@cmssy/ai-tools 0.92.0 → 0.93.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.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +2 -0
- package/dist/registry.js.map +1 -1
- package/dist/schemas.d.ts +47 -1
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +98 -8
- package/dist/schemas.js.map +1 -1
- package/dist/tools/bulk-update-products.tool.js +3 -3
- package/dist/tools/bulk-update-products.tool.js.map +1 -1
- package/dist/tools/create-discount.tool.d.ts +4 -0
- package/dist/tools/create-discount.tool.d.ts.map +1 -1
- package/dist/tools/create-discount.tool.js +12 -7
- package/dist/tools/create-discount.tool.js.map +1 -1
- package/dist/tools/create-manual-order.tool.d.ts +1 -0
- package/dist/tools/create-manual-order.tool.d.ts.map +1 -1
- package/dist/tools/create-manual-order.tool.js +7 -4
- package/dist/tools/create-manual-order.tool.js.map +1 -1
- package/dist/tools/create-model.tool.d.ts +1 -1
- package/dist/tools/create-sales-channel.tool.d.ts +1 -0
- package/dist/tools/create-sales-channel.tool.d.ts.map +1 -1
- package/dist/tools/create-sales-channel.tool.js +10 -3
- package/dist/tools/create-sales-channel.tool.js.map +1 -1
- package/dist/tools/get-discount.tool.js +1 -1
- package/dist/tools/get-discount.tool.js.map +1 -1
- package/dist/tools/get-price-list.tool.d.ts +1 -0
- package/dist/tools/get-price-list.tool.d.ts.map +1 -1
- package/dist/tools/get-price-list.tool.js +12 -3
- package/dist/tools/get-price-list.tool.js.map +1 -1
- package/dist/tools/get-record.tool.js +1 -1
- package/dist/tools/get-record.tool.js.map +1 -1
- package/dist/tools/mark-order-paid.tool.d.ts.map +1 -1
- package/dist/tools/mark-order-paid.tool.js +5 -2
- package/dist/tools/mark-order-paid.tool.js.map +1 -1
- package/dist/tools/record-order-payment.tool.d.ts.map +1 -1
- package/dist/tools/record-order-payment.tool.js +5 -2
- package/dist/tools/record-order-payment.tool.js.map +1 -1
- package/dist/tools/refund-order.tool.d.ts.map +1 -1
- package/dist/tools/refund-order.tool.js +2 -2
- package/dist/tools/refund-order.tool.js.map +1 -1
- package/dist/tools/remove-price-list-entries.tool.d.ts +1 -0
- package/dist/tools/remove-price-list-entries.tool.d.ts.map +1 -1
- package/dist/tools/remove-price-list-entries.tool.js +1 -1
- package/dist/tools/remove-price-list-entries.tool.js.map +1 -1
- package/dist/tools/set-price-list-entries.tool.d.ts +1 -0
- package/dist/tools/set-price-list-entries.tool.d.ts.map +1 -1
- package/dist/tools/set-price-list-entries.tool.js +1 -1
- package/dist/tools/set-price-list-entries.tool.js.map +1 -1
- package/dist/tools/set-price-list-entry.tool.d.ts +1 -0
- package/dist/tools/set-price-list-entry.tool.d.ts.map +1 -1
- package/dist/tools/set-price-list-entry.tool.js +1 -1
- package/dist/tools/set-price-list-entry.tool.js.map +1 -1
- package/dist/tools/set-product-currency-prices.tool.d.ts +17 -0
- package/dist/tools/set-product-currency-prices.tool.d.ts.map +1 -0
- package/dist/tools/set-product-currency-prices.tool.js +20 -0
- package/dist/tools/set-product-currency-prices.tool.js.map +1 -0
- package/dist/tools/set-product-tiers.tool.js +1 -1
- package/dist/tools/set-product-tiers.tool.js.map +1 -1
- package/dist/tools/set-product-variants.tool.d.ts +8 -0
- package/dist/tools/set-product-variants.tool.d.ts.map +1 -1
- package/dist/tools/set-product-variants.tool.js +11 -4
- package/dist/tools/set-product-variants.tool.js.map +1 -1
- package/dist/tools/update-cart-config.tool.d.ts +8 -0
- package/dist/tools/update-cart-config.tool.d.ts.map +1 -1
- package/dist/tools/update-cart-config.tool.js +10 -7
- package/dist/tools/update-cart-config.tool.js.map +1 -1
- package/dist/tools/update-discount.tool.d.ts +5 -1
- package/dist/tools/update-discount.tool.d.ts.map +1 -1
- package/dist/tools/update-discount.tool.js +11 -4
- package/dist/tools/update-discount.tool.js.map +1 -1
- package/dist/tools/update-model.tool.d.ts +1 -1
- package/dist/tools/update-sales-channel.tool.d.ts +1 -0
- package/dist/tools/update-sales-channel.tool.d.ts.map +1 -1
- package/dist/tools/update-sales-channel.tool.js +15 -6
- package/dist/tools/update-sales-channel.tool.js.map +1 -1
- package/dist/types.d.ts +54 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -15,17 +15,17 @@ const inputSchema = z.object({
|
|
|
15
15
|
.number()
|
|
16
16
|
.min(0)
|
|
17
17
|
.optional()
|
|
18
|
-
.describe("Set absolute price (major units - the stored price field value, 49.99 = $49.99)"),
|
|
18
|
+
.describe("Set absolute price (major units of the default currency - the stored price field value, 49.99 = $49.99)"),
|
|
19
19
|
adjustPrice: z
|
|
20
20
|
.number()
|
|
21
21
|
.optional()
|
|
22
|
-
.describe("Delta to price (major units, +/-)"),
|
|
22
|
+
.describe("Delta to price (major units of the default currency, +/-)"),
|
|
23
23
|
})
|
|
24
24
|
.describe("Single patch applied to every selected record"),
|
|
25
25
|
});
|
|
26
26
|
export const bulkUpdateProductsTool = {
|
|
27
27
|
name: "bulk_update_products",
|
|
28
|
-
description: "Bulk-update selected product records with a single patch (status, set/adjust stock, set/adjust price). Stock is whole units; price is major units - the stored price field value, not cents.",
|
|
28
|
+
description: "Bulk-update selected product records with a single patch (status, set/adjust stock, set/adjust price). Stock is whole units; price is major units - the stored price field value, not cents - and changes the default-currency price only; prices in additional currencies are left as they are.",
|
|
29
29
|
inputSchema,
|
|
30
30
|
requiredPermissions: ["models:edit"],
|
|
31
31
|
confirmGated: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk-update-products.tool.js","sourceRoot":"","sources":["../../src/tools/bulk-update-products.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,mDAAmD,CAAC;IAChE,SAAS,EAAE,sBAAsB;IACjC,KAAK,EAAE,CAAC;SACL,MAAM,CAAC;QACN,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC7B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;QACpE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACzE,QAAQ,EAAE,CAAC;aACR,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,EAAE;aACV,QAAQ,CACP,
|
|
1
|
+
{"version":3,"file":"bulk-update-products.tool.js","sourceRoot":"","sources":["../../src/tools/bulk-update-products.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,mDAAmD,CAAC;IAChE,SAAS,EAAE,sBAAsB;IACjC,KAAK,EAAE,CAAC;SACL,MAAM,CAAC;QACN,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC7B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;QACpE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACzE,QAAQ,EAAE,CAAC;aACR,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,EAAE;aACV,QAAQ,CACP,yGAAyG,CAC1G;QACH,WAAW,EAAE,CAAC;aACX,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,2DAA2D,CAAC;KACzE,CAAC;SACD,QAAQ,CAAC,+CAA+C,CAAC;CAC7D,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,sBAAsB,GAA+B;IAChE,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EACT,kSAAkS;IACpS,WAAW;IACX,mBAAmB,EAAE,CAAC,aAAa,CAAC;IACpC,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;QACpD,OAAO,GAAG,CAAC,QAAQ,CAAC,UAAU,CAC5B,OAAO,EACP,SAA6B,EAC7B,KAAK,CACN,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -11,6 +11,10 @@ declare const inputSchema: z.ZodObject<{
|
|
|
11
11
|
currency: z.ZodOptional<z.ZodString>;
|
|
12
12
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
13
13
|
minSubtotal: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
minSubtotalByCurrency: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
15
|
+
currency: z.ZodString;
|
|
16
|
+
amount: z.ZodNumber;
|
|
17
|
+
}, z.core.$strip>>>;
|
|
14
18
|
maxUses: z.ZodOptional<z.ZodNumber>;
|
|
15
19
|
startsAt: z.ZodOptional<z.ZodString>;
|
|
16
20
|
endsAt: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-discount.tool.d.ts","sourceRoot":"","sources":["../../src/tools/create-discount.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"create-discount.tool.d.ts","sourceRoot":"","sources":["../../src/tools/create-discount.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAO3D,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;iBA4Bf,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,KAAK,EAAE,eAAe,CAkC7D,CAAC"}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { isoDateTimeSchema } from "../schemas.js";
|
|
2
|
+
import { currencyAmountListSchema, currencyCodeSchema, isoDateTimeSchema, } from "../schemas.js";
|
|
3
3
|
const inputSchema = z.object({
|
|
4
4
|
code: z.string().min(3).max(32).describe("The discount code"),
|
|
5
5
|
type: z.enum(["percentage", "fixed", "free_shipping"]),
|
|
6
6
|
value: z
|
|
7
7
|
.number()
|
|
8
8
|
.describe("Percent (0-100), fixed amount in minor units, or 0"),
|
|
9
|
-
currency:
|
|
10
|
-
.string()
|
|
11
|
-
.length(3)
|
|
9
|
+
currency: currencyCodeSchema
|
|
12
10
|
.optional()
|
|
13
11
|
.describe("ISO 4217 code, required for 'fixed' type, omit otherwise"),
|
|
14
12
|
enabled: z.boolean().default(true),
|
|
15
13
|
minSubtotal: z
|
|
16
14
|
.number()
|
|
17
15
|
.optional()
|
|
18
|
-
.describe("Minimum
|
|
16
|
+
.describe("Minimum cart subtotal in minor units: of the code's own currency for 'fixed', of the default currency otherwise. With minSubtotalByCurrency set, omitting it means the code does not apply to default-currency carts, and 0 means it applies to them with no minimum"),
|
|
17
|
+
minSubtotalByCurrency: currencyAmountListSchema
|
|
18
|
+
.optional()
|
|
19
|
+
.describe("'percentage' and 'free_shipping' only: minimum subtotal for carts in each additional currency, e.g. [{currency: 'EUR', amount: 5000}]. A code with any minimum applies only in the currencies its minimums name - nothing is converted"),
|
|
19
20
|
maxUses: z.number().int().optional().describe("Total redemption cap"),
|
|
20
21
|
startsAt: isoDateTimeSchema
|
|
21
22
|
.optional()
|
|
@@ -26,16 +27,19 @@ const inputSchema = z.object({
|
|
|
26
27
|
});
|
|
27
28
|
export const createDiscountTool = {
|
|
28
29
|
name: "create_discount",
|
|
29
|
-
description: "Create a discount code. `type` is 'percentage' (value 0-100), 'fixed' (value in minor currency units, requires currency e.g. 'USD'), or 'free_shipping' (value 0). Optional limits: minSubtotal, maxUses, startsAt, endsAt.",
|
|
30
|
+
description: "Create a discount code. `type` is 'percentage' (value 0-100), 'fixed' (value in minor currency units, requires currency e.g. 'USD'; it applies only to carts in that currency), or 'free_shipping' (value 0). Optional limits: minSubtotal, maxUses, startsAt, endsAt. A cart is in its sales channel's currency; for a 'percentage' or 'free_shipping' code with a minimum, minSubtotal is the default-currency minimum and minSubtotalByCurrency the minimum in each additional currency.",
|
|
30
31
|
inputSchema,
|
|
31
32
|
requiredPermissions: ["discounts:manage"],
|
|
32
|
-
execute: async ({ code, type, value, currency, enabled, ...limits }, ops) => {
|
|
33
|
+
execute: async ({ code, type, value, currency, enabled, minSubtotalByCurrency, ...limits }, ops) => {
|
|
33
34
|
if (type === "fixed" && !currency) {
|
|
34
35
|
throw new Error("A 'fixed' discount requires a currency");
|
|
35
36
|
}
|
|
36
37
|
if (type !== "fixed" && currency) {
|
|
37
38
|
throw new Error(`A '${type}' discount must not set a currency`);
|
|
38
39
|
}
|
|
40
|
+
if (type === "fixed" && minSubtotalByCurrency?.length) {
|
|
41
|
+
throw new Error("A 'fixed' discount has one currency - set its minimum with minSubtotal");
|
|
42
|
+
}
|
|
39
43
|
if (type === "percentage" && value <= 0) {
|
|
40
44
|
throw new Error("A percentage discount must be greater than 0");
|
|
41
45
|
}
|
|
@@ -46,6 +50,7 @@ export const createDiscountTool = {
|
|
|
46
50
|
currency,
|
|
47
51
|
enabled,
|
|
48
52
|
...limits,
|
|
53
|
+
...(minSubtotalByCurrency !== undefined && { minSubtotalByCurrency }),
|
|
49
54
|
});
|
|
50
55
|
},
|
|
51
56
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-discount.tool.js","sourceRoot":"","sources":["../../src/tools/create-discount.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,
|
|
1
|
+
{"version":3,"file":"create-discount.tool.js","sourceRoot":"","sources":["../../src/tools/create-discount.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IAC7D,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;IACtD,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,QAAQ,CAAC,oDAAoD,CAAC;IACjE,QAAQ,EAAE,kBAAkB;SACzB,QAAQ,EAAE;SACV,QAAQ,CAAC,0DAA0D,CAAC;IACvE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAClC,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,sQAAsQ,CACvQ;IACH,qBAAqB,EAAE,wBAAwB;SAC5C,QAAQ,EAAE;SACV,QAAQ,CACP,wOAAwO,CACzO;IACH,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IACrE,QAAQ,EAAE,iBAAiB;SACxB,QAAQ,EAAE;SACV,QAAQ,CAAC,sCAAsC,CAAC;IACnD,MAAM,EAAE,iBAAiB;SACtB,QAAQ,EAAE;SACV,QAAQ,CAAC,gCAAgC,CAAC;CAC9C,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,kBAAkB,GAAmC;IAChE,IAAI,EAAE,iBAAiB;IACvB,WAAW,EACT,6dAA6d;IAC/d,WAAW;IACX,mBAAmB,EAAE,CAAC,kBAAkB,CAAC;IACzC,OAAO,EAAE,KAAK,EACZ,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,EAAE,GAAG,MAAM,EAAE,EAC1E,GAAG,EACH,EAAE;QACF,IAAI,IAAI,KAAK,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5D,CAAC;QACD,IAAI,IAAI,KAAK,OAAO,IAAI,QAAQ,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,MAAM,IAAI,oCAAoC,CAAC,CAAC;QAClE,CAAC;QACD,IAAI,IAAI,KAAK,OAAO,IAAI,qBAAqB,EAAE,MAAM,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CACb,wEAAwE,CACzE,CAAC;QACJ,CAAC;QACD,IAAI,IAAI,KAAK,YAAY,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAClE,CAAC;QACD,OAAO,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC;YAC1B,IAAI;YACJ,IAAI;YACJ,KAAK;YACL,QAAQ;YACR,OAAO;YACP,GAAG,MAAM;YACT,GAAG,CAAC,qBAAqB,KAAK,SAAS,IAAI,EAAE,qBAAqB,EAAE,CAAC;SACtE,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -22,6 +22,7 @@ declare const inputSchema: z.ZodObject<{
|
|
|
22
22
|
phone: z.ZodOptional<z.ZodString>;
|
|
23
23
|
vatId: z.ZodOptional<z.ZodString>;
|
|
24
24
|
}, z.core.$strip>>;
|
|
25
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
25
26
|
}, z.core.$strip>;
|
|
26
27
|
type Input = z.infer<typeof inputSchema>;
|
|
27
28
|
export declare const createManualOrderTool: AiTool<Input, OrderWriteResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-manual-order.tool.d.ts","sourceRoot":"","sources":["../../src/tools/create-manual-order.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAkB,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"create-manual-order.tool.d.ts","sourceRoot":"","sources":["../../src/tools/create-manual-order.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAkB,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAO5E,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;iBAcf,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,KAAK,EAAE,gBAAgB,CAkBjE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { orderAddressSchema, orderItemSchema } from "../schemas.js";
|
|
2
|
+
import { currencyCodeSchema, orderAddressSchema, orderItemSchema, } from "../schemas.js";
|
|
3
3
|
const inputSchema = z.object({
|
|
4
4
|
customerEmail: z.string().describe("Customer email for the order"),
|
|
5
5
|
customerId: z.string().optional(),
|
|
@@ -7,14 +7,17 @@ const inputSchema = z.object({
|
|
|
7
7
|
shippingAddress: orderAddressSchema
|
|
8
8
|
.optional()
|
|
9
9
|
.describe("Delivery address. Its country decides reverse charge for a buyer whose company has a verified VAT id"),
|
|
10
|
+
currency: currencyCodeSchema
|
|
11
|
+
.optional()
|
|
12
|
+
.describe("The order's currency: omit for the default currency, or one of the workspace's additional currencies. Product lines are priced in it - a product with no price in it is refused (NO_PRICE_IN_CURRENCY) - and ad-hoc line prices are minor units of it"),
|
|
10
13
|
});
|
|
11
14
|
export const createManualOrderTool = {
|
|
12
15
|
name: "create_manual_order",
|
|
13
|
-
description: "Create a manual (admin-entered) order. Each item references a product recordId or is an ad-hoc line with name+price (minor units). shippingAddress is optional; for a customer of a company with a verified VAT id its country decides whether the order is reverse charge, and the order freezes that tax treatment (get_order taxTreatment).",
|
|
16
|
+
description: "Create a manual (admin-entered) order. Each item references a product recordId or is an ad-hoc line with name+price (minor units of the order's currency). currency picks the order's currency (default currency when omitted); payments and refunds on the order are in that currency. shippingAddress is optional; for a customer of a company with a verified VAT id its country decides whether the order is reverse charge, and the order freezes that tax treatment (get_order taxTreatment).",
|
|
14
17
|
inputSchema,
|
|
15
18
|
requiredPermissions: ["orders:manage"],
|
|
16
|
-
execute: async ({ customerEmail, customerId, items, shippingAddress }, ops) => {
|
|
17
|
-
return ops.orders.createManual(customerEmail, items, customerId, shippingAddress);
|
|
19
|
+
execute: async ({ customerEmail, customerId, items, shippingAddress, currency }, ops) => {
|
|
20
|
+
return ops.orders.createManual(customerEmail, items, customerId, shippingAddress, currency);
|
|
18
21
|
},
|
|
19
22
|
};
|
|
20
23
|
//# sourceMappingURL=create-manual-order.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-manual-order.tool.js","sourceRoot":"","sources":["../../src/tools/create-manual-order.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,
|
|
1
|
+
{"version":3,"file":"create-manual-order.tool.js","sourceRoot":"","sources":["../../src/tools/create-manual-order.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,GAChB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IAClE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,yBAAyB,CAAC;IACjE,eAAe,EAAE,kBAAkB;SAChC,QAAQ,EAAE;SACV,QAAQ,CACP,sGAAsG,CACvG;IACH,QAAQ,EAAE,kBAAkB;SACzB,QAAQ,EAAE;SACV,QAAQ,CACP,uPAAuP,CACxP;CACJ,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,qBAAqB,GAAoC;IACpE,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EACT,qeAAqe;IACve,WAAW;IACX,mBAAmB,EAAE,CAAC,eAAe,CAAC;IACtC,OAAO,EAAE,KAAK,EACZ,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,EAC/D,GAAG,EACH,EAAE;QACF,OAAO,GAAG,CAAC,MAAM,CAAC,YAAY,CAC5B,aAAa,EACb,KAAyB,EACzB,UAAU,EACV,eAAe,EACf,QAAQ,CACT,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -31,7 +31,7 @@ declare const inputSchema: z.ZodObject<{
|
|
|
31
31
|
priceField: z.ZodOptional<z.ZodString>;
|
|
32
32
|
inventoryField: z.ZodOptional<z.ZodString>;
|
|
33
33
|
nameField: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
-
currencyField: z.ZodOptional<z.
|
|
34
|
+
currencyField: z.ZodOptional<z.ZodNull>;
|
|
35
35
|
imageField: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
36
36
|
taxRateField: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
37
37
|
}, z.core.$strip>>;
|
|
@@ -12,6 +12,7 @@ declare const inputSchema: z.ZodObject<{
|
|
|
12
12
|
MEMBERS: "MEMBERS";
|
|
13
13
|
COMPANY_MEMBERS: "COMPANY_MEMBERS";
|
|
14
14
|
}>>;
|
|
15
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
15
16
|
}, z.core.$strip>;
|
|
16
17
|
type Input = z.infer<typeof inputSchema>;
|
|
17
18
|
export declare const createSalesChannelTool: AiTool<Input, SalesChannelSummary>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-sales-channel.tool.d.ts","sourceRoot":"","sources":["../../src/tools/create-sales-channel.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"create-sales-channel.tool.d.ts","sourceRoot":"","sources":["../../src/tools/create-sales-channel.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAQ/D,QAAA,MAAM,WAAW;;;;;;;;;;;;;iBAaf,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,KAAK,EAAE,mBAAmB,CAcrE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { SALES_CHANNEL_NAME_MAX_LEN } from "@cmssy/types";
|
|
3
|
-
import { channelPriceAccessSchema, priceDisplayModeSchema, salesChannelKeySchema, } from "../schemas.js";
|
|
3
|
+
import { channelCurrencySchema, channelPriceAccessSchema, priceDisplayModeSchema, salesChannelKeySchema, } from "../schemas.js";
|
|
4
4
|
const inputSchema = z.object({
|
|
5
5
|
key: salesChannelKeySchema.describe("What the storefront sends as channel: 1-40 lowercase letters and digits, words joined by - or _ (e.g. 'horeca'). Cannot change later; orders keep it."),
|
|
6
6
|
name: z
|
|
@@ -11,12 +11,19 @@ const inputSchema = z.object({
|
|
|
11
11
|
.describe("Display name, e.g. 'HoReCa'"),
|
|
12
12
|
displayMode: priceDisplayModeSchema.optional(),
|
|
13
13
|
priceAccess: channelPriceAccessSchema.optional(),
|
|
14
|
+
currency: channelCurrencySchema.optional(),
|
|
14
15
|
});
|
|
15
16
|
export const createSalesChannelTool = {
|
|
16
17
|
name: "create_sales_channel",
|
|
17
|
-
description: "Create a sales channel, at most 20 per workspace; a duplicate key is refused. The channel prices nothing until a price list is published to it (create_price_list / update_price_list with channels): one undated base list plus dated lists whose windows do not overlap. Channel keys are public - any storefront can send one - so priceAccess decides who sees its prices and may buy through it.",
|
|
18
|
+
description: "Create a sales channel, at most 20 per workspace; a duplicate key is refused. The channel prices nothing until a price list is published to it (create_price_list / update_price_list with channels): one undated base list plus dated lists whose windows do not overlap. Channel keys are public - any storefront can send one - so priceAccess decides who sees its prices and may buy through it. currency picks what the channel sells in (the default currency when omitted): its carts, orders, shipping and discounts are in it, and a product with no price in it is not sold there.",
|
|
18
19
|
inputSchema,
|
|
19
20
|
requiredPermissions: ["models:edit"],
|
|
20
|
-
execute: async ({ key, name, displayMode, priceAccess }, ops) => ops.salesChannels.create({
|
|
21
|
+
execute: async ({ key, name, displayMode, priceAccess, currency }, ops) => ops.salesChannels.create({
|
|
22
|
+
key,
|
|
23
|
+
name,
|
|
24
|
+
displayMode,
|
|
25
|
+
priceAccess,
|
|
26
|
+
...(currency !== undefined && { currency }),
|
|
27
|
+
}),
|
|
21
28
|
};
|
|
22
29
|
//# sourceMappingURL=create-sales-channel.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-sales-channel.tool.js","sourceRoot":"","sources":["../../src/tools/create-sales-channel.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,GAAG,EAAE,qBAAqB,CAAC,QAAQ,CACjC,uJAAuJ,CACxJ;IACD,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,0BAA0B,CAAC;SAC/B,QAAQ,CAAC,6BAA6B,CAAC;IAC1C,WAAW,EAAE,sBAAsB,CAAC,QAAQ,EAAE;IAC9C,WAAW,EAAE,wBAAwB,CAAC,QAAQ,EAAE;
|
|
1
|
+
{"version":3,"file":"create-sales-channel.tool.js","sourceRoot":"","sources":["../../src/tools/create-sales-channel.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,GAAG,EAAE,qBAAqB,CAAC,QAAQ,CACjC,uJAAuJ,CACxJ;IACD,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,0BAA0B,CAAC;SAC/B,QAAQ,CAAC,6BAA6B,CAAC;IAC1C,WAAW,EAAE,sBAAsB,CAAC,QAAQ,EAAE;IAC9C,WAAW,EAAE,wBAAwB,CAAC,QAAQ,EAAE;IAChD,QAAQ,EAAE,qBAAqB,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,sBAAsB,GAAuC;IACxE,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EACT,+jBAA+jB;IACjkB,WAAW;IACX,mBAAmB,EAAE,CAAC,aAAa,CAAC;IACpC,OAAO,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,EAAE,CACxE,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC;QACvB,GAAG;QACH,IAAI;QACJ,WAAW;QACX,WAAW;QACX,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,CAAC;KAC5C,CAAC;CACL,CAAC"}
|
|
@@ -7,7 +7,7 @@ const inputSchema = z.object({
|
|
|
7
7
|
});
|
|
8
8
|
export const getDiscountTool = {
|
|
9
9
|
name: "get_discount",
|
|
10
|
-
description: "Get one discount's full details
|
|
10
|
+
description: "Get one discount's full details by id or code: type, value, currency, minSubtotal (default currency, or a fixed code's own), minSubtotalByCurrency (per additional currency), usage limits and validity window.",
|
|
11
11
|
inputSchema,
|
|
12
12
|
requiredPermissions: ["discounts:view"],
|
|
13
13
|
execute: async ({ idOrSlug }, ops) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-discount.tool.js","sourceRoot":"","sources":["../../src/tools/get-discount.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,iDAAiD,CAAC;CAC/D,CAAC,CAAC;AAOH,MAAM,CAAC,MAAM,eAAe,GAA0B;IACpD,IAAI,EAAE,cAAc;IACpB,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"get-discount.tool.js","sourceRoot":"","sources":["../../src/tools/get-discount.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,iDAAiD,CAAC;CAC/D,CAAC,CAAC;AAOH,MAAM,CAAC,MAAM,eAAe,GAA0B;IACpD,IAAI,EAAE,cAAc;IACpB,WAAW,EACT,iNAAiN;IACnN,WAAW;IACX,mBAAmB,EAAE,CAAC,gBAAgB,CAAC;IACvC,OAAO,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,EAAE;QACnC,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;QACpC,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,CAAC;IACtC,CAAC;CACF,CAAC"}
|
|
@@ -3,6 +3,7 @@ import type { AiTool, PriceListEntry, PriceListSummary } from "../types.js";
|
|
|
3
3
|
declare const inputSchema: z.ZodObject<{
|
|
4
4
|
id: z.ZodString;
|
|
5
5
|
recordId: z.ZodOptional<z.ZodString>;
|
|
6
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
6
7
|
first: z.ZodOptional<z.ZodNumber>;
|
|
7
8
|
after: z.ZodOptional<z.ZodString>;
|
|
8
9
|
}, z.core.$strip>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-price-list.tool.d.ts","sourceRoot":"","sources":["../../src/tools/get-price-list.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"get-price-list.tool.d.ts","sourceRoot":"","sources":["../../src/tools/get-price-list.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG5E,QAAA,MAAM,WAAW;;;;;;iBAwBf,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,KAAK,MAAM,GACP,CAAC;IAAE,KAAK,EAAE,IAAI,CAAA;CAAE,GAAG,gBAAgB,GAAG;IAClC,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC,GACJ;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjC,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAwBlD,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { currencyCodeSchema } from "../schemas.js";
|
|
2
3
|
const inputSchema = z.object({
|
|
3
4
|
id: z.string().min(1).describe("The price list's id (from list_price_lists)"),
|
|
4
5
|
recordId: z
|
|
@@ -6,6 +7,9 @@ const inputSchema = z.object({
|
|
|
6
7
|
.min(1)
|
|
7
8
|
.optional()
|
|
8
9
|
.describe("Only the fixed prices for this product record"),
|
|
10
|
+
currency: currencyCodeSchema
|
|
11
|
+
.optional()
|
|
12
|
+
.describe("The currency whose rows to page; omit for the default currency's rows. overrideCountByCurrency names the currencies the list holds rows in"),
|
|
9
13
|
first: z
|
|
10
14
|
.number()
|
|
11
15
|
.int()
|
|
@@ -21,15 +25,20 @@ const inputSchema = z.object({
|
|
|
21
25
|
});
|
|
22
26
|
export const getPriceListTool = {
|
|
23
27
|
name: "get_price_list",
|
|
24
|
-
description: "Get one price list by id with a page of its fixed prices (entries, oldest first, at most 200 per page; pass nextCursor back as after for the next page, null on the last). An entry is a fixed unit price in minor units for one product (variantKey null) or one variant of a product with variants, with its own volume breaks (tiers), its order bounds (minQuantity / maxQuantity, null = none) and the product's currency; recordMissing true means the product or variant was removed and the entry prices nothing - remove it with remove_price_list_entries. Filter by recordId to see one product's entries. Read-only.",
|
|
28
|
+
description: "Get one price list by id with a page of its fixed prices (entries, oldest first, at most 200 per page; pass nextCursor back as after for the next page, null on the last). An entry is a fixed unit price in minor units for one product (variantKey null) or one variant of a product with variants, with its own volume breaks (tiers), its order bounds (minQuantity / maxQuantity, null = none) and its currency (an additional currency's row names it; a default-currency row reads the product's currency); recordMissing true means the product or variant was removed and the entry prices nothing - remove it with remove_price_list_entries. Filter by recordId to see one product's entries. Read-only.",
|
|
25
29
|
inputSchema,
|
|
26
30
|
requiredPermissions: ["models:view"],
|
|
27
|
-
execute: async ({ id, recordId, first, after }, ops) => {
|
|
31
|
+
execute: async ({ id, recordId, currency, first, after }, ops) => {
|
|
28
32
|
const list = await ops.priceLists.get(id);
|
|
29
33
|
if (!list) {
|
|
30
34
|
return { found: false, id };
|
|
31
35
|
}
|
|
32
|
-
const page = await ops.priceLists.entries(id, {
|
|
36
|
+
const page = await ops.priceLists.entries(id, {
|
|
37
|
+
recordId,
|
|
38
|
+
first,
|
|
39
|
+
after,
|
|
40
|
+
...(currency !== undefined && { currency }),
|
|
41
|
+
});
|
|
33
42
|
return {
|
|
34
43
|
found: true,
|
|
35
44
|
...list,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-price-list.tool.js","sourceRoot":"","sources":["../../src/tools/get-price-list.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"get-price-list.tool.js","sourceRoot":"","sources":["../../src/tools/get-price-list.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,6CAA6C,CAAC;IAC7E,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,EAAE;SACV,QAAQ,CAAC,+CAA+C,CAAC;IAC5D,QAAQ,EAAE,kBAAkB;SACzB,QAAQ,EAAE;SACV,QAAQ,CACP,4IAA4I,CAC7I;IACH,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,+BAA+B,CAAC;IAC5C,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,EAAE;SACV,QAAQ,CAAC,mCAAmC,CAAC;CACjD,CAAC,CAAC;AAWH,MAAM,CAAC,MAAM,gBAAgB,GAA0B;IACrD,IAAI,EAAE,gBAAgB;IACtB,WAAW,EACT,qrBAAqrB;IACvrB,WAAW;IACX,mBAAmB,EAAE,CAAC,aAAa,CAAC;IACpC,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;QAC/D,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;QAC9B,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,EAAE;YAC5C,QAAQ;YACR,KAAK;YACL,KAAK;YACL,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,CAAC;SAC5C,CAAC,CAAC;QACH,OAAO;YACL,KAAK,EAAE,IAAI;YACX,GAAG,IAAI;YACP,OAAO,EAAE,IAAI,CAAC,KAAK;YACnB,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -4,7 +4,7 @@ const inputSchema = z.object({
|
|
|
4
4
|
});
|
|
5
5
|
export const getRecordTool = {
|
|
6
6
|
name: "get_record",
|
|
7
|
-
description: "Get one record (entry) of a data model by its id, including all its field values and status. A company record (a model with the Company capability) also carries vatId, vatCountry, vatVerifiedAt, vatVerifiedBy and taxExemptReason, null when unset (set_company_vat_id, set_company_vat_verified, set_company_tax_exemption).",
|
|
7
|
+
description: "Get one record (entry) of a data model by its id, including all its field values and status. A company record (a model with the Company capability) also carries vatId, vatCountry, vatVerifiedAt, vatVerifiedBy and taxExemptReason, null when unset (set_company_vat_id, set_company_vat_verified, set_company_tax_exemption). A product record also carries currencyPrices and variantCurrencyPrices - its prices in additional currencies, minor units, enabled false while that currency is not an additional currency (set_product_currency_prices, set_product_variants); its data holds the default-currency price.",
|
|
8
8
|
inputSchema,
|
|
9
9
|
requiredPermissions: ["models:view"],
|
|
10
10
|
execute: async ({ recordId }, ops) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-record.tool.js","sourceRoot":"","sources":["../../src/tools/get-record.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,qCAAqC,CAAC;CAC5E,CAAC,CAAC;AAOH,MAAM,CAAC,MAAM,aAAa,GAA0B;IAClD,IAAI,EAAE,YAAY;IAClB,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"get-record.tool.js","sourceRoot":"","sources":["../../src/tools/get-record.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,qCAAqC,CAAC;CAC5E,CAAC,CAAC;AAOH,MAAM,CAAC,MAAM,aAAa,GAA0B;IAClD,IAAI,EAAE,YAAY;IAClB,WAAW,EACT,6lBAA6lB;IAC/lB,WAAW;IACX,mBAAmB,EAAE,CAAC,aAAa,CAAC;IACpC,OAAO,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,EAAE;QACnC,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACpD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;QACpC,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IACpC,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mark-order-paid.tool.d.ts","sourceRoot":"","sources":["../../src/tools/mark-order-paid.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE5D,QAAA,MAAM,WAAW;;;;;
|
|
1
|
+
{"version":3,"file":"mark-order-paid.tool.d.ts","sourceRoot":"","sources":["../../src/tools/mark-order-paid.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE5D,QAAA,MAAM,WAAW;;;;;iBAQf,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,KAAK,EAAE,gBAAgB,CAS7D,CAAC"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
const inputSchema = z.object({
|
|
3
3
|
orderId: z.string().min(1),
|
|
4
|
-
amount: z
|
|
4
|
+
amount: z
|
|
5
|
+
.number()
|
|
6
|
+
.int()
|
|
7
|
+
.describe("Amount in minor units of the order's currency (cents)"),
|
|
5
8
|
reference: z.string().describe("Payment reference / receipt id"),
|
|
6
9
|
provider: z.string().describe("Payment provider label, e.g. 'manual'"),
|
|
7
10
|
});
|
|
8
11
|
export const markOrderPaidTool = {
|
|
9
12
|
name: "mark_order_paid",
|
|
10
|
-
description: "Record a full payment for an order (manual reconciliation - does NOT verify with a payment provider). amount is in minor units.",
|
|
13
|
+
description: "Record a full payment for an order (manual reconciliation - does NOT verify with a payment provider). amount is in minor units of the order's currency.",
|
|
11
14
|
inputSchema,
|
|
12
15
|
requiredPermissions: ["orders:manage"],
|
|
13
16
|
execute: async ({ orderId, amount, reference, provider }, ops) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mark-order-paid.tool.js","sourceRoot":"","sources":["../../src/tools/mark-order-paid.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,MAAM,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"mark-order-paid.tool.js","sourceRoot":"","sources":["../../src/tools/mark-order-paid.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,CAAC,uDAAuD,CAAC;IACpE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;IAChE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;CACvE,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,iBAAiB,GAAoC;IAChE,IAAI,EAAE,iBAAiB;IACvB,WAAW,EACT,yJAAyJ;IAC3J,WAAW;IACX,mBAAmB,EAAE,CAAC,eAAe,CAAC;IACtC,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,EAAE;QAC/D,OAAO,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;IACvE,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-order-payment.tool.d.ts","sourceRoot":"","sources":["../../src/tools/record-order-payment.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE5D,QAAA,MAAM,WAAW;;;;;
|
|
1
|
+
{"version":3,"file":"record-order-payment.tool.d.ts","sourceRoot":"","sources":["../../src/tools/record-order-payment.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE5D,QAAA,MAAM,WAAW;;;;;iBAQf,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,KAAK,EAAE,gBAAgB,CASlE,CAAC"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
const inputSchema = z.object({
|
|
3
3
|
orderId: z.string().min(1),
|
|
4
|
-
amount: z
|
|
4
|
+
amount: z
|
|
5
|
+
.number()
|
|
6
|
+
.int()
|
|
7
|
+
.describe("Amount in minor units of the order's currency (cents)"),
|
|
5
8
|
reference: z.string().describe("Payment reference / receipt id"),
|
|
6
9
|
provider: z.string().optional(),
|
|
7
10
|
});
|
|
8
11
|
export const recordOrderPaymentTool = {
|
|
9
12
|
name: "record_order_payment",
|
|
10
|
-
description: "Record a (possibly partial) payment against an order's outstanding balance. amount is in minor units and capped at the balance due.",
|
|
13
|
+
description: "Record a (possibly partial) payment against an order's outstanding balance. amount is in minor units of the order's currency and capped at the balance due.",
|
|
11
14
|
inputSchema,
|
|
12
15
|
requiredPermissions: ["orders:manage"],
|
|
13
16
|
execute: async ({ orderId, amount, reference, provider }, ops) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-order-payment.tool.js","sourceRoot":"","sources":["../../src/tools/record-order-payment.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,MAAM,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"record-order-payment.tool.js","sourceRoot":"","sources":["../../src/tools/record-order-payment.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,CAAC,uDAAuD,CAAC;IACpE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;IAChE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,sBAAsB,GAAoC;IACrE,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EACT,6JAA6J;IAC/J,WAAW;IACX,mBAAmB,EAAE,CAAC,eAAe,CAAC;IACtC,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,EAAE;QAC/D,OAAO,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC5E,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refund-order.tool.d.ts","sourceRoot":"","sources":["../../src/tools/refund-order.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE5D,QAAA,MAAM,WAAW;;;;
|
|
1
|
+
{"version":3,"file":"refund-order.tool.d.ts","sourceRoot":"","sources":["../../src/tools/refund-order.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE5D,QAAA,MAAM,WAAW;;;;iBAUf,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,KAAK,EAAE,gBAAgB,CAU3D,CAAC"}
|
|
@@ -6,11 +6,11 @@ const inputSchema = z.object({
|
|
|
6
6
|
.number()
|
|
7
7
|
.int()
|
|
8
8
|
.optional()
|
|
9
|
-
.describe("Partial refund amount in minor units; omit for full refund"),
|
|
9
|
+
.describe("Partial refund amount in minor units of the order's currency; omit for full refund"),
|
|
10
10
|
});
|
|
11
11
|
export const refundOrderTool = {
|
|
12
12
|
name: "refund_order",
|
|
13
|
-
description: "Refund an order. Omit amount for a full refund; pass amount (minor units) for a partial refund.",
|
|
13
|
+
description: "Refund an order. Omit amount for a full refund; pass amount (minor units of the order's currency) for a partial refund.",
|
|
14
14
|
inputSchema,
|
|
15
15
|
requiredPermissions: ["orders:manage"],
|
|
16
16
|
confirmGated: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refund-order.tool.js","sourceRoot":"","sources":["../../src/tools/refund-order.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IAC/D,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,
|
|
1
|
+
{"version":3,"file":"refund-order.tool.js","sourceRoot":"","sources":["../../src/tools/refund-order.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IAC/D,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,CACP,oFAAoF,CACrF;CACJ,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,eAAe,GAAoC;IAC9D,IAAI,EAAE,cAAc;IACpB,WAAW,EACT,yHAAyH;IAC3H,WAAW;IACX,mBAAmB,EAAE,CAAC,eAAe,CAAC;IACtC,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE;QACrD,OAAO,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACvD,CAAC;CACF,CAAC"}
|
|
@@ -5,6 +5,7 @@ declare const inputSchema: z.ZodObject<{
|
|
|
5
5
|
keys: z.ZodArray<z.ZodObject<{
|
|
6
6
|
recordId: z.ZodString;
|
|
7
7
|
variantKey: z.ZodOptional<z.ZodString>;
|
|
8
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
8
9
|
}, z.core.$strip>>;
|
|
9
10
|
}, z.core.$strip>;
|
|
10
11
|
type Input = z.infer<typeof inputSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-price-list-entries.tool.d.ts","sourceRoot":"","sources":["../../src/tools/remove-price-list-entries.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,QAAA,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"remove-price-list-entries.tool.d.ts","sourceRoot":"","sources":["../../src/tools/remove-price-list-entries.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,QAAA,MAAM,WAAW;;;;;;;iBAUf,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,UAAU,MAAM;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAW5D,CAAC"}
|
|
@@ -13,7 +13,7 @@ const inputSchema = z.object({
|
|
|
13
13
|
});
|
|
14
14
|
export const removePriceListEntriesTool = {
|
|
15
15
|
name: "remove_price_list_entries",
|
|
16
|
-
description: "Remove up to 1000 fixed prices from a price list by key: recordId alone for a product without variants, recordId + variantKey for one variant of a product with variants. Those products then fall back to the catalogue price minus the list's percentOff. Returns how many were removed; a key with no entry removes nothing.",
|
|
16
|
+
description: "Remove up to 1000 fixed prices from a price list by key: recordId alone for a product without variants, recordId + variantKey for one variant of a product with variants; currency limits a key to that currency's row, without it every currency's row goes. Those products then fall back to the catalogue price minus the list's percentOff. Returns how many were removed; a key with no entry removes nothing.",
|
|
17
17
|
inputSchema,
|
|
18
18
|
requiredPermissions: ["models:edit"],
|
|
19
19
|
confirmGated: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-price-list-entries.tool.js","sourceRoot":"","sources":["../../src/tools/remove-price-list-entries.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,6CAA6C,CAAC;IAC1D,IAAI,EAAE,CAAC;SACJ,KAAK,CAAC,uBAAuB,CAAC;SAC9B,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,IAAI,CAAC;SACT,QAAQ,CAAC,+DAA+D,CAAC;CAC7E,CAAC,CAAC;AASH,MAAM,CAAC,MAAM,0BAA0B,GAA0B;IAC/D,IAAI,EAAE,2BAA2B;IACjC,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"remove-price-list-entries.tool.js","sourceRoot":"","sources":["../../src/tools/remove-price-list-entries.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,6CAA6C,CAAC;IAC1D,IAAI,EAAE,CAAC;SACJ,KAAK,CAAC,uBAAuB,CAAC;SAC9B,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,IAAI,CAAC;SACT,QAAQ,CAAC,+DAA+D,CAAC;CAC7E,CAAC,CAAC;AASH,MAAM,CAAC,MAAM,0BAA0B,GAA0B;IAC/D,IAAI,EAAE,2BAA2B;IACjC,WAAW,EACT,qZAAqZ;IACvZ,WAAW;IACX,mBAAmB,EAAE,CAAC,aAAa,CAAC;IACpC,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE;QAC5C,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QACtE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;IAClC,CAAC;CACF,CAAC"}
|
|
@@ -5,6 +5,7 @@ declare const inputSchema: z.ZodObject<{
|
|
|
5
5
|
entries: z.ZodArray<z.ZodObject<{
|
|
6
6
|
recordId: z.ZodString;
|
|
7
7
|
variantKey: z.ZodOptional<z.ZodString>;
|
|
8
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
8
9
|
price: z.ZodNumber;
|
|
9
10
|
tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
10
11
|
minQty: z.ZodNumber;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-price-list-entries.tool.d.ts","sourceRoot":"","sources":["../../src/tools/set-price-list-entries.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,QAAA,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"set-price-list-entries.tool.d.ts","sourceRoot":"","sources":["../../src/tools/set-price-list-entries.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,QAAA,MAAM,WAAW;;;;;;;;;;;;;;iBAUf,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,UAAU,MAAM;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAWzD,CAAC"}
|
|
@@ -13,7 +13,7 @@ const inputSchema = z.object({
|
|
|
13
13
|
});
|
|
14
14
|
export const setPriceListEntriesTool = {
|
|
15
15
|
name: "set_price_list_entries",
|
|
16
|
-
description: "Upsert up to 1000 fixed prices on a price list in one call (an ERP or spreadsheet import). Each row is one product (no variantKey) or one variant of a product with variants (variantKey required there), price in minor units with optional volume breaks and optional minQuantity / maxQuantity order bounds; a row replaces the whole entry already set for the same product/variant, so bounds it had are cleared unless the row re-sends them (read them with get_price_list); every other entry stays. All or nothing: one invalid row refuses the whole call and the error names every bad row by index. Fixed prices override the list's percentOff. Never removes entries - use remove_price_list_entries for that.",
|
|
16
|
+
description: "Upsert up to 1000 fixed prices on a price list in one call (an ERP or spreadsheet import). Each row is one product (no variantKey) or one variant of a product with variants (variantKey required there), price in minor units of the row's currency (currency omitted = the default currency; an additional currency writes that currency's own row) with optional volume breaks and optional minQuantity / maxQuantity order bounds; a row replaces the whole entry already set for the same product/variant and currency, so bounds it had are cleared unless the row re-sends them (read them with get_price_list); every other entry stays. All or nothing: one invalid row refuses the whole call and the error names every bad row by index. Fixed prices override the list's percentOff. Never removes entries - use remove_price_list_entries for that.",
|
|
17
17
|
inputSchema,
|
|
18
18
|
requiredPermissions: ["models:edit"],
|
|
19
19
|
confirmGated: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-price-list-entries.tool.js","sourceRoot":"","sources":["../../src/tools/set-price-list-entries.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,6CAA6C,CAAC;IAC1D,OAAO,EAAE,CAAC;SACP,KAAK,CAAC,oBAAoB,CAAC;SAC3B,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,IAAI,CAAC;SACT,QAAQ,CAAC,yBAAyB,CAAC;CACvC,CAAC,CAAC;AASH,MAAM,CAAC,MAAM,uBAAuB,GAA0B;IAC5D,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"set-price-list-entries.tool.js","sourceRoot":"","sources":["../../src/tools/set-price-list-entries.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,6CAA6C,CAAC;IAC1D,OAAO,EAAE,CAAC;SACP,KAAK,CAAC,oBAAoB,CAAC;SAC3B,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,IAAI,CAAC;SACT,QAAQ,CAAC,yBAAyB,CAAC;CACvC,CAAC,CAAC;AASH,MAAM,CAAC,MAAM,uBAAuB,GAA0B;IAC5D,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EACT,k0BAAk0B;IACp0B,WAAW;IACX,mBAAmB,EAAE,CAAC,aAAa,CAAC;IACpC,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE;QAC/C,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACtE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;IAClC,CAAC;CACF,CAAC"}
|
|
@@ -3,6 +3,7 @@ import type { AiTool, PriceListEntry } from "../types.js";
|
|
|
3
3
|
declare const inputSchema: z.ZodObject<{
|
|
4
4
|
recordId: z.ZodString;
|
|
5
5
|
variantKey: z.ZodOptional<z.ZodString>;
|
|
6
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
6
7
|
price: z.ZodNumber;
|
|
7
8
|
tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
8
9
|
minQty: z.ZodNumber;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-price-list-entry.tool.d.ts","sourceRoot":"","sources":["../../src/tools/set-price-list-entry.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG1D,QAAA,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"set-price-list-entry.tool.d.ts","sourceRoot":"","sources":["../../src/tools/set-price-list-entry.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG1D,QAAA,MAAM,WAAW;;;;;;;;;;;;iBAOmB,CAAC;AAErC,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,KAAK,EAAE,cAAc,CAQ/D,CAAC"}
|
|
@@ -10,7 +10,7 @@ const inputSchema = priceListEntryShape
|
|
|
10
10
|
.superRefine(refinePriceListEntry);
|
|
11
11
|
export const setPriceListEntryTool = {
|
|
12
12
|
name: "set_price_list_entry",
|
|
13
|
-
description: "Set a price list's fixed price for one product, or one variant of a product with variants (variantKey required there - a list prices each variant on its own, never the product as a whole; omit it for a product without variants). The fixed price (minor units, with optional volume breaks) overrides the list's percentOff for that product or variant; replaces the entry already set for it as a whole, so an existing minQuantity / maxQuantity left out of the call is cleared - read it with get_price_list and re-send it to keep it. For many rows use set_price_list_entries.",
|
|
13
|
+
description: "Set a price list's fixed price for one product, or one variant of a product with variants (variantKey required there - a list prices each variant on its own, never the product as a whole; omit it for a product without variants). currency picks the row: omitted is the default-currency row, an additional currency writes that currency's own row, which prices only carts in it. The fixed price (minor units of the row's currency, with optional volume breaks) overrides the list's percentOff for that product or variant; replaces the entry already set for it as a whole, so an existing minQuantity / maxQuantity left out of the call is cleared - read it with get_price_list and re-send it to keep it. For many rows use set_price_list_entries.",
|
|
14
14
|
inputSchema,
|
|
15
15
|
requiredPermissions: ["models:edit"],
|
|
16
16
|
execute: async ({ priceListId, ...entry }, ops) => ops.priceLists.setEntry(priceListId, entry),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-price-list-entry.tool.js","sourceRoot":"","sources":["../../src/tools/set-price-list-entry.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1E,MAAM,WAAW,GAAG,mBAAmB;KACpC,MAAM,CAAC;IACN,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,6CAA6C,CAAC;CAC3D,CAAC;KACD,WAAW,CAAC,oBAAoB,CAAC,CAAC;AAIrC,MAAM,CAAC,MAAM,qBAAqB,GAAkC;IAClE,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"set-price-list-entry.tool.js","sourceRoot":"","sources":["../../src/tools/set-price-list-entry.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1E,MAAM,WAAW,GAAG,mBAAmB;KACpC,MAAM,CAAC;IACN,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,6CAA6C,CAAC;CAC3D,CAAC;KACD,WAAW,CAAC,oBAAoB,CAAC,CAAC;AAIrC,MAAM,CAAC,MAAM,qBAAqB,GAAkC;IAClE,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EACT,quBAAquB;IACvuB,WAAW;IACX,mBAAmB,EAAE,CAAC,aAAa,CAAC;IACpC,OAAO,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAChD,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC;CAC9C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AiTool } from "../types.js";
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
|
+
recordId: z.ZodString;
|
|
5
|
+
prices: z.ZodArray<z.ZodObject<{
|
|
6
|
+
currency: z.ZodString;
|
|
7
|
+
price: z.ZodNullable<z.ZodNumber>;
|
|
8
|
+
tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
9
|
+
minQty: z.ZodNumber;
|
|
10
|
+
price: z.ZodNumber;
|
|
11
|
+
}, z.core.$strip>>>;
|
|
12
|
+
}, z.core.$strip>>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
type Input = z.infer<typeof inputSchema>;
|
|
15
|
+
export declare const setProductCurrencyPricesTool: AiTool<Input, unknown>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=set-product-currency-prices.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-product-currency-prices.tool.d.ts","sourceRoot":"","sources":["../../src/tools/set-product-currency-prices.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,MAAM,EAA6B,MAAM,aAAa,CAAC;AAMrE,QAAA,MAAM,WAAW;;;;;;;;;;iBASf,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,CAY/D,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ADDITIONAL_CURRENCIES_MAX } from "@cmssy/types";
|
|
3
|
+
import { productCurrencyPriceSchema, refineUniqueCurrencies, } from "../schemas.js";
|
|
4
|
+
const inputSchema = z.object({
|
|
5
|
+
recordId: z.string().min(1).describe("Product record id"),
|
|
6
|
+
prices: z
|
|
7
|
+
.array(productCurrencyPriceSchema)
|
|
8
|
+
.max(ADDITIONAL_CURRENCIES_MAX)
|
|
9
|
+
.superRefine((items, ctx) => refineUniqueCurrencies(items, ctx))
|
|
10
|
+
.describe("The product's whole list of prices in additional currencies; it replaces what is stored, [] clears it. Each currency must be one of the workspace's additional currencies"),
|
|
11
|
+
});
|
|
12
|
+
export const setProductCurrencyPricesTool = {
|
|
13
|
+
name: "set_product_currency_prices",
|
|
14
|
+
description: "Set a product's prices in the workspace's additional currencies (update_cart_config additionalCurrencies), e.g. [{currency: 'EUR', price: 4500, tiers: [{minQty: 10, price: 4000}]}]. Prices and breaks are minor units of each currency; nothing is converted from the default-currency price. price is read only while the product has no variants - a product with variants takes each variant's price from set_product_variants currencyPrices, and these tiers price every variant without breaks of its own in that currency (price null keeps just the tiers). A product with no price in a sales channel's currency is not sold on that channel (NO_PRICE_IN_CURRENCY). The call replaces the whole list: send every currency the product keeps.",
|
|
15
|
+
inputSchema,
|
|
16
|
+
requiredPermissions: ["models:edit"],
|
|
17
|
+
confirmGated: true,
|
|
18
|
+
execute: async ({ recordId, prices }, ops) => ops.products.setCurrencyPrices(recordId, prices),
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=set-product-currency-prices.tool.js.map
|