@amaster.ai/client 1.1.56 → 1.1.57
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 +7 -0
- package/package.json +11 -11
- package/types/__tests__/type-checks.test-d.ts +10 -0
- package/types/entity.d.ts +21 -0
package/README.md
CHANGED
|
@@ -220,6 +220,12 @@ await client.entity.delete("default", "users", 123);
|
|
|
220
220
|
### Bulk Operations
|
|
221
221
|
|
|
222
222
|
```typescript
|
|
223
|
+
// Bulk create
|
|
224
|
+
const created = await client.entity.bulkCreate("default", "users", [
|
|
225
|
+
{ name: "Alice", status: "active" },
|
|
226
|
+
{ name: "Bob", status: "active" },
|
|
227
|
+
]);
|
|
228
|
+
|
|
223
229
|
// Bulk update
|
|
224
230
|
await client.entity.bulkUpdate("default", "users", [
|
|
225
231
|
{ id: 1, status: "active" },
|
|
@@ -750,6 +756,7 @@ Full CRUD API from `@amaster.ai/entity-client`:
|
|
|
750
756
|
- `list(source, entity, params?)` - List entities with pagination, filtering, sorting, and query params
|
|
751
757
|
- `get(source, entity, id)` - Get single entity
|
|
752
758
|
- `create(source, entity, data)` - Create new entity
|
|
759
|
+
- `bulkCreate(source, entity, items)` - Bulk create entities
|
|
753
760
|
- `update(source, entity, id, data)` - Update entity
|
|
754
761
|
- `updateWhere(source, entity, params, data)` - Update entities matching filter conditions and return affected rows
|
|
755
762
|
- `delete(source, entity, id)` - Delete entity
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amaster.ai/client",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.57",
|
|
4
4
|
"description": "Unified API client for Amaster platform - All services in one package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -72,16 +72,16 @@
|
|
|
72
72
|
"registry": "https://registry.npmjs.org/"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@amaster.ai/asr-client": "1.1.
|
|
76
|
-
"@amaster.ai/
|
|
77
|
-
"@amaster.ai/
|
|
78
|
-
"@amaster.ai/
|
|
79
|
-
"@amaster.ai/
|
|
80
|
-
"@amaster.ai/
|
|
81
|
-
"@amaster.ai/
|
|
82
|
-
"@amaster.ai/
|
|
83
|
-
"@amaster.ai/
|
|
84
|
-
"@amaster.ai/
|
|
75
|
+
"@amaster.ai/asr-client": "1.1.57",
|
|
76
|
+
"@amaster.ai/bpm-client": "1.1.57",
|
|
77
|
+
"@amaster.ai/auth-client": "1.1.57",
|
|
78
|
+
"@amaster.ai/copilot-client": "1.1.57",
|
|
79
|
+
"@amaster.ai/entity-client": "1.1.57",
|
|
80
|
+
"@amaster.ai/function-client": "1.1.57",
|
|
81
|
+
"@amaster.ai/http-client": "1.1.57",
|
|
82
|
+
"@amaster.ai/s3-client": "1.1.57",
|
|
83
|
+
"@amaster.ai/tts-client": "1.1.57",
|
|
84
|
+
"@amaster.ai/workflow-client": "1.1.57"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"axios": "^1.11.0"
|
|
@@ -106,6 +106,16 @@ describe('Type Tests', () => {
|
|
|
106
106
|
});
|
|
107
107
|
|
|
108
108
|
it('should expose the current downstream client methods', () => {
|
|
109
|
+
expectTypeOf<AmasterClient['entity']>().toHaveProperty('bulkCreate');
|
|
110
|
+
const bulkCreateResult: Promise<ClientResult<Array<{ id: number; name: string }>>> =
|
|
111
|
+
({} as AmasterClient).entity.bulkCreate<{ id: number; name: string }>(
|
|
112
|
+
'default',
|
|
113
|
+
'users',
|
|
114
|
+
[{ name: 'Alice' }]
|
|
115
|
+
);
|
|
116
|
+
expectTypeOf(bulkCreateResult).toMatchTypeOf<
|
|
117
|
+
Promise<ClientResult<Array<{ id: number; name: string }>>>
|
|
118
|
+
>();
|
|
109
119
|
expectTypeOf<AmasterClient['entity']>().toHaveProperty('bulkUpdate');
|
|
110
120
|
expectTypeOf<AmasterClient['entity']>().toHaveProperty('updateWhere');
|
|
111
121
|
const updateWhereResult: Promise<ClientResult<EntityUpdateWhereResponse>> =
|
package/types/entity.d.ts
CHANGED
|
@@ -347,6 +347,27 @@ export interface EntityClientAPI {
|
|
|
347
347
|
data: Record<string, unknown>
|
|
348
348
|
): Promise<ClientResult<T>>;
|
|
349
349
|
|
|
350
|
+
/**
|
|
351
|
+
* Create multiple entities
|
|
352
|
+
*
|
|
353
|
+
* @template T - The entity type
|
|
354
|
+
* @param source - Data source name
|
|
355
|
+
* @param entity - Entity name
|
|
356
|
+
* @param items - Entity data to create
|
|
357
|
+
* @returns The created entities
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* const result = await client.entity.bulkCreate('default', 'users', [
|
|
361
|
+
* { name: 'Alice', status: 'active' },
|
|
362
|
+
* { name: 'Bob', status: 'active' }
|
|
363
|
+
* ]);
|
|
364
|
+
*/
|
|
365
|
+
bulkCreate<T = Record<string, unknown>>(
|
|
366
|
+
source: string,
|
|
367
|
+
entity: string,
|
|
368
|
+
items: Array<Record<string, unknown>>
|
|
369
|
+
): Promise<ClientResult<T[]>>;
|
|
370
|
+
|
|
350
371
|
/**
|
|
351
372
|
* Update an existing entity
|
|
352
373
|
*
|