@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
@@ -1,13 +1,7 @@
1
- # Class: SynchronisedStorageService\<T\>
1
+ # Class: SynchronisedStorageService
2
2
 
3
3
  Class for performing synchronised storage operations.
4
4
 
5
- ## Type Parameters
6
-
7
- ### T
8
-
9
- `T` *extends* `ISynchronisedEntity` = `ISynchronisedEntity`
10
-
11
5
  ## Implements
12
6
 
13
7
  - `ISynchronisedStorageComponent`
@@ -16,7 +10,7 @@ Class for performing synchronised storage operations.
16
10
 
17
11
  ### Constructor
18
12
 
19
- > **new SynchronisedStorageService**\<`T`\>(`options`): `SynchronisedStorageService`\<`T`\>
13
+ > **new SynchronisedStorageService**(`options`): `SynchronisedStorageService`
20
14
 
21
15
  Create a new instance of SynchronisedStorageService.
22
16
 
@@ -30,45 +24,49 @@ The options for the service.
30
24
 
31
25
  #### Returns
32
26
 
33
- `SynchronisedStorageService`\<`T`\>
27
+ `SynchronisedStorageService`
34
28
 
35
29
  ## Properties
36
30
 
37
31
  ### CLASS\_NAME
38
32
 
39
- > `readonly` **CLASS\_NAME**: `string`
33
+ > `readonly` `static` **CLASS\_NAME**: `string`
40
34
 
41
35
  Runtime name for the class.
42
36
 
43
- #### Implementation of
37
+ ## Methods
44
38
 
45
- `ISynchronisedStorageComponent.CLASS_NAME`
39
+ ### className()
46
40
 
47
- ## Methods
41
+ > **className**(): `string`
48
42
 
49
- ### start()
43
+ Returns the class name of the component.
44
+
45
+ #### Returns
50
46
 
51
- > **start**(`nodeIdentity`, `nodeLoggingConnectorType`, `componentState?`): `Promise`\<`void`\>
47
+ `string`
52
48
 
53
- The component needs to be started when the node is initialized.
49
+ The class name of the component.
54
50
 
55
- #### Parameters
51
+ #### Implementation of
56
52
 
57
- ##### nodeIdentity
53
+ `ISynchronisedStorageComponent.className`
58
54
 
59
- `string`
55
+ ***
56
+
57
+ ### start()
60
58
 
61
- The identity of the node starting the component.
59
+ > **start**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
62
60
 
63
- ##### nodeLoggingConnectorType
61
+ The component needs to be started when the node is initialized.
64
62
 
65
- The node logging connector type, defaults to "node-logging".
63
+ #### Parameters
66
64
 
67
- `undefined` | `string`
65
+ ##### nodeLoggingComponentType?
68
66
 
69
- ##### componentState?
67
+ `string`
70
68
 
71
- A persistent state which can be modified by the method.
69
+ The node logging component type.
72
70
 
73
71
  #### Returns
74
72
 
@@ -84,27 +82,17 @@ Nothing.
84
82
 
85
83
  ### stop()
86
84
 
87
- > **stop**(`nodeIdentity`, `nodeLoggingConnectorType`, `componentState?`): `Promise`\<`void`\>
85
+ > **stop**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
88
86
 
89
87
  The component needs to be stopped when the node is closed.
90
88
 
91
89
  #### Parameters
92
90
 
93
- ##### nodeIdentity
91
+ ##### nodeLoggingComponentType?
94
92
 
95
93
  `string`
96
94
 
97
- The identity of the node stopping the component.
98
-
99
- ##### nodeLoggingConnectorType
100
-
101
- The node logging connector type, defaults to "node-logging".
102
-
103
- `undefined` | `string`
104
-
105
- ##### componentState?
106
-
107
- A persistent state which can be modified by the method.
95
+ The node logging component type.
108
96
 
109
97
  #### Returns
110
98
 
@@ -120,24 +108,18 @@ Nothing.
120
108
 
121
109
  ### getDecryptionKey()
122
110
 
123
- > **getDecryptionKey**(`nodeIdentity`, `proof`): `Promise`\<`string`\>
111
+ > **getDecryptionKey**(`actionRequest`): `Promise`\<`string`\>
124
112
 
125
113
  Get the decryption key for the synchronised storage.
126
114
  This is used to decrypt the data stored in the synchronised storage.
