@twin.org/synchronised-storage-models 0.0.3-next.9 → 0.9.0-next.1

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.
Files changed (54) hide show
  1. package/README.md +2 -2
  2. package/dist/es/index.js +0 -1
  3. package/dist/es/index.js.map +1 -1
  4. package/dist/es/models/ISyncChange.js.map +1 -1
  5. package/dist/es/models/ISyncChangeSet.js.map +1 -1
  6. package/dist/es/models/ISyncRequest.js.map +1 -1
  7. package/dist/es/models/ISynchronisedEntity.js.map +1 -1
  8. package/dist/es/models/ISynchronisedEntityCore.js.map +1 -1
  9. package/dist/es/models/ISynchronisedStorageComponent.js.map +1 -1
  10. package/dist/es/models/eventBus/ISyncItemRequest.js.map +1 -1
  11. package/dist/es/models/eventBus/ISyncItemResponse.js.map +1 -1
  12. package/dist/es/models/eventBus/ISyncReset.js.map +1 -1
  13. package/dist/types/index.d.ts +0 -1
  14. package/dist/types/models/ISyncChange.d.ts +2 -2
  15. package/dist/types/models/ISyncChangeSet.d.ts +5 -5
  16. package/dist/types/models/ISyncRequest.d.ts +1 -1
  17. package/dist/types/models/ISynchronisedEntity.d.ts +1 -1
  18. package/dist/types/models/ISynchronisedEntityCore.d.ts +1 -1
  19. package/dist/types/models/ISynchronisedStorageComponent.d.ts +1 -1
  20. package/dist/types/models/eventBus/ISyncItemRequest.d.ts +1 -1
  21. package/dist/types/models/eventBus/ISyncItemResponse.d.ts +1 -1
  22. package/dist/types/models/eventBus/ISyncReset.d.ts +1 -1
  23. package/docs/changelog.md +133 -58
  24. package/docs/examples.md +61 -1
  25. package/docs/reference/index.md +0 -2
  26. package/docs/reference/interfaces/ISyncBatchRequest.md +3 -3
  27. package/docs/reference/interfaces/ISyncBatchResponse.md +3 -3
  28. package/docs/reference/interfaces/ISyncChange.md +4 -6
  29. package/docs/reference/interfaces/ISyncChangeSet.md +8 -13
  30. package/docs/reference/interfaces/ISyncChangeSetRequest.md +5 -5
  31. package/docs/reference/interfaces/ISyncDecryptionKeyRequest.md +4 -4
  32. package/docs/reference/interfaces/ISyncDecryptionKeyResponse.md +1 -1
  33. package/docs/reference/interfaces/ISyncItemChange.md +4 -4
  34. package/docs/reference/interfaces/ISyncItemRemove.md +3 -3
  35. package/docs/reference/interfaces/ISyncItemRequest.md +3 -3
  36. package/docs/reference/interfaces/ISyncItemResponse.md +5 -5
  37. package/docs/reference/interfaces/ISyncItemSet.md +2 -2
  38. package/docs/reference/interfaces/ISyncRegisterStorageKey.md +1 -1
  39. package/docs/reference/interfaces/ISyncRequest.md +3 -4
  40. package/docs/reference/interfaces/ISyncReset.md +3 -3
  41. package/docs/reference/interfaces/ISynchronisedEntity.md +3 -5
  42. package/docs/reference/interfaces/ISynchronisedEntityCore.md +1 -2
  43. package/docs/reference/interfaces/ISynchronisedStorageComponent.md +3 -3
  44. package/docs/reference/variables/SyncChangeOperation.md +2 -2
  45. package/docs/reference/variables/SyncNodeIdMode.md +3 -3
  46. package/docs/reference/variables/SynchronisedStorageContexts.md +3 -3
  47. package/docs/reference/variables/SynchronisedStorageTopics.md +9 -9
  48. package/docs/reference/variables/SynchronisedStorageTypes.md +2 -2
  49. package/package.json +8 -10
  50. package/dist/es/models/synchronisedStorageAssetTypes.js +0 -26
  51. package/dist/es/models/synchronisedStorageAssetTypes.js.map +0 -1
  52. package/dist/types/models/synchronisedStorageAssetTypes.d.ts +0 -25
  53. package/docs/reference/type-aliases/SynchronisedStorageAssetTypes.md +0 -5
  54. package/docs/reference/variables/SynchronisedStorageAssetTypes.md +0 -31
