@twin.org/synchronised-storage-models 0.0.1-next.8 → 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 (102) hide show
  1. package/dist/es/index.js +27 -0
  2. package/dist/es/index.js.map +1 -0
  3. package/dist/es/models/ISyncChange.js +2 -0
  4. package/dist/es/models/ISyncChange.js.map +1 -0
  5. package/dist/es/models/ISyncChangeSet.js +2 -0
  6. package/dist/es/models/ISyncChangeSet.js.map +1 -0
  7. package/dist/es/models/ISyncRequest.js +2 -0
  8. package/dist/es/models/ISyncRequest.js.map +1 -0
  9. package/dist/es/models/ISynchronisedEntity.js +2 -0
  10. package/dist/es/models/ISynchronisedEntity.js.map +1 -0
  11. package/dist/es/models/ISynchronisedEntityCore.js +4 -0
  12. package/dist/es/models/ISynchronisedEntityCore.js.map +1 -0
  13. package/dist/es/models/ISynchronisedStorageComponent.js +2 -0
  14. package/dist/es/models/ISynchronisedStorageComponent.js.map +1 -0
  15. package/dist/es/models/api/ISyncChangeSetRequest.js +2 -0
  16. package/dist/es/models/api/ISyncChangeSetRequest.js.map +1 -0
  17. package/dist/es/models/api/ISyncDecryptionKeyRequest.js +2 -0
  18. package/dist/es/models/api/ISyncDecryptionKeyRequest.js.map +1 -0
  19. package/dist/es/models/api/ISyncDecryptionKeyResponse.js +4 -0
  20. package/dist/es/models/api/ISyncDecryptionKeyResponse.js.map +1 -0
  21. package/dist/es/models/eventBus/ISyncBatchRequest.js +2 -0
  22. package/dist/es/models/eventBus/ISyncBatchRequest.js.map +1 -0
  23. package/dist/es/models/eventBus/ISyncBatchResponse.js +2 -0
  24. package/dist/es/models/eventBus/ISyncBatchResponse.js.map +1 -0
  25. package/dist/es/models/eventBus/ISyncItemChange.js +2 -0
  26. package/dist/es/models/eventBus/ISyncItemChange.js.map +1 -0
  27. package/dist/es/models/eventBus/ISyncItemRemove.js +4 -0
  28. package/dist/es/models/eventBus/ISyncItemRemove.js.map +1 -0
  29. package/dist/es/models/eventBus/ISyncItemRequest.js +4 -0
  30. package/dist/es/models/eventBus/ISyncItemRequest.js.map +1 -0
  31. package/dist/es/models/eventBus/ISyncItemResponse.js +2 -0
  32. package/dist/es/models/eventBus/ISyncItemResponse.js.map +1 -0
  33. package/dist/es/models/eventBus/ISyncItemSet.js +2 -0
  34. package/dist/es/models/eventBus/ISyncItemSet.js.map +1 -0
  35. package/dist/es/models/eventBus/ISyncRegisterStorageKey.js +4 -0
  36. package/dist/es/models/eventBus/ISyncRegisterStorageKey.js.map +1 -0
  37. package/dist/es/models/eventBus/ISyncReset.js +2 -0
  38. package/dist/es/models/eventBus/ISyncReset.js.map +1 -0
  39. package/dist/es/models/syncChangeOperation.js +17 -0
  40. package/dist/es/models/syncChangeOperation.js.map +1 -0
  41. package/dist/es/models/syncNodeIdMode.js +21 -0
  42. package/dist/es/models/syncNodeIdMode.js.map +1 -0
  43. package/dist/es/models/synchronisedStorageAssetTypes.js +26 -0
  44. package/dist/es/models/synchronisedStorageAssetTypes.js.map +1 -0
  45. package/dist/es/models/synchronisedStorageContexts.js +13 -0
  46. package/dist/es/models/synchronisedStorageContexts.js.map +1 -0
  47. package/dist/{esm/index.mjs → es/models/synchronisedStorageTopics.js} +2 -41
  48. package/dist/es/models/synchronisedStorageTopics.js.map +1 -0
  49. package/dist/es/models/synchronisedStorageTypes.js +17 -0
  50. package/dist/es/models/synchronisedStorageTypes.js.map +1 -0
  51. package/dist/types/index.d.ts +24 -19
  52. package/dist/types/models/ISyncChange.d.ts +4 -4
  53. package/dist/types/models/ISyncChangeSet.d.ts +19 -15
  54. package/dist/types/models/ISyncRequest.d.ts +19 -0
  55. package/dist/types/models/ISynchronisedEntity.d.ts +3 -6
  56. package/dist/types/models/ISynchronisedEntityCore.d.ts +9 -0
  57. package/dist/types/models/ISynchronisedStorageComponent.d.ts +6 -6
  58. package/dist/types/models/api/ISyncChangeSetRequest.d.ts +9 -1
  59. package/dist/types/models/api/ISyncDecryptionKeyRequest.d.ts +5 -11
  60. package/dist/types/models/eventBus/ISyncBatchRequest.d.ts +3 -3
  61. package/dist/types/models/eventBus/ISyncBatchResponse.d.ts +3 -3
  62. package/dist/types/models/eventBus/ISyncItemChange.d.ts +2 -2
  63. package/dist/types/models/eventBus/ISyncItemRemove.d.ts +1 -1
  64. package/dist/types/models/eventBus/ISyncItemResponse.d.ts +3 -3
  65. package/dist/types/models/eventBus/ISyncItemSet.d.ts +3 -3
  66. package/dist/types/models/eventBus/ISyncReset.d.ts +3 -3
  67. package/dist/types/models/{syncNodeIdentityMode.d.ts → syncNodeIdMode.d.ts} +2 -2
  68. package/dist/types/models/synchronisedStorageAssetTypes.d.ts +25 -0
  69. package/dist/types/models/synchronisedStorageContexts.d.ts +13 -0
  70. package/dist/types/models/synchronisedStorageTypes.d.ts +17 -0
  71. package/docs/changelog.md +80 -0
  72. package/docs/reference/index.md +10 -2
  73. package/docs/reference/interfaces/ISyncBatchRequest.md +2 -2
  74. package/docs/reference/interfaces/ISyncBatchResponse.md +2 -8
  75. package/docs/reference/interfaces/ISyncChange.md +2 -8
  76. package/docs/reference/interfaces/ISyncChangeSet.md +24 -22
  77. package/docs/reference/interfaces/ISyncChangeSetRequest.md +16 -0
  78. package/docs/reference/interfaces/ISyncDecryptionKeyRequest.md +7 -11
  79. package/docs/reference/interfaces/ISyncItemChange.md +2 -2
  80. package/docs/reference/interfaces/ISyncItemRemove.md +2 -2
  81. package/docs/reference/interfaces/ISyncItemResponse.md +2 -8
  82. package/docs/reference/interfaces/ISyncItemSet.md +2 -8
  83. package/docs/reference/interfaces/ISyncRequest.md +27 -0
  84. package/docs/reference/interfaces/ISyncReset.md +2 -2
  85. package/docs/reference/interfaces/ISynchronisedEntity.md +14 -6
  86. package/docs/reference/interfaces/ISynchronisedEntityCore.md +15 -0
  87. package/docs/reference/interfaces/ISynchronisedStorageComponent.md +11 -11
  88. package/docs/reference/type-aliases/SyncNodeIdMode.md +5 -0
  89. package/docs/reference/type-aliases/SynchronisedStorageAssetTypes.md +5 -0
  90. package/docs/reference/type-aliases/SynchronisedStorageContexts.md +5 -0
  91. package/docs/reference/type-aliases/SynchronisedStorageTypes.md +5 -0
  92. package/docs/reference/variables/SyncChangeOperation.md +1 -1
  93. package/docs/reference/variables/{SyncNodeIdentityMode.md → SyncNodeIdMode.md} +3 -3
  94. package/docs/reference/variables/SynchronisedStorageAssetTypes.md +31 -0
  95. package/docs/reference/variables/SynchronisedStorageContexts.md +13 -0
  96. package/docs/reference/variables/SynchronisedStorageTopics.md +1 -1
  97. package/docs/reference/variables/SynchronisedStorageTypes.md +19 -0
  98. package/locales/en.json +1 -3
  99. package/package.json +25 -9
  100. package/dist/cjs/index.cjs +0 -88
  101. package/docs/reference/type-aliases/SyncNodeIdentityMode.md +0 -5
  102. /package/dist/types/models/{eventBus/syncChangeOperation.d.ts → syncChangeOperation.d.ts} +0 -0