127
115
 
128
116
  #### Parameters
129
117
 
130
- ##### nodeIdentity
131
-
132
- `string`
133
-
134
- The identity of the node requesting the decryption key.
118
+ ##### actionRequest
135
119
 
136
- ##### proof
120
+ `IIdentityAuthenticationActionRequest`
137
121
 
138
- `IProof`
139
-
140
- The proof of the request so we know the request is from the specified node.
122
+ The action request used in the verifiable credential.
141
123
 
142
124
  #### Returns
143
125
 
@@ -153,7 +135,7 @@ The decryption key.
153
135
 
154
136
  ### syncChangeSet()
155
137
 
156
- > **syncChangeSet**(`syncChangeSet`): `Promise`\<`void`\>
138
+ > **syncChangeSet**(`syncChangeSet`, `actionRequest`): `Promise`\<`void`\>
157
139
 
158
140
  Synchronise a set of changes from an untrusted node, assumes this is a trusted node.
159
141
 
@@ -161,10 +143,16 @@ Synchronise a set of changes from an untrusted node, assumes this is a trusted n
161
143
 
162
144
  ##### syncChangeSet
163
145
 
164
- `ISyncChangeSet`\<`T`\>
146
+ `ISyncChangeSet`
165
147
 
166
148
  The change set to synchronise.
167
149
 
150
+ ##### actionRequest
151
+
152
+ `IIdentityAuthenticationActionRequest`
153
+
154
+ The action request used in the verifiable credential.
155
+
168
156
  #### Returns
169
157
 
170
158
  `Promise`\<`void`\>
@@ -4,20 +4,6 @@ Configuration for the Synchronised Storage Service.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### synchronisedStorageMethodId?
8
-
9
- > `optional` **synchronisedStorageMethodId**: `string`
10
-
11
- The id of the identity method to use when signing/verifying requests and changesets.
12
-
13
- #### Default
14
-
15
- ```ts
16
- synchronised-storage-assertion
17
- ```
18
-
19
- ***
20
-
21
7
  ### entityUpdateIntervalMinutes?
22
8
 
23
9
  > `optional` **entityUpdateIntervalMinutes**: `number`
@@ -36,7 +22,7 @@ How often to check for entity updates in minutes.
36
22
 
37
23
  > `optional` **consolidationIntervalMinutes**: `number`
38
24
 
39
- Interval to perform consolidation of changesets, only used if isTrustedNode is set.
25
+ Interval to perform consolidation of changesets, only used if this is a trusted node.
40
26
 
41
27
  #### Default
42
28
 
@@ -50,7 +36,7 @@ Interval to perform consolidation of changesets, only used if isTrustedNode is s
50
36
 
51
37
  > `optional` **consolidationBatchSize**: `number`
52
38
 
53
- The number of entities to process in a single consolidation batch.
39
+ The number of entities to process in a single consolidation batch, only used if this is a trusted node.
54
40
 
55
41
  #### Default
56
42
 
@@ -64,7 +50,7 @@ The number of entities to process in a single consolidation batch.
64
50
 
65
51
  > `optional` **maxConsolidations**: `number`
66
52
 
67
- The maximum number of consolidations to keep in storage.
53
+ The maximum number of consolidations to keep in storage, only used if this is a trusted node.
68
54
 
69
55
  #### Default
70
56
 
@@ -70,30 +70,31 @@ verifiable-storage
70
70
 
71
71
  ***
72
72
 
73
- ### identityConnectorType?
73
+ ### taskSchedulerComponentType?
74
74
 
75
- > `optional` **identityConnectorType**: `string`
75
+ > `optional` **taskSchedulerComponentType**: `string`
76
76
 
77
- The identity connector.
77
+ The task scheduler component.
78
78
 
79
79
  #### Default
80
80
 
81
81
  ```ts
82
- identity
82
+ task-scheduler
83
83
  ```
84
84
 
85
85
  ***
86
86
 
87
- ### taskSchedulerComponentType?
87
+ ### policyEnforcementPointComponentType?
88
88
 
89
- > `optional` **taskSchedulerComponentType**: `string`
89
+ > `optional` **policyEnforcementPointComponentType**: `string`
90
90
 
91
- The task scheduler component.
91
+ The rights management enforcement component to use for verifying untrusted node access.
92
+ Only required on a trusted node to enforce access control.
92
93
 
