@decartai/sdk 0.0.20 → 0.0.21

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 { ImageModels, Model, ModelDefinition, RealTimeModels, VideoModels, models } from "./shared/model.js";
1
+ import { ImageModelDefinition, ImageModels, Model, ModelDefinition, RealTimeModels, VideoModelDefinition, VideoModels, 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";
@@ -20,20 +20,22 @@ declare const createDecartClient: (options: DecartClientOptions) => {
20
20
  connect: (stream: MediaStream, options: RealTimeClientConnectOptions) => Promise<RealTimeClient>;
21
21
  };
22
22
  /**
23
- * Client for video and image generation.
23
+ * Client for synchronous image generation.
24
+ * Only image models support the sync/process API.
24
25
  *
25
26
  * @example
26
27
  * ```ts
27
28
  * const client = createDecartClient({ apiKey: "your-api-key" });
28
29
  * const result = await client.process({
29
- * model: models.video("lucy-pro-t2v"),
30
+ * model: models.image("lucy-pro-t2i"),
30
31
  * prompt: "A beautiful sunset over the ocean"
31
32
  * });
32
33
  * ```
33
34
  */
34
35
  process: ProcessClient;
35
36
  /**
36
- * Client for queue-based async video and image generation.
37
+ * Client for queue-based async video generation.
38
+ * Only video models support the queue API.
37
39
  * Jobs are submitted and processed asynchronously.
38
40
  *
39
41
  * @example
@@ -72,4 +74,4 @@ declare const createDecartClient: (options: DecartClientOptions) => {
72
74
  queue: QueueClient;
73
75
  };
74
76
  //#endregion
75
- export { DecartClientOptions, type DecartSDKError, ERROR_CODES, type FileInput, 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 VideoModels, createDecartClient, models };
77
+ export { 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 VideoModelDefinition, type VideoModels, createDecartClient, models };
@@ -1,7 +1,12 @@
1
- import { ModelDefinition } from "../shared/model.js";
1
+ import { ImageModelDefinition } from "../shared/model.js";
2
2
  import { ProcessOptions } from "./types.js";
3
3
 
4
4
  //#region src/process/client.d.ts
5
- type ProcessClient = <T extends ModelDefinition>(options: ProcessOptions<T>) => Promise<Blob>;
5
+
6
+ /**
7
+ * Client for synchronous image generation.
8
+ * Only image models (t2i, i2i) support the sync/process API.
9
+ */
10
+ type ProcessClient = <T extends ImageModelDefinition>(options: ProcessOptions<T>) => Promise<Blob>;
6
11
  //#endregion
7
12
  export { ProcessClient };
@@ -1,4 +1,4 @@
1
- import { ImageModels, ModelDefinition, ModelInputSchemas, VideoModels } from "../shared/model.js";
1
+ import { ImageModelDefinition, ImageModels, ModelDefinition, ModelInputSchemas, VideoModels } from "../shared/model.js";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region src/process/types.d.ts
@@ -127,11 +127,12 @@ type PickDocumentedInputs<T extends ModelDefinition> = Pick<ModelSpecificProcess
127
127
  */
128
128
  type MergeDocumentedInputs<T extends ModelDefinition> = PickDocumentedInputs<T> & InferModelInputs<T>;
129
129
  /**
130
- * Options for the process client to generate video or image content.
130
+ * Options for the process client to generate image content.
131
+ * Only image models support the sync/process API.
131
132
  *
132
- * @template T - The model definition type
133
+ * @template T - The image model definition type
133
134
  */
134
- type ProcessOptions<T extends ModelDefinition = ModelDefinition> = {
135
+ type ProcessOptions<T extends ImageModelDefinition = ImageModelDefinition> = {
135
136
  /**
136
137
  * The model definition to use.
137
138
  */
@@ -1,7 +1,12 @@
1
- import { ModelDefinition } from "../shared/model.js";
1
+ import { VideoModelDefinition } from "../shared/model.js";
2
2
  import { JobStatusResponse, JobSubmitResponse, QueueJobResult, QueueSubmitAndPollOptions, QueueSubmitOptions } from "./types.js";
3
3
 
4
4
  //#region src/queue/client.d.ts
5
+
6
+ /**
7
+ * Client for queue-based async video generation.
8
+ * Only video models support the queue API.
9
+ */
5
10
  type QueueClient = {
6
11
  /**
7
12
  * Submit a job to the queue for async processing.
@@ -16,7 +21,7 @@ type QueueClient = {
16
21
  * console.log(job.job_id); // "job_abc123"
17
22
  * ```
18
23
  */
19
- submit: <T extends ModelDefinition>(options: QueueSubmitOptions<T>) => Promise<JobSubmitResponse>;
24
+ submit: <T extends VideoModelDefinition>(options: QueueSubmitOptions<T>) => Promise<JobSubmitResponse>;
20
25
  /**
21
26
  * Get the current status of a job.
22
27
  *
@@ -59,7 +64,7 @@ type QueueClient = {
59
64
  * }
60
65
  * ```
61
66
  */
62
- submitAndPoll: <T extends ModelDefinition>(options: QueueSubmitAndPollOptions<T>) => Promise<QueueJobResult>;
67
+ submitAndPoll: <T extends VideoModelDefinition>(options: QueueSubmitAndPollOptions<T>) => Promise<QueueJobResult>;
63
68
  };
64
69
  //#endregion
65
70
  export { QueueClient };
@@ -1,4 +1,4 @@
1
- import { ModelDefinition } from "../shared/model.js";
1
+ import { ModelDefinition, VideoModelDefinition } from "../shared/model.js";
2
2
  import { FileInput, InferModelInputs, ModelSpecificInputs, ProcessInputs } from "../process/types.js";
3
3
 
4
4
  //#region src/queue/types.d.ts
@@ -54,8 +54,9 @@ type PickDocumentedInputs<T extends ModelDefinition> = Pick<ModelSpecificQueueIn
54
54
  type MergeDocumentedInputs<T extends ModelDefinition> = PickDocumentedInputs<T> & InferModelInputs<T>;
55
55
  /**
56
56
  * Options for queue.submit() - submit a job for async processing.
57
+ * Only video models support the queue API.
57
58
  */
58
- type QueueSubmitOptions<T extends ModelDefinition = ModelDefinition> = {
59
+ type QueueSubmitOptions<T extends VideoModelDefinition = VideoModelDefinition> = {
59
60
  /**
60
61
  * The model definition to use.
61
62
  */
@@ -67,8 +68,9 @@ type QueueSubmitOptions<T extends ModelDefinition = ModelDefinition> = {
67
68
  } & MergeDocumentedInputs<T>;
68
69
  /**
69
70
  * Options for queue.submitAndPoll() - submit and wait for completion.
71
+ * Only video models support the queue API.
70
72
  */
71
- type QueueSubmitAndPollOptions<T extends ModelDefinition = ModelDefinition> = QueueSubmitOptions<T> & {
73
+ type QueueSubmitAndPollOptions<T extends VideoModelDefinition = VideoModelDefinition> = QueueSubmitOptions<T> & {
72
74
  /**
73
75
  * Callback invoked when job status changes during polling.
74
76
  * Receives the full job status response object.
@@ -99,6 +99,16 @@ type ModelDefinition<T extends Model = Model> = {
99
99
  height: number;
100
100
  inputSchema: T extends keyof ModelInputSchemas ? ModelInputSchemas[T] : z.ZodTypeAny;
101
101
  };
102
+ /**
103
+ * Type alias for model definitions that support synchronous processing.
104
+ * Only image models support the sync/process API.
105
+ */
106
+ type ImageModelDefinition = ModelDefinition<ImageModels>;
107
+ /**
108
+ * Type alias for model definitions that support queue processing.
109
+ * Only video models support the queue API.
110
+ */
111
+ type VideoModelDefinition = ModelDefinition<VideoModels>;
102
112
  declare const models: {
103
113
  realtime: <T extends RealTimeModels>(model: T) => ModelDefinition<T>;
104
114
  /**
@@ -123,4 +133,4 @@ declare const models: {
123
133
  image: <T extends ImageModels>(model: T) => ModelDefinition<T>;
124
134
  };
125
135
  //#endregion
126
- export { ImageModels, Model, ModelDefinition, ModelInputSchemas, RealTimeModels, VideoModels, models };
136
+ export { ImageModelDefinition, ImageModels, Model, ModelDefinition, ModelInputSchemas, RealTimeModels, VideoModelDefinition, VideoModels, models };
package/dist/version.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Injected at build time from package.json.
5
5
  * Falls back to '0.0.0-dev' in development.
6
6
  */
7
- const VERSION = "0.0.20";
7
+ const VERSION = "0.0.21";
8
8
 
9
9
  //#endregion
10
10
  export { VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decartai/sdk",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "Decart's JavaScript SDK",
5
5
  "type": "module",
6
6
  "license": "MIT",