generated from Nodarx/template
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 77f3babfc0 |
Generated
+34
-46
@@ -621,20 +621,20 @@
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
"version": "1.14.0",
|
||||
"version": "1.13.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/myclabs/DeepCopy.git",
|
||||
"reference": "8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae"
|
||||
"reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae",
|
||||
"reference": "8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a",
|
||||
"reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^8.0"
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/collections": "<1.6.8",
|
||||
@@ -669,15 +669,15 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/myclabs/DeepCopy/issues",
|
||||
"source": "https://github.com/myclabs/DeepCopy/tree/1.14.0"
|
||||
"source": "https://github.com/myclabs/DeepCopy/tree/1.13.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/mnapoli",
|
||||
"type": "github"
|
||||
"url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-08-11T10:17:44+00:00"
|
||||
"time": "2025-08-01T08:46:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
@@ -944,23 +944,23 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-file-iterator",
|
||||
"version": "6.0.2",
|
||||
"version": "6.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
|
||||
"reference": "a248d1640ab059b075f53a2ef0f9856e864e06b5"
|
||||
"reference": "3d1cd096ef6bea4bf2762ba586e35dbd317cbfd5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a248d1640ab059b075f53a2ef0f9856e864e06b5",
|
||||
"reference": "a248d1640ab059b075f53a2ef0f9856e864e06b5",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3d1cd096ef6bea4bf2762ba586e35dbd317cbfd5",
|
||||
"reference": "3d1cd096ef6bea4bf2762ba586e35dbd317cbfd5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^12.5.33"
|
||||
"phpunit/phpunit": "^12.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@@ -993,7 +993,7 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
|
||||
"security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/6.0.2"
|
||||
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/6.0.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -1013,7 +1013,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-08-25T14:40:53+00:00"
|
||||
"time": "2026-02-02T14:04:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-invoker",
|
||||
@@ -1201,16 +1201,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "12.5.34",
|
||||
"version": "12.5.31",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "6cbff63d670de92cb1cb3d2ff9f40327e9da9c7f"
|
||||
"reference": "0608d157a284f15cc73b99a3327eff06b66a176d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6cbff63d670de92cb1cb3d2ff9f40327e9da9c7f",
|
||||
"reference": "6cbff63d670de92cb1cb3d2ff9f40327e9da9c7f",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0608d157a284f15cc73b99a3327eff06b66a176d",
|
||||
"reference": "0608d157a284f15cc73b99a3327eff06b66a176d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1220,18 +1220,18 @@
|
||||
"ext-libxml": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"myclabs/deep-copy": "^1.14.0",
|
||||
"myclabs/deep-copy": "^1.13.4",
|
||||
"phar-io/manifest": "^2.0.4",
|
||||
"phar-io/version": "^3.2.1",
|
||||
"php": ">=8.3",
|
||||
"phpunit/php-code-coverage": "^12.5.7",
|
||||
"phpunit/php-file-iterator": "^6.0.2",
|
||||
"phpunit/php-file-iterator": "^6.0.1",
|
||||
"phpunit/php-invoker": "^6.0.0",
|
||||
"phpunit/php-text-template": "^5.0.0",
|
||||
"phpunit/php-timer": "^8.0.0",
|
||||
"sebastian/cli-parser": "^4.2.1",
|
||||
"sebastian/comparator": "^7.1.8",
|
||||
"sebastian/diff": "^7.0.1",
|
||||
"sebastian/diff": "^7.0.0",
|
||||
"sebastian/environment": "^8.1.2",
|
||||
"sebastian/exporter": "^7.0.3",
|
||||
"sebastian/global-state": "^8.0.3",
|
||||
@@ -1279,7 +1279,7 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.34"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.31"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -1287,7 +1287,7 @@
|
||||
"type": "other"
|
||||
}
|
||||
],
|
||||
"time": "2026-08-27T08:38:28+00:00"
|
||||
"time": "2026-07-06T14:54:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/cli-parser",
|
||||
@@ -1510,24 +1510,24 @@
|
||||
},
|
||||
{
|
||||
"name": "sebastian/diff",
|
||||
"version": "7.0.1",
|
||||
"version": "7.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/diff.git",
|
||||
"reference": "cd4cabe39f8a4e8ee6818ba99f10a05561ea4ad6"
|
||||
"reference": "7ab1ea946c012266ca32390913653d844ecd085f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/cd4cabe39f8a4e8ee6818ba99f10a05561ea4ad6",
|
||||
"reference": "cd4cabe39f8a4e8ee6818ba99f10a05561ea4ad6",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7ab1ea946c012266ca32390913653d844ecd085f",
|
||||
"reference": "7ab1ea946c012266ca32390913653d844ecd085f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^12.5.33",
|
||||
"symfony/process": "^7.4.17"
|
||||
"phpunit/phpunit": "^12.0",
|
||||
"symfony/process": "^7.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@@ -1565,27 +1565,15 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/diff/issues",
|
||||
"security": "https://github.com/sebastianbergmann/diff/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/diff/tree/7.0.1"
|
||||
"source": "https://github.com/sebastianbergmann/diff/tree/7.0.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sebastianbergmann",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://liberapay.com/sebastianbergmann",
|
||||
"type": "liberapay"
|
||||
},
|
||||
{
|
||||
"url": "https://thanks.dev/u/gh/sebastianbergmann",
|
||||
"type": "thanks_dev"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/sebastian/diff",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-08-25T15:35:54+00:00"
|
||||
"time": "2025-02-07T04:55:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/environment",
|
||||
@@ -2327,5 +2315,5 @@
|
||||
"platform-overrides": {
|
||||
"php": "8.3"
|
||||
},
|
||||
"plugin-api-version": "2.9.0"
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace KTXM\ProviderImap\Listeners;
|
||||
|
||||
use KTXC\User\Event\UserCreatedEvent;
|
||||
use KTXC\User\Event\UserDeletingEvent;
|
||||
use KTXM\ProviderImap\Stores\MessageStore;
|
||||
use KTXM\ProviderImap\Stores\ServiceStore;
|
||||
|
||||
final class UserEventListener
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ServiceStore $serviceStore,
|
||||
private readonly MessageStore $messageStore,
|
||||
) {
|
||||
}
|
||||
|
||||
public function onUserCreated(UserCreatedEvent $event): void
|
||||
{
|
||||
// TODO: implement provisioning configuration
|
||||
}
|
||||
|
||||
public function onUserDeleting(UserDeletingEvent $event): void
|
||||
{
|
||||
$tenantId = $event->tenantIdentifier();
|
||||
$userId = $event->userIdentifier();
|
||||
|
||||
foreach (array_keys($this->serviceStore->list($tenantId, $userId)) as $serviceId) {
|
||||
$this->messageStore->deleteByServiceId((string) $serviceId);
|
||||
}
|
||||
|
||||
$this->serviceStore->deleteByUser($tenantId, $userId);
|
||||
}
|
||||
}
|
||||
@@ -10,10 +10,6 @@ declare(strict_types=1);
|
||||
namespace KTXM\ProviderImap;
|
||||
|
||||
use KTXC\Resource\ProviderManager;
|
||||
use KTXC\User\Event\UserCreatedEvent;
|
||||
use KTXC\User\Event\UserDeletingEvent;
|
||||
use KTXF\Event\DeliveryMode;
|
||||
use KTXF\Event\EventListenerRegistrarInterface;
|
||||
use KTXF\Module\ModuleBrowserInterface;
|
||||
use KTXF\Module\ModuleConsoleInterface;
|
||||
use KTXF\Module\ModuleInstanceAbstract;
|
||||
@@ -22,7 +18,6 @@ use KTXM\ProviderImap\Console\ConnectCommand;
|
||||
use KTXM\ProviderImap\Console\DiscoverCommand;
|
||||
use KTXM\ProviderImap\Console\DisconnectCommand;
|
||||
use KTXM\ProviderImap\Console\TestCommand;
|
||||
use KTXM\ProviderImap\Listeners\UserEventListener;
|
||||
use KTXM\ProviderImap\Providers\Provider as MailProvider;
|
||||
|
||||
/**
|
||||
@@ -34,7 +29,6 @@ class Module extends ModuleInstanceAbstract implements ModuleConsoleInterface, M
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ProviderManager $providerManager,
|
||||
private readonly EventListenerRegistrarInterface $events,
|
||||
) {}
|
||||
|
||||
public function handle(): string
|
||||
@@ -75,10 +69,6 @@ class Module extends ModuleInstanceAbstract implements ModuleConsoleInterface, M
|
||||
|
||||
public function boot(): void
|
||||
{
|
||||
// Register listeners
|
||||
$this->events->listen($this->handle(), UserCreatedEvent::class, UserEventListener::class, 'onUserCreated', DeliveryMode::Deferred);
|
||||
$this->events->listen($this->handle(), UserDeletingEvent::class, UserEventListener::class, 'onUserDeleting', DeliveryMode::Deferred);
|
||||
// Register providers
|
||||
$this->providerManager->register(ProviderInterface::TYPE_MAIL, 'imap', MailProvider::class);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace KTXM\ProviderImap\Providers;
|
||||
|
||||
use KTXM\ProviderImap\Client\Message;
|
||||
use KTXF\Mail\Entity\EntityMutableAbstract;
|
||||
use KTXF\Mail\Object\MessagePropertiesMutableInterface;
|
||||
|
||||
/**
|
||||
* Mail Entity Resource Implementation
|
||||
@@ -43,26 +42,6 @@ class EntityResource extends EntityMutableAbstract {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate an entity returned by a create or replacement operation.
|
||||
*/
|
||||
public function fromMutation(
|
||||
string $mailbox,
|
||||
string|int $identifier,
|
||||
MessagePropertiesMutableInterface $properties,
|
||||
): static {
|
||||
$this->data['collection'] = $mailbox;
|
||||
$this->data['identifier'] = $identifier;
|
||||
|
||||
if ($properties instanceof MessageProperties) {
|
||||
$this->setProperties($properties);
|
||||
} else {
|
||||
$this->getProperties()->jsonDeserialize($properties->jsonSerialize());
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
||||
@@ -102,8 +102,8 @@ class Service implements ServiceBaseInterface, ServiceMutableInterface, ServiceC
|
||||
],
|
||||
self::CAPABILITY_ENTITY_FETCH => true,
|
||||
self::CAPABILITY_ENTITY_EXTANT => true,
|
||||
self::CAPABILITY_ENTITY_CREATE => true,
|
||||
self::CAPABILITY_ENTITY_MODIFY => true,
|
||||
self::CAPABILITY_ENTITY_CREATE => false,
|
||||
self::CAPABILITY_ENTITY_MODIFY => false,
|
||||
self::CAPABILITY_ENTITY_PATCH => true,
|
||||
self::CAPABILITY_ENTITY_DELETE => true,
|
||||
self::CAPABILITY_ENTITY_MOVE => true,
|
||||
@@ -675,27 +675,10 @@ class Service implements ServiceBaseInterface, ServiceMutableInterface, ServiceC
|
||||
// ignore — the message was already delivered
|
||||
}
|
||||
|
||||
// Best-effort: IMAP has no native "submit existing draft" operation, so the
|
||||
// message above was always sent fresh. If it originated from a synced draft,
|
||||
// remove the now-superseded draft UID. A failure here must not turn a
|
||||
// successful delivery into an error; the draft is simply left for a later
|
||||
// discard or retry.
|
||||
if ($source !== null
|
||||
&& $source->provider() === $this->provider()
|
||||
&& $source->service() === $this->identifier()) {
|
||||
try {
|
||||
$this->initialize();
|
||||
$this->remoteService->entityDestroy($source->collection(), (int) $source->entity());
|
||||
} catch (\Throwable) {
|
||||
// ignore — the message was already delivered
|
||||
}
|
||||
}
|
||||
|
||||
return new EntitySubmitResult(
|
||||
disposition: EntitySubmitResult::DISPOSITION_SENT,
|
||||
transportId: $queueId !== '' ? $queueId : null,
|
||||
sentEntity: $sentEntity,
|
||||
sourceDraft: $source instanceof EntityIdentifier ? $source : null,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -718,45 +701,12 @@ class Service implements ServiceBaseInterface, ServiceMutableInterface, ServiceC
|
||||
|
||||
public function entityCreate(CollectionIdentifier $target, MessagePropertiesMutableInterface $properties, array $options = []): EntityResource
|
||||
{
|
||||
if ($target->provider() !== $this->provider() || (string)$target->service() !== (string)$this->identifier()) {
|
||||
throw new \InvalidArgumentException('Target collection does not belong to this service: ' . (string)$target);
|
||||
}
|
||||
|
||||
$this->initialize();
|
||||
|
||||
[$nativeMessage, $nativeFlags] = $this->messagePayload($properties, $options);
|
||||
$created = $this->remoteService->entityCreate(
|
||||
(string)$target->collection(),
|
||||
$nativeMessage,
|
||||
$nativeFlags,
|
||||
);
|
||||
if ($created === null || $created <= 0) {
|
||||
throw new \RuntimeException('IMAP APPEND did not return a valid UID');
|
||||
}
|
||||
|
||||
return $this->entityFresh()->fromMutation((string)$target->collection(), $created, $properties);
|
||||
throw new \RuntimeException('Entity creation is not supported in this service');
|
||||
}
|
||||
|
||||
public function entityModify(EntityIdentifier $target, MessagePropertiesMutableInterface $properties): EntityResource
|
||||
{
|
||||
if ($target->provider() !== $this->provider() || (string)$target->service() !== (string)$this->identifier()) {
|
||||
throw new \InvalidArgumentException('Target entity does not belong to this service: ' . (string)$target);
|
||||
}
|
||||
|
||||
$this->initialize();
|
||||
|
||||
[$nativeMessage, $nativeFlags] = $this->messagePayload($properties);
|
||||
$modified = $this->remoteService->entityReplace(
|
||||
(string)$target->collection(),
|
||||
(int)$target->entity(),
|
||||
$nativeMessage,
|
||||
$nativeFlags,
|
||||
);
|
||||
if ($modified === null || $modified <= 0) {
|
||||
throw new \RuntimeException('IMAP replacement did not return a valid UID');
|
||||
}
|
||||
|
||||
return $this->entityFresh()->fromMutation((string)$target->collection(), $modified, $properties);
|
||||
throw new \RuntimeException('Entity modification is not supported in this service');
|
||||
}
|
||||
|
||||
public function entityPatch(MessagePropertiesMutableInterface $properties, EntityIdentifier ...$targets): array
|
||||
@@ -941,46 +891,5 @@ class Service implements ServiceBaseInterface, ServiceMutableInterface, ServiceC
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert canonical message flags to IMAP system flags.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
private function messageFlags(MessagePropertiesMutableInterface $properties): array
|
||||
{
|
||||
$flags = [];
|
||||
foreach ($properties->getFlags() as $flag => $enabled) {
|
||||
if ($enabled !== true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$flags[] = match (strtolower((string)$flag)) {
|
||||
'seen' => '\\Seen',
|
||||
'flagged' => '\\Flagged',
|
||||
'answered' => '\\Answered',
|
||||
'draft' => '\\Draft',
|
||||
'deleted' => '\\Deleted',
|
||||
default => (string)$flag,
|
||||
};
|
||||
}
|
||||
|
||||
return array_values(array_unique($flags));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert message properties into the native IMAP append payload.
|
||||
*
|
||||
* @return array{0: string, 1: string[]}
|
||||
*/
|
||||
private function messagePayload(MessagePropertiesMutableInterface $properties, array $options = []): array
|
||||
{
|
||||
$flags = $this->messageFlags($properties);
|
||||
if (isset($options['flags']) && is_array($options['flags'])) {
|
||||
$flags = array_values(array_unique([...$flags, ...$options['flags']]));
|
||||
}
|
||||
|
||||
return [(new MessageBuilder())->build($properties), $flags];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ class RemoteMailService
|
||||
return null;
|
||||
}
|
||||
|
||||
$logDir = dirname(__DIR__, 5) . '/var/logs/provider_imap';
|
||||
$logDir = dirname(__DIR__, 5) . '/var/log';
|
||||
|
||||
return new PlainFileLogger($logDir . '/' . $channel, $this->service->identifier());
|
||||
}
|
||||
@@ -490,44 +490,6 @@ class RemoteMailService
|
||||
return $this->imapClient()->perform(new AppendCommand($collection, $rawMessage, $flags));
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a replacement message, then permanently remove the superseded UID.
|
||||
* The replacement is removed on cleanup failure so the old UID remains
|
||||
* authoritative for a later retry.
|
||||
*
|
||||
* @param string[] $flags
|
||||
*/
|
||||
public function entityReplace(
|
||||
string $collection,
|
||||
int $identifier,
|
||||
string $rawMessage,
|
||||
array $flags = [],
|
||||
): ?int {
|
||||
if ($identifier <= 0) {
|
||||
throw new RuntimeException('A valid IMAP UID is required for replacement');
|
||||
}
|
||||
|
||||
$replacement = $this->entityCreate($collection, $rawMessage, $flags);
|
||||
if ($replacement === null || $replacement <= 0) {
|
||||
throw new RuntimeException('IMAP replacement append did not return a valid UID');
|
||||
}
|
||||
|
||||
try {
|
||||
$deleted = $this->entityDestroy($collection, $identifier);
|
||||
if (($deleted[$identifier] ?? false) !== true) {
|
||||
throw new RuntimeException('Failed to delete the superseded IMAP entity');
|
||||
}
|
||||
} catch (\Throwable $error) {
|
||||
try {
|
||||
$this->entityDestroy($collection, $replacement);
|
||||
} catch (\Throwable) {
|
||||
}
|
||||
throw $error;
|
||||
}
|
||||
|
||||
return $replacement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify message flags for one or more messages.
|
||||
*
|
||||
|
||||
@@ -177,15 +177,4 @@ class ServiceStore
|
||||
return $result->getDeletedCount() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete every service owned by a user.
|
||||
*/
|
||||
public function deleteByUser(string $tenantId, string $userId): void
|
||||
{
|
||||
$this->dataStore->selectCollection(self::COLLECTION_NAME)->deleteMany([
|
||||
'tid' => $tenantId,
|
||||
'uid' => $userId,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Generated
+47
-38
@@ -19,7 +19,7 @@
|
||||
"@vitest/coverage-v8": "^4.1.6",
|
||||
"@vue/test-utils": "^2.4.10",
|
||||
"@vue/tsconfig": "^0.9.0",
|
||||
"jsdom": "^29.1.1",
|
||||
"jsdom": "^30.0.0",
|
||||
"typescript": "~6.0.0",
|
||||
"vite": "^8.0.0",
|
||||
"vitest": "^4.1.6",
|
||||
@@ -27,48 +27,38 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@asamuzakjp/css-color": {
|
||||
"version": "5.1.11",
|
||||
"version": "6.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-6.0.5.tgz",
|
||||
"integrity": "sha512-mbhpPMmnw/kwW19aRNmSUl1QzLbdGo1SCuE49BT98MNwqF6zaHb3o2owssFc/PEO/4t2UjqtCNwocuDtJornzA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@asamuzakjp/generational-cache": "^1.0.1",
|
||||
"@csstools/css-calc": "^3.2.0",
|
||||
"@csstools/css-color-parser": "^4.1.0",
|
||||
"@csstools/css-calc": "^3.2.1",
|
||||
"@csstools/css-color-parser": "^4.1.9",
|
||||
"@csstools/css-parser-algorithms": "^4.0.0",
|
||||
"@csstools/css-tokenizer": "^4.0.0"
|
||||
"@csstools/css-tokenizer": "^4.0.0",
|
||||
"lru-cache": "^11.5.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
|
||||
"node": "^22.13.0 || >=24.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@asamuzakjp/dom-selector": {
|
||||
"version": "7.1.1",
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-8.3.0.tgz",
|
||||
"integrity": "sha512-UJLfKXBhrc8i1vH2eJXuYQMwlsLKWFw3O+CPqXSuVEiikeAim3UgrfWX0k4tA/X8cRFM8iZ7OaqBokFGbYusdg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@asamuzakjp/generational-cache": "^1.0.1",
|
||||
"@asamuzakjp/nwsapi": "^2.3.9",
|
||||
"bidi-js": "^1.0.3",
|
||||
"css-tree": "^3.2.1",
|
||||
"is-potential-custom-element-name": "^1.0.1"
|
||||
"is-potential-custom-element-name": "^1.0.1",
|
||||
"lru-cache": "^11.5.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
|
||||
"node": "^22.13.0 || >=24.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@asamuzakjp/generational-cache": {
|
||||
"version": "1.0.1",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@asamuzakjp/nwsapi": {
|
||||
"version": "2.3.9",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@babel/generator": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-8.0.0.tgz",
|
||||
@@ -1640,37 +1630,39 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/jsdom": {
|
||||
"version": "29.1.1",
|
||||
"version": "30.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsdom/-/jsdom-30.0.0.tgz",
|
||||
"integrity": "sha512-JQHfRGmmKmaZoUAvIgff5jjG/0SzTQlGz8c7t72KzBzo8ZULEjAjnYE0sNwBOUA4QtWwYE2xoYitg8NFsmiYxA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@asamuzakjp/css-color": "^5.1.11",
|
||||
"@asamuzakjp/dom-selector": "^7.1.1",
|
||||
"@asamuzakjp/css-color": "^6.0.5",
|
||||
"@asamuzakjp/dom-selector": "^8.2.5",
|
||||
"@bramus/specificity": "^2.4.2",
|
||||
"@csstools/css-syntax-patches-for-csstree": "^1.1.3",
|
||||
"@exodus/bytes": "^1.15.0",
|
||||
"@csstools/css-syntax-patches-for-csstree": "^1.1.6",
|
||||
"@exodus/bytes": "^1.15.1",
|
||||
"css-tree": "^3.2.1",
|
||||
"data-urls": "^7.0.0",
|
||||
"decimal.js": "^10.6.0",
|
||||
"html-encoding-sniffer": "^6.0.0",
|
||||
"is-potential-custom-element-name": "^1.0.1",
|
||||
"lru-cache": "^11.3.5",
|
||||
"lru-cache": "^11.5.2",
|
||||
"parse5": "^8.0.1",
|
||||
"saxes": "^6.0.0",
|
||||
"symbol-tree": "^3.2.4",
|
||||
"tough-cookie": "^6.0.1",
|
||||
"undici": "^7.25.0",
|
||||
"tough-cookie": "^6.0.2",
|
||||
"undici": "^8.7.0",
|
||||
"w3c-xmlserializer": "^5.0.0",
|
||||
"webidl-conversions": "^8.0.1",
|
||||
"whatwg-mimetype": "^5.0.0",
|
||||
"whatwg-url": "^16.0.1",
|
||||
"whatwg-url": "^17.1.0",
|
||||
"xml-name-validator": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20.19.0 || ^22.13.0 || >=24.0.0"
|
||||
"node": "^22.22.2 || ^24.15.0 || >=26.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"canvas": "^3.0.0"
|
||||
"canvas": "^3.2.3"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"canvas": {
|
||||
@@ -1678,6 +1670,21 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/jsdom/node_modules/whatwg-url": {
|
||||
"version": "17.1.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-17.1.0.tgz",
|
||||
"integrity": "sha512-3GeworPmc2ZfEEHP7lEbUfBX/L75wdEsi0rLNhXcXxnoN5jyq0SL5gCy06SGW2cyTIZdTvWIDQNQoza++vKeaw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@exodus/bytes": "^1.15.1",
|
||||
"tr46": "^6.0.0",
|
||||
"webidl-conversions": "^8.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^22.14.0 || >=24.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/jsesc": {
|
||||
"version": "3.1.0",
|
||||
"license": "MIT",
|
||||
@@ -2640,11 +2647,13 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "7.28.0",
|
||||
"version": "8.9.0",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-8.9.0.tgz",
|
||||
"integrity": "sha512-aWZpUj7XoGonMClx4gdDRfgBjqeA+F473aDmROQQbM9n6PRfK/u1q/a0X4wMTgcHfT8H6fpbt98PFuDUwFg2YA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=20.18.1"
|
||||
"node": ">=22.19.0"
|
||||
}
|
||||
},
|
||||
"node_modules/unplugin": {
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@
|
||||
"vue-tsc": "^3.0.5",
|
||||
"@vitest/coverage-v8": "^4.1.6",
|
||||
"@vue/test-utils": "^2.4.10",
|
||||
"jsdom": "^29.1.1",
|
||||
"jsdom": "^30.0.0",
|
||||
"vitest": "^4.1.6"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace KTXT\ProviderImap\Tests\Unit;
|
||||
|
||||
use KTXM\ProviderImap\Providers\Service;
|
||||
use KTXM\ProviderImap\Service\Remote\RemoteMailService;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use RuntimeException;
|
||||
|
||||
final class RemoteMailServiceTest extends TestCase {
|
||||
|
||||
public function testEntityReplaceReturnsAuthoritativeReplacementUid(): void {
|
||||
$service = new RemoteMailServiceStub($this->createStub(Service::class));
|
||||
$service->appendUid = 202;
|
||||
$service->destroyResults = [[101 => true]];
|
||||
|
||||
$result = $service->entityReplace('Drafts', 101, 'raw message', ['\\Draft']);
|
||||
|
||||
$this->assertSame(202, $result);
|
||||
$this->assertSame([
|
||||
['Drafts', 'raw message', ['\\Draft']],
|
||||
], $service->createCalls);
|
||||
$this->assertSame([
|
||||
['Drafts', [101]],
|
||||
], $service->destroyCalls);
|
||||
}
|
||||
|
||||
public function testEntityReplaceRemovesReplacementWhenOldUidCannotBeDeleted(): void {
|
||||
$service = new RemoteMailServiceStub($this->createStub(Service::class));
|
||||
$service->appendUid = 202;
|
||||
$service->destroyResults = [
|
||||
[101 => false],
|
||||
[202 => true],
|
||||
];
|
||||
|
||||
try {
|
||||
$service->entityReplace('Drafts', 101, 'raw message', ['\\Draft']);
|
||||
$this->fail('Expected superseded message cleanup failure');
|
||||
} catch (RuntimeException $exception) {
|
||||
$this->assertSame('Failed to delete the superseded IMAP entity', $exception->getMessage());
|
||||
}
|
||||
|
||||
$this->assertSame([
|
||||
['Drafts', [101]],
|
||||
['Drafts', [202]],
|
||||
], $service->destroyCalls);
|
||||
}
|
||||
}
|
||||
|
||||
final class RemoteMailServiceStub extends RemoteMailService {
|
||||
|
||||
public ?int $appendUid = null;
|
||||
public array $createCalls = [];
|
||||
public array $destroyCalls = [];
|
||||
public array $destroyResults = [];
|
||||
|
||||
public function entityCreate(string $collection, string $rawMessage, array $flags = []): ?int {
|
||||
$this->createCalls[] = [$collection, $rawMessage, $flags];
|
||||
return $this->appendUid;
|
||||
}
|
||||
|
||||
public function entityDestroy(string $collection, int ...$uids): array {
|
||||
$this->destroyCalls[] = [$collection, $uids];
|
||||
return array_shift($this->destroyResults) ?? [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user