Compare commits
1 Commits
main
..
68dee49e99
| Author | SHA1 | Date | |
|---|---|---|---|
| 68dee49e99 |
File diff suppressed because it is too large
Load Diff
@@ -62,14 +62,14 @@ class TransferController extends ControllerAbstract
|
||||
/** @var EntityBaseInterface[] $entities */
|
||||
$entities = $this->manager->entityFetchBulk($tenantId, $userId, $target);
|
||||
|
||||
if (!isset($entities[(string) $target])) {
|
||||
if (empty($entities) || !isset($entities[$identifier])) {
|
||||
return new JsonResponse([
|
||||
'status' => 'error',
|
||||
'error' => ['code' => 404, 'message' => 'File not found']
|
||||
], Response::HTTP_NOT_FOUND);
|
||||
}
|
||||
|
||||
$entity = $entities[(string) $target];
|
||||
$entity = $entities[$identifier];
|
||||
|
||||
// Get the stream
|
||||
$stream = $this->manager->entityReadStream($tenantId, $userId, $target);
|
||||
@@ -130,7 +130,10 @@ class TransferController extends ControllerAbstract
|
||||
$variant,
|
||||
);
|
||||
if ($preview === null) {
|
||||
return new Response('', Response::HTTP_NO_CONTENT);
|
||||
return new JsonResponse([
|
||||
'status' => 'error',
|
||||
'error' => ['code' => 404, 'message' => 'Preview unavailable'],
|
||||
], Response::HTTP_NOT_FOUND);
|
||||
}
|
||||
|
||||
$response = new StreamedResponse($preview->resource->stream());
|
||||
@@ -327,16 +330,15 @@ class TransferController extends ControllerAbstract
|
||||
foreach ($ids as $id) {
|
||||
// Try as entity first
|
||||
if ($collection !== null) {
|
||||
$target = new EntityIdentifier($provider, $service, $collection, (string) $id);
|
||||
/** @var EntityBaseInterface[] $entities */
|
||||
$entities = $this->manager->entityFetchBulk(
|
||||
$tenantId,
|
||||
$userId,
|
||||
$target
|
||||
new EntityIdentifier($provider, $service, $collection, (string)$id)
|
||||
);
|
||||
|
||||
if (isset($entities[(string) $target])) {
|
||||
$entity = $entities[(string) $target];
|
||||
if (!empty($entities) && isset($entities[$id])) {
|
||||
$entity = $entities[$id];
|
||||
$files[] = [
|
||||
'type' => 'file',
|
||||
'id' => $id,
|
||||
|
||||
+12
-98
@@ -20,12 +20,10 @@ use KTXF\Documents\Service\ServiceBaseInterface;
|
||||
use KTXF\Documents\Service\ServiceCollectionMutableInterface;
|
||||
use KTXF\Documents\Service\ServiceEntityMutableInterface;
|
||||
use KTXF\Documents\Service\ServiceMutableInterface;
|
||||
use KTXF\Documents\Service\ServiceNodeListInterface;
|
||||
use KTXF\Resource\Filter\IFilter;
|
||||
use KTXF\Preview\PreviewSource;
|
||||
use KTXF\Resource\BinaryResource;
|
||||
use KTXF\Resource\Identifier\CollectionIdentifier;
|
||||
use KTXF\Resource\Identifier\ServiceIdentifier;
|
||||
use KTXF\Resource\Identifier\EntityIdentifier;
|
||||
use KTXF\Resource\Identifier\ResourceIdentifiers;
|
||||
use KTXF\Resource\Provider\ResourceServiceIdentityInterface;
|
||||
@@ -508,16 +506,18 @@ class Manager {
|
||||
*
|
||||
* @param string $tenantId tenant identifier
|
||||
* @param string $userId user identifier
|
||||
* @param ServiceIdentifier|CollectionIdentifier $target service root or parent collection
|
||||
* @param string $provider provider identifier
|
||||
* @param string|int $service service identifier
|
||||
* @param CollectionIdentifier|null $target target parent collection identifier (null for root)
|
||||
* @param CollectionPropertiesMutableInterface|array $properties properties for the new collection
|
||||
* @param array $options additional options for creation
|
||||
*
|
||||
* @return CollectionBaseInterface
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function collectionCreate(string $tenantId, string $userId, ServiceIdentifier|CollectionIdentifier $target, CollectionPropertiesMutableInterface|array $properties, array $options = []): CollectionBaseInterface {
|
||||
public function collectionCreate(string $tenantId, string $userId, string $provider, string|int $service, CollectionIdentifier|null $target, CollectionPropertiesMutableInterface|array $properties, array $options = []): CollectionBaseInterface {
|
||||
// retrieve service
|
||||
$service = $this->serviceFetch($tenantId, $userId, $target->provider(), $target->service());
|
||||
$service = $this->serviceFetch($tenantId, $userId, $provider, $service);
|
||||
// Check if service supports collection creation
|
||||
if ($service->getEnabled() === false) {
|
||||
throw new InvalidArgumentException("Service '{$service->identifier()}' not found or is disabled");
|
||||
@@ -533,7 +533,7 @@ class Manager {
|
||||
$properties = $service->collectionFresh()->getProperties()->jsonDeserialize($properties);
|
||||
}
|
||||
// Create collection
|
||||
return $service->collectionCreate($target instanceof CollectionIdentifier ? $target : null, $properties, $options);
|
||||
return $service->collectionCreate($target, $properties, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -811,28 +811,21 @@ class Manager {
|
||||
* @return array<string,EntityBaseInterface>
|
||||
*/
|
||||
public function entityFetchBulk(string $tenantId, ?string $userId, EntityIdentifier ...$identifiers): array {
|
||||
// Keep locations separate: providers may return maps keyed by local ID.
|
||||
// group identifiers by provider/service
|
||||
$groupedIdentifiers = [];
|
||||
foreach ($identifiers as $identifier) {
|
||||
$groupedIdentifiers[$identifier->provider()][$identifier->service()][$identifier->collection()][] = $identifier;
|
||||
$groupedIdentifiers[$identifier->provider()][$identifier->service()][] = $identifier;
|
||||
}
|
||||
// retrieve each service and fetch entities
|
||||
$list = [];
|
||||
foreach ($groupedIdentifiers as $providerId => $services) {
|
||||
foreach ($services as $serviceId => $collections) {
|
||||
foreach ($services as $serviceId => $entities) {
|
||||
$service = $this->serviceFetch($tenantId, $userId, $providerId, $serviceId);
|
||||
if ($service->getEnabled() === false) {
|
||||
throw new InvalidArgumentException("Service '{$providerId}:{$serviceId}' not found or is disabled");
|
||||
}
|
||||
foreach ($collections as $entities) {
|
||||
$fetched = $service->entityFetchBulk(...$entities);
|
||||
foreach ($entities as $identifier) {
|
||||
$entity = $fetched[(string) $identifier] ?? $fetched[$identifier->entity()] ?? null;
|
||||
if ($entity !== null) {
|
||||
$list[(string) $identifier] = $entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
// retrieve entities and merge into list
|
||||
$list = array_merge($list, $service->entityFetchBulk(...$entities));
|
||||
}
|
||||
}
|
||||
return $list;
|
||||
@@ -1360,7 +1353,7 @@ class Manager {
|
||||
*/
|
||||
public function entityPreview(string $tenantId, string $userId, EntityIdentifier $target, string $variant = 'inline'): ?Preview {
|
||||
$entities = $this->entityFetchBulk($tenantId, $userId, $target);
|
||||
$entity = $entities[(string) $target] ?? null;
|
||||
$entity = $entities[$target->entity()] ?? reset($entities);
|
||||
if (!$entity instanceof EntityBaseInterface) {
|
||||
return null;
|
||||
}
|
||||
@@ -1411,85 +1404,6 @@ class Manager {
|
||||
|
||||
return $this->previewManager->fetch($tenantId, $source, $variant);
|
||||
}
|
||||
|
||||
/**
|
||||
* List collections and entities within a location as one unified, paginated set
|
||||
*
|
||||
* Folders are ordered before files within the returned range. Unlike
|
||||
* {@see collectionList} and {@see entityListBulk}, this requires the target
|
||||
* service to natively implement {@see ServiceNodeListInterface} — there is
|
||||
* intentionally no fallback for services that only support the separate
|
||||
* collection/entity listing operations, since every current caller targets a
|
||||
* single provider/service/location per request.
|
||||
*
|
||||
* @since 2026.09.01
|
||||
*
|
||||
* @param string $tenantId Tenant identifier
|
||||
* @param string $userId User identifier
|
||||
* @param ResourceIdentifiers|null $targets Node sources with collection identifiers
|
||||
* @param array|null $filter Node filter
|
||||
* @param array|null $sort Node sort
|
||||
* @param array|null $range Node range/pagination
|
||||
*
|
||||
* @return \Generator<int,CollectionBaseInterface|EntityBaseInterface> Nodes in provider order
|
||||
*
|
||||
* @throws InvalidArgumentException If the resolved service does not support unified node listing
|
||||
*/
|
||||
public function nodeList(string $tenantId, string $userId, ?ResourceIdentifiers $targets = null, array|null $filter = null, array|null $sort = null, array|null $range = null): \Generator {
|
||||
// confirm that sources are provided
|
||||
if ($targets === null) {
|
||||
$targets = new ResourceIdentifiers([]);
|
||||
}
|
||||
// retrieve services for each provider
|
||||
$aggregateServices = $this->serviceList($tenantId, $userId, $targets);
|
||||
// retrieve nodes for each service
|
||||
foreach ($aggregateServices as $services) {
|
||||
/** @var ServiceBaseInterface $service */
|
||||
foreach ($services as $service) {
|
||||
// omit disabled services
|
||||
if ($service->getEnabled() === false) {
|
||||
continue;
|
||||
}
|
||||
if ($service instanceof ServiceNodeListInterface === false) {
|
||||
throw new InvalidArgumentException("Service '{$service->identifier()}' does not support paginated node listing");
|
||||
}
|
||||
// retrieve collections for each service
|
||||
$collectionSelected = $targets->byProvider($service->provider())->byService($service->identifier())->collections();
|
||||
if ($collectionSelected === []) {
|
||||
// documents are hierarchical: service level selection lists the root collection
|
||||
$collectionSelected = [''];
|
||||
}
|
||||
// construct filter for nodes
|
||||
$nodeFilter = null;
|
||||
if ($filter !== null && $filter !== []) {
|
||||
$nodeFilter = $service->nodeListFilter();
|
||||
foreach ($filter as $attribute => $value) {
|
||||
$nodeFilter->condition($attribute, $value);
|
||||
}
|
||||
}
|
||||
// construct sort for nodes
|
||||
$nodeSort = null;
|
||||
if ($sort !== null && $sort !== []) {
|
||||
$nodeSort = $service->nodeListSort();
|
||||
foreach ($sort as $attribute => $direction) {
|
||||
$nodeSort->condition($attribute, $direction);
|
||||
}
|
||||
}
|
||||
// construct range for nodes
|
||||
$nodeRange = null;
|
||||
if ($range !== null && $range !== [] && isset($range['type'])) {
|
||||
$nodeRange = $service->nodeListRange(RangeType::from($range['type']))->jsonDeserialize($range);
|
||||
}
|
||||
// Preserve provider order without grouping or buffering nodes.
|
||||
foreach ($collectionSelected as $collectionId) {
|
||||
$nodes = $service->nodeList($collectionId, $nodeFilter, $nodeSort, $nodeRange);
|
||||
foreach ($nodes as $node) {
|
||||
yield $node;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+12
-8
@@ -2,14 +2,13 @@
|
||||
|
||||
namespace KTXM\DocumentsManager;
|
||||
|
||||
use KTXF\Module\Configuration\BrowserModuleContextInterface;
|
||||
use KTXF\Module\Configuration\ModuleContextInterface;
|
||||
use KTXF\Module\ModuleBrowserInterface;
|
||||
use KTXF\Module\ModuleInstanceAbstract;
|
||||
|
||||
/**
|
||||
* File Manager Module
|
||||
*/
|
||||
class Module extends ModuleInstanceAbstract
|
||||
class Module extends ModuleInstanceAbstract implements ModuleBrowserInterface
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
@@ -51,11 +50,16 @@ class Module extends ModuleInstanceAbstract
|
||||
];
|
||||
}
|
||||
|
||||
public function configure(ModuleContextInterface $context): void
|
||||
{
|
||||
if ($context instanceof BrowserModuleContextInterface) {
|
||||
$context->registerModule($this, 'DocumentsManager', 'static/module.mjs');
|
||||
}
|
||||
public function registerBI(): array {
|
||||
return [
|
||||
'handle' => $this->handle(),
|
||||
'namespace' => 'DocumentsManager',
|
||||
'version' => $this->version(),
|
||||
'label' => $this->label(),
|
||||
'author' => $this->author(),
|
||||
'description' => $this->description(),
|
||||
'boot' => 'static/module.mjs',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Generated
+142
-216
@@ -285,40 +285,6 @@
|
||||
"node": ">=20.19.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/core": {
|
||||
"version": "1.11.1",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.1.tgz",
|
||||
"integrity": "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@emnapi/wasi-threads": "1.2.2",
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/runtime": {
|
||||
"version": "1.11.1",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.1.tgz",
|
||||
"integrity": "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/wasi-threads": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.2.tgz",
|
||||
"integrity": "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@exodus/bytes": {
|
||||
"version": "1.15.1",
|
||||
"resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.15.1.tgz",
|
||||
@@ -364,39 +330,37 @@
|
||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/wasm-runtime": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.6.tgz",
|
||||
"integrity": "sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@tybys/wasm-util": "^0.10.3"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/Brooooooklyn"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@emnapi/core": "^1.7.1",
|
||||
"@emnapi/runtime": "^1.7.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@oxc-project/types": {
|
||||
"version": "0.139.0",
|
||||
"resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.139.0.tgz",
|
||||
"integrity": "sha512-r9gHphtCs+1M7J0pw6Sn/hh/Wpa/iQrOOkrNAlVLF/gHq+/CJmHIWKKUUhdWjcD6CIa8idarspCsASiXCXvFUw==",
|
||||
"version": "0.147.0",
|
||||
"resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.147.0.tgz",
|
||||
"integrity": "sha512-IJ3s6ltHLp45S0bh7phkX+gJO7A1Wuz2EaqpAhb8WjqDwbzMiWKHhyyT42tskaWjEYXtHtVCPpnBJVT9+dcRLg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/Boshen"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-android-arm-eabi": {
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.6.tgz",
|
||||
"integrity": "sha512-b+jTcARdTiFLI6jB4a5XjTm0RWd6KcRfQj/I2356fxUZemiho9zQLxo0RtCuMDAyKcLo6cEltkgbQp6d1+sjjQ==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-android-arm64": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.1.5.tgz",
|
||||
"integrity": "sha512-lZg8fqIv2v7FF237bwMgzGZEJvGL79/s5knJ/i6FmsGF4XXlzccZ4jb+TrFIxtSSxFtIpdsgrPZeMk1I9AFcyQ==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.6.tgz",
|
||||
"integrity": "sha512-lkWU8ZJaRk9q3CIEY1Tc7vIFALp3Xw5NfGJo2hQg5oIqNgxWi1zI+IiDEK3r70BF5Dzol1tcXsnzsRc8NLhG+Q==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -411,9 +375,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-darwin-arm64": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.1.5.tgz",
|
||||
"integrity": "sha512-51Bnx9pNiMRKSUNtBfySkNJ9vMU9Hh3I1ozDd6gyPPYzaXCfnptUcEZxXGYFn+ul2dtcMUiqGR1Yai2K10uoTw==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.6.tgz",
|
||||
"integrity": "sha512-dgR56NYnvAszm7Ob1B2/Vn0e8bUQYZH2UjVaMMtMVOCKFSfjhfLmuA/9+O+F+ajUdG6B/bSssrKW6JJYASa8jA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -428,9 +392,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-darwin-x64": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.1.5.tgz",
|
||||
"integrity": "sha512-Tm+gbfC0aHu1tBA/JvKQh32S0K6YgCHkiAF4/W6xX0K0RmNuc94VeK419dJoE65R5aRxmo+noZQSWrAMF6yb6g==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.6.tgz",
|
||||
"integrity": "sha512-vpVxFvUCFioJqug7OTvqptkc4yb8UX0AwfDmJpaR/0sWz+BUmqSVAf7c8JkUgnN8YLspb4a/N6NhTyMAmdyQ7Q==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -445,9 +409,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-freebsd-x64": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.1.5.tgz",
|
||||
"integrity": "sha512-JMzDKCCXq93YccG5gz3hvOs1oXRKAf0XYpfOS88e+wZrC8Iugj6j68867vrYZkvpDDpKn/KoKORThmchMpF6TA==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.6.tgz",
|
||||
"integrity": "sha512-h1wG6Y6K3JlRswxsI64qQJqBAy4vrLuHgRbc8CZMGSWTOFRY6ghMApM1NKzB2I0n5xV1fjkE18SuVl2QpLeNpA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -462,9 +426,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-arm-gnueabihf": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.1.5.tgz",
|
||||
"integrity": "sha512-uML21j2K5TfPGutKxub+M+nLjZIrWjXQ5Grx4lCe/nimTj9B4L63zHpjXLl4y0L3mcm2htEQIb06oCG/szerNw==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.6.tgz",
|
||||
"integrity": "sha512-tbCiqub0q2MVWJKgF5PoAlNWCtQydiOYSLIkd8sByqK/6MMYLJRcSXSYodqYtd0O+Fw7QaVmKKlS4oL94YRZ0w==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
@@ -479,9 +443,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-arm64-gnu": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.1.5.tgz",
|
||||
"integrity": "sha512-navSiuTMogvnQoZoM/v+l3ZWo50/NTwSHSzheABx/RCnmUPaKwq9qSo4Br2OYRs21+Fz8uFqITZM3H4opOB0/Q==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.6.tgz",
|
||||
"integrity": "sha512-oxK9+baEBPhZG5HB4URY+uU04zJWeZlH6Tb9rB5DK4DF9XR1uXNLXt5Q5ZsugTKayNCNLhkcwz/ye74hRI98dg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -496,9 +460,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-arm64-musl": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.1.5.tgz",
|
||||
"integrity": "sha512-lAryqH7IteztmCXQXk0etKj4wBQ7Gx5S6LjKhsgp9zb8I5bsuvU/2llH1hDQcjsFeqIsovMVN339/8pUDDBXxA==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.6.tgz",
|
||||
"integrity": "sha512-muWCk27FVBEZtv0MsK8gnfSmgczA8KQ0uRVJbTABKhkRfQc38aUrcb7fhi3BNiyseFmgcRsoMfQsSNJ+DbZdSw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -513,9 +477,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-ppc64-gnu": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.1.5.tgz",
|
||||
"integrity": "sha512-fsK/sNBnxzBlL4O1JNrZakVQxPspqpED5dLtNsZS9oOKmtSpdNIzxH2kkol5HYTWJN47sE20ztMJPxfZ89qGOg==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.6.tgz",
|
||||
"integrity": "sha512-eWDoSfU7Co2qj3vgB3Dt4lj1mG6CoWbcJQkRMP3XJplyCMtuaq3LHvPFjS9QIPvMGWVadJC04Xiy0IdcVPtnwQ==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
@@ -530,9 +494,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-s390x-gnu": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.1.5.tgz",
|
||||
"integrity": "sha512-gLYb4BIadlfTOYT5gO503n8zQjXflgzpD0FcyKh0Mzx3rqCZKnHoJWV9xe1KXUJ5lx2JfcSHr/mhzS0PC/McAA==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.6.tgz",
|
||||
"integrity": "sha512-2bWNjRSIayvupRKxXUY2tWG9fYdoUlTqWywHRvE8Eq3GvuQ+f2HeIkve697fIt+IQs/PV8yFsdWuhp1aJ1PdnA==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
@@ -547,9 +511,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-x64-gnu": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.1.5.tgz",
|
||||
"integrity": "sha512-FjcpEKUyJygHgs1o50VYNvkt5+7Le/VEdYt0AkRpkL33MnyQfwr8l5mXwMmfmTbyMPr5vJLC+8/Gd9gXnwU1QQ==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.6.tgz",
|
||||
"integrity": "sha512-KekI0gS0wLxe1UBSQSjenBVwou/JkcQPDzBPICGZjxUv9k3RteHDPBQaiOicZUFKRIH2wKEimGwVpnJsbPzu7w==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -564,9 +528,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-x64-musl": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.1.5.tgz",
|
||||
"integrity": "sha512-Me+PfPI2TMeOQk0gYWfLQZtTktrmzbr8cDboqX83XKc7UrgAi55gF+2dUkWdxd19n55Essp2yeca+O9N5rBxHg==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.6.tgz",
|
||||
"integrity": "sha512-TvtPnfVr+HtyGiDmPK4VWmlNm7QhNNAcK5Q9A7aOXsI8545yCyaoMaicXrFZ72JzeYjaUVk7yT243zT0jzjFKQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -581,9 +545,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-openharmony-arm64": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.1.5.tgz",
|
||||
"integrity": "sha512-yc5WrLzXks6zCQfn9Oxr8pORKyl/pF+QjHmW/Qx3qu0oyrrNC+y2JLTU1E2rcWYAmzlnqngWXHQjy51VzW70Vw==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.6.tgz",
|
||||
"integrity": "sha512-iOo0VEay2XFhaCcH0sps5XIimkSuOnNaZrf6+ZkoSOQBJPKNU48RkmJv0/lSpipexu5P+ouFgafe5IGr/DiQfg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -597,29 +561,10 @@
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-wasm32-wasi": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.1.5.tgz",
|
||||
"integrity": "sha512-VbQGPX2b4r48TAMIM2cjgluIM1HYutm4pcTEJsle7iEP7sB1dFqtPLBVbdLAZCxy1txCcPxf4QFf4v8uvltPqA==",
|
||||
"cpu": [
|
||||
"wasm32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@emnapi/core": "1.11.1",
|
||||
"@emnapi/runtime": "1.11.1",
|
||||
"@napi-rs/wasm-runtime": "^1.1.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-win32-arm64-msvc": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.1.5.tgz",
|
||||
"integrity": "sha512-gHv82k63z4qpV5+Q1y/12KrK0ltWBukVDI8nZcbT7Tt/ZlOIVwppazneq0F93oDxTo3IgAMEDIoQh3E2n6mVsw==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.6.tgz",
|
||||
"integrity": "sha512-y5NTmmasMS455JlOCO4ZM9krIchv3Mvm1crL1iUPGOPgEzSkves9n0SdC5Sjz6+qWDFhd8/JpfWMH8NSWNHe+A==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -634,9 +579,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-win32-x64-msvc": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.1.5.tgz",
|
||||
"integrity": "sha512-tTZuDBPw85tEN5PQi1pnEBzDy0Z49HtScLAbD5t6hyeU92A95pRWaSMw1GZZi/RwgSgUIl0xrSlXIT/9QzvYSA==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.6.tgz",
|
||||
"integrity": "sha512-np8iZSLfXlAD4kWhiyq/u0Yt8oZDtRQ8lGhQaCXo2rl37KNjeU0GjJuwr4P3oeZ++ROfofsKNBqR5LTO8aXyWQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -671,17 +616,6 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@tybys/wasm-util": {
|
||||
"version": "0.10.3",
|
||||
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.3.tgz",
|
||||
"integrity": "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/chai": {
|
||||
"version": "5.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz",
|
||||
@@ -1407,9 +1341,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz",
|
||||
"integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==",
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz",
|
||||
"integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==",
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"dependencies": {
|
||||
@@ -1423,23 +1357,23 @@
|
||||
"url": "https://opencollective.com/parcel"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"lightningcss-android-arm64": "1.32.0",
|
||||
"lightningcss-darwin-arm64": "1.32.0",
|
||||
"lightningcss-darwin-x64": "1.32.0",
|
||||
"lightningcss-freebsd-x64": "1.32.0",
|
||||
"lightningcss-linux-arm-gnueabihf": "1.32.0",
|
||||
"lightningcss-linux-arm64-gnu": "1.32.0",
|
||||
"lightningcss-linux-arm64-musl": "1.32.0",
|
||||
"lightningcss-linux-x64-gnu": "1.32.0",
|
||||
"lightningcss-linux-x64-musl": "1.32.0",
|
||||
"lightningcss-win32-arm64-msvc": "1.32.0",
|
||||
"lightningcss-win32-x64-msvc": "1.32.0"
|
||||
"lightningcss-android-arm64": "1.33.0",
|
||||
"lightningcss-darwin-arm64": "1.33.0",
|
||||
"lightningcss-darwin-x64": "1.33.0",
|
||||
"lightningcss-freebsd-x64": "1.33.0",
|
||||
"lightningcss-linux-arm-gnueabihf": "1.33.0",
|
||||
"lightningcss-linux-arm64-gnu": "1.33.0",
|
||||
"lightningcss-linux-arm64-musl": "1.33.0",
|
||||
"lightningcss-linux-x64-gnu": "1.33.0",
|
||||
"lightningcss-linux-x64-musl": "1.33.0",
|
||||
"lightningcss-win32-arm64-msvc": "1.33.0",
|
||||
"lightningcss-win32-x64-msvc": "1.33.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-android-arm64": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz",
|
||||
"integrity": "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==",
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz",
|
||||
"integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1458,9 +1392,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-darwin-arm64": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz",
|
||||
"integrity": "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==",
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz",
|
||||
"integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1479,9 +1413,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-darwin-x64": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz",
|
||||
"integrity": "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==",
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz",
|
||||
"integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1500,9 +1434,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-freebsd-x64": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz",
|
||||
"integrity": "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==",
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz",
|
||||
"integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1521,9 +1455,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-arm-gnueabihf": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz",
|
||||
"integrity": "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==",
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz",
|
||||
"integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
@@ -1542,9 +1476,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-arm64-gnu": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz",
|
||||
"integrity": "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==",
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz",
|
||||
"integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1563,9 +1497,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-arm64-musl": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz",
|
||||
"integrity": "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==",
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz",
|
||||
"integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1584,9 +1518,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-x64-gnu": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz",
|
||||
"integrity": "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==",
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz",
|
||||
"integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1605,9 +1539,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-x64-musl": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz",
|
||||
"integrity": "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==",
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz",
|
||||
"integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1626,9 +1560,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-win32-arm64-msvc": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz",
|
||||
"integrity": "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==",
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz",
|
||||
"integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@@ -1647,9 +1581,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-win32-x64-msvc": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz",
|
||||
"integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==",
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz",
|
||||
"integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
@@ -1729,9 +1663,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "3.3.12",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz",
|
||||
"integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==",
|
||||
"version": "3.3.18",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.18.tgz",
|
||||
"integrity": "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
@@ -1858,9 +1792,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.5.19",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.19.tgz",
|
||||
"integrity": "sha512-Mz8SaolMd8nB+G13WkORcxQKHZ/NE4xXevtkJHVuG+guo9/wYKlIMTKAqGdEmYOXR2ijPjTYNHssizdaVSUNdQ==",
|
||||
"version": "8.5.26",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.26.tgz",
|
||||
"integrity": "sha512-u82N74LFzG8ca+dD8puPnplTXoGH4fTPpVGuIbt36G3qvNlkvfD0lEAZSxaly3KX8TS/L1A1gsCEmvKmBcVbkQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
@@ -1877,7 +1811,7 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.12",
|
||||
"nanoid": "^3.3.17",
|
||||
"picocolors": "^1.1.1",
|
||||
"source-map-js": "^1.2.1"
|
||||
},
|
||||
@@ -1906,13 +1840,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/rolldown": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.1.5.tgz",
|
||||
"integrity": "sha512-t9z29cJjXf/vxQ8dyhCSpt6H6aSwHTk8cT5I3iy6SMXuFpk5mB6PL6XfC8PCwrPTx93udwKUm9HRteAlTGBLiA==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.6.tgz",
|
||||
"integrity": "sha512-vMM4q3aixf46GiF1Kok8jDPFsEpXgFWGjUHXNkNHNm+Y2adXAG2dbX91jkti3i0ZRsOlcmbuzAz1poObSHCmUA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@oxc-project/types": "=0.139.0",
|
||||
"@oxc-project/types": "=0.147.0",
|
||||
"@rolldown/pluginutils": "^1.0.0"
|
||||
},
|
||||
"bin": {
|
||||
@@ -1922,21 +1856,21 @@
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rolldown/binding-android-arm64": "1.1.5",
|
||||
"@rolldown/binding-darwin-arm64": "1.1.5",
|
||||
"@rolldown/binding-darwin-x64": "1.1.5",
|
||||
"@rolldown/binding-freebsd-x64": "1.1.5",
|
||||
"@rolldown/binding-linux-arm-gnueabihf": "1.1.5",
|
||||
"@rolldown/binding-linux-arm64-gnu": "1.1.5",
|
||||
"@rolldown/binding-linux-arm64-musl": "1.1.5",
|
||||
"@rolldown/binding-linux-ppc64-gnu": "1.1.5",
|
||||
"@rolldown/binding-linux-s390x-gnu": "1.1.5",
|
||||
"@rolldown/binding-linux-x64-gnu": "1.1.5",
|
||||
"@rolldown/binding-linux-x64-musl": "1.1.5",
|
||||
"@rolldown/binding-openharmony-arm64": "1.1.5",
|
||||
"@rolldown/binding-wasm32-wasi": "1.1.5",
|
||||
"@rolldown/binding-win32-arm64-msvc": "1.1.5",
|
||||
"@rolldown/binding-win32-x64-msvc": "1.1.5"
|
||||
"@rolldown/binding-android-arm-eabi": "1.2.6",
|
||||
"@rolldown/binding-android-arm64": "1.2.6",
|
||||
"@rolldown/binding-darwin-arm64": "1.2.6",
|
||||
"@rolldown/binding-darwin-x64": "1.2.6",
|
||||
"@rolldown/binding-freebsd-x64": "1.2.6",
|
||||
"@rolldown/binding-linux-arm-gnueabihf": "1.2.6",
|
||||
"@rolldown/binding-linux-arm64-gnu": "1.2.6",
|
||||
"@rolldown/binding-linux-arm64-musl": "1.2.6",
|
||||
"@rolldown/binding-linux-ppc64-gnu": "1.2.6",
|
||||
"@rolldown/binding-linux-s390x-gnu": "1.2.6",
|
||||
"@rolldown/binding-linux-x64-gnu": "1.2.6",
|
||||
"@rolldown/binding-linux-x64-musl": "1.2.6",
|
||||
"@rolldown/binding-openharmony-arm64": "1.2.6",
|
||||
"@rolldown/binding-win32-arm64-msvc": "1.2.6",
|
||||
"@rolldown/binding-win32-x64-msvc": "1.2.6"
|
||||
}
|
||||
},
|
||||
"node_modules/saxes": {
|
||||
@@ -2105,14 +2039,6 @@
|
||||
"node": ">=20"
|
||||
}
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||
"dev": true,
|
||||
"license": "0BSD",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "6.0.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz",
|
||||
@@ -2145,16 +2071,16 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "8.1.5",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-8.1.5.tgz",
|
||||
"integrity": "sha512-7ULLwsCdYx/nRyrpiEwvqb5TFHrMVZyBt+rg/OAXT7rgj/z+DtTDyKFeLAdDkubDVDKD8jOsndmy7m55XcfUsw==",
|
||||
"version": "8.2.2",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-8.2.2.tgz",
|
||||
"integrity": "sha512-cFKLV/PRgAUlIRm5WjMjJ86jrftzpqcgH+Us+DS8mI3CDNiH30Whrz8uHL3+MOLPAgqbMBAqWdAHAphOAM+z/Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"lightningcss": "^1.32.0",
|
||||
"lightningcss": "^1.33.0",
|
||||
"picomatch": "^4.0.5",
|
||||
"postcss": "^8.5.17",
|
||||
"rolldown": "~1.1.5",
|
||||
"postcss": "^8.5.26",
|
||||
"rolldown": "~1.2.4",
|
||||
"tinyglobby": "^0.2.17"
|
||||
},
|
||||
"bin": {
|
||||
@@ -2171,7 +2097,7 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/node": "^20.19.0 || >=22.12.0",
|
||||
"@vitejs/devtools": "^0.3.0",
|
||||
"@vitejs/devtools": "^0.4.0 || ^0.5.0",
|
||||
"esbuild": "^0.27.0 || ^0.28.0",
|
||||
"jiti": ">=1.21.0",
|
||||
"less": "^4.0.0",
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { Ref, ComputedRef } from 'vue'
|
||||
import { useProvidersStore } from '@/stores/providersStore'
|
||||
import { useServicesStore } from '@/stores/servicesStore'
|
||||
import { useNodesStore, ROOT_ID } from '@/stores/nodesStore'
|
||||
import type { ListFilter, ListSort, ListRange, ServiceIdentifier, CollectionIdentifier } from '@/types/common'
|
||||
import type { ListFilter, ListSort, ListRange } from '@/types/common'
|
||||
import type { DocumentInterface } from '@/types/document'
|
||||
import { CollectionObject } from '@/models/collection'
|
||||
import { EntityObject } from '@/models/entity'
|
||||
@@ -16,9 +16,6 @@ import { EntityObject } from '@/models/entity'
|
||||
// Base URL for file manager transfer endpoints
|
||||
const TRANSFER_BASE_URL = '/m/documents_manager'
|
||||
|
||||
// Number of collections+entities requested per page
|
||||
const DEFAULT_PAGE_TALLY = 64
|
||||
|
||||
export interface UseDocumentManagerOptions {
|
||||
providerId: string | Ref<string> | ComputedRef<string>
|
||||
serviceId: string | Ref<string> | ComputedRef<string>
|
||||
@@ -35,12 +32,6 @@ export function useDocumentManager(options: UseDocumentManagerOptions) {
|
||||
const currentProviderId = () => unref(providerId)
|
||||
const currentServiceId = () => unref(serviceId)
|
||||
|
||||
const currentSources = (): (ServiceIdentifier | CollectionIdentifier)[] => [
|
||||
currentLocation.value === ROOT_ID
|
||||
? `${currentProviderId()}:${currentServiceId()}`
|
||||
: `${currentProviderId()}:${currentServiceId()}:${currentLocation.value}`,
|
||||
]
|
||||
|
||||
// Current location (folder being viewed)
|
||||
const currentLocation: Ref<string> = ref(ROOT_ID)
|
||||
|
||||
@@ -48,13 +39,6 @@ export function useDocumentManager(options: UseDocumentManagerOptions) {
|
||||
const isLoading = computed(() => nodesStore.transceiving)
|
||||
const error = computed(() => nodesStore.error)
|
||||
|
||||
// Pagination state for the current location + filter + sort
|
||||
const currentFilter: Ref<ListFilter | undefined> = ref(undefined)
|
||||
const currentSort: Ref<ListSort | undefined> = ref(undefined)
|
||||
const loadedCount = ref(0)
|
||||
const hasMore = ref(false)
|
||||
const isLoadingMore = ref(false)
|
||||
|
||||
// Provider and service
|
||||
const provider = computed(() => providersStore.provider(currentProviderId()))
|
||||
const service = computed(() => servicesStore.service(currentProviderId(), currentServiceId()))
|
||||
@@ -87,7 +71,7 @@ export function useDocumentManager(options: UseDocumentManagerOptions) {
|
||||
// Navigate to a folder
|
||||
const navigateTo = async (collectionId: string | null) => {
|
||||
currentLocation.value = collectionId || ROOT_ID
|
||||
await resetAndLoad(currentFilter.value, currentSort.value)
|
||||
await refresh()
|
||||
}
|
||||
|
||||
// Navigate up one level
|
||||
@@ -106,55 +90,28 @@ export function useDocumentManager(options: UseDocumentManagerOptions) {
|
||||
await navigateTo(ROOT_ID)
|
||||
}
|
||||
|
||||
// Reset the current location's loaded items and (re)fetch the first page,
|
||||
// optionally with a new filter/sort (e.g. search query or sort field change)
|
||||
const resetAndLoad = async (filter?: ListFilter, sort?: ListSort) => {
|
||||
currentFilter.value = filter
|
||||
currentSort.value = sort
|
||||
loadedCount.value = 0
|
||||
hasMore.value = false
|
||||
|
||||
const range: ListRange = { type: 'tally', anchor: 'absolute', position: 0, tally: DEFAULT_PAGE_TALLY }
|
||||
const result = await nodesStore.fetchNodes(
|
||||
currentSources(),
|
||||
// Refresh current location
|
||||
const refresh = async (
|
||||
filter?: ListFilter,
|
||||
sort?: ListSort,
|
||||
range?: ListRange
|
||||
) => {
|
||||
await nodesStore.fetchNodes(
|
||||
currentProviderId(),
|
||||
currentServiceId(),
|
||||
currentLocation.value === ROOT_ID ? ROOT_ID : currentLocation.value,
|
||||
filter,
|
||||
sort,
|
||||
range,
|
||||
'reset'
|
||||
range
|
||||
)
|
||||
|
||||
loadedCount.value = result.collections.length + result.entities.length
|
||||
hasMore.value = !result.isLastPage
|
||||
}
|
||||
|
||||
// Fetch the next page of the current location (infinite scroll "load more")
|
||||
const loadMore = async () => {
|
||||
if (!hasMore.value || isLoadingMore.value) {
|
||||
return
|
||||
}
|
||||
|
||||
isLoadingMore.value = true
|
||||
try {
|
||||
const range: ListRange = { type: 'tally', anchor: 'absolute', position: loadedCount.value, tally: DEFAULT_PAGE_TALLY }
|
||||
const result = await nodesStore.fetchNodes(
|
||||
currentSources(),
|
||||
currentFilter.value,
|
||||
currentSort.value,
|
||||
range,
|
||||
'append'
|
||||
)
|
||||
|
||||
loadedCount.value += result.collections.length + result.entities.length
|
||||
hasMore.value = !result.isLastPage
|
||||
} finally {
|
||||
isLoadingMore.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new folder
|
||||
const createFolder = async (label: string): Promise<CollectionObject> => {
|
||||
return await nodesStore.createCollection(
|
||||
`${currentProviderId()}:${currentServiceId()}:${currentLocation.value}`,
|
||||
currentProviderId(),
|
||||
currentServiceId(),
|
||||
currentLocation.value === ROOT_ID ? ROOT_ID : currentLocation.value,
|
||||
{ label, owner: '' }
|
||||
)
|
||||
}
|
||||
@@ -175,7 +132,9 @@ export function useDocumentManager(options: UseDocumentManagerOptions) {
|
||||
}
|
||||
|
||||
return await nodesStore.createEntity(
|
||||
`${currentProviderId()}:${currentServiceId()}:${currentLocation.value}`,
|
||||
currentProviderId(),
|
||||
currentServiceId(),
|
||||
currentLocation.value === ROOT_ID ? ROOT_ID : currentLocation.value,
|
||||
properties
|
||||
)
|
||||
}
|
||||
@@ -188,7 +147,7 @@ export function useDocumentManager(options: UseDocumentManagerOptions) {
|
||||
}
|
||||
|
||||
if (node instanceof CollectionObject) {
|
||||
return await nodesStore.updateCollection(`${node.provider}:${node.service}:${nodeId}`, {
|
||||
return await nodesStore.updateCollection(currentProviderId(), currentServiceId(), nodeId, {
|
||||
label: newLabel,
|
||||
owner: node.properties.owner,
|
||||
})
|
||||
@@ -202,7 +161,7 @@ export function useDocumentManager(options: UseDocumentManagerOptions) {
|
||||
format: node.properties.format,
|
||||
encoding: node.properties.encoding,
|
||||
}
|
||||
return await nodesStore.updateEntity(`${node.provider}:${node.service}:${node.collection || ROOT_ID}:${nodeId}`, properties)
|
||||
return await nodesStore.updateEntity(currentProviderId(), currentServiceId(), node.collection, nodeId, properties)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,9 +173,9 @@ export function useDocumentManager(options: UseDocumentManagerOptions) {
|
||||
}
|
||||
|
||||
if (node instanceof CollectionObject) {
|
||||
return await nodesStore.deleteCollection(`${node.provider}:${node.service}:${nodeId}`)
|
||||
return await nodesStore.deleteCollection(currentProviderId(), currentServiceId(), nodeId)
|
||||
} else {
|
||||
return await nodesStore.deleteEntity(`${node.provider}:${node.service}:${node.collection || ROOT_ID}:${nodeId}`)
|
||||
return await nodesStore.deleteEntity(currentProviderId(), currentServiceId(), node.collection, nodeId)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +185,7 @@ export function useDocumentManager(options: UseDocumentManagerOptions) {
|
||||
if (!node || !(node instanceof EntityObject)) {
|
||||
throw new Error('Entity not found')
|
||||
}
|
||||
return await nodesStore.readEntity(`${node.provider}:${node.service}:${node.collection || ROOT_ID}:${entityId}`)
|
||||
return await nodesStore.readEntity(currentProviderId(), currentServiceId(), node.collection || ROOT_ID, entityId)
|
||||
}
|
||||
|
||||
// Write file content
|
||||
@@ -235,7 +194,7 @@ export function useDocumentManager(options: UseDocumentManagerOptions) {
|
||||
if (!node || !(node instanceof EntityObject)) {
|
||||
throw new Error('Entity not found')
|
||||
}
|
||||
return await nodesStore.writeEntity(`${node.provider}:${node.service}:${node.collection || ROOT_ID}:${entityId}`, content)
|
||||
return await nodesStore.writeEntity(currentProviderId(), currentServiceId(), node.collection, entityId, content)
|
||||
}
|
||||
|
||||
// Get a URL suitable for inline viewing (img src / video src)
|
||||
@@ -294,7 +253,7 @@ export function useDocumentManager(options: UseDocumentManagerOptions) {
|
||||
await providersStore.list([currentProviderId()])
|
||||
await servicesStore.list()
|
||||
if (autoFetch) {
|
||||
await resetAndLoad()
|
||||
await refresh()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,8 +262,6 @@ export function useDocumentManager(options: UseDocumentManagerOptions) {
|
||||
currentLocation,
|
||||
isLoading,
|
||||
error,
|
||||
hasMore,
|
||||
isLoadingMore,
|
||||
|
||||
// Provider/Service
|
||||
provider,
|
||||
@@ -322,8 +279,7 @@ export function useDocumentManager(options: UseDocumentManagerOptions) {
|
||||
navigateTo,
|
||||
navigateUp,
|
||||
navigateToRoot,
|
||||
resetAndLoad,
|
||||
loadMore,
|
||||
refresh,
|
||||
|
||||
// Operations
|
||||
createFolder,
|
||||
|
||||
@@ -25,11 +25,23 @@ import type {
|
||||
import { useIntegrationStore } from '@KTXC/stores/integrationStore';
|
||||
import { CollectionObject, CollectionPropertiesObject } from '../models/collection';
|
||||
|
||||
function isCollectionPayload(value: unknown): value is CollectionInterface {
|
||||
if (!value || typeof value !== 'object') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const candidate = value as Record<string, unknown>;
|
||||
return (
|
||||
('identifier' in candidate || 'provider' in candidate || 'service' in candidate)
|
||||
&& 'properties' in candidate
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to create the right collection model class based on provider identifier
|
||||
* Uses provider-specific factory if available, otherwise returns base CollectionObject
|
||||
*/
|
||||
export function createCollectionObject(data: CollectionInterface): CollectionObject {
|
||||
function createCollectionObject(data: CollectionInterface): CollectionObject {
|
||||
const integrationStore = useIntegrationStore();
|
||||
const factoryItem = integrationStore.getItemById('documents_collection_factory', data.provider) as any;
|
||||
const factory = factoryItem?.factory;
|
||||
@@ -56,27 +68,38 @@ export const collectionService = {
|
||||
const serviceList: Record<string, Record<string, CollectionObject>> = {};
|
||||
Object.entries(providerServices).forEach(([serviceId, serviceCollections]) => {
|
||||
const collectionList: Record<string, CollectionObject> = {};
|
||||
Object.entries(serviceCollections).forEach(([collectionId, collectionData]) => {
|
||||
collectionList[collectionId] = createCollectionObject(collectionData);
|
||||
Object.entries(serviceCollections as Record<string, unknown>).forEach(([collectionId, collectionData]) => {
|
||||
if (isCollectionPayload(collectionData)) {
|
||||
collectionList[collectionId] = createCollectionObject(collectionData);
|
||||
return;
|
||||
}
|
||||
|
||||
if (collectionData && typeof collectionData === 'object') {
|
||||
Object.entries(collectionData as Record<string, unknown>).forEach(([nestedCollectionId, nestedCollectionData]) => {
|
||||
if (isCollectionPayload(nestedCollectionData)) {
|
||||
collectionList[nestedCollectionId] = createCollectionObject(nestedCollectionData);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
serviceList[serviceId] = collectionList;
|
||||
});
|
||||
providerList[providerId] = serviceList;
|
||||
});
|
||||
|
||||
|
||||
return providerList;
|
||||
},
|
||||
|
||||
/**
|
||||
* Retrieve collections by resource identifier
|
||||
* Retrieve a specific collection by provider and identifier
|
||||
*
|
||||
* @param request - fetch request parameters
|
||||
*
|
||||
* @returns Promise with collections keyed by resource identifier
|
||||
* @returns Promise with collection object
|
||||
*/
|
||||
async fetch(request: CollectionFetchRequest): Promise<Record<string, CollectionObject>> {
|
||||
async fetch(request: CollectionFetchRequest): Promise<CollectionObject> {
|
||||
const response = await transceivePost<CollectionFetchRequest, CollectionFetchResponse>('collection.fetch', request);
|
||||
return Object.fromEntries(Object.entries(response).map(([target, data]) => [target, createCollectionObject(data)]));
|
||||
return createCollectionObject(response);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,7 +35,7 @@ import { EntityObject } from '../models';
|
||||
* Helper to create the right entity model class based on provider identifier
|
||||
* Uses provider-specific factory if available, otherwise returns base EntityObject
|
||||
*/
|
||||
export function createEntityObject(data: EntityInterface): EntityObject {
|
||||
function createEntityObject(data: EntityInterface): EntityObject {
|
||||
const integrationStore = useIntegrationStore();
|
||||
const factoryItem = integrationStore.getItemById('documents_entity_factory', data.provider) as any;
|
||||
const factory = factoryItem?.factory;
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
import { transceiveStream } from './transceive';
|
||||
import type { NodeListRequest, NodeInterface } from '../types/node';
|
||||
import { createCollectionObject } from './collectionService';
|
||||
import { createEntityObject } from './entityService';
|
||||
import type { CollectionObject } from '../models/collection';
|
||||
import type { EntityObject } from '../models/entity';
|
||||
|
||||
export type NodeListResult = (CollectionObject | EntityObject)[];
|
||||
|
||||
export const nodeService = {
|
||||
/** Hydrate a mixed page in the exact order returned by the provider. */
|
||||
async list(request: NodeListRequest = {}): Promise<NodeListResult> {
|
||||
const nodes: NodeListResult = [];
|
||||
const { total } = await transceiveStream<NodeListRequest, NodeInterface>('node.list', request, node => {
|
||||
switch (node['@type']) {
|
||||
case 'document:collection':
|
||||
nodes.push(createCollectionObject(node));
|
||||
break;
|
||||
case 'document:entity':
|
||||
nodes.push(createEntityObject(node));
|
||||
break;
|
||||
default:
|
||||
throw new Error('Unsupported node type in node.list response');
|
||||
}
|
||||
}, { requireEnd: true });
|
||||
if (total !== nodes.length) {
|
||||
throw new Error('Incomplete node.list stream');
|
||||
}
|
||||
// Publish only complete pages so a retry uses the same offset after failure.
|
||||
return nodes;
|
||||
},
|
||||
};
|
||||
|
||||
export default nodeService;
|
||||
@@ -62,7 +62,7 @@ export async function transceiveStream<TRequest, TData>(
|
||||
operation: string,
|
||||
data: TRequest,
|
||||
onData: (data: TData) => void,
|
||||
options?: { user?: string; onStart?: (expected?: number) => void; requireEnd?: boolean }
|
||||
options?: { user?: string; onStart?: (expected?: number) => void }
|
||||
): Promise<{ total: number }> {
|
||||
const request: ApiRequest<TRequest> = {
|
||||
version: API_VERSION,
|
||||
@@ -73,7 +73,6 @@ export async function transceiveStream<TRequest, TData>(
|
||||
};
|
||||
|
||||
let total = 0;
|
||||
let ended = false;
|
||||
|
||||
const dispatch = (line: string): void => {
|
||||
const message = JSON.parse(line) as ApiStreamResponse<TData>;
|
||||
@@ -83,7 +82,6 @@ export async function transceiveStream<TRequest, TData>(
|
||||
options?.onStart?.(message.total);
|
||||
} else if (message.status === 'end') {
|
||||
total = message.total;
|
||||
ended = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -120,7 +118,6 @@ export async function transceiveStream<TRequest, TData>(
|
||||
}
|
||||
}
|
||||
|
||||
buffer += decoder.decode();
|
||||
if (buffer.trim()) dispatch(buffer);
|
||||
} finally {
|
||||
reader.releaseLock();
|
||||
@@ -128,8 +125,5 @@ export async function transceiveStream<TRequest, TData>(
|
||||
},
|
||||
});
|
||||
|
||||
if (options?.requireEnd && !ended) {
|
||||
throw new Error(`[${operation}] Stream ended without a completion frame`);
|
||||
}
|
||||
return { total };
|
||||
}
|
||||
|
||||
@@ -40,25 +40,25 @@ export const useCollectionsStore = defineStore('documentsCollectionsStore', () =
|
||||
return `${provider}:${service ?? ''}:${identifier ?? ''}`
|
||||
}
|
||||
|
||||
function collection(target: CollectionIdentifier, retrieve: boolean = false): CollectionObject | null {
|
||||
const key = target
|
||||
function collection(provider: string, service: string | number, identifier: string | number, retrieve: boolean = false): CollectionObject | null {
|
||||
const key = identifierKey(provider, service, identifier)
|
||||
if (retrieve === true && !_collections.value[key]) {
|
||||
console.debug(`[Documents Manager][Store] - Force fetching collection "${key}"`)
|
||||
void fetch([target])
|
||||
fetch(provider, service, identifier)
|
||||
}
|
||||
|
||||
return _collections.value[key] || null
|
||||
}
|
||||
|
||||
function collectionsForService(target: ServiceIdentifier): CollectionObject[] {
|
||||
const serviceKeyPrefix = `${target}:`
|
||||
function collectionsForService(provider: string, service: string | number): CollectionObject[] {
|
||||
const serviceKeyPrefix = `${provider}:${service}:`
|
||||
return Object.entries(_collections.value)
|
||||
.filter(([key]) => key.startsWith(serviceKeyPrefix))
|
||||
.map(([_, collectionObj]) => collectionObj)
|
||||
}
|
||||
|
||||
function clearService(target: ServiceIdentifier): void {
|
||||
const serviceKeyPrefix = `${target}:`
|
||||
function clearService(provider: string, service: string | number): void {
|
||||
const serviceKeyPrefix = `${provider}:${service}:`
|
||||
Object.keys(_collections.value)
|
||||
.filter((key) => key.startsWith(serviceKeyPrefix))
|
||||
.forEach((key) => {
|
||||
@@ -70,27 +70,6 @@ export const useCollectionsStore = defineStore('documentsCollectionsStore', () =
|
||||
_collections.value = {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge externally-hydrated collections into the store (used by paginated node fetches)
|
||||
*/
|
||||
function mergeMany(collections: CollectionObject[]): void {
|
||||
const hydrated: Record<string, CollectionObject> = {}
|
||||
collections.forEach((collectionObj) => {
|
||||
const key = identifierKey(collectionObj.provider, collectionObj.service, collectionObj.identifier)
|
||||
hydrated[key] = collectionObj
|
||||
})
|
||||
_collections.value = { ..._collections.value, ...hydrated }
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove specific collections by their own identifiers (used to evict a stale page before a reset)
|
||||
*/
|
||||
function removeMany(targets: CollectionIdentifier[]): void {
|
||||
targets.forEach((target) => {
|
||||
delete _collections.value[target]
|
||||
})
|
||||
}
|
||||
|
||||
// Actions
|
||||
async function list(sources?: (ServiceIdentifier | CollectionIdentifier)[], filter?: ListFilter, sort?: ListSort): Promise<Record<string, CollectionObject>> {
|
||||
transceiving.value = true
|
||||
@@ -119,11 +98,14 @@ export const useCollectionsStore = defineStore('documentsCollectionsStore', () =
|
||||
}
|
||||
}
|
||||
|
||||
async function fetch(targets: CollectionIdentifier[]): Promise<Record<string, CollectionObject>> {
|
||||
async function fetch(provider: string, service: string | number, identifier: string | number): Promise<CollectionObject> {
|
||||
transceiving.value = true
|
||||
try {
|
||||
const response = await collectionService.fetch({ targets })
|
||||
_collections.value = { ..._collections.value, ...response }
|
||||
const response = await collectionService.fetch({ targets: [`${provider}:${service}:${identifier}`] })
|
||||
const key = identifierKey(response.provider, response.service, response.identifier)
|
||||
_collections.value[key] = response
|
||||
|
||||
console.debug('[Documents Manager][Store] - Successfully fetched collection:', key)
|
||||
return response
|
||||
} catch (error: any) {
|
||||
console.error('[Documents Manager][Store] - Failed to fetch collection:', error)
|
||||
@@ -148,12 +130,17 @@ export const useCollectionsStore = defineStore('documentsCollectionsStore', () =
|
||||
}
|
||||
|
||||
async function create(
|
||||
target: ServiceIdentifier | CollectionIdentifier,
|
||||
provider: string,
|
||||
service: string | number,
|
||||
collection: string | number | null,
|
||||
properties: CollectionMutableProperties,
|
||||
): Promise<CollectionObject> {
|
||||
transceiving.value = true
|
||||
try {
|
||||
const response = await collectionService.create({ target, properties })
|
||||
const target: CollectionIdentifier | undefined = collection !== null && collection !== undefined && collection !== ''
|
||||
? `${provider}:${service}:${collection}`
|
||||
: undefined
|
||||
const response = await collectionService.create({ provider, service: String(service), target, properties })
|
||||
const key = identifierKey(response.provider, response.service, response.identifier)
|
||||
_collections.value[key] = response
|
||||
|
||||
@@ -168,12 +155,14 @@ export const useCollectionsStore = defineStore('documentsCollectionsStore', () =
|
||||
}
|
||||
|
||||
async function update(
|
||||
target: CollectionIdentifier,
|
||||
provider: string,
|
||||
service: string | number,
|
||||
identifier: string | number,
|
||||
properties: CollectionMutableProperties,
|
||||
): Promise<CollectionObject> {
|
||||
transceiving.value = true
|
||||
try {
|
||||
const response = await collectionService.update({ target, properties })
|
||||
const response = await collectionService.update({ target: `${provider}:${service}:${identifier}`, properties })
|
||||
const key = identifierKey(response.provider, response.service, response.identifier)
|
||||
_collections.value[key] = response
|
||||
|
||||
@@ -187,16 +176,17 @@ export const useCollectionsStore = defineStore('documentsCollectionsStore', () =
|
||||
}
|
||||
}
|
||||
|
||||
async function remove(target: CollectionIdentifier): Promise<{ success: boolean }> {
|
||||
async function remove(provider: string, service: string | number, identifier: string | number): Promise<{ success: boolean }> {
|
||||
transceiving.value = true
|
||||
try {
|
||||
const response = await collectionService.delete({ target })
|
||||
const response = await collectionService.delete({ target: `${provider}:${service}:${identifier}` })
|
||||
const success = response.disposition === 'deleted' || response.disposition === 'moved'
|
||||
if (success) {
|
||||
delete _collections.value[target]
|
||||
const key = identifierKey(provider, service, identifier)
|
||||
delete _collections.value[key]
|
||||
}
|
||||
|
||||
console.debug('[Documents Manager][Store] - Successfully deleted collection:', target)
|
||||
console.debug('[Documents Manager][Store] - Successfully deleted collection:', `${provider}:${service}:${identifier}`)
|
||||
return { success }
|
||||
} catch (error: any) {
|
||||
console.error('[Documents Manager][Store] - Failed to delete collection:', error)
|
||||
@@ -216,8 +206,6 @@ export const useCollectionsStore = defineStore('documentsCollectionsStore', () =
|
||||
collectionsForService,
|
||||
clearService,
|
||||
clearAll,
|
||||
mergeMany,
|
||||
removeMany,
|
||||
list,
|
||||
fetch,
|
||||
extant,
|
||||
|
||||
+62
-48
@@ -49,34 +49,37 @@ export const useEntitiesStore = defineStore('documentsEntitiesStore', () => {
|
||||
}
|
||||
|
||||
function entity(
|
||||
target: EntityIdentifier,
|
||||
provider: string,
|
||||
service: string | number,
|
||||
collection: string | number,
|
||||
identifier: string | number,
|
||||
retrieve: boolean = false,
|
||||
): EntityObject | null {
|
||||
const key = target
|
||||
const key = identifierKey(provider, service, collection, identifier)
|
||||
if (retrieve === true && !_entities.value[key]) {
|
||||
console.debug(`[Documents Manager][Store] - Force fetching entity "${key}"`)
|
||||
void fetch([target])
|
||||
fetch(provider, service, collection, [identifier])
|
||||
}
|
||||
|
||||
return _entities.value[key] || null
|
||||
}
|
||||
|
||||
function entitiesForService(target: ServiceIdentifier): EntityObject[] {
|
||||
const serviceKeyPrefix = `${target}:`
|
||||
function entitiesForService(provider: string, service: string | number): EntityObject[] {
|
||||
const serviceKeyPrefix = `${provider}:${service}:`
|
||||
return Object.entries(_entities.value)
|
||||
.filter(([key]) => key.startsWith(serviceKeyPrefix))
|
||||
.map(([_, entityObj]) => entityObj)
|
||||
}
|
||||
|
||||
function entitiesForCollection(target: CollectionIdentifier): EntityObject[] {
|
||||
const collectionKeyPrefix = `${target}:`
|
||||
function entitiesForCollection(provider: string, service: string | number, collection: string | number): EntityObject[] {
|
||||
const collectionKeyPrefix = `${provider}:${service}:${collection}:`
|
||||
return Object.entries(_entities.value)
|
||||
.filter(([key]) => key.startsWith(collectionKeyPrefix))
|
||||
.map(([_, entityObj]) => entityObj)
|
||||
}
|
||||
|
||||
function clearService(target: ServiceIdentifier): void {
|
||||
const serviceKeyPrefix = `${target}:`
|
||||
function clearService(provider: string, service: string | number): void {
|
||||
const serviceKeyPrefix = `${provider}:${service}:`
|
||||
Object.keys(_entities.value)
|
||||
.filter((key) => key.startsWith(serviceKeyPrefix))
|
||||
.forEach((key) => {
|
||||
@@ -84,8 +87,8 @@ export const useEntitiesStore = defineStore('documentsEntitiesStore', () => {
|
||||
})
|
||||
}
|
||||
|
||||
function clearCollection(target: CollectionIdentifier): void {
|
||||
const collectionKeyPrefix = `${target}:`
|
||||
function clearCollection(provider: string, service: string | number, collection: string | number): void {
|
||||
const collectionKeyPrefix = `${provider}:${service}:${collection}:`
|
||||
Object.keys(_entities.value)
|
||||
.filter((key) => key.startsWith(collectionKeyPrefix))
|
||||
.forEach((key) => {
|
||||
@@ -97,18 +100,6 @@ export const useEntitiesStore = defineStore('documentsEntitiesStore', () => {
|
||||
_entities.value = {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge externally-hydrated entities into the store (used by paginated node fetches)
|
||||
*/
|
||||
function mergeMany(entities: EntityObject[]): void {
|
||||
const hydrated: Record<string, EntityObject> = {}
|
||||
entities.forEach((entityObj) => {
|
||||
const key = identifierKey(entityObj.provider, entityObj.service, entityObj.collection, entityObj.identifier)
|
||||
hydrated[key] = entityObj
|
||||
})
|
||||
_entities.value = { ..._entities.value, ...hydrated }
|
||||
}
|
||||
|
||||
// Actions
|
||||
async function list(sources?: (ServiceIdentifier | CollectionIdentifier)[], filter?: ListFilter, sort?: ListSort, range?: ListRange): Promise<Record<string, EntityObject>> {
|
||||
transceiving.value = true
|
||||
@@ -140,13 +131,25 @@ export const useEntitiesStore = defineStore('documentsEntitiesStore', () => {
|
||||
}
|
||||
|
||||
async function fetch(
|
||||
targets: EntityIdentifier[],
|
||||
provider: string,
|
||||
service: string | number,
|
||||
collection: string | number,
|
||||
identifiers: (string | number)[],
|
||||
): Promise<Record<string, EntityObject>> {
|
||||
transceiving.value = true
|
||||
try {
|
||||
const targets: EntityIdentifier[] = identifiers.map((identifier) => `${provider}:${service}:${collection}:${identifier}` as EntityIdentifier)
|
||||
const response = await entityService.fetch({ targets })
|
||||
_entities.value = { ..._entities.value, ...response }
|
||||
return response
|
||||
|
||||
const hydrated: Record<string, EntityObject> = {}
|
||||
Object.entries(response).forEach(([identifier, entityObj]) => {
|
||||
const key = identifierKey(provider, service, collection, identifier)
|
||||
hydrated[key] = entityObj
|
||||
_entities.value[key] = entityObj
|
||||
})
|
||||
|
||||
console.debug('[Documents Manager][Store] - Successfully fetched', Object.keys(hydrated).length, 'entities')
|
||||
return hydrated
|
||||
} catch (error: any) {
|
||||
console.error('[Documents Manager][Store] - Failed to fetch entities:', error)
|
||||
throw error
|
||||
@@ -170,13 +173,15 @@ export const useEntitiesStore = defineStore('documentsEntitiesStore', () => {
|
||||
}
|
||||
|
||||
async function create(
|
||||
target: CollectionIdentifier,
|
||||
provider: string,
|
||||
service: string | number,
|
||||
collection: string | number,
|
||||
properties: DocumentInterface,
|
||||
options?: Record<string, unknown>,
|
||||
): Promise<EntityObject> {
|
||||
transceiving.value = true
|
||||
try {
|
||||
const response = await entityService.create({ target, properties, options })
|
||||
const response = await entityService.create({ target: `${provider}:${service}:${collection}`, properties, options })
|
||||
const key = identifierKey(response.provider, response.service, response.collection, response.identifier)
|
||||
_entities.value[key] = response
|
||||
|
||||
@@ -191,12 +196,15 @@ export const useEntitiesStore = defineStore('documentsEntitiesStore', () => {
|
||||
}
|
||||
|
||||
async function update(
|
||||
target: EntityIdentifier,
|
||||
provider: string,
|
||||
service: string | number,
|
||||
collection: string | number,
|
||||
identifier: string | number,
|
||||
properties: DocumentInterface,
|
||||
): Promise<EntityObject> {
|
||||
transceiving.value = true
|
||||
try {
|
||||
const response = await entityService.update({ target, properties })
|
||||
const response = await entityService.update({ target: `${provider}:${service}:${collection}:${identifier}`, properties })
|
||||
const key = identifierKey(response.provider, response.service, response.collection, response.identifier)
|
||||
_entities.value[key] = response
|
||||
|
||||
@@ -211,22 +219,23 @@ export const useEntitiesStore = defineStore('documentsEntitiesStore', () => {
|
||||
}
|
||||
|
||||
async function remove(
|
||||
targets: EntityIdentifier[],
|
||||
): Promise<{ successes: EntityIdentifier[]; failures: EntityIdentifier[] }> {
|
||||
provider: string,
|
||||
service: string | number,
|
||||
collection: string | number,
|
||||
identifier: string | number,
|
||||
): Promise<{ success: boolean }> {
|
||||
transceiving.value = true
|
||||
try {
|
||||
const response = await entityService.delete({ targets })
|
||||
const successes: EntityIdentifier[] = []
|
||||
const failures: EntityIdentifier[] = []
|
||||
for (const target of targets) {
|
||||
if (response[target]?.disposition === 'deleted') {
|
||||
delete _entities.value[target]
|
||||
successes.push(target)
|
||||
} else {
|
||||
failures.push(target)
|
||||
}
|
||||
const target: EntityIdentifier = `${provider}:${service}:${collection}:${identifier}`
|
||||
const response = await entityService.delete({ targets: [target] })
|
||||
const success = response[target]?.disposition === 'deleted'
|
||||
if (success) {
|
||||
const key = identifierKey(provider, service, collection, identifier)
|
||||
delete _entities.value[key]
|
||||
}
|
||||
return { successes, failures }
|
||||
|
||||
console.debug('[Documents Manager][Store] - Successfully deleted entity:', target)
|
||||
return { success }
|
||||
} catch (error: any) {
|
||||
console.error('[Documents Manager][Store] - Failed to delete entity:', error)
|
||||
throw error
|
||||
@@ -268,11 +277,14 @@ export const useEntitiesStore = defineStore('documentsEntitiesStore', () => {
|
||||
}
|
||||
|
||||
async function read(
|
||||
target: EntityIdentifier,
|
||||
provider: string,
|
||||
service: string | number,
|
||||
collection: string | number,
|
||||
identifier: string | number,
|
||||
): Promise<string | null> {
|
||||
transceiving.value = true
|
||||
try {
|
||||
const response = await entityService.read({ target })
|
||||
const response = await entityService.read({ target: `${provider}:${service}:${collection}:${identifier}` })
|
||||
return response.content
|
||||
} catch (error: any) {
|
||||
console.error('[Documents Manager][Store] - Failed to read entity:', error)
|
||||
@@ -283,12 +295,15 @@ export const useEntitiesStore = defineStore('documentsEntitiesStore', () => {
|
||||
}
|
||||
|
||||
async function write(
|
||||
target: EntityIdentifier,
|
||||
provider: string,
|
||||
service: string | number,
|
||||
collection: string | number,
|
||||
identifier: string | number,
|
||||
content: string,
|
||||
): Promise<number> {
|
||||
transceiving.value = true
|
||||
try {
|
||||
const response = await entityService.write({ target, content, encoding: 'base64' })
|
||||
const response = await entityService.write({ target: `${provider}:${service}:${collection}:${identifier}`, content, encoding: 'base64' })
|
||||
return response.bytesWritten
|
||||
} catch (error: any) {
|
||||
console.error('[Documents Manager][Store] - Failed to write entity:', error)
|
||||
@@ -310,7 +325,6 @@ export const useEntitiesStore = defineStore('documentsEntitiesStore', () => {
|
||||
clearService,
|
||||
clearCollection,
|
||||
clearAll,
|
||||
mergeMany,
|
||||
list,
|
||||
fetch,
|
||||
extant,
|
||||
|
||||
+68
-76
@@ -6,7 +6,6 @@ import { computed, ref, readonly } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
import type {
|
||||
CollectionIdentifier,
|
||||
EntityIdentifier,
|
||||
ServiceIdentifier,
|
||||
ListFilter,
|
||||
ListSort,
|
||||
@@ -17,7 +16,6 @@ import type {
|
||||
import { CollectionObject, EntityObject } from '../models'
|
||||
import { useCollectionsStore } from './collectionsStore'
|
||||
import { useEntitiesStore } from './entitiesStore'
|
||||
import { nodeService } from '../services/nodeService'
|
||||
|
||||
export const ROOT_ID = '00000000-0000-0000-0000-000000000000'
|
||||
|
||||
@@ -48,8 +46,8 @@ export const useNodesStore = defineStore('documentsNodesStore', () => {
|
||||
|
||||
function getServiceNodes(providerId: string, serviceId: string | number): NodeRecord[] {
|
||||
return [
|
||||
...collectionsStore.collectionsForService(`${providerId}:${serviceId}`),
|
||||
...entitiesStore.entitiesForService(`${providerId}:${serviceId}`),
|
||||
...collectionsStore.collectionsForService(providerId, serviceId),
|
||||
...entitiesStore.entitiesForService(providerId, serviceId),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -107,13 +105,20 @@ export const useNodesStore = defineStore('documentsNodesStore', () => {
|
||||
}
|
||||
|
||||
async function fetchCollections(
|
||||
sources?: (ServiceIdentifier | CollectionIdentifier)[],
|
||||
providerId: string,
|
||||
serviceId: string | number,
|
||||
collectionId: string | number | null,
|
||||
filter?: ListFilter,
|
||||
sort?: ListSort,
|
||||
): Promise<CollectionObject[]> {
|
||||
error.value = null
|
||||
try {
|
||||
return Object.values(await collectionsStore.list(sources, filter, sort))
|
||||
const sources: (ServiceIdentifier | CollectionIdentifier)[] = collectionId === null
|
||||
? [`${providerId}:${serviceId}`]
|
||||
: [`${providerId}:${serviceId}:${collectionId}`]
|
||||
|
||||
await collectionsStore.list(sources, filter, sort)
|
||||
return collectionsStore.collectionsForService(providerId, serviceId)
|
||||
} catch (e) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to fetch collections'
|
||||
throw e
|
||||
@@ -121,76 +126,43 @@ export const useNodesStore = defineStore('documentsNodesStore', () => {
|
||||
}
|
||||
|
||||
async function fetchEntities(
|
||||
sources?: (ServiceIdentifier | CollectionIdentifier)[],
|
||||
providerId: string,
|
||||
serviceId: string | number,
|
||||
collectionId: string | number | null,
|
||||
filter?: ListFilter,
|
||||
sort?: ListSort,
|
||||
range?: ListRange,
|
||||
): Promise<EntityObject[]> {
|
||||
error.value = null
|
||||
try {
|
||||
return Object.values(await entitiesStore.list(sources, filter, sort, range))
|
||||
const sources: (ServiceIdentifier | CollectionIdentifier)[] = collectionId === null
|
||||
? [`${providerId}:${serviceId}`]
|
||||
: [`${providerId}:${serviceId}:${collectionId}`]
|
||||
|
||||
await entitiesStore.list(sources, filter, sort, range)
|
||||
return entitiesStore.entitiesForCollection(providerId, serviceId, collectionId)
|
||||
} catch (e) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to fetch entities'
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a unified node listing, optionally limited to a page by range.
|
||||
*/
|
||||
async function fetchNodes(
|
||||
sources?: (ServiceIdentifier | CollectionIdentifier)[],
|
||||
providerId: string,
|
||||
serviceId: string | number,
|
||||
parentId: string | number | null = ROOT_ID,
|
||||
filter?: ListFilter,
|
||||
sort?: ListSort,
|
||||
range?: ListRange,
|
||||
mode: 'reset' | 'append' = 'reset',
|
||||
): Promise<{ collections: CollectionObject[]; entities: EntityObject[]; isLastPage: boolean }> {
|
||||
): Promise<NodeRecord[]> {
|
||||
error.value = null
|
||||
try {
|
||||
const result = await nodeService.list({ sources, filter, sort, range })
|
||||
await Promise.all([
|
||||
fetchCollections(providerId, serviceId, parentId, filter, sort),
|
||||
fetchEntities(providerId, serviceId, parentId, filter, sort, range),
|
||||
])
|
||||
|
||||
// Service selectors list the root; collection selectors list that folder.
|
||||
// Omitted sources list roots across services, not every cached descendant.
|
||||
const locations = new Map<string, { provider: string; service: string; parent: string }>()
|
||||
if (sources?.length) {
|
||||
for (const source of sources) {
|
||||
const [provider, service, parent] = source.split(':')
|
||||
const location = { provider: provider!, service: service!, parent: isRoot(parent) ? ROOT_ID : parent! }
|
||||
locations.set(`${location.provider}:${location.service}:${location.parent}`, location)
|
||||
}
|
||||
} else {
|
||||
for (const node of [...nodeList.value, ...result]) {
|
||||
const location = { provider: node.provider, service: String(node.service), parent: ROOT_ID }
|
||||
locations.set(`${location.provider}:${location.service}:${ROOT_ID}`, location)
|
||||
}
|
||||
}
|
||||
|
||||
// Replace only the selected locations, and only after the stream succeeds.
|
||||
if (mode === 'reset') {
|
||||
for (const { provider, service, parent } of locations.values()) {
|
||||
const staleIds = getChildCollections(provider, service, parent)
|
||||
.map((node): CollectionIdentifier => `${node.provider}:${node.service}:${node.identifier}`)
|
||||
collectionsStore.removeMany(staleIds)
|
||||
entitiesStore.clearCollection(`${provider}:${service}:${parent}`)
|
||||
}
|
||||
}
|
||||
|
||||
const pageCollections = result.filter((node): node is CollectionObject => node instanceof CollectionObject)
|
||||
const pageEntities = result.filter((node): node is EntityObject => node instanceof EntityObject)
|
||||
|
||||
collectionsStore.mergeMany(pageCollections)
|
||||
entitiesStore.mergeMany(pageEntities)
|
||||
|
||||
// The backend applies the range independently to each selected location.
|
||||
const counts = new Map<string, number>()
|
||||
for (const node of result) {
|
||||
const parent = isRoot(node.collection) ? ROOT_ID : String(node.collection)
|
||||
const key = `${node.provider}:${node.service}:${parent}`
|
||||
counts.set(key, (counts.get(key) ?? 0) + 1)
|
||||
}
|
||||
const isLastPage = range === undefined || [...counts.values()].every(count => count < range.tally)
|
||||
|
||||
return { collections: pageCollections, entities: pageEntities, isLastPage }
|
||||
return getChildren(providerId, serviceId, parentId)
|
||||
} catch (e) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to fetch nodes'
|
||||
throw e
|
||||
@@ -198,12 +170,14 @@ export const useNodesStore = defineStore('documentsNodesStore', () => {
|
||||
}
|
||||
|
||||
async function createCollection(
|
||||
target: ServiceIdentifier | CollectionIdentifier,
|
||||
providerId: string,
|
||||
serviceId: string | number,
|
||||
parentCollectionId: string | number | null,
|
||||
properties: CollectionMutableProperties,
|
||||
): Promise<CollectionObject> {
|
||||
error.value = null
|
||||
try {
|
||||
return await collectionsStore.create(target, properties)
|
||||
return await collectionsStore.create(providerId, serviceId, parentCollectionId, properties)
|
||||
} catch (e) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to create collection'
|
||||
throw e
|
||||
@@ -211,12 +185,14 @@ export const useNodesStore = defineStore('documentsNodesStore', () => {
|
||||
}
|
||||
|
||||
async function updateCollection(
|
||||
target: CollectionIdentifier,
|
||||
providerId: string,
|
||||
serviceId: string | number,
|
||||
identifier: string | number,
|
||||
properties: CollectionMutableProperties,
|
||||
): Promise<CollectionObject> {
|
||||
error.value = null
|
||||
try {
|
||||
return await collectionsStore.update(target, properties)
|
||||
return await collectionsStore.update(providerId, serviceId, identifier, properties)
|
||||
} catch (e) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to update collection'
|
||||
throw e
|
||||
@@ -224,11 +200,13 @@ export const useNodesStore = defineStore('documentsNodesStore', () => {
|
||||
}
|
||||
|
||||
async function deleteCollection(
|
||||
target: CollectionIdentifier,
|
||||
providerId: string,
|
||||
serviceId: string | number,
|
||||
identifier: string | number,
|
||||
): Promise<boolean> {
|
||||
error.value = null
|
||||
try {
|
||||
const response = await collectionsStore.delete(target)
|
||||
const response = await collectionsStore.delete(providerId, serviceId, identifier)
|
||||
return response.success
|
||||
} catch (e) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to delete collection'
|
||||
@@ -237,13 +215,15 @@ export const useNodesStore = defineStore('documentsNodesStore', () => {
|
||||
}
|
||||
|
||||
async function createEntity(
|
||||
target: CollectionIdentifier,
|
||||
providerId: string,
|
||||
serviceId: string | number,
|
||||
collectionId: string | number,
|
||||
properties: DocumentInterface,
|
||||
options?: Record<string, unknown>,
|
||||
): Promise<EntityObject> {
|
||||
error.value = null
|
||||
try {
|
||||
return await entitiesStore.create(target, properties, options)
|
||||
return await entitiesStore.create(providerId, serviceId, collectionId, properties, options)
|
||||
} catch (e) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to create entity'
|
||||
throw e
|
||||
@@ -251,12 +231,15 @@ export const useNodesStore = defineStore('documentsNodesStore', () => {
|
||||
}
|
||||
|
||||
async function updateEntity(
|
||||
target: EntityIdentifier,
|
||||
providerId: string,
|
||||
serviceId: string | number,
|
||||
collectionId: string | number,
|
||||
identifier: string | number,
|
||||
properties: DocumentInterface,
|
||||
): Promise<EntityObject> {
|
||||
error.value = null
|
||||
try {
|
||||
return await entitiesStore.update(target, properties)
|
||||
return await entitiesStore.update(providerId, serviceId, collectionId, identifier, properties)
|
||||
} catch (e) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to update entity'
|
||||
throw e
|
||||
@@ -264,12 +247,15 @@ export const useNodesStore = defineStore('documentsNodesStore', () => {
|
||||
}
|
||||
|
||||
async function deleteEntity(
|
||||
target: EntityIdentifier,
|
||||
providerId: string,
|
||||
serviceId: string | number,
|
||||
collectionId: string | number,
|
||||
identifier: string | number,
|
||||
): Promise<boolean> {
|
||||
error.value = null
|
||||
try {
|
||||
const response = await entitiesStore.delete([target])
|
||||
return response.successes.includes(target)
|
||||
const response = await entitiesStore.delete(providerId, serviceId, collectionId, identifier)
|
||||
return response.success
|
||||
} catch (e) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to delete entity'
|
||||
throw e
|
||||
@@ -277,11 +263,14 @@ export const useNodesStore = defineStore('documentsNodesStore', () => {
|
||||
}
|
||||
|
||||
async function readEntity(
|
||||
target: EntityIdentifier,
|
||||
providerId: string,
|
||||
serviceId: string | number,
|
||||
collectionId: string | number,
|
||||
identifier: string | number,
|
||||
): Promise<string | null> {
|
||||
error.value = null
|
||||
try {
|
||||
return await entitiesStore.read(target)
|
||||
return await entitiesStore.read(providerId, serviceId, collectionId, identifier)
|
||||
} catch (e) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to read entity'
|
||||
throw e
|
||||
@@ -289,12 +278,15 @@ export const useNodesStore = defineStore('documentsNodesStore', () => {
|
||||
}
|
||||
|
||||
async function writeEntity(
|
||||
target: EntityIdentifier,
|
||||
providerId: string,
|
||||
serviceId: string | number,
|
||||
collectionId: string | number,
|
||||
identifier: string | number,
|
||||
content: string,
|
||||
): Promise<number> {
|
||||
error.value = null
|
||||
try {
|
||||
return await entitiesStore.write(target, content)
|
||||
return await entitiesStore.write(providerId, serviceId, collectionId, identifier, content)
|
||||
} catch (e) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to write entity'
|
||||
throw e
|
||||
@@ -302,8 +294,8 @@ export const useNodesStore = defineStore('documentsNodesStore', () => {
|
||||
}
|
||||
|
||||
function clearServiceNodes(providerId: string, serviceId: string | number): void {
|
||||
collectionsStore.clearService(`${providerId}:${serviceId}`)
|
||||
entitiesStore.clearService(`${providerId}:${serviceId}`)
|
||||
collectionsStore.clearService(providerId, serviceId)
|
||||
entitiesStore.clearService(providerId, serviceId)
|
||||
}
|
||||
|
||||
function clearNodes(): void {
|
||||
|
||||
@@ -66,7 +66,7 @@ export interface CollectionFetchRequest {
|
||||
targets: CollectionIdentifier[];
|
||||
}
|
||||
|
||||
export type CollectionFetchResponse = Record<CollectionIdentifier, CollectionInterface>;
|
||||
export interface CollectionFetchResponse extends CollectionInterface {}
|
||||
|
||||
/**
|
||||
* Collection extant
|
||||
@@ -87,7 +87,9 @@ export interface CollectionExtantResponse {
|
||||
* Collection create
|
||||
*/
|
||||
export interface CollectionCreateRequest {
|
||||
target: ServiceIdentifier | CollectionIdentifier; // Service root or parent collection
|
||||
provider: string;
|
||||
service: string | number;
|
||||
target?: CollectionIdentifier | null; // Parent collection identifier (absent for root)
|
||||
properties: CollectionMutableProperties;
|
||||
options?: Record<string, unknown>;
|
||||
}
|
||||
@@ -137,4 +139,4 @@ export interface CollectionMoveRequest {
|
||||
target?: CollectionIdentifier | null; // Destination parent (absent for root)
|
||||
}
|
||||
|
||||
export interface CollectionMoveResponse extends CollectionInterface {}
|
||||
export interface CollectionMoveResponse extends CollectionInterface {}
|
||||
@@ -3,5 +3,4 @@ export type * from './provider';
|
||||
export type * from './service';
|
||||
export type * from './collection';
|
||||
export type * from './entity';
|
||||
export type * from './node';
|
||||
export type * from './document';
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
/**
|
||||
* Node (unified collections + entities) type definitions
|
||||
*/
|
||||
import type { CollectionIdentifier, ListFilter, ListRange, ListSort, ServiceIdentifier } from './common';
|
||||
import type { CollectionInterface } from './collection';
|
||||
import type { EntityInterface } from './entity';
|
||||
|
||||
/**
|
||||
* Node list
|
||||
*/
|
||||
export interface NodeListRequest {
|
||||
sources?: (ServiceIdentifier | CollectionIdentifier)[];
|
||||
filter?: ListFilter;
|
||||
sort?: ListSort;
|
||||
range?: ListRange;
|
||||
}
|
||||
|
||||
export type NodeInterface =
|
||||
| (Omit<CollectionInterface, '@type'> & { '@type': 'document:collection' })
|
||||
| (Omit<EntityInterface, '@type'> & { '@type': 'document:entity' });
|
||||
|
||||
/** Payload of each data frame in the node.list NDJSON stream. */
|
||||
export type NodeListResponse = NodeInterface;
|
||||
Reference in New Issue
Block a user