package/docs/examples.md CHANGED
@@ -1 +1,61 @@
1
- # @twin.org/synchronised-storage-models - Examples
1
+ # Synchronised Storage Models Examples
2
+
3
+ Use these model-focused snippets to define strongly typed payloads for synchronisation requests, changes, and event bus workflows.
4
+
5
+ ## Model Contracts
6
+
7
+ ```typescript
8
+ import {
9
+ SynchronisedStorageContexts,
10
+ SynchronisedStorageTypes,
11
+ SyncChangeOperation,
12
+ type ISyncChangeSet
13
+ } from '@twin.org/synchronised-storage-models';
14
+
15
+ const syncChangeSet: ISyncChangeSet = {
16
+ '@context': SynchronisedStorageContexts.Context,
17
+ type: SynchronisedStorageTypes.ChangeSet,
18
+ id: 'changeset-001',
19
+ storageKey: 'profile',
20
+ dateCreated: '2026-03-10T11:00:00.000Z',
21
+ dateModified: '2026-03-10T11:00:00.000Z',
22
+ nodeIdentity: 'did:iota:node-1',
23
+ changes: [
24
+ {
25
+ operation: SyncChangeOperation.Set,
26
+ id: 'profile-42',
27
+ entity: {
28
+ dateModified: '2026-03-10T11:00:00.000Z'
29
+ }
30
+ }
31
+ ]
32
+ };
33
+
34
+ console.log(syncChangeSet.changes[0].operation); // set
35
+ ```
36
+
37
+ ```typescript
38
+ import {
39
+ SyncNodeIdMode,
40
+ SynchronisedStorageTopics,
41
+ type ISynchronisedEntity
42
+ } from '@twin.org/synchronised-storage-models';
43
+
44
+ interface IProfileEntity extends ISynchronisedEntity {
45
+ displayName: string;
46
+ }
47
+
48
+ const entity: IProfileEntity = {
49
+ id: 'profile-42',
50
+ nodeIdentity: 'did:iota:node-1',
51
+ dateModified: '2026-03-10T11:05:00.000Z',
52
+ displayName: 'Rowan'
53
+ };
54
+
55
+ const topic = SynchronisedStorageTopics.LocalItemChange;
56
+ const mode = SyncNodeIdMode.Remote;
57
+
58
+ console.log(entity.id); // profile-42
59
+ console.log(topic); // synchronised-storage:local-item-change
60
+ console.log(mode); // remote
61
+ ```
@@ -25,7 +25,6 @@
25
25
 
26
26
  - [SyncChangeOperation](type-aliases/SyncChangeOperation.md)
27
27
  - [SyncNodeIdMode](type-aliases/SyncNodeIdMode.md)
28
- - [SynchronisedStorageAssetTypes](type-aliases/SynchronisedStorageAssetTypes.md)
29
28
  - [SynchronisedStorageContexts](type-aliases/SynchronisedStorageContexts.md)
30
29
  - [SynchronisedStorageTopics](type-aliases/SynchronisedStorageTopics.md)
31
30
  - [SynchronisedStorageTypes](type-aliases/SynchronisedStorageTypes.md)
@@ -34,7 +33,6 @@
34
33
 
35
34
  - [SyncChangeOperation](variables/SyncChangeOperation.md)
36
35
  - [SyncNodeIdMode](variables/SyncNodeIdMode.md)
37
- - [SynchronisedStorageAssetTypes](variables/SynchronisedStorageAssetTypes.md)
38
36
  - [SynchronisedStorageContexts](variables/SynchronisedStorageContexts.md)
39
37
  - [SynchronisedStorageTopics](variables/SynchronisedStorageTopics.md)
40
38
  - [SynchronisedStorageTypes](variables/SynchronisedStorageTypes.md)
