@twin.org/synchronised-storage-service 0.0.1-next.2 → 0.0.1-next.4

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 (34) hide show
  1. package/dist/cjs/index.cjs +962 -314
  2. package/dist/esm/index.mjs +963 -316
  3. package/dist/types/entities/syncSnapshotEntry.d.ts +4 -5
  4. package/dist/types/helpers/blobStorageHelper.d.ts +33 -0
  5. package/dist/types/helpers/changeSetHelper.d.ts +20 -7
  6. package/dist/types/helpers/localSyncStateHelper.d.ts +13 -28
  7. package/dist/types/helpers/remoteSyncStateHelper.d.ts +26 -21
  8. package/dist/types/helpers/versions.d.ts +3 -0
  9. package/dist/types/index.d.ts +4 -2
  10. package/dist/types/models/ISyncPointerStore.d.ts +15 -0
  11. package/dist/types/models/ISyncSnapshot.d.ts +5 -1
  12. package/dist/types/models/ISyncState.d.ts +4 -0
  13. package/dist/types/models/ISynchronisedStorageServiceConfig.d.ts +17 -11
  14. package/dist/types/models/ISynchronisedStorageServiceConstructorOptions.d.ts +11 -2
  15. package/dist/types/synchronisedStorageRoutes.d.ts +9 -1
  16. package/dist/types/synchronisedStorageService.d.ts +13 -4
  17. package/docs/architecture.md +125 -0
  18. package/docs/changelog.md +29 -0
  19. package/docs/open-api/spec.json +244 -18
  20. package/docs/reference/classes/SyncSnapshotEntry.md +5 -5
  21. package/docs/reference/classes/SynchronisedStorageService.md +38 -5
  22. package/docs/reference/functions/synchronisedStorageGetDecryptionKeyRequest.md +31 -0
  23. package/docs/reference/index.md +4 -1
  24. package/docs/reference/interfaces/ISyncPointerStore.md +23 -0
  25. package/docs/reference/interfaces/ISyncSnapshot.md +43 -0
  26. package/docs/reference/interfaces/ISyncState.md +19 -0
  27. package/docs/reference/interfaces/ISynchronisedStorageServiceConfig.md +37 -17
  28. package/docs/reference/interfaces/ISynchronisedStorageServiceConstructorOptions.md +25 -3
  29. package/locales/en.json +62 -14
  30. package/package.json +4 -2
  31. package/dist/types/models/ISyncChange.d.ts +0 -18
  32. package/dist/types/models/ISyncChangeSet.d.ts +0 -36
  33. package/dist/types/models/ISyncPointer.d.ts +0 -9
  34. package/docs/reference/interfaces/ISyncChange.md +0 -33
package/locales/en.json CHANGED
@@ -4,31 +4,61 @@
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, invalid 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",
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}\""
10
14
  },
11
15
  "localSyncStateHelper": {
12
- "remoteSyncSynchronisation": "Syncing from remote state with \"{snapshotCount}\" snapshots",
13
- "remoteSyncSnapshotProcessing": "Processing remote sync snapshot with id \"{snapshotId}\" created on \"{dateCreated}\"",
14
- "remoteSyncSnapshotModified": "Processing modified sync snapshot with id \"{snapshotId}\", remote modified on \"{remoteModified}\", local modified on \"{localModified}\"",
15
- "remoteSyncSnapshotNew": "Processing new sync snapshot with id \"{snapshotId}\", created on \"{dateCreated}\"",
16
- "removeLocalChangeSnapshot": "Removing local change snapshot with id \"{snapshotId}\""
16
+ "getLocalChangeSnapshot": "Retrieving local change snapshot for storage key \"{storageKey}\"",
17
+ "localChangeSnapshotExists": "Found existing local change snapshot for storage key \"{storageKey}\"",
18
+ "localChangeSnapshotDoesNotExist": "No local change snapshot found for storage key \"{storageKey}\", creating new one",
19
+ "applySyncState": "Syncing from remote state with \"{snapshotCount}\" snapshots",
20
+ "applySnapshot": "Processing sync snapshot with id \"{snapshotId}\" created on \"{dateCreated}\"",
21
+ "processModifiedSnapshot": "Processing modified sync snapshot with id \"{snapshotId}\", remote modified on \"{remoteModified}\", local modified on \"{localModified}\"",
22
+ "processNewSnapshot": "Processing new sync snapshot with id \"{snapshotId}\", created on \"{dateCreated}\"",
23
+ "removeLocalChangeSnapshot": "Removing local change snapshot with id \"{snapshotId}\"",
24
+ "addLocalChange": "Adding local change with id \"{id}\" to local change snapshot for storage key \"{storageKey}\", operation \"{operation}\"",
25
+ "setLocalChangeSnapshot": "Storing local change snapshot for storage key \"{storageKey}\""
17
26
  },
