deepline 0.1.19 → 0.1.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.mts CHANGED
@@ -1173,7 +1173,9 @@ declare class DeeplineClient {
1173
1173
  * console.log(`Logs: ${status.progress?.logs.length ?? 0} lines`);
1174
1174
  * ```
1175
1175
  */
1176
- getPlayStatus(workflowId: string): Promise<PlayStatus>;
1176
+ getPlayStatus(workflowId: string, options?: {
1177
+ billing?: boolean;
1178
+ }): Promise<PlayStatus>;
1177
1179
  /**
1178
1180
  * Get the lightweight tail-polling status for a play execution.
1179
1181
  *
@@ -1434,7 +1436,7 @@ declare class DeeplineClient {
1434
1436
  }>;
1435
1437
  }
1436
1438
 
1437
- declare const SDK_VERSION = "0.1.19";
1439
+ declare const SDK_VERSION = "0.1.21";
1438
1440
  declare const SDK_API_CONTRACT = "2026-05-runs-v2";
1439
1441
 
1440
1442
  /**
package/dist/index.d.ts CHANGED
@@ -1173,7 +1173,9 @@ declare class DeeplineClient {
1173
1173
  * console.log(`Logs: ${status.progress?.logs.length ?? 0} lines`);
1174
1174
  * ```
1175
1175
  */
1176
- getPlayStatus(workflowId: string): Promise<PlayStatus>;
1176
+ getPlayStatus(workflowId: string, options?: {
1177
+ billing?: boolean;
1178
+ }): Promise<PlayStatus>;
1177
1179
  /**
1178
1180
  * Get the lightweight tail-polling status for a play execution.
1179
1181
  *
@@ -1434,7 +1436,7 @@ declare class DeeplineClient {
1434
1436
  }>;
1435
1437
  }
1436
1438
 
1437
- declare const SDK_VERSION = "0.1.19";
1439
+ declare const SDK_VERSION = "0.1.21";
1438
1440
  declare const SDK_API_CONTRACT = "2026-05-runs-v2";
1439
1441
 
1440
1442
  /**
package/dist/index.js CHANGED
@@ -241,7 +241,7 @@ function resolveConfig(options) {
241
241
  }
242
242
 
243
243
  // src/version.ts
244
- var SDK_VERSION = "0.1.19";
244
+ var SDK_VERSION = "0.1.21";
245
245
  var SDK_API_CONTRACT = "2026-05-runs-v2";
246
246
 
247
247
  // ../shared_libs/play-runtime/coordinator-headers.ts
@@ -324,7 +324,7 @@ var HttpClient = class {
324
324
  const response = await fetch(candidateUrl, {
325
325
  method,
326
326
  headers,
327
- body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0,
327
+ body: options?.formData !== void 0 ? options.formData : options?.body !== void 0 ? JSON.stringify(options.body) : void 0,
328
328
  signal: controller.signal
329
329
  });
330
330
  clearTimeout(timeoutId);
@@ -348,7 +348,8 @@ var HttpClient = class {
348
348
  parsed = body;
349
349
  }
350
350
  if (!response.ok) {
351
- const msg = typeof parsed === "object" && parsed && "error" in parsed ? String(parsed.error) : `HTTP ${response.status}`;
351
+ const errorValue = typeof parsed === "object" && parsed && "error" in parsed ? parsed.error : void 0;
352
+ const msg = typeof errorValue === "string" ? errorValue : errorValue && typeof errorValue === "object" && "message" in errorValue && typeof errorValue.message === "string" ? errorValue.message : typeof parsed === "object" && parsed && "message" in parsed && typeof parsed.message === "string" ? parsed.message : `HTTP ${response.status}`;
352
353
  throw new DeeplineError(msg, response.status, "API_ERROR", {
353
354
  response: parsed
354
355
  });
@@ -442,6 +443,13 @@ var HttpClient = class {
442
443
  headers
443
444
  });
444
445
  }
446
+ async postFormData(path, formData, headers) {
447
+ return this.request(path, {
448
+ method: "POST",
449
+ formData,
450
+ headers
451
+ });
452
+ }
445
453
  /**
446
454
  * Send a DELETE request.
447
455
  *
@@ -550,6 +558,14 @@ function mapLegacyTemporalStatus(status) {
550
558
  return "running";
551
559
  }
552
560
  }
561
+ function decodeBase64Bytes(value) {
562
+ const binary = atob(value);
563
+ const bytes = new Uint8Array(binary.length);
564
+ for (let index = 0; index < binary.length; index += 1) {
565
+ bytes[index] = binary.charCodeAt(index);
566
+ }
567
+ return bytes;
568
+ }
553
569
  var DeeplineClient = class {
554
570
  http;
555
571
  config;
@@ -1001,9 +1017,34 @@ var DeeplineClient = class {
1001
1017
  * ```
1002
1018
  */
1003
1019
  async stagePlayFiles(files) {
1004
- const response = await this.http.post(
1020
+ const formData = new FormData();
1021
+ formData.set(
1022
+ "metadata",
1023
+ JSON.stringify({
1024
+ files: files.map((file, index) => ({
1025
+ index,
1026
+ logicalPath: file.logicalPath,
1027
+ contentHash: file.contentHash,
1028
+ contentType: file.contentType,
1029
+ bytes: file.bytes
1030
+ }))
1031
+ })
1032
+ );
1033
+ for (const [index, file] of files.entries()) {
1034
+ const bytes = decodeBase64Bytes(file.contentBase64);
1035
+ const body = bytes.buffer.slice(
1036
+ bytes.byteOffset,
1037
+ bytes.byteOffset + bytes.byteLength
1038
+ );
1039
+ formData.set(
1040
+ `file:${index}`,
1041
+ new Blob([body], { type: file.contentType }),
1042
+ file.logicalPath
1043
+ );
1044
+ }
1045
+ const response = await this.http.postFormData(
1005
1046
  "/api/v2/plays/files/stage",
1006
- { files }
1047
+ formData
1007
1048
  );
1008
1049
  return response.files;
1009
1050
  }
@@ -1032,9 +1073,14 @@ var DeeplineClient = class {
1032
1073
  * console.log(`Logs: ${status.progress?.logs.length ?? 0} lines`);
1033
1074
  * ```
1034
1075
  */
1035
- async getPlayStatus(workflowId) {
1076
+ async getPlayStatus(workflowId, options) {
1077
+ const params = new URLSearchParams();
1078
+ if (options?.billing === false) {
1079
+ params.set("billing", "false");
1080
+ }
1081
+ const query = params.size > 0 ? `?${params.toString()}` : "";
1036
1082
  const response = await this.http.get(
1037
- `/api/v2/plays/run/${encodeURIComponent(workflowId)}`
1083
+ `/api/v2/plays/run/${encodeURIComponent(workflowId)}${query}`
1038
1084
  );
1039
1085
  return normalizePlayStatus(response);
1040
1086
  }
package/dist/index.mjs CHANGED
@@ -195,7 +195,7 @@ function resolveConfig(options) {
195
195
  }
196
196
 
197
197
  // src/version.ts
198
- var SDK_VERSION = "0.1.19";
198
+ var SDK_VERSION = "0.1.21";
199
199
  var SDK_API_CONTRACT = "2026-05-runs-v2";
200
200
 
201
201
  // ../shared_libs/play-runtime/coordinator-headers.ts
@@ -278,7 +278,7 @@ var HttpClient = class {
278
278
  const response = await fetch(candidateUrl, {
279
279
  method,
280
280
  headers,
281
- body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0,
281
+ body: options?.formData !== void 0 ? options.formData : options?.body !== void 0 ? JSON.stringify(options.body) : void 0,
282
282
  signal: controller.signal
283
283
  });
284
284
  clearTimeout(timeoutId);
@@ -302,7 +302,8 @@ var HttpClient = class {
302
302
  parsed = body;
303
303
  }
304
304
  if (!response.ok) {
305
- const msg = typeof parsed === "object" && parsed && "error" in parsed ? String(parsed.error) : `HTTP ${response.status}`;
305
+ const errorValue = typeof parsed === "object" && parsed && "error" in parsed ? parsed.error : void 0;
306
+ const msg = typeof errorValue === "string" ? errorValue : errorValue && typeof errorValue === "object" && "message" in errorValue && typeof errorValue.message === "string" ? errorValue.message : typeof parsed === "object" && parsed && "message" in parsed && typeof parsed.message === "string" ? parsed.message : `HTTP ${response.status}`;
306
307
  throw new DeeplineError(msg, response.status, "API_ERROR", {
307
308
  response: parsed
308
309
  });
@@ -396,6 +397,13 @@ var HttpClient = class {
396
397
  headers
397
398
  });
398
399
  }
400
+ async postFormData(path, formData, headers) {
401
+ return this.request(path, {
402
+ method: "POST",
403
+ formData,
404
+ headers
405
+ });
406
+ }
399
407
  /**
400
408
  * Send a DELETE request.
401
409
  *
@@ -504,6 +512,14 @@ function mapLegacyTemporalStatus(status) {
504
512
  return "running";
505
513
  }
506
514
  }
515
+ function decodeBase64Bytes(value) {
516
+ const binary = atob(value);
517
+ const bytes = new Uint8Array(binary.length);
518
+ for (let index = 0; index < binary.length; index += 1) {
519
+ bytes[index] = binary.charCodeAt(index);
520
+ }
521
+ return bytes;
522
+ }
507
523
  var DeeplineClient = class {
508
524
  http;
509
525
  config;
@@ -955,9 +971,34 @@ var DeeplineClient = class {
955
971
  * ```
956
972
  */
957
973
  async stagePlayFiles(files) {
958
- const response = await this.http.post(
974
+ const formData = new FormData();
975
+ formData.set(
976
+ "metadata",
977
+ JSON.stringify({
978
+ files: files.map((file, index) => ({
979
+ index,
980
+ logicalPath: file.logicalPath,
981
+ contentHash: file.contentHash,
982
+ contentType: file.contentType,
983
+ bytes: file.bytes
984
+ }))
985
+ })
986
+ );
987
+ for (const [index, file] of files.entries()) {
988
+ const bytes = decodeBase64Bytes(file.contentBase64);
989
+ const body = bytes.buffer.slice(
990
+ bytes.byteOffset,
991
+ bytes.byteOffset + bytes.byteLength
992
+ );
993
+ formData.set(
994
+ `file:${index}`,
995
+ new Blob([body], { type: file.contentType }),
996
+ file.logicalPath
997
+ );
998
+ }
999
+ const response = await this.http.postFormData(
959
1000
  "/api/v2/plays/files/stage",
960
- { files }
1001
+ formData
961
1002
  );
962
1003
  return response.files;
963
1004
  }
@@ -986,9 +1027,14 @@ var DeeplineClient = class {
986
1027
  * console.log(`Logs: ${status.progress?.logs.length ?? 0} lines`);
987
1028
  * ```
988
1029
  */
989
- async getPlayStatus(workflowId) {
1030
+ async getPlayStatus(workflowId, options) {
1031
+ const params = new URLSearchParams();
1032
+ if (options?.billing === false) {
1033
+ params.set("billing", "false");
1034
+ }
1035
+ const query = params.size > 0 ? `?${params.toString()}` : "";
990
1036
  const response = await this.http.get(
991
- `/api/v2/plays/run/${encodeURIComponent(workflowId)}`
1037
+ `/api/v2/plays/run/${encodeURIComponent(workflowId)}${query}`
992
1038
  );
993
1039
  return normalizePlayStatus(response);
994
1040
  }