@@ -4,7 +4,7 @@ Request for a local batch.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### storageKey
7
+ ### storageKey {#storagekey}
8
8
 
9
9
  > **storageKey**: `string`
10
10
 
@@ -12,7 +12,7 @@ The key of the storage for the entities in the batch.
12
12
 
13
13
  ***
14
14
 
15
- ### batchSize
15
+ ### batchSize {#batchsize}
16
16
 
17
17
  > **batchSize**: `number`
18
18
 
@@ -20,7 +20,7 @@ The size of the batch.
20
20
 
21
21
  ***
22
22
 
23
- ### requestMode
23
+ ### requestMode {#requestmode}
24
24
 
25
25
  > **requestMode**: [`SyncNodeIdMode`](../type-aliases/SyncNodeIdMode.md)
26
26
 
@@ -4,7 +4,7 @@ Response for a local batch.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### storageKey
7
+ ### storageKey {#storagekey}
8
8
 
9
9
  > **storageKey**: `string`
10
10
 
@@ -12,7 +12,7 @@ The key of the storage for the entities in the batch.
12
12
 
13
13
  ***
14
14
 
15
- ### entities
15
+ ### entities {#entities}
16
16
 
17
17
  > **entities**: [`ISynchronisedEntity`](ISynchronisedEntity.md)[]
18
18
 
@@ -20,7 +20,7 @@ The entities in the batch.
20
20
 
21
21
  ***
22
22
 
23
- ### lastEntry
23
+ ### lastEntry {#lastentry}
24
24
 
25
25
  > **lastEntry**: `boolean`
26
26
 
@@ -4,16 +4,15 @@ The object definition for a sync change.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### operation
7
+ ### operation {#operation}
8
8
 
9
9
  > **operation**: [`SyncChangeOperation`](../type-aliases/SyncChangeOperation.md)
10
10
 
11
11
  Operation.
12
- json-ld type:schema:Text
13
12
 
14
13
  ***
15
14
 
16
- ### id
15
+ ### id {#id}
17
16
 
18
17
  > **id**: `string`
19
18
 
@@ -21,9 +20,8 @@ The item id.
21
20
 
22
21
  ***
23
22
 
24
- ### entity?
23
+ ### entity? {#entity}
25
24
 
26
- > `optional` **entity**: [`ISynchronisedEntityCore`](ISynchronisedEntityCore.md)
25
+ > `optional` **entity?**: [`ISynchronisedEntityCore`](ISynchronisedEntityCore.md)
27
26
 
28
27
  The entity to set.
29
- json-ld type:json
@@ -4,7 +4,7 @@ The object definition for a sync change set.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### @context
7
+ ### @context {#context}
8
8
 
9
9
  > **@context**: `"https://schema.twindev.org/synchronised-storage/"`
10
10
 
@@ -12,7 +12,7 @@ The LD Context for the change set.
12
12
 
13
13
  ***
14
14
 
15
- ### type
15
+ ### type {#type}
16
16
 
17
17
  > **type**: `"ChangeSet"`
18
18
 
@@ -20,7 +20,7 @@ The LD Type for the change set.
20
20
 
21
21
  ***
22
22
 
23
- ### id
23
+ ### id {#id}
24
24
 
25
25
  > **id**: `string`
26
26
 
@@ -28,45 +28,40 @@ The id of the change set.
28
28
 
29
29
  ***
30
30
 
31
- ### storageKey
31
+ ### storageKey {#storagekey}
32
32
 
33
33
  > **storageKey**: `string`
34
34
 
35
35
  The storage key of the change set. This is used to identify the entities being synchronised.
36
- json-ld type:schema:identifier
37
36
 
38
37
  ***
39
38
 
40
- ### dateCreated
39
+ ### dateCreated {#datecreated}
41
40
 
42
41
  > **dateCreated**: `string`
43
42
 
44
43
  The date the change set was created.
45
- json-ld namespace:schema
46
44
 
47
45
  ***
48
46
 
49
- ### dateModified
47
+ ### dateModified {#datemodified}
50
48
 
51
49
  > **dateModified**: `string`
52
50
 
