@twin.org/entity-storage-rest-client 0.0.3-next.2 → 0.0.3-next.20

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # TWIN Entity Storage REST Client
1
+ # Entity Storage REST Client
2
2
 
3
- Entity Storage contract implementation which can connect to REST endpoints.
3
+ This package provides a client layer for calling storage service endpoints through a consistent REST interface. It is designed to work with the wider storage ecosystem so applications can keep behaviour consistent across connectors and environments.
4
4
 
5
5
  ## Installation
6
6
 
@@ -28,28 +28,45 @@ export class EntityStorageRestClient extends BaseRestClient {
28
28
  /**
29
29
  * Set an entity.
30
30
  * @param entity The entity to set.
31
+ * @param conditions The optional conditions to match for the entities.
31
32
  * @returns The id of the entity.
32
33
  */
33
- async set(entity) {
34
+ async set(entity, conditions) {
34
35
  Guards.object(EntityStorageRestClient.CLASS_NAME, "entity", entity);
35
36
  await this.fetch("/", "POST", {
36
- body: entity
37
+ body: entity,
38
+ query: {
39
+ conditions: HttpParameterHelper.objectToString(conditions)
40
+ }
41
+ });
42
+ }
43
+ /**
44
+ * Set multiple entities in a batch.
45
+ * @param entities The entities to set.
46
+ * @returns Nothing.
47
+ */
48
+ async setBatch(entities) {
49
+ Guards.arrayValue(EntityStorageRestClient.CLASS_NAME, "entities", entities);
50
+ await this.fetch("/batch", "POST", {
51
+ body: entities
37
52
  });
38
53
  }
39
54
  /**
40
55
  * Get an entity.
41
56
  * @param id The id of the entity to get, or the index value if secondaryIndex is set.
42
57
  * @param secondaryIndex Get the item using a secondary index.
58
+ * @param conditions The optional conditions to match for the entities.
43
59
  * @returns The object if it can be found or undefined.
44
60
  */
45
- async get(id, secondaryIndex) {
61
+ async get(id, secondaryIndex, conditions) {
46
62
  Guards.stringValue(EntityStorageRestClient.CLASS_NAME, "id", id);
47
63
  const response = await this.fetch("/:id", "GET", {
48
64
  pathParams: {
49
65
  id
50
66
  },
51
67
  query: {
52
- secondaryIndex: secondaryIndex
68
+ secondaryIndex: secondaryIndex,
69
+ conditions: HttpParameterHelper.objectToString(conditions)
53
70
  }
54
71
  });
55
72
  return response.body;
@@ -57,15 +74,50 @@ export class EntityStorageRestClient extends BaseRestClient {
57
74
  /**
58
75
  * Remove the entity.
59
76
  * @param id The id of the entity to remove.
77
+ * @param conditions The optional conditions to match for the entities.
60
78
  * @returns Nothing.
61
79
  */
62
- async remove(id) {
80
+ async remove(id, conditions) {
63
81
  Guards.stringValue(EntityStorageRestClient.CLASS_NAME, "id", id);
64
82
  await this.fetch("/:id", "DELETE", {
65
83
  pathParams: {
66
84
  id
85
+ },
86
+ query: {
87
+ conditions: HttpParameterHelper.objectToString(conditions)
88
+ }
89
+ });
90
+ }
91
+ /**
92
+ * Remove multiple entities by id.
93
+ * @param ids The ids of the entities to remove.
94
+ * @returns Nothing.
95
+ */
96
+ async removeBatch(ids) {
97
+ Guards.arrayValue(EntityStorageRestClient.CLASS_NAME, "ids", ids);
98
+ await this.fetch("/batch", "DELETE", {
99
+ body: ids
100
+ });
101
+ }
102
+ /**
103
+ * Remove all entities from the storage.
104
+ * @returns Nothing.
105
+ */
106
+ async empty() {
107
+ await this.fetch("/", "DELETE", {});
108
+ }
109
+ /**
110
+ * Count all the entities which match the conditions.
111
+ * @param conditions The optional conditions to match for the entities.
112
+ * @returns The total count of entities in the storage.
113
+ */
114
+ async count(conditions) {
115
+ const result = await this.fetch("/count", "GET", {
116
+ query: {
117
+ conditions: HttpParameterHelper.objectToString(conditions)
67
118
  }
68
119
  });
120
+ return result.body.count;
69
121
  }
70
122
  /**
71
123
  * Query all the entities which match the conditions.
@@ -1 +1 @@
1
- {"version":3,"file":"entityStorageRestClient.js","sourceRoot":"","sources":["../../src/entityStorageRestClient.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACN,mBAAmB,EAGnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAahD;;GAEG;AACH,MAAM,OAAO,uBACZ,SAAQ,cAAc;IAGtB;;OAEG;IACI,MAAM,CAAU,UAAU,6BAAsD;IAEvF;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,4BAAuC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACvE,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,uBAAuB,CAAC,UAAU,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,GAAG,CAAC,MAAS;QACzB,MAAM,CAAC,MAAM,CAAC,uBAAuB,CAAC,UAAU,YAAkB,MAAM,CAAC,CAAC;QAE1E,MAAM,IAAI,CAAC,KAAK,CAA+C,GAAG,EAAE,MAAM,EAAE;YAC3E,IAAI,EAAE,MAAM;SACZ,CAAC,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,GAAG,CAAC,EAAU,EAAE,cAAwB;QACpD,MAAM,CAAC,WAAW,CAAC,uBAAuB,CAAC,UAAU,QAAc,EAAE,CAAC,CAAC;QAEvE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAChC,MAAM,EACN,KAAK,EACL;YACC,UAAU,EAAE;gBACX,EAAE;aACF;YACD,KAAK,EAAE;gBACN,cAAc,EAAE,cAAwB;aACxC;SACD,CACD,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAS,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAAC,EAAU;QAC7B,MAAM,CAAC,WAAW,CAAC,uBAAuB,CAAC,UAAU,QAAc,EAAE,CAAC,CAAC;QAEvE,MAAM,IAAI,CAAC,KAAK,CAAkD,MAAM,EAAE,QAAQ,EAAE;YACnF,UAAU,EAAE;gBACX,EAAE;aACF;SACD,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;;;;;OAUG;IACI,KAAK,CAAC,KAAK,CACjB,UAA+B,EAC/B,OAAiB,EACjB,gBAAgC,EAChC,UAAwB,EACxB,MAAe,EACf,KAAc;QAWd,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAC9B,GAAG,EACH,KAAK,EACL;YACC,KAAK,EAAE;gBACN,UAAU,EAAE,mBAAmB,CAAC,cAAc,CAAC,UAAU,CAAC;gBAC1D,OAAO,EAAE,OAAiB;gBAC1B,gBAAgB;gBAChB,UAAU,EAAE,mBAAmB,CAAC,aAAa,CAAC,UAAU,CAAC;gBACzD,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;gBAC3B,MAAM;aACN;SACD,CACD,CAAC;QAEF,OAAO;YACN,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,QAAwB;YAC9C,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM;SAC1B,CAAC;IACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport {\n\tHttpParameterHelper,\n\ttype IBaseRestClientConfig,\n\ttype INoContentResponse\n} from \"@twin.org/api-models\";\nimport { Coerce, Guards } from \"@twin.org/core\";\nimport type { EntityCondition, SortDirection } from \"@twin.org/entity\";\nimport type {\n\tIEntityStorageComponent,\n\tIEntityStorageGetRequest,\n\tIEntityStorageGetResponse,\n\tIEntityStorageListRequest,\n\tIEntityStorageListResponse,\n\tIEntityStorageRemoveRequest,\n\tIEntityStorageSetRequest\n} from \"@twin.org/entity-storage-models\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * Client for performing entity storage through to REST endpoints.\n */\nexport class EntityStorageRestClient<T>\n\textends BaseRestClient\n\timplements IEntityStorageComponent<T>\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<EntityStorageRestClient<unknown>>();\n\n\t/**\n\t * Create a new instance of EntityStorageRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(nameof<EntityStorageRestClient<T>>(), config, \"entity-storage\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn EntityStorageRestClient.CLASS_NAME;\n\t}\n\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\tpublic async set(entity: T): Promise<void> {\n\t\tGuards.object(EntityStorageRestClient.CLASS_NAME, nameof(entity), entity);\n\n\t\tawait this.fetch<IEntityStorageSetRequest, INoContentResponse>(\"/\", \"POST\", {\n\t\t\tbody: entity\n\t\t});\n\t}\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\tpublic async get(id: string, secondaryIndex?: keyof T): Promise<T | undefined> {\n\t\tGuards.stringValue(EntityStorageRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tconst response = await this.fetch<IEntityStorageGetRequest, IEntityStorageGetResponse>(\n\t\t\t\"/:id\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\tpathParams: {\n\t\t\t\t\tid\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\tsecondaryIndex: secondaryIndex as string\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn response.body as T;\n\t}\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\tpublic async remove(id: string): Promise<void> {\n\t\tGuards.stringValue(EntityStorageRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tawait this.fetch<IEntityStorageRemoveRequest, INoContentResponse>(\"/:id\", \"DELETE\", {\n\t\t\tpathParams: {\n\t\t\t\tid\n\t\t\t}\n\t\t});\n\t}\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\tpublic async query(\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\t\tconst result = await this.fetch<IEntityStorageListRequest, IEntityStorageListResponse>(\n\t\t\t\"/\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\tquery: {\n\t\t\t\t\tconditions: HttpParameterHelper.objectToString(conditions),\n\t\t\t\t\torderBy: orderBy as string,\n\t\t\t\t\torderByDirection,\n\t\t\t\t\tproperties: HttpParameterHelper.arrayToString(properties),\n\t\t\t\t\tlimit: Coerce.string(limit),\n\t\t\t\t\tcursor\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn {\n\t\t\tentities: result.body.entities as Partial<T>[],\n\t\t\tcursor: result.body.cursor\n\t\t};\n\t}\n}\n"]}
1
+ {"version":3,"file":"entityStorageRestClient.js","sourceRoot":"","sources":["../../src/entityStorageRestClient.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport {\n\tHttpParameterHelper,\n\ttype IBaseRestClientConfig,\n\ttype INoContentResponse\n} from \"@twin.org/api-models\";\nimport { Coerce, Guards } from \"@twin.org/core\";\nimport type { EntityCondition, SortDirection } from \"@twin.org/entity\";\nimport type {\n\tIEntityStorageComponent,\n\tIEntityStorageCountRequest,\n\tIEntityStorageCountResponse,\n\tIEntityStorageEmptyRequest,\n\tIEntityStorageGetRequest,\n\tIEntityStorageGetResponse,\n\tIEntityStorageListRequest,\n\tIEntityStorageListResponse,\n\tIEntityStorageRemoveBatchRequest,\n\tIEntityStorageRemoveRequest,\n\tIEntityStorageSetBatchRequest,\n\tIEntityStorageSetRequest\n} from \"@twin.org/entity-storage-models\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * Client for performing entity storage through to REST endpoints.\n */\nexport class EntityStorageRestClient<T>\n\textends BaseRestClient\n\timplements IEntityStorageComponent<T>\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<EntityStorageRestClient<unknown>>();\n\n\t/**\n\t * Create a new instance of EntityStorageRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(nameof<EntityStorageRestClient<T>>(), config, \"entity-storage\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn EntityStorageRestClient.CLASS_NAME;\n\t}\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\tpublic async set(entity: T, conditions?: { property: keyof T; value: unknown }[]): Promise<void> {\n\t\tGuards.object(EntityStorageRestClient.CLASS_NAME, nameof(entity), entity);\n\n\t\tawait this.fetch<IEntityStorageSetRequest, INoContentResponse>(\"/\", \"POST\", {\n\t\t\tbody: entity,\n\t\t\tquery: {\n\t\t\t\tconditions: HttpParameterHelper.objectToString(conditions)\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Set multiple entities in a batch.\n\t * @param entities The entities to set.\n\t * @returns Nothing.\n\t */\n\tpublic async setBatch(entities: T[]): Promise<void> {\n\t\tGuards.arrayValue(EntityStorageRestClient.CLASS_NAME, nameof(entities), entities);\n\n\t\tawait this.fetch<IEntityStorageSetBatchRequest, INoContentResponse>(\"/batch\", \"POST\", {\n\t\t\tbody: entities\n\t\t});\n\t}\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\tpublic async get(\n\t\tid: string,\n\t\tsecondaryIndex?: keyof T,\n\t\tconditions?: { property: keyof T; value: unknown }[]\n\t): Promise<T | undefined> {\n\t\tGuards.stringValue(EntityStorageRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tconst response = await this.fetch<IEntityStorageGetRequest, IEntityStorageGetResponse>(\n\t\t\t\"/:id\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\tpathParams: {\n\t\t\t\t\tid\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\tsecondaryIndex: secondaryIndex as string,\n\t\t\t\t\tconditions: HttpParameterHelper.objectToString(conditions)\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn response.body as T;\n\t}\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\tpublic async remove(\n\t\tid: string,\n\t\tconditions?: { property: keyof T; value: unknown }[]\n\t): Promise<void> {\n\t\tGuards.stringValue(EntityStorageRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tawait this.fetch<IEntityStorageRemoveRequest, INoContentResponse>(\"/:id\", \"DELETE\", {\n\t\t\tpathParams: {\n\t\t\t\tid\n\t\t\t},\n\t\t\tquery: {\n\t\t\t\tconditions: HttpParameterHelper.objectToString(conditions)\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Remove multiple entities by id.\n\t * @param ids The ids of the entities to remove.\n\t * @returns Nothing.\n\t */\n\tpublic async removeBatch(ids: string[]): Promise<void> {\n\t\tGuards.arrayValue(EntityStorageRestClient.CLASS_NAME, nameof(ids), ids);\n\n\t\tawait this.fetch<IEntityStorageRemoveBatchRequest, INoContentResponse>(\"/batch\", \"DELETE\", {\n\t\t\tbody: ids\n\t\t});\n\t}\n\n\t/**\n\t * Remove all entities from the storage.\n\t * @returns Nothing.\n\t */\n\tpublic async empty(): Promise<void> {\n\t\tawait this.fetch<IEntityStorageEmptyRequest, INoContentResponse>(\"/\", \"DELETE\", {});\n\t}\n\n\t/**\n\t * Count all the entities which match the conditions.\n\t * @param conditions The optional conditions to match for the entities.\n\t * @returns The total count of entities in the storage.\n\t */\n\tpublic async count(conditions?: EntityCondition<T>): Promise<number> {\n\t\tconst result = await this.fetch<IEntityStorageCountRequest, IEntityStorageCountResponse>(\n\t\t\t\"/count\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\tquery: {\n\t\t\t\t\tconditions: HttpParameterHelper.objectToString(conditions)\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\treturn result.body.count;\n\t}\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\tpublic async query(\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\t\tconst result = await this.fetch<IEntityStorageListRequest, IEntityStorageListResponse>(\n\t\t\t\"/\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\tquery: {\n\t\t\t\t\tconditions: HttpParameterHelper.objectToString(conditions),\n\t\t\t\t\torderBy: orderBy as string,\n\t\t\t\t\torderByDirection,\n\t\t\t\t\tproperties: HttpParameterHelper.arrayToString(properties),\n\t\t\t\t\tlimit: Coerce.string(limit),\n\t\t\t\t\tcursor\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn {\n\t\t\tentities: result.body.entities as Partial<T>[],\n\t\t\tcursor: result.body.cursor\n\t\t};\n\t}\n}\n"]}
@@ -23,22 +23,57 @@ export declare class EntityStorageRestClient<T> extends BaseRestClient implement
23
23
  /**
24
24
  * Set an entity.
25
25
  * @param entity The entity to set.
26
+ * @param conditions The optional conditions to match for the entities.
26
27
  * @returns The id of the entity.
27
28
  */
28
- set(entity: T): Promise<void>;
29
+ set(entity: T, conditions?: {
30
+ property: keyof T;
31
+ value: unknown;
32
+ }[]): Promise<void>;
33
+ /**
34
+ * Set multiple entities in a batch.
35
+ * @param entities The entities to set.
36
+ * @returns Nothing.
37
+ */
38
+ setBatch(entities: T[]): Promise<void>;
29
39
  /**
30
40
  * Get an entity.
31
41
  * @param id The id of the entity to get, or the index value if secondaryIndex is set.
32
42
  * @param secondaryIndex Get the item using a secondary index.
43
+ * @param conditions The optional conditions to match for the entities.
33
44
  * @returns The object if it can be found or undefined.
34
45
  */
35
- get(id: string, secondaryIndex?: keyof T): Promise<T | undefined>;
46
+ get(id: string, secondaryIndex?: keyof T, conditions?: {
47
+ property: keyof T;
48
+ value: unknown;
49
+ }[]): Promise<T | undefined>;
36
50
  /**
37
51
  * Remove the entity.
38
52
  * @param id The id of the entity to remove.
53
+ * @param conditions The optional conditions to match for the entities.
54
+ * @returns Nothing.
55
+ */
56
+ remove(id: string, conditions?: {
57
+ property: keyof T;
58
+ value: unknown;
59
+ }[]): Promise<void>;
60
+ /**
61
+ * Remove multiple entities by id.
62
+ * @param ids The ids of the entities to remove.
39
63
  * @returns Nothing.
40
64
  */
41
- remove(id: string): Promise<void>;
65
+ removeBatch(ids: string[]): Promise<void>;
66
+ /**
67
+ * Remove all entities from the storage.
68
+ * @returns Nothing.
69
+ */
70
+ empty(): Promise<void>;
71
+ /**
72
+ * Count all the entities which match the conditions.
73
+ * @param conditions The optional conditions to match for the entities.
74
+ * @returns The total count of entities in the storage.
75
+ */
76
+ count(conditions?: EntityCondition<T>): Promise<number>;
42
77
  /**
43
78
  * Query all the entities which match the conditions.
44
79
  * @param conditions The conditions to match for the entities.
package/docs/changelog.md CHANGED
@@ -1,6 +1,300 @@
1
- # @twin.org/entity-storage-rest-client - Changelog
1
+ # Changelog
2
2
 
3
- ## [0.0.3-next.2](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.3-next.1...entity-storage-rest-client-v0.0.3-next.2) (2025-11-13)
3
+ ## [0.0.3-next.20](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.19...entity-storage-rest-client-v0.0.3-next.20) (2026-06-01)
4
+
5
+
6
+ ### Features
7
+
8
+ * add context id features ([#55](https://github.com/iotaledger/twin-entity-storage/issues/55)) ([99c15a2](https://github.com/iotaledger/twin-entity-storage/commit/99c15a257539b61d9da63649ce573ebf47699fc9))
9
+ * add production release automation ([1eb4c8e](https://github.com/iotaledger/twin-entity-storage/commit/1eb4c8ee3eb099defdfc2d063ae44935276dcae8))
10
+ * add validate-locales ([e66ef0d](https://github.com/iotaledger/twin-entity-storage/commit/e66ef0de26ca2f82b3fe89bb5c7a15a0978a9644))
11
+ * adding schema migration functionality to all the connectors ([#85](https://github.com/iotaledger/twin-entity-storage/issues/85)) ([fd1555a](https://github.com/iotaledger/twin-entity-storage/commit/fd1555a34380158214a577586dafae821e72a578))
12
+ * entity storage enhancements ([#86](https://github.com/iotaledger/twin-entity-storage/issues/86)) ([1279af4](https://github.com/iotaledger/twin-entity-storage/commit/1279af42615c6497bb06539842cee44842dd1f75))
13
+ * eslint migration to flat config ([f033b64](https://github.com/iotaledger/twin-entity-storage/commit/f033b64984c0e6a8129d929c9dd816dcc1b8dab0))
14
+ * typescript 6 update ([995a0c6](https://github.com/iotaledger/twin-entity-storage/commit/995a0c6fa9a6813bfdc7200779ce3664236e59e9))
15
+ * update dependencies ([7ccc0c4](https://github.com/iotaledger/twin-entity-storage/commit/7ccc0c429125d073dc60b3de6cf101abc8cc6cba))
16
+ * update framework core ([b59a380](https://github.com/iotaledger/twin-entity-storage/commit/b59a380bb7fba2b43610f69074dcdee24a4737da))
17
+ * use shared store mechanism ([#34](https://github.com/iotaledger/twin-entity-storage/issues/34)) ([68b6b71](https://github.com/iotaledger/twin-entity-storage/commit/68b6b71e7a96d7d016cd57bfff36775b56bf3f93))
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * query params force coercion ([dd6aa87](https://github.com/iotaledger/twin-entity-storage/commit/dd6aa87efdfb60bab7d6756a86888863c45c51a7))
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @twin.org/entity-storage-models bumped from 0.0.3-next.19 to 0.0.3-next.20
30
+
31
+ ## [0.0.3-next.19](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.18...entity-storage-rest-client-v0.0.3-next.19) (2026-06-01)
32
+
33
+
34
+ ### Features
35
+
36
+ * add context id features ([#55](https://github.com/iotaledger/twin-entity-storage/issues/55)) ([99c15a2](https://github.com/iotaledger/twin-entity-storage/commit/99c15a257539b61d9da63649ce573ebf47699fc9))
37
+ * add production release automation ([1eb4c8e](https://github.com/iotaledger/twin-entity-storage/commit/1eb4c8ee3eb099defdfc2d063ae44935276dcae8))
38
+ * add validate-locales ([e66ef0d](https://github.com/iotaledger/twin-entity-storage/commit/e66ef0de26ca2f82b3fe89bb5c7a15a0978a9644))
39
+ * adding schema migration functionality to all the connectors ([#85](https://github.com/iotaledger/twin-entity-storage/issues/85)) ([fd1555a](https://github.com/iotaledger/twin-entity-storage/commit/fd1555a34380158214a577586dafae821e72a578))
40
+ * entity storage enhancements ([#86](https://github.com/iotaledger/twin-entity-storage/issues/86)) ([1279af4](https://github.com/iotaledger/twin-entity-storage/commit/1279af42615c6497bb06539842cee44842dd1f75))
41
+ * eslint migration to flat config ([f033b64](https://github.com/iotaledger/twin-entity-storage/commit/f033b64984c0e6a8129d929c9dd816dcc1b8dab0))
42
+ * typescript 6 update ([995a0c6](https://github.com/iotaledger/twin-entity-storage/commit/995a0c6fa9a6813bfdc7200779ce3664236e59e9))
43
+ * update dependencies ([7ccc0c4](https://github.com/iotaledger/twin-entity-storage/commit/7ccc0c429125d073dc60b3de6cf101abc8cc6cba))
44
+ * update framework core ([b59a380](https://github.com/iotaledger/twin-entity-storage/commit/b59a380bb7fba2b43610f69074dcdee24a4737da))
45
+ * use shared store mechanism ([#34](https://github.com/iotaledger/twin-entity-storage/issues/34)) ([68b6b71](https://github.com/iotaledger/twin-entity-storage/commit/68b6b71e7a96d7d016cd57bfff36775b56bf3f93))
46
+
47
+
48
+ ### Bug Fixes
49
+
50
+ * query params force coercion ([dd6aa87](https://github.com/iotaledger/twin-entity-storage/commit/dd6aa87efdfb60bab7d6756a86888863c45c51a7))
51
+
52
+
53
+ ### Dependencies
54
+
55
+ * The following workspace dependencies were updated
56
+ * dependencies
57
+ * @twin.org/entity-storage-models bumped from 0.0.3-next.18 to 0.0.3-next.19
58
+
59
+ ## [0.0.3-next.18](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.17...entity-storage-rest-client-v0.0.3-next.18) (2026-06-01)
60
+
61
+
62
+ ### Features
63
+
64
+ * add context id features ([#55](https://github.com/iotaledger/twin-entity-storage/issues/55)) ([99c15a2](https://github.com/iotaledger/twin-entity-storage/commit/99c15a257539b61d9da63649ce573ebf47699fc9))
65
+ * add production release automation ([1eb4c8e](https://github.com/iotaledger/twin-entity-storage/commit/1eb4c8ee3eb099defdfc2d063ae44935276dcae8))
66
+ * add validate-locales ([e66ef0d](https://github.com/iotaledger/twin-entity-storage/commit/e66ef0de26ca2f82b3fe89bb5c7a15a0978a9644))
67
+ * adding schema migration functionality to all the connectors ([#85](https://github.com/iotaledger/twin-entity-storage/issues/85)) ([fd1555a](https://github.com/iotaledger/twin-entity-storage/commit/fd1555a34380158214a577586dafae821e72a578))
68
+ * entity storage enhancements ([#86](https://github.com/iotaledger/twin-entity-storage/issues/86)) ([1279af4](https://github.com/iotaledger/twin-entity-storage/commit/1279af42615c6497bb06539842cee44842dd1f75))
69
+ * eslint migration to flat config ([f033b64](https://github.com/iotaledger/twin-entity-storage/commit/f033b64984c0e6a8129d929c9dd816dcc1b8dab0))
70
+ * typescript 6 update ([995a0c6](https://github.com/iotaledger/twin-entity-storage/commit/995a0c6fa9a6813bfdc7200779ce3664236e59e9))
71
+ * update dependencies ([7ccc0c4](https://github.com/iotaledger/twin-entity-storage/commit/7ccc0c429125d073dc60b3de6cf101abc8cc6cba))
72
+ * update framework core ([b59a380](https://github.com/iotaledger/twin-entity-storage/commit/b59a380bb7fba2b43610f69074dcdee24a4737da))
73
+ * use shared store mechanism ([#34](https://github.com/iotaledger/twin-entity-storage/issues/34)) ([68b6b71](https://github.com/iotaledger/twin-entity-storage/commit/68b6b71e7a96d7d016cd57bfff36775b56bf3f93))
74
+
75
+
76
+ ### Bug Fixes
77
+
78
+ * query params force coercion ([dd6aa87](https://github.com/iotaledger/twin-entity-storage/commit/dd6aa87efdfb60bab7d6756a86888863c45c51a7))
79
+
80
+
81
+ ### Dependencies
82
+
83
+ * The following workspace dependencies were updated
84
+ * dependencies
85
+ * @twin.org/entity-storage-models bumped from 0.0.3-next.17 to 0.0.3-next.18
86
+
87
+ ## [0.0.3-next.17](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.16...entity-storage-rest-client-v0.0.3-next.17) (2026-06-01)
88
+
89
+
90
+ ### Miscellaneous Chores
91
+
92
+ * **entity-storage-rest-client:** Synchronize repo versions
93
+
94
+
95
+ ### Dependencies
96
+
97
+ * The following workspace dependencies were updated
98
+ * dependencies
99
+ * @twin.org/entity-storage-models bumped from 0.0.3-next.16 to 0.0.3-next.17
100
+
101
+ ## [0.0.3-next.16](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.15...entity-storage-rest-client-v0.0.3-next.16) (2026-05-20)
102
+
103
+
104
+ ### Miscellaneous Chores
105
+
106
+ * **entity-storage-rest-client:** Synchronize repo versions
107
+
108
+
109
+ ### Dependencies
110
+
111
+ * The following workspace dependencies were updated
112
+ * dependencies
113
+ * @twin.org/entity-storage-models bumped from 0.0.3-next.15 to 0.0.3-next.16
114
+
115
+ ## [0.0.3-next.15](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.14...entity-storage-rest-client-v0.0.3-next.15) (2026-05-19)
116
+
117
+
118
+ ### Miscellaneous Chores
119
+
120
+ * **entity-storage-rest-client:** Synchronize repo versions
121
+
122
+
123
+ ### Dependencies
124
+
125
+ * The following workspace dependencies were updated
126
+ * dependencies
127
+ * @twin.org/entity-storage-models bumped from 0.0.3-next.14 to 0.0.3-next.15
128
+
129
+ ## [0.0.3-next.14](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.13...entity-storage-rest-client-v0.0.3-next.14) (2026-05-19)
130
+
131
+
132
+ ### Features
133
+
134
+ * adding schema migration functionality to all the connectors ([#85](https://github.com/iotaledger/twin-entity-storage/issues/85)) ([fd1555a](https://github.com/iotaledger/twin-entity-storage/commit/fd1555a34380158214a577586dafae821e72a578))
135
+
136
+
137
+ ### Dependencies
138
+
139
+ * The following workspace dependencies were updated
140
+ * dependencies
141
+ * @twin.org/entity-storage-models bumped from 0.0.3-next.13 to 0.0.3-next.14
142
+
143
+ ## [0.0.3-next.13](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.12...entity-storage-rest-client-v0.0.3-next.13) (2026-05-13)
144
+
145
+
146
+ ### Miscellaneous Chores
147
+
148
+ * **entity-storage-rest-client:** Synchronize repo versions
149
+
150
+
151
+ ### Dependencies
152
+
153
+ * The following workspace dependencies were updated
154
+ * dependencies
155
+ * @twin.org/entity-storage-models bumped from 0.0.3-next.12 to 0.0.3-next.13
156
+
157
+ ## [0.0.3-next.12](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.11...entity-storage-rest-client-v0.0.3-next.12) (2026-05-11)
158
+
159
+
160
+ ### Features
161
+
162
+ * typescript 6 update ([995a0c6](https://github.com/iotaledger/twin-entity-storage/commit/995a0c6fa9a6813bfdc7200779ce3664236e59e9))
163
+
164
+
165
+ ### Dependencies
166
+
167
+ * The following workspace dependencies were updated
168
+ * dependencies
169
+ * @twin.org/entity-storage-models bumped from 0.0.3-next.11 to 0.0.3-next.12
170
+
171
+ ## [0.0.3-next.11](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.10...entity-storage-rest-client-v0.0.3-next.11) (2026-05-07)
172
+
173
+
174
+ ### Miscellaneous Chores
175
+
176
+ * **entity-storage-rest-client:** Synchronize repo versions
177
+
178
+
179
+ ### Dependencies
180
+
181
+ * The following workspace dependencies were updated
182
+ * dependencies
183
+ * @twin.org/entity-storage-models bumped from 0.0.3-next.10 to 0.0.3-next.11
184
+
185
+ ## [0.0.3-next.10](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.9...entity-storage-rest-client-v0.0.3-next.10) (2026-05-07)
186
+
187
+
188
+ ### Features
189
+
190
+ * entity storage enhancements ([#86](https://github.com/iotaledger/twin-entity-storage/issues/86)) ([1279af4](https://github.com/iotaledger/twin-entity-storage/commit/1279af42615c6497bb06539842cee44842dd1f75))
191
+
192
+
193
+ ### Dependencies
194
+
195
+ * The following workspace dependencies were updated
196
+ * dependencies
197
+ * @twin.org/entity-storage-models bumped from 0.0.3-next.9 to 0.0.3-next.10
198
+
199
+ ## [0.0.3-next.9](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.8...entity-storage-rest-client-v0.0.3-next.9) (2026-04-22)
200
+
201
+
202
+ ### Miscellaneous Chores
203
+
204
+ * **entity-storage-rest-client:** Synchronize repo versions
205
+
206
+
207
+ ### Dependencies
208
+
209
+ * The following workspace dependencies were updated
210
+ * dependencies
211
+ * @twin.org/entity-storage-models bumped from 0.0.3-next.8 to 0.0.3-next.9
212
+
213
+ ## [0.0.3-next.8](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.7...entity-storage-rest-client-v0.0.3-next.8) (2026-03-20)
214
+
215
+
216
+ ### Miscellaneous Chores
217
+
218
+ * **entity-storage-rest-client:** Synchronize repo versions
219
+
220
+
221
+ ### Dependencies
222
+
223
+ * The following workspace dependencies were updated
224
+ * dependencies
225
+ * @twin.org/entity-storage-models bumped from 0.0.3-next.7 to 0.0.3-next.8
226
+
227
+ ## [0.0.3-next.7](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.6...entity-storage-rest-client-v0.0.3-next.7) (2026-03-13)
228
+
229
+
230
+ ### Miscellaneous Chores
231
+
232
+ * **entity-storage-rest-client:** Synchronize repo versions
233
+
234
+
235
+ ### Dependencies
236
+
237
+ * The following workspace dependencies were updated
238
+ * dependencies
239
+ * @twin.org/entity-storage-models bumped from 0.0.3-next.6 to 0.0.3-next.7
240
+
241
+ ## [0.0.3-next.6](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.5...entity-storage-rest-client-v0.0.3-next.6) (2026-01-21)
242
+
243
+
244
+ ### Miscellaneous Chores
245
+
246
+ * **entity-storage-rest-client:** Synchronize repo versions
247
+
248
+
249
+ ### Dependencies
250
+
251
+ * The following workspace dependencies were updated
252
+ * dependencies
253
+ * @twin.org/entity-storage-models bumped from 0.0.3-next.5 to 0.0.3-next.6
254
+
255
+ ## [0.0.3-next.5](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.4...entity-storage-rest-client-v0.0.3-next.5) (2026-01-06)
256
+
257
+
258
+ ### Miscellaneous Chores
259
+
260
+ * **entity-storage-rest-client:** Synchronize repo versions
261
+
262
+
263
+ ### Dependencies
264
+
265
+ * The following workspace dependencies were updated
266
+ * dependencies
267
+ * @twin.org/entity-storage-models bumped from 0.0.3-next.4 to 0.0.3-next.5
268
+
269
+ ## [0.0.3-next.4](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.3...entity-storage-rest-client-v0.0.3-next.4) (2025-12-03)
270
+
271
+
272
+ ### Miscellaneous Chores
273
+
274
+ * **entity-storage-rest-client:** Synchronize repo versions
275
+
276
+
277
+ ### Dependencies
278
+
279
+ * The following workspace dependencies were updated
280
+ * dependencies
281
+ * @twin.org/entity-storage-models bumped from 0.0.3-next.3 to 0.0.3-next.4
282
+
283
+ ## [0.0.3-next.3](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.2...entity-storage-rest-client-v0.0.3-next.3) (2025-11-26)
284
+
285
+
286
+ ### Miscellaneous Chores
287
+
288
+ * **entity-storage-rest-client:** Synchronize repo versions
289
+
290
+
291
+ ### Dependencies
292
+
293
+ * The following workspace dependencies were updated
294
+ * dependencies
295
+ * @twin.org/entity-storage-models bumped from 0.0.3-next.2 to 0.0.3-next.3
296
+
297
+ ## [0.0.3-next.2](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.1...entity-storage-rest-client-v0.0.3-next.2) (2025-11-13)
4
298
 
5
299
 
6
300
  ### Miscellaneous Chores
@@ -14,23 +308,23 @@
14
308
  * dependencies
15
309
  * @twin.org/entity-storage-models bumped from 0.0.3-next.1 to 0.0.3-next.2
16
310
 
17
- ## [0.0.3-next.1](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.3-next.0...entity-storage-rest-client-v0.0.3-next.1) (2025-11-10)
311
+ ## [0.0.3-next.1](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.3-next.0...entity-storage-rest-client-v0.0.3-next.1) (2025-11-10)
18
312
 
19
313
 
20
314
  ### Features
21
315
 
22
- * add context id features ([#55](https://github.com/twinfoundation/entity-storage/issues/55)) ([99c15a2](https://github.com/twinfoundation/entity-storage/commit/99c15a257539b61d9da63649ce573ebf47699fc9))
23
- * add production release automation ([1eb4c8e](https://github.com/twinfoundation/entity-storage/commit/1eb4c8ee3eb099defdfc2d063ae44935276dcae8))
24
- * add validate-locales ([e66ef0d](https://github.com/twinfoundation/entity-storage/commit/e66ef0de26ca2f82b3fe89bb5c7a15a0978a9644))
25
- * eslint migration to flat config ([f033b64](https://github.com/twinfoundation/entity-storage/commit/f033b64984c0e6a8129d929c9dd816dcc1b8dab0))
26
- * update dependencies ([7ccc0c4](https://github.com/twinfoundation/entity-storage/commit/7ccc0c429125d073dc60b3de6cf101abc8cc6cba))
27
- * update framework core ([b59a380](https://github.com/twinfoundation/entity-storage/commit/b59a380bb7fba2b43610f69074dcdee24a4737da))
28
- * use shared store mechanism ([#34](https://github.com/twinfoundation/entity-storage/issues/34)) ([68b6b71](https://github.com/twinfoundation/entity-storage/commit/68b6b71e7a96d7d016cd57bfff36775b56bf3f93))
316
+ * add context id features ([#55](https://github.com/iotaledger/twin-entity-storage/issues/55)) ([99c15a2](https://github.com/iotaledger/twin-entity-storage/commit/99c15a257539b61d9da63649ce573ebf47699fc9))
317
+ * add production release automation ([1eb4c8e](https://github.com/iotaledger/twin-entity-storage/commit/1eb4c8ee3eb099defdfc2d063ae44935276dcae8))
318
+ * add validate-locales ([e66ef0d](https://github.com/iotaledger/twin-entity-storage/commit/e66ef0de26ca2f82b3fe89bb5c7a15a0978a9644))
319
+ * eslint migration to flat config ([f033b64](https://github.com/iotaledger/twin-entity-storage/commit/f033b64984c0e6a8129d929c9dd816dcc1b8dab0))
320
+ * update dependencies ([7ccc0c4](https://github.com/iotaledger/twin-entity-storage/commit/7ccc0c429125d073dc60b3de6cf101abc8cc6cba))
321
+ * update framework core ([b59a380](https://github.com/iotaledger/twin-entity-storage/commit/b59a380bb7fba2b43610f69074dcdee24a4737da))
322
+ * use shared store mechanism ([#34](https://github.com/iotaledger/twin-entity-storage/issues/34)) ([68b6b71](https://github.com/iotaledger/twin-entity-storage/commit/68b6b71e7a96d7d016cd57bfff36775b56bf3f93))
29
323
 
30
324
 
31
325
  ### Bug Fixes
32
326
 
33
- * query params force coercion ([dd6aa87](https://github.com/twinfoundation/entity-storage/commit/dd6aa87efdfb60bab7d6756a86888863c45c51a7))
327
+ * query params force coercion ([dd6aa87](https://github.com/iotaledger/twin-entity-storage/commit/dd6aa87efdfb60bab7d6756a86888863c45c51a7))
34
328
 
35
329
 
36
330
  ### Dependencies
@@ -39,12 +333,12 @@
39
333
  * dependencies
40
334
  * @twin.org/entity-storage-models bumped from 0.0.3-next.0 to 0.0.3-next.1
41
335
 
42
- ## [0.0.2-next.10](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.2-next.9...entity-storage-rest-client-v0.0.2-next.10) (2025-10-09)
336
+ ## [0.0.2-next.10](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.2-next.9...entity-storage-rest-client-v0.0.2-next.10) (2025-10-09)
43
337
 
44
338
 
45
339
  ### Features
46
340
 
47
- * add validate-locales ([e66ef0d](https://github.com/twinfoundation/entity-storage/commit/e66ef0de26ca2f82b3fe89bb5c7a15a0978a9644))
341
+ * add validate-locales ([e66ef0d](https://github.com/iotaledger/twin-entity-storage/commit/e66ef0de26ca2f82b3fe89bb5c7a15a0978a9644))
48
342
 
49
343
 
50
344
  ### Dependencies
@@ -53,7 +347,7 @@
53
347
  * dependencies
54
348
  * @twin.org/entity-storage-models bumped from 0.0.2-next.9 to 0.0.2-next.10
55
349
 
56
- ## [0.0.2-next.9](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.2-next.8...entity-storage-rest-client-v0.0.2-next.9) (2025-10-02)
350
+ ## [0.0.2-next.9](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.2-next.8...entity-storage-rest-client-v0.0.2-next.9) (2025-10-02)
57
351
 
58
352
 
59
353
  ### Miscellaneous Chores
@@ -67,12 +361,12 @@
67
361
  * dependencies
68
362
  * @twin.org/entity-storage-models bumped from 0.0.2-next.8 to 0.0.2-next.9
69
363
 
70
- ## [0.0.2-next.8](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.2-next.7...entity-storage-rest-client-v0.0.2-next.8) (2025-08-29)
364
+ ## [0.0.2-next.8](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.2-next.7...entity-storage-rest-client-v0.0.2-next.8) (2025-08-29)
71
365
 
72
366
 
73
367
  ### Features
74
368
 
75
- * eslint migration to flat config ([f033b64](https://github.com/twinfoundation/entity-storage/commit/f033b64984c0e6a8129d929c9dd816dcc1b8dab0))
369
+ * eslint migration to flat config ([f033b64](https://github.com/iotaledger/twin-entity-storage/commit/f033b64984c0e6a8129d929c9dd816dcc1b8dab0))
76
370
 
77
371
 
78
372
  ### Dependencies
@@ -81,7 +375,7 @@
81
375
  * dependencies
82
376
  * @twin.org/entity-storage-models bumped from 0.0.2-next.7 to 0.0.2-next.8
83
377
 
84
- ## [0.0.2-next.7](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.2-next.6...entity-storage-rest-client-v0.0.2-next.7) (2025-08-20)
378
+ ## [0.0.2-next.7](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.2-next.6...entity-storage-rest-client-v0.0.2-next.7) (2025-08-20)
85
379
 
86
380
 
87
381
  ### Miscellaneous Chores
@@ -95,12 +389,12 @@
95
389
  * dependencies
96
390
  * @twin.org/entity-storage-models bumped from 0.0.2-next.6 to 0.0.2-next.7
97
391
 
98
- ## [0.0.2-next.6](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.2-next.5...entity-storage-rest-client-v0.0.2-next.6) (2025-08-19)
392
+ ## [0.0.2-next.6](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.2-next.5...entity-storage-rest-client-v0.0.2-next.6) (2025-08-19)
99
393
 
100
394
 
101
395
  ### Features
102
396
 
103
- * update framework core ([b59a380](https://github.com/twinfoundation/entity-storage/commit/b59a380bb7fba2b43610f69074dcdee24a4737da))
397
+ * update framework core ([b59a380](https://github.com/iotaledger/twin-entity-storage/commit/b59a380bb7fba2b43610f69074dcdee24a4737da))
104
398
 
105
399
 
106
400
  ### Dependencies
@@ -109,7 +403,7 @@
109
403
  * dependencies
110
404
  * @twin.org/entity-storage-models bumped from 0.0.2-next.5 to 0.0.2-next.6
111
405
 
112
- ## [0.0.2-next.5](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.2-next.4...entity-storage-rest-client-v0.0.2-next.5) (2025-08-11)
406
+ ## [0.0.2-next.5](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.2-next.4...entity-storage-rest-client-v0.0.2-next.5) (2025-08-11)
113
407
 
114
408
 
115
409
  ### Miscellaneous Chores
@@ -123,7 +417,7 @@
123
417
  * dependencies
124
418
  * @twin.org/entity-storage-models bumped from 0.0.2-next.4 to 0.0.2-next.5
125
419
 
126
- ## [0.0.2-next.4](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.2-next.3...entity-storage-rest-client-v0.0.2-next.4) (2025-08-08)
420
+ ## [0.0.2-next.4](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.2-next.3...entity-storage-rest-client-v0.0.2-next.4) (2025-08-08)
127
421
 
128
422
 
129
423
  ### Miscellaneous Chores
@@ -137,7 +431,7 @@
137
431
  * dependencies
138
432
  * @twin.org/entity-storage-models bumped from 0.0.2-next.3 to 0.0.2-next.4
139
433
 
140
- ## [0.0.2-next.3](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.2-next.2...entity-storage-rest-client-v0.0.2-next.3) (2025-07-25)
434
+ ## [0.0.2-next.3](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.2-next.2...entity-storage-rest-client-v0.0.2-next.3) (2025-07-25)
141
435
 
142
436
 
143
437
  ### Miscellaneous Chores
@@ -151,7 +445,7 @@
151
445
  * dependencies
152
446
  * @twin.org/entity-storage-models bumped from 0.0.2-next.2 to 0.0.2-next.3
153
447
 
154
- ## [0.0.2-next.2](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.2-next.1...entity-storage-rest-client-v0.0.2-next.2) (2025-07-24)
448
+ ## [0.0.2-next.2](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.2-next.1...entity-storage-rest-client-v0.0.2-next.2) (2025-07-24)
155
449
 
156
450
 
157
451
  ### Miscellaneous Chores
@@ -165,19 +459,19 @@
165
459
  * dependencies
166
460
  * @twin.org/entity-storage-models bumped from 0.0.2-next.1 to 0.0.2-next.2
167
461
 
168
- ## [0.0.2-next.1](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.2-next.0...entity-storage-rest-client-v0.0.2-next.1) (2025-07-17)
462
+ ## [0.0.2-next.1](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.2-next.0...entity-storage-rest-client-v0.0.2-next.1) (2025-07-17)
169
463
 
170
464
 
171
465
  ### Features
172
466
 
173
- * add production release automation ([1eb4c8e](https://github.com/twinfoundation/entity-storage/commit/1eb4c8ee3eb099defdfc2d063ae44935276dcae8))
174
- * update dependencies ([7ccc0c4](https://github.com/twinfoundation/entity-storage/commit/7ccc0c429125d073dc60b3de6cf101abc8cc6cba))
175
- * use shared store mechanism ([#34](https://github.com/twinfoundation/entity-storage/issues/34)) ([68b6b71](https://github.com/twinfoundation/entity-storage/commit/68b6b71e7a96d7d016cd57bfff36775b56bf3f93))
467
+ * add production release automation ([1eb4c8e](https://github.com/iotaledger/twin-entity-storage/commit/1eb4c8ee3eb099defdfc2d063ae44935276dcae8))
468
+ * update dependencies ([7ccc0c4](https://github.com/iotaledger/twin-entity-storage/commit/7ccc0c429125d073dc60b3de6cf101abc8cc6cba))
469
+ * use shared store mechanism ([#34](https://github.com/iotaledger/twin-entity-storage/issues/34)) ([68b6b71](https://github.com/iotaledger/twin-entity-storage/commit/68b6b71e7a96d7d016cd57bfff36775b56bf3f93))
176
470
 
177
471
 
178
472
  ### Bug Fixes
179
473
 
180
- * query params force coercion ([dd6aa87](https://github.com/twinfoundation/entity-storage/commit/dd6aa87efdfb60bab7d6756a86888863c45c51a7))
474
+ * query params force coercion ([dd6aa87](https://github.com/iotaledger/twin-entity-storage/commit/dd6aa87efdfb60bab7d6756a86888863c45c51a7))
181
475
 
182
476
 
183
477
  ### Dependencies
@@ -191,15 +485,15 @@
191
485
 
192
486
  ### Features
193
487
 
194
- * add production release automation ([1eb4c8e](https://github.com/twinfoundation/entity-storage/commit/1eb4c8ee3eb099defdfc2d063ae44935276dcae8))
195
- * release to production ([a309051](https://github.com/twinfoundation/entity-storage/commit/a3090519adebf7943232b4df12e4c6bd5afe7eed))
196
- * update dependencies ([7ccc0c4](https://github.com/twinfoundation/entity-storage/commit/7ccc0c429125d073dc60b3de6cf101abc8cc6cba))
197
- * use shared store mechanism ([#34](https://github.com/twinfoundation/entity-storage/issues/34)) ([68b6b71](https://github.com/twinfoundation/entity-storage/commit/68b6b71e7a96d7d016cd57bfff36775b56bf3f93))
488
+ * add production release automation ([1eb4c8e](https://github.com/iotaledger/twin-entity-storage/commit/1eb4c8ee3eb099defdfc2d063ae44935276dcae8))
489
+ * release to production ([a309051](https://github.com/iotaledger/twin-entity-storage/commit/a3090519adebf7943232b4df12e4c6bd5afe7eed))
490
+ * update dependencies ([7ccc0c4](https://github.com/iotaledger/twin-entity-storage/commit/7ccc0c429125d073dc60b3de6cf101abc8cc6cba))
491
+ * use shared store mechanism ([#34](https://github.com/iotaledger/twin-entity-storage/issues/34)) ([68b6b71](https://github.com/iotaledger/twin-entity-storage/commit/68b6b71e7a96d7d016cd57bfff36775b56bf3f93))
198
492
 
199
493
 
200
494
  ### Bug Fixes
201
495
 
202
- * query params force coercion ([dd6aa87](https://github.com/twinfoundation/entity-storage/commit/dd6aa87efdfb60bab7d6756a86888863c45c51a7))
496
+ * query params force coercion ([dd6aa87](https://github.com/iotaledger/twin-entity-storage/commit/dd6aa87efdfb60bab7d6756a86888863c45c51a7))
203
497
 
204
498
 
205
499
  ### Dependencies
@@ -208,12 +502,12 @@
208
502
  * dependencies
209
503
  * @twin.org/entity-storage-models bumped from ^0.0.0 to ^0.0.1
210
504
 
211
- ## [0.0.1-next.31](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.1-next.30...entity-storage-rest-client-v0.0.1-next.31) (2025-06-20)
505
+ ## [0.0.1-next.31](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.1-next.30...entity-storage-rest-client-v0.0.1-next.31) (2025-06-20)
212
506
 
213
507
 
214
508
  ### Bug Fixes
215
509
 
216
- * query params force coercion ([dd6aa87](https://github.com/twinfoundation/entity-storage/commit/dd6aa87efdfb60bab7d6756a86888863c45c51a7))
510
+ * query params force coercion ([dd6aa87](https://github.com/iotaledger/twin-entity-storage/commit/dd6aa87efdfb60bab7d6756a86888863c45c51a7))
217
511
 
218
512
 
219
513
  ### Dependencies
@@ -222,12 +516,12 @@
222
516
  * dependencies
223
517
  * @twin.org/entity-storage-models bumped from 0.0.1-next.30 to 0.0.1-next.31
224
518
 
225
- ## [0.0.1-next.30](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.1-next.29...entity-storage-rest-client-v0.0.1-next.30) (2025-06-12)
519
+ ## [0.0.1-next.30](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.1-next.29...entity-storage-rest-client-v0.0.1-next.30) (2025-06-12)
226
520
 
227
521
 
228
522
  ### Features
229
523
 
230
- * update dependencies ([7ccc0c4](https://github.com/twinfoundation/entity-storage/commit/7ccc0c429125d073dc60b3de6cf101abc8cc6cba))
524
+ * update dependencies ([7ccc0c4](https://github.com/iotaledger/twin-entity-storage/commit/7ccc0c429125d073dc60b3de6cf101abc8cc6cba))
231
525
 
232
526
 
233
527
  ### Dependencies
@@ -236,12 +530,12 @@
236
530
  * dependencies
237
531
  * @twin.org/entity-storage-models bumped from 0.0.1-next.29 to 0.0.1-next.30
238
532
 
239
- ## [0.0.1-next.29](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.1-next.28...entity-storage-rest-client-v0.0.1-next.29) (2025-04-17)
533
+ ## [0.0.1-next.29](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.1-next.28...entity-storage-rest-client-v0.0.1-next.29) (2025-04-17)
240
534
 
241
535
 
242
536
  ### Features
243
537
 
244
- * use shared store mechanism ([#34](https://github.com/twinfoundation/entity-storage/issues/34)) ([68b6b71](https://github.com/twinfoundation/entity-storage/commit/68b6b71e7a96d7d016cd57bfff36775b56bf3f93))
538
+ * use shared store mechanism ([#34](https://github.com/iotaledger/twin-entity-storage/issues/34)) ([68b6b71](https://github.com/iotaledger/twin-entity-storage/commit/68b6b71e7a96d7d016cd57bfff36775b56bf3f93))
245
539
 
246
540
 
247
541
  ### Dependencies
@@ -250,7 +544,7 @@
250
544
  * dependencies
251
545
  * @twin.org/entity-storage-models bumped from 0.0.1-next.28 to 0.0.1-next.29
252
546
 
253
- ## [0.0.1-next.28](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.1-next.27...entity-storage-rest-client-v0.0.1-next.28) (2025-04-09)
547
+ ## [0.0.1-next.28](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.1-next.27...entity-storage-rest-client-v0.0.1-next.28) (2025-04-09)
254
548
 
255
549
 
256
550
  ### Miscellaneous Chores
@@ -264,7 +558,7 @@
264
558
  * dependencies
265
559
  * @twin.org/entity-storage-models bumped from 0.0.1-next.27 to 0.0.1-next.28
266
560
 
267
- ## [0.0.1-next.27](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.1-next.26...entity-storage-rest-client-v0.0.1-next.27) (2025-03-28)
561
+ ## [0.0.1-next.27](https://github.com/iotaledger/twin-entity-storage/compare/entity-storage-rest-client-v0.0.1-next.26...entity-storage-rest-client-v0.0.1-next.27) (2025-03-28)
268
562
 
269
563
 
270
564
  ### Miscellaneous Chores
package/docs/examples.md CHANGED
@@ -1 +1,60 @@
1
- # @twin.org/entity-storage-rest-client - Examples
1
+ # Entity Storage REST Client Examples
2
+
3
+ These snippets show how to call the REST endpoints with typed payloads and how to shape filtered list requests.
4
+
5
+ ## EntityStorageRestClient
6
+
7
+ ```typescript
8
+ import { EntityStorageRestClient } from '@twin.org/entity-storage-rest-client';
9
+ import {
10
+ ComparisonOperator,
11
+ LogicalOperator,
12
+ SortDirection,
13
+ type EntityCondition
14
+ } from '@twin.org/entity';
15
+
16
+ interface Profile {
17
+ id: string;
18
+ email: string;
19
+ status: 'active' | 'inactive';
20
+ createdAt: string;
21
+ }
22
+
23
+ const client = new EntityStorageRestClient<Profile>({
24
+ endpoint: 'http://localhost:8080'
25
+ });
26
+
27
+ const className = client.className();
28
+
29
+ await client.set({
30
+ id: 'profile-1',
31
+ email: 'ada@example.com',
32
+ status: 'active',
33
+ createdAt: '2026-03-09T10:30:00.000Z'
34
+ });
35
+
36
+ const byPrimaryKey = await client.get('profile-1');
37
+ const bySecondaryIndex = await client.get('ada@example.com', 'email');
38
+
39
+ const activeCondition: EntityCondition<Profile> = {
40
+ logicalOperator: LogicalOperator.And,
41
+ conditions: [
42
+ {
43
+ property: 'status',
44
+ comparison: ComparisonOperator.Equals,
45
+ value: 'active'
46
+ }
47
+ ]
48
+ };
49
+
50
+ const result = await client.query(
51
+ activeCondition,
52
+ 'createdAt',
53
+ SortDirection.Descending,
54
+ ['id', 'email', 'status'],
55
+ undefined,
56
+ 25
57
+ );
58
+
59
+ await client.remove('profile-1');
60
+ ```
@@ -42,7 +42,7 @@ The configuration for the client.
42
42
 
43
43
  ## Properties
44
44
 
45
- ### CLASS\_NAME
45
+ ### CLASS\_NAME {#class_name}
46
46
 
47
47
  > `readonly` `static` **CLASS\_NAME**: `string`
48
48
 
@@ -50,7 +50,7 @@ Runtime name for the class.
50
50
 
51
51
  ## Methods
52
52
 
53
- ### className()
53
+ ### className() {#classname}
54
54
 
55
55
  > **className**(): `string`
56
56
 
@@ -68,9 +68,9 @@ The class name of the component.
68
68
 
69
69
  ***
70
70
 
71
- ### set()
71
+ ### set() {#set}
72
72
 
73
- > **set**(`entity`): `Promise`\<`void`\>
73
+ > **set**(`entity`, `conditions?`): `Promise`\<`void`\>
74
74
 
75
75
  Set an entity.
76
76
 
@@ -82,6 +82,12 @@ Set an entity.
82
82
 
83
83
  The entity to set.
84
84
 
85
+ ##### conditions?
86
+
87
+ `object`[]
88
+
89
+ The optional conditions to match for the entities.
90
+
85
91
  #### Returns
86
92
 
87
93
  `Promise`\<`void`\>
@@ -94,9 +100,35 @@ The id of the entity.
94
100
 
95
101
  ***
96
102
 
97
- ### get()
103
+ ### setBatch() {#setbatch}
104
+
105
+ > **setBatch**(`entities`): `Promise`\<`void`\>
106
+
107
+ Set multiple entities in a batch.
108
+
109
+ #### Parameters
110
+
111
+ ##### entities
112
+
113
+ `T`[]
114
+
115
+ The entities to set.
116
+
117
+ #### Returns
118
+
119
+ `Promise`\<`void`\>
120
+
121
+ Nothing.
122
+
123
+ #### Implementation of
124
+
125
+ `IEntityStorageComponent.setBatch`
126
+
127
+ ***
128
+
129
+ ### get() {#get}
98
130
 
99
- > **get**(`id`, `secondaryIndex?`): `Promise`\<`T` \| `undefined`\>
131
+ > **get**(`id`, `secondaryIndex?`, `conditions?`): `Promise`\<`T` \| `undefined`\>
100
132
 
101
133
  Get an entity.
102
134
 
@@ -114,6 +146,12 @@ keyof `T`
114
146
 
115
147
  Get the item using a secondary index.
116
148
 
149
+ ##### conditions?
150
+
151
+ `object`[]
152
+
153
+ The optional conditions to match for the entities.
154
+
117
155
  #### Returns
118
156
 
119
157
  `Promise`\<`T` \| `undefined`\>
@@ -126,9 +164,9 @@ The object if it can be found or undefined.
126
164
 
127
165
  ***
128
166
 
129
- ### remove()
167
+ ### remove() {#remove}
130
168
 
131
- > **remove**(`id`): `Promise`\<`void`\>
169
+ > **remove**(`id`, `conditions?`): `Promise`\<`void`\>
132
170
 
133
171
  Remove the entity.
134
172
 
@@ -140,6 +178,12 @@ Remove the entity.
140
178
 
141
179
  The id of the entity to remove.
142
180
 
181
+ ##### conditions?
182
+
183
+ `object`[]
184
+
185
+ The optional conditions to match for the entities.
186
+
143
187
  #### Returns
144
188
 
145
189
  `Promise`\<`void`\>
@@ -152,7 +196,77 @@ Nothing.
152
196
 
153
197
  ***
154
198
 
155
- ### query()
199
+ ### removeBatch() {#removebatch}
200
+
201
+ > **removeBatch**(`ids`): `Promise`\<`void`\>
202
+
203
+ Remove multiple entities by id.
204
+
205
+ #### Parameters
206
+
207
+ ##### ids
208
+
209
+ `string`[]
210
+
211
+ The ids of the entities to remove.
212
+
213
+ #### Returns
214
+
215
+ `Promise`\<`void`\>
216
+
217
+ Nothing.
218
+
219
+ #### Implementation of
220
+
221
+ `IEntityStorageComponent.removeBatch`
222
+
223
+ ***
224
+
225
+ ### empty() {#empty}
226
+
227
+ > **empty**(): `Promise`\<`void`\>
228
+
229
+ Remove all entities from the storage.
230
+
231
+ #### Returns
232
+
233
+ `Promise`\<`void`\>
234
+
235
+ Nothing.
236
+
237
+ #### Implementation of
238
+
239
+ `IEntityStorageComponent.empty`
240
+
241
+ ***
242
+
243
+ ### count() {#count}
244
+
245
+ > **count**(`conditions?`): `Promise`\<`number`\>
246
+
247
+ Count all the entities which match the conditions.
248
+
249
+ #### Parameters
250
+
251
+ ##### conditions?
252
+
253
+ `EntityCondition`\<`T`\>
254
+
255
+ The optional conditions to match for the entities.
256
+
257
+ #### Returns
258
+
259
+ `Promise`\<`number`\>
260
+
261
+ The total count of entities in the storage.
262
+
263
+ #### Implementation of
264
+
265
+ `IEntityStorageComponent.count`
266
+
267
+ ***
268
+
269
+ ### query() {#query}
156
270
 
157
271
  > **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
158
272
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@twin.org/entity-storage-rest-client",
3
- "version": "0.0.3-next.2",
4
- "description": "Entity Storage contract implementation which can connect to REST endpoints",
3
+ "version": "0.0.3-next.20",
4
+ "description": "REST client for calling storage services from applications and tools.",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/twinfoundation/entity-storage.git",
7
+ "url": "git+https://github.com/iotaledger/twin-entity-storage.git",
8
8
  "directory": "packages/entity-storage-rest-client"
9
9
  },
10
10
  "author": "martyn.janes@iota.org",
@@ -18,7 +18,7 @@
18
18
  "@twin.org/api-models": "next",
19
19
  "@twin.org/core": "next",
20
20
  "@twin.org/entity": "next",
21
- "@twin.org/entity-storage-models": "0.0.3-next.2",
21
+ "@twin.org/entity-storage-models": "0.0.3-next.20",
22
22
  "@twin.org/nameof": "next",
23
23
  "@twin.org/web": "next"
24
24
  },
@@ -51,7 +51,7 @@
51
51
  "database"
52
52
  ],
53
53
  "bugs": {
54
- "url": "git+https://github.com/twinfoundation/entity-storage/issues"
54
+ "url": "git+https://github.com/iotaledger/twin-entity-storage/issues"
55
55
  },
56
56
  "homepage": "https://twindev.org"
57
57
  }