@twin.org/synchronised-storage-service 0.0.1-next.9 → 0.0.3-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 (55) hide show
  1. package/dist/es/data/verifiableStorageKeys.json +5 -0
  2. package/dist/es/entities/syncSnapshotEntry.js +93 -0
  3. package/dist/es/entities/syncSnapshotEntry.js.map +1 -0
  4. package/dist/es/helpers/blobStorageHelper.js +185 -0
  5. package/dist/es/helpers/blobStorageHelper.js.map +1 -0
  6. package/dist/es/helpers/changeSetHelper.js +215 -0
  7. package/dist/es/helpers/changeSetHelper.js.map +1 -0
  8. package/dist/es/helpers/localSyncStateHelper.js +384 -0
  9. package/dist/es/helpers/localSyncStateHelper.js.map +1 -0
  10. package/dist/es/helpers/remoteSyncStateHelper.js +560 -0
  11. package/dist/es/helpers/remoteSyncStateHelper.js.map +1 -0
  12. package/dist/es/helpers/versions.js +6 -0
  13. package/dist/es/helpers/versions.js.map +1 -0
  14. package/dist/es/index.js +13 -0
  15. package/dist/es/index.js.map +1 -0
  16. package/dist/es/models/ISyncPointerStore.js +4 -0
  17. package/dist/es/models/ISyncPointerStore.js.map +1 -0
  18. package/dist/es/models/ISyncSnapshot.js +4 -0
  19. package/dist/es/models/ISyncSnapshot.js.map +1 -0
  20. package/dist/es/models/ISyncState.js +2 -0
  21. package/dist/es/models/ISyncState.js.map +1 -0
  22. package/dist/es/models/ISynchronisedStorageServiceConfig.js +4 -0
  23. package/dist/es/models/ISynchronisedStorageServiceConfig.js.map +1 -0
  24. package/dist/es/models/ISynchronisedStorageServiceConstructorOptions.js +2 -0
  25. package/dist/es/models/ISynchronisedStorageServiceConstructorOptions.js.map +1 -0
  26. package/dist/es/restEntryPoints.js +10 -0
  27. package/dist/es/restEntryPoints.js.map +1 -0
  28. package/dist/es/schema.js +11 -0
  29. package/dist/es/schema.js.map +1 -0
  30. package/dist/es/synchronisedStorageRoutes.js +153 -0
  31. package/dist/es/synchronisedStorageRoutes.js.map +1 -0
  32. package/dist/es/synchronisedStorageService.js +554 -0
  33. package/dist/es/synchronisedStorageService.js.map +1 -0
  34. package/dist/types/entities/syncSnapshotEntry.d.ts +3 -3
  35. package/dist/types/helpers/blobStorageHelper.d.ts +3 -3
  36. package/dist/types/helpers/changeSetHelper.d.ts +16 -32
  37. package/dist/types/helpers/localSyncStateHelper.d.ts +11 -11
  38. package/dist/types/helpers/remoteSyncStateHelper.d.ts +18 -14
  39. package/dist/types/index.d.ts +10 -10
  40. package/dist/types/models/ISyncState.d.ts +1 -1
  41. package/dist/types/models/ISynchronisedStorageServiceConfig.d.ts +3 -8
  42. package/dist/types/models/ISynchronisedStorageServiceConstructorOptions.d.ts +7 -6
  43. package/dist/types/synchronisedStorageRoutes.d.ts +1 -1
  44. package/dist/types/synchronisedStorageService.d.ts +18 -21
  45. package/docs/architecture.md +168 -12
  46. package/docs/changelog.md +135 -0
  47. package/docs/open-api/spec.json +62 -57
  48. package/docs/reference/classes/SyncSnapshotEntry.md +4 -10
  49. package/docs/reference/classes/SynchronisedStorageService.md +38 -50
  50. package/docs/reference/interfaces/ISynchronisedStorageServiceConfig.md +3 -17
  51. package/docs/reference/interfaces/ISynchronisedStorageServiceConstructorOptions.md +9 -8
  52. package/locales/en.json +11 -16
  53. package/package.json +26 -9
  54. package/dist/cjs/index.cjs +0 -2235
  55. package/dist/esm/index.mjs +0 -2227
@@ -62,7 +62,6 @@ The Synchronised Storage Service implements a distributed, eventually-consistent
62
62
  ┌───────────▼────────────┐