18
27
  "remoteSyncStateHelper": {
19
- "verifiableSyncPointerRetrieving": "Retrieving verifiable sync pointer for key \"{key}\"",
20
- "verifiableSyncPointerNotFound": "No verifiable sync pointer found for key \"{key}\"",
21
- "verifiableSyncPointerRetrieved": "Retrieved verifiable sync pointer for key \"{key}\" with value \"{syncPointerId}\"",
22
- "verifiableSyncPointerStoring": "Storing verifiable sync pointer for key \"{key}\" with value \"{syncPointerId}\"",
28
+ "verifiableSyncPointerStoreRetrieving": "Retrieving verifiable sync pointer for key \"{key}\"",
29
+ "verifiableSyncPointerStoreNotFound": "No verifiable sync pointer store found for key \"{key}\"",
30
+ "verifiableSyncPointerStoreRetrieved": "Retrieved verifiable sync pointer for key \"{key}\"",
31
+ "verifiableSyncPointerStoreStoring": "Storing verifiable sync pointer store for key \"{key}\"",
23
32
  "remoteSyncStateStoring": "Storing remote sync state entry with \"{snapshotCount}\" snapshots",
24
33
  "remoteSyncStateRetrieving": "Retrieving remote sync state entry for syncPointerId \"{syncPointerId}\"",
25
34
  "remoteSyncStateRetrieved": "Retrieving remote sync state entry for syncPointerId \"{syncPointerId}\" with \"{snapshotCount}\" snapshots",
26
35
  "remoteSyncStateNotFound": "No remote sync state entry found for syncPointerId \"{syncPointerId}\"",
27
36
  "consolidationStarting": "Starting consolidation of remote sync state",
28
- "consolidationCompleted": "Consolidation of remote sync state completed"
37
+ "consolidationCompleted": "Consolidation of remote sync state completed",
38
+ "addChangeSetToSyncState": "Adding change set with id \"{changeSetStorageId}\" to remote sync state for storage key \"{storageKey}\"",
39
+ "buildingChangeSet": "Building change set for storage key \"{storageKey}\" with \"{changeCount}\" changes",
40
+ "finalisingSyncChanges": "Finalising sync changes for storage key \"{storageKey}\""
29
41
  },
30
42
  "synchronisedStorageService": {
31
- "registerType": "Registering synchronised storage type \"{schemaType}\""
43
+ "registerStorageKey": "Registering synchronised storage key \"{storageKey}\"",
44
+ "activateStorageKey": "Activating synchronised storage key \"{storageKey}\"",
45
+ "startEntitySync": "Starting synchronised entity storage for key \"{storageKey}\"",
46
+ "updateFromRemoteSyncState": "Updating synchronised entity storage from remote sync state for key \"{storageKey}\"",
47
+ "updateFromLocalSyncState": "Updating synchronised entity storage from local sync state for key \"{storageKey}\"",
48
+ "updateFromLocalSyncStateNoChanges": "No changes found in local sync state for key \"{storageKey}\", skipping update",
49
+ "builtStorageChangeSet": "Built storage change set for key \"{storageKey}\" with id \"{changeSetStorageId}\"",
50
+ "builtStorageChangeSetNone": "No changes found for key \"{storageKey}\", no storage change set created",
51
+ "createChangeSetRequestingItem": "Creating change set for key \"{storageKey}\", requesting item with id \"{id}\"",
52
+ "createChangeSetRespondingItem": "Responding to change set request for key \"{storageKey}\", item with id \"{id}\"",
53
+ "sendingChangeSetToTrustedNode": "Sending change set with id \"{changeSetStorageId}\" to trusted node for key \"{storageKey}\"",
54
+ "syncChangeSetForRemoteNode": "Synchronising change set with id \"{changeSetStorageId}\" for remote node for type \"{storageKey}\""
55
+ },
56
+ "blobStorageHelper": {
57
+ "loadBlob": "Loading blob with id \"{blobId}\"",
58
+ "loadedBlob": "Loaded blob with id \"{blobId}\"",
59
+ "loadBlobEmpty": "No blob found with id \"{blobId}\"",
60
+ "saveBlob": "Saving blob",
61
+ "savedBlob": "Saved blob with id \"{blobId}\""
32
62
  }
