@indreamai/client 0.2.1 → 0.3.0

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,5 +1,6 @@
1
1
  interface components {
2
2
  schemas: {
3
+ /** @description Problem-details style error payload with a stable `errorCode`. */
3
4
  Problem: {
4
5
  type: string;
5
6
  title: string;
@@ -7,6 +8,23 @@ interface components {
7
8
  detail: string;
8
9
  errorCode?: string;
9
10
  };
11
+ /** @description Request body for creating a persistent editor project. */
12
+ CreateProjectRequest: {
13
+ title?: string;
14
+ description?: string | null;
15
+ editorState: components["schemas"]["editor-state.v1.schema"];
16
+ stateVersion?: string;
17
+ };
18
+ PatchProjectRequest: {
19
+ title?: string;
20
+ description?: string | null;
21
+ };
22
+ /** @description Request body for autosave-style editor state sync. */
23
+ SyncProjectRequest: {
24
+ editorState: components["schemas"]["editor-state.v1.schema"];
25
+ stateVersion?: string;
26
+ };
27
+ /** @description Request body for stateless export creation. */
10
28
  CreateExportRequest: {
11
29
  clientTaskId?: string;
12
30
  editorState: components["schemas"]["editor-state.v1.schema"];
@@ -25,16 +43,90 @@ interface components {
25
43
  [key: string]: string;
26
44
  };
27
45
  };
46
+ /** @description Request body for project-based export creation. */
47
+ CreateProjectExportRequest: {
48
+ clientTaskId?: string;
49
+ /** @enum {integer} */
50
+ fps: 30 | 60;
51
+ /** @enum {string} */
52
+ ratio: "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "custom";
53
+ scale: number;
54
+ /** @enum {string} */
55
+ format: "mp4" | "webm";
56
+ callbackUrl?: string;
57
+ callbackHeaders?: {
58
+ [key: string]: string;
59
+ };
60
+ };
61
+ AddProjectAssetRequest: {
62
+ /** Format: uuid */
63
+ assetId: string;
64
+ };
65
+ ProjectSummary: {
66
+ /** Format: uuid */
67
+ projectId: string;
68
+ title: string;
69
+ description: string | null;
70
+ /** Format: date-time */
71
+ createdAt: string;
72
+ /** Format: date-time */
73
+ updatedAt: string;
74
+ };
75
+ /** @description Project detail response, including the latest persisted editor state. */
76
+ ProjectDetail: components["schemas"]["ProjectSummary"] & {
77
+ editorState: components["schemas"]["editor-state.v1.schema"];
78
+ stateVersion: string;
79
+ };
80
+ ProjectMetadata: {
81
+ /** Format: uuid */
82
+ projectId: string;
83
+ title: string;
84
+ description: string | null;
85
+ /** Format: date-time */
86
+ updatedAt: string;
87
+ };
88
+ SyncProjectResponseData: {
89
+ /** Format: uuid */
90
+ projectId: string;
91
+ stateVersion: string;
92
+ /** Format: date-time */
93
+ updatedAt: string;
94
+ };
95
+ /**
96
+ * @description Core asset fields returned by OpenAPI.
97
+ * To reference uploaded files in editor JSON, map `fileUrl` to `assets[*].remoteUrl` and `fileKey` to `assets[*].remoteKey`.
98
+ */
99
+ Asset: {
100
+ /** Format: uuid */
101
+ assetId: string;
102
+ type: string;
103
+ source: string | null;
104
+ filename: string;
105
+ mimetype: string;
106
+ size: number | null;
107
+ fileUrl: string;
108
+ fileKey: string;
109
+ width: number | null;
110
+ height: number | null;
111
+ duration: number | null;
112
+ };
113
+ /** @description Export creation response shared by stateless and project-based export routes. */
28
114
  CreateExportResponseData: {
29
115
  taskId: string;
116
+ /** Format: uuid */
117
+ projectId?: string | null;
30
118
  /** Format: date-time */
31
119
  createdAt: string;
32
120
  durationSeconds: number;
33
121
  billedStandardSeconds: number;
34
122
  chargedCredits: string;
123
+ chargedCreditPool?: string;
35
124
  };
125
+ /** @description Export task snapshot returned by task detail, list, and webhook payloads. */
36
126
  ExportTask: {
37
127
  taskId: string;
128
+ /** Format: uuid */
129
+ projectId: string | null;
38
130
  createdByApiKeyId: string | null;
39
131
  clientTaskId: string | null;
40
132
  /** @enum {string} */
@@ -123,6 +215,87 @@ interface components {
123
215
  valid: boolean;
124
216
  errors: components["schemas"]["EditorValidationError"][];
125
217
  };
218
+ ProjectSummaryEnvelope: {
219
+ data: components["schemas"]["ProjectSummary"];
220
+ meta: {
221
+ [key: string]: unknown;
222
+ };
223
+ };
224
+ ProjectDetailEnvelope: {
225
+ data: components["schemas"]["ProjectDetail"];
226
+ meta: {
227
+ [key: string]: unknown;
228
+ };
229
+ };
230
+ ProjectMetadataEnvelope: {
231
+ data: components["schemas"]["ProjectMetadata"];
232
+ meta: {
233
+ [key: string]: unknown;
234
+ };
235
+ };
236
+ SyncProjectEnvelope: {
237
+ data: components["schemas"]["SyncProjectResponseData"];
238
+ meta: {
239
+ [key: string]: unknown;
240
+ };
241
+ };
242
+ DeleteProjectEnvelope: {
243
+ data: {
244
+ /** Format: uuid */
245
+ projectId: string;
246
+ deleted: boolean;
247
+ };
248
+ meta: {
249
+ [key: string]: unknown;
250
+ };
251
+ };
252
+ AssetEnvelope: {
253
+ data: components["schemas"]["Asset"];
254
+ meta: {
255
+ [key: string]: unknown;
256
+ };
257
+ };
258
+ ListAssetsResponseEnvelope: {
259
+ data: components["schemas"]["Asset"][];
260
+ meta: {
261
+ nextPageCursor?: string | null;
262
+ } & {
263
+ [key: string]: unknown;
264
+ };
265
+ };
266
+ ProjectAssetBindingEnvelope: {
267
+ data: {
268
+ /** Format: uuid */
269
+ projectId: string;
270
+ /** Format: uuid */
271
+ assetId: string;
272
+ };
273
+ meta: {
274
+ [key: string]: unknown;
275
+ };
276
+ };
277
+ DeleteProjectAssetEnvelope: {
278
+ data: {
279
+ /** Format: uuid */
280
+ projectId: string;
281
+ /** Format: uuid */
282
+ assetId: string;
283
+ deleted: boolean;
284
+ };
285
+ meta: {
286
+ [key: string]: unknown;
287
+ };
288
+ };
289
+ DeleteAssetEnvelope: {
290
+ data: {
291
+ /** Format: uuid */
292
+ assetId: string;
293
+ deleted: boolean;
294
+ };
295
+ meta: {
296
+ [key: string]: unknown;
297
+ };
298
+ };
126
299
  CreateExportResponseEnvelope: {
127
300
  data: components["schemas"]["CreateExportResponseData"];
128
301
  meta: {
@@ -143,6 +316,14 @@ interface components {
143
316
  [key: string]: unknown;
144
317
  };
145
318
  };
319
+ ListProjectsResponseEnvelope: {
320
+ data: components["schemas"]["ProjectSummary"][];
321
+ meta: {
322
+ nextPageCursor?: string | null;
323
+ } & {
324
+ [key: string]: unknown;
325
+ };
326
+ };
146
327
  EditorCapabilitiesResponseEnvelope: {
147
328
  data: components["schemas"]["EditorCapabilities"];
148
329
  meta: {
@@ -592,7 +773,22 @@ interface components {
592
773
  };
593
774
  };
594
775
  };
595
- parameters: never;
776
+ parameters: {
777
+ /**
778
+ * @description Optional idempotency key for create/finalize style POST requests.
779
+ * When provided, the server replays the first completed response for the same request payload.
780
+ */
781
+ IdempotencyKey: string;
782
+ ProjectId: string;
783
+ AssetId: string;
784
+ /** @description Original filename for the uploaded file. */
785
+ UploadFileName: string;
786
+ /** @description Optional project to bind the created asset to. */
787
+ UploadProjectId: string;
788
+ PageSize: number;
789
+ PageSizeAssets: number;
790
+ PageCursor: string;
791
+ };
596
792
  requestBodies: never;
597
793
  headers: never;
598
794
  pathItems: never;
@@ -629,13 +825,16 @@ interface ICreateExportRequest {
629
825
  }
630
826
  interface ICreateExportResponse {
631
827
  taskId: string;
828
+ projectId?: string | null;
632
829
  createdAt: string;
633
830
  durationSeconds: number;
634
831
  billedStandardSeconds: number;
635
832
  chargedCredits: string;
833
+ chargedCreditPool?: string;
636
834
  }
637
835
  interface IExportTask {
638
836
  taskId: string;
837
+ projectId?: string | null;
639
838
  createdByApiKeyId: string | null;
640
839
  clientTaskId: string | null;
641
840
  status: TTaskStatus;
@@ -735,6 +934,100 @@ interface IWaitOptions {
735
934
  pollIntervalMs?: number;
736
935
  signal?: AbortSignal;
737
936
  }
937
+ interface IProjectSummary {
938
+ projectId: string;
939
+ title: string;
940
+ description: string | null;
941
+ createdAt: string;
942
+ updatedAt: string;
943
+ }
944
+ interface IProjectDetail extends IProjectSummary {
945
+ editorState: TEditorStateV1;
946
+ stateVersion: string;
947
+ }
948
+ interface ICreateProjectRequest {
949
+ title?: string;
950
+ description?: string | null;
951
+ editorState: TEditorStateV1;
952
+ stateVersion?: string;
953
+ }
954
+ interface IUpdateProjectRequest {
955
+ title?: string;
956
+ description?: string | null;
957
+ }
958
+ interface ISyncProjectRequest {
959
+ editorState: TEditorStateV1;
960
+ stateVersion?: string;
961
+ }
962
+ interface IProjectMetadataResponse {
963
+ projectId: string;
964
+ title: string;
965
+ description: string | null;
966
+ updatedAt: string;
967
+ }
968
+ interface IProjectSyncResponse {
969
+ projectId: string;
970
+ stateVersion: string;
971
+ updatedAt: string;
972
+ }
973
+ interface IDeleteProjectResponse {
974
+ projectId: string;
975
+ deleted: boolean;
976
+ }
977
+ interface IListProjectsResponse {
978
+ items: IProjectSummary[];
979
+ nextPageCursor: string | null;
980
+ }
981
+ interface IAsset {
982
+ assetId: string;
983
+ type: string;
984
+ source: string | null;
985
+ filename: string;
986
+ mimetype: string;
987
+ size: number | null;
988
+ fileUrl: string;
989
+ fileKey: string;
990
+ width: number | null;
991
+ height: number | null;
992
+ duration: number | null;
993
+ }
994
+ interface IListAssetsResponse {
995
+ items: IAsset[];
996
+ nextPageCursor: string | null;
997
+ }
998
+ type TUploadBody = Blob | ArrayBuffer | ArrayBufferView | ReadableStream<Uint8Array>;
999
+ interface IUploadOptions extends IRequestOptions {
1000
+ filename?: string;
1001
+ contentType?: string;
1002
+ projectId?: string;
1003
+ }
1004
+ interface IProjectAssetBindingResponse {
1005
+ projectId: string;
1006
+ assetId: string;
1007
+ }
1008
+ interface IDeleteProjectAssetResponse extends IProjectAssetBindingResponse {
1009
+ deleted: boolean;
1010
+ }
1011
+ interface IDeleteAssetResponse {
1012
+ assetId: string;
1013
+ deleted: boolean;
1014
+ }
1015
+ interface ICreateProjectExportRequest {
1016
+ clientTaskId?: string;
1017
+ fps: 30 | 60;
1018
+ ratio: TExportRatio;
1019
+ scale: number;
1020
+ format: TExportFormat;
1021
+ callbackUrl?: string;
1022
+ callbackHeaders?: Record<string, string>;
1023
+ }
1024
+
1025
+ declare class AssetsResource {
1026
+ private readonly client;
1027
+ constructor(client: IndreamClient);
1028
+ get(assetId: string, options?: IRequestOptions): Promise<IAsset>;
1029
+ delete(assetId: string, options?: IRequestOptions): Promise<IDeleteAssetResponse>;
1030
+ }
738
1031
 
739
1032
  declare class ExportsResource {
740
1033
  private readonly client;
@@ -759,6 +1052,36 @@ declare class EditorResource {
759
1052
  validate(editorState: TEditorStateV1, options?: IRequestOptions): Promise<IEditorValidationResult>;
760
1053
  }
761
1054
 
1055
+ declare class ProjectsResource {
1056
+ private readonly client;
1057
+ constructor(client: IndreamClient);
1058
+ create(payload: ICreateProjectRequest, options?: ICreateRequestOptions): Promise<IProjectSummary>;
1059
+ list(params?: {
1060
+ pageSize?: number;
1061
+ pageCursor?: string;
1062
+ signal?: AbortSignal;
1063
+ }): Promise<IListProjectsResponse>;
1064
+ get(projectId: string, options?: IRequestOptions): Promise<IProjectDetail>;
1065
+ update(projectId: string, payload: IUpdateProjectRequest, options?: IRequestOptions): Promise<IProjectMetadataResponse>;
1066
+ sync(projectId: string, payload: ISyncProjectRequest, options?: IRequestOptions): Promise<IProjectSyncResponse>;
1067
+ delete(projectId: string, options?: IRequestOptions): Promise<IDeleteProjectResponse>;
1068
+ listAssets(params: {
1069
+ projectId: string;
1070
+ pageSize?: number;
1071
+ pageCursor?: string;
1072
+ signal?: AbortSignal;
1073
+ }): Promise<IListAssetsResponse>;
1074
+ addAsset(projectId: string, assetId: string, options?: IRequestOptions): Promise<IProjectAssetBindingResponse>;
1075
+ removeAsset(projectId: string, assetId: string, options?: IRequestOptions): Promise<IDeleteProjectAssetResponse>;
1076
+ createExport(projectId: string, payload: ICreateProjectExportRequest, options?: ICreateRequestOptions): Promise<ICreateExportResponse>;
1077
+ }
1078
+
1079
+ declare class UploadsResource {
1080
+ private readonly client;
1081
+ constructor(client: IndreamClient);
1082
+ upload(body: TUploadBody, options?: IUploadOptions): Promise<IAsset>;
1083
+ }
1084
+
762
1085
  declare class IndreamClient {
763
1086
  readonly apiKey: string;
764
1087
  readonly baseURL: string;
@@ -768,9 +1091,12 @@ declare class IndreamClient {
768
1091
  readonly fetchImpl: typeof fetch;
769
1092
  readonly exports: ExportsResource;
770
1093
  readonly editor: EditorResource;
1094
+ readonly projects: ProjectsResource;
1095
+ readonly uploads: UploadsResource;
1096
+ readonly assets: AssetsResource;
771
1097
  constructor(options: IClientOptions);
772
1098
  request<T>(path: string, init: {
773
- method: 'GET' | 'POST';
1099
+ method: 'GET' | 'POST' | 'PATCH' | 'DELETE';
774
1100
  body?: unknown;
775
1101
  headers?: Record<string, string>;
776
1102
  idempotencyKey?: string;
@@ -778,7 +1104,7 @@ declare class IndreamClient {
778
1104
  skipRetry?: boolean;
779
1105
  }): Promise<T>;
780
1106
  requestEnvelope<T>(path: string, init: {
781
- method: 'GET' | 'POST';
1107
+ method: 'GET' | 'POST' | 'PATCH' | 'DELETE';
782
1108
  body?: unknown;
783
1109
  headers?: Record<string, string>;
784
1110
  idempotencyKey?: string;
@@ -829,4 +1155,4 @@ declare const parseExportWebhookEvent: (value: unknown) => IExportWebhookEvent;
829
1155
  declare const verifyExportWebhookSignature: ({ webhookSecret, timestamp, rawBody, signature, }: IVerifyExportWebhookSignatureParams) => Promise<boolean>;
830
1156
  declare const verifyExportWebhookRequest: ({ webhookSecret, rawBody, headers, maxSkewSeconds, nowTimestampSeconds, }: IVerifyExportWebhookRequestParams) => Promise<boolean>;
831
1157
 
832
- export { APIError, AuthError, type IApiEnvelope, type IApiProblem, type ICaptionAnimationPresetGroups, type ICaptionAnimationPresetItem, type IClientOptions, type ICreateExportRequest, type ICreateExportResponse, type ICreateRequestOptions, type IEditorCapabilities, type IEditorValidationError, type IEditorValidationResult, type IExportTask, type IExportWebhookEvent, type IListExportsResponse, type IRequestOptions, type IVerifyExportWebhookRequestParams, type IVerifyExportWebhookSignatureParams, type IWaitOptions, IndreamClient, RateLimitError, type TEditorStateV1, type TExportFormat, type TExportRatio, type TExportWebhookEventType, type TTaskStatus, type TWebhookHeaders, ValidationError, createApiError, isExportTaskSnapshot, isExportWebhookEvent, isExportWebhookEventType, isTaskStatus, parseExportWebhookEvent, toApiProblem, verifyExportWebhookRequest, verifyExportWebhookSignature };
1158
+ export { APIError, AssetsResource, AuthError, EditorResource, ExportsResource, type IApiEnvelope, type IApiProblem, type IAsset, type ICaptionAnimationPresetGroups, type ICaptionAnimationPresetItem, type IClientOptions, type ICreateExportRequest, type ICreateExportResponse, type ICreateProjectExportRequest, type ICreateProjectRequest, type ICreateRequestOptions, type IDeleteAssetResponse, type IDeleteProjectAssetResponse, type IDeleteProjectResponse, type IEditorCapabilities, type IEditorValidationError, type IEditorValidationResult, type IExportTask, type IExportWebhookEvent, type IListAssetsResponse, type IListExportsResponse, type IListProjectsResponse, type IProjectAssetBindingResponse, type IProjectDetail, type IProjectMetadataResponse, type IProjectSummary, type IProjectSyncResponse, type IRequestOptions, type ISyncProjectRequest, type IUpdateProjectRequest, type IUploadOptions, type IVerifyExportWebhookRequestParams, type IVerifyExportWebhookSignatureParams, type IWaitOptions, IndreamClient, ProjectsResource, RateLimitError, type TEditorStateV1, type TExportFormat, type TExportRatio, type TExportWebhookEventType, type TTaskStatus, type TUploadBody, type TWebhookHeaders, UploadsResource, ValidationError, createApiError, isExportTaskSnapshot, isExportWebhookEvent, isExportWebhookEventType, isTaskStatus, parseExportWebhookEvent, toApiProblem, verifyExportWebhookRequest, verifyExportWebhookSignature };