@campfire-interactive/master-data-client 4.12.0 → 4.13.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.
@@ -1,91 +0,0 @@
1
- import { HttpTransport } from './http';
2
- import type { QuoteLinesResponse, QuoteLinesWithApprovalFlag, AddQuoteLineInput, UpdateQuoteLineInput, SetQuoteLineEffectiveCostInput, SetQuoteLineEffectivePriceInput, SingleResponse } from './types';
3
- /**
4
- * Quote lines — the finished goods on a quote.
5
- *
6
- * A quote is MULTI-PART: it is the document the OEM receives and it carries one
7
- * line per finished good, each with its own volume, cost and price. See the
8
- * nextgen ADR `2026-08-05-multi-part-quotes.md`.
9
- *
10
- * Two things to know before using this:
11
- *
12
- * 1. **`Quote.partId` is now a derived mirror** of these lines and is
13
- * deprecated. It reflects the FIRST line only, so it is lossy the moment a
14
- * quote has more than one. Read `lines` here instead. It keeps working for
15
- * the whole deprecation window — including writes, which transparently
16
- * maintain the quote's single line — and is dropped in a later major.
17
- *
18
- * 2. **Never sum lines across competing quotes.** When an OEM asks for several
19
- * competing groupings of the same parts, those are alternatives, not
20
- * additions. `rollUp` covers ONE quote; anything aggregating across a round
21
- * must dedupe by part.
22
- *
23
- * Cost is DERIVED, never authored: it reaches a line only through
24
- * {@link setEffectiveCost}, published by whichever engine resolved it. There is
25
- * no authored-cost field, deliberately — the earlier design had one whose only
26
- * writer was a human, so it could store a per-grouping cost but never produce
27
- * one, and went stale unnoticed on the next re-cost.
28
- */
29
- export declare class QuoteLineResource {
30
- private readonly http;
31
- constructor(http: HttpTransport);
32
- /**
33
- * The quote's lines, each with resolved `terms` (volume / cost / price plus
34
- * which tier each came from), and the quote-level `rollUp`.
35
- */
36
- list(quoteId: string): Promise<SingleResponse<QuoteLinesResponse>>;
37
- /**
38
- * The resolved line sets for MANY quotes, in one round trip.
39
- *
40
- * Use this instead of looping {@link list} whenever you read volume off a set
41
- * of quotes — a per-quote fan-out is slow and, against a hub holding one warm
42
- * instance, manufactures cold starts.
43
- *
44
- * Chunk to 200 ids per call (the server rejects more). Ids that don't exist, or
45
- * belong to another tenant, are simply absent from the result — so index the
46
- * response by `quoteId` rather than assuming it lines up positionally with the
47
- * ids you passed. A quote that exists but has no finished goods comes back with
48
- * an empty `lines` array.
49
- */
50
- listForQuotes(quoteIds: string[]): Promise<SingleResponse<QuoteLinesResponse[]>>;
51
- /**
52
- * Add a finished good to a quote. Returns the full line set, so a caller never
53
- * has to re-fetch to get the new roll-up.
54
- *
55
- * Omit `partId` to have it resolved from `partNumber` against the parts
56
- * catalog; it is left null when nothing matches, which is legal — soft
57
- * enforcement, so a part number that hasn't been reconciled into the catalog
58
- * can still be quoted. Pass `partId: null` to pin it null explicitly.
59
- */
60
- add(quoteId: string, input: AddQuoteLineInput, idempotencyKey?: string): Promise<SingleResponse<QuoteLinesResponse>>;
61
- /**
62
- * Update a line's AUTHORED terms. Derived cost/price are not settable here.
63
- *
64
- * A `note`-only patch is accepted while the quote is in review — flagging a bad
65
- * part is something that happens DURING review. Anything touching the figures
66
- * requires a pre-approval status (422 otherwise).
67
- */
68
- update(quoteId: string, lineId: string, input: UpdateQuoteLineInput): Promise<SingleResponse<QuoteLinesResponse>>;
69
- /** Remove a finished good. The last line may be removed. */
70
- remove(quoteId: string, lineId: string): Promise<SingleResponse<QuoteLinesResponse>>;
71
- /**
72
- * Set the document order. `lineIds` must list every line on the quote exactly
73
- * once (422 otherwise). Order also decides which line supplies the deprecated
74
- * `quote.partId` mirror.
75
- */
76
- reorder(quoteId: string, lineIds: string[]): Promise<SingleResponse<QuoteLinesResponse>>;
77
- /**
78
- * Publish a DERIVED per-line cost — the line-scoped mirror of
79
- * `quotes.setEffectiveCost`, and the only way a cost reaches a line.
80
- *
81
- * Deliberately NOT gated on quote status: a re-cost must always be able to
82
- * land, or the published number silently diverges from the cost model that
83
- * produced it. When the figure lands on a quote already in approval the
84
- * response sets `invalidatesApproval` — the caller owns what to do about it
85
- * (OMSF voids the collected approvals and re-routes).
86
- */
87
- setEffectiveCost(quoteId: string, lineId: string, input: SetQuoteLineEffectiveCostInput, idempotencyKey?: string): Promise<SingleResponse<QuoteLinesWithApprovalFlag>>;
88
- /** Price-side sibling of {@link setEffectiveCost}. */
89
- setEffectivePrice(quoteId: string, lineId: string, input: SetQuoteLineEffectivePriceInput, idempotencyKey?: string): Promise<SingleResponse<QuoteLinesWithApprovalFlag>>;
90
- }
91
- //# sourceMappingURL=quoteLines.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"quoteLines.d.ts","sourceRoot":"","sources":["../src/quoteLines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EACV,kBAAkB,EAClB,0BAA0B,EAC1B,iBAAiB,EACjB,oBAAoB,EACpB,8BAA8B,EAC9B,+BAA+B,EAC/B,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEhD;;;OAGG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;IAOxE;;;;;;;;;;;;OAYG;IAIG,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAQtF;;;;;;;;OAQG;IACG,GAAG,CACP,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,iBAAiB,EACxB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;IAS9C;;;;;;OAMG;IACG,MAAM,CACV,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;IAQ9C,4DAA4D;IACtD,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;IAO1F;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;IAQ9F;;;;;;;;;OASG;IACG,gBAAgB,CACpB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,8BAA8B,EACrC,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,cAAc,CAAC,0BAA0B,CAAC,CAAC;IAStD,sDAAsD;IAChD,iBAAiB,CACrB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,+BAA+B,EACtC,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,cAAc,CAAC,0BAA0B,CAAC,CAAC;CAQvD"}
@@ -1,147 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuoteLineResource = void 0;
4
- /**
5
- * Quote lines — the finished goods on a quote.
6
- *
7
- * A quote is MULTI-PART: it is the document the OEM receives and it carries one
8
- * line per finished good, each with its own volume, cost and price. See the
9
- * nextgen ADR `2026-08-05-multi-part-quotes.md`.
10
- *
11
- * Two things to know before using this:
12
- *
13
- * 1. **`Quote.partId` is now a derived mirror** of these lines and is
14
- * deprecated. It reflects the FIRST line only, so it is lossy the moment a
15
- * quote has more than one. Read `lines` here instead. It keeps working for
16
- * the whole deprecation window — including writes, which transparently
17
- * maintain the quote's single line — and is dropped in a later major.
18
- *
19
- * 2. **Never sum lines across competing quotes.** When an OEM asks for several
20
- * competing groupings of the same parts, those are alternatives, not
21
- * additions. `rollUp` covers ONE quote; anything aggregating across a round
22
- * must dedupe by part.
23
- *
24
- * Cost is DERIVED, never authored: it reaches a line only through
25
- * {@link setEffectiveCost}, published by whichever engine resolved it. There is
26
- * no authored-cost field, deliberately — the earlier design had one whose only
27
- * writer was a human, so it could store a per-grouping cost but never produce
28
- * one, and went stale unnoticed on the next re-cost.
29
- */
30
- class QuoteLineResource {
31
- http;
32
- constructor(http) {
33
- this.http = http;
34
- }
35
- /**
36
- * The quote's lines, each with resolved `terms` (volume / cost / price plus
37
- * which tier each came from), and the quote-level `rollUp`.
38
- */
39
- async list(quoteId) {
40
- return this.http.request({
41
- method: 'GET',
42
- path: `/v1/quotes/${encodeURIComponent(quoteId)}/lines`,
43
- });
44
- }
45
- /**
46
- * The resolved line sets for MANY quotes, in one round trip.
47
- *
48
- * Use this instead of looping {@link list} whenever you read volume off a set
49
- * of quotes — a per-quote fan-out is slow and, against a hub holding one warm
50
- * instance, manufactures cold starts.
51
- *
52
- * Chunk to 200 ids per call (the server rejects more). Ids that don't exist, or
53
- * belong to another tenant, are simply absent from the result — so index the
54
- * response by `quoteId` rather than assuming it lines up positionally with the
55
- * ids you passed. A quote that exists but has no finished goods comes back with
56
- * an empty `lines` array.
57
- */
58
- // Typed SingleResponse<T[]> rather than ListResponse<T>: this batch read is not
59
- // paginated, so it carries no cursor/hasMore meta and claiming ListMeta would
60
- // promise fields the server never sends.
61
- async listForQuotes(quoteIds) {
62
- return this.http.request({
63
- method: 'GET',
64
- path: '/v1/quote-lines',
65
- query: { quoteIds: quoteIds.join(',') },
66
- });
67
- }
68
- /**
69
- * Add a finished good to a quote. Returns the full line set, so a caller never
70
- * has to re-fetch to get the new roll-up.
71
- *
72
- * Omit `partId` to have it resolved from `partNumber` against the parts
73
- * catalog; it is left null when nothing matches, which is legal — soft
74
- * enforcement, so a part number that hasn't been reconciled into the catalog
75
- * can still be quoted. Pass `partId: null` to pin it null explicitly.
76
- */
77
- async add(quoteId, input, idempotencyKey) {
78
- return this.http.request({
79
- method: 'POST',
80
- path: `/v1/quotes/${encodeURIComponent(quoteId)}/lines`,
81
- body: input,
82
- idempotencyKey,
83
- });
84
- }
85
- /**
86
- * Update a line's AUTHORED terms. Derived cost/price are not settable here.
87
- *
88
- * A `note`-only patch is accepted while the quote is in review — flagging a bad
89
- * part is something that happens DURING review. Anything touching the figures
90
- * requires a pre-approval status (422 otherwise).
91
- */
92
- async update(quoteId, lineId, input) {
93
- return this.http.request({
94
- method: 'PATCH',
95
- path: `/v1/quotes/${encodeURIComponent(quoteId)}/lines/${encodeURIComponent(lineId)}`,
96
- body: input,
97
- });
98
- }
99
- /** Remove a finished good. The last line may be removed. */
100
- async remove(quoteId, lineId) {
101
- return this.http.request({
102
- method: 'DELETE',
103
- path: `/v1/quotes/${encodeURIComponent(quoteId)}/lines/${encodeURIComponent(lineId)}`,
104
- });
105
- }
106
- /**
107
- * Set the document order. `lineIds` must list every line on the quote exactly
108
- * once (422 otherwise). Order also decides which line supplies the deprecated
109
- * `quote.partId` mirror.
110
- */
111
- async reorder(quoteId, lineIds) {
112
- return this.http.request({
113
- method: 'PUT',
114
- path: `/v1/quotes/${encodeURIComponent(quoteId)}/lines/reorder`,
115
- body: { lineIds },
116
- });
117
- }
118
- /**
119
- * Publish a DERIVED per-line cost — the line-scoped mirror of
120
- * `quotes.setEffectiveCost`, and the only way a cost reaches a line.
121
- *
122
- * Deliberately NOT gated on quote status: a re-cost must always be able to
123
- * land, or the published number silently diverges from the cost model that
124
- * produced it. When the figure lands on a quote already in approval the
125
- * response sets `invalidatesApproval` — the caller owns what to do about it
126
- * (OMSF voids the collected approvals and re-routes).
127
- */
128
- async setEffectiveCost(quoteId, lineId, input, idempotencyKey) {
129
- return this.http.request({
130
- method: 'PATCH',
131
- path: `/v1/quotes/${encodeURIComponent(quoteId)}/lines/${encodeURIComponent(lineId)}/effective-cost`,
132
- body: input,
133
- idempotencyKey,
134
- });
135
- }
136
- /** Price-side sibling of {@link setEffectiveCost}. */
137
- async setEffectivePrice(quoteId, lineId, input, idempotencyKey) {
138
- return this.http.request({
139
- method: 'PATCH',
140
- path: `/v1/quotes/${encodeURIComponent(quoteId)}/lines/${encodeURIComponent(lineId)}/effective-price`,
141
- body: input,
142
- idempotencyKey,
143
- });
144
- }
145
- }
146
- exports.QuoteLineResource = QuoteLineResource;
147
- //# sourceMappingURL=quoteLines.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"quoteLines.js","sourceRoot":"","sources":["../src/quoteLines.ts"],"names":[],"mappings":";;;AAWA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAa,iBAAiB;IACC;IAA7B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD;;;OAGG;IACH,KAAK,CAAC,IAAI,CAAC,OAAe;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAqC;YAC3D,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,cAAc,kBAAkB,CAAC,OAAO,CAAC,QAAQ;SACxD,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,gFAAgF;IAChF,8EAA8E;IAC9E,yCAAyC;IACzC,KAAK,CAAC,aAAa,CAAC,QAAkB;QACpC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAuC;YAC7D,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,iBAAiB;YACvB,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;SACxC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,GAAG,CACP,OAAe,EACf,KAAwB,EACxB,cAAuB;QAEvB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAqC;YAC3D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc,kBAAkB,CAAC,OAAO,CAAC,QAAQ;YACvD,IAAI,EAAE,KAAK;YACX,cAAc;SACf,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CACV,OAAe,EAC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