@cmssy/ai-tools 0.82.0 → 0.84.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 +13 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +22 -0
- package/dist/registry.js.map +1 -1
- package/dist/schemas.d.ts +31 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +44 -0
- package/dist/schemas.js.map +1 -1
- package/dist/tools/create-price-list.tool.d.ts +10 -0
- package/dist/tools/create-price-list.tool.d.ts.map +1 -0
- package/dist/tools/create-price-list.tool.js +18 -0
- package/dist/tools/create-price-list.tool.js.map +1 -0
- package/dist/tools/delete-carts.tool.d.ts +12 -0
- package/dist/tools/delete-carts.tool.d.ts.map +1 -0
- package/dist/tools/delete-carts.tool.js +20 -0
- package/dist/tools/delete-carts.tool.js.map +1 -0
- package/dist/tools/delete-price-list.tool.d.ts +13 -0
- package/dist/tools/delete-price-list.tool.d.ts.map +1 -0
- package/dist/tools/delete-price-list.tool.js +16 -0
- package/dist/tools/delete-price-list.tool.js.map +1 -0
- package/dist/tools/get-customer.tool.js +1 -1
- package/dist/tools/get-customer.tool.js.map +1 -1
- package/dist/tools/get-order.tool.js +1 -1
- package/dist/tools/get-order.tool.js.map +1 -1
- package/dist/tools/get-price-list.tool.d.ts +21 -0
- package/dist/tools/get-price-list.tool.d.ts.map +1 -0
- package/dist/tools/get-price-list.tool.js +41 -0
- package/dist/tools/get-price-list.tool.js.map +1 -0
- package/dist/tools/list-customers.tool.js +1 -1
- package/dist/tools/list-customers.tool.js.map +1 -1
- package/dist/tools/list-orders.tool.d.ts +6 -0
- package/dist/tools/list-orders.tool.d.ts.map +1 -1
- package/dist/tools/list-orders.tool.js +6 -2
- package/dist/tools/list-orders.tool.js.map +1 -1
- package/dist/tools/list-price-lists.tool.d.ts +11 -0
- package/dist/tools/list-price-lists.tool.d.ts.map +1 -0
- package/dist/tools/list-price-lists.tool.js +13 -0
- package/dist/tools/list-price-lists.tool.js.map +1 -0
- package/dist/tools/remove-price-list-entries.tool.d.ts +17 -0
- package/dist/tools/remove-price-list-entries.tool.d.ts.map +1 -0
- package/dist/tools/remove-price-list-entries.tool.js +25 -0
- package/dist/tools/remove-price-list-entries.tool.js.map +1 -0
- package/dist/tools/set-company-price-list.tool.d.ts +10 -0
- package/dist/tools/set-company-price-list.tool.d.ts.map +1 -0
- package/dist/tools/set-company-price-list.tool.js +20 -0
- package/dist/tools/set-company-price-list.tool.js.map +1 -0
- package/dist/tools/set-customer-price-list.tool.d.ts +10 -0
- package/dist/tools/set-customer-price-list.tool.d.ts.map +1 -0
- package/dist/tools/set-customer-price-list.tool.js +17 -0
- package/dist/tools/set-customer-price-list.tool.js.map +1 -0
- package/dist/tools/set-price-list-entries.tool.d.ts +22 -0
- package/dist/tools/set-price-list-entries.tool.d.ts.map +1 -0
- package/dist/tools/set-price-list-entries.tool.js +25 -0
- package/dist/tools/set-price-list-entries.tool.js.map +1 -0
- package/dist/tools/set-price-list-entry.tool.d.ts +16 -0
- package/dist/tools/set-price-list-entry.tool.d.ts.map +1 -0
- package/dist/tools/set-price-list-entry.tool.js +18 -0
- package/dist/tools/set-price-list-entry.tool.js.map +1 -0
- package/dist/tools/update-price-list.tool.d.ts +11 -0
- package/dist/tools/update-price-list.tool.d.ts.map +1 -0
- package/dist/tools/update-price-list.tool.js +20 -0
- package/dist/tools/update-price-list.tool.js.map +1 -0
- package/dist/types.d.ts +80 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AiTool, PriceListEntry, PriceListSummary } from "../types.js";
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
recordId: z.ZodOptional<z.ZodString>;
|
|
6
|
+
first: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
after: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
type Input = z.infer<typeof inputSchema>;
|
|
10
|
+
type Output = ({
|
|
11
|
+
found: true;
|
|
12
|
+
} & PriceListSummary & {
|
|
13
|
+
entries: PriceListEntry[];
|
|
14
|
+
nextCursor: string | null;
|
|
15
|
+
}) | {
|
|
16
|
+
found: false;
|
|
17
|
+
id: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const getPriceListTool: AiTool<Input, Output>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=get-price-list.tool.d.ts.map
|
|
@@ -0,0 +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;AAE5E,QAAA,MAAM,WAAW;;;;;iBAmBf,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,CAmBlD,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const inputSchema = z.object({
|
|
3
|
+
id: z.string().min(1).describe("The price list's id (from list_price_lists)"),
|
|
4
|
+
recordId: z
|
|
5
|
+
.string()
|
|
6
|
+
.min(1)
|
|
7
|
+
.optional()
|
|
8
|
+
.describe("Only the fixed prices for this product record"),
|
|
9
|
+
first: z
|
|
10
|
+
.number()
|
|
11
|
+
.int()
|
|
12
|
+
.min(1)
|
|
13
|
+
.max(200)
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("Entries per page, at most 200"),
|
|
16
|
+
after: z
|
|
17
|
+
.string()
|
|
18
|
+
.min(1)
|
|
19
|
+
.optional()
|
|
20
|
+
.describe("nextCursor from the previous page"),
|
|
21
|
+
});
|
|
22
|
+
export const getPriceListTool = {
|
|
23
|
+
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) 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.",
|
|
25
|
+
inputSchema,
|
|
26
|
+
requiredPermissions: ["models:view"],
|
|
27
|
+
execute: async ({ id, recordId, first, after }, ops) => {
|
|
28
|
+
const list = await ops.priceLists.get(id);
|
|
29
|
+
if (!list) {
|
|
30
|
+
return { found: false, id };
|
|
31
|
+
}
|
|
32
|
+
const page = await ops.priceLists.entries(id, { recordId, first, after });
|
|
33
|
+
return {
|
|
34
|
+
found: true,
|
|
35
|
+
...list,
|
|
36
|
+
entries: page.items,
|
|
37
|
+
nextCursor: page.nextCursor,
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=get-price-list.tool.js.map
|
|
@@ -0,0 +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;AA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IAAI,CAAC,KAAK;YACnB,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -21,7 +21,7 @@ const inputSchema = z.object({
|
|
|
21
21
|
});
|
|
22
22
|
export const listCustomersTool = {
|
|
23
23
|
name: "list_customers",
|
|
24
|
-
description: "List the customers - accounts that sign in to the user's site (records of an accounts model), with status, verification, last login, their company, companyRole (the effective company role: admin or buyer in v1, null without a company) and orderStats (non-canceled order count, last order date, and net spend = paid minus refunded, in minor units, one entry per currency; null when the caller may not view orders). Not the team: those are list_team. Read-only; filter by model, status, company or an identity search; paginated, newest first.",
|
|
24
|
+
description: "List the customers - accounts that sign in to the user's site (records of an accounts model), with status, verification, last login, their company, companyRole (the effective company role: admin or buyer in v1, null without a company), effectivePriceList (the price list that prices them, source MEMBER or COMPANY; null = catalogue prices) and orderStats (non-canceled order count, last order date, and net spend = paid minus refunded, in minor units, one entry per currency; null when the caller may not view orders). Not the team: those are list_team. Read-only; filter by model, status, company or an identity search; paginated, newest first.",
|
|
25
25
|
inputSchema,
|
|
26
26
|
requiredPermissions: ["customers:view"],
|
|
27
27
|
execute: async (input, ops) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-customers.tool.js","sourceRoot":"","sources":["../../src/tools/list-customers.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,yEAAyE,CAC1E;IACH,MAAM,EAAE,CAAC;SACN,IAAI,CAAC,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;SACxC,QAAQ,EAAE;SACV,QAAQ,CAAC,0BAA0B,CAAC;IACvC,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,QAAQ,EAA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AC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;CAC/D,CAAC,CAAC;AAWH,MAAM,CAAC,MAAM,iBAAiB,GAA0B;IACtD,IAAI,EAAE,gBAAgB;IACtB,WAAW,EACT,uoBAAuoB;IACzoB,WAAW;IACX,mBAAmB,EAAE,CAAC,gBAAgB,CAAC;IACvC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QAC5B,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,KAA4B,CAAC,CAAC;QACtE,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;YAC1B,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -31,6 +31,12 @@ declare const inputSchema: z.ZodObject<{
|
|
|
31
31
|
companyId: z.ZodOptional<z.ZodString>;
|
|
32
32
|
search: z.ZodOptional<z.ZodString>;
|
|
33
33
|
pipelineStageId: z.ZodOptional<z.ZodString>;
|
|
34
|
+
queue: z.ZodOptional<z.ZodEnum<{
|
|
35
|
+
in_transit: "in_transit";
|
|
36
|
+
to_pack: "to_pack";
|
|
37
|
+
shipping_problem: "shipping_problem";
|
|
38
|
+
returns: "returns";
|
|
39
|
+
}>>;
|
|
34
40
|
dateFrom: z.ZodOptional<z.ZodString>;
|
|
35
41
|
dateTo: z.ZodOptional<z.ZodString>;
|
|
36
42
|
skip: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-orders.tool.d.ts","sourceRoot":"","sources":["../../src/tools/list-orders.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAoB,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"list-orders.tool.d.ts","sourceRoot":"","sources":["../../src/tools/list-orders.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAoB,YAAY,EAAE,MAAM,aAAa,CAAC;AAS1E,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyCf,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB;AAED,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAehD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { isoDateTimeSchema, orderDeliveryStatusValues, orderFulfillmentStatusValues, orderStateValues, } from "../schemas.js";
|
|
2
|
+
import { isoDateTimeSchema, orderDeliveryStatusValues, orderFulfillmentStatusValues, orderQueueValues, orderStateValues, } from "../schemas.js";
|
|
3
3
|
const inputSchema = z.object({
|
|
4
4
|
paymentStatus: z
|
|
5
5
|
.enum([
|
|
@@ -27,6 +27,10 @@ const inputSchema = z.object({
|
|
|
27
27
|
.optional()
|
|
28
28
|
.describe("Case-insensitive contains match on the customer email or the frozen company name"),
|
|
29
29
|
pipelineStageId: z.string().optional(),
|
|
30
|
+
queue: z
|
|
31
|
+
.enum(orderQueueValues)
|
|
32
|
+
.optional()
|
|
33
|
+
.describe("A warehouse work queue, the same tabs as the admin order list: to_pack = open, paid and not yet fully shipped; in_transit = a parcel has a label or is on its way, without a delivery problem; shipping_problem = delivery status exception; returns = an open return. Combines with every other filter."),
|
|
30
34
|
dateFrom: isoDateTimeSchema.optional().describe("ISO date-time lower bound"),
|
|
31
35
|
dateTo: isoDateTimeSchema.optional().describe("ISO date-time upper bound"),
|
|
32
36
|
skip: z.number().int().optional().default(0),
|
|
@@ -34,7 +38,7 @@ const inputSchema = z.object({
|
|
|
34
38
|
});
|
|
35
39
|
export const listOrdersTool = {
|
|
36
40
|
name: "list_orders",
|
|
37
|
-
description: "List orders in the workspace. Filter by payment, fulfillment or delivery status, state (open/closed/canceled), customer, company (B2B), pipeline stage, a search string (customer email or company name), or a date range; paginated. Each order carries customerId, companyId and companyName when it was placed for a customer or a company.",
|
|
41
|
+
description: "List orders in the workspace. Filter by payment, fulfillment or delivery status, state (open/closed/canceled), customer, company (B2B), pipeline stage, warehouse queue (to pack, in transit, shipping problem, returns), a search string (customer email or company name), or a date range; paginated. Each order carries customerId, companyId and companyName when it was placed for a customer or a company.",
|
|
38
42
|
inputSchema,
|
|
39
43
|
requiredPermissions: ["orders:view"],
|
|
40
44
|
execute: async (input, ops) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-orders.tool.js","sourceRoot":"","sources":["../../src/tools/list-orders.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,4BAA4B,EAC5B,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,aAAa,EAAE,CAAC;SACb,IAAI,CAAC;QACJ,QAAQ;QACR,gBAAgB;QAChB,YAAY;QACZ,MAAM;QACN,oBAAoB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CAAC;IAC5C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;CAC/C,CAAC,CAAC;AAWH,MAAM,CAAC,MAAM,cAAc,GAA0B;IACnD,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,kZAAkZ;IACpZ,WAAW;IACX,mBAAmB,EAAE,CAAC,aAAa,CAAC;IACpC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QAC5B,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAyB,CAAC,CAAC;QAChE,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;YAC1B,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AiTool, PriceListSummary } from "../types.js";
|
|
3
|
+
declare const inputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
4
|
+
type Input = z.infer<typeof inputSchema>;
|
|
5
|
+
interface Output {
|
|
6
|
+
count: number;
|
|
7
|
+
items: PriceListSummary[];
|
|
8
|
+
}
|
|
9
|
+
export declare const listPriceListsTool: AiTool<Input, Output>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=list-price-lists.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-price-lists.tool.d.ts","sourceRoot":"","sources":["../../src/tools/list-price-lists.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,gCAAe,CAAC;AAEjC,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B;AAED,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAUpD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const inputSchema = z.object({});
|
|
3
|
+
export const listPriceListsTool = {
|
|
4
|
+
name: "list_price_lists",
|
|
5
|
+
description: "List the workspace's price lists (Gold, Silver, dealer tiers ...), by name: each with percentOff (percent off the catalogue, 2 decimals), overrideCount (fixed prices it holds) and assignedCount (companies and customers it prices). A list prices a buyer from a fixed price per product or variant where it has one, else the catalogue price minus percentOff. Read-only; entries are in get_price_list.",
|
|
6
|
+
inputSchema,
|
|
7
|
+
requiredPermissions: ["models:view"],
|
|
8
|
+
execute: async (_input, ops) => {
|
|
9
|
+
const items = await ops.priceLists.list();
|
|
10
|
+
return { count: items.length, items };
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=list-price-lists.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-price-lists.tool.js","sourceRoot":"","sources":["../../src/tools/list-price-lists.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AASjC,MAAM,CAAC,MAAM,kBAAkB,GAA0B;IACvD,IAAI,EAAE,kBAAkB;IACxB,WAAW,EACT,+YAA+Y;IACjZ,WAAW;IACX,mBAAmB,EAAE,CAAC,aAAa,CAAC;IACpC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QAC1C,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;IACxC,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AiTool } from "../types.js";
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
|
+
priceListId: z.ZodString;
|
|
5
|
+
keys: z.ZodArray<z.ZodObject<{
|
|
6
|
+
recordId: z.ZodString;
|
|
7
|
+
variantKey: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, z.core.$strip>>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
type Input = z.infer<typeof inputSchema>;
|
|
11
|
+
interface Output {
|
|
12
|
+
priceListId: string;
|
|
13
|
+
removed: number;
|
|
14
|
+
}
|
|
15
|
+
export declare const removePriceListEntriesTool: AiTool<Input, Output>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=remove-price-list-entries.tool.d.ts.map
|
|
@@ -0,0 +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;;;;;;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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { priceListEntryKeySchema } from "../schemas.js";
|
|
3
|
+
const inputSchema = z.object({
|
|
4
|
+
priceListId: z
|
|
5
|
+
.string()
|
|
6
|
+
.min(1)
|
|
7
|
+
.describe("The price list's id (from list_price_lists)"),
|
|
8
|
+
keys: z
|
|
9
|
+
.array(priceListEntryKeySchema)
|
|
10
|
+
.min(1)
|
|
11
|
+
.max(1000)
|
|
12
|
+
.describe("Up to 1000 product / variant keys whose fixed price to remove"),
|
|
13
|
+
});
|
|
14
|
+
export const removePriceListEntriesTool = {
|
|
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.",
|
|
17
|
+
inputSchema,
|
|
18
|
+
requiredPermissions: ["models:edit"],
|
|
19
|
+
confirmGated: true,
|
|
20
|
+
execute: async ({ priceListId, keys }, ops) => {
|
|
21
|
+
const removed = await ops.priceLists.removeEntries(priceListId, keys);
|
|
22
|
+
return { priceListId, removed };
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=remove-price-list-entries.tool.js.map
|
|
@@ -0,0 +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,iUAAiU;IACnU,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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AiTool, PriceListRecordAssignment } from "../types.js";
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
|
+
recordId: z.ZodString;
|
|
5
|
+
priceListId: z.ZodNullable<z.ZodString>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
type Input = z.infer<typeof inputSchema>;
|
|
8
|
+
export declare const setCompanyPriceListTool: AiTool<Input, PriceListRecordAssignment>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=set-company-price-list.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-company-price-list.tool.d.ts","sourceRoot":"","sources":["../../src/tools/set-company-price-list.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAErE,QAAA,MAAM,WAAW;;;iBAYf,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,KAAK,EAAE,yBAAyB,CAS1E,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const inputSchema = z.object({
|
|
3
|
+
recordId: z
|
|
4
|
+
.string()
|
|
5
|
+
.min(1)
|
|
6
|
+
.describe("The company record's id (a record of a model with the Company capability; a customer's company.id)"),
|
|
7
|
+
priceListId: z
|
|
8
|
+
.string()
|
|
9
|
+
.min(1)
|
|
10
|
+
.nullable()
|
|
11
|
+
.describe("The price list's id (from list_price_lists); null unassigns"),
|
|
12
|
+
});
|
|
13
|
+
export const setCompanyPriceListTool = {
|
|
14
|
+
name: "set_company_price_list",
|
|
15
|
+
description: "Assign a price list to a company record; null unassigns. Every member of the company pays this list - one list per buyer, and a member's own list is ignored while they belong to the company. A company without a list leaves its members on catalogue prices. Refused for a record that is not a company (a model with the Company capability) - for a customer use set_customer_price_list. Returns the record id and its priceListId.",
|
|
16
|
+
inputSchema,
|
|
17
|
+
requiredPermissions: ["customers:manage"],
|
|
18
|
+
execute: async ({ recordId, priceListId }, ops) => ops.priceLists.setRecordPriceList(recordId, priceListId),
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=set-company-price-list.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-company-price-list.tool.js","sourceRoot":"","sources":["../../src/tools/set-company-price-list.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,CACP,oGAAoG,CACrG;IACH,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,EAAE;SACV,QAAQ,CAAC,6DAA6D,CAAC;CAC3E,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,uBAAuB,GAClC;IACE,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EACT,2aAA2a;IAC7a,WAAW;IACX,mBAAmB,EAAE,CAAC,kBAAkB,CAAC;IACzC,OAAO,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,EAAE,CAChD,GAAG,CAAC,UAAU,CAAC,kBAAkB,CAAC,QAAQ,EAAE,WAAW,CAAC;CAC3D,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AiTool, CustomerSummary } from "../types.js";
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
priceListId: z.ZodNullable<z.ZodString>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
type Input = z.infer<typeof inputSchema>;
|
|
8
|
+
export declare const setCustomerPriceListTool: AiTool<Input, CustomerSummary>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=set-customer-price-list.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-customer-price-list.tool.d.ts","sourceRoot":"","sources":["../../src/tools/set-customer-price-list.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE3D,QAAA,MAAM,WAAW;;;iBAOf,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,KAAK,EAAE,eAAe,CAQnE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const inputSchema = z.object({
|
|
3
|
+
id: z.string().min(1).describe("The customer's id (from list_customers)"),
|
|
4
|
+
priceListId: z
|
|
5
|
+
.string()
|
|
6
|
+
.min(1)
|
|
7
|
+
.nullable()
|
|
8
|
+
.describe("The price list's id (from list_price_lists); null unassigns"),
|
|
9
|
+
});
|
|
10
|
+
export const setCustomerPriceListTool = {
|
|
11
|
+
name: "set_customer_price_list",
|
|
12
|
+
description: "Assign a price list to a customer without a company (a B2C VIP); null unassigns. One list per buyer: a customer in a company pays the company's list, so assigning to them is refused - assign the list to the company with set_company_price_list instead. Returns the customer with priceList (their own) and effectivePriceList (the one that prices them, source MEMBER or COMPANY).",
|
|
13
|
+
inputSchema,
|
|
14
|
+
requiredPermissions: ["customers:manage"],
|
|
15
|
+
execute: async ({ id, priceListId }, ops) => ops.customers.setPriceList(id, priceListId),
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=set-customer-price-list.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-customer-price-list.tool.js","sourceRoot":"","sources":["../../src/tools/set-customer-price-list.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,yCAAyC,CAAC;IACzE,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,EAAE;SACV,QAAQ,CAAC,6DAA6D,CAAC;CAC3E,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,wBAAwB,GAAmC;IACtE,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EACT,0XAA0X;IAC5X,WAAW;IACX,mBAAmB,EAAE,CAAC,kBAAkB,CAAC;IACzC,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,EAAE,CAC1C,GAAG,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,EAAE,WAAW,CAAC;CAC9C,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AiTool } from "../types.js";
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
|
+
priceListId: z.ZodString;
|
|
5
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
6
|
+
recordId: z.ZodString;
|
|
7
|
+
variantKey: z.ZodOptional<z.ZodString>;
|
|
8
|
+
price: z.ZodNumber;
|
|
9
|
+
tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
10
|
+
minQty: z.ZodNumber;
|
|
11
|
+
price: z.ZodNumber;
|
|
12
|
+
}, z.core.$strip>>>;
|
|
13
|
+
}, z.core.$strip>>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
type Input = z.infer<typeof inputSchema>;
|
|
16
|
+
interface Output {
|
|
17
|
+
priceListId: string;
|
|
18
|
+
written: number;
|
|
19
|
+
}
|
|
20
|
+
export declare const setPriceListEntriesTool: AiTool<Input, Output>;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=set-price-list-entries.tool.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;;;;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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { priceListEntrySchema } from "../schemas.js";
|
|
3
|
+
const inputSchema = z.object({
|
|
4
|
+
priceListId: z
|
|
5
|
+
.string()
|
|
6
|
+
.min(1)
|
|
7
|
+
.describe("The price list's id (from list_price_lists)"),
|
|
8
|
+
entries: z
|
|
9
|
+
.array(priceListEntrySchema)
|
|
10
|
+
.min(1)
|
|
11
|
+
.max(1000)
|
|
12
|
+
.describe("Up to 1000 fixed prices"),
|
|
13
|
+
});
|
|
14
|
+
export const setPriceListEntriesTool = {
|
|
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; a row replaces the price already set for the same product/variant, 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
|
+
inputSchema,
|
|
18
|
+
requiredPermissions: ["models:edit"],
|
|
19
|
+
confirmGated: true,
|
|
20
|
+
execute: async ({ priceListId, entries }, ops) => {
|
|
21
|
+
const written = await ops.priceLists.setEntries(priceListId, entries);
|
|
22
|
+
return { priceListId, written };
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=set-price-list-entries.tool.js.map
|
|
@@ -0,0 +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,yiBAAyiB;IAC3iB,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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AiTool, PriceListEntry } from "../types.js";
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
|
+
recordId: z.ZodString;
|
|
5
|
+
variantKey: z.ZodOptional<z.ZodString>;
|
|
6
|
+
price: z.ZodNumber;
|
|
7
|
+
tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
8
|
+
minQty: z.ZodNumber;
|
|
9
|
+
price: z.ZodNumber;
|
|
10
|
+
}, z.core.$strip>>>;
|
|
11
|
+
priceListId: z.ZodString;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
type Input = z.infer<typeof inputSchema>;
|
|
14
|
+
export declare const setPriceListEntryTool: AiTool<Input, PriceListEntry>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=set-price-list-entry.tool.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;;iBAOoB,CAAC;AAEtC,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,KAAK,EAAE,cAAc,CAQ/D,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { priceListEntryShape, refineTiersBelowPrice } from "../schemas.js";
|
|
3
|
+
const inputSchema = priceListEntryShape
|
|
4
|
+
.extend({
|
|
5
|
+
priceListId: z
|
|
6
|
+
.string()
|
|
7
|
+
.min(1)
|
|
8
|
+
.describe("The price list's id (from list_price_lists)"),
|
|
9
|
+
})
|
|
10
|
+
.superRefine(refineTiersBelowPrice);
|
|
11
|
+
export const setPriceListEntryTool = {
|
|
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 price already set for it. For many rows use set_price_list_entries.",
|
|
14
|
+
inputSchema,
|
|
15
|
+
requiredPermissions: ["models:edit"],
|
|
16
|
+
execute: async ({ priceListId, ...entry }, ops) => ops.priceLists.setEntry(priceListId, entry),
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=set-price-list-entry.tool.js.map
|
|
@@ -0,0 +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,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE3E,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,qBAAqB,CAAC,CAAC;AAItC,MAAM,CAAC,MAAM,qBAAqB,GAAkC;IAClE,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EACT,+aAA+a;IACjb,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,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AiTool, PriceListSummary } from "../types.js";
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
name: z.ZodOptional<z.ZodString>;
|
|
6
|
+
percentOff: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
type Input = z.infer<typeof inputSchema>;
|
|
9
|
+
export declare const updatePriceListTool: AiTool<Input, PriceListSummary>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=update-price-list.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-price-list.tool.d.ts","sourceRoot":"","sources":["../../src/tools/update-price-list.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG5D,QAAA,MAAM,WAAW;;;;iBAIf,CAAC;AAEH,KAAK,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzC,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,KAAK,EAAE,gBAAgB,CAY/D,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { percentOffSchema } from "../schemas.js";
|
|
3
|
+
const inputSchema = z.object({
|
|
4
|
+
id: z.string().min(1).describe("The price list's id (from list_price_lists)"),
|
|
5
|
+
name: z.string().trim().min(1).optional().describe("New unique name"),
|
|
6
|
+
percentOff: percentOffSchema.optional(),
|
|
7
|
+
});
|
|
8
|
+
export const updatePriceListTool = {
|
|
9
|
+
name: "update_price_list",
|
|
10
|
+
description: "Rename a price list or change its percentOff (0-99.99, 2 decimals; it prices every product the list holds no fixed price for). Fixed prices are changed with set_price_list_entry / set_price_list_entries. Carts already priced from the list keep their prices until the buyer adds again; orders keep theirs.",
|
|
11
|
+
inputSchema,
|
|
12
|
+
requiredPermissions: ["models:edit"],
|
|
13
|
+
execute: async ({ id, name, percentOff }, ops) => {
|
|
14
|
+
if (name === undefined && percentOff === undefined) {
|
|
15
|
+
throw new Error("Provide name or percentOff to update");
|
|
16
|
+
}
|
|
17
|
+
return ops.priceLists.update(id, { name, percentOff });
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=update-price-list.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-price-list.tool.js","sourceRoot":"","sources":["../../src/tools/update-price-list.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,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,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC;IACrE,UAAU,EAAE,gBAAgB,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,mBAAmB,GAAoC;IAClE,IAAI,EAAE,mBAAmB;IACzB,WAAW,EACT,kTAAkT;IACpT,WAAW;IACX,mBAAmB,EAAE,CAAC,aAAa,CAAC;IACpC,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE,EAAE;QAC/C,IAAI,IAAI,KAAK,SAAS,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;IACzD,CAAC;CACF,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -666,6 +666,7 @@ export interface OrderListOptions {
|
|
|
666
666
|
companyId?: string;
|
|
667
667
|
search?: string;
|
|
668
668
|
pipelineStageId?: string;
|
|
669
|
+
queue?: string;
|
|
669
670
|
dateFrom?: string;
|
|
670
671
|
dateTo?: string;
|
|
671
672
|
skip?: number;
|
|
@@ -696,6 +697,7 @@ export interface OrderDetail {
|
|
|
696
697
|
customerId: string | null;
|
|
697
698
|
companyId: string | null;
|
|
698
699
|
companyName: string | null;
|
|
700
|
+
priceListName: string | null;
|
|
699
701
|
subtotal: number | null;
|
|
700
702
|
discount: number | null;
|
|
701
703
|
appliedDiscount: OrderAppliedDiscount | null;
|
|
@@ -1045,6 +1047,7 @@ export interface WebhookOps {
|
|
|
1045
1047
|
}
|
|
1046
1048
|
export interface CartOps {
|
|
1047
1049
|
list(status?: string, skip?: number, limit?: number): Promise<unknown>;
|
|
1050
|
+
delete(ids: string[]): Promise<number>;
|
|
1048
1051
|
}
|
|
1049
1052
|
export interface ProductFilter {
|
|
1050
1053
|
search?: string;
|
|
@@ -1184,6 +1187,17 @@ export interface CustomerOrderStats {
|
|
|
1184
1187
|
lastOrderAt: string | null;
|
|
1185
1188
|
spent: CustomerSpend[];
|
|
1186
1189
|
}
|
|
1190
|
+
export interface CustomerPriceList {
|
|
1191
|
+
id: string;
|
|
1192
|
+
name: string;
|
|
1193
|
+
}
|
|
1194
|
+
export type PriceListSource = "MEMBER" | "COMPANY";
|
|
1195
|
+
export interface CustomerEffectivePriceList {
|
|
1196
|
+
id: string;
|
|
1197
|
+
name: string;
|
|
1198
|
+
source: PriceListSource;
|
|
1199
|
+
companyName: string | null;
|
|
1200
|
+
}
|
|
1187
1201
|
export interface CustomerSummary {
|
|
1188
1202
|
id: string;
|
|
1189
1203
|
modelId: string;
|
|
@@ -1200,6 +1214,8 @@ export interface CustomerSummary {
|
|
|
1200
1214
|
name: string | null;
|
|
1201
1215
|
} | null;
|
|
1202
1216
|
companyRole: string | null;
|
|
1217
|
+
priceList: CustomerPriceList | null;
|
|
1218
|
+
effectivePriceList: CustomerEffectivePriceList | null;
|
|
1203
1219
|
orderStats: CustomerOrderStats | null;
|
|
1204
1220
|
createdAt: string | null;
|
|
1205
1221
|
updatedAt: string | null;
|
|
@@ -1233,6 +1249,69 @@ export interface CustomerOps {
|
|
|
1233
1249
|
resendVerification(id: string): Promise<CustomerAccountRequestResult>;
|
|
1234
1250
|
unlock(id: string): Promise<CustomerSummary>;
|
|
1235
1251
|
setCompanyRole(id: string, role: string): Promise<CustomerSummary>;
|
|
1252
|
+
setPriceList(id: string, priceListId: string | null): Promise<CustomerSummary>;
|
|
1253
|
+
}
|
|
1254
|
+
export interface PriceListSummary {
|
|
1255
|
+
id: string;
|
|
1256
|
+
name: string;
|
|
1257
|
+
percentOff: number;
|
|
1258
|
+
overrideCount: number;
|
|
1259
|
+
assignedCount: number;
|
|
1260
|
+
createdAt: string | null;
|
|
1261
|
+
updatedAt: string | null;
|
|
1262
|
+
}
|
|
1263
|
+
export interface PriceListInput {
|
|
1264
|
+
name: string;
|
|
1265
|
+
percentOff?: number;
|
|
1266
|
+
}
|
|
1267
|
+
export interface PriceListUpdateInput {
|
|
1268
|
+
name?: string;
|
|
1269
|
+
percentOff?: number;
|
|
1270
|
+
}
|
|
1271
|
+
export interface PriceListEntry {
|
|
1272
|
+
id: string;
|
|
1273
|
+
priceListId: string;
|
|
1274
|
+
recordId: string;
|
|
1275
|
+
variantKey: string | null;
|
|
1276
|
+
price: number;
|
|
1277
|
+
tiers: PriceTier[];
|
|
1278
|
+
currency: string | null;
|
|
1279
|
+
recordMissing: boolean;
|
|
1280
|
+
}
|
|
1281
|
+
export interface PriceListEntryInput {
|
|
1282
|
+
recordId: string;
|
|
1283
|
+
variantKey?: string;
|
|
1284
|
+
price: number;
|
|
1285
|
+
tiers?: PriceTier[];
|
|
1286
|
+
}
|
|
1287
|
+
export interface PriceListEntryKey {
|
|
1288
|
+
recordId: string;
|
|
1289
|
+
variantKey?: string;
|
|
1290
|
+
}
|
|
1291
|
+
export interface PriceListEntriesOptions {
|
|
1292
|
+
recordId?: string;
|
|
1293
|
+
first?: number;
|
|
1294
|
+
after?: string;
|
|
1295
|
+
}
|
|
1296
|
+
export interface PriceListEntryPage {
|
|
1297
|
+
items: PriceListEntry[];
|
|
1298
|
+
nextCursor: string | null;
|
|
1299
|
+
}
|
|
1300
|
+
export interface PriceListRecordAssignment {
|
|
1301
|
+
id: string;
|
|
1302
|
+
priceListId: string | null;
|
|
1303
|
+
}
|
|
1304
|
+
export interface PriceListOps {
|
|
1305
|
+
list(): Promise<PriceListSummary[]>;
|
|
1306
|
+
get(id: string): Promise<PriceListSummary | null>;
|
|
1307
|
+
entries(priceListId: string, options?: PriceListEntriesOptions): Promise<PriceListEntryPage>;
|
|
1308
|
+
create(input: PriceListInput): Promise<PriceListSummary>;
|
|
1309
|
+
update(id: string, input: PriceListUpdateInput): Promise<PriceListSummary>;
|
|
1310
|
+
delete(id: string): Promise<boolean>;
|
|
1311
|
+
setEntry(priceListId: string, entry: PriceListEntryInput): Promise<PriceListEntry>;
|
|
1312
|
+
setEntries(priceListId: string, entries: PriceListEntryInput[]): Promise<number>;
|
|
1313
|
+
removeEntries(priceListId: string, keys: PriceListEntryKey[]): Promise<number>;
|
|
1314
|
+
setRecordPriceList(recordId: string, priceListId: string | null): Promise<PriceListRecordAssignment>;
|
|
1236
1315
|
}
|
|
1237
1316
|
export interface WorkspaceOps {
|
|
1238
1317
|
models: ModelOps;
|
|
@@ -1248,6 +1327,7 @@ export interface WorkspaceOps {
|
|
|
1248
1327
|
team: TeamOps;
|
|
1249
1328
|
roles: RoleOps;
|
|
1250
1329
|
customers: CustomerOps;
|
|
1330
|
+
priceLists: PriceListOps;
|
|
1251
1331
|
}
|
|
1252
1332
|
export interface AiTool<I = unknown, O = unknown> {
|
|
1253
1333
|
name: string;
|