@twin.org/entity-storage-rest-client 0.0.1-next.8 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,18 +66,20 @@ class EntityStorageClient extends apiCore.BaseRestClient {
66
66
  /**
67
67
  * Query all the entities which match the conditions.
68
68
  * @param conditions The conditions to match for the entities.
69
- * @param sortProperties The optional sort order.
69
+ * @param orderBy The order for the results.
70
+ * @param orderByDirection The direction for the order, defaults to ascending.
70
71
  * @param properties The optional properties to return, defaults to all.
71
72
  * @param cursor The cursor to request the next page of entities.
72
73
  * @param pageSize The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
73
74
  * @returns All the entities for the storage matching the conditions,
74
75
  * and a cursor which can be used to request more entities.
75
76
  */
76
- async query(conditions, sortProperties, properties, cursor, pageSize) {
77
+ async query(conditions, orderBy, orderByDirection, properties, cursor, pageSize) {
77
78
  const result = await this.fetch("/", "GET", {
78
79
  query: {
79
80
  conditions: apiModels.HttpParameterHelper.objectToString(conditions),
80
- sortProperties: apiModels.HttpParameterHelper.objectToString(sortProperties),
81
+ orderBy: orderBy,
82
+ orderByDirection,
81
83
  properties: apiModels.HttpParameterHelper.arrayToString(properties),
82
84
  pageSize,
83
85
  cursor
@@ -64,18 +64,20 @@ class EntityStorageClient extends BaseRestClient {
64
64
  /**
65
65
  * Query all the entities which match the conditions.
66
66
  * @param conditions The conditions to match for the entities.
67
- * @param sortProperties The optional sort order.
67
+ * @param orderBy The order for the results.
68
+ * @param orderByDirection The direction for the order, defaults to ascending.
68
69
  * @param properties The optional properties to return, defaults to all.
69
70
  * @param cursor The cursor to request the next page of entities.
70
71
  * @param pageSize The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
71
72
  * @returns All the entities for the storage matching the conditions,
72
73
  * and a cursor which can be used to request more entities.
73
74
  */
74
- async query(conditions, sortProperties, properties, cursor, pageSize) {
75
+ async query(conditions, orderBy, orderByDirection, properties, cursor, pageSize) {
75
76
  const result = await this.fetch("/", "GET", {
76
77
  query: {
77
78
  conditions: HttpParameterHelper.objectToString(conditions),
78
- sortProperties: HttpParameterHelper.objectToString(sortProperties),
79
+ orderBy: orderBy,
80
+ orderByDirection,
79
81
  properties: HttpParameterHelper.arrayToString(properties),
80
82
  pageSize,
81
83
  cursor
@@ -37,17 +37,15 @@ export declare class EntityStorageClient<T> extends BaseRestClient implements IE
37
37
  /**
38
38
  * Query all the entities which match the conditions.
39
39
  * @param conditions The conditions to match for the entities.
40
- * @param sortProperties The optional sort order.
40
+ * @param orderBy The order for the results.
41
+ * @param orderByDirection The direction for the order, defaults to ascending.
41
42
  * @param properties The optional properties to return, defaults to all.
42
43
  * @param cursor The cursor to request the next page of entities.
43
44
  * @param pageSize The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
44
45
  * @returns All the entities for the storage matching the conditions,
45
46
  * and a cursor which can be used to request more entities.
46
47
  */
47
- query(conditions?: EntityCondition<T>, sortProperties?: {
48
- property: keyof T;
49
- sortDirection: SortDirection;
50
- }[], properties?: (keyof T)[], cursor?: string, pageSize?: number): Promise<{
48
+ query(conditions?: EntityCondition<T>, orderBy?: keyof T, orderByDirection?: SortDirection, properties?: (keyof T)[], cursor?: string, pageSize?: number): Promise<{
51
49
  /**
52
50
  * The entities, which can be partial if a limited keys list was provided.
53
51
  */
package/docs/changelog.md CHANGED
@@ -1,5 +1,97 @@
1
1
  # @twin.org/entity-storage-rest-client - Changelog
2
2
 
3
- ## v0.0.1-next.10
3
+ ## 0.0.1 (2025-07-04)
4
+
5
+
6
+ ### Features
7
+
8
+ * add production release automation ([1eb4c8e](https://github.com/twinfoundation/entity-storage/commit/1eb4c8ee3eb099defdfc2d063ae44935276dcae8))
9
+ * release to production ([a309051](https://github.com/twinfoundation/entity-storage/commit/a3090519adebf7943232b4df12e4c6bd5afe7eed))
10
+ * update dependencies ([7ccc0c4](https://github.com/twinfoundation/entity-storage/commit/7ccc0c429125d073dc60b3de6cf101abc8cc6cba))
11
+ * use shared store mechanism ([#34](https://github.com/twinfoundation/entity-storage/issues/34)) ([68b6b71](https://github.com/twinfoundation/entity-storage/commit/68b6b71e7a96d7d016cd57bfff36775b56bf3f93))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * query params force coercion ([dd6aa87](https://github.com/twinfoundation/entity-storage/commit/dd6aa87efdfb60bab7d6756a86888863c45c51a7))
17
+
18
+
19
+ ### Dependencies
20
+
21
+ * The following workspace dependencies were updated
22
+ * dependencies
23
+ * @twin.org/entity-storage-models bumped from ^0.0.0 to ^0.0.1
24
+
25
+ ## [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)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * query params force coercion ([dd6aa87](https://github.com/twinfoundation/entity-storage/commit/dd6aa87efdfb60bab7d6756a86888863c45c51a7))
31
+
32
+
33
+ ### Dependencies
34
+
35
+ * The following workspace dependencies were updated
36
+ * dependencies
37
+ * @twin.org/entity-storage-models bumped from 0.0.1-next.30 to 0.0.1-next.31
38
+
39
+ ## [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)
40
+
41
+
42
+ ### Features
43
+
44
+ * update dependencies ([7ccc0c4](https://github.com/twinfoundation/entity-storage/commit/7ccc0c429125d073dc60b3de6cf101abc8cc6cba))
45
+
46
+
47
+ ### Dependencies
48
+
49
+ * The following workspace dependencies were updated
50
+ * dependencies
51
+ * @twin.org/entity-storage-models bumped from 0.0.1-next.29 to 0.0.1-next.30
52
+
53
+ ## [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)
54
+
55
+
56
+ ### Features
57
+
58
+ * use shared store mechanism ([#34](https://github.com/twinfoundation/entity-storage/issues/34)) ([68b6b71](https://github.com/twinfoundation/entity-storage/commit/68b6b71e7a96d7d016cd57bfff36775b56bf3f93))
59
+
60
+
61
+ ### Dependencies
62
+
63
+ * The following workspace dependencies were updated
64
+ * dependencies
65
+ * @twin.org/entity-storage-models bumped from 0.0.1-next.28 to 0.0.1-next.29
66
+
67
+ ## [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)
68
+
69
+
70
+ ### Miscellaneous Chores
71
+
72
+ * **entity-storage-rest-client:** Synchronize repo versions
73
+
74
+
75
+ ### Dependencies
76
+
77
+ * The following workspace dependencies were updated
78
+ * dependencies
79
+ * @twin.org/entity-storage-models bumped from 0.0.1-next.27 to 0.0.1-next.28
80
+
81
+ ## [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)
82
+
83
+
84
+ ### Miscellaneous Chores
85
+
86
+ * **entity-storage-rest-client:** Synchronize repo versions
87
+
88
+
89
+ ### Dependencies
90
+
91
+ * The following workspace dependencies were updated
92
+ * dependencies
93
+ * @twin.org/entity-storage-models bumped from 0.0.1-next.26 to 0.0.1-next.27
94
+
95
+ ## v0.0.1-next.26
4
96
 
5
97
  - Initial Release
@@ -8,7 +8,9 @@ Client for performing entity storage through to REST endpoints.
8
8
 
9
9
  ## Type Parameters
10
10
 
11
- **T**
11
+ ### T
12
+
13
+ `T`
12
14
 
13
15
  ## Implements
14
16
 
@@ -16,21 +18,23 @@ Client for performing entity storage through to REST endpoints.
16
18
 
17
19
  ## Constructors
18
20
 
19
- ### new EntityStorageClient()
21
+ ### Constructor
20
22
 
21
- > **new EntityStorageClient**\<`T`\>(`config`): [`EntityStorageClient`](EntityStorageClient.md)\<`T`\>
23
+ > **new EntityStorageClient**\<`T`\>(`config`): `EntityStorageClient`\<`T`\>
22
24
 
23
25
  Create a new instance of EntityStorageClient.
24
26
 
25
27
  #### Parameters
26
28
 
27
- **config**: `IBaseRestClientConfig`
29
+ ##### config
30
+
31
+ `IBaseRestClientConfig`
28
32
 
29
33
  The configuration for the client.
30
34
 
31
35
  #### Returns
32
36
 
33
- [`EntityStorageClient`](EntityStorageClient.md)\<`T`\>
37
+ `EntityStorageClient`\<`T`\>
34
38
 
35
39
  #### Overrides
36
40
 
@@ -58,7 +62,9 @@ Set an entity.
58
62
 
59
63
  #### Parameters
60
64
 
61
- **entity**: `T`
65
+ ##### entity
66
+
67
+ `T`
62
68
 
63
69
  The entity to set.
64
70
 
@@ -76,17 +82,21 @@ The id of the entity.
76
82
 
77
83
  ### get()
78
84
 
79
- > **get**(`id`, `secondaryIndex`?): `Promise`\<`undefined` \| `T`\>
85
+ > **get**(`id`, `secondaryIndex?`): `Promise`\<`undefined` \| `T`\>
80
86
 
81
87
  Get an entity.
82
88
 
83
89
  #### Parameters
84
90
 
85
- **id**: `string`
91
+ ##### id
92
+
93
+ `string`
86
94
 
87
95
  The id of the entity to get, or the index value if secondaryIndex is set.
88
96
 
89
- **secondaryIndex?**: keyof `T`
97
+ ##### secondaryIndex?
98
+
99
+ keyof `T`
90
100
 
91
101
  Get the item using a secondary index.
92
102
 
@@ -110,7 +120,9 @@ Remove the entity.
110
120
 
111
121
  #### Parameters
112
122
 
113
- **id**: `string`
123
+ ##### id
124
+
125
+ `string`
114
126
 
115
127
  The id of the entity to remove.
116
128
 
@@ -128,50 +140,54 @@ Nothing.
128
140
 
129
141
  ### query()
130
142
 
131
- > **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<`object`\>
143
+ > **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `pageSize?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
132
144
 
133
145
  Query all the entities which match the conditions.
134
146
 
135
147
  #### Parameters
136
148
 
137
- **conditions?**: `EntityCondition`\<`T`\>
149
+ ##### conditions?
150
+
151
+ `EntityCondition`\<`T`\>
138
152
 
139
153
  The conditions to match for the entities.
140
154
 
141
- **sortProperties?**: `object`[]
155
+ ##### orderBy?
142
156
 
143
- The optional sort order.
157
+ keyof `T`
144
158
 
145
- **properties?**: keyof `T`[]
159
+ The order for the results.
146
160
 
147
- The optional properties to return, defaults to all.
161
+ ##### orderByDirection?
148
162
 
149
- • **cursor?**: `string`
163
+ `SortDirection`
150
164
 
151
- The cursor to request the next page of entities.
165
+ The direction for the order, defaults to ascending.
152
166
 
153
- **pageSize?**: `number`
167
+ ##### properties?
154
168
 
155
- The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
169
+ keyof `T`[]
156
170
 
157
- #### Returns
171
+ The optional properties to return, defaults to all.
158
172
 
159
- `Promise`\<`object`\>
173
+ ##### cursor?
160
174
 
161
- All the entities for the storage matching the conditions,
162
- and a cursor which can be used to request more entities.
175
+ `string`
163
176
 
164
- ##### entities
177
+ The cursor to request the next page of entities.
165
178
 
166
- > **entities**: `Partial`\<`T`\>[]
179
+ ##### pageSize?
167
180
 
168
- The entities, which can be partial if a limited keys list was provided.
181
+ `number`
169
182
 
170
- ##### cursor?
183
+ The suggested number of entities to return in each chunk, in some scenarios can return a different amount.
184
+
185
+ #### Returns
171
186
 
172
- > `optional` **cursor**: `string`
187
+ `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
173
188
 
174
- An optional cursor, when defined can be used to call find to get more entities.
189
+ All the entities for the storage matching the conditions,
190
+ and a cursor which can be used to request more entities.
175
191
 
176
192
  #### Implementation of
177
193
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/entity-storage-rest-client",
3
- "version": "0.0.1-next.8",
3
+ "version": "0.0.1",
4
4
  "description": "Entity Storage contract implementation which can connect to REST endpoints",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,24 +14,24 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/api-core": "next",
18
- "@twin.org/api-models": "next",
19
- "@twin.org/core": "next",
20
- "@twin.org/entity": "next",
21
- "@twin.org/entity-storage-models": "0.0.1-next.8",
22
- "@twin.org/nameof": "next",
23
- "@twin.org/web": "next"
17
+ "@twin.org/api-core": "^0.0.1",
18
+ "@twin.org/api-models": "^0.0.1",
19
+ "@twin.org/core": "^0.0.1",
20
+ "@twin.org/entity": "^0.0.1",
21
+ "@twin.org/entity-storage-models": "^0.0.1",
22
+ "@twin.org/nameof": "^0.0.1",
23
+ "@twin.org/web": "^0.0.1"
24
24
  },
25
25
  "main": "./dist/cjs/index.cjs",
26
26
  "module": "./dist/esm/index.mjs",
27
27
  "types": "./dist/types/index.d.ts",
28
28
  "exports": {
29
29
  ".": {
30
+ "types": "./dist/types/index.d.ts",
30
31
  "require": "./dist/cjs/index.cjs",
31
- "import": "./dist/esm/index.mjs",
32
- "types": "./dist/types/index.d.ts"
32
+ "import": "./dist/esm/index.mjs"
33
33
  },
34
- "./locales": "./locales"
34
+ "./locales/*.json": "./locales/*.json"
35
35
  },
36
36
  "files": [
37
37
  "dist/cjs",