@modainteract/moda-interact-shared 5.4.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-232YZOKK.js → chunk-BDGLKOCW.js} +416 -305
- package/dist/chunk-BDGLKOCW.js.map +1 -0
- package/dist/{chunk-XE2YVPQV.js → chunk-BYAI6W7T.js} +2 -2
- package/dist/commerce/index.d.ts +4 -4
- package/dist/commerce/index.js +8 -2
- package/dist/commerce/index.js.map +1 -1
- package/dist/commerce/model/node.d.ts +2 -2
- package/dist/commerce/model/node.js +1 -1
- package/dist/commerce/runner/index.d.ts +3 -3
- package/dist/commerce/runner/index.js +4 -3
- package/dist/commerce/runner/index.js.map +1 -1
- package/dist/{response-Bh-KzXOQ.d.ts → response-C1JsiFoO.d.ts} +38 -11
- package/dist/{types-Bcrs9622.d.ts → types-Ds5QJ621.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-232YZOKK.js.map +0 -1
- /package/dist/{chunk-XE2YVPQV.js.map → chunk-BYAI6W7T.js.map} +0 -0
|
@@ -155,40 +155,148 @@ function compileSubset(schema, mode) {
|
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
// src/commerce/
|
|
158
|
+
// src/commerce/purpose-output.ts
|
|
159
159
|
import { z as z2 } from "zod";
|
|
160
|
+
var CANONICAL_PATTERNS = [
|
|
161
|
+
"^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\\.[0-9]+)?Z(?![\\s\\S])",
|
|
162
|
+
"^[0-9]{1,18}(\\.[0-9]{1,6})?$",
|
|
163
|
+
"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
|
|
164
|
+
"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
|
|
165
|
+
];
|
|
166
|
+
var MONEY = CANONICAL_PATTERNS.find((pattern) => pattern.includes("1,18"));
|
|
167
|
+
var STRICT_DATETIME = CANONICAL_PATTERNS.find((pattern) => pattern.includes("2468"));
|
|
168
|
+
var DATETIME = CANONICAL_PATTERNS.find((pattern) => pattern !== MONEY && pattern !== STRICT_DATETIME);
|
|
169
|
+
var MINUTE_DATETIME = CANONICAL_PATTERNS[3];
|
|
170
|
+
var scalarTypes = ["string", "number", "integer", "boolean", "object", "array"];
|
|
171
|
+
var baseKeys = ["type", "description", "enum"];
|
|
172
|
+
var typeKeys = {
|
|
173
|
+
object: ["properties", "required", "additionalProperties"],
|
|
174
|
+
array: ["items", "minItems", "maxItems"],
|
|
175
|
+
string: ["minLength", "maxLength", "pattern", "format"],
|
|
176
|
+
number: ["minimum", "maximum"],
|
|
177
|
+
integer: ["minimum", "maximum"],
|
|
178
|
+
boolean: []
|
|
179
|
+
};
|
|
180
|
+
function record(value) {
|
|
181
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value) && [Object.prototype, null].includes(Object.getPrototypeOf(value)));
|
|
182
|
+
}
|
|
183
|
+
function datetime(value, allowMinutes = false) {
|
|
184
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?Z$/.exec(value);
|
|
185
|
+
if (!match || match[0].length !== value.length) return false;
|
|
186
|
+
const [, y, m, d, h, minute, second] = match;
|
|
187
|
+
if (!allowMinutes && second === void 0) return false;
|
|
188
|
+
const year = Number(y), month = Number(m), day = Number(d);
|
|
189
|
+
const leap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
190
|
+
const days = [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
191
|
+
return month >= 1 && month <= 12 && day >= 1 && day <= days[month - 1] && Number(h) <= 23 && Number(minute) <= 59 && Number(second ?? 0) <= 59;
|
|
192
|
+
}
|
|
193
|
+
function validateCommercePurposeOutputSchema(value) {
|
|
194
|
+
let nodes = 0, properties = 0;
|
|
195
|
+
function walk(raw, depth, root = false) {
|
|
196
|
+
if (depth > 8 || ++nodes > 256 || !record(raw)) return false;
|
|
197
|
+
const s = raw;
|
|
198
|
+
if (s.description !== void 0 && (typeof s.description !== "string" || s.description.length > 1e3)) return false;
|
|
199
|
+
if (Object.hasOwn(s, "anyOf")) return Object.keys(s).every((key) => ["anyOf", "description"].includes(key)) && Array.isArray(s.anyOf) && s.anyOf.length >= 2 && s.anyOf.length <= 4 && s.anyOf.every((branch) => walk(branch, depth + 1, root));
|
|
200
|
+
const nullable = Array.isArray(s.type);
|
|
201
|
+
if (nullable && (s.type.length !== 2 || s.type[1] !== "null")) return false;
|
|
202
|
+
const type = nullable ? s.type[0] : s.type;
|
|
203
|
+
if (typeof type !== "string" || !scalarTypes.includes(type) || root && (type !== "object" || nullable)) return false;
|
|
204
|
+
if (Object.keys(s).some((key) => ![...baseKeys, ...typeKeys[type]].includes(key))) return false;
|
|
205
|
+
if (s.enum !== void 0 && (!Array.isArray(s.enum) || s.enum.length < 1 || s.enum.length > 32 || new Set(s.enum.map((v) => canonicalJson(v))).size !== s.enum.length || s.enum.some((v) => v === null ? !nullable : typeof v !== (type === "integer" ? "number" : type) || type === "integer" && !Number.isSafeInteger(v) || typeof v === "object"))) return false;
|
|
206
|
+
for (const [min, max] of [["minLength", "maxLength"], ["minItems", "maxItems"], ["minimum", "maximum"]]) {
|
|
207
|
+
if ([s[min], s[max]].some((v) => v !== void 0 && (typeof v !== "number" || !Number.isFinite(v) || min !== "minimum" && (!Number.isSafeInteger(v) || v < 0)))) return false;
|
|
208
|
+
if (s[min] !== void 0 && s[max] !== void 0 && s[min] > s[max]) return false;
|
|
209
|
+
}
|
|
210
|
+
if (type === "string") return (s.maxLength === void 0 || s.maxLength <= 4096) && (s.minLength ?? 0) <= (s.maxLength ?? 4096) && (s.pattern === void 0 || CANONICAL_PATTERNS.includes(s.pattern)) && (s.format === void 0 || s.format === "uri" || s.format === "date-time");
|
|
211
|
+
if (type === "array") return (s.maxItems === void 0 || s.maxItems <= 128) && (s.minItems ?? 0) <= (s.maxItems ?? 128) && walk(s.items, depth + 1);
|
|
212
|
+
if (type === "object") {
|
|
213
|
+
if (s.additionalProperties !== false || !record(s.properties)) return false;
|
|
214
|
+
const names = Object.keys(s.properties);
|
|
215
|
+
properties += names.length;
|
|
216
|
+
return properties <= 128 && names.every(safeName) && (s.required === void 0 || Array.isArray(s.required) && new Set(s.required).size === s.required.length && s.required.every((name) => typeof name === "string" && names.includes(name))) && Object.values(s.properties).every((child) => walk(child, depth + 1));
|
|
217
|
+
}
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
try {
|
|
221
|
+
return jsonBytes(value) <= 32768 && walk(value, 1, true);
|
|
222
|
+
} catch {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
var CommercePurposeOutputSchemaSchema = z2.custom(validateCommercePurposeOutputSchema);
|
|
227
|
+
function matches(schema, value) {
|
|
228
|
+
if (schema.anyOf) return schema.anyOf.some((branch) => matches(branch, value));
|
|
229
|
+
const nullable = Array.isArray(schema.type);
|
|
230
|
+
const type = nullable ? schema.type[0] : schema.type;
|
|
231
|
+
if (value === null) return nullable && (!schema.enum || schema.enum.includes(null));
|
|
232
|
+
if (schema.enum && !schema.enum.includes(value)) return false;
|
|
233
|
+
if (type === "string") {
|
|
234
|
+
if (typeof value !== "string" || value.length < (schema.minLength ?? 0) || value.length > (schema.maxLength ?? 4096)) return false;
|
|
235
|
+
if (schema.pattern === MONEY && (!/^[0-9]{1,18}(\.[0-9]{1,6})?$/.test(value) || /[\r\n]/.test(value))) return false;
|
|
236
|
+
if (schema.pattern === DATETIME && !datetime(value)) return false;
|
|
237
|
+
if ((schema.pattern === STRICT_DATETIME || schema.pattern === MINUTE_DATETIME || schema.format === "date-time") && !datetime(value, schema.pattern !== STRICT_DATETIME)) return false;
|
|
238
|
+
if (schema.format === "uri") {
|
|
239
|
+
try {
|
|
240
|
+
const url = new URL(value);
|
|
241
|
+
if (url.protocol !== "https:" || url.username || url.password || url.port) return false;
|
|
242
|
+
} catch {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
if (type === "boolean") return typeof value === "boolean";
|
|
249
|
+
if (type === "number" || type === "integer") return typeof value === "number" && Number.isFinite(value) && (type !== "integer" || Number.isSafeInteger(value)) && value >= (schema.minimum ?? -Infinity) && value <= (schema.maximum ?? Infinity);
|
|
250
|
+
if (type === "array") return Array.isArray(value) && value.length >= (schema.minItems ?? 0) && value.length <= (schema.maxItems ?? 128) && value.every((item) => matches(schema.items, item));
|
|
251
|
+
if (!record(value)) return false;
|
|
252
|
+
return Object.keys(value).every((key) => Object.hasOwn(schema.properties, key)) && (schema.required ?? []).every((key) => Object.hasOwn(value, key)) && Object.entries(value).every(([key, child]) => matches(schema.properties[key], child));
|
|
253
|
+
}
|
|
254
|
+
function compileCommercePurposeOutputSchema(raw) {
|
|
255
|
+
if (!validateCommercePurposeOutputSchema(raw)) throw new TypeError("Unsupported purpose output schema");
|
|
256
|
+
const snapshot = structuredClone(raw);
|
|
257
|
+
return z2.custom((value) => {
|
|
258
|
+
try {
|
|
259
|
+
return jsonBytes(value) <= 32768 && matches(snapshot, value);
|
|
260
|
+
} catch {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// src/commerce/external.ts
|
|
267
|
+
import { z as z3 } from "zod";
|
|
160
268
|
var utf8 = (value, maximum) => new TextEncoder().encode(value).length <= maximum;
|
|
161
|
-
var scalar =
|
|
269
|
+
var scalar = z3.union([z3.string().refine((value) => utf8(value, 2048)), z3.number().finite(), z3.boolean()]);
|
|
162
270
|
var ExternalQueryValueSchema = scalar;
|
|
163
|
-
var scalarOrNull =
|
|
164
|
-
var
|
|
165
|
-
var ExternalQueryMappingSchema =
|
|
166
|
-
|
|
167
|
-
|
|
271
|
+
var scalarOrNull = z3.union([scalar, z3.null()]);
|
|
272
|
+
var record2 = (item, max) => z3.record(z3.string().refine(safeName), item).refine((value) => Object.keys(value).length <= max);
|
|
273
|
+
var ExternalQueryMappingSchema = z3.union([
|
|
274
|
+
z3.strictObject({ input: z3.string().refine(safeName), omitIfMissing: z3.literal(true).optional() }),
|
|
275
|
+
z3.strictObject({ literal: scalar })
|
|
168
276
|
]);
|
|
169
|
-
var ExternalQueryMappingsSchema =
|
|
277
|
+
var ExternalQueryMappingsSchema = record2(ExternalQueryMappingSchema, 32).superRefine((value, ctx) => {
|
|
170
278
|
const reserved = /^(authorization|cookie|set-cookie|host|x-api-key|api_key|apikey|access_token|token|secret|password)$/i;
|
|
171
279
|
for (const key of Object.keys(value)) if (reserved.test(key)) ctx.addIssue({ code: "custom", path: [key], message: "Reserved query key" });
|
|
172
280
|
});
|
|
173
|
-
var ExternalPathSchema =
|
|
281
|
+
var ExternalPathSchema = z3.string().max(1024).refine(
|
|
174
282
|
(value) => utf8(value, 1024) && /^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]*\/?$/.test(value) && !value.includes("//") && !value.includes("%") && !value.includes("\\") && !value.includes("?") && !value.includes("#") && !value.includes("{") && !value.includes("}") && value.split("/").every((segment) => segment !== "." && segment !== "..")
|
|
175
283
|
);
|
|
176
|
-
var mediaType =
|
|
284
|
+
var mediaType = z3.string().min(1).max(128).refine((value) => value === value.toLowerCase() && /^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/.test(value));
|
|
177
285
|
var jsonMime = (value) => value === "application/json" || /^application\/[a-z0-9!#$&^_.+-]+\+json$/.test(value);
|
|
178
286
|
var textMime = (value) => /^text\/[a-z0-9!#$&^_.+-]+$/.test(value) || value === "application/xml" || /^application\/[a-z0-9!#$&^_.+-]+\+xml$/.test(value) || jsonMime(value);
|
|
179
|
-
var ExternalResponseFormatSchema =
|
|
180
|
-
var FieldProjectionSchema =
|
|
181
|
-
var ResponseFilterSchema =
|
|
182
|
-
|
|
183
|
-
|
|
287
|
+
var ExternalResponseFormatSchema = z3.strictObject({ mode: z3.enum(["JSON", "TEXT"]), mediaTypes: z3.array(mediaType).min(1).max(8).refine((values) => new Set(values).size === values.length) }).refine((value) => value.mediaTypes.every(value.mode === "JSON" ? jsonMime : textMime));
|
|
288
|
+
var FieldProjectionSchema = record2(z3.strictObject({ path: z3.string().refine(safePath), omitIfMissing: z3.literal(true).optional() }), 32).refine((value) => Object.keys(value).length >= 1);
|
|
289
|
+
var ResponseFilterSchema = z3.discriminatedUnion("op", [
|
|
290
|
+
z3.strictObject({ path: z3.string().refine(safePath), op: z3.enum(["EQ", "NE", "GT", "GTE", "LT", "LTE", "CONTAINS", "STARTS_WITH"]), value: scalarOrNull }),
|
|
291
|
+
z3.strictObject({ path: z3.string().refine(safePath), op: z3.literal("IN"), values: z3.array(scalarOrNull).min(1).max(20) })
|
|
184
292
|
]);
|
|
185
|
-
var visualObject =
|
|
186
|
-
var visualList =
|
|
187
|
-
var VisualResponseProcessingSchema =
|
|
188
|
-
var ResponseProcessingSchema =
|
|
189
|
-
var TransformResponseSchema =
|
|
190
|
-
var TransformSampleSchema =
|
|
191
|
-
var boundedValues =
|
|
293
|
+
var visualObject = z3.strictObject({ kind: z3.literal("OBJECT"), fields: FieldProjectionSchema });
|
|
294
|
+
var visualList = z3.strictObject({ kind: z3.literal("LIST"), fields: FieldProjectionSchema, filters: z3.array(ResponseFilterSchema).max(8), sort: z3.union([z3.null(), z3.strictObject({ path: z3.string().refine(safePath), direction: z3.enum(["ASC", "DESC"]) })]), limit: z3.int().min(1).max(20) });
|
|
295
|
+
var VisualResponseProcessingSchema = z3.union([visualObject, visualList]);
|
|
296
|
+
var ResponseProcessingSchema = z3.union([VisualResponseProcessingSchema, z3.strictObject({ kind: z3.literal("JAVASCRIPT"), runtimeVersion: z3.literal("quickjs-sync.v1"), source: z3.string().min(1).refine((value) => utf8(value, 16384)) })]);
|
|
297
|
+
var TransformResponseSchema = z3.strictObject({ status: z3.int().min(200).max(299), contentType: z3.string().min(1).max(128), bodyText: z3.string().refine((value) => utf8(value, 262144)), json: z3.union([z3.null(), z3.json()]) });
|
|
298
|
+
var TransformSampleSchema = z3.strictObject({ status: z3.int().min(200).max(299), contentType: z3.string().min(1).max(128), bodyText: z3.string().refine((value) => utf8(value, 262144)) }).refine((value) => jsonBytes(value) <= 524288);
|
|
299
|
+
var boundedValues = z3.custom((value) => {
|
|
192
300
|
const visit = (node, depth) => depth <= 20 && (node === null || typeof node === "string" || typeof node === "boolean" || typeof node === "number" && Number.isFinite(node) || Array.isArray(node) && node.every((child) => visit(child, depth + 1)) || !!node && typeof node === "object" && !Array.isArray(node) && Object.getPrototypeOf(node) === Object.prototype && Object.entries(node).every(([key, child]) => !["__proto__", "prototype", "constructor"].includes(key) && visit(child, depth + 1)));
|
|
193
301
|
try {
|
|
194
302
|
return !!value && typeof value === "object" && !Array.isArray(value) && visit(value, 1) && jsonBytes(value) <= 49152;
|
|
@@ -196,24 +304,24 @@ var boundedValues = z2.custom((value) => {
|
|
|
196
304
|
return false;
|
|
197
305
|
}
|
|
198
306
|
});
|
|
199
|
-
var ExternalHttpResultDataSchema =
|
|
200
|
-
var ConnectionRevisionViewSchema =
|
|
201
|
-
var ConnectionViewSchema =
|
|
202
|
-
var CredentialStatusSchema =
|
|
203
|
-
var ConnectionCommandSchema =
|
|
204
|
-
var RevisionInputSchema =
|
|
205
|
-
var ConnectionIssueSchema =
|
|
206
|
-
var ConnectionResultSchema = (value) =>
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
307
|
+
var ExternalHttpResultDataSchema = z3.strictObject({ source: z3.literal("EXTERNAL_HTTP"), connectionRevisionId: IdSchema, observedAt: DateSchema, values: boundedValues });
|
|
308
|
+
var ConnectionRevisionViewSchema = z3.strictObject({ id: IdSchema, connectionId: IdSchema, revisionNumber: z3.int().positive(), origin: z3.string().min(1).max(2048), scope: z3.enum(["PLATFORM", "PER_SHOP"]), authMode: z3.enum(["NONE", "BEARER", "API_KEY"]), authHeader: z3.string().min(1).max(128).nullable(), documentation: z3.string().max(16e3), createdAt: z3.iso.datetime({ offset: false }) });
|
|
309
|
+
var ConnectionViewSchema = z3.strictObject({ id: IdSchema, key: z3.string().regex(/^[a-z][a-z0-9_]{0,127}$/), displayName: z3.string().min(1).max(255), description: z3.string().max(4096), enabled: z3.boolean(), editVersion: z3.int().positive(), revisions: z3.array(ConnectionRevisionViewSchema) });
|
|
310
|
+
var CredentialStatusSchema = z3.strictObject({ connectionRevisionId: IdSchema, shopId: IdSchema.nullable(), configured: z3.boolean(), editVersion: z3.int().positive().nullable(), updatedAt: z3.iso.datetime({ offset: false }).nullable() });
|
|
311
|
+
var ConnectionCommandSchema = z3.strictObject({ operationId: IdSchema, reason: z3.string().trim().min(1).max(1e3) });
|
|
312
|
+
var RevisionInputSchema = z3.strictObject({ origin: z3.string().min(1).max(2048), scope: z3.enum(["PLATFORM", "PER_SHOP"]), authMode: z3.enum(["NONE", "BEARER", "API_KEY"]), authHeader: z3.string().min(1).max(128).nullable(), documentation: z3.string().max(16e3) });
|
|
313
|
+
var ConnectionIssueSchema = z3.strictObject({ path: z3.string().max(256), message: z3.string().min(1).max(512) });
|
|
314
|
+
var ConnectionResultSchema = (value) => z3.discriminatedUnion("kind", [
|
|
315
|
+
z3.strictObject({ kind: z3.literal("ok"), value }),
|
|
316
|
+
z3.strictObject({ kind: z3.literal("not-found") }),
|
|
317
|
+
z3.strictObject({ kind: z3.literal("forbidden") }),
|
|
318
|
+
z3.strictObject({ kind: z3.literal("unavailable") }),
|
|
319
|
+
z3.strictObject({ kind: z3.literal("invalid"), issues: z3.array(ConnectionIssueSchema).max(32) }),
|
|
320
|
+
z3.strictObject({ kind: z3.literal("conflict"), code: z3.enum(["STALE_CAS", "CONFLICTING_REPLAY"]) })
|
|
213
321
|
]);
|
|
214
322
|
|
|
215
323
|
// src/commerce/definitions.ts
|
|
216
|
-
import { z as
|
|
324
|
+
import { z as z4 } from "zod";
|
|
217
325
|
import { gt } from "semver";
|
|
218
326
|
|
|
219
327
|
// src/commerce/definition-size.ts
|
|
@@ -254,21 +362,21 @@ var definitionFitsStorage = (value) => {
|
|
|
254
362
|
var DEFINITION_SIZE_MESSAGE = "Definition exceeds the 65536-byte jsonb text limit";
|
|
255
363
|
|
|
256
364
|
// src/commerce/definitions.ts
|
|
257
|
-
var ToolNameSchema =
|
|
258
|
-
var CommerceExecutionPurposeSchema =
|
|
259
|
-
var CommercePurposeProfileSchema =
|
|
365
|
+
var ToolNameSchema = z4.string().regex(/^[a-z][a-z0-9_]{0,127}$/).refine((n) => n !== "finalResponse");
|
|
366
|
+
var CommerceExecutionPurposeSchema = z4.literal("INITIAL_RECOVERY_OUTREACH");
|
|
367
|
+
var CommercePurposeProfileSchema = z4.strictObject({
|
|
260
368
|
purpose: CommerceExecutionPurposeSchema,
|
|
261
369
|
featureId: IdSchema,
|
|
262
370
|
releaseId: IdSchema,
|
|
263
|
-
behaviourPrompt:
|
|
264
|
-
capabilities:
|
|
371
|
+
behaviourPrompt: z4.string().refine((value) => new TextEncoder().encode(value).length <= 32768),
|
|
372
|
+
capabilities: z4.array(z4.strictObject({
|
|
265
373
|
capabilityId: IdSchema,
|
|
266
374
|
toolId: IdSchema,
|
|
267
375
|
revisionId: IdSchema,
|
|
268
376
|
name: ToolNameSchema,
|
|
269
|
-
position:
|
|
377
|
+
position: z4.number().int().nonnegative(),
|
|
270
378
|
inputSchema: InputSchemaSchema,
|
|
271
|
-
outputSchema:
|
|
379
|
+
outputSchema: CommercePurposeOutputSchemaSchema
|
|
272
380
|
})).min(1, { message: "PROFILE_EMPTY" }).max(32)
|
|
273
381
|
}).superRefine((profile, ctx) => {
|
|
274
382
|
const members = profile.capabilities;
|
|
@@ -288,52 +396,52 @@ var CommercePurposeProfileSchema = z3.strictObject({
|
|
|
288
396
|
function requireCommercePurposeProfile(raw) {
|
|
289
397
|
return CommercePurposeProfileSchema.parse(raw);
|
|
290
398
|
}
|
|
291
|
-
var PublishedGrantedToolSchema =
|
|
399
|
+
var PublishedGrantedToolSchema = z4.strictObject({
|
|
292
400
|
toolId: IdSchema,
|
|
293
401
|
toolRevisionId: IdSchema,
|
|
294
402
|
toolName: ToolNameSchema,
|
|
295
403
|
definitionVersion: SemverSchema,
|
|
296
|
-
capabilityKeys:
|
|
404
|
+
capabilityKeys: z4.array(IdSchema).min(1).max(32).refine((v) => distinct(v) && v.join("\0") === [...v].sort().join("\0"))
|
|
297
405
|
});
|
|
298
|
-
var PublishedToolDescriptorSchema =
|
|
406
|
+
var PublishedToolDescriptorSchema = z4.strictObject({
|
|
299
407
|
toolId: IdSchema,
|
|
300
408
|
toolRevisionId: IdSchema,
|
|
301
409
|
name: ToolNameSchema,
|
|
302
410
|
definitionVersion: SemverSchema,
|
|
303
|
-
description:
|
|
411
|
+
description: z4.string().min(1).max(4096),
|
|
304
412
|
inputSchema: InputSchemaSchema
|
|
305
413
|
});
|
|
306
|
-
var CommerceBuiltInToolNameSchema =
|
|
414
|
+
var CommerceBuiltInToolNameSchema = z4.enum([
|
|
307
415
|
"commerce_get_discount_options",
|
|
308
416
|
"commerce_get_discount_details"
|
|
309
417
|
]).meta({ maxLength: 29 });
|
|
310
|
-
var CommerceBuiltInToolGrantSchema =
|
|
311
|
-
kind:
|
|
418
|
+
var CommerceBuiltInToolGrantSchema = z4.strictObject({
|
|
419
|
+
kind: z4.enum(["BUILT_IN"]).meta({ maxLength: 8 }),
|
|
312
420
|
toolName: CommerceBuiltInToolNameSchema,
|
|
313
|
-
definitionVersion:
|
|
421
|
+
definitionVersion: z4.enum(["2.0.0"]).meta({ maxLength: 5 })
|
|
314
422
|
});
|
|
315
|
-
var CommerceBuiltInToolDescriptorSchema =
|
|
316
|
-
kind:
|
|
423
|
+
var CommerceBuiltInToolDescriptorSchema = z4.strictObject({
|
|
424
|
+
kind: z4.enum(["BUILT_IN"]).meta({ maxLength: 8 }),
|
|
317
425
|
name: CommerceBuiltInToolNameSchema,
|
|
318
|
-
definitionVersion:
|
|
319
|
-
description:
|
|
426
|
+
definitionVersion: z4.enum(["2.0.0"]).meta({ maxLength: 5 }),
|
|
427
|
+
description: z4.string().min(1).max(4096),
|
|
320
428
|
inputSchema: InputSchemaSchema
|
|
321
429
|
});
|
|
322
|
-
var GrantedToolSchema =
|
|
323
|
-
var ToolDescriptorSchema =
|
|
324
|
-
var GrantedToolsSchema =
|
|
430
|
+
var GrantedToolSchema = z4.union([PublishedGrantedToolSchema, CommerceBuiltInToolGrantSchema]);
|
|
431
|
+
var ToolDescriptorSchema = z4.union([PublishedToolDescriptorSchema, CommerceBuiltInToolDescriptorSchema]);
|
|
432
|
+
var GrantedToolsSchema = z4.array(GrantedToolSchema).max(32).refine((values) => {
|
|
325
433
|
const published = values.filter((value) => !("kind" in value));
|
|
326
434
|
return distinct(values.map((value) => value.toolName)) && distinct(published.map((value) => value.toolId));
|
|
327
435
|
});
|
|
328
436
|
var isBuiltInTool = (value) => "kind" in value && value.kind === "BUILT_IN";
|
|
329
|
-
var MappingSchema =
|
|
330
|
-
|
|
331
|
-
input:
|
|
332
|
-
omitIfMissing:
|
|
437
|
+
var MappingSchema = z4.union([
|
|
438
|
+
z4.strictObject({
|
|
439
|
+
input: z4.string().refine(safeName),
|
|
440
|
+
omitIfMissing: z4.literal(true).optional()
|
|
333
441
|
}),
|
|
334
|
-
|
|
442
|
+
z4.strictObject({ literal: boundedJson(8192) })
|
|
335
443
|
]);
|
|
336
|
-
var MappingsSchema =
|
|
444
|
+
var MappingsSchema = z4.record(z4.string().refine(safeName), MappingSchema).refine((v) => Object.keys(v).length <= 32);
|
|
337
445
|
var POLICY_OPERATIONS = [
|
|
338
446
|
"taxonomy.resolveCategories",
|
|
339
447
|
"products.search",
|
|
@@ -347,15 +455,15 @@ var POLICY_OPERATIONS = [
|
|
|
347
455
|
"products.findQualifying",
|
|
348
456
|
"products.findSimilar"
|
|
349
457
|
];
|
|
350
|
-
var ExternalHttpExecutionSchema =
|
|
351
|
-
kind:
|
|
352
|
-
executorVersion:
|
|
458
|
+
var ExternalHttpExecutionSchema = z4.strictObject({
|
|
459
|
+
kind: z4.literal("EXTERNAL_HTTP"),
|
|
460
|
+
executorVersion: z4.literal("1.0.0"),
|
|
353
461
|
connectionRevisionId: IdSchema,
|
|
354
|
-
method:
|
|
462
|
+
method: z4.literal("GET"),
|
|
355
463
|
path: ExternalPathSchema,
|
|
356
464
|
query: ExternalQueryMappingsSchema,
|
|
357
465
|
responseFormat: ExternalResponseFormatSchema,
|
|
358
|
-
resultPath:
|
|
466
|
+
resultPath: z4.string().refine((value) => value === "" || safePath(value)),
|
|
359
467
|
responseProcessing: ResponseProcessingSchema,
|
|
360
468
|
resultSchema: DetailsSchemaSchema
|
|
361
469
|
}).superRefine((value, ctx) => {
|
|
@@ -364,21 +472,21 @@ var ExternalHttpExecutionSchema = z3.strictObject({
|
|
|
364
472
|
if (value.responseProcessing.kind !== "JAVASCRIPT" && value.responseFormat.mode !== "JSON")
|
|
365
473
|
ctx.addIssue({ code: "custom", path: ["responseFormat", "mode"], message: "Visual processing requires JSON" });
|
|
366
474
|
});
|
|
367
|
-
var CommerceExecutionSchema =
|
|
368
|
-
|
|
369
|
-
kind:
|
|
370
|
-
executorVersion:
|
|
371
|
-
apiVersion:
|
|
475
|
+
var CommerceExecutionSchema = z4.discriminatedUnion("kind", [
|
|
476
|
+
z4.strictObject({
|
|
477
|
+
kind: z4.literal("SHOPIFY_STOREFRONT_QUERY"),
|
|
478
|
+
executorVersion: z4.literal("1.0.0"),
|
|
479
|
+
apiVersion: z4.literal("2026-07"),
|
|
372
480
|
schemaHash: HashSchema,
|
|
373
|
-
document:
|
|
374
|
-
operationName:
|
|
481
|
+
document: z4.string().min(1).refine((v) => new TextEncoder().encode(v).length <= 16384),
|
|
482
|
+
operationName: z4.string().refine(safeName),
|
|
375
483
|
variables: MappingsSchema,
|
|
376
|
-
resultPath:
|
|
484
|
+
resultPath: z4.string().refine(safePath)
|
|
377
485
|
}),
|
|
378
|
-
|
|
379
|
-
kind:
|
|
380
|
-
operation:
|
|
381
|
-
operationVersion:
|
|
486
|
+
z4.strictObject({
|
|
487
|
+
kind: z4.literal("POLICY_OPERATION"),
|
|
488
|
+
operation: z4.enum(POLICY_OPERATIONS),
|
|
489
|
+
operationVersion: z4.literal("1.0.0"),
|
|
382
490
|
arguments: MappingsSchema
|
|
383
491
|
}),
|
|
384
492
|
ExternalHttpExecutionSchema
|
|
@@ -391,17 +499,17 @@ function tokensValid(text, root) {
|
|
|
391
499
|
);
|
|
392
500
|
return !residue.includes("{{") && !residue.includes("}}");
|
|
393
501
|
}
|
|
394
|
-
var fixed =
|
|
395
|
-
var ResponseTemplateSchema =
|
|
396
|
-
|
|
397
|
-
kind:
|
|
398
|
-
text:
|
|
502
|
+
var fixed = z4.string().max(4096).refine((v) => !/[<>]|\{\{|\}\}/.test(v));
|
|
503
|
+
var ResponseTemplateSchema = z4.discriminatedUnion("kind", [
|
|
504
|
+
z4.strictObject({
|
|
505
|
+
kind: z4.literal("text"),
|
|
506
|
+
text: z4.string().max(4096).refine((v) => tokensValid(v, "result")),
|
|
399
507
|
unavailable: fixed
|
|
400
508
|
}),
|
|
401
|
-
|
|
402
|
-
kind:
|
|
403
|
-
itemsPath:
|
|
404
|
-
item:
|
|
509
|
+
z4.strictObject({
|
|
510
|
+
kind: z4.literal("items"),
|
|
511
|
+
itemsPath: z4.string().refine(safePath),
|
|
512
|
+
item: z4.string().max(4096).refine((v) => tokensValid(v, "item")),
|
|
405
513
|
empty: fixed,
|
|
406
514
|
unavailable: fixed
|
|
407
515
|
})
|
|
@@ -409,11 +517,11 @@ var ResponseTemplateSchema = z3.discriminatedUnion("kind", [
|
|
|
409
517
|
var identity = {
|
|
410
518
|
name: ToolNameSchema,
|
|
411
519
|
definitionVersion: SemverSchema,
|
|
412
|
-
description:
|
|
520
|
+
description: z4.string().min(1).max(4096)
|
|
413
521
|
};
|
|
414
522
|
var forbiddenInput = /^(shopid|customerid|checkoutrecoveryid|conversationid|grantid|releaseid|token|accesstoken|domain|headers|url|graphql|document|authorization)$/i;
|
|
415
523
|
var forbiddenExternalInput = /^(authorization|cookie|set-cookie|host|x-api-key|api_key|apikey|access_token|token|secret|password)$/i;
|
|
416
|
-
var CommerceToolDefinitionSchema =
|
|
524
|
+
var CommerceToolDefinitionSchema = z4.strictObject({
|
|
417
525
|
...identity,
|
|
418
526
|
inputSchema: InputSchemaSchema,
|
|
419
527
|
execution: CommerceExecutionSchema,
|
|
@@ -449,7 +557,7 @@ var CommerceToolDefinitionSchema = z3.strictObject({
|
|
|
449
557
|
var draftObject = boundedJson(65536).refine(
|
|
450
558
|
(v) => !!v && typeof v === "object" && !Array.isArray(v)
|
|
451
559
|
);
|
|
452
|
-
var CommerceToolDraftDefinitionSchema =
|
|
560
|
+
var CommerceToolDraftDefinitionSchema = z4.strictObject({
|
|
453
561
|
...identity,
|
|
454
562
|
inputSchema: draftObject,
|
|
455
563
|
execution: draftObject,
|
|
@@ -542,12 +650,12 @@ function validateDefinitionVersion(proposed, highestPublished) {
|
|
|
542
650
|
SemverSchema.parse(highestPublished);
|
|
543
651
|
return gt(proposed, highestPublished);
|
|
544
652
|
}
|
|
545
|
-
var CommerceToolIdentitySchema =
|
|
653
|
+
var CommerceToolIdentitySchema = z4.strictObject({
|
|
546
654
|
id: IdSchema,
|
|
547
655
|
name: ToolNameSchema,
|
|
548
|
-
enabled:
|
|
656
|
+
enabled: z4.boolean()
|
|
549
657
|
});
|
|
550
|
-
var CommerceToolRevisionIdentitySchema =
|
|
658
|
+
var CommerceToolRevisionIdentitySchema = z4.strictObject({
|
|
551
659
|
toolId: IdSchema,
|
|
552
660
|
toolRevisionId: IdSchema,
|
|
553
661
|
definitionVersion: SemverSchema,
|
|
@@ -599,10 +707,10 @@ function isTrustedCommerceBuiltInGrant(value) {
|
|
|
599
707
|
}
|
|
600
708
|
|
|
601
709
|
// src/commerce/response.ts
|
|
602
|
-
import { z as
|
|
603
|
-
var CommerceResponseContractSchema =
|
|
604
|
-
version:
|
|
605
|
-
instructions:
|
|
710
|
+
import { z as z5 } from "zod";
|
|
711
|
+
var CommerceResponseContractSchema = z5.strictObject({
|
|
712
|
+
version: z5.literal("response.v1"),
|
|
713
|
+
instructions: z5.string().min(1).max(8e3),
|
|
606
714
|
detailsSchema: DetailsSchemaSchema
|
|
607
715
|
}).refine((v) => jsonBytes(v) <= 32768);
|
|
608
716
|
var EMPTY_RESPONSE_CONTRACT = {
|
|
@@ -615,31 +723,31 @@ var EMPTY_RESPONSE_CONTRACT = {
|
|
|
615
723
|
additionalProperties: false
|
|
616
724
|
}
|
|
617
725
|
};
|
|
618
|
-
var ReferralReasonSchema =
|
|
726
|
+
var ReferralReasonSchema = z5.enum([
|
|
619
727
|
"INSUFFICIENT_TOOLS",
|
|
620
728
|
"UNVERIFIABLE_FACTS",
|
|
621
729
|
"TOOL_UNAVAILABLE",
|
|
622
730
|
"TOOL_REVOKED"
|
|
623
731
|
]);
|
|
624
|
-
var DetectedLanguageTagSchema =
|
|
732
|
+
var DetectedLanguageTagSchema = z5.string().min(1).max(128).transform((value, ctx) => {
|
|
625
733
|
const canonical = canonicaliseLanguageTag(value);
|
|
626
734
|
if (!canonical) {
|
|
627
735
|
ctx.addIssue({
|
|
628
736
|
code: "custom",
|
|
629
737
|
message: "Invalid detected language tag"
|
|
630
738
|
});
|
|
631
|
-
return
|
|
739
|
+
return z5.NEVER;
|
|
632
740
|
}
|
|
633
741
|
return canonical;
|
|
634
742
|
});
|
|
635
|
-
var CommerceFinalResponseSchema =
|
|
636
|
-
answerKind:
|
|
637
|
-
replyText:
|
|
743
|
+
var CommerceFinalResponseSchema = z5.strictObject({
|
|
744
|
+
answerKind: z5.enum(["ANSWER", "REFER_TO_STORE"]),
|
|
745
|
+
replyText: z5.string().min(1).max(4096),
|
|
638
746
|
referralReason: ReferralReasonSchema.nullable(),
|
|
639
747
|
detectedLanguageTag: DetectedLanguageTagSchema.nullable(),
|
|
640
|
-
detectedLanguageConfidence:
|
|
641
|
-
evidenceIds:
|
|
642
|
-
details:
|
|
748
|
+
detectedLanguageConfidence: z5.number().min(0).max(1).nullable(),
|
|
749
|
+
evidenceIds: z5.array(IdSchema).max(3).refine((v) => new Set(v).size === v.length),
|
|
750
|
+
details: z5.record(z5.string(), z5.unknown()).refine((v) => {
|
|
643
751
|
try {
|
|
644
752
|
return jsonBytes(v) <= 16384;
|
|
645
753
|
} catch {
|
|
@@ -775,22 +883,22 @@ function finalResponseToolSchema(definition) {
|
|
|
775
883
|
}
|
|
776
884
|
|
|
777
885
|
// src/commerce/schemas.ts
|
|
778
|
-
import { z as
|
|
886
|
+
import { z as z6 } from "zod";
|
|
779
887
|
import { validRange } from "semver";
|
|
780
|
-
var CommerceTurnIdentitySchema =
|
|
888
|
+
var CommerceTurnIdentitySchema = z6.strictObject({
|
|
781
889
|
contractVersion: ContractVersionSchema,
|
|
782
890
|
shopId: IdSchema,
|
|
783
891
|
checkoutRecoveryId: IdSchema,
|
|
784
892
|
conversationId: IdSchema,
|
|
785
|
-
inboundVersion:
|
|
893
|
+
inboundVersion: z6.number().int().positive()
|
|
786
894
|
});
|
|
787
|
-
var CommerceConversationGrantSchema =
|
|
895
|
+
var CommerceConversationGrantSchema = z6.strictObject({
|
|
788
896
|
id: IdSchema,
|
|
789
897
|
shopId: IdSchema,
|
|
790
898
|
conversationId: IdSchema,
|
|
791
|
-
initialInboundVersion:
|
|
899
|
+
initialInboundVersion: z6.number().int().positive(),
|
|
792
900
|
releaseId: IdSchema,
|
|
793
|
-
selectedCapabilityKeys:
|
|
901
|
+
selectedCapabilityKeys: z6.array(IdSchema).max(32).refine(distinct),
|
|
794
902
|
purposeProfile: CommercePurposeProfileSchema.optional(),
|
|
795
903
|
grantedTools: GrantedToolsSchema,
|
|
796
904
|
runnerVersion: SemverSchema,
|
|
@@ -806,27 +914,27 @@ var CommerceConversationGrantSchema = z5.strictObject({
|
|
|
806
914
|
))
|
|
807
915
|
c.addIssue({ code: "custom", message: "Unselected grant provenance" });
|
|
808
916
|
});
|
|
809
|
-
var CommerceManifestSchema =
|
|
917
|
+
var CommerceManifestSchema = z6.strictObject({
|
|
810
918
|
contractVersion: ContractVersionSchema,
|
|
811
919
|
releaseId: IdSchema,
|
|
812
|
-
runnerCompatibility:
|
|
813
|
-
capabilities:
|
|
814
|
-
|
|
920
|
+
runnerCompatibility: z6.string().min(1).max(128).refine((v) => !!validRange(v)),
|
|
921
|
+
capabilities: z6.array(
|
|
922
|
+
z6.strictObject({
|
|
815
923
|
capabilityId: IdSchema,
|
|
816
924
|
key: IdSchema,
|
|
817
925
|
featureId: IdSchema,
|
|
818
|
-
position:
|
|
926
|
+
position: z6.number().int().nonnegative(),
|
|
819
927
|
toolDescriptor: PublishedToolDescriptorSchema
|
|
820
928
|
})
|
|
821
929
|
).max(32),
|
|
822
|
-
featureBehaviours:
|
|
823
|
-
|
|
930
|
+
featureBehaviours: z6.array(
|
|
931
|
+
z6.strictObject({
|
|
824
932
|
featureId: IdSchema,
|
|
825
|
-
behaviourPrompt:
|
|
933
|
+
behaviourPrompt: z6.string().max(32e3)
|
|
826
934
|
})
|
|
827
935
|
).max(32),
|
|
828
|
-
selectedCapabilityKeys:
|
|
829
|
-
builtInTools:
|
|
936
|
+
selectedCapabilityKeys: z6.array(IdSchema).max(32).refine(distinct),
|
|
937
|
+
builtInTools: z6.array(CommerceBuiltInToolDescriptorSchema).max(2).default([]),
|
|
830
938
|
purposeProfile: CommercePurposeProfileSchema.optional(),
|
|
831
939
|
grantedTools: GrantedToolsSchema,
|
|
832
940
|
responseContract: CommerceResponseContractSchema,
|
|
@@ -881,32 +989,32 @@ var CommerceManifestSchema = z5.strictObject({
|
|
|
881
989
|
message: "Grant must equal selected capability set"
|
|
882
990
|
});
|
|
883
991
|
});
|
|
884
|
-
var CommerceReleaseIdentitySchema =
|
|
992
|
+
var CommerceReleaseIdentitySchema = z6.strictObject({
|
|
885
993
|
contractVersion: ContractVersionSchema,
|
|
886
994
|
releaseId: IdSchema,
|
|
887
|
-
runnerCompatibility:
|
|
995
|
+
runnerCompatibility: z6.string().min(1).max(128).refine((v) => !!validRange(v))
|
|
888
996
|
});
|
|
889
997
|
var CommerceResolveAssertionSchema = CommerceTurnIdentitySchema.extend(
|
|
890
|
-
{ purpose:
|
|
998
|
+
{ purpose: z6.literal("resolve") }
|
|
891
999
|
);
|
|
892
1000
|
var CommerceExecuteAssertionSchema = CommerceTurnIdentitySchema.extend(
|
|
893
|
-
{ purpose:
|
|
1001
|
+
{ purpose: z6.literal("execute"), grantId: IdSchema, releaseId: IdSchema }
|
|
894
1002
|
);
|
|
895
|
-
var CommerceAssertionSchema =
|
|
1003
|
+
var CommerceAssertionSchema = z6.discriminatedUnion("purpose", [
|
|
896
1004
|
CommerceResolveAssertionSchema,
|
|
897
1005
|
CommerceExecuteAssertionSchema
|
|
898
1006
|
]);
|
|
899
|
-
var qty =
|
|
900
|
-
var CommerceProposalSchema =
|
|
901
|
-
operations:
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
kind:
|
|
1007
|
+
var qty = z6.number().int().min(1).max(999);
|
|
1008
|
+
var CommerceProposalSchema = z6.strictObject({
|
|
1009
|
+
operations: z6.array(
|
|
1010
|
+
z6.discriminatedUnion("kind", [
|
|
1011
|
+
z6.strictObject({
|
|
1012
|
+
kind: z6.literal("ADD"),
|
|
905
1013
|
variantId: IdSchema,
|
|
906
1014
|
quantity: qty
|
|
907
1015
|
}),
|
|
908
|
-
|
|
909
|
-
kind:
|
|
1016
|
+
z6.strictObject({
|
|
1017
|
+
kind: z6.literal("REPLACE"),
|
|
910
1018
|
lineId: IdSchema,
|
|
911
1019
|
variantId: IdSchema,
|
|
912
1020
|
quantity: qty
|
|
@@ -918,13 +1026,13 @@ var CommerceProposalSchema = z5.strictObject({
|
|
|
918
1026
|
v.operations.flatMap((o) => o.kind === "REPLACE" ? [o.lineId] : [])
|
|
919
1027
|
)
|
|
920
1028
|
);
|
|
921
|
-
var CommerceBasketSchema =
|
|
1029
|
+
var CommerceBasketSchema = z6.strictObject({
|
|
922
1030
|
basketId: IdSchema,
|
|
923
|
-
source:
|
|
1031
|
+
source: z6.enum(["RECOVERY_SNAPSHOT", "PROPOSED"]),
|
|
924
1032
|
observedAt: DateSchema,
|
|
925
1033
|
currency: CurrencySchema.nullable(),
|
|
926
|
-
lines:
|
|
927
|
-
|
|
1034
|
+
lines: z6.array(
|
|
1035
|
+
z6.strictObject({
|
|
928
1036
|
lineId: IdSchema,
|
|
929
1037
|
productId: IdSchema.nullable(),
|
|
930
1038
|
variantId: IdSchema.nullable(),
|
|
@@ -933,35 +1041,35 @@ var CommerceBasketSchema = z5.strictObject({
|
|
|
933
1041
|
})
|
|
934
1042
|
).max(100),
|
|
935
1043
|
fingerprint: HashSchema,
|
|
936
|
-
unknownFields:
|
|
1044
|
+
unknownFields: z6.array(z6.string().min(1).max(256)).max(128)
|
|
937
1045
|
}).refine((v) => distinct(v.lines.map((line) => line.lineId)));
|
|
938
|
-
var CommerceProductSaleEvidenceSchema =
|
|
1046
|
+
var CommerceProductSaleEvidenceSchema = z6.strictObject({
|
|
939
1047
|
regularPrice: MoneySchema.nullable(),
|
|
940
1048
|
salePrice: MoneySchema.nullable(),
|
|
941
1049
|
observedAt: DateSchema
|
|
942
1050
|
});
|
|
943
|
-
var CommerceProductSchema =
|
|
1051
|
+
var CommerceProductSchema = z6.strictObject({
|
|
944
1052
|
productId: IdSchema,
|
|
945
1053
|
variantId: IdSchema.nullable(),
|
|
946
|
-
title:
|
|
947
|
-
url:
|
|
1054
|
+
title: z6.string().min(1).max(512),
|
|
1055
|
+
url: z6.url({ protocol: /^https$/ }).refine((v) => {
|
|
948
1056
|
const u = new URL(v);
|
|
949
1057
|
return !u.username && !u.password && !u.port;
|
|
950
1058
|
}).nullable(),
|
|
951
|
-
available:
|
|
1059
|
+
available: z6.boolean().nullable(),
|
|
952
1060
|
unitPrice: MoneySchema.nullable(),
|
|
953
1061
|
currency: CurrencySchema.nullable(),
|
|
954
|
-
productType:
|
|
955
|
-
vendor:
|
|
956
|
-
categories:
|
|
957
|
-
categoryIds:
|
|
958
|
-
collectionIds:
|
|
959
|
-
imageUrl:
|
|
1062
|
+
productType: z6.string().max(512).nullable(),
|
|
1063
|
+
vendor: z6.string().max(512).nullable(),
|
|
1064
|
+
categories: z6.array(z6.string()).optional(),
|
|
1065
|
+
categoryIds: z6.array(IdSchema).max(128).optional(),
|
|
1066
|
+
collectionIds: z6.array(IdSchema).max(128).optional(),
|
|
1067
|
+
imageUrl: z6.string().nullable().optional(),
|
|
960
1068
|
saleEvidence: CommerceProductSaleEvidenceSchema.nullable().optional(),
|
|
961
1069
|
observedAt: DateSchema
|
|
962
1070
|
});
|
|
963
1071
|
var discountUtcPattern = /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.[0-9]+)?Z(?![\s\S])/;
|
|
964
|
-
var CommerceDiscountDateTimeSchema =
|
|
1072
|
+
var CommerceDiscountDateTimeSchema = z6.string().regex(discountUtcPattern).refine((value) => {
|
|
965
1073
|
const match = discountUtcPattern.exec(value);
|
|
966
1074
|
if (!match) return false;
|
|
967
1075
|
const [year, month, day, hour, minute, second] = match.slice(1).map(Number);
|
|
@@ -970,36 +1078,36 @@ var CommerceDiscountDateTimeSchema = z5.string().regex(discountUtcPattern).refin
|
|
|
970
1078
|
const daysInMonth = [31, leapYear ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
971
1079
|
return day >= 1 && day <= daysInMonth[month - 1];
|
|
972
1080
|
}, "Expected a valid UTC discount timestamp with seconds");
|
|
973
|
-
var CommerceOfferSchema =
|
|
1081
|
+
var CommerceOfferSchema = z6.strictObject({
|
|
974
1082
|
offerId: IdSchema,
|
|
975
|
-
title:
|
|
976
|
-
method:
|
|
977
|
-
code:
|
|
1083
|
+
title: z6.string().min(1).max(512),
|
|
1084
|
+
method: z6.enum(["AUTOMATIC", "CODE"]),
|
|
1085
|
+
code: z6.string().min(1).max(128).nullable(),
|
|
978
1086
|
startsAt: CommerceDiscountDateTimeSchema.nullable(),
|
|
979
1087
|
endsAt: CommerceDiscountDateTimeSchema.nullable(),
|
|
980
|
-
support:
|
|
981
|
-
reasonCodes:
|
|
1088
|
+
support: z6.enum(["SUPPORTED", "UNSUPPORTED", "UNKNOWN"]),
|
|
1089
|
+
reasonCodes: z6.array(z6.string().min(1).max(64)).max(16)
|
|
982
1090
|
}).refine(
|
|
983
1091
|
(v) => (v.startsAt === null || v.endsAt === null || Date.parse(v.startsAt) < Date.parse(v.endsAt)) && (v.method !== "AUTOMATIC" || v.code === null)
|
|
984
1092
|
);
|
|
985
|
-
var CommerceDiscountCombinationFactsSchema =
|
|
986
|
-
discountClasses:
|
|
987
|
-
shopifyPlus:
|
|
988
|
-
combinesWith:
|
|
989
|
-
orderDiscounts:
|
|
990
|
-
productDiscounts:
|
|
991
|
-
shippingDiscounts:
|
|
1093
|
+
var CommerceDiscountCombinationFactsSchema = z6.strictObject({
|
|
1094
|
+
discountClasses: z6.array(z6.enum(["ORDER", "PRODUCT", "SHIPPING"])).max(3).nullable(),
|
|
1095
|
+
shopifyPlus: z6.boolean().nullable(),
|
|
1096
|
+
combinesWith: z6.strictObject({
|
|
1097
|
+
orderDiscounts: z6.boolean().nullable(),
|
|
1098
|
+
productDiscounts: z6.boolean().nullable(),
|
|
1099
|
+
shippingDiscounts: z6.boolean().nullable()
|
|
992
1100
|
}).nullable(),
|
|
993
|
-
discountTags:
|
|
994
|
-
allowedSameLineProductTags:
|
|
1101
|
+
discountTags: z6.array(z6.string().min(1).max(128)).max(64).nullable(),
|
|
1102
|
+
allowedSameLineProductTags: z6.array(z6.string().min(1).max(128)).max(64).nullable()
|
|
995
1103
|
});
|
|
996
|
-
var CommerceDiscountConditionFactsSchema =
|
|
997
|
-
provider:
|
|
998
|
-
completeness:
|
|
1104
|
+
var CommerceDiscountConditionFactsSchema = z6.strictObject({
|
|
1105
|
+
provider: z6.enum(["SHOPIFY", "WOOCOMMERCE"]),
|
|
1106
|
+
completeness: z6.enum(["COMPLETE", "PARTIAL", "UNKNOWN"]),
|
|
999
1107
|
observedAt: CommerceDiscountDateTimeSchema,
|
|
1000
|
-
providerStatus:
|
|
1108
|
+
providerStatus: z6.string().max(64),
|
|
1001
1109
|
unavailableAt: CommerceDiscountDateTimeSchema.nullable(),
|
|
1002
|
-
discountKind:
|
|
1110
|
+
discountKind: z6.enum([
|
|
1003
1111
|
"PERCENTAGE",
|
|
1004
1112
|
"FIXED_AMOUNT",
|
|
1005
1113
|
"FREE_SHIPPING",
|
|
@@ -1009,8 +1117,8 @@ var CommerceDiscountConditionFactsSchema = z5.strictObject({
|
|
|
1009
1117
|
]),
|
|
1010
1118
|
discountValue: MoneySchema.nullable(),
|
|
1011
1119
|
discountCurrency: CurrencySchema.nullable(),
|
|
1012
|
-
targeting:
|
|
1013
|
-
kind:
|
|
1120
|
+
targeting: z6.strictObject({
|
|
1121
|
+
kind: z6.enum([
|
|
1014
1122
|
"ALL",
|
|
1015
1123
|
"PRODUCTS",
|
|
1016
1124
|
"VARIANTS",
|
|
@@ -1019,38 +1127,38 @@ var CommerceDiscountConditionFactsSchema = z5.strictObject({
|
|
|
1019
1127
|
"MIXED",
|
|
1020
1128
|
"UNKNOWN"
|
|
1021
1129
|
]),
|
|
1022
|
-
includedProductIds:
|
|
1023
|
-
includedVariantIds:
|
|
1024
|
-
includedCategoryIds:
|
|
1025
|
-
includedCollectionIds:
|
|
1026
|
-
excludedProductIds:
|
|
1027
|
-
excludedVariantIds:
|
|
1028
|
-
excludedCategoryIds:
|
|
1029
|
-
excludedCollectionIds:
|
|
1130
|
+
includedProductIds: z6.array(IdSchema).max(128),
|
|
1131
|
+
includedVariantIds: z6.array(IdSchema).max(128),
|
|
1132
|
+
includedCategoryIds: z6.array(IdSchema).max(128),
|
|
1133
|
+
includedCollectionIds: z6.array(IdSchema).max(128),
|
|
1134
|
+
excludedProductIds: z6.array(IdSchema).max(128),
|
|
1135
|
+
excludedVariantIds: z6.array(IdSchema).max(128),
|
|
1136
|
+
excludedCategoryIds: z6.array(IdSchema).max(128),
|
|
1137
|
+
excludedCollectionIds: z6.array(IdSchema).max(128)
|
|
1030
1138
|
}),
|
|
1031
1139
|
minimumSubtotal: MoneySchema.nullable(),
|
|
1032
1140
|
maximumSubtotal: MoneySchema.nullable(),
|
|
1033
1141
|
subtotalRequirementCurrency: CurrencySchema.nullable(),
|
|
1034
|
-
minimumQuantity:
|
|
1035
|
-
usageLimit:
|
|
1036
|
-
usageCount:
|
|
1037
|
-
perCustomerLimit:
|
|
1038
|
-
customerScope:
|
|
1039
|
-
excludesSaleItems:
|
|
1040
|
-
individualUse:
|
|
1142
|
+
minimumQuantity: z6.number().int().nonnegative().nullable(),
|
|
1143
|
+
usageLimit: z6.number().int().nonnegative().nullable(),
|
|
1144
|
+
usageCount: z6.number().int().nonnegative().nullable(),
|
|
1145
|
+
perCustomerLimit: z6.number().int().nonnegative().nullable(),
|
|
1146
|
+
customerScope: z6.enum(["ALL", "RESTRICTED", "UNKNOWN"]),
|
|
1147
|
+
excludesSaleItems: z6.boolean().nullable(),
|
|
1148
|
+
individualUse: z6.boolean().nullable(),
|
|
1041
1149
|
combination: CommerceDiscountCombinationFactsSchema,
|
|
1042
|
-
unrepresentedConditions:
|
|
1150
|
+
unrepresentedConditions: z6.array(z6.string().min(1).max(128)).max(24)
|
|
1043
1151
|
});
|
|
1044
|
-
var CommerceDiscountDetailsSchema =
|
|
1152
|
+
var CommerceDiscountDetailsSchema = z6.strictObject({
|
|
1045
1153
|
offer: CommerceOfferSchema,
|
|
1046
1154
|
facts: CommerceDiscountConditionFactsSchema,
|
|
1047
|
-
providerDiscountId:
|
|
1155
|
+
providerDiscountId: z6.string().min(1).max(191).nullable()
|
|
1048
1156
|
});
|
|
1049
|
-
var condition =
|
|
1050
|
-
code:
|
|
1051
|
-
description:
|
|
1157
|
+
var condition = z6.strictObject({
|
|
1158
|
+
code: z6.string().min(1).max(64),
|
|
1159
|
+
description: z6.string().max(256)
|
|
1052
1160
|
});
|
|
1053
|
-
var CommerceEvidenceSchema =
|
|
1161
|
+
var CommerceEvidenceSchema = z6.strictObject({
|
|
1054
1162
|
evidenceId: HashSchema,
|
|
1055
1163
|
turn: CommerceTurnIdentitySchema,
|
|
1056
1164
|
grantId: IdSchema,
|
|
@@ -1061,7 +1169,7 @@ var CommerceEvidenceSchema = z5.strictObject({
|
|
|
1061
1169
|
ruleFingerprint: HashSchema,
|
|
1062
1170
|
evaluatedAt: DateSchema,
|
|
1063
1171
|
expiresAt: DateSchema,
|
|
1064
|
-
outcome:
|
|
1172
|
+
outcome: z6.enum([
|
|
1065
1173
|
"QUALIFIES_FOR_KNOWN_RULES",
|
|
1066
1174
|
"DOES_NOT_QUALIFY",
|
|
1067
1175
|
"UNKNOWN",
|
|
@@ -1070,8 +1178,8 @@ var CommerceEvidenceSchema = z5.strictObject({
|
|
|
1070
1178
|
currency: CurrencySchema.nullable(),
|
|
1071
1179
|
savings: MoneySchema.nullable(),
|
|
1072
1180
|
resultingTotal: MoneySchema.nullable(),
|
|
1073
|
-
evaluatedConditions:
|
|
1074
|
-
unresolvedConditions:
|
|
1181
|
+
evaluatedConditions: z6.array(condition).max(32),
|
|
1182
|
+
unresolvedConditions: z6.array(condition).max(32)
|
|
1075
1183
|
}).superRefine((v, c) => {
|
|
1076
1184
|
if (Date.parse(v.expiresAt) - Date.parse(v.evaluatedAt) > 6e4)
|
|
1077
1185
|
c.addIssue({
|
|
@@ -1081,16 +1189,16 @@ var CommerceEvidenceSchema = z5.strictObject({
|
|
|
1081
1189
|
if (v.outcome === "QUALIFIES_FOR_KNOWN_RULES" && (v.unresolvedConditions.length || Date.parse(v.expiresAt) <= Date.parse(v.evaluatedAt) || v.currency === null || v.savings === null || v.resultingTotal === null))
|
|
1082
1190
|
c.addIssue({ code: "custom", message: "Unsupported qualifying claim" });
|
|
1083
1191
|
});
|
|
1084
|
-
var CommerceAlternativeSchema =
|
|
1192
|
+
var CommerceAlternativeSchema = z6.strictObject({
|
|
1085
1193
|
product: CommerceProductSchema,
|
|
1086
1194
|
proposal: CommerceProposalSchema,
|
|
1087
1195
|
extraSpend: MoneySchema.nullable(),
|
|
1088
1196
|
resultingTotal: MoneySchema.nullable(),
|
|
1089
1197
|
currency: CurrencySchema.nullable(),
|
|
1090
1198
|
evidence: CommerceEvidenceSchema.nullable(),
|
|
1091
|
-
similarityReasons:
|
|
1199
|
+
similarityReasons: z6.array(z6.string().max(256)).max(3)
|
|
1092
1200
|
}).refine((v) => v.product.available === true);
|
|
1093
|
-
var CommerceErrorCodeSchema =
|
|
1201
|
+
var CommerceErrorCodeSchema = z6.enum([
|
|
1094
1202
|
"INVALID_INPUT",
|
|
1095
1203
|
"DENIED",
|
|
1096
1204
|
"STALE_TURN",
|
|
@@ -1101,182 +1209,182 @@ var CommerceErrorCodeSchema = z5.enum([
|
|
|
1101
1209
|
"INCOMPATIBLE_VERSION"
|
|
1102
1210
|
]);
|
|
1103
1211
|
function commerceToolResultSchema(data) {
|
|
1104
|
-
return
|
|
1105
|
-
|
|
1212
|
+
return z6.union([
|
|
1213
|
+
z6.strictObject({
|
|
1106
1214
|
contractVersion: ContractVersionSchema,
|
|
1107
|
-
status:
|
|
1215
|
+
status: z6.literal("OK"),
|
|
1108
1216
|
data,
|
|
1109
|
-
renderedText:
|
|
1217
|
+
renderedText: z6.string().max(4096)
|
|
1110
1218
|
}),
|
|
1111
|
-
|
|
1219
|
+
z6.strictObject({
|
|
1112
1220
|
contractVersion: ContractVersionSchema,
|
|
1113
|
-
status:
|
|
1221
|
+
status: z6.literal("ERROR"),
|
|
1114
1222
|
code: CommerceErrorCodeSchema,
|
|
1115
|
-
retryable:
|
|
1116
|
-
renderedText:
|
|
1223
|
+
retryable: z6.boolean(),
|
|
1224
|
+
renderedText: z6.string().max(4096).optional()
|
|
1117
1225
|
})
|
|
1118
1226
|
]);
|
|
1119
1227
|
}
|
|
1120
1228
|
var CommerceToolResultSchema = commerceToolResultSchema(
|
|
1121
1229
|
boundedJson(262144)
|
|
1122
1230
|
);
|
|
1123
|
-
var wireId =
|
|
1124
|
-
var taxonomySource =
|
|
1125
|
-
var CommerceCategoryCandidateSchema =
|
|
1231
|
+
var wireId = z6.string().min(1).max(128);
|
|
1232
|
+
var taxonomySource = z6.enum(["SHOPIFY_STANDARD_PRODUCT_TAXONOMY"]).meta({ maxLength: 33 });
|
|
1233
|
+
var CommerceCategoryCandidateSchema = z6.strictObject({
|
|
1126
1234
|
categoryId: wireId,
|
|
1127
|
-
name:
|
|
1128
|
-
fullName:
|
|
1235
|
+
name: z6.string().min(1).max(512),
|
|
1236
|
+
fullName: z6.string().min(1).max(4096),
|
|
1129
1237
|
parentId: wireId.nullable(),
|
|
1130
|
-
level:
|
|
1131
|
-
ancestorIds:
|
|
1132
|
-
distance:
|
|
1238
|
+
level: z6.number().int().min(0).max(32),
|
|
1239
|
+
ancestorIds: z6.array(wireId).max(32),
|
|
1240
|
+
distance: z6.number().min(0).max(2)
|
|
1133
1241
|
});
|
|
1134
|
-
var CommerceCategoryResolutionSchema =
|
|
1135
|
-
|
|
1136
|
-
outcome:
|
|
1242
|
+
var CommerceCategoryResolutionSchema = z6.union([
|
|
1243
|
+
z6.strictObject({
|
|
1244
|
+
outcome: z6.enum(["CANDIDATES", "NO_CANDIDATES"]).meta({ maxLength: 13 }),
|
|
1137
1245
|
generationId: wireId,
|
|
1138
1246
|
source: taxonomySource,
|
|
1139
|
-
taxonomyVersion:
|
|
1140
|
-
languageTag:
|
|
1141
|
-
candidates:
|
|
1247
|
+
taxonomyVersion: z6.string().min(1).max(64),
|
|
1248
|
+
languageTag: z6.string().min(1).max(35),
|
|
1249
|
+
candidates: z6.array(CommerceCategoryCandidateSchema).max(10)
|
|
1142
1250
|
}),
|
|
1143
|
-
|
|
1144
|
-
outcome:
|
|
1145
|
-
reasonCode:
|
|
1251
|
+
z6.strictObject({
|
|
1252
|
+
outcome: z6.enum(["UNAVAILABLE"]).meta({ maxLength: 11 }),
|
|
1253
|
+
reasonCode: z6.enum(["NOT_READY", "TEMPORARY_UNAVAILABLE"]).meta({ maxLength: 21 })
|
|
1146
1254
|
})
|
|
1147
1255
|
]);
|
|
1148
|
-
var CommerceOptionalLookupUnavailableSchema =
|
|
1149
|
-
outcome:
|
|
1150
|
-
reasonCode:
|
|
1256
|
+
var CommerceOptionalLookupUnavailableSchema = z6.strictObject({
|
|
1257
|
+
outcome: z6.enum(["UNAVAILABLE"]).meta({ maxLength: 11 }),
|
|
1258
|
+
reasonCode: z6.enum(["TEMPORARY_UNAVAILABLE"]).meta({ maxLength: 21 })
|
|
1151
1259
|
});
|
|
1152
|
-
var CommerceProductRecommendationSelectionSchema =
|
|
1153
|
-
productRecommendationVersion:
|
|
1154
|
-
productRecommendations:
|
|
1155
|
-
scope:
|
|
1260
|
+
var CommerceProductRecommendationSelectionSchema = z6.strictObject({
|
|
1261
|
+
productRecommendationVersion: z6.enum(["1"]).meta({ maxLength: 1 }).optional(),
|
|
1262
|
+
productRecommendations: z6.array(z6.strictObject({
|
|
1263
|
+
scope: z6.enum(["PRODUCT_ONLY", "ADD_TO_BASKET", "REPLACE_BASKET_LINE"]).meta({ maxLength: 19 }),
|
|
1156
1264
|
basketLineId: wireId.nullable(),
|
|
1157
1265
|
productId: wireId,
|
|
1158
1266
|
variantId: wireId.nullable(),
|
|
1159
|
-
quantity:
|
|
1160
|
-
promotionKind:
|
|
1161
|
-
offerIds:
|
|
1267
|
+
quantity: z6.number().int().min(1).max(99),
|
|
1268
|
+
promotionKind: z6.enum(["NONE", "NATIVE_SALE", "DISCOUNT"]).meta({ maxLength: 11 }),
|
|
1269
|
+
offerIds: z6.array(wireId).max(3)
|
|
1162
1270
|
})).min(1).max(3).optional()
|
|
1163
1271
|
});
|
|
1164
|
-
var CommerceResponseDispositionSchema =
|
|
1272
|
+
var CommerceResponseDispositionSchema = z6.enum([
|
|
1165
1273
|
"STANDARD",
|
|
1166
1274
|
"OUT_OF_SCOPE_REDIRECT",
|
|
1167
1275
|
"SHIPPING_INFORMATION_UNVERIFIED"
|
|
1168
1276
|
]).meta({ maxLength: 31 });
|
|
1169
|
-
var CommerceAnswerPresentationSelectionSchema =
|
|
1277
|
+
var CommerceAnswerPresentationSelectionSchema = z6.strictObject({
|
|
1170
1278
|
responseDisposition: CommerceResponseDispositionSchema.optional(),
|
|
1171
|
-
shippingInformationSelection:
|
|
1279
|
+
shippingInformationSelection: z6.strictObject({
|
|
1172
1280
|
productId: wireId.nullable(),
|
|
1173
1281
|
variantId: wireId.nullable()
|
|
1174
1282
|
}).optional()
|
|
1175
1283
|
});
|
|
1176
|
-
var CommerceShippingInformationInputSchema =
|
|
1284
|
+
var CommerceShippingInformationInputSchema = z6.strictObject({
|
|
1177
1285
|
productId: wireId.nullable().default(null),
|
|
1178
1286
|
variantId: wireId.nullable().default(null)
|
|
1179
1287
|
});
|
|
1180
|
-
var CommerceShippingInformationSchema =
|
|
1181
|
-
provider:
|
|
1288
|
+
var CommerceShippingInformationSchema = z6.strictObject({
|
|
1289
|
+
provider: z6.enum(["SHOPIFY", "WOOCOMMERCE"]).meta({ maxLength: 11 }),
|
|
1182
1290
|
observedAt: DateSchema,
|
|
1183
|
-
product:
|
|
1184
|
-
status:
|
|
1291
|
+
product: z6.strictObject({
|
|
1292
|
+
status: z6.enum(["NOT_REQUESTED", "VARIANT_REQUIRED", "AVAILABLE"]).meta({ maxLength: 16 }),
|
|
1185
1293
|
productId: wireId.nullable(),
|
|
1186
1294
|
variantId: wireId.nullable(),
|
|
1187
|
-
requiresShipping:
|
|
1188
|
-
virtual:
|
|
1189
|
-
weight:
|
|
1190
|
-
value:
|
|
1191
|
-
unit:
|
|
1295
|
+
requiresShipping: z6.boolean().nullable(),
|
|
1296
|
+
virtual: z6.boolean().nullable(),
|
|
1297
|
+
weight: z6.strictObject({
|
|
1298
|
+
value: z6.number().min(0),
|
|
1299
|
+
unit: z6.enum(["GRAMS", "KILOGRAMS", "OUNCES", "POUNDS"]).meta({ maxLength: 9 }).nullable()
|
|
1192
1300
|
}).nullable(),
|
|
1193
|
-
dimensions:
|
|
1194
|
-
length:
|
|
1195
|
-
width:
|
|
1196
|
-
height:
|
|
1197
|
-
unit:
|
|
1301
|
+
dimensions: z6.strictObject({
|
|
1302
|
+
length: z6.number().min(0).nullable(),
|
|
1303
|
+
width: z6.number().min(0).nullable(),
|
|
1304
|
+
height: z6.number().min(0).nullable(),
|
|
1305
|
+
unit: z6.string().min(1).max(16).nullable()
|
|
1198
1306
|
}).nullable(),
|
|
1199
1307
|
shippingClassId: wireId.nullable(),
|
|
1200
|
-
shippingClassSlug:
|
|
1308
|
+
shippingClassSlug: z6.string().min(1).max(512).nullable()
|
|
1201
1309
|
}),
|
|
1202
|
-
policy:
|
|
1203
|
-
status:
|
|
1204
|
-
trust:
|
|
1205
|
-
title:
|
|
1206
|
-
bodyStatus:
|
|
1207
|
-
bodyHtml:
|
|
1208
|
-
url:
|
|
1310
|
+
policy: z6.strictObject({
|
|
1311
|
+
status: z6.enum(["AVAILABLE", "NOT_CONFIGURED", "SCOPE_NOT_GRANTED", "UNSUPPORTED"]).meta({ maxLength: 17 }),
|
|
1312
|
+
trust: z6.enum(["UNTRUSTED_REFERENCE"]).meta({ maxLength: 19 }),
|
|
1313
|
+
title: z6.string().min(1).max(512).nullable(),
|
|
1314
|
+
bodyStatus: z6.enum(["AVAILABLE", "EMPTY", "TOO_LARGE", "NOT_AVAILABLE"]).meta({ maxLength: 13 }),
|
|
1315
|
+
bodyHtml: z6.string().min(1).max(8e3).nullable(),
|
|
1316
|
+
url: z6.url({ protocol: /^https$/ }).min(1).max(2048).nullable(),
|
|
1209
1317
|
updatedAt: DateSchema.nullable()
|
|
1210
1318
|
})
|
|
1211
1319
|
});
|
|
1212
|
-
var limit =
|
|
1320
|
+
var limit = z6.number().int().min(1).max(3).default(3);
|
|
1213
1321
|
var CommerceToolInputs = {
|
|
1214
|
-
commerce_resolve_product_categories:
|
|
1215
|
-
query:
|
|
1216
|
-
limit:
|
|
1322
|
+
commerce_resolve_product_categories: z6.strictObject({
|
|
1323
|
+
query: z6.string().min(1).max(200),
|
|
1324
|
+
limit: z6.number().int().min(1).max(10).default(5)
|
|
1217
1325
|
}),
|
|
1218
1326
|
commerce_get_shipping_information: CommerceShippingInformationInputSchema,
|
|
1219
|
-
commerce_get_basket:
|
|
1220
|
-
commerce_search_products:
|
|
1221
|
-
query:
|
|
1222
|
-
category:
|
|
1223
|
-
system:
|
|
1327
|
+
commerce_get_basket: z6.strictObject({}),
|
|
1328
|
+
commerce_search_products: z6.strictObject({
|
|
1329
|
+
query: z6.string().min(1).max(200).nullable().default(null),
|
|
1330
|
+
category: z6.strictObject({
|
|
1331
|
+
system: z6.enum(["SHOPIFY_STANDARD_PRODUCT_TAXONOMY", "WOOCOMMERCE_PRODUCT_CATEGORY"]).meta({ maxLength: 33 }),
|
|
1224
1332
|
id: wireId,
|
|
1225
|
-
taxonomyVersion:
|
|
1333
|
+
taxonomyVersion: z6.string().min(1).max(64).nullable()
|
|
1226
1334
|
}).optional(),
|
|
1227
|
-
browse:
|
|
1335
|
+
browse: z6.boolean().default(false),
|
|
1228
1336
|
maximumPrice: MoneySchema.optional(),
|
|
1229
|
-
availableOnly:
|
|
1230
|
-
limit:
|
|
1231
|
-
cursor:
|
|
1337
|
+
availableOnly: z6.boolean().default(true),
|
|
1338
|
+
limit: z6.number().int().min(1).max(20).default(10),
|
|
1339
|
+
cursor: z6.string().max(2048).nullable().default(null)
|
|
1232
1340
|
}),
|
|
1233
|
-
commerce_get_product:
|
|
1341
|
+
commerce_get_product: z6.strictObject({
|
|
1234
1342
|
productId: IdSchema,
|
|
1235
1343
|
variantId: IdSchema.nullable()
|
|
1236
1344
|
}),
|
|
1237
|
-
commerce_get_discount_options:
|
|
1238
|
-
limit:
|
|
1239
|
-
cursor:
|
|
1345
|
+
commerce_get_discount_options: z6.strictObject({
|
|
1346
|
+
limit: z6.number().int().min(1).max(50).default(20),
|
|
1347
|
+
cursor: z6.string().max(2048).nullable().default(null)
|
|
1240
1348
|
}),
|
|
1241
|
-
commerce_get_discount_details:
|
|
1242
|
-
commerce_evaluate_discount:
|
|
1349
|
+
commerce_get_discount_details: z6.strictObject({ offerId: IdSchema }),
|
|
1350
|
+
commerce_evaluate_discount: z6.strictObject({
|
|
1243
1351
|
offerId: IdSchema,
|
|
1244
1352
|
proposal: CommerceProposalSchema.nullable()
|
|
1245
1353
|
}),
|
|
1246
|
-
commerce_find_qualifying_products:
|
|
1354
|
+
commerce_find_qualifying_products: z6.strictObject({
|
|
1247
1355
|
offerId: IdSchema,
|
|
1248
|
-
query:
|
|
1356
|
+
query: z6.string().min(1).max(200).nullable(),
|
|
1249
1357
|
limit
|
|
1250
1358
|
}),
|
|
1251
|
-
commerce_find_similar_products:
|
|
1359
|
+
commerce_find_similar_products: z6.strictObject({
|
|
1252
1360
|
variantId: IdSchema,
|
|
1253
1361
|
offerId: IdSchema.nullable(),
|
|
1254
1362
|
limit
|
|
1255
1363
|
})
|
|
1256
1364
|
};
|
|
1257
|
-
var alternatives =
|
|
1258
|
-
alternatives:
|
|
1259
|
-
truncated:
|
|
1365
|
+
var alternatives = z6.strictObject({
|
|
1366
|
+
alternatives: z6.array(CommerceAlternativeSchema).max(3),
|
|
1367
|
+
truncated: z6.boolean()
|
|
1260
1368
|
});
|
|
1261
1369
|
var CommerceToolOutputs = {
|
|
1262
1370
|
commerce_resolve_product_categories: CommerceCategoryResolutionSchema,
|
|
1263
1371
|
commerce_get_shipping_information: CommerceShippingInformationSchema,
|
|
1264
1372
|
commerce_get_basket: CommerceBasketSchema,
|
|
1265
|
-
commerce_search_products:
|
|
1266
|
-
products:
|
|
1267
|
-
cursor:
|
|
1268
|
-
truncated:
|
|
1373
|
+
commerce_search_products: z6.strictObject({
|
|
1374
|
+
products: z6.array(CommerceProductSchema).max(20),
|
|
1375
|
+
cursor: z6.string().max(2048).nullable(),
|
|
1376
|
+
truncated: z6.boolean()
|
|
1269
1377
|
}),
|
|
1270
|
-
commerce_get_product:
|
|
1378
|
+
commerce_get_product: z6.strictObject({
|
|
1271
1379
|
product: CommerceProductSchema.nullable()
|
|
1272
1380
|
}),
|
|
1273
|
-
commerce_get_discount_options:
|
|
1274
|
-
mode:
|
|
1275
|
-
offers:
|
|
1276
|
-
truncated:
|
|
1277
|
-
cursor:
|
|
1381
|
+
commerce_get_discount_options: z6.union([CommerceOptionalLookupUnavailableSchema, z6.strictObject({
|
|
1382
|
+
mode: z6.enum(["NONE", "FIXED", "AI_BEST_APPLICABLE"]),
|
|
1383
|
+
offers: z6.array(CommerceOfferSchema).max(50),
|
|
1384
|
+
truncated: z6.boolean(),
|
|
1385
|
+
cursor: z6.string().max(2048).nullable().optional()
|
|
1278
1386
|
})]),
|
|
1279
|
-
commerce_get_discount_details:
|
|
1387
|
+
commerce_get_discount_details: z6.union([CommerceOptionalLookupUnavailableSchema, z6.strictObject({
|
|
1280
1388
|
details: CommerceDiscountDetailsSchema.nullable()
|
|
1281
1389
|
})]),
|
|
1282
1390
|
commerce_evaluate_discount: CommerceEvidenceSchema,
|
|
@@ -1300,6 +1408,9 @@ export {
|
|
|
1300
1408
|
DetailsSchemaSchema,
|
|
1301
1409
|
matchesSubset,
|
|
1302
1410
|
compileSubset,
|
|
1411
|
+
validateCommercePurposeOutputSchema,
|
|
1412
|
+
CommercePurposeOutputSchemaSchema,
|
|
1413
|
+
compileCommercePurposeOutputSchema,
|
|
1303
1414
|
ExternalQueryValueSchema,
|
|
1304
1415
|
ExternalQueryMappingSchema,
|
|
1305
1416
|
ExternalQueryMappingsSchema,
|
|
@@ -1388,4 +1499,4 @@ export {
|
|
|
1388
1499
|
CommerceToolOutputs,
|
|
1389
1500
|
productBelongsToDomain
|
|
1390
1501
|
};
|
|
1391
|
-
//# sourceMappingURL=chunk-
|
|
1502
|
+
//# sourceMappingURL=chunk-BDGLKOCW.js.map
|