@raytio/mcp-server 10.2.0 → 10.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +2 -0
  2. package/contracts/persist/mcp_resource_contract.json +4 -4
  3. package/dist/authorization.d.ts.map +1 -1
  4. package/dist/authorization.js +4 -0
  5. package/dist/authorization.js.map +1 -1
  6. package/dist/generated-reads/guardrails.js +1 -1
  7. package/dist/generated-reads/guardrails.js.map +1 -1
  8. package/dist/generated-reads/resource-tools.d.ts.map +1 -1
  9. package/dist/generated-reads/resource-tools.js +8 -5
  10. package/dist/generated-reads/resource-tools.js.map +1 -1
  11. package/dist/tools/_shared/date-range.d.ts +16 -0
  12. package/dist/tools/_shared/date-range.d.ts.map +1 -0
  13. package/dist/tools/_shared/date-range.js +28 -0
  14. package/dist/tools/_shared/date-range.js.map +1 -0
  15. package/dist/tools/_shared/side-effect.d.ts.map +1 -1
  16. package/dist/tools/_shared/side-effect.js +3 -1
  17. package/dist/tools/_shared/side-effect.js.map +1 -1
  18. package/dist/tools/_shared/soft-deactivate.d.ts +2 -0
  19. package/dist/tools/_shared/soft-deactivate.d.ts.map +1 -1
  20. package/dist/tools/_shared/soft-deactivate.js +3 -0
  21. package/dist/tools/_shared/soft-deactivate.js.map +1 -1
  22. package/dist/tools/domains.d.ts.map +1 -1
  23. package/dist/tools/domains.js +39 -1
  24. package/dist/tools/domains.js.map +1 -1
  25. package/dist/tools/gpm/generated-reads.d.ts +5 -0
  26. package/dist/tools/gpm/generated-reads.d.ts.map +1 -0
  27. package/dist/tools/gpm/generated-reads.js +28 -0
  28. package/dist/tools/gpm/generated-reads.js.map +1 -0
  29. package/dist/tools/gpm/gpm-item-deactivate.d.ts +11 -0
  30. package/dist/tools/gpm/gpm-item-deactivate.d.ts.map +1 -0
  31. package/dist/tools/gpm/gpm-item-deactivate.js +45 -0
  32. package/dist/tools/gpm/gpm-item-deactivate.js.map +1 -0
  33. package/dist/tools/gpm/gpm-item-register.d.ts +21 -0
  34. package/dist/tools/gpm/gpm-item-register.d.ts.map +1 -0
  35. package/dist/tools/gpm/gpm-item-register.js +149 -0
  36. package/dist/tools/gpm/gpm-item-register.js.map +1 -0
  37. package/dist/tools/gpm/index.d.ts +5 -0
  38. package/dist/tools/gpm/index.d.ts.map +1 -0
  39. package/dist/tools/gpm/index.js +10 -0
  40. package/dist/tools/gpm/index.js.map +1 -0
  41. package/dist/tools/imports/index.d.ts +16 -93
  42. package/dist/tools/imports/index.d.ts.map +1 -1
  43. package/dist/tools/imports/index.js +11 -3
  44. package/dist/tools/imports/index.js.map +1 -1
  45. package/dist/tools/pbm/generated-reads.d.ts +5 -0
  46. package/dist/tools/pbm/generated-reads.d.ts.map +1 -0
  47. package/dist/tools/pbm/generated-reads.js +32 -0
  48. package/dist/tools/pbm/generated-reads.js.map +1 -0
  49. package/dist/tools/pbm/index.d.ts +5 -0
  50. package/dist/tools/pbm/index.d.ts.map +1 -0
  51. package/dist/tools/pbm/index.js +17 -0
  52. package/dist/tools/pbm/index.js.map +1 -0
  53. package/dist/tools/pbm/pbm-customer-entitlement-override-set.d.ts +26 -0
  54. package/dist/tools/pbm/pbm-customer-entitlement-override-set.d.ts.map +1 -0
  55. package/dist/tools/pbm/pbm-customer-entitlement-override-set.js +78 -0
  56. package/dist/tools/pbm/pbm-customer-entitlement-override-set.js.map +1 -0
  57. package/dist/tools/pbm/pbm-subscription-cancel.d.ts +21 -0
  58. package/dist/tools/pbm/pbm-subscription-cancel.d.ts.map +1 -0
  59. package/dist/tools/pbm/pbm-subscription-cancel.js +86 -0
  60. package/dist/tools/pbm/pbm-subscription-cancel.js.map +1 -0
  61. package/dist/tools/pbm/pbm-subscription-create.d.ts +20 -0
  62. package/dist/tools/pbm/pbm-subscription-create.d.ts.map +1 -0
  63. package/dist/tools/pbm/pbm-subscription-create.js +90 -0
  64. package/dist/tools/pbm/pbm-subscription-create.js.map +1 -0
  65. package/dist/tools/pbm/pbm-subscription-line-add.d.ts +13 -0
  66. package/dist/tools/pbm/pbm-subscription-line-add.d.ts.map +1 -0
  67. package/dist/tools/pbm/pbm-subscription-line-add.js +65 -0
  68. package/dist/tools/pbm/pbm-subscription-line-add.js.map +1 -0
  69. package/dist/tools/pbm/pbm-subscription-line-end.d.ts +12 -0
  70. package/dist/tools/pbm/pbm-subscription-line-end.d.ts.map +1 -0
  71. package/dist/tools/pbm/pbm-subscription-line-end.js +49 -0
  72. package/dist/tools/pbm/pbm-subscription-line-end.js.map +1 -0
  73. package/dist/tools/pcm/generated-reads.d.ts +5 -0
  74. package/dist/tools/pcm/generated-reads.d.ts.map +1 -0
  75. package/dist/tools/pcm/generated-reads.js +26 -0
  76. package/dist/tools/pcm/generated-reads.js.map +1 -0
  77. package/dist/tools/pcm/index.d.ts +5 -0
  78. package/dist/tools/pcm/index.d.ts.map +1 -0
  79. package/dist/tools/pcm/index.js +16 -0
  80. package/dist/tools/pcm/index.js.map +1 -0
  81. package/dist/tools/pcm/pcm-price-list-deactivate.d.ts +11 -0
  82. package/dist/tools/pcm/pcm-price-list-deactivate.d.ts.map +1 -0
  83. package/dist/tools/pcm/pcm-price-list-deactivate.js +46 -0
  84. package/dist/tools/pcm/pcm-price-list-deactivate.js.map +1 -0
  85. package/dist/tools/pcm/pcm-price-list-register.d.ts +21 -0
  86. package/dist/tools/pcm/pcm-price-list-register.d.ts.map +1 -0
  87. package/dist/tools/pcm/pcm-price-list-register.js +96 -0
  88. package/dist/tools/pcm/pcm-price-list-register.js.map +1 -0
  89. package/dist/tools/pcm/pcm-price-list-version-create.d.ts +19 -0
  90. package/dist/tools/pcm/pcm-price-list-version-create.d.ts.map +1 -0
  91. package/dist/tools/pcm/pcm-price-list-version-create.js +85 -0
  92. package/dist/tools/pcm/pcm-price-list-version-create.js.map +1 -0
  93. package/dist/tools/qom/generated-reads.d.ts +5 -0
  94. package/dist/tools/qom/generated-reads.d.ts.map +1 -0
  95. package/dist/tools/qom/generated-reads.js +22 -0
  96. package/dist/tools/qom/generated-reads.js.map +1 -0
  97. package/dist/tools/qom/index.d.ts +5 -0
  98. package/dist/tools/qom/index.d.ts.map +1 -0
  99. package/dist/tools/qom/index.js +23 -0
  100. package/dist/tools/qom/index.js.map +1 -0
  101. package/dist/tools/qom/qom-order-cancel.d.ts +16 -0
  102. package/dist/tools/qom/qom-order-cancel.d.ts.map +1 -0
  103. package/dist/tools/qom/qom-order-cancel.js +56 -0
  104. package/dist/tools/qom/qom-order-cancel.js.map +1 -0
  105. package/dist/tools/qom/qom-order-create.d.ts +24 -0
  106. package/dist/tools/qom/qom-order-create.d.ts.map +1 -0
  107. package/dist/tools/qom/qom-order-create.js +133 -0
  108. package/dist/tools/qom/qom-order-create.js.map +1 -0
  109. package/dist/tools/qom/qom-order-hold-place.d.ts +11 -0
  110. package/dist/tools/qom/qom-order-hold-place.d.ts.map +1 -0
  111. package/dist/tools/qom/qom-order-hold-place.js +50 -0
  112. package/dist/tools/qom/qom-order-hold-place.js.map +1 -0
  113. package/dist/tools/qom/qom-order-hold-release.d.ts +8 -0
  114. package/dist/tools/qom/qom-order-hold-release.d.ts.map +1 -0
  115. package/dist/tools/qom/qom-order-hold-release.js +42 -0
  116. package/dist/tools/qom/qom-order-hold-release.js.map +1 -0
  117. package/dist/tools/qom/qom-order-line-add.d.ts +18 -0
  118. package/dist/tools/qom/qom-order-line-add.d.ts.map +1 -0
  119. package/dist/tools/qom/qom-order-line-add.js +101 -0
  120. package/dist/tools/qom/qom-order-line-add.js.map +1 -0
  121. package/dist/tools/qom/qom-quote-create.d.ts +20 -0
  122. package/dist/tools/qom/qom-quote-create.d.ts.map +1 -0
  123. package/dist/tools/qom/qom-quote-create.js +142 -0
  124. package/dist/tools/qom/qom-quote-create.js.map +1 -0
  125. package/dist/tools/qom/qom-quote-line-add.d.ts +13 -0
  126. package/dist/tools/qom/qom-quote-line-add.d.ts.map +1 -0
  127. package/dist/tools/qom/qom-quote-line-add.js +92 -0
  128. package/dist/tools/qom/qom-quote-line-add.js.map +1 -0
  129. package/dist/tools/qom/qom-quote-version-create.d.ts +10 -0
  130. package/dist/tools/qom/qom-quote-version-create.d.ts.map +1 -0
  131. package/dist/tools/qom/qom-quote-version-create.js +69 -0
  132. package/dist/tools/qom/qom-quote-version-create.js.map +1 -0
  133. package/dist/tools/role-mapping.d.ts.map +1 -1
  134. package/dist/tools/role-mapping.js +15 -8
  135. package/dist/tools/role-mapping.js.map +1 -1
  136. package/package.json +1 -1
