@twin.org/entity-storage-models 0.0.2-next.9 → 0.0.3-next.2
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/{esm/index.mjs → es/factories/entityStorageConnectorFactory.js} +3 -5
- package/dist/es/factories/entityStorageConnectorFactory.js.map +1 -0
- package/dist/es/index.js +12 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IEntityStorageComponent.js +2 -0
- package/dist/es/models/IEntityStorageComponent.js.map +1 -0
- package/dist/es/models/IEntityStorageConnector.js +2 -0
- package/dist/es/models/IEntityStorageConnector.js.map +1 -0
- package/dist/es/models/api/IEntityStorageGetRequest.js +4 -0
- package/dist/es/models/api/IEntityStorageGetRequest.js.map +1 -0
- package/dist/es/models/api/IEntityStorageGetResponse.js +4 -0
- package/dist/es/models/api/IEntityStorageGetResponse.js.map +1 -0
- package/dist/es/models/api/IEntityStorageListRequest.js +2 -0
- package/dist/es/models/api/IEntityStorageListRequest.js.map +1 -0
- package/dist/es/models/api/IEntityStorageListResponse.js +4 -0
- package/dist/es/models/api/IEntityStorageListResponse.js.map +1 -0
- package/dist/es/models/api/IEntityStorageRemoveRequest.js +4 -0
- package/dist/es/models/api/IEntityStorageRemoveRequest.js.map +1 -0
- package/dist/es/models/api/IEntityStorageSetRequest.js +4 -0
- package/dist/es/models/api/IEntityStorageSetRequest.js.map +1 -0
- package/dist/types/factories/entityStorageConnectorFactory.d.ts +1 -1
- package/dist/types/index.d.ts +9 -9
- package/dist/types/models/IEntityStorageComponent.d.ts +6 -10
- package/dist/types/models/IEntityStorageConnector.d.ts +3 -3
- package/dist/types/models/api/IEntityStorageListRequest.d.ts +2 -2
- package/docs/changelog.md +33 -0
- package/docs/reference/interfaces/IEntityStorageComponent.md +7 -31
- package/docs/reference/interfaces/IEntityStorageConnector.md +5 -5
- package/docs/reference/interfaces/IEntityStorageListRequest.md +3 -3
- package/package.json +10 -8
- package/dist/cjs/index.cjs +0 -13
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { Factory } from '@twin.org/core';
|
|
2
|
-
|
|
3
1
|
// Copyright 2024 IOTA Stiftung.
|
|
4
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { Factory } from "@twin.org/core";
|
|
5
4
|
/**
|
|
6
5
|
* Factory for creating entity storage connectors.
|
|
7
6
|
*/
|
|
8
7
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
9
|
-
const EntityStorageConnectorFactory = Factory.createFactory("entity-storage");
|
|
10
|
-
|
|
11
|
-
export { EntityStorageConnectorFactory };
|
|
8
|
+
export const EntityStorageConnectorFactory = Factory.createFactory("entity-storage");
|
|
9
|
+
//# sourceMappingURL=entityStorageConnectorFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entityStorageConnectorFactory.js","sourceRoot":"","sources":["../../../src/factories/entityStorageConnectorFactory.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,6BAA6B,GACzC,OAAO,CAAC,aAAa,CAA0B,gBAAgB,CAAC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Factory } from \"@twin.org/core\";\nimport type { IEntityStorageConnector } from \"../models/IEntityStorageConnector.js\";\n\n/**\n * Factory for creating entity storage connectors.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const EntityStorageConnectorFactory =\n\tFactory.createFactory<IEntityStorageConnector>(\"entity-storage\");\n"]}
|
package/dist/es/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
export * from "./factories/entityStorageConnectorFactory.js";
|
|
4
|
+
export * from "./models/api/IEntityStorageGetRequest.js";
|
|
5
|
+
export * from "./models/api/IEntityStorageGetResponse.js";
|
|
6
|
+
export * from "./models/api/IEntityStorageListRequest.js";
|
|
7
|
+
export * from "./models/api/IEntityStorageListResponse.js";
|
|
8
|
+
export * from "./models/api/IEntityStorageRemoveRequest.js";
|
|
9
|
+
export * from "./models/api/IEntityStorageSetRequest.js";
|
|
10
|
+
export * from "./models/IEntityStorageComponent.js";
|
|
11
|
+
export * from "./models/IEntityStorageConnector.js";
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0CAA0C,CAAC;AACzD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./factories/entityStorageConnectorFactory.js\";\nexport * from \"./models/api/IEntityStorageGetRequest.js\";\nexport * from \"./models/api/IEntityStorageGetResponse.js\";\nexport * from \"./models/api/IEntityStorageListRequest.js\";\nexport * from \"./models/api/IEntityStorageListResponse.js\";\nexport * from \"./models/api/IEntityStorageRemoveRequest.js\";\nexport * from \"./models/api/IEntityStorageSetRequest.js\";\nexport * from \"./models/IEntityStorageComponent.js\";\nexport * from \"./models/IEntityStorageConnector.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEntityStorageComponent.js","sourceRoot":"","sources":["../../../src/models/IEntityStorageComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { EntityCondition, SortDirection } from \"@twin.org/entity\";\n\n/**\n * Interface describing an entity storage component.\n */\nexport interface IEntityStorageComponent<T = unknown> extends IComponent {\n\t/**\n\t * Set an entity.\n\t * @param entity The entity to set.\n\t * @returns The id of the entity.\n\t */\n\tset(entity: T): Promise<void>;\n\n\t/**\n\t * Get an entity.\n\t * @param id The id of the entity to get, or the index value if secondaryIndex is set.\n\t * @param secondaryIndex Get the item using a secondary index.\n\t * @returns The object if it can be found or undefined.\n\t */\n\tget(id: string, secondaryIndex?: keyof T): Promise<T | undefined>;\n\n\t/**\n\t * Remove the entity.\n\t * @param id The id of the entity to remove.\n\t * @returns Nothing.\n\t */\n\tremove(id: string): Promise<void>;\n\n\t/**\n\t * Query all the entities which match the conditions.\n\t * @param conditions The conditions to match for the entities.\n\t * @param orderBy The order for the results.\n\t * @param orderByDirection The direction for the order, defaults to ascending.\n\t * @param properties The optional properties to return, defaults to all.\n\t * @param cursor The cursor to request the next chunk of entities.\n\t * @param limit The suggested number of entities to return in each chunk, in some scenarios can return a different amount.\n\t * @returns All the entities for the storage matching the conditions,\n\t * and a cursor which can be used to request more entities.\n\t */\n\tquery(\n\t\tconditions?: EntityCondition<T>,\n\t\torderBy?: keyof T,\n\t\torderByDirection?: SortDirection,\n\t\tproperties?: (keyof T)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\t/**\n\t\t * The entities, which can be partial if a limited keys list was provided.\n\t\t */\n\t\tentities: Partial<T>[];\n\t\t/**\n\t\t * An optional cursor, when defined can be used to call find to get more entities.\n\t\t */\n\t\tcursor?: string;\n\t}>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEntityStorageConnector.js","sourceRoot":"","sources":["../../../src/models/IEntityStorageConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { EntityCondition, IEntitySchema, SortDirection } from \"@twin.org/entity\";\n\n/**\n * Interface describing an entity storage connector.\n */\nexport interface IEntityStorageConnector<T = unknown> extends IComponent {\n\t/**\n\t * Get the schema for the entities.\n\t * @returns The schema for the entities.\n\t */\n\tgetSchema(): IEntitySchema;\n\n\t/**\n\t * Set an entity.\n\t * @param entity The entity to set.\n\t * @param conditions The optional conditions to match for the entities.\n\t * @returns The id of the entity.\n\t */\n\tset(entity: T, conditions?: { property: keyof T; value: unknown }[]): Promise<void>;\n\n\t/**\n\t * Get an entity.\n\t * @param id The id of the entity to get, or the index value if secondaryIndex is set.\n\t * @param secondaryIndex Get the item using a secondary index.\n\t * @param conditions The optional conditions to match for the entities.\n\t * @returns The object if it can be found or undefined.\n\t */\n\tget(\n\t\tid: string,\n\t\tsecondaryIndex?: keyof T,\n\t\tconditions?: { property: keyof T; value: unknown }[]\n\t): Promise<T | undefined>;\n\n\t/**\n\t * Remove the entity.\n\t * @param id The id of the entity to remove.\n\t * @param conditions The optional conditions to match for the entities.\n\t * @returns Nothing.\n\t */\n\tremove(id: string, conditions?: { property: keyof T; value: unknown }[]): Promise<void>;\n\n\t/**\n\t * Query all the entities which match the conditions.\n\t * @param conditions The conditions to match for the entities.\n\t * @param sortProperties The optional sort order.\n\t * @param properties The optional properties to return, defaults to all.\n\t * @param cursor The cursor to request the next chunk of entities.\n\t * @param limit The suggested number of entities to return in each chunk, in some scenarios can return a different amount.\n\t * @returns All the entities for the storage matching the conditions,\n\t * and a cursor which can be used to request more entities.\n\t */\n\tquery(\n\t\tconditions?: EntityCondition<T>,\n\t\tsortProperties?: {\n\t\t\tproperty: keyof T;\n\t\t\tsortDirection: SortDirection;\n\t\t}[],\n\t\tproperties?: (keyof T)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\t/**\n\t\t * The entities, which can be partial if a limited keys list was provided.\n\t\t */\n\t\tentities: Partial<T>[];\n\t\t/**\n\t\t * An optional cursor, when defined can be used to call find to get more entities.\n\t\t */\n\t\tcursor?: string;\n\t}>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEntityStorageGetRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IEntityStorageGetRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Get an entry from entity storage.\n */\nexport interface IEntityStorageGetRequest {\n\t/**\n\t * The parameters from the path.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The id of the entity to get.\n\t\t */\n\t\tid: string;\n\t};\n\n\t/**\n\t * The query parameters.\n\t */\n\tquery?: {\n\t\t/**\n\t\t * The secondary index to query with the id.\n\t\t */\n\t\tsecondaryIndex?: string;\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEntityStorageGetResponse.js","sourceRoot":"","sources":["../../../../src/models/api/IEntityStorageGetResponse.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Get an entry from entity storage.\n */\nexport interface IEntityStorageGetResponse {\n\t/**\n\t * The data for the requested entity.\n\t */\n\tbody: unknown;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEntityStorageListRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IEntityStorageListRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { SortDirection } from \"@twin.org/entity\";\n\n/**\n * Query the entries from entity storage.\n */\nexport interface IEntityStorageListRequest {\n\t/**\n\t * The parameters from the query.\n\t */\n\tquery?: {\n\t\t/**\n\t\t * The condition for the query as JSON version of EntityCondition type.\n\t\t */\n\t\tconditions?: string;\n\n\t\t/**\n\t\t * The order property for the results.\n\t\t */\n\t\torderBy?: string;\n\n\t\t/**\n\t\t * The direction for the order, defaults to desc.\n\t\t */\n\t\torderByDirection?: SortDirection;\n\n\t\t/**\n\t\t * The properties to return in the response as a comma separated list, by default returns all properties.\n\t\t */\n\t\tproperties?: string;\n\n\t\t/**\n\t\t * Limit the number of entities to return.\n\t\t */\n\t\tlimit?: string;\n\n\t\t/**\n\t\t * The cursor to get next chunk of data, returned in previous response.\n\t\t */\n\t\tcursor?: string;\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEntityStorageListResponse.js","sourceRoot":"","sources":["../../../../src/models/api/IEntityStorageListResponse.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Response to getting the list of entries from a query.\n */\nexport interface IEntityStorageListResponse {\n\t/**\n\t * The list of entries from the query.\n\t */\n\tbody: {\n\t\t/**\n\t\t * The entities from the query.\n\t\t */\n\t\tentities: unknown[];\n\n\t\t/**\n\t\t * The cursor for the next page.\n\t\t */\n\t\tcursor?: string;\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEntityStorageRemoveRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IEntityStorageRemoveRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Remove an entry from entity storage.\n */\nexport interface IEntityStorageRemoveRequest {\n\t/**\n\t * The parameters from the path.\n\t */\n\tpathParams: {\n\t\t/**\n\t\t * The id of the entity to remove.\n\t\t */\n\t\tid: string;\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEntityStorageSetRequest.js","sourceRoot":"","sources":["../../../../src/models/api/IEntityStorageSetRequest.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Set an entry in entity storage.\n */\nexport interface IEntityStorageSetRequest {\n\t/**\n\t * The data to be used in the entity.\n\t */\n\tbody: unknown;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Factory } from "@twin.org/core";
|
|
2
|
-
import type { IEntityStorageConnector } from "../models/IEntityStorageConnector";
|
|
2
|
+
import type { IEntityStorageConnector } from "../models/IEntityStorageConnector.js";
|
|
3
3
|
/**
|
|
4
4
|
* Factory for creating entity storage connectors.
|
|
5
5
|
*/
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from "./factories/entityStorageConnectorFactory";
|
|
2
|
-
export * from "./models/api/IEntityStorageGetRequest";
|
|
3
|
-
export * from "./models/api/IEntityStorageGetResponse";
|
|
4
|
-
export * from "./models/api/IEntityStorageListRequest";
|
|
5
|
-
export * from "./models/api/IEntityStorageListResponse";
|
|
6
|
-
export * from "./models/api/IEntityStorageRemoveRequest";
|
|
7
|
-
export * from "./models/api/IEntityStorageSetRequest";
|
|
8
|
-
export * from "./models/IEntityStorageComponent";
|
|
9
|
-
export * from "./models/IEntityStorageConnector";
|
|
1
|
+
export * from "./factories/entityStorageConnectorFactory.js";
|
|
2
|
+
export * from "./models/api/IEntityStorageGetRequest.js";
|
|
3
|
+
export * from "./models/api/IEntityStorageGetResponse.js";
|
|
4
|
+
export * from "./models/api/IEntityStorageListRequest.js";
|
|
5
|
+
export * from "./models/api/IEntityStorageListResponse.js";
|
|
6
|
+
export * from "./models/api/IEntityStorageRemoveRequest.js";
|
|
7
|
+
export * from "./models/api/IEntityStorageSetRequest.js";
|
|
8
|
+
export * from "./models/IEntityStorageComponent.js";
|
|
9
|
+
export * from "./models/IEntityStorageConnector.js";
|
|
@@ -7,38 +7,34 @@ export interface IEntityStorageComponent<T = unknown> extends IComponent {
|
|
|
7
7
|
/**
|
|
8
8
|
* Set an entity.
|
|
9
9
|
* @param entity The entity to set.
|
|
10
|
-
* @param userIdentity The user identity to use with storage operations.
|
|
11
10
|
* @returns The id of the entity.
|
|
12
11
|
*/
|
|
13
|
-
set(entity: T
|
|
12
|
+
set(entity: T): Promise<void>;
|
|
14
13
|
/**
|
|
15
14
|
* Get an entity.
|
|
16
15
|
* @param id The id of the entity to get, or the index value if secondaryIndex is set.
|
|
17
16
|
* @param secondaryIndex Get the item using a secondary index.
|
|
18
|
-
* @param userIdentity The user identity to use with storage operations.
|
|
19
17
|
* @returns The object if it can be found or undefined.
|
|
20
18
|
*/
|
|
21
|
-
get(id: string, secondaryIndex?: keyof T
|
|
19
|
+
get(id: string, secondaryIndex?: keyof T): Promise<T | undefined>;
|
|
22
20
|
/**
|
|
23
21
|
* Remove the entity.
|
|
24
22
|
* @param id The id of the entity to remove.
|
|
25
|
-
* @param userIdentity The user identity to use with storage operations.
|
|
26
23
|
* @returns Nothing.
|
|
27
24
|
*/
|
|
28
|
-
remove(id: string
|
|
25
|
+
remove(id: string): Promise<void>;
|
|
29
26
|
/**
|
|
30
27
|
* Query all the entities which match the conditions.
|
|
31
28
|
* @param conditions The conditions to match for the entities.
|
|
32
29
|
* @param orderBy The order for the results.
|
|
33
30
|
* @param orderByDirection The direction for the order, defaults to ascending.
|
|
34
31
|
* @param properties The optional properties to return, defaults to all.
|
|
35
|
-
* @param cursor The cursor to request the next
|
|
36
|
-
* @param
|
|
37
|
-
* @param userIdentity The user identity to use with storage operations.
|
|
32
|
+
* @param cursor The cursor to request the next chunk of entities.
|
|
33
|
+
* @param limit The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
|
|
38
34
|
* @returns All the entities for the storage matching the conditions,
|
|
39
35
|
* and a cursor which can be used to request more entities.
|
|
40
36
|
*/
|
|
41
|
-
query(conditions?: EntityCondition<T>, orderBy?: keyof T, orderByDirection?: SortDirection, properties?: (keyof T)[], cursor?: string,
|
|
37
|
+
query(conditions?: EntityCondition<T>, orderBy?: keyof T, orderByDirection?: SortDirection, properties?: (keyof T)[], cursor?: string, limit?: number): Promise<{
|
|
42
38
|
/**
|
|
43
39
|
* The entities, which can be partial if a limited keys list was provided.
|
|
44
40
|
*/
|
|
@@ -45,15 +45,15 @@ export interface IEntityStorageConnector<T = unknown> extends IComponent {
|
|
|
45
45
|
* @param conditions The conditions to match for the entities.
|
|
46
46
|
* @param sortProperties The optional sort order.
|
|
47
47
|
* @param properties The optional properties to return, defaults to all.
|
|
48
|
-
* @param cursor The cursor to request the next
|
|
49
|
-
* @param
|
|
48
|
+
* @param cursor The cursor to request the next chunk of entities.
|
|
49
|
+
* @param limit The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
|
|
50
50
|
* @returns All the entities for the storage matching the conditions,
|
|
51
51
|
* and a cursor which can be used to request more entities.
|
|
52
52
|
*/
|
|
53
53
|
query(conditions?: EntityCondition<T>, sortProperties?: {
|
|
54
54
|
property: keyof T;
|
|
55
55
|
sortDirection: SortDirection;
|
|
56
|
-
}[], properties?: (keyof T)[], cursor?: string,
|
|
56
|
+
}[], properties?: (keyof T)[], cursor?: string, limit?: number): Promise<{
|
|
57
57
|
/**
|
|
58
58
|
* The entities, which can be partial if a limited keys list was provided.
|
|
59
59
|
*/
|
|
@@ -24,9 +24,9 @@ export interface IEntityStorageListRequest {
|
|
|
24
24
|
*/
|
|
25
25
|
properties?: string;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* Limit the number of entities to return.
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
limit?: string;
|
|
30
30
|
/**
|
|
31
31
|
* The cursor to get next chunk of data, returned in previous response.
|
|
32
32
|
*/
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @twin.org/entity-storage-models - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.2](https://github.com/twinfoundation/entity-storage/compare/entity-storage-models-v0.0.3-next.1...entity-storage-models-v0.0.3-next.2) (2025-11-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **entity-storage-models:** Synchronize repo versions
|
|
9
|
+
|
|
10
|
+
## [0.0.3-next.1](https://github.com/twinfoundation/entity-storage/compare/entity-storage-models-v0.0.3-next.0...entity-storage-models-v0.0.3-next.1) (2025-11-10)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add context id features ([#55](https://github.com/twinfoundation/entity-storage/issues/55)) ([99c15a2](https://github.com/twinfoundation/entity-storage/commit/99c15a257539b61d9da63649ce573ebf47699fc9))
|
|
16
|
+
* add production release automation ([1eb4c8e](https://github.com/twinfoundation/entity-storage/commit/1eb4c8ee3eb099defdfc2d063ae44935276dcae8))
|
|
17
|
+
* add validate-locales ([e66ef0d](https://github.com/twinfoundation/entity-storage/commit/e66ef0de26ca2f82b3fe89bb5c7a15a0978a9644))
|
|
18
|
+
* eslint migration to flat config ([f033b64](https://github.com/twinfoundation/entity-storage/commit/f033b64984c0e6a8129d929c9dd816dcc1b8dab0))
|
|
19
|
+
* remove includeNodeIdentity flag ([d88d1d0](https://github.com/twinfoundation/entity-storage/commit/d88d1d0694419b795dc860e0b712a0051c9a1c9e))
|
|
20
|
+
* update dependencies ([7ccc0c4](https://github.com/twinfoundation/entity-storage/commit/7ccc0c429125d073dc60b3de6cf101abc8cc6cba))
|
|
21
|
+
* update framework core ([b59a380](https://github.com/twinfoundation/entity-storage/commit/b59a380bb7fba2b43610f69074dcdee24a4737da))
|
|
22
|
+
* use shared store mechanism ([#34](https://github.com/twinfoundation/entity-storage/issues/34)) ([68b6b71](https://github.com/twinfoundation/entity-storage/commit/68b6b71e7a96d7d016cd57bfff36775b56bf3f93))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* query params force coercion ([dd6aa87](https://github.com/twinfoundation/entity-storage/commit/dd6aa87efdfb60bab7d6756a86888863c45c51a7))
|
|
28
|
+
|
|
29
|
+
## [0.0.2-next.10](https://github.com/twinfoundation/entity-storage/compare/entity-storage-models-v0.0.2-next.9...entity-storage-models-v0.0.2-next.10) (2025-10-09)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
* add validate-locales ([e66ef0d](https://github.com/twinfoundation/entity-storage/commit/e66ef0de26ca2f82b3fe89bb5c7a15a0978a9644))
|
|
35
|
+
|
|
3
36
|
## [0.0.2-next.9](https://github.com/twinfoundation/entity-storage/compare/entity-storage-models-v0.0.2-next.8...entity-storage-models-v0.0.2-next.9) (2025-10-02)
|
|
4
37
|
|
|
5
38
|
|
|
@@ -16,7 +16,7 @@ Interface describing an entity storage component.
|
|
|
16
16
|
|
|
17
17
|
### set()
|
|
18
18
|
|
|
19
|
-
> **set**(`entity
|
|
19
|
+
> **set**(`entity`): `Promise`\<`void`\>
|
|
20
20
|
|
|
21
21
|
Set an entity.
|
|
22
22
|
|
|
@@ -28,12 +28,6 @@ Set an entity.
|
|
|
28
28
|
|
|
29
29
|
The entity to set.
|
|
30
30
|
|
|
31
|
-
##### userIdentity?
|
|
32
|
-
|
|
33
|
-
`string`
|
|
34
|
-
|
|
35
|
-
The user identity to use with storage operations.
|
|
36
|
-
|
|
37
31
|
#### Returns
|
|
38
32
|
|
|
39
33
|
`Promise`\<`void`\>
|
|
@@ -44,7 +38,7 @@ The id of the entity.
|
|
|
44
38
|
|
|
45
39
|
### get()
|
|
46
40
|
|
|
47
|
-
> **get**(`id`, `secondaryIndex
|
|
41
|
+
> **get**(`id`, `secondaryIndex?`): `Promise`\<`T` \| `undefined`\>
|
|
48
42
|
|
|
49
43
|
Get an entity.
|
|
50
44
|
|
|
@@ -62,15 +56,9 @@ keyof `T`
|
|
|
62
56
|
|
|
63
57
|
Get the item using a secondary index.
|
|
64
58
|
|
|
65
|
-
##### userIdentity?
|
|
66
|
-
|
|
67
|
-
`string`
|
|
68
|
-
|
|
69
|
-
The user identity to use with storage operations.
|
|
70
|
-
|
|
71
59
|
#### Returns
|
|
72
60
|
|
|
73
|
-
`Promise`\<`
|
|
61
|
+
`Promise`\<`T` \| `undefined`\>
|
|
74
62
|
|
|
75
63
|
The object if it can be found or undefined.
|
|
76
64
|
|
|
@@ -78,7 +66,7 @@ The object if it can be found or undefined.
|
|
|
78
66
|
|
|
79
67
|
### remove()
|
|
80
68
|
|
|
81
|
-
> **remove**(`id
|
|
69
|
+
> **remove**(`id`): `Promise`\<`void`\>
|
|
82
70
|
|
|
83
71
|
Remove the entity.
|
|
84
72
|
|
|
@@ -90,12 +78,6 @@ Remove the entity.
|
|
|
90
78
|
|
|
91
79
|
The id of the entity to remove.
|
|
92
80
|
|
|
93
|
-
##### userIdentity?
|
|
94
|
-
|
|
95
|
-
`string`
|
|
96
|
-
|
|
97
|
-
The user identity to use with storage operations.
|
|
98
|
-
|
|
99
81
|
#### Returns
|
|
100
82
|
|
|
101
83
|
`Promise`\<`void`\>
|
|
@@ -106,7 +88,7 @@ Nothing.
|
|
|
106
88
|
|
|
107
89
|
### query()
|
|
108
90
|
|
|
109
|
-
> **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `
|
|
91
|
+
> **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
110
92
|
|
|
111
93
|
Query all the entities which match the conditions.
|
|
112
94
|
|
|
@@ -140,20 +122,14 @@ The optional properties to return, defaults to all.
|
|
|
140
122
|
|
|
141
123
|
`string`
|
|
142
124
|
|
|
143
|
-
The cursor to request the next
|
|
125
|
+
The cursor to request the next chunk of entities.
|
|
144
126
|
|
|
145
|
-
#####
|
|
127
|
+
##### limit?
|
|
146
128
|
|
|
147
129
|
`number`
|
|
148
130
|
|
|
149
131
|
The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
|
|
150
132
|
|
|
151
|
-
##### userIdentity?
|
|
152
|
-
|
|
153
|
-
`string`
|
|
154
|
-
|
|
155
|
-
The user identity to use with storage operations.
|
|
156
|
-
|
|
157
133
|
#### Returns
|
|
158
134
|
|
|
159
135
|
`Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
@@ -58,7 +58,7 @@ The id of the entity.
|
|
|
58
58
|
|
|
59
59
|
### get()
|
|
60
60
|
|
|
61
|
-
> **get**(`id`, `secondaryIndex?`, `conditions?`): `Promise`\<`
|
|
61
|
+
> **get**(`id`, `secondaryIndex?`, `conditions?`): `Promise`\<`T` \| `undefined`\>
|
|
62
62
|
|
|
63
63
|
Get an entity.
|
|
64
64
|
|
|
@@ -84,7 +84,7 @@ The optional conditions to match for the entities.
|
|
|
84
84
|
|
|
85
85
|
#### Returns
|
|
86
86
|
|
|
87
|
-
`Promise`\<`
|
|
87
|
+
`Promise`\<`T` \| `undefined`\>
|
|
88
88
|
|
|
89
89
|
The object if it can be found or undefined.
|
|
90
90
|
|
|
@@ -120,7 +120,7 @@ Nothing.
|
|
|
120
120
|
|
|
121
121
|
### query()
|
|
122
122
|
|
|
123
|
-
> **query**(`conditions?`, `sortProperties?`, `properties?`, `cursor?`, `
|
|
123
|
+
> **query**(`conditions?`, `sortProperties?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
124
124
|
|
|
125
125
|
Query all the entities which match the conditions.
|
|
126
126
|
|
|
@@ -148,9 +148,9 @@ The optional properties to return, defaults to all.
|
|
|
148
148
|
|
|
149
149
|
`string`
|
|
150
150
|
|
|
151
|
-
The cursor to request the next
|
|
151
|
+
The cursor to request the next chunk of entities.
|
|
152
152
|
|
|
153
|
-
#####
|
|
153
|
+
##### limit?
|
|
154
154
|
|
|
155
155
|
`number`
|
|
156
156
|
|
|
@@ -34,11 +34,11 @@ The direction for the order, defaults to desc.
|
|
|
34
34
|
|
|
35
35
|
The properties to return in the response as a comma separated list, by default returns all properties.
|
|
36
36
|
|
|
37
|
-
####
|
|
37
|
+
#### limit?
|
|
38
38
|
|
|
39
|
-
> `optional` **
|
|
39
|
+
> `optional` **limit**: `string`
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
Limit the number of entities to return.
|
|
42
42
|
|
|
43
43
|
#### cursor?
|
|
44
44
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/entity-storage-models",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3-next.2",
|
|
4
4
|
"description": "Models which define the structure of the entity storage contracts and connectors",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,20 +18,18 @@
|
|
|
18
18
|
"@twin.org/entity": "next",
|
|
19
19
|
"@twin.org/nameof": "next"
|
|
20
20
|
},
|
|
21
|
-
"main": "./dist/
|
|
22
|
-
"module": "./dist/esm/index.mjs",
|
|
21
|
+
"main": "./dist/es/index.js",
|
|
23
22
|
"types": "./dist/types/index.d.ts",
|
|
24
23
|
"exports": {
|
|
25
24
|
".": {
|
|
26
25
|
"types": "./dist/types/index.d.ts",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
26
|
+
"import": "./dist/es/index.js",
|
|
27
|
+
"default": "./dist/es/index.js"
|
|
29
28
|
},
|
|
30
29
|
"./locales/*.json": "./locales/*.json"
|
|
31
30
|
},
|
|
32
31
|
"files": [
|
|
33
|
-
"dist/
|
|
34
|
-
"dist/esm",
|
|
32
|
+
"dist/es",
|
|
35
33
|
"dist/types",
|
|
36
34
|
"locales",
|
|
37
35
|
"docs"
|
|
@@ -50,5 +48,9 @@
|
|
|
50
48
|
"models",
|
|
51
49
|
"types",
|
|
52
50
|
"schemas"
|
|
53
|
-
]
|
|
51
|
+
],
|
|
52
|
+
"bugs": {
|
|
53
|
+
"url": "git+https://github.com/twinfoundation/entity-storage/issues"
|
|
54
|
+
},
|
|
55
|
+
"homepage": "https://twindev.org"
|
|
54
56
|
}
|
package/dist/cjs/index.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var core = require('@twin.org/core');
|
|
4
|
-
|
|
5
|
-
// Copyright 2024 IOTA Stiftung.
|
|
6
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
7
|
-
/**
|
|
8
|
-
* Factory for creating entity storage connectors.
|
|
9
|
-
*/
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11
|
-
const EntityStorageConnectorFactory = core.Factory.createFactory("entity-storage");
|
|
12
|
-
|
|
13
|
-
exports.EntityStorageConnectorFactory = EntityStorageConnectorFactory;
|