@twin.org/entity-storage-rest-client 0.0.3-next.6 → 0.0.3-next.7
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 +2 -2
- package/docs/changelog.md +15 -1
- package/docs/examples.md +60 -1
- package/docs/reference/classes/EntityStorageRestClient.md +6 -6
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Entity Storage REST Client
|
|
2
2
|
|
|
3
|
-
|
|
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
|
|
package/docs/changelog.md
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.0.3-next.7](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.3-next.6...entity-storage-rest-client-v0.0.3-next.7) (2026-03-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **entity-storage-rest-client:** Synchronize repo versions
|
|
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.6 to 0.0.3-next.7
|
|
2
16
|
|
|
3
17
|
## [0.0.3-next.6](https://github.com/twinfoundation/entity-storage/compare/entity-storage-rest-client-v0.0.3-next.5...entity-storage-rest-client-v0.0.3-next.6) (2026-01-21)
|
|
4
18
|
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,60 @@
|
|
|
1
|
-
#
|
|
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,7 +68,7 @@ The class name of the component.
|
|
|
68
68
|
|
|
69
69
|
***
|
|
70
70
|
|
|
71
|
-
### set()
|
|
71
|
+
### set() {#set}
|
|
72
72
|
|
|
73
73
|
> **set**(`entity`): `Promise`\<`void`\>
|
|
74
74
|
|
|
@@ -94,7 +94,7 @@ The id of the entity.
|
|
|
94
94
|
|
|
95
95
|
***
|
|
96
96
|
|
|
97
|
-
### get()
|
|
97
|
+
### get() {#get}
|
|
98
98
|
|
|
99
99
|
> **get**(`id`, `secondaryIndex?`): `Promise`\<`T` \| `undefined`\>
|
|
100
100
|
|
|
@@ -126,7 +126,7 @@ The object if it can be found or undefined.
|
|
|
126
126
|
|
|
127
127
|
***
|
|
128
128
|
|
|
129
|
-
### remove()
|
|
129
|
+
### remove() {#remove}
|
|
130
130
|
|
|
131
131
|
> **remove**(`id`): `Promise`\<`void`\>
|
|
132
132
|
|
|
@@ -152,7 +152,7 @@ Nothing.
|
|
|
152
152
|
|
|
153
153
|
***
|
|
154
154
|
|
|
155
|
-
### query()
|
|
155
|
+
### query() {#query}
|
|
156
156
|
|
|
157
157
|
> **query**(`conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: `Partial`\<`T`\>[]; `cursor?`: `string`; \}\>
|
|
158
158
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/entity-storage-rest-client",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.7",
|
|
4
|
+
"description": "REST client for calling storage services from applications and tools.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/twinfoundation/entity-storage.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.7",
|
|
22
22
|
"@twin.org/nameof": "next",
|
|
23
23
|
"@twin.org/web": "next"
|
|
24
24
|
},
|