@@ -2,6 +2,10 @@
2
2
 
3
3
  The base definition for synchronised entries.
4
4
 
5
+ ## Extends
6
+
7
+ - [`ISynchronisedEntityCore`](ISynchronisedEntityCore.md)
8
+
5
9
  ## Properties
6
10
 
7
11
  ### id
@@ -12,16 +16,20 @@ The id of the entry.
12
16
 
13
17
  ***
14
18
 
15
- ### dateModified
19
+ ### nodeId?
16
20
 
17
- > **dateModified**: `string`
21
+ > `optional` **nodeId**: `string`
18
22
 
19
- The date the entry was modified
23
+ The identity of the node that owns the entry.
20
24
 
21
25
  ***
22
26
 
23
- ### nodeIdentity
27
+ ### dateModified
24
28
 
25
- > **nodeIdentity**: `string`
29
+ > **dateModified**: `string`
26
30
 
27
- The identity of the node that owns the entry.
31
+ The date the entry was modified.
32
+
33
+ #### Inherited from
34
+
35
+ [`ISynchronisedEntityCore`](ISynchronisedEntityCore.md).[`dateModified`](ISynchronisedEntityCore.md#datemodified)
@@ -0,0 +1,15 @@
1
+ # Interface: ISynchronisedEntityCore
2
+
3
+ The base definition for synchronised entries.
4
+
5
+ ## Extended by
6
+
7
+ - [`ISynchronisedEntity`](ISynchronisedEntity.md)
8
+
9
+ ## Properties
10
+
11
+ ### dateModified
12
+
13
+ > **dateModified**: `string`
14
+
15
+ The date the entry was modified.
@@ -10,24 +10,18 @@ Class for performing synchronised storage operations.
10
10
 
11
11
  ### getDecryptionKey()
12
12
 
13
- > **getDecryptionKey**(`nodeIdentity`, `proof`): `Promise`\<`string`\>
13
+ > **getDecryptionKey**(`actionRequest`): `Promise`\<`string`\>
14
14
 
15
15
  Get the decryption key for the synchronised storage.
16
16
  This is used to decrypt the data stored in the synchronised storage.
17
17
 
18
18
  #### Parameters
19
19
 
20
- ##### nodeIdentity
20
+ ##### actionRequest
21
21
 
22
- `string`
22
+ `IIdentityAuthenticationActionRequest`
23
23
 
24
- The identity of the node requesting the decryption key.
25
-
26
- ##### proof
27
-
28
- `IProof`
29
-
30
- The proof of the request so we know the request is from the specified node.
24
+ The action request used in the verifiable credential.
31
25
 
32
26
  #### Returns
33
27
 
@@ -39,7 +33,7 @@ The decryption key.
39
33
 
40
34
  ### syncChangeSet()
41
35
 
42
- > **syncChangeSet**(`syncChangeSet`): `Promise`\<`void`\>
36
+ > **syncChangeSet**(`syncChangeSet`, `actionRequest`): `Promise`\<`void`\>
43
37
 
44
38
  Synchronise a set of changes from an untrusted node, assumes this is a trusted node.
45
39
 
@@ -51,6 +45,12 @@ Synchronise a set of changes from an untrusted node, assumes this is a trusted n
51
45
 
52
46
  The change set to synchronise.
53
47
 
48
+ ##### actionRequest
49
+
50
+ `IIdentityAuthenticationActionRequest`
51
+
52
+ The action request used in the verifiable credential.
53
+
54
54
  #### Returns
55
55
 
56
56
  `Promise`\<`void`\>
@@ -0,0 +1,5 @@
1
+ # Type Alias: SyncNodeIdMode
2
+
3
+ > **SyncNodeIdMode** = *typeof* [`SyncNodeIdMode`](../variables/SyncNodeIdMode.md)\[keyof *typeof* [`SyncNodeIdMode`](../variables/SyncNodeIdMode.md)\]
4
+
5
+ The mode to determine how node identities are matched.
@@ -0,0 +1,5 @@
1
+ # Type Alias: SynchronisedStorageAssetTypes
2
+
3
+ > **SynchronisedStorageAssetTypes** = *typeof* [`SynchronisedStorageAssetTypes`](../variables/SynchronisedStorageAssetTypes.md)\[keyof *typeof* [`SynchronisedStorageAssetTypes`](../variables/SynchronisedStorageAssetTypes.md)\]
4
+
5
+ The ODRL asset types for SynchronisedStorage.
@@ -0,0 +1,5 @@
1
+ # Type Alias: SynchronisedStorageContexts
2
+
3
+ > **SynchronisedStorageContexts** = *typeof* [`SynchronisedStorageContexts`](../variables/SynchronisedStorageContexts.md)\[keyof *typeof* [`SynchronisedStorageContexts`](../variables/SynchronisedStorageContexts.md)\]
4
+
5
+ The LD Contexts concerning SynchronisedStorage.
@@ -0,0 +1,5 @@
1
+ # Type Alias: SynchronisedStorageTypes
2
+
3
+ > **SynchronisedStorageTypes** = *typeof* [`SynchronisedStorageTypes`](../variables/SynchronisedStorageTypes.md)\[keyof *typeof* [`SynchronisedStorageTypes`](../variables/SynchronisedStorageTypes.md)\]
4
+
5
+ The types of Synchronised Storage data.
@@ -4,7 +4,7 @@
4
4
 
5
5
  The operations for a change.
6
6
 
7
- ## Type declaration
7
+ ## Type Declaration
8
8
 
9
9
  ### Set
10
10
 
@@ -1,10 +1,10 @@
1
- # Variable: SyncNodeIdentityMode
1
+ # Variable: SyncNodeIdMode
2
2
 
3
- > `const` **SyncNodeIdentityMode**: `object`
3
+ > `const` **SyncNodeIdMode**: `object`
4
4
 
5
5
  The mode to determine how node identities are matched.
6
6
 
7
- ## Type declaration
7
+ ## Type Declaration
8
8
 
9
9
  ### Local
10
10
 
@@ -0,0 +1,31 @@
1
+ # Variable: SynchronisedStorageAssetTypes
2
+
3
+ > `const` **SynchronisedStorageAssetTypes**: `object`
4
+
5
+ The ODRL asset types for SynchronisedStorage.
6
+
7
+ ## Type Declaration
8
+
9
+ ### DecryptionKey
10
+
11
+ > `readonly` **DecryptionKey**: `"decryption-key"` = `"decryption-key"`
12
+
13
+ Decryption Key.
14
+
15
+ ### DecryptionKeyActions
16
+
17
+ > `readonly` **DecryptionKeyActions**: readonly \[`"read"`\]
18
+
19
+ Decryption Key Actions.
20
+
21
+ ### ChangeSet
22
+
23
+ > `readonly` **ChangeSet**: `"change-set"` = `"change-set"`
24
+
25
+ Change Set.
26
+
27
+ ### ChangeSetActions
28
+
29
+ > `readonly` **ChangeSetActions**: readonly \[`"write"`\]
30
+
31
+ Change Set Actions.
@@ -0,0 +1,13 @@
1
+ # Variable: SynchronisedStorageContexts
2
+
3
+ > `const` **SynchronisedStorageContexts**: `object`
4
+
5
+ The LD Contexts concerning SynchronisedStorage.
6
+
7
+ ## Type Declaration
8
+
9
+ ### ContextRoot
10
+
11
+ > `readonly` **ContextRoot**: `"https://schema.twindev.org/synchronised-storage"` = `"https://schema.twindev.org/synchronised-storage"`
12
+
13
+ The SynchronisedStorage LD Context.
@@ -4,7 +4,7 @@
4
4
 
5
5
  The topics for synchronised storage event bus notifications.
6
6
 
7
- ## Type declaration
7
+ ## Type Declaration
8
8
 
9
9
  ### RegisterStorageKey
10
10
 
@@ -0,0 +1,19 @@
1
+ # Variable: SynchronisedStorageTypes
2
+
3
+ > `const` **SynchronisedStorageTypes**: `object`
4
+
5
+ The types of Synchronised Storage data.
6
+
7
+ ## Type Declaration
8
+
9
+ ### SyncRequest
10
+
11
+ > `readonly` **SyncRequest**: `"SyncRequest"` = `"SyncRequest"`
12
+
13
+ Represents a synchronised storage request.
14
+
15
+ ### ChangeSet
16
+
17
+ > `readonly` **ChangeSet**: `"ChangeSet"` = `"ChangeSet"`
18
+
19
+ Represents a synchronised storage change set.
package/locales/en.json CHANGED
@@ -1,3 +1 @@
1
- {
2
- "error": {}
3
- }
1
+ {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/synchronised-storage-models",
3
- "version": "0.0.1-next.8",
3
+ "version": "0.0.3-next.1",
4
4
  "description": "Models which define the structure of the synchronised storage connectors and services",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,25 +16,41 @@
16
16
  "dependencies": {
17
17
  "@twin.org/core": "next",
18
18
  "@twin.org/entity": "next",
19
+ "@twin.org/identity-authentication": "next",
20
+ "@twin.org/identity-models": "next",
19
21
  "@twin.org/nameof": "next",
20
- "@twin.org/standards-w3c-did": "next"
22
+ "@twin.org/standards-w3c-did": "next",
23
+ "@twin.org/standards-w3c-odrl": "next"
21
24
  },
22
- "main": "./dist/cjs/index.cjs",
23
- "module": "./dist/esm/index.mjs",
25
+ "main": "./dist/es/index.js",
24
26
  "types": "./dist/types/index.d.ts",
25
27
  "exports": {
26
28
  ".": {
27
29
  "types": "./dist/types/index.d.ts",
28
- "require": "./dist/cjs/index.cjs",
29
- "import": "./dist/esm/index.mjs"
30
+ "import": "./dist/es/index.js",
31
+ "default": "./dist/es/index.js"
30
32
  },
31
33
  "./locales/*.json": "./locales/*.json"
32
34
  },
33
35
  "files": [
34
- "dist/cjs",
35
- "dist/esm",
36
+ "dist/es",
36
37
  "dist/types",
37
38
  "locales",
38
39
  "docs"
39
- ]
40
+ ],
41
+ "keywords": [
42
+ "twin",
43
+ "trade",
44
+ "iota",
45
+ "framework",
46
+ "blockchain",
47
+ "synchronised-storage",
48
+ "models",
49
+ "types",
50
+ "schemas"
51
+ ],
52
+ "bugs": {
53
+ "url": "git+https://github.com/twinfoundation/synchronised-storage/issues"
54
+ },
55
+ "homepage": "https://twindev.org"
40
56
  }
