deepline 0.3.294 → 0.3.296
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/bundling-sources/sdk/src/compat.ts +35 -7
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +108 -35
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts +25 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +14 -1
- package/dist/cli/auth-JCGIDVDF.mjs +31 -0
- package/dist/cli/auth-QDWV3TXX.js +31 -0
- package/dist/cli/billing-OQBSIXRG.mjs +1749 -0
- package/dist/cli/billing-YBK3J4WP.js +1749 -0
- package/dist/cli/chunk-2C3AVPTY.js +5688 -0
- package/dist/cli/chunk-2MZ5EQZE.mjs +499 -0
- package/dist/cli/chunk-3KC45UVF.js +150 -0
- package/dist/cli/chunk-3XX5TEA4.js +15 -0
- package/dist/cli/chunk-4MBOJQPL.mjs +0 -0
- package/dist/cli/chunk-4Y6CG4GE.js +2240 -0
- package/dist/cli/chunk-4ZB3CJRD.js +1269 -0
- package/dist/cli/chunk-5JLQPVNX.js +3056 -0
- package/dist/cli/chunk-6A3TJUWC.js +76 -0
- package/dist/cli/chunk-6HPEDBSJ.js +1995 -0
- package/dist/cli/chunk-7D6QG5KF.js +890 -0
- package/dist/cli/chunk-7P5AA3SN.js +344 -0
- package/dist/cli/chunk-7UAO5MWV.mjs +190 -0
- package/dist/cli/chunk-A7427JJH.js +190 -0
- package/dist/cli/chunk-AQRTLPHZ.js +735 -0
- package/dist/cli/chunk-AYHLUHE5.js +52 -0
- package/dist/cli/chunk-BZ77OTRF.mjs +923 -0
- package/dist/cli/chunk-CBVIJSHF.mjs +560 -0
- package/dist/cli/chunk-COGTRVWW.js +30 -0
- package/dist/cli/chunk-DLIRSHV6.mjs +28 -0
- package/dist/cli/chunk-DYWHXO7O.mjs +34 -0
- package/dist/cli/chunk-EDWJY6T4.mjs +3056 -0
- package/dist/cli/chunk-EXMLR72R.mjs +0 -0
- package/dist/cli/chunk-G46HHFNB.mjs +1269 -0
- package/dist/cli/chunk-GAMFK2ZP.mjs +148 -0
- package/dist/cli/chunk-GLKUGBTP.mjs +2240 -0
- package/dist/cli/chunk-GONRLVV3.js +3440 -0
- package/dist/cli/chunk-GVUJJJ5G.mjs +76 -0
- package/dist/cli/chunk-H7HIDGZ7.mjs +150 -0
- package/dist/cli/chunk-HUZXWOSK.mjs +503 -0
- package/dist/cli/chunk-I5YZLGMG.js +1 -0
- package/dist/cli/chunk-ITOFSXIU.mjs +15 -0
- package/dist/cli/chunk-J2D3VDOU.mjs +5688 -0
- package/dist/cli/chunk-J5NA2TTX.js +503 -0
- package/dist/cli/chunk-JCS5TPNY.mjs +3440 -0
- package/dist/cli/chunk-JNNOCMQY.js +47 -0
- package/dist/cli/chunk-KRD6H754.mjs +30 -0
- package/dist/cli/chunk-L4HBNHFW.js +34 -0
- package/dist/cli/chunk-LA46MMTL.js +560 -0
- package/dist/cli/chunk-LIKFCE7Z.js +190 -0
- package/dist/cli/chunk-MIMASXO4.mjs +389 -0
- package/dist/cli/chunk-NPPJX3BL.mjs +1995 -0
- package/dist/cli/chunk-NTEZFZLE.mjs +890 -0
- package/dist/cli/chunk-NXDRDJ4K.js +389 -0
- package/dist/cli/chunk-NXGCO4JB.mjs +344 -0
- package/dist/cli/chunk-OG64RBAC.js +6 -0
- package/dist/cli/chunk-OWJZUE3Y.mjs +103 -0
- package/dist/cli/chunk-QSIO4TX2.mjs +190 -0
- package/dist/cli/chunk-RCUE5C5C.mjs +735 -0
- package/dist/cli/chunk-SDK3ZA2C.js +103 -0
- package/dist/cli/chunk-SFLARO4Y.mjs +47 -0
- package/dist/cli/chunk-TAC3JIFE.mjs +354 -0
- package/dist/cli/chunk-UC6GHEL4.js +499 -0
- package/dist/cli/chunk-UFS752TU.mjs +52 -0
- package/dist/cli/chunk-UNEMDKXN.js +1 -0
- package/dist/cli/chunk-WB6Z2Q44.mjs +1622 -0
- package/dist/cli/chunk-WJYPBHTE.js +148 -0
- package/dist/cli/chunk-WOHBA5PV.js +354 -0
- package/dist/cli/chunk-WZYKRD7T.mjs +6 -0
- package/dist/cli/chunk-XNYIZMNQ.js +28 -0
- package/dist/cli/chunk-ZDO3TO3M.js +1622 -0
- package/dist/cli/chunk-ZDOC4HFL.js +923 -0
- package/dist/cli/client-CZDA4JKO.mjs +20 -0
- package/dist/cli/client-IZGIN2ZA.js +20 -0
- package/dist/cli/csv-6KOMZA2H.mjs +585 -0
- package/dist/cli/csv-UTEQY3NA.js +585 -0
- package/dist/cli/db-D5EP6TKO.mjs +486 -0
- package/dist/cli/db-SIBLPIKC.js +486 -0
- package/dist/cli/executions-2PHT57IO.js +28 -0
- package/dist/cli/executions-DFWM2YYY.mjs +28 -0
- package/dist/cli/feedback-GZW37JMI.mjs +107 -0
- package/dist/cli/feedback-IQVWIJZ4.js +107 -0
- package/dist/cli/getting-started.js +18 -76
- package/dist/cli/getting-started.mjs +10 -37
- package/dist/cli/git-563GYLMA.js +23 -0
- package/dist/cli/git-B72Y4FFQ.mjs +23 -0
- package/dist/cli/index.js +291 -54294
- package/dist/cli/index.mjs +209 -54352
- package/dist/cli/legacy-noops-37F5MX2P.mjs +157 -0
- package/dist/cli/legacy-noops-IFGVDCOM.js +157 -0
- package/dist/cli/monitors-42H6LOVT.mjs +3251 -0
- package/dist/cli/monitors-GQCHXBXZ.js +3251 -0
- package/dist/cli/org-4GCPBTGR.js +849 -0
- package/dist/cli/org-JYZA3ZRJ.mjs +849 -0
- package/dist/cli/play-46ZJ4FMI.js +18439 -0
- package/dist/cli/play-Q2XV3FZZ.mjs +18439 -0
- package/dist/cli/providers-CTKQP45X.mjs +95 -0
- package/dist/cli/providers-PCNF5E3K.js +95 -0
- package/dist/cli/proxy-env-EBANZHPV.js +161 -0
- package/dist/cli/proxy-env-M4ZHXHRL.mjs +161 -0
- package/dist/cli/quickstart-FTHWRVWN.js +69 -0
- package/dist/cli/quickstart-X7EVVWRG.mjs +69 -0
- package/dist/cli/search-73YPOFDO.mjs +18 -0
- package/dist/cli/search-XA5UVC3G.js +18 -0
- package/dist/cli/secrets-OUMPT4FX.mjs +400 -0
- package/dist/cli/secrets-UOEVR73Q.js +400 -0
- package/dist/cli/sessions-CMKXCN5Y.js +15 -0
- package/dist/cli/sessions-ZIFGDZE7.mjs +15 -0
- package/dist/cli/settings-OO5R3G52.mjs +846 -0
- package/dist/cli/settings-ULZT2NIC.js +846 -0
- package/dist/cli/setup-6GZH52OZ.mjs +1257 -0
- package/dist/cli/setup-DHGERXPZ.js +1257 -0
- package/dist/cli/skills-Q7NUCS2W.js +28 -0
- package/dist/cli/skills-T3EY2656.mjs +28 -0
- package/dist/cli/tools-BIMOAOTX.mjs +2955 -0
- package/dist/cli/tools-ODXVCKO7.js +2955 -0
- package/dist/cli/update-UMB3ULBR.js +28 -0
- package/dist/cli/update-X4HX7Z3M.mjs +28 -0
- package/dist/cli/workflow-EAUFVPIP.mjs +1936 -0
- package/dist/cli/workflow-IVLCPFTG.js +1936 -0
- package/dist/helpers.js +6 -32
- package/dist/helpers.mjs +2 -0
- package/dist/index.js +1972 -12825
- package/dist/index.mjs +1910 -12672
- package/dist/install-integrity.json +110 -0
- package/dist/monitor-fleet-contract.js +31 -730
- package/dist/monitor-fleet-contract.mjs +18 -667
- package/dist/monitor-input-contract.js +10 -390
- package/dist/monitor-input-contract.mjs +7 -348
- package/dist/plays/bundle-play-file.mjs +13 -5178
- package/dist/plays/csv-data-input.js +5 -3132
- package/dist/plays/csv-data-input.mjs +5 -3105
- package/dist/plays/run-request.js +56 -664
- package/dist/plays/run-request.mjs +30 -588
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +5 -212
- package/dist/release.mjs +5 -185
- package/package.json +1 -1
|
@@ -1,591 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/** Local diagnostic context; not a portable error contract. */
|
|
32
|
-
details;
|
|
33
|
-
/**
|
|
34
|
-
* Construct a Deepline error.
|
|
35
|
-
*
|
|
36
|
-
* SDK and runtime code construct these errors. Application and Play code
|
|
37
|
-
* normally catches the public subclasses instead.
|
|
38
|
-
*
|
|
39
|
-
* @param message Human-readable failure summary.
|
|
40
|
-
* @param statusCode HTTP status when one exists.
|
|
41
|
-
* @param code Stable machine-readable code when one exists.
|
|
42
|
-
* @param details Local diagnostic context; never a portable error contract.
|
|
43
|
-
*/
|
|
44
|
-
constructor(message, statusCode, code, details) {
|
|
45
|
-
super(message);
|
|
46
|
-
this.name = "DeeplineError";
|
|
47
|
-
this.statusCode = statusCode;
|
|
48
|
-
this.code = code;
|
|
49
|
-
this.details = details;
|
|
50
|
-
applyBrand(this, DEEPLINE_ERROR_BRAND);
|
|
51
|
-
}
|
|
52
|
-
static [Symbol.hasInstance](value) {
|
|
53
|
-
if (this !== _DeeplineError) return nativeInstanceOf(this, value);
|
|
54
|
-
return hasBrand(value, DEEPLINE_ERROR_BRAND);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
// ../play-runtime/run-lifecycle-policy.ts
|
|
59
|
-
var TERMINAL_PLAY_RUN_STATUSES = /* @__PURE__ */ new Set([
|
|
60
|
-
"completed",
|
|
61
|
-
"failed",
|
|
62
|
-
"cancelled",
|
|
63
|
-
"terminated",
|
|
64
|
-
"timed_out"
|
|
65
|
-
]);
|
|
66
|
-
function normalizePlayRunLifecycleStatus(value) {
|
|
67
|
-
const normalized = String(value ?? "").trim().toLowerCase();
|
|
68
|
-
switch (normalized) {
|
|
69
|
-
case "queued":
|
|
70
|
-
case "pending":
|
|
71
|
-
return "queued";
|
|
72
|
-
case "running":
|
|
73
|
-
case "started":
|
|
74
|
-
return "running";
|
|
75
|
-
case "waiting":
|
|
76
|
-
return "waiting";
|
|
77
|
-
case "completed":
|
|
78
|
-
case "complete":
|
|
79
|
-
case "succeeded":
|
|
80
|
-
return "completed";
|
|
81
|
-
case "failed":
|
|
82
|
-
case "error":
|
|
83
|
-
return "failed";
|
|
84
|
-
case "cancelled":
|
|
85
|
-
case "canceled":
|
|
86
|
-
return "cancelled";
|
|
87
|
-
case "terminated":
|
|
88
|
-
return "terminated";
|
|
89
|
-
case "timed_out":
|
|
90
|
-
case "timeout":
|
|
91
|
-
return "timed_out";
|
|
92
|
-
default:
|
|
93
|
-
return "unknown";
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
function isTerminalPlayRunLifecycleStatus(status) {
|
|
97
|
-
return TERMINAL_PLAY_RUN_STATUSES.has(
|
|
98
|
-
normalizePlayRunLifecycleStatus(status)
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// src/api-error.ts
|
|
103
|
-
function asRecord(value) {
|
|
104
|
-
return typeof value === "object" && value !== null ? value : null;
|
|
105
|
-
}
|
|
106
|
-
function apiErrorCodeFromResponse(parsed) {
|
|
107
|
-
const response = asRecord(parsed);
|
|
108
|
-
const error = asRecord(response?.error);
|
|
109
|
-
const code = error?.code ?? response?.code;
|
|
110
|
-
return typeof code === "string" ? code : "API_ERROR";
|
|
111
|
-
}
|
|
112
|
-
function apiErrorMessage(parsed, status) {
|
|
113
|
-
const errorValue = typeof parsed === "object" && parsed && "error" in parsed ? parsed.error : void 0;
|
|
114
|
-
if (typeof errorValue === "string") {
|
|
115
|
-
return errorValue;
|
|
116
|
-
}
|
|
117
|
-
if (errorValue && typeof errorValue === "object" && "message" in errorValue && typeof errorValue.message === "string") {
|
|
118
|
-
return errorValue.message;
|
|
119
|
-
}
|
|
120
|
-
if (typeof parsed === "object" && parsed && "message" in parsed && typeof parsed.message === "string") {
|
|
121
|
-
return parsed.message;
|
|
122
|
-
}
|
|
123
|
-
return `HTTP ${status}`;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// src/plays/run-request.ts
|
|
127
|
-
var PLAY_RUN_START_PATH = "/api/v2/plays/run";
|
|
128
|
-
var PLAY_RUN_START_STREAM_PATH = `${PLAY_RUN_START_PATH}?stream=true`;
|
|
129
|
-
var PLAY_FILES_STAGE_PATH = "/api/v2/plays/files/stage";
|
|
130
|
-
var PLAY_FILES_STAGE_MINT_PATH = `${PLAY_FILES_STAGE_PATH}/mint`;
|
|
131
|
-
function buildPlayRunStartBody(request) {
|
|
132
|
-
return {
|
|
133
|
-
...request.name ? { name: request.name } : {},
|
|
134
|
-
...request.revisionId ? { revisionId: request.revisionId } : {},
|
|
135
|
-
...request.artifactStorageKey ? { artifactStorageKey: request.artifactStorageKey } : {},
|
|
136
|
-
...request.sourceCode ? { sourceCode: request.sourceCode } : {},
|
|
137
|
-
...request.sourceFiles ? { sourceFiles: request.sourceFiles } : {},
|
|
138
|
-
...request.description ? { description: request.description } : {},
|
|
139
|
-
..."staticPipeline" in request ? { staticPipeline: request.staticPipeline } : {},
|
|
140
|
-
...request.artifactHash ? { artifactHash: request.artifactHash } : {},
|
|
141
|
-
...request.graphHash ? { graphHash: request.graphHash } : {},
|
|
142
|
-
...request.runtimeArtifact ? { runtimeArtifact: request.runtimeArtifact } : {},
|
|
143
|
-
...request.compilerManifest ? { compilerManifest: request.compilerManifest } : {},
|
|
144
|
-
...request.inputFileUpload ? { inputFileUpload: request.inputFileUpload } : {},
|
|
145
|
-
...request.packagedFileUploads?.length ? { packagedFileUploads: request.packagedFileUploads } : {},
|
|
146
|
-
...request.input ? { input: request.input } : {},
|
|
147
|
-
...request.inputFile ? { inputFile: request.inputFile } : {},
|
|
148
|
-
...request.packagedFiles?.length ? { packagedFiles: request.packagedFiles } : {},
|
|
149
|
-
...request.force ? { force: true } : {},
|
|
150
|
-
...request.forceToolRefresh === true ? { forceToolRefresh: true } : {},
|
|
151
|
-
...typeof request.maxConcurrentExternalCalls === "number" ? { maxConcurrentExternalCalls: request.maxConcurrentExternalCalls } : {},
|
|
152
|
-
...typeof request.maxConcurrentRows === "number" ? { maxConcurrentRows: request.maxConcurrentRows } : {},
|
|
153
|
-
...typeof request.waitForCompletionMs === "number" ? { waitForCompletionMs: request.waitForCompletionMs } : {},
|
|
154
|
-
// Profile selection is the API's job, not the caller's. The server
|
|
155
|
-
// defaults to absurd; callers normally omit this field.
|
|
156
|
-
...request.profile ? { profile: request.profile } : {},
|
|
157
|
-
...request.integrationMode ? { integrationMode: request.integrationMode } : {},
|
|
158
|
-
...request.fixtureBehavior ? { fixtureBehavior: request.fixtureBehavior } : {},
|
|
159
|
-
...request.runtime ? { runtime: request.runtime } : {},
|
|
160
|
-
...request.testPolicyOverrides ? { testPolicyOverrides: request.testPolicyOverrides } : {}
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
async function startPlayRun(http, request, headers) {
|
|
164
|
-
const response = await http.post(
|
|
165
|
-
PLAY_RUN_START_PATH,
|
|
166
|
-
buildPlayRunStartBody(request),
|
|
167
|
-
headers,
|
|
168
|
-
{ maxRetries: 0, exactUrlOnly: true }
|
|
169
|
-
);
|
|
170
|
-
return normalizePlayRunStart(response);
|
|
171
|
-
}
|
|
172
|
-
function isPlayRunPackage(value) {
|
|
173
|
-
return Boolean(
|
|
174
|
-
value && typeof value === "object" && !Array.isArray(value) && value.kind === "play_run" && value.run && typeof value.run?.id === "string"
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
function normalizePlayRunStart(raw) {
|
|
178
|
-
const runPackage = isPlayRunPackage(raw) ? raw : isPlayRunPackage(raw.package) ? raw.package : null;
|
|
179
|
-
if (!runPackage) {
|
|
180
|
-
const workflowId = typeof raw.workflowId === "string" && raw.workflowId ? raw.workflowId : typeof raw.runId === "string" ? raw.runId : "";
|
|
181
|
-
return {
|
|
182
|
-
...raw,
|
|
183
|
-
workflowId
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
const status = typeof runPackage.run.status === "string" ? runPackage.run.status : "running";
|
|
187
|
-
return {
|
|
188
|
-
workflowId: runPackage.run.id,
|
|
189
|
-
name: runPackage.run.playName,
|
|
190
|
-
status,
|
|
191
|
-
...runPackage.run.dashboardUrl ? { dashboardUrl: runPackage.run.dashboardUrl } : {},
|
|
192
|
-
...isTerminalPlayRunLifecycleStatus(status) ? { finalStatus: runPackage } : {},
|
|
193
|
-
package: runPackage
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
function buildNamedPlayRunRequest(input) {
|
|
197
|
-
return {
|
|
198
|
-
name: input.name,
|
|
199
|
-
...input.revisionId ? { revisionId: input.revisionId } : {},
|
|
200
|
-
...Object.keys(input.runtimeInput).length > 0 ? { input: input.runtimeInput } : {},
|
|
201
|
-
...input.stagedFileInputs.inputFile ? { inputFile: input.stagedFileInputs.inputFile } : {},
|
|
202
|
-
...input.stagedFileInputs.packagedFiles.length ? { packagedFiles: input.stagedFileInputs.packagedFiles } : {},
|
|
203
|
-
...input.extra
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
var CSV_DATA_INPUT_KEY = "csv";
|
|
207
|
-
function schemaMetadata(schema, key) {
|
|
208
|
-
if (!schema || typeof schema !== "object" || Array.isArray(schema))
|
|
209
|
-
return null;
|
|
210
|
-
const value = schema[key];
|
|
211
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
212
|
-
}
|
|
213
|
-
function stringMetadata(metadata, key) {
|
|
214
|
-
const value = metadata?.[key];
|
|
215
|
-
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
216
|
-
}
|
|
217
|
-
function inputFieldFromCsvArg(csvArg) {
|
|
218
|
-
if (typeof csvArg !== "string") return null;
|
|
219
|
-
const match = /^\(?\s*input\.([A-Za-z_$][\w$]*)\s*\)?(?:\s*\?\?[\s\S]+)?$/.exec(
|
|
220
|
-
csvArg.trim()
|
|
221
|
-
);
|
|
222
|
-
return match?.[1] ?? null;
|
|
223
|
-
}
|
|
224
|
-
function fileInputBindingsFromPlaySchema(inputSchema) {
|
|
225
|
-
const csvInput = schemaMetadata(inputSchema, "csvInput");
|
|
226
|
-
if (!csvInput) return [];
|
|
227
|
-
return [
|
|
228
|
-
{
|
|
229
|
-
inputPath: stringMetadata(csvInput, "inputField") ?? CSV_DATA_INPUT_KEY
|
|
230
|
-
}
|
|
231
|
-
];
|
|
232
|
-
}
|
|
233
|
-
function fileInputBindingsFromStaticPipeline(staticPipeline) {
|
|
234
|
-
if (!staticPipeline || typeof staticPipeline !== "object" || Array.isArray(staticPipeline)) {
|
|
235
|
-
return [];
|
|
236
|
-
}
|
|
237
|
-
const inputField = inputFieldFromCsvArg(
|
|
238
|
-
staticPipeline.csvArg
|
|
239
|
-
);
|
|
240
|
-
return inputField ? [{ inputPath: inputField }] : [];
|
|
241
|
-
}
|
|
242
|
-
function playRunFileInputBindings(play) {
|
|
243
|
-
return [
|
|
244
|
-
...fileInputBindingsFromPlaySchema(play.inputSchema),
|
|
245
|
-
...fileInputBindingsFromStaticPipeline(play.staticPipeline)
|
|
246
|
-
];
|
|
247
|
-
}
|
|
248
|
-
function getDottedInputValue(input, path) {
|
|
249
|
-
const parts = path.split(".").map((part) => part.trim()).filter(Boolean);
|
|
250
|
-
let cursor = input;
|
|
251
|
-
for (const part of parts) {
|
|
252
|
-
if (!cursor || typeof cursor !== "object" || Array.isArray(cursor)) {
|
|
253
|
-
return void 0;
|
|
254
|
-
}
|
|
255
|
-
cursor = cursor[part];
|
|
256
|
-
}
|
|
257
|
-
return cursor;
|
|
258
|
-
}
|
|
259
|
-
function setDottedInputValue(input, path, value) {
|
|
260
|
-
const parts = path.split(".").map((part) => part.trim()).filter(Boolean);
|
|
261
|
-
if (parts.length === 0) {
|
|
262
|
-
throw new Error(`Invalid play input flag path: ${path}`);
|
|
263
|
-
}
|
|
264
|
-
let cursor = input;
|
|
265
|
-
for (const part of parts.slice(0, -1)) {
|
|
266
|
-
const existing = cursor[part];
|
|
267
|
-
if (existing !== void 0 && (!existing || typeof existing !== "object" || Array.isArray(existing))) {
|
|
268
|
-
throw new Error(
|
|
269
|
-
`Cannot set --${path}; input.${part} is already a non-object value.`
|
|
270
|
-
);
|
|
271
|
-
}
|
|
272
|
-
if (!existing) {
|
|
273
|
-
cursor[part] = {};
|
|
274
|
-
}
|
|
275
|
-
cursor = cursor[part];
|
|
276
|
-
}
|
|
277
|
-
cursor[parts[parts.length - 1]] = value;
|
|
278
|
-
}
|
|
279
|
-
var webStagedFileCodec = {
|
|
280
|
-
async sha256Hex(bytes) {
|
|
281
|
-
const digest = await globalThis.crypto.subtle.digest(
|
|
282
|
-
"SHA-256",
|
|
283
|
-
bytes
|
|
284
|
-
);
|
|
285
|
-
return Array.from(
|
|
286
|
-
new Uint8Array(digest),
|
|
287
|
-
(byte) => byte.toString(16).padStart(2, "0")
|
|
288
|
-
).join("");
|
|
289
|
-
},
|
|
290
|
-
base64(bytes) {
|
|
291
|
-
let binary = "";
|
|
292
|
-
for (let offset = 0; offset < bytes.length; offset += 32768) {
|
|
293
|
-
binary += String.fromCharCode(...bytes.subarray(offset, offset + 32768));
|
|
294
|
-
}
|
|
295
|
-
return btoa(binary);
|
|
296
|
-
}
|
|
297
|
-
};
|
|
298
|
-
function stagedFileContentType(logicalPath) {
|
|
299
|
-
const lower = logicalPath.toLowerCase();
|
|
300
|
-
return lower.endsWith(".csv") ? "text/csv" : lower.endsWith(".json") ? "application/json" : "application/octet-stream";
|
|
301
|
-
}
|
|
302
|
-
async function createStagedFileUpload(logicalPath, bytes, codec = webStagedFileCodec) {
|
|
303
|
-
return {
|
|
304
|
-
logicalPath,
|
|
305
|
-
contentBase64: codec.base64(bytes),
|
|
306
|
-
contentHash: await codec.sha256Hex(bytes),
|
|
307
|
-
contentType: stagedFileContentType(logicalPath),
|
|
308
|
-
bytes: bytes.byteLength
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
var STAGE_LEGACY_MULTIPART_MAX_BYTES = 4e6;
|
|
312
|
-
var STAGE_DIRECT_UPLOAD_MAX_ATTEMPTS = 3;
|
|
313
|
-
function sleep(ms) {
|
|
314
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
315
|
-
}
|
|
316
|
-
function stagedUploadIdentity(logicalPath, contentHash) {
|
|
317
|
-
return `${contentHash}:${logicalPath}`;
|
|
318
|
-
}
|
|
319
|
-
function isStagedUploadMintUnsupported(error) {
|
|
320
|
-
return error instanceof DeeplineError && error.statusCode === 404;
|
|
321
|
-
}
|
|
322
|
-
function isStagedUploadDirectEgressDenied(error) {
|
|
323
|
-
return error instanceof DeeplineError && error.code === "STAGED_FILE_UPLOAD_EGRESS_DENIED";
|
|
324
|
-
}
|
|
325
|
-
function formatMegabytes(bytes) {
|
|
326
|
-
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
327
|
-
}
|
|
328
|
-
function decodeBase64Bytes(value) {
|
|
329
|
-
const binary = atob(value);
|
|
330
|
-
const bytes = new Uint8Array(binary.length);
|
|
331
|
-
for (let index = 0; index < binary.length; index += 1) {
|
|
332
|
-
bytes[index] = binary.charCodeAt(index);
|
|
333
|
-
}
|
|
334
|
-
return bytes;
|
|
335
|
-
}
|
|
336
|
-
async function uploadStagedFileToPresignedUrl(input) {
|
|
337
|
-
const arrayBuffer = input.body.buffer.slice(
|
|
338
|
-
input.body.byteOffset,
|
|
339
|
-
input.body.byteOffset + input.body.byteLength
|
|
340
|
-
);
|
|
341
|
-
let lastError;
|
|
342
|
-
for (let attempt = 1; attempt <= STAGE_DIRECT_UPLOAD_MAX_ATTEMPTS; attempt += 1) {
|
|
343
|
-
try {
|
|
344
|
-
const response = await fetch(input.url, {
|
|
345
|
-
method: "PUT",
|
|
346
|
-
headers: input.headers,
|
|
347
|
-
body: new Blob([arrayBuffer])
|
|
348
|
-
});
|
|
349
|
-
if (response.ok) {
|
|
350
|
-
return;
|
|
351
|
-
}
|
|
352
|
-
const text = await response.text().catch(() => "");
|
|
353
|
-
const egressDenied = response.status === 403 && response.headers.get("x-deny-reason")?.trim().toLowerCase() === "host_not_allowed";
|
|
354
|
-
lastError = new DeeplineError(
|
|
355
|
-
`Direct storage upload of ${input.logicalPath} failed: ${response.status} ${text.slice(0, 200)}`,
|
|
356
|
-
response.status,
|
|
357
|
-
egressDenied ? "STAGED_FILE_UPLOAD_EGRESS_DENIED" : "STAGED_FILE_UPLOAD_FAILED",
|
|
358
|
-
{ logicalPath: input.logicalPath }
|
|
359
|
-
);
|
|
360
|
-
if (response.status < 500 && response.status !== 429) {
|
|
361
|
-
break;
|
|
362
|
-
}
|
|
363
|
-
} catch (error) {
|
|
364
|
-
lastError = error instanceof TypeError ? new DeeplineError(
|
|
365
|
-
`Direct storage upload of ${input.logicalPath} could not reach the storage endpoint: ${error.message}`,
|
|
366
|
-
void 0,
|
|
367
|
-
"STAGED_FILE_UPLOAD_EGRESS_DENIED",
|
|
368
|
-
{ logicalPath: input.logicalPath }
|
|
369
|
-
) : error;
|
|
370
|
-
}
|
|
371
|
-
if (attempt < STAGE_DIRECT_UPLOAD_MAX_ATTEMPTS) {
|
|
372
|
-
await sleep(250 * attempt);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
throw lastError instanceof Error ? lastError : new DeeplineError(
|
|
376
|
-
`Direct storage upload of ${input.logicalPath} failed.`,
|
|
377
|
-
void 0,
|
|
378
|
-
"STAGED_FILE_UPLOAD_FAILED",
|
|
379
|
-
{ logicalPath: input.logicalPath }
|
|
380
|
-
);
|
|
381
|
-
}
|
|
382
|
-
async function mintStagedPlayFileUploads(http, files) {
|
|
383
|
-
const response = await http.post(PLAY_FILES_STAGE_MINT_PATH, { files });
|
|
384
|
-
return response.uploads ?? [];
|
|
385
|
-
}
|
|
386
|
-
async function stagePlayFilesViaMultipart(http, files, reason = "mint-unsupported") {
|
|
387
|
-
for (const file of files) {
|
|
388
|
-
if (file.bytes > STAGE_LEGACY_MULTIPART_MAX_BYTES) {
|
|
389
|
-
const reasonMessage = reason === "direct-egress-denied" ? "direct storage is blocked by this environment's network egress policy" : "the connected Deepline server does not support direct-to-storage uploads";
|
|
390
|
-
throw new DeeplineError(
|
|
391
|
-
`Cannot stage ${file.logicalPath} (${formatMegabytes(file.bytes)}): ${reasonMessage}, and this file exceeds the ~4.5MB request-body limit the legacy upload path is subject to.`,
|
|
392
|
-
413,
|
|
393
|
-
"STAGED_FILE_TOO_LARGE_FOR_LEGACY_UPLOAD",
|
|
394
|
-
{
|
|
395
|
-
logicalPath: file.logicalPath,
|
|
396
|
-
bytes: file.bytes,
|
|
397
|
-
maxBytes: STAGE_LEGACY_MULTIPART_MAX_BYTES
|
|
398
|
-
}
|
|
399
|
-
);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
const buildFormData = () => {
|
|
403
|
-
const formData = new FormData();
|
|
404
|
-
formData.set(
|
|
405
|
-
"metadata",
|
|
406
|
-
JSON.stringify({
|
|
407
|
-
files: files.map((file, index) => ({
|
|
408
|
-
index,
|
|
409
|
-
logicalPath: file.logicalPath,
|
|
410
|
-
contentHash: file.contentHash,
|
|
411
|
-
contentType: file.contentType,
|
|
412
|
-
bytes: file.bytes
|
|
413
|
-
}))
|
|
414
|
-
})
|
|
415
|
-
);
|
|
416
|
-
for (const [index, file] of files.entries()) {
|
|
417
|
-
const bytes = decodeBase64Bytes(file.contentBase64);
|
|
418
|
-
const body = bytes.buffer.slice(
|
|
419
|
-
bytes.byteOffset,
|
|
420
|
-
bytes.byteOffset + bytes.byteLength
|
|
421
|
-
);
|
|
422
|
-
formData.set(
|
|
423
|
-
`file:${index}`,
|
|
424
|
-
new Blob([body], { type: file.contentType }),
|
|
425
|
-
file.logicalPath
|
|
426
|
-
);
|
|
427
|
-
}
|
|
428
|
-
return formData;
|
|
429
|
-
};
|
|
430
|
-
const response = await http.postFormData(PLAY_FILES_STAGE_PATH, buildFormData);
|
|
431
|
-
return response.files;
|
|
432
|
-
}
|
|
433
|
-
async function stagePlayFiles(http, files) {
|
|
434
|
-
let uploads;
|
|
435
|
-
try {
|
|
436
|
-
uploads = await mintStagedPlayFileUploads(
|
|
437
|
-
http,
|
|
438
|
-
files.map((file) => ({
|
|
439
|
-
logicalPath: file.logicalPath,
|
|
440
|
-
contentHash: file.contentHash,
|
|
441
|
-
contentType: file.contentType,
|
|
442
|
-
bytes: file.bytes
|
|
443
|
-
}))
|
|
444
|
-
);
|
|
445
|
-
} catch (error) {
|
|
446
|
-
if (isStagedUploadMintUnsupported(error)) {
|
|
447
|
-
return stagePlayFilesViaMultipart(http, files);
|
|
448
|
-
}
|
|
449
|
-
throw error;
|
|
450
|
-
}
|
|
451
|
-
const uploadByIdentity = /* @__PURE__ */ new Map();
|
|
452
|
-
for (const upload of uploads) {
|
|
453
|
-
uploadByIdentity.set(
|
|
454
|
-
stagedUploadIdentity(upload.logicalPath, upload.contentHash),
|
|
455
|
-
upload
|
|
456
|
-
);
|
|
457
|
-
}
|
|
458
|
-
const directResults = await Promise.all(
|
|
459
|
-
files.map(async (file) => {
|
|
460
|
-
const upload = uploadByIdentity.get(
|
|
461
|
-
stagedUploadIdentity(file.logicalPath, file.contentHash)
|
|
462
|
-
);
|
|
463
|
-
if (!upload) {
|
|
464
|
-
throw new DeeplineError(
|
|
465
|
-
`The staging server did not return an upload target for ${file.logicalPath}.`,
|
|
466
|
-
void 0,
|
|
467
|
-
"STAGED_FILE_MINT_INCOMPLETE"
|
|
468
|
-
);
|
|
469
|
-
}
|
|
470
|
-
if (upload.alreadyStaged || !upload.uploadUrl) {
|
|
471
|
-
return { ref: upload.ref };
|
|
472
|
-
}
|
|
473
|
-
try {
|
|
474
|
-
await uploadStagedFileToPresignedUrl({
|
|
475
|
-
url: upload.uploadUrl,
|
|
476
|
-
headers: upload.uploadHeaders ?? {
|
|
477
|
-
"content-type": file.contentType
|
|
478
|
-
},
|
|
479
|
-
body: decodeBase64Bytes(file.contentBase64),
|
|
480
|
-
logicalPath: file.logicalPath
|
|
481
|
-
});
|
|
482
|
-
return { ref: upload.ref };
|
|
483
|
-
} catch (error) {
|
|
484
|
-
if (isStagedUploadDirectEgressDenied(error)) {
|
|
485
|
-
return { fallbackFile: file };
|
|
486
|
-
}
|
|
487
|
-
throw error;
|
|
488
|
-
}
|
|
489
|
-
})
|
|
490
|
-
);
|
|
491
|
-
return await Promise.all(
|
|
492
|
-
directResults.map(async (result) => {
|
|
493
|
-
if ("fallbackFile" in result) {
|
|
494
|
-
const [ref] = await stagePlayFilesViaMultipart(
|
|
495
|
-
http,
|
|
496
|
-
[result.fallbackFile],
|
|
497
|
-
"direct-egress-denied"
|
|
498
|
-
);
|
|
499
|
-
if (!ref) {
|
|
500
|
-
throw new DeeplineError(
|
|
501
|
-
`The staging server did not return an upload target for ${result.fallbackFile.logicalPath}.`,
|
|
502
|
-
void 0,
|
|
503
|
-
"STAGED_FILE_MINT_INCOMPLETE"
|
|
504
|
-
);
|
|
505
|
-
}
|
|
506
|
-
return ref;
|
|
507
|
-
}
|
|
508
|
-
return result.ref;
|
|
509
|
-
})
|
|
510
|
-
);
|
|
511
|
-
}
|
|
512
|
-
async function stageFileInputs(input) {
|
|
513
|
-
const uniqueBindings = [
|
|
514
|
-
...new Map(
|
|
515
|
-
input.bindings.map((binding) => [binding.inputPath, binding])
|
|
516
|
-
).values()
|
|
517
|
-
];
|
|
518
|
-
const localFiles = uniqueBindings.flatMap((binding) => {
|
|
519
|
-
const file = input.resolveLocalFile(
|
|
520
|
-
getDottedInputValue(input.runtimeInput, binding.inputPath),
|
|
521
|
-
binding
|
|
522
|
-
);
|
|
523
|
-
return file ? [{ binding, file }] : [];
|
|
524
|
-
});
|
|
525
|
-
if (localFiles.length === 0) {
|
|
526
|
-
return { inputFile: null, packagedFiles: [] };
|
|
527
|
-
}
|
|
528
|
-
input.onStaging?.(localFiles.length);
|
|
529
|
-
const uploads = await Promise.all(
|
|
530
|
-
localFiles.map(
|
|
531
|
-
async ({ file }) => createStagedFileUpload(file.logicalPath, await file.read(), input.codec)
|
|
532
|
-
)
|
|
533
|
-
);
|
|
534
|
-
const staged = await input.stage(uploads);
|
|
535
|
-
for (const [index, { binding, file }] of localFiles.entries()) {
|
|
536
|
-
setDottedInputValue(
|
|
537
|
-
input.runtimeInput,
|
|
538
|
-
binding.inputPath,
|
|
539
|
-
file.logicalPath
|
|
540
|
-
);
|
|
541
|
-
const stagedFile = staged[index];
|
|
542
|
-
if (stagedFile && stagedFile.logicalPath !== file.logicalPath) {
|
|
543
|
-
setDottedInputValue(
|
|
544
|
-
input.runtimeInput,
|
|
545
|
-
binding.inputPath,
|
|
546
|
-
stagedFile.logicalPath
|
|
547
|
-
);
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
return {
|
|
551
|
-
inputFile: staged[0] ?? null,
|
|
552
|
-
packagedFiles: staged.slice(1)
|
|
553
|
-
};
|
|
554
|
-
}
|
|
555
|
-
function createSessionPlayRunHttp(fetchImpl = (...args) => fetch(...args)) {
|
|
556
|
-
const send = async (path, init) => {
|
|
557
|
-
const response = await fetchImpl(path, {
|
|
558
|
-
...init,
|
|
559
|
-
credentials: "include"
|
|
560
|
-
});
|
|
561
|
-
const text = await response.text();
|
|
562
|
-
let parsed = text;
|
|
563
|
-
try {
|
|
564
|
-
parsed = text ? JSON.parse(text) : null;
|
|
565
|
-
} catch {
|
|
566
|
-
}
|
|
567
|
-
if (!response.ok) {
|
|
568
|
-
throw new DeeplineError(
|
|
569
|
-
apiErrorMessage(parsed, response.status),
|
|
570
|
-
response.status,
|
|
571
|
-
apiErrorCodeFromResponse(parsed),
|
|
572
|
-
{ response: parsed }
|
|
573
|
-
);
|
|
574
|
-
}
|
|
575
|
-
return parsed;
|
|
576
|
-
};
|
|
577
|
-
return {
|
|
578
|
-
post: (path, body, headers) => send(path, {
|
|
579
|
-
method: "POST",
|
|
580
|
-
headers: { "content-type": "application/json", ...headers },
|
|
581
|
-
body: JSON.stringify(body)
|
|
582
|
-
}),
|
|
583
|
-
postFormData: (path, formData) => send(path, {
|
|
584
|
-
method: "POST",
|
|
585
|
-
body: typeof formData === "function" ? formData() : formData
|
|
586
|
-
})
|
|
587
|
-
};
|
|
588
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
CSV_DATA_INPUT_KEY,
|
|
3
|
+
PLAY_FILES_STAGE_MINT_PATH,
|
|
4
|
+
PLAY_FILES_STAGE_PATH,
|
|
5
|
+
PLAY_RUN_START_PATH,
|
|
6
|
+
PLAY_RUN_START_STREAM_PATH,
|
|
7
|
+
STAGE_LEGACY_MULTIPART_MAX_BYTES,
|
|
8
|
+
buildNamedPlayRunRequest,
|
|
9
|
+
buildPlayRunStartBody,
|
|
10
|
+
createSessionPlayRunHttp,
|
|
11
|
+
createStagedFileUpload,
|
|
12
|
+
fileInputBindingsFromPlaySchema,
|
|
13
|
+
fileInputBindingsFromStaticPipeline,
|
|
14
|
+
getDottedInputValue,
|
|
15
|
+
isPlayRunPackage,
|
|
16
|
+
mintStagedPlayFileUploads,
|
|
17
|
+
normalizePlayRunStart,
|
|
18
|
+
playRunFileInputBindings,
|
|
19
|
+
setDottedInputValue,
|
|
20
|
+
stageFileInputs,
|
|
21
|
+
stagePlayFiles,
|
|
22
|
+
stagedFileContentType,
|
|
23
|
+
startPlayRun,
|
|
24
|
+
webStagedFileCodec
|
|
25
|
+
} from "../cli/chunk-CBVIJSHF.mjs";
|
|
26
|
+
import "../cli/chunk-DLIRSHV6.mjs";
|
|
27
|
+
import {
|
|
28
|
+
DeeplineError
|
|
29
|
+
} from "../cli/chunk-NXGCO4JB.mjs";
|
|
30
|
+
import "../cli/chunk-KRD6H754.mjs";
|
|
589
31
|
export {
|
|
590
32
|
CSV_DATA_INPUT_KEY,
|
|
591
33
|
DeeplineError,
|
package/dist/release.d.mts
CHANGED
|
@@ -149,7 +149,7 @@ type SdkRelease = {
|
|
|
149
149
|
supportPolicy: SdkSupportPolicy;
|
|
150
150
|
};
|
|
151
151
|
declare const SDK_RELEASE: {
|
|
152
|
-
readonly version: "0.3.
|
|
152
|
+
readonly version: "0.3.296";
|
|
153
153
|
readonly updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.";
|
|
154
154
|
readonly packageCapabilities: {
|
|
155
155
|
readonly updatePreferences: 1;
|
package/dist/release.d.ts
CHANGED
|
@@ -149,7 +149,7 @@ type SdkRelease = {
|
|
|
149
149
|
supportPolicy: SdkSupportPolicy;
|
|
150
150
|
};
|
|
151
151
|
declare const SDK_RELEASE: {
|
|
152
|
-
readonly version: "0.3.
|
|
152
|
+
readonly version: "0.3.296";
|
|
153
153
|
readonly updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.";
|
|
154
154
|
readonly packageCapabilities: {
|
|
155
155
|
readonly updatePreferences: 1;
|