@@ -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-add.js","sourceRoot":"","sources":["../../../src/tools/qom/qom-order-line-add.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,8BAA8B,EAC9B,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC;AAEnC,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAE9C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAS;IACvC,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EACT,6FAA6F;QAC7F,2FAA2F;QAC3F,uFAAuF;QACvF,kCAAkC;IACpC,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,eAAe,EAAE,CAAC;aACf,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,qDAAqD,C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AAK,CAAC,eAAe,8BAA8B,CACjE,CAAC;YACJ,CAAC;YACD,IAAI,KAAK,CAAC,YAAY,KAAK,IAAI,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;gBACrF,OAAO,aAAa,CAClB,SAAS,EACT,aAAa,KAAK,CAAC,eAAe,OAAO,KAAK,CAAC,YAAY,IAAI;oBAC7D,iDAAiD,CACpD,CAAC;YACJ,CAAC;YACD,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CACnC,GAAG,GAAG,CAAC,SAAS,CAAC,UAAU,2BAA2B,EACtD,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,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,8BAA8B,EAC9B,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC;AAEnC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAS;IACtC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EACT,6FAA6F;QAC7F,qFAAqF;QACrF,2FAA2F;QAC3F,4FAA4F;QAC5F,kGAAkG;IACpG,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC;QAC/E,gBAAgB,EAAE,CAAC;aAChB,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,yDAAyD,CAAC;QACtE,UAAU,EAAE,CAAC;aACV,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,GAAG,CAAC,EAAE,CAAC;aACP,QAAQ,EAAE;aAC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,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"}
@@ -0,0 +1,92 @@
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
+ /**
6
+ * Explicit-schema create for a QOM quote line (`qom_quote_lines`).
7
+ *
8
+ * The tool omits line status, which defaults to `O` in Persist.
9
+ * `quote_header_id` and `org_id` are derived by Persist triggers.
10
+ *
11
+ * Persist stores the prices as supplied: it does not compare them with
12
+ * the price list or with each other. Unique key:
13
+ * (tenant_id, quote_version_id, quote_line_number).
14
+ */
15
+ export const qomQuoteLineAddTool = {
16
+ name: 'qom_quote_line_add',
17
+ description: 'Add a line to an existing quote version (qom_quote_lines). Persist stores the prices as ' +
18
+ 'supplied and does not check them against the price list or each other, so ' +
19
+ 'extended_quoted_price must equal quoted_qty * unit_quoted_price. One line per ' +
20
+ 'quote_line_number: a retry fails with a duplicate-key error instead of adding a second line.',
21
+ inputSchema: z.object({
22
+ quote_version_id: z
23
+ .string()
24
+ .min(1)
25
+ .describe('UUID of the parent qom_quote_versions row (required)'),
26
+ quote_line_number: z
27
+ .number()
28
+ .int()
29
+ .min(1)
30
+ .max(32767)
31
+ .describe('Line number, unique within the version'),
32
+ original_item_id: z
33
+ .string()
34
+ .min(1)
35
+ .describe('UUID of the pcm_items row the customer originally asked for'),
36
+ quoted_item_id: z
37
+ .string()
38
+ .min(1)
39
+ .describe('UUID of the pcm_items row actually being quoted'),
40
+ quoted_item_relationship_type: z.string().max(32).optional(),
41
+ quoted_qty: z.number().describe('Quantity being quoted (required)'),
42
+ quoted_uom: z.string().max(3).optional(),
43
+ unit_list_price: z.number().optional(),
44
+ unit_quoted_price: z.number().describe('Unit price actually offered (required)'),
45
+ extended_list_price: z.number().optional(),
46
+ extended_quoted_price: z
47
+ .number()
48
+ .describe('Line total at the quoted unit price (required)'),
49
+ item_quote_line_description: z.string().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_quote_lines', 'INSERT')],
56
+ sideEffect: 'state_change',
57
+ confirmation: 'none',
58
+ idempotency: 'natural_key',
59
+ handler: async (args, ctx) => {
60
+ const input = args;
61
+ const body = {
62
+ quote_version_id: input.quote_version_id,
63
+ quote_line_number: input.quote_line_number,
64
+ original_item_id: input.original_item_id,
65
+ quoted_item_id: input.quoted_item_id,
66
+ quoted_qty: input.quoted_qty,
67
+ unit_quoted_price: input.unit_quoted_price,
68
+ extended_quoted_price: input.extended_quoted_price,
69
+ };
70
+ for (const field of [
71
+ 'quoted_item_relationship_type',
72
+ 'quoted_uom',
73
+ 'unit_list_price',
74
+ 'extended_list_price',
75
+ 'item_quote_line_description',
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 rows = await ctx.apiClient.post(`${ctx.apiClient.dbBasePath}/qom_quote_lines?select=*`, body, { headers: writeHeadersWithIdempotency(input.idempotency_key) });
85
+ return successResponse(rows[0]);
86
+ }
87
+ catch (error) {
88
+ return errorResponse(API_ERROR, `Failed to add QOM quote line: ${error.message}`);
89
+ }
90
+ },
91
+ };
92
+ //# sourceMappingURL=qom-quote-line-add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qom-quote-line-add.js","sourceRoot":"","sources":["../../../src/tools/qom/qom-quote-line-add.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,8BAA8B,EAC9B,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC;AAEnC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAS;IACvC,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EACT,0FAA0F;QAC1F,4EAA4E;QAC5E,gFAAgF;QAChF,8FAA8F;IAChG,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,gBAAgB,EAAE,CAAC;aAChB,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,sDAAsD,CAAC;QACnE,iBAAiB,EAAE,CAAC;aACjB,MAAM,EAAE;aACR,GAAG,EAAE;aACL,GAAG,CAAC,CAAC,CAAC;aACN,GAAG,CAAC,KAAK,CAAC;aACV,QAAQ,CAAC,wCAAwC,CAAC;QACrD,gBAAgB,EAAE,CAAC;aAChB,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,C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AK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QAC3B,MAAM,KAAK,GAAG,IAA2B,CAAC;QAC1C,MAAM,IAAI,GAAwB;YAChC,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;YACxC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;YAC1C,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;YACxC,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;YAC1C,qBAAqB,EAAE,KAAK,CAAC,qBAAqB;SACnD,CAAC;QACF,KAAK,MAAM,KAAK,IAAI;YAClB,+BAA+B;YAC/B,YAAY;YACZ,iBAAiB;YACjB,qBAAqB;YACrB,6BAA6B;YAC7B,yBAAyB;YACzB,QAAQ;YACR,UAAU;SACX,EAAE,CAAC;YACF,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,SAAS;gBAAE,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC7D,CAAC;QACD,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CACnC,GAAG,GAAG,CAAC,SAAS,CAAC,UAAU,2BAA2B,EACtD,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,iCAAiC,KAAK,CAAC,OAAO,EAAE,CACjD,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Tool } from '../registry.js';
2
+ /**
3
+ * Explicit-schema create for a QOM quote version (`qom_quote_versions`).
4
+ *
5
+ * A quote version is an editable draft of a quote and the parent of its
6
+ * quote lines. Persist has no unique key on the version name, so a
7
+ * retry creates a second version.
8
+ */
9
+ export declare const qomQuoteVersionCreateTool: Tool;
10
+ //# sourceMappingURL=qom-quote-version-create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qom-quote-version-create.d.ts","sourceRoot":"","sources":["../../../src/tools/qom/qom-quote-version-create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAQtC;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,EAAE,IA8DvC,CAAC"}
@@ -0,0 +1,69 @@
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
+ /**
6
+ * Explicit-schema create for a QOM quote version (`qom_quote_versions`).
7
+ *
8
+ * A quote version is an editable draft of a quote and the parent of its
9
+ * quote lines. Persist has no unique key on the version name, so a
10
+ * retry creates a second version.
11
+ */
12
+ export const qomQuoteVersionCreateTool = {
13
+ name: 'qom_quote_version_create',
14
+ description: 'Create a new quote version (qom_quote_versions) attached to an existing quote header. ' +
15
+ 'Not deduplicated: calling it again creates another version, so check ' +
16
+ 'qom_quote_versions_list filtered on quote_header_id before retrying.',
17
+ inputSchema: z.object({
18
+ quote_header_id: z
19
+ .string()
20
+ .min(1)
21
+ .describe('UUID of the parent qom_quote_headers row (required)'),
22
+ quote_version_name: z
23
+ .string()
24
+ .min(1)
25
+ .max(32)
26
+ .describe('Short name for the version, e.g. "v1"'),
27
+ quote_version_description: z.string().max(2048).optional(),
28
+ price_list_version_id: z
29
+ .string()
30
+ .min(1)
31
+ .optional()
32
+ .describe('UUID of the pcm_price_list_versions row this version prices against'),
33
+ org_id: z.string().min(1).optional(),
34
+ start_date: z.string().min(1).optional().describe('ISO 8601 effective start'),
35
+ end_date: z.string().min(1).optional().describe('ISO 8601 effective end'),
36
+ metadata: z.record(z.unknown()).optional(),
37
+ idempotency_key: unenforcedIdempotencyKeySchema,
38
+ }),
39
+ capabilities: [cap('qom_quote_versions', 'INSERT')],
40
+ sideEffect: 'state_change',
41
+ confirmation: 'none',
42
+ idempotency: 'not_idempotent',
43
+ handler: async (args, ctx) => {
44
+ const input = args;
45
+ const body = {
46
+ quote_header_id: input.quote_header_id,
47
+ quote_version_name: input.quote_version_name,
48
+ };
49
+ for (const field of [
50
+ 'quote_version_description',
51
+ 'price_list_version_id',
52
+ 'org_id',
53
+ 'start_date',
54
+ 'end_date',
55
+ 'metadata',
56
+ ]) {
57
+ if (input[field] !== undefined)
58
+ body[field] = input[field];
59
+ }
60
+ try {
61
+ const rows = await ctx.apiClient.post(`${ctx.apiClient.dbBasePath}/qom_quote_versions?select=*`, body, { headers: writeHeadersWithIdempotency(input.idempotency_key) });
62
+ return successResponse(rows[0]);
63
+ }
64
+ catch (error) {
65
+ return errorResponse(API_ERROR, `Failed to create QOM quote version: ${error.message}`);
66
+ }
67
+ },
68
+ };
69
+ //# sourceMappingURL=qom-quote-version-create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qom-quote-version-create.js","sourceRoot":"","sources":["../../../src/tools/qom/qom-quote-version-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,8BAA8B,EAC9B,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAS;IAC7C,IAAI,EAAE,0BAA0B;IAChC,WAAW,EACT,wFAAwF;QACxF,uEAAuE;QACvE,sEAAsE;IACxE,WAAW,EAAE,CAAC,CAAC,MAAM,CA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;GAQG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,eAAe,GACzB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAO7B"}
1
+ {"version":3,"file":"role-mapping.d.ts","sourceRoot":"","sources":["../../src/tools/role-mapping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;;;;;GAQG;AACH,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AA+DD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAuChE;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,eAAe,GACzB,OAAO,CAAC,SAAS,EAAE,CAAC,CAEtB;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,eAAe,GACzB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAO7B"}
@@ -45,6 +45,18 @@ const ROLE_TO_DOMAINS = {
45
45
  'Interaction administrator': ['ixn'],
46
46
  'Interaction user': ['ixn'],
47
47
  'Interaction viewer': ['ixn-readonly'],
48
+ 'Order administrator': ['qom'],
49
+ 'Order user': ['qom'],
50
+ 'Order viewer': ['qom-readonly'],
51
+ 'Billing administrator': ['pbm'],
52
+ 'Billing user': ['pbm'],
53
+ 'Billing viewer': ['pbm-readonly'],
54
+ 'Item administrator': ['gpm'],
55
+ 'Item user': ['gpm'],
56
+ 'Item viewer': ['gpm-readonly'],
57
+ 'Pricing administrator': ['pcm'],
58
+ 'Pricing user': ['pcm'],
59
+ 'Pricing viewer': ['pcm-readonly'],
48
60
  };
49
61
  /**
50
62
  * Given a list of user group names, resolve the set of tool domain IDs
@@ -63,14 +75,9 @@ export function mapRolesToDomains(groupNames) {
63
75
  }
64
76
  }
65
77
  // Full access is a superset of readonly — drop readonly if full access is present
66
- if (domains.has('ppm') && domains.has('ppm-readonly')) {
67
- domains.delete('ppm-readonly');
68
- }
69
- if (domains.has('wrm') && domains.has('wrm-readonly')) {
70
- domains.delete('wrm-readonly');
71
- }
72
- if (domains.has('sfa') && domains.has('sfa-readonly')) {
73
- domains.delete('sfa-readonly');
78
+ for (const parent of ['ppm', 'wrm', 'sfa', 'qom', 'pbm', 'gpm', 'pcm']) {
79
+ if (domains.has(parent))
80
+ domains.delete(`${parent}-readonly`);
74
81
  }
75
82
  if (domains.has('fxm') && domains.has('fxm-readonly')) {
76
83
  domains.delete('fxm-readonly');