93
94
  #### Default
94
95
 
95
96
  ```ts
96
- task-scheduler
97
+ policy-enforcement-point
97
98
  ```
98
99
 
99
100
  ***
package/locales/en.json CHANGED
@@ -3,11 +3,6 @@
3
3
  "changeSetHelper": {
4
4
  "changeSetApplyingChange": "Applying remote sync change with operation id \"{operation}\" for item with id \"{id}\"",
5
5
  "changeSetStoring": "Storing remote sync change set with id \"{id}\"",
6
- "verifyChangeSetProofMissing": "Verifying change set with id \"{id}\" failed, missing proof",
7
- "verifyChangeSetProofInvalid": "Verifying change set with id \"{id}\" failed, missing proof",
8
- "verifyChangeSetProofNodeIdentityMismatch": "Verifying change set with id \"{id}\" failed, the node identity does not match the proof",
9
- "verifyChangeSetProofValid": "Verifying change set with id \"{id}\" succeeded",
10
- "createdChangeSetProof": "Created change proof for change set with id \"{id}\", proof value is \"{proofValue}\"",
11
6
  "getChangeSet": "Retrieving change set with id \"{changeSetStorageId}\"",
12
7
  "getChangeSetEmpty": "No change set found with id \"{changeSetStorageId}\"",
13
8
  "copyChangeSet": "Copying change set with id \"{changeSetStorageId}\"",
@@ -41,7 +36,9 @@
41
36
  "consolidationCompleted": "Consolidation of remote sync state completed",
42
37
  "addChangeSetToSyncState": "Adding change set with id \"{changeSetStorageId}\" to remote sync state for storage key \"{storageKey}\"",
43
38
  "buildingChangeSet": "Building change set for storage key \"{storageKey}\" with \"{changeCount}\" changes",
44
- "finalisingSyncChanges": "Finalising sync changes for storage key \"{storageKey}\""
39
+ "finalisingSyncChanges": "Finalising sync changes for storage key \"{storageKey}\"",
40
+ "createChangeSetRequestingItem": "Creating change set for key \"{storageKey}\", requesting item with id \"{id}\"",
41
+ "createChangeSetRespondingItem": "Responding to change set request for key \"{storageKey}\", item with id \"{id}\""
45
42
  },
46
43
  "synchronisedStorageService": {
47
44
  "registerStorageKey": "Registering synchronised storage key \"{storageKey}\"",
@@ -52,10 +49,9 @@
52
49
  "updateFromLocalSyncStateNoChanges": "No changes found in local sync state for key \"{storageKey}\", skipping update",
53
50
  "builtStorageChangeSet": "Built storage change set for key \"{storageKey}\" with id \"{changeSetStorageId}\"",
54
51
  "builtStorageChangeSetNone": "No changes found for key \"{storageKey}\", no storage change set created",
55
- "createChangeSetRequestingItem": "Creating change set for key \"{storageKey}\", requesting item with id \"{id}\"",
56
- "createChangeSetRespondingItem": "Responding to change set request for key \"{storageKey}\", item with id \"{id}\"",
57
52
  "sendingChangeSetToTrustedNode": "Sending change set with id \"{changeSetStorageId}\" to trusted node for key \"{storageKey}\"",
58
- "syncChangeSetForRemoteNode": "Synchronising change set with id \"{changeSetStorageId}\" for remote node for type \"{storageKey}\""
53
+ "decryptionKeyRequest": "Decryption key requested by node identity \"{nodeId}\"",
54
+ "syncChangeSetForRemoteNode": "Synchronising change set with id \"{changeSetStorageId}\" for node identity \"{nodeId}\""
59
55
  },
60
56
  "blobStorageHelper": {
61
57
  "loadBlob": "Loading blob with id \"{blobId}\"",
@@ -69,16 +65,14 @@
69
65
  }
70
66
  },
