@omnixhq/ucp-client 2.3.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 -151
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -9405
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +3 -9405
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +239 -150
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/catch-errors-B2FSGjMS.d.cts +0 -446
- package/dist/catch-errors-B2FSGjMS.d.cts.map +0 -1
- package/dist/catch-errors-dZ2dwGey.d.ts +0 -446
- package/dist/catch-errors-dZ2dwGey.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -28,32 +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.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
|
-
/** @deprecated Removed from ucp-js-sdk 1.0.2. Use PaymentCredentialSchema instead. */
|
|
37
|
-
const ExtendedPaymentCredentialSchema = zod.z.object({
|
|
38
|
-
type: zod.z.string(),
|
|
39
|
-
token: zod.z.string().optional()
|
|
40
|
-
}).passthrough();
|
|
41
|
-
/** @deprecated Removed from ucp-js-sdk 1.0.2. Will be removed in a future major version. */
|
|
42
|
-
const PlatformConfigSchema = zod.z.object({ webhook_url: zod.z.string().optional() }).passthrough();
|
|
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;
|
|
43
36
|
const WebhookEventSchema = zod.z.object({
|
|
44
37
|
event_id: zod.z.string(),
|
|
45
38
|
created_time: zod.z.string(),
|
|
46
|
-
order: __omnixhq_ucp_js_sdk.OrderSchema
|
|
47
|
-
})
|
|
48
|
-
const JWKSchema = zod.z.object({
|
|
49
|
-
kty: zod.z.string(),
|
|
50
|
-
kid: zod.z.string().optional(),
|
|
51
|
-
use: zod.z.string().optional(),
|
|
52
|
-
alg: zod.z.string().optional(),
|
|
53
|
-
crv: zod.z.string().optional(),
|
|
54
|
-
x: zod.z.string().optional(),
|
|
55
|
-
y: zod.z.string().optional()
|
|
56
|
-
}).passthrough();
|
|
39
|
+
order: __omnixhq_ucp_js_sdk.OrderSchema
|
|
40
|
+
});
|
|
57
41
|
|
|
58
42
|
//#endregion
|
|
59
43
|
//#region src/http.ts
|
|
@@ -111,21 +95,18 @@ var HttpClient = class HttpClient {
|
|
|
111
95
|
return result.data;
|
|
112
96
|
}
|
|
113
97
|
throwFromResponse(data, statusCode) {
|
|
114
|
-
if (typeof data
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
...first.content_type !== void 0 ? { contentType: first.content_type } : {},
|
|
127
|
-
messages: allMessages
|
|
128
|
-
});
|
|
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
|
+
}
|
|
129
110
|
}
|
|
130
111
|
if (statusCode === 409) throw new require_errors.UCPIdempotencyConflictError();
|
|
131
112
|
throw new require_errors.UCPError("HTTP_ERROR", `Gateway returned ${statusCode}`, "error", statusCode);
|
|
@@ -175,10 +156,7 @@ function parseMessages(rawMessages) {
|
|
|
175
156
|
return {
|
|
176
157
|
type,
|
|
177
158
|
content: String(record["content"] ?? "Unknown error"),
|
|
178
|
-
...record["code"] !== void 0 ? { code: String(record["code"]) } : {}
|
|
179
|
-
...record["severity"] !== void 0 ? { severity: String(record["severity"]) } : {},
|
|
180
|
-
...record["path"] !== void 0 ? { path: String(record["path"]) } : {},
|
|
181
|
-
...record["content_type"] !== void 0 ? { content_type: String(record["content_type"]) } : {}
|
|
159
|
+
...record["code"] !== void 0 ? { code: String(record["code"]) } : {}
|
|
182
160
|
};
|
|
183
161
|
});
|
|
184
162
|
}
|
|
@@ -218,44 +196,48 @@ var CheckoutCapability = class {
|
|
|
218
196
|
const data = await this.http.request("POST", `/checkout-sessions/${encodeURIComponent(id)}/cancel`);
|
|
219
197
|
return this.validateSession(data);
|
|
220
198
|
}
|
|
221
|
-
async setFulfillment(id, type
|
|
222
|
-
return this.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
type
|
|
227
|
-
}] }
|
|
228
|
-
});
|
|
199
|
+
async setFulfillment(id, type) {
|
|
200
|
+
return this.patchFulfillmentDiscount(id, { fulfillment: { methods: [{
|
|
201
|
+
id: DEFAULT_METHOD_ID,
|
|
202
|
+
type
|
|
203
|
+
}] } });
|
|
229
204
|
}
|
|
230
|
-
async selectDestination(id, destinationId, fulfillmentType = "shipping"
|
|
231
|
-
return this.
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
selected_destination_id: destinationId
|
|
237
|
-
}] }
|
|
238
|
-
});
|
|
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
|
+
}] } });
|
|
239
211
|
}
|
|
240
|
-
async selectFulfillmentOption(id, optionId, destinationId, fulfillmentType = "shipping"
|
|
241
|
-
return this.
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}]
|
|
251
|
-
}] }
|
|
252
|
-
});
|
|
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
|
+
}] } });
|
|
253
222
|
}
|
|
254
|
-
async applyDiscountCodes(id, codes
|
|
255
|
-
return this.
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
});
|
|
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);
|
|
259
241
|
}
|
|
260
242
|
validateSession(data) {
|
|
261
243
|
const session = this.http.validate(data, CheckoutSessionSchema);
|
|
@@ -279,7 +261,12 @@ var OrderCapability = class {
|
|
|
279
261
|
/** Update an order with fulfillment events, adjustments, or status changes. */
|
|
280
262
|
async update(id, payload) {
|
|
281
263
|
const data = await this.http.request("PUT", `/orders/${encodeURIComponent(id)}`, payload);
|
|
282
|
-
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);
|
|
283
270
|
}
|
|
284
271
|
};
|
|
285
272
|
|
|
@@ -666,6 +653,97 @@ function fulfillmentTools(client) {
|
|
|
666
653
|
required: ["id", "option_id"]
|
|
667
654
|
},
|
|
668
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"] })
|
|
669
747
|
}
|
|
670
748
|
];
|
|
671
749
|
}
|
|
@@ -692,45 +770,74 @@ function discountTools(client) {
|
|
|
692
770
|
}];
|
|
693
771
|
}
|
|
694
772
|
function orderTools(client) {
|
|
695
|
-
return [
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
description: "Order ID"
|
|
703
|
-
} },
|
|
704
|
-
required: ["id"]
|
|
705
|
-
},
|
|
706
|
-
execute: async (params) => client.order.get(params["id"])
|
|
707
|
-
}, {
|
|
708
|
-
name: "update_order",
|
|
709
|
-
description: "Update an order with fulfillment events, adjustments, or status changes.",
|
|
710
|
-
parameters: {
|
|
711
|
-
type: "object",
|
|
712
|
-
properties: {
|
|
713
|
-
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: {
|
|
714
780
|
type: "string",
|
|
715
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
|
+
}
|
|
716
806
|
},
|
|
717
|
-
|
|
718
|
-
type: "object",
|
|
719
|
-
description: "Fulfillment update data (events, tracking)"
|
|
720
|
-
},
|
|
721
|
-
adjustments: {
|
|
722
|
-
type: "array",
|
|
723
|
-
description: "Order adjustments (refunds, returns)",
|
|
724
|
-
items: { type: "object" }
|
|
725
|
-
}
|
|
807
|
+
required: ["id"]
|
|
726
808
|
},
|
|
727
|
-
|
|
809
|
+
execute: async (params) => {
|
|
810
|
+
const { id,...payload } = params;
|
|
811
|
+
return client.order.update(id, payload);
|
|
812
|
+
}
|
|
728
813
|
},
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
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
|
+
}
|
|
732
839
|
}
|
|
733
|
-
|
|
840
|
+
];
|
|
734
841
|
}
|
|
735
842
|
function identityLinkingTools(client) {
|
|
736
843
|
return [
|
|
@@ -857,21 +964,6 @@ function identityLinkingTools(client) {
|
|
|
857
964
|
|
|
858
965
|
//#endregion
|
|
859
966
|
//#region src/UCPClient.ts
|
|
860
|
-
/**
|
|
861
|
-
* Connect to a UCP server, discover its capabilities, and return a {@link ConnectedClient}.
|
|
862
|
-
*
|
|
863
|
-
* @example
|
|
864
|
-
* ```typescript
|
|
865
|
-
* const client = await connect({
|
|
866
|
-
* gatewayUrl: 'https://store.example.com/ucp',
|
|
867
|
-
* agentProfileUrl: 'https://platform.example.com/.well-known/ucp',
|
|
868
|
-
* });
|
|
869
|
-
*
|
|
870
|
-
* if (client.checkout) {
|
|
871
|
-
* const session = await client.checkout.create({ line_items: [...] });
|
|
872
|
-
* }
|
|
873
|
-
* ```
|
|
874
|
-
*/
|
|
875
967
|
async function connect(config, options) {
|
|
876
968
|
validateConfig(config);
|
|
877
969
|
const http = new HttpClient({
|
|
@@ -901,18 +993,6 @@ async function connect(config, options) {
|
|
|
901
993
|
};
|
|
902
994
|
return Object.freeze(client);
|
|
903
995
|
}
|
|
904
|
-
/**
|
|
905
|
-
* UCP client entry point. Use `UCPClient.connect()` to discover server capabilities
|
|
906
|
-
* and get a {@link ConnectedClient}.
|
|
907
|
-
*
|
|
908
|
-
* @example
|
|
909
|
-
* ```typescript
|
|
910
|
-
* const client = await UCPClient.connect({
|
|
911
|
-
* gatewayUrl: 'https://store.example.com/ucp',
|
|
912
|
-
* agentProfileUrl: 'https://platform.example.com/.well-known/ucp',
|
|
913
|
-
* });
|
|
914
|
-
* ```
|
|
915
|
-
*/
|
|
916
996
|
var UCPClient = class {
|
|
917
997
|
constructor() {}
|
|
918
998
|
static connect = connect;
|
|
@@ -927,14 +1007,7 @@ function extractCapabilityNames(profile) {
|
|
|
927
1007
|
if (typeof capabilities !== "object" || capabilities === null) return new Set();
|
|
928
1008
|
return new Set(Object.keys(capabilities));
|
|
929
1009
|
}
|
|
930
|
-
const
|
|
931
|
-
id: zod.z.string(),
|
|
932
|
-
version: zod.z.string(),
|
|
933
|
-
spec: zod.z.string(),
|
|
934
|
-
schema: zod.z.string(),
|
|
935
|
-
config: zod.z.record(zod.z.unknown()).optional()
|
|
936
|
-
}).passthrough();
|
|
937
|
-
const PaymentHandlerMapSchema = zod.z.record(zod.z.array(PaymentHandlerInstanceSchema));
|
|
1010
|
+
const PaymentHandlerMapSchema = zod.z.record(zod.z.array(__omnixhq_ucp_js_sdk.PaymentHandlerBaseSchema));
|
|
938
1011
|
function extractPaymentHandlers(profile) {
|
|
939
1012
|
const raw = profile["payment_handlers"];
|
|
940
1013
|
if (typeof raw !== "object" || raw === null) return {};
|
|
@@ -947,7 +1020,7 @@ function extractSigningKeys(profile) {
|
|
|
947
1020
|
if (!Array.isArray(raw)) return [];
|
|
948
1021
|
const keys = [];
|
|
949
1022
|
for (const item of raw) {
|
|
950
|
-
const result =
|
|
1023
|
+
const result = __omnixhq_ucp_js_sdk.UcpSigningKeySchema.safeParse(item);
|
|
951
1024
|
if (result.success) keys.push(result.data);
|
|
952
1025
|
}
|
|
953
1026
|
return keys;
|
|
@@ -1020,6 +1093,18 @@ function buildToolDescriptors(checkout, order, identityLinking) {
|
|
|
1020
1093
|
name: "select_fulfillment_option",
|
|
1021
1094
|
capability: "checkout.fulfillment",
|
|
1022
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"
|
|
1023
1108
|
});
|
|
1024
1109
|
if (checkout.extensions.discount) tools.push({
|
|
1025
1110
|
name: "apply_discount_codes",
|
|
@@ -1035,6 +1120,10 @@ function buildToolDescriptors(checkout, order, identityLinking) {
|
|
|
1035
1120
|
name: "update_order",
|
|
1036
1121
|
capability: "order",
|
|
1037
1122
|
description: "Update an order"
|
|
1123
|
+
}, {
|
|
1124
|
+
name: "update_order_line_item",
|
|
1125
|
+
capability: "order",
|
|
1126
|
+
description: "Update a line item within an order"
|
|
1038
1127
|
});
|
|
1039
1128
|
if (identityLinking) tools.push({
|
|
1040
1129
|
name: "get_authorization_url",
|
|
@@ -1135,7 +1224,7 @@ function createWebhookVerifier(gatewayUrl) {
|
|
|
1135
1224
|
if (!Array.isArray(rawKeys)) return;
|
|
1136
1225
|
keyCache.clear();
|
|
1137
1226
|
for (const item of rawKeys) {
|
|
1138
|
-
const parsed =
|
|
1227
|
+
const parsed = __omnixhq_ucp_js_sdk.UcpSigningKeySchema.safeParse(item);
|
|
1139
1228
|
if (parsed.success && typeof parsed.data.kid === "string") keyCache.set(parsed.data.kid, parsed.data);
|
|
1140
1229
|
}
|
|
1141
1230
|
fetched = true;
|
|
@@ -1210,6 +1299,7 @@ function parseWebhookEvent(body) {
|
|
|
1210
1299
|
//#endregion
|
|
1211
1300
|
exports.AccountInfoSchema = __omnixhq_ucp_js_sdk.AccountInfoSchema
|
|
1212
1301
|
exports.AdjustmentSchema = __omnixhq_ucp_js_sdk.AdjustmentSchema
|
|
1302
|
+
exports.AdjustmentStatusEnumSchema = __omnixhq_ucp_js_sdk.AdjustmentStatusEnumSchema
|
|
1213
1303
|
exports.Ap2MandateAp2WithCheckoutMandateSchema = __omnixhq_ucp_js_sdk.Ap2MandateAp2WithCheckoutMandateSchema
|
|
1214
1304
|
exports.Ap2MandateAp2WithMerchantAuthorizationSchema = __omnixhq_ucp_js_sdk.Ap2MandateAp2WithMerchantAuthorizationSchema
|
|
1215
1305
|
exports.Ap2MandateCheckoutMandateSchema = __omnixhq_ucp_js_sdk.Ap2MandateCheckoutMandateSchema
|
|
@@ -1224,6 +1314,7 @@ exports.CapabilityBaseSchema = __omnixhq_ucp_js_sdk.CapabilityBaseSchema
|
|
|
1224
1314
|
exports.CapabilityBusinessSchema = __omnixhq_ucp_js_sdk.CapabilityBusinessSchema
|
|
1225
1315
|
exports.CapabilityPlatformSchema = __omnixhq_ucp_js_sdk.CapabilityPlatformSchema
|
|
1226
1316
|
exports.CapabilityResponseSchema = __omnixhq_ucp_js_sdk.CapabilityResponseSchema
|
|
1317
|
+
exports.CardCredentialCardNumberTypeEnumSchema = __omnixhq_ucp_js_sdk.CardCredentialCardNumberTypeEnumSchema
|
|
1227
1318
|
exports.CardCredentialSchema = __omnixhq_ucp_js_sdk.CardCredentialSchema
|
|
1228
1319
|
exports.CardPaymentInstrumentSchema = __omnixhq_ucp_js_sdk.CardPaymentInstrumentSchema
|
|
1229
1320
|
exports.CheckoutCapability = CheckoutCapability
|
|
@@ -1233,18 +1324,21 @@ exports.CheckoutResponseSchema = __omnixhq_ucp_js_sdk.CheckoutResponseSchema
|
|
|
1233
1324
|
exports.CheckoutResponseStatusSchema = __omnixhq_ucp_js_sdk.CheckoutResponseStatusSchema
|
|
1234
1325
|
exports.CheckoutSchema = __omnixhq_ucp_js_sdk.CheckoutSchema
|
|
1235
1326
|
exports.CheckoutSessionSchema = CheckoutSessionSchema
|
|
1327
|
+
exports.CheckoutStatusEnumSchema = __omnixhq_ucp_js_sdk.CheckoutStatusEnumSchema
|
|
1236
1328
|
exports.CheckoutUpdateRequestSchema = __omnixhq_ucp_js_sdk.CheckoutUpdateRequestSchema
|
|
1237
1329
|
exports.CompleteCheckoutRequestSchema = CompleteCheckoutRequestSchema
|
|
1238
1330
|
exports.ContextSchema = __omnixhq_ucp_js_sdk.ContextSchema
|
|
1239
1331
|
exports.CreateCheckoutRequestSchema = CreateCheckoutRequestSchema
|
|
1240
1332
|
exports.DEFAULT_UCP_VERSION = DEFAULT_UCP_VERSION
|
|
1241
1333
|
exports.DiscountAllocationSchema = __omnixhq_ucp_js_sdk.DiscountAllocationSchema
|
|
1334
|
+
exports.DiscountAppliedDiscountMethodEnumSchema = __omnixhq_ucp_js_sdk.DiscountAppliedDiscountMethodEnumSchema
|
|
1242
1335
|
exports.DiscountAppliedDiscountSchema = __omnixhq_ucp_js_sdk.DiscountAppliedDiscountSchema
|
|
1243
1336
|
exports.DiscountDiscountsObjectSchema = __omnixhq_ucp_js_sdk.DiscountDiscountsObjectSchema
|
|
1244
1337
|
exports.EmbeddedConfigSchema = __omnixhq_ucp_js_sdk.EmbeddedConfigSchema
|
|
1338
|
+
exports.ExpectationMethodTypeEnumSchema = __omnixhq_ucp_js_sdk.ExpectationMethodTypeEnumSchema
|
|
1245
1339
|
exports.ExpectationSchema = __omnixhq_ucp_js_sdk.ExpectationSchema
|
|
1246
|
-
exports.ExtendedPaymentCredentialSchema = ExtendedPaymentCredentialSchema
|
|
1247
1340
|
exports.FulfillmentAvailableMethodSchema = __omnixhq_ucp_js_sdk.FulfillmentAvailableMethodSchema
|
|
1341
|
+
exports.FulfillmentAvailableMethodTypeEnumSchema = __omnixhq_ucp_js_sdk.FulfillmentAvailableMethodTypeEnumSchema
|
|
1248
1342
|
exports.FulfillmentDestinationSchema = __omnixhq_ucp_js_sdk.FulfillmentDestinationSchema
|
|
1249
1343
|
exports.FulfillmentEventSchema = __omnixhq_ucp_js_sdk.FulfillmentEventSchema
|
|
1250
1344
|
exports.FulfillmentExtensionFulfillmentAvailableMethodSchema = __omnixhq_ucp_js_sdk.FulfillmentExtensionFulfillmentAvailableMethodSchema
|
|
@@ -1257,6 +1351,7 @@ exports.FulfillmentGroupUpdateRequestSchema = __omnixhq_ucp_js_sdk.FulfillmentGr
|
|
|
1257
1351
|
exports.FulfillmentMethodCreateRequestSchema = __omnixhq_ucp_js_sdk.FulfillmentMethodCreateRequestSchema
|
|
1258
1352
|
exports.FulfillmentMethodResponseSchema = __omnixhq_ucp_js_sdk.FulfillmentMethodResponseSchema
|
|
1259
1353
|
exports.FulfillmentMethodSchema = __omnixhq_ucp_js_sdk.FulfillmentMethodSchema
|
|
1354
|
+
exports.FulfillmentMethodTypeEnumSchema = __omnixhq_ucp_js_sdk.FulfillmentMethodTypeEnumSchema
|
|
1260
1355
|
exports.FulfillmentMethodUpdateRequestSchema = __omnixhq_ucp_js_sdk.FulfillmentMethodUpdateRequestSchema
|
|
1261
1356
|
exports.FulfillmentOptionSchema = __omnixhq_ucp_js_sdk.FulfillmentOptionSchema
|
|
1262
1357
|
exports.FulfillmentResponseSchema = __omnixhq_ucp_js_sdk.FulfillmentResponseSchema
|
|
@@ -1264,19 +1359,24 @@ exports.FulfillmentSchema = __omnixhq_ucp_js_sdk.FulfillmentSchema
|
|
|
1264
1359
|
exports.IdentityLinkingCapability = IdentityLinkingCapability
|
|
1265
1360
|
exports.ItemResponseSchema = __omnixhq_ucp_js_sdk.ItemResponseSchema
|
|
1266
1361
|
exports.ItemSchema = __omnixhq_ucp_js_sdk.ItemSchema
|
|
1267
|
-
exports.JWKSchema =
|
|
1362
|
+
exports.JWKSchema = __omnixhq_ucp_js_sdk.UcpSigningKeySchema
|
|
1268
1363
|
exports.LineItemResponseSchema = __omnixhq_ucp_js_sdk.LineItemResponseSchema
|
|
1269
1364
|
exports.LineItemSchema = __omnixhq_ucp_js_sdk.LineItemSchema
|
|
1270
1365
|
exports.LineItemUpdateRequestSchema = __omnixhq_ucp_js_sdk.LineItemUpdateRequestSchema
|
|
1271
1366
|
exports.LinkSchema = __omnixhq_ucp_js_sdk.LinkSchema
|
|
1272
1367
|
exports.MerchantFulfillmentConfigSchema = __omnixhq_ucp_js_sdk.MerchantFulfillmentConfigSchema
|
|
1368
|
+
exports.MessageErrorContentTypeEnumSchema = __omnixhq_ucp_js_sdk.MessageErrorContentTypeEnumSchema
|
|
1273
1369
|
exports.MessageErrorSchema = __omnixhq_ucp_js_sdk.MessageErrorSchema
|
|
1370
|
+
exports.MessageErrorSeverityEnumSchema = __omnixhq_ucp_js_sdk.MessageErrorSeverityEnumSchema
|
|
1371
|
+
exports.MessageInfoContentTypeEnumSchema = __omnixhq_ucp_js_sdk.MessageInfoContentTypeEnumSchema
|
|
1274
1372
|
exports.MessageInfoSchema = __omnixhq_ucp_js_sdk.MessageInfoSchema
|
|
1275
1373
|
exports.MessageSchema = __omnixhq_ucp_js_sdk.MessageSchema
|
|
1374
|
+
exports.MessageWarningContentTypeEnumSchema = __omnixhq_ucp_js_sdk.MessageWarningContentTypeEnumSchema
|
|
1276
1375
|
exports.MessageWarningSchema = __omnixhq_ucp_js_sdk.MessageWarningSchema
|
|
1277
1376
|
exports.OrderCapability = OrderCapability
|
|
1278
1377
|
exports.OrderConfirmationSchema = __omnixhq_ucp_js_sdk.OrderConfirmationSchema
|
|
1279
1378
|
exports.OrderLineItemSchema = __omnixhq_ucp_js_sdk.OrderLineItemSchema
|
|
1379
|
+
exports.OrderLineItemStatusEnumSchema = __omnixhq_ucp_js_sdk.OrderLineItemStatusEnumSchema
|
|
1280
1380
|
exports.OrderUpdateSchema = __omnixhq_ucp_js_sdk.OrderUpdateSchema
|
|
1281
1381
|
exports.PaymentCredentialSchema = __omnixhq_ucp_js_sdk.PaymentCredentialSchema
|
|
1282
1382
|
exports.PaymentHandlerBaseSchema = __omnixhq_ucp_js_sdk.PaymentHandlerBaseSchema
|
|
@@ -1288,11 +1388,16 @@ exports.PaymentInstrumentResponseSchema = __omnixhq_ucp_js_sdk.PaymentInstrument
|
|
|
1288
1388
|
exports.PaymentInstrumentSchema = __omnixhq_ucp_js_sdk.PaymentInstrumentSchema
|
|
1289
1389
|
exports.PaymentResponseSchema = __omnixhq_ucp_js_sdk.PaymentResponseSchema
|
|
1290
1390
|
exports.PaymentSchema = __omnixhq_ucp_js_sdk.PaymentSchema
|
|
1291
|
-
exports.PlatformConfigSchema = PlatformConfigSchema
|
|
1292
1391
|
exports.PlatformFulfillmentConfigSchema = __omnixhq_ucp_js_sdk.PlatformFulfillmentConfigSchema
|
|
1293
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
|
|
1294
1398
|
exports.RetailLocationSchema = __omnixhq_ucp_js_sdk.RetailLocationSchema
|
|
1295
1399
|
exports.ServiceBaseSchema = __omnixhq_ucp_js_sdk.ServiceBaseSchema
|
|
1400
|
+
exports.ServiceBaseTransportEnumSchema = __omnixhq_ucp_js_sdk.ServiceBaseTransportEnumSchema
|
|
1296
1401
|
exports.ServiceBusinessSchema = __omnixhq_ucp_js_sdk.ServiceBusinessSchema
|
|
1297
1402
|
exports.ServicePlatformSchema = __omnixhq_ucp_js_sdk.ServicePlatformSchema
|
|
1298
1403
|
exports.ServiceResponseSchema = __omnixhq_ucp_js_sdk.ServiceResponseSchema
|
|
@@ -1300,6 +1405,7 @@ exports.ShippingDestinationSchema = __omnixhq_ucp_js_sdk.ShippingDestinationSche
|
|
|
1300
1405
|
exports.TokenCredentialSchema = __omnixhq_ucp_js_sdk.TokenCredentialSchema
|
|
1301
1406
|
exports.TotalResponseSchema = __omnixhq_ucp_js_sdk.TotalResponseSchema
|
|
1302
1407
|
exports.TotalSchema = __omnixhq_ucp_js_sdk.TotalSchema
|
|
1408
|
+
exports.TotalTypeEnumSchema = __omnixhq_ucp_js_sdk.TotalTypeEnumSchema
|
|
1303
1409
|
exports.UCPClient = UCPClient
|
|
1304
1410
|
exports.UCPError = require_errors.UCPError
|
|
1305
1411
|
exports.UCPEscalationError = require_errors.UCPEscalationError
|
|
@@ -1310,11 +1416,14 @@ exports.UCPSpecOrderSchema = __omnixhq_ucp_js_sdk.OrderSchema
|
|
|
1310
1416
|
exports.UCP_CAPABILITIES = UCP_CAPABILITIES
|
|
1311
1417
|
exports.UcpBaseSchema = __omnixhq_ucp_js_sdk.UcpBaseSchema
|
|
1312
1418
|
exports.UcpBusinessSchema = __omnixhq_ucp_js_sdk.UcpBusinessSchema
|
|
1419
|
+
exports.UcpDiscoveryBusinessProfileSchema = __omnixhq_ucp_js_sdk.UcpDiscoveryBusinessProfileSchema
|
|
1420
|
+
exports.UcpDiscoveryPlatformProfileSchema = __omnixhq_ucp_js_sdk.UcpDiscoveryPlatformProfileSchema
|
|
1313
1421
|
exports.UcpEntitySchema = __omnixhq_ucp_js_sdk.UcpEntitySchema
|
|
1314
1422
|
exports.UcpPlatformSchema = __omnixhq_ucp_js_sdk.UcpPlatformSchema
|
|
1315
1423
|
exports.UcpResponseCheckoutSchema = __omnixhq_ucp_js_sdk.UcpResponseCheckoutSchema
|
|
1316
1424
|
exports.UcpResponseOrderSchema = __omnixhq_ucp_js_sdk.UcpResponseOrderSchema
|
|
1317
1425
|
exports.UcpReverseDomainNameSchema = __omnixhq_ucp_js_sdk.UcpReverseDomainNameSchema
|
|
1426
|
+
exports.UcpSigningKeySchema = __omnixhq_ucp_js_sdk.UcpSigningKeySchema
|
|
1318
1427
|
exports.UcpVersionSchema = __omnixhq_ucp_js_sdk.UcpVersionSchema
|
|
1319
1428
|
exports.UpdateCheckoutRequestSchema = UpdateCheckoutRequestSchema
|
|
1320
1429
|
exports.WebhookEventSchema = WebhookEventSchema
|