@apilift/cli 1.8.8-dev.1793993455.ba16d412dadb8603392b699857501c2d7d77bc47 → 1.8.8
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/apilift-capture-server.js +2 -2
- package/dist/apilift-collector.js +31 -8
- package/dist/apilift-native-host.js +33 -10
- package/dist/apilift.js +242 -67
- package/dist/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/plugin/.codex-plugin/plugin.json +1 -1
- package/dist/plugin/skills/discover/references/operation-contract.md +7 -5
- package/package.json +2 -2
|
@@ -19722,7 +19722,7 @@ var inputChunk = external_exports.strictObject({ offset: external_exports.number
|
|
|
19722
19722
|
var preparedBinding = external_exports.strictObject({ $prepared: external_exports.string().max(2e3) });
|
|
19723
19723
|
var filePart = external_exports.strictObject({ sha256: hash2, bytes: external_exports.number().int().min(0).max(16 * 1024 * 1024), name: external_exports.string().min(1).max(180), contentType: external_exports.string().min(1).max(100) });
|
|
19724
19724
|
var multipart = external_exports.array(external_exports.union([external_exports.strictObject({ name: text, value: external_exports.union([external_exports.string().max(65536), external_exports.number(), external_exports.boolean(), preparedBinding]) }), external_exports.strictObject({ name: text, file: filePart })])).min(1).max(64);
|
|
19725
|
-
var filePreparation = external_exports.strictObject({ url: url2, headers: external_exports.record(external_exports.string(), external_exports.string()), response: external_exports.strictObject({ path: external_exports.string().optional(), fields: external_exports.record(external_exports.string(), external_exports.string()).optional() }), urlFrom: external_exports.string().optional(), query: external_exports.record(external_exports.string(), preparedBinding).optional(), headerBindings: external_exports.record(external_exports.string(), preparedBinding).optional() });
|
|
19725
|
+
var filePreparation = external_exports.strictObject({ resultPaths: external_exports.array(external_exports.string().max(512)).min(1).max(8).optional(), url: url2, headers: external_exports.record(external_exports.string(), external_exports.string()), response: external_exports.strictObject({ path: external_exports.string().optional(), fields: external_exports.record(external_exports.string(), external_exports.string()).optional() }), urlFrom: external_exports.string().optional(), query: external_exports.record(external_exports.string(), preparedBinding).optional(), headerBindings: external_exports.record(external_exports.string(), preparedBinding).optional() });
|
|
19726
19726
|
var captureEntry = external_exports.strictObject({
|
|
19727
19727
|
captureId: id,
|
|
19728
19728
|
transactionId: id,
|
|
@@ -20379,7 +20379,7 @@ var CaptureStore = class {
|
|
|
20379
20379
|
if (!job) return {};
|
|
20380
20380
|
this.row(scopeId, true);
|
|
20381
20381
|
const envelope = readJson(job.envelope_json);
|
|
20382
|
-
if ((envelope.job.multipart || envelope.job.filePreparation || envelope.job.fileResponse || envelope.job.anonymous) && !request2.payload.capabilities.includes("file-transfers-v1")) {
|
|
20382
|
+
if ((envelope.job.multipart || envelope.job.filePreparation || envelope.job.fileResponse || envelope.job.anonymous) && !request2.payload.capabilities.includes("file-transfers-v1") || envelope.job.filePreparation?.resultPaths && !request2.payload.capabilities.includes("file-workflows-v2")) {
|
|
20383
20383
|
this.db.prepare("UPDATE jobs SET status='delivered',result_json=?,delivered_at=? WHERE id=?").run(json3({ transportError: "Update Companion before file transfers; no app request was sent", code: "extension-upgrade-required", executionState: "not-dispatched", mutationDispatched: false }), now, job.id);
|
|
20384
20384
|
this.emit();
|
|
20385
20385
|
return {};
|
|
@@ -28095,7 +28095,7 @@ function bodyIssues(v2, ctx) {
|
|
|
28095
28095
|
if (name.toLowerCase() === "content-type" && (v2.form !== void 0 || v2.body !== void 0) && value !== (v2.form !== void 0 ? "application/x-www-form-urlencoded" : "application/json"))
|
|
28096
28096
|
ctx.addIssue({ code: "custom", message: "Content-Type conflicts with declared body encoding" });
|
|
28097
28097
|
}
|
|
28098
|
-
var import__, resourceKinds, resourceKindSchema, segmentSchema, appSlugSchema, actionNameSchema, generatedNameSchema, inputNameSchema, pointerSchema, categorySlugs, categorySchema, title, description, requiredDescription, originSchema, httpUrlSchema, requestUrlSchema, ajv, jsonSchema, valueSchema, htmlFieldSchema, htmlExtractionSchema, continuationSchema, mediaTypeSchema, fileResponseSchema, csvResponseSchema, responseSchema, multipartPartSchema, baseRequestSchema, readPreparationSchema, requestSchema, proofPointer, proofComparison, proofKey, proofSelection, proofSchema, appDefinitionSchema, entityDefinitionSchema, generatedSchema, executableActionSchema, unavailableActionSchema, actionDefinitionSchema, locatorSchema, observeSchema, injectSchema, credentialSchema, basicComponent, httpBasicSchema, probeSchema, transportDefinitionSchema, browserContextDefinitionSchema, definitionSchemas;
|
|
28098
|
+
var import__, resourceKinds, resourceKindSchema, segmentSchema, appSlugSchema, actionNameSchema, generatedNameSchema, inputNameSchema, pointerSchema, categorySlugs, categorySchema, title, description, requiredDescription, originSchema, httpUrlSchema, requestUrlSchema, ajv, jsonSchema, valueSchema, htmlFieldSchema, htmlExtractionSchema, continuationSchema, mediaTypeSchema, fileResponseSchema, csvScalarSchema, csvTransformSchema, csvColumnSchema, csvResponseSchema, preparedResultSchema, responseSchema, multipartPartSchema, baseRequestSchema, readPreparationSchema, requestSchema, proofPointer, proofComparison, proofKey, proofSelection, proofSchema, appDefinitionSchema, entityDefinitionSchema, generatedSchema, executableActionSchema, unavailableActionSchema, actionDefinitionSchema, locatorSchema, observeSchema, injectSchema, credentialSchema, basicComponent, httpBasicSchema, probeSchema, transportDefinitionSchema, browserContextDefinitionSchema, definitionSchemas;
|
|
28099
28099
|
var init_schema = __esm({
|
|
28100
28100
|
"../../packages/core/dist/definitions/schema.js"() {
|
|
28101
28101
|
"use strict";
|
|
@@ -28155,8 +28155,29 @@ var init_schema = __esm({
|
|
|
28155
28155
|
});
|
|
28156
28156
|
mediaTypeSchema = external_exports.string().max(100).regex(/^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/u);
|
|
28157
28157
|
fileResponseSchema = external_exports.strictObject({ name: external_exports.string().min(1).max(180).optional(), contentTypes: external_exports.array(mediaTypeSchema).min(1).max(8) });
|
|
28158
|
-
|
|
28159
|
-
|
|
28158
|
+
csvScalarSchema = external_exports.union([external_exports.string().max(65536), external_exports.number().finite(), external_exports.boolean(), external_exports.null()]);
|
|
28159
|
+
csvTransformSchema = external_exports.discriminatedUnion("type", [
|
|
28160
|
+
external_exports.strictObject({ type: external_exports.literal("strip-prefix"), prefix: external_exports.string().min(1).max(256) }),
|
|
28161
|
+
external_exports.strictObject({ type: external_exports.literal("join"), separator: external_exports.string().max(64), itemPath: pointerSchema.optional() }),
|
|
28162
|
+
external_exports.strictObject({ type: external_exports.literal("spreadsheet-text") }),
|
|
28163
|
+
external_exports.strictObject({ type: external_exports.literal("date-time"), timeZone: external_exports.string().min(1).max(100).refine((value) => {
|
|
28164
|
+
try {
|
|
28165
|
+
new Intl.DateTimeFormat("en-US", { timeZone: value });
|
|
28166
|
+
return true;
|
|
28167
|
+
} catch {
|
|
28168
|
+
return false;
|
|
28169
|
+
}
|
|
28170
|
+
}, "Use a supported time zone"), pattern: external_exports.string().min(1).max(100).regex(/^(?:yyyy|MM|dd|HH|mm|ss|[ /:.,T-])+$/u), unit: external_exports.enum(["iso", "seconds", "milliseconds"]) })
|
|
28171
|
+
]);
|
|
28172
|
+
csvColumnSchema = external_exports.strictObject({ name: external_exports.string().min(1).max(160), path: pointerSchema.optional(), paths: external_exports.array(pointerSchema).min(1).max(32).optional(), fallback: csvScalarSchema.optional(), transform: external_exports.array(csvTransformSchema).min(1).max(4).optional() }).superRefine((v2, ctx) => {
|
|
28173
|
+
if (v2.path !== void 0 === (v2.paths !== void 0))
|
|
28174
|
+
ctx.addIssue({ code: "custom", message: "CSV columns need exactly one path or paths source" });
|
|
28175
|
+
});
|
|
28176
|
+
csvResponseSchema = external_exports.strictObject({ name: external_exports.string().min(1).max(180), rows: pointerSchema, columns: external_exports.array(csvColumnSchema).min(1).max(256) });
|
|
28177
|
+
preparedResultSchema = external_exports.record(external_exports.string().min(1).max(128), pointerSchema).refine((v2) => Object.keys(v2).length > 0 && Object.keys(v2).length <= 8, "Retain one to eight application resource fields");
|
|
28178
|
+
responseSchema = external_exports.strictObject({ prepared: preparedResultSchema.optional(), format: external_exports.enum(["json", "html", "file", "csv"]).optional(), file: fileResponseSchema.optional(), csv: csvResponseSchema.optional(), html: htmlExtractionSchema.optional(), continue: external_exports.array(continuationSchema).min(1).max(5).optional(), schema: jsonSchema.optional(), path: pointerSchema.optional(), fields: external_exports.record(external_exports.string(), pointerSchema).optional(), generated: generatedNameSchema.optional() }).superRefine((v2, ctx) => {
|
|
28179
|
+
if (v2.prepared && (v2.format && v2.format !== "json" || v2.path !== void 0 || v2.fields || v2.generated || v2.continue))
|
|
28180
|
+
ctx.addIssue({ code: "custom", message: "Prepared results require JSON and exclude response extraction or continuation" });
|
|
28160
28181
|
if (v2.format === "file" !== !!v2.file || v2.format === "csv" !== !!v2.csv)
|
|
28161
28182
|
ctx.addIssue({ code: "custom", message: "File and CSV responses require their matching format and contract" });
|
|
28162
28183
|
if ((v2.file || v2.csv) && (v2.path !== void 0 || v2.fields || v2.generated || v2.continue))
|
|
@@ -28185,14 +28206,14 @@ var init_schema = __esm({
|
|
|
28185
28206
|
bodyIssues(v2, ctx);
|
|
28186
28207
|
if (v2.method !== "GET")
|
|
28187
28208
|
ctx.addIssue({ code: "custom", message: "Preparation and identity checks must use GET" });
|
|
28188
|
-
}), response: responseSchema });
|
|
28209
|
+
}), response: responseSchema.refine((v2) => !v2.prepared, "Prepared results are only valid on the primary upload response") });
|
|
28189
28210
|
requestSchema = baseRequestSchema.extend({ prepare: readPreparationSchema.extend({ private: external_exports.literal(true).optional() }).optional(), urlFrom: pointerSchema.optional() }).superRefine((v2, ctx) => {
|
|
28190
28211
|
bodyIssues(v2, ctx);
|
|
28191
28212
|
if (v2.prepare?.private && (v2.body !== void 0 || v2.form !== void 0))
|
|
28192
28213
|
ctx.addIssue({ code: "custom", message: "Private preparation binds multipart fields, query parameters, headers and urlFrom only" });
|
|
28193
28214
|
if (v2.urlFrom !== void 0 && !v2.prepare?.private)
|
|
28194
28215
|
ctx.addIssue({ code: "custom", message: "urlFrom requires prepare.private: true" });
|
|
28195
|
-
if (v2.prepare?.private && (v2.prepare.response.format && v2.prepare.response.format !== "json" || v2.prepare.response.schema !== void 0 || v2.prepare.response.continue || v2.prepare.response.generated))
|
|
28216
|
+
if (v2.prepare?.private && (v2.prepare.response.format && v2.prepare.response.format !== "json" || v2.prepare.response.schema !== void 0 || v2.prepare.response.continue || v2.prepare.response.generated || v2.prepare.response.prepared))
|
|
28196
28217
|
ctx.addIssue({ code: "custom", message: "Private file preparation selects JSON path/fields only; final bindings validate required scalar values before dispatch" });
|
|
28197
28218
|
});
|
|
28198
28219
|
proofPointer = external_exports.string().refine((value) => {
|
|
@@ -28210,7 +28231,7 @@ var init_schema = __esm({
|
|
|
28210
28231
|
if (!!v2.where === !!v2.key)
|
|
28211
28232
|
ctx.addIssue({ code: "custom", message: "Select by exactly one of where or key" });
|
|
28212
28233
|
});
|
|
28213
|
-
proofSchema = external_exports.strictObject({ forEach: external_exports.strictObject({ input: inputNameSchema, as: inputNameSchema }).optional(), request: requestSchema, effect: external_exports.literal("read").optional(), select: proofSelection.optional(), equals: external_exports.array(proofComparison).min(1).optional(), response: responseSchema.optional(), absent: external_exports.literal(true).optional() }).superRefine((v2, ctx) => {
|
|
28234
|
+
proofSchema = external_exports.strictObject({ forEach: external_exports.strictObject({ input: inputNameSchema, as: inputNameSchema }).optional(), request: requestSchema, effect: external_exports.literal("read").optional(), select: proofSelection.optional(), equals: external_exports.array(proofComparison).min(1).optional(), response: responseSchema.refine((v2) => !v2.prepared, "Prepared results are only valid on the primary upload response").optional(), absent: external_exports.literal(true).optional() }).superRefine((v2, ctx) => {
|
|
28214
28235
|
if (v2.forEach && (!v2.select || v2.absent || !v2.select.where?.some((c) => "input" in c && c.input === v2.forEach.as) && !(v2.select.key && "input" in v2.select.key && v2.select.key.input === v2.forEach.as)))
|
|
28215
28236
|
ctx.addIssue({ code: "custom", path: ["forEach"], message: "Bulk confirmation needs a positive selection bound to each member" });
|
|
28216
28237
|
if (!!v2.equals === !!v2.absent)
|
|
@@ -28242,6 +28263,8 @@ var init_schema = __esm({
|
|
|
28242
28263
|
entityDefinitionSchema = external_exports.strictObject({ title, description: requiredDescription });
|
|
28243
28264
|
generatedSchema = external_exports.record(generatedNameSchema, external_exports.strictObject({ kind: external_exports.literal("uuid"), prefix: external_exports.string().max(80).optional() }));
|
|
28244
28265
|
executableActionSchema = external_exports.strictObject({ title, description: requiredDescription, details: external_exports.string().min(1).max(2e4).optional(), effect: external_exports.enum(["read", "create", "update", "delete"]), transport: segmentSchema, inputs: jsonSchema.optional(), generated: generatedSchema.optional(), request: requestSchema, response: responseSchema.optional(), proof: proofSchema.optional() }).superRefine((v2, ctx) => {
|
|
28266
|
+
if (v2.response?.prepared && (v2.effect === "read" || !v2.request.prepare?.private || !v2.request.multipart))
|
|
28267
|
+
ctx.addIssue({ code: "custom", message: "Prepared results require a private multipart mutation with independent proof" });
|
|
28245
28268
|
if (v2.effect !== "read" && !v2.proof)
|
|
28246
28269
|
ctx.addIssue({ code: "custom", path: ["proof"], message: "Proof required for writes" });
|
|
28247
28270
|
if (v2.effect !== "delete" && v2.proof?.absent)
|
|
@@ -28262,7 +28285,7 @@ var init_schema = __esm({
|
|
|
28262
28285
|
credentialSchema = external_exports.strictObject({ name: generatedNameSchema, header: external_exports.string().regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), prefix: external_exports.string().max(80).refine((v2) => !/[\r\n]/.test(v2)).optional() });
|
|
28263
28286
|
basicComponent = external_exports.union([generatedNameSchema, external_exports.strictObject({ literal: external_exports.string().max(128).refine((v2) => ![...v2].some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127), "Control characters are not allowed") })]);
|
|
28264
28287
|
httpBasicSchema = external_exports.strictObject({ username: basicComponent.optional(), password: basicComponent.optional() }).refine((v2) => Object.values(v2).some((value) => typeof value === "string"), "Name at least one saved credential field; the omitted component is empty");
|
|
28265
|
-
probeSchema = external_exports.strictObject({ effect: external_exports.literal("read").optional(), request: requestSchema, response: responseSchema, inputs: jsonSchema.optional() });
|
|
28288
|
+
probeSchema = external_exports.strictObject({ effect: external_exports.literal("read").optional(), request: requestSchema, response: responseSchema.refine((v2) => !v2.prepared, "Prepared results are only valid on the primary upload response"), inputs: jsonSchema.optional() });
|
|
28266
28289
|
transportDefinitionSchema = external_exports.strictObject({ title, description: requiredDescription, mode: external_exports.enum(["direct", "browser"]), baseUrl: requestUrlSchema.optional(), allowedOrigins: external_exports.array(originSchema).min(1).max(100), browserContext: segmentSchema.optional(), credentials: external_exports.array(credentialSchema).max(16).optional(), httpBasic: httpBasicSchema.optional(), inject: external_exports.array(injectSchema).optional(), identity: readPreparationSchema.extend({ paths: external_exports.array(pointerSchema).min(1).max(8) }).optional(), probes: external_exports.record(external_exports.string(), probeSchema) }).superRefine((v2, ctx) => {
|
|
28267
28290
|
if (new Set(v2.allowedOrigins).size !== v2.allowedOrigins.length)
|
|
28268
28291
|
ctx.addIssue({ code: "custom", path: ["allowedOrigins"], message: "Origins must be distinct" });
|
|
@@ -164326,7 +164349,7 @@ function createCliApi(baseUrl, fetcher = fetch, token, sessionId, observe) {
|
|
|
164326
164349
|
const transport = async (input2, init) => {
|
|
164327
164350
|
const method = init?.method ?? "GET";
|
|
164328
164351
|
const headers = new Headers(init?.headers);
|
|
164329
|
-
headers.set("Apilift-Capabilities", "distributed-rollouts-v1,discovery-proof-v2,dynamic-bindings-v1,collection-proof-v3,web-responses-v1,bounded-catalog-v1,http-basic-v1,api-contracts-v1,string-bindings-v1,file-transfers-v1");
|
|
164352
|
+
headers.set("Apilift-Capabilities", "distributed-rollouts-v1,discovery-proof-v2,dynamic-bindings-v1,collection-proof-v3,web-responses-v1,bounded-catalog-v1,http-basic-v1,api-contracts-v1,string-bindings-v1,file-transfers-v1,file-workflows-v2");
|
|
164330
164353
|
headers.set("Apilift-Client", `cli/${cliVersion}`);
|
|
164331
164354
|
if (token) headers.set("Authorization", `Bearer ${token}`);
|
|
164332
164355
|
if (sessionId) headers.set("Apilift-Session", sessionId);
|
|
@@ -29090,8 +29090,29 @@ var continuationSchema = external_exports.strictObject({ statuses: external_expo
|
|
|
29090
29090
|
});
|
|
29091
29091
|
var mediaTypeSchema = external_exports.string().max(100).regex(/^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/u);
|
|
29092
29092
|
var fileResponseSchema = external_exports.strictObject({ name: external_exports.string().min(1).max(180).optional(), contentTypes: external_exports.array(mediaTypeSchema).min(1).max(8) });
|
|
29093
|
-
var
|
|
29094
|
-
var
|
|
29093
|
+
var csvScalarSchema = external_exports.union([external_exports.string().max(65536), external_exports.number().finite(), external_exports.boolean(), external_exports.null()]);
|
|
29094
|
+
var csvTransformSchema = external_exports.discriminatedUnion("type", [
|
|
29095
|
+
external_exports.strictObject({ type: external_exports.literal("strip-prefix"), prefix: external_exports.string().min(1).max(256) }),
|
|
29096
|
+
external_exports.strictObject({ type: external_exports.literal("join"), separator: external_exports.string().max(64), itemPath: pointerSchema.optional() }),
|
|
29097
|
+
external_exports.strictObject({ type: external_exports.literal("spreadsheet-text") }),
|
|
29098
|
+
external_exports.strictObject({ type: external_exports.literal("date-time"), timeZone: external_exports.string().min(1).max(100).refine((value) => {
|
|
29099
|
+
try {
|
|
29100
|
+
new Intl.DateTimeFormat("en-US", { timeZone: value });
|
|
29101
|
+
return true;
|
|
29102
|
+
} catch {
|
|
29103
|
+
return false;
|
|
29104
|
+
}
|
|
29105
|
+
}, "Use a supported time zone"), pattern: external_exports.string().min(1).max(100).regex(/^(?:yyyy|MM|dd|HH|mm|ss|[ /:.,T-])+$/u), unit: external_exports.enum(["iso", "seconds", "milliseconds"]) })
|
|
29106
|
+
]);
|
|
29107
|
+
var csvColumnSchema = external_exports.strictObject({ name: external_exports.string().min(1).max(160), path: pointerSchema.optional(), paths: external_exports.array(pointerSchema).min(1).max(32).optional(), fallback: csvScalarSchema.optional(), transform: external_exports.array(csvTransformSchema).min(1).max(4).optional() }).superRefine((v, ctx) => {
|
|
29108
|
+
if (v.path !== void 0 === (v.paths !== void 0))
|
|
29109
|
+
ctx.addIssue({ code: "custom", message: "CSV columns need exactly one path or paths source" });
|
|
29110
|
+
});
|
|
29111
|
+
var csvResponseSchema = external_exports.strictObject({ name: external_exports.string().min(1).max(180), rows: pointerSchema, columns: external_exports.array(csvColumnSchema).min(1).max(256) });
|
|
29112
|
+
var preparedResultSchema = external_exports.record(external_exports.string().min(1).max(128), pointerSchema).refine((v) => Object.keys(v).length > 0 && Object.keys(v).length <= 8, "Retain one to eight application resource fields");
|
|
29113
|
+
var responseSchema = external_exports.strictObject({ prepared: preparedResultSchema.optional(), format: external_exports.enum(["json", "html", "file", "csv"]).optional(), file: fileResponseSchema.optional(), csv: csvResponseSchema.optional(), html: htmlExtractionSchema.optional(), continue: external_exports.array(continuationSchema).min(1).max(5).optional(), schema: jsonSchema.optional(), path: pointerSchema.optional(), fields: external_exports.record(external_exports.string(), pointerSchema).optional(), generated: generatedNameSchema.optional() }).superRefine((v, ctx) => {
|
|
29114
|
+
if (v.prepared && (v.format && v.format !== "json" || v.path !== void 0 || v.fields || v.generated || v.continue))
|
|
29115
|
+
ctx.addIssue({ code: "custom", message: "Prepared results require JSON and exclude response extraction or continuation" });
|
|
29095
29116
|
if (v.format === "file" !== !!v.file || v.format === "csv" !== !!v.csv)
|
|
29096
29117
|
ctx.addIssue({ code: "custom", message: "File and CSV responses require their matching format and contract" });
|
|
29097
29118
|
if ((v.file || v.csv) && (v.path !== void 0 || v.fields || v.generated || v.continue))
|
|
@@ -29134,14 +29155,14 @@ var readPreparationSchema = external_exports.strictObject({ request: baseRequest
|
|
|
29134
29155
|
bodyIssues(v, ctx);
|
|
29135
29156
|
if (v.method !== "GET")
|
|
29136
29157
|
ctx.addIssue({ code: "custom", message: "Preparation and identity checks must use GET" });
|
|
29137
|
-
}), response: responseSchema });
|
|
29158
|
+
}), response: responseSchema.refine((v) => !v.prepared, "Prepared results are only valid on the primary upload response") });
|
|
29138
29159
|
var requestSchema = baseRequestSchema.extend({ prepare: readPreparationSchema.extend({ private: external_exports.literal(true).optional() }).optional(), urlFrom: pointerSchema.optional() }).superRefine((v, ctx) => {
|
|
29139
29160
|
bodyIssues(v, ctx);
|
|
29140
29161
|
if (v.prepare?.private && (v.body !== void 0 || v.form !== void 0))
|
|
29141
29162
|
ctx.addIssue({ code: "custom", message: "Private preparation binds multipart fields, query parameters, headers and urlFrom only" });
|
|
29142
29163
|
if (v.urlFrom !== void 0 && !v.prepare?.private)
|
|
29143
29164
|
ctx.addIssue({ code: "custom", message: "urlFrom requires prepare.private: true" });
|
|
29144
|
-
if (v.prepare?.private && (v.prepare.response.format && v.prepare.response.format !== "json" || v.prepare.response.schema !== void 0 || v.prepare.response.continue || v.prepare.response.generated))
|
|
29165
|
+
if (v.prepare?.private && (v.prepare.response.format && v.prepare.response.format !== "json" || v.prepare.response.schema !== void 0 || v.prepare.response.continue || v.prepare.response.generated || v.prepare.response.prepared))
|
|
29145
29166
|
ctx.addIssue({ code: "custom", message: "Private file preparation selects JSON path/fields only; final bindings validate required scalar values before dispatch" });
|
|
29146
29167
|
});
|
|
29147
29168
|
var proofPointer = external_exports.string().refine((value) => {
|
|
@@ -29159,7 +29180,7 @@ var proofSelection = external_exports.strictObject({ path: proofPointer, where:
|
|
|
29159
29180
|
if (!!v.where === !!v.key)
|
|
29160
29181
|
ctx.addIssue({ code: "custom", message: "Select by exactly one of where or key" });
|
|
29161
29182
|
});
|
|
29162
|
-
var proofSchema = external_exports.strictObject({ forEach: external_exports.strictObject({ input: inputNameSchema, as: inputNameSchema }).optional(), request: requestSchema, effect: external_exports.literal("read").optional(), select: proofSelection.optional(), equals: external_exports.array(proofComparison).min(1).optional(), response: responseSchema.optional(), absent: external_exports.literal(true).optional() }).superRefine((v, ctx) => {
|
|
29183
|
+
var proofSchema = external_exports.strictObject({ forEach: external_exports.strictObject({ input: inputNameSchema, as: inputNameSchema }).optional(), request: requestSchema, effect: external_exports.literal("read").optional(), select: proofSelection.optional(), equals: external_exports.array(proofComparison).min(1).optional(), response: responseSchema.refine((v) => !v.prepared, "Prepared results are only valid on the primary upload response").optional(), absent: external_exports.literal(true).optional() }).superRefine((v, ctx) => {
|
|
29163
29184
|
if (v.forEach && (!v.select || v.absent || !v.select.where?.some((c) => "input" in c && c.input === v.forEach.as) && !(v.select.key && "input" in v.select.key && v.select.key.input === v.forEach.as)))
|
|
29164
29185
|
ctx.addIssue({ code: "custom", path: ["forEach"], message: "Bulk confirmation needs a positive selection bound to each member" });
|
|
29165
29186
|
if (!!v.equals === !!v.absent)
|
|
@@ -29191,6 +29212,8 @@ var appDefinitionSchema = external_exports.strictObject({ title, description: de
|
|
|
29191
29212
|
var entityDefinitionSchema = external_exports.strictObject({ title, description: requiredDescription });
|
|
29192
29213
|
var generatedSchema = external_exports.record(generatedNameSchema, external_exports.strictObject({ kind: external_exports.literal("uuid"), prefix: external_exports.string().max(80).optional() }));
|
|
29193
29214
|
var executableActionSchema = external_exports.strictObject({ title, description: requiredDescription, details: external_exports.string().min(1).max(2e4).optional(), effect: external_exports.enum(["read", "create", "update", "delete"]), transport: segmentSchema, inputs: jsonSchema.optional(), generated: generatedSchema.optional(), request: requestSchema, response: responseSchema.optional(), proof: proofSchema.optional() }).superRefine((v, ctx) => {
|
|
29215
|
+
if (v.response?.prepared && (v.effect === "read" || !v.request.prepare?.private || !v.request.multipart))
|
|
29216
|
+
ctx.addIssue({ code: "custom", message: "Prepared results require a private multipart mutation with independent proof" });
|
|
29194
29217
|
if (v.effect !== "read" && !v.proof)
|
|
29195
29218
|
ctx.addIssue({ code: "custom", path: ["proof"], message: "Proof required for writes" });
|
|
29196
29219
|
if (v.effect !== "delete" && v.proof?.absent)
|
|
@@ -29211,7 +29234,7 @@ var injectSchema = external_exports.strictObject({ from: external_exports.union(
|
|
|
29211
29234
|
var credentialSchema = external_exports.strictObject({ name: generatedNameSchema, header: external_exports.string().regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), prefix: external_exports.string().max(80).refine((v) => !/[\r\n]/.test(v)).optional() });
|
|
29212
29235
|
var basicComponent = external_exports.union([generatedNameSchema, external_exports.strictObject({ literal: external_exports.string().max(128).refine((v) => ![...v].some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127), "Control characters are not allowed") })]);
|
|
29213
29236
|
var httpBasicSchema = external_exports.strictObject({ username: basicComponent.optional(), password: basicComponent.optional() }).refine((v) => Object.values(v).some((value) => typeof value === "string"), "Name at least one saved credential field; the omitted component is empty");
|
|
29214
|
-
var probeSchema = external_exports.strictObject({ effect: external_exports.literal("read").optional(), request: requestSchema, response: responseSchema, inputs: jsonSchema.optional() });
|
|
29237
|
+
var probeSchema = external_exports.strictObject({ effect: external_exports.literal("read").optional(), request: requestSchema, response: responseSchema.refine((v) => !v.prepared, "Prepared results are only valid on the primary upload response"), inputs: jsonSchema.optional() });
|
|
29215
29238
|
var transportDefinitionSchema = external_exports.strictObject({ title, description: requiredDescription, mode: external_exports.enum(["direct", "browser"]), baseUrl: requestUrlSchema.optional(), allowedOrigins: external_exports.array(originSchema).min(1).max(100), browserContext: segmentSchema.optional(), credentials: external_exports.array(credentialSchema).max(16).optional(), httpBasic: httpBasicSchema.optional(), inject: external_exports.array(injectSchema).optional(), identity: readPreparationSchema.extend({ paths: external_exports.array(pointerSchema).min(1).max(8) }).optional(), probes: external_exports.record(external_exports.string(), probeSchema) }).superRefine((v, ctx) => {
|
|
29216
29239
|
if (new Set(v.allowedOrigins).size !== v.allowedOrigins.length)
|
|
29217
29240
|
ctx.addIssue({ code: "custom", path: ["allowedOrigins"], message: "Origins must be distinct" });
|
|
@@ -29878,7 +29901,7 @@ var inputChunk = external_exports.strictObject({ offset: external_exports.number
|
|
|
29878
29901
|
var preparedBinding = external_exports.strictObject({ $prepared: external_exports.string().max(2e3) });
|
|
29879
29902
|
var filePart = external_exports.strictObject({ sha256: hash3, bytes: external_exports.number().int().min(0).max(16 * 1024 * 1024), name: external_exports.string().min(1).max(180), contentType: external_exports.string().min(1).max(100) });
|
|
29880
29903
|
var multipart = external_exports.array(external_exports.union([external_exports.strictObject({ name: text, value: external_exports.union([external_exports.string().max(65536), external_exports.number(), external_exports.boolean(), preparedBinding]) }), external_exports.strictObject({ name: text, file: filePart })])).min(1).max(64);
|
|
29881
|
-
var filePreparation = external_exports.strictObject({ url: url2, headers: external_exports.record(external_exports.string(), external_exports.string()), response: external_exports.strictObject({ path: external_exports.string().optional(), fields: external_exports.record(external_exports.string(), external_exports.string()).optional() }), urlFrom: external_exports.string().optional(), query: external_exports.record(external_exports.string(), preparedBinding).optional(), headerBindings: external_exports.record(external_exports.string(), preparedBinding).optional() });
|
|
29904
|
+
var filePreparation = external_exports.strictObject({ resultPaths: external_exports.array(external_exports.string().max(512)).min(1).max(8).optional(), url: url2, headers: external_exports.record(external_exports.string(), external_exports.string()), response: external_exports.strictObject({ path: external_exports.string().optional(), fields: external_exports.record(external_exports.string(), external_exports.string()).optional() }), urlFrom: external_exports.string().optional(), query: external_exports.record(external_exports.string(), preparedBinding).optional(), headerBindings: external_exports.record(external_exports.string(), preparedBinding).optional() });
|
|
29882
29905
|
var captureEntry = external_exports.strictObject({
|
|
29883
29906
|
captureId: id,
|
|
29884
29907
|
transactionId: id,
|
|
@@ -30062,7 +30085,7 @@ function createCliApi(baseUrl, fetcher = fetch, token, sessionId, observe) {
|
|
|
30062
30085
|
const transport = async (input2, init) => {
|
|
30063
30086
|
const method = init?.method ?? "GET";
|
|
30064
30087
|
const headers = new Headers(init?.headers);
|
|
30065
|
-
headers.set("Apilift-Capabilities", "distributed-rollouts-v1,discovery-proof-v2,dynamic-bindings-v1,collection-proof-v3,web-responses-v1,bounded-catalog-v1,http-basic-v1,api-contracts-v1,string-bindings-v1,file-transfers-v1");
|
|
30088
|
+
headers.set("Apilift-Capabilities", "distributed-rollouts-v1,discovery-proof-v2,dynamic-bindings-v1,collection-proof-v3,web-responses-v1,bounded-catalog-v1,http-basic-v1,api-contracts-v1,string-bindings-v1,file-transfers-v1,file-workflows-v2");
|
|
30066
30089
|
headers.set("Apilift-Client", `cli/${cliVersion}`);
|
|
30067
30090
|
if (token) headers.set("Authorization", `Bearer ${token}`);
|
|
30068
30091
|
if (sessionId) headers.set("Apilift-Session", sessionId);
|
|
@@ -32012,7 +32035,7 @@ var NativeHost = class {
|
|
|
32012
32035
|
} catch {
|
|
32013
32036
|
}
|
|
32014
32037
|
if (restartVersion === this.options.version) rmSync2(restartPath, { force: true });
|
|
32015
|
-
return { hostVersion: this.options.version, hostBuildFingerprint: this.options.buildFingerprint, minimumHostVersion: minimumFor(compatibilityTable, "extension", "cli") ?? this.options.version, minimumExtensionVersion: registry2.minimumExtensionVersion, availableExtensionVersion: registry2.availableExtensionVersion, capabilities: ["demand-v1", "file-transfers-v1"], hostRestartRequired: Boolean(restartVersion && restartVersion !== this.options.version), ...registry2.identity ? { identity: registry2.identity } : {} };
|
|
32038
|
+
return { hostVersion: this.options.version, hostBuildFingerprint: this.options.buildFingerprint, minimumHostVersion: minimumFor(compatibilityTable, "extension", "cli") ?? this.options.version, minimumExtensionVersion: registry2.minimumExtensionVersion, availableExtensionVersion: registry2.availableExtensionVersion, capabilities: ["demand-v1", "file-transfers-v1", "file-workflows-v2"], hostRestartRequired: Boolean(restartVersion && restartVersion !== this.options.version), ...registry2.identity ? { identity: registry2.identity } : {} };
|
|
32016
32039
|
}
|
|
32017
32040
|
if (!this.helloDone) throw Object.assign(new Error("Native host handshake is required"), { code: "handshake-required" });
|
|
32018
32041
|
if (request2.operation === "scopes") {
|
|
@@ -32022,7 +32045,7 @@ var NativeHost = class {
|
|
|
32022
32045
|
client2 = await this.capture();
|
|
32023
32046
|
scopes = await client2.scopes();
|
|
32024
32047
|
if (this.stopped) return;
|
|
32025
|
-
if (!client2.legacyBridge) await client2.bridgeReady?.(this.options.version, [...this.extensionCapabilities, "host:file-transfers-v1"]);
|
|
32048
|
+
if (!client2.legacyBridge) await client2.bridgeReady?.(this.options.version, [...this.extensionCapabilities, "host:file-transfers-v1", "host:file-workflows-v2"]);
|
|
32026
32049
|
} catch (error62) {
|
|
32027
32050
|
if (this.options.captureClient || !captureServerIdle(this.options.root)) throw error62;
|
|
32028
32051
|
void this.client?.then((client3) => client3.close()).catch(() => {
|
package/dist/apilift.js
CHANGED
|
@@ -20493,7 +20493,7 @@ var init_native = __esm({
|
|
|
20493
20493
|
preparedBinding = external_exports.strictObject({ $prepared: external_exports.string().max(2e3) });
|
|
20494
20494
|
filePart = external_exports.strictObject({ sha256: hash2, bytes: external_exports.number().int().min(0).max(16 * 1024 * 1024), name: external_exports.string().min(1).max(180), contentType: external_exports.string().min(1).max(100) });
|
|
20495
20495
|
multipart = external_exports.array(external_exports.union([external_exports.strictObject({ name: text, value: external_exports.union([external_exports.string().max(65536), external_exports.number(), external_exports.boolean(), preparedBinding]) }), external_exports.strictObject({ name: text, file: filePart })])).min(1).max(64);
|
|
20496
|
-
filePreparation = external_exports.strictObject({ url: url2, headers: external_exports.record(external_exports.string(), external_exports.string()), response: external_exports.strictObject({ path: external_exports.string().optional(), fields: external_exports.record(external_exports.string(), external_exports.string()).optional() }), urlFrom: external_exports.string().optional(), query: external_exports.record(external_exports.string(), preparedBinding).optional(), headerBindings: external_exports.record(external_exports.string(), preparedBinding).optional() });
|
|
20496
|
+
filePreparation = external_exports.strictObject({ resultPaths: external_exports.array(external_exports.string().max(512)).min(1).max(8).optional(), url: url2, headers: external_exports.record(external_exports.string(), external_exports.string()), response: external_exports.strictObject({ path: external_exports.string().optional(), fields: external_exports.record(external_exports.string(), external_exports.string()).optional() }), urlFrom: external_exports.string().optional(), query: external_exports.record(external_exports.string(), preparedBinding).optional(), headerBindings: external_exports.record(external_exports.string(), preparedBinding).optional() });
|
|
20497
20497
|
captureEntry = external_exports.strictObject({
|
|
20498
20498
|
captureId: id,
|
|
20499
20499
|
transactionId: id,
|
|
@@ -20659,6 +20659,52 @@ var init_extension = __esm({
|
|
|
20659
20659
|
}
|
|
20660
20660
|
});
|
|
20661
20661
|
|
|
20662
|
+
// ../../packages/protocol/dist/multipart.js
|
|
20663
|
+
function parseMultipart(body, contentType) {
|
|
20664
|
+
const boundary = /(?:^|;)\s*boundary=(?:"([^"\r\n]+)"|([^;\s]+))/iu.exec(contentType)?.slice(1).find(Boolean);
|
|
20665
|
+
if (!boundary || boundary.length > 200 || /[\r\n]/u.test(boundary))
|
|
20666
|
+
throw new Error("Multipart boundary is unavailable");
|
|
20667
|
+
const marker = "--" + boundary, parts2 = [];
|
|
20668
|
+
if (!body.startsWith(marker + "\r\n"))
|
|
20669
|
+
throw new Error("Multipart body is incomplete");
|
|
20670
|
+
let at4 = marker.length + 2;
|
|
20671
|
+
for (; ; ) {
|
|
20672
|
+
const end2 = body.indexOf("\r\n\r\n", at4);
|
|
20673
|
+
if (end2 < 0 || end2 - at4 > 8192)
|
|
20674
|
+
throw new Error("Multipart headers are incomplete");
|
|
20675
|
+
const headers = body.slice(at4, end2).split("\r\n");
|
|
20676
|
+
if (headers.some((header) => !/^content-(?:disposition|type|transfer-encoding):/iu.test(header)) || headers.some((header) => /^content-transfer-encoding:/iu.test(header)))
|
|
20677
|
+
throw new Error("Multipart headers are unsupported");
|
|
20678
|
+
const dispositions = headers.filter((header) => /^content-disposition:/iu.test(header));
|
|
20679
|
+
if (dispositions.length !== 1 || !/^content-disposition:\s*form-data(?:;|$)/iu.test(dispositions[0]))
|
|
20680
|
+
throw new Error("Multipart disposition is unavailable");
|
|
20681
|
+
const disposition = dispositions[0], name = /(?:^|;)\s*name="((?:[^"\\\r\n]|\\["\\])*)"/iu.exec(disposition)?.[1]?.replace(/\\(["\\])/gu, "$1");
|
|
20682
|
+
if (!name || name.length > 128)
|
|
20683
|
+
throw new Error("Multipart name is unavailable");
|
|
20684
|
+
const file2 = /(?:^|;)\s*filename(?:\*)?=/iu.test(disposition);
|
|
20685
|
+
const next2 = body.indexOf("\r\n" + marker, end2 + 4);
|
|
20686
|
+
if (next2 < 0)
|
|
20687
|
+
throw new Error("Multipart body is incomplete");
|
|
20688
|
+
const value = body.slice(end2 + 4, next2);
|
|
20689
|
+
if (!file2 && new TextEncoder().encode(value).length > 65536)
|
|
20690
|
+
throw new Error("Multipart scalar exceeds 65536 bytes");
|
|
20691
|
+
parts2.push({ name, value: file2 ? "" : value, file: file2 });
|
|
20692
|
+
if (parts2.length > 64)
|
|
20693
|
+
throw new Error("Multipart body exceeds 64 parts");
|
|
20694
|
+
at4 = next2 + 2 + marker.length;
|
|
20695
|
+
if (body.slice(at4) === "--" || body.slice(at4) === "--\r\n")
|
|
20696
|
+
return { boundary, parts: parts2 };
|
|
20697
|
+
if (body.slice(at4, at4 + 2) !== "\r\n")
|
|
20698
|
+
throw new Error("Multipart body is incomplete");
|
|
20699
|
+
at4 += 2;
|
|
20700
|
+
}
|
|
20701
|
+
}
|
|
20702
|
+
var init_multipart = __esm({
|
|
20703
|
+
"../../packages/protocol/dist/multipart.js"() {
|
|
20704
|
+
"use strict";
|
|
20705
|
+
}
|
|
20706
|
+
});
|
|
20707
|
+
|
|
20662
20708
|
// ../../packages/protocol/dist/index.js
|
|
20663
20709
|
var init_dist = __esm({
|
|
20664
20710
|
"../../packages/protocol/dist/index.js"() {
|
|
@@ -20666,6 +20712,7 @@ var init_dist = __esm({
|
|
|
20666
20712
|
init_native();
|
|
20667
20713
|
init_dashboard();
|
|
20668
20714
|
init_extension();
|
|
20715
|
+
init_multipart();
|
|
20669
20716
|
}
|
|
20670
20717
|
});
|
|
20671
20718
|
|
|
@@ -22693,12 +22740,12 @@ var require_code2 = __commonJS({
|
|
|
22693
22740
|
});
|
|
22694
22741
|
}
|
|
22695
22742
|
exports.checkReportMissingProp = checkReportMissingProp;
|
|
22696
|
-
function checkMissingProp({ gen, data: data3, it: { opts } }, properties,
|
|
22697
|
-
return (0, codegen_1.or)(...properties.map((prop2) => (0, codegen_1.and)(noPropertyInData(gen, data3, prop2, opts.ownProperties), (0, codegen_1._)`${
|
|
22743
|
+
function checkMissingProp({ gen, data: data3, it: { opts } }, properties, missing2) {
|
|
22744
|
+
return (0, codegen_1.or)(...properties.map((prop2) => (0, codegen_1.and)(noPropertyInData(gen, data3, prop2, opts.ownProperties), (0, codegen_1._)`${missing2} = ${prop2}`)));
|
|
22698
22745
|
}
|
|
22699
22746
|
exports.checkMissingProp = checkMissingProp;
|
|
22700
|
-
function reportMissingProp(cxt,
|
|
22701
|
-
cxt.setParams({ missingProperty:
|
|
22747
|
+
function reportMissingProp(cxt, missing2) {
|
|
22748
|
+
cxt.setParams({ missingProperty: missing2 }, true);
|
|
22702
22749
|
cxt.error();
|
|
22703
22750
|
}
|
|
22704
22751
|
exports.reportMissingProp = reportMissingProp;
|
|
@@ -25920,14 +25967,14 @@ var require_required = __commonJS({
|
|
|
25920
25967
|
}
|
|
25921
25968
|
}
|
|
25922
25969
|
function exitOnErrorMode() {
|
|
25923
|
-
const
|
|
25970
|
+
const missing2 = gen.let("missing");
|
|
25924
25971
|
if (useLoop || $data) {
|
|
25925
25972
|
const valid2 = gen.let("valid", true);
|
|
25926
|
-
cxt.block$data(valid2, () => loopUntilMissing(
|
|
25973
|
+
cxt.block$data(valid2, () => loopUntilMissing(missing2, valid2));
|
|
25927
25974
|
cxt.ok(valid2);
|
|
25928
25975
|
} else {
|
|
25929
|
-
gen.if((0, code_1.checkMissingProp)(cxt, schema,
|
|
25930
|
-
(0, code_1.reportMissingProp)(cxt,
|
|
25976
|
+
gen.if((0, code_1.checkMissingProp)(cxt, schema, missing2));
|
|
25977
|
+
(0, code_1.reportMissingProp)(cxt, missing2);
|
|
25931
25978
|
gen.else();
|
|
25932
25979
|
}
|
|
25933
25980
|
}
|
|
@@ -25937,10 +25984,10 @@ var require_required = __commonJS({
|
|
|
25937
25984
|
gen.if((0, code_1.noPropertyInData)(gen, data3, prop2, opts.ownProperties), () => cxt.error());
|
|
25938
25985
|
});
|
|
25939
25986
|
}
|
|
25940
|
-
function loopUntilMissing(
|
|
25941
|
-
cxt.setParams({ missingProperty:
|
|
25942
|
-
gen.forOf(
|
|
25943
|
-
gen.assign(valid2, (0, code_1.propertyInData)(gen, data3,
|
|
25987
|
+
function loopUntilMissing(missing2, valid2) {
|
|
25988
|
+
cxt.setParams({ missingProperty: missing2 });
|
|
25989
|
+
gen.forOf(missing2, schemaCode, () => {
|
|
25990
|
+
gen.assign(valid2, (0, code_1.propertyInData)(gen, data3, missing2, opts.ownProperties));
|
|
25944
25991
|
gen.if((0, codegen_1.not)(valid2), () => {
|
|
25945
25992
|
cxt.error();
|
|
25946
25993
|
gen.break();
|
|
@@ -26478,7 +26525,7 @@ var require_dependencies = __commonJS({
|
|
|
26478
26525
|
const { gen, data: data3, it } = cxt;
|
|
26479
26526
|
if (Object.keys(propertyDeps).length === 0)
|
|
26480
26527
|
return;
|
|
26481
|
-
const
|
|
26528
|
+
const missing2 = gen.let("missing");
|
|
26482
26529
|
for (const prop2 in propertyDeps) {
|
|
26483
26530
|
const deps = propertyDeps[prop2];
|
|
26484
26531
|
if (deps.length === 0)
|
|
@@ -26496,8 +26543,8 @@ var require_dependencies = __commonJS({
|
|
|
26496
26543
|
}
|
|
26497
26544
|
});
|
|
26498
26545
|
} else {
|
|
26499
|
-
gen.if((0, codegen_1._)`${hasProperty} && (${(0, code_1.checkMissingProp)(cxt, deps,
|
|
26500
|
-
(0, code_1.reportMissingProp)(cxt,
|
|
26546
|
+
gen.if((0, codegen_1._)`${hasProperty} && (${(0, code_1.checkMissingProp)(cxt, deps, missing2)})`);
|
|
26547
|
+
(0, code_1.reportMissingProp)(cxt, missing2);
|
|
26501
26548
|
gen.else();
|
|
26502
26549
|
}
|
|
26503
26550
|
}
|
|
@@ -28167,7 +28214,7 @@ function bodyIssues(v, ctx) {
|
|
|
28167
28214
|
if (name.toLowerCase() === "content-type" && (v.form !== void 0 || v.body !== void 0) && value !== (v.form !== void 0 ? "application/x-www-form-urlencoded" : "application/json"))
|
|
28168
28215
|
ctx.addIssue({ code: "custom", message: "Content-Type conflicts with declared body encoding" });
|
|
28169
28216
|
}
|
|
28170
|
-
var import__, resourceKinds, resourceKindSchema, segmentSchema, appSlugSchema, actionNameSchema, generatedNameSchema, inputNameSchema, pointerSchema, categorySlugs, categorySchema, title, description, requiredDescription, originSchema, httpUrlSchema, requestUrlSchema, ajv, jsonSchema, valueSchema, htmlFieldSchema, htmlExtractionSchema, continuationSchema, mediaTypeSchema, fileResponseSchema, csvResponseSchema, responseSchema, multipartPartSchema, baseRequestSchema, readPreparationSchema, requestSchema, proofPointer, proofComparison, proofKey, proofSelection, proofSchema, appDefinitionSchema, entityDefinitionSchema, generatedSchema, executableActionSchema, unavailableActionSchema, actionDefinitionSchema, locatorSchema, observeSchema, injectSchema, credentialSchema, basicComponent, httpBasicSchema, probeSchema, transportDefinitionSchema, browserContextDefinitionSchema, definitionSchemas;
|
|
28217
|
+
var import__, resourceKinds, resourceKindSchema, segmentSchema, appSlugSchema, actionNameSchema, generatedNameSchema, inputNameSchema, pointerSchema, categorySlugs, categorySchema, title, description, requiredDescription, originSchema, httpUrlSchema, requestUrlSchema, ajv, jsonSchema, valueSchema, htmlFieldSchema, htmlExtractionSchema, continuationSchema, mediaTypeSchema, fileResponseSchema, csvScalarSchema, csvTransformSchema, csvColumnSchema, csvResponseSchema, preparedResultSchema, responseSchema, multipartPartSchema, baseRequestSchema, readPreparationSchema, requestSchema, proofPointer, proofComparison, proofKey, proofSelection, proofSchema, appDefinitionSchema, entityDefinitionSchema, generatedSchema, executableActionSchema, unavailableActionSchema, actionDefinitionSchema, locatorSchema, observeSchema, injectSchema, credentialSchema, basicComponent, httpBasicSchema, probeSchema, transportDefinitionSchema, browserContextDefinitionSchema, definitionSchemas;
|
|
28171
28218
|
var init_schema = __esm({
|
|
28172
28219
|
"../../packages/core/dist/definitions/schema.js"() {
|
|
28173
28220
|
"use strict";
|
|
@@ -28227,8 +28274,29 @@ var init_schema = __esm({
|
|
|
28227
28274
|
});
|
|
28228
28275
|
mediaTypeSchema = external_exports.string().max(100).regex(/^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/u);
|
|
28229
28276
|
fileResponseSchema = external_exports.strictObject({ name: external_exports.string().min(1).max(180).optional(), contentTypes: external_exports.array(mediaTypeSchema).min(1).max(8) });
|
|
28230
|
-
|
|
28231
|
-
|
|
28277
|
+
csvScalarSchema = external_exports.union([external_exports.string().max(65536), external_exports.number().finite(), external_exports.boolean(), external_exports.null()]);
|
|
28278
|
+
csvTransformSchema = external_exports.discriminatedUnion("type", [
|
|
28279
|
+
external_exports.strictObject({ type: external_exports.literal("strip-prefix"), prefix: external_exports.string().min(1).max(256) }),
|
|
28280
|
+
external_exports.strictObject({ type: external_exports.literal("join"), separator: external_exports.string().max(64), itemPath: pointerSchema.optional() }),
|
|
28281
|
+
external_exports.strictObject({ type: external_exports.literal("spreadsheet-text") }),
|
|
28282
|
+
external_exports.strictObject({ type: external_exports.literal("date-time"), timeZone: external_exports.string().min(1).max(100).refine((value) => {
|
|
28283
|
+
try {
|
|
28284
|
+
new Intl.DateTimeFormat("en-US", { timeZone: value });
|
|
28285
|
+
return true;
|
|
28286
|
+
} catch {
|
|
28287
|
+
return false;
|
|
28288
|
+
}
|
|
28289
|
+
}, "Use a supported time zone"), pattern: external_exports.string().min(1).max(100).regex(/^(?:yyyy|MM|dd|HH|mm|ss|[ /:.,T-])+$/u), unit: external_exports.enum(["iso", "seconds", "milliseconds"]) })
|
|
28290
|
+
]);
|
|
28291
|
+
csvColumnSchema = external_exports.strictObject({ name: external_exports.string().min(1).max(160), path: pointerSchema.optional(), paths: external_exports.array(pointerSchema).min(1).max(32).optional(), fallback: csvScalarSchema.optional(), transform: external_exports.array(csvTransformSchema).min(1).max(4).optional() }).superRefine((v, ctx) => {
|
|
28292
|
+
if (v.path !== void 0 === (v.paths !== void 0))
|
|
28293
|
+
ctx.addIssue({ code: "custom", message: "CSV columns need exactly one path or paths source" });
|
|
28294
|
+
});
|
|
28295
|
+
csvResponseSchema = external_exports.strictObject({ name: external_exports.string().min(1).max(180), rows: pointerSchema, columns: external_exports.array(csvColumnSchema).min(1).max(256) });
|
|
28296
|
+
preparedResultSchema = external_exports.record(external_exports.string().min(1).max(128), pointerSchema).refine((v) => Object.keys(v).length > 0 && Object.keys(v).length <= 8, "Retain one to eight application resource fields");
|
|
28297
|
+
responseSchema = external_exports.strictObject({ prepared: preparedResultSchema.optional(), format: external_exports.enum(["json", "html", "file", "csv"]).optional(), file: fileResponseSchema.optional(), csv: csvResponseSchema.optional(), html: htmlExtractionSchema.optional(), continue: external_exports.array(continuationSchema).min(1).max(5).optional(), schema: jsonSchema.optional(), path: pointerSchema.optional(), fields: external_exports.record(external_exports.string(), pointerSchema).optional(), generated: generatedNameSchema.optional() }).superRefine((v, ctx) => {
|
|
28298
|
+
if (v.prepared && (v.format && v.format !== "json" || v.path !== void 0 || v.fields || v.generated || v.continue))
|
|
28299
|
+
ctx.addIssue({ code: "custom", message: "Prepared results require JSON and exclude response extraction or continuation" });
|
|
28232
28300
|
if (v.format === "file" !== !!v.file || v.format === "csv" !== !!v.csv)
|
|
28233
28301
|
ctx.addIssue({ code: "custom", message: "File and CSV responses require their matching format and contract" });
|
|
28234
28302
|
if ((v.file || v.csv) && (v.path !== void 0 || v.fields || v.generated || v.continue))
|
|
@@ -28257,14 +28325,14 @@ var init_schema = __esm({
|
|
|
28257
28325
|
bodyIssues(v, ctx);
|
|
28258
28326
|
if (v.method !== "GET")
|
|
28259
28327
|
ctx.addIssue({ code: "custom", message: "Preparation and identity checks must use GET" });
|
|
28260
|
-
}), response: responseSchema });
|
|
28328
|
+
}), response: responseSchema.refine((v) => !v.prepared, "Prepared results are only valid on the primary upload response") });
|
|
28261
28329
|
requestSchema = baseRequestSchema.extend({ prepare: readPreparationSchema.extend({ private: external_exports.literal(true).optional() }).optional(), urlFrom: pointerSchema.optional() }).superRefine((v, ctx) => {
|
|
28262
28330
|
bodyIssues(v, ctx);
|
|
28263
28331
|
if (v.prepare?.private && (v.body !== void 0 || v.form !== void 0))
|
|
28264
28332
|
ctx.addIssue({ code: "custom", message: "Private preparation binds multipart fields, query parameters, headers and urlFrom only" });
|
|
28265
28333
|
if (v.urlFrom !== void 0 && !v.prepare?.private)
|
|
28266
28334
|
ctx.addIssue({ code: "custom", message: "urlFrom requires prepare.private: true" });
|
|
28267
|
-
if (v.prepare?.private && (v.prepare.response.format && v.prepare.response.format !== "json" || v.prepare.response.schema !== void 0 || v.prepare.response.continue || v.prepare.response.generated))
|
|
28335
|
+
if (v.prepare?.private && (v.prepare.response.format && v.prepare.response.format !== "json" || v.prepare.response.schema !== void 0 || v.prepare.response.continue || v.prepare.response.generated || v.prepare.response.prepared))
|
|
28268
28336
|
ctx.addIssue({ code: "custom", message: "Private file preparation selects JSON path/fields only; final bindings validate required scalar values before dispatch" });
|
|
28269
28337
|
});
|
|
28270
28338
|
proofPointer = external_exports.string().refine((value) => {
|
|
@@ -28282,7 +28350,7 @@ var init_schema = __esm({
|
|
|
28282
28350
|
if (!!v.where === !!v.key)
|
|
28283
28351
|
ctx.addIssue({ code: "custom", message: "Select by exactly one of where or key" });
|
|
28284
28352
|
});
|
|
28285
|
-
proofSchema = external_exports.strictObject({ forEach: external_exports.strictObject({ input: inputNameSchema, as: inputNameSchema }).optional(), request: requestSchema, effect: external_exports.literal("read").optional(), select: proofSelection.optional(), equals: external_exports.array(proofComparison).min(1).optional(), response: responseSchema.optional(), absent: external_exports.literal(true).optional() }).superRefine((v, ctx) => {
|
|
28353
|
+
proofSchema = external_exports.strictObject({ forEach: external_exports.strictObject({ input: inputNameSchema, as: inputNameSchema }).optional(), request: requestSchema, effect: external_exports.literal("read").optional(), select: proofSelection.optional(), equals: external_exports.array(proofComparison).min(1).optional(), response: responseSchema.refine((v) => !v.prepared, "Prepared results are only valid on the primary upload response").optional(), absent: external_exports.literal(true).optional() }).superRefine((v, ctx) => {
|
|
28286
28354
|
if (v.forEach && (!v.select || v.absent || !v.select.where?.some((c) => "input" in c && c.input === v.forEach.as) && !(v.select.key && "input" in v.select.key && v.select.key.input === v.forEach.as)))
|
|
28287
28355
|
ctx.addIssue({ code: "custom", path: ["forEach"], message: "Bulk confirmation needs a positive selection bound to each member" });
|
|
28288
28356
|
if (!!v.equals === !!v.absent)
|
|
@@ -28314,6 +28382,8 @@ var init_schema = __esm({
|
|
|
28314
28382
|
entityDefinitionSchema = external_exports.strictObject({ title, description: requiredDescription });
|
|
28315
28383
|
generatedSchema = external_exports.record(generatedNameSchema, external_exports.strictObject({ kind: external_exports.literal("uuid"), prefix: external_exports.string().max(80).optional() }));
|
|
28316
28384
|
executableActionSchema = external_exports.strictObject({ title, description: requiredDescription, details: external_exports.string().min(1).max(2e4).optional(), effect: external_exports.enum(["read", "create", "update", "delete"]), transport: segmentSchema, inputs: jsonSchema.optional(), generated: generatedSchema.optional(), request: requestSchema, response: responseSchema.optional(), proof: proofSchema.optional() }).superRefine((v, ctx) => {
|
|
28385
|
+
if (v.response?.prepared && (v.effect === "read" || !v.request.prepare?.private || !v.request.multipart))
|
|
28386
|
+
ctx.addIssue({ code: "custom", message: "Prepared results require a private multipart mutation with independent proof" });
|
|
28317
28387
|
if (v.effect !== "read" && !v.proof)
|
|
28318
28388
|
ctx.addIssue({ code: "custom", path: ["proof"], message: "Proof required for writes" });
|
|
28319
28389
|
if (v.effect !== "delete" && v.proof?.absent)
|
|
@@ -28334,7 +28404,7 @@ var init_schema = __esm({
|
|
|
28334
28404
|
credentialSchema = external_exports.strictObject({ name: generatedNameSchema, header: external_exports.string().regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), prefix: external_exports.string().max(80).refine((v) => !/[\r\n]/.test(v)).optional() });
|
|
28335
28405
|
basicComponent = external_exports.union([generatedNameSchema, external_exports.strictObject({ literal: external_exports.string().max(128).refine((v) => ![...v].some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127), "Control characters are not allowed") })]);
|
|
28336
28406
|
httpBasicSchema = external_exports.strictObject({ username: basicComponent.optional(), password: basicComponent.optional() }).refine((v) => Object.values(v).some((value) => typeof value === "string"), "Name at least one saved credential field; the omitted component is empty");
|
|
28337
|
-
probeSchema = external_exports.strictObject({ effect: external_exports.literal("read").optional(), request: requestSchema, response: responseSchema, inputs: jsonSchema.optional() });
|
|
28407
|
+
probeSchema = external_exports.strictObject({ effect: external_exports.literal("read").optional(), request: requestSchema, response: responseSchema.refine((v) => !v.prepared, "Prepared results are only valid on the primary upload response"), inputs: jsonSchema.optional() });
|
|
28338
28408
|
transportDefinitionSchema = external_exports.strictObject({ title, description: requiredDescription, mode: external_exports.enum(["direct", "browser"]), baseUrl: requestUrlSchema.optional(), allowedOrigins: external_exports.array(originSchema).min(1).max(100), browserContext: segmentSchema.optional(), credentials: external_exports.array(credentialSchema).max(16).optional(), httpBasic: httpBasicSchema.optional(), inject: external_exports.array(injectSchema).optional(), identity: readPreparationSchema.extend({ paths: external_exports.array(pointerSchema).min(1).max(8) }).optional(), probes: external_exports.record(external_exports.string(), probeSchema) }).superRefine((v, ctx) => {
|
|
28339
28409
|
if (new Set(v.allowedOrigins).size !== v.allowedOrigins.length)
|
|
28340
28410
|
ctx.addIssue({ code: "custom", path: ["allowedOrigins"], message: "Origins must be distinct" });
|
|
@@ -31978,7 +32048,7 @@ function createCliApi(baseUrl, fetcher = fetch, token, sessionId, observe) {
|
|
|
31978
32048
|
const transport = async (input2, init) => {
|
|
31979
32049
|
const method = init?.method ?? "GET";
|
|
31980
32050
|
const headers = new Headers(init?.headers);
|
|
31981
|
-
headers.set("Apilift-Capabilities", "distributed-rollouts-v1,discovery-proof-v2,dynamic-bindings-v1,collection-proof-v3,web-responses-v1,bounded-catalog-v1,http-basic-v1,api-contracts-v1,string-bindings-v1,file-transfers-v1");
|
|
32051
|
+
headers.set("Apilift-Capabilities", "distributed-rollouts-v1,discovery-proof-v2,dynamic-bindings-v1,collection-proof-v3,web-responses-v1,bounded-catalog-v1,http-basic-v1,api-contracts-v1,string-bindings-v1,file-transfers-v1,file-workflows-v2");
|
|
31982
32052
|
headers.set("Apilift-Client", `cli/${cliVersion}`);
|
|
31983
32053
|
if (token) headers.set("Authorization", `Bearer ${token}`);
|
|
31984
32054
|
if (sessionId) headers.set("Apilift-Session", sessionId);
|
|
@@ -32269,11 +32339,54 @@ function verifyArtifact(value) {
|
|
|
32269
32339
|
function select2(value, path2) {
|
|
32270
32340
|
if (!path2) return value;
|
|
32271
32341
|
for (const key of path2.slice(1).split("/").map((part) => part.replaceAll("~1", "/").replaceAll("~0", "~"))) {
|
|
32272
|
-
if (!value || typeof value !== "object" || !Object.hasOwn(value, key))
|
|
32342
|
+
if (!value || typeof value !== "object" || !Object.hasOwn(value, key)) return missing;
|
|
32273
32343
|
value = value[key];
|
|
32274
32344
|
}
|
|
32275
32345
|
return value;
|
|
32276
32346
|
}
|
|
32347
|
+
function csvValue(row, column) {
|
|
32348
|
+
let value = column.paths ? column.paths.map((path2) => select2(row, path2)) : select2(row, column.path);
|
|
32349
|
+
const absent2 = (value2) => value2 === missing || value2 === null;
|
|
32350
|
+
if (absent2(value) || Array.isArray(value) && value.some(absent2)) {
|
|
32351
|
+
if (Object.hasOwn(column, "fallback")) return column.fallback;
|
|
32352
|
+
if (value === missing || Array.isArray(value) && value.includes(missing)) throw new Error(`CSV column "${column.name}" is missing a source field; declare fallback for missing or null values`);
|
|
32353
|
+
}
|
|
32354
|
+
for (const step of column.transform ?? []) {
|
|
32355
|
+
if (step.type === "join") {
|
|
32356
|
+
if (!Array.isArray(value) || value.length > 256) throw new Error("CSV join requires an array of at most 256 values");
|
|
32357
|
+
const items = value.map((item) => step.itemPath === void 0 ? item : select2(item, step.itemPath));
|
|
32358
|
+
if (items.some(absent2)) {
|
|
32359
|
+
if (Object.hasOwn(column, "fallback")) return column.fallback;
|
|
32360
|
+
throw new Error(`CSV column "${column.name}" has missing or null join fields; declare fallback`);
|
|
32361
|
+
}
|
|
32362
|
+
if (items.some((item) => !["string", "number", "boolean"].includes(typeof item))) throw new Error("CSV join requires scalar values");
|
|
32363
|
+
value = items.map(String).join(step.separator);
|
|
32364
|
+
} else if (step.type === "strip-prefix") {
|
|
32365
|
+
if (typeof value !== "string") throw new Error("CSV prefix removal requires a string");
|
|
32366
|
+
if (value.startsWith(step.prefix)) value = value.slice(step.prefix.length);
|
|
32367
|
+
} else if (step.type === "spreadsheet-text") {
|
|
32368
|
+
if (!["string", "number", "boolean"].includes(typeof value)) throw new Error("CSV spreadsheet text requires a scalar");
|
|
32369
|
+
value = value === "" ? "" : "'" + String(value);
|
|
32370
|
+
} else {
|
|
32371
|
+
if (step.unit === "iso" ? typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}T.*(?:Z|[+-]\d{2}:\d{2})$/u.test(value) : typeof value !== "number" || !Number.isFinite(value)) throw new Error("CSV date-time requires an ISO timestamp with offset or a number in the declared unit");
|
|
32372
|
+
if (step.unit === "iso") {
|
|
32373
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d{1,3})?(?:Z|([+-])(\d{2}):(\d{2}))$/u.exec(value);
|
|
32374
|
+
if (!match) throw new Error("CSV date-time source is invalid");
|
|
32375
|
+
const [, y, m, d, h, min, s, , oh, om] = match;
|
|
32376
|
+
const calendar = /* @__PURE__ */ new Date(0);
|
|
32377
|
+
calendar.setUTCFullYear(Number(y), Number(m) - 1, Number(d));
|
|
32378
|
+
if (calendar.getUTCFullYear() !== Number(y) || calendar.getUTCMonth() !== Number(m) - 1 || calendar.getUTCDate() !== Number(d) || Number(h) > 23 || Number(min) > 59 || Number(s) > 59 || Number(oh ?? 0) > 23 || Number(om ?? 0) > 59) throw new Error("CSV date-time source is invalid");
|
|
32379
|
+
}
|
|
32380
|
+
const date5 = new Date(step.unit === "iso" ? value : value * (step.unit === "seconds" ? 1e3 : 1));
|
|
32381
|
+
if (!Number.isFinite(date5.getTime())) throw new Error("CSV date-time source is invalid");
|
|
32382
|
+
const parts2 = Object.fromEntries(new Intl.DateTimeFormat("en-US-u-ca-iso8601-nu-latn", { timeZone: step.timeZone, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", hourCycle: "h23" }).formatToParts(date5).map((part) => [part.type, part.value]));
|
|
32383
|
+
const tokens = { yyyy: parts2.year.padStart(4, "0"), MM: parts2.month, dd: parts2.day, HH: parts2.hour, mm: parts2.minute, ss: parts2.second };
|
|
32384
|
+
value = step.pattern.replace(/yyyy|MM|dd|HH|mm|ss/gu, (token) => tokens[token]);
|
|
32385
|
+
}
|
|
32386
|
+
if (typeof value === "string" && Buffer.byteLength(value) > 65536) throw new Error("CSV projected cell exceeds 65536 bytes");
|
|
32387
|
+
}
|
|
32388
|
+
return value;
|
|
32389
|
+
}
|
|
32277
32390
|
function csvBytes(source, contract) {
|
|
32278
32391
|
const rows = select2(source, contract.rows);
|
|
32279
32392
|
if (!Array.isArray(rows) || rows.length > 1e5) throw new Error("CSV source must be an array of at most 100000 rows");
|
|
@@ -32285,7 +32398,7 @@ function csvBytes(source, contract) {
|
|
|
32285
32398
|
const lines = [contract.columns.map((column) => cell(column.name)).join(",")];
|
|
32286
32399
|
let size = Buffer.byteLength(lines[0]) + 2;
|
|
32287
32400
|
for (const row of rows) {
|
|
32288
|
-
const line = contract.columns.map((column) => cell(
|
|
32401
|
+
const line = contract.columns.map((column) => cell(csvValue(row, column))).join(",");
|
|
32289
32402
|
size += Buffer.byteLength(line) + 2;
|
|
32290
32403
|
if (size > downloadLimit) throw new Error("CSV exceeds the artifact limit");
|
|
32291
32404
|
lines.push(line);
|
|
@@ -32309,7 +32422,7 @@ async function boundedResponseBytes(response) {
|
|
|
32309
32422
|
}
|
|
32310
32423
|
return Buffer.concat(chunks, size);
|
|
32311
32424
|
}
|
|
32312
|
-
var uploadLimit, downloadLimit, digest, mime;
|
|
32425
|
+
var uploadLimit, downloadLimit, digest, mime, missing;
|
|
32313
32426
|
var init_file_artifacts = __esm({
|
|
32314
32427
|
"src/execution/file-artifacts.ts"() {
|
|
32315
32428
|
"use strict";
|
|
@@ -32317,6 +32430,41 @@ var init_file_artifacts = __esm({
|
|
|
32317
32430
|
downloadLimit = 24 * 1024 * 1024;
|
|
32318
32431
|
digest = (bytes) => createHash5("sha256").update(bytes).digest("hex");
|
|
32319
32432
|
mime = (value) => value.split(";", 1)[0].trim().toLowerCase();
|
|
32433
|
+
missing = Symbol("missing");
|
|
32434
|
+
}
|
|
32435
|
+
});
|
|
32436
|
+
|
|
32437
|
+
// src/execution/prepared-fields.ts
|
|
32438
|
+
function preparationSecrets(value, credentials = []) {
|
|
32439
|
+
const sensitive2 = /auth|cookie|token|secret|session|credential|password|policy|signature|nonce|csrf|xsrf|api[_-]?key|hmac|digest/iu;
|
|
32440
|
+
const secrets = [...credentials];
|
|
32441
|
+
const visit4 = (node2, protectedField = false) => {
|
|
32442
|
+
if (node2 && typeof node2 === "object") {
|
|
32443
|
+
const named = node2;
|
|
32444
|
+
for (const [key, child2] of Object.entries(node2)) visit4(child2, protectedField || sensitive2.test(key) || key === "value" && typeof named.name === "string" && sensitive2.test(named.name));
|
|
32445
|
+
} else if (protectedField && node2 != null) secrets.push(String(node2));
|
|
32446
|
+
};
|
|
32447
|
+
visit4(value);
|
|
32448
|
+
return secrets;
|
|
32449
|
+
}
|
|
32450
|
+
function preparedFields(value, paths2, credentials) {
|
|
32451
|
+
const secrets = preparationSecrets(value, credentials);
|
|
32452
|
+
const sensitive2 = /auth|cookie|token|secret|session|credential|password|policy|signature|nonce|csrf|xsrf|api[_-]?key|hmac|digest/iu;
|
|
32453
|
+
return Object.fromEntries(paths2.map((path2) => {
|
|
32454
|
+
if (!path2.startsWith("/") || /~(?![01])/u.test(path2) || sensitive2.test(path2)) throw new Error("Prepared results must select application identifiers, not signing fields");
|
|
32455
|
+
let selected = value;
|
|
32456
|
+
for (const part of path2.slice(1).split("/").map((part2) => part2.replaceAll("~1", "/").replaceAll("~0", "~"))) {
|
|
32457
|
+
if (!selected || typeof selected !== "object" || !Object.hasOwn(selected, part)) throw new Error("Private preparation omitted a result field");
|
|
32458
|
+
selected = selected[part];
|
|
32459
|
+
}
|
|
32460
|
+
const text4 = String(selected);
|
|
32461
|
+
if (!["string", "number", "boolean"].includes(typeof selected) || typeof selected === "number" && !Number.isFinite(selected) || !text4 || text4.length > 2048 || [...text4].some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127) || /\[REDACTED\]|[?#]|:\/\/|^\/\//u.test(text4) || secrets.filter(Boolean).some((secret) => text4 === secret || secret.length >= 4 && (text4.includes(secret) || text4.includes(encodeURIComponent(secret))))) throw new Error("Prepared results must be bounded resource identifiers without signing material or URLs");
|
|
32462
|
+
return [path2, selected];
|
|
32463
|
+
}));
|
|
32464
|
+
}
|
|
32465
|
+
var init_prepared_fields = __esm({
|
|
32466
|
+
"src/execution/prepared-fields.ts"() {
|
|
32467
|
+
"use strict";
|
|
32320
32468
|
}
|
|
32321
32469
|
});
|
|
32322
32470
|
|
|
@@ -37999,8 +38147,8 @@ function filterParsed(selector, elements, options2) {
|
|
|
37999
38147
|
}
|
|
38000
38148
|
for (let i = 0; i < filteredSelectors.length && (found === null || found === void 0 ? void 0 : found.size) !== elements.length; i++) {
|
|
38001
38149
|
const filteredSelector = filteredSelectors[i];
|
|
38002
|
-
const
|
|
38003
|
-
if (
|
|
38150
|
+
const missing2 = found ? elements.filter((e) => isTag2(e) && !found.has(e)) : elements;
|
|
38151
|
+
if (missing2.length === 0)
|
|
38004
38152
|
break;
|
|
38005
38153
|
const filtered = filterBySelector(filteredSelector, elements, options2);
|
|
38006
38154
|
if (filtered.length) {
|
|
@@ -39235,6 +39383,10 @@ function htmlExtract(text4, contract) {
|
|
|
39235
39383
|
return fields(contract.fields, $.root(), 0);
|
|
39236
39384
|
}
|
|
39237
39385
|
function decodeResponse(result4, contract) {
|
|
39386
|
+
if (contract?.prepared) return Object.fromEntries(Object.entries(contract.prepared).map(([name, path2]) => {
|
|
39387
|
+
if (!result4.preparedFields || !Object.hasOwn(result4.preparedFields, path2)) throw new ResponseContractFailure("Saved evidence has no selected upload identifier; inspect app state without repeating the upload");
|
|
39388
|
+
return [name, result4.preparedFields[path2]];
|
|
39389
|
+
}));
|
|
39238
39390
|
if (contract?.file || contract?.csv) {
|
|
39239
39391
|
try {
|
|
39240
39392
|
const body = result4.body;
|
|
@@ -41211,7 +41363,7 @@ async function send(fetcher, prepared, allowNonJsonProbe = false) {
|
|
|
41211
41363
|
const contract = prepared.artifact.contract.csv, artifact = saveArtifact(prepared.artifact.root, csvBytes(body, contract), contract.name, "text/csv", prepared.artifact.secrets);
|
|
41212
41364
|
return { response, body: { artifact, source: body }, finalUrl: prepared.url.origin + prepared.url.pathname };
|
|
41213
41365
|
}
|
|
41214
|
-
return { response, body, rawText, finalUrl: response.url || prepared.url.href };
|
|
41366
|
+
return { response, body, rawText, preparedFields: prepared.preparedFields, finalUrl: response.url || prepared.url.href };
|
|
41215
41367
|
}
|
|
41216
41368
|
async function sendBrowser(root2, appId, contextName, pageOrigin, effect2, transportName, transport, prepared, dispatched, credentialId, credentialDraftId, allowNonJsonProbe = false, dispatchBefore, selection = {}) {
|
|
41217
41369
|
const client = selection.client ?? await captureClient(root2, true, selection.timings);
|
|
@@ -41248,6 +41400,10 @@ async function sendBrowser(root2, appId, contextName, pageOrigin, effect2, trans
|
|
|
41248
41400
|
const peers = await client.scopes();
|
|
41249
41401
|
if (!peers.extensionCapabilities?.includes("file-transfers-v1") || !peers.hostCapabilities?.includes("file-transfers-v1")) throw new BrowserControlError("Update the CLI native host and Companion before file transfers; no app request was sent", "extension-upgrade-required");
|
|
41250
41402
|
}
|
|
41403
|
+
if (prepared.filePreparation?.resultPaths) {
|
|
41404
|
+
const peers = await client.scopes();
|
|
41405
|
+
if (!peers.extensionCapabilities?.includes("file-workflows-v2") || !peers.hostCapabilities?.includes("file-workflows-v2")) throw new BrowserControlError("Update the CLI native host and Companion before retaining upload identifiers; no app request was sent", "extension-upgrade-required");
|
|
41406
|
+
}
|
|
41251
41407
|
const injections = (prepared.anonymous && !prepared.filePreparation ? void 0 : transport.inject)?.filter((rule) => !(rule.to.in === "form" && ["GET", "HEAD"].includes(String(prepared.init.method))));
|
|
41252
41408
|
const authRecipeDefinition = injections?.length ? { inject: injections } : void 0;
|
|
41253
41409
|
const authRecipeHash = authRecipeDefinition ? await hashJson(authRecipeDefinition) : void 0;
|
|
@@ -41298,7 +41454,9 @@ async function sendBrowser(root2, appId, contextName, pageOrigin, effect2, trans
|
|
|
41298
41454
|
const contract = prepared.artifact.contract.csv, artifact = saveArtifact(prepared.artifact.root, csvBytes(decoded, contract), contract.name, "text/csv", prepared.artifact.secrets);
|
|
41299
41455
|
return { response, body: { artifact, source: decoded }, finalUrl: prepared.url.origin + prepared.url.pathname };
|
|
41300
41456
|
}
|
|
41301
|
-
|
|
41457
|
+
const retained = prepared.filePreparation?.resultPaths;
|
|
41458
|
+
if (retained && (!value.preparedFields || Object.keys(value.preparedFields).length !== new Set(retained).size || retained.some((path2) => !Object.hasOwn(value.preparedFields, path2)))) throw new ResponseContractFailure("Chrome omitted retained upload identifiers; inspect saved state before another mutation");
|
|
41459
|
+
return { response, body: decoded, ...retained ? { preparedFields: value.preparedFields } : {}, ...!allowNonJsonProbe ? { rawText: evidence ?? "" } : {}, finalUrl: typeof value.url === "string" ? value.url : prepared.url.href, redirected: value.redirected === true, ...value.profileId ? { profileId: value.profileId } : {} };
|
|
41302
41460
|
}
|
|
41303
41461
|
if (held.status === "uncertain") throw new Error("Chrome execution outcome is uncertain");
|
|
41304
41462
|
await new Promise((resolve16) => setTimeout(resolve16, client.legacyBridge ? 200 : 10));
|
|
@@ -41569,7 +41727,7 @@ Inspect current action documentation: ${prefix2(`actions show ${appName} ${actio
|
|
|
41569
41727
|
try {
|
|
41570
41728
|
if (liveBrowser) await releaseStoppedCaptureForUse(state, session.id, bundle2.app.id, liveBrowser);
|
|
41571
41729
|
const deadline = Date.now() + 2e4;
|
|
41572
|
-
if (action.request.prepare) prepared = await prepareWithRead(action.request, transport, inputs.values, generated, sendRequest, void 0, responseSecrets);
|
|
41730
|
+
if (action.request.prepare) prepared = await prepareWithRead(action.request, transport, inputs.values, generated, sendRequest, void 0, responseSecrets, action.response?.prepared);
|
|
41573
41731
|
if (action.response?.file || action.response?.csv) prepared.artifact = { root: root2, contract: action.response, secrets: responseSecrets };
|
|
41574
41732
|
const initial = await sendRequest(prepared, action.effect);
|
|
41575
41733
|
const primary = await continueResponse(initial, action.response, async (url3, ms) => {
|
|
@@ -41665,16 +41823,17 @@ Inspect saved entries: ${prefix2(`credentials list ${appName} ${action.transport
|
|
|
41665
41823
|
saveTimings(timings, performance.now() - commandStarted);
|
|
41666
41824
|
return output2;
|
|
41667
41825
|
}
|
|
41668
|
-
async function prepareWithRead(request2, transport, inputs, generated, sendRead, output2, secrets) {
|
|
41826
|
+
async function prepareWithRead(request2, transport, inputs, generated, sendRead, output2, secrets, resultFields) {
|
|
41669
41827
|
const spec = request2.prepare;
|
|
41670
41828
|
const prepared = prepareRequest(spec.request, transport, inputs, generated, output2);
|
|
41671
41829
|
if (spec.private && transport.mode === "browser") {
|
|
41672
41830
|
const bindings = (values) => Object.fromEntries(Object.entries(values ?? {}).filter((entry2) => !!entry2[1] && typeof entry2[1] === "object" && Object.keys(entry2[1]).length === 1 && typeof entry2[1].$prepared === "string"));
|
|
41673
|
-
return { ...prepareRequest(request2, transport, inputs, generated, output2), filePreparation: { url: prepared.url.href, headers: Object.fromEntries(new Headers(prepared.init.headers).entries()), response: { ...spec.response.path !== void 0 ? { path: spec.response.path } : {}, ...spec.response.fields ? { fields: spec.response.fields } : {} }, ...request2.urlFrom !== void 0 ? { urlFrom: request2.urlFrom } : {}, query: bindings(request2.query), headerBindings: bindings(request2.headers) } };
|
|
41831
|
+
return { ...prepareRequest(request2, transport, inputs, generated, output2), filePreparation: { ...resultFields ? { resultPaths: Object.values(resultFields) } : {}, url: prepared.url.href, headers: Object.fromEntries(new Headers(prepared.init.headers).entries()), response: { ...spec.response.path !== void 0 ? { path: spec.response.path } : {}, ...spec.response.fields ? { fields: spec.response.fields } : {} }, ...request2.urlFrom !== void 0 ? { urlFrom: request2.urlFrom } : {}, query: bindings(request2.query), headerBindings: bindings(request2.headers) } };
|
|
41674
41832
|
}
|
|
41675
41833
|
const initial = await sendRead(prepared, "read");
|
|
41676
41834
|
const final = await continueResponse(initial, spec.response, (url3) => sendRead(prepareRequest({ method: "GET", url: url3 }, transport, inputs, generated, output2), "read"), "read", prepared.url.href, prepared.appDeadline);
|
|
41677
41835
|
if (!final.response.ok) throw new ResponseContractFailure(`Preparation returned HTTP ${final.response.status}; no mutation was sent`);
|
|
41836
|
+
if (secrets) secrets.push(...preparationSecrets(final.body));
|
|
41678
41837
|
const value = projected(decodeResponse(final, spec.response), { response: spec.response }, generated);
|
|
41679
41838
|
if (secrets) {
|
|
41680
41839
|
if (final.rawText) secrets.push(...htmlSecrets(final.rawText));
|
|
@@ -41693,7 +41852,11 @@ async function prepareWithRead(request2, transport, inputs, generated, sendRead,
|
|
|
41693
41852
|
}
|
|
41694
41853
|
}
|
|
41695
41854
|
}
|
|
41696
|
-
|
|
41855
|
+
const retained = resultFields ? preparedFields(value, Object.values(resultFields), secrets ?? []) : void 0;
|
|
41856
|
+
if (retained) for (const [name, binding2] of [...Object.entries(request2.query ?? {}), ...Object.entries(request2.headers ?? {}), ...(request2.multipart ?? []).flatMap((part) => "value" in part ? [[part.name, part.value]] : [])]) {
|
|
41857
|
+
if (/auth|cookie|token|secret|session|credential|password|policy|signature|nonce|csrf|xsrf|api[_-]?key|hmac|digest/iu.test(name) && binding2 && typeof binding2 === "object" && "$prepared" in binding2 && Object.values(retained).includes(pointer4(value, String(binding2.$prepared)))) throw new Error("Protected signing fields cannot be retained as upload results");
|
|
41858
|
+
}
|
|
41859
|
+
return { ...prepareRequest(request2, transport, inputs, generated, output2, value), ...retained ? { preparedFields: retained } : {} };
|
|
41697
41860
|
}
|
|
41698
41861
|
function effectiveEvidenceStatus(evidence) {
|
|
41699
41862
|
return evidence.hops?.at(-1)?.status ?? evidence.status;
|
|
@@ -41701,7 +41864,7 @@ function effectiveEvidenceStatus(evidence) {
|
|
|
41701
41864
|
function checkSavedResponse(action, evidence) {
|
|
41702
41865
|
const saved = evidence.hops?.at(-1) ?? evidence;
|
|
41703
41866
|
const response = new Response(null, { status: saved.status, headers: saved.contentType ? { "content-type": saved.contentType } : {} });
|
|
41704
|
-
const decoded = decodeResponse({ response, body: saved.body, rawText: saved.rawText, finalUrl: saved.finalUrl }, action.response);
|
|
41867
|
+
const decoded = decodeResponse({ response, body: saved.body, preparedFields: evidence.preparedFields, rawText: saved.rawText, finalUrl: saved.finalUrl }, action.response);
|
|
41705
41868
|
return projected(decoded, action, evidence.generated);
|
|
41706
41869
|
}
|
|
41707
41870
|
function checkSavedProof(action, body, primary, inputs) {
|
|
@@ -41903,11 +42066,11 @@ async function executeDraftVerification(input2) {
|
|
|
41903
42066
|
} else if (input2.primaryEvidence?.context) throw new ResponseContractFailure("Restore the identity check used by the saved mutation before recovery");
|
|
41904
42067
|
if (input2.contextOnly) return { ok: true, output: null, proof: "not-applicable", dispatched: true, ...context ? { context } : {} };
|
|
41905
42068
|
const request2 = input2.kind === "action" ? action.request : probe.request;
|
|
41906
|
-
if (!input2.primaryEvidence && request2.prepare) prepared = await prepareWithRead(request2, transport, values, generated, sendConfigured, void 0, knownCredentials);
|
|
42069
|
+
if (!input2.primaryEvidence && request2.prepare) prepared = await prepareWithRead(request2, transport, values, generated, sendConfigured, void 0, knownCredentials, input2.kind === "action" ? action.response?.prepared : void 0);
|
|
41907
42070
|
const deadline = appDeadline ?? Date.now() + 2e4;
|
|
41908
42071
|
const responseContract = input2.kind === "action" ? action.response : probe.response;
|
|
41909
42072
|
if (responseContract?.file || responseContract?.csv) prepared.artifact = { root: input2.root, contract: responseContract, secrets: knownCredentials };
|
|
41910
|
-
const initial = input2.primaryEvidence ? { response: new Response(null, { status: input2.primaryEvidence.status, headers: input2.primaryEvidence.contentType ? { "content-type": input2.primaryEvidence.contentType } : {} }), body: input2.primaryEvidence.body, rawText: input2.primaryEvidence.rawText, finalUrl: input2.primaryEvidence.finalUrl } : await sendConfigured(prepared, input2.kind === "action" ? action.effect : "read");
|
|
42073
|
+
const initial = input2.primaryEvidence ? { response: new Response(null, { status: input2.primaryEvidence.status, headers: input2.primaryEvidence.contentType ? { "content-type": input2.primaryEvidence.contentType } : {} }), body: input2.primaryEvidence.body, preparedFields: input2.primaryEvidence.preparedFields, rawText: input2.primaryEvidence.rawText, finalUrl: input2.primaryEvidence.finalUrl } : await sendConfigured(prepared, input2.kind === "action" ? action.effect : "read");
|
|
41911
42074
|
const contract = input2.kind === "action" ? action.response : probe.response;
|
|
41912
42075
|
const decoderHash = await hashJson(contract ?? {});
|
|
41913
42076
|
const navigationHash = await hashJson(contract?.continue ?? []);
|
|
@@ -41915,7 +42078,7 @@ async function executeDraftVerification(input2) {
|
|
|
41915
42078
|
let savedEvidence = input2.primaryEvidence;
|
|
41916
42079
|
const save = (decoded2) => {
|
|
41917
42080
|
if (!input2.onPrimary) return;
|
|
41918
|
-
const saved = privateEvidence({ status: initial.response.status, body: initial.body, rawText: initial.rawText, contentType: initial.response.headers.get("content-type") ?? void 0, inputs: values, generated, navigationHash, hops, ...initial.finalUrl ? { finalUrl: initial.finalUrl, redirected: initial.redirected } : {}, ...context ? { context } : {}, ...decoded2 !== void 0 ? { decoded: decoded2, decoderHash } : input2.primaryEvidence && Object.hasOwn(input2.primaryEvidence, "decoded") ? { decoded: input2.primaryEvidence.decoded, decoderHash: input2.primaryEvidence.decoderHash } : {} }, knownCredentials);
|
|
42081
|
+
const saved = privateEvidence({ status: initial.response.status, body: initial.body, preparedFields: initial.preparedFields, rawText: initial.rawText, contentType: initial.response.headers.get("content-type") ?? void 0, inputs: values, generated, navigationHash, hops, ...initial.finalUrl ? { finalUrl: initial.finalUrl, redirected: initial.redirected } : {}, ...context ? { context } : {}, ...decoded2 !== void 0 ? { decoded: decoded2, decoderHash } : input2.primaryEvidence && Object.hasOwn(input2.primaryEvidence, "decoded") ? { decoded: input2.primaryEvidence.decoded, decoderHash: input2.primaryEvidence.decoderHash } : {} }, knownCredentials);
|
|
41919
42082
|
savedEvidence = { ...saved.value, redacted: saved.redacted || input2.primaryEvidence?.redacted };
|
|
41920
42083
|
input2.onPrimary(savedEvidence);
|
|
41921
42084
|
};
|
|
@@ -41968,6 +42131,7 @@ var init_run = __esm({
|
|
|
41968
42131
|
"src/commands/run.ts"() {
|
|
41969
42132
|
"use strict";
|
|
41970
42133
|
init_file_artifacts();
|
|
42134
|
+
init_prepared_fields();
|
|
41971
42135
|
init_web_response();
|
|
41972
42136
|
init_catalog();
|
|
41973
42137
|
init_browser_response();
|
|
@@ -42516,16 +42680,16 @@ async function binding(api, appId, appTitle, transportName, workspaceId) {
|
|
|
42516
42680
|
}
|
|
42517
42681
|
async function unboundEntries(store, api) {
|
|
42518
42682
|
const entries = store.entries();
|
|
42519
|
-
const
|
|
42683
|
+
const missing2 = [];
|
|
42520
42684
|
for (const entry2 of entries) {
|
|
42521
42685
|
try {
|
|
42522
42686
|
const current = await binding(api, entry2.appId, entry2.appId, entry2.transportName, entry2.workspaceId);
|
|
42523
42687
|
void current;
|
|
42524
42688
|
} catch {
|
|
42525
|
-
|
|
42689
|
+
missing2.push(entry2);
|
|
42526
42690
|
}
|
|
42527
42691
|
}
|
|
42528
|
-
return
|
|
42692
|
+
return missing2;
|
|
42529
42693
|
}
|
|
42530
42694
|
async function handleCredentials(invocation, api, state, session, siteUrl2, root2) {
|
|
42531
42695
|
const [appRef, transportName, name] = invocation.positionals;
|
|
@@ -44117,9 +44281,9 @@ function filterCatalogueCoverage(raw, definition2, observation, text4) {
|
|
|
44117
44281
|
const available = new Set(descriptors.flatMap((row) => row[String(catalogue.operators)]));
|
|
44118
44282
|
const probeable = new Set(descriptors.filter((row) => row[String(catalogue.type)] === catalogue.booleanType).flatMap((row) => row[String(catalogue.operators)]));
|
|
44119
44283
|
const declared = /* @__PURE__ */ new Set([...raw.operators.unary, ...raw.operators.value]);
|
|
44120
|
-
const
|
|
44284
|
+
const missing2 = [...available].filter((op) => !declared.has(op) && !probeable.has(op));
|
|
44121
44285
|
const unsupported = [...declared].filter((op) => !available.has(String(op)));
|
|
44122
|
-
const findings = [
|
|
44286
|
+
const findings = [missing2.length ? `Catalogue operators missing from the grammar: ${missing2.join(", ")}. Classify each in operators.unary or operators.value from documented operand semantics` : "", unsupported.length ? `Declared operators absent from the complete catalogue: ${unsupported.join(", ")}. Use the catalogue's exact operator names` : ""].filter(Boolean);
|
|
44123
44287
|
if (findings.length) throw Error(findings.join(". ") + ".");
|
|
44124
44288
|
}
|
|
44125
44289
|
function filterArityProbes(input2, raw, definition2, observation, text4, catalogueDefinition, catalogueObservation, catalogueText) {
|
|
@@ -44300,8 +44464,8 @@ function compileCollection(definition2, raw) {
|
|
|
44300
44464
|
const key = parts(field)[0];
|
|
44301
44465
|
if (!fields.has(key) || required2.has(key)) throw Error(`Optional record field is unknown or already required: ${field}`);
|
|
44302
44466
|
}
|
|
44303
|
-
const
|
|
44304
|
-
if (
|
|
44467
|
+
const missing2 = [...fields].filter((key) => !required2.has(key) && !optional2.some((field) => parts(field)[0] === key));
|
|
44468
|
+
if (missing2.length) throw Error(`Classify remaining record fields as requiredFields or optionalFields: ${missing2.map((key) => "/" + key.replaceAll("~", "~0").replaceAll("/", "~1")).join(", ")}. Nullable does not mean optional; preserve lifecycle/discriminator and core record guarantees. Use requiredFields: all with conditional exceptions when appropriate`);
|
|
44305
44469
|
}
|
|
44306
44470
|
const meanings = { total: "Total matching records.", page: "Current page number.", limit: "Page size reported by the app.", offset: "Number of matching records skipped.", pages: "Total pages reported by the app." };
|
|
44307
44471
|
for (const [name, value] of Object.entries(pagination)) {
|
|
@@ -44341,19 +44505,19 @@ function compileCollection(definition2, raw) {
|
|
|
44341
44505
|
if (raw.completeEnvelope) {
|
|
44342
44506
|
const optional2 = raw.optionalOutputs ?? [];
|
|
44343
44507
|
if (!Array.isArray(optional2) || optional2.some((value) => typeof value !== "string")) throw Error("collection.optionalOutputs lists conditional envelope paths, relative to the complete result");
|
|
44344
|
-
const siblings2 = [],
|
|
44508
|
+
const siblings2 = [], missing2 = [];
|
|
44345
44509
|
for (let level = 0; level < path2.length; level++) {
|
|
44346
44510
|
const parent2 = path2.slice(0, level);
|
|
44347
44511
|
const fields = new Set(targets(parent2).flatMap((node2) => object18(node2.properties) ? Object.keys(node2.properties) : []));
|
|
44348
44512
|
for (const field of fields) if (field !== path2[level]) {
|
|
44349
44513
|
const segments = [...parent2, field], pointer11 = "/" + segments.map((key) => key.replaceAll("~", "~0").replaceAll("/", "~1")).join("/");
|
|
44350
44514
|
siblings2.push(pointer11);
|
|
44351
|
-
if (!guaranteesPath(root2, segments, root2) && !optional2.includes(pointer11))
|
|
44515
|
+
if (!guaranteesPath(root2, segments, root2) && !optional2.includes(pointer11)) missing2.push(pointer11);
|
|
44352
44516
|
if (guaranteesPath(root2, segments, root2) && optional2.includes(pointer11)) throw Error(`Envelope field ${pointer11} is already required; remove it from optionalOutputs`);
|
|
44353
44517
|
}
|
|
44354
44518
|
}
|
|
44355
44519
|
if (optional2.some((value) => !siblings2.includes(value))) throw Error("optionalOutputs must name documented fields alongside the collection path");
|
|
44356
|
-
if (
|
|
44520
|
+
if (missing2.length) throw Error(`Classify envelope fields ${missing2.join(", ")}: declare count/traversal roles in collection.pagination, always-present paths in requiredOutputs, or conditional paths in collection.optionalOutputs. Review catalogue totals even without pagination; do not infer optionality from missing source required lists.`);
|
|
44357
44521
|
}
|
|
44358
44522
|
}
|
|
44359
44523
|
function guaranteesPath(node2, path2, root2, seen = /* @__PURE__ */ new Set()) {
|
|
@@ -44417,8 +44581,8 @@ function checkLookupTraversal(parameters, selected, omissions, schema) {
|
|
|
44417
44581
|
const paginationMeaning = /\b(?:paginat\w*|paging|page\s+(?:size|number|token)|(?:next|previous)\s+page|number\s+of\s+[^.!?]+?\s+to\s+(?:return|skip|retrieve))\b/iu.test(description2);
|
|
44418
44582
|
return ["integer", "number", "string"].includes(String(shape.type)) && (paginationName || paginationMeaning);
|
|
44419
44583
|
});
|
|
44420
|
-
const
|
|
44421
|
-
if (
|
|
44584
|
+
const missing2 = candidates.filter((parameter) => !Object.hasOwn(omitted, String(parameter.name))).map((parameter) => parameter.name);
|
|
44585
|
+
if (missing2.length) throw Error(`Lookup omits potential traversal inputs: ${missing2.join(", ")}. Map one complete documented pagination method in lookup. For an alternative to that method or an unrelated business filter, supply lookupOmissions with its evidenced reason; do not expose redundant traversal modes. Do not publish a first-page-only identifier source.`);
|
|
44422
44586
|
}
|
|
44423
44587
|
function omittedQueryDefault(parameter, shape) {
|
|
44424
44588
|
if (parameter.in !== "query") return;
|
|
@@ -44843,12 +45007,12 @@ function compileApiPlan(text4, read = (path2) => boundedRead(path2, 8 * 1024 * 1
|
|
|
44843
45007
|
const evidenced = arrayCaseDiagnostics(definition2, observation, load2(String(observation.file)), [...Array.isArray(cases) ? cases : [], ...extraCases], verification2.outcome).map((group) => group.spec.input);
|
|
44844
45008
|
const probeable = choiceListProbes(definition2, raw.collection, observation, load2(String(observation.file))).filter((candidate2) => candidate2.documentedArray).map((candidate2) => candidate2.spec.input);
|
|
44845
45009
|
const request2 = definition2.request;
|
|
44846
|
-
const
|
|
45010
|
+
const missing2 = ambiguousArrayQueries(definition2).filter((input2) => {
|
|
44847
45011
|
if (probeable.includes(input2) || evidenced.includes(input2) || Array.isArray(verification2.unions) && verification2.unions.some((spec) => object21(spec) && spec.input === input2)) return false;
|
|
44848
45012
|
const wire = Object.entries(object21(request2.query) ? request2.query : {}).find(([, binding2]) => object21(binding2) && binding2.$input === input2)?.[0];
|
|
44849
45013
|
return !wire || !Array.isArray(verification2.observations) || !verification2.observations.some((fact) => object21(fact) && object21(fact.request) && object21(fact.request.query) && Object.hasOwn(fact.request.query, wire));
|
|
44850
45014
|
});
|
|
44851
|
-
if (
|
|
45015
|
+
if (missing2.length) issues.push({ path: `${path2}/verification`, message: `Scalar-or-array query inputs ${missing2.join(", ")} have no evidenced serialization. Declare source-grounded encoding, unions, or discriminating independent cases before import.` });
|
|
44852
45016
|
} catch {
|
|
44853
45017
|
}
|
|
44854
45018
|
}
|
|
@@ -46288,8 +46452,8 @@ Selection and independent evidence remain retained; repair the failure before re
|
|
|
46288
46452
|
const ambiguous = ambiguousArrayQueries(action.envelope.definition);
|
|
46289
46453
|
if (!ambiguous.length) continue;
|
|
46290
46454
|
const evidenced = arrayCaseDiagnostics(action.envelope.definition, original, readFileSync15(resolve9(dirname9(set2.filePath), original.file), "utf8"), action.cases, verification.outcome).map((group) => group.spec.input);
|
|
46291
|
-
const
|
|
46292
|
-
if (
|
|
46455
|
+
const missing2 = ambiguous.filter((input2) => !verification.unions?.some((union2) => union2.input === input2) && !evidenced.includes(input2));
|
|
46456
|
+
if (missing2.length) compiled.issues.push({ path: `/actions/${esc3(action.name)}/verification`, message: `Scalar-or-array query inputs ${missing2.join(", ")} have no evidenced serialization. Declare unions for documented OR semantics or discriminating independent cases; use an explicit encoding only when grounded in the source or wire evidence. This action was not executed.` });
|
|
46293
46457
|
}
|
|
46294
46458
|
const unionDiagnostics = /* @__PURE__ */ new Map();
|
|
46295
46459
|
const encodingResolutions = [];
|
|
@@ -47467,7 +47631,7 @@ function requestEncoding(entry2) {
|
|
|
47467
47631
|
const type = raw.split(";", 1)[0].trim().toLowerCase();
|
|
47468
47632
|
const mediaType = /^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/u.test(type) && type.length <= 100 ? type : "unknown";
|
|
47469
47633
|
if (mediaType === "application/x-www-form-urlencoded") return { mediaType, encoding: "urlencoded", reason: "Scalar and repeated form fields are supported" };
|
|
47470
|
-
if (mediaType.startsWith("multipart/")) return { mediaType, encoding: "multipart", reason: "
|
|
47634
|
+
if (mediaType.startsWith("multipart/")) return { mediaType, encoding: "multipart", reason: entry2.reqBodyState === "complete" ? "Ordered scalar multipart fields are supported without a file" : entry2.reqBodyState === "multipart-file-bytes-unavailable" ? "File bytes are unavailable; supply an explicit approved local file and fresh private signing preparation" : "Scalar multipart data is unavailable or incomplete; do not infer that a file was present or repeat a mutation" };
|
|
47471
47635
|
try {
|
|
47472
47636
|
JSON.parse(String(entry2.reqBody));
|
|
47473
47637
|
if (typeof entry2.reqBody === "string") return { mediaType, encoding: "json", reason: "JSON body is supported" };
|
|
@@ -47537,6 +47701,16 @@ function deriveRequest(entry2, inputs) {
|
|
|
47537
47701
|
form[name] = sensitive.test(name) ? pending(`/request/form/${name}`) : bind2(values.length === 1 ? values[0] : values, `/request/form/${name}`, true);
|
|
47538
47702
|
}
|
|
47539
47703
|
request2.form = form;
|
|
47704
|
+
} else if (encoding.encoding === "multipart") {
|
|
47705
|
+
const contentType = String(Object.entries(entry2.reqHeaders ?? {}).find(([name]) => name.toLowerCase() === "content-type")?.[1] ?? "");
|
|
47706
|
+
let parsed;
|
|
47707
|
+
try {
|
|
47708
|
+
parsed = parseMultipart(entry2.reqBody, contentType);
|
|
47709
|
+
} catch {
|
|
47710
|
+
throw new Error(`Captured request cannot be authored (media type: ${encoding.mediaType}; encoding: ${encoding.encoding}). Scalar multipart framing is incomplete; inspect retained evidence without repeating a mutation`);
|
|
47711
|
+
}
|
|
47712
|
+
if (parsed.parts.some((part) => part.file)) throw new Error("Multipart file bytes require an explicit approved local file input");
|
|
47713
|
+
request2.multipart = parsed.parts.map((part, index2) => ({ name: part.name, value: sensitive.test(part.name) || /^policy$/iu.test(part.name) ? pending(`/request/multipart/${index2}/value`) : bind2(part.value, `/request/multipart/${index2}/value`, true) }));
|
|
47540
47714
|
} else {
|
|
47541
47715
|
let body;
|
|
47542
47716
|
try {
|
|
@@ -47681,6 +47855,7 @@ var sensitive, browserHeader, protectedValue;
|
|
|
47681
47855
|
var init_capture_derivation = __esm({
|
|
47682
47856
|
"src/discovery/capture-derivation.ts"() {
|
|
47683
47857
|
"use strict";
|
|
47858
|
+
init_dist();
|
|
47684
47859
|
init_slim();
|
|
47685
47860
|
init_web_response();
|
|
47686
47861
|
init_json();
|
|
@@ -48598,8 +48773,8 @@ Review the saved output and readback; set verification.review to accepted only w
|
|
|
48598
48773
|
else {
|
|
48599
48774
|
const probes = evidence.data.probes ?? [];
|
|
48600
48775
|
const allowed = checked.definition.allowedOrigins;
|
|
48601
|
-
const
|
|
48602
|
-
if (
|
|
48776
|
+
const missing2 = allowed.filter((origin) => !probes.some((probe) => probe.origin === origin));
|
|
48777
|
+
if (missing2.length) return fail5(`Cannot publish ${draft.name}: probes have not been tested for ${missing2.join(", ")}.
|
|
48603
48778
|
Choose the next origin in verification.probeOrigin, then run ${command4(invocation, "discover run")}.
|
|
48604
48779
|
`);
|
|
48605
48780
|
verification = { executableHash: identity2.executable, probes: probes.map((probe) => ({ ...probe, outcome: "success", semanticConfirmed: true })), clientVersion: cliVersion };
|
|
@@ -48909,15 +49084,15 @@ Resolve the result or expectation from independent evidence, then discover check
|
|
|
48909
49084
|
boundaryPrimary = saved;
|
|
48910
49085
|
boundaryPath = savePrivate(saved, "boundary-primary.json");
|
|
48911
49086
|
} });
|
|
48912
|
-
const
|
|
48913
|
-
if (!tested.ok && !
|
|
49087
|
+
const missing2 = boundary.status === 404 && boundaryPrimary !== void 0 && effectiveEvidenceStatus(boundaryPrimary) === 404;
|
|
49088
|
+
if (!tested.ok && !missing2 || boundary.status === 404 && !missing2) return fail5(`The primary test is saved; the read boundary did not establish the declared result. ${tested.ok ? "Expected HTTP 404 was not returned." : tested.message}
|
|
48914
49089
|
Saved primary output: ${resultPath}
|
|
48915
49090
|
${boundaryPath ? `Saved boundary response: ${boundaryPath}
|
|
48916
49091
|
` : ""}Repair the contract or boundary inputs; do not repeat a mutation.
|
|
48917
49092
|
`, 12, true);
|
|
48918
49093
|
const boundaryOutput = tested.ok ? tested.output : null;
|
|
48919
49094
|
const boundaryResult = savePrivate(boundaryOutput, "boundary-output.json");
|
|
48920
|
-
const gaps =
|
|
49095
|
+
const gaps = missing2 ? [] : checkExpectedResults(boundaryOutput, values, boundary.expect, boundaryResult);
|
|
48921
49096
|
if (boundaryPath && boundaryPrimary) saveVerificationCase(store, draft.id, { binding: binding2, role: "boundary", inputs: boundaryPrimary.inputs, expect: boundary.expect, expectationsPassed: gaps.length === 0, primary: ownedCaseFile(boundaryPath), result: ownedCaseFile(boundaryResult), status: effectiveEvidenceStatus(boundaryPrimary) });
|
|
48922
49097
|
if (gaps.length) return fail5(`The primary test is saved; the read boundary differs from its expectation.
|
|
48923
49098
|
${issueLines(gaps)}
|
|
@@ -50070,8 +50245,8 @@ function active(agent2, expected) {
|
|
|
50070
50245
|
function inspectAgentPlugin(agent2, env, sourceOverride) {
|
|
50071
50246
|
if (env.APILIFT_DEV_PLUGIN_ROOT) return { ready: false, version: "development", detail: "Development plugin activation has not been verified" };
|
|
50072
50247
|
const source = resolve12(sourceOverride || join19(dirname13(fileURLToPath2(import.meta.url)), "plugin"));
|
|
50073
|
-
const
|
|
50074
|
-
if (
|
|
50248
|
+
const missing2 = missingSkill(source);
|
|
50249
|
+
if (missing2) return { ready: false, version: "unknown", detail: `CLI package is missing its ${missing2} skill` };
|
|
50075
50250
|
const version2 = readJson(join19(source, `.${agent2}-plugin`, "plugin.json"))?.version;
|
|
50076
50251
|
if (typeof version2 !== "string" || !/^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/.test(version2)) throw new Error("Plugin package version is invalid");
|
|
50077
50252
|
const bundleDigest = digest4(source);
|
|
@@ -50088,16 +50263,16 @@ function inspectAgentPlugin(agent2, env, sourceOverride) {
|
|
|
50088
50263
|
function ensureAgentPlugin(agent2, env, sourceOverride) {
|
|
50089
50264
|
if (env.APILIFT_DEV_PLUGIN_ROOT) {
|
|
50090
50265
|
const source2 = resolve12(env.APILIFT_DEV_PLUGIN_ROOT);
|
|
50091
|
-
const
|
|
50092
|
-
if (
|
|
50266
|
+
const missing3 = missingSkill(source2);
|
|
50267
|
+
if (missing3) throw new Error(`Development plugin ${missing3} skill is missing`);
|
|
50093
50268
|
const bundleDigest2 = digest4(source2);
|
|
50094
50269
|
const root2 = resolve12(env.APILIFT_HOME || join19(homedir2(), ".local", "share", "apilift"));
|
|
50095
50270
|
writeJson(join19(root2, "agent-plugins", `${agent2}.json`), { root: source2, digest: bundleDigest2 });
|
|
50096
50271
|
return { ready: false, version: `dev+${bundleDigest2.slice(0, 12)}`, detail: "Development plugin source recorded; activation was not verified" };
|
|
50097
50272
|
}
|
|
50098
50273
|
const source = resolve12(sourceOverride || join19(dirname13(fileURLToPath2(import.meta.url)), "plugin"));
|
|
50099
|
-
const
|
|
50100
|
-
if (
|
|
50274
|
+
const missing2 = missingSkill(source);
|
|
50275
|
+
if (missing2) throw new Error(`CLI package is missing its ${missing2} skill`);
|
|
50101
50276
|
const version2 = readJson(join19(source, `.${agent2}-plugin`, "plugin.json"))?.version;
|
|
50102
50277
|
if (typeof version2 !== "string" || !/^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/.test(version2)) throw new Error("Plugin package version is invalid");
|
|
50103
50278
|
const bundleDigest = digest4(source);
|
|
@@ -42,7 +42,7 @@ A genuinely terminal, command-scoped unavailable boundary may be documented only
|
|
|
42
42
|
|
|
43
43
|
For returned HTML, declare `response.format: "html"` and `response.html: {marker:"#observed-page",fields:{title:{selector:"h1",read:"text"}}}`. Replace selectors with observed structure. The marker must match exactly once and distinguish the signed-in page from login. Fields support `read` values `text`, `attribute` with `attribute`, `value`, `checked`, or `json` for embedded JSON; `fields` nests objects and `many:true` returns records. Use explicit `type` conversion for numbers or booleans, and `optional:true` only for observed optional fields. Extraction produces JSON before existing `path`, `fields` and `schema` validation. Declare `html.errors` for observed form-validation messages. Scripts never run; rendered-only data needs an observed structured request. Capture show accepts `--selector <CSS-selector>` for bounded retained HTML inspection; capture select writes an incomplete contract for review.
|
|
44
44
|
|
|
45
|
-
Use `request.form` for observed `application/x-www-form-urlencoded` submissions, excluding `body`. Arrays become repeated fields; empty strings remain present and absent optional inputs are omitted. Represent checkbox wire values, omitted controls and the selected submit button explicitly; do not map caller booleans to browser behavior by assumption. One optional `request.prepare: {request:{method:"GET",url:"/settings/edit"},response:{...}}` extracts fresh internal values. Bind them with `{"$prepared":"/csrf"}` or a preservation path. Prepared values are refreshed per submission and never caller inputs. Declare unrelated non-default fields that a complete-form replacement must preserve. Transport form authentication uses `to:{in:"form",name:"csrf"}` on form submissions; read requests omit that form-only injection.
|
|
45
|
+
Use `request.form` for observed `application/x-www-form-urlencoded` submissions, excluding `body`. Arrays become repeated fields; empty strings remain present and absent optional inputs are omitted. Represent checkbox wire values, omitted controls and the selected submit button explicitly; do not map caller booleans to browser behavior by assumption. One optional `request.prepare: {request:{method:"GET",url:"/settings/edit"},response:{...}}` extracts fresh internal values. Bind them with `{"$prepared":"/csrf"}` or a preservation path. Prepared values are refreshed per submission and never caller inputs. Declare unrelated non-default fields that a complete-form replacement must preserve. Transport form authentication uses `to:{in:"form",name:"csrf"}` on form submissions; read requests omit that form-only injection. Use the multipart contract below for uploads. A single action dispatches one primary mutation; publish multiple-write workflows as separate independently verified actions.
|
|
46
46
|
|
|
47
47
|
Follow app navigation only when observed and declared: `response.continue:[{statuses:[200],format:"json",path:"/next"}]`, or an HTML rule with `selector` and `attribute`. Rules perform GET on the selected origin, resolve against the actual response URL, and share a five-read/20-second budget. A read may declare a non-2xx continuation; a rejected write cannot. Final responses use the result contract above. Never guess semantics from names such as redirectUrl or execute navigation scripts. Failed navigation retains the primary and completed reads for proof-only recovery.
|
|
48
48
|
|
|
@@ -50,12 +50,14 @@ For recovery through another tab, configure a browser transport `identity` befor
|
|
|
50
50
|
|
|
51
51
|
## File uploads and exports
|
|
52
52
|
|
|
53
|
-
Use `request.multipart` for ordered multipart parts: `{ "name": "file", "file": { "input": "file_path", "contentType": "image/png" } }` reads an explicitly supplied absolute local file, and `{ "name": "policy", "value": { "$prepared": "/policy" } }` binds a fresh signing field. File inputs must be required strings without defaults; saved context cannot select a file. The runtime snapshots regular files, rejects symlinks and devices, limits combined file bytes to 16 MiB, sets the multipart boundary, and preserves part order. Put the file last when the observed app requires it. Never copy a captured upload policy or file bytes into a definition.
|
|
53
|
+
Use `request.multipart` for ordered multipart parts, including scalar-only bodies without a file: `{ "name": "label", "value": "" }` preserves an empty scalar, and repeated names remain separate ordered parts. Complete scalar-only captures derive this structure; unavailable scalar data does not imply a file. `{ "name": "file", "file": { "input": "file_path", "contentType": "image/png" } }` reads an explicitly supplied absolute local file, and `{ "name": "policy", "value": { "$prepared": "/policy" } }` binds a fresh signing field. File inputs must be required strings without defaults; saved context cannot select a file. The runtime snapshots regular files, rejects symlinks and devices, limits combined file bytes to 16 MiB, sets the multipart boundary, and preserves part order. Put the file last when the observed app requires it. Never copy a captured upload policy or file bytes into a definition.
|
|
54
54
|
|
|
55
|
-
For signing fields, attachment nonces or protected download links, use `request.prepare: { "private": true, "request": { "method": "GET", "url": "/attachments/prepare" }, "response": { "path": "/upload" } }`. Private browser preparation selects JSON `path`/`fields`; it does not accept a response schema, HTML decoder or continuation.
|
|
55
|
+
For signing fields, attachment nonces or protected download links, use `request.prepare: { "private": true, "request": { "method": "GET", "url": "/attachments/prepare" }, "response": { "path": "/upload" } }`. Private browser preparation selects JSON `path`/`fields`; it does not accept a response schema, HTML decoder or continuation. Signing values remain inside the browser and bind scalar multipart fields, query parameters or headers through `$prepared`. `request.urlFrom: "/url"` selects a prepared destination within the transport's explicit allowed origins. Cross-origin prepared destinations require `request.anonymous: true`, which omits browser cookies and transport authentication from the final request. Preparation retains the app's authentication. It shares the request deadline, refuses redirects, and fails before the primary request if a required field or approved destination is missing.
|
|
56
|
+
|
|
57
|
+
For a signed upload that returns no body, declare `response: { "prepared": { "asset_key": "/fields/key" } }` to retain a resource identifier selected from the prepared result. The pointer addresses the value after preparation `path`/`fields`. Only one to eight bounded scalar identifiers are allowed; signing fields, credentials, copied secrets and URLs are refused before upload. Bind `{result./asset_key}` in the independent proof request, and compare the returned key and usable state. The verified result can supply a later action's input. This requires a private multipart mutation and independent proof. Primary evidence retains only the selected identifiers with the actual HTTP status/body before proof; repair proof or projection against saved evidence without another preparation or upload. Changing a pointer to a field absent from saved evidence remains blocked.
|
|
56
58
|
|
|
57
59
|
Use `response: { "format": "file", "file": { "contentTypes": ["application/pdf"], "name": "report.pdf" } }` for authenticated attachments. The declared name is a fallback when Content-Disposition provides none. Results retain the complete local artifact `{path,name,contentType,bytes,sha256}`. Verify MIME type, filename and content against independent evidence, including the checksum or parsed file content; HTTP 200 alone is insufficient. Files are limited to 24 MiB, saved privately, and rechecked for integrity during local review. Do not project away artifact metadata. File responses do not follow redirects; obtain the final approved URL through private preparation. A generation mutation returns its job identifier through its ordinary JSON action; publish status and file retrieval as separate actions. Failed retrieval never authorizes another generation or upload.
|
|
58
60
|
|
|
59
|
-
If the UI generates CSV from a typed query, use `response: { "format": "csv", "csv": { "name": "tickets.csv", "rows": "/items", "columns": [{ "name": "ID", "path": "/id" }, { "name": "Title", "path": "/title" }] } }`. Verify the declared column order and complete rows against an independent UI export. The runtime preserves scalar types as CSV text, quotes delimiters/newlines, and retains the query evidence for local rechecks. A missing HTTP download does not prove client-side generation. Captures distinguish an attachment handed to Chrome, unavailable bytes, and a browser-blocked request; retain browser restrictions instead of switching transport to bypass them.
|
|
61
|
+
If the UI generates CSV from a typed query, use `response: { "format": "csv", "csv": { "name": "tickets.csv", "rows": "/items", "columns": [{ "name": "ID", "path": "/id" }, { "name": "Title", "path": "/title" }] } }`. Verify the declared column order and complete rows against an independent UI export. The runtime preserves scalar types as CSV text, quotes delimiters/newlines, and retains the query evidence for local rechecks. Each column uses exactly one `path` or ordered `paths` array. Add `fallback: ""` explicitly for missing or null values; zero, false and empty strings remain supplied values. Without fallback, missing fields fail; an unformatted null retains the existing empty-cell behavior. A fallback is the final cell value and skips transforms. Optional `transform` holds up to four ordered typed steps: `{ "type": "strip-prefix", "prefix": "desk_" }`, `{ "type": "join", "separator": " " }` for an array or `paths`, `{ "type": "join", "separator": ", ", "itemPath": "/name" }` for an array of objects, `{ "type": "spreadsheet-text" }` to prefix nonempty scalar text with an apostrophe, or `{ "type": "date-time", "unit": "iso", "timeZone": "America/New_York", "pattern": "MM/dd/yyyy HH:mm:ss" }`. Dates require an ISO timestamp with an explicit offset or numeric `seconds`/`milliseconds`; supported pattern tokens are `yyyy`, `MM`, `dd`, `HH`, `mm`, `ss`. Join inputs with missing/null members use the declared final-cell fallback or fail. No arbitrary code or format inference runs. Compare a complete header and rows covering missing and populated metrics, delimiters and formatted metadata with an independent export. A missing HTTP download does not prove client-side generation. Captures distinguish an attachment handed to Chrome, unavailable bytes, and a browser-blocked request; retain browser restrictions instead of switching transport to bypass them.
|
|
60
62
|
|
|
61
|
-
File operations require the CLI, native host and Companion `file-transfers-v1` capability. Repair an outdated peer before dispatch. Chrome may omit multipart file bytes from capture; retained names and field types are diagnostic evidence, not replayable upload content. Verify uploaded asset availability through an independent read and preserve the existing proof-only recovery rule for any uncertain write.
|
|
63
|
+
File operations require the CLI, native host and Companion `file-transfers-v1` capability. Prepared result handoffs also require `file-workflows-v2` on both peers; typed CSV projections require that capability on the CLI. Repair an outdated peer before dispatch. Chrome may omit multipart file bytes from capture; retained names and field types are diagnostic evidence, not replayable upload content. Verify uploaded asset availability through an independent read and preserve the existing proof-only recovery rule for any uncertain write.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apilift/cli",
|
|
3
|
-
"version": "1.8.8
|
|
3
|
+
"version": "1.8.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=24.16.0 <27"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "e1ca97ea05414b44f341657ec474be0c62305581",
|
|
41
41
|
"repository": {
|
|
42
42
|
"type": "git",
|
|
43
43
|
"url": "git+https://github.com/egor-sergeev/apilift.git",
|