@tensorlakeai/tensorlake 0.5.153 → 0.5.154
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/applications/index.cjs +131 -33
- package/dist/applications/index.cjs.map +1 -1
- package/dist/applications/index.js +131 -33
- package/dist/applications/index.js.map +1 -1
- package/dist/function-agent/main.cjs +1 -1
- package/dist/function-agent/main.js +1 -1
- package/dist/function-executor/main.cjs +2 -2
- package/dist/function-executor/main.js +2 -2
- package/dist/index.cjs +195 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +70 -15
- package/dist/index.d.ts +70 -15
- package/dist/index.js +190 -61
- package/dist/index.js.map +1 -1
- package/dist/sandbox-image.cjs +129 -31
- package/dist/sandbox-image.cjs.map +1 -1
- package/dist/sandbox-image.js +129 -31
- package/dist/sandbox-image.js.map +1 -1
- package/package.json +7 -7
- package/runtime/function-executor/manifest.json +5 -5
- package/runtime/function-executor/package/dist/function-executor/main.js +2 -2
- package/runtime/function-executor/package/npm-shrinkwrap.json +2 -2
- package/runtime/function-executor/package/package.json +1 -1
- package/runtime/typescript-function-runner/manifest.json +5 -5
- package/runtime/typescript-function-runner/package/dist/function-agent/main.js +1 -1
- package/runtime/typescript-function-runner/package/npm-shrinkwrap.json +26 -26
- package/runtime/typescript-function-runner/package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -46,7 +46,7 @@ var init_defaults = __esm({
|
|
|
46
46
|
"src/defaults.ts"() {
|
|
47
47
|
"use strict";
|
|
48
48
|
init_esm_shims();
|
|
49
|
-
SDK_VERSION = "0.5.
|
|
49
|
+
SDK_VERSION = "0.5.154";
|
|
50
50
|
API_URL = process.env.TENSORLAKE_API_URL ?? "https://api.tensorlake.ai";
|
|
51
51
|
API_KEY = process.env.TENSORLAKE_API_KEY ?? void 0;
|
|
52
52
|
NAMESPACE = process.env.INDEXIFY_NAMESPACE ?? "default";
|
|
@@ -57,6 +57,20 @@ var init_defaults = __esm({
|
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
+
// src/enum.ts
|
|
61
|
+
function enumValue(values, value) {
|
|
62
|
+
return typeof value === "string" && Object.values(values).includes(value) ? value : values.UNKNOWN;
|
|
63
|
+
}
|
|
64
|
+
function withRaw(value, raw) {
|
|
65
|
+
return Object.defineProperty(value, "raw", { value: raw, enumerable: false, configurable: true });
|
|
66
|
+
}
|
|
67
|
+
var init_enum = __esm({
|
|
68
|
+
"src/enum.ts"() {
|
|
69
|
+
"use strict";
|
|
70
|
+
init_esm_shims();
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
60
74
|
// src/errors.ts
|
|
61
75
|
function formatErrorDetails(errorDetails) {
|
|
62
76
|
if (errorDetails == null) return void 0;
|
|
@@ -495,7 +509,7 @@ var init_native_worker_client = __esm({
|
|
|
495
509
|
}
|
|
496
510
|
};
|
|
497
511
|
runtimeKey = /* @__PURE__ */ Symbol.for(
|
|
498
|
-
`tensorlake.native.worker.${false ? "source" : "0.5.
|
|
512
|
+
`tensorlake.native.worker.${false ? "source" : "0.5.154"}.v1`
|
|
499
513
|
);
|
|
500
514
|
runtimes = globalThis;
|
|
501
515
|
}
|
|
@@ -597,6 +611,7 @@ var init_models = __esm({
|
|
|
597
611
|
SnapshotStatus2["FAILED"] = "failed";
|
|
598
612
|
SnapshotStatus2["DELETING"] = "deleting";
|
|
599
613
|
SnapshotStatus2["REPLICATING"] = "replicating";
|
|
614
|
+
SnapshotStatus2["UNKNOWN"] = "unknown";
|
|
600
615
|
return SnapshotStatus2;
|
|
601
616
|
})(SnapshotStatus || {});
|
|
602
617
|
ProcessStatus = /* @__PURE__ */ ((ProcessStatus2) => {
|
|
@@ -4493,6 +4508,18 @@ __export(client_exports, {
|
|
|
4493
4508
|
DEFAULT_WAIT_POLL_INTERVAL_SEC: () => DEFAULT_WAIT_POLL_INTERVAL_SEC,
|
|
4494
4509
|
SandboxClient: () => SandboxClient
|
|
4495
4510
|
});
|
|
4511
|
+
function parseSnapshot(raw) {
|
|
4512
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
4513
|
+
throw new SandboxError("Invalid snapshot response: expected an object");
|
|
4514
|
+
}
|
|
4515
|
+
if (raw.status == null) {
|
|
4516
|
+
throw new SandboxError("Invalid snapshot response: missing status");
|
|
4517
|
+
}
|
|
4518
|
+
return withRaw({
|
|
4519
|
+
...fromSnakeKeys(raw, "snapshotId"),
|
|
4520
|
+
status: enumValue(SnapshotStatus, raw.status)
|
|
4521
|
+
}, raw);
|
|
4522
|
+
}
|
|
4496
4523
|
function requireReadOnlySnapshotPin(fileSystemId, mountPath, readOnly, snapshotId) {
|
|
4497
4524
|
if (snapshotId != null && readOnly !== true) {
|
|
4498
4525
|
throw new SandboxError(
|
|
@@ -4614,6 +4641,7 @@ var init_client = __esm({
|
|
|
4614
4641
|
"use strict";
|
|
4615
4642
|
init_esm_shims();
|
|
4616
4643
|
init_defaults();
|
|
4644
|
+
init_enum();
|
|
4617
4645
|
init_errors();
|
|
4618
4646
|
init_native_worker_client();
|
|
4619
4647
|
init_native_sandbox();
|
|
@@ -5261,18 +5289,18 @@ var init_client = __esm({
|
|
|
5261
5289
|
* block automatically.
|
|
5262
5290
|
*/
|
|
5263
5291
|
async snapshot(sandboxId, options) {
|
|
5264
|
-
|
|
5292
|
+
const { json } = await callNative(
|
|
5265
5293
|
() => this.native.createSnapshot(sandboxId, options?.snapshotType ?? null),
|
|
5266
|
-
"snapshotId",
|
|
5267
5294
|
{ sandboxId, notFoundKind: "sandbox" }
|
|
5268
5295
|
);
|
|
5296
|
+
return parseSnapshot(JSON.parse(json));
|
|
5269
5297
|
}
|
|
5270
5298
|
/** Get current status and metadata for a snapshot by ID. */
|
|
5271
5299
|
async getSnapshot(snapshotId) {
|
|
5272
|
-
|
|
5273
|
-
() => this.native.getSnapshot(snapshotId)
|
|
5274
|
-
"snapshotId"
|
|
5300
|
+
const { traceId, json } = await callNative(
|
|
5301
|
+
() => this.native.getSnapshot(snapshotId)
|
|
5275
5302
|
);
|
|
5303
|
+
return Object.assign(parseSnapshot(JSON.parse(json)), { traceId });
|
|
5276
5304
|
}
|
|
5277
5305
|
/** List all snapshots in the namespace. */
|
|
5278
5306
|
async listSnapshots() {
|
|
@@ -5280,9 +5308,14 @@ var init_client = __esm({
|
|
|
5280
5308
|
() => this.native.listSnapshots()
|
|
5281
5309
|
);
|
|
5282
5310
|
const parsed = JSON.parse(json);
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5311
|
+
if (parsed !== null && (typeof parsed !== "object" || Array.isArray(parsed))) {
|
|
5312
|
+
throw new SandboxError("Invalid snapshot list response: expected an object");
|
|
5313
|
+
}
|
|
5314
|
+
const records = parsed?.snapshots ?? [];
|
|
5315
|
+
if (!Array.isArray(records)) {
|
|
5316
|
+
throw new SandboxError("Invalid snapshot list response: snapshots must be an array");
|
|
5317
|
+
}
|
|
5318
|
+
const snapshots = records.map((s) => parseSnapshot(s));
|
|
5286
5319
|
return Object.assign(snapshots, { traceId });
|
|
5287
5320
|
}
|
|
5288
5321
|
/** Delete a snapshot by ID. */
|
|
@@ -5850,6 +5883,9 @@ var init_native_binding = __esm({
|
|
|
5850
5883
|
import path3 from "path";
|
|
5851
5884
|
import os from "os";
|
|
5852
5885
|
import { existsSync as existsSync2, mkdtempSync, rmSync } from "fs";
|
|
5886
|
+
function isConfirmedCancellation(outcome) {
|
|
5887
|
+
return outcome === "cancelled" /* CANCELLED */ || outcome === "already_cancelled" /* ALREADY_CANCELLED */ || outcome === "already_failed" /* ALREADY_FAILED */;
|
|
5888
|
+
}
|
|
5853
5889
|
function camelize(key) {
|
|
5854
5890
|
return key.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
|
|
5855
5891
|
}
|
|
@@ -5867,62 +5903,87 @@ function toImageBuildError(error) {
|
|
|
5867
5903
|
if (key === "category") continue;
|
|
5868
5904
|
details[camelize(key)] = value;
|
|
5869
5905
|
}
|
|
5906
|
+
details.code = enumValue(ImageBuildErrorCode, details.code || "internal" /* INTERNAL */);
|
|
5907
|
+
if ("activeKind" in details) details.activeKind = details.activeKind ? enumValue(ImageBuildKind, details.activeKind) : null;
|
|
5908
|
+
if ("activeStatus" in details) details.activeStatus = details.activeStatus ? enumValue(ImageBuildStatus, details.activeStatus) : null;
|
|
5909
|
+
if ("outcome" in details) details.outcome = details.outcome ? enumValue(ImageBuildCancellationOutcome, details.outcome) : null;
|
|
5910
|
+
if ("info" in details) details.info = buildInfoOrNull(details.info);
|
|
5870
5911
|
const typed = details;
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
return new ImageBuildTimeoutError(typed);
|
|
5882
|
-
case "interrupted":
|
|
5883
|
-
return new ImageBuildInterruptedError(typed);
|
|
5884
|
-
default:
|
|
5885
|
-
return new ImageBuildError(typed);
|
|
5886
|
-
}
|
|
5912
|
+
const errors = {
|
|
5913
|
+
not_found: ImageBuildNotFoundError,
|
|
5914
|
+
image_build_in_progress: ImageBuildInProgressError,
|
|
5915
|
+
failed: ImageBuildFailedError,
|
|
5916
|
+
cancelled: ImageBuildCancelledError,
|
|
5917
|
+
timeout: ImageBuildTimeoutError,
|
|
5918
|
+
interrupted: ImageBuildInterruptedError
|
|
5919
|
+
};
|
|
5920
|
+
const ErrorClass = errors[typed.code] ?? ImageBuildError;
|
|
5921
|
+
return withRaw(new ErrorClass(typed), payload);
|
|
5887
5922
|
}
|
|
5888
5923
|
function camelizeRecord(value) {
|
|
5889
5924
|
const out = {};
|
|
5890
5925
|
for (const [key, inner] of Object.entries(value)) out[camelize(key)] = inner;
|
|
5891
5926
|
return out;
|
|
5892
5927
|
}
|
|
5893
|
-
function
|
|
5928
|
+
function buildInfoOrNull(value) {
|
|
5929
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
5930
|
+
try {
|
|
5931
|
+
return parseBuildInfo(value);
|
|
5932
|
+
} catch (error) {
|
|
5933
|
+
if (error instanceof ImageBuildError) return null;
|
|
5934
|
+
throw error;
|
|
5935
|
+
}
|
|
5936
|
+
}
|
|
5937
|
+
function decodeResponse(value) {
|
|
5938
|
+
try {
|
|
5939
|
+
const raw = typeof value === "string" ? JSON.parse(value) : value;
|
|
5940
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) throw new TypeError("expected a response object");
|
|
5941
|
+
return raw;
|
|
5942
|
+
} catch (error) {
|
|
5943
|
+
throw withRaw(new ImageBuildError({ code: "service" /* SERVICE */, message: `Invalid image-build response: ${String(error)}` }), { response: value });
|
|
5944
|
+
}
|
|
5945
|
+
}
|
|
5946
|
+
function parseBuildInfo(value) {
|
|
5947
|
+
const raw = decodeResponse(value);
|
|
5948
|
+
if (raw.status == null) {
|
|
5949
|
+
throw withRaw(new ImageBuildError({ code: "service" /* SERVICE */, message: "Invalid image-build response: missing status" }), { response: value });
|
|
5950
|
+
}
|
|
5951
|
+
const attempt = raw.attempt_no ?? 0;
|
|
5952
|
+
const attemptNo = Number(attempt);
|
|
5953
|
+
if (typeof attempt !== "number" && typeof attempt !== "string" || typeof attempt === "string" && attempt.trim() === "" || !Number.isSafeInteger(attemptNo)) {
|
|
5954
|
+
throw withRaw(new ImageBuildError({ code: "service" /* SERVICE */, message: "Invalid image-build attempt_no" }), { response: value });
|
|
5955
|
+
}
|
|
5894
5956
|
const camel = camelizeRecord(raw);
|
|
5895
5957
|
const result = raw.result && typeof raw.result === "object" ? camelizeRecord(raw.result) : null;
|
|
5896
|
-
return {
|
|
5958
|
+
return withRaw({
|
|
5897
5959
|
buildId: String(raw.build_id ?? ""),
|
|
5898
5960
|
clientRequestId: camel.clientRequestId ?? null,
|
|
5899
|
-
kind:
|
|
5961
|
+
kind: raw.kind ? enumValue(ImageBuildKind, raw.kind) : null,
|
|
5900
5962
|
name: raw.name ?? null,
|
|
5901
|
-
status:
|
|
5902
|
-
phase: raw.phase
|
|
5903
|
-
attemptNo
|
|
5963
|
+
status: enumValue(ImageBuildStatus, raw.status),
|
|
5964
|
+
phase: raw.phase ? enumValue(ImageBuildPhase, raw.phase) : null,
|
|
5965
|
+
attemptNo,
|
|
5904
5966
|
builderSandboxId: camel.builderSandboxId ?? null,
|
|
5905
5967
|
error: raw.error ?? null,
|
|
5906
5968
|
result,
|
|
5907
5969
|
operationDeadlineMs: camel.operationDeadlineMs ?? null,
|
|
5908
5970
|
createdAtMs: camel.createdAtMs ?? null,
|
|
5909
|
-
updatedAtMs: camel.updatedAtMs ?? null
|
|
5910
|
-
|
|
5911
|
-
};
|
|
5971
|
+
updatedAtMs: camel.updatedAtMs ?? null
|
|
5972
|
+
}, raw);
|
|
5912
5973
|
}
|
|
5913
5974
|
function parseResult(json) {
|
|
5914
|
-
return camelizeRecord(
|
|
5975
|
+
return camelizeRecord(decodeResponse(json));
|
|
5915
5976
|
}
|
|
5916
5977
|
function credentialsFromEnv() {
|
|
5917
5978
|
const context = __imageBuildInternals.buildContextFromEnv();
|
|
5918
5979
|
if (!context.apiKey) {
|
|
5919
5980
|
if (context.personalAccessToken) {
|
|
5920
5981
|
throw new ImageBuildError({
|
|
5921
|
-
code: "auth"
|
|
5982
|
+
code: "auth" /* AUTH */,
|
|
5922
5983
|
message: "Sandbox image SDKs require TENSORLAKE_API_KEY. Personal access tokens are CLI-only."
|
|
5923
5984
|
});
|
|
5924
5985
|
}
|
|
5925
|
-
throw new ImageBuildError({ code: "auth"
|
|
5986
|
+
throw new ImageBuildError({ code: "auth" /* AUTH */, message: "Missing TENSORLAKE_API_KEY credentials." });
|
|
5926
5987
|
}
|
|
5927
5988
|
return { apiUrl: context.apiUrl, bearerToken: context.apiKey, namespace: context.namespace };
|
|
5928
5989
|
}
|
|
@@ -5936,18 +5997,18 @@ function clientOptions(credentials) {
|
|
|
5936
5997
|
}
|
|
5937
5998
|
function rejectLegacyReference(buildId) {
|
|
5938
5999
|
if (typeof buildId !== "string" || buildId.trim().length === 0) {
|
|
5939
|
-
throw new ImageBuildError({ code: "usage"
|
|
6000
|
+
throw new ImageBuildError({ code: "usage" /* USAGE */, message: "buildId must be a non-empty string" });
|
|
5940
6001
|
}
|
|
5941
6002
|
if (buildId.startsWith("sandbox_template_")) {
|
|
5942
6003
|
throw new ImageBuildError({
|
|
5943
|
-
code: "usage"
|
|
6004
|
+
code: "usage" /* USAGE */,
|
|
5944
6005
|
message: `'${buildId}' is a legacy sandbox template id; legacy images have no build operation to get, wait for or cancel`,
|
|
5945
6006
|
buildId
|
|
5946
6007
|
});
|
|
5947
6008
|
}
|
|
5948
6009
|
if (buildId.startsWith("image_")) {
|
|
5949
6010
|
throw new ImageBuildError({
|
|
5950
|
-
code: "usage"
|
|
6011
|
+
code: "usage" /* USAGE */,
|
|
5951
6012
|
message: `'${buildId}' is an image id, not a build id; look the image up with findSandboxImageByName or use the build id admission returned`,
|
|
5952
6013
|
buildId
|
|
5953
6014
|
});
|
|
@@ -5994,8 +6055,15 @@ function makeEmitter(options) {
|
|
|
5994
6055
|
};
|
|
5995
6056
|
}
|
|
5996
6057
|
function decodeStarted(json, credentials) {
|
|
5997
|
-
const payload =
|
|
5998
|
-
|
|
6058
|
+
const payload = decodeResponse(json);
|
|
6059
|
+
const build = payload.build;
|
|
6060
|
+
if (!build || typeof build !== "object" || Array.isArray(build) || typeof build.build_id !== "string" || !build.build_id.trim()) {
|
|
6061
|
+
throw withRaw(new ImageBuildError({
|
|
6062
|
+
code: "service" /* SERVICE */,
|
|
6063
|
+
message: "Invalid image-build admission: expected a build with a non-empty build_id"
|
|
6064
|
+
}), { response: payload });
|
|
6065
|
+
}
|
|
6066
|
+
return new ImageBuildHandle(parseBuildInfo(build), credentials, payload.client_request_id);
|
|
5999
6067
|
}
|
|
6000
6068
|
async function startImageBuild(source, options = {}, deps = {}) {
|
|
6001
6069
|
const emitter = makeEmitter({ emit: deps.emit ?? options.emit, verbose: options.verbose });
|
|
@@ -6107,7 +6175,7 @@ async function getImageBuild(buildId) {
|
|
|
6107
6175
|
} catch (error) {
|
|
6108
6176
|
throw toImageBuildError(error);
|
|
6109
6177
|
}
|
|
6110
|
-
return new ImageBuildHandle(parseBuildInfo(
|
|
6178
|
+
return new ImageBuildHandle(parseBuildInfo(json), credentials);
|
|
6111
6179
|
}
|
|
6112
6180
|
async function waitImageBuild(buildId, options = {}) {
|
|
6113
6181
|
rejectLegacyReference(buildId);
|
|
@@ -6138,33 +6206,81 @@ async function cancelImageBuildWith(credentials, selector) {
|
|
|
6138
6206
|
} catch (error) {
|
|
6139
6207
|
throw toImageBuildError(error);
|
|
6140
6208
|
}
|
|
6141
|
-
const payload =
|
|
6142
|
-
const outcome =
|
|
6143
|
-
return {
|
|
6144
|
-
outcome,
|
|
6145
|
-
build: payload.build ? parseBuildInfo(payload.build) : null,
|
|
6146
|
-
confirmed: ["cancelled", "already_cancelled", "already_failed"].includes(outcome)
|
|
6147
|
-
};
|
|
6209
|
+
const payload = decodeResponse(json);
|
|
6210
|
+
const outcome = enumValue(ImageBuildCancellationOutcome, payload.outcome);
|
|
6211
|
+
return withRaw({ outcome, build: buildInfoOrNull(payload.build), confirmed: isConfirmedCancellation(outcome) }, payload);
|
|
6148
6212
|
}
|
|
6149
6213
|
async function cancelImageBuild(selector) {
|
|
6150
6214
|
const hasBuild = selector.buildId != null;
|
|
6151
6215
|
const hasRequest = selector.clientRequestId != null;
|
|
6152
6216
|
if (hasBuild === hasRequest) {
|
|
6153
6217
|
throw new ImageBuildError({
|
|
6154
|
-
code: "usage"
|
|
6218
|
+
code: "usage" /* USAGE */,
|
|
6155
6219
|
message: "pass exactly one of buildId or clientRequestId"
|
|
6156
6220
|
});
|
|
6157
6221
|
}
|
|
6158
6222
|
if (selector.buildId != null) rejectLegacyReference(selector.buildId);
|
|
6159
6223
|
return cancelImageBuildWith(credentialsFromEnv(), selector);
|
|
6160
6224
|
}
|
|
6161
|
-
var ImageBuildError, ImageBuildNotFoundError, ImageBuildInProgressError, ImageBuildFailedError, ImageBuildCancelledError, ImageBuildTimeoutError, ImageBuildInterruptedError, ImageBuildHandle;
|
|
6225
|
+
var ImageBuildStatus, ImageBuildPhase, ImageBuildKind, ImageBuildCancellationOutcome, ImageBuildErrorCode, ImageBuildError, ImageBuildNotFoundError, ImageBuildInProgressError, ImageBuildFailedError, ImageBuildCancelledError, ImageBuildTimeoutError, ImageBuildInterruptedError, ImageBuildHandle;
|
|
6162
6226
|
var init_image_builds = __esm({
|
|
6163
6227
|
"src/image-builds.ts"() {
|
|
6164
6228
|
"use strict";
|
|
6165
6229
|
init_esm_shims();
|
|
6230
|
+
init_enum();
|
|
6166
6231
|
init_image();
|
|
6167
6232
|
init_sandbox_image();
|
|
6233
|
+
ImageBuildStatus = /* @__PURE__ */ ((ImageBuildStatus2) => {
|
|
6234
|
+
ImageBuildStatus2["PENDING"] = "pending";
|
|
6235
|
+
ImageBuildStatus2["RUNNING"] = "running";
|
|
6236
|
+
ImageBuildStatus2["SUCCEEDED"] = "succeeded";
|
|
6237
|
+
ImageBuildStatus2["FAILED"] = "failed";
|
|
6238
|
+
ImageBuildStatus2["CANCELLED"] = "cancelled";
|
|
6239
|
+
ImageBuildStatus2["UNKNOWN"] = "unknown";
|
|
6240
|
+
return ImageBuildStatus2;
|
|
6241
|
+
})(ImageBuildStatus || {});
|
|
6242
|
+
ImageBuildPhase = /* @__PURE__ */ ((ImageBuildPhase2) => {
|
|
6243
|
+
ImageBuildPhase2["AWAITING_CONTEXT"] = "awaiting_context";
|
|
6244
|
+
ImageBuildPhase2["STARTING_BUILDER"] = "starting_builder";
|
|
6245
|
+
ImageBuildPhase2["EXECUTING"] = "executing";
|
|
6246
|
+
ImageBuildPhase2["SNAPSHOTTING"] = "snapshotting";
|
|
6247
|
+
ImageBuildPhase2["PUBLISHING"] = "publishing";
|
|
6248
|
+
ImageBuildPhase2["FINISHED"] = "finished";
|
|
6249
|
+
ImageBuildPhase2["UNKNOWN"] = "unknown";
|
|
6250
|
+
return ImageBuildPhase2;
|
|
6251
|
+
})(ImageBuildPhase || {});
|
|
6252
|
+
ImageBuildKind = /* @__PURE__ */ ((ImageBuildKind2) => {
|
|
6253
|
+
ImageBuildKind2["DOCKERFILE"] = "dockerfile";
|
|
6254
|
+
ImageBuildKind2["IMPORT"] = "import";
|
|
6255
|
+
ImageBuildKind2["DIRECT"] = "direct";
|
|
6256
|
+
ImageBuildKind2["UNKNOWN"] = "unknown";
|
|
6257
|
+
return ImageBuildKind2;
|
|
6258
|
+
})(ImageBuildKind || {});
|
|
6259
|
+
ImageBuildCancellationOutcome = /* @__PURE__ */ ((ImageBuildCancellationOutcome2) => {
|
|
6260
|
+
ImageBuildCancellationOutcome2["CANCELLED"] = "cancelled";
|
|
6261
|
+
ImageBuildCancellationOutcome2["ALREADY_CANCELLED"] = "already_cancelled";
|
|
6262
|
+
ImageBuildCancellationOutcome2["ALREADY_COMPLETED"] = "already_completed";
|
|
6263
|
+
ImageBuildCancellationOutcome2["ALREADY_FAILED"] = "already_failed";
|
|
6264
|
+
ImageBuildCancellationOutcome2["NOT_ADMITTED"] = "not_admitted";
|
|
6265
|
+
ImageBuildCancellationOutcome2["UNCONFIRMED"] = "unconfirmed";
|
|
6266
|
+
ImageBuildCancellationOutcome2["UNKNOWN"] = "unknown";
|
|
6267
|
+
return ImageBuildCancellationOutcome2;
|
|
6268
|
+
})(ImageBuildCancellationOutcome || {});
|
|
6269
|
+
ImageBuildErrorCode = /* @__PURE__ */ ((ImageBuildErrorCode2) => {
|
|
6270
|
+
ImageBuildErrorCode2["USAGE"] = "usage";
|
|
6271
|
+
ImageBuildErrorCode2["AUTH"] = "auth";
|
|
6272
|
+
ImageBuildErrorCode2["NOT_FOUND"] = "not_found";
|
|
6273
|
+
ImageBuildErrorCode2["IMAGE_BUILD_IN_PROGRESS"] = "image_build_in_progress";
|
|
6274
|
+
ImageBuildErrorCode2["CLIENT_REQUEST_ID_MISMATCH"] = "client_request_id_mismatch";
|
|
6275
|
+
ImageBuildErrorCode2["FAILED"] = "failed";
|
|
6276
|
+
ImageBuildErrorCode2["CANCELLED"] = "cancelled";
|
|
6277
|
+
ImageBuildErrorCode2["TIMEOUT"] = "timeout";
|
|
6278
|
+
ImageBuildErrorCode2["INTERRUPTED"] = "interrupted";
|
|
6279
|
+
ImageBuildErrorCode2["SERVICE"] = "service";
|
|
6280
|
+
ImageBuildErrorCode2["INTERNAL"] = "internal";
|
|
6281
|
+
ImageBuildErrorCode2["UNKNOWN"] = "unknown";
|
|
6282
|
+
return ImageBuildErrorCode2;
|
|
6283
|
+
})(ImageBuildErrorCode || {});
|
|
6168
6284
|
ImageBuildError = class extends Error {
|
|
6169
6285
|
code;
|
|
6170
6286
|
buildId;
|
|
@@ -6174,7 +6290,11 @@ var init_image_builds = __esm({
|
|
|
6174
6290
|
super(details.message);
|
|
6175
6291
|
this.name = "ImageBuildError";
|
|
6176
6292
|
this.code = details.code;
|
|
6177
|
-
this.details = details;
|
|
6293
|
+
this.details = { ...details };
|
|
6294
|
+
withRaw(this, {});
|
|
6295
|
+
if ("confirmed" in details) {
|
|
6296
|
+
this.details.confirmed = details.confirmed === true && isConfirmedCancellation(details.outcome);
|
|
6297
|
+
}
|
|
6178
6298
|
if (details.buildId) this.buildId = details.buildId;
|
|
6179
6299
|
if (details.clientRequestId) this.clientRequestId = details.clientRequestId;
|
|
6180
6300
|
}
|
|
@@ -6206,7 +6326,7 @@ var init_image_builds = __esm({
|
|
|
6206
6326
|
super(details);
|
|
6207
6327
|
this.name = "ImageBuildFailedError";
|
|
6208
6328
|
this.error = details.error ?? "no error recorded";
|
|
6209
|
-
if (details.info) this.info =
|
|
6329
|
+
if (details.info) this.info = details.info;
|
|
6210
6330
|
}
|
|
6211
6331
|
};
|
|
6212
6332
|
ImageBuildCancelledError = class extends ImageBuildError {
|
|
@@ -6214,7 +6334,7 @@ var init_image_builds = __esm({
|
|
|
6214
6334
|
constructor(details) {
|
|
6215
6335
|
super(details);
|
|
6216
6336
|
this.name = "ImageBuildCancelledError";
|
|
6217
|
-
if (details.info) this.info =
|
|
6337
|
+
if (details.info) this.info = details.info;
|
|
6218
6338
|
}
|
|
6219
6339
|
};
|
|
6220
6340
|
ImageBuildTimeoutError = class extends ImageBuildError {
|
|
@@ -6230,8 +6350,8 @@ var init_image_builds = __esm({
|
|
|
6230
6350
|
constructor(details) {
|
|
6231
6351
|
super(details);
|
|
6232
6352
|
this.name = "ImageBuildInterruptedError";
|
|
6233
|
-
this.outcome = details.outcome ?? "unconfirmed"
|
|
6234
|
-
this.confirmed = details.confirmed === true;
|
|
6353
|
+
this.outcome = details.outcome ?? "unconfirmed" /* UNCONFIRMED */;
|
|
6354
|
+
this.confirmed = this.details.confirmed === true;
|
|
6235
6355
|
if (details.result) this.result = details.result;
|
|
6236
6356
|
}
|
|
6237
6357
|
};
|
|
@@ -6264,7 +6384,7 @@ var init_image_builds = __esm({
|
|
|
6264
6384
|
} catch (error) {
|
|
6265
6385
|
throw toImageBuildError(error);
|
|
6266
6386
|
}
|
|
6267
|
-
this.#info = parseBuildInfo(
|
|
6387
|
+
this.#info = parseBuildInfo(json);
|
|
6268
6388
|
return this.#info;
|
|
6269
6389
|
}
|
|
6270
6390
|
/**
|
|
@@ -6285,8 +6405,12 @@ var init_image_builds = __esm({
|
|
|
6285
6405
|
)
|
|
6286
6406
|
);
|
|
6287
6407
|
emitter.rethrow();
|
|
6288
|
-
const
|
|
6289
|
-
|
|
6408
|
+
const raw = decodeResponse(json);
|
|
6409
|
+
const result = camelizeRecord(raw);
|
|
6410
|
+
this.#info = withRaw(
|
|
6411
|
+
{ ...this.#info, status: "succeeded" /* SUCCEEDED */, result },
|
|
6412
|
+
{ ...this.#info.raw, status: "succeeded", result: raw }
|
|
6413
|
+
);
|
|
6290
6414
|
return result;
|
|
6291
6415
|
}
|
|
6292
6416
|
/** Cancel this build by its id (the sufficient selector). */
|
|
@@ -10413,14 +10537,19 @@ export {
|
|
|
10413
10537
|
Headers,
|
|
10414
10538
|
HttpBody,
|
|
10415
10539
|
Image,
|
|
10540
|
+
ImageBuildCancellationOutcome,
|
|
10416
10541
|
ImageBuildCancelledError,
|
|
10417
10542
|
ImageBuildError,
|
|
10543
|
+
ImageBuildErrorCode,
|
|
10418
10544
|
ImageBuildFailedError,
|
|
10419
10545
|
ImageBuildHandle,
|
|
10420
10546
|
ImageBuildInProgressError,
|
|
10421
10547
|
ImageBuildInterruptedError,
|
|
10548
|
+
ImageBuildKind,
|
|
10422
10549
|
ImageBuildNotFoundError,
|
|
10423
10550
|
ImageBuildOperationType,
|
|
10551
|
+
ImageBuildPhase,
|
|
10552
|
+
ImageBuildStatus,
|
|
10424
10553
|
ImageBuildTimeoutError,
|
|
10425
10554
|
MountError,
|
|
10426
10555
|
OutputMode,
|