9 Commits

Author SHA1 Message Date
Sebastian 06c1cb272f chore(deps): update dependency symfony/console to v7.4.14
Build Test / build (pull_request) Failing after 10m14s
PHP Unit Tests / test (pull_request) Failing after 14m56s
JS Unit Tests / test (pull_request) Failing after 14m58s
2026-07-02 03:02:40 +00:00
Sebastian 8f61c4d2d5 refactor: chrono objects
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
2026-06-28 17:51:23 -04:00
Sebastian 319fcb6485 Merge pull request 'chore(deps): update dependency prettier to v3.8.4' (#107) from renovate/prettier-3.x-lockfile into main
Reviewed-on: #107
2026-06-28 14:42:46 +00:00
Sebastian 18478f9985 Merge pull request 'chore(deps): update dependency phpseclib/phpseclib to v3.0.55' (#106) from renovate/phpseclib-phpseclib-3.x-lockfile into main
Reviewed-on: #106
2026-06-28 14:42:36 +00:00
Sebastian 139b4df844 refactor: use seen instead of read
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
2026-06-25 23:47:52 -04:00
Sebastian a7ad86860d refactor: use unified service provider desing
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
2026-06-25 23:47:24 -04:00
Sebastian 6ca83a7dd7 refactor: use unified service provider desing
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
2026-06-25 23:47:17 -04:00
Sebastian 6a3e1f309e chore(deps): update dependency prettier to v3.8.4
PHP Unit Tests / test (pull_request) Failing after 13m54s
JS Unit Tests / test (pull_request) Failing after 13m56s
Build Test / build (pull_request) Failing after 14m6s
2026-06-25 03:02:46 +00:00
Sebastian 4d4999602c chore(deps): update dependency phpseclib/phpseclib to v3.0.55
PHP Unit Tests / test (pull_request) Failing after 14m35s
JS Unit Tests / test (pull_request) Failing after 14m37s
Build Test / build (pull_request) Failing after 14m45s
2026-06-25 03:02:45 +00:00
66 changed files with 448 additions and 212 deletions
Generated
+13 -13
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "a6a858359fbae2f77ad84becd3a98261", "content-hash": "2be56ca7c02be4eaab844d529fd1b0a5",
"packages": [ "packages": [
{ {
"name": "laravel/serializable-closure", "name": "laravel/serializable-closure",
@@ -393,16 +393,16 @@
}, },
{ {
"name": "phpseclib/phpseclib", "name": "phpseclib/phpseclib",
"version": "3.0.52", "version": "3.0.55",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpseclib/phpseclib.git", "url": "https://github.com/phpseclib/phpseclib.git",
"reference": "2adaefc83df2ec548558307690f376dd7d4f4fce" "reference": "db9744e6d47e742b1f974e965ad49bdd041105af"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/2adaefc83df2ec548558307690f376dd7d4f4fce", "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/db9744e6d47e742b1f974e965ad49bdd041105af",
"reference": "2adaefc83df2ec548558307690f376dd7d4f4fce", "reference": "db9744e6d47e742b1f974e965ad49bdd041105af",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -483,7 +483,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/phpseclib/phpseclib/issues", "issues": "https://github.com/phpseclib/phpseclib/issues",
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.52" "source": "https://github.com/phpseclib/phpseclib/tree/3.0.55"
}, },
"funding": [ "funding": [
{ {
@@ -499,7 +499,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2026-04-27T07:02:15+00:00" "time": "2026-06-14T23:24:10+00:00"
}, },
{ {
"name": "psr/container", "name": "psr/container",
@@ -606,16 +606,16 @@
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v7.4.13", "version": "v7.4.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "85095d2573eaefaf35e40b9513a9bf09f72cd217" "reference": "92f58bc4bf97a92ed1b9f367f0cd44f20bde0e87"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/85095d2573eaefaf35e40b9513a9bf09f72cd217", "url": "https://api.github.com/repos/symfony/console/zipball/92f58bc4bf97a92ed1b9f367f0cd44f20bde0e87",
"reference": "85095d2573eaefaf35e40b9513a9bf09f72cd217", "reference": "92f58bc4bf97a92ed1b9f367f0cd44f20bde0e87",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -680,7 +680,7 @@
"terminal" "terminal"
], ],
"support": { "support": {
"source": "https://github.com/symfony/console/tree/v7.4.13" "source": "https://github.com/symfony/console/tree/v7.4.14"
}, },
"funding": [ "funding": [
{ {
@@ -700,7 +700,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2026-05-24T08:56:14+00:00" "time": "2026-06-16T11:50:14+00:00"
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
+3 -3
View File
@@ -4951,9 +4951,9 @@
} }
}, },
"node_modules/prettier": { "node_modules/prettier": {
"version": "3.8.3", "version": "3.8.4",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.3.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.4.tgz",
"integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==", "integrity": "sha512-N2MylSdi48+5N/6S5j+maeHbUSIzzZ5uOcX5Hm4QpV8Dkb1HFjfAKTKX6yNPJQD9AhcT3ifHNB66tWTTJDi11Q==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"bin": { "bin": {
@@ -40,6 +40,10 @@ abstract class CollectionMutableAbstract extends NodeMutableAbstract implements
// Copy all property values // Copy all property values
$this->properties->setLabel($value->getLabel()); $this->properties->setLabel($value->getLabel());
$this->properties->setDescription($value->getDescription());
$this->properties->setRank($value->getRank());
$this->properties->setVisibility($value->getVisibility());
$this->properties->setColor($value->getColor());
return $this; return $this;
} }
@@ -20,22 +20,18 @@ use KTXF\Resource\Provider\Node\NodePropertiesBaseAbstract;
*/ */
abstract class CollectionPropertiesBaseAbstract extends NodePropertiesBaseAbstract implements CollectionPropertiesBaseInterface { abstract class CollectionPropertiesBaseAbstract extends NodePropertiesBaseAbstract implements CollectionPropertiesBaseInterface {
public const JSON_TYPE = CollectionPropertiesBaseInterface::JSON_TYPE;
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function content(): CollectionContent { public function content(): array {
$content = $this->data[self::PROPERTY_CONTENTS] ?? null; $content = $this->data[self::PROPERTY_CONTENT] ?? null;
if ($content instanceof CollectionContent) { if (is_array($content)) {
return $content; return array_filter(array_map(function ($item) {
return $item instanceof CollectionContent ? $item : CollectionContent::tryFrom($item);
}, $content));
} else {
return [];
} }
if (is_string($content)) {
return CollectionContent::tryFrom($content) ?? CollectionContent::Event;
}
return CollectionContent::Event;
} }
/** /**
@@ -55,8 +51,8 @@ abstract class CollectionPropertiesBaseAbstract extends NodePropertiesBaseAbstra
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function getPriority(): ?int { public function getRank(): ?int {
return $this->data[self::PROPERTY_PRIORITY] ?? null; return $this->data[self::PROPERTY_RANK] ?? null;
} }
/** /**
@@ -14,15 +14,22 @@ use KTXF\Resource\Provider\Node\NodePropertiesBaseInterface;
interface CollectionPropertiesBaseInterface extends NodePropertiesBaseInterface { interface CollectionPropertiesBaseInterface extends NodePropertiesBaseInterface {
public const JSON_TYPE = 'chrono:collection'; public const JSON_TYPE = 'chrono:collection';
public const PROPERTY_CONTENTS = 'content'; public const PROPERTY_CONTENT = 'content';
public const PROPERTY_LABEL = 'label'; public const PROPERTY_LABEL = 'label';
public const PROPERTY_DESCRIPTION = 'description'; public const PROPERTY_DESCRIPTION = 'description';
public const PROPERTY_PRIORITY = 'priority'; public const PROPERTY_RANK = 'rank';
public const PROPERTY_VISIBILITY = 'visibility'; public const PROPERTY_VISIBILITY = 'visibility';
public const PROPERTY_COLOR = 'color'; public const PROPERTY_COLOR = 'color';
public function content(): CollectionContent; /**
* Gets the content type of this collection
*
* @since 2025.05.01
*
* @return CollectionContent[] Returns an array of content types, a single content type, or null if not set
*/
public function content(): array;
/** /**
* Gets the human friendly name of this collection (e.g. Personal Calendar) * Gets the human friendly name of this collection (e.g. Personal Calendar)
@@ -39,11 +46,11 @@ interface CollectionPropertiesBaseInterface extends NodePropertiesBaseInterface
public function getDescription(): ?string; public function getDescription(): ?string;
/** /**
* Gets the priority of this collection * Gets the rank of this collection
* *
* @since 2025.05.01 * @since 2025.05.01
*/ */
public function getPriority(): ?int; public function getRank(): ?int;
/** /**
* Gets the visibility of this collection * Gets the visibility of this collection
@@ -48,8 +48,8 @@ abstract class CollectionPropertiesMutableAbstract extends CollectionPropertiesB
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function setPriority(?int $value): static { public function setRank(?int $value): static {
$this->data[self::PROPERTY_PRIORITY] = $value; $this->data[self::PROPERTY_RANK] = $value;
return $this; return $this;
} }
@@ -30,11 +30,11 @@ interface CollectionPropertiesMutableInterface extends CollectionPropertiesBaseI
public function setDescription(?string $value): static; public function setDescription(?string $value): static;
/** /**
* Sets the priority of this collection * Sets the rank of this collection
* *
* @since 2025.05.01 * @since 2025.05.01
*/ */
public function setPriority(?int $value): static; public function setRank(?int $value): static;
/** /**
* Sets the visibility of this collection * Sets the visibility of this collection
@@ -9,18 +9,24 @@ declare(strict_types=1);
namespace KTXF\Chrono\Entity; namespace KTXF\Chrono\Entity;
use KTXF\Resource\Identifier\EntityIdentifier;
use KTXF\Resource\Provider\Node\NodeBaseAbstract; use KTXF\Resource\Provider\Node\NodeBaseAbstract;
/** /**
* Abstract Chrono Entity Base Class * Abstract Chrono Entity Base Class
* *
* Provides common implementation for chrono entities * Provides common implementation for chrono entities
* *
* @since 2025.05.01 * @since 2025.05.01
*/ */
abstract class EntityBaseAbstract extends NodeBaseAbstract implements EntityBaseInterface { abstract class EntityBaseAbstract extends NodeBaseAbstract implements EntityBaseInterface {
protected EntityPropertiesBaseAbstract $properties; protected string $type = 'chrono:entity';
protected EntityPropertiesBaseInterface $properties;
protected function nodeIdentifier(): EntityIdentifier {
return new EntityIdentifier($this->data[static::PROPERTY_PROVIDER], $this->data[static::PROPERTY_SERVICE], $this->data[static::PROPERTY_COLLECTION], $this->data[static::PROPERTY_IDENTIFIER]);
}
/** /**
* @inheritDoc * @inheritDoc
@@ -13,8 +13,6 @@ use KTXF\Resource\Provider\Node\NodeBaseInterface;
interface EntityBaseInterface extends NodeBaseInterface { interface EntityBaseInterface extends NodeBaseInterface {
public const JSON_TYPE = 'chrono.entity';
/** /**
* Gets the entity properties * Gets the entity properties
* *
@@ -9,21 +9,25 @@ declare(strict_types=1);
namespace KTXF\Chrono\Entity; namespace KTXF\Chrono\Entity;
use KTXF\Resource\Identifier\EntityIdentifier;
use KTXF\Resource\Provider\Node\NodeMutableAbstract; use KTXF\Resource\Provider\Node\NodeMutableAbstract;
use KTXF\Resource\Provider\Node\NodePropertiesMutableInterface; use KTXF\Resource\Provider\Node\NodePropertiesMutableInterface;
/** /**
* Abstract Chrono Entity Mutable Class * Abstract Chrono Entity Mutable Class
* *
* Provides common implementation for mutable chrono entities * Provides common implementation for mutable chrono entities
* *
* @since 2025.05.01 * @since 2025.05.01
*/ */
abstract class EntityMutableAbstract extends NodeMutableAbstract implements EntityMutableInterface { abstract class EntityMutableAbstract extends NodeMutableAbstract implements EntityMutableInterface {
public const JSON_TYPE = EntityMutableInterface::JSON_TYPE; protected string $type = 'chrono:entity';
protected EntityPropertiesMutableInterface $properties;
protected EntityPropertiesMutableAbstract $properties; protected function nodeIdentifier(): EntityIdentifier {
return new EntityIdentifier($this->data[static::PROPERTY_PROVIDER], $this->data[static::PROPERTY_SERVICE], (string) $this->data[static::PROPERTY_COLLECTION], (string) $this->data[static::PROPERTY_IDENTIFIER]);
}
/** /**
* @inheritDoc * @inheritDoc
@@ -40,7 +44,7 @@ abstract class EntityMutableAbstract extends NodeMutableAbstract implements Enti
throw new \InvalidArgumentException('Properties must implement EntityPropertiesMutableInterface'); throw new \InvalidArgumentException('Properties must implement EntityPropertiesMutableInterface');
} }
$this->properties->setDataRaw($value->getDataRaw()); $this->properties = $value;
return $this; return $this;
} }
@@ -16,8 +16,6 @@ use KTXF\Resource\Provider\Node\NodeMutableInterface;
*/ */
interface EntityMutableInterface extends EntityBaseInterface, NodeMutableInterface { interface EntityMutableInterface extends EntityBaseInterface, NodeMutableInterface {
public const JSON_TYPE = EntityBaseInterface::JSON_TYPE;
/** /**
* Gets the entity properties (mutable) * Gets the entity properties (mutable)
* *
@@ -13,8 +13,9 @@ use KTXF\Resource\Provider\Node\NodePropertiesBaseAbstract;
abstract class EntityPropertiesBaseAbstract extends NodePropertiesBaseAbstract implements EntityPropertiesBaseInterface { abstract class EntityPropertiesBaseAbstract extends NodePropertiesBaseAbstract implements EntityPropertiesBaseInterface {
public const JSON_TYPE = EntityPropertiesBaseInterface::JSON_TYPE; /**
* @inheritDoc
*/
public function getDataRaw(): array|string|null { public function getDataRaw(): array|string|null {
return $this->data[self::PROPERTY_DATA] ?? null; return $this->data[self::PROPERTY_DATA] ?? null;
} }
@@ -13,8 +13,6 @@ use KTXF\Resource\Provider\Node\NodePropertiesMutableInterface;
interface EntityPropertiesMutableInterface extends EntityPropertiesBaseInterface, NodePropertiesMutableInterface { interface EntityPropertiesMutableInterface extends EntityPropertiesBaseInterface, NodePropertiesMutableInterface {
public const JSON_TYPE = EntityPropertiesBaseInterface::JSON_TYPE;
public function setDataRaw(array|string|null $value): static; public function setDataRaw(array|string|null $value): static;
} }
@@ -7,9 +7,12 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity;
use DateTimeInterface; use DateTimeInterface;
use KTXF\Chrono\Entity\Property\EventCommonObject;
use KTXF\Chrono\Entity\Property\EventMutationCollection;
use KTXF\Chrono\Entity\Property\EventOccurrenceObject;
class EventObject extends EventCommonObject { class EventObject extends EventCommonObject {
@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity;
use DateTimeInterface;
use KTXF\Chrono\Entity\Property\AttachmentCollection;
use KTXF\Chrono\Entity\Property\JournalStatusTypes;
use KTXF\Chrono\Entity\Property\JournalVisibilityTypes;
use KTXF\Chrono\Entity\Property\TagCollection;
use KTXF\Json\JsonSerializableObject;
class JournalObject extends JsonSerializableObject {
public string $type = 'journal';
public int $version = 1;
public ?string $urid = null;
public ?DateTimeInterface $created = null;
public ?DateTimeInterface $modified = null;
public ?string $label = null;
public ?string $description = null;
public TagCollection $tags;
public ?string $content = null;
public ?DateTimeInterface $startsOn = null;
public ?DateTimeInterface $endsOn = null;
public ?JournalStatusTypes $status = null;
public ?JournalVisibilityTypes $visibility = null;
public AttachmentCollection $attachments;
public function __construct() {
$this->tags = new TagCollection();
$this->attachments = new AttachmentCollection();
}
}
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableCollection;
class AttachmentCollection extends JsonSerializableCollection {
public function __construct(array $data = []) {
parent::__construct($data, AttachmentObject::class, 'string');
}
}
@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableObject;
class AttachmentObject extends JsonSerializableObject {
public ?string $uri = null;
public ?string $type = null;
public ?string $label = null;
public ?int $priority = null;
}
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
enum EventAvailabilityTypes: string { enum EventAvailabilityTypes: string {
case Free = 'free'; case Free = 'free';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
use DateInterval; use DateInterval;
use DateTime; use DateTime;
@@ -33,7 +33,7 @@ class EventCommonObject extends JsonSerializableObject {
public EventSensitivityTypes|null $sensitivity = null; public EventSensitivityTypes|null $sensitivity = null;
public int|null $priority = null; public int|null $priority = null;
public string|null $color = null; public string|null $color = null;
public EventTagCollection $tags; public TagCollection $tags;
public EventOrganizerObject $organizer; public EventOrganizerObject $organizer;
public EventParticipantCollection $participants; public EventParticipantCollection $participants;
public EventNotificationCollection $notifications; public EventNotificationCollection $notifications;
@@ -44,7 +44,7 @@ class EventCommonObject extends JsonSerializableObject {
$this->locationsVirtual = new EventLocationVirtualCollection(); $this->locationsVirtual = new EventLocationVirtualCollection();
$this->notifications = new EventNotificationCollection(); $this->notifications = new EventNotificationCollection();
$this->organizer = new EventOrganizerObject(); $this->organizer = new EventOrganizerObject();
$this->tags = new EventTagCollection(); $this->tags = new TagCollection();
} }
} }
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableCollection; use KTXF\Json\JsonSerializableCollection;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableObject; use KTXF\Json\JsonSerializableObject;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableCollection; use KTXF\Json\JsonSerializableCollection;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableObject; use KTXF\Json\JsonSerializableObject;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableCollection; use KTXF\Json\JsonSerializableCollection;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
use DateTime; use DateTime;
use DateTimeImmutable; use DateTimeImmutable;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
enum EventNotificationAnchorTypes: string { enum EventNotificationAnchorTypes: string {
case Start = 'start'; case Start = 'start';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableCollection; use KTXF\Json\JsonSerializableCollection;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
use DateInterval; use DateInterval;
use DateTime; use DateTime;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
enum EventNotificationPatterns: string { enum EventNotificationPatterns: string {
case Absolute = 'absolute'; case Absolute = 'absolute';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
enum EventNotificationTypes: string { enum EventNotificationTypes: string {
case Visual = 'visual'; case Visual = 'visual';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
use DateTime; use DateTime;
use DateTimeImmutable; use DateTimeImmutable;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
enum EventOccurrencePatternTypes: string { enum EventOccurrencePatternTypes: string {
case Absolute = 'absolute'; case Absolute = 'absolute';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
enum EventOccurrencePrecisionTypes: string { enum EventOccurrencePrecisionTypes: string {
case Yearly = 'yearly'; case Yearly = 'yearly';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableObject; use KTXF\Json\JsonSerializableObject;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableCollection; use KTXF\Json\JsonSerializableCollection;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableObject; use KTXF\Json\JsonSerializableObject;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
enum EventParticipantRealm: string { enum EventParticipantRealm: string {
case Internal = 'I'; case Internal = 'I';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableCollection; use KTXF\Json\JsonSerializableCollection;
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
enum EventParticipantRoleTypes: string { enum EventParticipantRoleTypes: string {
case Owner = 'owner'; case Owner = 'owner';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
enum EventParticipantStatusTypes: string { enum EventParticipantStatusTypes: string {
case None = 'none'; case None = 'none';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
enum EventParticipantTypes: string { enum EventParticipantTypes: string {
case Unknown = 'unknown'; case Unknown = 'unknown';
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
namespace KTXF\Chrono\Event; namespace KTXF\Chrono\Entity\Property;
enum EventSensitivityTypes: string { enum EventSensitivityTypes: string {
case Public = 'public'; case Public = 'public';
@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity\Property;
enum JournalStatusTypes: string {
case Draft = 'draft';
case Final = 'final';
case Cancelled = 'cancelled';
}
@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity\Property;
enum JournalVisibilityTypes: string {
case Public = 'public';
case Private = 'private';
case Confidential = 'confidential';
}
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableCollection;
class TagCollection extends JsonSerializableCollection {
public function __construct(array $data = []) {
parent::__construct($data, 'string');
}
}
@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity\Property;
use DateTimeInterface;
use KTXF\Json\JsonSerializableObject;
class TaskRecurrenceObject extends JsonSerializableObject {
public ?string $frequency = null;
public ?int $interval = null;
public ?int $count = null;
public ?DateTimeInterface $until = null;
public array $byDay = [];
public array $byMonthDay = [];
public array $byMonth = [];
}
@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity\Property;
enum TaskStatusTypes: string {
case NeedsAction = 'needs-action';
case InProcess = 'in-process';
case Completed = 'completed';
case Cancelled = 'cancelled';
}
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableCollection;
class TaskSubtaskCollection extends JsonSerializableCollection {
public function __construct(array $data = []) {
parent::__construct($data, TaskSubtaskObject::class, 'string');
}
}
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity\Property;
use KTXF\Json\JsonSerializableObject;
class TaskSubtaskObject extends JsonSerializableObject {
public ?string $label = null;
public bool $completed = false;
public ?int $priority = null;
}
+41
View File
@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace KTXF\Chrono\Entity;
use DateTimeInterface;
use KTXF\Chrono\Entity\Property\AttachmentCollection;
use KTXF\Chrono\Entity\Property\TagCollection;
use KTXF\Chrono\Entity\Property\TaskRecurrenceObject;
use KTXF\Chrono\Entity\Property\TaskStatusTypes;
use KTXF\Chrono\Entity\Property\TaskSubtaskCollection;
use KTXF\Json\JsonSerializableObject;
class TaskObject extends JsonSerializableObject {
public string $type = 'task';
public int $version = 1;
public ?string $urid = null;
public ?DateTimeInterface $created = null;
public ?DateTimeInterface $modified = null;
public ?string $label = null;
public ?string $description = null;
public TagCollection $tags;
public ?DateTimeInterface $startsOn = null;
public ?DateTimeInterface $dueOn = null;
public ?DateTimeInterface $completedOn = null;
public ?TaskStatusTypes $status = null;
public ?int $priority = null;
public ?int $progress = null;
public ?string $color = null;
public ?TaskRecurrenceObject $recurrence = null;
public TaskSubtaskCollection $subtasks;
public AttachmentCollection $attachments;
public ?string $notes = null;
public function __construct() {
$this->tags = new TagCollection();
$this->subtasks = new TaskSubtaskCollection();
$this->attachments = new AttachmentCollection();
}
}
@@ -1,20 +0,0 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Chrono\Event;
use KTXF\Json\JsonSerializableCollection;
class EventTagCollection extends JsonSerializableCollection {
public function __construct(array $data = []) {
parent::__construct($data, 'string');
}
}
@@ -12,7 +12,7 @@ namespace KTXF\Chrono\Provider;
use KTXF\Resource\Provider\ResourceProviderBaseInterface; use KTXF\Resource\Provider\ResourceProviderBaseInterface;
/** /**
* Chrono Provider Base Interface * Provider Base Interface
* *
* @since 2025.05.01 * @since 2025.05.01
*/ */
@@ -12,11 +12,9 @@ namespace KTXF\Chrono\Provider;
use KTXF\Resource\Provider\ResourceProviderServiceMutateInterface; use KTXF\Resource\Provider\ResourceProviderServiceMutateInterface;
/** /**
* Chrono Provider Service Mutate Interface * Provider Service Mutate Interface
* *
* Optional interface for providers that support service CRUD operations. * Optional interface for providers that support service CRUD operations
*
* Implementations return ServiceMutableInterface instances (which extend ResourceServiceMutateInterface).
* *
* @since 2025.05.01 * @since 2025.05.01
* *
@@ -25,11 +23,8 @@ use KTXF\Resource\Provider\ResourceProviderServiceMutateInterface;
* @method string serviceModify(string $tenantId, ?string $userId, ServiceMutableInterface $service) Modify a chrono service configuration * @method string serviceModify(string $tenantId, ?string $userId, ServiceMutableInterface $service) Modify a chrono service configuration
* @method bool serviceDestroy(string $tenantId, ?string $userId, ServiceMutableInterface $service) Delete a chrono service configuration * @method bool serviceDestroy(string $tenantId, ?string $userId, ServiceMutableInterface $service) Delete a chrono service configuration
*/ */
interface ProviderServiceMutateInterface extends ProviderBaseInterface, ResourceProviderServiceMutateInterface { interface ProviderServiceMutateInterface extends ResourceProviderServiceMutateInterface {
public const JSON_TYPE = ProviderBaseInterface::JSON_TYPE;
// Methods inherited from ResourceProviderServiceMutateInterface
// Implementations should return/accept ServiceMutableInterface instances
// Methods inherited from ResourceProviderServiceMutateInterface
} }
@@ -10,36 +10,27 @@ declare(strict_types=1);
namespace KTXF\Chrono\Provider; namespace KTXF\Chrono\Provider;
use KTXF\Chrono\Service\ServiceBaseInterface; use KTXF\Chrono\Service\ServiceBaseInterface;
use KTXF\Chrono\Service\ServiceMutableInterface;
/** /**
* Chrono Provider Service Test Interface * Provider Service Test Interface
* *
* Optional interface for chrono providers that support testing service connections. * Optional interface for providers that support testing service connections
* Providers implementing this interface can validate connection parameters,
* test authentication, and verify service availability before creating a
* persistent service configuration.
*
* Supports two testing modes:
* 1. Testing an existing service (validate current configuration)
* 2. Testing a fresh configuration (validate before saving)
* *
* @since 2025.05.01 * @since 2025.05.01
*/ */
interface ProviderServiceTestInterface extends ProviderBaseInterface { interface ProviderServiceTestInterface {
public const CAPABILITY_SERVICE_TEST = 'ServiceTest';
/** /**
* Test a service connection * Test a service connection
* *
* Tests connectivity, authentication, and capabilities of a service. * Tests connectivity, authentication, and capabilities of a service
*
* For new services: use serviceFresh() to create a service, configure it with
* setters, then pass it to this method for testing before persisting.
*
* For existing services: fetch the service and pass it directly.
* *
* @since 2025.05.01 * @since 2025.05.01
* *
* @param ServiceBaseInterface $service Service to test (can be fresh/unsaved or existing) * @param ServiceBaseInterface|ServiceMutableInterface $service Service to test (can be fresh/unsaved or existing)
* @param array $options Provider-specific test options: * @param array $options Provider-specific test options:
* - 'timeout' => int (seconds, default: 10) * - 'timeout' => int (seconds, default: 10)
* - 'verify_ssl' => bool (default: true) * - 'verify_ssl' => bool (default: true)
@@ -48,10 +39,10 @@ interface ProviderServiceTestInterface extends ProviderBaseInterface {
* *
* @return array Test results in the format: * @return array Test results in the format:
* [ * [
* 'success' => bool, * 'disposition' => 'Success' | 'Failure' | 'Warning',
* 'message' => 'Connection successful' | 'Error message' * 'message' => 'Connection successful' | 'Error message',
* ] * ]
*/ */
public function serviceTest(ServiceBaseInterface $service, array $options = []): array; public function serviceTest(ServiceBaseInterface|ServiceMutableInterface $service, array $options = []): array;
} }
@@ -9,16 +9,21 @@ declare(strict_types=1);
namespace KTXF\Chrono\Service; namespace KTXF\Chrono\Service;
use Generator;
use KTXF\Chrono\Collection\CollectionBaseInterface; use KTXF\Chrono\Collection\CollectionBaseInterface;
use KTXF\Chrono\Entity\EntityBaseInterface;
use KTXF\Resource\Delta\Delta; use KTXF\Resource\Delta\Delta;
use KTXF\Resource\Filter\IFilter; use KTXF\Resource\Filter\IFilter;
use KTXF\Resource\Identifier\EntityIdentifierInterface;
use KTXF\Resource\Provider\ResourceServiceBaseInterface; use KTXF\Resource\Provider\ResourceServiceBaseInterface;
use KTXF\Resource\Range\IRange; use KTXF\Resource\Range\IRange;
use KTXF\Resource\Range\RangeType; use KTXF\Resource\Range\RangeType;
use KTXF\Resource\Sort\ISort; use KTXF\Resource\Sort\ISort;
/** /**
* Chrono Service Base Interface * Service Base Interface
*
* Minimum interface for a service, providing read-only access to collections and entities.
* *
* @since 2025.05.01 * @since 2025.05.01
*/ */
@@ -70,7 +75,7 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
* @param IFilter|null $filter Optional filter criteria * @param IFilter|null $filter Optional filter criteria
* @param ISort|null $sort Optional sort order * @param ISort|null $sort Optional sort order
* *
* @return array<string|int,CollectionBaseInterface> Collections indexed by ID * @return array<string|int,CollectionBaseInterface> Collections indexed by identifier
*/ */
public function collectionList(string|int $location, ?IFilter $filter = null, ?ISort $sort = null): array; public function collectionList(string|int $location, ?IFilter $filter = null, ?ISort $sort = null): array;
@@ -97,9 +102,9 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
* *
* @since 2025.05.01 * @since 2025.05.01
* *
* @param string|int ...$identifiers Collection IDs to check * @param string|int ...$identifiers Collection identifiers to check
* *
* @return array<string|int,bool> Map of ID => exists * @return array<string|int,bool> Map of identifier => exists
*/ */
public function collectionExtant(string|int $location, string|int ...$identifiers): array; public function collectionExtant(string|int $location, string|int ...$identifiers): array;
@@ -108,29 +113,44 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
* *
* @since 2025.05.01 * @since 2025.05.01
* *
* @param string|int $identifier Collection ID * @param string|int $identifier Collection identifier
* *
* @return CollectionBaseInterface|null Collection or null if not found * @return CollectionBaseInterface|null Collection or null if not found
*/ */
public function collectionFetch(string|int $identifier): ?CollectionBaseInterface; public function collectionFetch(string|int $identifier): ?CollectionBaseInterface;
/** /**
* Lists messages in a collection * Lists entities in a collection
* *
* @since 2025.05.01 * @since 2025.05.01
* *
* @param string|int $collection Collection ID * @param string|int $collection Collection identifier
* @param IFilter|null $filter Optional filter criteria * @param IFilter|null $filter Optional filter criteria
* @param ISort|null $sort Optional sort order * @param ISort|null $sort Optional sort order
* @param IRange|null $range Optional pagination * @param IRange|null $range Optional pagination
* @param array|null $properties Optional message properties to fetch * @param array|null $properties Optional entity properties to fetch
* *
* @return array<string|int,EntityBaseInterface> Messages indexed by ID * @return array<string,EntityBaseInterface> Entities indexed by Urn
*/ */
public function entityList(string|int $collection, ?IFilter $filter = null, ?ISort $sort = null, ?IRange $range = null, ?array $properties = null): array; public function entityListBulk(string|int $collection, ?IFilter $filter = null, ?ISort $sort = null, ?IRange $range = null, ?array $properties = null): array;
/** /**
* Creates a filter builder for messages * Lists entities in a collection
*
* @since 2025.05.01
*
* @param string|int $collection Collection identifier
* @param IFilter|null $filter Optional filter criteria
* @param ISort|null $sort Optional sort order
* @param IRange|null $range Optional pagination
* @param array|null $properties Optional entity properties to fetch
*
* @return Generator Yields entities one by one as EntityBaseInterface
*/
public function entityListStream(string|int $collection, ?IFilter $filter = null, ?ISort $sort = null, ?IRange $range = null, ?array $properties = null): Generator;
/**
* Creates a filter builder for entities
* *
* @since 2025.05.01 * @since 2025.05.01
* *
@@ -139,7 +159,7 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
public function entityListFilter(): IFilter; public function entityListFilter(): IFilter;
/** /**
* Creates a sort builder for messages * Creates a sort builder for entities
* *
* @since 2025.05.01 * @since 2025.05.01
* *
@@ -148,7 +168,7 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
public function entityListSort(): ISort; public function entityListSort(): ISort;
/** /**
* Creates a range builder for messages * Creates a range builder for entities
* *
* @since 2025.05.01 * @since 2025.05.01
* *
@@ -159,40 +179,49 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
public function entityListRange(RangeType $type): IRange; public function entityListRange(RangeType $type): IRange;
/** /**
* Gets incremental changes since last sync * Gets incremental changes since last signature
* *
* @since 2025.05.01 * @since 2025.05.01
* *
* @param string|int $collection Collection ID * @param string|int $collection Collection identifier
* @param string $signature Sync token from previous sync * @param string $signature Token from previous delta
* @param string $detail Detail level: 'ids', 'minimal', 'full'
* *
* @return array ['signature' => string, 'added' => array, 'modified' => array, 'removed' => array] * @return array ['signature' => string, 'added' => array, 'modified' => array, 'removed' => array]
*/ */
public function entityDelta(string|int $collection, string $signature, string $detail = 'ids'): Delta; public function entityDelta(string|int $collection, string $signature): Delta;
/** /**
* Checks if messages exist * Checks if entities exist
* *
* @since 2025.05.01 * @since 2025.05.01
* *
* @param string|int $collection Collection ID * @param string|int $collection Collection identifier
* @param string|int ...$identifiers Message IDs to check * @param string|int ...$identifiers Entity identifiers to check
* *
* @return array<string|int,bool> Map of ID => exists * @return array<string|int,bool> Map of identifier => exists
*/ */
public function entityExtant(string|int $collection, string|int ...$identifiers): array; public function entityExtant(string|int $collection, string|int ...$identifiers): array;
/** /**
* Fetches one or more entities * Fetches one or more entities as an array
* *
* @since 2025.05.01 * @since 2025.05.01
* *
* @param string|int $collection Collection ID * @param EntityIdentifierInterface ...$identifiers Entity identifiers to fetch
* @param string|int ...$identifiers Message IDs to fetch
* *
* @return array<string|int,EntityBaseInterface> Messages indexed by ID * @return array<string,EntityBaseInterface> Entities indexed by Urn
*/ */
public function entityFetch(string|int $collection, string|int ...$identifiers): array; public function entityFetchBulk(EntityIdentifierInterface ...$identifiers): array;
/**
* Fetches one or more entities as a stream
*
* @since 2025.05.01
*
* @param EntityIdentifierInterface ...$identifiers Entity identifiers to fetch
*
* @return Generator<string,EntityBaseInterface> Yields entities one by one
*/
public function entityFetchStream(EntityIdentifierInterface ...$identifiers): Generator;
} }
@@ -11,13 +11,17 @@ namespace KTXF\Chrono\Service;
use KTXF\Chrono\Collection\CollectionBaseInterface; use KTXF\Chrono\Collection\CollectionBaseInterface;
use KTXF\Chrono\Collection\CollectionMutableInterface; use KTXF\Chrono\Collection\CollectionMutableInterface;
use KTXF\Chrono\Collection\CollectionPropertiesBaseInterface;
use KTXF\Resource\Identifier\CollectionIdentifierInterface;
/** /**
* Chrono Service Collection Mutable Interface * Service Collection Mutable Interface
*
* Optional interface for services that support collection CRUD operations.
* *
* @since 2025.05.01 * @since 2025.05.01
*/ */
interface ServiceCollectionMutableInterface extends ServiceBaseInterface { interface ServiceCollectionMutableInterface {
public const CAPABILITY_COLLECTION_CREATE = 'CollectionCreate'; public const CAPABILITY_COLLECTION_CREATE = 'CollectionCreate';
public const CAPABILITY_COLLECTION_UPDATE = 'CollectionUpdate'; public const CAPABILITY_COLLECTION_UPDATE = 'CollectionUpdate';
@@ -37,37 +41,36 @@ interface ServiceCollectionMutableInterface extends ServiceBaseInterface {
* *
* @since 2025.05.01 * @since 2025.05.01
* *
* @param string|int|null $location Parent collection ID (null for root) * @param CollectionIdentifierInterface|null $target Target collection identifier (parent)
* @param CollectionMutableInterface $collection Collection to create * @param CollectionPropertiesBaseInterface $properties Collection properties
* @param array $options Protocol-specific options * @param array $options Protocol-specific options
* *
* @return CollectionBaseInterface Created collection with assigned ID * @return CollectionBaseInterface Created collection with assigned ID
*/ */
public function collectionCreate(string|int|null $location, CollectionMutableInterface $collection, array $options = []): CollectionBaseInterface; public function collectionCreate(CollectionIdentifierInterface|null $target, CollectionPropertiesBaseInterface $properties, array $options = []): CollectionBaseInterface;
/** /**
* Updates an existing collection * Updates an existing collection
* *
* @since 2025.05.01 * @since 2025.05.01
* *
* @param string|int $identifier Collection ID * @param CollectionIdentifierInterface $target Target collection identifier
* @param CollectionMutableInterface $collection Updated collection data * @param CollectionPropertiesBaseInterface $properties Updated collection data
* *
* @return CollectionBaseInterface Updated collection * @return CollectionBaseInterface Updated collection
*/ */
public function collectionUpdate(string|int $identifier, CollectionMutableInterface $collection): CollectionBaseInterface; public function collectionUpdate(CollectionIdentifierInterface $target, CollectionPropertiesBaseInterface $properties): CollectionBaseInterface;
/** /**
* Deletes a collection * Deletes a collection
* *
* @since 2025.05.01 * @since 2025.05.01
* *
* @param string|int $identifier Collection ID * @param CollectionIdentifierInterface $target Target collection identifier
* @param bool $force Force deletion even if not empty * @param bool $force Force deletion even if not empty
* @param bool $recursive Recursively delete contents
* *
* @return bool True if deleted * @return CollectionBaseInterface|true Collection object on soft delete, true on hard delete
*/ */
public function collectionDelete(string|int $identifier, bool $force = false, bool $recursive = false): bool; public function collectionDelete(CollectionIdentifierInterface $target, bool $force = false): CollectionBaseInterface | true;
} }
@@ -12,15 +12,12 @@ namespace KTXF\Chrono\Service;
use KTXF\Resource\Provider\ResourceServiceConfigureInterface; use KTXF\Resource\Provider\ResourceServiceConfigureInterface;
/** /**
* Chrono Service Configurable Interface * Service Configurable Interface
* *
* Extends base service interface with setter methods for mutable properties. * Extends base service interface with setter methods for mutable properties
* Used for service configuration and updates.
* *
* @since 2025.05.01 * @since 2025.05.01
*/ */
interface ServiceConfigurableInterface extends ServiceMutableInterface, ResourceServiceConfigureInterface { interface ServiceConfigurableInterface extends ServiceMutableInterface, ResourceServiceConfigureInterface {
public const JSON_TYPE = ServiceBaseInterface::JSON_TYPE;
} }
@@ -11,19 +11,21 @@ namespace KTXF\Chrono\Service;
use KTXF\Chrono\Entity\EntityBaseInterface; use KTXF\Chrono\Entity\EntityBaseInterface;
use KTXF\Chrono\Entity\EntityMutableInterface; use KTXF\Chrono\Entity\EntityMutableInterface;
use KTXF\Chrono\Entity\EntityPropertiesMutableInterface;
use KTXF\Resource\Identifier\CollectionIdentifierInterface;
use KTXF\Resource\Identifier\EntityIdentifierInterface;
/** /**
* Chrono Service Entity Mutable Interface * Service Entity Mutable Interface
* *
* Optional interface for services that support entity CRUD operations. * Optional interface for services that support entity CRUD operations
* Provides entity creation, modification, deletion, copying, moving, and flag management.
* *
* @since 2025.05.01 * @since 2025.05.01
*/ */
interface ServiceEntityMutableInterface extends ServiceBaseInterface { interface ServiceEntityMutableInterface {
public const CAPABILITY_ENTITY_CREATE = 'EntityCreate'; public const CAPABILITY_ENTITY_CREATE = 'EntityCreate';
public const CAPABILITY_ENTITY_UPDATE = 'EntityUpdate'; public const CAPABILITY_ENTITY_MODIFY = 'EntityModify';
public const CAPABILITY_ENTITY_DELETE = 'EntityDelete'; public const CAPABILITY_ENTITY_DELETE = 'EntityDelete';
public const CAPABILITY_ENTITY_COPY = 'EntityCopy'; public const CAPABILITY_ENTITY_COPY = 'EntityCopy';
public const CAPABILITY_ENTITY_MOVE = 'EntityMove'; public const CAPABILITY_ENTITY_MOVE = 'EntityMove';
@@ -42,36 +44,71 @@ interface ServiceEntityMutableInterface extends ServiceBaseInterface {
* *
* @since 2025.05.01 * @since 2025.05.01
* *
* @param string|int $collection collection identifier * @param CollectionIdentifierInterface $target Target collection identifier
* @param EntityMutableInterface $entity Entity data * @param EntityPropertiesMutableInterface $properties Entity properties
* @param array $options additional options * @param array $options Additional options
* *
* @return EntityBaseInterface Created entity * @return EntityBaseInterface Created entity
*/ */
public function entityCreate(string|int $collection, EntityMutableInterface $entity, array $options = []): EntityBaseInterface; public function entityCreate(CollectionIdentifierInterface $target, EntityPropertiesMutableInterface $properties, array $options = []): EntityBaseInterface;
/** /**
* Modifies an existing entity * Modifies an existing entity
* *
* @since 2025.05.01 * @since 2025.05.01
* *
* @param string|int $collection Collection identifier * @param EntityIdentifierInterface $target Target entity identifier
* @param string|int $identifier Entity identifier * @param EntityPropertiesMutableInterface $properties Entity properties to update
* @param EntityMutableInterface $entity Entity data
* *
* @return EntityBaseInterface Modified entity * @return EntityBaseInterface Modified entity
*/ */
public function entityUpdate(string|int $collection, string|int $identifier, EntityMutableInterface $entity): EntityBaseInterface; public function entityModify(EntityIdentifierInterface $target, EntityPropertiesMutableInterface $properties): EntityBaseInterface;
/** /**
* Deletes an existing entity in the specified collection * Deletes entities
*
* @since 2026.04.01
*
* @param EntityIdentifierInterface ...$targets Source entities to delete
*
* @return array<string, array{
* disposition: 'moved'|'deleted'|'error',
* destination: ?CollectionIdentifierInterface,
* mutation: EntityIdentifierInterface
* }> Results keyed by source entity identifier
*/
public function entityDelete(EntityIdentifierInterface ...$targets): array;
/**
* Moves entities to another collection
*
* @since 2025.05.01
*
* @param CollectionIdentifierInterface $target Target collection identifier
* @param EntityIdentifierInterface ...$sources Source entities to move
*
* @return array<string, array{
* disposition: 'moved'|'error',
* destination: ?CollectionIdentifierInterface,
* mutation: EntityIdentifierInterface
* }> Results keyed by source entity identifier
*/
public function entityMove(CollectionIdentifierInterface $target, EntityIdentifierInterface ...$sources): array;
/**
* Copies entities to another collection
* *
* @since 2025.05.01 * @since 2025.05.01
* *
* @param string|int $collection Collection identifier * @param CollectionIdentifierInterface $target Target collection identifier
* @param string|int $identifier Entity identifier to delete * @param EntityIdentifierInterface ...$sources Source entities to copy
* *
* @return EntityBaseInterface Deleted entity * @return array<string, array{
* disposition: 'copied'|'error',
* destination: ?CollectionIdentifierInterface,
* mutation: EntityIdentifierInterface
* }> Results keyed by source entity identifier
*/ */
public function entityDelete(string|int $collection, string|int $identifier): EntityBaseInterface; public function entityCopy(CollectionIdentifierInterface $target, EntityIdentifierInterface ...$sources): array;
} }
@@ -12,11 +12,10 @@ namespace KTXF\Chrono\Service;
/** /**
* Chrono Service Mutable Interface * Chrono Service Mutable Interface
* *
* Extends base service interface with setter methods for mutable properties. * Extends base service interface with setter methods for mutable properties
* Used for service configuration and updates.
* *
* @since 2025.05.01 * @since 2025.05.01
*/ */
interface ServiceMutableInterface extends ServiceBaseInterface { interface ServiceMutableInterface {
} }
@@ -282,7 +282,7 @@ abstract class MessagePropertiesBaseAbstract extends NodePropertiesBaseAbstract
*/ */
public function getFlags(): array { public function getFlags(): array {
return $this->data[static::PROPERTY_FLAGS] ?? [ return $this->data[static::PROPERTY_FLAGS] ?? [
'read' => false, 'seen' => false,
'starred' => false, 'starred' => false,
'important' => false, 'important' => false,
'answered' => false, 'answered' => false,
@@ -295,7 +295,7 @@ abstract class MessagePropertiesMutableAbstract extends MessagePropertiesBaseAbs
public function setFlags(array $value): static { public function setFlags(array $value): static {
if (!isset($this->data[static::PROPERTY_FLAGS])) { if (!isset($this->data[static::PROPERTY_FLAGS])) {
$this->data[static::PROPERTY_FLAGS] = [ $this->data[static::PROPERTY_FLAGS] = [
'read' => false, 'seen' => false,
'starred' => false, 'starred' => false,
'important' => false, 'important' => false,
'answered' => false, 'answered' => false,
@@ -315,7 +315,7 @@ abstract class MessagePropertiesMutableAbstract extends MessagePropertiesBaseAbs
public function setFlag(string $name, bool $value): static { public function setFlag(string $name, bool $value): static {
if (!isset($this->data[static::PROPERTY_FLAGS])) { if (!isset($this->data[static::PROPERTY_FLAGS])) {
$this->data[static::PROPERTY_FLAGS] = [ $this->data[static::PROPERTY_FLAGS] = [
'read' => false, 'seen' => false,
'starred' => false, 'starred' => false,
'important' => false, 'important' => false,
'answered' => false, 'answered' => false,
@@ -20,17 +20,15 @@ use KTXF\Resource\Provider\Node\NodePropertiesBaseAbstract;
*/ */
abstract class CollectionPropertiesBaseAbstract extends NodePropertiesBaseAbstract implements CollectionPropertiesBaseInterface { abstract class CollectionPropertiesBaseAbstract extends NodePropertiesBaseAbstract implements CollectionPropertiesBaseInterface {
public const JSON_TYPE = CollectionPropertiesBaseInterface::JSON_TYPE;
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function content(): array { public function content(): array {
$content = $this->data[self::PROPERTY_CONTENT] ?? null; $content = $this->data[self::PROPERTY_CONTENT] ?? null;
if (is_array($content)) { if (is_array($content)) {
return array_map(function ($item) { return array_filter(array_map(function ($item) {
return new CollectionContent($item); return $item instanceof CollectionContent ? $item : CollectionContent::tryFrom($item);
}, $content); }, $content));
} else { } else {
return []; return [];
} }
@@ -10,7 +10,6 @@ declare(strict_types=1);
namespace KTXF\People\Collection; namespace KTXF\People\Collection;
use KTXF\Resource\Provider\Node\NodePropertiesBaseInterface; use KTXF\Resource\Provider\Node\NodePropertiesBaseInterface;
use PhpParser\Node\Expr\Array_;
interface CollectionPropertiesBaseInterface extends NodePropertiesBaseInterface { interface CollectionPropertiesBaseInterface extends NodePropertiesBaseInterface {
@@ -9,8 +9,8 @@ declare(strict_types=1);
namespace KTXF\People\Provider; namespace KTXF\People\Provider;
use KTXF\Chrono\Service\ServiceMutableInterface; use KTXF\People\Service\ServiceBaseInterface;
use KTXF\Mail\Service\ServiceBaseInterface; use KTXF\People\Service\ServiceMutableInterface;
/** /**
* Provider Service Test Interface * Provider Service Test Interface
@@ -21,7 +21,7 @@ use KTXF\Resource\Range\RangeType;
use KTXF\Resource\Sort\ISort; use KTXF\Resource\Sort\ISort;
/** /**
* People Service Base Interface * Service Base Interface
* *
* Minimum interface for a service, providing read-only access to collections and entities. * Minimum interface for a service, providing read-only access to collections and entities.
* *
@@ -15,7 +15,7 @@ use KTXF\People\Collection\CollectionPropertiesBaseInterface;
use KTXF\Resource\Identifier\CollectionIdentifierInterface; use KTXF\Resource\Identifier\CollectionIdentifierInterface;
/** /**
* People Service Collection Mutable Interface * Service Collection Mutable Interface
* *
* Optional interface for services that support collection CRUD operations. * Optional interface for services that support collection CRUD operations.
* *