@ornncompute/cli 1.0.120 → 1.0.122

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ornncompute/cli",
3
- "version": "1.0.120",
3
+ "version": "1.0.122",
4
4
  "description": "Command-line interface for Ornn compute access workflows.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,8 +1,9 @@
1
+ import * as storageApi from "../vendor/api-client/orchestrator.js";
1
2
  import * as gatewayApi from "../vendor/api-client/gateway.js";
2
3
  import { createHash } from "node:crypto";
3
4
  import { readFile } from "node:fs/promises";
4
5
 
5
- import { CliApiError, computeEndpoint } from "./api-client.mjs";
6
+ import { CliApiError } from "./api-client.mjs";
6
7
  import { isRecoverableWaitFailure } from "./interaction-runtime.mjs";
7
8
  import {
8
9
  codeOf,
@@ -18,7 +19,6 @@ import {
18
19
 
19
20
  const IMPORT_POLL_INTERVAL_MS = 10_000;
20
21
  const DEFAULT_IMPORT_TIMEOUT_MS = 30 * 60 * 1_000;
21
- const STORAGE_PREFIX = "/nodes/storage-drives";
22
22
  const PROVIDERS = new Set(["gcs", "s3", "r2"]);
23
23
 
24
24
  function usage(message, field, code = "usage_error") {
@@ -438,27 +438,6 @@ function requireMutationPreflight(input, runtime) {
438
438
  }
439
439
  }
440
440
 
441
- const SAFE_EXTERNAL_ERRORS = {
442
- external_bucket_required: "The external bucket record is incomplete.",
443
- external_endpoint_url_invalid: "The Cloudflare R2 endpoint is invalid.",
444
- external_endpoint_url_required: "Cloudflare R2 requires an account endpoint.",
445
- external_s3_credentials_required: "Current S3-compatible credentials are required.",
446
- storage_drive_attached_elsewhere:
447
- "This working volume is already attached to a different reservation.",
448
- storage_drive_attached_to_reservation:
449
- "Detach the working volume from every reservation before disconnecting the source.",
450
- storage_location_unavailable:
451
- "No managed destination is available for this reservation. The source bucket was not changed.",
452
- storage_regional_bucket_unconfigured:
453
- "Managed destination storage is temporarily unavailable. The source bucket was not changed.",
454
- storage_reservation_node_offline:
455
- "A reservation machine is offline, so the import destination was not changed.",
456
- storage_source_client_unavailable: "The external bucket client is temporarily unavailable.",
457
- storage_source_list_failed: "Ornn could not read the external bucket.",
458
- storage_source_not_verified: "Verify this external bucket before importing it.",
459
- storage_source_verification_unsupported: "This external bucket kind cannot be verified.",
460
- };
461
-
462
441
  function safeExternalError(error, fallback, { action, forcePartial = false } = {}) {
463
442
  if (error instanceof StorageCommandError) return error;
464
443
  if (error instanceof CliApiError && (error.status === 401 || error.status === 403)) {
@@ -476,8 +455,7 @@ function safeExternalError(error, fallback, { action, forcePartial = false } = {
476
455
  const unavailable = error?.status === undefined || error?.status >= 500;
477
456
  const ownerMessage = detailOf(error)?.message;
478
457
  return new StorageCommandError(
479
- SAFE_EXTERNAL_ERRORS[code] ??
480
- (typeof ownerMessage === "string" && ownerMessage.trim() ? ownerMessage : fallback),
458
+ typeof ownerMessage === "string" && ownerMessage.trim() ? ownerMessage : fallback,
481
459
  {
482
460
  action,
483
461
  code: code ?? (unavailable ? "service_unavailable" : "external_bucket_operation_failed"),
@@ -560,8 +538,9 @@ async function connectBucket(input, runtime) {
560
538
 
561
539
  let created;
562
540
  try {
563
- created = await runtime.fetch(computeEndpoint(STORAGE_PREFIX), {
564
- body: {
541
+ created = await storageApi.createDrive(
542
+ runtime.fetch,
543
+ {
565
544
  name: intent.name,
566
545
  provider: "ornn_volume",
567
546
  source_provider: intent.kind === "gcs" ? "external_gcs" : "s3",
@@ -575,9 +554,8 @@ async function connectBucket(input, runtime) {
575
554
  ...(intent.accessKeyId ? { external_access_key_id: intent.accessKeyId } : {}),
576
555
  ...(intent.secretAccessKey ? { external_secret_access_key: intent.secretAccessKey } : {}),
577
556
  },
578
- headers: idempotencyHeaders(input),
579
- method: "POST",
580
- });
557
+ { headers: idempotencyHeaders(input) }
558
+ );
581
559
  } catch (error) {
582
560
  throw safeExternalError(error, "The external bucket could not be connected safely.");
583
561
  }
@@ -609,12 +587,11 @@ async function verifyBucket(input, runtime) {
609
587
  const id = safeIdentifier(source.id);
610
588
  let verified;
611
589
  try {
612
- verified = await runtime.fetch(
613
- computeEndpoint(`${STORAGE_PREFIX}/${encodeURIComponent(id)}/verify-source`),
614
- {
615
- headers: idempotencyHeaders(input),
616
- method: "POST",
617
- }
590
+ verified = await storageApi.updateDrive(
591
+ runtime.fetch,
592
+ id,
593
+ { verify_source: true },
594
+ { headers: idempotencyHeaders(input) }
618
595
  );
619
596
  } catch (error) {
620
597
  throw safeExternalError(error, "External bucket verification could not be completed safely.");
@@ -668,16 +645,16 @@ async function updateCredentials(input, runtime) {
668
645
  const id = safeIdentifier(source.id);
669
646
  let updated;
670
647
  try {
671
- updated = await runtime.fetch(
672
- computeEndpoint(`${STORAGE_PREFIX}/${encodeURIComponent(id)}/source-credentials`),
648
+ updated = await storageApi.updateDrive(
649
+ runtime.fetch,
650
+ id,
673
651
  {
674
- body: {
652
+ source_credentials: {
675
653
  external_access_key_id: accessKeyId,
676
654
  external_secret_access_key: secret,
677
655
  },
678
- headers: idempotencyHeaders(input),
679
- method: "PATCH",
680
- }
656
+ },
657
+ { headers: idempotencyHeaders(input) }
681
658
  );
682
659
  } catch (error) {
683
660
  throw safeExternalError(error, "External bucket credentials could not be updated safely.");
@@ -715,10 +692,12 @@ async function disconnectBucket(input, runtime) {
715
692
  );
716
693
  }
717
694
  try {
718
- await runtime.fetch(computeEndpoint(`${STORAGE_PREFIX}/${encodeURIComponent(safe.id)}`), {
719
- headers: idempotencyHeaders(input),
720
- method: "DELETE",
721
- });
695
+ await storageApi.deleteDrive(
696
+ runtime.fetch,
697
+ safe.id,
698
+ {},
699
+ { headers: idempotencyHeaders(input) }
700
+ );
722
701
  } catch (error) {
723
702
  throw safeExternalError(error, "The external bucket could not be disconnected safely.");
724
703
  }
@@ -1,3 +1,4 @@
1
+ import * as storageApi from "../vendor/api-client/orchestrator.js";
1
2
  import * as gatewayApi from "../vendor/api-client/gateway.js";
2
3
  import { CliApiError } from "./api-client.mjs";
3
4
  import { isRecoverableWaitFailure } from "./interaction-runtime.mjs";
@@ -314,12 +315,7 @@ async function reservationMachineCount(runtime, reservationId, signal) {
314
315
  if (cache.has(reservationId)) return cache.get(reservationId);
315
316
  let count = 0;
316
317
  try {
317
- const rows = candidateRows(
318
- await runtime.fetch("/v1/orchestrator/storage-targets", {
319
- method: "GET",
320
- ...(signal ? { signal } : {}),
321
- })
322
- );
318
+ const rows = candidateRows(await storageApi.listStorageTargets(runtime.fetch, signal));
323
319
  const row = rows.find(
324
320
  (candidate) =>
325
321
  candidate.id === reservationId || candidate.reservation_ids.includes(reservationId)
@@ -560,9 +556,7 @@ async function candidates(input, runtime) {
560
556
  "ornn volume-mounts candidates [--limit <1-500>] [--cursor <cursor>]",
561
557
  runtime.interaction
562
558
  );
563
- const rows = candidateRows(
564
- await runtime.fetch("/v1/orchestrator/storage-targets", { method: "GET" })
565
- );
559
+ const rows = candidateRows(await storageApi.listStorageTargets(runtime.fetch));
566
560
  const offset = cursorOffset(input.cursor, runtime.interaction);
567
561
  const limit = pageLimit(input.limit, runtime.interaction);
568
562
  if (offset > rows.length) {
@@ -1,3 +1,4 @@
1
+ import { getContainerRegistry } from "../vendor/api-client/orchestrator.js";
1
2
  import {
2
3
  listApiKeys,
3
4
  createApiKey,
@@ -23,7 +24,7 @@ async function login({
23
24
  spawnProcess = spawnProcessDefault,
24
25
  hostname = os.hostname(),
25
26
  }) {
26
- const registry = await fetch("/v1/orchestrator/registry");
27
+ const registry = await getContainerRegistry(fetch);
27
28
  const session = await getCliSession(fetch);
28
29
  const organizationId = (session?.selectedOrganization ?? session?.selected_organization)?.id;
29
30
  if (typeof organizationId !== "string" || !organizationId) {
@@ -1,3 +1,4 @@
1
+ import * as storageApi from "../vendor/api-client/orchestrator.js";
1
2
  import { createHash } from "node:crypto";
2
3
  import { createReadStream } from "node:fs";
3
4
  import { stat } from "node:fs/promises";
@@ -6,7 +7,6 @@ import { Readable } from "node:stream";
6
7
 
7
8
  import {
8
9
  CliApiError,
9
- computeEndpoint,
10
10
  loadRequiredSession,
11
11
  raiseForFailedResponse,
12
12
  resolveApiBaseUrl,
@@ -20,7 +20,6 @@ import {
20
20
 
21
21
  const DEFAULT_PAGE_LIMIT = 50;
22
22
  const MAX_PAGE_LIMIT = 500;
23
- const STORAGE_PREFIX = "/nodes/storage-drives";
24
23
 
25
24
  /**
26
25
  * Narrow CLI adapter expected by executeStorageCommand:
@@ -143,13 +142,6 @@ function normalizeRemotePath(value, { allowEmpty = false, field = "path" } = {})
143
142
  return segments.join("/");
144
143
  }
145
144
 
146
- function encodedRemotePath(path) {
147
- return path
148
- .split("/")
149
- .map((segment) => encodeURIComponent(segment))
150
- .join("/");
151
- }
152
-
153
145
  function isManagedVolume(drive) {
154
146
  const provider = String(drive?.provider ?? "").toLocaleLowerCase("en-US");
155
147
  const sourceProvider = String(
@@ -255,19 +247,6 @@ export function codeOf(error) {
255
247
  return nested && /^[a-z][a-z0-9_]*$/.test(nested) ? nested : null;
256
248
  }
257
249
 
258
- const SAFE_ERROR_MESSAGES = {
259
- storage_content_busy: "The volume content is still changing. Inspect the volume and try again.",
260
- storage_drive_attached_to_reservation:
261
- "This volume still has a reservation relationship. Detach every volume mount before deleting it.",
262
- storage_drive_mounted: "This volume is mounted. Detach it before changing its files.",
263
- storage_drive_not_found: "The requested volume was not found.",
264
- storage_file_not_found: "The requested volume file was not found.",
265
- storage_folder_not_found: "The requested volume folder was not found.",
266
- storage_object_file_api_unsupported: "This volume does not support nested file operations.",
267
- storage_pending_uploads:
268
- "This volume has an upload still being finalized. Inspect it and try again.",
269
- };
270
-
271
250
  function safeStorageError(error, fallback, { action } = {}) {
272
251
  if (error instanceof StorageCommandError) return error;
273
252
  if (error instanceof AtomicOutputExistsError) {
@@ -285,8 +264,7 @@ function safeStorageError(error, fallback, { action } = {}) {
285
264
  const unavailable = code === "service_unavailable";
286
265
  const ownerMessage = detailOf(error)?.message;
287
266
  return new StorageCommandError(
288
- SAFE_ERROR_MESSAGES[code] ??
289
- (typeof ownerMessage === "string" && ownerMessage.trim() ? ownerMessage : fallback),
267
+ typeof ownerMessage === "string" && ownerMessage.trim() ? ownerMessage : fallback,
290
268
  {
291
269
  action,
292
270
  code,
@@ -313,11 +291,11 @@ export async function fetchDrivePage(runtime, { limit = 25, cursor, scope = "all
313
291
  if (!Number.isInteger(Number(limit)) || Number(limit) < 1 || Number(limit) > 100) {
314
292
  usage("--limit must be an integer from 1 through 100.", "limit");
315
293
  }
316
- const params = new URLSearchParams({ limit: String(limit), scope });
317
- if (cursor) params.set("cursor", cursor);
318
294
  try {
319
- const payload = await runtime.fetch(computeEndpoint(`${STORAGE_PREFIX}?${params}`), {
320
- method: "GET",
295
+ const payload = await storageApi.listDrives(runtime.fetch, {
296
+ limit: Number(limit),
297
+ scope,
298
+ ...(cursor ? { cursor } : {}),
321
299
  });
322
300
  return { drives: volumeRows(payload), next_cursor: payload?.next_cursor ?? null };
323
301
  } catch (error) {
@@ -367,10 +345,7 @@ function resolveFromRows(rows, reference, { source = false } = {}) {
367
345
 
368
346
  export async function resolveVolume(runtime, reference) {
369
347
  if (/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(reference)) {
370
- const drive = await runtime.fetch(
371
- computeEndpoint(`${STORAGE_PREFIX}/${encodeURIComponent(reference)}`),
372
- { method: "GET" }
373
- );
348
+ const drive = await storageApi.getDrive(runtime.fetch, reference);
374
349
  return resolveFromRows([drive], reference);
375
350
  }
376
351
  return resolveFromRows(await fetchDrives(runtime), reference);
@@ -418,10 +393,8 @@ async function createVolume(input, runtime) {
418
393
 
419
394
  const body = { name, source_drive_id: source ? String(source.id) : null };
420
395
  try {
421
- const created = await runtime.fetch(computeEndpoint(STORAGE_PREFIX), {
422
- body,
396
+ const created = await storageApi.createDrive(runtime.fetch, body, {
423
397
  headers: idempotencyHeaders(input),
424
- method: "POST",
425
398
  });
426
399
  return runtime.interaction.result({
427
400
  data: { effective_input: effective, replayed: false, volume: safeVolume(created) },
@@ -477,10 +450,7 @@ async function showVolume(input, runtime, { refresh = false } = {}) {
477
450
  return runtime.interaction.result({ data: { volume: safeVolume(drive) } });
478
451
  }
479
452
  try {
480
- const refreshed = await runtime.fetch(
481
- computeEndpoint(`${STORAGE_PREFIX}/${encodeURIComponent(String(drive.id))}/refresh`),
482
- { method: "POST" }
483
- );
453
+ const refreshed = await storageApi.getDrive(runtime.fetch, String(drive.id), { refresh: true });
484
454
  return runtime.interaction.result({
485
455
  data: { volume: safeVolume(refreshed) },
486
456
  outcome: { class: "ready", phase: "refreshed" },
@@ -495,10 +465,7 @@ async function clearVolume(input, runtime) {
495
465
  const [reference] = positionals(input, 1, "Usage: ornn volumes clear <volume>");
496
466
  const drive = await resolveVolume(runtime, reference);
497
467
  try {
498
- const payload = await runtime.fetch(
499
- computeEndpoint(`${STORAGE_PREFIX}/${encodeURIComponent(String(drive.id))}/contents`),
500
- { method: "DELETE" }
501
- );
468
+ const payload = await storageApi.clearDriveContents(runtime.fetch, String(drive.id));
502
469
  return runtime.interaction.result({
503
470
  data: {
504
471
  cleared: true,
@@ -533,12 +500,11 @@ async function deleteVolume(input, runtime) {
533
500
  requireMachineMutationKey(input, runtime);
534
501
  const drive = await resolveVolume(runtime, reference);
535
502
  try {
536
- await runtime.fetch(
537
- computeEndpoint(`${STORAGE_PREFIX}/${encodeURIComponent(String(drive.id))}`),
538
- {
539
- headers: idempotencyHeaders(input),
540
- method: "DELETE",
541
- }
503
+ await storageApi.deleteDrive(
504
+ runtime.fetch,
505
+ String(drive.id),
506
+ {},
507
+ { headers: idempotencyHeaders(input) }
542
508
  );
543
509
  return runtime.interaction.result({
544
510
  data: { deleted: true, volume: safeVolume(drive) },
@@ -590,17 +556,13 @@ async function fetchFileRows(runtime, drive, prefix) {
590
556
  const entries = [];
591
557
  let cursor = 0;
592
558
  while (cursor !== null) {
593
- const query = new URLSearchParams({ recursive: "true" });
594
- if (folder) query.set("path", folder);
595
- if (cursor) query.set("cursor", String(cursor));
596
559
  let page;
597
560
  try {
598
- page = await runtime.fetch(
599
- computeEndpoint(
600
- `${STORAGE_PREFIX}/${encodeURIComponent(String(drive.id))}/contents?${query}`
601
- ),
602
- { method: "GET" }
603
- );
561
+ page = await storageApi.listDriveContents(runtime.fetch, String(drive.id), {
562
+ recursive: true,
563
+ ...(folder ? { path: folder } : {}),
564
+ ...(cursor ? { cursor } : {}),
565
+ });
604
566
  } catch (error) {
605
567
  throw safeStorageError(error, "Volume files could not be listed safely.");
606
568
  }
@@ -719,12 +681,7 @@ async function putSignedUpload({
719
681
 
720
682
  async function cancelUpload(runtime, driveId, uploadId) {
721
683
  try {
722
- await runtime.fetch(
723
- computeEndpoint(
724
- `${STORAGE_PREFIX}/${encodeURIComponent(driveId)}/file-uploads/${encodeURIComponent(uploadId)}`
725
- ),
726
- { method: "DELETE" }
727
- );
684
+ await storageApi.cancelDriveUpload(runtime.fetch, driveId, uploadId);
728
685
  } catch {
729
686
  // Preserve the transfer error. Finalizing sessions are owner-reconciled.
730
687
  }
@@ -762,13 +719,11 @@ async function uploadFile(input, runtime) {
762
719
  const sha256 = requestHash.digest("hex");
763
720
  let session;
764
721
  try {
765
- session = await runtime.fetch(
766
- computeEndpoint(`${STORAGE_PREFIX}/${encodeURIComponent(String(drive.id))}/file-upload-url`),
767
- {
768
- body: { content_type: contentType, path: remotePath, size_bytes: fileInfo.size, sha256 },
769
- headers: idempotencyHeaders(input),
770
- method: "POST",
771
- }
722
+ session = await storageApi.startDriveUpload(
723
+ runtime.fetch,
724
+ String(drive.id),
725
+ { content_type: contentType, path: remotePath, size_bytes: fileInfo.size, sha256 },
726
+ { headers: idempotencyHeaders(input) }
772
727
  );
773
728
  } catch (error) {
774
729
  throw safeStorageError(error, "The upload could not be staged safely.");
@@ -803,24 +758,25 @@ async function uploadFile(input, runtime) {
803
758
  sizeBytes: fileInfo.size,
804
759
  uploadUrl: session.upload_url,
805
760
  });
806
- const completionPath = computeEndpoint(
807
- `${STORAGE_PREFIX}/${encodeURIComponent(String(drive.id))}/file-uploads/${encodeURIComponent(uploadId)}/complete`
808
- );
809
761
  let completed;
810
762
  try {
811
- completed = await runtime.fetch(completionPath, {
812
- body: { uploaded_generation: uploaded.generation },
813
- headers: idempotencyHeaders(input),
814
- method: "POST",
815
- });
763
+ completed = await storageApi.completeDriveUpload(
764
+ runtime.fetch,
765
+ String(drive.id),
766
+ uploadId,
767
+ { uploaded_generation: uploaded.generation },
768
+ { headers: idempotencyHeaders(input) }
769
+ );
816
770
  } catch (error) {
817
771
  if (!(error instanceof CliApiError) || (error.status !== undefined && error.status < 500))
818
772
  throw error;
819
- completed = await runtime.fetch(completionPath, {
820
- body: { uploaded_generation: uploaded.generation },
821
- headers: idempotencyHeaders(input),
822
- method: "POST",
823
- });
773
+ completed = await storageApi.completeDriveUpload(
774
+ runtime.fetch,
775
+ String(drive.id),
776
+ uploadId,
777
+ { uploaded_generation: uploaded.generation },
778
+ { headers: idempotencyHeaders(input) }
779
+ );
824
780
  }
825
781
  const file = safeFile(completed?.file ?? { path: remotePath, size_bytes: fileInfo.size });
826
782
  return runtime.interaction.result({
@@ -888,16 +844,19 @@ async function downloadFile(input, runtime) {
888
844
  const drive = await resolveVolume(runtime, reference);
889
845
  const session = await loadRequiredSession({ env: runtime.env });
890
846
  const baseUrl = resolveApiBaseUrl({ env: runtime.env, session });
891
- const endpoint = computeEndpoint(
892
- `${STORAGE_PREFIX}/${encodeURIComponent(String(drive.id))}/files/${encodedRemotePath(remotePath)}`
893
- );
847
+ const endpoint = storageApi.driveFilePath(String(drive.id), remotePath);
894
848
  const url = new URL(endpoint, `${baseUrl}/`);
895
849
  let response;
896
850
  try {
897
- response = await runtime.fetchImpl(url, {
898
- headers: userCredentialHeaders(session),
899
- method: "GET",
900
- });
851
+ response = await storageApi.downloadDriveFile(
852
+ (path, init) =>
853
+ runtime.fetchImpl(new URL(path, `${baseUrl}/`), {
854
+ ...init,
855
+ headers: userCredentialHeaders(session),
856
+ }),
857
+ String(drive.id),
858
+ remotePath
859
+ );
901
860
  } catch {
902
861
  throw new StorageCommandError("The volume file could not be downloaded safely.", {
903
862
  code: "service_unavailable",
@@ -950,11 +909,11 @@ async function deleteContent(command, input, runtime) {
950
909
  );
951
910
  const remotePath = normalizeRemotePath(rawRemotePath);
952
911
  const drive = await resolveVolume(runtime, reference);
953
- const endpoint = computeEndpoint(
954
- `${STORAGE_PREFIX}/${encodeURIComponent(String(drive.id))}/${kind}s/${encodedRemotePath(remotePath)}`
955
- );
912
+
956
913
  try {
957
- const payload = await runtime.fetch(endpoint, { method: "DELETE" });
914
+ const payload = await (
915
+ kind === "file" ? storageApi.deleteDriveFile : storageApi.deleteDriveFolder
916
+ )(runtime.fetch, String(drive.id), remotePath);
958
917
  return runtime.interaction.result({
959
918
  data: {
960
919
  deleted: true,
@@ -370,6 +370,134 @@ function deleteComputeDealAddOn(request, id2, addOnId, body) {
370
370
  });
371
371
  }
372
372
 
373
+ // ../../packages/api-client/dist/commerce/compute-contracts.js
374
+ var contracts = "/internal/v1/gtm/compute-contracts";
375
+ var contractPath = (id2) => `${contracts}/${encodeURIComponent(id2)}`;
376
+ var documents = (id2) => `${contractPath(id2)}/documents`;
377
+ var lines = (id2) => `${contractPath(id2)}/lines`;
378
+ var delayPenalties = (id2) => `${contractPath(id2)}/delay-penalties`;
379
+ function listComputeContracts(request, input = {}, signal) {
380
+ return request(contracts + queryString(input), { method: "GET", signal });
381
+ }
382
+ async function listAllComputeContracts(request, filter = {}, signal) {
383
+ const contracts2 = [];
384
+ const seen = /* @__PURE__ */ new Set();
385
+ let after;
386
+ for (; ; ) {
387
+ const page = await listComputeContracts(request, { ...filter, after }, signal);
388
+ contracts2.push(...page.contracts);
389
+ if (!page.nextCursor)
390
+ return { ...page, contracts: contracts2 };
391
+ if (seen.has(page.nextCursor))
392
+ throw new Error("Compute contracts returned an incomplete list.");
393
+ seen.add(page.nextCursor);
394
+ after = page.nextCursor;
395
+ }
396
+ }
397
+ function getComputeContract(request, id2, signal) {
398
+ return request(contractPath(id2), { method: "GET", signal });
399
+ }
400
+ function createComputeContract(request, body) {
401
+ return request(contracts, { method: "POST", body });
402
+ }
403
+ function updateComputeContract(request, id2, body) {
404
+ return request(contractPath(id2), { method: "PUT", body });
405
+ }
406
+ function deleteComputeContract(request, id2, body) {
407
+ return request(contractPath(id2), { method: "DELETE", body });
408
+ }
409
+ function listComputeContractDocuments(request, id2, signal) {
410
+ return request(documents(id2), { method: "GET", signal });
411
+ }
412
+ function createComputeContractDocument(request, id2, body) {
413
+ return request(documents(id2), { method: "POST", body });
414
+ }
415
+ function updateComputeContractDocument(request, id2, documentId, body) {
416
+ return request(`${documents(id2)}/${encodeURIComponent(documentId)}`, {
417
+ method: "PUT",
418
+ body
419
+ });
420
+ }
421
+ function deleteComputeContractDocument(request, id2, documentId, body) {
422
+ return request(`${documents(id2)}/${encodeURIComponent(documentId)}`, {
423
+ method: "DELETE",
424
+ body
425
+ });
426
+ }
427
+ function listComputeContractLines(request, id2, signal) {
428
+ return request(lines(id2), { method: "GET", signal });
429
+ }
430
+ function createComputeContractLine(request, id2, body) {
431
+ return request(lines(id2), { method: "POST", body });
432
+ }
433
+ function updateComputeContractLine(request, id2, lineId, body) {
434
+ return request(`${lines(id2)}/${encodeURIComponent(lineId)}`, {
435
+ method: "PUT",
436
+ body
437
+ });
438
+ }
439
+ function deleteComputeContractLine(request, id2, lineId, body) {
440
+ return request(`${lines(id2)}/${encodeURIComponent(lineId)}`, {
441
+ method: "DELETE",
442
+ body
443
+ });
444
+ }
445
+ function listComputeContractDelayPenalties(request, id2, signal) {
446
+ return request(delayPenalties(id2), { method: "GET", signal });
447
+ }
448
+ function createComputeContractDelayPenalty(request, id2, body) {
449
+ return request(delayPenalties(id2), { method: "POST", body });
450
+ }
451
+ function updateComputeContractDelayPenalty(request, id2, penaltyId, body) {
452
+ return request(`${delayPenalties(id2)}/${encodeURIComponent(penaltyId)}`, {
453
+ method: "PUT",
454
+ body
455
+ });
456
+ }
457
+ function deleteComputeContractDelayPenalty(request, id2, penaltyId, body) {
458
+ return request(`${delayPenalties(id2)}/${encodeURIComponent(penaltyId)}`, {
459
+ method: "DELETE",
460
+ body
461
+ });
462
+ }
463
+
464
+ // ../../packages/api-client/dist/commerce/contract-extractions.js
465
+ var extractions = "/internal/v1/gtm/contract-extractions";
466
+ var extractionPath = (id2) => `${extractions}/${encodeURIComponent(id2)}`;
467
+ function listContractExtractions(request, input = {}, signal) {
468
+ return request(extractions + queryString(input), { method: "GET", signal });
469
+ }
470
+ async function listAllContractExtractions(request, input = {}, signal) {
471
+ const runs = [];
472
+ const seen = /* @__PURE__ */ new Set();
473
+ let after;
474
+ for (; ; ) {
475
+ const page = await listContractExtractions(request, { ...input, after }, signal);
476
+ runs.push(...page.runs);
477
+ if (!page.nextCursor)
478
+ return { ...page, runs };
479
+ if (seen.has(page.nextCursor))
480
+ throw new Error("Contract extractions returned an incomplete list.");
481
+ seen.add(page.nextCursor);
482
+ after = page.nextCursor;
483
+ }
484
+ }
485
+ function createContractExtraction(request, body) {
486
+ return request(extractions, { method: "POST", body });
487
+ }
488
+ function getContractExtraction(request, id2, signal) {
489
+ return request(extractionPath(id2), { method: "GET", signal });
490
+ }
491
+ function updateContractExtractionField(request, id2, fieldId, body) {
492
+ return request(`${extractionPath(id2)}/fields/${encodeURIComponent(fieldId)}`, {
493
+ method: "PUT",
494
+ body
495
+ });
496
+ }
497
+ function deleteContractExtraction(request, id2, body) {
498
+ return request(extractionPath(id2), { method: "DELETE", body });
499
+ }
500
+
373
501
  // ../../packages/api-client/dist/commerce/compute-contract-line-matches.js
374
502
  var matchesPath = "/internal/v1/gtm/compute-contract-line-matches";
375
503
  var capacityPath = "/internal/v1/gtm/compute-contract-line-capacity";
@@ -709,8 +837,13 @@ export {
709
837
  completeReservation,
710
838
  createBillingSetupIntent,
711
839
  createCapacityListing,
840
+ createComputeContract,
841
+ createComputeContractDelayPenalty,
842
+ createComputeContractDocument,
843
+ createComputeContractLine,
712
844
  createComputeDeal,
713
845
  createComputeDealAddOn,
846
+ createContractExtraction,
714
847
  createControlplaneLicense,
715
848
  createCreditAdjustment,
716
849
  createDowntime,
@@ -725,8 +858,13 @@ export {
725
858
  createSupplierIntakeLink,
726
859
  createSupplierPaymentAccount,
727
860
  deleteCapacityTerms,
861
+ deleteComputeContract,
862
+ deleteComputeContractDelayPenalty,
863
+ deleteComputeContractDocument,
864
+ deleteComputeContractLine,
728
865
  deleteComputeDeal,
729
866
  deleteComputeDealAddOn,
867
+ deleteContractExtraction,
730
868
  deleteContractFile,
731
869
  deleteGTMComment,
732
870
  deleteGTMCompany,
@@ -743,6 +881,8 @@ export {
743
881
  getCapacityListingImage,
744
882
  getCapacityListingSpecPdf,
745
883
  getCommerceOrganization,
884
+ getComputeContract,
885
+ getContractExtraction,
746
886
  getContractFile,
747
887
  getControlplaneLicense,
748
888
  getGTMPersonalWorkspace,
@@ -763,7 +903,9 @@ export {
763
903
  getSupplierPaymentAccount,
764
904
  listAdminInvoices,
765
905
  listAllCapacityListings,
906
+ listAllComputeContracts,
766
907
  listAllComputeDeals,
908
+ listAllContractExtractions,
767
909
  listAllContractFiles,
768
910
  listAllFacilities,
769
911
  listAllInvoices,
@@ -773,10 +915,15 @@ export {
773
915
  listCapacityNodes,
774
916
  listCapacityTerms,
775
917
  listCapacityTermsBatch,
918
+ listComputeContractDelayPenalties,
919
+ listComputeContractDocuments,
776
920
  listComputeContractLineCapacity,
777
921
  listComputeContractLineMatches,
922
+ listComputeContractLines,
923
+ listComputeContracts,
778
924
  listComputeDealAddOns,
779
925
  listComputeDeals,
926
+ listContractExtractions,
780
927
  listContractFiles,
781
928
  listControlplaneLicenses,
782
929
  listCreditAdjustments,
@@ -810,8 +957,13 @@ export {
810
957
  setReservationDisk,
811
958
  stopReservation,
812
959
  transferReservation,
960
+ updateComputeContract,
961
+ updateComputeContractDelayPenalty,
962
+ updateComputeContractDocument,
963
+ updateComputeContractLine,
813
964
  updateComputeDeal,
814
965
  updateComputeDealAddOn,
966
+ updateContractExtractionField,
815
967
  updateDowntime,
816
968
  updateGTMComment,
817
969
  updateGTMCompany,