@raytio/mcp-server 10.2.0 → 10.3.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/contracts/persist/mcp_resource_contract.json +4 -4
- package/dist/authorization.d.ts.map +1 -1
- package/dist/authorization.js +2 -0
- package/dist/authorization.js.map +1 -1
- package/dist/generated-reads/guardrails.js +1 -1
- package/dist/generated-reads/guardrails.js.map +1 -1
- package/dist/generated-reads/resource-tools.d.ts.map +1 -1
- package/dist/generated-reads/resource-tools.js +8 -5
- package/dist/generated-reads/resource-tools.js.map +1 -1
- package/dist/tools/_shared/soft-deactivate.d.ts +2 -0
- package/dist/tools/_shared/soft-deactivate.d.ts.map +1 -1
- package/dist/tools/_shared/soft-deactivate.js +3 -0
- package/dist/tools/_shared/soft-deactivate.js.map +1 -1
- package/dist/tools/domains.d.ts.map +1 -1
- package/dist/tools/domains.js +18 -0
- package/dist/tools/domains.js.map +1 -1
- package/dist/tools/imports/index.d.ts +6 -6
- package/dist/tools/pbm/generated-reads.d.ts +5 -0
- package/dist/tools/pbm/generated-reads.d.ts.map +1 -0
- package/dist/tools/pbm/generated-reads.js +32 -0
- package/dist/tools/pbm/generated-reads.js.map +1 -0
- package/dist/tools/pbm/index.d.ts +5 -0
- package/dist/tools/pbm/index.d.ts.map +1 -0
- package/dist/tools/pbm/index.js +17 -0
- package/dist/tools/pbm/index.js.map +1 -0
- package/dist/tools/pbm/pbm-customer-entitlement-override-set.d.ts +26 -0
- package/dist/tools/pbm/pbm-customer-entitlement-override-set.d.ts.map +1 -0
- package/dist/tools/pbm/pbm-customer-entitlement-override-set.js +78 -0
- package/dist/tools/pbm/pbm-customer-entitlement-override-set.js.map +1 -0
- package/dist/tools/pbm/pbm-subscription-cancel.d.ts +21 -0
- package/dist/tools/pbm/pbm-subscription-cancel.d.ts.map +1 -0
- package/dist/tools/pbm/pbm-subscription-cancel.js +86 -0
- package/dist/tools/pbm/pbm-subscription-cancel.js.map +1 -0
- package/dist/tools/pbm/pbm-subscription-create.d.ts +20 -0
- package/dist/tools/pbm/pbm-subscription-create.d.ts.map +1 -0
- package/dist/tools/pbm/pbm-subscription-create.js +90 -0
- package/dist/tools/pbm/pbm-subscription-create.js.map +1 -0
- package/dist/tools/pbm/pbm-subscription-line-add.d.ts +13 -0
- package/dist/tools/pbm/pbm-subscription-line-add.d.ts.map +1 -0
- package/dist/tools/pbm/pbm-subscription-line-add.js +65 -0
- package/dist/tools/pbm/pbm-subscription-line-add.js.map +1 -0
- package/dist/tools/pbm/pbm-subscription-line-end.d.ts +12 -0
- package/dist/tools/pbm/pbm-subscription-line-end.d.ts.map +1 -0
- package/dist/tools/pbm/pbm-subscription-line-end.js +49 -0
- package/dist/tools/pbm/pbm-subscription-line-end.js.map +1 -0
- package/dist/tools/qom/generated-reads.d.ts +5 -0
- package/dist/tools/qom/generated-reads.d.ts.map +1 -0
- package/dist/tools/qom/generated-reads.js +22 -0
- package/dist/tools/qom/generated-reads.js.map +1 -0
- package/dist/tools/qom/index.d.ts +5 -0
- package/dist/tools/qom/index.d.ts.map +1 -0
- package/dist/tools/qom/index.js +23 -0
- package/dist/tools/qom/index.js.map +1 -0
- package/dist/tools/qom/qom-order-cancel.d.ts +16 -0
- package/dist/tools/qom/qom-order-cancel.d.ts.map +1 -0
- package/dist/tools/qom/qom-order-cancel.js +56 -0
- package/dist/tools/qom/qom-order-cancel.js.map +1 -0
- package/dist/tools/qom/qom-order-create.d.ts +24 -0
- package/dist/tools/qom/qom-order-create.d.ts.map +1 -0
- package/dist/tools/qom/qom-order-create.js +133 -0
- package/dist/tools/qom/qom-order-create.js.map +1 -0
- package/dist/tools/qom/qom-order-hold-place.d.ts +11 -0
- package/dist/tools/qom/qom-order-hold-place.d.ts.map +1 -0
- package/dist/tools/qom/qom-order-hold-place.js +50 -0
- package/dist/tools/qom/qom-order-hold-place.js.map +1 -0
- package/dist/tools/qom/qom-order-hold-release.d.ts +8 -0
- package/dist/tools/qom/qom-order-hold-release.d.ts.map +1 -0
- package/dist/tools/qom/qom-order-hold-release.js +42 -0
- package/dist/tools/qom/qom-order-hold-release.js.map +1 -0
- package/dist/tools/qom/qom-order-line-add.d.ts +18 -0
- package/dist/tools/qom/qom-order-line-add.d.ts.map +1 -0
- package/dist/tools/qom/qom-order-line-add.js +101 -0
- package/dist/tools/qom/qom-order-line-add.js.map +1 -0
- package/dist/tools/qom/qom-quote-create.d.ts +20 -0
- package/dist/tools/qom/qom-quote-create.d.ts.map +1 -0
- package/dist/tools/qom/qom-quote-create.js +142 -0
- package/dist/tools/qom/qom-quote-create.js.map +1 -0
- package/dist/tools/qom/qom-quote-line-add.d.ts +13 -0
- package/dist/tools/qom/qom-quote-line-add.d.ts.map +1 -0
- package/dist/tools/qom/qom-quote-line-add.js +92 -0
- package/dist/tools/qom/qom-quote-line-add.js.map +1 -0
- package/dist/tools/qom/qom-quote-version-create.d.ts +10 -0
- package/dist/tools/qom/qom-quote-version-create.d.ts.map +1 -0
- package/dist/tools/qom/qom-quote-version-create.js +69 -0
- package/dist/tools/qom/qom-quote-version-create.js.map +1 -0
- package/dist/tools/role-mapping.d.ts.map +1 -1
- package/dist/tools/role-mapping.js +9 -8
- package/dist/tools/role-mapping.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { API_ERROR, errorResponse, successResponse } from '../types.js';
|
|
3
|
+
import { cap } from '../../capabilities/tool-capability.js';
|
|
4
|
+
import { redactRow } from '../../generated-reads/index.js';
|
|
5
|
+
import { confirmFlagSchema, unenforcedIdempotencyKeySchema, writeHeadersWithIdempotency, } from '../_shared/side-effect.js';
|
|
6
|
+
/**
|
|
7
|
+
* Provisioning semantic tool: create a QOM order header
|
|
8
|
+
* (`qom_order_headers`). The tool requires `confirm: true` and a
|
|
9
|
+
* business `order_code`, because the unique key
|
|
10
|
+
* (tenant_id, org_id, order_code) is what stops a retry creating a
|
|
11
|
+
* second order. Persist would generate a code if none were sent.
|
|
12
|
+
*
|
|
13
|
+
* `order_status` is limited to DRAFT and OPEN: Persist accepts any
|
|
14
|
+
* lookup value, so a caller could otherwise create an order already
|
|
15
|
+
* PAID or FULFILLED. `order_type` omits MARKETPLACE_GUEST, which belongs
|
|
16
|
+
* to the guest cart RPCs.
|
|
17
|
+
*
|
|
18
|
+
* `is_open`, `is_on_hold`, `is_cancelled` are intentionally NOT
|
|
19
|
+
* writable through this tool — they belong to `qom_order_cancel`,
|
|
20
|
+
* `qom_order_hold_place` and `qom_order_hold_release`.
|
|
21
|
+
* `guest_session_token_hash` is a credential-shaped field: it is not an
|
|
22
|
+
* input and is removed from the returned row.
|
|
23
|
+
*
|
|
24
|
+
* `source_deal_id` links the order back to the SFA deal it was
|
|
25
|
+
* quoted from, if any.
|
|
26
|
+
*/
|
|
27
|
+
export const qomOrderCreateTool = {
|
|
28
|
+
name: 'qom_order_create',
|
|
29
|
+
description: 'Create a new sales order (qom_order_headers) as DRAFT or OPEN. Requires confirm=true. ' +
|
|
30
|
+
'is_open, is_on_hold and is_cancelled cannot be set here: use qom_order_cancel, ' +
|
|
31
|
+
'qom_order_hold_place or qom_order_hold_release. One order per order_code in an ' +
|
|
32
|
+
'organisation: a retry fails with a duplicate-key error instead of creating a second order.',
|
|
33
|
+
inputSchema: z.object({
|
|
34
|
+
order_code: z
|
|
35
|
+
.string()
|
|
36
|
+
.min(1)
|
|
37
|
+
.max(32)
|
|
38
|
+
.describe('Business order reference, unique within the organisation (required)'),
|
|
39
|
+
order_status: z.enum(['DRAFT', 'OPEN']).describe('Initial order status (required)'),
|
|
40
|
+
order_type: z
|
|
41
|
+
.enum(['SALES_ORDER', 'STANDARD', 'SUBSCRIPTION'])
|
|
42
|
+
.describe('Order type (required)'),
|
|
43
|
+
order_date: z.string().min(1).optional().describe('ISO 8601 order date'),
|
|
44
|
+
order_currency_code: z.string().length(3).optional(),
|
|
45
|
+
sold_to_customer_id: z.string().min(1).optional(),
|
|
46
|
+
sold_to_customer_site_id: z.string().min(1).optional(),
|
|
47
|
+
sold_to_party_contact_point_id: z.string().min(1).optional(),
|
|
48
|
+
ship_to_customer_id: z.string().min(1).optional(),
|
|
49
|
+
ship_to_customer_site_id: z.string().min(1).optional(),
|
|
50
|
+
ship_to_party_contact_point_id: z.string().min(1).optional(),
|
|
51
|
+
payment_term_id: z.string().min(1).optional(),
|
|
52
|
+
payment_method_id: z.string().min(1).optional(),
|
|
53
|
+
price_list_version_id: z.string().min(1).optional(),
|
|
54
|
+
priced_date: z.string().min(1).optional(),
|
|
55
|
+
request_arrival_date: z.string().min(1).optional(),
|
|
56
|
+
request_ship_date: z.string().min(1).optional(),
|
|
57
|
+
earliest_arrival_date: z.string().min(1).optional(),
|
|
58
|
+
latest_arrival_date: z.string().min(1).optional(),
|
|
59
|
+
earliest_ship_date: z.string().min(1).optional(),
|
|
60
|
+
latest_ship_date: z.string().min(1).optional(),
|
|
61
|
+
allow_partial_ship: z.boolean().optional(),
|
|
62
|
+
shipment_terms_name: z.string().max(32).optional(),
|
|
63
|
+
shipping_instructions: z.string().max(2048).optional(),
|
|
64
|
+
packing_instructions: z.string().max(2048).optional(),
|
|
65
|
+
customer_po_number: z.string().max(64).optional(),
|
|
66
|
+
customer_reference: z.string().max(256).optional(),
|
|
67
|
+
sales_channel_name: z.string().max(32).optional(),
|
|
68
|
+
salesperson_number: z.number().int().optional(),
|
|
69
|
+
source_deal_id: z
|
|
70
|
+
.string()
|
|
71
|
+
.min(1)
|
|
72
|
+
.optional()
|
|
73
|
+
.describe('UUID of the sfa_deals row this order was quoted from'),
|
|
74
|
+
org_id: z.string().min(1).optional(),
|
|
75
|
+
metadata: z.record(z.unknown()).optional(),
|
|
76
|
+
confirm: confirmFlagSchema,
|
|
77
|
+
idempotency_key: unenforcedIdempotencyKeySchema,
|
|
78
|
+
}),
|
|
79
|
+
capabilities: [cap('qom_order_headers', 'INSERT')],
|
|
80
|
+
sideEffect: 'provisioning',
|
|
81
|
+
confirmation: 'caller_confirms',
|
|
82
|
+
idempotency: 'natural_key',
|
|
83
|
+
handler: async (args, ctx) => {
|
|
84
|
+
const input = args;
|
|
85
|
+
const body = {
|
|
86
|
+
order_code: input.order_code,
|
|
87
|
+
order_status: input.order_status,
|
|
88
|
+
order_type: input.order_type,
|
|
89
|
+
};
|
|
90
|
+
for (const field of [
|
|
91
|
+
'order_date',
|
|
92
|
+
'order_currency_code',
|
|
93
|
+
'sold_to_customer_id',
|
|
94
|
+
'sold_to_customer_site_id',
|
|
95
|
+
'sold_to_party_contact_point_id',
|
|
96
|
+
'ship_to_customer_id',
|
|
97
|
+
'ship_to_customer_site_id',
|
|
98
|
+
'ship_to_party_contact_point_id',
|
|
99
|
+
'payment_term_id',
|
|
100
|
+
'payment_method_id',
|
|
101
|
+
'price_list_version_id',
|
|
102
|
+
'priced_date',
|
|
103
|
+
'request_arrival_date',
|
|
104
|
+
'request_ship_date',
|
|
105
|
+
'earliest_arrival_date',
|
|
106
|
+
'latest_arrival_date',
|
|
107
|
+
'earliest_ship_date',
|
|
108
|
+
'latest_ship_date',
|
|
109
|
+
'allow_partial_ship',
|
|
110
|
+
'shipment_terms_name',
|
|
111
|
+
'shipping_instructions',
|
|
112
|
+
'packing_instructions',
|
|
113
|
+
'customer_po_number',
|
|
114
|
+
'customer_reference',
|
|
115
|
+
'sales_channel_name',
|
|
116
|
+
'salesperson_number',
|
|
117
|
+
'source_deal_id',
|
|
118
|
+
'org_id',
|
|
119
|
+
'metadata',
|
|
120
|
+
]) {
|
|
121
|
+
if (input[field] !== undefined)
|
|
122
|
+
body[field] = input[field];
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
const rows = await ctx.apiClient.post(`${ctx.apiClient.dbBasePath}/qom_order_headers?select=*`, body, { headers: writeHeadersWithIdempotency(input.idempotency_key) });
|
|
126
|
+
return successResponse(redactRow(rows[0]));
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
return errorResponse(API_ERROR, `Failed to create QOM order: ${error.message}`);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=qom-order-create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qom-order-create.js","sourceRoot":"","sources":["../../../src/tools/qom/qom-order-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EACL,iBAAiB,EACjB,8BAA8B,EAC9B,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAS;IACtC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EACT,wFAAwF;QACxF,iFAAiF;QACjF,iFAAiF;QACjF,4FAA4F;IAC9F,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,UAAU,EAAE,CAAC;aACV,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,GAAG,CAAC,EAAE,CAAC;aACP,QAAQ,CAAC,qEAAqE,CAAC;QAClF,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,iCAAiC,CAAC;QACnF,UAAU,EAAE,CAAC;aACV,IAAI,CAAC,CAAC,aAAa,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;aACjD,QAAQ,CAAC,uBAAuB,CAAC;QACpC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;QACxE,mBAAm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G,CAAC,SAAS,CAAC,IAAI,CACnC,GAAG,GAAG,CAAC,SAAS,CAAC,UAAU,6BAA6B,EACxD,IAAI,EACJ,EAAE,OAAO,EAAE,2BAA2B,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CAChE,CAAC;YACF,OAAO,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7C,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,aAAa,CAClB,SAAS,EACT,+BAA+B,KAAK,CAAC,OAAO,EAAE,CAC/C,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Tool } from '../registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* State-transition semantic tool: flag a QOM order as on hold
|
|
4
|
+
* (`qom_order_headers.is_on_hold=true`).
|
|
5
|
+
*
|
|
6
|
+
* Nothing in Persist or persist-functions reads `is_on_hold` on an
|
|
7
|
+
* order, so the flag records intent and does not stop payment or
|
|
8
|
+
* fulfilment. The reason is merged into `metadata.hold_reason`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const qomOrderHoldPlaceTool: Tool;
|
|
11
|
+
//# sourceMappingURL=qom-order-hold-place.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qom-order-hold-place.d.ts","sourceRoot":"","sources":["../../../src/tools/qom/qom-order-hold-place.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAYtC;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,EAAE,IAoCnC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { cap } from '../../capabilities/tool-capability.js';
|
|
3
|
+
import { redactRow } from '../../generated-reads/index.js';
|
|
4
|
+
import { confirmFlagSchema, reasonSchema, unenforcedIdempotencyKeySchema, } from '../_shared/side-effect.js';
|
|
5
|
+
import { softDeactivate } from '../_shared/soft-deactivate.js';
|
|
6
|
+
const FINISHED_STATUSES = ['CANCELLED', 'EXPIRED', 'FULFILLED'];
|
|
7
|
+
/**
|
|
8
|
+
* State-transition semantic tool: flag a QOM order as on hold
|
|
9
|
+
* (`qom_order_headers.is_on_hold=true`).
|
|
10
|
+
*
|
|
11
|
+
* Nothing in Persist or persist-functions reads `is_on_hold` on an
|
|
12
|
+
* order, so the flag records intent and does not stop payment or
|
|
13
|
+
* fulfilment. The reason is merged into `metadata.hold_reason`.
|
|
14
|
+
*/
|
|
15
|
+
export const qomOrderHoldPlaceTool = {
|
|
16
|
+
name: 'qom_order_hold_place',
|
|
17
|
+
description: 'Flag a QOM order as on hold (is_on_hold=true) and merge the reason into metadata. The flag ' +
|
|
18
|
+
'is a record only: Persist does not read it, so it does not stop payment or fulfilment. ' +
|
|
19
|
+
'Refused for CANCELLED, EXPIRED and FULFILLED orders. Requires confirm=true and a reason. ' +
|
|
20
|
+
'An order already on hold is returned unchanged, so retries are safe.',
|
|
21
|
+
inputSchema: z.object({
|
|
22
|
+
id: z.string().min(1).describe('UUID of the order to hold'),
|
|
23
|
+
reason: reasonSchema.describe('Human-readable reason, merged into metadata'),
|
|
24
|
+
confirm: confirmFlagSchema,
|
|
25
|
+
idempotency_key: unenforcedIdempotencyKeySchema,
|
|
26
|
+
}),
|
|
27
|
+
capabilities: [cap('qom_order_headers', 'UPDATE')],
|
|
28
|
+
sideEffect: 'state_change',
|
|
29
|
+
confirmation: 'caller_confirms',
|
|
30
|
+
idempotency: 'natural_key',
|
|
31
|
+
handler: async (args, ctx) => {
|
|
32
|
+
const input = args;
|
|
33
|
+
return softDeactivate(ctx, {
|
|
34
|
+
table: 'qom_order_headers',
|
|
35
|
+
id: input.id,
|
|
36
|
+
label: 'QOM order',
|
|
37
|
+
verb: 'place hold on',
|
|
38
|
+
isDone: (row) => row.is_on_hold === true,
|
|
39
|
+
reject: (row) => FINISHED_STATUSES.includes(row.order_status)
|
|
40
|
+
? `QOM order ${input.id} is ${row.order_status} and cannot be put on hold`
|
|
41
|
+
: undefined,
|
|
42
|
+
changes: () => ({ is_on_hold: true }),
|
|
43
|
+
reasonKey: 'hold_reason',
|
|
44
|
+
reason: input.reason,
|
|
45
|
+
idempotencyKey: input.idempotency_key,
|
|
46
|
+
present: redactRow,
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=qom-order-hold-place.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qom-order-hold-place.js","sourceRoot":"","sources":["../../../src/tools/qom/qom-order-hold-place.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,8BAA8B,GAC/B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,iBAAiB,GAAG,CAAC,WAAW,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AAEhE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAS;IACzC,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EACT,6FAA6F;QAC7F,yFAAyF;QACzF,2FAA2F;QAC3F,sEAAsE;IACxE,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC;QAC3D,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,6CAA6C,CAAC;QAC5E,OAAO,EAAE,iBAAiB;QAC1B,eAAe,EAAE,8BAA8B;KAChD,CAAC;IACF,YAAY,EAAE,CAAC,GAAG,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;IAClD,UAAU,EAAE,cAAc;IAC1B,YAAY,EAAE,iBAAiB;IAC/B,WAAW,EAAE,aAAa;IAC1B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QAC3B,MAAM,KAAK,GAAG,IAAgE,CAAC;QAC/E,OAAO,cAAc,CAAC,GAAG,EAAE;YACzB,KAAK,EAAE,mBAAmB;YAC1B,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,eAAe;YACrB,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,KAAK,IAAI;YACxC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CACd,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC;gBAC1C,CAAC,CAAC,aAAa,KAAK,CAAC,EAAE,OAAO,GAAG,CAAC,YAAY,4BAA4B;gBAC1E,CAAC,CAAC,SAAS;YACf,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;YACrC,SAAS,EAAE,aAAa;YACxB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,cAAc,EAAE,KAAK,CAAC,eAAe;YACrC,OAAO,EAAE,SAAS;SACnB,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Tool } from '../registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* State-transition semantic tool: clear a QOM order hold flag
|
|
4
|
+
* (`qom_order_headers.is_on_hold=false`). The reason is merged into
|
|
5
|
+
* `metadata.hold_release_reason`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const qomOrderHoldReleaseTool: Tool;
|
|
8
|
+
//# sourceMappingURL=qom-order-hold-release.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qom-order-hold-release.d.ts","sourceRoot":"","sources":["../../../src/tools/qom/qom-order-hold-release.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAUtC;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,IA+BrC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { cap } from '../../capabilities/tool-capability.js';
|
|
3
|
+
import { redactRow } from '../../generated-reads/index.js';
|
|
4
|
+
import { confirmFlagSchema, reasonSchema, unenforcedIdempotencyKeySchema, } from '../_shared/side-effect.js';
|
|
5
|
+
import { softDeactivate } from '../_shared/soft-deactivate.js';
|
|
6
|
+
/**
|
|
7
|
+
* State-transition semantic tool: clear a QOM order hold flag
|
|
8
|
+
* (`qom_order_headers.is_on_hold=false`). The reason is merged into
|
|
9
|
+
* `metadata.hold_release_reason`.
|
|
10
|
+
*/
|
|
11
|
+
export const qomOrderHoldReleaseTool = {
|
|
12
|
+
name: 'qom_order_hold_release',
|
|
13
|
+
description: 'Clear a QOM order hold flag (is_on_hold=false) and merge the reason into metadata. ' +
|
|
14
|
+
'Requires confirm=true and a reason. An order not on hold is returned unchanged, so retries ' +
|
|
15
|
+
'are safe.',
|
|
16
|
+
inputSchema: z.object({
|
|
17
|
+
id: z.string().min(1).describe('UUID of the order whose hold is being released'),
|
|
18
|
+
reason: reasonSchema.describe('Human-readable reason, merged into metadata'),
|
|
19
|
+
confirm: confirmFlagSchema,
|
|
20
|
+
idempotency_key: unenforcedIdempotencyKeySchema,
|
|
21
|
+
}),
|
|
22
|
+
capabilities: [cap('qom_order_headers', 'UPDATE')],
|
|
23
|
+
sideEffect: 'state_change',
|
|
24
|
+
confirmation: 'caller_confirms',
|
|
25
|
+
idempotency: 'natural_key',
|
|
26
|
+
handler: async (args, ctx) => {
|
|
27
|
+
const input = args;
|
|
28
|
+
return softDeactivate(ctx, {
|
|
29
|
+
table: 'qom_order_headers',
|
|
30
|
+
id: input.id,
|
|
31
|
+
label: 'QOM order',
|
|
32
|
+
verb: 'release hold on',
|
|
33
|
+
isDone: (row) => row.is_on_hold !== true,
|
|
34
|
+
changes: () => ({ is_on_hold: false }),
|
|
35
|
+
reasonKey: 'hold_release_reason',
|
|
36
|
+
reason: input.reason,
|
|
37
|
+
idempotencyKey: input.idempotency_key,
|
|
38
|
+
present: redactRow,
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=qom-order-hold-release.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qom-order-hold-release.js","sourceRoot":"","sources":["../../../src/tools/qom/qom-order-hold-release.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,8BAA8B,GAC/B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAS;IAC3C,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EACT,qFAAqF;QACrF,6FAA6F;QAC7F,WAAW;IACb,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,gDAAgD,CAAC;QAChF,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,6CAA6C,CAAC;QAC5E,OAAO,EAAE,iBAAiB;QAC1B,eAAe,EAAE,8BAA8B;KAChD,CAAC;IACF,YAAY,EAAE,CAAC,GAAG,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;IAClD,UAAU,EAAE,cAAc;IAC1B,YAAY,EAAE,iBAAiB;IAC/B,WAAW,EAAE,aAAa;IAC1B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QAC3B,MAAM,KAAK,GAAG,IAAgE,CAAC;QAC/E,OAAO,cAAc,CAAC,GAAG,EAAE;YACzB,KAAK,EAAE,mBAAmB;YAC1B,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,iBAAiB;YACvB,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,KAAK,IAAI;YACxC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;YACtC,SAAS,EAAE,qBAAqB;YAChC,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,cAAc,EAAE,KAAK,CAAC,eAAe;YACrC,OAAO,EAAE,SAAS;SACnB,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Tool } from '../registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* Explicit-schema create for a QOM order line (`qom_order_lines`).
|
|
4
|
+
*
|
|
5
|
+
* The tool omits every fulfilment / cancellation column
|
|
6
|
+
* (`fulfilled_qty`, `shipped_qty`, `cancelled_qty`, `actual_ship_date`,
|
|
7
|
+
* `is_cancelled`, `is_on_hold`, `is_open`), so a caller cannot mark a
|
|
8
|
+
* line shipped without a shipment.
|
|
9
|
+
*
|
|
10
|
+
* Persist stores `unit_list_price` and `unit_selling_price` as supplied
|
|
11
|
+
* and accepts a new line on any order, so the tool reads the order first
|
|
12
|
+
* and refuses one that is not DRAFT or OPEN. That check is not atomic
|
|
13
|
+
* (see the Persist work item for QOM order state rules).
|
|
14
|
+
*
|
|
15
|
+
* Unique key: (tenant_id, order_header_id, order_line_number).
|
|
16
|
+
*/
|
|
17
|
+
export declare const qomOrderLineAddTool: Tool;
|
|
18
|
+
//# sourceMappingURL=qom-order-line-add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qom-order-line-add.d.ts","sourceRoot":"","sources":["../../../src/tools/qom/qom-order-line-add.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAUtC;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,EAAE,IA6FjC,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { API_ERROR, errorResponse, successResponse } from '../types.js';
|
|
3
|
+
import { cap } from '../../capabilities/tool-capability.js';
|
|
4
|
+
import { unenforcedIdempotencyKeySchema, writeHeadersWithIdempotency, } from '../_shared/side-effect.js';
|
|
5
|
+
const OPEN_ORDER_STATUSES = ['DRAFT', 'OPEN'];
|
|
6
|
+
/**
|
|
7
|
+
* Explicit-schema create for a QOM order line (`qom_order_lines`).
|
|
8
|
+
*
|
|
9
|
+
* The tool omits every fulfilment / cancellation column
|
|
10
|
+
* (`fulfilled_qty`, `shipped_qty`, `cancelled_qty`, `actual_ship_date`,
|
|
11
|
+
* `is_cancelled`, `is_on_hold`, `is_open`), so a caller cannot mark a
|
|
12
|
+
* line shipped without a shipment.
|
|
13
|
+
*
|
|
14
|
+
* Persist stores `unit_list_price` and `unit_selling_price` as supplied
|
|
15
|
+
* and accepts a new line on any order, so the tool reads the order first
|
|
16
|
+
* and refuses one that is not DRAFT or OPEN. That check is not atomic
|
|
17
|
+
* (see the Persist work item for QOM order state rules).
|
|
18
|
+
*
|
|
19
|
+
* Unique key: (tenant_id, order_header_id, order_line_number).
|
|
20
|
+
*/
|
|
21
|
+
export const qomOrderLineAddTool = {
|
|
22
|
+
name: 'qom_order_line_add',
|
|
23
|
+
description: 'Add a line to a DRAFT or OPEN order (qom_order_lines). Fulfilment and cancellation columns ' +
|
|
24
|
+
'cannot be set. Persist stores the prices as supplied and does not check them against the ' +
|
|
25
|
+
'price list. One line per order_line_number: a retry fails with a duplicate-key error ' +
|
|
26
|
+
'instead of adding a second line.',
|
|
27
|
+
inputSchema: z.object({
|
|
28
|
+
order_header_id: z
|
|
29
|
+
.string()
|
|
30
|
+
.min(1)
|
|
31
|
+
.describe('UUID of the parent qom_order_headers row (required)'),
|
|
32
|
+
order_line_number: z
|
|
33
|
+
.number()
|
|
34
|
+
.int()
|
|
35
|
+
.min(1)
|
|
36
|
+
.describe('Line number, unique within the order'),
|
|
37
|
+
order_line_status: z.enum(['OPEN', 'CONFIRMED']).describe('Initial line status (required)'),
|
|
38
|
+
order_line_type: z.enum(['STANDARD']).describe('Line type (required)'),
|
|
39
|
+
item_id: z
|
|
40
|
+
.string()
|
|
41
|
+
.min(1)
|
|
42
|
+
.describe('UUID of the pcm_items row being ordered (required)'),
|
|
43
|
+
merchant_item_id: z.string().min(1).optional(),
|
|
44
|
+
item_order_line_description: z.string().optional(),
|
|
45
|
+
ordered_qty: z.number().describe('Quantity ordered (required)'),
|
|
46
|
+
ordered_uom: z.string().max(3).optional(),
|
|
47
|
+
unit_list_price: z.number().optional(),
|
|
48
|
+
unit_selling_price: z.number().optional(),
|
|
49
|
+
scheduled_ship_date: z.string().min(1).optional(),
|
|
50
|
+
customer_line_reference: z.string().max(256).optional(),
|
|
51
|
+
org_id: z.string().min(1).optional(),
|
|
52
|
+
metadata: z.record(z.unknown()).optional(),
|
|
53
|
+
idempotency_key: unenforcedIdempotencyKeySchema,
|
|
54
|
+
}),
|
|
55
|
+
capabilities: [cap('qom_order_lines', 'INSERT'), cap('qom_order_headers', 'SELECT')],
|
|
56
|
+
sideEffect: 'state_change',
|
|
57
|
+
confirmation: 'none',
|
|
58
|
+
idempotency: 'natural_key',
|
|
59
|
+
handler: async (args, ctx) => {
|
|
60
|
+
const input = args;
|
|
61
|
+
const body = {
|
|
62
|
+
order_header_id: input.order_header_id,
|
|
63
|
+
order_line_number: input.order_line_number,
|
|
64
|
+
order_line_status: input.order_line_status,
|
|
65
|
+
order_line_type: input.order_line_type,
|
|
66
|
+
item_id: input.item_id,
|
|
67
|
+
ordered_qty: input.ordered_qty,
|
|
68
|
+
};
|
|
69
|
+
for (const field of [
|
|
70
|
+
'merchant_item_id',
|
|
71
|
+
'item_order_line_description',
|
|
72
|
+
'ordered_uom',
|
|
73
|
+
'unit_list_price',
|
|
74
|
+
'unit_selling_price',
|
|
75
|
+
'scheduled_ship_date',
|
|
76
|
+
'customer_line_reference',
|
|
77
|
+
'org_id',
|
|
78
|
+
'metadata',
|
|
79
|
+
]) {
|
|
80
|
+
if (input[field] !== undefined)
|
|
81
|
+
body[field] = input[field];
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
const orders = await ctx.apiClient.get(`${ctx.apiClient.dbBasePath}/qom_order_headers?id=eq.${input.order_header_id}&select=id,order_status,is_cancelled`);
|
|
85
|
+
const order = orders?.[0];
|
|
86
|
+
if (!order) {
|
|
87
|
+
return errorResponse(API_ERROR, `QOM order ${input.order_header_id} not found or not accessible`);
|
|
88
|
+
}
|
|
89
|
+
if (order.is_cancelled === true || !OPEN_ORDER_STATUSES.includes(order.order_status)) {
|
|
90
|
+
return errorResponse(API_ERROR, `QOM order ${input.order_header_id} is ${order.order_status}: ` +
|
|
91
|
+
'lines can only be added to DRAFT or OPEN orders');
|
|
92
|
+
}
|
|
93
|
+
const rows = await ctx.apiClient.post(`${ctx.apiClient.dbBasePath}/qom_order_lines?select=*`, body, { headers: writeHeadersWithIdempotency(input.idempotency_key) });
|
|
94
|
+
return successResponse(rows[0]);
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
return errorResponse(API_ERROR, `Failed to add QOM order line: ${error.message}`);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=qom-order-line-add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qom-order-line-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ClC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,aAAa,CAClB,SAAS,EACT,iCAAiC,KAAK,CAAC,OAAO,EAAE,CACjD,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Tool } from '../registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* Explicit-schema create for a QOM quote header (`qom_quote_headers`),
|
|
4
|
+
* the parent of quote versions and quote lines. Quotes are sold to a
|
|
5
|
+
* party (`prm_parties`), not a customer, so `sold_to_party_id` is
|
|
6
|
+
* required, as it is in Persist.
|
|
7
|
+
*
|
|
8
|
+
* `quote_status` is not an input: Persist defaults it to `O` (open), and
|
|
9
|
+
* the other QOM_QUOTE_STATUS values (CUSTOMER_CONFIRMED,
|
|
10
|
+
* SUPPLIER_CONFIRMED, FINAL, CLOSED) are later lifecycle steps.
|
|
11
|
+
* `is_open`, `is_on_hold` and `is_cancelled` are not inputs either.
|
|
12
|
+
*
|
|
13
|
+
* Persist has no unique key on `quote_code` and generates one when none
|
|
14
|
+
* is sent, so a retry creates a second quote. When the caller supplies a
|
|
15
|
+
* `quote_code`, the tool first looks for a visible quote with that code
|
|
16
|
+
* (in `org_id`, if given) and refuses to create another. That check is
|
|
17
|
+
* not atomic.
|
|
18
|
+
*/
|
|
19
|
+
export declare const qomQuoteCreateTool: Tool;
|
|
20
|
+
//# sourceMappingURL=qom-quote-create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qom-quote-create.d.ts","sourceRoot":"","sources":["../../../src/tools/qom/qom-quote-create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAStC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,kBAAkB,EAAE,IAkIhC,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { API_ERROR, errorResponse, successResponse } from '../types.js';
|
|
3
|
+
import { cap } from '../../capabilities/tool-capability.js';
|
|
4
|
+
import { confirmFlagSchema, unenforcedIdempotencyKeySchema, writeHeadersWithIdempotency, } from '../_shared/side-effect.js';
|
|
5
|
+
/**
|
|
6
|
+
* Explicit-schema create for a QOM quote header (`qom_quote_headers`),
|
|
7
|
+
* the parent of quote versions and quote lines. Quotes are sold to a
|
|
8
|
+
* party (`prm_parties`), not a customer, so `sold_to_party_id` is
|
|
9
|
+
* required, as it is in Persist.
|
|
10
|
+
*
|
|
11
|
+
* `quote_status` is not an input: Persist defaults it to `O` (open), and
|
|
12
|
+
* the other QOM_QUOTE_STATUS values (CUSTOMER_CONFIRMED,
|
|
13
|
+
* SUPPLIER_CONFIRMED, FINAL, CLOSED) are later lifecycle steps.
|
|
14
|
+
* `is_open`, `is_on_hold` and `is_cancelled` are not inputs either.
|
|
15
|
+
*
|
|
16
|
+
* Persist has no unique key on `quote_code` and generates one when none
|
|
17
|
+
* is sent, so a retry creates a second quote. When the caller supplies a
|
|
18
|
+
* `quote_code`, the tool first looks for a visible quote with that code
|
|
19
|
+
* (in `org_id`, if given) and refuses to create another. That check is
|
|
20
|
+
* not atomic.
|
|
21
|
+
*/
|
|
22
|
+
export const qomQuoteCreateTool = {
|
|
23
|
+
name: 'qom_quote_create',
|
|
24
|
+
description: 'Create a new open quote (qom_quote_headers) for a party, to which quote versions and lines ' +
|
|
25
|
+
'are then added. Requires confirm=true. quote_status always starts as O (open), and ' +
|
|
26
|
+
'is_open, is_on_hold and is_cancelled cannot be set. Persist generates quote_code when it ' +
|
|
27
|
+
'is omitted. Not deduplicated: a retry without quote_code creates a second quote, so check ' +
|
|
28
|
+
'qom_quote_headers_list before retrying. A quote_code already used by a visible quote is refused.',
|
|
29
|
+
inputSchema: z.object({
|
|
30
|
+
quote_type: z.enum(['QUOTATION', 'ESTIMATE']).describe('Quote type (required)'),
|
|
31
|
+
sold_to_party_id: z
|
|
32
|
+
.string()
|
|
33
|
+
.min(1)
|
|
34
|
+
.describe('UUID of the prm_parties row the quote is for (required)'),
|
|
35
|
+
quote_code: z
|
|
36
|
+
.string()
|
|
37
|
+
.min(1)
|
|
38
|
+
.max(32)
|
|
39
|
+
.optional()
|
|
40
|
+
.describe('Business quote reference. Persist generates one when omitted'),
|
|
41
|
+
quote_date: z.string().min(1).optional().describe('ISO 8601 quote date (defaults to today)'),
|
|
42
|
+
start_date: z.string().min(1).optional().describe('ISO 8601 date the quote is valid from'),
|
|
43
|
+
end_date: z.string().min(1).optional().describe('ISO 8601 date the quote expires'),
|
|
44
|
+
quote_currency_code: z.string().length(3).optional(),
|
|
45
|
+
sold_to_party_site_id: z.string().min(1).optional(),
|
|
46
|
+
sold_to_contact_point_id: z.string().min(1).optional(),
|
|
47
|
+
ship_to_party_id: z.string().min(1).optional(),
|
|
48
|
+
ship_to_party_site_id: z.string().min(1).optional(),
|
|
49
|
+
ship_to_contact_point_id: z.string().min(1).optional(),
|
|
50
|
+
payment_term_id: z.string().min(1).optional(),
|
|
51
|
+
payment_method_id: z.string().min(1).optional(),
|
|
52
|
+
priced_date: z.string().min(1).optional(),
|
|
53
|
+
requested_ship_date: z.string().min(1).optional(),
|
|
54
|
+
earliest_ship_date: z.string().min(1).optional(),
|
|
55
|
+
latest_ship_date: z.string().min(1).optional(),
|
|
56
|
+
requested_arrival_date: z.string().min(1).optional(),
|
|
57
|
+
earliest_arrival_date: z.string().min(1).optional(),
|
|
58
|
+
latest_arrival_date: z.string().min(1).optional(),
|
|
59
|
+
allow_partial_ship: z.boolean().optional(),
|
|
60
|
+
shipment_terms_name: z.string().max(32).optional(),
|
|
61
|
+
shipping_instructions: z.string().max(2048).optional(),
|
|
62
|
+
packing_instructions: z.string().max(2048).optional(),
|
|
63
|
+
customer_po_number: z.string().max(64).optional(),
|
|
64
|
+
customer_reference: z.string().max(256).optional(),
|
|
65
|
+
sales_channel_name: z.string().max(32).optional(),
|
|
66
|
+
salesperson_number: z.number().int().optional(),
|
|
67
|
+
source_deal_id: z
|
|
68
|
+
.string()
|
|
69
|
+
.min(1)
|
|
70
|
+
.optional()
|
|
71
|
+
.describe('UUID of the sfa_deals row this quote is for'),
|
|
72
|
+
org_id: z.string().min(1).optional(),
|
|
73
|
+
metadata: z.record(z.unknown()).optional(),
|
|
74
|
+
confirm: confirmFlagSchema,
|
|
75
|
+
idempotency_key: unenforcedIdempotencyKeySchema,
|
|
76
|
+
}),
|
|
77
|
+
capabilities: [cap('qom_quote_headers', 'INSERT'), cap('qom_quote_headers', 'SELECT')],
|
|
78
|
+
sideEffect: 'provisioning',
|
|
79
|
+
confirmation: 'caller_confirms',
|
|
80
|
+
idempotency: 'not_idempotent',
|
|
81
|
+
handler: async (args, ctx) => {
|
|
82
|
+
const input = args;
|
|
83
|
+
const body = {
|
|
84
|
+
quote_type: input.quote_type,
|
|
85
|
+
sold_to_party_id: input.sold_to_party_id,
|
|
86
|
+
};
|
|
87
|
+
for (const field of [
|
|
88
|
+
'quote_code',
|
|
89
|
+
'quote_date',
|
|
90
|
+
'start_date',
|
|
91
|
+
'end_date',
|
|
92
|
+
'quote_currency_code',
|
|
93
|
+
'sold_to_party_site_id',
|
|
94
|
+
'sold_to_contact_point_id',
|
|
95
|
+
'ship_to_party_id',
|
|
96
|
+
'ship_to_party_site_id',
|
|
97
|
+
'ship_to_contact_point_id',
|
|
98
|
+
'payment_term_id',
|
|
99
|
+
'payment_method_id',
|
|
100
|
+
'priced_date',
|
|
101
|
+
'requested_ship_date',
|
|
102
|
+
'earliest_ship_date',
|
|
103
|
+
'latest_ship_date',
|
|
104
|
+
'requested_arrival_date',
|
|
105
|
+
'earliest_arrival_date',
|
|
106
|
+
'latest_arrival_date',
|
|
107
|
+
'allow_partial_ship',
|
|
108
|
+
'shipment_terms_name',
|
|
109
|
+
'shipping_instructions',
|
|
110
|
+
'packing_instructions',
|
|
111
|
+
'customer_po_number',
|
|
112
|
+
'customer_reference',
|
|
113
|
+
'sales_channel_name',
|
|
114
|
+
'salesperson_number',
|
|
115
|
+
'source_deal_id',
|
|
116
|
+
'org_id',
|
|
117
|
+
'metadata',
|
|
118
|
+
]) {
|
|
119
|
+
if (input[field] !== undefined)
|
|
120
|
+
body[field] = input[field];
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
if (input.quote_code !== undefined) {
|
|
124
|
+
const filters = [`quote_code=eq.${encodeURIComponent(input.quote_code)}`];
|
|
125
|
+
if (input.org_id !== undefined) {
|
|
126
|
+
filters.push(`org_id=eq.${encodeURIComponent(input.org_id)}`);
|
|
127
|
+
}
|
|
128
|
+
const existing = await ctx.apiClient.get(`${ctx.apiClient.dbBasePath}/qom_quote_headers?${filters.join('&')}&select=id&limit=1`);
|
|
129
|
+
if (existing?.[0]) {
|
|
130
|
+
return errorResponse(API_ERROR, `QOM quote ${input.quote_code} already exists (id ${existing[0].id}): ` +
|
|
131
|
+
'use that quote or choose another quote_code');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const rows = await ctx.apiClient.post(`${ctx.apiClient.dbBasePath}/qom_quote_headers?select=*`, body, { headers: writeHeadersWithIdempotency(input.idempotency_key) });
|
|
135
|
+
return successResponse(rows[0]);
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
return errorResponse(API_ERROR, `Failed to create QOM quote: ${error.message}`);
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=qom-quote-create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qom-quote-create.js","sourceRoot":"","sources":["../../../src/tools/qom/qom-quote-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAC5D,OAAO,EACL,iBAAiB,EACjB,8BA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,SAAS,CAAC,UAAU,sBAAsB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,oBAAoB,CACvF,CAAC;gBACF,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBAClB,OAAO,aAAa,CAClB,SAAS,EACT,aAAa,KAAK,CAAC,UAAU,uBAAuB,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK;wBACrE,6CAA6C,CAChD,CAAC;gBACJ,CAAC;YACH,CAAC;YACD,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CACnC,GAAG,GAAG,CAAC,SAAS,CAAC,UAAU,6BAA6B,EACxD,IAAI,EACJ,EAAE,OAAO,EAAE,2BAA2B,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CAChE,CAAC;YACF,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,aAAa,CAClB,SAAS,EACT,+BAA+B,KAAK,CAAC,OAAO,EAAE,CAC/C,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Tool } from '../registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* Explicit-schema create for a QOM quote line (`qom_quote_lines`).
|
|
4
|
+
*
|
|
5
|
+
* The tool omits line status, which defaults to `O` in Persist.
|
|
6
|
+
* `quote_header_id` and `org_id` are derived by Persist triggers.
|
|
7
|
+
*
|
|
8
|
+
* Persist stores the prices as supplied: it does not compare them with
|
|
9
|
+
* the price list or with each other. Unique key:
|
|
10
|
+
* (tenant_id, quote_version_id, quote_line_number).
|
|
11
|
+
*/
|
|
12
|
+
export declare const qomQuoteLineAddTool: Tool;
|
|
13
|
+
//# sourceMappingURL=qom-quote-line-add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qom-quote-line-add.d.ts","sourceRoot":"","sources":["../../../src/tools/qom/qom-quote-line-add.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAQtC;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,IAkFjC,CAAC"}
|