53
51
  The date the change set was last modified.
54
- json-ld namespace:schema
55
52
 
56
53
  ***
57
54
 
58
- ### nodeIdentity
55
+ ### nodeIdentity {#nodeidentity}
59
56
 
60
57
  > **nodeIdentity**: `string`
61
58
 
62
59
  The identity of the node that created the change set.
63
- json-ld namespace:twin-common
64
60
 
65
61
  ***
66
62
 
67
- ### changes
63
+ ### changes {#changes}
68
64
 
69
65
  > **changes**: [`ISyncChange`](ISyncChange.md)[]
70
66
 
71
67
  The changes to apply after a snapshot.
72
- json-ld type:json
@@ -4,23 +4,23 @@ Request a trusted node to perform a sync request for a changeset.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### headers?
7
+ ### headers? {#headers}
8
8
 
9
- > `optional` **headers**: `object`
9
+ > `optional` **headers?**: `object`
10
10
 
11
11
  The headers which can be used to determine the response data type.
12
12
 
13
13
  #### accept?
14
14
 
15
- > `optional` **accept**: `"application/ld+json"` \| `"application/json"`
15
+ > `optional` **accept?**: `"application/ld+json"` \| `"application/json"`
16
16
 
17
17
  #### authorization?
18
18
 
19
- > `optional` **authorization**: `string`
19
+ > `optional` **authorization?**: `string`
20
20
 
21
21
  ***
22
22
 
23
- ### body
23
+ ### body {#body}
24
24
 
25
25
  > **body**: [`ISyncChangeSet`](ISyncChangeSet.md)
26
26
 
@@ -4,16 +4,16 @@ Request for the decryption key for the synchronised storage.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### headers?
7
+ ### headers? {#headers}
8
8
 
9
- > `optional` **headers**: `object`
9
+ > `optional` **headers?**: `object`
10
10
 
11
11
  The headers which can be used to determine the response data type.
12
12
 
13
13
  #### accept?
14
14
 
15
- > `optional` **accept**: `"application/ld+json"` \| `"application/json"`
15
+ > `optional` **accept?**: `"application/ld+json"` \| `"application/json"`
16
16
 
17
17
  #### authorization?
18
18
 
19
- > `optional` **authorization**: `string`
19
+ > `optional` **authorization?**: `string`
@@ -4,7 +4,7 @@ Response to a request for the decryption key for the synchronised storage.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### body
7
+ ### body {#body}
8
8
 
9
9
  > **body**: `object`
10
10
 
@@ -4,7 +4,7 @@ The payload for an item change.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### storageKey
7
+ ### storageKey {#storagekey}
8
8
 
9
9
  > **storageKey**: `string`
10
10
 
@@ -12,7 +12,7 @@ The key of the storage being changed.
12
12
 
13
13
  ***
14
14
 
15
- ### operation
15
+ ### operation {#operation}
16
16
 
17
17
  > **operation**: [`SyncChangeOperation`](../type-aliases/SyncChangeOperation.md)
18
18
 
@@ -20,7 +20,7 @@ The operation being performed on the item.
20
20
 
21
21
  ***
22
22
 
23
- ### nodeId
23
+ ### nodeId {#nodeid}
24
24
 
25
25
  > **nodeId**: `string`
26
26
 
@@ -28,7 +28,7 @@ The node performing the operation.
28
28
 
29
29
  ***
30
30
 
31
- ### id
31
+ ### id {#id}
32
32
 
33
33
  > **id**: `string`
34
34
 
@@ -4,7 +4,7 @@ The payload for an item remove.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### storageKey
7
+ ### storageKey {#storagekey}
8
8
 
9
9
  > **storageKey**: `string`
10
10
 
@@ -12,7 +12,7 @@ The key of the storage being removed.
12
12
 
13
13
  ***
14
14
 
15
- ### nodeId
15
+ ### nodeId {#nodeid}
16
16
 
17
17
  > **nodeId**: `string`
18
18
 
@@ -20,7 +20,7 @@ The node identity of the entity being removed.
20
20
 
21
21
  ***
22
22
 