63
63
  │ Verifiable Storage │
64
64
  │ • On-chain Pointers │
65
- │ • State Root Hashes │
66
65
  │ • Access Control │
67
66
  └───────────┬────────────┘
68
67
 
@@ -70,7 +69,6 @@ The Synchronised Storage Service implements a distributed, eventually-consistent
70
69
  │ Decentralised Storage │
71
70
  │ • IPFS/Content Hash │
72
71
  │ • Immutable Blobs │
73
- │ • Distributed Refs │
74
72
  └────────────────────────┘
75
73
  ```
76
74
 
@@ -89,10 +87,9 @@ The Synchronised Storage Service implements a distributed, eventually-consistent
89
87
 
90
88
  - **Multi-Node Architecture**: Multiple trusted nodes operate in parallel to distribute processing load and provide high availability
91
89
  - **Change Validation**: Verify cryptographic signatures and node permissions across the cluster
92
- - **Change Set Consolidation**: Periodic compaction of historical change logs distributed across trusted node instances
93
- - **Decentralised Storage Interface**: Upload/download operations to IPFS-like systems with load balancing
90
+ - **Change Set Consolidation**: Periodic compaction of changes to create complete data sets
91
+ - **Decentralised Storage Interface**: Upload/download operations to e.g. IPFS
94
92
  - **Verifiable Storage Updates**: Atomic updates to on-chain state pointers with consensus agreement
95
- - **Load Distribution**: Automatic distribution of regular node connections and change processing across available trusted nodes
96
93
 
97
94
  ## Data Flow Architecture
98
95
 
@@ -105,24 +102,183 @@ EntityStorage → ChangeCapture → LocalSnapshot → EventBus
105
102
  ### 2. Change Set Propagation
106
103
 
107
104
  ```typescript
108
- LocalNode → [Sign] → ChangeSet → TrustedNode → [Validation] → GlobalState
105
+ RegularNode → [Sign] → ChangeSet → TrustedNode → [Verify] → GlobalState
109
106
  ```
110
107
 
111
108
  ### 3. Global State Persistence
112
109
 
113
110
  ```typescript
114
- TrustedNode → [Sign & Compression] → DecentralisedStorage → [StateRoot] → VerifiableStorage
111
+ TrustedNode → [Encrypt & Compress] → DecentralisedStorage → [StateRoot] → VerifiableStorage
115
112
  ```
116
113
 
117
114
  ### 4. Remote Synchronisation
118
115
 
119
116
  ```typescript
