@twin.org/entity-storage-rest-client 0.0.3-next.13 → 0.0.3-next.14
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.
|
@@ -28,12 +28,16 @@ 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
|
+
}
|
|
37
41
|
});
|
|
38
42
|
}
|
|
39
43
|
/**
|
|
@@ -51,16 +55,18 @@ export class EntityStorageRestClient extends BaseRestClient {
|
|
|
51
55
|
* Get an entity.
|
|
52
56
|
* @param id The id of the entity to get, or the index value if secondaryIndex is set.
|
|
53
57
|
* @param secondaryIndex Get the item using a secondary index.
|
|
58
|
+
* @param conditions The optional conditions to match for the entities.
|
|
54
59
|
* @returns The object if it can be found or undefined.
|
|
55
60
|
*/
|
|
56
|
-
async get(id, secondaryIndex) {
|
|
61
|
+
async get(id, secondaryIndex, conditions) {
|
|
57
62
|
Guards.stringValue(EntityStorageRestClient.CLASS_NAME, "id", id);
|
|
58
63
|
const response = await this.fetch("/:id", "GET", {
|
|
59
64
|
pathParams: {
|
|
60
65
|
id
|
|
61
66
|
},
|
|
62
67
|
query: {
|
|
63
|
-
secondaryIndex: secondaryIndex
|
|
68
|
+
secondaryIndex: secondaryIndex,
|
|
69
|
+
conditions: HttpParameterHelper.objectToString(conditions)
|
|
64
70
|
}
|
|
65
71
|
});
|
|
66
72
|
return response.body;
|
|
@@ -68,13 +74,17 @@ export class EntityStorageRestClient extends BaseRestClient {
|
|
|
68
74
|
/**
|
|
69
75
|
* Remove the entity.
|
|
70
76
|
* @param id The id of the entity to remove.
|
|
77
|
+
* @param conditions The optional conditions to match for the entities.
|
|
71
78
|
* @returns Nothing.
|
|
72
79
|
*/
|
|
73
|
-
async remove(id) {
|
|
80
|
+
async remove(id, conditions) {
|
|
74
81
|
Guards.stringValue(EntityStorageRestClient.CLASS_NAME, "id", id);
|
|
75
82
|
await this.fetch("/:id", "DELETE", {
|
|
76
83
|
pathParams: {
|
|
77
84
|
id
|
|
85
|
+
},
|
|
86
|
+
query: {
|
|
87
|
+
conditions: HttpParameterHelper.objectToString(conditions)
|
|
78
88
|
}
|
|
79
89
|
});
|
|
80
90
|
}
|
|
@@ -98,10 +108,15 @@ export class EntityStorageRestClient extends BaseRestClient {
|
|
|
98
108
|
}
|
|
99
109
|
/**
|
|
100
110
|
* Count all the entities which match the conditions.
|
|
111
|
+
* @param conditions The optional conditions to match for the entities.
|
|
101
112
|
* @returns The total count of entities in the storage.
|
|
102
113
|
*/
|
|
103
|
-
async count() {
|
|
104
|
-
const result = await this.fetch("/count", "GET", {
|
|
114
|
+
async count(conditions) {
|
|
115
|
+
const result = await this.fetch("/count", "GET", {
|
|
116
|
+
query: {
|
|
117
|
+
conditions: HttpParameterHelper.objectToString(conditions)
|
|
118
|
+
}
|
|
119
|
+
});
|
|
105
120
|
return result.body.count;
|
|
106
121
|
}
|
|
107
122
|
/**
|
|
@@ -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,CA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KAAK,CAAC,KAAK;QACjB,MAAM,IAAI,CAAC,KAAK,CAAiD,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;IACrF,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,KAAK,CAAC,UAA+B;QACjD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAC9B,QAAQ,EACR,KAAK,EACL;YACC,KAAK,EAAE;gBACN,UAAU,EAAE,mBAAmB,CAAC,cAAc,CAAC,UAAU,CAAC;aAC1D;SACD,CACD,CAAC;QACF,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;IAC1B,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\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,9 +23,13 @@ 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
|
|
29
|
+
set(entity: T, conditions?: {
|
|
30
|
+
property: keyof T;
|
|
31
|
+
value: unknown;
|
|
32
|
+
}[]): Promise<void>;
|
|
29
33
|
/**
|
|
30
34
|
* Set multiple entities in a batch.
|
|
31
35
|
* @param entities The entities to set.
|
|
@@ -36,15 +40,23 @@ export declare class EntityStorageRestClient<T> extends BaseRestClient implement
|
|
|
36
40
|
* Get an entity.
|
|
37
41
|
* @param id The id of the entity to get, or the index value if secondaryIndex is set.
|
|
38
42
|
* @param secondaryIndex Get the item using a secondary index.
|
|
43
|
+
* @param conditions The optional conditions to match for the entities.
|
|
39
44
|
* @returns The object if it can be found or undefined.
|
|
40
45
|
*/
|
|
41
|
-
get(id: string, secondaryIndex?: keyof T
|
|
46
|
+
get(id: string, secondaryIndex?: keyof T, conditions?: {
|
|
47
|
+
property: keyof T;
|
|
48
|
+
value: unknown;
|
|
49
|
+
}[]): Promise<T | undefined>;
|
|
42
50
|
/**
|
|
43
51
|
* Remove the entity.
|
|
44
52
|
* @param id The id of the entity to remove.
|
|
53
|
+
* @param conditions The optional conditions to match for the entities.
|
|
45
54
|
* @returns Nothing.
|
|
46
55
|
*/
|
|
47
|
-
remove(id: string
|
|
56
|
+
remove(id: string, conditions?: {
|
|
57
|
+
property: keyof T;
|
|
58
|
+
value: unknown;
|
|
59
|
+
}[]): Promise<void>;
|
|
48
60
|
/**
|
|
49
61
|
* Remove multiple entities by id.
|
|
50
62
|
* @param ids The ids of the entities to remove.
|
|
@@ -58,9 +70,10 @@ export declare class EntityStorageRestClient<T> extends BaseRestClient implement
|
|
|
58
70
|
empty(): Promise<void>;
|
|
59
71
|
/**
|
|
60
72
|
* Count all the entities which match the conditions.
|
|
73
|
+
* @param conditions The optional conditions to match for the entities.
|
|
61
74
|
* @returns The total count of entities in the storage.
|
|
62
75
|
*/
|
|
63
|
-
count(): Promise<number>;
|
|
76
|
+
count(conditions?: EntityCondition<T>): Promise<number>;
|
|
64
77
|
/**
|
|
65
78
|
* Query all the entities which match the conditions.
|
|
66
79
|
* @param conditions The conditions to match for the entities.
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [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)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* 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))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/entity-storage-models bumped from 0.0.3-next.13 to 0.0.3-next.14
|
|
16
|
+
|
|
3
17
|
## [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)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -70,7 +70,7 @@ The class name of the component.
|
|
|
70
70
|
|
|
71
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`\>
|
|
@@ -122,7 +128,7 @@ Nothing.
|
|
|
122
128
|
|
|
123
129
|
### get() {#get}
|
|
124
130
|
|
|
125
|
-
> **get**(`id`, `secondaryIndex?`): `Promise`\<`T` \| `undefined`\>
|
|
131
|
+
> **get**(`id`, `secondaryIndex?`, `conditions?`): `Promise`\<`T` \| `undefined`\>
|
|
126
132
|
|
|
127
133
|
Get an entity.
|
|
128
134
|
|
|
@@ -140,6 +146,12 @@ keyof `T`
|
|
|
140
146
|
|
|
141
147
|
Get the item using a secondary index.
|
|
142
148
|
|
|
149
|
+
##### conditions?
|
|
150
|
+
|
|
151
|
+
`object`[]
|
|
152
|
+
|
|
153
|
+
The optional conditions to match for the entities.
|
|
154
|
+
|
|
143
155
|
#### Returns
|
|
144
156
|
|
|
145
157
|
`Promise`\<`T` \| `undefined`\>
|
|
@@ -154,7 +166,7 @@ The object if it can be found or undefined.
|
|
|
154
166
|
|
|
155
167
|
### remove() {#remove}
|
|
156
168
|
|
|
157
|
-
> **remove**(`id`): `Promise`\<`void`\>
|
|
169
|
+
> **remove**(`id`, `conditions?`): `Promise`\<`void`\>
|
|
158
170
|
|
|
159
171
|
Remove the entity.
|
|
160
172
|
|
|
@@ -166,6 +178,12 @@ Remove the entity.
|
|
|
166
178
|
|
|
167
179
|
The id of the entity to remove.
|
|
168
180
|
|
|
181
|
+
##### conditions?
|
|
182
|
+
|
|
183
|
+
`object`[]
|
|
184
|
+
|
|
185
|
+
The optional conditions to match for the entities.
|
|
186
|
+
|
|
169
187
|
#### Returns
|
|
170
188
|
|
|
171
189
|
`Promise`\<`void`\>
|
|
@@ -224,10 +242,18 @@ Nothing.
|
|
|
224
242
|
|
|
225
243
|
### count() {#count}
|
|
226
244
|
|
|
227
|
-
> **count**(): `Promise`\<`number`\>
|
|
245
|
+
> **count**(`conditions?`): `Promise`\<`number`\>
|
|
228
246
|
|
|
229
247
|
Count all the entities which match the conditions.
|
|
230
248
|
|
|
249
|
+
#### Parameters
|
|
250
|
+
|
|
251
|
+
##### conditions?
|
|
252
|
+
|
|
253
|
+
`EntityCondition`\<`T`\>
|
|
254
|
+
|
|
255
|
+
The optional conditions to match for the entities.
|
|
256
|
+
|
|
231
257
|
#### Returns
|
|
232
258
|
|
|
233
259
|
`Promise`\<`number`\>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/entity-storage-rest-client",
|
|
3
|
-
"version": "0.0.3-next.
|
|
3
|
+
"version": "0.0.3-next.14",
|
|
4
4
|
"description": "REST client for calling storage services from applications and tools.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -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.
|
|
21
|
+
"@twin.org/entity-storage-models": "0.0.3-next.14",
|
|
22
22
|
"@twin.org/nameof": "next",
|
|
23
23
|
"@twin.org/web": "next"
|
|
24
24
|
},
|