@decartai/sdk 0.0.26 → 0.0.27

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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ImageModelDefinition, ImageModels, Model, ModelDefinition, RealTimeModels, VideoModelDefinition, VideoModels, models } from "./shared/model.js";
1
+ import { ImageModelDefinition, ImageModels, Model, ModelDefinition, RealTimeModels, VideoModelDefinition, VideoModels, isImageModel, isRealtimeModel, isVideoModel, models } from "./shared/model.js";
2
2
  import { FileInput, ProcessOptions } from "./process/types.js";
3
3
  import { ProcessClient } from "./process/client.js";
4
4
  import { JobStatus, JobStatusResponse, JobSubmitResponse, QueueJobResult, QueueSubmitAndPollOptions, QueueSubmitOptions } from "./queue/types.js";
@@ -109,4 +109,4 @@ declare const createDecartClient: (options?: DecartClientOptions) => {
109
109
  tokens: TokensClient;
110
110
  };
111
111
  //#endregion
112
- export { type CreateTokenResponse, DecartClientOptions, type DecartSDKError, ERROR_CODES, type FileInput, type ImageModelDefinition, type ImageModels, type JobStatus, type JobStatusResponse, type JobSubmitResponse, type Model, type ModelDefinition, type ModelState, type ProcessClient, type ProcessOptions, type QueueClient, type QueueJobResult, type QueueSubmitAndPollOptions, type QueueSubmitOptions, type RealTimeClient, type RealTimeClientConnectOptions, type RealTimeClientInitialState, type RealTimeModels, type TokensClient, type VideoModelDefinition, type VideoModels, createDecartClient, models };
112
+ export { type CreateTokenResponse, DecartClientOptions, type DecartSDKError, ERROR_CODES, type FileInput, type ImageModelDefinition, type ImageModels, type JobStatus, type JobStatusResponse, type JobSubmitResponse, type Model, type ModelDefinition, type ModelState, type ProcessClient, type ProcessOptions, type QueueClient, type QueueJobResult, type QueueSubmitAndPollOptions, type QueueSubmitOptions, type RealTimeClient, type RealTimeClientConnectOptions, type RealTimeClientInitialState, type RealTimeModels, type TokensClient, type VideoModelDefinition, type VideoModels, createDecartClient, isImageModel, isRealtimeModel, isVideoModel, models };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ERROR_CODES, createInvalidApiKeyError, createInvalidBaseUrlError } from "./utils/errors.js";
2
2
  import { createProcessClient } from "./process/client.js";
3
3
  import { createQueueClient } from "./queue/client.js";
4
- import { models } from "./shared/model.js";
4
+ import { isImageModel, isRealtimeModel, isVideoModel, models } from "./shared/model.js";
5
5
  import { createRealTimeClient } from "./realtime/client.js";
6
6
  import { createTokensClient } from "./tokens/client.js";
7
7
  import { readEnv } from "./utils/env.js";
@@ -67,4 +67,4 @@ const createDecartClient = (options = {}) => {
67
67
  };
68
68
 
69
69
  //#endregion
70
- export { ERROR_CODES, createDecartClient, models };
70
+ export { ERROR_CODES, createDecartClient, isImageModel, isRealtimeModel, isVideoModel, models };
@@ -9,6 +9,9 @@ type Model = z.infer<typeof modelSchema>;
9
9
  type RealTimeModels = z.infer<typeof realtimeModels>;
10
10
  type VideoModels = z.infer<typeof videoModels>;
11
11
  type ImageModels = z.infer<typeof imageModels>;
12
+ declare function isRealtimeModel(model: string): model is RealTimeModels;
13
+ declare function isVideoModel(model: string): model is VideoModels;
14
+ declare function isImageModel(model: string): model is ImageModels;
12
15
  declare const modelInputSchemas: {
13
16
  readonly "lucy-pro-t2v": z.ZodObject<{
14
17
  prompt: z.ZodString;
@@ -141,4 +144,4 @@ declare const models: {
141
144
  image: <T extends ImageModels>(model: T) => ModelDefinition<T>;
142
145
  };
143
146
  //#endregion
144
- export { ImageModelDefinition, ImageModels, Model, ModelDefinition, ModelInputSchemas, RealTimeModels, VideoModelDefinition, VideoModels, models };
147
+ export { ImageModelDefinition, ImageModels, Model, ModelDefinition, ModelInputSchemas, RealTimeModels, VideoModelDefinition, VideoModels, isImageModel, isRealtimeModel, isVideoModel, models };
@@ -23,6 +23,15 @@ const modelSchema = z.union([
23
23
  videoModels,
24
24
  imageModels
25
25
  ]);
26
+ function isRealtimeModel(model) {
27
+ return realtimeModels.safeParse(model).success;
28
+ }
29
+ function isVideoModel(model) {
30
+ return videoModels.safeParse(model).success;
31
+ }
32
+ function isImageModel(model) {
33
+ return imageModels.safeParse(model).success;
34
+ }
26
35
  const fileInputSchema = z.union([
27
36
  z.instanceof(File),
28
37
  z.instanceof(Blob),
@@ -271,4 +280,4 @@ const models = {
271
280
  };
272
281
 
273
282
  //#endregion
274
- export { modelDefinitionSchema, models };
283
+ export { isImageModel, isRealtimeModel, isVideoModel, modelDefinitionSchema, models };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decartai/sdk",
3
- "version": "0.0.26",
3
+ "version": "0.0.27",
4
4
  "description": "Decart's JavaScript SDK",
5
5
  "type": "module",
6
6
  "license": "MIT",