120
- AnyNode → [Poll] → VerifiableStorage → [Fetch] → DecentralisedStorage → [Merge] → LocalState
117
+ AnyNode → [Poll] → VerifiableStorage → [Fetch] → DecentralisedStorage → [Decrypt & Decompress] → LocalState
121
118
  ```
122
119
 
120
+ ## Synchronisation Algorithms
121
+
122
+ ### Apply Sync State Logic
123
+
124
+ The `applySyncState` method in `LocalSyncStateHelper` implements the core synchronisation algorithm that reconciles remote sync state with local state. This algorithm handles both full and incremental synchronisation scenarios:
125
+
126
+ #### Algorithm Overview
127
+
128
+ **Input Processing:**
129
+
130
+ - Retrieves existing local snapshots and remote sync state snapshots
131
+ - Sorts both collections by creation date (newest to oldest) for temporal ordering
132
+ - Extracts epoch information for gap detection analysis
133
+
134
+ **Epoch Gap Detection:**
135
+
136
+ If the node has not been running for a while or has failed communications it might start to miss data, so we use gap detection to determine if we need to use a full consolidation snapshot.
137
+
138
+ ```typescript
139
+ const newestExistingEpoch = existingSnapshots[0]?.epoch ?? 0;
140
+ const oldestSyncStateEpoch = syncStateSnapshots[syncStateSnapshots.length - 1]?.epoch ?? 0;
141
+ const hasEpochGap = newestExistingEpoch + 1 < oldestSyncStateEpoch;
142
+ ```
143
+
144
+ **Synchronisation Strategy Decision:**
145
+
146
+ 1. **Full Synchronisation Trigger:**
147
+ - No existing consolidated snapshots locally, OR
148
+ - Detected epoch gap between local and remote state
149
+
150
+ 2. **Incremental Synchronisation Trigger:**
151
+ - Existing consolidated snapshots present AND
152
+ - No epoch gaps detected
153
+
154
+ #### Full Synchronisation Process
155
+
156
+ When full sync is required:
157
+
158
+ 1. **Consolidation Search:** Locates the most recent consolidated snapshot in remote state
159
+ 2. **Entity Storage Reset:** Clears all remote entities from local storage to ensure clean state, but retains all local entries maintained by this node
160
+ 3. **Progressive Application:** Processes snapshots from the consolidation point forward to the newest, ensuring newer changes override older ones
161
+ 4. **Change Set Processing:** Applies all change sets from the consolidation and subsequent modifications
162
+
163
+ #### Incremental Synchronisation Process
164
+
165
+ When incremental sync is sufficient:
166
+
167
+ 1. **Snapshot Mapping:** Creates lookup map of existing local snapshots for efficient comparison
168
+ 2. **Change Detection:** Categorises remote snapshots into:
169
+ - **New Snapshots:** Not present locally
170
+ - **Modified Snapshots:** Present but with different `dateModified`
171
+ - **Unchanged Snapshots:** Identical local and remote versions
172
+
173
+ 3. **Processing Optimisation:** Stops processing when encountering an unchanged snapshot (temporal consistency guarantee)
174
+
175
+ 4. **Change Set Application:**
176
+ - Processes modified snapshots to apply incremental changes
177
+ - Processes new snapshots in chronological order (oldest to newest)
178
+ - Removes unreferenced local snapshots for storage clean-up
179
+
180
+ #### Key Design Principles
181
+
182
+ - **Temporal Consistency:** Changes are applied in chronological order to maintain causality
183
+ - **Conflict Resolution:** Newer changes automatically override older ones within the same entity
184
+ - **Storage Efficiency:** Only processes changed or new snapshots, avoiding redundant operations
185
+ - **Data Integrity:** Maintains referential integrity by cleaning up orphaned snapshot references
186
+ - **Gap Recovery:** Automatically triggers full synchronisation when data continuity is compromised
187
+
188
+ #### Error Handling & Edge Cases
189
+
190
+ - **Missing Consolidations:** Logs warning when full sync is needed but no consolidated snapshot is available
191
+ - **Empty Remote State:** Handles scenarios where remote sync state contains no snapshots
192
+ - **Epoch Inconsistencies:** Automatically recovers from epoch gaps through full synchronisation
193
+ - **Processing Interruption:** Uses `completedProcessing` flag to optimise incremental sync execution
194
+
195
+ This algorithm ensures eventually consistent data replication across distributed nodes while minimising network traffic and computational overhead through intelligent synchronisation strategy selection.
196
+
123
197
  ## Data Structures
124
198
 
125
- - Sync Pointer Store - stored in verifiable storage, for each storage type contains a storage id of the location for sync states
126
- - Sync State - stored in decentralised storage, contains all of the snapshots for a specific storage key
127
- - Sync Snapshot - contains a list of all the decentralised storage ids for the change sets which make up the snapshot
128
- - Change Set - contains a set of changes to be made to the entity storage
199
+ ### Sync Pointer Store
200
+
201
+ Stored in verifiable storage, for each storage type contains a storage id of the location for sync states.
202
+
203
+ ```json
204
+ {
205
+ "syncPointers": {
206
+ "my-type-1": "blob:ipfs:0x11...1111",
207
+ "my-type-2": "blob:ipfs:0x22...2222"
208
+ }
209
+ }
210
+ ```
211
+
212
+ ### Sync State
213
+
214
+ Stored in decentralised storage, contains all of the snapshots for a specific storage key
215
+
216
+ ```json
217
+ {
218
+ "storageKey": "my-type-1",
219
+ "snapshots": [
220
+ {
221
+ "id": "0xaaa...aaa",
222
+ ...
223
+ },
224
+ {
225
+ "id": "0xbbb...bbb",
226
+ ...
227
+ }
228
+ ]
229
+ }
230
+ ```
231
+
232
+ ### Sync Snapshot
233
+
234
+ Contains a list of all the storage ids for the change sets which make up the snapshot
235
+
236
+ ```json
237
+ {
238
+ "id": "0xaaa...aaa",
239
+ "dateCreated": "2025-05-29T01:00:00.000Z",
240
+ "dateModified": "2025-05-29T01:00:00.000Z",
241
+ "isConsolidated": false, // Determines if this contains a complete data set
242
+ "epoch": 123, // A counter that is incremented for each snapshot
243
+ "changeSetStorageIds": [
244
+ "blob:ipfs:0x111...1111",
245
+ "blob:ipfs:0x111...1112"
246
+ ...
247
+ ]
248
+ }
249
+ ```
250
+
251
+ ### Sync Change Set
252
+
253
+ Contains a set of changes to be made to the entity storage, the proof is generated by the node identity which guarantees the validity of the data from the node
254
+
255
+ ```json
256
+ {
257
+ "id": "0xaaa...aaa",
258
+ "storageKey": "my-type-1",
259
+ "dateCreated": "2025-05-29T01:00:00.000Z",
260
+ "dateModified": "2025-05-29T01:00:00.000Z",
261
+ "changes": [
262
+ ...
263
+ ],
264
+ "nodeIdentity": "did:iota:0xccc.cccccc",
265
+ "proof": {
266
+ // Cryptographic proof signed by the node identity
267
+ }
268
+ }
269
+ ```
270
+
271
+ ### Sync Change
272
+
273
+ Contains a mutation for an entry in entity storage, either a `set` of `delete`. The `id` and `nodeIdentity` are omitted from the entity and stored at a higher level in the data structures to shrink the data set size.
274
+
275
+ ```json
276
+ {
277
+ "operation": "set",
278
+ "id": "my-item-1",
279
+ "entity": {
280
+ "foo": true,
281
+ "bar": 123
282
+ }
283
+ }
284
+ ```
package/docs/changelog.md CHANGED
@@ -1,5 +1,140 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.1](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-service-v0.0.3-next.0...synchronised-storage-service-v0.0.3-next.1) (2025-11-12)
4
+
5
+
6
+ ### Features
7
+
8
+ * add async item requests to reduce storage overhead ([#3](https://github.com/twinfoundation/synchronised-storage/issues/3)) ([af4e17d](https://github.com/twinfoundation/synchronised-storage/commit/af4e17d826f0a8278fd60dc69aaa21fe6895425f))
9
+ * add context id features ([#24](https://github.com/twinfoundation/synchronised-storage/issues/24)) ([5266b18](https://github.com/twinfoundation/synchronised-storage/commit/5266b18088317c7dc274a209a79102a6fc88a8e4))
10
+ * add guards for verifiable storage keys ([5182e8b](https://github.com/twinfoundation/synchronised-storage/commit/5182e8b2a7868e8d396fd02964b0ed7f0c0a5947))
11
+ * add payload versioning ([3bbbce0](https://github.com/twinfoundation/synchronised-storage/commit/3bbbce0bdf24bbe67c1a265704538d505d7feb91))
12
+ * add rights management integration ([56fff6b](https://github.com/twinfoundation/synchronised-storage/commit/56fff6b4074f7ffaa40920e0c1e9fc98ca669111))
13
+ * add rights management integration ([d003d33](https://github.com/twinfoundation/synchronised-storage/commit/d003d33d2d2b4a4aa1379071eed71a707ebcb4de))
14
+ * add validate-locales ([e3d7b98](https://github.com/twinfoundation/synchronised-storage/commit/e3d7b98839e9ca624855717c8957d572c4e09abf))
15
+ * additional node identity checks ([76257c4](https://github.com/twinfoundation/synchronised-storage/commit/76257c4173303d484391f71f581fd0e214204029))
16
+ * blob storage connector instead of component ([#7](https://github.com/twinfoundation/synchronised-storage/issues/7)) ([ea27241](https://github.com/twinfoundation/synchronised-storage/commit/ea27241cf0810b52ab7a6be7346809d127b7109a))
17
+ * eslint migration to flat config ([f601c14](https://github.com/twinfoundation/synchronised-storage/commit/f601c14f6adef3290554dc7df6e6b3528aa0dc2b))
18
+ * improve consolidation logic ([698232f](https://github.com/twinfoundation/synchronised-storage/commit/698232f57640f87642ecd323cb1e4670eda33343))
19
+ * initial commit ([16949b8](https://github.com/twinfoundation/synchronised-storage/commit/16949b8e5bdb190f053c52af352290e3fd964f9a))
20
+ * remove isTrustedNode from config and rely on trusted component ([cc2d987](https://github.com/twinfoundation/synchronised-storage/commit/cc2d98795044fc97b33fadf871188f6103f5c987))
21
+ * removed unused properties ([7d4e916](https://github.com/twinfoundation/synchronised-storage/commit/7d4e9169e923142cd767c8830f2c009675484df8))
22
+ * switch to chacha20poly1305 for encryption ([ecc7137](https://github.com/twinfoundation/synchronised-storage/commit/ecc713775bc958c15453729aa1d6dacafd789906))
23
+ * switch to logging component ([a606302](https://github.com/twinfoundation/synchronised-storage/commit/a606302d7b89b922d33456b420d8f140d4fd565a))
24
+ * sync testing ([#5](https://github.com/twinfoundation/synchronised-storage/issues/5)) ([f78d5ac](https://github.com/twinfoundation/synchronised-storage/commit/f78d5ac661b891f9912e0a81d028453f909a64b4))
25
+ * update assertion method naming ([fb0118c](https://github.com/twinfoundation/synchronised-storage/commit/fb0118c494f0f520e1850a4e77b54e91235ce9a9))
26
+ * update framework core ([99f09cc](https://github.com/twinfoundation/synchronised-storage/commit/99f09cc94cfb9fff6b3a345775eeae2ab3192ed2))
27
+ * update RSA components ([c57c7b8](https://github.com/twinfoundation/synchronised-storage/commit/c57c7b85d4225deb6efa1228c77b8148bf6e11f7))
28
+ * update to in built vc auth mechanism ([411a371](https://github.com/twinfoundation/synchronised-storage/commit/411a3716830195ebf54755a1633b05d5c3f96754))
29
+
30
+
31
+ ### Dependencies
32
+
33
+ * The following workspace dependencies were updated
34
+ * dependencies
35
+ * @twin.org/synchronised-storage-models bumped from 0.0.3-next.0 to 0.0.3-next.1
36
+
37
+ ## [0.0.1-next.16](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-service-v0.0.1-next.15...synchronised-storage-service-v0.0.1-next.16) (2025-10-09)
38
+
39
+
40
+ ### Features
41
+
42
+ * add validate-locales ([e3d7b98](https://github.com/twinfoundation/synchronised-storage/commit/e3d7b98839e9ca624855717c8957d572c4e09abf))
43
+ * update assertion method naming ([fb0118c](https://github.com/twinfoundation/synchronised-storage/commit/fb0118c494f0f520e1850a4e77b54e91235ce9a9))
44
+
45
+
46
+ ### Dependencies
47
+
48
+ * The following workspace dependencies were updated
49
+ * dependencies
50
+ * @twin.org/synchronised-storage-models bumped from 0.0.1-next.15 to 0.0.1-next.16
51
+
52
+ ## [0.0.1-next.15](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-service-v0.0.1-next.14...synchronised-storage-service-v0.0.1-next.15) (2025-09-23)
53
+
54
+
55
+ ### Features
56
+
57
+ * add rights management integration ([56fff6b](https://github.com/twinfoundation/synchronised-storage/commit/56fff6b4074f7ffaa40920e0c1e9fc98ca669111))
58
+ * update to in built vc auth mechanism ([411a371](https://github.com/twinfoundation/synchronised-storage/commit/411a3716830195ebf54755a1633b05d5c3f96754))
59
+
60
+
61
+ ### Dependencies
62
+
63
+ * The following workspace dependencies were updated
64
+ * dependencies
65
+ * @twin.org/synchronised-storage-models bumped from 0.0.1-next.14 to 0.0.1-next.15
66
+
67
+ ## [0.0.1-next.14](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-service-v0.0.1-next.13...synchronised-storage-service-v0.0.1-next.14) (2025-09-22)
68
+
69
+
70
+ ### Features
71
+
72
+ * add rights management integration ([d003d33](https://github.com/twinfoundation/synchronised-storage/commit/d003d33d2d2b4a4aa1379071eed71a707ebcb4de))
73
+
74
+
75
+ ### Dependencies
76
+
77
+ * The following workspace dependencies were updated
78
+ * dependencies
79
+ * @twin.org/synchronised-storage-models bumped from 0.0.1-next.13 to 0.0.1-next.14
80
+
81
+ ## [0.0.1-next.13](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-service-v0.0.1-next.12...synchronised-storage-service-v0.0.1-next.13) (2025-08-29)
82
+
83
+
84
+ ### Features
85
+
86
+ * eslint migration to flat config ([f601c14](https://github.com/twinfoundation/synchronised-storage/commit/f601c14f6adef3290554dc7df6e6b3528aa0dc2b))
87
+ * removed unused properties ([7d4e916](https://github.com/twinfoundation/synchronised-storage/commit/7d4e9169e923142cd767c8830f2c009675484df8))
88
+
89
+
90
+ ### Dependencies
91
+
92
+ * The following workspace dependencies were updated
93
+ * dependencies
94
+ * @twin.org/synchronised-storage-models bumped from 0.0.1-next.12 to 0.0.1-next.13
95
+
96
+ ## [0.0.1-next.12](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-service-v0.0.1-next.11...synchronised-storage-service-v0.0.1-next.12) (2025-08-21)
97
+
98
+
99
+ ### Features
100
+
101
+ * update framework core ([99f09cc](https://github.com/twinfoundation/synchronised-storage/commit/99f09cc94cfb9fff6b3a345775eeae2ab3192ed2))
102
+
103
+
104
+ ### Dependencies
105
+
106
+ * The following workspace dependencies were updated
107
+ * dependencies
108
+ * @twin.org/synchronised-storage-models bumped from 0.0.1-next.11 to 0.0.1-next.12
109
+
110
+ ## [0.0.1-next.11](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-service-v0.0.1-next.10...synchronised-storage-service-v0.0.1-next.11) (2025-08-15)
111
+
112
+
113
+ ### Features
114
+
115
+ * switch to chacha20poly1305 for encryption ([ecc7137](https://github.com/twinfoundation/synchronised-storage/commit/ecc713775bc958c15453729aa1d6dacafd789906))
116
+
117
+
118
+ ### Dependencies
119
+
120
+ * The following workspace dependencies were updated
121
+ * dependencies
122
+ * @twin.org/synchronised-storage-models bumped from 0.0.1-next.10 to 0.0.1-next.11
123
+
124
+ ## [0.0.1-next.10](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-service-v0.0.1-next.9...synchronised-storage-service-v0.0.1-next.10) (2025-08-15)
125
+
126
+
127
+ ### Features
128
+
129
+ * update RSA components ([c57c7b8](https://github.com/twinfoundation/synchronised-storage/commit/c57c7b85d4225deb6efa1228c77b8148bf6e11f7))
130
+
131
+
132
+ ### Dependencies
133
+
134
+ * The following workspace dependencies were updated
135
+ * dependencies
136
+ * @twin.org/synchronised-storage-models bumped from 0.0.1-next.9 to 0.0.1-next.10
137
+
3
138
  ## [0.0.1-next.9](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-service-v0.0.1-next.8...synchronised-storage-service-v0.0.1-next.9) (2025-08-13)
4
139
 
5
140
 
@@ -28,6 +28,27 @@
28
28
  "tags": [
29
29
  "Synchronised Storage"
30
30
  ],
31
+ "parameters": [
32
+ {
33
+ "name": "accept",
34
+ "in": "header",
35
+ "required": true,
36
+ "schema": {
37
+ "type": "string"
38
+ },
39
+ "style": "simple"
40
+ },
41
+ {
42
+ "name": "authorization",
43
+ "in": "header",
44
+ "required": true,
45
+ "schema": {
46
+ "type": "string"
47
+ },
48
+ "style": "simple",
49
+ "example": "z3V32BP9ShC...z3V32BP9ShC"
50
+ }
51
+ ],
31
52
  "requestBody": {
32
53
  "description": "Request a trusted node to perform a sync request for a changeset.",
33
54
  "required": true,
@@ -39,10 +60,12 @@
39
60
  "examples": {
40
61
  "synchronisedStorageSyncChangeSetRequestExample": {
41
62
  "value": {
63
+ "@context": "https://schema.twindev.org/synchronised-storage",
64
+ "type": "ChangeSet",
42
65
  "id": "0909090909090909090909090909090909090909090909090909090909090909",
43
66
  "dateCreated": "2025-05-29T01:00:00.000Z",
44
67
  "dateModified": "2025-05-29T01:00:00.000Z",
45
- "nodeIdentity": "did:entity-storage:0xd2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2",
68
+ "nodeId": "did:entity-storage:0xd2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2",
46
69
  "changes": [
47
70
  {
48
71
  "entity": {
@@ -52,15 +75,6 @@
52
75
  "operation": "set"
53
76
  }
54
77
  ],
55
- "proof": {
56
- "@context": "https://www.w3.org/ns/credentials/v2",
57
- "created": "2025-05-29T01:00:00.000Z",
58
- "cryptosuite": "eddsa-jcs-2022",
59
- "proofPurpose": "assertionMethod",
60
- "proofValue": "z5efBErQs3YBLZoH7jgKMQaRc9YjAxA5XSYKmW3FmTBDw9WionT2NS2x1SMvcRyBvw53cSSoaCT1xQH9tkWngGCX3",
61
- "type": "DataIntegrityProof",
62
- "verificationMethod": "did:entity-storage:0xd0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0#synchronised-storage-assertion"
63
- },
64
78
  "storageKey": "test-type"
65
79
  }
66
80
  }
@@ -83,7 +97,7 @@
83
97
  "exampleResponse": {
84
98
  "value": {
85
99
  "name": "GeneralError",
86
- "message": "component.error",
100
+ "message": "errorMessage",
87
101
  "properties": {
88
102
  "foo": "bar"
89
103
  }
@@ -104,7 +118,7 @@
104
118
  "exampleResponse": {
105
119
  "value": {
106
120
  "name": "InternalServerError",
107
- "message": "component.error"
121
+ "message": "errorMessage"
108
122
  }
109
123
  }
110
124
  }
@@ -128,22 +142,6 @@
128
142
  "application/json": {
129
143
  "schema": {
130
144
  "$ref": "#/components/schemas/SyncChangeSet"
131
- },
132
- "examples": {
133
- "synchronisedStorageSyncGetDecryptionKeyRequestExample": {
134
- "value": {
135
- "nodeIdentity": "did:entity-storage:0xd2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2",
136
- "proof": {
137
- "@context": "https://www.w3.org/ns/credentials/v2",
138
- "created": "2025-05-29T01:00:00.000Z",
139
- "cryptosuite": "eddsa-jcs-2022",
140
- "proofPurpose": "assertionMethod",
141
- "proofValue": "z5efBErQs3YBLZoH7jgKMQaRc9YjAxA5XSYKmW3FmTBDw9WionT2NS2x1SMvcRyBvw53cSSoaCT1xQH9tkWngGCX3",
142
- "type": "DataIntegrityProof",
143
- "verificationMethod": "did:entity-storage:0xd0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0#synchronised-storage-assertion"
144
- }
145
- }
146
- }
147
145
  }
148
146
  }
149
147
  }
@@ -177,7 +175,7 @@
177
175
  "exampleResponse": {
178
176
  "value": {
179
177
  "name": "GeneralError",
180
- "message": "component.error",
178
+ "message": "errorMessage",
181
179
  "properties": {
182
180
  "foo": "bar"
183
181
  }
@@ -198,7 +196,7 @@
198
196
  "exampleResponse": {
199
197
  "value": {
200
198
  "name": "UnauthorizedError",
201
- "message": "component.error"
199
+ "message": "errorMessage"
202
200
  }
203
201
  }
204
202
  }
@@ -216,7 +214,7 @@
216
214
  "exampleResponse": {
217
215
  "value": {
218
216
  "name": "InternalServerError",
219
- "message": "component.error"
217
+ "message": "errorMessage"
220
218
  }
221
219
  }
222
220
  }
@@ -253,7 +251,7 @@
253
251
  "type": "string",
254
252
  "description": "The stack trace for the error."
255
253
  },
256
- "inner": {
254
+ "cause": {
257
255
  "$ref": "#/components/schemas/Error"
258
256
  }
259
257
  },
@@ -264,7 +262,7 @@
264
262
  "additionalProperties": false,
265
263
  "description": "Model to describe serialized error."
266
264
  },
267
- "SyncChange<SynchronisedEntity>": {
265
+ "SyncChange": {
268
266
  "type": "object",
269
267
  "properties": {
270
268
  "operation": {
@@ -275,7 +273,7 @@
275
273
  "description": "The item id."
276
274
  },
277
275
  "entity": {
278
- "$ref": "#/components/schemas/SynchronisedEntity"
276
+ "$ref": "#/components/schemas/SynchronisedEntityCore"
279
277
  }
280
278
  },
281
279
  "required": [
@@ -303,47 +301,53 @@
303
301
  "SyncChangeSet": {
304
302
  "type": "object",
305
303
  "properties": {
306
- "id": {
304
+ "@context": {
307
305
  "type": "string",
308
- "description": "The id of the change set."
306
+ "const": "https://schema.twindev.org/synchronised-storage",
307
+ "description": "The LD Context for the change set."
309
308
  },
310
- "dateCreated": {
309
+ "type": {
311
310
  "type": "string",
312
- "description": "The date the change set was created."
311
+ "const": "ChangeSet",
312
+ "description": "The LD Type for the change set."
313
+ },
314
+ "id": {
315
+ "type": "string",
316
+ "description": "The id of the change set."
313
317
  },
314
318
  "storageKey": {
315
319
  "type": "string",
316
320
  "description": "The storage key of the change set. This is used to identify the entities being synchronised."
317
321
  },
322
+ "dateCreated": {
323
+ "type": "string",
324
+ "description": "The date the change set was created."
325
+ },
318
326
  "dateModified": {
319
327
  "type": "string",
320
328
  "description": "The date the change set was last modified."
321
329
  },
322
- "changes": {
323
- "type": "array",
324
- "items": false,
325
- "description": "The changes to apply after a snapshot.",
326
- "prefixItems": [
327
- {
328
- "$ref": "#/components/schemas/SyncChange<SynchronisedEntity>"
329
- }
330
- ]
331
- },
332
- "nodeIdentity": {
330
+ "nodeId": {
333
331
  "type": "string",
334
332
  "description": "The identity of the node that created the change set."
335
333
  },
336
- "proof": {
337
- "$ref": "https://schema.twindev.org/w3c-did/Proof"
334
+ "changes": {
335
+ "type": "array",
336
+ "items": {
337
+ "$ref": "#/components/schemas/SyncChange"
338
+ },
339
+ "description": "The changes to apply after a snapshot."
338
340
  }
339
341
  },
340
342
  "required": [
343
+ "@context",
344
+ "type",
341
345
  "id",
342
- "dateCreated",
343
346
  "storageKey",
347
+ "dateCreated",
344
348
  "dateModified",
345
- "changes",
346
- "nodeIdentity"
349
+ "nodeId",
350
+ "changes"
347
351
  ],
348
352
  "additionalProperties": false,
349
353
  "description": "The object definition for a sync change set."
@@ -362,18 +366,19 @@
362
366
  "additionalProperties": false,
363
367
  "description": "The body of the response."
364
368
  },
365
- "SynchronisedEntity": {
369
+ "SynchronisedEntityCore": {
366
370
  "type": "object",
367
371
  "properties": {
368
372
  "dateModified": {
369
373
  "type": "string",
370
- "description": "The date the entry was modified"
374
+ "description": "The date the entry was modified."
371
375
  }
372
376
  },
373
377
  "required": [
374
378
  "dateModified"
375
379
  ],
376
- "additionalProperties": false
380
+ "additionalProperties": false,
381
+ "description": "The base definition for synchronised entries."
377
382
  }
378
383
  },
379
384
  "securitySchemes": {
@@ -1,22 +1,16 @@
1
- # Class: SyncSnapshotEntry\<T\>
1
+ # Class: SyncSnapshotEntry
2
2
 
3
3
  Class representing an entry for the sync snapshot.
4
4
 
5
- ## Type Parameters
6
-
7
- ### T
8
-
9
- `T` *extends* `ISynchronisedEntity` = `ISynchronisedEntity`
10
-
11
5
  ## Constructors
12
6
 
13
7
  ### Constructor
14
8
 
15
- > **new SyncSnapshotEntry**\<`T`\>(): `SyncSnapshotEntry`\<`T`\>
9
+ > **new SyncSnapshotEntry**(): `SyncSnapshotEntry`
16
10
 
17
11
  #### Returns
18
12
 
19
- `SyncSnapshotEntry`\<`T`\>
13
+ `SyncSnapshotEntry`
20
14
 
21
15
  ## Properties
22
16
 
@@ -94,6 +88,6 @@ The ids of the storage for the change sets in the snapshot, if this is not a loc
94
88
 
95
89
  ### changes?
96
90
 
97
- > `optional` **changes**: `ISyncChange`\<`T`\>[]
91
+ > `optional` **changes**: `ISyncChange`[]
98
92
 
99
93
  The changes that were made in this snapshot, if this is a local snapshot.