@omnixhq/ucp-js-sdk 1.1.0 → 2.0.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/README.md +5 -6
- package/dist/index.cjs +1711 -390
- package/dist/index.d.cts +11484 -5382
- package/dist/index.d.mts +11484 -5382
- package/dist/index.mjs +1675 -388
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -30,56 +30,124 @@ const CapabilityBaseSchema = zod.intersection(zod.object({
|
|
|
30
30
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
31
31
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
32
32
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
33
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
33
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
34
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
35
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
36
|
+
const passed = schemas.length - errors.length;
|
|
37
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
38
|
+
path: ctx.path,
|
|
39
|
+
code: "invalid_union",
|
|
40
|
+
unionErrors: errors,
|
|
41
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
42
|
+
} : {
|
|
43
|
+
path: ctx.path,
|
|
44
|
+
code: "custom",
|
|
45
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
46
|
+
});
|
|
47
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() }));
|
|
34
48
|
const CapabilityPlatformSchema = zod.intersection(zod.intersection(zod.object({
|
|
35
49
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
36
50
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
37
51
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
38
52
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
39
53
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
40
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
54
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
55
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
56
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
57
|
+
const passed = schemas.length - errors.length;
|
|
58
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
59
|
+
path: ctx.path,
|
|
60
|
+
code: "invalid_union",
|
|
61
|
+
unionErrors: errors,
|
|
62
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
63
|
+
} : {
|
|
64
|
+
path: ctx.path,
|
|
65
|
+
code: "custom",
|
|
66
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
67
|
+
});
|
|
68
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })), zod.record(zod.string(), zod.unknown())).describe("Full capability declaration for platform-level discovery. Includes spec/schema URLs for agent fetching.");
|
|
41
69
|
const CapabilityBusinessSchema = zod.intersection(zod.object({
|
|
42
70
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
43
71
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
44
72
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
45
73
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
46
74
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
47
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
75
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
76
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
77
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
78
|
+
const passed = schemas.length - errors.length;
|
|
79
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
80
|
+
path: ctx.path,
|
|
81
|
+
code: "invalid_union",
|
|
82
|
+
unionErrors: errors,
|
|
83
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
84
|
+
} : {
|
|
85
|
+
path: ctx.path,
|
|
86
|
+
code: "custom",
|
|
87
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
88
|
+
});
|
|
89
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })).describe("Capability configuration for business/merchant level. May include business-specific config overrides.");
|
|
48
90
|
const CapabilityResponseSchema = zod.intersection(zod.object({
|
|
49
91
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
50
92
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
51
93
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
52
94
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
53
95
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
54
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
96
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
97
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
98
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
99
|
+
const passed = schemas.length - errors.length;
|
|
100
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
101
|
+
path: ctx.path,
|
|
102
|
+
code: "invalid_union",
|
|
103
|
+
unionErrors: errors,
|
|
104
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
105
|
+
} : {
|
|
106
|
+
path: ctx.path,
|
|
107
|
+
code: "custom",
|
|
108
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
109
|
+
});
|
|
110
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })).describe("Capability reference in responses. Only name/version required to confirm active capabilities.");
|
|
55
111
|
const PaymentHandlerBaseSchema = zod.intersection(zod.object({
|
|
56
112
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
57
113
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
58
114
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
59
115
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
60
116
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
61
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
117
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
118
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
119
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
120
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() })));
|
|
62
121
|
const PaymentHandlerPlatformSchema = zod.intersection(zod.intersection(zod.object({
|
|
63
122
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
64
123
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
65
124
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
66
125
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
67
126
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
68
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
127
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
128
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
129
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
130
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))), zod.record(zod.string(), zod.unknown())).describe("Platform declaration for discovery profiles. May include partial config state required for discovery.");
|
|
69
131
|
const PaymentHandlerBusinessSchema = zod.intersection(zod.object({
|
|
70
132
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
71
133
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
72
134
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
73
135
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
74
136
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
75
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
137
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
138
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
139
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
140
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))).describe("Business declaration for discovery profiles. May include partial config state required for discovery.");
|
|
76
141
|
const PaymentHandlerResponseSchema = zod.intersection(zod.object({
|
|
77
142
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
78
143
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
79
144
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
80
145
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
81
146
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
82
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
147
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
148
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
149
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
150
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))).describe("Handler reference in responses. May include full config state for runtime usage of the handler.");
|
|
83
151
|
const ServiceBaseSchema = zod.intersection(zod.object({
|
|
84
152
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
85
153
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -114,7 +182,7 @@ const ServicePlatformSchema = zod.intersection(zod.intersection(zod.object({
|
|
|
114
182
|
zod.object({ "transport": zod.literal("mcp").optional() }),
|
|
115
183
|
zod.object({ "transport": zod.literal("a2a").optional() }),
|
|
116
184
|
zod.object({ "transport": zod.literal("embedded").optional() })
|
|
117
|
-
]))).describe("Full service declaration for platform-level discovery.
|
|
185
|
+
]))).describe("Full service declaration for platform-level discovery. All transports require `version`, `spec`, and `transport`. REST and MCP additionally require `schema` and `endpoint`; A2A requires `endpoint`; embedded requires `schema`.");
|
|
118
186
|
const ServiceBusinessSchema = zod.intersection(zod.intersection(zod.object({
|
|
119
187
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
120
188
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -135,7 +203,10 @@ const ServiceBusinessSchema = zod.intersection(zod.intersection(zod.object({
|
|
|
135
203
|
zod.object({ "transport": zod.literal("a2a").optional() }),
|
|
136
204
|
zod.object({
|
|
137
205
|
"transport": zod.literal("embedded").optional(),
|
|
138
|
-
"config": zod.object({
|
|
206
|
+
"config": zod.object({
|
|
207
|
+
"delegate": zod.array(zod.string()).describe("Delegations the business allows. At service-level, declares available delegations. In UCP responses, confirms accepted delegations for this session.").optional(),
|
|
208
|
+
"color_scheme": zod.array(zod.enum(["light", "dark"])).describe("Color schemes the business supports. Hosts use ec_color_scheme query parameter to request a scheme from this list.").optional()
|
|
209
|
+
}).describe("Per-session configuration for embedded transport binding. Allows businesses to vary EP availability and delegations based on cart contents, agent authorization, or policy.").optional()
|
|
139
210
|
})
|
|
140
211
|
])).describe("Service binding for business/merchant configuration. May override platform endpoints.");
|
|
141
212
|
const ServiceResponseSchema = zod.intersection(zod.intersection(zod.object({
|
|
@@ -158,7 +229,10 @@ const ServiceResponseSchema = zod.intersection(zod.intersection(zod.object({
|
|
|
158
229
|
zod.object({ "transport": zod.literal("a2a").optional() }),
|
|
159
230
|
zod.object({
|
|
160
231
|
"transport": zod.literal("embedded").optional(),
|
|
161
|
-
"config": zod.object({
|
|
232
|
+
"config": zod.object({
|
|
233
|
+
"delegate": zod.array(zod.string()).describe("Delegations the business allows. At service-level, declares available delegations. In UCP responses, confirms accepted delegations for this session.").optional(),
|
|
234
|
+
"color_scheme": zod.array(zod.enum(["light", "dark"])).describe("Color schemes the business supports. Hosts use ec_color_scheme query parameter to request a scheme from this list.").optional()
|
|
235
|
+
}).describe("Per-session configuration for embedded transport binding. Allows businesses to vary EP availability and delegations based on cart contents, agent authorization, or policy.").optional()
|
|
162
236
|
})
|
|
163
237
|
])).describe("Service binding in API responses. Includes per-resource transport configuration via typed config.");
|
|
164
238
|
const Ap2MandateMerchantAuthorizationSchema = zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Za-z0-9_-]+\\.\\.[A-Za-z0-9_-]+$")).describe("JWS Detached Content signature (RFC 7515 Appendix F) over the checkout response body (excluding ap2 field). Format: `<base64url-header>..<base64url-signature>`. The header MUST contain 'alg' (ES256/ES384/ES512) and 'kid' claims. The signature covers both the header and JCS-canonicalized checkout payload.");
|
|
@@ -191,9 +265,257 @@ const BuyerConsentBuyerSchema = zod.intersection(zod.object({
|
|
|
191
265
|
"marketing": zod.boolean().describe("Consent for marketing communications.").optional(),
|
|
192
266
|
"sale_of_data": zod.boolean().describe("Consent for selling data to third parties (CCPA).").optional()
|
|
193
267
|
}).describe("Consent tracking fields.").optional() })).describe("Buyer object extended with consent tracking.");
|
|
268
|
+
const CartSchema = zod.object({
|
|
269
|
+
"ucp": zod.intersection(zod.object({
|
|
270
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
271
|
+
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
272
|
+
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
273
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
274
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
275
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
276
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
277
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
278
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({
|
|
279
|
+
"transport": zod.enum([
|
|
280
|
+
"rest",
|
|
281
|
+
"mcp",
|
|
282
|
+
"a2a",
|
|
283
|
+
"embedded"
|
|
284
|
+
]).describe("Transport protocol for this service binding."),
|
|
285
|
+
"endpoint": zod.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
286
|
+
})))).describe("Service registry keyed by reverse-domain name.").optional(),
|
|
287
|
+
"capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
288
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
289
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
290
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
291
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
292
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
293
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
294
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
295
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
296
|
+
const passed = schemas.length - errors.length;
|
|
297
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
298
|
+
path: ctx.path,
|
|
299
|
+
code: "invalid_union",
|
|
300
|
+
unionErrors: errors,
|
|
301
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
302
|
+
} : {
|
|
303
|
+
path: ctx.path,
|
|
304
|
+
code: "custom",
|
|
305
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
306
|
+
});
|
|
307
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
308
|
+
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
309
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
310
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
311
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
312
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
313
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
314
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
315
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
316
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
317
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
318
|
+
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({ "capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
319
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
320
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
321
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
322
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
323
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
324
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
325
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
326
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
327
|
+
const passed = schemas.length - errors.length;
|
|
328
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
329
|
+
path: ctx.path,
|
|
330
|
+
code: "invalid_union",
|
|
331
|
+
unionErrors: errors,
|
|
332
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
333
|
+
} : {
|
|
334
|
+
path: ctx.path,
|
|
335
|
+
code: "custom",
|
|
336
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
337
|
+
});
|
|
338
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })).describe("Capability reference in responses. Only name/version required to confirm active capabilities."))).optional() })).describe("UCP metadata for cart responses. No payment handlers needed pre-checkout."),
|
|
339
|
+
"id": zod.string().describe("Unique cart identifier."),
|
|
340
|
+
"line_items": zod.array(zod.object({
|
|
341
|
+
"id": zod.string(),
|
|
342
|
+
"item": zod.object({
|
|
343
|
+
"id": zod.string().describe("The product identifier, often the SKU, required to resolve the product details associated with this line item. Should be recognized by both the Platform, and the Business."),
|
|
344
|
+
"title": zod.string().describe("Product title."),
|
|
345
|
+
"price": zod.number().int().gte(0).describe("Unit price in ISO 4217 minor units."),
|
|
346
|
+
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
347
|
+
}),
|
|
348
|
+
"quantity": zod.number().int().gte(1).describe("Quantity of the item being purchased."),
|
|
349
|
+
"totals": zod.array(zod.object({
|
|
350
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
351
|
+
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
352
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
353
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Line item totals breakdown."),
|
|
354
|
+
"parent_id": zod.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
355
|
+
}).describe("Line item object. Expected to use the currency of the parent object.")).describe("Cart line items. Same structure as checkout. Full replacement on update."),
|
|
356
|
+
"context": zod.object({
|
|
357
|
+
"address_country": zod.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used. Optional hint for market context (currency, availability, pricing)—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
358
|
+
"address_region": zod.string().describe("The region in which the locality is, and which is in the country. For example, California or another appropriate first-level Administrative division. Optional hint for progressive localization—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
359
|
+
"postal_code": zod.string().describe("The postal code. For example, 94043. Optional hint for regional refinement—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
360
|
+
"intent": zod.string().describe("Background context describing buyer's intent (e.g., 'looking for a gift under $50', 'need something durable for outdoor use'). Informs relevance, recommendations, and personalization.").optional(),
|
|
361
|
+
"language": zod.string().describe("Preferred language for content. Use IETF BCP 47 language tags (e.g., 'en', 'fr-CA', 'zh-Hans'). For REST, equivalent to Accept-Language header—platforms SHOULD fall back to Accept-Language when this field is absent; when provided, overrides Accept-Language. Businesses MAY return content in a different language if unavailable.").optional(),
|
|
362
|
+
"currency": zod.string().describe("Preferred currency (ISO 4217, e.g., 'EUR', 'USD'). Businesses determine presentment currency from context and authoritative signals; this hint MAY inform selection in multi-currency markets. Also serves as the denomination for price filter values — platforms SHOULD include this field when sending price filters. Response prices include explicit currency confirming the resolution.").optional(),
|
|
363
|
+
"eligibility": zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Reverse-domain identifier used for collision-safe namespacing of capabilities, services, handlers, eligibility claims, and extension-contributed keys. Must contain at least two dot-separated segments (e.g., 'dev.ucp.shopping.checkout', 'com.example.loyalty_gold').")).refine((arr) => arr.every((item, i) => arr.indexOf(item) == i), "All items must be unique!").describe("Buyer claims about eligible benefits such as loyalty membership, payment instrument perks, and similar. Recognized claims MAY inform the Business response (e.g., member-only product availability, adjusted pricing in catalog, provisional discounts at cart or checkout). Businesses MUST ignore unrecognized values without error. Values MUST use reverse-domain naming (e.g., 'com.example.loyalty_gold', 'org.school.student') and MUST be non-identifying.").optional()
|
|
364
|
+
}).passthrough().describe("Buyer signals for localization (country, region, postal_code). Merchant uses for pricing, availability, currency. Falls back to geo-IP if omitted.").optional(),
|
|
365
|
+
"signals": zod.object({
|
|
366
|
+
"dev.ucp.buyer_ip": zod.string().describe("Client's IP address (IPv4 or IPv6).").optional(),
|
|
367
|
+
"dev.ucp.user_agent": zod.string().describe("Client's HTTP User-Agent header or equivalent.").optional()
|
|
368
|
+
}).passthrough().describe("Environment data provided by the platform to support authorization and abuse prevention. Values MUST NOT be buyer-asserted claims — platforms provide signals based on direct observation or independently verifiable third-party attestations. All signal keys MUST use reverse-domain naming to ensure provenance and prevent collisions when multiple extensions contribute to the shared namespace.").optional(),
|
|
369
|
+
"buyer": zod.object({
|
|
370
|
+
"first_name": zod.string().describe("First name of the buyer.").optional(),
|
|
371
|
+
"last_name": zod.string().describe("Last name of the buyer.").optional(),
|
|
372
|
+
"email": zod.string().describe("Email of the buyer.").optional(),
|
|
373
|
+
"phone_number": zod.string().describe("E.164 standard.").optional()
|
|
374
|
+
}).passthrough().describe("Optional buyer information for personalized estimates.").optional(),
|
|
375
|
+
"currency": zod.string().describe("ISO 4217 currency code. Determined by merchant based on context or geo-IP."),
|
|
376
|
+
"totals": zod.array(zod.intersection(zod.object({
|
|
377
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
378
|
+
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
379
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
380
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text."), zod.intersection(zod.object({ "lines": zod.array(zod.object({
|
|
381
|
+
"display_text": zod.string().describe("Human-readable label for this sub-line."),
|
|
382
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
383
|
+
}).describe("Sub-line entry. Additional metadata MAY be included.")).describe("Optional itemized breakdown. The parent entry is always rendered; lines are supplementary. Sum of line amounts MUST equal the parent entry amount.").optional() }), zod.any()))).describe("Estimated cost breakdown. May be partial if shipping/tax not yet calculable."),
|
|
384
|
+
"messages": zod.array(zod.record(zod.string(), zod.unknown()).and(zod.unknown().superRefine((x, ctx) => {
|
|
385
|
+
const schemas = [
|
|
386
|
+
zod.object({
|
|
387
|
+
"type": zod.literal("error").describe("Message type discriminator."),
|
|
388
|
+
"code": zod.string().describe("Error code identifying the type of error. Standard errors are defined in specification (see examples), and have standardized semantics; freeform codes are permitted."),
|
|
389
|
+
"path": zod.string().describe("RFC 9535 JSONPath to the component the message refers to (e.g., $.items[1]).").optional(),
|
|
390
|
+
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
391
|
+
"content": zod.string().describe("Human-readable message."),
|
|
392
|
+
"severity": zod.enum([
|
|
393
|
+
"recoverable",
|
|
394
|
+
"requires_buyer_input",
|
|
395
|
+
"requires_buyer_review",
|
|
396
|
+
"unrecoverable"
|
|
397
|
+
]).describe("Reflects the resource state and recommended action. 'recoverable': platform can resolve by modifying inputs and retrying via API. 'requires_buyer_input': merchant requires information their API doesn't support collecting programmatically (checkout incomplete). 'requires_buyer_review': buyer must authorize before order placement due to policy, regulatory, or entitlement rules. 'unrecoverable': no valid resource exists to act on, retry with new resource or inputs. Errors with 'requires_*' severity contribute to 'status: requires_escalation'.")
|
|
398
|
+
}),
|
|
399
|
+
zod.object({
|
|
400
|
+
"type": zod.literal("warning").describe("Message type discriminator."),
|
|
401
|
+
"path": zod.string().describe("JSONPath (RFC 9535) to related field (e.g., $.line_items[0]).").optional(),
|
|
402
|
+
"code": zod.string().describe("Warning code. Machine-readable identifier for the warning type (e.g., final_sale, prop65, fulfillment_changed, age_restricted, etc.)."),
|
|
403
|
+
"content": zod.string().describe("Human-readable warning message that MUST be displayed."),
|
|
404
|
+
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
405
|
+
"presentation": zod.string().describe("Rendering contract for this warning. 'notice' (default): platform MUST display, MAY dismiss. 'disclosure': platform MUST display in proximity to the path-referenced component, MUST NOT hide or auto-dismiss. See specification for full contract.").default("notice"),
|
|
406
|
+
"image_url": zod.string().url().describe("URL to a required visual element (e.g., warning symbol, energy class label).").optional(),
|
|
407
|
+
"url": zod.string().url().describe("Reference URL for more information (e.g., regulatory site, registry entry, policy page).").optional()
|
|
408
|
+
}),
|
|
409
|
+
zod.object({
|
|
410
|
+
"type": zod.literal("info").describe("Message type discriminator."),
|
|
411
|
+
"path": zod.string().describe("RFC 9535 JSONPath to the component the message refers to.").optional(),
|
|
412
|
+
"code": zod.string().describe("Info code for programmatic handling.").optional(),
|
|
413
|
+
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
414
|
+
"content": zod.string().describe("Human-readable message.")
|
|
415
|
+
})
|
|
416
|
+
];
|
|
417
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
418
|
+
const passed = schemas.length - errors.length;
|
|
419
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
420
|
+
path: ctx.path,
|
|
421
|
+
code: "invalid_union",
|
|
422
|
+
unionErrors: errors,
|
|
423
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
424
|
+
} : {
|
|
425
|
+
path: ctx.path,
|
|
426
|
+
code: "custom",
|
|
427
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
428
|
+
});
|
|
429
|
+
})).describe("Container for error, warning, or info messages.")).describe("Validation messages, warnings, or informational notices.").optional(),
|
|
430
|
+
"links": zod.array(zod.object({
|
|
431
|
+
"type": zod.string().describe("Type of link. Well-known values: `privacy_policy`, `terms_of_service`, `refund_policy`, `shipping_policy`, `faq`. Consumers SHOULD handle unknown values gracefully by displaying them using the `title` field or omitting the link."),
|
|
432
|
+
"url": zod.string().url().describe("The actual URL pointing to the content to be displayed."),
|
|
433
|
+
"title": zod.string().describe("Optional display text for the link. When provided, use this instead of generating from type.").optional()
|
|
434
|
+
})).describe("Optional merchant links (policies, FAQs).").optional(),
|
|
435
|
+
"continue_url": zod.string().url().describe("URL for cart handoff and session recovery. Enables sharing and human-in-the-loop flows.").optional(),
|
|
436
|
+
"expires_at": zod.string().datetime({ offset: true }).describe("Cart expiry timestamp (RFC 3339). Optional.").optional()
|
|
437
|
+
}).passthrough().describe("Shopping cart with estimated pricing before checkout. Lightweight pre-purchase exploration with no payment info or complex status states.");
|
|
438
|
+
const CartCreateRequestSchema = zod.object({
|
|
439
|
+
"line_items": zod.array(zod.object({
|
|
440
|
+
"id": zod.string(),
|
|
441
|
+
"item": zod.object({
|
|
442
|
+
"id": zod.string().describe("The product identifier, often the SKU, required to resolve the product details associated with this line item. Should be recognized by both the Platform, and the Business."),
|
|
443
|
+
"title": zod.string().describe("Product title."),
|
|
444
|
+
"price": zod.number().int().gte(0).describe("Unit price in ISO 4217 minor units."),
|
|
445
|
+
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
446
|
+
}),
|
|
447
|
+
"quantity": zod.number().int().gte(1).describe("Quantity of the item being purchased."),
|
|
448
|
+
"totals": zod.array(zod.object({
|
|
449
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
450
|
+
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
451
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
452
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Line item totals breakdown."),
|
|
453
|
+
"parent_id": zod.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
454
|
+
}).describe("Line item object. Expected to use the currency of the parent object.")).describe("Cart line items. Same structure as checkout. Full replacement on update."),
|
|
455
|
+
"context": zod.object({
|
|
456
|
+
"address_country": zod.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used. Optional hint for market context (currency, availability, pricing)—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
457
|
+
"address_region": zod.string().describe("The region in which the locality is, and which is in the country. For example, California or another appropriate first-level Administrative division. Optional hint for progressive localization—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
458
|
+
"postal_code": zod.string().describe("The postal code. For example, 94043. Optional hint for regional refinement—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
459
|
+
"intent": zod.string().describe("Background context describing buyer's intent (e.g., 'looking for a gift under $50', 'need something durable for outdoor use'). Informs relevance, recommendations, and personalization.").optional(),
|
|
460
|
+
"language": zod.string().describe("Preferred language for content. Use IETF BCP 47 language tags (e.g., 'en', 'fr-CA', 'zh-Hans'). For REST, equivalent to Accept-Language header—platforms SHOULD fall back to Accept-Language when this field is absent; when provided, overrides Accept-Language. Businesses MAY return content in a different language if unavailable.").optional(),
|
|
461
|
+
"currency": zod.string().describe("Preferred currency (ISO 4217, e.g., 'EUR', 'USD'). Businesses determine presentment currency from context and authoritative signals; this hint MAY inform selection in multi-currency markets. Also serves as the denomination for price filter values — platforms SHOULD include this field when sending price filters. Response prices include explicit currency confirming the resolution.").optional(),
|
|
462
|
+
"eligibility": zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Reverse-domain identifier used for collision-safe namespacing of capabilities, services, handlers, eligibility claims, and extension-contributed keys. Must contain at least two dot-separated segments (e.g., 'dev.ucp.shopping.checkout', 'com.example.loyalty_gold').")).refine((arr) => arr.every((item, i) => arr.indexOf(item) == i), "All items must be unique!").describe("Buyer claims about eligible benefits such as loyalty membership, payment instrument perks, and similar. Recognized claims MAY inform the Business response (e.g., member-only product availability, adjusted pricing in catalog, provisional discounts at cart or checkout). Businesses MUST ignore unrecognized values without error. Values MUST use reverse-domain naming (e.g., 'com.example.loyalty_gold', 'org.school.student') and MUST be non-identifying.").optional()
|
|
463
|
+
}).passthrough().describe("Buyer signals for localization (country, region, postal_code). Merchant uses for pricing, availability, currency. Falls back to geo-IP if omitted.").optional(),
|
|
464
|
+
"signals": zod.object({
|
|
465
|
+
"dev.ucp.buyer_ip": zod.string().describe("Client's IP address (IPv4 or IPv6).").optional(),
|
|
466
|
+
"dev.ucp.user_agent": zod.string().describe("Client's HTTP User-Agent header or equivalent.").optional()
|
|
467
|
+
}).passthrough().describe("Environment data provided by the platform to support authorization and abuse prevention. Values MUST NOT be buyer-asserted claims — platforms provide signals based on direct observation or independently verifiable third-party attestations. All signal keys MUST use reverse-domain naming to ensure provenance and prevent collisions when multiple extensions contribute to the shared namespace.").optional(),
|
|
468
|
+
"buyer": zod.object({
|
|
469
|
+
"first_name": zod.string().describe("First name of the buyer.").optional(),
|
|
470
|
+
"last_name": zod.string().describe("Last name of the buyer.").optional(),
|
|
471
|
+
"email": zod.string().describe("Email of the buyer.").optional(),
|
|
472
|
+
"phone_number": zod.string().describe("E.164 standard.").optional()
|
|
473
|
+
}).passthrough().describe("Optional buyer information for personalized estimates.").optional()
|
|
474
|
+
}).strict();
|
|
475
|
+
const CartUpdateRequestSchema = zod.object({
|
|
476
|
+
"id": zod.string().describe("Unique cart identifier."),
|
|
477
|
+
"line_items": zod.array(zod.object({
|
|
478
|
+
"id": zod.string(),
|
|
479
|
+
"item": zod.object({
|
|
480
|
+
"id": zod.string().describe("The product identifier, often the SKU, required to resolve the product details associated with this line item. Should be recognized by both the Platform, and the Business."),
|
|
481
|
+
"title": zod.string().describe("Product title."),
|
|
482
|
+
"price": zod.number().int().gte(0).describe("Unit price in ISO 4217 minor units."),
|
|
483
|
+
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
484
|
+
}),
|
|
485
|
+
"quantity": zod.number().int().gte(1).describe("Quantity of the item being purchased."),
|
|
486
|
+
"totals": zod.array(zod.object({
|
|
487
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
488
|
+
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
489
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
490
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Line item totals breakdown."),
|
|
491
|
+
"parent_id": zod.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
492
|
+
}).describe("Line item object. Expected to use the currency of the parent object.")).describe("Cart line items. Same structure as checkout. Full replacement on update."),
|
|
493
|
+
"context": zod.object({
|
|
494
|
+
"address_country": zod.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used. Optional hint for market context (currency, availability, pricing)—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
495
|
+
"address_region": zod.string().describe("The region in which the locality is, and which is in the country. For example, California or another appropriate first-level Administrative division. Optional hint for progressive localization—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
496
|
+
"postal_code": zod.string().describe("The postal code. For example, 94043. Optional hint for regional refinement—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
497
|
+
"intent": zod.string().describe("Background context describing buyer's intent (e.g., 'looking for a gift under $50', 'need something durable for outdoor use'). Informs relevance, recommendations, and personalization.").optional(),
|
|
498
|
+
"language": zod.string().describe("Preferred language for content. Use IETF BCP 47 language tags (e.g., 'en', 'fr-CA', 'zh-Hans'). For REST, equivalent to Accept-Language header—platforms SHOULD fall back to Accept-Language when this field is absent; when provided, overrides Accept-Language. Businesses MAY return content in a different language if unavailable.").optional(),
|
|
499
|
+
"currency": zod.string().describe("Preferred currency (ISO 4217, e.g., 'EUR', 'USD'). Businesses determine presentment currency from context and authoritative signals; this hint MAY inform selection in multi-currency markets. Also serves as the denomination for price filter values — platforms SHOULD include this field when sending price filters. Response prices include explicit currency confirming the resolution.").optional(),
|
|
500
|
+
"eligibility": zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Reverse-domain identifier used for collision-safe namespacing of capabilities, services, handlers, eligibility claims, and extension-contributed keys. Must contain at least two dot-separated segments (e.g., 'dev.ucp.shopping.checkout', 'com.example.loyalty_gold').")).refine((arr) => arr.every((item, i) => arr.indexOf(item) == i), "All items must be unique!").describe("Buyer claims about eligible benefits such as loyalty membership, payment instrument perks, and similar. Recognized claims MAY inform the Business response (e.g., member-only product availability, adjusted pricing in catalog, provisional discounts at cart or checkout). Businesses MUST ignore unrecognized values without error. Values MUST use reverse-domain naming (e.g., 'com.example.loyalty_gold', 'org.school.student') and MUST be non-identifying.").optional()
|
|
501
|
+
}).passthrough().describe("Buyer signals for localization (country, region, postal_code). Merchant uses for pricing, availability, currency. Falls back to geo-IP if omitted.").optional(),
|
|
502
|
+
"signals": zod.object({
|
|
503
|
+
"dev.ucp.buyer_ip": zod.string().describe("Client's IP address (IPv4 or IPv6).").optional(),
|
|
504
|
+
"dev.ucp.user_agent": zod.string().describe("Client's HTTP User-Agent header or equivalent.").optional()
|
|
505
|
+
}).passthrough().describe("Environment data provided by the platform to support authorization and abuse prevention. Values MUST NOT be buyer-asserted claims — platforms provide signals based on direct observation or independently verifiable third-party attestations. All signal keys MUST use reverse-domain naming to ensure provenance and prevent collisions when multiple extensions contribute to the shared namespace.").optional(),
|
|
506
|
+
"buyer": zod.object({
|
|
507
|
+
"first_name": zod.string().describe("First name of the buyer.").optional(),
|
|
508
|
+
"last_name": zod.string().describe("Last name of the buyer.").optional(),
|
|
509
|
+
"email": zod.string().describe("Email of the buyer.").optional(),
|
|
510
|
+
"phone_number": zod.string().describe("E.164 standard.").optional()
|
|
511
|
+
}).passthrough().describe("Optional buyer information for personalized estimates.").optional()
|
|
512
|
+
}).strict();
|
|
513
|
+
const CatalogLookupSchema = zod.record(zod.string(), zod.unknown()).describe("Product/variant lookup by identifier. Supports batch retrieval (lookup_catalog) and single-product detail (get_product).");
|
|
514
|
+
const CatalogSearchSchema = zod.record(zod.string(), zod.unknown()).describe("Product catalog search capability.");
|
|
194
515
|
const CheckoutSchema = zod.object({
|
|
195
516
|
"ucp": zod.intersection(zod.object({
|
|
196
517
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
518
|
+
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
197
519
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
198
520
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
199
521
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -215,14 +537,31 @@ const CheckoutSchema = zod.object({
|
|
|
215
537
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
216
538
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
217
539
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
218
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
540
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
541
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
542
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
543
|
+
const passed = schemas.length - errors.length;
|
|
544
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
545
|
+
path: ctx.path,
|
|
546
|
+
code: "invalid_union",
|
|
547
|
+
unionErrors: errors,
|
|
548
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
549
|
+
} : {
|
|
550
|
+
path: ctx.path,
|
|
551
|
+
code: "custom",
|
|
552
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
553
|
+
});
|
|
554
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
219
555
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
220
556
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
221
557
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
222
558
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
223
559
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
224
560
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
225
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
561
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
562
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
563
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
564
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
226
565
|
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({
|
|
227
566
|
"services": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
228
567
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
@@ -244,7 +583,10 @@ const CheckoutSchema = zod.object({
|
|
|
244
583
|
zod.object({ "transport": zod.literal("a2a").optional() }),
|
|
245
584
|
zod.object({
|
|
246
585
|
"transport": zod.literal("embedded").optional(),
|
|
247
|
-
"config": zod.object({
|
|
586
|
+
"config": zod.object({
|
|
587
|
+
"delegate": zod.array(zod.string()).describe("Delegations the business allows. At service-level, declares available delegations. In UCP responses, confirms accepted delegations for this session.").optional(),
|
|
588
|
+
"color_scheme": zod.array(zod.enum(["light", "dark"])).describe("Color schemes the business supports. Hosts use ec_color_scheme query parameter to request a scheme from this list.").optional()
|
|
589
|
+
}).describe("Per-session configuration for embedded transport binding. Allows businesses to vary EP availability and delegations based on cart contents, agent authorization, or policy.").optional()
|
|
248
590
|
})
|
|
249
591
|
])).describe("Service binding in API responses. Includes per-resource transport configuration via typed config."))).optional(),
|
|
250
592
|
"capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
@@ -253,38 +595,47 @@ const CheckoutSchema = zod.object({
|
|
|
253
595
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
254
596
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
255
597
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
256
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
598
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
599
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
600
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
601
|
+
const passed = schemas.length - errors.length;
|
|
602
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
603
|
+
path: ctx.path,
|
|
604
|
+
code: "invalid_union",
|
|
605
|
+
unionErrors: errors,
|
|
606
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
607
|
+
} : {
|
|
608
|
+
path: ctx.path,
|
|
609
|
+
code: "custom",
|
|
610
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
611
|
+
});
|
|
612
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })).describe("Capability reference in responses. Only name/version required to confirm active capabilities."))).optional(),
|
|
257
613
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
258
614
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
259
615
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
260
616
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
261
617
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
262
618
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
263
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
619
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
620
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
621
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
622
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))).describe("Handler reference in responses. May include full config state for runtime usage of the handler.")))
|
|
264
623
|
})).describe("UCP metadata for checkout responses."),
|
|
265
624
|
"id": zod.string().describe("Unique identifier of the checkout session."),
|
|
266
625
|
"line_items": zod.array(zod.object({
|
|
267
626
|
"id": zod.string(),
|
|
268
627
|
"item": zod.object({
|
|
269
|
-
"id": zod.string().describe("
|
|
628
|
+
"id": zod.string().describe("The product identifier, often the SKU, required to resolve the product details associated with this line item. Should be recognized by both the Platform, and the Business."),
|
|
270
629
|
"title": zod.string().describe("Product title."),
|
|
271
|
-
"price": zod.number().int().gte(0).describe("Unit price in
|
|
630
|
+
"price": zod.number().int().gte(0).describe("Unit price in ISO 4217 minor units."),
|
|
272
631
|
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
273
632
|
}),
|
|
274
633
|
"quantity": zod.number().int().gte(1).describe("Quantity of the item being purchased."),
|
|
275
634
|
"totals": zod.array(zod.object({
|
|
276
|
-
"type": zod.
|
|
277
|
-
"items_discount",
|
|
278
|
-
"subtotal",
|
|
279
|
-
"discount",
|
|
280
|
-
"fulfillment",
|
|
281
|
-
"tax",
|
|
282
|
-
"fee",
|
|
283
|
-
"total"
|
|
284
|
-
]).describe("Type of total categorization."),
|
|
635
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
285
636
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
286
|
-
"amount": zod.number().int().
|
|
287
|
-
})).describe("Line item totals breakdown."),
|
|
637
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
638
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Line item totals breakdown."),
|
|
288
639
|
"parent_id": zod.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
289
640
|
}).describe("Line item object. Expected to use the currency of the parent object.")).describe("List of line items being checked out."),
|
|
290
641
|
"buyer": zod.object({
|
|
@@ -296,8 +647,16 @@ const CheckoutSchema = zod.object({
|
|
|
296
647
|
"context": zod.object({
|
|
297
648
|
"address_country": zod.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used. Optional hint for market context (currency, availability, pricing)—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
298
649
|
"address_region": zod.string().describe("The region in which the locality is, and which is in the country. For example, California or another appropriate first-level Administrative division. Optional hint for progressive localization—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
299
|
-
"postal_code": zod.string().describe("The postal code. For example, 94043. Optional hint for regional refinement—higher-resolution data (e.g., shipping address) supersedes this value.").optional()
|
|
300
|
-
|
|
650
|
+
"postal_code": zod.string().describe("The postal code. For example, 94043. Optional hint for regional refinement—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
651
|
+
"intent": zod.string().describe("Background context describing buyer's intent (e.g., 'looking for a gift under $50', 'need something durable for outdoor use'). Informs relevance, recommendations, and personalization.").optional(),
|
|
652
|
+
"language": zod.string().describe("Preferred language for content. Use IETF BCP 47 language tags (e.g., 'en', 'fr-CA', 'zh-Hans'). For REST, equivalent to Accept-Language header—platforms SHOULD fall back to Accept-Language when this field is absent; when provided, overrides Accept-Language. Businesses MAY return content in a different language if unavailable.").optional(),
|
|
653
|
+
"currency": zod.string().describe("Preferred currency (ISO 4217, e.g., 'EUR', 'USD'). Businesses determine presentment currency from context and authoritative signals; this hint MAY inform selection in multi-currency markets. Also serves as the denomination for price filter values — platforms SHOULD include this field when sending price filters. Response prices include explicit currency confirming the resolution.").optional(),
|
|
654
|
+
"eligibility": zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Reverse-domain identifier used for collision-safe namespacing of capabilities, services, handlers, eligibility claims, and extension-contributed keys. Must contain at least two dot-separated segments (e.g., 'dev.ucp.shopping.checkout', 'com.example.loyalty_gold').")).refine((arr) => arr.every((item, i) => arr.indexOf(item) == i), "All items must be unique!").describe("Buyer claims about eligible benefits such as loyalty membership, payment instrument perks, and similar. Recognized claims MAY inform the Business response (e.g., member-only product availability, adjusted pricing in catalog, provisional discounts at cart or checkout). Businesses MUST ignore unrecognized values without error. Values MUST use reverse-domain naming (e.g., 'com.example.loyalty_gold', 'org.school.student') and MUST be non-identifying.").optional()
|
|
655
|
+
}).passthrough().describe("Provisional buyer signals for relevance and localization—not authoritative data. Businesses SHOULD use these values when verified inputs (e.g., shipping address) are absent, and MAY ignore or down-rank them if inconsistent with higher-confidence signals (authenticated account, risk detection) or regulatory constraints (export controls). Eligibility and policy enforcement MUST occur at checkout time using binding transaction data. Context SHOULD be non-identifying and can be disclosed progressively—coarse signals early, finer resolution as the session progresses. Higher-resolution data (shipping address, billing address) supersedes context.").optional(),
|
|
656
|
+
"signals": zod.object({
|
|
657
|
+
"dev.ucp.buyer_ip": zod.string().describe("Client's IP address (IPv4 or IPv6).").optional(),
|
|
658
|
+
"dev.ucp.user_agent": zod.string().describe("Client's HTTP User-Agent header or equivalent.").optional()
|
|
659
|
+
}).passthrough().describe("Environment data provided by the platform to support authorization and abuse prevention. Values MUST NOT be buyer-asserted claims — platforms provide signals based on direct observation or independently verifiable third-party attestations. All signal keys MUST use reverse-domain naming to ensure provenance and prevent collisions when multiple extensions contribute to the shared namespace.").optional(),
|
|
301
660
|
"status": zod.enum([
|
|
302
661
|
"incomplete",
|
|
303
662
|
"requires_escalation",
|
|
@@ -307,39 +666,38 @@ const CheckoutSchema = zod.object({
|
|
|
307
666
|
"canceled"
|
|
308
667
|
]).describe("Checkout state indicating the current phase and required action. See Checkout Status lifecycle documentation for state transition details."),
|
|
309
668
|
"currency": zod.string().describe("ISO 4217 currency code reflecting the merchant's market determination. Derived from address, context, and geo IP—buyers provide signals, merchants determine currency."),
|
|
310
|
-
"totals": zod.array(zod.object({
|
|
311
|
-
"type": zod.
|
|
312
|
-
"items_discount",
|
|
313
|
-
"subtotal",
|
|
314
|
-
"discount",
|
|
315
|
-
"fulfillment",
|
|
316
|
-
"tax",
|
|
317
|
-
"fee",
|
|
318
|
-
"total"
|
|
319
|
-
]).describe("Type of total categorization."),
|
|
669
|
+
"totals": zod.array(zod.intersection(zod.object({
|
|
670
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
320
671
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
321
|
-
"amount": zod.number().int().
|
|
322
|
-
})).describe("
|
|
672
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
673
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text."), zod.intersection(zod.object({ "lines": zod.array(zod.object({
|
|
674
|
+
"display_text": zod.string().describe("Human-readable label for this sub-line."),
|
|
675
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
676
|
+
}).describe("Sub-line entry. Additional metadata MAY be included.")).describe("Optional itemized breakdown. The parent entry is always rendered; lines are supplementary. Sum of line amounts MUST equal the parent entry amount.").optional() }), zod.any()))).describe("Different cart totals."),
|
|
323
677
|
"messages": zod.array(zod.record(zod.string(), zod.unknown()).and(zod.unknown().superRefine((x, ctx) => {
|
|
324
678
|
const schemas = [
|
|
325
679
|
zod.object({
|
|
326
680
|
"type": zod.literal("error").describe("Message type discriminator."),
|
|
327
|
-
"code": zod.string().describe("Error code.
|
|
681
|
+
"code": zod.string().describe("Error code identifying the type of error. Standard errors are defined in specification (see examples), and have standardized semantics; freeform codes are permitted."),
|
|
328
682
|
"path": zod.string().describe("RFC 9535 JSONPath to the component the message refers to (e.g., $.items[1]).").optional(),
|
|
329
683
|
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
330
684
|
"content": zod.string().describe("Human-readable message."),
|
|
331
685
|
"severity": zod.enum([
|
|
332
686
|
"recoverable",
|
|
333
687
|
"requires_buyer_input",
|
|
334
|
-
"requires_buyer_review"
|
|
335
|
-
|
|
688
|
+
"requires_buyer_review",
|
|
689
|
+
"unrecoverable"
|
|
690
|
+
]).describe("Reflects the resource state and recommended action. 'recoverable': platform can resolve by modifying inputs and retrying via API. 'requires_buyer_input': merchant requires information their API doesn't support collecting programmatically (checkout incomplete). 'requires_buyer_review': buyer must authorize before order placement due to policy, regulatory, or entitlement rules. 'unrecoverable': no valid resource exists to act on, retry with new resource or inputs. Errors with 'requires_*' severity contribute to 'status: requires_escalation'.")
|
|
336
691
|
}),
|
|
337
692
|
zod.object({
|
|
338
693
|
"type": zod.literal("warning").describe("Message type discriminator."),
|
|
339
694
|
"path": zod.string().describe("JSONPath (RFC 9535) to related field (e.g., $.line_items[0]).").optional(),
|
|
340
695
|
"code": zod.string().describe("Warning code. Machine-readable identifier for the warning type (e.g., final_sale, prop65, fulfillment_changed, age_restricted, etc.)."),
|
|
341
696
|
"content": zod.string().describe("Human-readable warning message that MUST be displayed."),
|
|
342
|
-
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain")
|
|
697
|
+
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
698
|
+
"presentation": zod.string().describe("Rendering contract for this warning. 'notice' (default): platform MUST display, MAY dismiss. 'disclosure': platform MUST display in proximity to the path-referenced component, MUST NOT hide or auto-dismiss. See specification for full contract.").default("notice"),
|
|
699
|
+
"image_url": zod.string().url().describe("URL to a required visual element (e.g., warning symbol, energy class label).").optional(),
|
|
700
|
+
"url": zod.string().url().describe("Reference URL for more information (e.g., regulatory site, registry entry, policy page).").optional()
|
|
343
701
|
}),
|
|
344
702
|
zod.object({
|
|
345
703
|
"type": zod.literal("info").describe("Message type discriminator."),
|
|
@@ -389,6 +747,7 @@ const CheckoutSchema = zod.object({
|
|
|
389
747
|
}).passthrough().describe("The base definition for any payment instrument. It links the instrument to a specific payment handler."), zod.object({ "selected": zod.boolean().describe("Whether this instrument is selected by the user.").optional() })).describe("A payment instrument with selection state.")).describe("The payment instruments available for this payment. Each instrument is associated with a specific handler via the handler_id field. Handlers can extend the base payment_instrument schema to add handler-specific fields.").optional() }).describe("Payment configuration containing handlers.").optional(),
|
|
390
748
|
"order": zod.object({
|
|
391
749
|
"id": zod.string().describe("Unique order identifier."),
|
|
750
|
+
"label": zod.string().describe("Human-readable label for identifying the order. MUST only be provided by the business.").optional(),
|
|
392
751
|
"permalink_url": zod.string().url().describe("Permalink to access the order on merchant site.")
|
|
393
752
|
}).describe("Details about an order created for this checkout session.").optional()
|
|
394
753
|
}).passthrough().describe("Base checkout schema. Extensions compose onto this using allOf.");
|
|
@@ -396,25 +755,17 @@ const CheckoutCreateRequestSchema = zod.object({
|
|
|
396
755
|
"line_items": zod.array(zod.object({
|
|
397
756
|
"id": zod.string(),
|
|
398
757
|
"item": zod.object({
|
|
399
|
-
"id": zod.string().describe("
|
|
758
|
+
"id": zod.string().describe("The product identifier, often the SKU, required to resolve the product details associated with this line item. Should be recognized by both the Platform, and the Business."),
|
|
400
759
|
"title": zod.string().describe("Product title."),
|
|
401
|
-
"price": zod.number().int().gte(0).describe("Unit price in
|
|
760
|
+
"price": zod.number().int().gte(0).describe("Unit price in ISO 4217 minor units."),
|
|
402
761
|
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
403
762
|
}),
|
|
404
763
|
"quantity": zod.number().int().gte(1).describe("Quantity of the item being purchased."),
|
|
405
764
|
"totals": zod.array(zod.object({
|
|
406
|
-
"type": zod.
|
|
407
|
-
"items_discount",
|
|
408
|
-
"subtotal",
|
|
409
|
-
"discount",
|
|
410
|
-
"fulfillment",
|
|
411
|
-
"tax",
|
|
412
|
-
"fee",
|
|
413
|
-
"total"
|
|
414
|
-
]).describe("Type of total categorization."),
|
|
765
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
415
766
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
416
|
-
"amount": zod.number().int().
|
|
417
|
-
})).describe("Line item totals breakdown."),
|
|
767
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
768
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Line item totals breakdown."),
|
|
418
769
|
"parent_id": zod.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
419
770
|
}).describe("Line item object. Expected to use the currency of the parent object.")).describe("List of line items being checked out."),
|
|
420
771
|
"buyer": zod.object({
|
|
@@ -426,8 +777,16 @@ const CheckoutCreateRequestSchema = zod.object({
|
|
|
426
777
|
"context": zod.object({
|
|
427
778
|
"address_country": zod.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used. Optional hint for market context (currency, availability, pricing)—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
428
779
|
"address_region": zod.string().describe("The region in which the locality is, and which is in the country. For example, California or another appropriate first-level Administrative division. Optional hint for progressive localization—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
429
|
-
"postal_code": zod.string().describe("The postal code. For example, 94043. Optional hint for regional refinement—higher-resolution data (e.g., shipping address) supersedes this value.").optional()
|
|
430
|
-
|
|
780
|
+
"postal_code": zod.string().describe("The postal code. For example, 94043. Optional hint for regional refinement—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
781
|
+
"intent": zod.string().describe("Background context describing buyer's intent (e.g., 'looking for a gift under $50', 'need something durable for outdoor use'). Informs relevance, recommendations, and personalization.").optional(),
|
|
782
|
+
"language": zod.string().describe("Preferred language for content. Use IETF BCP 47 language tags (e.g., 'en', 'fr-CA', 'zh-Hans'). For REST, equivalent to Accept-Language header—platforms SHOULD fall back to Accept-Language when this field is absent; when provided, overrides Accept-Language. Businesses MAY return content in a different language if unavailable.").optional(),
|
|
783
|
+
"currency": zod.string().describe("Preferred currency (ISO 4217, e.g., 'EUR', 'USD'). Businesses determine presentment currency from context and authoritative signals; this hint MAY inform selection in multi-currency markets. Also serves as the denomination for price filter values — platforms SHOULD include this field when sending price filters. Response prices include explicit currency confirming the resolution.").optional(),
|
|
784
|
+
"eligibility": zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Reverse-domain identifier used for collision-safe namespacing of capabilities, services, handlers, eligibility claims, and extension-contributed keys. Must contain at least two dot-separated segments (e.g., 'dev.ucp.shopping.checkout', 'com.example.loyalty_gold').")).refine((arr) => arr.every((item, i) => arr.indexOf(item) == i), "All items must be unique!").describe("Buyer claims about eligible benefits such as loyalty membership, payment instrument perks, and similar. Recognized claims MAY inform the Business response (e.g., member-only product availability, adjusted pricing in catalog, provisional discounts at cart or checkout). Businesses MUST ignore unrecognized values without error. Values MUST use reverse-domain naming (e.g., 'com.example.loyalty_gold', 'org.school.student') and MUST be non-identifying.").optional()
|
|
785
|
+
}).passthrough().describe("Provisional buyer signals for relevance and localization—not authoritative data. Businesses SHOULD use these values when verified inputs (e.g., shipping address) are absent, and MAY ignore or down-rank them if inconsistent with higher-confidence signals (authenticated account, risk detection) or regulatory constraints (export controls). Eligibility and policy enforcement MUST occur at checkout time using binding transaction data. Context SHOULD be non-identifying and can be disclosed progressively—coarse signals early, finer resolution as the session progresses. Higher-resolution data (shipping address, billing address) supersedes context.").optional(),
|
|
786
|
+
"signals": zod.object({
|
|
787
|
+
"dev.ucp.buyer_ip": zod.string().describe("Client's IP address (IPv4 or IPv6).").optional(),
|
|
788
|
+
"dev.ucp.user_agent": zod.string().describe("Client's HTTP User-Agent header or equivalent.").optional()
|
|
789
|
+
}).passthrough().describe("Environment data provided by the platform to support authorization and abuse prevention. Values MUST NOT be buyer-asserted claims — platforms provide signals based on direct observation or independently verifiable third-party attestations. All signal keys MUST use reverse-domain naming to ensure provenance and prevent collisions when multiple extensions contribute to the shared namespace.").optional(),
|
|
431
790
|
"payment": zod.object({ "instruments": zod.array(zod.intersection(zod.object({
|
|
432
791
|
"id": zod.string().describe("A unique identifier for this instrument instance, assigned by the platform."),
|
|
433
792
|
"handler_id": zod.string().describe("The unique identifier for the handler instance that produced this instrument. This corresponds to the 'id' field in the Payment Handler definition."),
|
|
@@ -448,29 +807,20 @@ const CheckoutCreateRequestSchema = zod.object({
|
|
|
448
807
|
}).passthrough().describe("The base definition for any payment instrument. It links the instrument to a specific payment handler."), zod.object({ "selected": zod.boolean().describe("Whether this instrument is selected by the user.").optional() })).describe("A payment instrument with selection state.")).describe("The payment instruments available for this payment. Each instrument is associated with a specific handler via the handler_id field. Handlers can extend the base payment_instrument schema to add handler-specific fields.").optional() }).describe("Payment configuration containing handlers.").optional()
|
|
449
808
|
}).strict();
|
|
450
809
|
const CheckoutUpdateRequestSchema = zod.object({
|
|
451
|
-
"id": zod.string().describe("Unique identifier of the checkout session."),
|
|
452
810
|
"line_items": zod.array(zod.object({
|
|
453
811
|
"id": zod.string(),
|
|
454
812
|
"item": zod.object({
|
|
455
|
-
"id": zod.string().describe("
|
|
813
|
+
"id": zod.string().describe("The product identifier, often the SKU, required to resolve the product details associated with this line item. Should be recognized by both the Platform, and the Business."),
|
|
456
814
|
"title": zod.string().describe("Product title."),
|
|
457
|
-
"price": zod.number().int().gte(0).describe("Unit price in
|
|
815
|
+
"price": zod.number().int().gte(0).describe("Unit price in ISO 4217 minor units."),
|
|
458
816
|
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
459
817
|
}),
|
|
460
818
|
"quantity": zod.number().int().gte(1).describe("Quantity of the item being purchased."),
|
|
461
819
|
"totals": zod.array(zod.object({
|
|
462
|
-
"type": zod.
|
|
463
|
-
"items_discount",
|
|
464
|
-
"subtotal",
|
|
465
|
-
"discount",
|
|
466
|
-
"fulfillment",
|
|
467
|
-
"tax",
|
|
468
|
-
"fee",
|
|
469
|
-
"total"
|
|
470
|
-
]).describe("Type of total categorization."),
|
|
820
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
471
821
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
472
|
-
"amount": zod.number().int().
|
|
473
|
-
})).describe("Line item totals breakdown."),
|
|
822
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
823
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Line item totals breakdown."),
|
|
474
824
|
"parent_id": zod.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
475
825
|
}).describe("Line item object. Expected to use the currency of the parent object.")).describe("List of line items being checked out."),
|
|
476
826
|
"buyer": zod.object({
|
|
@@ -482,8 +832,16 @@ const CheckoutUpdateRequestSchema = zod.object({
|
|
|
482
832
|
"context": zod.object({
|
|
483
833
|
"address_country": zod.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used. Optional hint for market context (currency, availability, pricing)—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
484
834
|
"address_region": zod.string().describe("The region in which the locality is, and which is in the country. For example, California or another appropriate first-level Administrative division. Optional hint for progressive localization—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
485
|
-
"postal_code": zod.string().describe("The postal code. For example, 94043. Optional hint for regional refinement—higher-resolution data (e.g., shipping address) supersedes this value.").optional()
|
|
486
|
-
|
|
835
|
+
"postal_code": zod.string().describe("The postal code. For example, 94043. Optional hint for regional refinement—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
836
|
+
"intent": zod.string().describe("Background context describing buyer's intent (e.g., 'looking for a gift under $50', 'need something durable for outdoor use'). Informs relevance, recommendations, and personalization.").optional(),
|
|
837
|
+
"language": zod.string().describe("Preferred language for content. Use IETF BCP 47 language tags (e.g., 'en', 'fr-CA', 'zh-Hans'). For REST, equivalent to Accept-Language header—platforms SHOULD fall back to Accept-Language when this field is absent; when provided, overrides Accept-Language. Businesses MAY return content in a different language if unavailable.").optional(),
|
|
838
|
+
"currency": zod.string().describe("Preferred currency (ISO 4217, e.g., 'EUR', 'USD'). Businesses determine presentment currency from context and authoritative signals; this hint MAY inform selection in multi-currency markets. Also serves as the denomination for price filter values — platforms SHOULD include this field when sending price filters. Response prices include explicit currency confirming the resolution.").optional(),
|
|
839
|
+
"eligibility": zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Reverse-domain identifier used for collision-safe namespacing of capabilities, services, handlers, eligibility claims, and extension-contributed keys. Must contain at least two dot-separated segments (e.g., 'dev.ucp.shopping.checkout', 'com.example.loyalty_gold').")).refine((arr) => arr.every((item, i) => arr.indexOf(item) == i), "All items must be unique!").describe("Buyer claims about eligible benefits such as loyalty membership, payment instrument perks, and similar. Recognized claims MAY inform the Business response (e.g., member-only product availability, adjusted pricing in catalog, provisional discounts at cart or checkout). Businesses MUST ignore unrecognized values without error. Values MUST use reverse-domain naming (e.g., 'com.example.loyalty_gold', 'org.school.student') and MUST be non-identifying.").optional()
|
|
840
|
+
}).passthrough().describe("Provisional buyer signals for relevance and localization—not authoritative data. Businesses SHOULD use these values when verified inputs (e.g., shipping address) are absent, and MAY ignore or down-rank them if inconsistent with higher-confidence signals (authenticated account, risk detection) or regulatory constraints (export controls). Eligibility and policy enforcement MUST occur at checkout time using binding transaction data. Context SHOULD be non-identifying and can be disclosed progressively—coarse signals early, finer resolution as the session progresses. Higher-resolution data (shipping address, billing address) supersedes context.").optional(),
|
|
841
|
+
"signals": zod.object({
|
|
842
|
+
"dev.ucp.buyer_ip": zod.string().describe("Client's IP address (IPv4 or IPv6).").optional(),
|
|
843
|
+
"dev.ucp.user_agent": zod.string().describe("Client's HTTP User-Agent header or equivalent.").optional()
|
|
844
|
+
}).passthrough().describe("Environment data provided by the platform to support authorization and abuse prevention. Values MUST NOT be buyer-asserted claims — platforms provide signals based on direct observation or independently verifiable third-party attestations. All signal keys MUST use reverse-domain naming to ensure provenance and prevent collisions when multiple extensions contribute to the shared namespace.").optional(),
|
|
487
845
|
"payment": zod.object({ "instruments": zod.array(zod.intersection(zod.object({
|
|
488
846
|
"id": zod.string().describe("A unique identifier for this instrument instance, assigned by the platform."),
|
|
489
847
|
"handler_id": zod.string().describe("The unique identifier for the handler instance that produced this instrument. This corresponds to the 'id' field in the Payment Handler definition."),
|
|
@@ -503,38 +861,46 @@ const CheckoutUpdateRequestSchema = zod.object({
|
|
|
503
861
|
"display": zod.record(zod.string(), zod.unknown()).describe("Display information for this payment instrument. Each payment instrument schema defines its specific display properties, as outlined by the payment handler.").optional()
|
|
504
862
|
}).passthrough().describe("The base definition for any payment instrument. It links the instrument to a specific payment handler."), zod.object({ "selected": zod.boolean().describe("Whether this instrument is selected by the user.").optional() })).describe("A payment instrument with selection state.")).describe("The payment instruments available for this payment. Each instrument is associated with a specific handler via the handler_id field. Handlers can extend the base payment_instrument schema to add handler-specific fields.").optional() }).describe("Payment configuration containing handlers.").optional()
|
|
505
863
|
}).strict();
|
|
506
|
-
const CheckoutCompleteRequestSchema = zod.object({
|
|
507
|
-
"
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
"
|
|
511
|
-
|
|
512
|
-
"
|
|
513
|
-
"
|
|
514
|
-
"
|
|
515
|
-
"
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
864
|
+
const CheckoutCompleteRequestSchema = zod.object({
|
|
865
|
+
"signals": zod.object({
|
|
866
|
+
"dev.ucp.buyer_ip": zod.string().describe("Client's IP address (IPv4 or IPv6).").optional(),
|
|
867
|
+
"dev.ucp.user_agent": zod.string().describe("Client's HTTP User-Agent header or equivalent.").optional()
|
|
868
|
+
}).passthrough().describe("Environment data provided by the platform to support authorization and abuse prevention. Values MUST NOT be buyer-asserted claims — platforms provide signals based on direct observation or independently verifiable third-party attestations. All signal keys MUST use reverse-domain naming to ensure provenance and prevent collisions when multiple extensions contribute to the shared namespace.").optional(),
|
|
869
|
+
"payment": zod.object({ "instruments": zod.array(zod.intersection(zod.object({
|
|
870
|
+
"id": zod.string().describe("A unique identifier for this instrument instance, assigned by the platform."),
|
|
871
|
+
"handler_id": zod.string().describe("The unique identifier for the handler instance that produced this instrument. This corresponds to the 'id' field in the Payment Handler definition."),
|
|
872
|
+
"type": zod.string().describe("The broad category of the instrument (e.g., 'card', 'tokenized_card'). Specific schemas will constrain this to a constant value."),
|
|
873
|
+
"billing_address": zod.object({
|
|
874
|
+
"extended_address": zod.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
875
|
+
"street_address": zod.string().describe("The street address.").optional(),
|
|
876
|
+
"address_locality": zod.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
877
|
+
"address_region": zod.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
878
|
+
"address_country": zod.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
879
|
+
"postal_code": zod.string().describe("The postal code. For example, 94043.").optional(),
|
|
880
|
+
"first_name": zod.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
881
|
+
"last_name": zod.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
882
|
+
"phone_number": zod.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
883
|
+
}).describe("The billing address associated with this payment method.").optional(),
|
|
884
|
+
"credential": zod.object({ "type": zod.string().describe("The credential type discriminator. Specific schemas will constrain this to a constant value.") }).passthrough().describe("The base definition for any payment credential. Handlers define specific credential types.").optional(),
|
|
885
|
+
"display": zod.record(zod.string(), zod.unknown()).describe("Display information for this payment instrument. Each payment instrument schema defines its specific display properties, as outlined by the payment handler.").optional()
|
|
886
|
+
}).passthrough().describe("The base definition for any payment instrument. It links the instrument to a specific payment handler."), zod.object({ "selected": zod.boolean().describe("Whether this instrument is selected by the user.").optional() })).describe("A payment instrument with selection state.")).describe("The payment instruments available for this payment. Each instrument is associated with a specific handler via the handler_id field. Handlers can extend the base payment_instrument schema to add handler-specific fields.").optional() }).describe("Payment configuration containing handlers.")
|
|
887
|
+
}).strict();
|
|
524
888
|
const DiscountAllocationSchema = zod.object({
|
|
525
889
|
"path": zod.string().describe("JSONPath to the allocation target (e.g., '$.line_items[0]', '$.totals.shipping')."),
|
|
526
|
-
"amount": zod.number().int().gte(0).describe("Amount allocated to this target in
|
|
890
|
+
"amount": zod.number().int().gte(0).describe("Amount allocated to this target in ISO 4217 minor units.")
|
|
527
891
|
}).describe("Breakdown of how a discount amount was allocated to a specific target.");
|
|
528
892
|
const DiscountAppliedDiscountSchema = zod.object({
|
|
529
893
|
"code": zod.string().describe("The discount code. Omitted for automatic discounts.").optional(),
|
|
530
894
|
"title": zod.string().describe("Human-readable discount name (e.g., 'Summer Sale 20% Off')."),
|
|
531
|
-
"amount": zod.number().int().gte(0).describe("Total discount amount in
|
|
895
|
+
"amount": zod.number().int().gte(0).describe("Total discount amount in ISO 4217 minor units."),
|
|
532
896
|
"automatic": zod.boolean().describe("True if applied automatically by merchant rules (no code required).").default(false),
|
|
533
897
|
"method": zod.enum(["each", "across"]).describe("Allocation method. 'each' = applied independently per item. 'across' = split proportionally by value.").optional(),
|
|
534
898
|
"priority": zod.number().int().gte(1).describe("Stacking order for discount calculation. Lower numbers applied first (1 = first).").optional(),
|
|
899
|
+
"provisional": zod.boolean().describe("True if this discount requires additional verification.").default(false),
|
|
900
|
+
"eligibility": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("The eligibility claim accepted by the Business for this discount. Corresponds to a value from context.eligibility. Omitted for code-based and non-eligibility automatic discounts.").optional(),
|
|
535
901
|
"allocations": zod.array(zod.object({
|
|
536
902
|
"path": zod.string().describe("JSONPath to the allocation target (e.g., '$.line_items[0]', '$.totals.shipping')."),
|
|
537
|
-
"amount": zod.number().int().gte(0).describe("Amount allocated to this target in
|
|
903
|
+
"amount": zod.number().int().gte(0).describe("Amount allocated to this target in ISO 4217 minor units.")
|
|
538
904
|
}).describe("Breakdown of how a discount amount was allocated to a specific target.")).describe("Breakdown of where this discount was allocated. Sum of allocation amounts equals total amount.").optional()
|
|
539
905
|
}).describe("A discount that was successfully applied.");
|
|
540
906
|
const DiscountDiscountsObjectSchema = zod.object({
|
|
@@ -542,13 +908,15 @@ const DiscountDiscountsObjectSchema = zod.object({
|
|
|
542
908
|
"applied": zod.array(zod.object({
|
|
543
909
|
"code": zod.string().describe("The discount code. Omitted for automatic discounts.").optional(),
|
|
544
910
|
"title": zod.string().describe("Human-readable discount name (e.g., 'Summer Sale 20% Off')."),
|
|
545
|
-
"amount": zod.number().int().gte(0).describe("Total discount amount in
|
|
911
|
+
"amount": zod.number().int().gte(0).describe("Total discount amount in ISO 4217 minor units."),
|
|
546
912
|
"automatic": zod.boolean().describe("True if applied automatically by merchant rules (no code required).").default(false),
|
|
547
913
|
"method": zod.enum(["each", "across"]).describe("Allocation method. 'each' = applied independently per item. 'across' = split proportionally by value.").optional(),
|
|
548
914
|
"priority": zod.number().int().gte(1).describe("Stacking order for discount calculation. Lower numbers applied first (1 = first).").optional(),
|
|
915
|
+
"provisional": zod.boolean().describe("True if this discount requires additional verification.").default(false),
|
|
916
|
+
"eligibility": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("The eligibility claim accepted by the Business for this discount. Corresponds to a value from context.eligibility. Omitted for code-based and non-eligibility automatic discounts.").optional(),
|
|
549
917
|
"allocations": zod.array(zod.object({
|
|
550
918
|
"path": zod.string().describe("JSONPath to the allocation target (e.g., '$.line_items[0]', '$.totals.shipping')."),
|
|
551
|
-
"amount": zod.number().int().gte(0).describe("Amount allocated to this target in
|
|
919
|
+
"amount": zod.number().int().gte(0).describe("Amount allocated to this target in ISO 4217 minor units.")
|
|
552
920
|
}).describe("Breakdown of how a discount amount was allocated to a specific target.")).describe("Breakdown of where this discount was allocated. Sum of allocation amounts equals total amount.").optional()
|
|
553
921
|
}).describe("A discount that was successfully applied.")).describe("Discounts successfully applied (code-based and automatic).").readonly().optional()
|
|
554
922
|
}).describe("Discount codes input and applied discounts output.");
|
|
@@ -560,18 +928,10 @@ const FulfillmentExtensionFulfillmentOptionSchema = zod.object({
|
|
|
560
928
|
"earliest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
561
929
|
"latest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
562
930
|
"totals": zod.array(zod.object({
|
|
563
|
-
"type": zod.
|
|
564
|
-
"items_discount",
|
|
565
|
-
"subtotal",
|
|
566
|
-
"discount",
|
|
567
|
-
"fulfillment",
|
|
568
|
-
"tax",
|
|
569
|
-
"fee",
|
|
570
|
-
"total"
|
|
571
|
-
]).describe("Type of total categorization."),
|
|
931
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
572
932
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
573
|
-
"amount": zod.number().int().
|
|
574
|
-
})).describe("Fulfillment option totals breakdown.")
|
|
933
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
934
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Fulfillment option totals breakdown.")
|
|
575
935
|
}).passthrough().describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).");
|
|
576
936
|
const FulfillmentExtensionFulfillmentGroupSchema = zod.object({
|
|
577
937
|
"id": zod.string().describe("Group identifier for referencing merchant-generated groups in updates."),
|
|
@@ -584,18 +944,10 @@ const FulfillmentExtensionFulfillmentGroupSchema = zod.object({
|
|
|
584
944
|
"earliest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
585
945
|
"latest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
586
946
|
"totals": zod.array(zod.object({
|
|
587
|
-
"type": zod.
|
|
588
|
-
"items_discount",
|
|
589
|
-
"subtotal",
|
|
590
|
-
"discount",
|
|
591
|
-
"fulfillment",
|
|
592
|
-
"tax",
|
|
593
|
-
"fee",
|
|
594
|
-
"total"
|
|
595
|
-
]).describe("Type of total categorization."),
|
|
947
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
596
948
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
597
|
-
"amount": zod.number().int().
|
|
598
|
-
})).describe("Fulfillment option totals breakdown.")
|
|
949
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
950
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Fulfillment option totals breakdown.")
|
|
599
951
|
}).passthrough().describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).")).describe("Available fulfillment options for this group.").optional(),
|
|
600
952
|
"selected_option_id": zod.union([zod.string().describe("ID of the selected fulfillment option for this group."), zod.null().describe("ID of the selected fulfillment option for this group.")]).describe("ID of the selected fulfillment option for this group.").optional()
|
|
601
953
|
}).passthrough().describe("A merchant-generated package/group of line items with fulfillment options.");
|
|
@@ -654,18 +1006,10 @@ const FulfillmentExtensionFulfillmentMethodSchema = zod.object({
|
|
|
654
1006
|
"earliest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
655
1007
|
"latest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
656
1008
|
"totals": zod.array(zod.object({
|
|
657
|
-
"type": zod.
|
|
658
|
-
"items_discount",
|
|
659
|
-
"subtotal",
|
|
660
|
-
"discount",
|
|
661
|
-
"fulfillment",
|
|
662
|
-
"tax",
|
|
663
|
-
"fee",
|
|
664
|
-
"total"
|
|
665
|
-
]).describe("Type of total categorization."),
|
|
1009
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
666
1010
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
667
|
-
"amount": zod.number().int().
|
|
668
|
-
})).describe("Fulfillment option totals breakdown.")
|
|
1011
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
1012
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Fulfillment option totals breakdown.")
|
|
669
1013
|
}).passthrough().describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).")).describe("Available fulfillment options for this group.").optional(),
|
|
670
1014
|
"selected_option_id": zod.union([zod.string().describe("ID of the selected fulfillment option for this group."), zod.null().describe("ID of the selected fulfillment option for this group.")]).describe("ID of the selected fulfillment option for this group.").optional()
|
|
671
1015
|
}).passthrough().describe("A merchant-generated package/group of line items with fulfillment options.")).describe("Fulfillment groups for selecting options. Agent sets selected_option_id on groups to choose shipping method.").optional()
|
|
@@ -732,18 +1076,10 @@ const FulfillmentExtensionFulfillmentSchema = zod.object({
|
|
|
732
1076
|
"earliest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
733
1077
|
"latest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
734
1078
|
"totals": zod.array(zod.object({
|
|
735
|
-
"type": zod.
|
|
736
|
-
"items_discount",
|
|
737
|
-
"subtotal",
|
|
738
|
-
"discount",
|
|
739
|
-
"fulfillment",
|
|
740
|
-
"tax",
|
|
741
|
-
"fee",
|
|
742
|
-
"total"
|
|
743
|
-
]).describe("Type of total categorization."),
|
|
1079
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
744
1080
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
745
|
-
"amount": zod.number().int().
|
|
746
|
-
})).describe("Fulfillment option totals breakdown.")
|
|
1081
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
1082
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Fulfillment option totals breakdown.")
|
|
747
1083
|
}).passthrough().describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).")).describe("Available fulfillment options for this group.").optional(),
|
|
748
1084
|
"selected_option_id": zod.union([zod.string().describe("ID of the selected fulfillment option for this group."), zod.null().describe("ID of the selected fulfillment option for this group.")]).describe("ID of the selected fulfillment option for this group.").optional()
|
|
749
1085
|
}).passthrough().describe("A merchant-generated package/group of line items with fulfillment options.")).describe("Fulfillment groups for selecting options. Agent sets selected_option_id on groups to choose shipping method.").optional()
|
|
@@ -758,6 +1094,7 @@ const FulfillmentExtensionFulfillmentSchema = zod.object({
|
|
|
758
1094
|
const OrderSchema = zod.object({
|
|
759
1095
|
"ucp": zod.intersection(zod.object({
|
|
760
1096
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1097
|
+
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
761
1098
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
762
1099
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
763
1100
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -779,56 +1116,82 @@ const OrderSchema = zod.object({
|
|
|
779
1116
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
780
1117
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
781
1118
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
782
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
1119
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
1120
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
1121
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
1122
|
+
const passed = schemas.length - errors.length;
|
|
1123
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
1124
|
+
path: ctx.path,
|
|
1125
|
+
code: "invalid_union",
|
|
1126
|
+
unionErrors: errors,
|
|
1127
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1128
|
+
} : {
|
|
1129
|
+
path: ctx.path,
|
|
1130
|
+
code: "custom",
|
|
1131
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1132
|
+
});
|
|
1133
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
783
1134
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
784
1135
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
785
1136
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
786
1137
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
787
1138
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
788
1139
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
789
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
1140
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
1141
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
1142
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
1143
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
790
1144
|
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({ "capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
791
1145
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
792
1146
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
793
1147
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
794
1148
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
795
1149
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
796
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
1150
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
1151
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
1152
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
1153
|
+
const passed = schemas.length - errors.length;
|
|
1154
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
1155
|
+
path: ctx.path,
|
|
1156
|
+
code: "invalid_union",
|
|
1157
|
+
unionErrors: errors,
|
|
1158
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1159
|
+
} : {
|
|
1160
|
+
path: ctx.path,
|
|
1161
|
+
code: "custom",
|
|
1162
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1163
|
+
});
|
|
1164
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })).describe("Capability reference in responses. Only name/version required to confirm active capabilities."))).optional() })).describe("UCP metadata for order responses. No payment handlers needed post-purchase."),
|
|
797
1165
|
"id": zod.string().describe("Unique order identifier."),
|
|
1166
|
+
"label": zod.string().describe("Human-readable label for identifying the order. MUST only be provided by the business.").optional(),
|
|
798
1167
|
"checkout_id": zod.string().describe("Associated checkout ID for reconciliation."),
|
|
799
1168
|
"permalink_url": zod.string().url().describe("Permalink to access the order on merchant site."),
|
|
800
1169
|
"line_items": zod.array(zod.object({
|
|
801
1170
|
"id": zod.string().describe("Line item identifier."),
|
|
802
1171
|
"item": zod.object({
|
|
803
|
-
"id": zod.string().describe("
|
|
1172
|
+
"id": zod.string().describe("The product identifier, often the SKU, required to resolve the product details associated with this line item. Should be recognized by both the Platform, and the Business."),
|
|
804
1173
|
"title": zod.string().describe("Product title."),
|
|
805
|
-
"price": zod.number().int().gte(0).describe("Unit price in
|
|
1174
|
+
"price": zod.number().int().gte(0).describe("Unit price in ISO 4217 minor units."),
|
|
806
1175
|
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
807
1176
|
}).describe("Product data (id, title, price, image_url)."),
|
|
808
1177
|
"quantity": zod.object({
|
|
809
|
-
"
|
|
810
|
-
"
|
|
811
|
-
|
|
1178
|
+
"original": zod.number().int().gte(0).describe("Quantity from the original checkout.").optional(),
|
|
1179
|
+
"total": zod.number().int().gte(0).describe("Current total active quantity. May differ from original due to post-order modifications (e.g., returns or cancellations)."),
|
|
1180
|
+
"fulfilled": zod.number().int().gte(0).describe("Quantity fulfilled so far.")
|
|
1181
|
+
}).describe("Quantity tracking for the line item."),
|
|
812
1182
|
"totals": zod.array(zod.object({
|
|
813
|
-
"type": zod.
|
|
814
|
-
"items_discount",
|
|
815
|
-
"subtotal",
|
|
816
|
-
"discount",
|
|
817
|
-
"fulfillment",
|
|
818
|
-
"tax",
|
|
819
|
-
"fee",
|
|
820
|
-
"total"
|
|
821
|
-
]).describe("Type of total categorization."),
|
|
1183
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
822
1184
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
823
|
-
"amount": zod.number().int().
|
|
824
|
-
})).describe("Line item totals breakdown."),
|
|
1185
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
1186
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Line item totals breakdown."),
|
|
825
1187
|
"status": zod.enum([
|
|
826
1188
|
"processing",
|
|
827
1189
|
"partial",
|
|
828
|
-
"fulfilled"
|
|
829
|
-
|
|
1190
|
+
"fulfilled",
|
|
1191
|
+
"removed"
|
|
1192
|
+
]).describe("Derived status: removed if quantity.total == 0, fulfilled if quantity.total > 0 and quantity.fulfilled == quantity.total, partial if quantity.total > 0 and quantity.fulfilled > 0, otherwise processing."),
|
|
830
1193
|
"parent_id": zod.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
831
|
-
})).describe("
|
|
1194
|
+
})).describe("Line items representing what was purchased — can change post-order via edits or exchanges."),
|
|
832
1195
|
"fulfillment": zod.object({
|
|
833
1196
|
"expectations": zod.array(zod.object({
|
|
834
1197
|
"id": zod.string().describe("Expectation identifier."),
|
|
@@ -880,25 +1243,71 @@ const OrderSchema = zod.object({
|
|
|
880
1243
|
]).describe("Adjustment status."),
|
|
881
1244
|
"line_items": zod.array(zod.object({
|
|
882
1245
|
"id": zod.string().describe("Line item ID reference."),
|
|
883
|
-
"quantity": zod.number().int().
|
|
1246
|
+
"quantity": zod.number().int().describe("Signed quantity affected by this adjustment. Negative values represent reductions (e.g. returns); positive values represent additions (e.g. exchanges).")
|
|
884
1247
|
})).describe("Which line items and quantities are affected (optional).").optional(),
|
|
885
|
-
"
|
|
1248
|
+
"totals": zod.array(zod.object({
|
|
1249
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
1250
|
+
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1251
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
1252
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Adjustment totals breakdown. Signed values - negative for money returned to buyer (refunds, credits), positive for additional charges (exchanges).").optional(),
|
|
886
1253
|
"description": zod.string().describe("Human-readable reason or description (e.g., 'Defective item', 'Customer requested').").optional()
|
|
887
|
-
}).describe("
|
|
888
|
-
"
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
"subtotal",
|
|
892
|
-
"discount",
|
|
893
|
-
"fulfillment",
|
|
894
|
-
"tax",
|
|
895
|
-
"fee",
|
|
896
|
-
"total"
|
|
897
|
-
]).describe("Type of total categorization."),
|
|
1254
|
+
}).describe("Post-order event that exists independently of fulfillment. Typically represents money movements but can be any post-order change. Polymorphic type that can optionally reference line items.")).describe("Post-order events (refunds, returns, credits, disputes, cancellations, etc.) that exist independently of fulfillment.").optional(),
|
|
1255
|
+
"currency": zod.string().describe("ISO 4217 currency code. MUST match the currency from the originating checkout session."),
|
|
1256
|
+
"totals": zod.array(zod.intersection(zod.object({
|
|
1257
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
898
1258
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
899
|
-
"amount": zod.number().int().
|
|
900
|
-
})).describe("
|
|
901
|
-
|
|
1259
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
1260
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text."), zod.intersection(zod.object({ "lines": zod.array(zod.object({
|
|
1261
|
+
"display_text": zod.string().describe("Human-readable label for this sub-line."),
|
|
1262
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
1263
|
+
}).describe("Sub-line entry. Additional metadata MAY be included.")).describe("Optional itemized breakdown. The parent entry is always rendered; lines are supplementary. Sum of line amounts MUST equal the parent entry amount.").optional() }), zod.any()))).describe("Different totals for the order."),
|
|
1264
|
+
"messages": zod.array(zod.record(zod.string(), zod.unknown()).and(zod.unknown().superRefine((x, ctx) => {
|
|
1265
|
+
const schemas = [
|
|
1266
|
+
zod.object({
|
|
1267
|
+
"type": zod.literal("error").describe("Message type discriminator."),
|
|
1268
|
+
"code": zod.string().describe("Error code identifying the type of error. Standard errors are defined in specification (see examples), and have standardized semantics; freeform codes are permitted."),
|
|
1269
|
+
"path": zod.string().describe("RFC 9535 JSONPath to the component the message refers to (e.g., $.items[1]).").optional(),
|
|
1270
|
+
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1271
|
+
"content": zod.string().describe("Human-readable message."),
|
|
1272
|
+
"severity": zod.enum([
|
|
1273
|
+
"recoverable",
|
|
1274
|
+
"requires_buyer_input",
|
|
1275
|
+
"requires_buyer_review",
|
|
1276
|
+
"unrecoverable"
|
|
1277
|
+
]).describe("Reflects the resource state and recommended action. 'recoverable': platform can resolve by modifying inputs and retrying via API. 'requires_buyer_input': merchant requires information their API doesn't support collecting programmatically (checkout incomplete). 'requires_buyer_review': buyer must authorize before order placement due to policy, regulatory, or entitlement rules. 'unrecoverable': no valid resource exists to act on, retry with new resource or inputs. Errors with 'requires_*' severity contribute to 'status: requires_escalation'.")
|
|
1278
|
+
}),
|
|
1279
|
+
zod.object({
|
|
1280
|
+
"type": zod.literal("warning").describe("Message type discriminator."),
|
|
1281
|
+
"path": zod.string().describe("JSONPath (RFC 9535) to related field (e.g., $.line_items[0]).").optional(),
|
|
1282
|
+
"code": zod.string().describe("Warning code. Machine-readable identifier for the warning type (e.g., final_sale, prop65, fulfillment_changed, age_restricted, etc.)."),
|
|
1283
|
+
"content": zod.string().describe("Human-readable warning message that MUST be displayed."),
|
|
1284
|
+
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1285
|
+
"presentation": zod.string().describe("Rendering contract for this warning. 'notice' (default): platform MUST display, MAY dismiss. 'disclosure': platform MUST display in proximity to the path-referenced component, MUST NOT hide or auto-dismiss. See specification for full contract.").default("notice"),
|
|
1286
|
+
"image_url": zod.string().url().describe("URL to a required visual element (e.g., warning symbol, energy class label).").optional(),
|
|
1287
|
+
"url": zod.string().url().describe("Reference URL for more information (e.g., regulatory site, registry entry, policy page).").optional()
|
|
1288
|
+
}),
|
|
1289
|
+
zod.object({
|
|
1290
|
+
"type": zod.literal("info").describe("Message type discriminator."),
|
|
1291
|
+
"path": zod.string().describe("RFC 9535 JSONPath to the component the message refers to.").optional(),
|
|
1292
|
+
"code": zod.string().describe("Info code for programmatic handling.").optional(),
|
|
1293
|
+
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1294
|
+
"content": zod.string().describe("Human-readable message.")
|
|
1295
|
+
})
|
|
1296
|
+
];
|
|
1297
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
1298
|
+
const passed = schemas.length - errors.length;
|
|
1299
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
1300
|
+
path: ctx.path,
|
|
1301
|
+
code: "invalid_union",
|
|
1302
|
+
unionErrors: errors,
|
|
1303
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1304
|
+
} : {
|
|
1305
|
+
path: ctx.path,
|
|
1306
|
+
code: "custom",
|
|
1307
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1308
|
+
});
|
|
1309
|
+
})).describe("Container for error, warning, or info messages.")).describe("Business outcome messages (errors, warnings, informational). Present when the business needs to communicate status or issues to the platform.").optional()
|
|
1310
|
+
}).describe("Order schema with line items, buyer-facing fulfillment expectations, and event logs.");
|
|
902
1311
|
const PaymentSchema = zod.object({ "instruments": zod.array(zod.intersection(zod.object({
|
|
903
1312
|
"id": zod.string().describe("A unique identifier for this instrument instance, assigned by the platform."),
|
|
904
1313
|
"handler_id": zod.string().describe("The unique identifier for the handler instance that produced this instrument. This corresponds to the 'id' field in the Payment Handler definition."),
|
|
@@ -929,11 +1338,20 @@ const AdjustmentSchema = zod.object({
|
|
|
929
1338
|
]).describe("Adjustment status."),
|
|
930
1339
|
"line_items": zod.array(zod.object({
|
|
931
1340
|
"id": zod.string().describe("Line item ID reference."),
|
|
932
|
-
"quantity": zod.number().int().
|
|
1341
|
+
"quantity": zod.number().int().describe("Signed quantity affected by this adjustment. Negative values represent reductions (e.g. returns); positive values represent additions (e.g. exchanges).")
|
|
933
1342
|
})).describe("Which line items and quantities are affected (optional).").optional(),
|
|
934
|
-
"
|
|
1343
|
+
"totals": zod.array(zod.object({
|
|
1344
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
1345
|
+
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1346
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
1347
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Adjustment totals breakdown. Signed values - negative for money returned to buyer (refunds, credits), positive for additional charges (exchanges).").optional(),
|
|
935
1348
|
"description": zod.string().describe("Human-readable reason or description (e.g., 'Defective item', 'Customer requested').").optional()
|
|
936
|
-
}).describe("
|
|
1349
|
+
}).describe("Post-order event that exists independently of fulfillment. Typically represents money movements but can be any post-order change. Polymorphic type that can optionally reference line items.");
|
|
1350
|
+
const AmountSchema = zod.number().int().gte(0).describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD).");
|
|
1351
|
+
const AvailablePaymentInstrumentSchema = zod.object({
|
|
1352
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
1353
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
1354
|
+
}).describe("An instrument type available from a payment handler with optional constraints.");
|
|
937
1355
|
const BindingSchema = zod.object({
|
|
938
1356
|
"checkout_id": zod.string().describe("The checkout session identifier this token is bound to."),
|
|
939
1357
|
"identity": zod.object({ "access_token": zod.string().describe("Unique identifier for this participant, obtained during onboarding with the tokenizer.") }).describe("The participant this token is bound to. Required when acting on behalf of another participant (e.g., agent tokenizing for merchant). Omit when the authenticated caller is the binding target.").optional()
|
|
@@ -966,39 +1384,138 @@ const CardCredentialSchema = zod.intersection(zod.object({ "type": zod.string().
|
|
|
966
1384
|
"cryptogram": zod.string().describe("Cryptogram provided with network tokens.").optional(),
|
|
967
1385
|
"eci_value": zod.string().describe("Electronic Commerce Indicator / Security Level Indicator provided with network tokens.").optional()
|
|
968
1386
|
})).describe("A card credential containing sensitive payment card details including raw Primary Account Numbers (PANs). This credential type MUST NOT be used for checkout, only with payment handlers that tokenize or encrypt credentials. CRITICAL: Both parties handling CardCredential (sender and receiver) MUST be PCI DSS compliant. Transmission MUST use HTTPS/TLS with strong cipher suites.");
|
|
969
|
-
const
|
|
970
|
-
"
|
|
971
|
-
"
|
|
972
|
-
|
|
973
|
-
"
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
"first_name": zod.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
981
|
-
"last_name": zod.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
982
|
-
"phone_number": zod.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
983
|
-
}).describe("The billing address associated with this payment method.").optional(),
|
|
984
|
-
"credential": zod.object({ "type": zod.string().describe("The credential type discriminator. Specific schemas will constrain this to a constant value.") }).passthrough().describe("The base definition for any payment credential. Handlers define specific credential types.").optional(),
|
|
985
|
-
"display": zod.record(zod.string(), zod.unknown()).describe("Display information for this payment instrument. Each payment instrument schema defines its specific display properties, as outlined by the payment handler.").optional()
|
|
986
|
-
}).passthrough().describe("The base definition for any payment instrument. It links the instrument to a specific payment handler."), zod.object({
|
|
987
|
-
"type": zod.literal("card").describe("Indicates this is a card payment instrument."),
|
|
988
|
-
"display": zod.object({
|
|
989
|
-
"brand": zod.string().describe("The card brand/network (e.g., visa, mastercard, amex).").optional(),
|
|
990
|
-
"last_digits": zod.string().describe("Last 4 digits of the card number.").optional(),
|
|
991
|
-
"expiry_month": zod.number().int().describe("The month of the card's expiration date (1-12).").optional(),
|
|
992
|
-
"expiry_year": zod.number().int().describe("The year of the card's expiration date.").optional(),
|
|
993
|
-
"description": zod.string().describe("An optional rich text description of the card to display to the user (e.g., 'Visa ending in 1234, expires 12/2025').").optional(),
|
|
994
|
-
"card_art": zod.string().url().describe("An optional URI to a rich image representing the card (e.g., card art provided by the issuer).").optional()
|
|
995
|
-
}).describe("Display information for this card payment instrument.").optional()
|
|
996
|
-
})).describe("A basic card payment instrument with visible card details. Can be inherited by a handler's instrument schema to define handler-specific display details or more complex credential structures.");
|
|
1387
|
+
const CardPaymentInstrumentAvailableCardPaymentInstrumentSchema = zod.intersection(zod.object({
|
|
1388
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
1389
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
1390
|
+
}).describe("An instrument type available from a payment handler with optional constraints."), zod.object({
|
|
1391
|
+
"type": zod.literal("card").optional(),
|
|
1392
|
+
"constraints": zod.object({ "brands": zod.array(zod.string()).min(1).refine((arr) => arr.every((item, i) => arr.indexOf(item) == i), "All items must be unique!").describe("Limit to specific card brands (e.g., ['visa', 'mastercard', 'amex']).").optional() }).optional()
|
|
1393
|
+
})).describe("Declares card instrument availability with card-specific constraints.");
|
|
1394
|
+
const CategorySchema = zod.object({
|
|
1395
|
+
"value": zod.string().describe("Category value or path (e.g., 'Apparel > Shirts', '1604')."),
|
|
1396
|
+
"taxonomy": zod.string().describe("Source taxonomy. Well-known values: `google_product_category`, `shopify`, `merchant`.").optional()
|
|
1397
|
+
}).describe("A product category with optional taxonomy identifier.");
|
|
997
1398
|
const ContextSchema = zod.object({
|
|
998
1399
|
"address_country": zod.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used. Optional hint for market context (currency, availability, pricing)—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
999
1400
|
"address_region": zod.string().describe("The region in which the locality is, and which is in the country. For example, California or another appropriate first-level Administrative division. Optional hint for progressive localization—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
1000
|
-
"postal_code": zod.string().describe("The postal code. For example, 94043. Optional hint for regional refinement—higher-resolution data (e.g., shipping address) supersedes this value.").optional()
|
|
1001
|
-
|
|
1401
|
+
"postal_code": zod.string().describe("The postal code. For example, 94043. Optional hint for regional refinement—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
1402
|
+
"intent": zod.string().describe("Background context describing buyer's intent (e.g., 'looking for a gift under $50', 'need something durable for outdoor use'). Informs relevance, recommendations, and personalization.").optional(),
|
|
1403
|
+
"language": zod.string().describe("Preferred language for content. Use IETF BCP 47 language tags (e.g., 'en', 'fr-CA', 'zh-Hans'). For REST, equivalent to Accept-Language header—platforms SHOULD fall back to Accept-Language when this field is absent; when provided, overrides Accept-Language. Businesses MAY return content in a different language if unavailable.").optional(),
|
|
1404
|
+
"currency": zod.string().describe("Preferred currency (ISO 4217, e.g., 'EUR', 'USD'). Businesses determine presentment currency from context and authoritative signals; this hint MAY inform selection in multi-currency markets. Also serves as the denomination for price filter values — platforms SHOULD include this field when sending price filters. Response prices include explicit currency confirming the resolution.").optional(),
|
|
1405
|
+
"eligibility": zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Reverse-domain identifier used for collision-safe namespacing of capabilities, services, handlers, eligibility claims, and extension-contributed keys. Must contain at least two dot-separated segments (e.g., 'dev.ucp.shopping.checkout', 'com.example.loyalty_gold').")).refine((arr) => arr.every((item, i) => arr.indexOf(item) == i), "All items must be unique!").describe("Buyer claims about eligible benefits such as loyalty membership, payment instrument perks, and similar. Recognized claims MAY inform the Business response (e.g., member-only product availability, adjusted pricing in catalog, provisional discounts at cart or checkout). Businesses MUST ignore unrecognized values without error. Values MUST use reverse-domain naming (e.g., 'com.example.loyalty_gold', 'org.school.student') and MUST be non-identifying.").optional()
|
|
1406
|
+
}).passthrough().describe("Provisional buyer signals for relevance and localization—not authoritative data. Businesses SHOULD use these values when verified inputs (e.g., shipping address) are absent, and MAY ignore or down-rank them if inconsistent with higher-confidence signals (authenticated account, risk detection) or regulatory constraints (export controls). Eligibility and policy enforcement MUST occur at checkout time using binding transaction data. Context SHOULD be non-identifying and can be disclosed progressively—coarse signals early, finer resolution as the session progresses. Higher-resolution data (shipping address, billing address) supersedes context.");
|
|
1407
|
+
const DescriptionSchema = zod.object({
|
|
1408
|
+
"plain": zod.string().describe("Plain text content.").optional(),
|
|
1409
|
+
"html": zod.string().describe("HTML-formatted content. Security: Platforms MUST sanitize before rendering—strip scripts, event handlers, and untrusted elements. Treat all rich text as untrusted input.").optional(),
|
|
1410
|
+
"markdown": zod.string().describe("Markdown-formatted content.").optional()
|
|
1411
|
+
}).describe("Description content in one or more formats. At least one format must be provided.");
|
|
1412
|
+
const DetailOptionValueSchema = zod.object({
|
|
1413
|
+
"available": zod.boolean().describe("Whether a variant matching this value and the current option selections is purchasable.").optional(),
|
|
1414
|
+
"exists": zod.boolean().describe("Whether a variant matching this value and the current option selections exists in the catalog.").optional()
|
|
1415
|
+
}).and(zod.object({
|
|
1416
|
+
"id": zod.string().describe("Optional server-assigned identifier for this option value. When present in a selected_option, the server SHOULD use it for matching instead of label.").optional(),
|
|
1417
|
+
"label": zod.string().describe("Display text for this option value (e.g., 'Small', 'Blue').")
|
|
1418
|
+
}).describe("A selectable value for a product option.")).describe("An option value with availability signals relative to the current selections. Used in get_product responses where selected context exists.");
|
|
1419
|
+
const ErrorCodeSchema = zod.string().describe("Error code identifying the type of error. Standard errors are defined in specification (see examples), and have standardized semantics; freeform codes are permitted.");
|
|
1420
|
+
const ErrorResponseSchema = zod.object({
|
|
1421
|
+
"ucp": zod.intersection(zod.object({
|
|
1422
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1423
|
+
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
1424
|
+
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
1425
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1426
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1427
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1428
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1429
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1430
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({
|
|
1431
|
+
"transport": zod.enum([
|
|
1432
|
+
"rest",
|
|
1433
|
+
"mcp",
|
|
1434
|
+
"a2a",
|
|
1435
|
+
"embedded"
|
|
1436
|
+
]).describe("Transport protocol for this service binding."),
|
|
1437
|
+
"endpoint": zod.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
1438
|
+
})))).describe("Service registry keyed by reverse-domain name.").optional(),
|
|
1439
|
+
"capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
1440
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1441
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1442
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1443
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1444
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1445
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
1446
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
1447
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
1448
|
+
const passed = schemas.length - errors.length;
|
|
1449
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
1450
|
+
path: ctx.path,
|
|
1451
|
+
code: "invalid_union",
|
|
1452
|
+
unionErrors: errors,
|
|
1453
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1454
|
+
} : {
|
|
1455
|
+
path: ctx.path,
|
|
1456
|
+
code: "custom",
|
|
1457
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1458
|
+
});
|
|
1459
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
1460
|
+
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
1461
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1462
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1463
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1464
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1465
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1466
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
1467
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
1468
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
1469
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
1470
|
+
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({ "status": zod.literal("error") })).describe("UCP protocol metadata. Status MUST be 'error' for error response."),
|
|
1471
|
+
"messages": zod.array(zod.record(zod.string(), zod.unknown()).and(zod.unknown().superRefine((x, ctx) => {
|
|
1472
|
+
const schemas = [
|
|
1473
|
+
zod.object({
|
|
1474
|
+
"type": zod.literal("error").describe("Message type discriminator."),
|
|
1475
|
+
"code": zod.string().describe("Error code identifying the type of error. Standard errors are defined in specification (see examples), and have standardized semantics; freeform codes are permitted."),
|
|
1476
|
+
"path": zod.string().describe("RFC 9535 JSONPath to the component the message refers to (e.g., $.items[1]).").optional(),
|
|
1477
|
+
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1478
|
+
"content": zod.string().describe("Human-readable message."),
|
|
1479
|
+
"severity": zod.enum([
|
|
1480
|
+
"recoverable",
|
|
1481
|
+
"requires_buyer_input",
|
|
1482
|
+
"requires_buyer_review",
|
|
1483
|
+
"unrecoverable"
|
|
1484
|
+
]).describe("Reflects the resource state and recommended action. 'recoverable': platform can resolve by modifying inputs and retrying via API. 'requires_buyer_input': merchant requires information their API doesn't support collecting programmatically (checkout incomplete). 'requires_buyer_review': buyer must authorize before order placement due to policy, regulatory, or entitlement rules. 'unrecoverable': no valid resource exists to act on, retry with new resource or inputs. Errors with 'requires_*' severity contribute to 'status: requires_escalation'.")
|
|
1485
|
+
}),
|
|
1486
|
+
zod.object({
|
|
1487
|
+
"type": zod.literal("warning").describe("Message type discriminator."),
|
|
1488
|
+
"path": zod.string().describe("JSONPath (RFC 9535) to related field (e.g., $.line_items[0]).").optional(),
|
|
1489
|
+
"code": zod.string().describe("Warning code. Machine-readable identifier for the warning type (e.g., final_sale, prop65, fulfillment_changed, age_restricted, etc.)."),
|
|
1490
|
+
"content": zod.string().describe("Human-readable warning message that MUST be displayed."),
|
|
1491
|
+
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1492
|
+
"presentation": zod.string().describe("Rendering contract for this warning. 'notice' (default): platform MUST display, MAY dismiss. 'disclosure': platform MUST display in proximity to the path-referenced component, MUST NOT hide or auto-dismiss. See specification for full contract.").default("notice"),
|
|
1493
|
+
"image_url": zod.string().url().describe("URL to a required visual element (e.g., warning symbol, energy class label).").optional(),
|
|
1494
|
+
"url": zod.string().url().describe("Reference URL for more information (e.g., regulatory site, registry entry, policy page).").optional()
|
|
1495
|
+
}),
|
|
1496
|
+
zod.object({
|
|
1497
|
+
"type": zod.literal("info").describe("Message type discriminator."),
|
|
1498
|
+
"path": zod.string().describe("RFC 9535 JSONPath to the component the message refers to.").optional(),
|
|
1499
|
+
"code": zod.string().describe("Info code for programmatic handling.").optional(),
|
|
1500
|
+
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1501
|
+
"content": zod.string().describe("Human-readable message.")
|
|
1502
|
+
})
|
|
1503
|
+
];
|
|
1504
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
1505
|
+
const passed = schemas.length - errors.length;
|
|
1506
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
1507
|
+
path: ctx.path,
|
|
1508
|
+
code: "invalid_union",
|
|
1509
|
+
unionErrors: errors,
|
|
1510
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1511
|
+
} : {
|
|
1512
|
+
path: ctx.path,
|
|
1513
|
+
code: "custom",
|
|
1514
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1515
|
+
});
|
|
1516
|
+
})).describe("Container for error, warning, or info messages.")).min(1).describe("Array of messages describing why the operation failed."),
|
|
1517
|
+
"continue_url": zod.string().url().describe("URL for buyer handoff or session recovery.").optional()
|
|
1518
|
+
}).strict().describe("Generic error response when business logic prevents resource creation or failed to retrieve resource. Used when no valid resource can be established.");
|
|
1002
1519
|
const ExpectationSchema = zod.object({
|
|
1003
1520
|
"id": zod.string().describe("Expectation identifier."),
|
|
1004
1521
|
"line_items": zod.array(zod.object({
|
|
@@ -1080,18 +1597,10 @@ const FulfillmentSchema = zod.object({
|
|
|
1080
1597
|
"earliest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
1081
1598
|
"latest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
1082
1599
|
"totals": zod.array(zod.object({
|
|
1083
|
-
"type": zod.
|
|
1084
|
-
"items_discount",
|
|
1085
|
-
"subtotal",
|
|
1086
|
-
"discount",
|
|
1087
|
-
"fulfillment",
|
|
1088
|
-
"tax",
|
|
1089
|
-
"fee",
|
|
1090
|
-
"total"
|
|
1091
|
-
]).describe("Type of total categorization."),
|
|
1600
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
1092
1601
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1093
|
-
"amount": zod.number().int().
|
|
1094
|
-
})).describe("Fulfillment option totals breakdown.")
|
|
1602
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
1603
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Fulfillment option totals breakdown.")
|
|
1095
1604
|
}).passthrough().describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).")).describe("Available fulfillment options for this group.").optional(),
|
|
1096
1605
|
"selected_option_id": zod.union([zod.string().describe("ID of the selected fulfillment option for this group."), zod.null().describe("ID of the selected fulfillment option for this group.")]).describe("ID of the selected fulfillment option for this group.").optional()
|
|
1097
1606
|
}).passthrough().describe("A merchant-generated package/group of line items with fulfillment options.")).describe("Fulfillment groups for selecting options. Agent sets selected_option_id on groups to choose shipping method.").optional()
|
|
@@ -1172,18 +1681,10 @@ const FulfillmentGroupSchema = zod.object({
|
|
|
1172
1681
|
"earliest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
1173
1682
|
"latest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
1174
1683
|
"totals": zod.array(zod.object({
|
|
1175
|
-
"type": zod.
|
|
1176
|
-
"items_discount",
|
|
1177
|
-
"subtotal",
|
|
1178
|
-
"discount",
|
|
1179
|
-
"fulfillment",
|
|
1180
|
-
"tax",
|
|
1181
|
-
"fee",
|
|
1182
|
-
"total"
|
|
1183
|
-
]).describe("Type of total categorization."),
|
|
1684
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
1184
1685
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1185
|
-
"amount": zod.number().int().
|
|
1186
|
-
})).describe("Fulfillment option totals breakdown.")
|
|
1686
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
1687
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Fulfillment option totals breakdown.")
|
|
1187
1688
|
}).passthrough().describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).")).describe("Available fulfillment options for this group.").optional(),
|
|
1188
1689
|
"selected_option_id": zod.union([zod.string().describe("ID of the selected fulfillment option for this group."), zod.null().describe("ID of the selected fulfillment option for this group.")]).describe("ID of the selected fulfillment option for this group.").optional()
|
|
1189
1690
|
}).passthrough().describe("A merchant-generated package/group of line items with fulfillment options.");
|
|
@@ -1243,18 +1744,10 @@ const FulfillmentMethodSchema = zod.object({
|
|
|
1243
1744
|
"earliest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
1244
1745
|
"latest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
1245
1746
|
"totals": zod.array(zod.object({
|
|
1246
|
-
"type": zod.
|
|
1247
|
-
"items_discount",
|
|
1248
|
-
"subtotal",
|
|
1249
|
-
"discount",
|
|
1250
|
-
"fulfillment",
|
|
1251
|
-
"tax",
|
|
1252
|
-
"fee",
|
|
1253
|
-
"total"
|
|
1254
|
-
]).describe("Type of total categorization."),
|
|
1747
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
1255
1748
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1256
|
-
"amount": zod.number().int().
|
|
1257
|
-
})).describe("Fulfillment option totals breakdown.")
|
|
1749
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
1750
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Fulfillment option totals breakdown.")
|
|
1258
1751
|
}).passthrough().describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).")).describe("Available fulfillment options for this group.").optional(),
|
|
1259
1752
|
"selected_option_id": zod.union([zod.string().describe("ID of the selected fulfillment option for this group."), zod.null().describe("ID of the selected fulfillment option for this group.")]).describe("ID of the selected fulfillment option for this group.").optional()
|
|
1260
1753
|
}).passthrough().describe("A merchant-generated package/group of line items with fulfillment options.")).describe("Fulfillment groups for selecting options. Agent sets selected_option_id on groups to choose shipping method.").optional()
|
|
@@ -1264,7 +1757,8 @@ const FulfillmentMethodCreateRequestSchema = zod.object({
|
|
|
1264
1757
|
"line_item_ids": zod.array(zod.string()).describe("Line item IDs fulfilled via this method.").optional()
|
|
1265
1758
|
}).strict();
|
|
1266
1759
|
const FulfillmentMethodUpdateRequestSchema = zod.object({
|
|
1267
|
-
"id": zod.string().describe("Unique fulfillment method identifier."),
|
|
1760
|
+
"id": zod.string().describe("Unique fulfillment method identifier.").optional(),
|
|
1761
|
+
"type": zod.enum(["shipping", "pickup"]).describe("Fulfillment method type.").optional(),
|
|
1268
1762
|
"line_item_ids": zod.array(zod.string()).describe("Line item IDs fulfilled via this method.")
|
|
1269
1763
|
}).strict();
|
|
1270
1764
|
const FulfillmentOptionSchema = zod.object({
|
|
@@ -1275,47 +1769,35 @@ const FulfillmentOptionSchema = zod.object({
|
|
|
1275
1769
|
"earliest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
1276
1770
|
"latest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
1277
1771
|
"totals": zod.array(zod.object({
|
|
1278
|
-
"type": zod.
|
|
1279
|
-
"items_discount",
|
|
1280
|
-
"subtotal",
|
|
1281
|
-
"discount",
|
|
1282
|
-
"fulfillment",
|
|
1283
|
-
"tax",
|
|
1284
|
-
"fee",
|
|
1285
|
-
"total"
|
|
1286
|
-
]).describe("Type of total categorization."),
|
|
1772
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
1287
1773
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1288
|
-
"amount": zod.number().int().
|
|
1289
|
-
})).describe("Fulfillment option totals breakdown.")
|
|
1774
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
1775
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Fulfillment option totals breakdown.")
|
|
1290
1776
|
}).passthrough().describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).");
|
|
1777
|
+
const InputCorrelationSchema = zod.object({
|
|
1778
|
+
"id": zod.string().describe("The identifier from the lookup request that resolved to this variant."),
|
|
1779
|
+
"match": zod.string().describe("How the request identifier resolved to this variant. Well-known values: `exact` (input directly identifies this variant, e.g., variant ID, SKU), `featured` (server selected this variant as representative, e.g., product ID resolved to best match). Businesses MAY implement and provide additional resolution strategies.").optional()
|
|
1780
|
+
}).describe("Maps a request identifier to the variant it resolved to, with match semantics.");
|
|
1291
1781
|
const ItemSchema = zod.object({
|
|
1292
|
-
"id": zod.string().describe("
|
|
1782
|
+
"id": zod.string().describe("The product identifier, often the SKU, required to resolve the product details associated with this line item. Should be recognized by both the Platform, and the Business."),
|
|
1293
1783
|
"title": zod.string().describe("Product title."),
|
|
1294
|
-
"price": zod.number().int().gte(0).describe("Unit price in
|
|
1784
|
+
"price": zod.number().int().gte(0).describe("Unit price in ISO 4217 minor units."),
|
|
1295
1785
|
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
1296
1786
|
});
|
|
1297
1787
|
const LineItemSchema = zod.object({
|
|
1298
1788
|
"id": zod.string(),
|
|
1299
1789
|
"item": zod.object({
|
|
1300
|
-
"id": zod.string().describe("
|
|
1790
|
+
"id": zod.string().describe("The product identifier, often the SKU, required to resolve the product details associated with this line item. Should be recognized by both the Platform, and the Business."),
|
|
1301
1791
|
"title": zod.string().describe("Product title."),
|
|
1302
|
-
"price": zod.number().int().gte(0).describe("Unit price in
|
|
1792
|
+
"price": zod.number().int().gte(0).describe("Unit price in ISO 4217 minor units."),
|
|
1303
1793
|
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
1304
1794
|
}),
|
|
1305
1795
|
"quantity": zod.number().int().gte(1).describe("Quantity of the item being purchased."),
|
|
1306
1796
|
"totals": zod.array(zod.object({
|
|
1307
|
-
"type": zod.
|
|
1308
|
-
"items_discount",
|
|
1309
|
-
"subtotal",
|
|
1310
|
-
"discount",
|
|
1311
|
-
"fulfillment",
|
|
1312
|
-
"tax",
|
|
1313
|
-
"fee",
|
|
1314
|
-
"total"
|
|
1315
|
-
]).describe("Type of total categorization."),
|
|
1797
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
1316
1798
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1317
|
-
"amount": zod.number().int().
|
|
1318
|
-
})).describe("Line item totals breakdown."),
|
|
1799
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
1800
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Line item totals breakdown."),
|
|
1319
1801
|
"parent_id": zod.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
1320
1802
|
}).describe("Line item object. Expected to use the currency of the parent object.");
|
|
1321
1803
|
const LineItemUpdateRequestSchema = zod.object({
|
|
@@ -1327,6 +1809,13 @@ const LinkSchema = zod.object({
|
|
|
1327
1809
|
"url": zod.string().url().describe("The actual URL pointing to the content to be displayed."),
|
|
1328
1810
|
"title": zod.string().describe("Optional display text for the link. When provided, use this instead of generating from type.").optional()
|
|
1329
1811
|
});
|
|
1812
|
+
const MediaSchema = zod.object({
|
|
1813
|
+
"type": zod.string().describe("Media type. Well-known values: `image`, `video`, `model_3d`."),
|
|
1814
|
+
"url": zod.string().url().describe("URL to the media resource."),
|
|
1815
|
+
"alt_text": zod.string().describe("Accessibility text describing the media.").optional(),
|
|
1816
|
+
"width": zod.number().int().gte(1).describe("Width in pixels (for images/video).").optional(),
|
|
1817
|
+
"height": zod.number().int().gte(1).describe("Height in pixels (for images/video).").optional()
|
|
1818
|
+
}).describe("Product media item (image, video, etc.).");
|
|
1330
1819
|
const MerchantFulfillmentConfigSchema = zod.object({
|
|
1331
1820
|
"allows_multi_destination": zod.object({
|
|
1332
1821
|
"shipping": zod.boolean().describe("Multiple shipping destinations allowed.").optional(),
|
|
@@ -1338,22 +1827,26 @@ const MessageSchema = zod.record(zod.string(), zod.unknown()).and(zod.unknown().
|
|
|
1338
1827
|
const schemas = [
|
|
1339
1828
|
zod.object({
|
|
1340
1829
|
"type": zod.literal("error").describe("Message type discriminator."),
|
|
1341
|
-
"code": zod.string().describe("Error code.
|
|
1830
|
+
"code": zod.string().describe("Error code identifying the type of error. Standard errors are defined in specification (see examples), and have standardized semantics; freeform codes are permitted."),
|
|
1342
1831
|
"path": zod.string().describe("RFC 9535 JSONPath to the component the message refers to (e.g., $.items[1]).").optional(),
|
|
1343
1832
|
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1344
1833
|
"content": zod.string().describe("Human-readable message."),
|
|
1345
1834
|
"severity": zod.enum([
|
|
1346
1835
|
"recoverable",
|
|
1347
1836
|
"requires_buyer_input",
|
|
1348
|
-
"requires_buyer_review"
|
|
1349
|
-
|
|
1837
|
+
"requires_buyer_review",
|
|
1838
|
+
"unrecoverable"
|
|
1839
|
+
]).describe("Reflects the resource state and recommended action. 'recoverable': platform can resolve by modifying inputs and retrying via API. 'requires_buyer_input': merchant requires information their API doesn't support collecting programmatically (checkout incomplete). 'requires_buyer_review': buyer must authorize before order placement due to policy, regulatory, or entitlement rules. 'unrecoverable': no valid resource exists to act on, retry with new resource or inputs. Errors with 'requires_*' severity contribute to 'status: requires_escalation'.")
|
|
1350
1840
|
}),
|
|
1351
1841
|
zod.object({
|
|
1352
1842
|
"type": zod.literal("warning").describe("Message type discriminator."),
|
|
1353
1843
|
"path": zod.string().describe("JSONPath (RFC 9535) to related field (e.g., $.line_items[0]).").optional(),
|
|
1354
1844
|
"code": zod.string().describe("Warning code. Machine-readable identifier for the warning type (e.g., final_sale, prop65, fulfillment_changed, age_restricted, etc.)."),
|
|
1355
1845
|
"content": zod.string().describe("Human-readable warning message that MUST be displayed."),
|
|
1356
|
-
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain")
|
|
1846
|
+
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1847
|
+
"presentation": zod.string().describe("Rendering contract for this warning. 'notice' (default): platform MUST display, MAY dismiss. 'disclosure': platform MUST display in proximity to the path-referenced component, MUST NOT hide or auto-dismiss. See specification for full contract.").default("notice"),
|
|
1848
|
+
"image_url": zod.string().url().describe("URL to a required visual element (e.g., warning symbol, energy class label).").optional(),
|
|
1849
|
+
"url": zod.string().url().describe("Reference URL for more information (e.g., regulatory site, registry entry, policy page).").optional()
|
|
1357
1850
|
}),
|
|
1358
1851
|
zod.object({
|
|
1359
1852
|
"type": zod.literal("info").describe("Message type discriminator."),
|
|
@@ -1378,15 +1871,16 @@ const MessageSchema = zod.record(zod.string(), zod.unknown()).and(zod.unknown().
|
|
|
1378
1871
|
})).describe("Container for error, warning, or info messages.");
|
|
1379
1872
|
const MessageErrorSchema = zod.object({
|
|
1380
1873
|
"type": zod.literal("error").describe("Message type discriminator."),
|
|
1381
|
-
"code": zod.string().describe("Error code.
|
|
1874
|
+
"code": zod.string().describe("Error code identifying the type of error. Standard errors are defined in specification (see examples), and have standardized semantics; freeform codes are permitted."),
|
|
1382
1875
|
"path": zod.string().describe("RFC 9535 JSONPath to the component the message refers to (e.g., $.items[1]).").optional(),
|
|
1383
1876
|
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1384
1877
|
"content": zod.string().describe("Human-readable message."),
|
|
1385
1878
|
"severity": zod.enum([
|
|
1386
1879
|
"recoverable",
|
|
1387
1880
|
"requires_buyer_input",
|
|
1388
|
-
"requires_buyer_review"
|
|
1389
|
-
|
|
1881
|
+
"requires_buyer_review",
|
|
1882
|
+
"unrecoverable"
|
|
1883
|
+
]).describe("Reflects the resource state and recommended action. 'recoverable': platform can resolve by modifying inputs and retrying via API. 'requires_buyer_input': merchant requires information their API doesn't support collecting programmatically (checkout incomplete). 'requires_buyer_review': buyer must authorize before order placement due to policy, regulatory, or entitlement rules. 'unrecoverable': no valid resource exists to act on, retry with new resource or inputs. Errors with 'requires_*' severity contribute to 'status: requires_escalation'.")
|
|
1390
1884
|
});
|
|
1391
1885
|
const MessageInfoSchema = zod.object({
|
|
1392
1886
|
"type": zod.literal("info").describe("Message type discriminator."),
|
|
@@ -1400,44 +1894,47 @@ const MessageWarningSchema = zod.object({
|
|
|
1400
1894
|
"path": zod.string().describe("JSONPath (RFC 9535) to related field (e.g., $.line_items[0]).").optional(),
|
|
1401
1895
|
"code": zod.string().describe("Warning code. Machine-readable identifier for the warning type (e.g., final_sale, prop65, fulfillment_changed, age_restricted, etc.)."),
|
|
1402
1896
|
"content": zod.string().describe("Human-readable warning message that MUST be displayed."),
|
|
1403
|
-
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain")
|
|
1897
|
+
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1898
|
+
"presentation": zod.string().describe("Rendering contract for this warning. 'notice' (default): platform MUST display, MAY dismiss. 'disclosure': platform MUST display in proximity to the path-referenced component, MUST NOT hide or auto-dismiss. See specification for full contract.").default("notice"),
|
|
1899
|
+
"image_url": zod.string().url().describe("URL to a required visual element (e.g., warning symbol, energy class label).").optional(),
|
|
1900
|
+
"url": zod.string().url().describe("Reference URL for more information (e.g., regulatory site, registry entry, policy page).").optional()
|
|
1404
1901
|
});
|
|
1902
|
+
const OptionValueSchema = zod.object({
|
|
1903
|
+
"id": zod.string().describe("Optional server-assigned identifier for this option value. When present in a selected_option, the server SHOULD use it for matching instead of label.").optional(),
|
|
1904
|
+
"label": zod.string().describe("Display text for this option value (e.g., 'Small', 'Blue').")
|
|
1905
|
+
}).describe("A selectable value for a product option.");
|
|
1405
1906
|
const OrderConfirmationSchema = zod.object({
|
|
1406
1907
|
"id": zod.string().describe("Unique order identifier."),
|
|
1908
|
+
"label": zod.string().describe("Human-readable label for identifying the order. MUST only be provided by the business.").optional(),
|
|
1407
1909
|
"permalink_url": zod.string().url().describe("Permalink to access the order on merchant site.")
|
|
1408
1910
|
}).describe("Order details available at the time of checkout completion.");
|
|
1409
1911
|
const OrderLineItemSchema = zod.object({
|
|
1410
1912
|
"id": zod.string().describe("Line item identifier."),
|
|
1411
1913
|
"item": zod.object({
|
|
1412
|
-
"id": zod.string().describe("
|
|
1914
|
+
"id": zod.string().describe("The product identifier, often the SKU, required to resolve the product details associated with this line item. Should be recognized by both the Platform, and the Business."),
|
|
1413
1915
|
"title": zod.string().describe("Product title."),
|
|
1414
|
-
"price": zod.number().int().gte(0).describe("Unit price in
|
|
1916
|
+
"price": zod.number().int().gte(0).describe("Unit price in ISO 4217 minor units."),
|
|
1415
1917
|
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
1416
1918
|
}).describe("Product data (id, title, price, image_url)."),
|
|
1417
1919
|
"quantity": zod.object({
|
|
1418
|
-
"
|
|
1419
|
-
"
|
|
1420
|
-
|
|
1920
|
+
"original": zod.number().int().gte(0).describe("Quantity from the original checkout.").optional(),
|
|
1921
|
+
"total": zod.number().int().gte(0).describe("Current total active quantity. May differ from original due to post-order modifications (e.g., returns or cancellations)."),
|
|
1922
|
+
"fulfilled": zod.number().int().gte(0).describe("Quantity fulfilled so far.")
|
|
1923
|
+
}).describe("Quantity tracking for the line item."),
|
|
1421
1924
|
"totals": zod.array(zod.object({
|
|
1422
|
-
"type": zod.
|
|
1423
|
-
"items_discount",
|
|
1424
|
-
"subtotal",
|
|
1425
|
-
"discount",
|
|
1426
|
-
"fulfillment",
|
|
1427
|
-
"tax",
|
|
1428
|
-
"fee",
|
|
1429
|
-
"total"
|
|
1430
|
-
]).describe("Type of total categorization."),
|
|
1925
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
1431
1926
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1432
|
-
"amount": zod.number().int().
|
|
1433
|
-
})).describe("Line item totals breakdown."),
|
|
1927
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
1928
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Line item totals breakdown."),
|
|
1434
1929
|
"status": zod.enum([
|
|
1435
1930
|
"processing",
|
|
1436
1931
|
"partial",
|
|
1437
|
-
"fulfilled"
|
|
1438
|
-
|
|
1932
|
+
"fulfilled",
|
|
1933
|
+
"removed"
|
|
1934
|
+
]).describe("Derived status: removed if quantity.total == 0, fulfilled if quantity.total > 0 and quantity.fulfilled == quantity.total, partial if quantity.total > 0 and quantity.fulfilled > 0, otherwise processing."),
|
|
1439
1935
|
"parent_id": zod.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
1440
1936
|
});
|
|
1937
|
+
const PaginationSchema = zod.record(zod.string(), zod.unknown()).describe("Cursor-based pagination for list operations.");
|
|
1441
1938
|
const PaymentCredentialSchema = zod.object({ "type": zod.string().describe("The credential type discriminator. Specific schemas will constrain this to a constant value.") }).passthrough().describe("The base definition for any payment credential. Handlers define specific credential types.");
|
|
1442
1939
|
const PaymentIdentitySchema = zod.object({ "access_token": zod.string().describe("Unique identifier for this participant, obtained during onboarding with the tokenizer.") }).describe("Identity of a participant for token binding. The access_token uniquely identifies the participant who tokens should be bound to.");
|
|
1443
1940
|
const PaymentInstrumentSchema = zod.object({
|
|
@@ -1470,6 +1967,166 @@ const PostalAddressSchema = zod.object({
|
|
|
1470
1967
|
"last_name": zod.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
1471
1968
|
"phone_number": zod.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
1472
1969
|
});
|
|
1970
|
+
const PriceSchema = zod.object({
|
|
1971
|
+
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
1972
|
+
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
1973
|
+
}).describe("Price with explicit currency.");
|
|
1974
|
+
const PriceFilterSchema = zod.object({
|
|
1975
|
+
"min": zod.number().int().gte(0).describe("Minimum price in ISO 4217 minor units.").optional(),
|
|
1976
|
+
"max": zod.number().int().gte(0).describe("Maximum price in ISO 4217 minor units.").optional()
|
|
1977
|
+
}).describe("Price range filter denominated in context.currency. When context.currency matches the presentment currency, businesses apply the filter directly. When it differs, businesses SHOULD convert filter values to the presentment currency before applying; if conversion is not supported, businesses MAY ignore the filter and SHOULD indicate this via a message. When context.currency is absent, filter denomination is ambiguous and businesses MAY ignore it.");
|
|
1978
|
+
const PriceRangeSchema = zod.object({
|
|
1979
|
+
"min": zod.object({
|
|
1980
|
+
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
1981
|
+
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
1982
|
+
}).describe("Minimum price in the range."),
|
|
1983
|
+
"max": zod.object({
|
|
1984
|
+
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
1985
|
+
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
1986
|
+
}).describe("Maximum price in the range.")
|
|
1987
|
+
}).describe("A price range representing minimum and maximum values (e.g., across product variants).");
|
|
1988
|
+
const ProductSchema = zod.object({
|
|
1989
|
+
"id": zod.string().describe("Global ID (GID) uniquely identifying this product."),
|
|
1990
|
+
"handle": zod.string().describe("URL-safe slug for SEO-friendly URLs (e.g., 'blue-runner-pro'). Use id for stable API references.").optional(),
|
|
1991
|
+
"title": zod.string().describe("Product title."),
|
|
1992
|
+
"description": zod.object({
|
|
1993
|
+
"plain": zod.string().describe("Plain text content.").optional(),
|
|
1994
|
+
"html": zod.string().describe("HTML-formatted content. Security: Platforms MUST sanitize before rendering—strip scripts, event handlers, and untrusted elements. Treat all rich text as untrusted input.").optional(),
|
|
1995
|
+
"markdown": zod.string().describe("Markdown-formatted content.").optional()
|
|
1996
|
+
}).describe("Product description in one or more formats."),
|
|
1997
|
+
"url": zod.string().url().describe("Canonical product page URL.").optional(),
|
|
1998
|
+
"categories": zod.array(zod.object({
|
|
1999
|
+
"value": zod.string().describe("Category value or path (e.g., 'Apparel > Shirts', '1604')."),
|
|
2000
|
+
"taxonomy": zod.string().describe("Source taxonomy. Well-known values: `google_product_category`, `shopify`, `merchant`.").optional()
|
|
2001
|
+
}).describe("A product category with optional taxonomy identifier.")).describe("Product categories with optional taxonomy identifiers.").optional(),
|
|
2002
|
+
"price_range": zod.object({
|
|
2003
|
+
"min": zod.object({
|
|
2004
|
+
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
2005
|
+
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
2006
|
+
}).describe("Minimum price in the range."),
|
|
2007
|
+
"max": zod.object({
|
|
2008
|
+
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
2009
|
+
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
2010
|
+
}).describe("Maximum price in the range.")
|
|
2011
|
+
}).describe("Price range across all variants."),
|
|
2012
|
+
"list_price_range": zod.object({
|
|
2013
|
+
"min": zod.object({
|
|
2014
|
+
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
2015
|
+
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
2016
|
+
}).describe("Minimum price in the range."),
|
|
2017
|
+
"max": zod.object({
|
|
2018
|
+
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
2019
|
+
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
2020
|
+
}).describe("Maximum price in the range.")
|
|
2021
|
+
}).describe("List price range before discounts (for strikethrough display).").optional(),
|
|
2022
|
+
"media": zod.array(zod.object({
|
|
2023
|
+
"type": zod.string().describe("Media type. Well-known values: `image`, `video`, `model_3d`."),
|
|
2024
|
+
"url": zod.string().url().describe("URL to the media resource."),
|
|
2025
|
+
"alt_text": zod.string().describe("Accessibility text describing the media.").optional(),
|
|
2026
|
+
"width": zod.number().int().gte(1).describe("Width in pixels (for images/video).").optional(),
|
|
2027
|
+
"height": zod.number().int().gte(1).describe("Height in pixels (for images/video).").optional()
|
|
2028
|
+
}).describe("Product media item (image, video, etc.).")).describe("Product media (images, videos, 3D models). First item is the featured media for listings.").optional(),
|
|
2029
|
+
"options": zod.array(zod.object({
|
|
2030
|
+
"name": zod.string().describe("Option name (e.g., 'Size', 'Color')."),
|
|
2031
|
+
"values": zod.array(zod.object({
|
|
2032
|
+
"id": zod.string().describe("Optional server-assigned identifier for this option value. When present in a selected_option, the server SHOULD use it for matching instead of label.").optional(),
|
|
2033
|
+
"label": zod.string().describe("Display text for this option value (e.g., 'Small', 'Blue').")
|
|
2034
|
+
}).describe("A selectable value for a product option.")).min(1).describe("Available values for this option.")
|
|
2035
|
+
}).describe("A product option such as size, color, or material.")).describe("Product options (Size, Color, etc.).").optional(),
|
|
2036
|
+
"variants": zod.array(zod.object({
|
|
2037
|
+
"id": zod.string().describe("Global ID (GID) uniquely identifying this variant. Used as item.id in checkout."),
|
|
2038
|
+
"sku": zod.string().describe("Business-assigned identifier for inventory and fulfillment.").optional(),
|
|
2039
|
+
"barcodes": zod.array(zod.object({
|
|
2040
|
+
"type": zod.string().describe("Barcode standard. Well-known values: UPC, EAN, ISBN, GTIN, JAN."),
|
|
2041
|
+
"value": zod.string().describe("Barcode value.")
|
|
2042
|
+
})).describe("Industry-standard product identifiers for cross-reference and correlation.").optional(),
|
|
2043
|
+
"handle": zod.string().describe("URL-safe variant handle/slug.").optional(),
|
|
2044
|
+
"title": zod.string().describe("Variant display title (e.g., 'Blue / Large')."),
|
|
2045
|
+
"description": zod.object({
|
|
2046
|
+
"plain": zod.string().describe("Plain text content.").optional(),
|
|
2047
|
+
"html": zod.string().describe("HTML-formatted content. Security: Platforms MUST sanitize before rendering—strip scripts, event handlers, and untrusted elements. Treat all rich text as untrusted input.").optional(),
|
|
2048
|
+
"markdown": zod.string().describe("Markdown-formatted content.").optional()
|
|
2049
|
+
}).describe("Variant description in one or more formats."),
|
|
2050
|
+
"url": zod.string().url().describe("Canonical variant page URL.").optional(),
|
|
2051
|
+
"categories": zod.array(zod.object({
|
|
2052
|
+
"value": zod.string().describe("Category value or path (e.g., 'Apparel > Shirts', '1604')."),
|
|
2053
|
+
"taxonomy": zod.string().describe("Source taxonomy. Well-known values: `google_product_category`, `shopify`, `merchant`.").optional()
|
|
2054
|
+
}).describe("A product category with optional taxonomy identifier.")).describe("Variant categories with optional taxonomy identifiers.").optional(),
|
|
2055
|
+
"price": zod.object({
|
|
2056
|
+
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
2057
|
+
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
2058
|
+
}).describe("Current selling price."),
|
|
2059
|
+
"list_price": zod.object({
|
|
2060
|
+
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
2061
|
+
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
2062
|
+
}).describe("List price before discounts (for strikethrough display).").optional(),
|
|
2063
|
+
"unit_price": zod.object({
|
|
2064
|
+
"amount": zod.number().int().gte(0).describe("Unit price in ISO 4217 minor units. Business MUST return precomputed unit price value: (variant.price / measure.value) * reference.value."),
|
|
2065
|
+
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code."),
|
|
2066
|
+
"measure": zod.object({
|
|
2067
|
+
"value": zod.number().describe("Package quantity."),
|
|
2068
|
+
"unit": zod.string().describe("Unit of measurement.")
|
|
2069
|
+
}).describe("Product quantity in packaging (e.g., 750ml bottle)."),
|
|
2070
|
+
"reference": zod.object({
|
|
2071
|
+
"value": zod.number().int().describe("Reference quantity."),
|
|
2072
|
+
"unit": zod.string().describe("Unit of measurement.")
|
|
2073
|
+
}).describe("Denominator for unit price display (e.g., per 100ml, per 1kg).")
|
|
2074
|
+
}).describe("Price per standard unit of measurement. MAY be omitted when unit pricing does not apply.").optional(),
|
|
2075
|
+
"availability": zod.object({
|
|
2076
|
+
"available": zod.boolean().describe("Whether this variant can be purchased. See status for fulfillment details.").optional(),
|
|
2077
|
+
"status": zod.string().describe("Qualifies available with fulfillment state. Well-known values: `in_stock`, `backorder`, `preorder`, `out_of_stock`, `discontinued`.").optional()
|
|
2078
|
+
}).describe("Variant availability for purchase.").optional(),
|
|
2079
|
+
"selected_options": zod.array(zod.object({
|
|
2080
|
+
"name": zod.string().describe("Option name (e.g., 'Size')."),
|
|
2081
|
+
"id": zod.string().describe("Optional option value identifier from option_value.id. When present, the server SHOULD use it for matching; name and label remain required for display.").optional(),
|
|
2082
|
+
"label": zod.string().describe("Selected option label (e.g., 'Large').")
|
|
2083
|
+
}).describe("A specific option selection on a variant (e.g., Size: Large).")).describe("Option selections that define this variant.").optional(),
|
|
2084
|
+
"media": zod.array(zod.object({
|
|
2085
|
+
"type": zod.string().describe("Media type. Well-known values: `image`, `video`, `model_3d`."),
|
|
2086
|
+
"url": zod.string().url().describe("URL to the media resource."),
|
|
2087
|
+
"alt_text": zod.string().describe("Accessibility text describing the media.").optional(),
|
|
2088
|
+
"width": zod.number().int().gte(1).describe("Width in pixels (for images/video).").optional(),
|
|
2089
|
+
"height": zod.number().int().gte(1).describe("Height in pixels (for images/video).").optional()
|
|
2090
|
+
}).describe("Product media item (image, video, etc.).")).describe("Variant media (images, videos, 3D models). First item is the featured media for listings.").optional(),
|
|
2091
|
+
"rating": zod.object({
|
|
2092
|
+
"value": zod.number().gte(0).describe("Average rating value."),
|
|
2093
|
+
"scale_min": zod.number().gte(0).describe("Minimum value on the rating scale (e.g., 1 for 1-5 stars).").default(1),
|
|
2094
|
+
"scale_max": zod.number().gte(1).describe("Maximum value on the rating scale (e.g., 5 for 5-star)."),
|
|
2095
|
+
"count": zod.number().int().gte(0).describe("Number of reviews contributing to the rating.").optional()
|
|
2096
|
+
}).describe("Variant rating.").optional(),
|
|
2097
|
+
"tags": zod.array(zod.string()).describe("Variant tags for categorization and search.").optional(),
|
|
2098
|
+
"metadata": zod.record(zod.string(), zod.unknown()).describe("Business-defined custom data extending the standard variant model.").optional(),
|
|
2099
|
+
"seller": zod.object({
|
|
2100
|
+
"name": zod.string().describe("Seller display name.").optional(),
|
|
2101
|
+
"links": zod.array(zod.object({
|
|
2102
|
+
"type": zod.string().describe("Type of link. Well-known values: `privacy_policy`, `terms_of_service`, `refund_policy`, `shipping_policy`, `faq`. Consumers SHOULD handle unknown values gracefully by displaying them using the `title` field or omitting the link."),
|
|
2103
|
+
"url": zod.string().url().describe("The actual URL pointing to the content to be displayed."),
|
|
2104
|
+
"title": zod.string().describe("Optional display text for the link. When provided, use this instead of generating from type.").optional()
|
|
2105
|
+
})).describe("Seller policy and information links.").optional()
|
|
2106
|
+
}).describe("Optional seller context for this variant.").optional()
|
|
2107
|
+
}).describe("A purchasable variant of a product with specific option selections.")).min(1).describe("Purchasable variants of this product. First item is the featured variant for listings."),
|
|
2108
|
+
"rating": zod.object({
|
|
2109
|
+
"value": zod.number().gte(0).describe("Average rating value."),
|
|
2110
|
+
"scale_min": zod.number().gte(0).describe("Minimum value on the rating scale (e.g., 1 for 1-5 stars).").default(1),
|
|
2111
|
+
"scale_max": zod.number().gte(1).describe("Maximum value on the rating scale (e.g., 5 for 5-star)."),
|
|
2112
|
+
"count": zod.number().int().gte(0).describe("Number of reviews contributing to the rating.").optional()
|
|
2113
|
+
}).describe("Aggregate product rating.").optional(),
|
|
2114
|
+
"tags": zod.array(zod.string()).describe("Product tags for categorization and search.").optional(),
|
|
2115
|
+
"metadata": zod.record(zod.string(), zod.unknown()).describe("Business-defined custom data extending the standard product model.").optional()
|
|
2116
|
+
}).describe("A product in the catalog with variants and options.");
|
|
2117
|
+
const ProductOptionSchema = zod.object({
|
|
2118
|
+
"name": zod.string().describe("Option name (e.g., 'Size', 'Color')."),
|
|
2119
|
+
"values": zod.array(zod.object({
|
|
2120
|
+
"id": zod.string().describe("Optional server-assigned identifier for this option value. When present in a selected_option, the server SHOULD use it for matching instead of label.").optional(),
|
|
2121
|
+
"label": zod.string().describe("Display text for this option value (e.g., 'Small', 'Blue').")
|
|
2122
|
+
}).describe("A selectable value for a product option.")).min(1).describe("Available values for this option.")
|
|
2123
|
+
}).describe("A product option such as size, color, or material.");
|
|
2124
|
+
const RatingSchema = zod.object({
|
|
2125
|
+
"value": zod.number().gte(0).describe("Average rating value."),
|
|
2126
|
+
"scale_min": zod.number().gte(0).describe("Minimum value on the rating scale (e.g., 1 for 1-5 stars).").default(1),
|
|
2127
|
+
"scale_max": zod.number().gte(1).describe("Maximum value on the rating scale (e.g., 5 for 5-star)."),
|
|
2128
|
+
"count": zod.number().int().gte(0).describe("Number of reviews contributing to the rating.").optional()
|
|
2129
|
+
}).describe("Product rating aggregate.");
|
|
1473
2130
|
const RetailLocationSchema = zod.object({
|
|
1474
2131
|
"id": zod.string().describe("Unique location identifier."),
|
|
1475
2132
|
"name": zod.string().describe("Location name (e.g., store name)."),
|
|
@@ -1485,6 +2142,19 @@ const RetailLocationSchema = zod.object({
|
|
|
1485
2142
|
"phone_number": zod.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
1486
2143
|
}).describe("Physical address of the location.").optional()
|
|
1487
2144
|
}).passthrough().describe("A pickup location (retail store, locker, etc.).");
|
|
2145
|
+
const ReverseDomainNameSchema = zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Reverse-domain identifier used for collision-safe namespacing of capabilities, services, handlers, eligibility claims, and extension-contributed keys. Must contain at least two dot-separated segments (e.g., 'dev.ucp.shopping.checkout', 'com.example.loyalty_gold').");
|
|
2146
|
+
const SearchFiltersSchema = zod.object({
|
|
2147
|
+
"categories": zod.array(zod.string()).describe("Filter by product categories (OR logic — matches products in any listed categories). Values match against the value field in product category entries. Valid values can be discovered from the categories field in search results, merchant documentation, or standard taxonomies that businesses may align with.").optional(),
|
|
2148
|
+
"price": zod.object({
|
|
2149
|
+
"min": zod.number().int().gte(0).describe("Minimum price in ISO 4217 minor units.").optional(),
|
|
2150
|
+
"max": zod.number().int().gte(0).describe("Maximum price in ISO 4217 minor units.").optional()
|
|
2151
|
+
}).describe("Price range filter denominated in context.currency. When context.currency matches the presentment currency, businesses apply the filter directly. When it differs, businesses SHOULD convert filter values to the presentment currency before applying; if conversion is not supported, businesses MAY ignore the filter and SHOULD indicate this via a message. When context.currency is absent, filter denomination is ambiguous and businesses MAY ignore it.").optional()
|
|
2152
|
+
}).passthrough().describe("Filter criteria to narrow search results. All specified filters combine with AND logic.");
|
|
2153
|
+
const SelectedOptionSchema = zod.object({
|
|
2154
|
+
"name": zod.string().describe("Option name (e.g., 'Size')."),
|
|
2155
|
+
"id": zod.string().describe("Optional option value identifier from option_value.id. When present, the server SHOULD use it for matching; name and label remain required for display.").optional(),
|
|
2156
|
+
"label": zod.string().describe("Selected option label (e.g., 'Large').")
|
|
2157
|
+
}).describe("A specific option selection on a variant (e.g., Size: Large).");
|
|
1488
2158
|
const ShippingDestinationSchema = zod.record(zod.string(), zod.unknown()).and(zod.intersection(zod.object({
|
|
1489
2159
|
"extended_address": zod.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
1490
2160
|
"street_address": zod.string().describe("The street address.").optional(),
|
|
@@ -1496,26 +2166,119 @@ const ShippingDestinationSchema = zod.record(zod.string(), zod.unknown()).and(zo
|
|
|
1496
2166
|
"last_name": zod.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
1497
2167
|
"phone_number": zod.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
1498
2168
|
}), zod.object({ "id": zod.string().describe("ID specific to this shipping destination.") }))).describe("Shipping destination.");
|
|
2169
|
+
const SignalsSchema = zod.object({
|
|
2170
|
+
"dev.ucp.buyer_ip": zod.string().describe("Client's IP address (IPv4 or IPv6).").optional(),
|
|
2171
|
+
"dev.ucp.user_agent": zod.string().describe("Client's HTTP User-Agent header or equivalent.").optional()
|
|
2172
|
+
}).passthrough().describe("Environment data provided by the platform to support authorization and abuse prevention. Values MUST NOT be buyer-asserted claims — platforms provide signals based on direct observation or independently verifiable third-party attestations. All signal keys MUST use reverse-domain naming to ensure provenance and prevent collisions when multiple extensions contribute to the shared namespace.");
|
|
2173
|
+
const SignedAmountSchema = zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).");
|
|
1499
2174
|
const TokenCredentialSchema = zod.intersection(zod.object({ "type": zod.string().describe("The credential type discriminator. Specific schemas will constrain this to a constant value.") }).passthrough().describe("The base definition for any payment credential. Handlers define specific credential types."), zod.object({
|
|
1500
2175
|
"type": zod.string().describe("The specific type of token produced by the handler (e.g., 'stripe_token')."),
|
|
1501
2176
|
"token": zod.string().describe("The token value.")
|
|
1502
2177
|
})).describe("Base token credential schema. Concrete payment handlers may extend this schema with additional fields and define their own constraints.");
|
|
1503
2178
|
const TotalSchema = zod.object({
|
|
1504
|
-
"type": zod.
|
|
1505
|
-
"items_discount",
|
|
1506
|
-
"subtotal",
|
|
1507
|
-
"discount",
|
|
1508
|
-
"fulfillment",
|
|
1509
|
-
"tax",
|
|
1510
|
-
"fee",
|
|
1511
|
-
"total"
|
|
1512
|
-
]).describe("Type of total categorization."),
|
|
2179
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
1513
2180
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1514
|
-
"amount": zod.number().int().
|
|
1515
|
-
});
|
|
1516
|
-
const
|
|
2181
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
2182
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text.");
|
|
2183
|
+
const TotalsSchema = zod.array(zod.intersection(zod.object({
|
|
2184
|
+
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
2185
|
+
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
2186
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
2187
|
+
}).and(zod.intersection(zod.any(), zod.any())).describe("A cost breakdown entry with a category, amount, and optional display text."), zod.intersection(zod.object({ "lines": zod.array(zod.object({
|
|
2188
|
+
"display_text": zod.string().describe("Human-readable label for this sub-line."),
|
|
2189
|
+
"amount": zod.number().int().describe("Monetary amount in the currency's minor unit as defined by ISO 4217. Refer to the currency's exponent to determine minor-to-major ratio (e.g., 2 for USD, 0 for JPY, 3 for KWD). May be negative — the sign is intrinsic to the value (e.g., discounts are negative, charges are positive).")
|
|
2190
|
+
}).describe("Sub-line entry. Additional metadata MAY be included.")).describe("Optional itemized breakdown. The parent entry is always rendered; lines are supplementary. Sum of line amounts MUST equal the parent entry amount.").optional() }), zod.any()))).describe("Pricing breakdown provided by the business. MUST contain exactly one subtotal and one total entry. Detail types (tax, fee, discount, fulfillment) may appear multiple times for itemization. Platforms MUST render all entries in order using display_text and amount.");
|
|
2191
|
+
const VariantSchema = zod.object({
|
|
2192
|
+
"id": zod.string().describe("Global ID (GID) uniquely identifying this variant. Used as item.id in checkout."),
|
|
2193
|
+
"sku": zod.string().describe("Business-assigned identifier for inventory and fulfillment.").optional(),
|
|
2194
|
+
"barcodes": zod.array(zod.object({
|
|
2195
|
+
"type": zod.string().describe("Barcode standard. Well-known values: UPC, EAN, ISBN, GTIN, JAN."),
|
|
2196
|
+
"value": zod.string().describe("Barcode value.")
|
|
2197
|
+
})).describe("Industry-standard product identifiers for cross-reference and correlation.").optional(),
|
|
2198
|
+
"handle": zod.string().describe("URL-safe variant handle/slug.").optional(),
|
|
2199
|
+
"title": zod.string().describe("Variant display title (e.g., 'Blue / Large')."),
|
|
2200
|
+
"description": zod.object({
|
|
2201
|
+
"plain": zod.string().describe("Plain text content.").optional(),
|
|
2202
|
+
"html": zod.string().describe("HTML-formatted content. Security: Platforms MUST sanitize before rendering—strip scripts, event handlers, and untrusted elements. Treat all rich text as untrusted input.").optional(),
|
|
2203
|
+
"markdown": zod.string().describe("Markdown-formatted content.").optional()
|
|
2204
|
+
}).describe("Variant description in one or more formats."),
|
|
2205
|
+
"url": zod.string().url().describe("Canonical variant page URL.").optional(),
|
|
2206
|
+
"categories": zod.array(zod.object({
|
|
2207
|
+
"value": zod.string().describe("Category value or path (e.g., 'Apparel > Shirts', '1604')."),
|
|
2208
|
+
"taxonomy": zod.string().describe("Source taxonomy. Well-known values: `google_product_category`, `shopify`, `merchant`.").optional()
|
|
2209
|
+
}).describe("A product category with optional taxonomy identifier.")).describe("Variant categories with optional taxonomy identifiers.").optional(),
|
|
2210
|
+
"price": zod.object({
|
|
2211
|
+
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
2212
|
+
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
2213
|
+
}).describe("Current selling price."),
|
|
2214
|
+
"list_price": zod.object({
|
|
2215
|
+
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
2216
|
+
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
2217
|
+
}).describe("List price before discounts (for strikethrough display).").optional(),
|
|
2218
|
+
"unit_price": zod.object({
|
|
2219
|
+
"amount": zod.number().int().gte(0).describe("Unit price in ISO 4217 minor units. Business MUST return precomputed unit price value: (variant.price / measure.value) * reference.value."),
|
|
2220
|
+
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code."),
|
|
2221
|
+
"measure": zod.object({
|
|
2222
|
+
"value": zod.number().describe("Package quantity."),
|
|
2223
|
+
"unit": zod.string().describe("Unit of measurement.")
|
|
2224
|
+
}).describe("Product quantity in packaging (e.g., 750ml bottle)."),
|
|
2225
|
+
"reference": zod.object({
|
|
2226
|
+
"value": zod.number().int().describe("Reference quantity."),
|
|
2227
|
+
"unit": zod.string().describe("Unit of measurement.")
|
|
2228
|
+
}).describe("Denominator for unit price display (e.g., per 100ml, per 1kg).")
|
|
2229
|
+
}).describe("Price per standard unit of measurement. MAY be omitted when unit pricing does not apply.").optional(),
|
|
2230
|
+
"availability": zod.object({
|
|
2231
|
+
"available": zod.boolean().describe("Whether this variant can be purchased. See status for fulfillment details.").optional(),
|
|
2232
|
+
"status": zod.string().describe("Qualifies available with fulfillment state. Well-known values: `in_stock`, `backorder`, `preorder`, `out_of_stock`, `discontinued`.").optional()
|
|
2233
|
+
}).describe("Variant availability for purchase.").optional(),
|
|
2234
|
+
"selected_options": zod.array(zod.object({
|
|
2235
|
+
"name": zod.string().describe("Option name (e.g., 'Size')."),
|
|
2236
|
+
"id": zod.string().describe("Optional option value identifier from option_value.id. When present, the server SHOULD use it for matching; name and label remain required for display.").optional(),
|
|
2237
|
+
"label": zod.string().describe("Selected option label (e.g., 'Large').")
|
|
2238
|
+
}).describe("A specific option selection on a variant (e.g., Size: Large).")).describe("Option selections that define this variant.").optional(),
|
|
2239
|
+
"media": zod.array(zod.object({
|
|
2240
|
+
"type": zod.string().describe("Media type. Well-known values: `image`, `video`, `model_3d`."),
|
|
2241
|
+
"url": zod.string().url().describe("URL to the media resource."),
|
|
2242
|
+
"alt_text": zod.string().describe("Accessibility text describing the media.").optional(),
|
|
2243
|
+
"width": zod.number().int().gte(1).describe("Width in pixels (for images/video).").optional(),
|
|
2244
|
+
"height": zod.number().int().gte(1).describe("Height in pixels (for images/video).").optional()
|
|
2245
|
+
}).describe("Product media item (image, video, etc.).")).describe("Variant media (images, videos, 3D models). First item is the featured media for listings.").optional(),
|
|
2246
|
+
"rating": zod.object({
|
|
2247
|
+
"value": zod.number().gte(0).describe("Average rating value."),
|
|
2248
|
+
"scale_min": zod.number().gte(0).describe("Minimum value on the rating scale (e.g., 1 for 1-5 stars).").default(1),
|
|
2249
|
+
"scale_max": zod.number().gte(1).describe("Maximum value on the rating scale (e.g., 5 for 5-star)."),
|
|
2250
|
+
"count": zod.number().int().gte(0).describe("Number of reviews contributing to the rating.").optional()
|
|
2251
|
+
}).describe("Variant rating.").optional(),
|
|
2252
|
+
"tags": zod.array(zod.string()).describe("Variant tags for categorization and search.").optional(),
|
|
2253
|
+
"metadata": zod.record(zod.string(), zod.unknown()).describe("Business-defined custom data extending the standard variant model.").optional(),
|
|
2254
|
+
"seller": zod.object({
|
|
2255
|
+
"name": zod.string().describe("Seller display name.").optional(),
|
|
2256
|
+
"links": zod.array(zod.object({
|
|
2257
|
+
"type": zod.string().describe("Type of link. Well-known values: `privacy_policy`, `terms_of_service`, `refund_policy`, `shipping_policy`, `faq`. Consumers SHOULD handle unknown values gracefully by displaying them using the `title` field or omitting the link."),
|
|
2258
|
+
"url": zod.string().url().describe("The actual URL pointing to the content to be displayed."),
|
|
2259
|
+
"title": zod.string().describe("Optional display text for the link. When provided, use this instead of generating from type.").optional()
|
|
2260
|
+
})).describe("Seller policy and information links.").optional()
|
|
2261
|
+
}).describe("Optional seller context for this variant.").optional()
|
|
2262
|
+
}).describe("A purchasable variant of a product with specific option selections.");
|
|
2263
|
+
const EmbeddedConfigSchema = zod.object({
|
|
2264
|
+
"delegate": zod.array(zod.string()).describe("Delegations the business allows. At service-level, declares available delegations. In UCP responses, confirms accepted delegations for this session.").optional(),
|
|
2265
|
+
"color_scheme": zod.array(zod.enum(["light", "dark"])).describe("Color schemes the business supports. Hosts use ec_color_scheme query parameter to request a scheme from this list.").optional()
|
|
2266
|
+
}).describe("Per-session configuration for embedded transport binding. Allows businesses to vary EP availability and delegations based on cart contents, agent authorization, or policy.");
|
|
1517
2267
|
const UcpVersionSchema = zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format.");
|
|
1518
|
-
const
|
|
2268
|
+
const UcpVersionConstraintSchema = zod.object({
|
|
2269
|
+
"min": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Minimum required version (inclusive)."),
|
|
2270
|
+
"max": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Maximum compatible version (inclusive). When absent, no upper bound.").optional()
|
|
2271
|
+
}).passthrough().describe("Version range requirement with minimum and optional maximum.");
|
|
2272
|
+
const UcpRequiresSchema = zod.object({
|
|
2273
|
+
"protocol": zod.object({
|
|
2274
|
+
"min": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Minimum required version (inclusive)."),
|
|
2275
|
+
"max": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Maximum compatible version (inclusive). When absent, no upper bound.").optional()
|
|
2276
|
+
}).passthrough().describe("Required protocol version.").optional(),
|
|
2277
|
+
"capabilities": zod.record(zod.object({
|
|
2278
|
+
"min": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Minimum required version (inclusive)."),
|
|
2279
|
+
"max": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Maximum compatible version (inclusive). When absent, no upper bound.").optional()
|
|
2280
|
+
}).passthrough().describe("Version range requirement with minimum and optional maximum.")).describe("Required capability versions, keyed by capability name. Keys must be a subset of the extension's $defs keys.").optional()
|
|
2281
|
+
}).passthrough().describe("Version requirements for extension schemas. Declares minimum (and optionally maximum) protocol and capability versions needed for correct operation.");
|
|
1519
2282
|
const UcpEntitySchema = zod.object({
|
|
1520
2283
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1521
2284
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -1525,6 +2288,157 @@ const UcpEntitySchema = zod.object({
|
|
|
1525
2288
|
}).describe("Shared foundation for all UCP entities.");
|
|
1526
2289
|
const UcpBaseSchema = zod.object({
|
|
1527
2290
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2291
|
+
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
2292
|
+
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
2293
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2294
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2295
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2296
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2297
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2298
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({
|
|
2299
|
+
"transport": zod.enum([
|
|
2300
|
+
"rest",
|
|
2301
|
+
"mcp",
|
|
2302
|
+
"a2a",
|
|
2303
|
+
"embedded"
|
|
2304
|
+
]).describe("Transport protocol for this service binding."),
|
|
2305
|
+
"endpoint": zod.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
2306
|
+
})))).describe("Service registry keyed by reverse-domain name.").optional(),
|
|
2307
|
+
"capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
2308
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2309
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2310
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2311
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2312
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2313
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2314
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
2315
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2316
|
+
const passed = schemas.length - errors.length;
|
|
2317
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2318
|
+
path: ctx.path,
|
|
2319
|
+
code: "invalid_union",
|
|
2320
|
+
unionErrors: errors,
|
|
2321
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2322
|
+
} : {
|
|
2323
|
+
path: ctx.path,
|
|
2324
|
+
code: "custom",
|
|
2325
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2326
|
+
});
|
|
2327
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
2328
|
+
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
2329
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2330
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2331
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2332
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2333
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2334
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
2335
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2336
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2337
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
2338
|
+
}).describe("Base UCP metadata with shared properties for all schema types.");
|
|
2339
|
+
const UcpSuccessSchema = zod.intersection(zod.object({
|
|
2340
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2341
|
+
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
2342
|
+
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
2343
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2344
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2345
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2346
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2347
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2348
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({
|
|
2349
|
+
"transport": zod.enum([
|
|
2350
|
+
"rest",
|
|
2351
|
+
"mcp",
|
|
2352
|
+
"a2a",
|
|
2353
|
+
"embedded"
|
|
2354
|
+
]).describe("Transport protocol for this service binding."),
|
|
2355
|
+
"endpoint": zod.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
2356
|
+
})))).describe("Service registry keyed by reverse-domain name.").optional(),
|
|
2357
|
+
"capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
2358
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2359
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2360
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2361
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2362
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2363
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2364
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
2365
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2366
|
+
const passed = schemas.length - errors.length;
|
|
2367
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2368
|
+
path: ctx.path,
|
|
2369
|
+
code: "invalid_union",
|
|
2370
|
+
unionErrors: errors,
|
|
2371
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2372
|
+
} : {
|
|
2373
|
+
path: ctx.path,
|
|
2374
|
+
code: "custom",
|
|
2375
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2376
|
+
});
|
|
2377
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
2378
|
+
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
2379
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2380
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2381
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2382
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2383
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2384
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
2385
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2386
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2387
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
2388
|
+
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({ "status": zod.literal("success") })).describe("UCP metadata with status 'success'. Use for response branches that carry the expected payload.");
|
|
2389
|
+
const UcpErrorSchema = zod.intersection(zod.object({
|
|
2390
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2391
|
+
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
2392
|
+
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
2393
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2394
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2395
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2396
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2397
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2398
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({
|
|
2399
|
+
"transport": zod.enum([
|
|
2400
|
+
"rest",
|
|
2401
|
+
"mcp",
|
|
2402
|
+
"a2a",
|
|
2403
|
+
"embedded"
|
|
2404
|
+
]).describe("Transport protocol for this service binding."),
|
|
2405
|
+
"endpoint": zod.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
2406
|
+
})))).describe("Service registry keyed by reverse-domain name.").optional(),
|
|
2407
|
+
"capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
2408
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2409
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2410
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2411
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2412
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2413
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2414
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
2415
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2416
|
+
const passed = schemas.length - errors.length;
|
|
2417
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2418
|
+
path: ctx.path,
|
|
2419
|
+
code: "invalid_union",
|
|
2420
|
+
unionErrors: errors,
|
|
2421
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2422
|
+
} : {
|
|
2423
|
+
path: ctx.path,
|
|
2424
|
+
code: "custom",
|
|
2425
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2426
|
+
});
|
|
2427
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
2428
|
+
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
2429
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2430
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2431
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2432
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2433
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2434
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
2435
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2436
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2437
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
2438
|
+
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({ "status": zod.literal("error") })).describe("UCP metadata with status 'error'. Use for response branches that carry error information.");
|
|
2439
|
+
const UcpPlatformSchema = zod.intersection(zod.object({
|
|
2440
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2441
|
+
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
1528
2442
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
1529
2443
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1530
2444
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -1546,17 +2460,87 @@ const UcpBaseSchema = zod.object({
|
|
|
1546
2460
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1547
2461
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1548
2462
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1549
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2463
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2464
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
2465
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2466
|
+
const passed = schemas.length - errors.length;
|
|
2467
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2468
|
+
path: ctx.path,
|
|
2469
|
+
code: "invalid_union",
|
|
2470
|
+
unionErrors: errors,
|
|
2471
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2472
|
+
} : {
|
|
2473
|
+
path: ctx.path,
|
|
2474
|
+
code: "custom",
|
|
2475
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2476
|
+
});
|
|
2477
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
1550
2478
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
1551
2479
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1552
2480
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1553
2481
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1554
2482
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1555
2483
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1556
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
1557
|
-
|
|
1558
|
-
|
|
2484
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
2485
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2486
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2487
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
2488
|
+
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({
|
|
2489
|
+
"services": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
2490
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2491
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2492
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2493
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2494
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2495
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({
|
|
2496
|
+
"transport": zod.enum([
|
|
2497
|
+
"rest",
|
|
2498
|
+
"mcp",
|
|
2499
|
+
"a2a",
|
|
2500
|
+
"embedded"
|
|
2501
|
+
]).describe("Transport protocol for this service binding."),
|
|
2502
|
+
"endpoint": zod.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
2503
|
+
})), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.union([
|
|
2504
|
+
zod.object({ "transport": zod.literal("rest").optional() }),
|
|
2505
|
+
zod.object({ "transport": zod.literal("mcp").optional() }),
|
|
2506
|
+
zod.object({ "transport": zod.literal("a2a").optional() }),
|
|
2507
|
+
zod.object({ "transport": zod.literal("embedded").optional() })
|
|
2508
|
+
]))).describe("Full service declaration for platform-level discovery. All transports require `version`, `spec`, and `transport`. REST and MCP additionally require `schema` and `endpoint`; A2A requires `endpoint`; embedded requires `schema`."))),
|
|
2509
|
+
"capabilities": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
2510
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2511
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2512
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2513
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2514
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2515
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2516
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
2517
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2518
|
+
const passed = schemas.length - errors.length;
|
|
2519
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2520
|
+
path: ctx.path,
|
|
2521
|
+
code: "invalid_union",
|
|
2522
|
+
unionErrors: errors,
|
|
2523
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2524
|
+
} : {
|
|
2525
|
+
path: ctx.path,
|
|
2526
|
+
code: "custom",
|
|
2527
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2528
|
+
});
|
|
2529
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })), zod.record(zod.string(), zod.unknown())).describe("Full capability declaration for platform-level discovery. Includes spec/schema URLs for agent fetching."))).optional(),
|
|
2530
|
+
"payment_handlers": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
2531
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2532
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2533
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2534
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2535
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2536
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
2537
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2538
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2539
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))), zod.record(zod.string(), zod.unknown())).describe("Platform declaration for discovery profiles. May include partial config state required for discovery.")))
|
|
2540
|
+
})).describe("Full UCP metadata for platform-level configuration. Hosted at a URI advertised by the platform in request headers.");
|
|
2541
|
+
const UcpBusinessSchema = zod.intersection(zod.object({
|
|
1559
2542
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2543
|
+
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
1560
2544
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
1561
2545
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1562
2546
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -1578,15 +2562,33 @@ const UcpPlatformSchema = zod.intersection(zod.object({
|
|
|
1578
2562
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1579
2563
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1580
2564
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1581
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2565
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2566
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
2567
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2568
|
+
const passed = schemas.length - errors.length;
|
|
2569
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2570
|
+
path: ctx.path,
|
|
2571
|
+
code: "invalid_union",
|
|
2572
|
+
unionErrors: errors,
|
|
2573
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2574
|
+
} : {
|
|
2575
|
+
path: ctx.path,
|
|
2576
|
+
code: "custom",
|
|
2577
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2578
|
+
});
|
|
2579
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
1582
2580
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
1583
2581
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1584
2582
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1585
2583
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1586
2584
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1587
2585
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1588
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
2586
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
2587
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2588
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2589
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
1589
2590
|
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({
|
|
2591
|
+
"supported_versions": zod.record(zod.string().url()).describe("Previous protocol versions this business supports, mapped to profile URIs. Businesses that support older protocol versions SHOULD advertise each version and link to its profile. Each URI points to a complete, self-contained profile for that version. When omitted, only `version` is supported.").optional(),
|
|
1590
2592
|
"services": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
1591
2593
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1592
2594
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -1601,29 +2603,53 @@ const UcpPlatformSchema = zod.intersection(zod.object({
|
|
|
1601
2603
|
"embedded"
|
|
1602
2604
|
]).describe("Transport protocol for this service binding."),
|
|
1603
2605
|
"endpoint": zod.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
1604
|
-
})), zod.
|
|
2606
|
+
})), zod.union([
|
|
1605
2607
|
zod.object({ "transport": zod.literal("rest").optional() }),
|
|
1606
2608
|
zod.object({ "transport": zod.literal("mcp").optional() }),
|
|
1607
2609
|
zod.object({ "transport": zod.literal("a2a").optional() }),
|
|
1608
|
-
zod.object({
|
|
1609
|
-
|
|
1610
|
-
|
|
2610
|
+
zod.object({
|
|
2611
|
+
"transport": zod.literal("embedded").optional(),
|
|
2612
|
+
"config": zod.object({
|
|
2613
|
+
"delegate": zod.array(zod.string()).describe("Delegations the business allows. At service-level, declares available delegations. In UCP responses, confirms accepted delegations for this session.").optional(),
|
|
2614
|
+
"color_scheme": zod.array(zod.enum(["light", "dark"])).describe("Color schemes the business supports. Hosts use ec_color_scheme query parameter to request a scheme from this list.").optional()
|
|
2615
|
+
}).describe("Per-session configuration for embedded transport binding. Allows businesses to vary EP availability and delegations based on cart contents, agent authorization, or policy.").optional()
|
|
2616
|
+
})
|
|
2617
|
+
])).describe("Service binding for business/merchant configuration. May override platform endpoints."))),
|
|
2618
|
+
"capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
1611
2619
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1612
2620
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1613
2621
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1614
2622
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1615
2623
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1616
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
1617
|
-
|
|
2624
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2625
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
2626
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2627
|
+
const passed = schemas.length - errors.length;
|
|
2628
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2629
|
+
path: ctx.path,
|
|
2630
|
+
code: "invalid_union",
|
|
2631
|
+
unionErrors: errors,
|
|
2632
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2633
|
+
} : {
|
|
2634
|
+
path: ctx.path,
|
|
2635
|
+
code: "custom",
|
|
2636
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2637
|
+
});
|
|
2638
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })).describe("Capability configuration for business/merchant level. May include business-specific config overrides."))).optional(),
|
|
2639
|
+
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
1618
2640
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1619
2641
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1620
2642
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1621
2643
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1622
2644
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1623
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
1624
|
-
|
|
1625
|
-
|
|
2645
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
2646
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2647
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2648
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))).describe("Business declaration for discovery profiles. May include partial config state required for discovery.")))
|
|
2649
|
+
})).describe("UCP metadata for business/merchant-level configuration. Subset of platform schema with business-specific settings.");
|
|
2650
|
+
const UcpResponseCheckoutSchema = zod.intersection(zod.object({
|
|
1626
2651
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2652
|
+
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
1627
2653
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
1628
2654
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1629
2655
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -1645,14 +2671,31 @@ const UcpBusinessSchema = zod.intersection(zod.object({
|
|
|
1645
2671
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1646
2672
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1647
2673
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1648
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2674
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2675
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
2676
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2677
|
+
const passed = schemas.length - errors.length;
|
|
2678
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2679
|
+
path: ctx.path,
|
|
2680
|
+
code: "invalid_union",
|
|
2681
|
+
unionErrors: errors,
|
|
2682
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2683
|
+
} : {
|
|
2684
|
+
path: ctx.path,
|
|
2685
|
+
code: "custom",
|
|
2686
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2687
|
+
});
|
|
2688
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
1649
2689
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
1650
2690
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1651
2691
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1652
2692
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1653
2693
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1654
2694
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1655
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
2695
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
2696
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2697
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2698
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
1656
2699
|
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({
|
|
1657
2700
|
"services": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
1658
2701
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
@@ -1674,26 +2717,47 @@ const UcpBusinessSchema = zod.intersection(zod.object({
|
|
|
1674
2717
|
zod.object({ "transport": zod.literal("a2a").optional() }),
|
|
1675
2718
|
zod.object({
|
|
1676
2719
|
"transport": zod.literal("embedded").optional(),
|
|
1677
|
-
"config": zod.object({
|
|
2720
|
+
"config": zod.object({
|
|
2721
|
+
"delegate": zod.array(zod.string()).describe("Delegations the business allows. At service-level, declares available delegations. In UCP responses, confirms accepted delegations for this session.").optional(),
|
|
2722
|
+
"color_scheme": zod.array(zod.enum(["light", "dark"])).describe("Color schemes the business supports. Hosts use ec_color_scheme query parameter to request a scheme from this list.").optional()
|
|
2723
|
+
}).describe("Per-session configuration for embedded transport binding. Allows businesses to vary EP availability and delegations based on cart contents, agent authorization, or policy.").optional()
|
|
1678
2724
|
})
|
|
1679
|
-
])).describe("Service binding
|
|
2725
|
+
])).describe("Service binding in API responses. Includes per-resource transport configuration via typed config."))).optional(),
|
|
1680
2726
|
"capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
1681
2727
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1682
2728
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1683
2729
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1684
2730
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1685
2731
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1686
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2732
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2733
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
2734
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2735
|
+
const passed = schemas.length - errors.length;
|
|
2736
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2737
|
+
path: ctx.path,
|
|
2738
|
+
code: "invalid_union",
|
|
2739
|
+
unionErrors: errors,
|
|
2740
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2741
|
+
} : {
|
|
2742
|
+
path: ctx.path,
|
|
2743
|
+
code: "custom",
|
|
2744
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2745
|
+
});
|
|
2746
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })).describe("Capability reference in responses. Only name/version required to confirm active capabilities."))).optional(),
|
|
1687
2747
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
1688
2748
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1689
2749
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1690
2750
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1691
2751
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1692
2752
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1693
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
1694
|
-
|
|
1695
|
-
|
|
2753
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
2754
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2755
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2756
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))).describe("Handler reference in responses. May include full config state for runtime usage of the handler.")))
|
|
2757
|
+
})).describe("UCP metadata for checkout responses.");
|
|
2758
|
+
const UcpResponseOrderSchema = zod.intersection(zod.object({
|
|
1696
2759
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2760
|
+
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
1697
2761
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
1698
2762
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1699
2763
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -1715,16 +2779,56 @@ const UcpResponseCheckoutSchema = zod.intersection(zod.object({
|
|
|
1715
2779
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1716
2780
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1717
2781
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1718
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2782
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2783
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
2784
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2785
|
+
const passed = schemas.length - errors.length;
|
|
2786
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2787
|
+
path: ctx.path,
|
|
2788
|
+
code: "invalid_union",
|
|
2789
|
+
unionErrors: errors,
|
|
2790
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2791
|
+
} : {
|
|
2792
|
+
path: ctx.path,
|
|
2793
|
+
code: "custom",
|
|
2794
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2795
|
+
});
|
|
2796
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
1719
2797
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
1720
2798
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1721
2799
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1722
2800
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1723
2801
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1724
2802
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1725
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
1726
|
-
|
|
1727
|
-
|
|
2803
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
2804
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2805
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2806
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
2807
|
+
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({ "capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
2808
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2809
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2810
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2811
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2812
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2813
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2814
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
2815
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2816
|
+
const passed = schemas.length - errors.length;
|
|
2817
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2818
|
+
path: ctx.path,
|
|
2819
|
+
code: "invalid_union",
|
|
2820
|
+
unionErrors: errors,
|
|
2821
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2822
|
+
} : {
|
|
2823
|
+
path: ctx.path,
|
|
2824
|
+
code: "custom",
|
|
2825
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2826
|
+
});
|
|
2827
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })).describe("Capability reference in responses. Only name/version required to confirm active capabilities."))).optional() })).describe("UCP metadata for order responses. No payment handlers needed post-purchase.");
|
|
2828
|
+
const UcpResponseCartSchema = zod.intersection(zod.object({
|
|
2829
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2830
|
+
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
2831
|
+
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
1728
2832
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1729
2833
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1730
2834
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
@@ -1738,32 +2842,62 @@ const UcpResponseCheckoutSchema = zod.intersection(zod.object({
|
|
|
1738
2842
|
"embedded"
|
|
1739
2843
|
]).describe("Transport protocol for this service binding."),
|
|
1740
2844
|
"endpoint": zod.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
1741
|
-
}))
|
|
1742
|
-
zod.object({ "transport": zod.literal("rest").optional() }),
|
|
1743
|
-
zod.object({ "transport": zod.literal("mcp").optional() }),
|
|
1744
|
-
zod.object({ "transport": zod.literal("a2a").optional() }),
|
|
1745
|
-
zod.object({
|
|
1746
|
-
"transport": zod.literal("embedded").optional(),
|
|
1747
|
-
"config": zod.object({ "delegate": zod.array(zod.string()).describe("Delegations the business allows. At service-level, declares available delegations. In checkout responses, confirms accepted delegations for this session.").optional() }).describe("Per-checkout configuration for embedded transport binding. Allows businesses to vary ECP availability and delegations based on cart contents, agent authorization, or policy.").optional()
|
|
1748
|
-
})
|
|
1749
|
-
])).describe("Service binding in API responses. Includes per-resource transport configuration via typed config."))).optional(),
|
|
2845
|
+
})))).describe("Service registry keyed by reverse-domain name.").optional(),
|
|
1750
2846
|
"capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
1751
2847
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1752
2848
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1753
2849
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1754
2850
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1755
2851
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1756
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2852
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2853
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
2854
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2855
|
+
const passed = schemas.length - errors.length;
|
|
2856
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2857
|
+
path: ctx.path,
|
|
2858
|
+
code: "invalid_union",
|
|
2859
|
+
unionErrors: errors,
|
|
2860
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2861
|
+
} : {
|
|
2862
|
+
path: ctx.path,
|
|
2863
|
+
code: "custom",
|
|
2864
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2865
|
+
});
|
|
2866
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
1757
2867
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
1758
2868
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1759
2869
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1760
2870
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1761
2871
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1762
2872
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1763
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
1764
|
-
|
|
1765
|
-
|
|
2873
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
2874
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2875
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2876
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
2877
|
+
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({ "capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
2878
|
+
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2879
|
+
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2880
|
+
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2881
|
+
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2882
|
+
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2883
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2884
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
2885
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2886
|
+
const passed = schemas.length - errors.length;
|
|
2887
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2888
|
+
path: ctx.path,
|
|
2889
|
+
code: "invalid_union",
|
|
2890
|
+
unionErrors: errors,
|
|
2891
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2892
|
+
} : {
|
|
2893
|
+
path: ctx.path,
|
|
2894
|
+
code: "custom",
|
|
2895
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2896
|
+
});
|
|
2897
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })).describe("Capability reference in responses. Only name/version required to confirm active capabilities."))).optional() })).describe("UCP metadata for cart responses. No payment handlers needed pre-checkout.");
|
|
2898
|
+
const UcpResponseCatalogSchema = zod.intersection(zod.object({
|
|
1766
2899
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2900
|
+
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
1767
2901
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
1768
2902
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1769
2903
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -1785,21 +2919,52 @@ const UcpResponseOrderSchema = zod.intersection(zod.object({
|
|
|
1785
2919
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1786
2920
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1787
2921
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1788
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2922
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2923
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
2924
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2925
|
+
const passed = schemas.length - errors.length;
|
|
2926
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2927
|
+
path: ctx.path,
|
|
2928
|
+
code: "invalid_union",
|
|
2929
|
+
unionErrors: errors,
|
|
2930
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2931
|
+
} : {
|
|
2932
|
+
path: ctx.path,
|
|
2933
|
+
code: "custom",
|
|
2934
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2935
|
+
});
|
|
2936
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
1789
2937
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
1790
2938
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1791
2939
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1792
2940
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1793
2941
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1794
2942
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1795
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
2943
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
2944
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2945
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2946
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
1796
2947
|
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({ "capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
1797
2948
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1798
2949
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1799
2950
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1800
2951
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1801
2952
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1802
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2953
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2954
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
2955
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2956
|
+
const passed = schemas.length - errors.length;
|
|
2957
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2958
|
+
path: ctx.path,
|
|
2959
|
+
code: "invalid_union",
|
|
2960
|
+
unionErrors: errors,
|
|
2961
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2962
|
+
} : {
|
|
2963
|
+
path: ctx.path,
|
|
2964
|
+
code: "custom",
|
|
2965
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2966
|
+
});
|
|
2967
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })).describe("Capability reference in responses. Only name/version required to confirm active capabilities."))).optional() })).describe("UCP metadata for catalog responses.");
|
|
1803
2968
|
const ProfileSchemaSigningKeySchema = zod.object({
|
|
1804
2969
|
"kid": zod.string().describe("Key ID. Referenced in signature headers to identify which key to use for verification."),
|
|
1805
2970
|
"kty": zod.string().describe("Key type (e.g., 'EC', 'RSA')."),
|
|
@@ -1814,6 +2979,7 @@ const ProfileSchemaSigningKeySchema = zod.object({
|
|
|
1814
2979
|
const ProfileSchemaBaseSchema = zod.object({
|
|
1815
2980
|
"ucp": zod.object({
|
|
1816
2981
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2982
|
+
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
1817
2983
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
1818
2984
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1819
2985
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -1835,14 +3001,31 @@ const ProfileSchemaBaseSchema = zod.object({
|
|
|
1835
3001
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1836
3002
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1837
3003
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1838
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
3004
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
3005
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
3006
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
3007
|
+
const passed = schemas.length - errors.length;
|
|
3008
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
3009
|
+
path: ctx.path,
|
|
3010
|
+
code: "invalid_union",
|
|
3011
|
+
unionErrors: errors,
|
|
3012
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3013
|
+
} : {
|
|
3014
|
+
path: ctx.path,
|
|
3015
|
+
code: "custom",
|
|
3016
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3017
|
+
});
|
|
3018
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
1839
3019
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
1840
3020
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1841
3021
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1842
3022
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1843
3023
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1844
3024
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1845
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
3025
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
3026
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
3027
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
3028
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
1846
3029
|
}).describe("Base UCP metadata with shared properties for all schema types."),
|
|
1847
3030
|
"signing_keys": zod.array(zod.object({
|
|
1848
3031
|
"kid": zod.string().describe("Key ID. Referenced in signature headers to identify which key to use for verification."),
|
|
@@ -1859,6 +3042,7 @@ const ProfileSchemaBaseSchema = zod.object({
|
|
|
1859
3042
|
const ProfileSchemaPlatformProfileSchema = zod.intersection(zod.object({
|
|
1860
3043
|
"ucp": zod.object({
|
|
1861
3044
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
3045
|
+
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
1862
3046
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
1863
3047
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1864
3048
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -1880,14 +3064,31 @@ const ProfileSchemaPlatformProfileSchema = zod.intersection(zod.object({
|
|
|
1880
3064
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1881
3065
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1882
3066
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1883
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
3067
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
3068
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
3069
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
3070
|
+
const passed = schemas.length - errors.length;
|
|
3071
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
3072
|
+
path: ctx.path,
|
|
3073
|
+
code: "invalid_union",
|
|
3074
|
+
unionErrors: errors,
|
|
3075
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3076
|
+
} : {
|
|
3077
|
+
path: ctx.path,
|
|
3078
|
+
code: "custom",
|
|
3079
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3080
|
+
});
|
|
3081
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
1884
3082
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
1885
3083
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1886
3084
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1887
3085
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1888
3086
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1889
3087
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1890
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
3088
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
3089
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
3090
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
3091
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
1891
3092
|
}).describe("Base UCP metadata with shared properties for all schema types."),
|
|
1892
3093
|
"signing_keys": zod.array(zod.object({
|
|
1893
3094
|
"kid": zod.string().describe("Key ID. Referenced in signature headers to identify which key to use for verification."),
|
|
@@ -1902,6 +3103,7 @@ const ProfileSchemaPlatformProfileSchema = zod.intersection(zod.object({
|
|
|
1902
3103
|
}).describe("Public key for signature verification in JWK format.")).describe("Public keys for signature verification (JWK format). Used to verify signed responses, webhooks, and other authenticated messages from this party.").optional()
|
|
1903
3104
|
}).passthrough().describe("Base discovery profile with shared properties for all profile types."), zod.object({ "ucp": zod.intersection(zod.object({
|
|
1904
3105
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
3106
|
+
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
1905
3107
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
1906
3108
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1907
3109
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -1923,14 +3125,31 @@ const ProfileSchemaPlatformProfileSchema = zod.intersection(zod.object({
|
|
|
1923
3125
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1924
3126
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1925
3127
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1926
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
3128
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
3129
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
3130
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
3131
|
+
const passed = schemas.length - errors.length;
|
|
3132
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
3133
|
+
path: ctx.path,
|
|
3134
|
+
code: "invalid_union",
|
|
3135
|
+
unionErrors: errors,
|
|
3136
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3137
|
+
} : {
|
|
3138
|
+
path: ctx.path,
|
|
3139
|
+
code: "custom",
|
|
3140
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3141
|
+
});
|
|
3142
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
1927
3143
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
1928
3144
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1929
3145
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1930
3146
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1931
3147
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1932
3148
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1933
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
3149
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
3150
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
3151
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
3152
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
1934
3153
|
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({
|
|
1935
3154
|
"services": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
1936
3155
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
@@ -1951,25 +3170,43 @@ const ProfileSchemaPlatformProfileSchema = zod.intersection(zod.object({
|
|
|
1951
3170
|
zod.object({ "transport": zod.literal("mcp").optional() }),
|
|
1952
3171
|
zod.object({ "transport": zod.literal("a2a").optional() }),
|
|
1953
3172
|
zod.object({ "transport": zod.literal("embedded").optional() })
|
|
1954
|
-
]))).describe("Full service declaration for platform-level discovery.
|
|
3173
|
+
]))).describe("Full service declaration for platform-level discovery. All transports require `version`, `spec`, and `transport`. REST and MCP additionally require `schema` and `endpoint`; A2A requires `endpoint`; embedded requires `schema`."))),
|
|
1955
3174
|
"capabilities": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
1956
3175
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1957
3176
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1958
3177
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1959
3178
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1960
3179
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1961
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
3180
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
3181
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
3182
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
3183
|
+
const passed = schemas.length - errors.length;
|
|
3184
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
3185
|
+
path: ctx.path,
|
|
3186
|
+
code: "invalid_union",
|
|
3187
|
+
unionErrors: errors,
|
|
3188
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3189
|
+
} : {
|
|
3190
|
+
path: ctx.path,
|
|
3191
|
+
code: "custom",
|
|
3192
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3193
|
+
});
|
|
3194
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })), zod.record(zod.string(), zod.unknown())).describe("Full capability declaration for platform-level discovery. Includes spec/schema URLs for agent fetching."))).optional(),
|
|
1962
3195
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
1963
3196
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1964
3197
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1965
3198
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1966
3199
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1967
3200
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1968
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
3201
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
3202
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
3203
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
3204
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))), zod.record(zod.string(), zod.unknown())).describe("Platform declaration for discovery profiles. May include partial config state required for discovery.")))
|
|
1969
3205
|
})).describe("Full UCP metadata for platform-level configuration. Hosted at a URI advertised by the platform in request headers.").optional() })).describe("Full discovery profile for platforms. Exposes complete service, capability, and payment handler registries.");
|
|
1970
3206
|
const ProfileSchemaBusinessProfileSchema = zod.intersection(zod.object({
|
|
1971
3207
|
"ucp": zod.object({
|
|
1972
3208
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
3209
|
+
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
1973
3210
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
1974
3211
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1975
3212
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -1991,14 +3228,31 @@ const ProfileSchemaBusinessProfileSchema = zod.intersection(zod.object({
|
|
|
1991
3228
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1992
3229
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1993
3230
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1994
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
3231
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
3232
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
3233
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
3234
|
+
const passed = schemas.length - errors.length;
|
|
3235
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
3236
|
+
path: ctx.path,
|
|
3237
|
+
code: "invalid_union",
|
|
3238
|
+
unionErrors: errors,
|
|
3239
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3240
|
+
} : {
|
|
3241
|
+
path: ctx.path,
|
|
3242
|
+
code: "custom",
|
|
3243
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3244
|
+
});
|
|
3245
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
1995
3246
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
1996
3247
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1997
3248
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1998
3249
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1999
3250
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2000
3251
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2001
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
3252
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
3253
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
3254
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
3255
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
2002
3256
|
}).describe("Base UCP metadata with shared properties for all schema types."),
|
|
2003
3257
|
"signing_keys": zod.array(zod.object({
|
|
2004
3258
|
"kid": zod.string().describe("Key ID. Referenced in signature headers to identify which key to use for verification."),
|
|
@@ -2013,6 +3267,7 @@ const ProfileSchemaBusinessProfileSchema = zod.intersection(zod.object({
|
|
|
2013
3267
|
}).describe("Public key for signature verification in JWK format.")).describe("Public keys for signature verification (JWK format). Used to verify signed responses, webhooks, and other authenticated messages from this party.").optional()
|
|
2014
3268
|
}).passthrough().describe("Base discovery profile with shared properties for all profile types."), zod.object({ "ucp": zod.intersection(zod.object({
|
|
2015
3269
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
3270
|
+
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
2016
3271
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
2017
3272
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2018
3273
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -2034,15 +3289,33 @@ const ProfileSchemaBusinessProfileSchema = zod.intersection(zod.object({
|
|
|
2034
3289
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2035
3290
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2036
3291
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2037
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
3292
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
3293
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
3294
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
3295
|
+
const passed = schemas.length - errors.length;
|
|
3296
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
3297
|
+
path: ctx.path,
|
|
3298
|
+
code: "invalid_union",
|
|
3299
|
+
unionErrors: errors,
|
|
3300
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3301
|
+
} : {
|
|
3302
|
+
path: ctx.path,
|
|
3303
|
+
code: "custom",
|
|
3304
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3305
|
+
});
|
|
3306
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
2038
3307
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
2039
3308
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2040
3309
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2041
3310
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2042
3311
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2043
3312
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2044
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
3313
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
3314
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
3315
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
3316
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
2045
3317
|
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({
|
|
3318
|
+
"supported_versions": zod.record(zod.string().url()).describe("Previous protocol versions this business supports, mapped to profile URIs. Businesses that support older protocol versions SHOULD advertise each version and link to its profile. Each URI points to a complete, self-contained profile for that version. When omitted, only `version` is supported.").optional(),
|
|
2046
3319
|
"services": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
2047
3320
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2048
3321
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -2063,7 +3336,10 @@ const ProfileSchemaBusinessProfileSchema = zod.intersection(zod.object({
|
|
|
2063
3336
|
zod.object({ "transport": zod.literal("a2a").optional() }),
|
|
2064
3337
|
zod.object({
|
|
2065
3338
|
"transport": zod.literal("embedded").optional(),
|
|
2066
|
-
"config": zod.object({
|
|
3339
|
+
"config": zod.object({
|
|
3340
|
+
"delegate": zod.array(zod.string()).describe("Delegations the business allows. At service-level, declares available delegations. In UCP responses, confirms accepted delegations for this session.").optional(),
|
|
3341
|
+
"color_scheme": zod.array(zod.enum(["light", "dark"])).describe("Color schemes the business supports. Hosts use ec_color_scheme query parameter to request a scheme from this list.").optional()
|
|
3342
|
+
}).describe("Per-session configuration for embedded transport binding. Allows businesses to vary EP availability and delegations based on cart contents, agent authorization, or policy.").optional()
|
|
2067
3343
|
})
|
|
2068
3344
|
])).describe("Service binding for business/merchant configuration. May override platform endpoints."))),
|
|
2069
3345
|
"capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
@@ -2072,14 +3348,31 @@ const ProfileSchemaBusinessProfileSchema = zod.intersection(zod.object({
|
|
|
2072
3348
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2073
3349
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2074
3350
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2075
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
3351
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
3352
|
+
const schemas = [zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")), zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"))).min(1)];
|
|
3353
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
3354
|
+
const passed = schemas.length - errors.length;
|
|
3355
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
3356
|
+
path: ctx.path,
|
|
3357
|
+
code: "invalid_union",
|
|
3358
|
+
unionErrors: errors,
|
|
3359
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3360
|
+
} : {
|
|
3361
|
+
path: ctx.path,
|
|
3362
|
+
code: "custom",
|
|
3363
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3364
|
+
});
|
|
3365
|
+
}).describe("Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions.").optional() })).describe("Capability configuration for business/merchant level. May include business-specific config overrides."))).optional(),
|
|
2076
3366
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
2077
3367
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2078
3368
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2079
3369
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2080
3370
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2081
3371
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2082
|
-
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())
|
|
3372
|
+
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
3373
|
+
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
3374
|
+
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
3375
|
+
}).describe("An instrument type available from a payment handler with optional constraints.")).min(1).describe("Instrument types this handler supports, with optional constraints. When absent, every instrument should be considered available.").optional() }))).describe("Business declaration for discovery profiles. May include partial config state required for discovery.")))
|
|
2083
3376
|
})).describe("UCP metadata for business/merchant-level configuration. Subset of platform schema with business-specific settings.").optional() })).describe("Discovery profile for businesses/merchants. Subset of platform profile with business-specific configuration.");
|
|
2084
3377
|
const ServiceBaseTransportEnumSchema = zod.enum([
|
|
2085
3378
|
"rest",
|
|
@@ -2117,24 +3410,18 @@ const MessageErrorContentTypeEnumSchema = zod.enum(["plain", "markdown"]).descri
|
|
|
2117
3410
|
const MessageErrorSeverityEnumSchema = zod.enum([
|
|
2118
3411
|
"recoverable",
|
|
2119
3412
|
"requires_buyer_input",
|
|
2120
|
-
"requires_buyer_review"
|
|
2121
|
-
|
|
3413
|
+
"requires_buyer_review",
|
|
3414
|
+
"unrecoverable"
|
|
3415
|
+
]).describe("Reflects the resource state and recommended action. 'recoverable': platform can resolve by modifying inputs and retrying via API. 'requires_buyer_input': merchant requires information their API doesn't support collecting programmatically (checkout incomplete). 'requires_buyer_review': buyer must authorize before order placement due to policy, regulatory, or entitlement rules. 'unrecoverable': no valid resource exists to act on, retry with new resource or inputs. Errors with 'requires_*' severity contribute to 'status: requires_escalation'.");
|
|
2122
3416
|
const MessageInfoContentTypeEnumSchema = zod.enum(["plain", "markdown"]).describe("Content format, default = plain.");
|
|
2123
3417
|
const MessageWarningContentTypeEnumSchema = zod.enum(["plain", "markdown"]).describe("Content format, default = plain.");
|
|
2124
3418
|
const OrderLineItemStatusEnumSchema = zod.enum([
|
|
2125
3419
|
"processing",
|
|
2126
3420
|
"partial",
|
|
2127
|
-
"fulfilled"
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
"subtotal",
|
|
2132
|
-
"discount",
|
|
2133
|
-
"fulfillment",
|
|
2134
|
-
"tax",
|
|
2135
|
-
"fee",
|
|
2136
|
-
"total"
|
|
2137
|
-
]).describe("Type of total categorization.");
|
|
3421
|
+
"fulfilled",
|
|
3422
|
+
"removed"
|
|
3423
|
+
]).describe("Derived status: removed if quantity.total == 0, fulfilled if quantity.total > 0 and quantity.fulfilled == quantity.total, partial if quantity.total > 0 and quantity.fulfilled > 0, otherwise processing.");
|
|
3424
|
+
const UcpBaseStatusEnumSchema = zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.");
|
|
2138
3425
|
const ProfileSchemaSigningKeyUseEnumSchema = zod.enum(["sig", "enc"]).describe("Key usage. Should be 'sig' for signing keys.");
|
|
2139
3426
|
//#endregion
|
|
2140
3427
|
//#region src/extensions.ts
|
|
@@ -2156,11 +3443,13 @@ const OrderUpdateSchema = OrderSchema;
|
|
|
2156
3443
|
exports.AccountInfoSchema = AccountInfoSchema;
|
|
2157
3444
|
exports.AdjustmentSchema = AdjustmentSchema;
|
|
2158
3445
|
exports.AdjustmentStatusEnumSchema = AdjustmentStatusEnumSchema;
|
|
3446
|
+
exports.AmountSchema = AmountSchema;
|
|
2159
3447
|
exports.Ap2MandateAp2WithCheckoutMandateSchema = Ap2MandateAp2WithCheckoutMandateSchema;
|
|
2160
3448
|
exports.Ap2MandateAp2WithMerchantAuthorizationSchema = Ap2MandateAp2WithMerchantAuthorizationSchema;
|
|
2161
3449
|
exports.Ap2MandateCheckoutMandateSchema = Ap2MandateCheckoutMandateSchema;
|
|
2162
3450
|
exports.Ap2MandateErrorCodeSchema = Ap2MandateErrorCodeSchema;
|
|
2163
3451
|
exports.Ap2MandateMerchantAuthorizationSchema = Ap2MandateMerchantAuthorizationSchema;
|
|
3452
|
+
exports.AvailablePaymentInstrumentSchema = AvailablePaymentInstrumentSchema;
|
|
2164
3453
|
exports.BindingSchema = BindingSchema;
|
|
2165
3454
|
exports.BusinessFulfillmentConfigSchema = BusinessFulfillmentConfigSchema;
|
|
2166
3455
|
exports.BuyerConsentBuyerSchema = BuyerConsentBuyerSchema;
|
|
@@ -2172,7 +3461,13 @@ exports.CapabilityPlatformSchema = CapabilityPlatformSchema;
|
|
|
2172
3461
|
exports.CapabilityResponseSchema = CapabilityResponseSchema;
|
|
2173
3462
|
exports.CardCredentialCardNumberTypeEnumSchema = CardCredentialCardNumberTypeEnumSchema;
|
|
2174
3463
|
exports.CardCredentialSchema = CardCredentialSchema;
|
|
2175
|
-
exports.
|
|
3464
|
+
exports.CardPaymentInstrumentAvailableCardPaymentInstrumentSchema = CardPaymentInstrumentAvailableCardPaymentInstrumentSchema;
|
|
3465
|
+
exports.CartCreateRequestSchema = CartCreateRequestSchema;
|
|
3466
|
+
exports.CartSchema = CartSchema;
|
|
3467
|
+
exports.CartUpdateRequestSchema = CartUpdateRequestSchema;
|
|
3468
|
+
exports.CatalogLookupSchema = CatalogLookupSchema;
|
|
3469
|
+
exports.CatalogSearchSchema = CatalogSearchSchema;
|
|
3470
|
+
exports.CategorySchema = CategorySchema;
|
|
2176
3471
|
exports.CheckoutCompleteRequestSchema = CheckoutCompleteRequestSchema;
|
|
2177
3472
|
exports.CheckoutCreateRequestSchema = CheckoutCreateRequestSchema;
|
|
2178
3473
|
exports.CheckoutResponseSchema = CheckoutResponseSchema;
|
|
@@ -2181,11 +3476,15 @@ exports.CheckoutSchema = CheckoutSchema;
|
|
|
2181
3476
|
exports.CheckoutStatusEnumSchema = CheckoutStatusEnumSchema;
|
|
2182
3477
|
exports.CheckoutUpdateRequestSchema = CheckoutUpdateRequestSchema;
|
|
2183
3478
|
exports.ContextSchema = ContextSchema;
|
|
3479
|
+
exports.DescriptionSchema = DescriptionSchema;
|
|
3480
|
+
exports.DetailOptionValueSchema = DetailOptionValueSchema;
|
|
2184
3481
|
exports.DiscountAllocationSchema = DiscountAllocationSchema;
|
|
2185
3482
|
exports.DiscountAppliedDiscountMethodEnumSchema = DiscountAppliedDiscountMethodEnumSchema;
|
|
2186
3483
|
exports.DiscountAppliedDiscountSchema = DiscountAppliedDiscountSchema;
|
|
2187
3484
|
exports.DiscountDiscountsObjectSchema = DiscountDiscountsObjectSchema;
|
|
2188
3485
|
exports.EmbeddedConfigSchema = EmbeddedConfigSchema;
|
|
3486
|
+
exports.ErrorCodeSchema = ErrorCodeSchema;
|
|
3487
|
+
exports.ErrorResponseSchema = ErrorResponseSchema;
|
|
2189
3488
|
exports.ExpectationMethodTypeEnumSchema = ExpectationMethodTypeEnumSchema;
|
|
2190
3489
|
exports.ExpectationSchema = ExpectationSchema;
|
|
2191
3490
|
exports.FulfillmentAvailableMethodSchema = FulfillmentAvailableMethodSchema;
|
|
@@ -2207,12 +3506,14 @@ exports.FulfillmentMethodUpdateRequestSchema = FulfillmentMethodUpdateRequestSch
|
|
|
2207
3506
|
exports.FulfillmentOptionSchema = FulfillmentOptionSchema;
|
|
2208
3507
|
exports.FulfillmentResponseSchema = FulfillmentResponseSchema;
|
|
2209
3508
|
exports.FulfillmentSchema = FulfillmentSchema;
|
|
3509
|
+
exports.InputCorrelationSchema = InputCorrelationSchema;
|
|
2210
3510
|
exports.ItemResponseSchema = ItemResponseSchema;
|
|
2211
3511
|
exports.ItemSchema = ItemSchema;
|
|
2212
3512
|
exports.LineItemResponseSchema = LineItemResponseSchema;
|
|
2213
3513
|
exports.LineItemSchema = LineItemSchema;
|
|
2214
3514
|
exports.LineItemUpdateRequestSchema = LineItemUpdateRequestSchema;
|
|
2215
3515
|
exports.LinkSchema = LinkSchema;
|
|
3516
|
+
exports.MediaSchema = MediaSchema;
|
|
2216
3517
|
exports.MerchantFulfillmentConfigSchema = MerchantFulfillmentConfigSchema;
|
|
2217
3518
|
exports.MessageErrorContentTypeEnumSchema = MessageErrorContentTypeEnumSchema;
|
|
2218
3519
|
exports.MessageErrorSchema = MessageErrorSchema;
|
|
@@ -2222,11 +3523,13 @@ exports.MessageInfoSchema = MessageInfoSchema;
|
|
|
2222
3523
|
exports.MessageSchema = MessageSchema;
|
|
2223
3524
|
exports.MessageWarningContentTypeEnumSchema = MessageWarningContentTypeEnumSchema;
|
|
2224
3525
|
exports.MessageWarningSchema = MessageWarningSchema;
|
|
3526
|
+
exports.OptionValueSchema = OptionValueSchema;
|
|
2225
3527
|
exports.OrderConfirmationSchema = OrderConfirmationSchema;
|
|
2226
3528
|
exports.OrderLineItemSchema = OrderLineItemSchema;
|
|
2227
3529
|
exports.OrderLineItemStatusEnumSchema = OrderLineItemStatusEnumSchema;
|
|
2228
3530
|
exports.OrderSchema = OrderSchema;
|
|
2229
3531
|
exports.OrderUpdateSchema = OrderUpdateSchema;
|
|
3532
|
+
exports.PaginationSchema = PaginationSchema;
|
|
2230
3533
|
exports.PaymentCredentialSchema = PaymentCredentialSchema;
|
|
2231
3534
|
exports.PaymentHandlerBaseSchema = PaymentHandlerBaseSchema;
|
|
2232
3535
|
exports.PaymentHandlerBusinessSchema = PaymentHandlerBusinessSchema;
|
|
@@ -2239,31 +3542,49 @@ exports.PaymentResponseSchema = PaymentResponseSchema;
|
|
|
2239
3542
|
exports.PaymentSchema = PaymentSchema;
|
|
2240
3543
|
exports.PlatformFulfillmentConfigSchema = PlatformFulfillmentConfigSchema;
|
|
2241
3544
|
exports.PostalAddressSchema = PostalAddressSchema;
|
|
3545
|
+
exports.PriceFilterSchema = PriceFilterSchema;
|
|
3546
|
+
exports.PriceRangeSchema = PriceRangeSchema;
|
|
3547
|
+
exports.PriceSchema = PriceSchema;
|
|
3548
|
+
exports.ProductOptionSchema = ProductOptionSchema;
|
|
3549
|
+
exports.ProductSchema = ProductSchema;
|
|
2242
3550
|
exports.ProfileSchemaBaseSchema = ProfileSchemaBaseSchema;
|
|
2243
3551
|
exports.ProfileSchemaBusinessProfileSchema = ProfileSchemaBusinessProfileSchema;
|
|
2244
3552
|
exports.ProfileSchemaPlatformProfileSchema = ProfileSchemaPlatformProfileSchema;
|
|
2245
3553
|
exports.ProfileSchemaSigningKeySchema = ProfileSchemaSigningKeySchema;
|
|
2246
3554
|
exports.ProfileSchemaSigningKeyUseEnumSchema = ProfileSchemaSigningKeyUseEnumSchema;
|
|
3555
|
+
exports.RatingSchema = RatingSchema;
|
|
2247
3556
|
exports.RetailLocationSchema = RetailLocationSchema;
|
|
3557
|
+
exports.ReverseDomainNameSchema = ReverseDomainNameSchema;
|
|
3558
|
+
exports.SearchFiltersSchema = SearchFiltersSchema;
|
|
3559
|
+
exports.SelectedOptionSchema = SelectedOptionSchema;
|
|
2248
3560
|
exports.ServiceBaseSchema = ServiceBaseSchema;
|
|
2249
3561
|
exports.ServiceBaseTransportEnumSchema = ServiceBaseTransportEnumSchema;
|
|
2250
3562
|
exports.ServiceBusinessSchema = ServiceBusinessSchema;
|
|
2251
3563
|
exports.ServicePlatformSchema = ServicePlatformSchema;
|
|
2252
3564
|
exports.ServiceResponseSchema = ServiceResponseSchema;
|
|
2253
3565
|
exports.ShippingDestinationSchema = ShippingDestinationSchema;
|
|
3566
|
+
exports.SignalsSchema = SignalsSchema;
|
|
3567
|
+
exports.SignedAmountSchema = SignedAmountSchema;
|
|
2254
3568
|
exports.TokenCredentialSchema = TokenCredentialSchema;
|
|
2255
3569
|
exports.TotalResponseSchema = TotalResponseSchema;
|
|
2256
3570
|
exports.TotalSchema = TotalSchema;
|
|
2257
|
-
exports.
|
|
3571
|
+
exports.TotalsSchema = TotalsSchema;
|
|
2258
3572
|
exports.UcpBaseSchema = UcpBaseSchema;
|
|
3573
|
+
exports.UcpBaseStatusEnumSchema = UcpBaseStatusEnumSchema;
|
|
2259
3574
|
exports.UcpBusinessSchema = UcpBusinessSchema;
|
|
2260
3575
|
exports.UcpDiscoveryBusinessProfileSchema = UcpDiscoveryBusinessProfileSchema;
|
|
2261
3576
|
exports.UcpDiscoveryPlatformProfileSchema = UcpDiscoveryPlatformProfileSchema;
|
|
2262
3577
|
exports.UcpDiscoveryProfileSchema = UcpDiscoveryProfileSchema;
|
|
2263
3578
|
exports.UcpEntitySchema = UcpEntitySchema;
|
|
3579
|
+
exports.UcpErrorSchema = UcpErrorSchema;
|
|
2264
3580
|
exports.UcpPlatformSchema = UcpPlatformSchema;
|
|
3581
|
+
exports.UcpRequiresSchema = UcpRequiresSchema;
|
|
3582
|
+
exports.UcpResponseCartSchema = UcpResponseCartSchema;
|
|
3583
|
+
exports.UcpResponseCatalogSchema = UcpResponseCatalogSchema;
|
|
2265
3584
|
exports.UcpResponseCheckoutSchema = UcpResponseCheckoutSchema;
|
|
2266
3585
|
exports.UcpResponseOrderSchema = UcpResponseOrderSchema;
|
|
2267
|
-
exports.UcpReverseDomainNameSchema = UcpReverseDomainNameSchema;
|
|
2268
3586
|
exports.UcpSigningKeySchema = UcpSigningKeySchema;
|
|
3587
|
+
exports.UcpSuccessSchema = UcpSuccessSchema;
|
|
3588
|
+
exports.UcpVersionConstraintSchema = UcpVersionConstraintSchema;
|
|
2269
3589
|
exports.UcpVersionSchema = UcpVersionSchema;
|
|
3590
|
+
exports.VariantSchema = VariantSchema;
|