33
63
  },
34
64
  "error": {
@@ -39,7 +69,25 @@
39
69
  "synchronisedStorageService": {
40
70
  "notTrustedNode": "This method can only be called on a trusted node",
41
71
  "entitySyncFailed": "Failed to sync synchronised entity storage connector",
42
- "consolidationSyncFailed": "Failed to consolidate synchronised entity storage connector"
72
+ "consolidationSyncFailed": "Failed to consolidate synchronised entity storage connector",
73
+ "invalidProof": "Invalid proof provided for synchronised entity storage connector",
74
+ "decryptionKeyNotFound": "Decryption key not found, ensure the synchronised storage component is initialised and the decryption key is set"
75
+ },
76
+ "remoteSyncStateHelper": {
77
+ "finalisingSyncChangesFailed": "Failed to finalise sync changes for storage key \"{storageKey}\""
78
+ },
79
+ "blobStorageHelper": {
80
+ "loadBlobFailed": "Failed to load blob with id \"{blobId}\"",
81
+ "saveBlobFailed": "Failed to save blob",
82
+ "notTrustedNode": "Cannot save blob, this is not a trusted node"
83
+ }
84
+ },
85
+ "warn": {
86
+ "changeSetHelper": {
87
+ "getChangeSetError": "Failed to retrieve change set with id \"{changeSetStorageId}\""
88
+ },
89
+ "remoteSyncStateHelper": {
90
+ "getSyncStateError": "Failed to retrieve sync state for syncPointerId \"{syncPointerId}\""
43
91
  }
44
92
  }
45
93
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/synchronised-storage-service",
3
- "version": "0.0.1-next.2",
3
+ "version": "0.0.1-next.4",
4
4
  "description": "Synchronised storage contract implementation and REST endpoint definitions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,8 +15,10 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@twin.org/api-models": "next",
18
+ "@twin.org/background-task-models": "next",
18
19
  "@twin.org/blob-storage-models": "next",
19
20
  "@twin.org/core": "next",
21
+ "@twin.org/crypto": "next",
20
22
  "@twin.org/entity": "next",
21
23
  "@twin.org/entity-storage-models": "next",
22
24
  "@twin.org/event-bus-models": "next",
@@ -24,7 +26,7 @@
24
26
  "@twin.org/logging-models": "next",
25
27
  "@twin.org/nameof": "next",
26
28
  "@twin.org/standards-w3c-did": "next",
27
- "@twin.org/synchronised-storage-models": "0.0.1-next.2",
29
+ "@twin.org/synchronised-storage-models": "0.0.1-next.4",
28
30
  "@twin.org/verifiable-storage-models": "next",
29
31
  "@twin.org/web": "next"
30
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 schema type of the change set. This is used to identify the type of entity being synchronised.
18
- */
19
- schemaType: 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,9 +0,0 @@
1
- /**
2
- * The object definition for the sync pointer.
3
- */
4
- export interface ISyncPointer {
5
- /**
6
- * The pointer to where the sync data resides.
7
- */
8
- syncPointerId: string;
9
- }
@@ -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.