@objectstack/client 1.0.11 → 1.0.12
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +9 -0
- package/dist/index.d.mts +125 -14
- package/dist/index.d.ts +125 -14
- package/dist/index.js +128 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +128 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -9
- package/src/client.hono.test.ts +30 -25
- package/src/client.msw.test.ts +28 -16
- package/src/index.ts +182 -28
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @objectstack/client@1.0.
|
|
2
|
+
> @objectstack/client@1.0.12 build /home/runner/work/spec/spec/packages/client
|
|
3
3
|
> tsup --config ../../tsup.config.ts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
14
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
15
|
-
[32mCJS[39m ⚡️ Build success in
|
|
16
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
17
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[
|
|
18
|
-
[32mESM[39m ⚡️ Build success in
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m25.81 KB[39m
|
|
14
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m50.45 KB[39m
|
|
15
|
+
[32mCJS[39m ⚡️ Build success in 48ms
|
|
16
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m24.66 KB[39m
|
|
17
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m50.39 KB[39m
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 51ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
22
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 4299ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m13.88 KB[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m13.88 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @objectstack/client
|
|
2
2
|
|
|
3
|
+
## 1.0.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- chore: add Vercel deployment configs, simplify console runtime configuration
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @objectstack/spec@1.0.12
|
|
10
|
+
- @objectstack/core@1.0.12
|
|
11
|
+
|
|
3
12
|
## 1.0.11
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -159,8 +159,42 @@ interface QueryOptions {
|
|
|
159
159
|
groupBy?: string[];
|
|
160
160
|
}
|
|
161
161
|
interface PaginatedResult<T = any> {
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
/** @deprecated Use `records` — aligned with FindDataResponseSchema */
|
|
163
|
+
value?: T[];
|
|
164
|
+
/** Spec-compliant: array of matching records */
|
|
165
|
+
records: T[];
|
|
166
|
+
/** @deprecated Use `total` — aligned with FindDataResponseSchema */
|
|
167
|
+
count?: number;
|
|
168
|
+
/** Total number of matching records (if requested) */
|
|
169
|
+
total?: number;
|
|
170
|
+
/** The object name */
|
|
171
|
+
object?: string;
|
|
172
|
+
/** Whether more records are available */
|
|
173
|
+
hasMore?: boolean;
|
|
174
|
+
}
|
|
175
|
+
/** Spec: GetDataResponseSchema */
|
|
176
|
+
interface GetDataResult<T = any> {
|
|
177
|
+
object: string;
|
|
178
|
+
id: string;
|
|
179
|
+
record: T;
|
|
180
|
+
}
|
|
181
|
+
/** Spec: CreateDataResponseSchema */
|
|
182
|
+
interface CreateDataResult<T = any> {
|
|
183
|
+
object: string;
|
|
184
|
+
id: string;
|
|
185
|
+
record: T;
|
|
186
|
+
}
|
|
187
|
+
/** Spec: UpdateDataResponseSchema */
|
|
188
|
+
interface UpdateDataResult<T = any> {
|
|
189
|
+
object: string;
|
|
190
|
+
id: string;
|
|
191
|
+
record: T;
|
|
192
|
+
}
|
|
193
|
+
/** Spec: DeleteDataResponseSchema */
|
|
194
|
+
interface DeleteDataResult {
|
|
195
|
+
object: string;
|
|
196
|
+
id: string;
|
|
197
|
+
deleted: boolean;
|
|
164
198
|
}
|
|
165
199
|
interface StandardError {
|
|
166
200
|
code: StandardErrorCode;
|
|
@@ -200,6 +234,7 @@ declare class ObjectStackClient {
|
|
|
200
234
|
automation?: string | undefined;
|
|
201
235
|
analytics?: string | undefined;
|
|
202
236
|
hub?: string | undefined;
|
|
237
|
+
ui?: string | undefined;
|
|
203
238
|
} | undefined;
|
|
204
239
|
}>;
|
|
205
240
|
/**
|
|
@@ -214,33 +249,36 @@ declare class ObjectStackClient {
|
|
|
214
249
|
/**
|
|
215
250
|
* Get all items of a specific metadata type
|
|
216
251
|
* @param type - Metadata type name (e.g., 'object', 'plugin')
|
|
252
|
+
* @param options - Optional filters (e.g., packageId to scope by package)
|
|
217
253
|
*/
|
|
218
|
-
getItems: (type: string
|
|
254
|
+
getItems: (type: string, options?: {
|
|
255
|
+
packageId?: string;
|
|
256
|
+
}) => Promise<GetMetaItemsResponse>;
|
|
219
257
|
/**
|
|
220
258
|
* Get a specific object definition by name
|
|
221
259
|
* @deprecated Use `getItem('object', name)` instead for consistency with spec protocol
|
|
222
260
|
* @param name - Object name (snake_case identifier)
|
|
223
261
|
*/
|
|
224
|
-
getObject: (name: string) => Promise<
|
|
262
|
+
getObject: (name: string) => Promise<unknown>;
|
|
225
263
|
/**
|
|
226
264
|
* Get a specific metadata item by type and name
|
|
227
265
|
* @param type - Metadata type (e.g., 'object', 'plugin')
|
|
228
266
|
* @param name - Item name (snake_case identifier)
|
|
229
267
|
*/
|
|
230
|
-
getItem: (type: string, name: string) => Promise<
|
|
268
|
+
getItem: (type: string, name: string) => Promise<unknown>;
|
|
231
269
|
/**
|
|
232
270
|
* Save a metadata item
|
|
233
271
|
* @param type - Metadata type (e.g., 'object', 'plugin')
|
|
234
272
|
* @param name - Item name
|
|
235
273
|
* @param item - The metadata content to save
|
|
236
274
|
*/
|
|
237
|
-
saveItem: (type: string, name: string, item: any) => Promise<
|
|
275
|
+
saveItem: (type: string, name: string, item: any) => Promise<unknown>;
|
|
238
276
|
/**
|
|
239
277
|
* Get object metadata with cache support
|
|
240
278
|
* Supports ETag-based conditional requests for efficient caching
|
|
241
279
|
*/
|
|
242
280
|
getCached: (name: string, cacheOptions?: MetadataCacheRequest) => Promise<MetadataCacheResponse>;
|
|
243
|
-
getView: (object: string, type?: "list" | "form") => Promise<
|
|
281
|
+
getView: (object: string, type?: "list" | "form") => Promise<unknown>;
|
|
244
282
|
};
|
|
245
283
|
/**
|
|
246
284
|
* Analytics Services
|
|
@@ -262,6 +300,73 @@ declare class ObjectStackClient {
|
|
|
262
300
|
install: (pkg: string, version?: string) => Promise<any>;
|
|
263
301
|
};
|
|
264
302
|
};
|
|
303
|
+
/**
|
|
304
|
+
* Package Management Services
|
|
305
|
+
*
|
|
306
|
+
* Manages the lifecycle of installed packages.
|
|
307
|
+
* A package (ManifestSchema) is the unit of installation.
|
|
308
|
+
* An app (AppSchema) is a UI navigation definition within a package.
|
|
309
|
+
* A package may contain 0, 1, or many apps, or be a pure functionality plugin.
|
|
310
|
+
*
|
|
311
|
+
* Endpoints:
|
|
312
|
+
* - GET /packages → list installed packages
|
|
313
|
+
* - GET /packages/:id → get package details
|
|
314
|
+
* - POST /packages → install a package
|
|
315
|
+
* - DELETE /packages/:id → uninstall a package
|
|
316
|
+
* - PATCH /packages/:id/enable → enable a package
|
|
317
|
+
* - PATCH /packages/:id/disable → disable a package
|
|
318
|
+
*/
|
|
319
|
+
packages: {
|
|
320
|
+
/**
|
|
321
|
+
* List all installed packages with optional filters.
|
|
322
|
+
*/
|
|
323
|
+
list: (filters?: {
|
|
324
|
+
status?: string;
|
|
325
|
+
type?: string;
|
|
326
|
+
enabled?: boolean;
|
|
327
|
+
}) => Promise<{
|
|
328
|
+
packages: any[];
|
|
329
|
+
total: number;
|
|
330
|
+
}>;
|
|
331
|
+
/**
|
|
332
|
+
* Get a specific installed package by its ID (reverse domain identifier).
|
|
333
|
+
*/
|
|
334
|
+
get: (id: string) => Promise<{
|
|
335
|
+
package: any;
|
|
336
|
+
}>;
|
|
337
|
+
/**
|
|
338
|
+
* Install a new package from its manifest.
|
|
339
|
+
*/
|
|
340
|
+
install: (manifest: any, options?: {
|
|
341
|
+
settings?: Record<string, any>;
|
|
342
|
+
enableOnInstall?: boolean;
|
|
343
|
+
}) => Promise<{
|
|
344
|
+
package: any;
|
|
345
|
+
message?: string;
|
|
346
|
+
}>;
|
|
347
|
+
/**
|
|
348
|
+
* Uninstall a package by its ID.
|
|
349
|
+
*/
|
|
350
|
+
uninstall: (id: string) => Promise<{
|
|
351
|
+
id: string;
|
|
352
|
+
success: boolean;
|
|
353
|
+
message?: string;
|
|
354
|
+
}>;
|
|
355
|
+
/**
|
|
356
|
+
* Enable a disabled package.
|
|
357
|
+
*/
|
|
358
|
+
enable: (id: string) => Promise<{
|
|
359
|
+
package: any;
|
|
360
|
+
message?: string;
|
|
361
|
+
}>;
|
|
362
|
+
/**
|
|
363
|
+
* Disable an installed package.
|
|
364
|
+
*/
|
|
365
|
+
disable: (id: string) => Promise<{
|
|
366
|
+
package: any;
|
|
367
|
+
message?: string;
|
|
368
|
+
}>;
|
|
369
|
+
};
|
|
265
370
|
/**
|
|
266
371
|
* Authentication Services
|
|
267
372
|
*/
|
|
@@ -293,10 +398,10 @@ declare class ObjectStackClient {
|
|
|
293
398
|
*/
|
|
294
399
|
query: <T = any>(object: string, query: Partial<QueryAST>) => Promise<PaginatedResult<T>>;
|
|
295
400
|
find: <T = any>(object: string, options?: QueryOptions) => Promise<PaginatedResult<T>>;
|
|
296
|
-
get: <T = any>(object: string, id: string) => Promise<T
|
|
297
|
-
create: <T = any>(object: string, data: Partial<T>) => Promise<T
|
|
401
|
+
get: <T = any>(object: string, id: string) => Promise<GetDataResult<T>>;
|
|
402
|
+
create: <T = any>(object: string, data: Partial<T>) => Promise<CreateDataResult<T>>;
|
|
298
403
|
createMany: <T = any>(object: string, data: Partial<T>[]) => Promise<T[]>;
|
|
299
|
-
update: <T = any>(object: string, id: string, data: Partial<T>) => Promise<T
|
|
404
|
+
update: <T = any>(object: string, id: string, data: Partial<T>) => Promise<UpdateDataResult<T>>;
|
|
300
405
|
/**
|
|
301
406
|
* Batch update multiple records
|
|
302
407
|
* Uses the new BatchUpdateRequest schema with full control over options
|
|
@@ -310,9 +415,7 @@ declare class ObjectStackClient {
|
|
|
310
415
|
id: string;
|
|
311
416
|
data: Partial<T>;
|
|
312
417
|
}>, options?: BatchOptions) => Promise<BatchUpdateResponse>;
|
|
313
|
-
delete: (object: string, id: string) => Promise<
|
|
314
|
-
success: boolean;
|
|
315
|
-
}>;
|
|
418
|
+
delete: (object: string, id: string) => Promise<DeleteDataResult>;
|
|
316
419
|
/**
|
|
317
420
|
* Delete multiple records by IDs
|
|
318
421
|
*/
|
|
@@ -322,6 +425,14 @@ declare class ObjectStackClient {
|
|
|
322
425
|
* Private Helpers
|
|
323
426
|
*/
|
|
324
427
|
private isFilterAST;
|
|
428
|
+
/**
|
|
429
|
+
* Unwrap the standard REST API response envelope.
|
|
430
|
+
* The HTTP layer wraps responses as `{ success: boolean, data: T, meta? }`
|
|
431
|
+
* (see BaseResponseSchema in contract.zod.ts).
|
|
432
|
+
* This method strips the envelope and returns the inner `data` payload
|
|
433
|
+
* so callers receive the spec-level type (e.g. GetMetaTypesResponse).
|
|
434
|
+
*/
|
|
435
|
+
private unwrapResponse;
|
|
325
436
|
private fetch;
|
|
326
437
|
/**
|
|
327
438
|
* Get the conventional route path for a given API endpoint type
|
|
@@ -330,4 +441,4 @@ declare class ObjectStackClient {
|
|
|
330
441
|
private getRoute;
|
|
331
442
|
}
|
|
332
443
|
|
|
333
|
-
export { type ClientConfig, type DiscoveryResult, FilterBuilder, ObjectStackClient, type PaginatedResult, QueryBuilder, type QueryOptions, type StandardError, createFilter, createQuery };
|
|
444
|
+
export { type ClientConfig, type CreateDataResult, type DeleteDataResult, type DiscoveryResult, FilterBuilder, type GetDataResult, ObjectStackClient, type PaginatedResult, QueryBuilder, type QueryOptions, type StandardError, type UpdateDataResult, createFilter, createQuery };
|
package/dist/index.d.ts
CHANGED
|
@@ -159,8 +159,42 @@ interface QueryOptions {
|
|
|
159
159
|
groupBy?: string[];
|
|
160
160
|
}
|
|
161
161
|
interface PaginatedResult<T = any> {
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
/** @deprecated Use `records` — aligned with FindDataResponseSchema */
|
|
163
|
+
value?: T[];
|
|
164
|
+
/** Spec-compliant: array of matching records */
|
|
165
|
+
records: T[];
|
|
166
|
+
/** @deprecated Use `total` — aligned with FindDataResponseSchema */
|
|
167
|
+
count?: number;
|
|
168
|
+
/** Total number of matching records (if requested) */
|
|
169
|
+
total?: number;
|
|
170
|
+
/** The object name */
|
|
171
|
+
object?: string;
|
|
172
|
+
/** Whether more records are available */
|
|
173
|
+
hasMore?: boolean;
|
|
174
|
+
}
|
|
175
|
+
/** Spec: GetDataResponseSchema */
|
|
176
|
+
interface GetDataResult<T = any> {
|
|
177
|
+
object: string;
|
|
178
|
+
id: string;
|
|
179
|
+
record: T;
|
|
180
|
+
}
|
|
181
|
+
/** Spec: CreateDataResponseSchema */
|
|
182
|
+
interface CreateDataResult<T = any> {
|
|
183
|
+
object: string;
|
|
184
|
+
id: string;
|
|
185
|
+
record: T;
|
|
186
|
+
}
|
|
187
|
+
/** Spec: UpdateDataResponseSchema */
|
|
188
|
+
interface UpdateDataResult<T = any> {
|
|
189
|
+
object: string;
|
|
190
|
+
id: string;
|
|
191
|
+
record: T;
|
|
192
|
+
}
|
|
193
|
+
/** Spec: DeleteDataResponseSchema */
|
|
194
|
+
interface DeleteDataResult {
|
|
195
|
+
object: string;
|
|
196
|
+
id: string;
|
|
197
|
+
deleted: boolean;
|
|
164
198
|
}
|
|
165
199
|
interface StandardError {
|
|
166
200
|
code: StandardErrorCode;
|
|
@@ -200,6 +234,7 @@ declare class ObjectStackClient {
|
|
|
200
234
|
automation?: string | undefined;
|
|
201
235
|
analytics?: string | undefined;
|
|
202
236
|
hub?: string | undefined;
|
|
237
|
+
ui?: string | undefined;
|
|
203
238
|
} | undefined;
|
|
204
239
|
}>;
|
|
205
240
|
/**
|
|
@@ -214,33 +249,36 @@ declare class ObjectStackClient {
|
|
|
214
249
|
/**
|
|
215
250
|
* Get all items of a specific metadata type
|
|
216
251
|
* @param type - Metadata type name (e.g., 'object', 'plugin')
|
|
252
|
+
* @param options - Optional filters (e.g., packageId to scope by package)
|
|
217
253
|
*/
|
|
218
|
-
getItems: (type: string
|
|
254
|
+
getItems: (type: string, options?: {
|
|
255
|
+
packageId?: string;
|
|
256
|
+
}) => Promise<GetMetaItemsResponse>;
|
|
219
257
|
/**
|
|
220
258
|
* Get a specific object definition by name
|
|
221
259
|
* @deprecated Use `getItem('object', name)` instead for consistency with spec protocol
|
|
222
260
|
* @param name - Object name (snake_case identifier)
|
|
223
261
|
*/
|
|
224
|
-
getObject: (name: string) => Promise<
|
|
262
|
+
getObject: (name: string) => Promise<unknown>;
|
|
225
263
|
/**
|
|
226
264
|
* Get a specific metadata item by type and name
|
|
227
265
|
* @param type - Metadata type (e.g., 'object', 'plugin')
|
|
228
266
|
* @param name - Item name (snake_case identifier)
|
|
229
267
|
*/
|
|
230
|
-
getItem: (type: string, name: string) => Promise<
|
|
268
|
+
getItem: (type: string, name: string) => Promise<unknown>;
|
|
231
269
|
/**
|
|
232
270
|
* Save a metadata item
|
|
233
271
|
* @param type - Metadata type (e.g., 'object', 'plugin')
|
|
234
272
|
* @param name - Item name
|
|
235
273
|
* @param item - The metadata content to save
|
|
236
274
|
*/
|
|
237
|
-
saveItem: (type: string, name: string, item: any) => Promise<
|
|
275
|
+
saveItem: (type: string, name: string, item: any) => Promise<unknown>;
|
|
238
276
|
/**
|
|
239
277
|
* Get object metadata with cache support
|
|
240
278
|
* Supports ETag-based conditional requests for efficient caching
|
|
241
279
|
*/
|
|
242
280
|
getCached: (name: string, cacheOptions?: MetadataCacheRequest) => Promise<MetadataCacheResponse>;
|
|
243
|
-
getView: (object: string, type?: "list" | "form") => Promise<
|
|
281
|
+
getView: (object: string, type?: "list" | "form") => Promise<unknown>;
|
|
244
282
|
};
|
|
245
283
|
/**
|
|
246
284
|
* Analytics Services
|
|
@@ -262,6 +300,73 @@ declare class ObjectStackClient {
|
|
|
262
300
|
install: (pkg: string, version?: string) => Promise<any>;
|
|
263
301
|
};
|
|
264
302
|
};
|
|
303
|
+
/**
|
|
304
|
+
* Package Management Services
|
|
305
|
+
*
|
|
306
|
+
* Manages the lifecycle of installed packages.
|
|
307
|
+
* A package (ManifestSchema) is the unit of installation.
|
|
308
|
+
* An app (AppSchema) is a UI navigation definition within a package.
|
|
309
|
+
* A package may contain 0, 1, or many apps, or be a pure functionality plugin.
|
|
310
|
+
*
|
|
311
|
+
* Endpoints:
|
|
312
|
+
* - GET /packages → list installed packages
|
|
313
|
+
* - GET /packages/:id → get package details
|
|
314
|
+
* - POST /packages → install a package
|
|
315
|
+
* - DELETE /packages/:id → uninstall a package
|
|
316
|
+
* - PATCH /packages/:id/enable → enable a package
|
|
317
|
+
* - PATCH /packages/:id/disable → disable a package
|
|
318
|
+
*/
|
|
319
|
+
packages: {
|
|
320
|
+
/**
|
|
321
|
+
* List all installed packages with optional filters.
|
|
322
|
+
*/
|
|
323
|
+
list: (filters?: {
|
|
324
|
+
status?: string;
|
|
325
|
+
type?: string;
|
|
326
|
+
enabled?: boolean;
|
|
327
|
+
}) => Promise<{
|
|
328
|
+
packages: any[];
|
|
329
|
+
total: number;
|
|
330
|
+
}>;
|
|
331
|
+
/**
|
|
332
|
+
* Get a specific installed package by its ID (reverse domain identifier).
|
|
333
|
+
*/
|
|
334
|
+
get: (id: string) => Promise<{
|
|
335
|
+
package: any;
|
|
336
|
+
}>;
|
|
337
|
+
/**
|
|
338
|
+
* Install a new package from its manifest.
|
|
339
|
+
*/
|
|
340
|
+
install: (manifest: any, options?: {
|
|
341
|
+
settings?: Record<string, any>;
|
|
342
|
+
enableOnInstall?: boolean;
|
|
343
|
+
}) => Promise<{
|
|
344
|
+
package: any;
|
|
345
|
+
message?: string;
|
|
346
|
+
}>;
|
|
347
|
+
/**
|
|
348
|
+
* Uninstall a package by its ID.
|
|
349
|
+
*/
|
|
350
|
+
uninstall: (id: string) => Promise<{
|
|
351
|
+
id: string;
|
|
352
|
+
success: boolean;
|
|
353
|
+
message?: string;
|
|
354
|
+
}>;
|
|
355
|
+
/**
|
|
356
|
+
* Enable a disabled package.
|
|
357
|
+
*/
|
|
358
|
+
enable: (id: string) => Promise<{
|
|
359
|
+
package: any;
|
|
360
|
+
message?: string;
|
|
361
|
+
}>;
|
|
362
|
+
/**
|
|
363
|
+
* Disable an installed package.
|
|
364
|
+
*/
|
|
365
|
+
disable: (id: string) => Promise<{
|
|
366
|
+
package: any;
|
|
367
|
+
message?: string;
|
|
368
|
+
}>;
|
|
369
|
+
};
|
|
265
370
|
/**
|
|
266
371
|
* Authentication Services
|
|
267
372
|
*/
|
|
@@ -293,10 +398,10 @@ declare class ObjectStackClient {
|
|
|
293
398
|
*/
|
|
294
399
|
query: <T = any>(object: string, query: Partial<QueryAST>) => Promise<PaginatedResult<T>>;
|
|
295
400
|
find: <T = any>(object: string, options?: QueryOptions) => Promise<PaginatedResult<T>>;
|
|
296
|
-
get: <T = any>(object: string, id: string) => Promise<T
|
|
297
|
-
create: <T = any>(object: string, data: Partial<T>) => Promise<T
|
|
401
|
+
get: <T = any>(object: string, id: string) => Promise<GetDataResult<T>>;
|
|
402
|
+
create: <T = any>(object: string, data: Partial<T>) => Promise<CreateDataResult<T>>;
|
|
298
403
|
createMany: <T = any>(object: string, data: Partial<T>[]) => Promise<T[]>;
|
|
299
|
-
update: <T = any>(object: string, id: string, data: Partial<T>) => Promise<T
|
|
404
|
+
update: <T = any>(object: string, id: string, data: Partial<T>) => Promise<UpdateDataResult<T>>;
|
|
300
405
|
/**
|
|
301
406
|
* Batch update multiple records
|
|
302
407
|
* Uses the new BatchUpdateRequest schema with full control over options
|
|
@@ -310,9 +415,7 @@ declare class ObjectStackClient {
|
|
|
310
415
|
id: string;
|
|
311
416
|
data: Partial<T>;
|
|
312
417
|
}>, options?: BatchOptions) => Promise<BatchUpdateResponse>;
|
|
313
|
-
delete: (object: string, id: string) => Promise<
|
|
314
|
-
success: boolean;
|
|
315
|
-
}>;
|
|
418
|
+
delete: (object: string, id: string) => Promise<DeleteDataResult>;
|
|
316
419
|
/**
|
|
317
420
|
* Delete multiple records by IDs
|
|
318
421
|
*/
|
|
@@ -322,6 +425,14 @@ declare class ObjectStackClient {
|
|
|
322
425
|
* Private Helpers
|
|
323
426
|
*/
|
|
324
427
|
private isFilterAST;
|
|
428
|
+
/**
|
|
429
|
+
* Unwrap the standard REST API response envelope.
|
|
430
|
+
* The HTTP layer wraps responses as `{ success: boolean, data: T, meta? }`
|
|
431
|
+
* (see BaseResponseSchema in contract.zod.ts).
|
|
432
|
+
* This method strips the envelope and returns the inner `data` payload
|
|
433
|
+
* so callers receive the spec-level type (e.g. GetMetaTypesResponse).
|
|
434
|
+
*/
|
|
435
|
+
private unwrapResponse;
|
|
325
436
|
private fetch;
|
|
326
437
|
/**
|
|
327
438
|
* Get the conventional route path for a given API endpoint type
|
|
@@ -330,4 +441,4 @@ declare class ObjectStackClient {
|
|
|
330
441
|
private getRoute;
|
|
331
442
|
}
|
|
332
443
|
|
|
333
|
-
export { type ClientConfig, type DiscoveryResult, FilterBuilder, ObjectStackClient, type PaginatedResult, QueryBuilder, type QueryOptions, type StandardError, createFilter, createQuery };
|
|
444
|
+
export { type ClientConfig, type CreateDataResult, type DeleteDataResult, type DiscoveryResult, FilterBuilder, type GetDataResult, ObjectStackClient, type PaginatedResult, QueryBuilder, type QueryOptions, type StandardError, type UpdateDataResult, createFilter, createQuery };
|