23
- ### id
23
+ ### id {#id}
24
24
 
25
25
  > **id**: `string`
26
26
 
@@ -4,15 +4,15 @@ Request for a local item.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### storageKey
7
+ ### storageKey {#storagekey}
8
8
 
9
9
  > **storageKey**: `string`
10
10
 
11
- The key of the storage for the entities in the batch.
11
+ The key of the storage containing the requested item.
12
12
 
13
13
  ***
14
14
 
15
- ### id
15
+ ### id {#id}
16
16
 
17
17
  > **id**: `string`
18
18
 
@@ -4,15 +4,15 @@ Response for a sync item request.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### storageKey
7
+ ### storageKey {#storagekey}
8
8
 
9
9
  > **storageKey**: `string`
10
10
 
11
- The key of the storage for the entities in the batch.
11
+ The key of the storage containing the responding item.
12
12
 
13
13
  ***
14
14
 
15
- ### id
15
+ ### id {#id}
16
16
 
17
17
  > **id**: `string`
18
18
 
@@ -20,8 +20,8 @@ The id of the entity in the sync item response.
20
20
 
21
21
  ***
22
22
 
23
- ### entity?
23
+ ### entity? {#entity}
24
24
 
25
- > `optional` **entity**: [`ISynchronisedEntity`](ISynchronisedEntity.md)
25
+ > `optional` **entity?**: [`ISynchronisedEntity`](ISynchronisedEntity.md)
26
26
 
27
27
  The entity in the sync item response, undefined if not found.
@@ -4,7 +4,7 @@ The payload for an item set.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### storageKey
7
+ ### storageKey {#storagekey}
8
8
 
9
9
  > **storageKey**: `string`
10
10
 
@@ -12,7 +12,7 @@ The key of the storage being set.
12
12
 
13
13
  ***
14
14
 
15
- ### entity
15
+ ### entity {#entity}
16
16
 
17
17
  > **entity**: [`ISynchronisedEntity`](ISynchronisedEntity.md)
18
18
 
@@ -4,7 +4,7 @@ Register a key with synchronised storage.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### storageKey
7
+ ### storageKey {#storagekey}
8
8
 
9
9
  > **storageKey**: `string`
10
10
 
@@ -4,7 +4,7 @@ The object definition for a sync request.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### @context
7
+ ### @context {#context}
8
8
 
9
9
  > **@context**: `"https://schema.twindev.org/synchronised-storage/"`
10
10
 
@@ -12,7 +12,7 @@ The LD Context for the request.
12
12
 
13
13
  ***
14
14
 
15
- ### type
15
+ ### type {#type}
16
16
 
17
17
  > **type**: `"SyncRequest"`
18
18
 
@@ -20,9 +20,8 @@ The LD Type for the request.
20
20
 
21
21
  ***
22
22
 
23
- ### nodeIdentity
23
+ ### nodeIdentity {#nodeidentity}
24
24
 
25
25
  > **nodeIdentity**: `string`
26
26
 
27
27
  The identity of the node that created the request.
28
- json-ld namespace:twin-common
@@ -4,15 +4,15 @@ Request to reset the local storage.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### storageKey
7
+ ### storageKey {#storagekey}
8
8
 
9
9
  > **storageKey**: `string`
10
10
 
11
- The key of the storage for the entities in the batch.
11
+ The key of the storage to reset.
12
12
 
13
13
  ***
14
14
 
15
- ### resetMode
15
+ ### resetMode {#resetmode}
16
16
 
17
17
  > **resetMode**: [`SyncNodeIdMode`](../type-aliases/SyncNodeIdMode.md)
18
18
 
@@ -8,7 +8,7 @@ The base definition for synchronised entries.
8
8
 
9
9
  ## Properties
10
10
 
11
- ### id
11
+ ### id {#id}
12
12
 
13
13
  > **id**: `string`
14
14
 
@@ -16,21 +16,19 @@ The id of the entry.
16
16
 
17
17
  ***
18
18
 
19
- ### nodeIdentity
19
+ ### nodeIdentity {#nodeidentity}
20
20
 
21
21
  > **nodeIdentity**: `string`
