@audialize/sdk 0.1.0 → 1.0.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.cjs CHANGED
@@ -73,6 +73,7 @@ var HttpClient = class {
73
73
  baseUrl;
74
74
  timeout;
75
75
  maxRetries;
76
+ defaultHeaders;
76
77
  fetchImpl;
77
78
  constructor(options) {
78
79
  if (!options.apiKey) {
@@ -82,12 +83,27 @@ var HttpClient = class {
82
83
  this.baseUrl = options.baseUrl || "https://api.audialize.com";
83
84
  this.timeout = options.timeout || 3e4;
84
85
  this.maxRetries = options.maxRetries ?? 3;
86
+ this.defaultHeaders = options.defaultHeaders ?? {};
85
87
  this.fetchImpl = options.fetch || globalThis.fetch.bind(globalThis);
86
88
  }
87
89
  async request(path, options = {}) {
90
+ const response = await this.execute(path, options);
91
+ if (response.status === 204) {
92
+ return {};
93
+ }
94
+ return await response.json();
95
+ }
96
+ async requestRaw(path, options = {}) {
97
+ return this.execute(path, options);
98
+ }
99
+ async execute(path, options = {}) {
88
100
  const url = new URL(path, this.baseUrl).toString();
89
- const headers = new Headers(options.headers);
90
- headers.set("Authorization", `Bearer ${this.apiKey}`);
101
+ const headers = new Headers(this.defaultHeaders);
102
+ const requestHeaders = new Headers(options.headers);
103
+ requestHeaders.forEach((value, key) => {
104
+ headers.set(key, value);
105
+ });
106
+ headers.set("x-api-key", this.apiKey);
91
107
  if (!headers.has("Content-Type") && options.body && typeof options.body === "string") {
92
108
  headers.set("Content-Type", "application/json");
93
109
  }
@@ -103,10 +119,7 @@ var HttpClient = class {
103
119
  });
104
120
  clearTimeout(timeoutId);
105
121
  if (response.ok) {
106
- if (response.status === 204) {
107
- return {};
108
- }
109
- return await response.json();
122
+ return response;
110
123
  }
111
124
  await this.handleErrorResponse(response);
112
125
  } catch (error) {
@@ -297,15 +310,152 @@ var JobsResource = class {
297
310
  constructor(client) {
298
311
  this.client = client;
299
312
  }
313
+ async start(request) {
314
+ return this.client.request("/jobs/start", {
315
+ method: "POST",
316
+ body: JSON.stringify(request)
317
+ });
318
+ }
319
+ async create(options) {
320
+ const response = await this.client.request("/jobs", {
321
+ method: "POST",
322
+ body: JSON.stringify({
323
+ fileName: options.fileName,
324
+ languages: options.languages,
325
+ ...options.sourceLanguage !== void 0 && { sourceLanguage: options.sourceLanguage }
326
+ })
327
+ });
328
+ const jobId = getStringField(response, "jobId") ?? getStringField(response, "id");
329
+ if (!jobId) {
330
+ throw new AudiolizeValidationError("Create job response did not include a job identifier.");
331
+ }
332
+ const success = getBooleanField(response, "success");
333
+ const message = getStringField(response, "message");
334
+ return {
335
+ jobId,
336
+ ...success !== void 0 && { success },
337
+ ...message !== void 0 && { message }
338
+ };
339
+ }
340
+ async updateSubtitles(jobId, payload) {
341
+ return this.client.request(`/jobs/${jobId}/subtitles`, {
342
+ method: "PUT",
343
+ body: JSON.stringify(payload)
344
+ });
345
+ }
346
+ async updateSubtitlesForLanguage(jobId, language, body, contentType) {
347
+ const response = await this.client.requestRaw(`/jobs/${jobId}/subtitles/${language}`, {
348
+ method: "PUT",
349
+ headers: {
350
+ "Content-Type": contentType
351
+ },
352
+ body
353
+ });
354
+ return {
355
+ body: await response.text(),
356
+ contentType: response.headers.get("content-type") || "application/json",
357
+ statusCode: response.status
358
+ };
359
+ }
360
+ async getSubtitles(jobId, language) {
361
+ return this.client.request(`/jobs/${jobId}/subtitles/${language}`);
362
+ }
363
+ async getSummary(jobId, language) {
364
+ const query = new URLSearchParams();
365
+ if (language) query.set("language", language);
366
+ const path = `/jobs/${jobId}/summary${query.toString() ? `?${query.toString()}` : ""}`;
367
+ return this.client.request(path);
368
+ }
369
+ async generateSummary(jobId, payload) {
370
+ return this.client.request(`/jobs/${jobId}/summary`, {
371
+ method: "POST",
372
+ body: JSON.stringify(payload)
373
+ });
374
+ }
375
+ async cleanSubtitles(jobId, payload) {
376
+ return this.client.request(`/jobs/${jobId}/subtitles/clean`, {
377
+ method: "POST",
378
+ body: JSON.stringify(payload)
379
+ });
380
+ }
381
+ async getThumbnail(jobId) {
382
+ return this.client.request(`/jobs/${jobId}/thumbnail`);
383
+ }
384
+ async getVideo(jobId) {
385
+ return this.client.request(`/jobs/${jobId}/video`);
386
+ }
387
+ async getAudio(jobId, language) {
388
+ return this.client.requestRaw(`/audio/${jobId}/${language}`);
389
+ }
390
+ async updateSpeakerNames(payload) {
391
+ return this.client.request("/jobs/update-speaker-names", {
392
+ method: "POST",
393
+ body: JSON.stringify(payload)
394
+ });
395
+ }
396
+ async pauseResume(jobId, payload) {
397
+ return this.client.request(`/jobs/${jobId}/pause-resume`, {
398
+ method: "POST",
399
+ body: JSON.stringify(payload)
400
+ });
401
+ }
402
+ async submitFeedback(jobId, payload) {
403
+ return this.client.request(`/jobs/${jobId}/feedback`, {
404
+ method: "POST",
405
+ body: JSON.stringify(payload)
406
+ });
407
+ }
408
+ async generateQualityAiInsights(jobId, payload) {
409
+ return this.client.request(`/jobs/${jobId}/quality/ai-insights`, {
410
+ method: "POST",
411
+ body: JSON.stringify(payload)
412
+ });
413
+ }
300
414
  async get(jobId) {
301
415
  return this.client.request(`/jobs/${jobId}/status`);
302
416
  }
417
+ async delete(jobId) {
418
+ return this.client.request(`/jobs/${jobId}`, {
419
+ method: "DELETE"
420
+ });
421
+ }
422
+ async getCapabilityReadiness(jobId) {
423
+ return this.client.request(`/jobs/${jobId}/capabilities`);
424
+ }
425
+ async listArtifacts(jobId, options = {}) {
426
+ const query = new URLSearchParams();
427
+ if (options.type) query.set("type", options.type);
428
+ if (options.language) query.set("language", options.language);
429
+ if (options.status) query.set("status", options.status);
430
+ const path = `/jobs/${jobId}/artifacts${query.toString() ? `?${query.toString()}` : ""}`;
431
+ return this.client.request(path);
432
+ }
433
+ async startCapabilityRun(jobId, capability, request = {}) {
434
+ return this.client.request(`/jobs/${jobId}/capabilities/${capability}/runs`, {
435
+ method: "POST",
436
+ body: JSON.stringify(request)
437
+ });
438
+ }
439
+ async listHighlights(jobId) {
440
+ return this.client.request(`/jobs/${jobId}/highlights`);
441
+ }
442
+ async listCommentary(jobId) {
443
+ return this.client.request(`/jobs/${jobId}/commentary`);
444
+ }
445
+ async listExports(jobId, options = {}) {
446
+ const query = new URLSearchParams();
447
+ if (options.status) query.set("status", options.status);
448
+ if (options.packageFormat) query.set("packageFormat", options.packageFormat);
449
+ const path = `/jobs/${jobId}/exports${query.toString() ? `?${query.toString()}` : ""}`;
450
+ return this.client.request(path);
451
+ }
303
452
  async list(options) {
304
453
  const query = new URLSearchParams();
305
454
  if (options?.limit) query.set("limit", options.limit.toString());
306
455
  if (options?.pageToken) query.set("pageToken", options.pageToken);
307
456
  const path = `/jobs${query.toString() ? `?${query.toString()}` : ""}`;
308
- return this.client.request(path);
457
+ const raw = await this.client.request(path);
458
+ return normalizeJobList(raw);
309
459
  }
310
460
  /**
311
461
  * Polls until the job reaches `completed` or `failed`, then returns the final job.
@@ -333,6 +483,235 @@ var JobsResource = class {
333
483
  return new JobPoller(jobId, this, options);
334
484
  }
335
485
  };
486
+ function getStringField(record, key) {
487
+ const value = record[key];
488
+ return typeof value === "string" ? value : void 0;
489
+ }
490
+ function getBooleanField(record, key) {
491
+ const value = record[key];
492
+ return typeof value === "boolean" ? value : void 0;
493
+ }
494
+ function normalizeJobList(raw) {
495
+ if (!isRecord2(raw)) {
496
+ return { items: [] };
497
+ }
498
+ const explicitItems = raw.items;
499
+ if (Array.isArray(explicitItems)) {
500
+ return {
501
+ items: explicitItems,
502
+ ...typeof raw.nextPageToken === "string" ? { nextPageToken: raw.nextPageToken } : {}
503
+ };
504
+ }
505
+ const jobs = raw.jobs;
506
+ const pagination = isRecord2(raw.pagination) ? raw.pagination : void 0;
507
+ const nextPageToken = typeof raw.nextPageToken === "string" ? raw.nextPageToken : typeof pagination?.nextStartAfter === "string" ? pagination.nextStartAfter : typeof raw.lastEvaluatedKey === "string" ? raw.lastEvaluatedKey : void 0;
508
+ if (Array.isArray(jobs)) {
509
+ return {
510
+ items: jobs,
511
+ ...nextPageToken !== void 0 ? { nextPageToken } : {}
512
+ };
513
+ }
514
+ return { items: [] };
515
+ }
516
+ function isRecord2(value) {
517
+ return typeof value === "object" && value !== null && !Array.isArray(value);
518
+ }
519
+
520
+ // src/resources/highlights.ts
521
+ var HighlightsResource = class {
522
+ constructor(client) {
523
+ this.client = client;
524
+ }
525
+ async create(request) {
526
+ return this.client.request("/highlights", {
527
+ method: "POST",
528
+ body: JSON.stringify(request)
529
+ });
530
+ }
531
+ async list(options = {}) {
532
+ const query = new URLSearchParams();
533
+ if (options.sourceKind) query.set("sourceKind", options.sourceKind);
534
+ if (options.sourceId) query.set("sourceId", options.sourceId);
535
+ if (options.status) query.set("status", options.status);
536
+ const path = `/highlights${query.toString() ? `?${query.toString()}` : ""}`;
537
+ return this.client.request(path);
538
+ }
539
+ async get(runId) {
540
+ return this.client.request(`/highlights/${runId}`);
541
+ }
542
+ async listClips(runId) {
543
+ return this.client.request(`/highlights/${runId}/clips`);
544
+ }
545
+ async getClip(clipId) {
546
+ return this.client.request(`/clips/${clipId}`);
547
+ }
548
+ async createVariant(clipId, request) {
549
+ return this.client.request(`/clips/${clipId}/variants`, {
550
+ method: "POST",
551
+ body: JSON.stringify(request)
552
+ });
553
+ }
554
+ async approve(clipId, request) {
555
+ return this.client.request(`/clips/${clipId}/approval`, {
556
+ method: "POST",
557
+ body: JSON.stringify(request)
558
+ });
559
+ }
560
+ async socialExport(clipId) {
561
+ return this.client.request(`/clips/${clipId}/social-export`, {
562
+ method: "POST"
563
+ });
564
+ }
565
+ };
566
+
567
+ // src/resources/liveSessions.ts
568
+ var LiveSessionsResource = class {
569
+ constructor(client) {
570
+ this.client = client;
571
+ }
572
+ async create(request) {
573
+ return this.client.request("/live-sessions", {
574
+ method: "POST",
575
+ body: JSON.stringify(request)
576
+ });
577
+ }
578
+ async list(options) {
579
+ const query = new URLSearchParams();
580
+ if (options?.limit) query.set("limit", options.limit.toString());
581
+ if (options?.pageToken) query.set("pageToken", options.pageToken);
582
+ if (options?.status) query.set("status", options.status);
583
+ const path = `/live-sessions${query.toString() ? `?${query.toString()}` : ""}`;
584
+ return this.client.request(path);
585
+ }
586
+ async get(sessionId) {
587
+ return this.client.request(`/live-sessions/${sessionId}`);
588
+ }
589
+ async getRollingSubtitles(sessionId) {
590
+ return this.client.request(
591
+ `/live-sessions/${sessionId}/rolling-subtitles`
592
+ );
593
+ }
594
+ async publishRollingSubtitles(sessionId, request) {
595
+ return this.client.request(
596
+ `/live-sessions/${sessionId}/rolling-subtitles`,
597
+ {
598
+ method: "POST",
599
+ body: JSON.stringify(request)
600
+ }
601
+ );
602
+ }
603
+ async stop(sessionId, request = {}) {
604
+ return this.client.request(`/live-sessions/${sessionId}/stop`, {
605
+ method: "POST",
606
+ body: JSON.stringify(request)
607
+ });
608
+ }
609
+ };
610
+
611
+ // src/resources/commentary.ts
612
+ var CommentaryResource = class {
613
+ constructor(client) {
614
+ this.client = client;
615
+ }
616
+ async create(request) {
617
+ return this.client.request("/commentary", {
618
+ method: "POST",
619
+ body: JSON.stringify(request)
620
+ });
621
+ }
622
+ async list(options = {}) {
623
+ const query = new URLSearchParams();
624
+ if (options?.limit) query.set("limit", options.limit.toString());
625
+ if (options?.pageToken) query.set("pageToken", options.pageToken);
626
+ if (options?.sourceKind) query.set("sourceKind", options.sourceKind);
627
+ if (options?.sourceId) query.set("sourceId", options.sourceId);
628
+ if (options?.status) query.set("status", options.status);
629
+ const path = `/commentary${query.toString() ? `?${query.toString()}` : ""}`;
630
+ return this.client.request(path);
631
+ }
632
+ async get(runId) {
633
+ return this.client.request(`/commentary/${runId}`);
634
+ }
635
+ async listOutputs(runId) {
636
+ return this.client.request(`/commentary/${runId}/outputs`);
637
+ }
638
+ };
639
+
640
+ // src/resources/dubbing.ts
641
+ var DubbingResource = class {
642
+ constructor(client) {
643
+ this.client = client;
644
+ }
645
+ async list(options = {}) {
646
+ const query = new URLSearchParams();
647
+ if (options.sourceId) query.set("sourceId", options.sourceId);
648
+ if (options.status) query.set("status", options.status);
649
+ if (options.limit) query.set("limit", options.limit.toString());
650
+ if (options.pageToken) query.set("pageToken", options.pageToken);
651
+ const path = `/dubbing${query.toString() ? `?${query.toString()}` : ""}`;
652
+ return this.client.request(path);
653
+ }
654
+ async get(runId) {
655
+ return this.client.request(`/dubbing/${runId}`);
656
+ }
657
+ async getForJob(jobId) {
658
+ return this.client.request(`/jobs/${jobId}/dubbing`);
659
+ }
660
+ };
661
+
662
+ // src/resources/artifacts.ts
663
+ var ArtifactsResource = class {
664
+ constructor(client) {
665
+ this.client = client;
666
+ }
667
+ async list(options = {}) {
668
+ const query = new URLSearchParams();
669
+ if (options.limit) query.set("limit", options.limit.toString());
670
+ if (options.pageToken) query.set("pageToken", options.pageToken);
671
+ if (options.ownerKind) query.set("ownerKind", options.ownerKind);
672
+ if (options.ownerId) query.set("ownerId", options.ownerId);
673
+ if (options.type) query.set("type", options.type);
674
+ if (options.language) query.set("language", options.language);
675
+ if (options.status) query.set("status", options.status);
676
+ if (options.releaseStage) query.set("releaseStage", options.releaseStage);
677
+ const path = `/artifacts${query.toString() ? `?${query.toString()}` : ""}`;
678
+ return this.client.request(path);
679
+ }
680
+ async get(artifactId) {
681
+ return this.client.request(`/artifacts/${artifactId}`);
682
+ }
683
+ async createSignedUrl(artifactId) {
684
+ return this.client.request(`/artifacts/${artifactId}/signed-url`, {
685
+ method: "POST"
686
+ });
687
+ }
688
+ };
689
+
690
+ // src/resources/exportPackages.ts
691
+ var ExportPackagesResource = class {
692
+ constructor(client) {
693
+ this.client = client;
694
+ }
695
+ async list(options = {}) {
696
+ const query = new URLSearchParams();
697
+ if (options.limit) query.set("limit", options.limit.toString());
698
+ if (options.pageToken) query.set("pageToken", options.pageToken);
699
+ if (options.ownerKind) query.set("ownerKind", options.ownerKind);
700
+ if (options.ownerId) query.set("ownerId", options.ownerId);
701
+ if (options.status) query.set("status", options.status);
702
+ if (options.packageFormat) query.set("packageFormat", options.packageFormat);
703
+ const path = `/exports${query.toString() ? `?${query.toString()}` : ""}`;
704
+ return this.client.request(path);
705
+ }
706
+ async get(exportPackageId) {
707
+ return this.client.request(`/exports/${exportPackageId}`);
708
+ }
709
+ async createSignedUrl(exportPackageId) {
710
+ return this.client.request(`/exports/${exportPackageId}/signed-url`, {
711
+ method: "POST"
712
+ });
713
+ }
714
+ };
336
715
 
337
716
  // src/resources/languages.ts
338
717
  var LanguagesResource = class {
@@ -340,9 +719,38 @@ var LanguagesResource = class {
340
719
  this.client = client;
341
720
  }
342
721
  async list() {
343
- return this.client.request("/supported-languages");
722
+ const raw = await this.client.request("/supported-languages");
723
+ return extractLanguages(raw);
344
724
  }
345
725
  };
726
+ function extractLanguages(raw) {
727
+ if (Array.isArray(raw)) {
728
+ return raw.filter(isLanguage);
729
+ }
730
+ if (!isRecord3(raw)) {
731
+ return [];
732
+ }
733
+ const languages = raw.languages;
734
+ if (Array.isArray(languages)) {
735
+ return languages.filter(isLanguage);
736
+ }
737
+ if (isRecord3(languages)) {
738
+ const merged = [];
739
+ for (const value of Object.values(languages)) {
740
+ if (Array.isArray(value)) {
741
+ merged.push(...value.filter(isLanguage));
742
+ }
743
+ }
744
+ return merged;
745
+ }
746
+ return [];
747
+ }
748
+ function isLanguage(value) {
749
+ return isRecord3(value) && typeof value.code === "string" && typeof value.name === "string";
750
+ }
751
+ function isRecord3(value) {
752
+ return typeof value === "object" && value !== null && !Array.isArray(value);
753
+ }
346
754
 
347
755
  // src/resources/subtitles.ts
348
756
  var SubtitlesResource = class {
@@ -469,6 +877,12 @@ var FilesResource = class {
469
877
  constructor(client) {
470
878
  this.client = client;
471
879
  }
880
+ async createPresignedUrl(request) {
881
+ return this.client.request("/presigned-url", {
882
+ method: "POST",
883
+ body: JSON.stringify(request)
884
+ });
885
+ }
472
886
  async upload(file, options) {
473
887
  const response = await this.client.request("/presigned-url", {
474
888
  method: "POST",
@@ -594,6 +1008,12 @@ function getFileSize(file) {
594
1008
  var AudiolizeClient = class {
595
1009
  http;
596
1010
  jobs;
1011
+ highlights;
1012
+ liveSessions;
1013
+ commentary;
1014
+ dubbing;
1015
+ artifacts;
1016
+ exportPackages;
597
1017
  languages;
598
1018
  subtitles;
599
1019
  files;
@@ -607,8 +1027,15 @@ var AudiolizeClient = class {
607
1027
  };
608
1028
  if (options.timeout !== void 0) httpOptions.timeout = options.timeout;
609
1029
  if (options.maxRetries !== void 0) httpOptions.maxRetries = options.maxRetries;
1030
+ if (options.defaultHeaders !== void 0) httpOptions.defaultHeaders = options.defaultHeaders;
610
1031
  this.http = new HttpClient(httpOptions);
611
1032
  this.jobs = new JobsResource(this.http);
1033
+ this.highlights = new HighlightsResource(this.http);
1034
+ this.liveSessions = new LiveSessionsResource(this.http);
1035
+ this.commentary = new CommentaryResource(this.http);
1036
+ this.dubbing = new DubbingResource(this.http);
1037
+ this.artifacts = new ArtifactsResource(this.http);
1038
+ this.exportPackages = new ExportPackagesResource(this.http);
612
1039
  this.languages = new LanguagesResource(this.http);
613
1040
  this.subtitles = new SubtitlesResource(this.http);
614
1041
  this.files = new FilesResource(this.http);
@@ -623,6 +1050,342 @@ var AudiolizeClient = class {
623
1050
  }
624
1051
  };
625
1052
 
1053
+ // src/types/domain.ts
1054
+ var DOMAIN_ENTITY_KINDS = [
1055
+ "job",
1056
+ "live_session",
1057
+ "highlight_run",
1058
+ "dubbing_run",
1059
+ "clip_artifact",
1060
+ "commentary_run",
1061
+ "artifact",
1062
+ "export_package"
1063
+ ];
1064
+ var CAPABILITY_READINESS_STATES = [
1065
+ "unavailable",
1066
+ "queued",
1067
+ "processing",
1068
+ "partial",
1069
+ "review_required",
1070
+ "ready",
1071
+ "failed"
1072
+ ];
1073
+ var CANONICAL_JOB_STATUSES = [
1074
+ "created",
1075
+ "queued",
1076
+ "processing",
1077
+ "completed",
1078
+ "failed",
1079
+ "cancelled"
1080
+ ];
1081
+ var LEGACY_JOB_STATUSES = [
1082
+ "pending",
1083
+ "processing",
1084
+ "completed",
1085
+ "failed",
1086
+ "created",
1087
+ "uploaded",
1088
+ "initializing",
1089
+ "transcribing",
1090
+ "translating",
1091
+ "paused"
1092
+ ];
1093
+ var LEGACY_TO_CANONICAL_JOB_STATUS = {
1094
+ pending: "queued",
1095
+ processing: "processing",
1096
+ completed: "completed",
1097
+ failed: "failed",
1098
+ created: "created",
1099
+ uploaded: "queued",
1100
+ initializing: "queued",
1101
+ transcribing: "processing",
1102
+ translating: "processing",
1103
+ paused: "processing"
1104
+ };
1105
+ var CANONICAL_JOB_CURRENT_STEPS = [
1106
+ "awaiting_upload",
1107
+ "initializing",
1108
+ "extracting_audio",
1109
+ "transcribing",
1110
+ "translating",
1111
+ "generating_subtitles",
1112
+ "generating_summary",
1113
+ "generating_dubbing",
1114
+ "packaging_exports",
1115
+ "finalizing"
1116
+ ];
1117
+ var LEGACY_JOB_CURRENT_STEPS = [
1118
+ "initializing",
1119
+ "extracting_audio",
1120
+ "transcribing",
1121
+ "translating",
1122
+ "cleaning_subtitles",
1123
+ "generating_summary",
1124
+ "completing"
1125
+ ];
1126
+ var LEGACY_TO_CANONICAL_JOB_CURRENT_STEP = {
1127
+ initializing: "initializing",
1128
+ extracting_audio: "extracting_audio",
1129
+ transcribing: "transcribing",
1130
+ translating: "translating",
1131
+ cleaning_subtitles: "generating_subtitles",
1132
+ generating_summary: "generating_summary",
1133
+ completing: "finalizing"
1134
+ };
1135
+ var LIVE_SESSION_STATUSES = [
1136
+ "scheduled",
1137
+ "starting",
1138
+ "live",
1139
+ "finalizing",
1140
+ "completed",
1141
+ "failed",
1142
+ "cancelled"
1143
+ ];
1144
+ var LIVE_SESSION_CURRENT_STEPS = [
1145
+ "provisioning_stream",
1146
+ "connecting_inputs",
1147
+ "capturing_audio",
1148
+ "transcribing_live",
1149
+ "translating_live",
1150
+ "publishing_live_subtitles",
1151
+ "finalizing_session",
1152
+ "archiving_outputs"
1153
+ ];
1154
+ var HIGHLIGHT_RUN_STATUSES = [
1155
+ "queued",
1156
+ "processing",
1157
+ "completed",
1158
+ "failed",
1159
+ "cancelled"
1160
+ ];
1161
+ var HIGHLIGHT_RUN_CURRENT_STEPS = [
1162
+ "loading_source_context",
1163
+ "detecting_candidates",
1164
+ "scoring_candidates",
1165
+ "selecting_moments",
1166
+ "rendering_clips",
1167
+ "indexing_results"
1168
+ ];
1169
+ var DUBBING_RUN_STATUSES = [
1170
+ "queued",
1171
+ "processing",
1172
+ "partial",
1173
+ "completed",
1174
+ "failed",
1175
+ "cancelled"
1176
+ ];
1177
+ var DUBBING_RUN_CURRENT_STEPS = [
1178
+ "loading_source_media",
1179
+ "requesting_dubbing",
1180
+ "dubbing_languages",
1181
+ "storing_dubbed_artifacts",
1182
+ "finalizing_outputs"
1183
+ ];
1184
+ var CLIP_ARTIFACT_STATUSES = [
1185
+ "queued",
1186
+ "processing",
1187
+ "review_required",
1188
+ "ready",
1189
+ "failed",
1190
+ "cancelled"
1191
+ ];
1192
+ var CLIP_ARTIFACT_CURRENT_STEPS = [
1193
+ "queued_for_render",
1194
+ "extracting_media_window",
1195
+ "rendering_clip",
1196
+ "burning_subtitles",
1197
+ "rendering_variant",
1198
+ "generating_thumbnail",
1199
+ "awaiting_review",
1200
+ "publishing_clip"
1201
+ ];
1202
+ var COMMENTARY_RUN_STATUSES = [
1203
+ "queued",
1204
+ "processing",
1205
+ "review_required",
1206
+ "completed",
1207
+ "failed",
1208
+ "cancelled"
1209
+ ];
1210
+ var COMMENTARY_RUN_CURRENT_STEPS = [
1211
+ "loading_context",
1212
+ "assembling_prompt",
1213
+ "generating_outputs",
1214
+ "normalizing_outputs",
1215
+ "awaiting_review",
1216
+ "publishing_outputs"
1217
+ ];
1218
+ var ARTIFACT_STATUSES = [
1219
+ "unavailable",
1220
+ "queued",
1221
+ "processing",
1222
+ "partial",
1223
+ "review_required",
1224
+ "ready",
1225
+ "failed",
1226
+ "cancelled"
1227
+ ];
1228
+ var ARTIFACT_TYPES = [
1229
+ "source_media",
1230
+ "extracted_audio",
1231
+ "transcript_json",
1232
+ "subtitle_json",
1233
+ "subtitle_srt",
1234
+ "subtitle_vtt",
1235
+ "subtitle_ttml",
1236
+ "subtitle_stl",
1237
+ "summary_text",
1238
+ "summary_json",
1239
+ "dubbed_audio",
1240
+ "highlight_clip",
1241
+ "highlight_clip_subtitled",
1242
+ "social_variant",
1243
+ "thumbnail_image",
1244
+ "commentary_text",
1245
+ "commentary_json",
1246
+ "export_bundle",
1247
+ "live_segment",
1248
+ "quality_report"
1249
+ ];
1250
+ var ARTIFACT_FORMATS = [
1251
+ "json",
1252
+ "txt",
1253
+ "md",
1254
+ "srt",
1255
+ "vtt",
1256
+ "ttml",
1257
+ "xml",
1258
+ "stl",
1259
+ "wav",
1260
+ "mp3",
1261
+ "mp4",
1262
+ "jpg",
1263
+ "png",
1264
+ "zip"
1265
+ ];
1266
+ var ARTIFACT_REVIEW_STATUSES = [
1267
+ "not_required",
1268
+ "pending",
1269
+ "approved",
1270
+ "rejected"
1271
+ ];
1272
+ var ARTIFACT_CURRENT_STEPS = [
1273
+ "awaiting_source",
1274
+ "generating",
1275
+ "validating",
1276
+ "awaiting_review",
1277
+ "publishing",
1278
+ "indexed"
1279
+ ];
1280
+ var EXPORT_PACKAGE_STATUSES = [
1281
+ "queued",
1282
+ "processing",
1283
+ "partial",
1284
+ "ready",
1285
+ "failed",
1286
+ "cancelled"
1287
+ ];
1288
+ var EXPORT_PACKAGE_FORMATS = [
1289
+ "zip",
1290
+ "manifest",
1291
+ "deliverable_bundle"
1292
+ ];
1293
+ var EXPORT_PACKAGE_CURRENT_STEPS = [
1294
+ "collecting_artifacts",
1295
+ "validating_contents",
1296
+ "packaging_bundle",
1297
+ "publishing_package",
1298
+ "indexed"
1299
+ ];
1300
+ var JOB_STATUS_TRANSITIONS = {
1301
+ created: ["queued", "cancelled"],
1302
+ queued: ["processing", "failed", "cancelled"],
1303
+ processing: ["completed", "failed", "cancelled"],
1304
+ completed: [],
1305
+ failed: ["queued"],
1306
+ cancelled: ["queued"]
1307
+ };
1308
+ var LIVE_SESSION_STATUS_TRANSITIONS = {
1309
+ scheduled: ["starting", "cancelled"],
1310
+ starting: ["live", "failed", "cancelled"],
1311
+ live: ["finalizing", "failed", "cancelled"],
1312
+ finalizing: ["completed", "failed", "cancelled"],
1313
+ completed: [],
1314
+ failed: ["starting"],
1315
+ cancelled: ["starting"]
1316
+ };
1317
+ var HIGHLIGHT_RUN_STATUS_TRANSITIONS = {
1318
+ queued: ["processing", "failed", "cancelled"],
1319
+ processing: ["completed", "failed", "cancelled"],
1320
+ completed: [],
1321
+ failed: ["queued"],
1322
+ cancelled: ["queued"]
1323
+ };
1324
+ var DUBBING_RUN_STATUS_TRANSITIONS = {
1325
+ queued: ["processing", "failed", "cancelled"],
1326
+ processing: ["partial", "completed", "failed", "cancelled"],
1327
+ partial: ["processing", "completed", "failed", "cancelled"],
1328
+ completed: [],
1329
+ failed: ["queued"],
1330
+ cancelled: ["queued"]
1331
+ };
1332
+ var CLIP_ARTIFACT_STATUS_TRANSITIONS = {
1333
+ queued: ["processing", "failed", "cancelled"],
1334
+ processing: ["review_required", "ready", "failed", "cancelled"],
1335
+ review_required: ["ready", "failed", "cancelled"],
1336
+ ready: [],
1337
+ failed: ["queued"],
1338
+ cancelled: ["queued"]
1339
+ };
1340
+ var COMMENTARY_RUN_STATUS_TRANSITIONS = {
1341
+ queued: ["processing", "failed", "cancelled"],
1342
+ processing: ["review_required", "completed", "failed", "cancelled"],
1343
+ review_required: ["completed", "failed", "cancelled"],
1344
+ completed: [],
1345
+ failed: ["queued"],
1346
+ cancelled: ["queued"]
1347
+ };
1348
+ var ARTIFACT_STATUS_TRANSITIONS = {
1349
+ unavailable: ["queued", "failed"],
1350
+ queued: ["processing", "failed", "cancelled"],
1351
+ processing: ["partial", "review_required", "ready", "failed", "cancelled"],
1352
+ partial: ["ready", "failed", "cancelled"],
1353
+ review_required: ["ready", "failed", "cancelled"],
1354
+ ready: [],
1355
+ failed: ["queued"],
1356
+ cancelled: ["queued"]
1357
+ };
1358
+ var EXPORT_PACKAGE_STATUS_TRANSITIONS = {
1359
+ queued: ["processing", "failed", "cancelled"],
1360
+ processing: ["partial", "ready", "failed", "cancelled"],
1361
+ partial: ["ready", "failed", "cancelled"],
1362
+ ready: [],
1363
+ failed: ["queued"],
1364
+ cancelled: ["queued"]
1365
+ };
1366
+ function normalizeJobStatus(status) {
1367
+ if (CANONICAL_JOB_STATUSES.includes(status)) {
1368
+ return status;
1369
+ }
1370
+ return LEGACY_TO_CANONICAL_JOB_STATUS[status];
1371
+ }
1372
+ function normalizeJobCurrentStep(step) {
1373
+ if (CANONICAL_JOB_CURRENT_STEPS.includes(step)) {
1374
+ return step;
1375
+ }
1376
+ return LEGACY_TO_CANONICAL_JOB_CURRENT_STEP[step];
1377
+ }
1378
+ function isValidTransition(transitionMap, from, to) {
1379
+ return transitionMap[from]?.includes(to) ?? false;
1380
+ }
1381
+
1382
+ exports.ARTIFACT_CURRENT_STEPS = ARTIFACT_CURRENT_STEPS;
1383
+ exports.ARTIFACT_FORMATS = ARTIFACT_FORMATS;
1384
+ exports.ARTIFACT_REVIEW_STATUSES = ARTIFACT_REVIEW_STATUSES;
1385
+ exports.ARTIFACT_STATUSES = ARTIFACT_STATUSES;
1386
+ exports.ARTIFACT_STATUS_TRANSITIONS = ARTIFACT_STATUS_TRANSITIONS;
1387
+ exports.ARTIFACT_TYPES = ARTIFACT_TYPES;
1388
+ exports.ArtifactsResource = ArtifactsResource;
626
1389
  exports.AudiolizeApiError = AudiolizeApiError;
627
1390
  exports.AudiolizeClient = AudiolizeClient;
628
1391
  exports.AudiolizeError = AudiolizeError;
@@ -631,18 +1394,54 @@ exports.AudiolizeUploadError = AudiolizeUploadError;
631
1394
  exports.AudiolizeValidationError = AudiolizeValidationError;
632
1395
  exports.AuthenticationError = AuthenticationError;
633
1396
  exports.AuthorizationError = AuthorizationError;
1397
+ exports.CANONICAL_JOB_CURRENT_STEPS = CANONICAL_JOB_CURRENT_STEPS;
1398
+ exports.CANONICAL_JOB_STATUSES = CANONICAL_JOB_STATUSES;
1399
+ exports.CAPABILITY_READINESS_STATES = CAPABILITY_READINESS_STATES;
1400
+ exports.CLIP_ARTIFACT_CURRENT_STEPS = CLIP_ARTIFACT_CURRENT_STEPS;
1401
+ exports.CLIP_ARTIFACT_STATUSES = CLIP_ARTIFACT_STATUSES;
1402
+ exports.CLIP_ARTIFACT_STATUS_TRANSITIONS = CLIP_ARTIFACT_STATUS_TRANSITIONS;
1403
+ exports.COMMENTARY_RUN_CURRENT_STEPS = COMMENTARY_RUN_CURRENT_STEPS;
1404
+ exports.COMMENTARY_RUN_STATUSES = COMMENTARY_RUN_STATUSES;
1405
+ exports.COMMENTARY_RUN_STATUS_TRANSITIONS = COMMENTARY_RUN_STATUS_TRANSITIONS;
1406
+ exports.CommentaryResource = CommentaryResource;
634
1407
  exports.DEFAULT_MULTIPART_THRESHOLD = DEFAULT_MULTIPART_THRESHOLD;
1408
+ exports.DOMAIN_ENTITY_KINDS = DOMAIN_ENTITY_KINDS;
1409
+ exports.DUBBING_RUN_CURRENT_STEPS = DUBBING_RUN_CURRENT_STEPS;
1410
+ exports.DUBBING_RUN_STATUSES = DUBBING_RUN_STATUSES;
1411
+ exports.DUBBING_RUN_STATUS_TRANSITIONS = DUBBING_RUN_STATUS_TRANSITIONS;
1412
+ exports.DubbingResource = DubbingResource;
1413
+ exports.EXPORT_PACKAGE_CURRENT_STEPS = EXPORT_PACKAGE_CURRENT_STEPS;
1414
+ exports.EXPORT_PACKAGE_FORMATS = EXPORT_PACKAGE_FORMATS;
1415
+ exports.EXPORT_PACKAGE_STATUSES = EXPORT_PACKAGE_STATUSES;
1416
+ exports.EXPORT_PACKAGE_STATUS_TRANSITIONS = EXPORT_PACKAGE_STATUS_TRANSITIONS;
1417
+ exports.ExportPackagesResource = ExportPackagesResource;
635
1418
  exports.FilesResource = FilesResource;
1419
+ exports.HIGHLIGHT_RUN_CURRENT_STEPS = HIGHLIGHT_RUN_CURRENT_STEPS;
1420
+ exports.HIGHLIGHT_RUN_STATUSES = HIGHLIGHT_RUN_STATUSES;
1421
+ exports.HIGHLIGHT_RUN_STATUS_TRANSITIONS = HIGHLIGHT_RUN_STATUS_TRANSITIONS;
1422
+ exports.HighlightsResource = HighlightsResource;
1423
+ exports.JOB_STATUS_TRANSITIONS = JOB_STATUS_TRANSITIONS;
636
1424
  exports.JobPoller = JobPoller;
637
1425
  exports.JobsResource = JobsResource;
1426
+ exports.LEGACY_JOB_CURRENT_STEPS = LEGACY_JOB_CURRENT_STEPS;
1427
+ exports.LEGACY_JOB_STATUSES = LEGACY_JOB_STATUSES;
1428
+ exports.LEGACY_TO_CANONICAL_JOB_CURRENT_STEP = LEGACY_TO_CANONICAL_JOB_CURRENT_STEP;
1429
+ exports.LEGACY_TO_CANONICAL_JOB_STATUS = LEGACY_TO_CANONICAL_JOB_STATUS;
1430
+ exports.LIVE_SESSION_CURRENT_STEPS = LIVE_SESSION_CURRENT_STEPS;
1431
+ exports.LIVE_SESSION_STATUSES = LIVE_SESSION_STATUSES;
1432
+ exports.LIVE_SESSION_STATUS_TRANSITIONS = LIVE_SESSION_STATUS_TRANSITIONS;
638
1433
  exports.LanguagesResource = LanguagesResource;
1434
+ exports.LiveSessionsResource = LiveSessionsResource;
639
1435
  exports.NotFoundError = NotFoundError;
640
1436
  exports.PaywallError = PaywallError;
641
1437
  exports.RateLimitError = RateLimitError;
642
1438
  exports.ServerError = ServerError;
643
1439
  exports.SubtitlesResource = SubtitlesResource;
644
1440
  exports.getBackoffDelay = getBackoffDelay;
1441
+ exports.isValidTransition = isValidTransition;
645
1442
  exports.localize = localize;
1443
+ exports.normalizeJobCurrentStep = normalizeJobCurrentStep;
1444
+ exports.normalizeJobStatus = normalizeJobStatus;
646
1445
  exports.withRetry = withRetry;
647
1446
  //# sourceMappingURL=index.cjs.map
648
1447
  //# sourceMappingURL=index.cjs.map