@omnixhq/ucp-js-sdk 1.1.0-draft.3.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +382 -1586
- package/dist/index.d.cts +7178 -13138
- package/dist/index.d.mts +7178 -13138
- package/dist/index.mjs +380 -1548
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -30,173 +30,56 @@ 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.
|
|
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() }));
|
|
33
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() }));
|
|
48
34
|
const CapabilityPlatformSchema = zod.intersection(zod.intersection(zod.object({
|
|
49
35
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
50
36
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
51
37
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
52
38
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
53
39
|
"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.
|
|
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.");
|
|
40
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })), zod.record(zod.string(), zod.unknown())).describe("Full capability declaration for platform-level discovery. Includes spec/schema URLs for agent fetching.");
|
|
69
41
|
const CapabilityBusinessSchema = zod.intersection(zod.object({
|
|
70
42
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
71
43
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
72
44
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
73
45
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
74
46
|
"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.object({ "extends": zod.
|
|
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.");
|
|
47
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })).describe("Capability configuration for business/merchant level. May include business-specific config overrides.");
|
|
90
48
|
const CapabilityResponseSchema = zod.intersection(zod.object({
|
|
91
49
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
92
50
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
93
51
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
94
52
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
95
53
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
96
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
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.");
|
|
111
|
-
const IdentityLinkingPlatformSchema = zod.intersection(zod.intersection(zod.object({
|
|
112
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
113
|
-
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
114
|
-
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
115
|
-
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
116
|
-
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
117
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
118
|
-
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)];
|
|
119
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
120
|
-
const passed = schemas.length - errors.length;
|
|
121
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
122
|
-
path: ctx.path,
|
|
123
|
-
code: "invalid_union",
|
|
124
|
-
unionErrors: errors,
|
|
125
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
126
|
-
} : {
|
|
127
|
-
path: ctx.path,
|
|
128
|
-
code: "custom",
|
|
129
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
130
|
-
});
|
|
131
|
-
}).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.");
|
|
132
|
-
const IdentityLinkingBusinessSchema = zod.intersection(zod.intersection(zod.object({
|
|
133
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
134
|
-
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
135
|
-
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
136
|
-
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
137
|
-
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
138
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
139
|
-
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)];
|
|
140
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
141
|
-
const passed = schemas.length - errors.length;
|
|
142
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
143
|
-
path: ctx.path,
|
|
144
|
-
code: "invalid_union",
|
|
145
|
-
unionErrors: errors,
|
|
146
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
147
|
-
} : {
|
|
148
|
-
path: ctx.path,
|
|
149
|
-
code: "custom",
|
|
150
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
151
|
-
});
|
|
152
|
-
}).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."), zod.object({ "config": zod.object({ "supported_mechanisms": zod.array(zod.object({ "type": zod.string().describe("The mechanism type discriminator. Known values: 'oauth2'. Specific mechanism schemas constrain this to a constant value.") }).passthrough().describe("Base definition for any authentication mechanism. The 'type' field discriminates between known mechanism schemas (e.g., oauth2). Unknown types pass through with only the base requirement, enabling forward-compatible extensibility. Note: this open base schema does not enforce field requirements for known types — use $defs/oauth2 directly to validate an oauth2 mechanism object explicitly.")).min(1) }) }));
|
|
153
|
-
const IdentityLinkingIdentityScopesSchema = zod.array(zod.string().regex(/* @__PURE__ */ new RegExp("^[a-zA-Z0-9][a-zA-Z0-9_\\-]*(\\.[a-zA-Z0-9][a-zA-Z0-9_\\-]*)*\\.scopes\\.[a-zA-Z0-9][a-zA-Z0-9_\\-]*(\\.[a-zA-Z0-9][a-zA-Z0-9_\\-]*)*$"))).min(1).refine((arr) => arr.every((item, i) => arr.indexOf(item) == i), "All items must be unique!").describe("A custom UCP annotation placed at the root of a capability schema to declare the OAuth 2.0 scopes required to operate that capability. Scopes MUST use reverse DNS dot notation to prevent namespace collisions (e.g., 'dev.ucp.shopping.scopes.checkout_session' for UCP-defined scopes, 'com.example.scopes.my_capability' for third-party scopes). Platforms collect this annotation from every capability in the finalized negotiated intersection and use the union as the authorization scope set. This annotation is intentionally a plain JSON array so it is ignored by standard JSON Schema validators — it carries semantic meaning only to UCP-aware tooling. Absence of this annotation on a capability schema means that capability requires no dedicated scope.");
|
|
154
|
-
const IdentityLinkingMechanismSchema = zod.object({ "type": zod.string().describe("The mechanism type discriminator. Known values: 'oauth2'. Specific mechanism schemas constrain this to a constant value.") }).passthrough().describe("Base definition for any authentication mechanism. The 'type' field discriminates between known mechanism schemas (e.g., oauth2). Unknown types pass through with only the base requirement, enabling forward-compatible extensibility. Note: this open base schema does not enforce field requirements for known types — use $defs/oauth2 directly to validate an oauth2 mechanism object explicitly.");
|
|
155
|
-
const IdentityLinkingOauth2Schema = zod.object({
|
|
156
|
-
"type": zod.literal("oauth2").describe("OAuth 2.0 authentication mechanism."),
|
|
157
|
-
"issuer": zod.string().url().describe("The authorization server URL, supporting RFC 8414 discovery."),
|
|
158
|
-
"discovery_endpoint": zod.string().url().describe("Optional explicit URI to the authorization server's metadata (e.g., `https://auth.merchant.example.com/.well-known/openid-configuration`). If omitted, platforms construct discovery paths based on the `issuer`.").optional()
|
|
159
|
-
}).passthrough();
|
|
54
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })).describe("Capability reference in responses. Only name/version required to confirm active capabilities.");
|
|
160
55
|
const PaymentHandlerBaseSchema = zod.intersection(zod.object({
|
|
161
56
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
162
57
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
163
58
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
164
59
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
165
60
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
166
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
167
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
168
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
169
|
-
}).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() })));
|
|
61
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown()));
|
|
170
62
|
const PaymentHandlerPlatformSchema = zod.intersection(zod.intersection(zod.object({
|
|
171
63
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
172
64
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
173
65
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
174
66
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
175
67
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
176
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
177
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
178
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
179
|
-
}).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.");
|
|
68
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())), zod.record(zod.string(), zod.unknown())).describe("Platform declaration for discovery profiles. May include partial config state required for discovery.");
|
|
180
69
|
const PaymentHandlerBusinessSchema = zod.intersection(zod.object({
|
|
181
70
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
182
71
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
183
72
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
184
73
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
185
74
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
186
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
187
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
188
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
189
|
-
}).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.");
|
|
75
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())).describe("Business declaration for discovery profiles. May include partial config state required for discovery.");
|
|
190
76
|
const PaymentHandlerResponseSchema = zod.intersection(zod.object({
|
|
191
77
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
192
78
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
193
79
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
194
80
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
195
81
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
196
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
197
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
198
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
199
|
-
}).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.");
|
|
82
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())).describe("Handler reference in responses. May include full config state for runtime usage of the handler.");
|
|
200
83
|
const ServiceBaseSchema = zod.intersection(zod.object({
|
|
201
84
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
202
85
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -252,10 +135,7 @@ const ServiceBusinessSchema = zod.intersection(zod.intersection(zod.object({
|
|
|
252
135
|
zod.object({ "transport": zod.literal("a2a").optional() }),
|
|
253
136
|
zod.object({
|
|
254
137
|
"transport": zod.literal("embedded").optional(),
|
|
255
|
-
"config": zod.object({
|
|
256
|
-
"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(),
|
|
257
|
-
"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()
|
|
258
|
-
}).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()
|
|
138
|
+
"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()
|
|
259
139
|
})
|
|
260
140
|
])).describe("Service binding for business/merchant configuration. May override platform endpoints.");
|
|
261
141
|
const ServiceResponseSchema = zod.intersection(zod.intersection(zod.object({
|
|
@@ -278,10 +158,7 @@ const ServiceResponseSchema = zod.intersection(zod.intersection(zod.object({
|
|
|
278
158
|
zod.object({ "transport": zod.literal("a2a").optional() }),
|
|
279
159
|
zod.object({
|
|
280
160
|
"transport": zod.literal("embedded").optional(),
|
|
281
|
-
"config": zod.object({
|
|
282
|
-
"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(),
|
|
283
|
-
"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()
|
|
284
|
-
}).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()
|
|
161
|
+
"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()
|
|
285
162
|
})
|
|
286
163
|
])).describe("Service binding in API responses. Includes per-resource transport configuration via typed config.");
|
|
287
164
|
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.");
|
|
@@ -314,260 +191,9 @@ const BuyerConsentBuyerSchema = zod.intersection(zod.object({
|
|
|
314
191
|
"marketing": zod.boolean().describe("Consent for marketing communications.").optional(),
|
|
315
192
|
"sale_of_data": zod.boolean().describe("Consent for selling data to third parties (CCPA).").optional()
|
|
316
193
|
}).describe("Consent tracking fields.").optional() })).describe("Buyer object extended with consent tracking.");
|
|
317
|
-
const CartSchema = zod.object({
|
|
318
|
-
"ucp": 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
|
-
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
321
|
-
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
322
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
323
|
-
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
324
|
-
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
325
|
-
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
326
|
-
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
327
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({
|
|
328
|
-
"transport": zod.enum([
|
|
329
|
-
"rest",
|
|
330
|
-
"mcp",
|
|
331
|
-
"a2a",
|
|
332
|
-
"embedded"
|
|
333
|
-
]).describe("Transport protocol for this service binding."),
|
|
334
|
-
"endpoint": zod.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
335
|
-
})))).describe("Service registry keyed by reverse-domain name.").optional(),
|
|
336
|
-
"capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
337
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
338
|
-
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
339
|
-
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
340
|
-
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
341
|
-
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
342
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
343
|
-
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)];
|
|
344
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
345
|
-
const passed = schemas.length - errors.length;
|
|
346
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
347
|
-
path: ctx.path,
|
|
348
|
-
code: "invalid_union",
|
|
349
|
-
unionErrors: errors,
|
|
350
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
351
|
-
} : {
|
|
352
|
-
path: ctx.path,
|
|
353
|
-
code: "custom",
|
|
354
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
355
|
-
});
|
|
356
|
-
}).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(),
|
|
357
|
-
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
358
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
359
|
-
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
360
|
-
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
361
|
-
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
362
|
-
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
363
|
-
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
364
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
365
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
366
|
-
}).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()
|
|
367
|
-
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({ "capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
368
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
369
|
-
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
370
|
-
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
371
|
-
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
372
|
-
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
373
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
374
|
-
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)];
|
|
375
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
376
|
-
const passed = schemas.length - errors.length;
|
|
377
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
378
|
-
path: ctx.path,
|
|
379
|
-
code: "invalid_union",
|
|
380
|
-
unionErrors: errors,
|
|
381
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
382
|
-
} : {
|
|
383
|
-
path: ctx.path,
|
|
384
|
-
code: "custom",
|
|
385
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
386
|
-
});
|
|
387
|
-
}).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."),
|
|
388
|
-
"id": zod.string().describe("Unique cart identifier."),
|
|
389
|
-
"line_items": zod.array(zod.object({
|
|
390
|
-
"id": zod.string(),
|
|
391
|
-
"item": zod.object({
|
|
392
|
-
"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."),
|
|
393
|
-
"title": zod.string().describe("Product title."),
|
|
394
|
-
"price": zod.number().int().gte(0).describe("Unit price in ISO 4217 minor units."),
|
|
395
|
-
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
396
|
-
}),
|
|
397
|
-
"quantity": zod.number().int().gte(1).describe("Quantity of the item being purchased."),
|
|
398
|
-
"totals": zod.array(zod.object({
|
|
399
|
-
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
400
|
-
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
401
|
-
"amount": 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).")
|
|
402
|
-
}).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Line item totals breakdown."),
|
|
403
|
-
"parent_id": zod.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
404
|
-
}).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."),
|
|
405
|
-
"context": zod.object({
|
|
406
|
-
"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(),
|
|
407
|
-
"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(),
|
|
408
|
-
"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(),
|
|
409
|
-
"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(),
|
|
410
|
-
"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(),
|
|
411
|
-
"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(),
|
|
412
|
-
"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()
|
|
413
|
-
}).passthrough().describe("Buyer signals for localization (country, region, postal_code). Merchant uses for pricing, availability, currency. Falls back to geo-IP if omitted.").optional(),
|
|
414
|
-
"signals": zod.object({
|
|
415
|
-
"dev.ucp.buyer_ip": zod.string().describe("Client's IP address (IPv4 or IPv6).").optional(),
|
|
416
|
-
"dev.ucp.user_agent": zod.string().describe("Client's HTTP User-Agent header or equivalent.").optional()
|
|
417
|
-
}).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(),
|
|
418
|
-
"buyer": zod.object({
|
|
419
|
-
"first_name": zod.string().describe("First name of the buyer.").optional(),
|
|
420
|
-
"last_name": zod.string().describe("Last name of the buyer.").optional(),
|
|
421
|
-
"email": zod.string().describe("Email of the buyer.").optional(),
|
|
422
|
-
"phone_number": zod.string().describe("E.164 standard.").optional()
|
|
423
|
-
}).passthrough().describe("Optional buyer information for personalized estimates.").optional(),
|
|
424
|
-
"currency": zod.string().describe("ISO 4217 currency code. Determined by merchant based on context or geo-IP."),
|
|
425
|
-
"totals": zod.array(zod.intersection(zod.intersection(zod.object({
|
|
426
|
-
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
427
|
-
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
428
|
-
"amount": 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).")
|
|
429
|
-
}).describe("A cost breakdown entry with a category, amount, and optional display text."), zod.object({
|
|
430
|
-
"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).").optional(),
|
|
431
|
-
"lines": zod.array(zod.object({
|
|
432
|
-
"display_text": zod.string().describe("Human-readable label for this sub-line."),
|
|
433
|
-
"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).")
|
|
434
|
-
}).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()
|
|
435
|
-
})), zod.intersection(zod.any(), zod.intersection(zod.any(), zod.any())))).describe("Estimated cost breakdown. May be partial if shipping/tax not yet calculable."),
|
|
436
|
-
"messages": zod.array(zod.record(zod.string(), zod.unknown()).and(zod.unknown().superRefine((x, ctx) => {
|
|
437
|
-
const schemas = [
|
|
438
|
-
zod.object({
|
|
439
|
-
"type": zod.literal("error").describe("Message type discriminator."),
|
|
440
|
-
"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."),
|
|
441
|
-
"path": zod.string().describe("RFC 9535 JSONPath to the component the message refers to (e.g., $.items[1]).").optional(),
|
|
442
|
-
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
443
|
-
"content": zod.string().describe("Human-readable message."),
|
|
444
|
-
"severity": zod.enum([
|
|
445
|
-
"recoverable",
|
|
446
|
-
"requires_buyer_input",
|
|
447
|
-
"requires_buyer_review",
|
|
448
|
-
"unrecoverable"
|
|
449
|
-
]).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'.")
|
|
450
|
-
}),
|
|
451
|
-
zod.object({
|
|
452
|
-
"type": zod.literal("warning").describe("Message type discriminator."),
|
|
453
|
-
"path": zod.string().describe("JSONPath (RFC 9535) to related field (e.g., $.line_items[0]).").optional(),
|
|
454
|
-
"code": zod.string().describe("Warning code. Machine-readable identifier for the warning type (e.g., final_sale, prop65, fulfillment_changed, age_restricted, etc.)."),
|
|
455
|
-
"content": zod.string().describe("Human-readable warning message that MUST be displayed."),
|
|
456
|
-
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
457
|
-
"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"),
|
|
458
|
-
"image_url": zod.string().url().describe("URL to a required visual element (e.g., warning symbol, energy class label).").optional(),
|
|
459
|
-
"url": zod.string().url().describe("Reference URL for more information (e.g., regulatory site, registry entry, policy page).").optional()
|
|
460
|
-
}),
|
|
461
|
-
zod.object({
|
|
462
|
-
"type": zod.literal("info").describe("Message type discriminator."),
|
|
463
|
-
"path": zod.string().describe("RFC 9535 JSONPath to the component the message refers to.").optional(),
|
|
464
|
-
"code": zod.string().describe("Info code for programmatic handling.").optional(),
|
|
465
|
-
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
466
|
-
"content": zod.string().describe("Human-readable message.")
|
|
467
|
-
})
|
|
468
|
-
];
|
|
469
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
470
|
-
const passed = schemas.length - errors.length;
|
|
471
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
472
|
-
path: ctx.path,
|
|
473
|
-
code: "invalid_union",
|
|
474
|
-
unionErrors: errors,
|
|
475
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
476
|
-
} : {
|
|
477
|
-
path: ctx.path,
|
|
478
|
-
code: "custom",
|
|
479
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
480
|
-
});
|
|
481
|
-
})).describe("Container for error, warning, or info messages.")).describe("Validation messages, warnings, or informational notices.").optional(),
|
|
482
|
-
"links": zod.array(zod.object({
|
|
483
|
-
"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."),
|
|
484
|
-
"url": zod.string().url().describe("The actual URL pointing to the content to be displayed."),
|
|
485
|
-
"title": zod.string().describe("Optional display text for the link. When provided, use this instead of generating from type.").optional()
|
|
486
|
-
})).describe("Optional merchant links (policies, FAQs).").optional(),
|
|
487
|
-
"continue_url": zod.string().url().describe("URL for cart handoff and session recovery. Enables sharing and human-in-the-loop flows.").optional(),
|
|
488
|
-
"expires_at": zod.string().datetime({ offset: true }).describe("Cart expiry timestamp (RFC 3339). Optional.").optional()
|
|
489
|
-
}).passthrough().describe("Shopping cart with estimated pricing before checkout. Lightweight pre-purchase exploration with no payment info or complex status states.");
|
|
490
|
-
const CartCreateRequestSchema = zod.object({
|
|
491
|
-
"line_items": zod.array(zod.object({
|
|
492
|
-
"id": zod.string(),
|
|
493
|
-
"item": zod.object({
|
|
494
|
-
"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."),
|
|
495
|
-
"title": zod.string().describe("Product title."),
|
|
496
|
-
"price": zod.number().int().gte(0).describe("Unit price in ISO 4217 minor units."),
|
|
497
|
-
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
498
|
-
}),
|
|
499
|
-
"quantity": zod.number().int().gte(1).describe("Quantity of the item being purchased."),
|
|
500
|
-
"totals": zod.array(zod.object({
|
|
501
|
-
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
502
|
-
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
503
|
-
"amount": 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).")
|
|
504
|
-
}).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Line item totals breakdown."),
|
|
505
|
-
"parent_id": zod.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
506
|
-
}).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."),
|
|
507
|
-
"context": zod.object({
|
|
508
|
-
"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(),
|
|
509
|
-
"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(),
|
|
510
|
-
"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(),
|
|
511
|
-
"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(),
|
|
512
|
-
"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(),
|
|
513
|
-
"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(),
|
|
514
|
-
"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()
|
|
515
|
-
}).passthrough().describe("Buyer signals for localization (country, region, postal_code). Merchant uses for pricing, availability, currency. Falls back to geo-IP if omitted.").optional(),
|
|
516
|
-
"signals": zod.object({
|
|
517
|
-
"dev.ucp.buyer_ip": zod.string().describe("Client's IP address (IPv4 or IPv6).").optional(),
|
|
518
|
-
"dev.ucp.user_agent": zod.string().describe("Client's HTTP User-Agent header or equivalent.").optional()
|
|
519
|
-
}).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(),
|
|
520
|
-
"buyer": zod.object({
|
|
521
|
-
"first_name": zod.string().describe("First name of the buyer.").optional(),
|
|
522
|
-
"last_name": zod.string().describe("Last name of the buyer.").optional(),
|
|
523
|
-
"email": zod.string().describe("Email of the buyer.").optional(),
|
|
524
|
-
"phone_number": zod.string().describe("E.164 standard.").optional()
|
|
525
|
-
}).passthrough().describe("Optional buyer information for personalized estimates.").optional()
|
|
526
|
-
}).strict();
|
|
527
|
-
const CartUpdateRequestSchema = zod.object({
|
|
528
|
-
"id": zod.string().describe("Unique cart identifier."),
|
|
529
|
-
"line_items": zod.array(zod.object({
|
|
530
|
-
"id": zod.string(),
|
|
531
|
-
"item": zod.object({
|
|
532
|
-
"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."),
|
|
533
|
-
"title": zod.string().describe("Product title."),
|
|
534
|
-
"price": zod.number().int().gte(0).describe("Unit price in ISO 4217 minor units."),
|
|
535
|
-
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
536
|
-
}),
|
|
537
|
-
"quantity": zod.number().int().gte(1).describe("Quantity of the item being purchased."),
|
|
538
|
-
"totals": zod.array(zod.object({
|
|
539
|
-
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
540
|
-
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
541
|
-
"amount": 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).")
|
|
542
|
-
}).describe("A cost breakdown entry with a category, amount, and optional display text.")).describe("Line item totals breakdown."),
|
|
543
|
-
"parent_id": zod.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
544
|
-
}).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."),
|
|
545
|
-
"context": zod.object({
|
|
546
|
-
"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(),
|
|
547
|
-
"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(),
|
|
548
|
-
"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(),
|
|
549
|
-
"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(),
|
|
550
|
-
"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(),
|
|
551
|
-
"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(),
|
|
552
|
-
"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()
|
|
553
|
-
}).passthrough().describe("Buyer signals for localization (country, region, postal_code). Merchant uses for pricing, availability, currency. Falls back to geo-IP if omitted.").optional(),
|
|
554
|
-
"signals": zod.object({
|
|
555
|
-
"dev.ucp.buyer_ip": zod.string().describe("Client's IP address (IPv4 or IPv6).").optional(),
|
|
556
|
-
"dev.ucp.user_agent": zod.string().describe("Client's HTTP User-Agent header or equivalent.").optional()
|
|
557
|
-
}).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(),
|
|
558
|
-
"buyer": zod.object({
|
|
559
|
-
"first_name": zod.string().describe("First name of the buyer.").optional(),
|
|
560
|
-
"last_name": zod.string().describe("Last name of the buyer.").optional(),
|
|
561
|
-
"email": zod.string().describe("Email of the buyer.").optional(),
|
|
562
|
-
"phone_number": zod.string().describe("E.164 standard.").optional()
|
|
563
|
-
}).passthrough().describe("Optional buyer information for personalized estimates.").optional()
|
|
564
|
-
}).strict();
|
|
565
|
-
const CatalogLookupSchema = zod.record(zod.string(), zod.unknown()).describe("Product/variant lookup by identifier capability.");
|
|
566
|
-
const CatalogSearchSchema = zod.record(zod.string(), zod.unknown()).describe("Product catalog search capability.");
|
|
567
194
|
const CheckoutSchema = zod.object({
|
|
568
195
|
"ucp": zod.intersection(zod.object({
|
|
569
196
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
570
|
-
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
571
197
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
572
198
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
573
199
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -589,31 +215,14 @@ const CheckoutSchema = zod.object({
|
|
|
589
215
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
590
216
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
591
217
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
592
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
593
|
-
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)];
|
|
594
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
595
|
-
const passed = schemas.length - errors.length;
|
|
596
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
597
|
-
path: ctx.path,
|
|
598
|
-
code: "invalid_union",
|
|
599
|
-
unionErrors: errors,
|
|
600
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
601
|
-
} : {
|
|
602
|
-
path: ctx.path,
|
|
603
|
-
code: "custom",
|
|
604
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
605
|
-
});
|
|
606
|
-
}).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(),
|
|
218
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
607
219
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
608
220
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
609
221
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
610
222
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
611
223
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
612
224
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
613
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
614
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
615
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
616
|
-
}).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()
|
|
225
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
617
226
|
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({
|
|
618
227
|
"services": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
619
228
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
@@ -635,10 +244,7 @@ const CheckoutSchema = zod.object({
|
|
|
635
244
|
zod.object({ "transport": zod.literal("a2a").optional() }),
|
|
636
245
|
zod.object({
|
|
637
246
|
"transport": zod.literal("embedded").optional(),
|
|
638
|
-
"config": zod.object({
|
|
639
|
-
"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(),
|
|
640
|
-
"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()
|
|
641
|
-
}).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()
|
|
247
|
+
"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()
|
|
642
248
|
})
|
|
643
249
|
])).describe("Service binding in API responses. Includes per-resource transport configuration via typed config."))).optional(),
|
|
644
250
|
"capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
@@ -647,47 +253,38 @@ const CheckoutSchema = zod.object({
|
|
|
647
253
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
648
254
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
649
255
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
650
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
651
|
-
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)];
|
|
652
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
653
|
-
const passed = schemas.length - errors.length;
|
|
654
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
655
|
-
path: ctx.path,
|
|
656
|
-
code: "invalid_union",
|
|
657
|
-
unionErrors: errors,
|
|
658
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
659
|
-
} : {
|
|
660
|
-
path: ctx.path,
|
|
661
|
-
code: "custom",
|
|
662
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
663
|
-
});
|
|
664
|
-
}).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(),
|
|
256
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })).describe("Capability reference in responses. Only name/version required to confirm active capabilities."))).optional(),
|
|
665
257
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
666
258
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
667
259
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
668
260
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
669
261
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
670
262
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
671
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
672
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
673
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
674
|
-
}).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.")))
|
|
263
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())).describe("Handler reference in responses. May include full config state for runtime usage of the handler.")))
|
|
675
264
|
})).describe("UCP metadata for checkout responses."),
|
|
676
265
|
"id": zod.string().describe("Unique identifier of the checkout session."),
|
|
677
266
|
"line_items": zod.array(zod.object({
|
|
678
267
|
"id": zod.string(),
|
|
679
268
|
"item": zod.object({
|
|
680
|
-
"id": zod.string().describe("
|
|
269
|
+
"id": zod.string().describe("Should be recognized by both the Platform, and the Business. For Google it should match the id provided in the \"id\" field in the product feed."),
|
|
681
270
|
"title": zod.string().describe("Product title."),
|
|
682
|
-
"price": zod.number().int().gte(0).describe("Unit price in
|
|
271
|
+
"price": zod.number().int().gte(0).describe("Unit price in minor (cents) currency units."),
|
|
683
272
|
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
684
273
|
}),
|
|
685
274
|
"quantity": zod.number().int().gte(1).describe("Quantity of the item being purchased."),
|
|
686
275
|
"totals": zod.array(zod.object({
|
|
687
|
-
"type": zod.
|
|
276
|
+
"type": zod.enum([
|
|
277
|
+
"items_discount",
|
|
278
|
+
"subtotal",
|
|
279
|
+
"discount",
|
|
280
|
+
"fulfillment",
|
|
281
|
+
"tax",
|
|
282
|
+
"fee",
|
|
283
|
+
"total"
|
|
284
|
+
]).describe("Type of total categorization."),
|
|
688
285
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
689
|
-
"amount": zod.number().int().gte(0).describe("
|
|
690
|
-
})
|
|
286
|
+
"amount": zod.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
287
|
+
})).describe("Line item totals breakdown."),
|
|
691
288
|
"parent_id": zod.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
692
289
|
}).describe("Line item object. Expected to use the currency of the parent object.")).describe("List of line items being checked out."),
|
|
693
290
|
"buyer": zod.object({
|
|
@@ -699,17 +296,8 @@ const CheckoutSchema = zod.object({
|
|
|
699
296
|
"context": zod.object({
|
|
700
297
|
"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(),
|
|
701
298
|
"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(),
|
|
702
|
-
"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()
|
|
703
|
-
|
|
704
|
-
"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(),
|
|
705
|
-
"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(),
|
|
706
|
-
"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()
|
|
707
|
-
}).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(),
|
|
708
|
-
"signals": zod.object({
|
|
709
|
-
"dev.ucp.buyer_ip": zod.string().describe("Client's IP address (IPv4 or IPv6).").optional(),
|
|
710
|
-
"dev.ucp.user_agent": zod.string().describe("Client's HTTP User-Agent header or equivalent.").optional()
|
|
711
|
-
}).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(),
|
|
712
|
-
"risk_signals": zod.record(zod.string(), zod.unknown()).describe("Deprecated. Use signals instead. Will be removed in the next version.").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
|
+
}).passthrough().describe("Provisional buyer signals for relevance and localization: product availability, pricing, currency, tax, shipping, payment methods, and eligibility (e.g., student or affiliation discounts). Businesses SHOULD use these values when authoritative data (e.g., address) is absent, and MAY ignore unsupported values without returning errors. Context can be disclosed progressively—coarse signals early, finer resolution as the session progresses. Higher-resolution data (shipping address, billing address) supersedes context. Platforms SHOULD progressively enhance context throughout the buyer journey.").optional(),
|
|
713
301
|
"status": zod.enum([
|
|
714
302
|
"incomplete",
|
|
715
303
|
"requires_escalation",
|
|
@@ -719,41 +307,39 @@ const CheckoutSchema = zod.object({
|
|
|
719
307
|
"canceled"
|
|
720
308
|
]).describe("Checkout state indicating the current phase and required action. See Checkout Status lifecycle documentation for state transition details."),
|
|
721
309
|
"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."),
|
|
722
|
-
"totals": zod.array(zod.
|
|
723
|
-
"type": zod.
|
|
310
|
+
"totals": zod.array(zod.object({
|
|
311
|
+
"type": zod.enum([
|
|
312
|
+
"items_discount",
|
|
313
|
+
"subtotal",
|
|
314
|
+
"discount",
|
|
315
|
+
"fulfillment",
|
|
316
|
+
"tax",
|
|
317
|
+
"fee",
|
|
318
|
+
"total"
|
|
319
|
+
]).describe("Type of total categorization."),
|
|
724
320
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
725
|
-
"amount": zod.number().int().gte(0).describe("
|
|
726
|
-
}).describe("
|
|
727
|
-
"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).").optional(),
|
|
728
|
-
"lines": zod.array(zod.object({
|
|
729
|
-
"display_text": zod.string().describe("Human-readable label for this sub-line."),
|
|
730
|
-
"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).")
|
|
731
|
-
}).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()
|
|
732
|
-
})), zod.intersection(zod.any(), zod.intersection(zod.any(), zod.any())))).describe("Different cart totals."),
|
|
321
|
+
"amount": zod.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
322
|
+
})).describe("Different cart totals."),
|
|
733
323
|
"messages": zod.array(zod.record(zod.string(), zod.unknown()).and(zod.unknown().superRefine((x, ctx) => {
|
|
734
324
|
const schemas = [
|
|
735
325
|
zod.object({
|
|
736
326
|
"type": zod.literal("error").describe("Message type discriminator."),
|
|
737
|
-
"code": zod.string().describe("Error code
|
|
327
|
+
"code": zod.string().describe("Error code. Possible values include: missing, invalid, out_of_stock, payment_declined, requires_sign_in, requires_3ds, requires_identity_linking. Freeform codes also allowed."),
|
|
738
328
|
"path": zod.string().describe("RFC 9535 JSONPath to the component the message refers to (e.g., $.items[1]).").optional(),
|
|
739
329
|
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
740
330
|
"content": zod.string().describe("Human-readable message."),
|
|
741
331
|
"severity": zod.enum([
|
|
742
332
|
"recoverable",
|
|
743
333
|
"requires_buyer_input",
|
|
744
|
-
"requires_buyer_review"
|
|
745
|
-
|
|
746
|
-
]).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'.")
|
|
334
|
+
"requires_buyer_review"
|
|
335
|
+
]).describe("Declares who resolves this error. 'recoverable': agent can fix 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 (checkout complete). Errors with 'requires_*' severity contribute to 'status: requires_escalation'.")
|
|
747
336
|
}),
|
|
748
337
|
zod.object({
|
|
749
338
|
"type": zod.literal("warning").describe("Message type discriminator."),
|
|
750
339
|
"path": zod.string().describe("JSONPath (RFC 9535) to related field (e.g., $.line_items[0]).").optional(),
|
|
751
340
|
"code": zod.string().describe("Warning code. Machine-readable identifier for the warning type (e.g., final_sale, prop65, fulfillment_changed, age_restricted, etc.)."),
|
|
752
341
|
"content": zod.string().describe("Human-readable warning message that MUST be displayed."),
|
|
753
|
-
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain")
|
|
754
|
-
"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"),
|
|
755
|
-
"image_url": zod.string().url().describe("URL to a required visual element (e.g., warning symbol, energy class label).").optional(),
|
|
756
|
-
"url": zod.string().url().describe("Reference URL for more information (e.g., regulatory site, registry entry, policy page).").optional()
|
|
342
|
+
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain")
|
|
757
343
|
}),
|
|
758
344
|
zod.object({
|
|
759
345
|
"type": zod.literal("info").describe("Message type discriminator."),
|
|
@@ -810,17 +396,25 @@ const CheckoutCreateRequestSchema = zod.object({
|
|
|
810
396
|
"line_items": zod.array(zod.object({
|
|
811
397
|
"id": zod.string(),
|
|
812
398
|
"item": zod.object({
|
|
813
|
-
"id": zod.string().describe("
|
|
399
|
+
"id": zod.string().describe("Should be recognized by both the Platform, and the Business. For Google it should match the id provided in the \"id\" field in the product feed."),
|
|
814
400
|
"title": zod.string().describe("Product title."),
|
|
815
|
-
"price": zod.number().int().gte(0).describe("Unit price in
|
|
401
|
+
"price": zod.number().int().gte(0).describe("Unit price in minor (cents) currency units."),
|
|
816
402
|
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
817
403
|
}),
|
|
818
404
|
"quantity": zod.number().int().gte(1).describe("Quantity of the item being purchased."),
|
|
819
405
|
"totals": zod.array(zod.object({
|
|
820
|
-
"type": zod.
|
|
406
|
+
"type": zod.enum([
|
|
407
|
+
"items_discount",
|
|
408
|
+
"subtotal",
|
|
409
|
+
"discount",
|
|
410
|
+
"fulfillment",
|
|
411
|
+
"tax",
|
|
412
|
+
"fee",
|
|
413
|
+
"total"
|
|
414
|
+
]).describe("Type of total categorization."),
|
|
821
415
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
822
|
-
"amount": zod.number().int().gte(0).describe("
|
|
823
|
-
})
|
|
416
|
+
"amount": zod.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
417
|
+
})).describe("Line item totals breakdown."),
|
|
824
418
|
"parent_id": zod.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
825
419
|
}).describe("Line item object. Expected to use the currency of the parent object.")).describe("List of line items being checked out."),
|
|
826
420
|
"buyer": zod.object({
|
|
@@ -832,16 +426,8 @@ const CheckoutCreateRequestSchema = zod.object({
|
|
|
832
426
|
"context": zod.object({
|
|
833
427
|
"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(),
|
|
834
428
|
"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(),
|
|
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
|
-
|
|
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(),
|
|
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
|
+
}).passthrough().describe("Provisional buyer signals for relevance and localization: product availability, pricing, currency, tax, shipping, payment methods, and eligibility (e.g., student or affiliation discounts). Businesses SHOULD use these values when authoritative data (e.g., address) is absent, and MAY ignore unsupported values without returning errors. Context can be disclosed progressively—coarse signals early, finer resolution as the session progresses. Higher-resolution data (shipping address, billing address) supersedes context. Platforms SHOULD progressively enhance context throughout the buyer journey.").optional(),
|
|
845
431
|
"payment": zod.object({ "instruments": zod.array(zod.intersection(zod.object({
|
|
846
432
|
"id": zod.string().describe("A unique identifier for this instrument instance, assigned by the platform."),
|
|
847
433
|
"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."),
|
|
@@ -862,65 +448,42 @@ const CheckoutCreateRequestSchema = zod.object({
|
|
|
862
448
|
}).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()
|
|
863
449
|
}).strict();
|
|
864
450
|
const CheckoutUpdateRequestSchema = zod.object({
|
|
451
|
+
"id": zod.string().describe("Unique identifier of the checkout session."),
|
|
865
452
|
"line_items": zod.array(zod.object({
|
|
866
453
|
"id": zod.string(),
|
|
867
454
|
"item": zod.object({
|
|
868
|
-
"id": zod.string().describe("
|
|
455
|
+
"id": zod.string().describe("Should be recognized by both the Platform, and the Business. For Google it should match the id provided in the \"id\" field in the product feed."),
|
|
869
456
|
"title": zod.string().describe("Product title."),
|
|
870
|
-
"price": zod.number().int().gte(0).describe("Unit price in
|
|
457
|
+
"price": zod.number().int().gte(0).describe("Unit price in minor (cents) currency units."),
|
|
871
458
|
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
872
459
|
}),
|
|
873
460
|
"quantity": zod.number().int().gte(1).describe("Quantity of the item being purchased."),
|
|
874
461
|
"totals": zod.array(zod.object({
|
|
875
|
-
"type": zod.
|
|
462
|
+
"type": zod.enum([
|
|
463
|
+
"items_discount",
|
|
464
|
+
"subtotal",
|
|
465
|
+
"discount",
|
|
466
|
+
"fulfillment",
|
|
467
|
+
"tax",
|
|
468
|
+
"fee",
|
|
469
|
+
"total"
|
|
470
|
+
]).describe("Type of total categorization."),
|
|
876
471
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
877
|
-
"amount": zod.number().int().gte(0).describe("
|
|
878
|
-
})
|
|
472
|
+
"amount": zod.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
473
|
+
})).describe("Line item totals breakdown."),
|
|
879
474
|
"parent_id": zod.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
880
|
-
}).describe("Line item object. Expected to use the currency of the parent object.")).describe("List of line items being checked out."),
|
|
881
|
-
"buyer": zod.object({
|
|
882
|
-
"first_name": zod.string().describe("First name of the buyer.").optional(),
|
|
883
|
-
"last_name": zod.string().describe("Last name of the buyer.").optional(),
|
|
884
|
-
"email": zod.string().describe("Email of the buyer.").optional(),
|
|
885
|
-
"phone_number": zod.string().describe("E.164 standard.").optional()
|
|
886
|
-
}).passthrough().describe("Representation of the buyer.").optional(),
|
|
887
|
-
"context": zod.object({
|
|
888
|
-
"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(),
|
|
889
|
-
"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(),
|
|
890
|
-
"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()
|
|
891
|
-
|
|
892
|
-
"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(),
|
|
893
|
-
"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(),
|
|
894
|
-
"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()
|
|
895
|
-
}).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(),
|
|
896
|
-
"signals": zod.object({
|
|
897
|
-
"dev.ucp.buyer_ip": zod.string().describe("Client's IP address (IPv4 or IPv6).").optional(),
|
|
898
|
-
"dev.ucp.user_agent": zod.string().describe("Client's HTTP User-Agent header or equivalent.").optional()
|
|
899
|
-
}).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(),
|
|
900
|
-
"payment": zod.object({ "instruments": zod.array(zod.intersection(zod.object({
|
|
901
|
-
"id": zod.string().describe("A unique identifier for this instrument instance, assigned by the platform."),
|
|
902
|
-
"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."),
|
|
903
|
-
"type": zod.string().describe("The broad category of the instrument (e.g., 'card', 'tokenized_card'). Specific schemas will constrain this to a constant value."),
|
|
904
|
-
"billing_address": zod.object({
|
|
905
|
-
"extended_address": zod.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
906
|
-
"street_address": zod.string().describe("The street address.").optional(),
|
|
907
|
-
"address_locality": zod.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
908
|
-
"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(),
|
|
909
|
-
"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(),
|
|
910
|
-
"postal_code": zod.string().describe("The postal code. For example, 94043.").optional(),
|
|
911
|
-
"first_name": zod.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
912
|
-
"last_name": zod.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
913
|
-
"phone_number": zod.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
914
|
-
}).describe("The billing address associated with this payment method.").optional(),
|
|
915
|
-
"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(),
|
|
916
|
-
"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()
|
|
917
|
-
}).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()
|
|
918
|
-
}).strict();
|
|
919
|
-
const CheckoutCompleteRequestSchema = zod.object({
|
|
920
|
-
"signals": zod.object({
|
|
921
|
-
"dev.ucp.buyer_ip": zod.string().describe("Client's IP address (IPv4 or IPv6).").optional(),
|
|
922
|
-
"dev.ucp.user_agent": zod.string().describe("Client's HTTP User-Agent header or equivalent.").optional()
|
|
923
|
-
}).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(),
|
|
475
|
+
}).describe("Line item object. Expected to use the currency of the parent object.")).describe("List of line items being checked out."),
|
|
476
|
+
"buyer": zod.object({
|
|
477
|
+
"first_name": zod.string().describe("First name of the buyer.").optional(),
|
|
478
|
+
"last_name": zod.string().describe("Last name of the buyer.").optional(),
|
|
479
|
+
"email": zod.string().describe("Email of the buyer.").optional(),
|
|
480
|
+
"phone_number": zod.string().describe("E.164 standard.").optional()
|
|
481
|
+
}).passthrough().describe("Representation of the buyer.").optional(),
|
|
482
|
+
"context": zod.object({
|
|
483
|
+
"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
|
+
"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
|
+
}).passthrough().describe("Provisional buyer signals for relevance and localization: product availability, pricing, currency, tax, shipping, payment methods, and eligibility (e.g., student or affiliation discounts). Businesses SHOULD use these values when authoritative data (e.g., address) is absent, and MAY ignore unsupported values without returning errors. Context can be disclosed progressively—coarse signals early, finer resolution as the session progresses. Higher-resolution data (shipping address, billing address) supersedes context. Platforms SHOULD progressively enhance context throughout the buyer journey.").optional(),
|
|
924
487
|
"payment": zod.object({ "instruments": zod.array(zod.intersection(zod.object({
|
|
925
488
|
"id": zod.string().describe("A unique identifier for this instrument instance, assigned by the platform."),
|
|
926
489
|
"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."),
|
|
@@ -938,24 +501,40 @@ const CheckoutCompleteRequestSchema = zod.object({
|
|
|
938
501
|
}).describe("The billing address associated with this payment method.").optional(),
|
|
939
502
|
"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(),
|
|
940
503
|
"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()
|
|
941
|
-
}).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.")
|
|
504
|
+
}).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()
|
|
942
505
|
}).strict();
|
|
506
|
+
const CheckoutCompleteRequestSchema = zod.object({ "payment": zod.object({ "instruments": zod.array(zod.intersection(zod.object({
|
|
507
|
+
"id": zod.string().describe("A unique identifier for this instrument instance, assigned by the platform."),
|
|
508
|
+
"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."),
|
|
509
|
+
"type": zod.string().describe("The broad category of the instrument (e.g., 'card', 'tokenized_card'). Specific schemas will constrain this to a constant value."),
|
|
510
|
+
"billing_address": zod.object({
|
|
511
|
+
"extended_address": zod.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
512
|
+
"street_address": zod.string().describe("The street address.").optional(),
|
|
513
|
+
"address_locality": zod.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
514
|
+
"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(),
|
|
515
|
+
"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(),
|
|
516
|
+
"postal_code": zod.string().describe("The postal code. For example, 94043.").optional(),
|
|
517
|
+
"first_name": zod.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
518
|
+
"last_name": zod.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
519
|
+
"phone_number": zod.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
520
|
+
}).describe("The billing address associated with this payment method.").optional(),
|
|
521
|
+
"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(),
|
|
522
|
+
"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()
|
|
523
|
+
}).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.") }).strict();
|
|
943
524
|
const DiscountAllocationSchema = zod.object({
|
|
944
525
|
"path": zod.string().describe("JSONPath to the allocation target (e.g., '$.line_items[0]', '$.totals.shipping')."),
|
|
945
|
-
"amount": zod.number().int().gte(0).describe("Amount allocated to this target in
|
|
526
|
+
"amount": zod.number().int().gte(0).describe("Amount allocated to this target in minor (cents) currency units.")
|
|
946
527
|
}).describe("Breakdown of how a discount amount was allocated to a specific target.");
|
|
947
528
|
const DiscountAppliedDiscountSchema = zod.object({
|
|
948
529
|
"code": zod.string().describe("The discount code. Omitted for automatic discounts.").optional(),
|
|
949
530
|
"title": zod.string().describe("Human-readable discount name (e.g., 'Summer Sale 20% Off')."),
|
|
950
|
-
"amount": zod.number().int().gte(0).describe("Total discount amount in
|
|
531
|
+
"amount": zod.number().int().gte(0).describe("Total discount amount in minor (cents) currency units."),
|
|
951
532
|
"automatic": zod.boolean().describe("True if applied automatically by merchant rules (no code required).").default(false),
|
|
952
533
|
"method": zod.enum(["each", "across"]).describe("Allocation method. 'each' = applied independently per item. 'across' = split proportionally by value.").optional(),
|
|
953
534
|
"priority": zod.number().int().gte(1).describe("Stacking order for discount calculation. Lower numbers applied first (1 = first).").optional(),
|
|
954
|
-
"provisional": zod.boolean().describe("True if this discount requires additional verification.").default(false),
|
|
955
|
-
"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(),
|
|
956
535
|
"allocations": zod.array(zod.object({
|
|
957
536
|
"path": zod.string().describe("JSONPath to the allocation target (e.g., '$.line_items[0]', '$.totals.shipping')."),
|
|
958
|
-
"amount": zod.number().int().gte(0).describe("Amount allocated to this target in
|
|
537
|
+
"amount": zod.number().int().gte(0).describe("Amount allocated to this target in minor (cents) currency units.")
|
|
959
538
|
}).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()
|
|
960
539
|
}).describe("A discount that was successfully applied.");
|
|
961
540
|
const DiscountDiscountsObjectSchema = zod.object({
|
|
@@ -963,15 +542,13 @@ const DiscountDiscountsObjectSchema = zod.object({
|
|
|
963
542
|
"applied": zod.array(zod.object({
|
|
964
543
|
"code": zod.string().describe("The discount code. Omitted for automatic discounts.").optional(),
|
|
965
544
|
"title": zod.string().describe("Human-readable discount name (e.g., 'Summer Sale 20% Off')."),
|
|
966
|
-
"amount": zod.number().int().gte(0).describe("Total discount amount in
|
|
545
|
+
"amount": zod.number().int().gte(0).describe("Total discount amount in minor (cents) currency units."),
|
|
967
546
|
"automatic": zod.boolean().describe("True if applied automatically by merchant rules (no code required).").default(false),
|
|
968
547
|
"method": zod.enum(["each", "across"]).describe("Allocation method. 'each' = applied independently per item. 'across' = split proportionally by value.").optional(),
|
|
969
548
|
"priority": zod.number().int().gte(1).describe("Stacking order for discount calculation. Lower numbers applied first (1 = first).").optional(),
|
|
970
|
-
"provisional": zod.boolean().describe("True if this discount requires additional verification.").default(false),
|
|
971
|
-
"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(),
|
|
972
549
|
"allocations": zod.array(zod.object({
|
|
973
550
|
"path": zod.string().describe("JSONPath to the allocation target (e.g., '$.line_items[0]', '$.totals.shipping')."),
|
|
974
|
-
"amount": zod.number().int().gte(0).describe("Amount allocated to this target in
|
|
551
|
+
"amount": zod.number().int().gte(0).describe("Amount allocated to this target in minor (cents) currency units.")
|
|
975
552
|
}).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()
|
|
976
553
|
}).describe("A discount that was successfully applied.")).describe("Discounts successfully applied (code-based and automatic).").readonly().optional()
|
|
977
554
|
}).describe("Discount codes input and applied discounts output.");
|
|
@@ -983,10 +560,18 @@ const FulfillmentExtensionFulfillmentOptionSchema = zod.object({
|
|
|
983
560
|
"earliest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
984
561
|
"latest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
985
562
|
"totals": zod.array(zod.object({
|
|
986
|
-
"type": zod.
|
|
563
|
+
"type": zod.enum([
|
|
564
|
+
"items_discount",
|
|
565
|
+
"subtotal",
|
|
566
|
+
"discount",
|
|
567
|
+
"fulfillment",
|
|
568
|
+
"tax",
|
|
569
|
+
"fee",
|
|
570
|
+
"total"
|
|
571
|
+
]).describe("Type of total categorization."),
|
|
987
572
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
988
|
-
"amount": zod.number().int().gte(0).describe("
|
|
989
|
-
})
|
|
573
|
+
"amount": zod.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
574
|
+
})).describe("Fulfillment option totals breakdown.")
|
|
990
575
|
}).passthrough().describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).");
|
|
991
576
|
const FulfillmentExtensionFulfillmentGroupSchema = zod.object({
|
|
992
577
|
"id": zod.string().describe("Group identifier for referencing merchant-generated groups in updates."),
|
|
@@ -999,10 +584,18 @@ const FulfillmentExtensionFulfillmentGroupSchema = zod.object({
|
|
|
999
584
|
"earliest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
1000
585
|
"latest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
1001
586
|
"totals": zod.array(zod.object({
|
|
1002
|
-
"type": zod.
|
|
587
|
+
"type": zod.enum([
|
|
588
|
+
"items_discount",
|
|
589
|
+
"subtotal",
|
|
590
|
+
"discount",
|
|
591
|
+
"fulfillment",
|
|
592
|
+
"tax",
|
|
593
|
+
"fee",
|
|
594
|
+
"total"
|
|
595
|
+
]).describe("Type of total categorization."),
|
|
1003
596
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1004
|
-
"amount": zod.number().int().gte(0).describe("
|
|
1005
|
-
})
|
|
597
|
+
"amount": zod.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
598
|
+
})).describe("Fulfillment option totals breakdown.")
|
|
1006
599
|
}).passthrough().describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).")).describe("Available fulfillment options for this group.").optional(),
|
|
1007
600
|
"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()
|
|
1008
601
|
}).passthrough().describe("A merchant-generated package/group of line items with fulfillment options.");
|
|
@@ -1061,10 +654,18 @@ const FulfillmentExtensionFulfillmentMethodSchema = zod.object({
|
|
|
1061
654
|
"earliest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
1062
655
|
"latest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
1063
656
|
"totals": zod.array(zod.object({
|
|
1064
|
-
"type": zod.
|
|
657
|
+
"type": zod.enum([
|
|
658
|
+
"items_discount",
|
|
659
|
+
"subtotal",
|
|
660
|
+
"discount",
|
|
661
|
+
"fulfillment",
|
|
662
|
+
"tax",
|
|
663
|
+
"fee",
|
|
664
|
+
"total"
|
|
665
|
+
]).describe("Type of total categorization."),
|
|
1065
666
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1066
|
-
"amount": zod.number().int().gte(0).describe("
|
|
1067
|
-
})
|
|
667
|
+
"amount": zod.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
668
|
+
})).describe("Fulfillment option totals breakdown.")
|
|
1068
669
|
}).passthrough().describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).")).describe("Available fulfillment options for this group.").optional(),
|
|
1069
670
|
"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()
|
|
1070
671
|
}).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()
|
|
@@ -1131,10 +732,18 @@ const FulfillmentExtensionFulfillmentSchema = zod.object({
|
|
|
1131
732
|
"earliest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
1132
733
|
"latest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
1133
734
|
"totals": zod.array(zod.object({
|
|
1134
|
-
"type": zod.
|
|
735
|
+
"type": zod.enum([
|
|
736
|
+
"items_discount",
|
|
737
|
+
"subtotal",
|
|
738
|
+
"discount",
|
|
739
|
+
"fulfillment",
|
|
740
|
+
"tax",
|
|
741
|
+
"fee",
|
|
742
|
+
"total"
|
|
743
|
+
]).describe("Type of total categorization."),
|
|
1135
744
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1136
|
-
"amount": zod.number().int().gte(0).describe("
|
|
1137
|
-
})
|
|
745
|
+
"amount": zod.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
746
|
+
})).describe("Fulfillment option totals breakdown.")
|
|
1138
747
|
}).passthrough().describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).")).describe("Available fulfillment options for this group.").optional(),
|
|
1139
748
|
"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()
|
|
1140
749
|
}).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()
|
|
@@ -1149,7 +758,6 @@ const FulfillmentExtensionFulfillmentSchema = zod.object({
|
|
|
1149
758
|
const OrderSchema = zod.object({
|
|
1150
759
|
"ucp": zod.intersection(zod.object({
|
|
1151
760
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1152
|
-
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
1153
761
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
1154
762
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1155
763
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -1171,61 +779,30 @@ const OrderSchema = zod.object({
|
|
|
1171
779
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1172
780
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1173
781
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1174
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
1175
|
-
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)];
|
|
1176
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
1177
|
-
const passed = schemas.length - errors.length;
|
|
1178
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
1179
|
-
path: ctx.path,
|
|
1180
|
-
code: "invalid_union",
|
|
1181
|
-
unionErrors: errors,
|
|
1182
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1183
|
-
} : {
|
|
1184
|
-
path: ctx.path,
|
|
1185
|
-
code: "custom",
|
|
1186
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1187
|
-
});
|
|
1188
|
-
}).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(),
|
|
782
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
1189
783
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
1190
784
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1191
785
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1192
786
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1193
787
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1194
788
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1195
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
1196
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
1197
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
1198
|
-
}).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()
|
|
789
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
1199
790
|
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({ "capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
1200
791
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1201
792
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1202
793
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1203
794
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1204
795
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1205
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
1206
|
-
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)];
|
|
1207
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
1208
|
-
const passed = schemas.length - errors.length;
|
|
1209
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
1210
|
-
path: ctx.path,
|
|
1211
|
-
code: "invalid_union",
|
|
1212
|
-
unionErrors: errors,
|
|
1213
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1214
|
-
} : {
|
|
1215
|
-
path: ctx.path,
|
|
1216
|
-
code: "custom",
|
|
1217
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1218
|
-
});
|
|
1219
|
-
}).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."),
|
|
796
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").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."),
|
|
1220
797
|
"id": zod.string().describe("Unique order identifier."),
|
|
1221
798
|
"checkout_id": zod.string().describe("Associated checkout ID for reconciliation."),
|
|
1222
799
|
"permalink_url": zod.string().url().describe("Permalink to access the order on merchant site."),
|
|
1223
800
|
"line_items": zod.array(zod.object({
|
|
1224
801
|
"id": zod.string().describe("Line item identifier."),
|
|
1225
802
|
"item": zod.object({
|
|
1226
|
-
"id": zod.string().describe("
|
|
803
|
+
"id": zod.string().describe("Should be recognized by both the Platform, and the Business. For Google it should match the id provided in the \"id\" field in the product feed."),
|
|
1227
804
|
"title": zod.string().describe("Product title."),
|
|
1228
|
-
"price": zod.number().int().gte(0).describe("Unit price in
|
|
805
|
+
"price": zod.number().int().gte(0).describe("Unit price in minor (cents) currency units."),
|
|
1229
806
|
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
1230
807
|
}).describe("Product data (id, title, price, image_url)."),
|
|
1231
808
|
"quantity": zod.object({
|
|
@@ -1233,10 +810,18 @@ const OrderSchema = zod.object({
|
|
|
1233
810
|
"fulfilled": zod.number().int().gte(0).describe("Quantity fulfilled (sum from fulfillment events).")
|
|
1234
811
|
}).describe("Quantity tracking. Both total and fulfilled are derived from events."),
|
|
1235
812
|
"totals": zod.array(zod.object({
|
|
1236
|
-
"type": zod.
|
|
813
|
+
"type": zod.enum([
|
|
814
|
+
"items_discount",
|
|
815
|
+
"subtotal",
|
|
816
|
+
"discount",
|
|
817
|
+
"fulfillment",
|
|
818
|
+
"tax",
|
|
819
|
+
"fee",
|
|
820
|
+
"total"
|
|
821
|
+
]).describe("Type of total categorization."),
|
|
1237
822
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1238
|
-
"amount": zod.number().int().gte(0).describe("
|
|
1239
|
-
})
|
|
823
|
+
"amount": zod.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
824
|
+
})).describe("Line item totals breakdown."),
|
|
1240
825
|
"status": zod.enum([
|
|
1241
826
|
"processing",
|
|
1242
827
|
"partial",
|
|
@@ -1297,21 +882,22 @@ const OrderSchema = zod.object({
|
|
|
1297
882
|
"id": zod.string().describe("Line item ID reference."),
|
|
1298
883
|
"quantity": zod.number().int().gte(1).describe("Quantity affected by this adjustment.")
|
|
1299
884
|
})).describe("Which line items and quantities are affected (optional).").optional(),
|
|
1300
|
-
"amount": zod.number().int().
|
|
885
|
+
"amount": zod.number().int().describe("Amount in minor units (cents) for refunds, credits, price adjustments (optional).").optional(),
|
|
1301
886
|
"description": zod.string().describe("Human-readable reason or description (e.g., 'Defective item', 'Customer requested').").optional()
|
|
1302
887
|
}).describe("Append-only 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("Append-only event log of money movements (refunds, returns, credits, disputes, cancellations, etc.) that exist independently of fulfillment.").optional(),
|
|
1303
|
-
"
|
|
1304
|
-
|
|
1305
|
-
|
|
888
|
+
"totals": zod.array(zod.object({
|
|
889
|
+
"type": zod.enum([
|
|
890
|
+
"items_discount",
|
|
891
|
+
"subtotal",
|
|
892
|
+
"discount",
|
|
893
|
+
"fulfillment",
|
|
894
|
+
"tax",
|
|
895
|
+
"fee",
|
|
896
|
+
"total"
|
|
897
|
+
]).describe("Type of total categorization."),
|
|
1306
898
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1307
|
-
"amount": zod.number().int().gte(0).describe("
|
|
1308
|
-
}).describe("
|
|
1309
|
-
"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).").optional(),
|
|
1310
|
-
"lines": zod.array(zod.object({
|
|
1311
|
-
"display_text": zod.string().describe("Human-readable label for this sub-line."),
|
|
1312
|
-
"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).")
|
|
1313
|
-
}).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()
|
|
1314
|
-
})), zod.intersection(zod.any(), zod.intersection(zod.any(), zod.any())))).describe("Different totals for the order.")
|
|
899
|
+
"amount": zod.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
900
|
+
})).describe("Different totals for the order.")
|
|
1315
901
|
}).describe("Order schema with immutable line items, buyer-facing fulfillment expectations, and append-only event logs.");
|
|
1316
902
|
const PaymentSchema = zod.object({ "instruments": zod.array(zod.intersection(zod.object({
|
|
1317
903
|
"id": zod.string().describe("A unique identifier for this instrument instance, assigned by the platform."),
|
|
@@ -1345,14 +931,9 @@ const AdjustmentSchema = zod.object({
|
|
|
1345
931
|
"id": zod.string().describe("Line item ID reference."),
|
|
1346
932
|
"quantity": zod.number().int().gte(1).describe("Quantity affected by this adjustment.")
|
|
1347
933
|
})).describe("Which line items and quantities are affected (optional).").optional(),
|
|
1348
|
-
"amount": zod.number().int().
|
|
934
|
+
"amount": zod.number().int().describe("Amount in minor units (cents) for refunds, credits, price adjustments (optional).").optional(),
|
|
1349
935
|
"description": zod.string().describe("Human-readable reason or description (e.g., 'Defective item', 'Customer requested').").optional()
|
|
1350
936
|
}).describe("Append-only 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.");
|
|
1351
|
-
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).");
|
|
1352
|
-
const AvailablePaymentInstrumentSchema = zod.object({
|
|
1353
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
1354
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
1355
|
-
}).describe("An instrument type available from a payment handler with optional constraints.");
|
|
1356
937
|
const BindingSchema = zod.object({
|
|
1357
938
|
"checkout_id": zod.string().describe("The checkout session identifier this token is bound to."),
|
|
1358
939
|
"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()
|
|
@@ -1385,131 +966,39 @@ const CardCredentialSchema = zod.intersection(zod.object({ "type": zod.string().
|
|
|
1385
966
|
"cryptogram": zod.string().describe("Cryptogram provided with network tokens.").optional(),
|
|
1386
967
|
"eci_value": zod.string().describe("Electronic Commerce Indicator / Security Level Indicator provided with network tokens.").optional()
|
|
1387
968
|
})).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.");
|
|
1388
|
-
const
|
|
1389
|
-
"
|
|
1390
|
-
"
|
|
1391
|
-
|
|
1392
|
-
"
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
969
|
+
const CardPaymentInstrumentSchema = zod.intersection(zod.object({
|
|
970
|
+
"id": zod.string().describe("A unique identifier for this instrument instance, assigned by the platform."),
|
|
971
|
+
"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."),
|
|
972
|
+
"type": zod.string().describe("The broad category of the instrument (e.g., 'card', 'tokenized_card'). Specific schemas will constrain this to a constant value."),
|
|
973
|
+
"billing_address": zod.object({
|
|
974
|
+
"extended_address": zod.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
975
|
+
"street_address": zod.string().describe("The street address.").optional(),
|
|
976
|
+
"address_locality": zod.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
977
|
+
"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(),
|
|
978
|
+
"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(),
|
|
979
|
+
"postal_code": zod.string().describe("The postal code. For example, 94043.").optional(),
|
|
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.");
|
|
1399
997
|
const ContextSchema = zod.object({
|
|
1400
998
|
"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(),
|
|
1401
999
|
"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(),
|
|
1402
|
-
"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()
|
|
1403
|
-
|
|
1404
|
-
"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(),
|
|
1405
|
-
"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(),
|
|
1406
|
-
"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()
|
|
1407
|
-
}).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.");
|
|
1408
|
-
const DescriptionSchema = zod.object({
|
|
1409
|
-
"plain": zod.string().describe("Plain text content.").optional(),
|
|
1410
|
-
"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(),
|
|
1411
|
-
"markdown": zod.string().describe("Markdown-formatted content.").optional()
|
|
1412
|
-
}).describe("Description content in one or more formats. At least one format must be provided.");
|
|
1413
|
-
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.");
|
|
1414
|
-
const ErrorResponseSchema = zod.object({
|
|
1415
|
-
"ucp": zod.intersection(zod.object({
|
|
1416
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1417
|
-
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
1418
|
-
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
1419
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1420
|
-
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1421
|
-
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1422
|
-
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1423
|
-
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1424
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({
|
|
1425
|
-
"transport": zod.enum([
|
|
1426
|
-
"rest",
|
|
1427
|
-
"mcp",
|
|
1428
|
-
"a2a",
|
|
1429
|
-
"embedded"
|
|
1430
|
-
]).describe("Transport protocol for this service binding."),
|
|
1431
|
-
"endpoint": zod.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
1432
|
-
})))).describe("Service registry keyed by reverse-domain name.").optional(),
|
|
1433
|
-
"capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
1434
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1435
|
-
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1436
|
-
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1437
|
-
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1438
|
-
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1439
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
1440
|
-
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)];
|
|
1441
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
1442
|
-
const passed = schemas.length - errors.length;
|
|
1443
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
1444
|
-
path: ctx.path,
|
|
1445
|
-
code: "invalid_union",
|
|
1446
|
-
unionErrors: errors,
|
|
1447
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1448
|
-
} : {
|
|
1449
|
-
path: ctx.path,
|
|
1450
|
-
code: "custom",
|
|
1451
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1452
|
-
});
|
|
1453
|
-
}).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(),
|
|
1454
|
-
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
1455
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1456
|
-
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1457
|
-
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1458
|
-
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1459
|
-
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1460
|
-
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
1461
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
1462
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
1463
|
-
}).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()
|
|
1464
|
-
}).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."),
|
|
1465
|
-
"messages": zod.array(zod.record(zod.string(), zod.unknown()).and(zod.unknown().superRefine((x, ctx) => {
|
|
1466
|
-
const schemas = [
|
|
1467
|
-
zod.object({
|
|
1468
|
-
"type": zod.literal("error").describe("Message type discriminator."),
|
|
1469
|
-
"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."),
|
|
1470
|
-
"path": zod.string().describe("RFC 9535 JSONPath to the component the message refers to (e.g., $.items[1]).").optional(),
|
|
1471
|
-
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1472
|
-
"content": zod.string().describe("Human-readable message."),
|
|
1473
|
-
"severity": zod.enum([
|
|
1474
|
-
"recoverable",
|
|
1475
|
-
"requires_buyer_input",
|
|
1476
|
-
"requires_buyer_review",
|
|
1477
|
-
"unrecoverable"
|
|
1478
|
-
]).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'.")
|
|
1479
|
-
}),
|
|
1480
|
-
zod.object({
|
|
1481
|
-
"type": zod.literal("warning").describe("Message type discriminator."),
|
|
1482
|
-
"path": zod.string().describe("JSONPath (RFC 9535) to related field (e.g., $.line_items[0]).").optional(),
|
|
1483
|
-
"code": zod.string().describe("Warning code. Machine-readable identifier for the warning type (e.g., final_sale, prop65, fulfillment_changed, age_restricted, etc.)."),
|
|
1484
|
-
"content": zod.string().describe("Human-readable warning message that MUST be displayed."),
|
|
1485
|
-
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1486
|
-
"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"),
|
|
1487
|
-
"image_url": zod.string().url().describe("URL to a required visual element (e.g., warning symbol, energy class label).").optional(),
|
|
1488
|
-
"url": zod.string().url().describe("Reference URL for more information (e.g., regulatory site, registry entry, policy page).").optional()
|
|
1489
|
-
}),
|
|
1490
|
-
zod.object({
|
|
1491
|
-
"type": zod.literal("info").describe("Message type discriminator."),
|
|
1492
|
-
"path": zod.string().describe("RFC 9535 JSONPath to the component the message refers to.").optional(),
|
|
1493
|
-
"code": zod.string().describe("Info code for programmatic handling.").optional(),
|
|
1494
|
-
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1495
|
-
"content": zod.string().describe("Human-readable message.")
|
|
1496
|
-
})
|
|
1497
|
-
];
|
|
1498
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
1499
|
-
const passed = schemas.length - errors.length;
|
|
1500
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
1501
|
-
path: ctx.path,
|
|
1502
|
-
code: "invalid_union",
|
|
1503
|
-
unionErrors: errors,
|
|
1504
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1505
|
-
} : {
|
|
1506
|
-
path: ctx.path,
|
|
1507
|
-
code: "custom",
|
|
1508
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1509
|
-
});
|
|
1510
|
-
})).describe("Container for error, warning, or info messages.")).min(1).describe("Array of messages describing why the operation failed."),
|
|
1511
|
-
"continue_url": zod.string().url().describe("URL for buyer handoff or session recovery.").optional()
|
|
1512
|
-
}).strict().describe("Generic error response when business logic prevents resource creation or failed to retrieve resource. Used when no valid resource can be established.");
|
|
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
|
+
}).passthrough().describe("Provisional buyer signals for relevance and localization: product availability, pricing, currency, tax, shipping, payment methods, and eligibility (e.g., student or affiliation discounts). Businesses SHOULD use these values when authoritative data (e.g., address) is absent, and MAY ignore unsupported values without returning errors. Context can be disclosed progressively—coarse signals early, finer resolution as the session progresses. Higher-resolution data (shipping address, billing address) supersedes context. Platforms SHOULD progressively enhance context throughout the buyer journey.");
|
|
1513
1002
|
const ExpectationSchema = zod.object({
|
|
1514
1003
|
"id": zod.string().describe("Expectation identifier."),
|
|
1515
1004
|
"line_items": zod.array(zod.object({
|
|
@@ -1591,10 +1080,18 @@ const FulfillmentSchema = zod.object({
|
|
|
1591
1080
|
"earliest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
1592
1081
|
"latest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
1593
1082
|
"totals": zod.array(zod.object({
|
|
1594
|
-
"type": zod.
|
|
1083
|
+
"type": zod.enum([
|
|
1084
|
+
"items_discount",
|
|
1085
|
+
"subtotal",
|
|
1086
|
+
"discount",
|
|
1087
|
+
"fulfillment",
|
|
1088
|
+
"tax",
|
|
1089
|
+
"fee",
|
|
1090
|
+
"total"
|
|
1091
|
+
]).describe("Type of total categorization."),
|
|
1595
1092
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1596
|
-
"amount": zod.number().int().gte(0).describe("
|
|
1597
|
-
})
|
|
1093
|
+
"amount": zod.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
1094
|
+
})).describe("Fulfillment option totals breakdown.")
|
|
1598
1095
|
}).passthrough().describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).")).describe("Available fulfillment options for this group.").optional(),
|
|
1599
1096
|
"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()
|
|
1600
1097
|
}).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()
|
|
@@ -1675,10 +1172,18 @@ const FulfillmentGroupSchema = zod.object({
|
|
|
1675
1172
|
"earliest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
1676
1173
|
"latest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
1677
1174
|
"totals": zod.array(zod.object({
|
|
1678
|
-
"type": zod.
|
|
1175
|
+
"type": zod.enum([
|
|
1176
|
+
"items_discount",
|
|
1177
|
+
"subtotal",
|
|
1178
|
+
"discount",
|
|
1179
|
+
"fulfillment",
|
|
1180
|
+
"tax",
|
|
1181
|
+
"fee",
|
|
1182
|
+
"total"
|
|
1183
|
+
]).describe("Type of total categorization."),
|
|
1679
1184
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1680
|
-
"amount": zod.number().int().gte(0).describe("
|
|
1681
|
-
})
|
|
1185
|
+
"amount": zod.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
1186
|
+
})).describe("Fulfillment option totals breakdown.")
|
|
1682
1187
|
}).passthrough().describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).")).describe("Available fulfillment options for this group.").optional(),
|
|
1683
1188
|
"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()
|
|
1684
1189
|
}).passthrough().describe("A merchant-generated package/group of line items with fulfillment options.");
|
|
@@ -1738,10 +1243,18 @@ const FulfillmentMethodSchema = zod.object({
|
|
|
1738
1243
|
"earliest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
1739
1244
|
"latest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
1740
1245
|
"totals": zod.array(zod.object({
|
|
1741
|
-
"type": zod.
|
|
1246
|
+
"type": zod.enum([
|
|
1247
|
+
"items_discount",
|
|
1248
|
+
"subtotal",
|
|
1249
|
+
"discount",
|
|
1250
|
+
"fulfillment",
|
|
1251
|
+
"tax",
|
|
1252
|
+
"fee",
|
|
1253
|
+
"total"
|
|
1254
|
+
]).describe("Type of total categorization."),
|
|
1742
1255
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1743
|
-
"amount": zod.number().int().gte(0).describe("
|
|
1744
|
-
})
|
|
1256
|
+
"amount": zod.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
1257
|
+
})).describe("Fulfillment option totals breakdown.")
|
|
1745
1258
|
}).passthrough().describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).")).describe("Available fulfillment options for this group.").optional(),
|
|
1746
1259
|
"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()
|
|
1747
1260
|
}).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()
|
|
@@ -1751,8 +1264,7 @@ const FulfillmentMethodCreateRequestSchema = zod.object({
|
|
|
1751
1264
|
"line_item_ids": zod.array(zod.string()).describe("Line item IDs fulfilled via this method.").optional()
|
|
1752
1265
|
}).strict();
|
|
1753
1266
|
const FulfillmentMethodUpdateRequestSchema = zod.object({
|
|
1754
|
-
"id": zod.string().describe("Unique fulfillment method identifier.")
|
|
1755
|
-
"type": zod.enum(["shipping", "pickup"]).describe("Fulfillment method type.").optional(),
|
|
1267
|
+
"id": zod.string().describe("Unique fulfillment method identifier."),
|
|
1756
1268
|
"line_item_ids": zod.array(zod.string()).describe("Line item IDs fulfilled via this method.")
|
|
1757
1269
|
}).strict();
|
|
1758
1270
|
const FulfillmentOptionSchema = zod.object({
|
|
@@ -1763,35 +1275,47 @@ const FulfillmentOptionSchema = zod.object({
|
|
|
1763
1275
|
"earliest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
1764
1276
|
"latest_fulfillment_time": zod.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
1765
1277
|
"totals": zod.array(zod.object({
|
|
1766
|
-
"type": zod.
|
|
1278
|
+
"type": zod.enum([
|
|
1279
|
+
"items_discount",
|
|
1280
|
+
"subtotal",
|
|
1281
|
+
"discount",
|
|
1282
|
+
"fulfillment",
|
|
1283
|
+
"tax",
|
|
1284
|
+
"fee",
|
|
1285
|
+
"total"
|
|
1286
|
+
]).describe("Type of total categorization."),
|
|
1767
1287
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1768
|
-
"amount": zod.number().int().gte(0).describe("
|
|
1769
|
-
})
|
|
1288
|
+
"amount": zod.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
1289
|
+
})).describe("Fulfillment option totals breakdown.")
|
|
1770
1290
|
}).passthrough().describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).");
|
|
1771
|
-
const InputCorrelationSchema = zod.object({
|
|
1772
|
-
"id": zod.string().describe("The identifier from the lookup request that resolved to this variant."),
|
|
1773
|
-
"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()
|
|
1774
|
-
}).describe("Maps a request identifier to the variant it resolved to, with match semantics.");
|
|
1775
1291
|
const ItemSchema = zod.object({
|
|
1776
|
-
"id": zod.string().describe("
|
|
1292
|
+
"id": zod.string().describe("Should be recognized by both the Platform, and the Business. For Google it should match the id provided in the \"id\" field in the product feed."),
|
|
1777
1293
|
"title": zod.string().describe("Product title."),
|
|
1778
|
-
"price": zod.number().int().gte(0).describe("Unit price in
|
|
1294
|
+
"price": zod.number().int().gte(0).describe("Unit price in minor (cents) currency units."),
|
|
1779
1295
|
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
1780
1296
|
});
|
|
1781
1297
|
const LineItemSchema = zod.object({
|
|
1782
1298
|
"id": zod.string(),
|
|
1783
1299
|
"item": zod.object({
|
|
1784
|
-
"id": zod.string().describe("
|
|
1300
|
+
"id": zod.string().describe("Should be recognized by both the Platform, and the Business. For Google it should match the id provided in the \"id\" field in the product feed."),
|
|
1785
1301
|
"title": zod.string().describe("Product title."),
|
|
1786
|
-
"price": zod.number().int().gte(0).describe("Unit price in
|
|
1302
|
+
"price": zod.number().int().gte(0).describe("Unit price in minor (cents) currency units."),
|
|
1787
1303
|
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
1788
1304
|
}),
|
|
1789
1305
|
"quantity": zod.number().int().gte(1).describe("Quantity of the item being purchased."),
|
|
1790
1306
|
"totals": zod.array(zod.object({
|
|
1791
|
-
"type": zod.
|
|
1307
|
+
"type": zod.enum([
|
|
1308
|
+
"items_discount",
|
|
1309
|
+
"subtotal",
|
|
1310
|
+
"discount",
|
|
1311
|
+
"fulfillment",
|
|
1312
|
+
"tax",
|
|
1313
|
+
"fee",
|
|
1314
|
+
"total"
|
|
1315
|
+
]).describe("Type of total categorization."),
|
|
1792
1316
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1793
|
-
"amount": zod.number().int().gte(0).describe("
|
|
1794
|
-
})
|
|
1317
|
+
"amount": zod.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
1318
|
+
})).describe("Line item totals breakdown."),
|
|
1795
1319
|
"parent_id": zod.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
1796
1320
|
}).describe("Line item object. Expected to use the currency of the parent object.");
|
|
1797
1321
|
const LineItemUpdateRequestSchema = zod.object({
|
|
@@ -1803,13 +1327,6 @@ const LinkSchema = zod.object({
|
|
|
1803
1327
|
"url": zod.string().url().describe("The actual URL pointing to the content to be displayed."),
|
|
1804
1328
|
"title": zod.string().describe("Optional display text for the link. When provided, use this instead of generating from type.").optional()
|
|
1805
1329
|
});
|
|
1806
|
-
const MediaSchema = zod.object({
|
|
1807
|
-
"type": zod.string().describe("Media type. Well-known values: `image`, `video`, `model_3d`."),
|
|
1808
|
-
"url": zod.string().url().describe("URL to the media resource."),
|
|
1809
|
-
"alt_text": zod.string().describe("Accessibility text describing the media.").optional(),
|
|
1810
|
-
"width": zod.number().int().gte(1).describe("Width in pixels (for images/video).").optional(),
|
|
1811
|
-
"height": zod.number().int().gte(1).describe("Height in pixels (for images/video).").optional()
|
|
1812
|
-
}).describe("Product media item (image, video, etc.).");
|
|
1813
1330
|
const MerchantFulfillmentConfigSchema = zod.object({
|
|
1814
1331
|
"allows_multi_destination": zod.object({
|
|
1815
1332
|
"shipping": zod.boolean().describe("Multiple shipping destinations allowed.").optional(),
|
|
@@ -1821,26 +1338,22 @@ const MessageSchema = zod.record(zod.string(), zod.unknown()).and(zod.unknown().
|
|
|
1821
1338
|
const schemas = [
|
|
1822
1339
|
zod.object({
|
|
1823
1340
|
"type": zod.literal("error").describe("Message type discriminator."),
|
|
1824
|
-
"code": zod.string().describe("Error code
|
|
1341
|
+
"code": zod.string().describe("Error code. Possible values include: missing, invalid, out_of_stock, payment_declined, requires_sign_in, requires_3ds, requires_identity_linking. Freeform codes also allowed."),
|
|
1825
1342
|
"path": zod.string().describe("RFC 9535 JSONPath to the component the message refers to (e.g., $.items[1]).").optional(),
|
|
1826
1343
|
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1827
1344
|
"content": zod.string().describe("Human-readable message."),
|
|
1828
1345
|
"severity": zod.enum([
|
|
1829
1346
|
"recoverable",
|
|
1830
1347
|
"requires_buyer_input",
|
|
1831
|
-
"requires_buyer_review"
|
|
1832
|
-
|
|
1833
|
-
]).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'.")
|
|
1348
|
+
"requires_buyer_review"
|
|
1349
|
+
]).describe("Declares who resolves this error. 'recoverable': agent can fix 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 (checkout complete). Errors with 'requires_*' severity contribute to 'status: requires_escalation'.")
|
|
1834
1350
|
}),
|
|
1835
1351
|
zod.object({
|
|
1836
1352
|
"type": zod.literal("warning").describe("Message type discriminator."),
|
|
1837
1353
|
"path": zod.string().describe("JSONPath (RFC 9535) to related field (e.g., $.line_items[0]).").optional(),
|
|
1838
1354
|
"code": zod.string().describe("Warning code. Machine-readable identifier for the warning type (e.g., final_sale, prop65, fulfillment_changed, age_restricted, etc.)."),
|
|
1839
1355
|
"content": zod.string().describe("Human-readable warning message that MUST be displayed."),
|
|
1840
|
-
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain")
|
|
1841
|
-
"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"),
|
|
1842
|
-
"image_url": zod.string().url().describe("URL to a required visual element (e.g., warning symbol, energy class label).").optional(),
|
|
1843
|
-
"url": zod.string().url().describe("Reference URL for more information (e.g., regulatory site, registry entry, policy page).").optional()
|
|
1356
|
+
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain")
|
|
1844
1357
|
}),
|
|
1845
1358
|
zod.object({
|
|
1846
1359
|
"type": zod.literal("info").describe("Message type discriminator."),
|
|
@@ -1865,16 +1378,15 @@ const MessageSchema = zod.record(zod.string(), zod.unknown()).and(zod.unknown().
|
|
|
1865
1378
|
})).describe("Container for error, warning, or info messages.");
|
|
1866
1379
|
const MessageErrorSchema = zod.object({
|
|
1867
1380
|
"type": zod.literal("error").describe("Message type discriminator."),
|
|
1868
|
-
"code": zod.string().describe("Error code
|
|
1381
|
+
"code": zod.string().describe("Error code. Possible values include: missing, invalid, out_of_stock, payment_declined, requires_sign_in, requires_3ds, requires_identity_linking. Freeform codes also allowed."),
|
|
1869
1382
|
"path": zod.string().describe("RFC 9535 JSONPath to the component the message refers to (e.g., $.items[1]).").optional(),
|
|
1870
1383
|
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1871
1384
|
"content": zod.string().describe("Human-readable message."),
|
|
1872
1385
|
"severity": zod.enum([
|
|
1873
1386
|
"recoverable",
|
|
1874
1387
|
"requires_buyer_input",
|
|
1875
|
-
"requires_buyer_review"
|
|
1876
|
-
|
|
1877
|
-
]).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'.")
|
|
1388
|
+
"requires_buyer_review"
|
|
1389
|
+
]).describe("Declares who resolves this error. 'recoverable': agent can fix 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 (checkout complete). Errors with 'requires_*' severity contribute to 'status: requires_escalation'.")
|
|
1878
1390
|
});
|
|
1879
1391
|
const MessageInfoSchema = zod.object({
|
|
1880
1392
|
"type": zod.literal("info").describe("Message type discriminator."),
|
|
@@ -1888,12 +1400,8 @@ const MessageWarningSchema = zod.object({
|
|
|
1888
1400
|
"path": zod.string().describe("JSONPath (RFC 9535) to related field (e.g., $.line_items[0]).").optional(),
|
|
1889
1401
|
"code": zod.string().describe("Warning code. Machine-readable identifier for the warning type (e.g., final_sale, prop65, fulfillment_changed, age_restricted, etc.)."),
|
|
1890
1402
|
"content": zod.string().describe("Human-readable warning message that MUST be displayed."),
|
|
1891
|
-
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain")
|
|
1892
|
-
"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"),
|
|
1893
|
-
"image_url": zod.string().url().describe("URL to a required visual element (e.g., warning symbol, energy class label).").optional(),
|
|
1894
|
-
"url": zod.string().url().describe("Reference URL for more information (e.g., regulatory site, registry entry, policy page).").optional()
|
|
1403
|
+
"content_type": zod.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain")
|
|
1895
1404
|
});
|
|
1896
|
-
const OptionValueSchema = zod.object({ "label": zod.string().describe("Display text for this option value (e.g., 'Small', 'Blue').") }).describe("A selectable value for a product option.");
|
|
1897
1405
|
const OrderConfirmationSchema = zod.object({
|
|
1898
1406
|
"id": zod.string().describe("Unique order identifier."),
|
|
1899
1407
|
"permalink_url": zod.string().url().describe("Permalink to access the order on merchant site.")
|
|
@@ -1901,9 +1409,9 @@ const OrderConfirmationSchema = zod.object({
|
|
|
1901
1409
|
const OrderLineItemSchema = zod.object({
|
|
1902
1410
|
"id": zod.string().describe("Line item identifier."),
|
|
1903
1411
|
"item": zod.object({
|
|
1904
|
-
"id": zod.string().describe("
|
|
1412
|
+
"id": zod.string().describe("Should be recognized by both the Platform, and the Business. For Google it should match the id provided in the \"id\" field in the product feed."),
|
|
1905
1413
|
"title": zod.string().describe("Product title."),
|
|
1906
|
-
"price": zod.number().int().gte(0).describe("Unit price in
|
|
1414
|
+
"price": zod.number().int().gte(0).describe("Unit price in minor (cents) currency units."),
|
|
1907
1415
|
"image_url": zod.string().url().describe("Product image URI.").optional()
|
|
1908
1416
|
}).describe("Product data (id, title, price, image_url)."),
|
|
1909
1417
|
"quantity": zod.object({
|
|
@@ -1911,10 +1419,18 @@ const OrderLineItemSchema = zod.object({
|
|
|
1911
1419
|
"fulfilled": zod.number().int().gte(0).describe("Quantity fulfilled (sum from fulfillment events).")
|
|
1912
1420
|
}).describe("Quantity tracking. Both total and fulfilled are derived from events."),
|
|
1913
1421
|
"totals": zod.array(zod.object({
|
|
1914
|
-
"type": zod.
|
|
1422
|
+
"type": zod.enum([
|
|
1423
|
+
"items_discount",
|
|
1424
|
+
"subtotal",
|
|
1425
|
+
"discount",
|
|
1426
|
+
"fulfillment",
|
|
1427
|
+
"tax",
|
|
1428
|
+
"fee",
|
|
1429
|
+
"total"
|
|
1430
|
+
]).describe("Type of total categorization."),
|
|
1915
1431
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1916
|
-
"amount": zod.number().int().gte(0).describe("
|
|
1917
|
-
})
|
|
1432
|
+
"amount": zod.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
1433
|
+
})).describe("Line item totals breakdown."),
|
|
1918
1434
|
"status": zod.enum([
|
|
1919
1435
|
"processing",
|
|
1920
1436
|
"partial",
|
|
@@ -1922,7 +1438,6 @@ const OrderLineItemSchema = zod.object({
|
|
|
1922
1438
|
]).describe("Derived status: fulfilled if quantity.fulfilled == quantity.total, partial if quantity.fulfilled > 0, otherwise processing."),
|
|
1923
1439
|
"parent_id": zod.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
1924
1440
|
});
|
|
1925
|
-
const PaginationSchema = zod.record(zod.string(), zod.unknown()).describe("Cursor-based pagination for list operations.");
|
|
1926
1441
|
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.");
|
|
1927
1442
|
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.");
|
|
1928
1443
|
const PaymentInstrumentSchema = zod.object({
|
|
@@ -1955,159 +1470,6 @@ const PostalAddressSchema = zod.object({
|
|
|
1955
1470
|
"last_name": zod.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
1956
1471
|
"phone_number": zod.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
1957
1472
|
});
|
|
1958
|
-
const PriceSchema = zod.object({
|
|
1959
|
-
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
1960
|
-
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
1961
|
-
}).describe("Price with explicit currency.");
|
|
1962
|
-
const PriceFilterSchema = zod.object({
|
|
1963
|
-
"min": zod.number().int().gte(0).describe("Minimum price in ISO 4217 minor units.").optional(),
|
|
1964
|
-
"max": zod.number().int().gte(0).describe("Maximum price in ISO 4217 minor units.").optional()
|
|
1965
|
-
}).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.");
|
|
1966
|
-
const PriceRangeSchema = zod.object({
|
|
1967
|
-
"min": zod.object({
|
|
1968
|
-
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
1969
|
-
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
1970
|
-
}).describe("Minimum price in the range."),
|
|
1971
|
-
"max": zod.object({
|
|
1972
|
-
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
1973
|
-
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
1974
|
-
}).describe("Maximum price in the range.")
|
|
1975
|
-
}).describe("A price range representing minimum and maximum values (e.g., across product variants).");
|
|
1976
|
-
const ProductSchema = zod.object({
|
|
1977
|
-
"id": zod.string().describe("Global ID (GID) uniquely identifying this product."),
|
|
1978
|
-
"handle": zod.string().describe("URL-safe slug for SEO-friendly URLs (e.g., 'blue-runner-pro'). Use id for stable API references.").optional(),
|
|
1979
|
-
"title": zod.string().describe("Product title."),
|
|
1980
|
-
"description": zod.object({
|
|
1981
|
-
"plain": zod.string().describe("Plain text content.").optional(),
|
|
1982
|
-
"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(),
|
|
1983
|
-
"markdown": zod.string().describe("Markdown-formatted content.").optional()
|
|
1984
|
-
}).describe("Product description in one or more formats."),
|
|
1985
|
-
"url": zod.string().url().describe("Canonical product page URL.").optional(),
|
|
1986
|
-
"categories": zod.array(zod.object({
|
|
1987
|
-
"value": zod.string().describe("Category value or path (e.g., 'Apparel > Shirts', '1604')."),
|
|
1988
|
-
"taxonomy": zod.string().describe("Source taxonomy. Well-known values: `google_product_category`, `shopify`, `merchant`.").optional()
|
|
1989
|
-
}).describe("A product category with optional taxonomy identifier.")).describe("Product categories with optional taxonomy identifiers.").optional(),
|
|
1990
|
-
"price_range": zod.object({
|
|
1991
|
-
"min": zod.object({
|
|
1992
|
-
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
1993
|
-
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
1994
|
-
}).describe("Minimum price in the range."),
|
|
1995
|
-
"max": zod.object({
|
|
1996
|
-
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
1997
|
-
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
1998
|
-
}).describe("Maximum price in the range.")
|
|
1999
|
-
}).describe("Price range across all variants."),
|
|
2000
|
-
"list_price_range": zod.object({
|
|
2001
|
-
"min": zod.object({
|
|
2002
|
-
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
2003
|
-
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
2004
|
-
}).describe("Minimum price in the range."),
|
|
2005
|
-
"max": zod.object({
|
|
2006
|
-
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
2007
|
-
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
2008
|
-
}).describe("Maximum price in the range.")
|
|
2009
|
-
}).describe("List price range before discounts (for strikethrough display).").optional(),
|
|
2010
|
-
"media": zod.array(zod.object({
|
|
2011
|
-
"type": zod.string().describe("Media type. Well-known values: `image`, `video`, `model_3d`."),
|
|
2012
|
-
"url": zod.string().url().describe("URL to the media resource."),
|
|
2013
|
-
"alt_text": zod.string().describe("Accessibility text describing the media.").optional(),
|
|
2014
|
-
"width": zod.number().int().gte(1).describe("Width in pixels (for images/video).").optional(),
|
|
2015
|
-
"height": zod.number().int().gte(1).describe("Height in pixels (for images/video).").optional()
|
|
2016
|
-
}).describe("Product media item (image, video, etc.).")).describe("Product media (images, videos, 3D models). First item is the featured media for listings.").optional(),
|
|
2017
|
-
"options": zod.array(zod.object({
|
|
2018
|
-
"name": zod.string().describe("Option name (e.g., 'Size', 'Color')."),
|
|
2019
|
-
"values": zod.array(zod.object({ "label": zod.string().describe("Display text for this option value (e.g., 'Small', 'Blue').") }).describe("A selectable value for a product option.")).min(1).describe("Available values for this option.")
|
|
2020
|
-
}).describe("A product option such as size, color, or material.")).describe("Product options (Size, Color, etc.).").optional(),
|
|
2021
|
-
"variants": zod.array(zod.object({
|
|
2022
|
-
"id": zod.string().describe("Global ID (GID) uniquely identifying this variant. Used as item.id in checkout."),
|
|
2023
|
-
"sku": zod.string().describe("Business-assigned identifier for inventory and fulfillment.").optional(),
|
|
2024
|
-
"barcodes": zod.array(zod.object({
|
|
2025
|
-
"type": zod.string().describe("Barcode standard. Well-known values: UPC, EAN, ISBN, GTIN, JAN."),
|
|
2026
|
-
"value": zod.string().describe("Barcode value.")
|
|
2027
|
-
})).describe("Industry-standard product identifiers for cross-reference and correlation.").optional(),
|
|
2028
|
-
"handle": zod.string().describe("URL-safe variant handle/slug.").optional(),
|
|
2029
|
-
"title": zod.string().describe("Variant display title (e.g., 'Blue / Large')."),
|
|
2030
|
-
"description": zod.object({
|
|
2031
|
-
"plain": zod.string().describe("Plain text content.").optional(),
|
|
2032
|
-
"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(),
|
|
2033
|
-
"markdown": zod.string().describe("Markdown-formatted content.").optional()
|
|
2034
|
-
}).describe("Variant description in one or more formats."),
|
|
2035
|
-
"url": zod.string().url().describe("Canonical variant page URL.").optional(),
|
|
2036
|
-
"categories": zod.array(zod.object({
|
|
2037
|
-
"value": zod.string().describe("Category value or path (e.g., 'Apparel > Shirts', '1604')."),
|
|
2038
|
-
"taxonomy": zod.string().describe("Source taxonomy. Well-known values: `google_product_category`, `shopify`, `merchant`.").optional()
|
|
2039
|
-
}).describe("A product category with optional taxonomy identifier.")).describe("Variant categories with optional taxonomy identifiers.").optional(),
|
|
2040
|
-
"price": zod.object({
|
|
2041
|
-
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
2042
|
-
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
2043
|
-
}).describe("Current selling price."),
|
|
2044
|
-
"list_price": zod.object({
|
|
2045
|
-
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
2046
|
-
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
2047
|
-
}).describe("List price before discounts (for strikethrough display).").optional(),
|
|
2048
|
-
"unit_price": zod.object({
|
|
2049
|
-
"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."),
|
|
2050
|
-
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code."),
|
|
2051
|
-
"measure": zod.object({
|
|
2052
|
-
"value": zod.number().describe("Package quantity."),
|
|
2053
|
-
"unit": zod.string().describe("Unit of measurement.")
|
|
2054
|
-
}).describe("Product quantity in packaging (e.g., 750ml bottle)."),
|
|
2055
|
-
"reference": zod.object({
|
|
2056
|
-
"value": zod.number().int().describe("Reference quantity."),
|
|
2057
|
-
"unit": zod.string().describe("Unit of measurement.")
|
|
2058
|
-
}).describe("Denominator for unit price display (e.g., per 100ml, per 1kg).")
|
|
2059
|
-
}).describe("Price per standard unit of measurement. MAY be omitted when unit pricing does not apply.").optional(),
|
|
2060
|
-
"availability": zod.object({
|
|
2061
|
-
"available": zod.boolean().describe("Whether this variant can be purchased. See status for fulfillment details.").optional(),
|
|
2062
|
-
"status": zod.string().describe("Qualifies available with fulfillment state. Well-known values: `in_stock`, `backorder`, `preorder`, `out_of_stock`, `discontinued`.").optional()
|
|
2063
|
-
}).describe("Variant availability for purchase.").optional(),
|
|
2064
|
-
"selected_options": zod.array(zod.object({
|
|
2065
|
-
"name": zod.string().describe("Option name (e.g., 'Size')."),
|
|
2066
|
-
"label": zod.string().describe("Selected option label (e.g., 'Large').")
|
|
2067
|
-
}).describe("A specific option selection on a variant (e.g., Size: Large).")).describe("Option selections that define this variant.").optional(),
|
|
2068
|
-
"media": zod.array(zod.object({
|
|
2069
|
-
"type": zod.string().describe("Media type. Well-known values: `image`, `video`, `model_3d`."),
|
|
2070
|
-
"url": zod.string().url().describe("URL to the media resource."),
|
|
2071
|
-
"alt_text": zod.string().describe("Accessibility text describing the media.").optional(),
|
|
2072
|
-
"width": zod.number().int().gte(1).describe("Width in pixels (for images/video).").optional(),
|
|
2073
|
-
"height": zod.number().int().gte(1).describe("Height in pixels (for images/video).").optional()
|
|
2074
|
-
}).describe("Product media item (image, video, etc.).")).describe("Variant media (images, videos, 3D models). First item is the featured media for listings.").optional(),
|
|
2075
|
-
"rating": zod.object({
|
|
2076
|
-
"value": zod.number().gte(0).describe("Average rating value."),
|
|
2077
|
-
"scale_min": zod.number().gte(0).describe("Minimum value on the rating scale (e.g., 1 for 1-5 stars).").default(1),
|
|
2078
|
-
"scale_max": zod.number().gte(1).describe("Maximum value on the rating scale (e.g., 5 for 5-star)."),
|
|
2079
|
-
"count": zod.number().int().gte(0).describe("Number of reviews contributing to the rating.").optional()
|
|
2080
|
-
}).describe("Variant rating.").optional(),
|
|
2081
|
-
"tags": zod.array(zod.string()).describe("Variant tags for categorization and search.").optional(),
|
|
2082
|
-
"metadata": zod.record(zod.string(), zod.unknown()).describe("Business-defined custom data extending the standard variant model.").optional(),
|
|
2083
|
-
"seller": zod.object({
|
|
2084
|
-
"name": zod.string().describe("Seller display name.").optional(),
|
|
2085
|
-
"links": zod.array(zod.object({
|
|
2086
|
-
"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."),
|
|
2087
|
-
"url": zod.string().url().describe("The actual URL pointing to the content to be displayed."),
|
|
2088
|
-
"title": zod.string().describe("Optional display text for the link. When provided, use this instead of generating from type.").optional()
|
|
2089
|
-
})).describe("Seller policy and information links.").optional()
|
|
2090
|
-
}).describe("Optional seller context for this variant.").optional()
|
|
2091
|
-
}).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."),
|
|
2092
|
-
"rating": zod.object({
|
|
2093
|
-
"value": zod.number().gte(0).describe("Average rating value."),
|
|
2094
|
-
"scale_min": zod.number().gte(0).describe("Minimum value on the rating scale (e.g., 1 for 1-5 stars).").default(1),
|
|
2095
|
-
"scale_max": zod.number().gte(1).describe("Maximum value on the rating scale (e.g., 5 for 5-star)."),
|
|
2096
|
-
"count": zod.number().int().gte(0).describe("Number of reviews contributing to the rating.").optional()
|
|
2097
|
-
}).describe("Aggregate product rating.").optional(),
|
|
2098
|
-
"tags": zod.array(zod.string()).describe("Product tags for categorization and search.").optional(),
|
|
2099
|
-
"metadata": zod.record(zod.string(), zod.unknown()).describe("Business-defined custom data extending the standard product model.").optional()
|
|
2100
|
-
}).describe("A product in the catalog with variants and options.");
|
|
2101
|
-
const ProductOptionSchema = zod.object({
|
|
2102
|
-
"name": zod.string().describe("Option name (e.g., 'Size', 'Color')."),
|
|
2103
|
-
"values": zod.array(zod.object({ "label": zod.string().describe("Display text for this option value (e.g., 'Small', 'Blue').") }).describe("A selectable value for a product option.")).min(1).describe("Available values for this option.")
|
|
2104
|
-
}).describe("A product option such as size, color, or material.");
|
|
2105
|
-
const RatingSchema = zod.object({
|
|
2106
|
-
"value": zod.number().gte(0).describe("Average rating value."),
|
|
2107
|
-
"scale_min": zod.number().gte(0).describe("Minimum value on the rating scale (e.g., 1 for 1-5 stars).").default(1),
|
|
2108
|
-
"scale_max": zod.number().gte(1).describe("Maximum value on the rating scale (e.g., 5 for 5-star)."),
|
|
2109
|
-
"count": zod.number().int().gte(0).describe("Number of reviews contributing to the rating.").optional()
|
|
2110
|
-
}).describe("Product rating aggregate.");
|
|
2111
1473
|
const RetailLocationSchema = zod.object({
|
|
2112
1474
|
"id": zod.string().describe("Unique location identifier."),
|
|
2113
1475
|
"name": zod.string().describe("Location name (e.g., store name)."),
|
|
@@ -2123,18 +1485,6 @@ const RetailLocationSchema = zod.object({
|
|
|
2123
1485
|
"phone_number": zod.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
2124
1486
|
}).describe("Physical address of the location.").optional()
|
|
2125
1487
|
}).passthrough().describe("A pickup location (retail store, locker, etc.).");
|
|
2126
|
-
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').");
|
|
2127
|
-
const SearchFiltersSchema = zod.object({
|
|
2128
|
-
"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(),
|
|
2129
|
-
"price": zod.object({
|
|
2130
|
-
"min": zod.number().int().gte(0).describe("Minimum price in ISO 4217 minor units.").optional(),
|
|
2131
|
-
"max": zod.number().int().gte(0).describe("Maximum price in ISO 4217 minor units.").optional()
|
|
2132
|
-
}).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()
|
|
2133
|
-
}).passthrough().describe("Filter criteria to narrow search results. All specified filters combine with AND logic.");
|
|
2134
|
-
const SelectedOptionSchema = zod.object({
|
|
2135
|
-
"name": zod.string().describe("Option name (e.g., 'Size')."),
|
|
2136
|
-
"label": zod.string().describe("Selected option label (e.g., 'Large').")
|
|
2137
|
-
}).describe("A specific option selection on a variant (e.g., Size: Large).");
|
|
2138
1488
|
const ShippingDestinationSchema = zod.record(zod.string(), zod.unknown()).and(zod.intersection(zod.object({
|
|
2139
1489
|
"extended_address": zod.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
2140
1490
|
"street_address": zod.string().describe("The street address.").optional(),
|
|
@@ -2146,121 +1496,26 @@ const ShippingDestinationSchema = zod.record(zod.string(), zod.unknown()).and(zo
|
|
|
2146
1496
|
"last_name": zod.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
2147
1497
|
"phone_number": zod.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
2148
1498
|
}), zod.object({ "id": zod.string().describe("ID specific to this shipping destination.") }))).describe("Shipping destination.");
|
|
2149
|
-
const SignalsSchema = zod.object({
|
|
2150
|
-
"dev.ucp.buyer_ip": zod.string().describe("Client's IP address (IPv4 or IPv6).").optional(),
|
|
2151
|
-
"dev.ucp.user_agent": zod.string().describe("Client's HTTP User-Agent header or equivalent.").optional()
|
|
2152
|
-
}).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.");
|
|
2153
|
-
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).");
|
|
2154
1499
|
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({
|
|
2155
1500
|
"type": zod.string().describe("The specific type of token produced by the handler (e.g., 'stripe_token')."),
|
|
2156
1501
|
"token": zod.string().describe("The token value.")
|
|
2157
1502
|
})).describe("Base token credential schema. Concrete payment handlers may extend this schema with additional fields and define their own constraints.");
|
|
2158
1503
|
const TotalSchema = zod.object({
|
|
2159
|
-
"type": zod.
|
|
1504
|
+
"type": zod.enum([
|
|
1505
|
+
"items_discount",
|
|
1506
|
+
"subtotal",
|
|
1507
|
+
"discount",
|
|
1508
|
+
"fulfillment",
|
|
1509
|
+
"tax",
|
|
1510
|
+
"fee",
|
|
1511
|
+
"total"
|
|
1512
|
+
]).describe("Type of total categorization."),
|
|
2160
1513
|
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
2161
|
-
"amount": zod.number().int().gte(0).describe("
|
|
2162
|
-
})
|
|
2163
|
-
const
|
|
2164
|
-
"type": zod.string().describe("Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Businesses MAY use additional values."),
|
|
2165
|
-
"display_text": zod.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
2166
|
-
"amount": 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).")
|
|
2167
|
-
}).describe("A cost breakdown entry with a category, amount, and optional display text."), zod.object({
|
|
2168
|
-
"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).").optional(),
|
|
2169
|
-
"lines": zod.array(zod.object({
|
|
2170
|
-
"display_text": zod.string().describe("Human-readable label for this sub-line."),
|
|
2171
|
-
"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).")
|
|
2172
|
-
}).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()
|
|
2173
|
-
})), zod.intersection(zod.any(), zod.intersection(zod.any(), 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.");
|
|
2174
|
-
const VariantSchema = zod.object({
|
|
2175
|
-
"id": zod.string().describe("Global ID (GID) uniquely identifying this variant. Used as item.id in checkout."),
|
|
2176
|
-
"sku": zod.string().describe("Business-assigned identifier for inventory and fulfillment.").optional(),
|
|
2177
|
-
"barcodes": zod.array(zod.object({
|
|
2178
|
-
"type": zod.string().describe("Barcode standard. Well-known values: UPC, EAN, ISBN, GTIN, JAN."),
|
|
2179
|
-
"value": zod.string().describe("Barcode value.")
|
|
2180
|
-
})).describe("Industry-standard product identifiers for cross-reference and correlation.").optional(),
|
|
2181
|
-
"handle": zod.string().describe("URL-safe variant handle/slug.").optional(),
|
|
2182
|
-
"title": zod.string().describe("Variant display title (e.g., 'Blue / Large')."),
|
|
2183
|
-
"description": zod.object({
|
|
2184
|
-
"plain": zod.string().describe("Plain text content.").optional(),
|
|
2185
|
-
"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(),
|
|
2186
|
-
"markdown": zod.string().describe("Markdown-formatted content.").optional()
|
|
2187
|
-
}).describe("Variant description in one or more formats."),
|
|
2188
|
-
"url": zod.string().url().describe("Canonical variant page URL.").optional(),
|
|
2189
|
-
"categories": zod.array(zod.object({
|
|
2190
|
-
"value": zod.string().describe("Category value or path (e.g., 'Apparel > Shirts', '1604')."),
|
|
2191
|
-
"taxonomy": zod.string().describe("Source taxonomy. Well-known values: `google_product_category`, `shopify`, `merchant`.").optional()
|
|
2192
|
-
}).describe("A product category with optional taxonomy identifier.")).describe("Variant categories with optional taxonomy identifiers.").optional(),
|
|
2193
|
-
"price": zod.object({
|
|
2194
|
-
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
2195
|
-
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
2196
|
-
}).describe("Current selling price."),
|
|
2197
|
-
"list_price": zod.object({
|
|
2198
|
-
"amount": zod.number().int().gte(0).describe("Amount in ISO 4217 minor units. Use 0 for free items."),
|
|
2199
|
-
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP').")
|
|
2200
|
-
}).describe("List price before discounts (for strikethrough display).").optional(),
|
|
2201
|
-
"unit_price": zod.object({
|
|
2202
|
-
"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."),
|
|
2203
|
-
"currency": zod.string().regex(/* @__PURE__ */ new RegExp("^[A-Z]{3}$")).describe("ISO 4217 currency code."),
|
|
2204
|
-
"measure": zod.object({
|
|
2205
|
-
"value": zod.number().describe("Package quantity."),
|
|
2206
|
-
"unit": zod.string().describe("Unit of measurement.")
|
|
2207
|
-
}).describe("Product quantity in packaging (e.g., 750ml bottle)."),
|
|
2208
|
-
"reference": zod.object({
|
|
2209
|
-
"value": zod.number().int().describe("Reference quantity."),
|
|
2210
|
-
"unit": zod.string().describe("Unit of measurement.")
|
|
2211
|
-
}).describe("Denominator for unit price display (e.g., per 100ml, per 1kg).")
|
|
2212
|
-
}).describe("Price per standard unit of measurement. MAY be omitted when unit pricing does not apply.").optional(),
|
|
2213
|
-
"availability": zod.object({
|
|
2214
|
-
"available": zod.boolean().describe("Whether this variant can be purchased. See status for fulfillment details.").optional(),
|
|
2215
|
-
"status": zod.string().describe("Qualifies available with fulfillment state. Well-known values: `in_stock`, `backorder`, `preorder`, `out_of_stock`, `discontinued`.").optional()
|
|
2216
|
-
}).describe("Variant availability for purchase.").optional(),
|
|
2217
|
-
"selected_options": zod.array(zod.object({
|
|
2218
|
-
"name": zod.string().describe("Option name (e.g., 'Size')."),
|
|
2219
|
-
"label": zod.string().describe("Selected option label (e.g., 'Large').")
|
|
2220
|
-
}).describe("A specific option selection on a variant (e.g., Size: Large).")).describe("Option selections that define this variant.").optional(),
|
|
2221
|
-
"media": zod.array(zod.object({
|
|
2222
|
-
"type": zod.string().describe("Media type. Well-known values: `image`, `video`, `model_3d`."),
|
|
2223
|
-
"url": zod.string().url().describe("URL to the media resource."),
|
|
2224
|
-
"alt_text": zod.string().describe("Accessibility text describing the media.").optional(),
|
|
2225
|
-
"width": zod.number().int().gte(1).describe("Width in pixels (for images/video).").optional(),
|
|
2226
|
-
"height": zod.number().int().gte(1).describe("Height in pixels (for images/video).").optional()
|
|
2227
|
-
}).describe("Product media item (image, video, etc.).")).describe("Variant media (images, videos, 3D models). First item is the featured media for listings.").optional(),
|
|
2228
|
-
"rating": zod.object({
|
|
2229
|
-
"value": zod.number().gte(0).describe("Average rating value."),
|
|
2230
|
-
"scale_min": zod.number().gte(0).describe("Minimum value on the rating scale (e.g., 1 for 1-5 stars).").default(1),
|
|
2231
|
-
"scale_max": zod.number().gte(1).describe("Maximum value on the rating scale (e.g., 5 for 5-star)."),
|
|
2232
|
-
"count": zod.number().int().gte(0).describe("Number of reviews contributing to the rating.").optional()
|
|
2233
|
-
}).describe("Variant rating.").optional(),
|
|
2234
|
-
"tags": zod.array(zod.string()).describe("Variant tags for categorization and search.").optional(),
|
|
2235
|
-
"metadata": zod.record(zod.string(), zod.unknown()).describe("Business-defined custom data extending the standard variant model.").optional(),
|
|
2236
|
-
"seller": zod.object({
|
|
2237
|
-
"name": zod.string().describe("Seller display name.").optional(),
|
|
2238
|
-
"links": zod.array(zod.object({
|
|
2239
|
-
"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."),
|
|
2240
|
-
"url": zod.string().url().describe("The actual URL pointing to the content to be displayed."),
|
|
2241
|
-
"title": zod.string().describe("Optional display text for the link. When provided, use this instead of generating from type.").optional()
|
|
2242
|
-
})).describe("Seller policy and information links.").optional()
|
|
2243
|
-
}).describe("Optional seller context for this variant.").optional()
|
|
2244
|
-
}).describe("A purchasable variant of a product with specific option selections.");
|
|
2245
|
-
const EmbeddedConfigSchema = zod.object({
|
|
2246
|
-
"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(),
|
|
2247
|
-
"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()
|
|
2248
|
-
}).describe("Per-checkout configuration for embedded transport binding. Allows businesses to vary ECP availability and delegations based on cart contents, agent authorization, or policy.");
|
|
1514
|
+
"amount": zod.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
1515
|
+
});
|
|
1516
|
+
const EmbeddedConfigSchema = 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.");
|
|
2249
1517
|
const UcpVersionSchema = zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format.");
|
|
2250
|
-
const
|
|
2251
|
-
"min": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Minimum required version (inclusive)."),
|
|
2252
|
-
"max": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Maximum compatible version (inclusive). When absent, no upper bound.").optional()
|
|
2253
|
-
}).passthrough().describe("Version range requirement with minimum and optional maximum.");
|
|
2254
|
-
const UcpRequiresSchema = zod.object({
|
|
2255
|
-
"protocol": zod.object({
|
|
2256
|
-
"min": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Minimum required version (inclusive)."),
|
|
2257
|
-
"max": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Maximum compatible version (inclusive). When absent, no upper bound.").optional()
|
|
2258
|
-
}).passthrough().describe("Required protocol version.").optional(),
|
|
2259
|
-
"capabilities": zod.record(zod.object({
|
|
2260
|
-
"min": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Minimum required version (inclusive)."),
|
|
2261
|
-
"max": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Maximum compatible version (inclusive). When absent, no upper bound.").optional()
|
|
2262
|
-
}).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()
|
|
2263
|
-
}).passthrough().describe("Version requirements for extension schemas. Declares minimum (and optionally maximum) protocol and capability versions needed for correct operation.");
|
|
1518
|
+
const UcpReverseDomainNameSchema = zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Reverse-domain identifier (e.g., com.google.pay, dev.ucp.shopping.checkout)");
|
|
2264
1519
|
const UcpEntitySchema = zod.object({
|
|
2265
1520
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2266
1521
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -2270,57 +1525,6 @@ const UcpEntitySchema = zod.object({
|
|
|
2270
1525
|
}).describe("Shared foundation for all UCP entities.");
|
|
2271
1526
|
const UcpBaseSchema = zod.object({
|
|
2272
1527
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2273
|
-
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
2274
|
-
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
2275
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2276
|
-
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2277
|
-
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2278
|
-
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2279
|
-
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2280
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({
|
|
2281
|
-
"transport": zod.enum([
|
|
2282
|
-
"rest",
|
|
2283
|
-
"mcp",
|
|
2284
|
-
"a2a",
|
|
2285
|
-
"embedded"
|
|
2286
|
-
]).describe("Transport protocol for this service binding."),
|
|
2287
|
-
"endpoint": zod.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
2288
|
-
})))).describe("Service registry keyed by reverse-domain name.").optional(),
|
|
2289
|
-
"capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
2290
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2291
|
-
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2292
|
-
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2293
|
-
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2294
|
-
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2295
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2296
|
-
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)];
|
|
2297
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2298
|
-
const passed = schemas.length - errors.length;
|
|
2299
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2300
|
-
path: ctx.path,
|
|
2301
|
-
code: "invalid_union",
|
|
2302
|
-
unionErrors: errors,
|
|
2303
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2304
|
-
} : {
|
|
2305
|
-
path: ctx.path,
|
|
2306
|
-
code: "custom",
|
|
2307
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2308
|
-
});
|
|
2309
|
-
}).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(),
|
|
2310
|
-
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
2311
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2312
|
-
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2313
|
-
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2314
|
-
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2315
|
-
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2316
|
-
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
2317
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2318
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2319
|
-
}).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()
|
|
2320
|
-
}).describe("Base UCP metadata with shared properties for all schema types.");
|
|
2321
|
-
const UcpPlatformSchema = zod.intersection(zod.object({
|
|
2322
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2323
|
-
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
2324
1528
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
2325
1529
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2326
1530
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -2342,87 +1546,17 @@ const UcpPlatformSchema = zod.intersection(zod.object({
|
|
|
2342
1546
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2343
1547
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2344
1548
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2345
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2346
|
-
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)];
|
|
2347
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2348
|
-
const passed = schemas.length - errors.length;
|
|
2349
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2350
|
-
path: ctx.path,
|
|
2351
|
-
code: "invalid_union",
|
|
2352
|
-
unionErrors: errors,
|
|
2353
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2354
|
-
} : {
|
|
2355
|
-
path: ctx.path,
|
|
2356
|
-
code: "custom",
|
|
2357
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2358
|
-
});
|
|
2359
|
-
}).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(),
|
|
1549
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
2360
1550
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
2361
1551
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2362
1552
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2363
1553
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2364
1554
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2365
|
-
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2366
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
}).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()
|
|
2370
|
-
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({
|
|
2371
|
-
"services": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
2372
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2373
|
-
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2374
|
-
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2375
|
-
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2376
|
-
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2377
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({
|
|
2378
|
-
"transport": zod.enum([
|
|
2379
|
-
"rest",
|
|
2380
|
-
"mcp",
|
|
2381
|
-
"a2a",
|
|
2382
|
-
"embedded"
|
|
2383
|
-
]).describe("Transport protocol for this service binding."),
|
|
2384
|
-
"endpoint": zod.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
2385
|
-
})), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.union([
|
|
2386
|
-
zod.object({ "transport": zod.literal("rest").optional() }),
|
|
2387
|
-
zod.object({ "transport": zod.literal("mcp").optional() }),
|
|
2388
|
-
zod.object({ "transport": zod.literal("a2a").optional() }),
|
|
2389
|
-
zod.object({ "transport": zod.literal("embedded").optional() })
|
|
2390
|
-
]))).describe("Full service declaration for platform-level discovery. Different transports require different fields."))),
|
|
2391
|
-
"capabilities": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
2392
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2393
|
-
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2394
|
-
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2395
|
-
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2396
|
-
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2397
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2398
|
-
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)];
|
|
2399
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2400
|
-
const passed = schemas.length - errors.length;
|
|
2401
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2402
|
-
path: ctx.path,
|
|
2403
|
-
code: "invalid_union",
|
|
2404
|
-
unionErrors: errors,
|
|
2405
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2406
|
-
} : {
|
|
2407
|
-
path: ctx.path,
|
|
2408
|
-
code: "custom",
|
|
2409
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2410
|
-
});
|
|
2411
|
-
}).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(),
|
|
2412
|
-
"payment_handlers": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
2413
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2414
|
-
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2415
|
-
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2416
|
-
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2417
|
-
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2418
|
-
}).describe("Shared foundation for all UCP entities."), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.object({ "available_instruments": zod.array(zod.object({
|
|
2419
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2420
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2421
|
-
}).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.")))
|
|
2422
|
-
})).describe("Full UCP metadata for platform-level configuration. Hosted at a URI advertised by the platform in request headers.");
|
|
2423
|
-
const UcpBusinessSchema = zod.intersection(zod.object({
|
|
1555
|
+
"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())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
1557
|
+
}).describe("Base UCP metadata with shared properties for all schema types.");
|
|
1558
|
+
const UcpPlatformSchema = zod.intersection(zod.object({
|
|
2424
1559
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2425
|
-
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
2426
1560
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
2427
1561
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2428
1562
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -2444,33 +1578,15 @@ const UcpBusinessSchema = zod.intersection(zod.object({
|
|
|
2444
1578
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2445
1579
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2446
1580
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2447
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2448
|
-
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)];
|
|
2449
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2450
|
-
const passed = schemas.length - errors.length;
|
|
2451
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2452
|
-
path: ctx.path,
|
|
2453
|
-
code: "invalid_union",
|
|
2454
|
-
unionErrors: errors,
|
|
2455
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2456
|
-
} : {
|
|
2457
|
-
path: ctx.path,
|
|
2458
|
-
code: "custom",
|
|
2459
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2460
|
-
});
|
|
2461
|
-
}).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(),
|
|
1581
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
2462
1582
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
2463
1583
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2464
1584
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2465
1585
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2466
1586
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2467
1587
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2468
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
2469
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2470
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2471
|
-
}).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()
|
|
1588
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
2472
1589
|
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({
|
|
2473
|
-
"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(),
|
|
2474
1590
|
"services": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
2475
1591
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2476
1592
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -2485,53 +1601,29 @@ const UcpBusinessSchema = zod.intersection(zod.object({
|
|
|
2485
1601
|
"embedded"
|
|
2486
1602
|
]).describe("Transport protocol for this service binding."),
|
|
2487
1603
|
"endpoint": zod.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
2488
|
-
})), zod.union([
|
|
1604
|
+
})), zod.intersection(zod.record(zod.string(), zod.unknown()), zod.union([
|
|
2489
1605
|
zod.object({ "transport": zod.literal("rest").optional() }),
|
|
2490
1606
|
zod.object({ "transport": zod.literal("mcp").optional() }),
|
|
2491
1607
|
zod.object({ "transport": zod.literal("a2a").optional() }),
|
|
2492
|
-
zod.object({
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
"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(),
|
|
2496
|
-
"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()
|
|
2497
|
-
}).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()
|
|
2498
|
-
})
|
|
2499
|
-
])).describe("Service binding for business/merchant configuration. May override platform endpoints."))),
|
|
2500
|
-
"capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
1608
|
+
zod.object({ "transport": zod.literal("embedded").optional() })
|
|
1609
|
+
]))).describe("Full service declaration for platform-level discovery. Different transports require different fields."))),
|
|
1610
|
+
"capabilities": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
2501
1611
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2502
1612
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2503
1613
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2504
1614
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2505
1615
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2506
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2507
|
-
|
|
2508
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2509
|
-
const passed = schemas.length - errors.length;
|
|
2510
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2511
|
-
path: ctx.path,
|
|
2512
|
-
code: "invalid_union",
|
|
2513
|
-
unionErrors: errors,
|
|
2514
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2515
|
-
} : {
|
|
2516
|
-
path: ctx.path,
|
|
2517
|
-
code: "custom",
|
|
2518
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2519
|
-
});
|
|
2520
|
-
}).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(),
|
|
2521
|
-
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
1616
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })), zod.record(zod.string(), zod.unknown())).describe("Full capability declaration for platform-level discovery. Includes spec/schema URLs for agent fetching."))).optional(),
|
|
1617
|
+
"payment_handlers": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
2522
1618
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2523
1619
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2524
1620
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2525
1621
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2526
1622
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2527
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
}).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.")))
|
|
2531
|
-
})).describe("UCP metadata for business/merchant-level configuration. Subset of platform schema with business-specific settings.");
|
|
2532
|
-
const UcpResponseCheckoutSchema = zod.intersection(zod.object({
|
|
1623
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())), zod.record(zod.string(), zod.unknown())).describe("Platform declaration for discovery profiles. May include partial config state required for discovery.")))
|
|
1624
|
+
})).describe("Full UCP metadata for platform-level configuration. Hosted at a URI advertised by the platform in request headers.");
|
|
1625
|
+
const UcpBusinessSchema = zod.intersection(zod.object({
|
|
2533
1626
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2534
|
-
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
2535
1627
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
2536
1628
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2537
1629
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -2553,31 +1645,14 @@ const UcpResponseCheckoutSchema = zod.intersection(zod.object({
|
|
|
2553
1645
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2554
1646
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2555
1647
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2556
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2557
|
-
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)];
|
|
2558
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2559
|
-
const passed = schemas.length - errors.length;
|
|
2560
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2561
|
-
path: ctx.path,
|
|
2562
|
-
code: "invalid_union",
|
|
2563
|
-
unionErrors: errors,
|
|
2564
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2565
|
-
} : {
|
|
2566
|
-
path: ctx.path,
|
|
2567
|
-
code: "custom",
|
|
2568
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2569
|
-
});
|
|
2570
|
-
}).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(),
|
|
1648
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
2571
1649
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
2572
1650
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2573
1651
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2574
1652
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2575
1653
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2576
1654
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2577
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
2578
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2579
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2580
|
-
}).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()
|
|
1655
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
2581
1656
|
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({
|
|
2582
1657
|
"services": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
2583
1658
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
@@ -2599,47 +1674,26 @@ const UcpResponseCheckoutSchema = zod.intersection(zod.object({
|
|
|
2599
1674
|
zod.object({ "transport": zod.literal("a2a").optional() }),
|
|
2600
1675
|
zod.object({
|
|
2601
1676
|
"transport": zod.literal("embedded").optional(),
|
|
2602
|
-
"config": zod.object({
|
|
2603
|
-
"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(),
|
|
2604
|
-
"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()
|
|
2605
|
-
}).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()
|
|
1677
|
+
"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()
|
|
2606
1678
|
})
|
|
2607
|
-
])).describe("Service binding
|
|
1679
|
+
])).describe("Service binding for business/merchant configuration. May override platform endpoints."))),
|
|
2608
1680
|
"capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
2609
1681
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2610
1682
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2611
1683
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2612
1684
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2613
1685
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2614
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2615
|
-
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)];
|
|
2616
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2617
|
-
const passed = schemas.length - errors.length;
|
|
2618
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2619
|
-
path: ctx.path,
|
|
2620
|
-
code: "invalid_union",
|
|
2621
|
-
unionErrors: errors,
|
|
2622
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2623
|
-
} : {
|
|
2624
|
-
path: ctx.path,
|
|
2625
|
-
code: "custom",
|
|
2626
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2627
|
-
});
|
|
2628
|
-
}).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(),
|
|
1686
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })).describe("Capability configuration for business/merchant level. May include business-specific config overrides."))).optional(),
|
|
2629
1687
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
2630
1688
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2631
1689
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2632
1690
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2633
1691
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2634
1692
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2635
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
}).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.")))
|
|
2639
|
-
})).describe("UCP metadata for checkout responses.");
|
|
2640
|
-
const UcpResponseOrderSchema = zod.intersection(zod.object({
|
|
1693
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())).describe("Business declaration for discovery profiles. May include partial config state required for discovery.")))
|
|
1694
|
+
})).describe("UCP metadata for business/merchant-level configuration. Subset of platform schema with business-specific settings.");
|
|
1695
|
+
const UcpResponseCheckoutSchema = zod.intersection(zod.object({
|
|
2641
1696
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2642
|
-
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
2643
1697
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
2644
1698
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2645
1699
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -2661,56 +1715,16 @@ const UcpResponseOrderSchema = zod.intersection(zod.object({
|
|
|
2661
1715
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2662
1716
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2663
1717
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2664
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2665
|
-
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)];
|
|
2666
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2667
|
-
const passed = schemas.length - errors.length;
|
|
2668
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2669
|
-
path: ctx.path,
|
|
2670
|
-
code: "invalid_union",
|
|
2671
|
-
unionErrors: errors,
|
|
2672
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2673
|
-
} : {
|
|
2674
|
-
path: ctx.path,
|
|
2675
|
-
code: "custom",
|
|
2676
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2677
|
-
});
|
|
2678
|
-
}).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(),
|
|
1718
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
2679
1719
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
2680
1720
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2681
1721
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2682
1722
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2683
1723
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2684
1724
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2685
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
}).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()
|
|
2689
|
-
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({ "capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
2690
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2691
|
-
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2692
|
-
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2693
|
-
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2694
|
-
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2695
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2696
|
-
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)];
|
|
2697
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2698
|
-
const passed = schemas.length - errors.length;
|
|
2699
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2700
|
-
path: ctx.path,
|
|
2701
|
-
code: "invalid_union",
|
|
2702
|
-
unionErrors: errors,
|
|
2703
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2704
|
-
} : {
|
|
2705
|
-
path: ctx.path,
|
|
2706
|
-
code: "custom",
|
|
2707
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2708
|
-
});
|
|
2709
|
-
}).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.");
|
|
2710
|
-
const UcpResponseCartSchema = zod.intersection(zod.object({
|
|
2711
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2712
|
-
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
2713
|
-
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
1725
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
1726
|
+
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({
|
|
1727
|
+
"services": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
2714
1728
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2715
1729
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2716
1730
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
@@ -2724,62 +1738,32 @@ const UcpResponseCartSchema = zod.intersection(zod.object({
|
|
|
2724
1738
|
"embedded"
|
|
2725
1739
|
]).describe("Transport protocol for this service binding."),
|
|
2726
1740
|
"endpoint": zod.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
2727
|
-
}))
|
|
1741
|
+
})), zod.union([
|
|
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(),
|
|
2728
1750
|
"capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
2729
1751
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2730
1752
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2731
1753
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2732
1754
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2733
1755
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2734
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2735
|
-
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)];
|
|
2736
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2737
|
-
const passed = schemas.length - errors.length;
|
|
2738
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2739
|
-
path: ctx.path,
|
|
2740
|
-
code: "invalid_union",
|
|
2741
|
-
unionErrors: errors,
|
|
2742
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2743
|
-
} : {
|
|
2744
|
-
path: ctx.path,
|
|
2745
|
-
code: "custom",
|
|
2746
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2747
|
-
});
|
|
2748
|
-
}).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(),
|
|
1756
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })).describe("Capability reference in responses. Only name/version required to confirm active capabilities."))).optional(),
|
|
2749
1757
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
2750
1758
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2751
1759
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2752
1760
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2753
1761
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2754
1762
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2755
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
}).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()
|
|
2759
|
-
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({ "capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
2760
|
-
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2761
|
-
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2762
|
-
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2763
|
-
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2764
|
-
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2765
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.unknown().superRefine((x, ctx) => {
|
|
2766
|
-
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)];
|
|
2767
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2768
|
-
const passed = schemas.length - errors.length;
|
|
2769
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2770
|
-
path: ctx.path,
|
|
2771
|
-
code: "invalid_union",
|
|
2772
|
-
unionErrors: errors,
|
|
2773
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2774
|
-
} : {
|
|
2775
|
-
path: ctx.path,
|
|
2776
|
-
code: "custom",
|
|
2777
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2778
|
-
});
|
|
2779
|
-
}).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.");
|
|
2780
|
-
const UcpResponseCatalogSchema = zod.intersection(zod.object({
|
|
1763
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())).describe("Handler reference in responses. May include full config state for runtime usage of the handler.")))
|
|
1764
|
+
})).describe("UCP metadata for checkout responses.");
|
|
1765
|
+
const UcpResponseOrderSchema = zod.intersection(zod.object({
|
|
2781
1766
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2782
|
-
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
2783
1767
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
2784
1768
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2785
1769
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -2801,52 +1785,21 @@ const UcpResponseCatalogSchema = zod.intersection(zod.object({
|
|
|
2801
1785
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2802
1786
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2803
1787
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2804
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2805
|
-
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)];
|
|
2806
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2807
|
-
const passed = schemas.length - errors.length;
|
|
2808
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2809
|
-
path: ctx.path,
|
|
2810
|
-
code: "invalid_union",
|
|
2811
|
-
unionErrors: errors,
|
|
2812
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2813
|
-
} : {
|
|
2814
|
-
path: ctx.path,
|
|
2815
|
-
code: "custom",
|
|
2816
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2817
|
-
});
|
|
2818
|
-
}).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(),
|
|
1788
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
2819
1789
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
2820
1790
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2821
1791
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2822
1792
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2823
1793
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2824
1794
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2825
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
2826
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2827
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2828
|
-
}).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()
|
|
1795
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
2829
1796
|
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({ "capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
2830
1797
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
2831
1798
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2832
1799
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2833
1800
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2834
1801
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2835
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2836
|
-
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)];
|
|
2837
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2838
|
-
const passed = schemas.length - errors.length;
|
|
2839
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2840
|
-
path: ctx.path,
|
|
2841
|
-
code: "invalid_union",
|
|
2842
|
-
unionErrors: errors,
|
|
2843
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2844
|
-
} : {
|
|
2845
|
-
path: ctx.path,
|
|
2846
|
-
code: "custom",
|
|
2847
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2848
|
-
});
|
|
2849
|
-
}).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.");
|
|
1802
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").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.");
|
|
2850
1803
|
const ProfileSchemaSigningKeySchema = zod.object({
|
|
2851
1804
|
"kid": zod.string().describe("Key ID. Referenced in signature headers to identify which key to use for verification."),
|
|
2852
1805
|
"kty": zod.string().describe("Key type (e.g., 'EC', 'RSA')."),
|
|
@@ -2861,7 +1814,6 @@ const ProfileSchemaSigningKeySchema = zod.object({
|
|
|
2861
1814
|
const ProfileSchemaBaseSchema = zod.object({
|
|
2862
1815
|
"ucp": zod.object({
|
|
2863
1816
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2864
|
-
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
2865
1817
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
2866
1818
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2867
1819
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -2883,31 +1835,14 @@ const ProfileSchemaBaseSchema = zod.object({
|
|
|
2883
1835
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2884
1836
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2885
1837
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2886
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2887
|
-
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)];
|
|
2888
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2889
|
-
const passed = schemas.length - errors.length;
|
|
2890
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2891
|
-
path: ctx.path,
|
|
2892
|
-
code: "invalid_union",
|
|
2893
|
-
unionErrors: errors,
|
|
2894
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2895
|
-
} : {
|
|
2896
|
-
path: ctx.path,
|
|
2897
|
-
code: "custom",
|
|
2898
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2899
|
-
});
|
|
2900
|
-
}).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(),
|
|
1838
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
2901
1839
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
2902
1840
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2903
1841
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2904
1842
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2905
1843
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2906
1844
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2907
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
2908
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2909
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2910
|
-
}).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()
|
|
1845
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
2911
1846
|
}).describe("Base UCP metadata with shared properties for all schema types."),
|
|
2912
1847
|
"signing_keys": zod.array(zod.object({
|
|
2913
1848
|
"kid": zod.string().describe("Key ID. Referenced in signature headers to identify which key to use for verification."),
|
|
@@ -2924,7 +1859,6 @@ const ProfileSchemaBaseSchema = zod.object({
|
|
|
2924
1859
|
const ProfileSchemaPlatformProfileSchema = zod.intersection(zod.object({
|
|
2925
1860
|
"ucp": zod.object({
|
|
2926
1861
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2927
|
-
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
2928
1862
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
2929
1863
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2930
1864
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -2946,31 +1880,14 @@ const ProfileSchemaPlatformProfileSchema = zod.intersection(zod.object({
|
|
|
2946
1880
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2947
1881
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2948
1882
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2949
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
2950
|
-
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)];
|
|
2951
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
2952
|
-
const passed = schemas.length - errors.length;
|
|
2953
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
2954
|
-
path: ctx.path,
|
|
2955
|
-
code: "invalid_union",
|
|
2956
|
-
unionErrors: errors,
|
|
2957
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2958
|
-
} : {
|
|
2959
|
-
path: ctx.path,
|
|
2960
|
-
code: "custom",
|
|
2961
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2962
|
-
});
|
|
2963
|
-
}).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(),
|
|
1883
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
2964
1884
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
2965
1885
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2966
1886
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
2967
1887
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
2968
1888
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
2969
1889
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
2970
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
2971
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
2972
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
2973
|
-
}).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()
|
|
1890
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
2974
1891
|
}).describe("Base UCP metadata with shared properties for all schema types."),
|
|
2975
1892
|
"signing_keys": zod.array(zod.object({
|
|
2976
1893
|
"kid": zod.string().describe("Key ID. Referenced in signature headers to identify which key to use for verification."),
|
|
@@ -2985,7 +1902,6 @@ const ProfileSchemaPlatformProfileSchema = zod.intersection(zod.object({
|
|
|
2985
1902
|
}).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()
|
|
2986
1903
|
}).passthrough().describe("Base discovery profile with shared properties for all profile types."), zod.object({ "ucp": zod.intersection(zod.object({
|
|
2987
1904
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2988
|
-
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
2989
1905
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
2990
1906
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
2991
1907
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -3007,31 +1923,14 @@ const ProfileSchemaPlatformProfileSchema = zod.intersection(zod.object({
|
|
|
3007
1923
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
3008
1924
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
3009
1925
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
3010
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
3011
|
-
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)];
|
|
3012
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
3013
|
-
const passed = schemas.length - errors.length;
|
|
3014
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
3015
|
-
path: ctx.path,
|
|
3016
|
-
code: "invalid_union",
|
|
3017
|
-
unionErrors: errors,
|
|
3018
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3019
|
-
} : {
|
|
3020
|
-
path: ctx.path,
|
|
3021
|
-
code: "custom",
|
|
3022
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3023
|
-
});
|
|
3024
|
-
}).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(),
|
|
1926
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
3025
1927
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
3026
1928
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
3027
1929
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
3028
1930
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
3029
1931
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
3030
1932
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
3031
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
3032
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
3033
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
3034
|
-
}).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()
|
|
1933
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
3035
1934
|
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({
|
|
3036
1935
|
"services": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
3037
1936
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
@@ -3059,36 +1958,18 @@ const ProfileSchemaPlatformProfileSchema = zod.intersection(zod.object({
|
|
|
3059
1958
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
3060
1959
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
3061
1960
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
3062
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
3063
|
-
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)];
|
|
3064
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
3065
|
-
const passed = schemas.length - errors.length;
|
|
3066
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
3067
|
-
path: ctx.path,
|
|
3068
|
-
code: "invalid_union",
|
|
3069
|
-
unionErrors: errors,
|
|
3070
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3071
|
-
} : {
|
|
3072
|
-
path: ctx.path,
|
|
3073
|
-
code: "custom",
|
|
3074
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3075
|
-
});
|
|
3076
|
-
}).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(),
|
|
1961
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })), zod.record(zod.string(), zod.unknown())).describe("Full capability declaration for platform-level discovery. Includes spec/schema URLs for agent fetching."))).optional(),
|
|
3077
1962
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
3078
1963
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
3079
1964
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
3080
1965
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
3081
1966
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
3082
1967
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
3083
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
3084
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
3085
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
3086
|
-
}).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.")))
|
|
1968
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())), zod.record(zod.string(), zod.unknown())).describe("Platform declaration for discovery profiles. May include partial config state required for discovery.")))
|
|
3087
1969
|
})).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.");
|
|
3088
1970
|
const ProfileSchemaBusinessProfileSchema = zod.intersection(zod.object({
|
|
3089
1971
|
"ucp": zod.object({
|
|
3090
1972
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
3091
|
-
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
3092
1973
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
3093
1974
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
3094
1975
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -3110,31 +1991,14 @@ const ProfileSchemaBusinessProfileSchema = zod.intersection(zod.object({
|
|
|
3110
1991
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
3111
1992
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
3112
1993
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
3113
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
3114
|
-
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)];
|
|
3115
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
3116
|
-
const passed = schemas.length - errors.length;
|
|
3117
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
3118
|
-
path: ctx.path,
|
|
3119
|
-
code: "invalid_union",
|
|
3120
|
-
unionErrors: errors,
|
|
3121
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3122
|
-
} : {
|
|
3123
|
-
path: ctx.path,
|
|
3124
|
-
code: "custom",
|
|
3125
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3126
|
-
});
|
|
3127
|
-
}).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(),
|
|
1994
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
3128
1995
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
3129
1996
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
3130
1997
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
3131
1998
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
3132
1999
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
3133
2000
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
3134
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
3135
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
3136
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
3137
|
-
}).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()
|
|
2001
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
3138
2002
|
}).describe("Base UCP metadata with shared properties for all schema types."),
|
|
3139
2003
|
"signing_keys": zod.array(zod.object({
|
|
3140
2004
|
"kid": zod.string().describe("Key ID. Referenced in signature headers to identify which key to use for verification."),
|
|
@@ -3149,7 +2013,6 @@ const ProfileSchemaBusinessProfileSchema = zod.intersection(zod.object({
|
|
|
3149
2013
|
}).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()
|
|
3150
2014
|
}).passthrough().describe("Base discovery profile with shared properties for all profile types."), zod.object({ "ucp": zod.intersection(zod.object({
|
|
3151
2015
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
3152
|
-
"status": zod.enum(["success", "error"]).describe("Application-level status of the UCP operation.").default("success"),
|
|
3153
2016
|
"services": zod.record(zod.array(zod.intersection(zod.object({
|
|
3154
2017
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
3155
2018
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -3171,33 +2034,15 @@ const ProfileSchemaBusinessProfileSchema = zod.intersection(zod.object({
|
|
|
3171
2034
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
3172
2035
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
3173
2036
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
3174
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
3175
|
-
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)];
|
|
3176
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
3177
|
-
const passed = schemas.length - errors.length;
|
|
3178
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
3179
|
-
path: ctx.path,
|
|
3180
|
-
code: "invalid_union",
|
|
3181
|
-
unionErrors: errors,
|
|
3182
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3183
|
-
} : {
|
|
3184
|
-
path: ctx.path,
|
|
3185
|
-
code: "custom",
|
|
3186
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3187
|
-
});
|
|
3188
|
-
}).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(),
|
|
2037
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
3189
2038
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
3190
2039
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
3191
2040
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
3192
2041
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
3193
2042
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
3194
2043
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
3195
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
3196
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
3197
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
3198
|
-
}).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()
|
|
2044
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
3199
2045
|
}).describe("Base UCP metadata with shared properties for all schema types."), zod.object({
|
|
3200
|
-
"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(),
|
|
3201
2046
|
"services": zod.record(zod.array(zod.intersection(zod.intersection(zod.object({
|
|
3202
2047
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
3203
2048
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
@@ -3218,10 +2063,7 @@ const ProfileSchemaBusinessProfileSchema = zod.intersection(zod.object({
|
|
|
3218
2063
|
zod.object({ "transport": zod.literal("a2a").optional() }),
|
|
3219
2064
|
zod.object({
|
|
3220
2065
|
"transport": zod.literal("embedded").optional(),
|
|
3221
|
-
"config": zod.object({
|
|
3222
|
-
"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(),
|
|
3223
|
-
"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()
|
|
3224
|
-
}).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()
|
|
2066
|
+
"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()
|
|
3225
2067
|
})
|
|
3226
2068
|
])).describe("Service binding for business/merchant configuration. May override platform endpoints."))),
|
|
3227
2069
|
"capabilities": zod.record(zod.array(zod.intersection(zod.object({
|
|
@@ -3230,31 +2072,14 @@ const ProfileSchemaBusinessProfileSchema = zod.intersection(zod.object({
|
|
|
3230
2072
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
3231
2073
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
3232
2074
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
3233
|
-
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.
|
|
3234
|
-
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)];
|
|
3235
|
-
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
3236
|
-
const passed = schemas.length - errors.length;
|
|
3237
|
-
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
3238
|
-
path: ctx.path,
|
|
3239
|
-
code: "invalid_union",
|
|
3240
|
-
unionErrors: errors,
|
|
3241
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3242
|
-
} : {
|
|
3243
|
-
path: ctx.path,
|
|
3244
|
-
code: "custom",
|
|
3245
|
-
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
3246
|
-
});
|
|
3247
|
-
}).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(),
|
|
2075
|
+
}).describe("Shared foundation for all UCP entities."), zod.object({ "extends": zod.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })).describe("Capability configuration for business/merchant level. May include business-specific config overrides."))).optional(),
|
|
3248
2076
|
"payment_handlers": zod.record(zod.array(zod.intersection(zod.object({
|
|
3249
2077
|
"version": zod.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
3250
2078
|
"spec": zod.string().url().describe("URL to human-readable specification document.").optional(),
|
|
3251
2079
|
"schema": zod.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
3252
2080
|
"id": zod.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
3253
2081
|
"config": zod.record(zod.string(), zod.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
3254
|
-
}).describe("Shared foundation for all UCP entities."), zod.
|
|
3255
|
-
"type": zod.string().describe("The instrument type identifier (e.g., 'card', 'gift_card'). References an instrument schema's type constant."),
|
|
3256
|
-
"constraints": zod.record(zod.string(), zod.unknown()).describe("Constraints on this instrument type. Structure depends on instrument type and active capabilities.").optional()
|
|
3257
|
-
}).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.")))
|
|
2082
|
+
}).describe("Shared foundation for all UCP entities."), zod.record(zod.string(), zod.unknown())).describe("Business declaration for discovery profiles. May include partial config state required for discovery.")))
|
|
3258
2083
|
})).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.");
|
|
3259
2084
|
const ServiceBaseTransportEnumSchema = zod.enum([
|
|
3260
2085
|
"rest",
|
|
@@ -3292,9 +2117,8 @@ const MessageErrorContentTypeEnumSchema = zod.enum(["plain", "markdown"]).descri
|
|
|
3292
2117
|
const MessageErrorSeverityEnumSchema = zod.enum([
|
|
3293
2118
|
"recoverable",
|
|
3294
2119
|
"requires_buyer_input",
|
|
3295
|
-
"requires_buyer_review"
|
|
3296
|
-
|
|
3297
|
-
]).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'.");
|
|
2120
|
+
"requires_buyer_review"
|
|
2121
|
+
]).describe("Declares who resolves this error. 'recoverable': agent can fix 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 (checkout complete). Errors with 'requires_*' severity contribute to 'status: requires_escalation'.");
|
|
3298
2122
|
const MessageInfoContentTypeEnumSchema = zod.enum(["plain", "markdown"]).describe("Content format, default = plain.");
|
|
3299
2123
|
const MessageWarningContentTypeEnumSchema = zod.enum(["plain", "markdown"]).describe("Content format, default = plain.");
|
|
3300
2124
|
const OrderLineItemStatusEnumSchema = zod.enum([
|
|
@@ -3302,7 +2126,15 @@ const OrderLineItemStatusEnumSchema = zod.enum([
|
|
|
3302
2126
|
"partial",
|
|
3303
2127
|
"fulfilled"
|
|
3304
2128
|
]).describe("Derived status: fulfilled if quantity.fulfilled == quantity.total, partial if quantity.fulfilled > 0, otherwise processing.");
|
|
3305
|
-
const
|
|
2129
|
+
const TotalTypeEnumSchema = zod.enum([
|
|
2130
|
+
"items_discount",
|
|
2131
|
+
"subtotal",
|
|
2132
|
+
"discount",
|
|
2133
|
+
"fulfillment",
|
|
2134
|
+
"tax",
|
|
2135
|
+
"fee",
|
|
2136
|
+
"total"
|
|
2137
|
+
]).describe("Type of total categorization.");
|
|
3306
2138
|
const ProfileSchemaSigningKeyUseEnumSchema = zod.enum(["sig", "enc"]).describe("Key usage. Should be 'sig' for signing keys.");
|
|
3307
2139
|
//#endregion
|
|
3308
2140
|
//#region src/extensions.ts
|
|
@@ -3324,13 +2156,11 @@ const OrderUpdateSchema = OrderSchema;
|
|
|
3324
2156
|
exports.AccountInfoSchema = AccountInfoSchema;
|
|
3325
2157
|
exports.AdjustmentSchema = AdjustmentSchema;
|
|
3326
2158
|
exports.AdjustmentStatusEnumSchema = AdjustmentStatusEnumSchema;
|
|
3327
|
-
exports.AmountSchema = AmountSchema;
|
|
3328
2159
|
exports.Ap2MandateAp2WithCheckoutMandateSchema = Ap2MandateAp2WithCheckoutMandateSchema;
|
|
3329
2160
|
exports.Ap2MandateAp2WithMerchantAuthorizationSchema = Ap2MandateAp2WithMerchantAuthorizationSchema;
|
|
3330
2161
|
exports.Ap2MandateCheckoutMandateSchema = Ap2MandateCheckoutMandateSchema;
|
|
3331
2162
|
exports.Ap2MandateErrorCodeSchema = Ap2MandateErrorCodeSchema;
|
|
3332
2163
|
exports.Ap2MandateMerchantAuthorizationSchema = Ap2MandateMerchantAuthorizationSchema;
|
|
3333
|
-
exports.AvailablePaymentInstrumentSchema = AvailablePaymentInstrumentSchema;
|
|
3334
2164
|
exports.BindingSchema = BindingSchema;
|
|
3335
2165
|
exports.BusinessFulfillmentConfigSchema = BusinessFulfillmentConfigSchema;
|
|
3336
2166
|
exports.BuyerConsentBuyerSchema = BuyerConsentBuyerSchema;
|
|
@@ -3342,13 +2172,7 @@ exports.CapabilityPlatformSchema = CapabilityPlatformSchema;
|
|
|
3342
2172
|
exports.CapabilityResponseSchema = CapabilityResponseSchema;
|
|
3343
2173
|
exports.CardCredentialCardNumberTypeEnumSchema = CardCredentialCardNumberTypeEnumSchema;
|
|
3344
2174
|
exports.CardCredentialSchema = CardCredentialSchema;
|
|
3345
|
-
exports.
|
|
3346
|
-
exports.CartCreateRequestSchema = CartCreateRequestSchema;
|
|
3347
|
-
exports.CartSchema = CartSchema;
|
|
3348
|
-
exports.CartUpdateRequestSchema = CartUpdateRequestSchema;
|
|
3349
|
-
exports.CatalogLookupSchema = CatalogLookupSchema;
|
|
3350
|
-
exports.CatalogSearchSchema = CatalogSearchSchema;
|
|
3351
|
-
exports.CategorySchema = CategorySchema;
|
|
2175
|
+
exports.CardPaymentInstrumentSchema = CardPaymentInstrumentSchema;
|
|
3352
2176
|
exports.CheckoutCompleteRequestSchema = CheckoutCompleteRequestSchema;
|
|
3353
2177
|
exports.CheckoutCreateRequestSchema = CheckoutCreateRequestSchema;
|
|
3354
2178
|
exports.CheckoutResponseSchema = CheckoutResponseSchema;
|
|
@@ -3357,14 +2181,11 @@ exports.CheckoutSchema = CheckoutSchema;
|
|
|
3357
2181
|
exports.CheckoutStatusEnumSchema = CheckoutStatusEnumSchema;
|
|
3358
2182
|
exports.CheckoutUpdateRequestSchema = CheckoutUpdateRequestSchema;
|
|
3359
2183
|
exports.ContextSchema = ContextSchema;
|
|
3360
|
-
exports.DescriptionSchema = DescriptionSchema;
|
|
3361
2184
|
exports.DiscountAllocationSchema = DiscountAllocationSchema;
|
|
3362
2185
|
exports.DiscountAppliedDiscountMethodEnumSchema = DiscountAppliedDiscountMethodEnumSchema;
|
|
3363
2186
|
exports.DiscountAppliedDiscountSchema = DiscountAppliedDiscountSchema;
|
|
3364
2187
|
exports.DiscountDiscountsObjectSchema = DiscountDiscountsObjectSchema;
|
|
3365
2188
|
exports.EmbeddedConfigSchema = EmbeddedConfigSchema;
|
|
3366
|
-
exports.ErrorCodeSchema = ErrorCodeSchema;
|
|
3367
|
-
exports.ErrorResponseSchema = ErrorResponseSchema;
|
|
3368
2189
|
exports.ExpectationMethodTypeEnumSchema = ExpectationMethodTypeEnumSchema;
|
|
3369
2190
|
exports.ExpectationSchema = ExpectationSchema;
|
|
3370
2191
|
exports.FulfillmentAvailableMethodSchema = FulfillmentAvailableMethodSchema;
|
|
@@ -3386,19 +2207,12 @@ exports.FulfillmentMethodUpdateRequestSchema = FulfillmentMethodUpdateRequestSch
|
|
|
3386
2207
|
exports.FulfillmentOptionSchema = FulfillmentOptionSchema;
|
|
3387
2208
|
exports.FulfillmentResponseSchema = FulfillmentResponseSchema;
|
|
3388
2209
|
exports.FulfillmentSchema = FulfillmentSchema;
|
|
3389
|
-
exports.IdentityLinkingBusinessSchema = IdentityLinkingBusinessSchema;
|
|
3390
|
-
exports.IdentityLinkingIdentityScopesSchema = IdentityLinkingIdentityScopesSchema;
|
|
3391
|
-
exports.IdentityLinkingMechanismSchema = IdentityLinkingMechanismSchema;
|
|
3392
|
-
exports.IdentityLinkingOauth2Schema = IdentityLinkingOauth2Schema;
|
|
3393
|
-
exports.IdentityLinkingPlatformSchema = IdentityLinkingPlatformSchema;
|
|
3394
|
-
exports.InputCorrelationSchema = InputCorrelationSchema;
|
|
3395
2210
|
exports.ItemResponseSchema = ItemResponseSchema;
|
|
3396
2211
|
exports.ItemSchema = ItemSchema;
|
|
3397
2212
|
exports.LineItemResponseSchema = LineItemResponseSchema;
|
|
3398
2213
|
exports.LineItemSchema = LineItemSchema;
|
|
3399
2214
|
exports.LineItemUpdateRequestSchema = LineItemUpdateRequestSchema;
|
|
3400
2215
|
exports.LinkSchema = LinkSchema;
|
|
3401
|
-
exports.MediaSchema = MediaSchema;
|
|
3402
2216
|
exports.MerchantFulfillmentConfigSchema = MerchantFulfillmentConfigSchema;
|
|
3403
2217
|
exports.MessageErrorContentTypeEnumSchema = MessageErrorContentTypeEnumSchema;
|
|
3404
2218
|
exports.MessageErrorSchema = MessageErrorSchema;
|
|
@@ -3408,13 +2222,11 @@ exports.MessageInfoSchema = MessageInfoSchema;
|
|
|
3408
2222
|
exports.MessageSchema = MessageSchema;
|
|
3409
2223
|
exports.MessageWarningContentTypeEnumSchema = MessageWarningContentTypeEnumSchema;
|
|
3410
2224
|
exports.MessageWarningSchema = MessageWarningSchema;
|
|
3411
|
-
exports.OptionValueSchema = OptionValueSchema;
|
|
3412
2225
|
exports.OrderConfirmationSchema = OrderConfirmationSchema;
|
|
3413
2226
|
exports.OrderLineItemSchema = OrderLineItemSchema;
|
|
3414
2227
|
exports.OrderLineItemStatusEnumSchema = OrderLineItemStatusEnumSchema;
|
|
3415
2228
|
exports.OrderSchema = OrderSchema;
|
|
3416
2229
|
exports.OrderUpdateSchema = OrderUpdateSchema;
|
|
3417
|
-
exports.PaginationSchema = PaginationSchema;
|
|
3418
2230
|
exports.PaymentCredentialSchema = PaymentCredentialSchema;
|
|
3419
2231
|
exports.PaymentHandlerBaseSchema = PaymentHandlerBaseSchema;
|
|
3420
2232
|
exports.PaymentHandlerBusinessSchema = PaymentHandlerBusinessSchema;
|
|
@@ -3427,47 +2239,31 @@ exports.PaymentResponseSchema = PaymentResponseSchema;
|
|
|
3427
2239
|
exports.PaymentSchema = PaymentSchema;
|
|
3428
2240
|
exports.PlatformFulfillmentConfigSchema = PlatformFulfillmentConfigSchema;
|
|
3429
2241
|
exports.PostalAddressSchema = PostalAddressSchema;
|
|
3430
|
-
exports.PriceFilterSchema = PriceFilterSchema;
|
|
3431
|
-
exports.PriceRangeSchema = PriceRangeSchema;
|
|
3432
|
-
exports.PriceSchema = PriceSchema;
|
|
3433
|
-
exports.ProductOptionSchema = ProductOptionSchema;
|
|
3434
|
-
exports.ProductSchema = ProductSchema;
|
|
3435
2242
|
exports.ProfileSchemaBaseSchema = ProfileSchemaBaseSchema;
|
|
3436
2243
|
exports.ProfileSchemaBusinessProfileSchema = ProfileSchemaBusinessProfileSchema;
|
|
3437
2244
|
exports.ProfileSchemaPlatformProfileSchema = ProfileSchemaPlatformProfileSchema;
|
|
3438
2245
|
exports.ProfileSchemaSigningKeySchema = ProfileSchemaSigningKeySchema;
|
|
3439
2246
|
exports.ProfileSchemaSigningKeyUseEnumSchema = ProfileSchemaSigningKeyUseEnumSchema;
|
|
3440
|
-
exports.RatingSchema = RatingSchema;
|
|
3441
2247
|
exports.RetailLocationSchema = RetailLocationSchema;
|
|
3442
|
-
exports.ReverseDomainNameSchema = ReverseDomainNameSchema;
|
|
3443
|
-
exports.SearchFiltersSchema = SearchFiltersSchema;
|
|
3444
|
-
exports.SelectedOptionSchema = SelectedOptionSchema;
|
|
3445
2248
|
exports.ServiceBaseSchema = ServiceBaseSchema;
|
|
3446
2249
|
exports.ServiceBaseTransportEnumSchema = ServiceBaseTransportEnumSchema;
|
|
3447
2250
|
exports.ServiceBusinessSchema = ServiceBusinessSchema;
|
|
3448
2251
|
exports.ServicePlatformSchema = ServicePlatformSchema;
|
|
3449
2252
|
exports.ServiceResponseSchema = ServiceResponseSchema;
|
|
3450
2253
|
exports.ShippingDestinationSchema = ShippingDestinationSchema;
|
|
3451
|
-
exports.SignalsSchema = SignalsSchema;
|
|
3452
|
-
exports.SignedAmountSchema = SignedAmountSchema;
|
|
3453
2254
|
exports.TokenCredentialSchema = TokenCredentialSchema;
|
|
3454
2255
|
exports.TotalResponseSchema = TotalResponseSchema;
|
|
3455
2256
|
exports.TotalSchema = TotalSchema;
|
|
3456
|
-
exports.
|
|
2257
|
+
exports.TotalTypeEnumSchema = TotalTypeEnumSchema;
|
|
3457
2258
|
exports.UcpBaseSchema = UcpBaseSchema;
|
|
3458
|
-
exports.UcpBaseStatusEnumSchema = UcpBaseStatusEnumSchema;
|
|
3459
2259
|
exports.UcpBusinessSchema = UcpBusinessSchema;
|
|
3460
2260
|
exports.UcpDiscoveryBusinessProfileSchema = UcpDiscoveryBusinessProfileSchema;
|
|
3461
2261
|
exports.UcpDiscoveryPlatformProfileSchema = UcpDiscoveryPlatformProfileSchema;
|
|
3462
2262
|
exports.UcpDiscoveryProfileSchema = UcpDiscoveryProfileSchema;
|
|
3463
2263
|
exports.UcpEntitySchema = UcpEntitySchema;
|
|
3464
2264
|
exports.UcpPlatformSchema = UcpPlatformSchema;
|
|
3465
|
-
exports.UcpRequiresSchema = UcpRequiresSchema;
|
|
3466
|
-
exports.UcpResponseCartSchema = UcpResponseCartSchema;
|
|
3467
|
-
exports.UcpResponseCatalogSchema = UcpResponseCatalogSchema;
|
|
3468
2265
|
exports.UcpResponseCheckoutSchema = UcpResponseCheckoutSchema;
|
|
3469
2266
|
exports.UcpResponseOrderSchema = UcpResponseOrderSchema;
|
|
2267
|
+
exports.UcpReverseDomainNameSchema = UcpReverseDomainNameSchema;
|
|
3470
2268
|
exports.UcpSigningKeySchema = UcpSigningKeySchema;
|
|
3471
|
-
exports.UcpVersionConstraintSchema = UcpVersionConstraintSchema;
|
|
3472
2269
|
exports.UcpVersionSchema = UcpVersionSchema;
|
|
3473
|
-
exports.VariantSchema = VariantSchema;
|