22
22
 
23
23
  The identity of the node that owns the entry.
24
- json-ld namespace:twin-common
25
24
 
26
25
  ***
27
26
 
28
- ### dateModified
27
+ ### dateModified {#datemodified}
29
28
 
30
29
  > **dateModified**: `string`
31
30
 
32
31
  The date the entry was modified.
33
- json-ld namespace:schema
34
32
 
35
33
  #### Inherited from
36
34
 
@@ -8,9 +8,8 @@ The base definition for synchronised entries.
8
8
 
9
9
  ## Properties
10
10
 
11
- ### dateModified
11
+ ### dateModified {#datemodified}
12
12
 
13
13
  > **dateModified**: `string`
14
14
 
15
15
  The date the entry was modified.
16
- json-ld namespace:schema
@@ -8,7 +8,7 @@ Class for performing synchronised storage operations.
8
8
 
9
9
  ## Methods
10
10
 
11
- ### getDecryptionKey()
11
+ ### getDecryptionKey() {#getdecryptionkey}
12
12
 
13
13
  > **getDecryptionKey**(`trustPayload`): `Promise`\<`string`\>
14
14
 
@@ -31,7 +31,7 @@ The decryption key.
31
31
 
32
32
  ***
33
33
 
34
- ### syncChangeSet()
34
+ ### syncChangeSet() {#syncchangeset}
35
35
 
36
36
  > **syncChangeSet**(`syncChangeSet`, `trustPayload`): `Promise`\<`void`\>
37
37
 
@@ -55,4 +55,4 @@ Trust payload to verify the requesters identity.
55
55
 
56
56
  `Promise`\<`void`\>
57
57
 
58
- Nothing.
58
+ A promise that resolves when the change set has been applied and stored.
@@ -6,13 +6,13 @@ The operations for a change.
6
6
 
7
7
  ## Type Declaration
8
8
 
9
- ### Set
9
+ ### Set {#set}
10
10
 
11
11
  > `readonly` **Set**: `"set"` = `"set"`
12
12
 
13
13
  An item was set in the storage.
14
14
 
15
- ### Delete
15
+ ### Delete {#delete}
16
16
 
17
17
  > `readonly` **Delete**: `"delete"` = `"delete"`
18
18
 
@@ -6,19 +6,19 @@ The mode to determine how node identities are matched.
6
6
 
7
7
  ## Type Declaration
8
8
 
9
- ### Local
9
+ ### Local {#local}
10
10
 
11
11
  > `readonly` **Local**: `"local"` = `"local"`
12
12
 
13
13
  Match the local node identity.
14
14
 
15
- ### Remote
15
+ ### Remote {#remote}
16
16
 
17
17
  > `readonly` **Remote**: `"remote"` = `"remote"`
18
18
 
19
19
  Match all but the local node identity.
20
20
 
21
- ### All
21
+ ### All {#all}
22
22
 
23
23
  > `readonly` **All**: `"all"` = `"all"`
24
24
 
@@ -6,19 +6,19 @@ The Contexts concerning Synchronised Storage.
6
6
 
7
7
  ## Type Declaration
8
8
 
9
- ### Namespace
9
+ ### Namespace {#namespace}
10
10
 
11
11
  > `readonly` **Namespace**: `"https://schema.twindev.org/synchronised-storage/"` = `"https://schema.twindev.org/synchronised-storage/"`
12
12
 
13
13
  The canonical RDF namespace URI for Synchronised Storage.
14
14
 
15
- ### Context
15
+ ### Context {#context}
16
16
 
17
17
  > `readonly` **Context**: `"https://schema.twindev.org/synchronised-storage/"` = `"https://schema.twindev.org/synchronised-storage/"`
18
18
 
19
19
  The value to use in context for Synchronised Storage.
20
20
 
21
- ### JsonLdContext
21
+ ### JsonLdContext {#jsonldcontext}
22
22
 
23
23
  > `readonly` **JsonLdContext**: `"https://schema.twindev.org/synchronised-storage/types.jsonld"` = `"https://schema.twindev.org/synchronised-storage/types.jsonld"`
24
24