@twin.org/synchronised-storage-models 0.0.1-next.4 → 0.0.1-next.6

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.
@@ -40,6 +40,10 @@ const SynchronisedStorageTopics = {
40
40
  * A response to a local item request.
41
41
  */
42
42
  LocalItemResponse: "synchronised-storage:local-item-response",
43
+ /**
44
+ * Reset the storage.
45
+ */
46
+ Reset: "synchronised-storage:reset",
43
47
  /**
44
48
  * A request has been made for a batch.
45
49
  */
@@ -58,5 +62,27 @@ const SynchronisedStorageTopics = {
58
62
  RemoteItemRemove: "synchronised-storage:remote-item-remove"
59
63
  };
60
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
+
61
86
  exports.SyncChangeOperation = SyncChangeOperation;
87
+ exports.SyncNodeIdentityMode = SyncNodeIdentityMode;
62
88
  exports.SynchronisedStorageTopics = SynchronisedStorageTopics;
@@ -38,6 +38,10 @@ const SynchronisedStorageTopics = {
38
38
  * A response to a local item request.
39
39
  */
40
40
  LocalItemResponse: "synchronised-storage:local-item-response",
41
+ /**
42
+ * Reset the storage.
43
+ */
44
+ Reset: "synchronised-storage:reset",
41
45
  /**
42
46
  * A request has been made for a batch.
43
47
  */
@@ -56,4 +60,25 @@ const SynchronisedStorageTopics = {
56
60
  RemoteItemRemove: "synchronised-storage:remote-item-remove"
57
61
  };
58
62
 
59
- export { SyncChangeOperation, SynchronisedStorageTopics };
63
+ // Copyright 2024 IOTA Stiftung.
64
+ // SPDX-License-Identifier: Apache-2.0.
65
+ /**
66
+ * The mode to determine how node identities are matched.
67
+ */
68
+ // eslint-disable-next-line @typescript-eslint/naming-convention
69
+ const SyncNodeIdentityMode = {
70
+ /**
71
+ * Match the local node identity.
72
+ */
73
+ Local: "local",
74
+ /**
75
+ * Match all but the local node identity.
76
+ */
77
+ Remote: "remote",
78
+ /**
79
+ * All match both local and remote entities.
80
+ */
81
+ All: "all"
82
+ };
83
+
84
+ export { SyncChangeOperation, SyncNodeIdentityMode, SynchronisedStorageTopics };
@@ -9,9 +9,11 @@ export * from "./models/eventBus/ISyncItemRequest";
9
9
  export * from "./models/eventBus/ISyncItemResponse";
10
10
  export * from "./models/eventBus/ISyncItemSet";
11
11
  export * from "./models/eventBus/ISyncRegisterStorageKey";
12
+ export * from "./models/eventBus/ISyncReset";
12
13
  export * from "./models/eventBus/syncChangeOperation";
13
14
  export * from "./models/ISyncChange";
14
15
  export * from "./models/ISyncChangeSet";
15
16
  export * from "./models/ISynchronisedEntity";
16
17
  export * from "./models/ISynchronisedStorageComponent";
17
18
  export * from "./models/synchronisedStorageTopics";
19
+ export * from "./models/syncNodeIdentityMode";
@@ -20,7 +20,7 @@ export interface ISyncChangeSet<T extends ISynchronisedEntity = ISynchronisedEnt
20
20
  /**
21
21
  * The date the change set was last modified.
22
22
  */
23
- dateModified?: string;
23
+ dateModified: string;
24
24
  /**
25
25
  * The changes to apply after a snapshot.
26
26
  */
@@ -1,3 +1,4 @@
1
+ import type { SyncNodeIdentityMode } from "../syncNodeIdentityMode";
1
2
  /**
2
3
  * Request for a local batch.
3
4
  */
@@ -10,4 +11,8 @@ export interface ISyncBatchRequest {
10
11
  * The size of the batch.
11
12
  */
12
13
  batchSize: number;
14
+ /**
15
+ * Determines which entries are required, for local it will match the nodeIdentity, for remote it will not include matching nodeIdentity, for all it will include all entries.
16
+ */
17
+ requestMode: SyncNodeIdentityMode;
13
18
  }
@@ -11,6 +11,10 @@ export interface ISyncItemChange {
11
11
  * The operation being performed on the item.
12
12
  */
13
13
  operation: SyncChangeOperation;
14
+ /**
15
+ * The node performing the operation.
16
+ */
17
+ nodeIdentity: string;
14
18
  /**
15
19
  * The id of the item being changed.
16
20
  */
@@ -6,6 +6,10 @@ export interface ISyncItemRemove {
6
6
  * The key of the storage being removed.
7
7
  */
8
8
  storageKey: string;
9
+ /**
10
+ * The node identity of the entity being removed.
11
+ */
12
+ nodeIdentity: string;
9
13
  /**
10
14
  * The entity being removed from the item set.
11
15
  */
@@ -0,0 +1,14 @@
1
+ import type { SyncNodeIdentityMode } from "../syncNodeIdentityMode";
2
+ /**
3
+ * Request to reset the local storage.
4
+ */
5
+ export interface ISyncReset {
6
+ /**
7
+ * The key of the storage for the entities in the batch.
8
+ */
9
+ storageKey: string;
10
+ /**
11
+ * Reset mode, this will use the nodeIdentity in the entities to determine which are local/remote.
12
+ */
13
+ resetMode: SyncNodeIdentityMode;
14
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The mode to determine how node identities are matched.
3
+ */
4
+ export declare const SyncNodeIdentityMode: {
5
+ /**
6
+ * Match the local node identity.
7
+ */
8
+ readonly Local: "local";
9
+ /**
10
+ * Match all but the local node identity.
11
+ */
12
+ readonly Remote: "remote";
13
+ /**
14
+ * All match both local and remote entities.
15
+ */
16
+ readonly All: "all";
17
+ };
18
+ /**
19
+ * The mode to determine how node identities are matched.
20
+ */
21
+ export type SyncNodeIdentityMode = (typeof SyncNodeIdentityMode)[keyof typeof SyncNodeIdentityMode];
@@ -18,6 +18,10 @@ export declare const SynchronisedStorageTopics: {
18
18
  * A response to a local item request.
19
19
  */
20
20
  readonly LocalItemResponse: "synchronised-storage:local-item-response";
21
+ /**
22
+ * Reset the storage.
23
+ */
24
+ readonly Reset: "synchronised-storage:reset";
21
25
  /**
22
26
  * A request has been made for a batch.
23
27
  */
package/docs/changelog.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.1-next.6](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-models-v0.0.1-next.5...synchronised-storage-models-v0.0.1-next.6) (2025-08-11)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **synchronised-storage-models:** Synchronize repo versions
9
+
10
+ ## [0.0.1-next.5](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-models-v0.0.1-next.4...synchronised-storage-models-v0.0.1-next.5) (2025-08-11)
11
+
12
+
13
+ ### Features
14
+
15
+ * additional node identity checks ([76257c4](https://github.com/twinfoundation/synchronised-storage/commit/76257c4173303d484391f71f581fd0e214204029))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * missing dependency ([cf4427e](https://github.com/twinfoundation/synchronised-storage/commit/cf4427edf6668b90aae9a9c1faafff13dffc2fc7))
21
+
3
22
  ## [0.0.1-next.4](https://github.com/twinfoundation/synchronised-storage/compare/synchronised-storage-models-v0.0.1-next.3...synchronised-storage-models-v0.0.1-next.4) (2025-08-08)
4
23
 
5
24
 
@@ -17,13 +17,16 @@
17
17
  - [ISyncItemResponse](interfaces/ISyncItemResponse.md)
18
18
  - [ISyncItemSet](interfaces/ISyncItemSet.md)
19
19
  - [ISyncRegisterStorageKey](interfaces/ISyncRegisterStorageKey.md)
20
+ - [ISyncReset](interfaces/ISyncReset.md)
20
21
 
21
22
  ## Type Aliases
22
23
 
23
24
  - [SyncChangeOperation](type-aliases/SyncChangeOperation.md)
25
+ - [SyncNodeIdentityMode](type-aliases/SyncNodeIdentityMode.md)
24
26
  - [SynchronisedStorageTopics](type-aliases/SynchronisedStorageTopics.md)
25
27
 
26
28
  ## Variables
27
29
 
28
30
  - [SyncChangeOperation](variables/SyncChangeOperation.md)
31
+ - [SyncNodeIdentityMode](variables/SyncNodeIdentityMode.md)
29
32
  - [SynchronisedStorageTopics](variables/SynchronisedStorageTopics.md)
@@ -17,3 +17,11 @@ The key of the storage for the entities in the batch.
17
17
  > **batchSize**: `number`
18
18
 
19
19
  The size of the batch.
20
+
21
+ ***
22
+
23
+ ### requestMode
24
+
25
+ > **requestMode**: [`SyncNodeIdentityMode`](../type-aliases/SyncNodeIdentityMode.md)
26
+
27
+ Determines which entries are required, for local it will match the nodeIdentity, for remote it will not include matching nodeIdentity, for all it will include all entries.
@@ -34,9 +34,9 @@ The storage key of the change set. This is used to identify the entities being s
34
34
 
35
35
  ***
36
36
 
37
- ### dateModified?
37
+ ### dateModified
38
38
 
39
- > `optional` **dateModified**: `string`
39
+ > **dateModified**: `string`
40
40
 
41
41
  The date the change set was last modified.
42
42
 
@@ -20,6 +20,14 @@ The operation being performed on the item.
20
20
 
21
21
  ***
22
22
 
23
+ ### nodeIdentity
24
+
25
+ > **nodeIdentity**: `string`
26
+
27
+ The node performing the operation.
28
+
29
+ ***
30
+
23
31
  ### id
24
32
 
25
33
  > **id**: `string`
@@ -12,6 +12,14 @@ The key of the storage being removed.
12
12
 
13
13
  ***
14
14
 
15
+ ### nodeIdentity
16
+
17
+ > **nodeIdentity**: `string`
18
+
19
+ The node identity of the entity being removed.
20
+
21
+ ***
22
+
15
23
  ### id
16
24
 
17
25
  > **id**: `string`
@@ -0,0 +1,19 @@
1
+ # Interface: ISyncReset
2
+
3
+ Request to reset the local storage.
4
+
5
+ ## Properties
6
+
7
+ ### storageKey
8
+
9
+ > **storageKey**: `string`
10
+
11
+ The key of the storage for the entities in the batch.
12
+
13
+ ***
14
+
15
+ ### resetMode
16
+
17
+ > **resetMode**: [`SyncNodeIdentityMode`](../type-aliases/SyncNodeIdentityMode.md)
18
+
19
+ Reset mode, this will use the nodeIdentity in the entities to determine which are local/remote.
@@ -0,0 +1,5 @@
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.
@@ -0,0 +1,25 @@
1
+ # Variable: SyncNodeIdentityMode
2
+
3
+ > `const` **SyncNodeIdentityMode**: `object`
4
+
5
+ The mode to determine how node identities are matched.
6
+
7
+ ## Type declaration
8
+
9
+ ### Local
10
+
11
+ > `readonly` **Local**: `"local"` = `"local"`
12
+
13
+ Match the local node identity.
14
+
15
+ ### Remote
16
+
17
+ > `readonly` **Remote**: `"remote"` = `"remote"`
18
+
19
+ Match all but the local node identity.
20
+
21
+ ### All
22
+
23
+ > `readonly` **All**: `"all"` = `"all"`
24
+
25
+ All match both local and remote entities.
@@ -30,6 +30,12 @@ A request has been made for a local item.
30
30
 
31
31
  A response to a local item request.
32
32
 
33
+ ### Reset
34
+
35
+ > `readonly` **Reset**: `"synchronised-storage:reset"` = `"synchronised-storage:reset"`
36
+
37
+ Reset the storage.
38
+
33
39
  ### BatchRequest
34
40
 
35
41
  > `readonly` **BatchRequest**: `"synchronised-storage:batch-request"` = `"synchronised-storage:batch-request"`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/synchronised-storage-models",
3
- "version": "0.0.1-next.4",
3
+ "version": "0.0.1-next.6",
4
4
  "description": "Models which define the structure of the synchronised storage connectors and services",
5
5
  "repository": {
6
6
  "type": "git",