@objectstack/client 4.0.1 → 4.0.2
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 +11 -11
- package/CHANGELOG.md +9 -0
- package/dist/index.d.mts +18 -8
- package/dist/index.d.ts +18 -8
- package/dist/index.js +20 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
- package/src/client.test.ts +4 -12
- package/src/index.ts +21 -17
package/dist/index.mjs
CHANGED
|
@@ -310,10 +310,15 @@ var ObjectStackClient = class {
|
|
|
310
310
|
* Get a specific metadata item by type and name
|
|
311
311
|
* @param type - Metadata type (e.g., 'object', 'plugin')
|
|
312
312
|
* @param name - Item name (snake_case identifier)
|
|
313
|
+
* @param options - Optional filters (e.g., packageId to scope by package)
|
|
313
314
|
*/
|
|
314
|
-
getItem: async (type, name) => {
|
|
315
|
+
getItem: async (type, name, options) => {
|
|
315
316
|
const route = this.getRoute("metadata");
|
|
316
|
-
const
|
|
317
|
+
const params = new URLSearchParams();
|
|
318
|
+
if (options?.packageId) params.set("package", options.packageId);
|
|
319
|
+
const qs = params.toString();
|
|
320
|
+
const url = `${this.baseUrl}${route}/${type}/${name}${qs ? `?${qs}` : ""}`;
|
|
321
|
+
const res = await this.fetch(url);
|
|
317
322
|
return this.unwrapResponse(res);
|
|
318
323
|
},
|
|
319
324
|
/**
|
|
@@ -330,6 +335,18 @@ var ObjectStackClient = class {
|
|
|
330
335
|
});
|
|
331
336
|
return this.unwrapResponse(res);
|
|
332
337
|
},
|
|
338
|
+
/**
|
|
339
|
+
* Delete a metadata item
|
|
340
|
+
* @param type - Metadata type (e.g., 'object', 'plugin')
|
|
341
|
+
* @param name - Item name (snake_case identifier)
|
|
342
|
+
*/
|
|
343
|
+
deleteItem: async (type, name) => {
|
|
344
|
+
const route = this.getRoute("metadata");
|
|
345
|
+
const res = await this.fetch(`${this.baseUrl}${route}/${encodeURIComponent(type)}/${encodeURIComponent(name)}`, {
|
|
346
|
+
method: "DELETE"
|
|
347
|
+
});
|
|
348
|
+
return this.unwrapResponse(res);
|
|
349
|
+
},
|
|
333
350
|
/**
|
|
334
351
|
* Get object metadata with cache support
|
|
335
352
|
* Supports ETag-based conditional requests for efficient caching
|
|
@@ -1073,17 +1090,7 @@ var ObjectStackClient = class {
|
|
|
1073
1090
|
});
|
|
1074
1091
|
return this.unwrapResponse(res);
|
|
1075
1092
|
},
|
|
1076
|
-
|
|
1077
|
-
* Multi-turn AI chat
|
|
1078
|
-
*/
|
|
1079
|
-
chat: async (request) => {
|
|
1080
|
-
const route = this.getRoute("ai");
|
|
1081
|
-
const res = await this.fetch(`${this.baseUrl}${route}/chat`, {
|
|
1082
|
-
method: "POST",
|
|
1083
|
-
body: JSON.stringify(request)
|
|
1084
|
-
});
|
|
1085
|
-
return this.unwrapResponse(res);
|
|
1086
|
-
},
|
|
1093
|
+
// AI chat method removed — use Vercel AI SDK `useChat()` / `@ai-sdk/react` directly.
|
|
1087
1094
|
/**
|
|
1088
1095
|
* AI-powered field value suggestions
|
|
1089
1096
|
*/
|