@@ -1,88 +0,0 @@
1
- 'use strict';
2
-
3
- // Copyright 2024 IOTA Stiftung.
4
- // SPDX-License-Identifier: Apache-2.0.
5
- /**
6
- * The operations for a change.
7
- */
8
- // eslint-disable-next-line @typescript-eslint/naming-convention
9
- const SyncChangeOperation = {
10
- /**
11
- * An item was set in the storage.
12
- */
13
- Set: "set",
14
- /**
15
- * An item was deleted from the storage.
16
- */
17
- Delete: "delete"
18
- };
19
-
20
- // Copyright 2024 IOTA Stiftung.
21
- // SPDX-License-Identifier: Apache-2.0.
22
- /**
23
- * The topics for synchronised storage event bus notifications.
24
- */
25
- // eslint-disable-next-line @typescript-eslint/naming-convention
26
- const SynchronisedStorageTopics = {
27
- /**
28
- * Register a storage key for the synchronised storage.
29
- */
30
- RegisterStorageKey: "synchronised-storage:register-storage-key",
31
- /**
32
- * An item was changed in the storage by the local node.
33
- */
34
- LocalItemChange: "synchronised-storage:local-item-change",
35
- /**
36
- * A request has been made for a local item.
37
- */
38
- LocalItemRequest: "synchronised-storage:local-item-request",
39
- /**
40
- * A response to a local item request.
41
- */
42
- LocalItemResponse: "synchronised-storage:local-item-response",
43
- /**
44
- * Reset the storage.
45
- */
46
- Reset: "synchronised-storage:reset",
47
- /**
48
- * A request has been made for a batch.
49
- */
50
- BatchRequest: "synchronised-storage:batch-request",
51
- /**
52
- * A response to a batch.
53
- */
54
- BatchResponse: "synchronised-storage:batch-response",
55
- /**
56
- * An item was set in the storage by the remote node.
57
- */
58
- RemoteItemSet: "synchronised-storage:remote-item-set",
59
- /**
60
- * An item was removed from the storage by the remote node.
61
- */
62
- RemoteItemRemove: "synchronised-storage:remote-item-remove"
63
- };
64
-
65
- // Copyright 2024 IOTA Stiftung.
66
- // SPDX-License-Identifier: Apache-2.0.
67
- /**
68
- * The mode to determine how node identities are matched.
69
- */
70
- // eslint-disable-next-line @typescript-eslint/naming-convention
71
- const SyncNodeIdentityMode = {
72
- /**
73
- * Match the local node identity.
74
- */
75
- Local: "local",
76
- /**
77
- * Match all but the local node identity.
78
- */
79
- Remote: "remote",
80
- /**
81
- * All match both local and remote entities.
82
- */
83
- All: "all"
84
- };
85
-
86
- exports.SyncChangeOperation = SyncChangeOperation;
87
- exports.SyncNodeIdentityMode = SyncNodeIdentityMode;
88
- exports.SynchronisedStorageTopics = SynchronisedStorageTopics;
@@ -1,5 +0,0 @@
1
- # Type Alias: SyncNodeIdentityMode
2
-
3
- > **SyncNodeIdentityMode** = *typeof* [`SyncNodeIdentityMode`](../variables/SyncNodeIdentityMode.md)\[keyof *typeof* [`SyncNodeIdentityMode`](../variables/SyncNodeIdentityMode.md)\]
4
-
5
- The mode to determine how node identities are matched.