@calmlens/js-sdk 0.0.3 → 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.
@@ -234,7 +234,7 @@ var CalmLensClient = /** @class */ (function () {
234
234
  return __generator(this, function (_a) {
235
235
  switch (_a.label) {
236
236
  case 0:
237
- if (!("file" in options) && !("url" in options)) {
237
+ if (!("content" in options) && !("url" in options)) {
238
238
  throw new Error("Either file content or URL is required");
239
239
  }
240
240
  if (!options.name) {
@@ -267,7 +267,7 @@ var CalmLensClient = /** @class */ (function () {
267
267
  return __generator(this, function (_a) {
268
268
  switch (_a.label) {
269
269
  case 0:
270
- if (!("file" in options) && !("url" in options)) {
270
+ if (!("content" in options) && !("url" in options)) {
271
271
  throw new Error("Either file content or URL is required");
272
272
  }
273
273
  if (!options.name) {
@@ -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
- file: zod.ZodString;
953
- fileType: zod.ZodString;
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;
@@ -1120,8 +1125,13 @@ export declare const POST_ASSET_REQUEST: {
1120
1125
  queue: zod.ZodDefault<zod.ZodBoolean>;
1121
1126
  }, zod.z.core.$strip>;
1122
1127
  readonly body: zod.ZodIntersection<zod.ZodUnion<readonly [zod.ZodObject<{
1123
- file: zod.ZodString;
1124
- fileType: zod.ZodString;
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>]>;
1125
1135
  externalUrl: zod.ZodOptional<zod.ZodString>;
1126
1136
  }, zod.z.core.$strip>, zod.ZodObject<{
1127
1137
  url: zod.ZodString;
@@ -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
- file: zod.string().meta((0, zod_meta_1.metaStore)([
197
- (0, DocMetaTypes_1.docPropertyInfo)({
198
- description: "Base64 encoded file content or data URL",
199
- placeholder: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...",
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
- fileType: zod.string().meta((0, zod_meta_1.metaStore)([
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: "MIME type or file extension",
205
- placeholder: "image/jpeg",
229
+ description: "File content as plain text or base64",
206
230
  }),
207
231
  ])),
208
232
  externalUrl: zod.string().url().optional(),
@@ -1,8 +1,13 @@
1
1
  import type { AssetVisibility } from "./Asset";
2
2
  export type SubmitAssetOptions = ({
3
- file: string;
4
- fileType: string;
5
- url?: string;
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
  }) & {
@@ -174,7 +174,7 @@ export default class CalmLensClient {
174
174
  * @returns Promise with created asset
175
175
  */
176
176
  create: (options) => __awaiter(this, void 0, void 0, function* () {
177
- if (!("file" in options) && !("url" in options)) {
177
+ if (!("content" in options) && !("url" in options)) {
178
178
  throw new Error("Either file content or URL is required");
179
179
  }
180
180
  if (!options.name) {
@@ -199,7 +199,7 @@ export default class CalmLensClient {
199
199
  * @returns Promise with created and analyzed asset
200
200
  */
201
201
  analyze: (options) => __awaiter(this, void 0, void 0, function* () {
202
- if (!("file" in options) && !("url" in options)) {
202
+ if (!("content" in options) && !("url" in options)) {
203
203
  throw new Error("Either file content or URL is required");
204
204
  }
205
205
  if (!options.name) {
@@ -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
- file: zod.ZodString;
953
- fileType: zod.ZodString;
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;
@@ -1120,8 +1125,13 @@ export declare const POST_ASSET_REQUEST: {
1120
1125
  queue: zod.ZodDefault<zod.ZodBoolean>;
1121
1126
  }, zod.z.core.$strip>;
1122
1127
  readonly body: zod.ZodIntersection<zod.ZodUnion<readonly [zod.ZodObject<{
1123
- file: zod.ZodString;
1124
- fileType: zod.ZodString;
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>]>;
1125
1135
  externalUrl: zod.ZodOptional<zod.ZodString>;
1126
1136
  }, zod.z.core.$strip>, zod.ZodObject<{
1127
1137
  url: zod.ZodString;
@@ -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
- file: zod.string().meta(metaStore([
161
- docPropertyInfo({
162
- description: "Base64 encoded file content or data URL",
163
- placeholder: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...",
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
- fileType: zod.string().meta(metaStore([
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: "MIME type or file extension",
169
- placeholder: "image/jpeg",
193
+ description: "File content as plain text or base64",
170
194
  }),
171
195
  ])),
172
196
  externalUrl: zod.string().url().optional(),
@@ -1,8 +1,13 @@
1
1
  import type { AssetVisibility } from "./Asset";
2
2
  export type SubmitAssetOptions = ({
3
- file: string;
4
- fileType: string;
5
- url?: string;
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calmlens/js-sdk",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "main": "cjs/index.js",
5
5
  "types": "esm/index.d.ts",
6
6
  "module": "esm/index.js",