@cmssy/ai-tools 0.82.0 → 0.83.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 +12 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +20 -0
- package/dist/registry.js.map +1 -1
- package/dist/schemas.d.ts +30 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +38 -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-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-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 +78 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -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
|
@@ -696,6 +696,7 @@ export interface OrderDetail {
|
|
|
696
696
|
customerId: string | null;
|
|
697
697
|
companyId: string | null;
|
|
698
698
|
companyName: string | null;
|
|
699
|
+
priceListName: string | null;
|
|
699
700
|
subtotal: number | null;
|
|
700
701
|
discount: number | null;
|
|
701
702
|
appliedDiscount: OrderAppliedDiscount | null;
|
|
@@ -1184,6 +1185,17 @@ export interface CustomerOrderStats {
|
|
|
1184
1185
|
lastOrderAt: string | null;
|
|
1185
1186
|
spent: CustomerSpend[];
|
|
1186
1187
|
}
|
|
1188
|
+
export interface CustomerPriceList {
|
|
1189
|
+
id: string;
|
|
1190
|
+
name: string;
|
|
1191
|
+
}
|
|
1192
|
+
export type PriceListSource = "MEMBER" | "COMPANY";
|
|
1193
|
+
export interface CustomerEffectivePriceList {
|
|
1194
|
+
id: string;
|
|
1195
|
+
name: string;
|
|
1196
|
+
source: PriceListSource;
|
|
1197
|
+
companyName: string | null;
|
|
1198
|
+
}
|
|
1187
1199
|
export interface CustomerSummary {
|
|
1188
1200
|
id: string;
|
|
1189
1201
|
modelId: string;
|
|
@@ -1200,6 +1212,8 @@ export interface CustomerSummary {
|
|
|
1200
1212
|
name: string | null;
|
|
1201
1213
|
} | null;
|
|
1202
1214
|
companyRole: string | null;
|
|
1215
|
+
priceList: CustomerPriceList | null;
|
|
1216
|
+
effectivePriceList: CustomerEffectivePriceList | null;
|
|
1203
1217
|
orderStats: CustomerOrderStats | null;
|
|
1204
1218
|
createdAt: string | null;
|
|
1205
1219
|
updatedAt: string | null;
|
|
@@ -1233,6 +1247,69 @@ export interface CustomerOps {
|
|
|
1233
1247
|
resendVerification(id: string): Promise<CustomerAccountRequestResult>;
|
|
1234
1248
|
unlock(id: string): Promise<CustomerSummary>;
|
|
1235
1249
|
setCompanyRole(id: string, role: string): Promise<CustomerSummary>;
|
|
1250
|
+
setPriceList(id: string, priceListId: string | null): Promise<CustomerSummary>;
|
|
1251
|
+
}
|
|
1252
|
+
export interface PriceListSummary {
|
|
1253
|
+
id: string;
|
|
1254
|
+
name: string;
|
|
1255
|
+
percentOff: number;
|
|
1256
|
+
overrideCount: number;
|
|
1257
|
+
assignedCount: number;
|
|
1258
|
+
createdAt: string | null;
|
|
1259
|
+
updatedAt: string | null;
|
|
1260
|
+
}
|
|
1261
|
+
export interface PriceListInput {
|
|
1262
|
+
name: string;
|
|
1263
|
+
percentOff?: number;
|
|
1264
|
+
}
|
|
1265
|
+
export interface PriceListUpdateInput {
|
|
1266
|
+
name?: string;
|
|
1267
|
+
percentOff?: number;
|
|
1268
|
+
}
|
|
1269
|
+
export interface PriceListEntry {
|
|
1270
|
+
id: string;
|
|
1271
|
+
priceListId: string;
|
|
1272
|
+
recordId: string;
|
|
1273
|
+
variantKey: string | null;
|
|
1274
|
+
price: number;
|
|
1275
|
+
tiers: PriceTier[];
|
|
1276
|
+
currency: string | null;
|
|
1277
|
+
recordMissing: boolean;
|
|
1278
|
+
}
|
|
1279
|
+
export interface PriceListEntryInput {
|
|
1280
|
+
recordId: string;
|
|
1281
|
+
variantKey?: string;
|
|
1282
|
+
price: number;
|
|
1283
|
+
tiers?: PriceTier[];
|
|
1284
|
+
}
|
|
1285
|
+
export interface PriceListEntryKey {
|
|
1286
|
+
recordId: string;
|
|
1287
|
+
variantKey?: string;
|
|
1288
|
+
}
|
|
1289
|
+
export interface PriceListEntriesOptions {
|
|
1290
|
+
recordId?: string;
|
|
1291
|
+
first?: number;
|
|
1292
|
+
after?: string;
|
|
1293
|
+
}
|
|
1294
|
+
export interface PriceListEntryPage {
|
|
1295
|
+
items: PriceListEntry[];
|
|
1296
|
+
nextCursor: string | null;
|
|
1297
|
+
}
|
|
1298
|
+
export interface PriceListRecordAssignment {
|
|
1299
|
+
id: string;
|
|
1300
|
+
priceListId: string | null;
|
|
1301
|
+
}
|
|
1302
|
+
export interface PriceListOps {
|
|
1303
|
+
list(): Promise<PriceListSummary[]>;
|
|
1304
|
+
get(id: string): Promise<PriceListSummary | null>;
|
|
1305
|
+
entries(priceListId: string, options?: PriceListEntriesOptions): Promise<PriceListEntryPage>;
|
|
1306
|
+
create(input: PriceListInput): Promise<PriceListSummary>;
|
|
1307
|
+
update(id: string, input: PriceListUpdateInput): Promise<PriceListSummary>;
|
|
1308
|
+
delete(id: string): Promise<boolean>;
|
|
1309
|
+
setEntry(priceListId: string, entry: PriceListEntryInput): Promise<PriceListEntry>;
|
|
1310
|
+
setEntries(priceListId: string, entries: PriceListEntryInput[]): Promise<number>;
|
|
1311
|
+
removeEntries(priceListId: string, keys: PriceListEntryKey[]): Promise<number>;
|
|
1312
|
+
setRecordPriceList(recordId: string, priceListId: string | null): Promise<PriceListRecordAssignment>;
|
|
1236
1313
|
}
|
|
1237
1314
|
export interface WorkspaceOps {
|
|
1238
1315
|
models: ModelOps;
|
|
@@ -1248,6 +1325,7 @@ export interface WorkspaceOps {
|
|
|
1248
1325
|
team: TeamOps;
|
|
1249
1326
|
roles: RoleOps;
|
|
1250
1327
|
customers: CustomerOps;
|
|
1328
|
+
priceLists: PriceListOps;
|
|
1251
1329
|
}
|
|
1252
1330
|
export interface AiTool<I = unknown, O = unknown> {
|
|
1253
1331
|
name: string;
|