@twin.org/synchronised-storage-models 0.0.1-next.9 → 0.0.3-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/index.js +27 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/ISyncChange.js +2 -0
- package/dist/es/models/ISyncChange.js.map +1 -0
- package/dist/es/models/ISyncChangeSet.js +2 -0
- package/dist/es/models/ISyncChangeSet.js.map +1 -0
- package/dist/es/models/ISyncRequest.js +2 -0
- package/dist/es/models/ISyncRequest.js.map +1 -0
- package/dist/es/models/ISynchronisedEntity.js +2 -0
- package/dist/es/models/ISynchronisedEntity.js.map +1 -0
- package/dist/es/models/ISynchronisedEntityCore.js +4 -0
- package/dist/es/models/ISynchronisedEntityCore.js.map +1 -0
- package/dist/es/models/ISynchronisedStorageComponent.js +2 -0
- package/dist/es/models/ISynchronisedStorageComponent.js.map +1 -0
- package/dist/es/models/api/ISyncChangeSetRequest.js +2 -0
- package/dist/es/models/api/ISyncChangeSetRequest.js.map +1 -0
- package/dist/es/models/api/ISyncDecryptionKeyRequest.js +2 -0
- package/dist/es/models/api/ISyncDecryptionKeyRequest.js.map +1 -0
- package/dist/es/models/api/ISyncDecryptionKeyResponse.js +4 -0
- package/dist/es/models/api/ISyncDecryptionKeyResponse.js.map +1 -0
- package/dist/es/models/eventBus/ISyncBatchRequest.js +2 -0
- package/dist/es/models/eventBus/ISyncBatchRequest.js.map +1 -0
- package/dist/es/models/eventBus/ISyncBatchResponse.js +2 -0
- package/dist/es/models/eventBus/ISyncBatchResponse.js.map +1 -0
- package/dist/es/models/eventBus/ISyncItemChange.js +2 -0
- package/dist/es/models/eventBus/ISyncItemChange.js.map +1 -0
- package/dist/es/models/eventBus/ISyncItemRemove.js +4 -0
- package/dist/es/models/eventBus/ISyncItemRemove.js.map +1 -0
- package/dist/es/models/eventBus/ISyncItemRequest.js +4 -0
- package/dist/es/models/eventBus/ISyncItemRequest.js.map +1 -0
- package/dist/es/models/eventBus/ISyncItemResponse.js +2 -0
- package/dist/es/models/eventBus/ISyncItemResponse.js.map +1 -0
- package/dist/es/models/eventBus/ISyncItemSet.js +2 -0
- package/dist/es/models/eventBus/ISyncItemSet.js.map +1 -0
- package/dist/es/models/eventBus/ISyncRegisterStorageKey.js +4 -0
- package/dist/es/models/eventBus/ISyncRegisterStorageKey.js.map +1 -0
- package/dist/es/models/eventBus/ISyncReset.js +2 -0
- package/dist/es/models/eventBus/ISyncReset.js.map +1 -0
- package/dist/es/models/syncChangeOperation.js +17 -0
- package/dist/es/models/syncChangeOperation.js.map +1 -0
- package/dist/es/models/syncNodeIdMode.js +21 -0
- package/dist/es/models/syncNodeIdMode.js.map +1 -0
- package/dist/es/models/synchronisedStorageAssetTypes.js +26 -0
- package/dist/es/models/synchronisedStorageAssetTypes.js.map +1 -0
- package/dist/es/models/synchronisedStorageContexts.js +13 -0
- package/dist/es/models/synchronisedStorageContexts.js.map +1 -0
- package/dist/{esm/index.mjs → es/models/synchronisedStorageTopics.js} +2 -41
- package/dist/es/models/synchronisedStorageTopics.js.map +1 -0
- package/dist/es/models/synchronisedStorageTypes.js +17 -0
- package/dist/es/models/synchronisedStorageTypes.js.map +1 -0
- package/dist/types/index.d.ts +24 -19
- package/dist/types/models/ISyncChange.d.ts +4 -4
- package/dist/types/models/ISyncChangeSet.d.ts +19 -15
- package/dist/types/models/ISyncRequest.d.ts +19 -0
- package/dist/types/models/ISynchronisedEntity.d.ts +3 -6
- package/dist/types/models/ISynchronisedEntityCore.d.ts +9 -0
- package/dist/types/models/ISynchronisedStorageComponent.d.ts +5 -6
- package/dist/types/models/api/ISyncChangeSetRequest.d.ts +9 -1
- package/dist/types/models/api/ISyncDecryptionKeyRequest.d.ts +5 -11
- package/dist/types/models/eventBus/ISyncBatchRequest.d.ts +3 -3
- package/dist/types/models/eventBus/ISyncBatchResponse.d.ts +3 -3
- package/dist/types/models/eventBus/ISyncItemChange.d.ts +2 -2
- package/dist/types/models/eventBus/ISyncItemRemove.d.ts +1 -1
- package/dist/types/models/eventBus/ISyncItemResponse.d.ts +3 -3
- package/dist/types/models/eventBus/ISyncItemSet.d.ts +3 -3
- package/dist/types/models/eventBus/ISyncReset.d.ts +3 -3
- package/dist/types/models/{syncNodeIdentityMode.d.ts → syncNodeIdMode.d.ts} +2 -2
- package/dist/types/models/synchronisedStorageAssetTypes.d.ts +25 -0
- package/dist/types/models/synchronisedStorageContexts.d.ts +13 -0
- package/dist/types/models/synchronisedStorageTypes.d.ts +17 -0
- package/docs/changelog.md +80 -0
- package/docs/reference/index.md +10 -2
- package/docs/reference/interfaces/ISyncBatchRequest.md +2 -2
- package/docs/reference/interfaces/ISyncBatchResponse.md +2 -8
- package/docs/reference/interfaces/ISyncChange.md +2 -8
- package/docs/reference/interfaces/ISyncChangeSet.md +24 -22
- package/docs/reference/interfaces/ISyncChangeSetRequest.md +16 -0
- package/docs/reference/interfaces/ISyncDecryptionKeyRequest.md +7 -11
- package/docs/reference/interfaces/ISyncItemChange.md +2 -2
- package/docs/reference/interfaces/ISyncItemRemove.md +2 -2
- package/docs/reference/interfaces/ISyncItemResponse.md +2 -8
- package/docs/reference/interfaces/ISyncItemSet.md +2 -8
- package/docs/reference/interfaces/ISyncRequest.md +27 -0
- package/docs/reference/interfaces/ISyncReset.md +2 -2
- package/docs/reference/interfaces/ISynchronisedEntity.md +14 -6
- package/docs/reference/interfaces/ISynchronisedEntityCore.md +15 -0
- package/docs/reference/interfaces/ISynchronisedStorageComponent.md +11 -11
- package/docs/reference/type-aliases/SyncNodeIdMode.md +5 -0
- package/docs/reference/type-aliases/SynchronisedStorageAssetTypes.md +5 -0
- package/docs/reference/type-aliases/SynchronisedStorageContexts.md +5 -0
- package/docs/reference/type-aliases/SynchronisedStorageTypes.md +5 -0
- package/docs/reference/variables/SyncChangeOperation.md +1 -1
- package/docs/reference/variables/{SyncNodeIdentityMode.md → SyncNodeIdMode.md} +3 -3
- package/docs/reference/variables/SynchronisedStorageAssetTypes.md +31 -0
- package/docs/reference/variables/SynchronisedStorageContexts.md +13 -0
- package/docs/reference/variables/SynchronisedStorageTopics.md +1 -1
- package/docs/reference/variables/SynchronisedStorageTypes.md +19 -0
- package/locales/en.json +1 -3
- package/package.json +25 -9
- package/dist/cjs/index.cjs +0 -88
- package/docs/reference/type-aliases/SyncNodeIdentityMode.md +0 -5
- /package/dist/types/models/{eventBus/syncChangeOperation.d.ts → syncChangeOperation.d.ts} +0 -0
package/dist/es/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
export * from "./models/api/ISyncChangeSetRequest.js";
|
|
4
|
+
export * from "./models/api/ISyncDecryptionKeyRequest.js";
|
|
5
|
+
export * from "./models/api/ISyncDecryptionKeyResponse.js";
|
|
6
|
+
export * from "./models/eventBus/ISyncBatchRequest.js";
|
|
7
|
+
export * from "./models/eventBus/ISyncBatchResponse.js";
|
|
8
|
+
export * from "./models/eventBus/ISyncItemChange.js";
|
|
9
|
+
export * from "./models/eventBus/ISyncItemRemove.js";
|
|
10
|
+
export * from "./models/eventBus/ISyncItemRequest.js";
|
|
11
|
+
export * from "./models/eventBus/ISyncItemResponse.js";
|
|
12
|
+
export * from "./models/eventBus/ISyncItemSet.js";
|
|
13
|
+
export * from "./models/eventBus/ISyncRegisterStorageKey.js";
|
|
14
|
+
export * from "./models/eventBus/ISyncReset.js";
|
|
15
|
+
export * from "./models/ISyncChange.js";
|
|
16
|
+
export * from "./models/ISyncChangeSet.js";
|
|
17
|
+
export * from "./models/ISynchronisedEntity.js";
|
|
18
|
+
export * from "./models/ISynchronisedEntityCore.js";
|
|
19
|
+
export * from "./models/ISynchronisedStorageComponent.js";
|
|
20
|
+
export * from "./models/ISyncRequest.js";
|
|
21
|
+
export * from "./models/syncChangeOperation.js";
|
|
22
|
+
export * from "./models/synchronisedStorageAssetTypes.js";
|
|
23
|
+
export * from "./models/synchronisedStorageContexts.js";
|
|
24
|
+
export * from "./models/synchronisedStorageTopics.js";
|
|
25
|
+
export * from "./models/synchronisedStorageTypes.js";
|
|
26
|
+
export * from "./models/syncNodeIdMode.js";
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,uCAAuC,CAAC;AACtD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,mCAAmC,CAAC;AAClD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,yCAAyC,CAAC;AACxD,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,4BAA4B,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./models/api/ISyncChangeSetRequest.js\";\nexport * from \"./models/api/ISyncDecryptionKeyRequest.js\";\nexport * from \"./models/api/ISyncDecryptionKeyResponse.js\";\nexport * from \"./models/eventBus/ISyncBatchRequest.js\";\nexport * from \"./models/eventBus/ISyncBatchResponse.js\";\nexport * from \"./models/eventBus/ISyncItemChange.js\";\nexport * from \"./models/eventBus/ISyncItemRemove.js\";\nexport * from \"./models/eventBus/ISyncItemRequest.js\";\nexport * from \"./models/eventBus/ISyncItemResponse.js\";\nexport * from \"./models/eventBus/ISyncItemSet.js\";\nexport * from \"./models/eventBus/ISyncRegisterStorageKey.js\";\nexport * from \"./models/eventBus/ISyncReset.js\";\nexport * from \"./models/ISyncChange.js\";\nexport * from \"./models/ISyncChangeSet.js\";\nexport * from \"./models/ISynchronisedEntity.js\";\nexport * from \"./models/ISynchronisedEntityCore.js\";\nexport * from \"./models/ISynchronisedStorageComponent.js\";\nexport * from \"./models/ISyncRequest.js\";\nexport * from \"./models/syncChangeOperation.js\";\nexport * from \"./models/synchronisedStorageAssetTypes.js\";\nexport * from \"./models/synchronisedStorageContexts.js\";\nexport * from \"./models/synchronisedStorageTopics.js\";\nexport * from \"./models/synchronisedStorageTypes.js\";\nexport * from \"./models/syncNodeIdMode.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISyncChange.js","sourceRoot":"","sources":["../../../src/models/ISyncChange.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { ISynchronisedEntityCore } from \"./ISynchronisedEntityCore.js\";\nimport type { SyncChangeOperation } from \"./syncChangeOperation.js\";\n\n/**\n * The object definition for a sync change.\n */\nexport interface ISyncChange {\n\t/**\n\t * Operation.\n\t */\n\toperation: SyncChangeOperation;\n\n\t/**\n\t * The item id.\n\t */\n\tid: string;\n\n\t/**\n\t * The entity to set.\n\t */\n\tentity?: ISynchronisedEntityCore;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISyncChangeSet.js","sourceRoot":"","sources":["../../../src/models/ISyncChangeSet.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { ISyncChange } from \"./ISyncChange.js\";\nimport type { SynchronisedStorageContexts } from \"./synchronisedStorageContexts.js\";\nimport type { SynchronisedStorageTypes } from \"./synchronisedStorageTypes.js\";\n\n/**\n * The object definition for a sync change set.\n */\nexport interface ISyncChangeSet {\n\t/**\n\t * The LD Context for the change set.\n\t */\n\t\"@context\": typeof SynchronisedStorageContexts.ContextRoot;\n\n\t/**\n\t * The LD Type for the change set.\n\t */\n\ttype: typeof SynchronisedStorageTypes.ChangeSet;\n\n\t/**\n\t * The id of the change set.\n\t */\n\tid: string;\n\n\t/**\n\t * The storage key of the change set. This is used to identify the entities being synchronised.\n\t */\n\tstorageKey: string;\n\n\t/**\n\t * The date the change set was created.\n\t */\n\tdateCreated: string;\n\n\t/**\n\t * The date the change set was last modified.\n\t */\n\tdateModified: string;\n\n\t/**\n\t * The identity of the node that created the change set.\n\t */\n\tnodeId: string;\n\n\t/**\n\t * The changes to apply after a snapshot.\n\t */\n\tchanges: ISyncChange[];\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISyncRequest.js","sourceRoot":"","sources":["../../../src/models/ISyncRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { SynchronisedStorageContexts } from \"./synchronisedStorageContexts.js\";\nimport type { SynchronisedStorageTypes } from \"./synchronisedStorageTypes.js\";\n\n/**\n * The object definition for a sync request.\n */\nexport interface ISyncRequest {\n\t/**\n\t * The LD Context for the request.\n\t */\n\t\"@context\": typeof SynchronisedStorageContexts.ContextRoot;\n\n\t/**\n\t * The LD Type for the request.\n\t */\n\ttype: typeof SynchronisedStorageTypes.SyncRequest;\n\n\t/**\n\t * The identity of the node that created the request.\n\t */\n\tnodeId: string;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISynchronisedEntity.js","sourceRoot":"","sources":["../../../src/models/ISynchronisedEntity.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { ISynchronisedEntityCore } from \"./ISynchronisedEntityCore.js\";\n\n/**\n * The base definition for synchronised entries.\n */\nexport interface ISynchronisedEntity extends ISynchronisedEntityCore {\n\t/**\n\t * The id of the entry.\n\t */\n\tid: string;\n\n\t/**\n\t * The identity of the node that owns the entry.\n\t */\n\tnodeId?: string;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISynchronisedEntityCore.js","sourceRoot":"","sources":["../../../src/models/ISynchronisedEntityCore.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The base definition for synchronised entries.\n */\nexport interface ISynchronisedEntityCore {\n\t/**\n\t * The date the entry was modified.\n\t */\n\tdateModified: string;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISynchronisedStorageComponent.js","sourceRoot":"","sources":["../../../src/models/ISynchronisedStorageComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { ISyncChangeSet } from \"./ISyncChangeSet.js\";\n\n/**\n * Class for performing synchronised storage operations.\n */\nexport interface ISynchronisedStorageComponent extends IComponent {\n\t/**\n\t * Get the decryption key for the synchronised storage.\n\t * This is used to decrypt the data stored in the synchronised storage.\n\t * @param trustPayload Trust payload to verify the requesters identity.\n\t * @returns The decryption key.\n\t */\n\tgetDecryptionKey(trustPayload: unknown): Promise<string>;\n\n\t/**\n\t * Synchronise a set of changes from an untrusted node, assumes this is a trusted node.\n\t * @param syncChangeSet The change set to synchronise.\n\t * @param trustPayload Trust payload to verify the requesters identity.\n\t * @returns Nothing.\n\t */\n\tsyncChangeSet(syncChangeSet: ISyncChangeSet, trustPayload: unknown): Promise<void>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISyncChangeSetRequest.js","sourceRoot":"","sources":["../../../../src/models/api/ISyncChangeSetRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HeaderTypes, MimeTypes } from \"@twin.org/web\";\nimport type { ISyncChangeSet } from \"../ISyncChangeSet.js\";\n\n/**\n * Request a trusted node to perform a sync request for a changeset.\n */\nexport interface ISyncChangeSetRequest {\n\t/**\n\t * The headers which can be used to determine the response data type.\n\t */\n\theaders?: {\n\t\t[HeaderTypes.Accept]?: typeof MimeTypes.JsonLd | typeof MimeTypes.Json;\n\t\t[HeaderTypes.Authorization]?: string;\n\t};\n\n\t/**\n\t * The body of the request.\n\t */\n\tbody: ISyncChangeSet;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISyncDecryptionKeyRequest.js","sourceRoot":"","sources":["../../../../src/models/api/ISyncDecryptionKeyRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HeaderTypes, MimeTypes } from \"@twin.org/web\";\n\n/**\n * Request for the decryption key for the synchronised storage.\n */\nexport interface ISyncDecryptionKeyRequest {\n\t/**\n\t * The headers which can be used to determine the response data type.\n\t */\n\theaders?: {\n\t\t[HeaderTypes.Accept]?: typeof MimeTypes.JsonLd | typeof MimeTypes.Json;\n\t\t[HeaderTypes.Authorization]?: string;\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISyncDecryptionKeyResponse.js","sourceRoot":"","sources":["../../../../src/models/api/ISyncDecryptionKeyResponse.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Response to a request for the decryption key for the synchronised storage.\n */\nexport interface ISyncDecryptionKeyResponse {\n\t/**\n\t * The body of the response.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The decryption key for the synchronised storage as base64.\n\t\t */\n\t\tdecryptionKey: string;\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISyncBatchRequest.js","sourceRoot":"","sources":["../../../../src/models/eventBus/ISyncBatchRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { SyncNodeIdMode } from \"../syncNodeIdMode.js\";\n\n/**\n * Request for a local batch.\n */\nexport interface ISyncBatchRequest {\n\t/**\n\t * The key of the storage for the entities in the batch.\n\t */\n\tstorageKey: string;\n\n\t/**\n\t * The size of the batch.\n\t */\n\tbatchSize: number;\n\n\t/**\n\t * Determines which entries are required, for local it will match the nodeId, for remote it will not include matching nodeId, for all it will include all entries.\n\t */\n\trequestMode: SyncNodeIdMode;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISyncBatchResponse.js","sourceRoot":"","sources":["../../../../src/models/eventBus/ISyncBatchResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { ISynchronisedEntity } from \"../ISynchronisedEntity.js\";\n\n/**\n * Response for a local batch.\n */\nexport interface ISyncBatchResponse {\n\t/**\n\t * The key of the storage for the entities in the batch.\n\t */\n\tstorageKey: string;\n\n\t/**\n\t * The entities in the batch.\n\t */\n\tentities: ISynchronisedEntity[];\n\n\t/**\n\t * Is this the last entry in the batch?\n\t */\n\tlastEntry: boolean;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISyncItemChange.js","sourceRoot":"","sources":["../../../../src/models/eventBus/ISyncItemChange.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { SyncChangeOperation } from \"../syncChangeOperation.js\";\n\n/**\n * The payload for an item change.\n */\nexport interface ISyncItemChange {\n\t/**\n\t * The key of the storage being changed.\n\t */\n\tstorageKey: string;\n\n\t/**\n\t * The operation being performed on the item.\n\t */\n\toperation: SyncChangeOperation;\n\n\t/**\n\t * The node performing the operation.\n\t */\n\tnodeId: string;\n\n\t/**\n\t * The id of the item being changed.\n\t */\n\tid: string;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISyncItemRemove.js","sourceRoot":"","sources":["../../../../src/models/eventBus/ISyncItemRemove.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The payload for an item remove.\n */\nexport interface ISyncItemRemove {\n\t/**\n\t * The key of the storage being removed.\n\t */\n\tstorageKey: string;\n\n\t/**\n\t * The node identity of the entity being removed.\n\t */\n\tnodeId: string;\n\n\t/**\n\t * The entity being removed from the item set.\n\t */\n\tid: string;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISyncItemRequest.js","sourceRoot":"","sources":["../../../../src/models/eventBus/ISyncItemRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Request for a local item.\n */\nexport interface ISyncItemRequest {\n\t/**\n\t * The key of the storage for the entities in the batch.\n\t */\n\tstorageKey: string;\n\n\t/**\n\t * The item id being requested.\n\t */\n\tid: string;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISyncItemResponse.js","sourceRoot":"","sources":["../../../../src/models/eventBus/ISyncItemResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { ISynchronisedEntity } from \"../ISynchronisedEntity.js\";\n\n/**\n * Response for a sync item request.\n */\nexport interface ISyncItemResponse {\n\t/**\n\t * The key of the storage for the entities in the batch.\n\t */\n\tstorageKey: string;\n\n\t/**\n\t * The id of the entity in the sync item response.\n\t */\n\tid: string;\n\n\t/**\n\t * The entity in the sync item response, undefined if not found.\n\t */\n\tentity?: ISynchronisedEntity;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISyncItemSet.js","sourceRoot":"","sources":["../../../../src/models/eventBus/ISyncItemSet.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { ISynchronisedEntity } from \"../ISynchronisedEntity.js\";\n\n/**\n * The payload for an item set.\n */\nexport interface ISyncItemSet {\n\t/**\n\t * The key of the storage being set.\n\t */\n\tstorageKey: string;\n\n\t/**\n\t * The entity being set in the item set.\n\t */\n\tentity: ISynchronisedEntity;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISyncRegisterStorageKey.js","sourceRoot":"","sources":["../../../../src/models/eventBus/ISyncRegisterStorageKey.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Register a key with synchronised storage.\n */\nexport interface ISyncRegisterStorageKey {\n\t/**\n\t * The key for the storage being registered.\n\t */\n\tstorageKey: string;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISyncReset.js","sourceRoot":"","sources":["../../../../src/models/eventBus/ISyncReset.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { SyncNodeIdMode } from \"../syncNodeIdMode.js\";\n\n/**\n * Request to reset the local storage.\n */\nexport interface ISyncReset {\n\t/**\n\t * The key of the storage for the entities in the batch.\n\t */\n\tstorageKey: string;\n\n\t/**\n\t * Reset mode, this will use the nodeId in the entities to determine which are local/remote.\n\t */\n\tresetMode: SyncNodeIdMode;\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
/**
|
|
4
|
+
* The operations for a change.
|
|
5
|
+
*/
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
+
export const SyncChangeOperation = {
|
|
8
|
+
/**
|
|
9
|
+
* An item was set in the storage.
|
|
10
|
+
*/
|
|
11
|
+
Set: "set",
|
|
12
|
+
/**
|
|
13
|
+
* An item was deleted from the storage.
|
|
14
|
+
*/
|
|
15
|
+
Delete: "delete"
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=syncChangeOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syncChangeOperation.js","sourceRoot":"","sources":["../../../src/models/syncChangeOperation.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC;;OAEG;IACH,GAAG,EAAE,KAAK;IAEV;;OAEG;IACH,MAAM,EAAE,QAAQ;CACP,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The operations for a change.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const SyncChangeOperation = {\n\t/**\n\t * An item was set in the storage.\n\t */\n\tSet: \"set\",\n\n\t/**\n\t * An item was deleted from the storage.\n\t */\n\tDelete: \"delete\"\n} as const;\n\n/**\n * The operations for a change\n */\nexport type SyncChangeOperation = (typeof SyncChangeOperation)[keyof typeof SyncChangeOperation];\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
/**
|
|
4
|
+
* The mode to determine how node identities are matched.
|
|
5
|
+
*/
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
+
export const SyncNodeIdMode = {
|
|
8
|
+
/**
|
|
9
|
+
* Match the local node identity.
|
|
10
|
+
*/
|
|
11
|
+
Local: "local",
|
|
12
|
+
/**
|
|
13
|
+
* Match all but the local node identity.
|
|
14
|
+
*/
|
|
15
|
+
Remote: "remote",
|
|
16
|
+
/**
|
|
17
|
+
* All match both local and remote entities.
|
|
18
|
+
*/
|
|
19
|
+
All: "all"
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=syncNodeIdMode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syncNodeIdMode.js","sourceRoot":"","sources":["../../../src/models/syncNodeIdMode.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B;;OAEG;IACH,KAAK,EAAE,OAAO;IAEd;;OAEG;IACH,MAAM,EAAE,QAAQ;IAEhB;;OAEG;IACH,GAAG,EAAE,KAAK;CACD,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The mode to determine how node identities are matched.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const SyncNodeIdMode = {\n\t/**\n\t * Match the local node identity.\n\t */\n\tLocal: \"local\",\n\n\t/**\n\t * Match all but the local node identity.\n\t */\n\tRemote: \"remote\",\n\n\t/**\n\t * All match both local and remote entities.\n\t */\n\tAll: \"all\"\n} as const;\n\n/**\n * The mode to determine how node identities are matched.\n */\nexport type SyncNodeIdMode = (typeof SyncNodeIdMode)[keyof typeof SyncNodeIdMode];\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { ActionType } from "@twin.org/standards-w3c-odrl";
|
|
4
|
+
/**
|
|
5
|
+
* The ODRL asset types for SynchronisedStorage.
|
|
6
|
+
*/
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8
|
+
export const SynchronisedStorageAssetTypes = {
|
|
9
|
+
/**
|
|
10
|
+
* Decryption Key.
|
|
11
|
+
*/
|
|
12
|
+
DecryptionKey: "decryption-key",
|
|
13
|
+
/**
|
|
14
|
+
* Decryption Key Actions.
|
|
15
|
+
*/
|
|
16
|
+
DecryptionKeyActions: [ActionType.Read],
|
|
17
|
+
/**
|
|
18
|
+
* Change Set.
|
|
19
|
+
*/
|
|
20
|
+
ChangeSet: "change-set",
|
|
21
|
+
/**
|
|
22
|
+
* Change Set Actions.
|
|
23
|
+
*/
|
|
24
|
+
ChangeSetActions: [ActionType.Write]
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=synchronisedStorageAssetTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synchronisedStorageAssetTypes.js","sourceRoot":"","sources":["../../../src/models/synchronisedStorageAssetTypes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC5C;;OAEG;IACH,aAAa,EAAE,gBAAgB;IAE/B;;OAEG;IACH,oBAAoB,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;IAEvC;;OAEG;IACH,SAAS,EAAE,YAAY;IAEvB;;OAEG;IACH,gBAAgB,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC;CAC3B,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ActionType } from \"@twin.org/standards-w3c-odrl\";\n\n/**\n * The ODRL asset types for SynchronisedStorage.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const SynchronisedStorageAssetTypes = {\n\t/**\n\t * Decryption Key.\n\t */\n\tDecryptionKey: \"decryption-key\",\n\n\t/**\n\t * Decryption Key Actions.\n\t */\n\tDecryptionKeyActions: [ActionType.Read],\n\n\t/**\n\t * Change Set.\n\t */\n\tChangeSet: \"change-set\",\n\n\t/**\n\t * Change Set Actions.\n\t */\n\tChangeSetActions: [ActionType.Write]\n} as const;\n\n/**\n * The ODRL asset types for SynchronisedStorage.\n */\nexport type SynchronisedStorageAssetTypes =\n\t(typeof SynchronisedStorageAssetTypes)[keyof typeof SynchronisedStorageAssetTypes];\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
/**
|
|
4
|
+
* The LD Contexts concerning SynchronisedStorage.
|
|
5
|
+
*/
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
+
export const SynchronisedStorageContexts = {
|
|
8
|
+
/**
|
|
9
|
+
* The SynchronisedStorage LD Context.
|
|
10
|
+
*/
|
|
11
|
+
ContextRoot: "https://schema.twindev.org/synchronised-storage"
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=synchronisedStorageContexts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synchronisedStorageContexts.js","sourceRoot":"","sources":["../../../src/models/synchronisedStorageContexts.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,2BAA2B,GAAG;IAC1C;;OAEG;IACH,WAAW,EAAE,iDAAiD;CACrD,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The LD Contexts concerning SynchronisedStorage.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const SynchronisedStorageContexts = {\n\t/**\n\t * The SynchronisedStorage LD Context.\n\t */\n\tContextRoot: \"https://schema.twindev.org/synchronised-storage\"\n} as const;\n\n/**\n * The LD Contexts concerning SynchronisedStorage.\n */\nexport type SynchronisedStorageContexts =\n\t(typeof SynchronisedStorageContexts)[keyof typeof SynchronisedStorageContexts];\n"]}
|
|
@@ -1,27 +1,10 @@
|
|
|
1
|
-
// Copyright 2024 IOTA Stiftung.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
-
/**
|
|
4
|
-
* The operations for a change.
|
|
5
|
-
*/
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
-
const SyncChangeOperation = {
|
|
8
|
-
/**
|
|
9
|
-
* An item was set in the storage.
|
|
10
|
-
*/
|
|
11
|
-
Set: "set",
|
|
12
|
-
/**
|
|
13
|
-
* An item was deleted from the storage.
|
|
14
|
-
*/
|
|
15
|
-
Delete: "delete"
|
|
16
|
-
};
|
|
17
|
-
|
|
18
1
|
// Copyright 2024 IOTA Stiftung.
|
|
19
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
20
3
|
/**
|
|
21
4
|
* The topics for synchronised storage event bus notifications.
|
|
22
5
|
*/
|
|
23
6
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
24
|
-
const SynchronisedStorageTopics = {
|
|
7
|
+
export const SynchronisedStorageTopics = {
|
|
25
8
|
/**
|
|
26
9
|
* Register a storage key for the synchronised storage.
|
|
27
10
|
*/
|
|
@@ -59,26 +42,4 @@ const SynchronisedStorageTopics = {
|
|
|
59
42
|
*/
|
|
60
43
|
RemoteItemRemove: "synchronised-storage:remote-item-remove"
|
|
61
44
|
};
|
|
62
|
-
|
|
63
|
-
// Copyright 2024 IOTA Stiftung.
|
|
64
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
65
|
-
/**
|
|
66
|
-
* The mode to determine how node identities are matched.
|
|
67
|
-
*/
|
|
68
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
69
|
-
const SyncNodeIdentityMode = {
|
|
70
|
-
/**
|
|
71
|
-
* Match the local node identity.
|
|
72
|
-
*/
|
|
73
|
-
Local: "local",
|
|
74
|
-
/**
|
|
75
|
-
* Match all but the local node identity.
|
|
76
|
-
*/
|
|
77
|
-
Remote: "remote",
|
|
78
|
-
/**
|
|
79
|
-
* All match both local and remote entities.
|
|
80
|
-
*/
|
|
81
|
-
All: "all"
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export { SyncChangeOperation, SyncNodeIdentityMode, SynchronisedStorageTopics };
|
|
45
|
+
//# sourceMappingURL=synchronisedStorageTopics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synchronisedStorageTopics.js","sourceRoot":"","sources":["../../../src/models/synchronisedStorageTopics.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACxC;;OAEG;IACH,kBAAkB,EAAE,2CAA2C;IAE/D;;OAEG;IACH,eAAe,EAAE,wCAAwC;IAEzD;;OAEG;IACH,gBAAgB,EAAE,yCAAyC;IAE3D;;OAEG;IACH,iBAAiB,EAAE,0CAA0C;IAE7D;;OAEG;IACH,KAAK,EAAE,4BAA4B;IAEnC;;OAEG;IACH,YAAY,EAAE,oCAAoC;IAElD;;OAEG;IACH,aAAa,EAAE,qCAAqC;IAEpD;;OAEG;IACH,aAAa,EAAE,sCAAsC;IAErD;;OAEG;IACH,gBAAgB,EAAE,yCAAyC;CAClD,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The topics for synchronised storage event bus notifications.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const SynchronisedStorageTopics = {\n\t/**\n\t * Register a storage key for the synchronised storage.\n\t */\n\tRegisterStorageKey: \"synchronised-storage:register-storage-key\",\n\n\t/**\n\t * An item was changed in the storage by the local node.\n\t */\n\tLocalItemChange: \"synchronised-storage:local-item-change\",\n\n\t/**\n\t * A request has been made for a local item.\n\t */\n\tLocalItemRequest: \"synchronised-storage:local-item-request\",\n\n\t/**\n\t * A response to a local item request.\n\t */\n\tLocalItemResponse: \"synchronised-storage:local-item-response\",\n\n\t/**\n\t * Reset the storage.\n\t */\n\tReset: \"synchronised-storage:reset\",\n\n\t/**\n\t * A request has been made for a batch.\n\t */\n\tBatchRequest: \"synchronised-storage:batch-request\",\n\n\t/**\n\t * A response to a batch.\n\t */\n\tBatchResponse: \"synchronised-storage:batch-response\",\n\n\t/**\n\t * An item was set in the storage by the remote node.\n\t */\n\tRemoteItemSet: \"synchronised-storage:remote-item-set\",\n\n\t/**\n\t * An item was removed from the storage by the remote node.\n\t */\n\tRemoteItemRemove: \"synchronised-storage:remote-item-remove\"\n} as const;\n\n/**\n * The topics for synchronised storage event bus notifications.\n */\nexport type SynchronisedStorageTopics =\n\t(typeof SynchronisedStorageTopics)[keyof typeof SynchronisedStorageTopics];\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
/**
|
|
4
|
+
* The types of Synchronised Storage data.
|
|
5
|
+
*/
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
+
export const SynchronisedStorageTypes = {
|
|
8
|
+
/**
|
|
9
|
+
* Represents a synchronised storage request.
|
|
10
|
+
*/
|
|
11
|
+
SyncRequest: "SyncRequest",
|
|
12
|
+
/**
|
|
13
|
+
* Represents a synchronised storage change set.
|
|
14
|
+
*/
|
|
15
|
+
ChangeSet: "ChangeSet"
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=synchronisedStorageTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synchronisedStorageTypes.js","sourceRoot":"","sources":["../../../src/models/synchronisedStorageTypes.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACvC;;OAEG;IACH,WAAW,EAAE,aAAa;IAE1B;;OAEG;IACH,SAAS,EAAE,WAAW;CACb,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The types of Synchronised Storage data.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const SynchronisedStorageTypes = {\n\t/**\n\t * Represents a synchronised storage request.\n\t */\n\tSyncRequest: \"SyncRequest\",\n\n\t/**\n\t * Represents a synchronised storage change set.\n\t */\n\tChangeSet: \"ChangeSet\"\n} as const;\n\n/**\n * The types of Synchronised Storage data.\n */\nexport type SynchronisedStorageTypes =\n\t(typeof SynchronisedStorageTypes)[keyof typeof SynchronisedStorageTypes];\n"]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
export * from "./models/api/ISyncChangeSetRequest";
|
|
2
|
-
export * from "./models/api/ISyncDecryptionKeyRequest";
|
|
3
|
-
export * from "./models/api/ISyncDecryptionKeyResponse";
|
|
4
|
-
export * from "./models/eventBus/ISyncBatchRequest";
|
|
5
|
-
export * from "./models/eventBus/ISyncBatchResponse";
|
|
6
|
-
export * from "./models/eventBus/ISyncItemChange";
|
|
7
|
-
export * from "./models/eventBus/ISyncItemRemove";
|
|
8
|
-
export * from "./models/eventBus/ISyncItemRequest";
|
|
9
|
-
export * from "./models/eventBus/ISyncItemResponse";
|
|
10
|
-
export * from "./models/eventBus/ISyncItemSet";
|
|
11
|
-
export * from "./models/eventBus/ISyncRegisterStorageKey";
|
|
12
|
-
export * from "./models/eventBus/ISyncReset";
|
|
13
|
-
export * from "./models/
|
|
14
|
-
export * from "./models/
|
|
15
|
-
export * from "./models/
|
|
16
|
-
export * from "./models/
|
|
17
|
-
export * from "./models/ISynchronisedStorageComponent";
|
|
18
|
-
export * from "./models/
|
|
19
|
-
export * from "./models/
|
|
1
|
+
export * from "./models/api/ISyncChangeSetRequest.js";
|
|
2
|
+
export * from "./models/api/ISyncDecryptionKeyRequest.js";
|
|
3
|
+
export * from "./models/api/ISyncDecryptionKeyResponse.js";
|
|
4
|
+
export * from "./models/eventBus/ISyncBatchRequest.js";
|
|
5
|
+
export * from "./models/eventBus/ISyncBatchResponse.js";
|
|
6
|
+
export * from "./models/eventBus/ISyncItemChange.js";
|
|
7
|
+
export * from "./models/eventBus/ISyncItemRemove.js";
|
|
8
|
+
export * from "./models/eventBus/ISyncItemRequest.js";
|
|
9
|
+
export * from "./models/eventBus/ISyncItemResponse.js";
|
|
10
|
+
export * from "./models/eventBus/ISyncItemSet.js";
|
|
11
|
+
export * from "./models/eventBus/ISyncRegisterStorageKey.js";
|
|
12
|
+
export * from "./models/eventBus/ISyncReset.js";
|
|
13
|
+
export * from "./models/ISyncChange.js";
|
|
14
|
+
export * from "./models/ISyncChangeSet.js";
|
|
15
|
+
export * from "./models/ISynchronisedEntity.js";
|
|
16
|
+
export * from "./models/ISynchronisedEntityCore.js";
|
|
17
|
+
export * from "./models/ISynchronisedStorageComponent.js";
|
|
18
|
+
export * from "./models/ISyncRequest.js";
|
|
19
|
+
export * from "./models/syncChangeOperation.js";
|
|
20
|
+
export * from "./models/synchronisedStorageAssetTypes.js";
|
|
21
|
+
export * from "./models/synchronisedStorageContexts.js";
|
|
22
|
+
export * from "./models/synchronisedStorageTopics.js";
|
|
23
|
+
export * from "./models/synchronisedStorageTypes.js";
|
|
24
|
+
export * from "./models/syncNodeIdMode.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { ISynchronisedEntityCore } from "./ISynchronisedEntityCore.js";
|
|
2
|
+
import type { SyncChangeOperation } from "./syncChangeOperation.js";
|
|
3
3
|
/**
|
|
4
4
|
* The object definition for a sync change.
|
|
5
5
|
*/
|
|
6
|
-
export interface ISyncChange
|
|
6
|
+
export interface ISyncChange {
|
|
7
7
|
/**
|
|
8
8
|
* Operation.
|
|
9
9
|
*/
|
|
@@ -15,5 +15,5 @@ export interface ISyncChange<T extends ISynchronisedEntity = ISynchronisedEntity
|
|
|
15
15
|
/**
|
|
16
16
|
* The entity to set.
|
|
17
17
|
*/
|
|
18
|
-
entity?:
|
|
18
|
+
entity?: ISynchronisedEntityCore;
|
|
19
19
|
}
|
|
@@ -1,36 +1,40 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { ISyncChange } from "./ISyncChange.js";
|
|
2
|
+
import type { SynchronisedStorageContexts } from "./synchronisedStorageContexts.js";
|
|
3
|
+
import type { SynchronisedStorageTypes } from "./synchronisedStorageTypes.js";
|
|
4
4
|
/**
|
|
5
5
|
* The object definition for a sync change set.
|
|
6
6
|
*/
|
|
7
|
-
export interface ISyncChangeSet
|
|
7
|
+
export interface ISyncChangeSet {
|
|
8
8
|
/**
|
|
9
|
-
* The
|
|
9
|
+
* The LD Context for the change set.
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
"@context": typeof SynchronisedStorageContexts.ContextRoot;
|
|
12
12
|
/**
|
|
13
|
-
* The
|
|
13
|
+
* The LD Type for the change set.
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
type: typeof SynchronisedStorageTypes.ChangeSet;
|
|
16
|
+
/**
|
|
17
|
+
* The id of the change set.
|
|
18
|
+
*/
|
|
19
|
+
id: string;
|
|
16
20
|
/**
|
|
17
21
|
* The storage key of the change set. This is used to identify the entities being synchronised.
|
|
18
22
|
*/
|
|
19
23
|
storageKey: string;
|
|
20
24
|
/**
|
|
21
|
-
* The date the change set was
|
|
25
|
+
* The date the change set was created.
|
|
22
26
|
*/
|
|
23
|
-
|
|
27
|
+
dateCreated: string;
|
|
24
28
|
/**
|
|
25
|
-
* The
|
|
29
|
+
* The date the change set was last modified.
|
|
26
30
|
*/
|
|
27
|
-
|
|
31
|
+
dateModified: string;
|
|
28
32
|
/**
|
|
29
33
|
* The identity of the node that created the change set.
|
|
30
34
|
*/
|
|
31
|
-
|
|
35
|
+
nodeId: string;
|
|
32
36
|
/**
|
|
33
|
-
* The
|
|
37
|
+
* The changes to apply after a snapshot.
|
|
34
38
|
*/
|
|
35
|
-
|
|
39
|
+
changes: ISyncChange[];
|
|
36
40
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SynchronisedStorageContexts } from "./synchronisedStorageContexts.js";
|
|
2
|
+
import type { SynchronisedStorageTypes } from "./synchronisedStorageTypes.js";
|
|
3
|
+
/**
|
|
4
|
+
* The object definition for a sync request.
|
|
5
|
+
*/
|
|
6
|
+
export interface ISyncRequest {
|
|
7
|
+
/**
|
|
8
|
+
* The LD Context for the request.
|
|
9
|
+
*/
|
|
10
|
+
"@context": typeof SynchronisedStorageContexts.ContextRoot;
|
|
11
|
+
/**
|
|
12
|
+
* The LD Type for the request.
|
|
13
|
+
*/
|
|
14
|
+
type: typeof SynchronisedStorageTypes.SyncRequest;
|
|
15
|
+
/**
|
|
16
|
+
* The identity of the node that created the request.
|
|
17
|
+
*/
|
|
18
|
+
nodeId: string;
|
|
19
|
+
}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
+
import type { ISynchronisedEntityCore } from "./ISynchronisedEntityCore.js";
|
|
1
2
|
/**
|
|
2
3
|
* The base definition for synchronised entries.
|
|
3
4
|
*/
|
|
4
|
-
export interface ISynchronisedEntity {
|
|
5
|
+
export interface ISynchronisedEntity extends ISynchronisedEntityCore {
|
|
5
6
|
/**
|
|
6
7
|
* The id of the entry.
|
|
7
8
|
*/
|
|
8
9
|
id: string;
|
|
9
|
-
/**
|
|
10
|
-
* The date the entry was modified
|
|
11
|
-
*/
|
|
12
|
-
dateModified: string;
|
|
13
10
|
/**
|
|
14
11
|
* The identity of the node that owns the entry.
|
|
15
12
|
*/
|
|
16
|
-
|
|
13
|
+
nodeId?: string;
|
|
17
14
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { IComponent } from "@twin.org/core";
|
|
2
|
-
import type {
|
|
3
|
-
import type { ISyncChangeSet } from "./ISyncChangeSet";
|
|
2
|
+
import type { ISyncChangeSet } from "./ISyncChangeSet.js";
|
|
4
3
|
/**
|
|
5
4
|
* Class for performing synchronised storage operations.
|
|
6
5
|
*/
|
|
@@ -8,15 +7,15 @@ export interface ISynchronisedStorageComponent extends IComponent {
|
|
|
8
7
|
/**
|
|
9
8
|
* Get the decryption key for the synchronised storage.
|
|
10
9
|
* This is used to decrypt the data stored in the synchronised storage.
|
|
11
|
-
* @param
|
|
12
|
-
* @param proof The proof of the request so we know the request is from the specified node.
|
|
10
|
+
* @param trustPayload Trust payload to verify the requesters identity.
|
|
13
11
|
* @returns The decryption key.
|
|
14
12
|
*/
|
|
15
|
-
getDecryptionKey(
|
|
13
|
+
getDecryptionKey(trustPayload: unknown): Promise<string>;
|
|
16
14
|
/**
|
|
17
15
|
* Synchronise a set of changes from an untrusted node, assumes this is a trusted node.
|
|
18
16
|
* @param syncChangeSet The change set to synchronise.
|
|
17
|
+
* @param trustPayload Trust payload to verify the requesters identity.
|
|
19
18
|
* @returns Nothing.
|
|
20
19
|
*/
|
|
21
|
-
syncChangeSet(syncChangeSet: ISyncChangeSet): Promise<void>;
|
|
20
|
+
syncChangeSet(syncChangeSet: ISyncChangeSet, trustPayload: unknown): Promise<void>;
|
|
22
21
|
}
|