@twin.org/synchronised-storage-service 0.0.1-next.3 → 0.0.1-next.5
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/cjs/index.cjs +963 -276
- package/dist/esm/index.mjs +965 -279
- package/dist/types/entities/syncSnapshotEntry.d.ts +12 -5
- package/dist/types/helpers/blobStorageHelper.d.ts +39 -0
- package/dist/types/helpers/changeSetHelper.d.ts +26 -7
- package/dist/types/helpers/localSyncStateHelper.d.ts +11 -25
- package/dist/types/helpers/remoteSyncStateHelper.d.ts +17 -12
- package/dist/types/helpers/versions.d.ts +3 -0
- package/dist/types/index.d.ts +0 -2
- package/dist/types/models/ISyncPointerStore.d.ts +4 -0
- package/dist/types/models/ISyncSnapshot.d.ts +9 -1
- package/dist/types/models/ISyncState.d.ts +8 -0
- package/dist/types/models/ISynchronisedStorageServiceConfig.d.ts +17 -6
- package/dist/types/models/ISynchronisedStorageServiceConstructorOptions.d.ts +6 -2
- package/dist/types/synchronisedStorageRoutes.d.ts +9 -1
- package/dist/types/synchronisedStorageService.d.ts +13 -4
- package/docs/architecture.md +128 -0
- package/docs/changelog.md +29 -0
- package/docs/open-api/spec.json +246 -18
- package/docs/reference/classes/SyncSnapshotEntry.md +22 -6
- package/docs/reference/classes/SynchronisedStorageService.md +38 -5
- package/docs/reference/functions/synchronisedStorageGetDecryptionKeyRequest.md +31 -0
- package/docs/reference/index.md +1 -2
- package/docs/reference/interfaces/ISyncPointerStore.md +8 -0
- package/docs/reference/interfaces/ISyncSnapshot.md +18 -2
- package/docs/reference/interfaces/ISyncState.md +16 -0
- package/docs/reference/interfaces/ISynchronisedStorageServiceConfig.md +44 -10
- package/docs/reference/interfaces/ISynchronisedStorageServiceConstructorOptions.md +11 -3
- package/locales/en.json +60 -25
- package/package.json +3 -2
- package/dist/types/models/ISyncChange.d.ts +0 -18
- package/dist/types/models/ISyncChangeSet.d.ts +0 -36
- package/docs/reference/interfaces/ISyncChange.md +0 -33
- package/docs/reference/interfaces/ISyncChangeSet.md +0 -65
package/locales/en.json
CHANGED
|
@@ -4,18 +4,26 @@
|
|
|
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
6
|
"verifyChangeSetProofMissing": "Verifying change set with id \"{id}\" failed, missing proof",
|
|
7
|
-
"verifyChangeSetProofInvalid": "Verifying change set with id \"{id}\" failed,
|
|
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",
|
|
8
9
|
"verifyChangeSetProofValid": "Verifying change set with id \"{id}\" succeeded",
|
|
9
|
-
"createdChangeSetProof": "Created change proof for change set with id \"{id}\", proof value is \"{proofValue}\""
|
|
10
|
+
"createdChangeSetProof": "Created change proof for change set with id \"{id}\", proof value is \"{proofValue}\"",
|
|
11
|
+
"getChangeSet": "Retrieving change set with id \"{changeSetStorageId}\"",
|
|
12
|
+
"getChangeSetEmpty": "No change set found with id \"{changeSetStorageId}\"",
|
|
13
|
+
"copyChangeSet": "Copying change set with id \"{changeSetStorageId}\"",
|
|
14
|
+
"storageReset": "Resetting storage for storage key \"{storageKey}\""
|
|
10
15
|
},
|
|
11
16
|
"localSyncStateHelper": {
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
17
|
+
"getSnapshots": "Retrieving snapshot for storage key \"{storageKey}\"",
|
|
18
|
+
"getSnapshotsExists": "Found existing snapshot for storage key \"{storageKey}\"",
|
|
19
|
+
"getSnapshotsDoesNotExist": "No local change snapshot found for storage key \"{storageKey}\", creating new one",
|
|
20
|
+
"applySyncState": "Syncing from remote state with \"{snapshotCount}\" snapshots",
|
|
21
|
+
"applySnapshot": "Processing sync snapshot with id \"{snapshotId}\" created on \"{dateCreated}\"",
|
|
22
|
+
"applySnapshotNoExisting": "There are no existing snapshots, find a consolidated snapshot for storage key \"{storageKey}\"",
|
|
23
|
+
"applySnapshotFoundConsolidated": "Found consolidated snapshot with id \"{snapshotId}\" for storage key \"{storageKey}\"",
|
|
24
|
+
"applySnapshotNoConsolidated": "No consolidated snapshot found, cannot apply sync state for storage key \"{storageKey}\"",
|
|
25
|
+
"processModifiedSnapshot": "Processing modified sync snapshot with id \"{snapshotId}\", remote modified on \"{remoteModified}\", local modified on \"{localModified}\"",
|
|
26
|
+
"processNewSnapshot": "Processing new sync snapshot with id \"{snapshotId}\", created on \"{dateCreated}\"",
|
|
19
27
|
"removeLocalChangeSnapshot": "Removing local change snapshot with id \"{snapshotId}\"",
|
|
20
28
|
"addLocalChange": "Adding local change with id \"{id}\" to local change snapshot for storage key \"{storageKey}\", operation \"{operation}\"",
|
|
21
29
|
"setLocalChangeSnapshot": "Storing local change snapshot for storage key \"{storageKey}\""
|
|
@@ -25,27 +33,39 @@
|
|
|
25
33
|
"verifiableSyncPointerStoreNotFound": "No verifiable sync pointer store found for key \"{key}\"",
|
|
26
34
|
"verifiableSyncPointerStoreRetrieved": "Retrieved verifiable sync pointer for key \"{key}\"",
|
|
27
35
|
"verifiableSyncPointerStoreStoring": "Storing verifiable sync pointer store for key \"{key}\"",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
36
|
+
"syncStateStoring": "Storing sync state entry with \"{snapshotCount}\" snapshots",
|
|
37
|
+
"syncStateRetrieving": "Retrieving sync state entry for syncPointerId \"{syncPointerId}\"",
|
|
38
|
+
"syncStateRetrieved": "Retrieving sync state entry for syncPointerId \"{syncPointerId}\" with \"{snapshotCount}\" snapshots",
|
|
39
|
+
"syncStateNotFound": "No sync state entry found for syncPointerId \"{syncPointerId}\"",
|
|
32
40
|
"consolidationStarting": "Starting consolidation of remote sync state",
|
|
33
41
|
"consolidationCompleted": "Consolidation of remote sync state completed",
|
|
34
42
|
"addChangeSetToSyncState": "Adding change set with id \"{changeSetStorageId}\" to remote sync state for storage key \"{storageKey}\"",
|
|
35
|
-
"
|
|
43
|
+
"buildingChangeSet": "Building change set for storage key \"{storageKey}\" with \"{changeCount}\" changes",
|
|
36
44
|
"finalisingSyncChanges": "Finalising sync changes for storage key \"{storageKey}\""
|
|
37
45
|
},
|
|
38
46
|
"synchronisedStorageService": {
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"startEntitySync": "Starting synchronised entity storage for
|
|
42
|
-
"updateFromRemoteSyncState": "Updating synchronised entity storage from remote sync state for
|
|
43
|
-
"updateFromLocalSyncState": "Updating synchronised entity storage from local sync state for
|
|
44
|
-
"updateFromLocalSyncStateNoChanges": "No changes found in local sync state for
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"createChangeSetRequestingItem": "Creating change set for
|
|
48
|
-
"createChangeSetRespondingItem": "Responding to change set request for
|
|
47
|
+
"registerStorageKey": "Registering synchronised storage key \"{storageKey}\"",
|
|
48
|
+
"activateStorageKey": "Activating synchronised storage key \"{storageKey}\"",
|
|
49
|
+
"startEntitySync": "Starting synchronised entity storage for key \"{storageKey}\"",
|
|
50
|
+
"updateFromRemoteSyncState": "Updating synchronised entity storage from remote sync state for key \"{storageKey}\"",
|
|
51
|
+
"updateFromLocalSyncState": "Updating synchronised entity storage from local sync state for key \"{storageKey}\"",
|
|
52
|
+
"updateFromLocalSyncStateNoChanges": "No changes found in local sync state for key \"{storageKey}\", skipping update",
|
|
53
|
+
"builtStorageChangeSet": "Built storage change set for key \"{storageKey}\" with id \"{changeSetStorageId}\"",
|
|
54
|
+
"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
|
+
"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}\""
|
|
59
|
+
},
|
|
60
|
+
"blobStorageHelper": {
|
|
61
|
+
"loadBlob": "Loading blob with id \"{blobId}\"",
|
|
62
|
+
"loadedBlob": "Loaded blob with id \"{blobId}\"",
|
|
63
|
+
"loadBlobEmpty": "No blob found with id \"{blobId}\"",
|
|
64
|
+
"saveBlob": "Saving blob",
|
|
65
|
+
"savedBlob": "Saved blob with id \"{blobId}\"",
|
|
66
|
+
"removeBlob": "Removing blob with id \"{blobId}\"",
|
|
67
|
+
"removedBlob": "Removed blob with id \"{blobId}\"",
|
|
68
|
+
"removeBlobEmpty": "No blob found to remove with id \"{blobId}\""
|
|
49
69
|
}
|
|
50
70
|
},
|
|
51
71
|
"error": {
|
|
@@ -56,10 +76,25 @@
|
|
|
56
76
|
"synchronisedStorageService": {
|
|
57
77
|
"notTrustedNode": "This method can only be called on a trusted node",
|
|
58
78
|
"entitySyncFailed": "Failed to sync synchronised entity storage connector",
|
|
59
|
-
"consolidationSyncFailed": "Failed to consolidate synchronised entity storage connector"
|
|
79
|
+
"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"
|
|
60
82
|
},
|
|
61
83
|
"remoteSyncStateHelper": {
|
|
62
84
|
"finalisingSyncChangesFailed": "Failed to finalise sync changes for storage key \"{storageKey}\""
|
|
85
|
+
},
|
|
86
|
+
"blobStorageHelper": {
|
|
87
|
+
"loadBlobFailed": "Failed to load blob with id \"{blobId}\"",
|
|
88
|
+
"saveBlobFailed": "Failed to save blob",
|
|
89
|
+
"notTrustedNode": "Cannot save blob, this is not a trusted node"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"warn": {
|
|
93
|
+
"changeSetHelper": {
|
|
94
|
+
"getChangeSetError": "Failed to retrieve change set with id \"{changeSetStorageId}\""
|
|
95
|
+
},
|
|
96
|
+
"remoteSyncStateHelper": {
|
|
97
|
+
"getSyncStateError": "Failed to retrieve sync state for syncPointerId \"{syncPointerId}\""
|
|
63
98
|
}
|
|
64
99
|
}
|
|
65
100
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/synchronised-storage-service",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.5",
|
|
4
4
|
"description": "Synchronised storage contract implementation and REST endpoint definitions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"@twin.org/background-task-models": "next",
|
|
19
19
|
"@twin.org/blob-storage-models": "next",
|
|
20
20
|
"@twin.org/core": "next",
|
|
21
|
+
"@twin.org/crypto": "next",
|
|
21
22
|
"@twin.org/entity": "next",
|
|
22
23
|
"@twin.org/entity-storage-models": "next",
|
|
23
24
|
"@twin.org/event-bus-models": "next",
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
"@twin.org/logging-models": "next",
|
|
26
27
|
"@twin.org/nameof": "next",
|
|
27
28
|
"@twin.org/standards-w3c-did": "next",
|
|
28
|
-
"@twin.org/synchronised-storage-models": "0.0.1-next.
|
|
29
|
+
"@twin.org/synchronised-storage-models": "0.0.1-next.5",
|
|
29
30
|
"@twin.org/verifiable-storage-models": "next",
|
|
30
31
|
"@twin.org/web": "next"
|
|
31
32
|
},
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ISynchronisedEntity, SyncChangeOperation } from "@twin.org/synchronised-storage-models";
|
|
2
|
-
/**
|
|
3
|
-
* The object definition for a sync change.
|
|
4
|
-
*/
|
|
5
|
-
export interface ISyncChange<T extends ISynchronisedEntity = ISynchronisedEntity> {
|
|
6
|
-
/**
|
|
7
|
-
* Operation.
|
|
8
|
-
*/
|
|
9
|
-
operation: SyncChangeOperation;
|
|
10
|
-
/**
|
|
11
|
-
* The item id.
|
|
12
|
-
*/
|
|
13
|
-
id: string;
|
|
14
|
-
/**
|
|
15
|
-
* The entity to set.
|
|
16
|
-
*/
|
|
17
|
-
entity?: T;
|
|
18
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { IProof } from "@twin.org/standards-w3c-did";
|
|
2
|
-
import type { ISynchronisedEntity } from "@twin.org/synchronised-storage-models";
|
|
3
|
-
import type { ISyncChange } from "./ISyncChange";
|
|
4
|
-
/**
|
|
5
|
-
* The object definition for a sync change set.
|
|
6
|
-
*/
|
|
7
|
-
export interface ISyncChangeSet<T extends ISynchronisedEntity = ISynchronisedEntity> {
|
|
8
|
-
/**
|
|
9
|
-
* The id of the snapshot.
|
|
10
|
-
*/
|
|
11
|
-
id: string;
|
|
12
|
-
/**
|
|
13
|
-
* The date the change set was created.
|
|
14
|
-
*/
|
|
15
|
-
dateCreated: string;
|
|
16
|
-
/**
|
|
17
|
-
* The storage key of the change set. This is used to identify the entities being synchronised.
|
|
18
|
-
*/
|
|
19
|
-
storageKey: string;
|
|
20
|
-
/**
|
|
21
|
-
* The date the change set was last modified.
|
|
22
|
-
*/
|
|
23
|
-
dateModified?: string;
|
|
24
|
-
/**
|
|
25
|
-
* The changes to apply after a snapshot.
|
|
26
|
-
*/
|
|
27
|
-
changes: ISyncChange<T>[];
|
|
28
|
-
/**
|
|
29
|
-
* The identity of the node that created the change set.
|
|
30
|
-
*/
|
|
31
|
-
nodeIdentity: string;
|
|
32
|
-
/**
|
|
33
|
-
* The proof for the change set.
|
|
34
|
-
*/
|
|
35
|
-
proof?: IProof;
|
|
36
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# Interface: ISyncChange\<T\>
|
|
2
|
-
|
|
3
|
-
The object definition for a sync change.
|
|
4
|
-
|
|
5
|
-
## Type Parameters
|
|
6
|
-
|
|
7
|
-
### T
|
|
8
|
-
|
|
9
|
-
`T` *extends* `ISynchronisedEntity` = `ISynchronisedEntity`
|
|
10
|
-
|
|
11
|
-
## Properties
|
|
12
|
-
|
|
13
|
-
### operation
|
|
14
|
-
|
|
15
|
-
> **operation**: `SyncChangeOperation`
|
|
16
|
-
|
|
17
|
-
Operation.
|
|
18
|
-
|
|
19
|
-
***
|
|
20
|
-
|
|
21
|
-
### id
|
|
22
|
-
|
|
23
|
-
> **id**: `string`
|
|
24
|
-
|
|
25
|
-
The item id.
|
|
26
|
-
|
|
27
|
-
***
|
|
28
|
-
|
|
29
|
-
### entity?
|
|
30
|
-
|
|
31
|
-
> `optional` **entity**: `T`
|
|
32
|
-
|
|
33
|
-
The entity to set.
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# Interface: ISyncChangeSet\<T\>
|
|
2
|
-
|
|
3
|
-
The object definition for a sync change set.
|
|
4
|
-
|
|
5
|
-
## Type Parameters
|
|
6
|
-
|
|
7
|
-
### T
|
|
8
|
-
|
|
9
|
-
`T` *extends* `ISynchronisedEntity` = `ISynchronisedEntity`
|
|
10
|
-
|
|
11
|
-
## Properties
|
|
12
|
-
|
|
13
|
-
### id
|
|
14
|
-
|
|
15
|
-
> **id**: `string`
|
|
16
|
-
|
|
17
|
-
The id of the snapshot.
|
|
18
|
-
|
|
19
|
-
***
|
|
20
|
-
|
|
21
|
-
### dateCreated
|
|
22
|
-
|
|
23
|
-
> **dateCreated**: `string`
|
|
24
|
-
|
|
25
|
-
The date the change set was created.
|
|
26
|
-
|
|
27
|
-
***
|
|
28
|
-
|
|
29
|
-
### storageKey
|
|
30
|
-
|
|
31
|
-
> **storageKey**: `string`
|
|
32
|
-
|
|
33
|
-
The storage key of the change set. This is used to identify the entities being synchronised.
|
|
34
|
-
|
|
35
|
-
***
|
|
36
|
-
|
|
37
|
-
### dateModified?
|
|
38
|
-
|
|
39
|
-
> `optional` **dateModified**: `string`
|
|
40
|
-
|
|
41
|
-
The date the change set was last modified.
|
|
42
|
-
|
|
43
|
-
***
|
|
44
|
-
|
|
45
|
-
### changes
|
|
46
|
-
|
|
47
|
-
> **changes**: [`ISyncChange`](ISyncChange.md)\<`T`\>[]
|
|
48
|
-
|
|
49
|
-
The changes to apply after a snapshot.
|
|
50
|
-
|
|
51
|
-
***
|
|
52
|
-
|
|
53
|
-
### nodeIdentity
|
|
54
|
-
|
|
55
|
-
> **nodeIdentity**: `string`
|
|
56
|
-
|
|
57
|
-
The identity of the node that created the change set.
|
|
58
|
-
|
|
59
|
-
***
|
|
60
|
-
|
|
61
|
-
### proof?
|
|
62
|
-
|
|
63
|
-
> `optional` **proof**: `IProof`
|
|
64
|
-
|
|
65
|
-
The proof for the change set.
|