@omnixhq/ucp-client 2.2.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -8
- package/dist/adapters/anthropic.d.cts +1 -1
- package/dist/adapters/anthropic.d.ts +1 -1
- package/dist/adapters/langchain.d.cts +1 -1
- package/dist/adapters/langchain.d.ts +1 -1
- package/dist/adapters/mcp.d.cts +1 -1
- package/dist/adapters/mcp.d.ts +1 -1
- package/dist/adapters/openai.d.cts +1 -1
- package/dist/adapters/openai.d.ts +1 -1
- package/dist/adapters/vercel-ai.d.cts +1 -1
- package/dist/adapters/vercel-ai.d.ts +1 -1
- package/dist/catch-errors-C8MBfxB5.d.ts +4774 -0
- package/dist/catch-errors-C8MBfxB5.d.ts.map +1 -0
- package/dist/catch-errors-CO8dAo6Q.d.cts +4774 -0
- package/dist/catch-errors-CO8dAo6Q.d.cts.map +1 -0
- package/dist/errors-C1XqxNmZ.cjs.map +1 -1
- package/dist/errors-DX7yw6Gl.js.map +1 -1
- package/dist/index.cjs +260 -144
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -10382
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +3 -10382
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +239 -143
- package/dist/index.js.map +1 -1
- package/package.json +42 -3
- package/dist/catch-errors-BoytVKBJ.d.cts +0 -446
- package/dist/catch-errors-BoytVKBJ.d.cts.map +0 -1
- package/dist/catch-errors-lijeGf45.d.ts +0 -446
- package/dist/catch-errors-lijeGf45.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -28,25 +28,16 @@ const node_crypto = __toESM(require("node:crypto"));
|
|
|
28
28
|
const __omnixhq_ucp_js_sdk = __toESM(require("@omnixhq/ucp-js-sdk"));
|
|
29
29
|
|
|
30
30
|
//#region src/schemas.ts
|
|
31
|
-
const CheckoutSessionSchema = __omnixhq_ucp_js_sdk.
|
|
32
|
-
const UCPProfileSchema = __omnixhq_ucp_js_sdk.UcpDiscoveryProfileSchema
|
|
33
|
-
const CreateCheckoutRequestSchema = __omnixhq_ucp_js_sdk.
|
|
34
|
-
const UpdateCheckoutRequestSchema = __omnixhq_ucp_js_sdk.
|
|
35
|
-
const CompleteCheckoutRequestSchema = __omnixhq_ucp_js_sdk.CheckoutCompleteRequestSchema
|
|
31
|
+
const CheckoutSessionSchema = __omnixhq_ucp_js_sdk.CheckoutResponseSchema;
|
|
32
|
+
const UCPProfileSchema = __omnixhq_ucp_js_sdk.UcpDiscoveryProfileSchema;
|
|
33
|
+
const CreateCheckoutRequestSchema = __omnixhq_ucp_js_sdk.CheckoutCreateRequestSchema;
|
|
34
|
+
const UpdateCheckoutRequestSchema = __omnixhq_ucp_js_sdk.CheckoutUpdateRequestSchema;
|
|
35
|
+
const CompleteCheckoutRequestSchema = __omnixhq_ucp_js_sdk.CheckoutCompleteRequestSchema;
|
|
36
36
|
const WebhookEventSchema = zod.z.object({
|
|
37
37
|
event_id: zod.z.string(),
|
|
38
38
|
created_time: zod.z.string(),
|
|
39
|
-
order: __omnixhq_ucp_js_sdk.OrderSchema
|
|
40
|
-
})
|
|
41
|
-
const JWKSchema = zod.z.object({
|
|
42
|
-
kty: zod.z.string(),
|
|
43
|
-
kid: zod.z.string().optional(),
|
|
44
|
-
use: zod.z.string().optional(),
|
|
45
|
-
alg: zod.z.string().optional(),
|
|
46
|
-
crv: zod.z.string().optional(),
|
|
47
|
-
x: zod.z.string().optional(),
|
|
48
|
-
y: zod.z.string().optional()
|
|
49
|
-
}).passthrough();
|
|
39
|
+
order: __omnixhq_ucp_js_sdk.OrderSchema
|
|
40
|
+
});
|
|
50
41
|
|
|
51
42
|
//#endregion
|
|
52
43
|
//#region src/http.ts
|
|
@@ -104,21 +95,18 @@ var HttpClient = class HttpClient {
|
|
|
104
95
|
return result.data;
|
|
105
96
|
}
|
|
106
97
|
throwFromResponse(data, statusCode) {
|
|
107
|
-
if (typeof data
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
...first.content_type !== void 0 ? { contentType: first.content_type } : {},
|
|
120
|
-
messages: allMessages
|
|
121
|
-
});
|
|
98
|
+
if (typeof data === "object" && data !== null && Array.isArray(data["messages"])) {
|
|
99
|
+
const rawMessages = data["messages"];
|
|
100
|
+
if (rawMessages.length > 0) {
|
|
101
|
+
const allMessages = parseMessages(rawMessages);
|
|
102
|
+
const first = allMessages[0];
|
|
103
|
+
const code = first.code ?? "UNKNOWN";
|
|
104
|
+
throw new require_errors.UCPError(code, first.content, first.type, statusCode, {
|
|
105
|
+
...first.path !== void 0 ? { path: first.path } : {},
|
|
106
|
+
...first.content_type !== void 0 ? { contentType: first.content_type } : {},
|
|
107
|
+
messages: allMessages
|
|
108
|
+
});
|
|
109
|
+
}
|
|
122
110
|
}
|
|
123
111
|
if (statusCode === 409) throw new require_errors.UCPIdempotencyConflictError();
|
|
124
112
|
throw new require_errors.UCPError("HTTP_ERROR", `Gateway returned ${statusCode}`, "error", statusCode);
|
|
@@ -168,10 +156,7 @@ function parseMessages(rawMessages) {
|
|
|
168
156
|
return {
|
|
169
157
|
type,
|
|
170
158
|
content: String(record["content"] ?? "Unknown error"),
|
|
171
|
-
...record["code"] !== void 0 ? { code: String(record["code"]) } : {}
|
|
172
|
-
...record["severity"] !== void 0 ? { severity: String(record["severity"]) } : {},
|
|
173
|
-
...record["path"] !== void 0 ? { path: String(record["path"]) } : {},
|
|
174
|
-
...record["content_type"] !== void 0 ? { content_type: String(record["content_type"]) } : {}
|
|
159
|
+
...record["code"] !== void 0 ? { code: String(record["code"]) } : {}
|
|
175
160
|
};
|
|
176
161
|
});
|
|
177
162
|
}
|
|
@@ -211,44 +196,48 @@ var CheckoutCapability = class {
|
|
|
211
196
|
const data = await this.http.request("POST", `/checkout-sessions/${encodeURIComponent(id)}/cancel`);
|
|
212
197
|
return this.validateSession(data);
|
|
213
198
|
}
|
|
214
|
-
async setFulfillment(id, type
|
|
215
|
-
return this.
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
type
|
|
220
|
-
}] }
|
|
221
|
-
});
|
|
199
|
+
async setFulfillment(id, type) {
|
|
200
|
+
return this.patchFulfillmentDiscount(id, { fulfillment: { methods: [{
|
|
201
|
+
id: DEFAULT_METHOD_ID,
|
|
202
|
+
type
|
|
203
|
+
}] } });
|
|
222
204
|
}
|
|
223
|
-
async selectDestination(id, destinationId, fulfillmentType = "shipping"
|
|
224
|
-
return this.
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
selected_destination_id: destinationId
|
|
230
|
-
}] }
|
|
231
|
-
});
|
|
205
|
+
async selectDestination(id, destinationId, fulfillmentType = "shipping") {
|
|
206
|
+
return this.patchFulfillmentDiscount(id, { fulfillment: { methods: [{
|
|
207
|
+
id: DEFAULT_METHOD_ID,
|
|
208
|
+
type: fulfillmentType,
|
|
209
|
+
selected_destination_id: destinationId
|
|
210
|
+
}] } });
|
|
232
211
|
}
|
|
233
|
-
async selectFulfillmentOption(id, optionId, destinationId, fulfillmentType = "shipping"
|
|
234
|
-
return this.
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}]
|
|
244
|
-
}] }
|
|
245
|
-
});
|
|
212
|
+
async selectFulfillmentOption(id, optionId, destinationId, fulfillmentType = "shipping") {
|
|
213
|
+
return this.patchFulfillmentDiscount(id, { fulfillment: { methods: [{
|
|
214
|
+
id: DEFAULT_METHOD_ID,
|
|
215
|
+
type: fulfillmentType,
|
|
216
|
+
...destinationId !== void 0 ? { selected_destination_id: destinationId } : {},
|
|
217
|
+
groups: [{
|
|
218
|
+
id: DEFAULT_GROUP_ID,
|
|
219
|
+
selected_option_id: optionId
|
|
220
|
+
}]
|
|
221
|
+
}] } });
|
|
246
222
|
}
|
|
247
|
-
async applyDiscountCodes(id, codes
|
|
248
|
-
return this.
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
});
|
|
223
|
+
async applyDiscountCodes(id, codes) {
|
|
224
|
+
return this.patchFulfillmentDiscount(id, { discounts: { codes: [...codes] } });
|
|
225
|
+
}
|
|
226
|
+
async createFulfillmentMethod(id, payload) {
|
|
227
|
+
const data = await this.http.request("POST", `/checkout-sessions/${encodeURIComponent(id)}/fulfillment/methods`, payload);
|
|
228
|
+
return this.validateSession(data);
|
|
229
|
+
}
|
|
230
|
+
async updateFulfillmentMethod(id, methodId, payload) {
|
|
231
|
+
const data = await this.http.request("PUT", `/checkout-sessions/${encodeURIComponent(id)}/fulfillment/methods/${encodeURIComponent(methodId)}`, payload);
|
|
232
|
+
return this.validateSession(data);
|
|
233
|
+
}
|
|
234
|
+
async updateFulfillmentGroup(id, methodId, groupId, payload) {
|
|
235
|
+
const data = await this.http.request("PUT", `/checkout-sessions/${encodeURIComponent(id)}/fulfillment/methods/${encodeURIComponent(methodId)}/groups/${encodeURIComponent(groupId)}`, payload);
|
|
236
|
+
return this.validateSession(data);
|
|
237
|
+
}
|
|
238
|
+
async patchFulfillmentDiscount(id, patch) {
|
|
239
|
+
const data = await this.http.request("PUT", `/checkout-sessions/${encodeURIComponent(id)}`, patch);
|
|
240
|
+
return this.validateSession(data);
|
|
252
241
|
}
|
|
253
242
|
validateSession(data) {
|
|
254
243
|
const session = this.http.validate(data, CheckoutSessionSchema);
|
|
@@ -272,7 +261,12 @@ var OrderCapability = class {
|
|
|
272
261
|
/** Update an order with fulfillment events, adjustments, or status changes. */
|
|
273
262
|
async update(id, payload) {
|
|
274
263
|
const data = await this.http.request("PUT", `/orders/${encodeURIComponent(id)}`, payload);
|
|
275
|
-
return this.http.validate(data, __omnixhq_ucp_js_sdk.
|
|
264
|
+
return this.http.validate(data, __omnixhq_ucp_js_sdk.OrderUpdateSchema);
|
|
265
|
+
}
|
|
266
|
+
/** Update a single line item within an order (e.g. set parent for grouping). */
|
|
267
|
+
async updateLineItem(id, lineItemId, payload) {
|
|
268
|
+
const data = await this.http.request("PUT", `/orders/${encodeURIComponent(id)}/line-items/${encodeURIComponent(lineItemId)}`, payload);
|
|
269
|
+
return this.http.validate(data, __omnixhq_ucp_js_sdk.OrderUpdateSchema);
|
|
276
270
|
}
|
|
277
271
|
};
|
|
278
272
|
|
|
@@ -659,6 +653,97 @@ function fulfillmentTools(client) {
|
|
|
659
653
|
required: ["id", "option_id"]
|
|
660
654
|
},
|
|
661
655
|
execute: async (params) => client.checkout.selectFulfillmentOption(params["id"], params["option_id"], params["destination_id"], params["fulfillment_type"] ?? "shipping")
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
name: "create_fulfillment_method",
|
|
659
|
+
description: "Add a new fulfillment method (shipping or pickup) to a checkout session.",
|
|
660
|
+
parameters: {
|
|
661
|
+
type: "object",
|
|
662
|
+
properties: {
|
|
663
|
+
id: {
|
|
664
|
+
type: "string",
|
|
665
|
+
description: "Checkout session ID"
|
|
666
|
+
},
|
|
667
|
+
type: {
|
|
668
|
+
type: "string",
|
|
669
|
+
enum: ["shipping", "pickup"],
|
|
670
|
+
description: "Fulfillment method type"
|
|
671
|
+
},
|
|
672
|
+
line_item_ids: {
|
|
673
|
+
type: "array",
|
|
674
|
+
items: { type: "string" },
|
|
675
|
+
description: "Line item IDs to associate with this method (optional)"
|
|
676
|
+
}
|
|
677
|
+
},
|
|
678
|
+
required: ["id", "type"]
|
|
679
|
+
},
|
|
680
|
+
execute: async (params) => {
|
|
681
|
+
const { id,...payload } = params;
|
|
682
|
+
return client.checkout.createFulfillmentMethod(id, payload);
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
name: "update_fulfillment_method",
|
|
687
|
+
description: "Update an existing fulfillment method on a checkout session.",
|
|
688
|
+
parameters: {
|
|
689
|
+
type: "object",
|
|
690
|
+
properties: {
|
|
691
|
+
id: {
|
|
692
|
+
type: "string",
|
|
693
|
+
description: "Checkout session ID"
|
|
694
|
+
},
|
|
695
|
+
method_id: {
|
|
696
|
+
type: "string",
|
|
697
|
+
description: "Fulfillment method ID to update"
|
|
698
|
+
},
|
|
699
|
+
type: {
|
|
700
|
+
type: "string",
|
|
701
|
+
enum: ["shipping", "pickup"],
|
|
702
|
+
description: "Updated fulfillment method type (optional)"
|
|
703
|
+
},
|
|
704
|
+
line_item_ids: {
|
|
705
|
+
type: "array",
|
|
706
|
+
items: { type: "string" },
|
|
707
|
+
description: "Updated line item IDs to associate with this method"
|
|
708
|
+
}
|
|
709
|
+
},
|
|
710
|
+
required: [
|
|
711
|
+
"id",
|
|
712
|
+
"method_id",
|
|
713
|
+
"line_item_ids"
|
|
714
|
+
]
|
|
715
|
+
},
|
|
716
|
+
execute: async (params) => {
|
|
717
|
+
const { id, method_id,...payload } = params;
|
|
718
|
+
return client.checkout.updateFulfillmentMethod(id, method_id, payload);
|
|
719
|
+
}
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
name: "update_fulfillment_group",
|
|
723
|
+
description: "Update a fulfillment group within a fulfillment method on a checkout session.",
|
|
724
|
+
parameters: {
|
|
725
|
+
type: "object",
|
|
726
|
+
properties: {
|
|
727
|
+
id: {
|
|
728
|
+
type: "string",
|
|
729
|
+
description: "Checkout session ID"
|
|
730
|
+
},
|
|
731
|
+
method_id: {
|
|
732
|
+
type: "string",
|
|
733
|
+
description: "Fulfillment method ID"
|
|
734
|
+
},
|
|
735
|
+
group_id: {
|
|
736
|
+
type: "string",
|
|
737
|
+
description: "Fulfillment group ID to update"
|
|
738
|
+
}
|
|
739
|
+
},
|
|
740
|
+
required: [
|
|
741
|
+
"id",
|
|
742
|
+
"method_id",
|
|
743
|
+
"group_id"
|
|
744
|
+
]
|
|
745
|
+
},
|
|
746
|
+
execute: async (params) => client.checkout.updateFulfillmentGroup(params["id"], params["method_id"], params["group_id"], { id: params["group_id"] })
|
|
662
747
|
}
|
|
663
748
|
];
|
|
664
749
|
}
|
|
@@ -685,45 +770,74 @@ function discountTools(client) {
|
|
|
685
770
|
}];
|
|
686
771
|
}
|
|
687
772
|
function orderTools(client) {
|
|
688
|
-
return [
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
description: "Order ID"
|
|
696
|
-
} },
|
|
697
|
-
required: ["id"]
|
|
698
|
-
},
|
|
699
|
-
execute: async (params) => client.order.get(params["id"])
|
|
700
|
-
}, {
|
|
701
|
-
name: "update_order",
|
|
702
|
-
description: "Update an order with fulfillment events, adjustments, or status changes.",
|
|
703
|
-
parameters: {
|
|
704
|
-
type: "object",
|
|
705
|
-
properties: {
|
|
706
|
-
id: {
|
|
773
|
+
return [
|
|
774
|
+
{
|
|
775
|
+
name: "get_order",
|
|
776
|
+
description: "Get order details by ID, including line items, fulfillment status, and tracking information.",
|
|
777
|
+
parameters: {
|
|
778
|
+
type: "object",
|
|
779
|
+
properties: { id: {
|
|
707
780
|
type: "string",
|
|
708
781
|
description: "Order ID"
|
|
782
|
+
} },
|
|
783
|
+
required: ["id"]
|
|
784
|
+
},
|
|
785
|
+
execute: async (params) => client.order.get(params["id"])
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
name: "update_order",
|
|
789
|
+
description: "Update an order with fulfillment events, adjustments, or status changes.",
|
|
790
|
+
parameters: {
|
|
791
|
+
type: "object",
|
|
792
|
+
properties: {
|
|
793
|
+
id: {
|
|
794
|
+
type: "string",
|
|
795
|
+
description: "Order ID"
|
|
796
|
+
},
|
|
797
|
+
fulfillment: {
|
|
798
|
+
type: "object",
|
|
799
|
+
description: "Fulfillment update data (events, tracking)"
|
|
800
|
+
},
|
|
801
|
+
adjustments: {
|
|
802
|
+
type: "array",
|
|
803
|
+
description: "Order adjustments (refunds, returns)",
|
|
804
|
+
items: { type: "object" }
|
|
805
|
+
}
|
|
709
806
|
},
|
|
710
|
-
|
|
711
|
-
type: "object",
|
|
712
|
-
description: "Fulfillment update data (events, tracking)"
|
|
713
|
-
},
|
|
714
|
-
adjustments: {
|
|
715
|
-
type: "array",
|
|
716
|
-
description: "Order adjustments (refunds, returns)",
|
|
717
|
-
items: { type: "object" }
|
|
718
|
-
}
|
|
807
|
+
required: ["id"]
|
|
719
808
|
},
|
|
720
|
-
|
|
809
|
+
execute: async (params) => {
|
|
810
|
+
const { id,...payload } = params;
|
|
811
|
+
return client.order.update(id, payload);
|
|
812
|
+
}
|
|
721
813
|
},
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
814
|
+
{
|
|
815
|
+
name: "update_order_line_item",
|
|
816
|
+
description: "Update a line item within an order, such as setting a parent line item for grouping.",
|
|
817
|
+
parameters: {
|
|
818
|
+
type: "object",
|
|
819
|
+
properties: {
|
|
820
|
+
id: {
|
|
821
|
+
type: "string",
|
|
822
|
+
description: "Order ID"
|
|
823
|
+
},
|
|
824
|
+
line_item_id: {
|
|
825
|
+
type: "string",
|
|
826
|
+
description: "Line item ID to update"
|
|
827
|
+
},
|
|
828
|
+
parent_id: {
|
|
829
|
+
type: "string",
|
|
830
|
+
description: "Parent line item ID for grouping (optional)"
|
|
831
|
+
}
|
|
832
|
+
},
|
|
833
|
+
required: ["id", "line_item_id"]
|
|
834
|
+
},
|
|
835
|
+
execute: async (params) => {
|
|
836
|
+
const { id, line_item_id,...payload } = params;
|
|
837
|
+
return client.order.updateLineItem(id, line_item_id, payload);
|
|
838
|
+
}
|
|
725
839
|
}
|
|
726
|
-
|
|
840
|
+
];
|
|
727
841
|
}
|
|
728
842
|
function identityLinkingTools(client) {
|
|
729
843
|
return [
|
|
@@ -850,21 +964,6 @@ function identityLinkingTools(client) {
|
|
|
850
964
|
|
|
851
965
|
//#endregion
|
|
852
966
|
//#region src/UCPClient.ts
|
|
853
|
-
/**
|
|
854
|
-
* Connect to a UCP server, discover its capabilities, and return a {@link ConnectedClient}.
|
|
855
|
-
*
|
|
856
|
-
* @example
|
|
857
|
-
* ```typescript
|
|
858
|
-
* const client = await connect({
|
|
859
|
-
* gatewayUrl: 'https://store.example.com/ucp',
|
|
860
|
-
* agentProfileUrl: 'https://platform.example.com/.well-known/ucp',
|
|
861
|
-
* });
|
|
862
|
-
*
|
|
863
|
-
* if (client.checkout) {
|
|
864
|
-
* const session = await client.checkout.create({ line_items: [...] });
|
|
865
|
-
* }
|
|
866
|
-
* ```
|
|
867
|
-
*/
|
|
868
967
|
async function connect(config, options) {
|
|
869
968
|
validateConfig(config);
|
|
870
969
|
const http = new HttpClient({
|
|
@@ -894,18 +993,6 @@ async function connect(config, options) {
|
|
|
894
993
|
};
|
|
895
994
|
return Object.freeze(client);
|
|
896
995
|
}
|
|
897
|
-
/**
|
|
898
|
-
* UCP client entry point. Use `UCPClient.connect()` to discover server capabilities
|
|
899
|
-
* and get a {@link ConnectedClient}.
|
|
900
|
-
*
|
|
901
|
-
* @example
|
|
902
|
-
* ```typescript
|
|
903
|
-
* const client = await UCPClient.connect({
|
|
904
|
-
* gatewayUrl: 'https://store.example.com/ucp',
|
|
905
|
-
* agentProfileUrl: 'https://platform.example.com/.well-known/ucp',
|
|
906
|
-
* });
|
|
907
|
-
* ```
|
|
908
|
-
*/
|
|
909
996
|
var UCPClient = class {
|
|
910
997
|
constructor() {}
|
|
911
998
|
static connect = connect;
|
|
@@ -920,14 +1007,7 @@ function extractCapabilityNames(profile) {
|
|
|
920
1007
|
if (typeof capabilities !== "object" || capabilities === null) return new Set();
|
|
921
1008
|
return new Set(Object.keys(capabilities));
|
|
922
1009
|
}
|
|
923
|
-
const
|
|
924
|
-
id: zod.z.string(),
|
|
925
|
-
version: zod.z.string(),
|
|
926
|
-
spec: zod.z.string(),
|
|
927
|
-
schema: zod.z.string(),
|
|
928
|
-
config: zod.z.record(zod.z.unknown()).optional()
|
|
929
|
-
}).passthrough();
|
|
930
|
-
const PaymentHandlerMapSchema = zod.z.record(zod.z.array(PaymentHandlerInstanceSchema));
|
|
1010
|
+
const PaymentHandlerMapSchema = zod.z.record(zod.z.array(__omnixhq_ucp_js_sdk.PaymentHandlerBaseSchema));
|
|
931
1011
|
function extractPaymentHandlers(profile) {
|
|
932
1012
|
const raw = profile["payment_handlers"];
|
|
933
1013
|
if (typeof raw !== "object" || raw === null) return {};
|
|
@@ -940,7 +1020,7 @@ function extractSigningKeys(profile) {
|
|
|
940
1020
|
if (!Array.isArray(raw)) return [];
|
|
941
1021
|
const keys = [];
|
|
942
1022
|
for (const item of raw) {
|
|
943
|
-
const result =
|
|
1023
|
+
const result = __omnixhq_ucp_js_sdk.UcpSigningKeySchema.safeParse(item);
|
|
944
1024
|
if (result.success) keys.push(result.data);
|
|
945
1025
|
}
|
|
946
1026
|
return keys;
|
|
@@ -1013,6 +1093,18 @@ function buildToolDescriptors(checkout, order, identityLinking) {
|
|
|
1013
1093
|
name: "select_fulfillment_option",
|
|
1014
1094
|
capability: "checkout.fulfillment",
|
|
1015
1095
|
description: "Select fulfillment option (e.g., express shipping)"
|
|
1096
|
+
}, {
|
|
1097
|
+
name: "create_fulfillment_method",
|
|
1098
|
+
capability: "checkout.fulfillment",
|
|
1099
|
+
description: "Add a new fulfillment method to a checkout session"
|
|
1100
|
+
}, {
|
|
1101
|
+
name: "update_fulfillment_method",
|
|
1102
|
+
capability: "checkout.fulfillment",
|
|
1103
|
+
description: "Update an existing fulfillment method on a checkout session"
|
|
1104
|
+
}, {
|
|
1105
|
+
name: "update_fulfillment_group",
|
|
1106
|
+
capability: "checkout.fulfillment",
|
|
1107
|
+
description: "Update a fulfillment group within a fulfillment method"
|
|
1016
1108
|
});
|
|
1017
1109
|
if (checkout.extensions.discount) tools.push({
|
|
1018
1110
|
name: "apply_discount_codes",
|
|
@@ -1028,6 +1120,10 @@ function buildToolDescriptors(checkout, order, identityLinking) {
|
|
|
1028
1120
|
name: "update_order",
|
|
1029
1121
|
capability: "order",
|
|
1030
1122
|
description: "Update an order"
|
|
1123
|
+
}, {
|
|
1124
|
+
name: "update_order_line_item",
|
|
1125
|
+
capability: "order",
|
|
1126
|
+
description: "Update a line item within an order"
|
|
1031
1127
|
});
|
|
1032
1128
|
if (identityLinking) tools.push({
|
|
1033
1129
|
name: "get_authorization_url",
|
|
@@ -1128,7 +1224,7 @@ function createWebhookVerifier(gatewayUrl) {
|
|
|
1128
1224
|
if (!Array.isArray(rawKeys)) return;
|
|
1129
1225
|
keyCache.clear();
|
|
1130
1226
|
for (const item of rawKeys) {
|
|
1131
|
-
const parsed =
|
|
1227
|
+
const parsed = __omnixhq_ucp_js_sdk.UcpSigningKeySchema.safeParse(item);
|
|
1132
1228
|
if (parsed.success && typeof parsed.data.kid === "string") keyCache.set(parsed.data.kid, parsed.data);
|
|
1133
1229
|
}
|
|
1134
1230
|
fetched = true;
|
|
@@ -1203,6 +1299,7 @@ function parseWebhookEvent(body) {
|
|
|
1203
1299
|
//#endregion
|
|
1204
1300
|
exports.AccountInfoSchema = __omnixhq_ucp_js_sdk.AccountInfoSchema
|
|
1205
1301
|
exports.AdjustmentSchema = __omnixhq_ucp_js_sdk.AdjustmentSchema
|
|
1302
|
+
exports.AdjustmentStatusEnumSchema = __omnixhq_ucp_js_sdk.AdjustmentStatusEnumSchema
|
|
1206
1303
|
exports.Ap2MandateAp2WithCheckoutMandateSchema = __omnixhq_ucp_js_sdk.Ap2MandateAp2WithCheckoutMandateSchema
|
|
1207
1304
|
exports.Ap2MandateAp2WithMerchantAuthorizationSchema = __omnixhq_ucp_js_sdk.Ap2MandateAp2WithMerchantAuthorizationSchema
|
|
1208
1305
|
exports.Ap2MandateCheckoutMandateSchema = __omnixhq_ucp_js_sdk.Ap2MandateCheckoutMandateSchema
|
|
@@ -1217,6 +1314,7 @@ exports.CapabilityBaseSchema = __omnixhq_ucp_js_sdk.CapabilityBaseSchema
|
|
|
1217
1314
|
exports.CapabilityBusinessSchema = __omnixhq_ucp_js_sdk.CapabilityBusinessSchema
|
|
1218
1315
|
exports.CapabilityPlatformSchema = __omnixhq_ucp_js_sdk.CapabilityPlatformSchema
|
|
1219
1316
|
exports.CapabilityResponseSchema = __omnixhq_ucp_js_sdk.CapabilityResponseSchema
|
|
1317
|
+
exports.CardCredentialCardNumberTypeEnumSchema = __omnixhq_ucp_js_sdk.CardCredentialCardNumberTypeEnumSchema
|
|
1220
1318
|
exports.CardCredentialSchema = __omnixhq_ucp_js_sdk.CardCredentialSchema
|
|
1221
1319
|
exports.CardPaymentInstrumentSchema = __omnixhq_ucp_js_sdk.CardPaymentInstrumentSchema
|
|
1222
1320
|
exports.CheckoutCapability = CheckoutCapability
|
|
@@ -1226,18 +1324,21 @@ exports.CheckoutResponseSchema = __omnixhq_ucp_js_sdk.CheckoutResponseSchema
|
|
|
1226
1324
|
exports.CheckoutResponseStatusSchema = __omnixhq_ucp_js_sdk.CheckoutResponseStatusSchema
|
|
1227
1325
|
exports.CheckoutSchema = __omnixhq_ucp_js_sdk.CheckoutSchema
|
|
1228
1326
|
exports.CheckoutSessionSchema = CheckoutSessionSchema
|
|
1327
|
+
exports.CheckoutStatusEnumSchema = __omnixhq_ucp_js_sdk.CheckoutStatusEnumSchema
|
|
1229
1328
|
exports.CheckoutUpdateRequestSchema = __omnixhq_ucp_js_sdk.CheckoutUpdateRequestSchema
|
|
1230
1329
|
exports.CompleteCheckoutRequestSchema = CompleteCheckoutRequestSchema
|
|
1231
1330
|
exports.ContextSchema = __omnixhq_ucp_js_sdk.ContextSchema
|
|
1232
1331
|
exports.CreateCheckoutRequestSchema = CreateCheckoutRequestSchema
|
|
1233
1332
|
exports.DEFAULT_UCP_VERSION = DEFAULT_UCP_VERSION
|
|
1234
1333
|
exports.DiscountAllocationSchema = __omnixhq_ucp_js_sdk.DiscountAllocationSchema
|
|
1334
|
+
exports.DiscountAppliedDiscountMethodEnumSchema = __omnixhq_ucp_js_sdk.DiscountAppliedDiscountMethodEnumSchema
|
|
1235
1335
|
exports.DiscountAppliedDiscountSchema = __omnixhq_ucp_js_sdk.DiscountAppliedDiscountSchema
|
|
1236
1336
|
exports.DiscountDiscountsObjectSchema = __omnixhq_ucp_js_sdk.DiscountDiscountsObjectSchema
|
|
1237
1337
|
exports.EmbeddedConfigSchema = __omnixhq_ucp_js_sdk.EmbeddedConfigSchema
|
|
1338
|
+
exports.ExpectationMethodTypeEnumSchema = __omnixhq_ucp_js_sdk.ExpectationMethodTypeEnumSchema
|
|
1238
1339
|
exports.ExpectationSchema = __omnixhq_ucp_js_sdk.ExpectationSchema
|
|
1239
|
-
exports.ExtendedPaymentCredentialSchema = __omnixhq_ucp_js_sdk.ExtendedPaymentCredentialSchema
|
|
1240
1340
|
exports.FulfillmentAvailableMethodSchema = __omnixhq_ucp_js_sdk.FulfillmentAvailableMethodSchema
|
|
1341
|
+
exports.FulfillmentAvailableMethodTypeEnumSchema = __omnixhq_ucp_js_sdk.FulfillmentAvailableMethodTypeEnumSchema
|
|
1241
1342
|
exports.FulfillmentDestinationSchema = __omnixhq_ucp_js_sdk.FulfillmentDestinationSchema
|
|
1242
1343
|
exports.FulfillmentEventSchema = __omnixhq_ucp_js_sdk.FulfillmentEventSchema
|
|
1243
1344
|
exports.FulfillmentExtensionFulfillmentAvailableMethodSchema = __omnixhq_ucp_js_sdk.FulfillmentExtensionFulfillmentAvailableMethodSchema
|
|
@@ -1250,6 +1351,7 @@ exports.FulfillmentGroupUpdateRequestSchema = __omnixhq_ucp_js_sdk.FulfillmentGr
|
|
|
1250
1351
|
exports.FulfillmentMethodCreateRequestSchema = __omnixhq_ucp_js_sdk.FulfillmentMethodCreateRequestSchema
|
|
1251
1352
|
exports.FulfillmentMethodResponseSchema = __omnixhq_ucp_js_sdk.FulfillmentMethodResponseSchema
|
|
1252
1353
|
exports.FulfillmentMethodSchema = __omnixhq_ucp_js_sdk.FulfillmentMethodSchema
|
|
1354
|
+
exports.FulfillmentMethodTypeEnumSchema = __omnixhq_ucp_js_sdk.FulfillmentMethodTypeEnumSchema
|
|
1253
1355
|
exports.FulfillmentMethodUpdateRequestSchema = __omnixhq_ucp_js_sdk.FulfillmentMethodUpdateRequestSchema
|
|
1254
1356
|
exports.FulfillmentOptionSchema = __omnixhq_ucp_js_sdk.FulfillmentOptionSchema
|
|
1255
1357
|
exports.FulfillmentResponseSchema = __omnixhq_ucp_js_sdk.FulfillmentResponseSchema
|
|
@@ -1257,19 +1359,24 @@ exports.FulfillmentSchema = __omnixhq_ucp_js_sdk.FulfillmentSchema
|
|
|
1257
1359
|
exports.IdentityLinkingCapability = IdentityLinkingCapability
|
|
1258
1360
|
exports.ItemResponseSchema = __omnixhq_ucp_js_sdk.ItemResponseSchema
|
|
1259
1361
|
exports.ItemSchema = __omnixhq_ucp_js_sdk.ItemSchema
|
|
1260
|
-
exports.JWKSchema =
|
|
1362
|
+
exports.JWKSchema = __omnixhq_ucp_js_sdk.UcpSigningKeySchema
|
|
1261
1363
|
exports.LineItemResponseSchema = __omnixhq_ucp_js_sdk.LineItemResponseSchema
|
|
1262
1364
|
exports.LineItemSchema = __omnixhq_ucp_js_sdk.LineItemSchema
|
|
1263
1365
|
exports.LineItemUpdateRequestSchema = __omnixhq_ucp_js_sdk.LineItemUpdateRequestSchema
|
|
1264
1366
|
exports.LinkSchema = __omnixhq_ucp_js_sdk.LinkSchema
|
|
1265
1367
|
exports.MerchantFulfillmentConfigSchema = __omnixhq_ucp_js_sdk.MerchantFulfillmentConfigSchema
|
|
1368
|
+
exports.MessageErrorContentTypeEnumSchema = __omnixhq_ucp_js_sdk.MessageErrorContentTypeEnumSchema
|
|
1266
1369
|
exports.MessageErrorSchema = __omnixhq_ucp_js_sdk.MessageErrorSchema
|
|
1370
|
+
exports.MessageErrorSeverityEnumSchema = __omnixhq_ucp_js_sdk.MessageErrorSeverityEnumSchema
|
|
1371
|
+
exports.MessageInfoContentTypeEnumSchema = __omnixhq_ucp_js_sdk.MessageInfoContentTypeEnumSchema
|
|
1267
1372
|
exports.MessageInfoSchema = __omnixhq_ucp_js_sdk.MessageInfoSchema
|
|
1268
1373
|
exports.MessageSchema = __omnixhq_ucp_js_sdk.MessageSchema
|
|
1374
|
+
exports.MessageWarningContentTypeEnumSchema = __omnixhq_ucp_js_sdk.MessageWarningContentTypeEnumSchema
|
|
1269
1375
|
exports.MessageWarningSchema = __omnixhq_ucp_js_sdk.MessageWarningSchema
|
|
1270
1376
|
exports.OrderCapability = OrderCapability
|
|
1271
1377
|
exports.OrderConfirmationSchema = __omnixhq_ucp_js_sdk.OrderConfirmationSchema
|
|
1272
1378
|
exports.OrderLineItemSchema = __omnixhq_ucp_js_sdk.OrderLineItemSchema
|
|
1379
|
+
exports.OrderLineItemStatusEnumSchema = __omnixhq_ucp_js_sdk.OrderLineItemStatusEnumSchema
|
|
1273
1380
|
exports.OrderUpdateSchema = __omnixhq_ucp_js_sdk.OrderUpdateSchema
|
|
1274
1381
|
exports.PaymentCredentialSchema = __omnixhq_ucp_js_sdk.PaymentCredentialSchema
|
|
1275
1382
|
exports.PaymentHandlerBaseSchema = __omnixhq_ucp_js_sdk.PaymentHandlerBaseSchema
|
|
@@ -1281,11 +1388,16 @@ exports.PaymentInstrumentResponseSchema = __omnixhq_ucp_js_sdk.PaymentInstrument
|
|
|
1281
1388
|
exports.PaymentInstrumentSchema = __omnixhq_ucp_js_sdk.PaymentInstrumentSchema
|
|
1282
1389
|
exports.PaymentResponseSchema = __omnixhq_ucp_js_sdk.PaymentResponseSchema
|
|
1283
1390
|
exports.PaymentSchema = __omnixhq_ucp_js_sdk.PaymentSchema
|
|
1284
|
-
exports.PlatformConfigSchema = __omnixhq_ucp_js_sdk.PlatformConfigSchema
|
|
1285
1391
|
exports.PlatformFulfillmentConfigSchema = __omnixhq_ucp_js_sdk.PlatformFulfillmentConfigSchema
|
|
1286
1392
|
exports.PostalAddressSchema = __omnixhq_ucp_js_sdk.PostalAddressSchema
|
|
1393
|
+
exports.ProfileSchemaBaseSchema = __omnixhq_ucp_js_sdk.ProfileSchemaBaseSchema
|
|
1394
|
+
exports.ProfileSchemaBusinessProfileSchema = __omnixhq_ucp_js_sdk.ProfileSchemaBusinessProfileSchema
|
|
1395
|
+
exports.ProfileSchemaPlatformProfileSchema = __omnixhq_ucp_js_sdk.ProfileSchemaPlatformProfileSchema
|
|
1396
|
+
exports.ProfileSchemaSigningKeySchema = __omnixhq_ucp_js_sdk.ProfileSchemaSigningKeySchema
|
|
1397
|
+
exports.ProfileSchemaSigningKeyUseEnumSchema = __omnixhq_ucp_js_sdk.ProfileSchemaSigningKeyUseEnumSchema
|
|
1287
1398
|
exports.RetailLocationSchema = __omnixhq_ucp_js_sdk.RetailLocationSchema
|
|
1288
1399
|
exports.ServiceBaseSchema = __omnixhq_ucp_js_sdk.ServiceBaseSchema
|
|
1400
|
+
exports.ServiceBaseTransportEnumSchema = __omnixhq_ucp_js_sdk.ServiceBaseTransportEnumSchema
|
|
1289
1401
|
exports.ServiceBusinessSchema = __omnixhq_ucp_js_sdk.ServiceBusinessSchema
|
|
1290
1402
|
exports.ServicePlatformSchema = __omnixhq_ucp_js_sdk.ServicePlatformSchema
|
|
1291
1403
|
exports.ServiceResponseSchema = __omnixhq_ucp_js_sdk.ServiceResponseSchema
|
|
@@ -1293,6 +1405,7 @@ exports.ShippingDestinationSchema = __omnixhq_ucp_js_sdk.ShippingDestinationSche
|
|
|
1293
1405
|
exports.TokenCredentialSchema = __omnixhq_ucp_js_sdk.TokenCredentialSchema
|
|
1294
1406
|
exports.TotalResponseSchema = __omnixhq_ucp_js_sdk.TotalResponseSchema
|
|
1295
1407
|
exports.TotalSchema = __omnixhq_ucp_js_sdk.TotalSchema
|
|
1408
|
+
exports.TotalTypeEnumSchema = __omnixhq_ucp_js_sdk.TotalTypeEnumSchema
|
|
1296
1409
|
exports.UCPClient = UCPClient
|
|
1297
1410
|
exports.UCPError = require_errors.UCPError
|
|
1298
1411
|
exports.UCPEscalationError = require_errors.UCPEscalationError
|
|
@@ -1303,11 +1416,14 @@ exports.UCPSpecOrderSchema = __omnixhq_ucp_js_sdk.OrderSchema
|
|
|
1303
1416
|
exports.UCP_CAPABILITIES = UCP_CAPABILITIES
|
|
1304
1417
|
exports.UcpBaseSchema = __omnixhq_ucp_js_sdk.UcpBaseSchema
|
|
1305
1418
|
exports.UcpBusinessSchema = __omnixhq_ucp_js_sdk.UcpBusinessSchema
|
|
1419
|
+
exports.UcpDiscoveryBusinessProfileSchema = __omnixhq_ucp_js_sdk.UcpDiscoveryBusinessProfileSchema
|
|
1420
|
+
exports.UcpDiscoveryPlatformProfileSchema = __omnixhq_ucp_js_sdk.UcpDiscoveryPlatformProfileSchema
|
|
1306
1421
|
exports.UcpEntitySchema = __omnixhq_ucp_js_sdk.UcpEntitySchema
|
|
1307
1422
|
exports.UcpPlatformSchema = __omnixhq_ucp_js_sdk.UcpPlatformSchema
|
|
1308
1423
|
exports.UcpResponseCheckoutSchema = __omnixhq_ucp_js_sdk.UcpResponseCheckoutSchema
|
|
1309
1424
|
exports.UcpResponseOrderSchema = __omnixhq_ucp_js_sdk.UcpResponseOrderSchema
|
|
1310
1425
|
exports.UcpReverseDomainNameSchema = __omnixhq_ucp_js_sdk.UcpReverseDomainNameSchema
|
|
1426
|
+
exports.UcpSigningKeySchema = __omnixhq_ucp_js_sdk.UcpSigningKeySchema
|
|
1311
1427
|
exports.UcpVersionSchema = __omnixhq_ucp_js_sdk.UcpVersionSchema
|
|
1312
1428
|
exports.UpdateCheckoutRequestSchema = UpdateCheckoutRequestSchema
|
|
1313
1429
|
exports.WebhookEventSchema = WebhookEventSchema
|