@calmlens/js-sdk 0.0.2 → 0.0.4
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/cjs/CalmLensClient.d.ts +10 -1
- package/cjs/CalmLensClient.js +40 -2
- package/cjs/PublicApiSchemas.d.ts +21 -4
- package/cjs/PublicApiSchemas.js +45 -9
- package/cjs/SharedTypes.d.ts +8 -3
- package/esm/CalmLensClient.d.ts +10 -1
- package/esm/CalmLensClient.js +32 -2
- package/esm/PublicApiSchemas.d.ts +21 -4
- package/esm/PublicApiSchemas.js +44 -8
- package/esm/SharedTypes.d.ts +8 -3
- package/package.json +1 -1
package/cjs/CalmLensClient.d.ts
CHANGED
|
@@ -49,10 +49,19 @@ export default class CalmLensClient {
|
|
|
49
49
|
*/
|
|
50
50
|
listChildren: (assetId: string, options: GetAssetChildrenQuery) => Promise<GetAssetChildrenResponse>;
|
|
51
51
|
/**
|
|
52
|
-
* Submit a new asset for processing
|
|
52
|
+
* Submit a new asset for processing (queued asynchronously)
|
|
53
|
+
* The asset will be queued for classification and returned immediately.
|
|
53
54
|
* @param options - Asset submission options
|
|
54
55
|
* @returns Promise with created asset
|
|
55
56
|
*/
|
|
56
57
|
create: (options: SubmitAssetOptions) => Promise<Asset>;
|
|
58
|
+
/**
|
|
59
|
+
* Submit a new asset and analyze it synchronously
|
|
60
|
+
* The asset will be classified immediately before the response is returned.
|
|
61
|
+
* This may take longer but ensures the asset is fully processed.
|
|
62
|
+
* @param options - Asset submission options
|
|
63
|
+
* @returns Promise with created and analyzed asset
|
|
64
|
+
*/
|
|
65
|
+
analyze: (options: SubmitAssetOptions) => Promise<Asset>;
|
|
57
66
|
};
|
|
58
67
|
}
|
package/cjs/CalmLensClient.js
CHANGED
|
@@ -91,6 +91,7 @@ var createEndpoints = function (api) {
|
|
|
91
91
|
.endpoint()
|
|
92
92
|
.bodyOf()
|
|
93
93
|
.paramsOf()
|
|
94
|
+
.queryOf()
|
|
94
95
|
.responseOf()
|
|
95
96
|
.build({
|
|
96
97
|
id: "postUploadAsset",
|
|
@@ -223,7 +224,8 @@ var CalmLensClient = /** @class */ (function () {
|
|
|
223
224
|
});
|
|
224
225
|
}); },
|
|
225
226
|
/**
|
|
226
|
-
* Submit a new asset for processing
|
|
227
|
+
* Submit a new asset for processing (queued asynchronously)
|
|
228
|
+
* The asset will be queued for classification and returned immediately.
|
|
227
229
|
* @param options - Asset submission options
|
|
228
230
|
* @returns Promise with created asset
|
|
229
231
|
*/
|
|
@@ -232,7 +234,7 @@ var CalmLensClient = /** @class */ (function () {
|
|
|
232
234
|
return __generator(this, function (_a) {
|
|
233
235
|
switch (_a.label) {
|
|
234
236
|
case 0:
|
|
235
|
-
if (!("
|
|
237
|
+
if (!("content" in options) && !("url" in options)) {
|
|
236
238
|
throw new Error("Either file content or URL is required");
|
|
237
239
|
}
|
|
238
240
|
if (!options.name) {
|
|
@@ -243,6 +245,42 @@ var CalmLensClient = /** @class */ (function () {
|
|
|
243
245
|
params: {
|
|
244
246
|
projectId: this.options.projectId,
|
|
245
247
|
},
|
|
248
|
+
query: {
|
|
249
|
+
queue: true, // Queue for async processing
|
|
250
|
+
},
|
|
251
|
+
})];
|
|
252
|
+
case 1:
|
|
253
|
+
result = _a.sent();
|
|
254
|
+
return [2 /*return*/, result.data];
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
}); },
|
|
258
|
+
/**
|
|
259
|
+
* Submit a new asset and analyze it synchronously
|
|
260
|
+
* The asset will be classified immediately before the response is returned.
|
|
261
|
+
* This may take longer but ensures the asset is fully processed.
|
|
262
|
+
* @param options - Asset submission options
|
|
263
|
+
* @returns Promise with created and analyzed asset
|
|
264
|
+
*/
|
|
265
|
+
analyze: function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
266
|
+
var result;
|
|
267
|
+
return __generator(this, function (_a) {
|
|
268
|
+
switch (_a.label) {
|
|
269
|
+
case 0:
|
|
270
|
+
if (!("content" in options) && !("url" in options)) {
|
|
271
|
+
throw new Error("Either file content or URL is required");
|
|
272
|
+
}
|
|
273
|
+
if (!options.name) {
|
|
274
|
+
throw new Error("Asset name is required");
|
|
275
|
+
}
|
|
276
|
+
return [4 /*yield*/, this.endpoints.postUploadAsset.submit({
|
|
277
|
+
body: options,
|
|
278
|
+
params: {
|
|
279
|
+
projectId: this.options.projectId,
|
|
280
|
+
},
|
|
281
|
+
query: {
|
|
282
|
+
queue: false, // Process synchronously
|
|
283
|
+
},
|
|
246
284
|
})];
|
|
247
285
|
case 1:
|
|
248
286
|
result = _a.sent();
|
|
@@ -949,8 +949,13 @@ export declare const POST_ASSET_PARAMS_SCHEMA: zod.ZodObject<{
|
|
|
949
949
|
projectId: zod.ZodString;
|
|
950
950
|
}, zod.z.core.$strip>;
|
|
951
951
|
export declare const POST_ASSET_BODY_SCHEMA: zod.ZodIntersection<zod.ZodUnion<readonly [zod.ZodObject<{
|
|
952
|
-
|
|
953
|
-
|
|
952
|
+
content: zod.ZodUnion<readonly [zod.ZodObject<{
|
|
953
|
+
plainText: zod.ZodString;
|
|
954
|
+
type: zod.ZodString;
|
|
955
|
+
}, zod.z.core.$strip>, zod.ZodObject<{
|
|
956
|
+
base64: zod.ZodString;
|
|
957
|
+
type: zod.ZodString;
|
|
958
|
+
}, zod.z.core.$strip>]>;
|
|
954
959
|
externalUrl: zod.ZodOptional<zod.ZodString>;
|
|
955
960
|
}, zod.z.core.$strip>, zod.ZodObject<{
|
|
956
961
|
url: zod.ZodString;
|
|
@@ -969,6 +974,9 @@ export declare const POST_ASSET_BODY_SCHEMA: zod.ZodIntersection<zod.ZodUnion<re
|
|
|
969
974
|
private: "private";
|
|
970
975
|
}>>>>;
|
|
971
976
|
}, zod.z.core.$strip>>>;
|
|
977
|
+
export declare const POST_ASSET_QUERY_SCHEMA: zod.ZodObject<{
|
|
978
|
+
queue: zod.ZodDefault<zod.ZodBoolean>;
|
|
979
|
+
}, zod.z.core.$strip>;
|
|
972
980
|
export declare const POST_ASSET_RESPONSE_SCHEMA: zod.ZodObject<{
|
|
973
981
|
id: zod.ZodString;
|
|
974
982
|
projectId: zod.ZodString;
|
|
@@ -1098,6 +1106,7 @@ export declare const POST_ASSET_RESPONSE_SCHEMA: zod.ZodObject<{
|
|
|
1098
1106
|
}, zod.z.core.$strip>>>;
|
|
1099
1107
|
}, zod.z.core.$strip>;
|
|
1100
1108
|
export type PostAssetParams = zod.infer<typeof POST_ASSET_PARAMS_SCHEMA>;
|
|
1109
|
+
export type PostAssetQuery = zod.infer<typeof POST_ASSET_QUERY_SCHEMA>;
|
|
1101
1110
|
export type PostAssetBody = zod.infer<typeof POST_ASSET_BODY_SCHEMA>;
|
|
1102
1111
|
export type PostAssetResponse = Asset;
|
|
1103
1112
|
export declare const POST_ASSET_REQUEST: {
|
|
@@ -1112,9 +1121,17 @@ export declare const POST_ASSET_REQUEST: {
|
|
|
1112
1121
|
readonly params: zod.ZodObject<{
|
|
1113
1122
|
projectId: zod.ZodString;
|
|
1114
1123
|
}, zod.z.core.$strip>;
|
|
1124
|
+
readonly query: zod.ZodObject<{
|
|
1125
|
+
queue: zod.ZodDefault<zod.ZodBoolean>;
|
|
1126
|
+
}, zod.z.core.$strip>;
|
|
1115
1127
|
readonly body: zod.ZodIntersection<zod.ZodUnion<readonly [zod.ZodObject<{
|
|
1116
|
-
|
|
1117
|
-
|
|
1128
|
+
content: zod.ZodUnion<readonly [zod.ZodObject<{
|
|
1129
|
+
plainText: zod.ZodString;
|
|
1130
|
+
type: zod.ZodString;
|
|
1131
|
+
}, zod.z.core.$strip>, zod.ZodObject<{
|
|
1132
|
+
base64: zod.ZodString;
|
|
1133
|
+
type: zod.ZodString;
|
|
1134
|
+
}, zod.z.core.$strip>]>;
|
|
1118
1135
|
externalUrl: zod.ZodOptional<zod.ZodString>;
|
|
1119
1136
|
}, zod.z.core.$strip>, zod.ZodObject<{
|
|
1120
1137
|
url: zod.ZodString;
|
package/cjs/PublicApiSchemas.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.DELETE_ASSET_REQUEST = exports.DELETE_ASSET_RESPONSE_SCHEMA = exports.DELETE_ASSET_PARAMS_SCHEMA = exports.PATCH_ASSET_REQUEST = exports.PATCH_ASSET_RESPONSE_SCHEMA = exports.PATCH_ASSET_BODY_SCHEMA = exports.PATCH_ASSET_PARAMS_SCHEMA = exports.POST_ASSET_REQUEST = exports.POST_ASSET_RESPONSE_SCHEMA = exports.POST_ASSET_BODY_SCHEMA = exports.POST_ASSET_PARAMS_SCHEMA = exports.GET_ASSET_CHILDREN_REQUEST = exports.GET_ASSET_CHILDREN_RESPONSE_SCHEMA = exports.GET_ASSET_CHILDREN_QUERY_SCHEMA = exports.GET_ASSET_CHILDREN_PARAMS_SCHEMA = exports.GET_ASSET_REQUEST = exports.GET_ASSET_RESPONSE_SCHEMA = exports.GET_ASSET_PARAMS_SCHEMA = exports.GET_ASSETS_PAGE_REQUEST = exports.GET_ASSETS_PAGE_RESPONSE_SCHEMA = exports.GET_ASSETS_PAGE_QUERY_SCHEMA = exports.GET_ASSETS_PAGE_PARAMS_SCHEMA = exports.PUBLIC_ERROR_CODES = void 0;
|
|
36
|
+
exports.DELETE_ASSET_REQUEST = exports.DELETE_ASSET_RESPONSE_SCHEMA = exports.DELETE_ASSET_PARAMS_SCHEMA = exports.PATCH_ASSET_REQUEST = exports.PATCH_ASSET_RESPONSE_SCHEMA = exports.PATCH_ASSET_BODY_SCHEMA = exports.PATCH_ASSET_PARAMS_SCHEMA = exports.POST_ASSET_REQUEST = exports.POST_ASSET_RESPONSE_SCHEMA = exports.POST_ASSET_QUERY_SCHEMA = exports.POST_ASSET_BODY_SCHEMA = exports.POST_ASSET_PARAMS_SCHEMA = exports.GET_ASSET_CHILDREN_REQUEST = exports.GET_ASSET_CHILDREN_RESPONSE_SCHEMA = exports.GET_ASSET_CHILDREN_QUERY_SCHEMA = exports.GET_ASSET_CHILDREN_PARAMS_SCHEMA = exports.GET_ASSET_REQUEST = exports.GET_ASSET_RESPONSE_SCHEMA = exports.GET_ASSET_PARAMS_SCHEMA = exports.GET_ASSETS_PAGE_REQUEST = exports.GET_ASSETS_PAGE_RESPONSE_SCHEMA = exports.GET_ASSETS_PAGE_QUERY_SCHEMA = exports.GET_ASSETS_PAGE_PARAMS_SCHEMA = exports.PUBLIC_ERROR_CODES = void 0;
|
|
37
37
|
var sendable_error_1 = require("sendable-error");
|
|
38
38
|
var zod = __importStar(require("zod/v4"));
|
|
39
39
|
var zod_meta_1 = require("zod-meta");
|
|
@@ -193,16 +193,40 @@ exports.POST_ASSET_PARAMS_SCHEMA = zod.object({
|
|
|
193
193
|
])),
|
|
194
194
|
});
|
|
195
195
|
var POST_ASSET_FILE_BODY_SCHEMA = zod.object({
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
196
|
+
content: zod
|
|
197
|
+
.union([
|
|
198
|
+
zod.object({
|
|
199
|
+
plainText: zod.string().meta((0, zod_meta_1.metaStore)([
|
|
200
|
+
(0, DocMetaTypes_1.docPropertyInfo)({
|
|
201
|
+
description: "Plain text content",
|
|
202
|
+
placeholder: "This is plain text content...",
|
|
203
|
+
}),
|
|
204
|
+
])),
|
|
205
|
+
type: zod.string().meta((0, zod_meta_1.metaStore)([
|
|
206
|
+
(0, DocMetaTypes_1.docPropertyInfo)({
|
|
207
|
+
description: "MIME type or file extension",
|
|
208
|
+
placeholder: "text/plain",
|
|
209
|
+
}),
|
|
210
|
+
])),
|
|
200
211
|
}),
|
|
201
|
-
|
|
202
|
-
|
|
212
|
+
zod.object({
|
|
213
|
+
base64: zod.string().meta((0, zod_meta_1.metaStore)([
|
|
214
|
+
(0, DocMetaTypes_1.docPropertyInfo)({
|
|
215
|
+
description: "Base64 encoded file content or data URL",
|
|
216
|
+
placeholder: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...",
|
|
217
|
+
}),
|
|
218
|
+
])),
|
|
219
|
+
type: zod.string().meta((0, zod_meta_1.metaStore)([
|
|
220
|
+
(0, DocMetaTypes_1.docPropertyInfo)({
|
|
221
|
+
description: "MIME type or file extension",
|
|
222
|
+
placeholder: "image/jpeg",
|
|
223
|
+
}),
|
|
224
|
+
])),
|
|
225
|
+
}),
|
|
226
|
+
])
|
|
227
|
+
.meta((0, zod_meta_1.metaStore)([
|
|
203
228
|
(0, DocMetaTypes_1.docPropertyInfo)({
|
|
204
|
-
description: "
|
|
205
|
-
placeholder: "image/jpeg",
|
|
229
|
+
description: "File content as plain text or base64",
|
|
206
230
|
}),
|
|
207
231
|
])),
|
|
208
232
|
externalUrl: zod.string().url().optional(),
|
|
@@ -228,6 +252,17 @@ var POST_ASSET_COMMON_BODY_SCHEMA = Asset_1.ASSET_SCHEMA.pick({
|
|
|
228
252
|
exports.POST_ASSET_BODY_SCHEMA = zod
|
|
229
253
|
.union([POST_ASSET_FILE_BODY_SCHEMA, POST_ASSET_URL_BODY_SCHEMA])
|
|
230
254
|
.and(POST_ASSET_COMMON_BODY_SCHEMA);
|
|
255
|
+
exports.POST_ASSET_QUERY_SCHEMA = zod.object({
|
|
256
|
+
queue: zod
|
|
257
|
+
.boolean()
|
|
258
|
+
.default(false)
|
|
259
|
+
.meta((0, zod_meta_1.metaStore)([
|
|
260
|
+
(0, DocMetaTypes_1.docPropertyInfo)({
|
|
261
|
+
description: "If true, queue the asset for asynchronous classification. If false, classify synchronously.",
|
|
262
|
+
placeholder: "false",
|
|
263
|
+
}),
|
|
264
|
+
])),
|
|
265
|
+
});
|
|
231
266
|
exports.POST_ASSET_RESPONSE_SCHEMA = Asset_1.ASSET_SCHEMA;
|
|
232
267
|
exports.POST_ASSET_REQUEST = {
|
|
233
268
|
name: "Create Asset",
|
|
@@ -239,6 +274,7 @@ exports.POST_ASSET_REQUEST = {
|
|
|
239
274
|
sdkPath: ["assets", "create"],
|
|
240
275
|
schemas: {
|
|
241
276
|
params: exports.POST_ASSET_PARAMS_SCHEMA,
|
|
277
|
+
query: exports.POST_ASSET_QUERY_SCHEMA,
|
|
242
278
|
body: exports.POST_ASSET_BODY_SCHEMA,
|
|
243
279
|
response: exports.POST_ASSET_RESPONSE_SCHEMA,
|
|
244
280
|
},
|
package/cjs/SharedTypes.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { AssetVisibility } from "./Asset";
|
|
2
2
|
export type SubmitAssetOptions = ({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
content: {
|
|
4
|
+
plainText: string;
|
|
5
|
+
type: string;
|
|
6
|
+
} | {
|
|
7
|
+
base64: string;
|
|
8
|
+
type: string;
|
|
9
|
+
};
|
|
10
|
+
externalUrl?: string;
|
|
6
11
|
} | {
|
|
7
12
|
url: string;
|
|
8
13
|
}) & {
|
package/esm/CalmLensClient.d.ts
CHANGED
|
@@ -49,10 +49,19 @@ export default class CalmLensClient {
|
|
|
49
49
|
*/
|
|
50
50
|
listChildren: (assetId: string, options: GetAssetChildrenQuery) => Promise<GetAssetChildrenResponse>;
|
|
51
51
|
/**
|
|
52
|
-
* Submit a new asset for processing
|
|
52
|
+
* Submit a new asset for processing (queued asynchronously)
|
|
53
|
+
* The asset will be queued for classification and returned immediately.
|
|
53
54
|
* @param options - Asset submission options
|
|
54
55
|
* @returns Promise with created asset
|
|
55
56
|
*/
|
|
56
57
|
create: (options: SubmitAssetOptions) => Promise<Asset>;
|
|
58
|
+
/**
|
|
59
|
+
* Submit a new asset and analyze it synchronously
|
|
60
|
+
* The asset will be classified immediately before the response is returned.
|
|
61
|
+
* This may take longer but ensures the asset is fully processed.
|
|
62
|
+
* @param options - Asset submission options
|
|
63
|
+
* @returns Promise with created and analyzed asset
|
|
64
|
+
*/
|
|
65
|
+
analyze: (options: SubmitAssetOptions) => Promise<Asset>;
|
|
57
66
|
};
|
|
58
67
|
}
|
package/esm/CalmLensClient.js
CHANGED
|
@@ -62,6 +62,7 @@ const createEndpoints = (api) => {
|
|
|
62
62
|
.endpoint()
|
|
63
63
|
.bodyOf()
|
|
64
64
|
.paramsOf()
|
|
65
|
+
.queryOf()
|
|
65
66
|
.responseOf()
|
|
66
67
|
.build({
|
|
67
68
|
id: "postUploadAsset",
|
|
@@ -167,12 +168,13 @@ export default class CalmLensClient {
|
|
|
167
168
|
return result.data;
|
|
168
169
|
}),
|
|
169
170
|
/**
|
|
170
|
-
* Submit a new asset for processing
|
|
171
|
+
* Submit a new asset for processing (queued asynchronously)
|
|
172
|
+
* The asset will be queued for classification and returned immediately.
|
|
171
173
|
* @param options - Asset submission options
|
|
172
174
|
* @returns Promise with created asset
|
|
173
175
|
*/
|
|
174
176
|
create: (options) => __awaiter(this, void 0, void 0, function* () {
|
|
175
|
-
if (!("
|
|
177
|
+
if (!("content" in options) && !("url" in options)) {
|
|
176
178
|
throw new Error("Either file content or URL is required");
|
|
177
179
|
}
|
|
178
180
|
if (!options.name) {
|
|
@@ -183,6 +185,34 @@ export default class CalmLensClient {
|
|
|
183
185
|
params: {
|
|
184
186
|
projectId: this.options.projectId,
|
|
185
187
|
},
|
|
188
|
+
query: {
|
|
189
|
+
queue: true, // Queue for async processing
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
return result.data;
|
|
193
|
+
}),
|
|
194
|
+
/**
|
|
195
|
+
* Submit a new asset and analyze it synchronously
|
|
196
|
+
* The asset will be classified immediately before the response is returned.
|
|
197
|
+
* This may take longer but ensures the asset is fully processed.
|
|
198
|
+
* @param options - Asset submission options
|
|
199
|
+
* @returns Promise with created and analyzed asset
|
|
200
|
+
*/
|
|
201
|
+
analyze: (options) => __awaiter(this, void 0, void 0, function* () {
|
|
202
|
+
if (!("content" in options) && !("url" in options)) {
|
|
203
|
+
throw new Error("Either file content or URL is required");
|
|
204
|
+
}
|
|
205
|
+
if (!options.name) {
|
|
206
|
+
throw new Error("Asset name is required");
|
|
207
|
+
}
|
|
208
|
+
const result = yield this.endpoints.postUploadAsset.submit({
|
|
209
|
+
body: options,
|
|
210
|
+
params: {
|
|
211
|
+
projectId: this.options.projectId,
|
|
212
|
+
},
|
|
213
|
+
query: {
|
|
214
|
+
queue: false, // Process synchronously
|
|
215
|
+
},
|
|
186
216
|
});
|
|
187
217
|
return result.data;
|
|
188
218
|
}),
|
|
@@ -949,8 +949,13 @@ export declare const POST_ASSET_PARAMS_SCHEMA: zod.ZodObject<{
|
|
|
949
949
|
projectId: zod.ZodString;
|
|
950
950
|
}, zod.z.core.$strip>;
|
|
951
951
|
export declare const POST_ASSET_BODY_SCHEMA: zod.ZodIntersection<zod.ZodUnion<readonly [zod.ZodObject<{
|
|
952
|
-
|
|
953
|
-
|
|
952
|
+
content: zod.ZodUnion<readonly [zod.ZodObject<{
|
|
953
|
+
plainText: zod.ZodString;
|
|
954
|
+
type: zod.ZodString;
|
|
955
|
+
}, zod.z.core.$strip>, zod.ZodObject<{
|
|
956
|
+
base64: zod.ZodString;
|
|
957
|
+
type: zod.ZodString;
|
|
958
|
+
}, zod.z.core.$strip>]>;
|
|
954
959
|
externalUrl: zod.ZodOptional<zod.ZodString>;
|
|
955
960
|
}, zod.z.core.$strip>, zod.ZodObject<{
|
|
956
961
|
url: zod.ZodString;
|
|
@@ -969,6 +974,9 @@ export declare const POST_ASSET_BODY_SCHEMA: zod.ZodIntersection<zod.ZodUnion<re
|
|
|
969
974
|
private: "private";
|
|
970
975
|
}>>>>;
|
|
971
976
|
}, zod.z.core.$strip>>>;
|
|
977
|
+
export declare const POST_ASSET_QUERY_SCHEMA: zod.ZodObject<{
|
|
978
|
+
queue: zod.ZodDefault<zod.ZodBoolean>;
|
|
979
|
+
}, zod.z.core.$strip>;
|
|
972
980
|
export declare const POST_ASSET_RESPONSE_SCHEMA: zod.ZodObject<{
|
|
973
981
|
id: zod.ZodString;
|
|
974
982
|
projectId: zod.ZodString;
|
|
@@ -1098,6 +1106,7 @@ export declare const POST_ASSET_RESPONSE_SCHEMA: zod.ZodObject<{
|
|
|
1098
1106
|
}, zod.z.core.$strip>>>;
|
|
1099
1107
|
}, zod.z.core.$strip>;
|
|
1100
1108
|
export type PostAssetParams = zod.infer<typeof POST_ASSET_PARAMS_SCHEMA>;
|
|
1109
|
+
export type PostAssetQuery = zod.infer<typeof POST_ASSET_QUERY_SCHEMA>;
|
|
1101
1110
|
export type PostAssetBody = zod.infer<typeof POST_ASSET_BODY_SCHEMA>;
|
|
1102
1111
|
export type PostAssetResponse = Asset;
|
|
1103
1112
|
export declare const POST_ASSET_REQUEST: {
|
|
@@ -1112,9 +1121,17 @@ export declare const POST_ASSET_REQUEST: {
|
|
|
1112
1121
|
readonly params: zod.ZodObject<{
|
|
1113
1122
|
projectId: zod.ZodString;
|
|
1114
1123
|
}, zod.z.core.$strip>;
|
|
1124
|
+
readonly query: zod.ZodObject<{
|
|
1125
|
+
queue: zod.ZodDefault<zod.ZodBoolean>;
|
|
1126
|
+
}, zod.z.core.$strip>;
|
|
1115
1127
|
readonly body: zod.ZodIntersection<zod.ZodUnion<readonly [zod.ZodObject<{
|
|
1116
|
-
|
|
1117
|
-
|
|
1128
|
+
content: zod.ZodUnion<readonly [zod.ZodObject<{
|
|
1129
|
+
plainText: zod.ZodString;
|
|
1130
|
+
type: zod.ZodString;
|
|
1131
|
+
}, zod.z.core.$strip>, zod.ZodObject<{
|
|
1132
|
+
base64: zod.ZodString;
|
|
1133
|
+
type: zod.ZodString;
|
|
1134
|
+
}, zod.z.core.$strip>]>;
|
|
1118
1135
|
externalUrl: zod.ZodOptional<zod.ZodString>;
|
|
1119
1136
|
}, zod.z.core.$strip>, zod.ZodObject<{
|
|
1120
1137
|
url: zod.ZodString;
|
package/esm/PublicApiSchemas.js
CHANGED
|
@@ -157,16 +157,40 @@ export const POST_ASSET_PARAMS_SCHEMA = zod.object({
|
|
|
157
157
|
])),
|
|
158
158
|
});
|
|
159
159
|
const POST_ASSET_FILE_BODY_SCHEMA = zod.object({
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
content: zod
|
|
161
|
+
.union([
|
|
162
|
+
zod.object({
|
|
163
|
+
plainText: zod.string().meta(metaStore([
|
|
164
|
+
docPropertyInfo({
|
|
165
|
+
description: "Plain text content",
|
|
166
|
+
placeholder: "This is plain text content...",
|
|
167
|
+
}),
|
|
168
|
+
])),
|
|
169
|
+
type: zod.string().meta(metaStore([
|
|
170
|
+
docPropertyInfo({
|
|
171
|
+
description: "MIME type or file extension",
|
|
172
|
+
placeholder: "text/plain",
|
|
173
|
+
}),
|
|
174
|
+
])),
|
|
164
175
|
}),
|
|
165
|
-
|
|
166
|
-
|
|
176
|
+
zod.object({
|
|
177
|
+
base64: zod.string().meta(metaStore([
|
|
178
|
+
docPropertyInfo({
|
|
179
|
+
description: "Base64 encoded file content or data URL",
|
|
180
|
+
placeholder: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...",
|
|
181
|
+
}),
|
|
182
|
+
])),
|
|
183
|
+
type: zod.string().meta(metaStore([
|
|
184
|
+
docPropertyInfo({
|
|
185
|
+
description: "MIME type or file extension",
|
|
186
|
+
placeholder: "image/jpeg",
|
|
187
|
+
}),
|
|
188
|
+
])),
|
|
189
|
+
}),
|
|
190
|
+
])
|
|
191
|
+
.meta(metaStore([
|
|
167
192
|
docPropertyInfo({
|
|
168
|
-
description: "
|
|
169
|
-
placeholder: "image/jpeg",
|
|
193
|
+
description: "File content as plain text or base64",
|
|
170
194
|
}),
|
|
171
195
|
])),
|
|
172
196
|
externalUrl: zod.string().url().optional(),
|
|
@@ -192,6 +216,17 @@ const POST_ASSET_COMMON_BODY_SCHEMA = ASSET_SCHEMA.pick({
|
|
|
192
216
|
export const POST_ASSET_BODY_SCHEMA = zod
|
|
193
217
|
.union([POST_ASSET_FILE_BODY_SCHEMA, POST_ASSET_URL_BODY_SCHEMA])
|
|
194
218
|
.and(POST_ASSET_COMMON_BODY_SCHEMA);
|
|
219
|
+
export const POST_ASSET_QUERY_SCHEMA = zod.object({
|
|
220
|
+
queue: zod
|
|
221
|
+
.boolean()
|
|
222
|
+
.default(false)
|
|
223
|
+
.meta(metaStore([
|
|
224
|
+
docPropertyInfo({
|
|
225
|
+
description: "If true, queue the asset for asynchronous classification. If false, classify synchronously.",
|
|
226
|
+
placeholder: "false",
|
|
227
|
+
}),
|
|
228
|
+
])),
|
|
229
|
+
});
|
|
195
230
|
export const POST_ASSET_RESPONSE_SCHEMA = ASSET_SCHEMA;
|
|
196
231
|
export const POST_ASSET_REQUEST = {
|
|
197
232
|
name: "Create Asset",
|
|
@@ -203,6 +238,7 @@ export const POST_ASSET_REQUEST = {
|
|
|
203
238
|
sdkPath: ["assets", "create"],
|
|
204
239
|
schemas: {
|
|
205
240
|
params: POST_ASSET_PARAMS_SCHEMA,
|
|
241
|
+
query: POST_ASSET_QUERY_SCHEMA,
|
|
206
242
|
body: POST_ASSET_BODY_SCHEMA,
|
|
207
243
|
response: POST_ASSET_RESPONSE_SCHEMA,
|
|
208
244
|
},
|
package/esm/SharedTypes.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { AssetVisibility } from "./Asset";
|
|
2
2
|
export type SubmitAssetOptions = ({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
content: {
|
|
4
|
+
plainText: string;
|
|
5
|
+
type: string;
|
|
6
|
+
} | {
|
|
7
|
+
base64: string;
|
|
8
|
+
type: string;
|
|
9
|
+
};
|
|
10
|
+
externalUrl?: string;
|
|
6
11
|
} | {
|
|
7
12
|
url: string;
|
|
8
13
|
}) & {
|