71
67
  "error": {
72
- "synchronisedEntityStorageConnector": {
73
- "missingRequiredProperty": "To use synchronised entity storage the entity schema must contain the property \"{requiredProperty}\"",
74
- "missingRequiredPropertySort": "To use synchronised entity storage the entity schema must contain the property \"{requiredProperty}\" and it must be sortable"
75
- },
76
68
  "synchronisedStorageService": {
77
69
  "notTrustedNode": "This method can only be called on a trusted node",
78
70
  "entitySyncFailed": "Failed to sync synchronised entity storage connector",
79
71
  "consolidationSyncFailed": "Failed to consolidate synchronised entity storage connector",
80
- "invalidProof": "Invalid proof provided for synchronised entity storage connector",
81
- "decryptionKeyNotFound": "Decryption key not found, ensure the synchronised storage component is initialised and the decryption key is set"
72
+ "decryptionKeyNotAllowed": "The node identity \"{nodeId}\" is not allowed to retrieve the decryption key",
73
+ "changeSetNotAllowed": "The node identity \"{nodeId}\" is not allowed to sync the change set with id \"{changeSetStorageId}\"",
74
+ "decryptionKeyNotFound": "Decryption key not found, ensure the synchronised storage component is initialised and the decryption key is set",
75
+ "incorrectActionType": "Incorrect action in credential \"{action}\", expecting \"{expecting}\""
82
76
  },
83
77
  "remoteSyncStateHelper": {
84
78
  "finalisingSyncChangesFailed": "Failed to finalise sync changes for storage key \"{storageKey}\""
@@ -86,7 +80,8 @@
86
80
  "blobStorageHelper": {
87
81
  "loadBlobFailed": "Failed to load blob with id \"{blobId}\"",
88
82
  "saveBlobFailed": "Failed to save blob",
89
- "notTrustedNode": "Cannot save blob, this is not a trusted node"
83
+ "notTrustedNode": "Cannot save blob, this is not a trusted node",
84
+ "removeBlobFailed": "Failed to remove blob with id \"{blobId}\""
90
85
  }
91
86
  },
92
87
  "warn": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/synchronised-storage-service",
3
- "version": "0.0.1-next.9",
3
+ "version": "0.0.3-next.1",
4
4
  "description": "Synchronised storage contract implementation and REST endpoint definitions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,35 +17,52 @@
17
17
  "@twin.org/api-models": "next",
18
18
  "@twin.org/background-task-models": "next",
19
19
  "@twin.org/blob-storage-models": "next",
20
+ "@twin.org/context": "next",
20
21
  "@twin.org/core": "next",
21
22
  "@twin.org/crypto": "next",
22
23
  "@twin.org/entity": "next",
23
24
  "@twin.org/entity-storage-models": "next",
24
25
  "@twin.org/event-bus-models": "next",
26
+ "@twin.org/identity-authentication": "next",
25
27
  "@twin.org/identity-models": "next",
26
28
  "@twin.org/logging-models": "next",
27
29
  "@twin.org/nameof": "next",
30
+ "@twin.org/rights-management-models": "next",
28
31
  "@twin.org/standards-w3c-did": "next",
29
- "@twin.org/synchronised-storage-models": "0.0.1-next.9",
32
+ "@twin.org/standards-w3c-odrl": "next",
33
+ "@twin.org/synchronised-storage-models": "0.0.3-next.1",
30
34
  "@twin.org/verifiable-storage-models": "next",
31
35
  "@twin.org/web": "next"
32
36
  },
33
- "main": "./dist/cjs/index.cjs",
34
- "module": "./dist/esm/index.mjs",
37
+ "main": "./dist/es/index.js",
35
38
  "types": "./dist/types/index.d.ts",
36
39
  "exports": {
37
40
  ".": {
38
41
  "types": "./dist/types/index.d.ts",
39
- "require": "./dist/cjs/index.cjs",
40
- "import": "./dist/esm/index.mjs"
42
+ "import": "./dist/es/index.js",
43
+ "default": "./dist/es/index.js"
41
44
  },
42
45
  "./locales/*.json": "./locales/*.json"
43
46
  },
44
47
  "files": [
45
- "dist/cjs",
46
- "dist/esm",
48
+ "dist/es",
47
49
  "dist/types",
48
50
  "locales",
49
51
  "docs"
50
- ]
52
+ ],
53
+ "keywords": [
54
+ "twin",
55
+ "trade",
56
+ "iota",
57
+ "framework",
58
+ "blockchain",
59
+ "synchronised-storage",
60
+ "service",
61
+ "microservice",
62
+ "business-logic"
63
+ ],
64
+ "bugs": {
65
+ "url": "git+https://github.com/twinfoundation/synchronised-storage/issues"
66
+ },
67
+ "homepage": "https://twindev.org"
51
68
  }