@campfire-interactive/master-data-client 4.26.0 → 4.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/attributeBag.d.ts +217 -0
- package/dist/attributeBag.d.ts.map +1 -0
- package/dist/attributeBag.js +339 -0
- package/dist/attributeBag.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -1
- package/dist/index.js.map +1 -1
- package/package.json +31 -31
- package/dist/partFamilies.d.ts +0 -12
- package/dist/partFamilies.d.ts.map +0 -1
- package/dist/partFamilies.js +0 -45
- package/dist/partFamilies.js.map +0 -1
- package/dist/rateLibraries.d.ts +0 -25
- package/dist/rateLibraries.d.ts.map +0 -1
- package/dist/rateLibraries.js +0 -132
- package/dist/rateLibraries.js.map +0 -1
- package/dist/suppliers.d.ts +0 -14
- package/dist/suppliers.d.ts.map +0 -1
- package/dist/suppliers.js +0 -84
- package/dist/suppliers.js.map +0 -1
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import type { AttributeDefinition, AttributeGroup, AttributeValidationRules } from './types';
|
|
2
|
+
import { type AttributeFieldError } from './attributeValidation';
|
|
3
|
+
/** The subset of a definition these helpers read. Both the full SDK
|
|
4
|
+
* `AttributeDefinition` and the trimmed shape an app sends its own frontend
|
|
5
|
+
* satisfy it structurally, so neither has to convert. */
|
|
6
|
+
export interface AttributeDefinitionView {
|
|
7
|
+
key: string;
|
|
8
|
+
label: string;
|
|
9
|
+
dataType: string;
|
|
10
|
+
unit: string | null;
|
|
11
|
+
options: string[] | null;
|
|
12
|
+
validation: AttributeValidationRules | null;
|
|
13
|
+
status: string;
|
|
14
|
+
sortOrder: number;
|
|
15
|
+
group: string | null;
|
|
16
|
+
groupId: string | null;
|
|
17
|
+
attributeOptions?: AttributeOptionView[];
|
|
18
|
+
}
|
|
19
|
+
/** The subset of an option row these helpers read. */
|
|
20
|
+
export interface AttributeOptionView {
|
|
21
|
+
id: string;
|
|
22
|
+
value: string;
|
|
23
|
+
label: string;
|
|
24
|
+
sortOrder: number;
|
|
25
|
+
parentId: string | null;
|
|
26
|
+
level: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The STORAGE rule: is this value absent from the bag?
|
|
30
|
+
*
|
|
31
|
+
* `null`, `undefined` and `''` only. `false` and `0` are answers. An empty
|
|
32
|
+
* ARRAY is deliberately not empty here — that is the storage rule both
|
|
33
|
+
* backends already apply, and widening it would start deleting keys that are
|
|
34
|
+
* written today. `isUnanswered` is the form-side rule and does treat `[]` as
|
|
35
|
+
* empty; the two are different questions and the difference is load-bearing.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isEmptyAttributeValue(value: unknown): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The FORM rule: has a human failed to answer this?
|
|
40
|
+
*
|
|
41
|
+
* Wider than the storage rule — whitespace-only text and an empty multi-select
|
|
42
|
+
* both count as no answer, because a required field is not satisfied by either.
|
|
43
|
+
*/
|
|
44
|
+
export declare function isUnansweredAttributeValue(value: unknown): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Coerce whatever the driver handed back into a bag object.
|
|
47
|
+
*
|
|
48
|
+
* jsonb comes back parsed on current Prisma, but a raw query on a different
|
|
49
|
+
* driver can hand back a string, and a malformed one must read as an empty bag
|
|
50
|
+
* rather than throwing inside a write path.
|
|
51
|
+
*/
|
|
52
|
+
export declare function normalizeAttributeBag(value: unknown): Record<string, unknown>;
|
|
53
|
+
/**
|
|
54
|
+
* MERGE, NOT REPLACE — set the keys the patch names, clear the ones it sends
|
|
55
|
+
* empty, and leave every other key exactly as it was.
|
|
56
|
+
*
|
|
57
|
+
* Two people editing different attributes must not last-write-wins the whole
|
|
58
|
+
* bag; this is the one place a typed EAV would have been better, and patching
|
|
59
|
+
* is how the ADR closes it. Values under a definition somebody has since
|
|
60
|
+
* archived are untouched precisely because the patch never names them — the
|
|
61
|
+
* guardrail that archived values are kept for analytics history is a
|
|
62
|
+
* consequence of this function doing nothing clever.
|
|
63
|
+
*
|
|
64
|
+
* Returns a NEW object; the input bag is not mutated.
|
|
65
|
+
*/
|
|
66
|
+
export declare function applyAttributePatch(bag: Record<string, unknown> | null | undefined, patch: Record<string, unknown>): Record<string, unknown>;
|
|
67
|
+
/**
|
|
68
|
+
* Drop empty values — the create path, where there is no prior bag to merge
|
|
69
|
+
* into and nothing to clear.
|
|
70
|
+
*
|
|
71
|
+
* Mirrors the validator's "non-empty if present" rule so a freshly created row
|
|
72
|
+
* never stores `{"k": ""}`, which would otherwise read as an answer.
|
|
73
|
+
*/
|
|
74
|
+
export declare function stripEmptyAttributeValues(bag: Record<string, unknown> | null | undefined): Record<string, unknown>;
|
|
75
|
+
/**
|
|
76
|
+
* Swap the machine key for the display label in messages a human reads.
|
|
77
|
+
*
|
|
78
|
+
* The validator keys its messages by `key` (`annual_volume`) so `field` stays
|
|
79
|
+
* parseable for every consumer. `field` is left untouched — callers still
|
|
80
|
+
* derive the drop-key from it — and only the prose changes.
|
|
81
|
+
*/
|
|
82
|
+
export declare function relabelAttributeErrors(definitions: AttributeDefinitionView[], errors: AttributeFieldError[]): AttributeFieldError[];
|
|
83
|
+
/**
|
|
84
|
+
* Validate WITHOUT throwing, and split the bag into what may be written and
|
|
85
|
+
* what a human should be told about — the import path.
|
|
86
|
+
*
|
|
87
|
+
* An unknown attribute or a value outside the registry becomes a warning and a
|
|
88
|
+
* dropped key, never a failed row and never a mutated registry. Rejecting a
|
|
89
|
+
* whole import because one spreadsheet column has a typo is the behaviour this
|
|
90
|
+
* exists to avoid.
|
|
91
|
+
*/
|
|
92
|
+
export declare function sanitizeAttributeBag(definitions: AttributeDefinition[], bag: Record<string, unknown> | null | undefined): {
|
|
93
|
+
clean: Record<string, unknown>;
|
|
94
|
+
warnings: string[];
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* A short-TTL memo for a tenant's definitions, so the write path does not
|
|
98
|
+
* round-trip the registry on every save. Definitions are curated and rare, and
|
|
99
|
+
* a newly created one taking effect a few seconds late is acceptable under
|
|
100
|
+
* lenient-until-adopted.
|
|
101
|
+
*
|
|
102
|
+
* A FACTORY, not a module-level cache, and that is the point. A singleton
|
|
103
|
+
* inside a shared package running in a multi-tenant process is one forgotten
|
|
104
|
+
* map key away from serving one tenant's registry to another. The caller owns
|
|
105
|
+
* the instance AND builds the key, so the tenant is visibly part of it at the
|
|
106
|
+
* call site rather than buried in here.
|
|
107
|
+
*/
|
|
108
|
+
export declare function createAttributeDefinitionsCache<T>(options: {
|
|
109
|
+
/** Fetch definitions for a cache key. Called on a miss and on expiry. */
|
|
110
|
+
load: (key: string) => Promise<T[]>;
|
|
111
|
+
/** Default 30_000. */
|
|
112
|
+
ttlMs?: number;
|
|
113
|
+
/** Injectable for tests; defaults to `Date.now`. */
|
|
114
|
+
now?: () => number;
|
|
115
|
+
}): {
|
|
116
|
+
get: (key: string) => Promise<T[]>;
|
|
117
|
+
invalidate: (key?: string) => void;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* The option rows for a select/hierarchy definition — real rows when present,
|
|
121
|
+
* else flat rows synthesized from the legacy inline `options` so a caller never
|
|
122
|
+
* has to know which of the two a definition uses.
|
|
123
|
+
*/
|
|
124
|
+
export declare function attributeOptionsFor(def: AttributeDefinitionView): AttributeOptionView[];
|
|
125
|
+
/** Words `formatAttributeValue` needs that are not data. Defaulted to English
|
|
126
|
+
* so an existing caller is unaffected; a localized app passes its own. */
|
|
127
|
+
export interface AttributeValueLabels {
|
|
128
|
+
yes?: string;
|
|
129
|
+
no?: string;
|
|
130
|
+
/** Shown for an empty value. */
|
|
131
|
+
empty?: string;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* A stored value as a human reads it: select/hierarchy render the option's
|
|
135
|
+
* LABEL rather than its stored value, multi-select joins them, a number carries
|
|
136
|
+
* its unit, and empty is a dash.
|
|
137
|
+
*
|
|
138
|
+
* The three non-data words are injectable because a localized consumer cannot
|
|
139
|
+
* ship English out of a shared package — and defaulting them keeps every
|
|
140
|
+
* existing call site byte-identical.
|
|
141
|
+
*/
|
|
142
|
+
export declare function formatAttributeValue(def: AttributeDefinitionView, raw: unknown, labels?: AttributeValueLabels): string;
|
|
143
|
+
/**
|
|
144
|
+
* The required definitions with nothing filled in — what a form holds Save on.
|
|
145
|
+
*
|
|
146
|
+
* Two exclusions, each of which looks like a bug until it is stated:
|
|
147
|
+
*
|
|
148
|
+
* - **Non-active definitions.** A deprecated or archived attribute may still
|
|
149
|
+
* carry `required`, but demanding a value for something being retired blocks
|
|
150
|
+
* work over a decision already taken.
|
|
151
|
+
* - **A select with no options configured.** enum / multi_select / hierarchy
|
|
152
|
+
* can be defined before anyone adds their values, and a required one in that
|
|
153
|
+
* state cannot be satisfied at all — holding Save on it traps the user in the
|
|
154
|
+
* form with no way out. The configuration error belongs in the registry's own
|
|
155
|
+
* screen, not in a dead end here.
|
|
156
|
+
*/
|
|
157
|
+
export declare function missingRequiredAttributes<T extends AttributeDefinitionView>(definitions: T[] | undefined, values: Record<string, unknown> | undefined): T[];
|
|
158
|
+
/**
|
|
159
|
+
* A definition trimmed to what a form needs: no tenant id, no audit columns,
|
|
160
|
+
* and the group NAME resolved so sections can be titled and ordered without a
|
|
161
|
+
* second lookup.
|
|
162
|
+
*
|
|
163
|
+
* It exists here because every consumer was declaring it by hand — a second
|
|
164
|
+
* copy of types this package already owns, kept in sync by nobody. Satisfies
|
|
165
|
+
* `AttributeDefinitionView`, so the display and required helpers above take it
|
|
166
|
+
* directly.
|
|
167
|
+
*/
|
|
168
|
+
export interface ClientAttributeDefinition {
|
|
169
|
+
id: string;
|
|
170
|
+
key: string;
|
|
171
|
+
label: string;
|
|
172
|
+
dataType: string;
|
|
173
|
+
unit: string | null;
|
|
174
|
+
/** Legacy inline values; `attributeOptions` is preferred. */
|
|
175
|
+
options: string[] | null;
|
|
176
|
+
/** Resolved group name — the form's section header, null when ungrouped. */
|
|
177
|
+
group: string | null;
|
|
178
|
+
groupId: string | null;
|
|
179
|
+
/** The group's sort order, for ordering the sections. Null when ungrouped. */
|
|
180
|
+
groupSortOrder: number | null;
|
|
181
|
+
validation: AttributeValidationRules | null;
|
|
182
|
+
filterable: boolean;
|
|
183
|
+
status: string;
|
|
184
|
+
sortOrder: number;
|
|
185
|
+
attributeOptions: AttributeOptionView[];
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Registry definition → the shape above.
|
|
189
|
+
*
|
|
190
|
+
* Pass the tenant's groups to resolve `group`/`groupSortOrder`; without them
|
|
191
|
+
* the definition's legacy `group` string is used, which is the Part-era
|
|
192
|
+
* fallback and the only thing Part definitions have.
|
|
193
|
+
*/
|
|
194
|
+
export declare function toClientAttributeDefinition(def: AttributeDefinition, groupById?: Map<string, AttributeGroup>): ClientAttributeDefinition;
|
|
195
|
+
/** How a filter value should be matched against a bag key. The consumer turns
|
|
196
|
+
* this into its own ORM's JSON predicate — the SDK does not emit query syntax
|
|
197
|
+
* for somebody else's query builder. */
|
|
198
|
+
export interface AttributeFilterMatch {
|
|
199
|
+
key: string;
|
|
200
|
+
/** `contains`: substring (text) · `arrayContains`: multi-select membership ·
|
|
201
|
+
* `equals`: everything else. */
|
|
202
|
+
mode: 'contains' | 'arrayContains' | 'equals';
|
|
203
|
+
/** Coerced to the definition's type — a JSON number, a boolean, or a string. */
|
|
204
|
+
value: unknown;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Coerce a filter typed as a STRING (a query parameter always is) to the type
|
|
208
|
+
* its definition stores, and say how to match it.
|
|
209
|
+
*
|
|
210
|
+
* Text matches by substring, which is what somebody typing half a value
|
|
211
|
+
* expects; anything picked from a dropdown matches exactly. Returns `null` when
|
|
212
|
+
* there is nothing to filter on or the key is not in the registry — the caller
|
|
213
|
+
* then applies NO predicate, rather than a predicate that matches nothing and
|
|
214
|
+
* silently empties the list.
|
|
215
|
+
*/
|
|
216
|
+
export declare function attributeFilterMatch(definitions: AttributeDefinitionView[], key: string | undefined, value: string | undefined): AttributeFilterMatch | null;
|
|
217
|
+
//# sourceMappingURL=attributeBag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributeBag.d.ts","sourceRoot":"","sources":["../src/attributeBag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAC7F,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAyCvF;;0DAE0D;AAC1D,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,gBAAgB,CAAC,EAAE,mBAAmB,EAAE,CAAC;CAC1C;AAED,sDAAsD;AACtD,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAMD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE7D;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKlE;AAMD;;;;;;GAMG;AACH,wB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M,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,mBAAmB,EAAE,CAAC;CACzC;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,mBAAmB,EACxB,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,GACtC,yBAAyB,CAyB3B;AAMD;;yCAEyC;AACzC,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ;qCACiC;IACjC,IAAI,EAAE,UAAU,GAAG,eAAe,GAAG,QAAQ,CAAC;IAC9C,gFAAgF;IAChF,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,uBAAuB,EAAE,EACtC,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,oBAAoB,GAAG,IAAI,CAS7B"}
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isEmptyAttributeValue = isEmptyAttributeValue;
|
|
4
|
+
exports.isUnansweredAttributeValue = isUnansweredAttributeValue;
|
|
5
|
+
exports.normalizeAttributeBag = normalizeAttributeBag;
|
|
6
|
+
exports.applyAttributePatch = applyAttributePatch;
|
|
7
|
+
exports.stripEmptyAttributeValues = stripEmptyAttributeValues;
|
|
8
|
+
exports.relabelAttributeErrors = relabelAttributeErrors;
|
|
9
|
+
exports.sanitizeAttributeBag = sanitizeAttributeBag;
|
|
10
|
+
exports.createAttributeDefinitionsCache = createAttributeDefinitionsCache;
|
|
11
|
+
exports.attributeOptionsFor = attributeOptionsFor;
|
|
12
|
+
exports.formatAttributeValue = formatAttributeValue;
|
|
13
|
+
exports.missingRequiredAttributes = missingRequiredAttributes;
|
|
14
|
+
exports.toClientAttributeDefinition = toClientAttributeDefinition;
|
|
15
|
+
exports.attributeFilterMatch = attributeFilterMatch;
|
|
16
|
+
const attributeValidation_1 = require("./attributeValidation");
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Emptiness
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
/**
|
|
21
|
+
* The STORAGE rule: is this value absent from the bag?
|
|
22
|
+
*
|
|
23
|
+
* `null`, `undefined` and `''` only. `false` and `0` are answers. An empty
|
|
24
|
+
* ARRAY is deliberately not empty here — that is the storage rule both
|
|
25
|
+
* backends already apply, and widening it would start deleting keys that are
|
|
26
|
+
* written today. `isUnanswered` is the form-side rule and does treat `[]` as
|
|
27
|
+
* empty; the two are different questions and the difference is load-bearing.
|
|
28
|
+
*/
|
|
29
|
+
function isEmptyAttributeValue(value) {
|
|
30
|
+
return value === null || value === undefined || value === '';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The FORM rule: has a human failed to answer this?
|
|
34
|
+
*
|
|
35
|
+
* Wider than the storage rule — whitespace-only text and an empty multi-select
|
|
36
|
+
* both count as no answer, because a required field is not satisfied by either.
|
|
37
|
+
*/
|
|
38
|
+
function isUnansweredAttributeValue(value) {
|
|
39
|
+
if (value === undefined || value === null)
|
|
40
|
+
return true;
|
|
41
|
+
if (typeof value === 'string')
|
|
42
|
+
return value.trim() === '';
|
|
43
|
+
if (Array.isArray(value))
|
|
44
|
+
return value.length === 0;
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
// Bag arithmetic
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
/**
|
|
51
|
+
* Coerce whatever the driver handed back into a bag object.
|
|
52
|
+
*
|
|
53
|
+
* jsonb comes back parsed on current Prisma, but a raw query on a different
|
|
54
|
+
* driver can hand back a string, and a malformed one must read as an empty bag
|
|
55
|
+
* rather than throwing inside a write path.
|
|
56
|
+
*/
|
|
57
|
+
function normalizeAttributeBag(value) {
|
|
58
|
+
if (value == null)
|
|
59
|
+
return {};
|
|
60
|
+
if (typeof value === 'string') {
|
|
61
|
+
try {
|
|
62
|
+
const parsed = JSON.parse(value);
|
|
63
|
+
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return {};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return typeof value === 'object' ? value : {};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* MERGE, NOT REPLACE — set the keys the patch names, clear the ones it sends
|
|
73
|
+
* empty, and leave every other key exactly as it was.
|
|
74
|
+
*
|
|
75
|
+
* Two people editing different attributes must not last-write-wins the whole
|
|
76
|
+
* bag; this is the one place a typed EAV would have been better, and patching
|
|
77
|
+
* is how the ADR closes it. Values under a definition somebody has since
|
|
78
|
+
* archived are untouched precisely because the patch never names them — the
|
|
79
|
+
* guardrail that archived values are kept for analytics history is a
|
|
80
|
+
* consequence of this function doing nothing clever.
|
|
81
|
+
*
|
|
82
|
+
* Returns a NEW object; the input bag is not mutated.
|
|
83
|
+
*/
|
|
84
|
+
function applyAttributePatch(bag, patch) {
|
|
85
|
+
const next = { ...normalizeAttributeBag(bag) };
|
|
86
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
87
|
+
if (isEmptyAttributeValue(value))
|
|
88
|
+
delete next[key];
|
|
89
|
+
else
|
|
90
|
+
next[key] = value;
|
|
91
|
+
}
|
|
92
|
+
return next;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Drop empty values — the create path, where there is no prior bag to merge
|
|
96
|
+
* into and nothing to clear.
|
|
97
|
+
*
|
|
98
|
+
* Mirrors the validator's "non-empty if present" rule so a freshly created row
|
|
99
|
+
* never stores `{"k": ""}`, which would otherwise read as an answer.
|
|
100
|
+
*/
|
|
101
|
+
function stripEmptyAttributeValues(bag) {
|
|
102
|
+
const clean = {};
|
|
103
|
+
if (!bag)
|
|
104
|
+
return clean;
|
|
105
|
+
for (const [key, value] of Object.entries(bag)) {
|
|
106
|
+
if (!isEmptyAttributeValue(value))
|
|
107
|
+
clean[key] = value;
|
|
108
|
+
}
|
|
109
|
+
return clean;
|
|
110
|
+
}
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
// Errors
|
|
113
|
+
// ---------------------------------------------------------------------------
|
|
114
|
+
/**
|
|
115
|
+
* Swap the machine key for the display label in messages a human reads.
|
|
116
|
+
*
|
|
117
|
+
* The validator keys its messages by `key` (`annual_volume`) so `field` stays
|
|
118
|
+
* parseable for every consumer. `field` is left untouched — callers still
|
|
119
|
+
* derive the drop-key from it — and only the prose changes.
|
|
120
|
+
*/
|
|
121
|
+
function relabelAttributeErrors(definitions, errors) {
|
|
122
|
+
if (errors.length === 0)
|
|
123
|
+
return errors;
|
|
124
|
+
const labelByKey = new Map(definitions.map((d) => [d.key, d.label]));
|
|
125
|
+
return errors.map((e) => {
|
|
126
|
+
const key = e.field.replace(/^attributes\./, '');
|
|
127
|
+
const label = labelByKey.get(key);
|
|
128
|
+
// No label (an unknown key is not in the registry) or a label identical to
|
|
129
|
+
// the key: nothing to swap. The validator quotes the key as `"<key>"` in
|
|
130
|
+
// every message variant.
|
|
131
|
+
if (!label || label === key)
|
|
132
|
+
return e;
|
|
133
|
+
return { ...e, message: e.message.split(`"${key}"`).join(`"${label}"`) };
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Validate WITHOUT throwing, and split the bag into what may be written and
|
|
138
|
+
* what a human should be told about — the import path.
|
|
139
|
+
*
|
|
140
|
+
* An unknown attribute or a value outside the registry becomes a warning and a
|
|
141
|
+
* dropped key, never a failed row and never a mutated registry. Rejecting a
|
|
142
|
+
* whole import because one spreadsheet column has a typo is the behaviour this
|
|
143
|
+
* exists to avoid.
|
|
144
|
+
*/
|
|
145
|
+
function sanitizeAttributeBag(definitions, bag) {
|
|
146
|
+
if (!bag || Object.keys(bag).length === 0)
|
|
147
|
+
return { clean: {}, warnings: [] };
|
|
148
|
+
const errors = (0, attributeValidation_1.validateAttributeBag)(definitions, bag);
|
|
149
|
+
// Drop-keys come from the untouched `field` (the code); warnings read the label.
|
|
150
|
+
const badKeys = new Set(errors.map((e) => e.field.replace(/^attributes\./, '')));
|
|
151
|
+
const warnings = relabelAttributeErrors(definitions, errors).map((e) => e.message);
|
|
152
|
+
const clean = {};
|
|
153
|
+
for (const [key, value] of Object.entries(bag)) {
|
|
154
|
+
if (badKeys.has(key))
|
|
155
|
+
continue;
|
|
156
|
+
if (isEmptyAttributeValue(value))
|
|
157
|
+
continue;
|
|
158
|
+
clean[key] = value;
|
|
159
|
+
}
|
|
160
|
+
return { clean, warnings };
|
|
161
|
+
}
|
|
162
|
+
// ---------------------------------------------------------------------------
|
|
163
|
+
// Definitions cache
|
|
164
|
+
// ---------------------------------------------------------------------------
|
|
165
|
+
/**
|
|
166
|
+
* A short-TTL memo for a tenant's definitions, so the write path does not
|
|
167
|
+
* round-trip the registry on every save. Definitions are curated and rare, and
|
|
168
|
+
* a newly created one taking effect a few seconds late is acceptable under
|
|
169
|
+
* lenient-until-adopted.
|
|
170
|
+
*
|
|
171
|
+
* A FACTORY, not a module-level cache, and that is the point. A singleton
|
|
172
|
+
* inside a shared package running in a multi-tenant process is one forgotten
|
|
173
|
+
* map key away from serving one tenant's registry to another. The caller owns
|
|
174
|
+
* the instance AND builds the key, so the tenant is visibly part of it at the
|
|
175
|
+
* call site rather than buried in here.
|
|
176
|
+
*/
|
|
177
|
+
function createAttributeDefinitionsCache(options) {
|
|
178
|
+
const ttlMs = options.ttlMs ?? 30_000;
|
|
179
|
+
const now = options.now ?? (() => Date.now());
|
|
180
|
+
const entries = new Map();
|
|
181
|
+
return {
|
|
182
|
+
async get(key) {
|
|
183
|
+
const hit = entries.get(key);
|
|
184
|
+
if (hit && now() - hit.at < ttlMs)
|
|
185
|
+
return hit.value;
|
|
186
|
+
const value = await options.load(key);
|
|
187
|
+
entries.set(key, { value, at: now() });
|
|
188
|
+
return value;
|
|
189
|
+
},
|
|
190
|
+
invalidate(key) {
|
|
191
|
+
if (key === undefined)
|
|
192
|
+
entries.clear();
|
|
193
|
+
else
|
|
194
|
+
entries.delete(key);
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
// ---------------------------------------------------------------------------
|
|
199
|
+
// Options, display, required
|
|
200
|
+
// ---------------------------------------------------------------------------
|
|
201
|
+
/**
|
|
202
|
+
* The option rows for a select/hierarchy definition — real rows when present,
|
|
203
|
+
* else flat rows synthesized from the legacy inline `options` so a caller never
|
|
204
|
+
* has to know which of the two a definition uses.
|
|
205
|
+
*/
|
|
206
|
+
function attributeOptionsFor(def) {
|
|
207
|
+
if (def.attributeOptions && def.attributeOptions.length > 0)
|
|
208
|
+
return def.attributeOptions;
|
|
209
|
+
return (def.options ?? []).map((value, i) => ({
|
|
210
|
+
id: `${def.key}:${value}`,
|
|
211
|
+
value,
|
|
212
|
+
label: value,
|
|
213
|
+
sortOrder: i,
|
|
214
|
+
parentId: null,
|
|
215
|
+
level: 0,
|
|
216
|
+
}));
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* A stored value as a human reads it: select/hierarchy render the option's
|
|
220
|
+
* LABEL rather than its stored value, multi-select joins them, a number carries
|
|
221
|
+
* its unit, and empty is a dash.
|
|
222
|
+
*
|
|
223
|
+
* The three non-data words are injectable because a localized consumer cannot
|
|
224
|
+
* ship English out of a shared package — and defaulting them keeps every
|
|
225
|
+
* existing call site byte-identical.
|
|
226
|
+
*/
|
|
227
|
+
function formatAttributeValue(def, raw, labels = {}) {
|
|
228
|
+
const { yes = 'Yes', no = 'No', empty = '—' } = labels;
|
|
229
|
+
if (raw === undefined || raw === null || raw === '')
|
|
230
|
+
return empty;
|
|
231
|
+
switch (def.dataType) {
|
|
232
|
+
case 'boolean':
|
|
233
|
+
return raw ? yes : no;
|
|
234
|
+
case 'multi_select': {
|
|
235
|
+
if (!Array.isArray(raw))
|
|
236
|
+
return String(raw);
|
|
237
|
+
const options = attributeOptionsFor(def);
|
|
238
|
+
return raw.map((v) => options.find((o) => o.value === v)?.label ?? String(v)).join(', ');
|
|
239
|
+
}
|
|
240
|
+
case 'enum':
|
|
241
|
+
case 'hierarchy': {
|
|
242
|
+
const opt = attributeOptionsFor(def).find((o) => o.value === raw);
|
|
243
|
+
return opt?.label ?? String(raw);
|
|
244
|
+
}
|
|
245
|
+
case 'number':
|
|
246
|
+
return def.unit ? `${raw} ${def.unit}` : String(raw);
|
|
247
|
+
default:
|
|
248
|
+
return String(raw);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* The required definitions with nothing filled in — what a form holds Save on.
|
|
253
|
+
*
|
|
254
|
+
* Two exclusions, each of which looks like a bug until it is stated:
|
|
255
|
+
*
|
|
256
|
+
* - **Non-active definitions.** A deprecated or archived attribute may still
|
|
257
|
+
* carry `required`, but demanding a value for something being retired blocks
|
|
258
|
+
* work over a decision already taken.
|
|
259
|
+
* - **A select with no options configured.** enum / multi_select / hierarchy
|
|
260
|
+
* can be defined before anyone adds their values, and a required one in that
|
|
261
|
+
* state cannot be satisfied at all — holding Save on it traps the user in the
|
|
262
|
+
* form with no way out. The configuration error belongs in the registry's own
|
|
263
|
+
* screen, not in a dead end here.
|
|
264
|
+
*/
|
|
265
|
+
function missingRequiredAttributes(definitions, values) {
|
|
266
|
+
if (!definitions || definitions.length === 0)
|
|
267
|
+
return [];
|
|
268
|
+
const bag = values ?? {};
|
|
269
|
+
return definitions.filter((def) => {
|
|
270
|
+
if (!def.validation?.required)
|
|
271
|
+
return false;
|
|
272
|
+
if (def.status !== 'active')
|
|
273
|
+
return false;
|
|
274
|
+
const isSelect = def.dataType === 'enum' || def.dataType === 'multi_select' || def.dataType === 'hierarchy';
|
|
275
|
+
if (isSelect && attributeOptionsFor(def).length === 0)
|
|
276
|
+
return false;
|
|
277
|
+
return isUnansweredAttributeValue(bag[def.key]);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Registry definition → the shape above.
|
|
282
|
+
*
|
|
283
|
+
* Pass the tenant's groups to resolve `group`/`groupSortOrder`; without them
|
|
284
|
+
* the definition's legacy `group` string is used, which is the Part-era
|
|
285
|
+
* fallback and the only thing Part definitions have.
|
|
286
|
+
*/
|
|
287
|
+
function toClientAttributeDefinition(def, groupById) {
|
|
288
|
+
const group = def.groupId ? groupById?.get(def.groupId) : undefined;
|
|
289
|
+
return {
|
|
290
|
+
id: def.id,
|
|
291
|
+
key: def.key,
|
|
292
|
+
label: def.label,
|
|
293
|
+
dataType: def.dataType,
|
|
294
|
+
unit: def.unit,
|
|
295
|
+
options: def.options,
|
|
296
|
+
group: group?.name ?? def.group,
|
|
297
|
+
groupId: def.groupId,
|
|
298
|
+
groupSortOrder: group?.sortOrder ?? null,
|
|
299
|
+
validation: def.validation,
|
|
300
|
+
filterable: def.filterable,
|
|
301
|
+
status: def.status,
|
|
302
|
+
sortOrder: def.sortOrder,
|
|
303
|
+
attributeOptions: (def.attributeOptions ?? []).map((o) => ({
|
|
304
|
+
id: o.id,
|
|
305
|
+
value: o.value,
|
|
306
|
+
label: o.label,
|
|
307
|
+
sortOrder: o.sortOrder,
|
|
308
|
+
parentId: o.parentId,
|
|
309
|
+
level: o.level,
|
|
310
|
+
})),
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Coerce a filter typed as a STRING (a query parameter always is) to the type
|
|
315
|
+
* its definition stores, and say how to match it.
|
|
316
|
+
*
|
|
317
|
+
* Text matches by substring, which is what somebody typing half a value
|
|
318
|
+
* expects; anything picked from a dropdown matches exactly. Returns `null` when
|
|
319
|
+
* there is nothing to filter on or the key is not in the registry — the caller
|
|
320
|
+
* then applies NO predicate, rather than a predicate that matches nothing and
|
|
321
|
+
* silently empties the list.
|
|
322
|
+
*/
|
|
323
|
+
function attributeFilterMatch(definitions, key, value) {
|
|
324
|
+
if (!key || value == null || value === '')
|
|
325
|
+
return null;
|
|
326
|
+
const def = definitions.find((d) => d.key === key);
|
|
327
|
+
if (!def)
|
|
328
|
+
return null;
|
|
329
|
+
if (def.dataType === 'multi_select')
|
|
330
|
+
return { key, mode: 'arrayContains', value };
|
|
331
|
+
if (def.dataType === 'text')
|
|
332
|
+
return { key, mode: 'contains', value };
|
|
333
|
+
if (def.dataType === 'number')
|
|
334
|
+
return { key, mode: 'equals', value: Number(value) };
|
|
335
|
+
if (def.dataType === 'boolean')
|
|
336
|
+
return { key, mode: 'equals', value: value === 'true' };
|
|
337
|
+
return { key, mode: 'equals', value };
|
|
338
|
+
}
|
|
339
|
+
//# sourceMappingURL=attributeBag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributeBag.js","sourceRoot":"","sources":["../src/attributeBag.ts"],"names":[],"mappings":";;AAkFA,sDAEC;AAQD,gEAKC;AAaD,sDAWC;AAeD,kDAUC;AASD,8DASC;AAaD,wDAeC;AAWD,oDAkBC;AAkBD,0EA4BC;AAWD,kDAUC;AAoBD,oDAyBC;AAgBD,8DAcC;AA2CD,kEA4BC;AA4BD,oDAaC;AA1dD,+DAAuF;AAoEvF,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CAAC,KAAc;IAClD,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,CAAC;AAC/D,CAAC;AAED;;;;;GAKG;AACH,SAAgB,0BAA0B,CAAC,KAAc;IACvD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACvD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;IAC1D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,MAAM,KAAK,CAA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,QAAQ,KAAK,QAAQ;QAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;IACpF,IAAI,GAAG,CAAC,QAAQ,KAAK,SAAS;QAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,KAAK,MAAM,EAAE,CAAC;IACxF,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACxC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ export { AttributeGroupResource } from './attributeGroups';
|
|
|
34
34
|
export { AttributeOptionResource } from './attributeOptions';
|
|
35
35
|
export { validateAttributeBag, assertValidAttributeBag } from './attributeValidation';
|
|
36
36
|
export type { AttributeFieldError } from './attributeValidation';
|
|
37
|
+
export { isEmptyAttributeValue, isUnansweredAttributeValue, normalizeAttributeBag, applyAttributePatch, stripEmptyAttributeValues, relabelAttributeErrors, sanitizeAttributeBag, createAttributeDefinitionsCache, attributeOptionsFor, formatAttributeValue, missingRequiredAttributes, toClientAttributeDefinition, attributeFilterMatch, } from './attributeBag';
|
|
38
|
+
export type { AttributeDefinitionView, AttributeOptionView, AttributeValueLabels, ClientAttributeDefinition, AttributeFilterMatch, } from './attributeBag';
|
|
37
39
|
export { PartResource } from './parts';
|
|
38
40
|
export { OwnershipResource } from './ownership';
|
|
39
41
|
export { formatSchedulePeriod, schedulePeriodGranularity, type SchedulePeriodGranularity, } from './schedulePeriods';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAG9C,OAAO,EAAE,eAAe,EA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,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,mBAAmB,EACnB,8BAA8B,EAC9B,8BAA8B,EAC9B,+BAA+B,EAC/B,cAAc,EACd,yBAAyB,EACzB,yBAAyB,EACzB,2BAA2B,EAC3B,eAAe,EACf,0BAA0B,EAC1B,0BAA0B,EAC1B,mBAAmB,EACnB,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,eAAe,EACf,aAAa,EACb,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,cAAc,GACf,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.OwnershipResource = exports.PartResource = exports.attributeFilterMatch = exports.toClientAttributeDefinition = exports.missingRequiredAttributes = exports.formatAttributeValue = exports.attributeOptionsFor = exports.createAttributeDefinitionsCache = exports.sanitizeAttributeBag = exports.relabelAttributeErrors = exports.stripEmptyAttributeValues = exports.applyAttributePatch = exports.normalizeAttributeBag = exports.isUnansweredAttributeValue = exports.isEmptyAttributeValue = exports.assertValidAttributeBag = exports.validateAttributeBag = exports.AttributeOptionResource = exports.AttributeGroupResource = exports.AttributeDefinitionResource = exports.PartAttributeResource = exports.PartTypeResource = exports.PartTypeDefaultResource = exports.PartCategoryResource = exports.PartCategoryDefaultResource = exports.OemFormTemplateResource = exports.ExternalReferenceResource = exports.RegionResource = exports.ExchangeRateResource = exports.RatesResource = exports.RateCatalogResource = exports.RateTableResource = exports.RateElementResource = exports.RateBookResource = exports.ProcessFamilyResource = exports.EquipmentResource = exports.PlantResource = exports.MaterialResource = exports.EngineeringChangeResource = exports.QuoteAskResource = exports.QuoteLineResource = exports.QuoteResource = exports.ProgramResource = exports.ImportTemplateResource = exports.ImportResource = exports.LocationResource = exports.ContactResource = exports.CompanyResource = exports.MockMasterDataClient = exports.MasterDataClient = void 0;
|
|
4
|
+
exports.ForbiddenError = exports.UnauthorizedError = exports.ConflictError = exports.ValidationError = exports.NotFoundError = exports.MasterDataError = exports.schedulePeriodGranularity = exports.formatSchedulePeriod = void 0;
|
|
4
5
|
// Client
|
|
5
6
|
var client_1 = require("./client");
|
|
6
7
|
Object.defineProperty(exports, "MasterDataClient", { enumerable: true, get: function () { return client_1.MasterDataClient; } });
|
|
@@ -72,6 +73,24 @@ Object.defineProperty(exports, "AttributeOptionResource", { enumerable: true, ge
|
|
|
72
73
|
var attributeValidation_1 = require("./attributeValidation");
|
|
73
74
|
Object.defineProperty(exports, "validateAttributeBag", { enumerable: true, get: function () { return attributeValidation_1.validateAttributeBag; } });
|
|
74
75
|
Object.defineProperty(exports, "assertValidAttributeBag", { enumerable: true, get: function () { return attributeValidation_1.assertValidAttributeBag; } });
|
|
76
|
+
// The shared core AROUND the validator — bag arithmetic, error relabelling, the
|
|
77
|
+
// definitions memo, display/required helpers and the client-facing definition
|
|
78
|
+
// shape. Policy (status codes, activeOnly, the persisting SQL) stays in each
|
|
79
|
+
// consumer on purpose; see the module header.
|
|
80
|
+
var attributeBag_1 = require("./attributeBag");
|
|
81
|
+
Object.defineProperty(exports, "isEmptyAttributeValue", { enumerable: true, get: function () { return attributeBag_1.isEmptyAttributeValue; } });
|
|
82
|
+
Object.defineProperty(exports, "isUnansweredAttributeValue", { enumerable: true, get: function () { return attributeBag_1.isUnansweredAttributeValue; } });
|
|
83
|
+
Object.defineProperty(exports, "normalizeAttributeBag", { enumerable: true, get: function () { return attributeBag_1.normalizeAttributeBag; } });
|
|
84
|
+
Object.defineProperty(exports, "applyAttributePatch", { enumerable: true, get: function () { return attributeBag_1.applyAttributePatch; } });
|
|
85
|
+
Object.defineProperty(exports, "stripEmptyAttributeValues", { enumerable: true, get: function () { return attributeBag_1.stripEmptyAttributeValues; } });
|
|
86
|
+
Object.defineProperty(exports, "relabelAttributeErrors", { enumerable: true, get: function () { return attributeBag_1.relabelAttributeErrors; } });
|
|
87
|
+
Object.defineProperty(exports, "sanitizeAttributeBag", { enumerable: true, get: function () { return attributeBag_1.sanitizeAttributeBag; } });
|
|
88
|
+
Object.defineProperty(exports, "createAttributeDefinitionsCache", { enumerable: true, get: function () { return attributeBag_1.createAttributeDefinitionsCache; } });
|
|
89
|
+
Object.defineProperty(exports, "attributeOptionsFor", { enumerable: true, get: function () { return attributeBag_1.attributeOptionsFor; } });
|
|
90
|
+
Object.defineProperty(exports, "formatAttributeValue", { enumerable: true, get: function () { return attributeBag_1.formatAttributeValue; } });
|
|
91
|
+
Object.defineProperty(exports, "missingRequiredAttributes", { enumerable: true, get: function () { return attributeBag_1.missingRequiredAttributes; } });
|
|
92
|
+
Object.defineProperty(exports, "toClientAttributeDefinition", { enumerable: true, get: function () { return attributeBag_1.toClientAttributeDefinition; } });
|
|
93
|
+
Object.defineProperty(exports, "attributeFilterMatch", { enumerable: true, get: function () { return attributeBag_1.attributeFilterMatch; } });
|
|
75
94
|
var parts_1 = require("./parts");
|
|
76
95
|
Object.defineProperty(exports, "PartResource", { enumerable: true, get: function () { return parts_1.PartResource; } });
|
|
77
96
|
var ownership_1 = require("./ownership");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"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
-
"version": "4.
|
|
4
|
-
"description": "TypeScript client for the Master Data Service",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist"
|
|
9
|
-
],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "tsc",
|
|
12
|
-
"clean": "rm -rf dist",
|
|
13
|
-
"test": "npm run build && node --test",
|
|
14
|
-
"prepublishOnly": "npm run build"
|
|
15
|
-
},
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "https://github.com/Campfire-Interactive/packages.git"
|
|
19
|
-
},
|
|
20
|
-
"publishConfig": {
|
|
21
|
-
"registry": "https://registry.npmjs.org",
|
|
22
|
-
"access": "public"
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"@types/node": "^25.5.0",
|
|
26
|
-
"typescript": "^5.3.3"
|
|
27
|
-
},
|
|
28
|
-
"engines": {
|
|
29
|
-
"node": ">=18.0.0"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@campfire-interactive/master-data-client",
|
|
3
|
+
"version": "4.27.0",
|
|
4
|
+
"description": "TypeScript client for the Master Data Service",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"clean": "rm -rf dist",
|
|
13
|
+
"test": "npm run build && node --test",
|
|
14
|
+
"prepublishOnly": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/Campfire-Interactive/packages.git"
|
|
19
|
+
},
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"registry": "https://registry.npmjs.org",
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^25.5.0",
|
|
26
|
+
"typescript": "^5.3.3"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=18.0.0"
|
|
30
|
+
}
|
|
31
|
+
}
|
package/dist/partFamilies.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { HttpTransport } from './http';
|
|
2
|
-
import type { PartFamily, CreatePartFamilyInput, UpdatePartFamilyInput, SingleResponse, ListResponse, CreateResponse } from './types';
|
|
3
|
-
export declare class PartFamilyResource {
|
|
4
|
-
private readonly http;
|
|
5
|
-
constructor(http: HttpTransport);
|
|
6
|
-
list(): Promise<ListResponse<PartFamily>>;
|
|
7
|
-
get(id: string): Promise<SingleResponse<PartFamily>>;
|
|
8
|
-
create(input: CreatePartFamilyInput, idempotencyKey?: string): Promise<CreateResponse<PartFamily>>;
|
|
9
|
-
update(id: string, input: UpdatePartFamilyInput, idempotencyKey?: string): Promise<SingleResponse<PartFamily>>;
|
|
10
|
-
delete(id: string): Promise<void>;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=partFamilies.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"partFamilies.d.ts","sourceRoot":"","sources":["../src/partFamilies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EACV,UAAU,EACV,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,YAAY,EACZ,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAE1C,IAAI,IAAI,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IAOzC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAOpD,MAAM,CACV,KAAK,EAAE,qBAAqB,EAC5B,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAShC,MAAM,CACV,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,qBAAqB,EAC5B,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAShC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMxC"}
|
package/dist/partFamilies.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PartFamilyResource = void 0;
|
|
4
|
-
class PartFamilyResource {
|
|
5
|
-
http;
|
|
6
|
-
constructor(http) {
|
|
7
|
-
this.http = http;
|
|
8
|
-
}
|
|
9
|
-
async list() {
|
|
10
|
-
return this.http.request({
|
|
11
|
-
method: 'GET',
|
|
12
|
-
path: '/v1/part-families',
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
async get(id) {
|
|
16
|
-
return this.http.request({
|
|
17
|
-
method: 'GET',
|
|
18
|
-
path: `/v1/part-families/${encodeURIComponent(id)}`,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
async create(input, idempotencyKey) {
|
|
22
|
-
return this.http.request({
|
|
23
|
-
method: 'POST',
|
|
24
|
-
path: '/v1/part-families',
|
|
25
|
-
body: input,
|
|
26
|
-
idempotencyKey,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
async update(id, input, idempotencyKey) {
|
|
30
|
-
return this.http.request({
|
|
31
|
-
method: 'PUT',
|
|
32
|
-
path: `/v1/part-families/${encodeURIComponent(id)}`,
|
|
33
|
-
body: input,
|
|
34
|
-
idempotencyKey,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
async delete(id) {
|
|
38
|
-
await this.http.request({
|
|
39
|
-
method: 'DELETE',
|
|
40
|
-
path: `/v1/part-families/${encodeURIComponent(id)}`,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.PartFamilyResource = PartFamilyResource;
|
|
45
|
-
//# sourceMappingURL=partFamilies.js.map
|
package/dist/partFamilies.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"partFamilies.js","sourceRoot":"","sources":["../src/partFamilies.ts"],"names":[],"mappings":";;;AAUA,MAAa,kBAAkB;IACA;IAA7B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA2B;YACjD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,mBAAmB;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA6B;YACnD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,qBAAqB,kBAAkB,CAAC,EAAE,CAAC,EAAE;SACpD,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CACV,KAA4B,EAC5B,cAAuB;QAEvB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA6B;YACnD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAAE,KAAK;YACX,cAAc;SACf,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CACV,EAAU,EACV,KAA4B,EAC5B,cAAuB;QAEvB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA6B;YACnD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,qBAAqB,kBAAkB,CAAC,EAAE,CAAC,EAAE;YACnD,IAAI,EAAE,KAAK;YACX,cAAc;SACf,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAY;YACjC,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,qBAAqB,kBAAkB,CAAC,EAAE,CAAC,EAAE;SACpD,CAAC,CAAC;IACL,CAAC;CACF;AAhDD,gDAgDC"}
|
package/dist/rateLibraries.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { HttpTransport } from './http';
|
|
2
|
-
import type { RateLibrary, RateEntry, RateEntryKind, AuditLogEntry, CreateRateLibraryInput, UpdateRateLibraryInput, ListRateLibrariesOptions, GetRateLibraryOptions, CreateRateEntryInput, UpdateRateEntryInput, ListRateEntriesOptions, SingleResponse, ListResponse, CreateResponse } from './types';
|
|
3
|
-
declare class RateEntryResource {
|
|
4
|
-
private readonly http;
|
|
5
|
-
constructor(http: HttpTransport);
|
|
6
|
-
list(libraryId: string, options?: ListRateEntriesOptions): Promise<ListResponse<RateEntry>>;
|
|
7
|
-
create(libraryId: string, input: CreateRateEntryInput, idempotencyKey?: string): Promise<CreateResponse<RateEntry>>;
|
|
8
|
-
update(libraryId: string, entryId: string, input: UpdateRateEntryInput, idempotencyKey?: string): Promise<SingleResponse<RateEntry>>;
|
|
9
|
-
remove(libraryId: string, entryId: string): Promise<void>;
|
|
10
|
-
}
|
|
11
|
-
export declare class RateLibraryResource {
|
|
12
|
-
private readonly http;
|
|
13
|
-
readonly entries: RateEntryResource;
|
|
14
|
-
constructor(http: HttpTransport);
|
|
15
|
-
list(options?: ListRateLibrariesOptions): Promise<ListResponse<RateLibrary>>;
|
|
16
|
-
get(id: string, options?: GetRateLibraryOptions): Promise<SingleResponse<RateLibrary>>;
|
|
17
|
-
create(input: CreateRateLibraryInput, idempotencyKey?: string): Promise<CreateResponse<RateLibrary>>;
|
|
18
|
-
update(id: string, input: UpdateRateLibraryInput, idempotencyKey?: string): Promise<SingleResponse<RateLibrary>>;
|
|
19
|
-
publish(id: string, idempotencyKey?: string): Promise<SingleResponse<RateLibrary>>;
|
|
20
|
-
archive(id: string): Promise<void>;
|
|
21
|
-
fork(id: string, idempotencyKey?: string): Promise<CreateResponse<RateLibrary>>;
|
|
22
|
-
getAudit(id: string): Promise<ListResponse<AuditLogEntry>>;
|
|
23
|
-
}
|
|
24
|
-
export type { RateEntryKind };
|
|
25
|
-
//# sourceMappingURL=rateLibraries.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rateLibraries.d.ts","sourceRoot":"","sources":["../src/rateLibraries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,cAAc,EACd,YAAY,EACZ,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,cAAM,iBAAiB;IACT,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAE1C,IAAI,CACR,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAU7B,MAAM,CACV,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,oBAAoB,EAC3B,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAS/B,MAAM,CACV,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,oBAAoB,EAC3B,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAS/B,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMhE;AAED,qBAAa,mBAAmB;IAGlB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;gBAEP,IAAI,EAAE,aAAa;IAI1C,IAAI,CAAC,OAAO,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IAmB5E,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAYtF,MAAM,CACV,KAAK,EAAE,sBAAsB,EAC7B,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IASjC,MAAM,CACV,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,sBAAsB,EAC7B,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IASjC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IASlF,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOlC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAS/E,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;CAMjE;AAED,YAAY,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/rateLibraries.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RateLibraryResource = void 0;
|
|
4
|
-
class RateEntryResource {
|
|
5
|
-
http;
|
|
6
|
-
constructor(http) {
|
|
7
|
-
this.http = http;
|
|
8
|
-
}
|
|
9
|
-
async list(libraryId, options = {}) {
|
|
10
|
-
const query = {};
|
|
11
|
-
if (options.kind)
|
|
12
|
-
query.kind = options.kind;
|
|
13
|
-
return this.http.request({
|
|
14
|
-
method: 'GET',
|
|
15
|
-
path: `/v1/rate-libraries/${encodeURIComponent(libraryId)}/entries`,
|
|
16
|
-
query,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
async create(libraryId, input, idempotencyKey) {
|
|
20
|
-
return this.http.request({
|
|
21
|
-
method: 'POST',
|
|
22
|
-
path: `/v1/rate-libraries/${encodeURIComponent(libraryId)}/entries`,
|
|
23
|
-
body: input,
|
|
24
|
-
idempotencyKey,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
async update(libraryId, entryId, input, idempotencyKey) {
|
|
28
|
-
return this.http.request({
|
|
29
|
-
method: 'PUT',
|
|
30
|
-
path: `/v1/rate-libraries/${encodeURIComponent(libraryId)}/entries/${encodeURIComponent(entryId)}`,
|
|
31
|
-
body: input,
|
|
32
|
-
idempotencyKey,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
async remove(libraryId, entryId) {
|
|
36
|
-
await this.http.request({
|
|
37
|
-
method: 'DELETE',
|
|
38
|
-
path: `/v1/rate-libraries/${encodeURIComponent(libraryId)}/entries/${encodeURIComponent(entryId)}`,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
class RateLibraryResource {
|
|
43
|
-
http;
|
|
44
|
-
entries;
|
|
45
|
-
constructor(http) {
|
|
46
|
-
this.http = http;
|
|
47
|
-
this.entries = new RateEntryResource(http);
|
|
48
|
-
}
|
|
49
|
-
async list(options) {
|
|
50
|
-
const query = {};
|
|
51
|
-
if (options) {
|
|
52
|
-
if (options.limit !== undefined)
|
|
53
|
-
query.limit = String(options.limit);
|
|
54
|
-
if (options.cursor)
|
|
55
|
-
query.cursor = options.cursor;
|
|
56
|
-
if (options.sort)
|
|
57
|
-
query.sort = options.sort;
|
|
58
|
-
if (options.q)
|
|
59
|
-
query.q = options.q;
|
|
60
|
-
if (options.status)
|
|
61
|
-
query.status = options.status;
|
|
62
|
-
if (options.asOf)
|
|
63
|
-
query.asOf = options.asOf;
|
|
64
|
-
if (options.code)
|
|
65
|
-
query.code = options.code;
|
|
66
|
-
if (options.currency)
|
|
67
|
-
query.currency = options.currency;
|
|
68
|
-
}
|
|
69
|
-
return this.http.request({
|
|
70
|
-
method: 'GET',
|
|
71
|
-
path: '/v1/rate-libraries',
|
|
72
|
-
query,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
async get(id, options) {
|
|
76
|
-
const query = {};
|
|
77
|
-
if (options?.include && options.include.length > 0) {
|
|
78
|
-
query.include = options.include.join(',');
|
|
79
|
-
}
|
|
80
|
-
return this.http.request({
|
|
81
|
-
method: 'GET',
|
|
82
|
-
path: `/v1/rate-libraries/${encodeURIComponent(id)}`,
|
|
83
|
-
query,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
async create(input, idempotencyKey) {
|
|
87
|
-
return this.http.request({
|
|
88
|
-
method: 'POST',
|
|
89
|
-
path: '/v1/rate-libraries',
|
|
90
|
-
body: input,
|
|
91
|
-
idempotencyKey,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
async update(id, input, idempotencyKey) {
|
|
95
|
-
return this.http.request({
|
|
96
|
-
method: 'PUT',
|
|
97
|
-
path: `/v1/rate-libraries/${encodeURIComponent(id)}`,
|
|
98
|
-
body: input,
|
|
99
|
-
idempotencyKey,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
async publish(id, idempotencyKey) {
|
|
103
|
-
return this.http.request({
|
|
104
|
-
method: 'POST',
|
|
105
|
-
path: `/v1/rate-libraries/${encodeURIComponent(id)}/publish`,
|
|
106
|
-
body: {},
|
|
107
|
-
idempotencyKey,
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
async archive(id) {
|
|
111
|
-
await this.http.request({
|
|
112
|
-
method: 'DELETE',
|
|
113
|
-
path: `/v1/rate-libraries/${encodeURIComponent(id)}`,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
async fork(id, idempotencyKey) {
|
|
117
|
-
return this.http.request({
|
|
118
|
-
method: 'POST',
|
|
119
|
-
path: `/v1/rate-libraries/${encodeURIComponent(id)}/fork`,
|
|
120
|
-
body: {},
|
|
121
|
-
idempotencyKey,
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
async getAudit(id) {
|
|
125
|
-
return this.http.request({
|
|
126
|
-
method: 'GET',
|
|
127
|
-
path: `/v1/rate-libraries/${encodeURIComponent(id)}/audit`,
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
exports.RateLibraryResource = RateLibraryResource;
|
|
132
|
-
//# sourceMappingURL=rateLibraries.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rateLibraries.js","sourceRoot":"","sources":["../src/rateLibraries.ts"],"names":[],"mappings":";;;AAkBA,MAAM,iBAAiB;IACQ;IAA7B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD,KAAK,CAAC,IAAI,CACR,SAAiB,EACjB,UAAkC,EAAE;QAEpC,MAAM,KAAK,GAAuC,EAAE,CAAC;QACrD,IAAI,OAAO,CAAC,IAAI;YAAE,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAC5C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA0B;YAChD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,sBAAsB,kBAAkB,CAAC,SAAS,CAAC,UAAU;YACnE,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CACV,SAAiB,EACjB,KAA2B,EAC3B,cAAuB;QAEvB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA4B;YAClD,MAAM,EAAE,MAAM;YACd,IAAI,E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{ HttpTransport } from './http';
|
|
2
|
-
import type { Supplier, AuditLogEntry, CreateSupplierInput, UpdateSupplierInput, MergeRequest, ListSuppliersOptions, GetSupplierOptions, SingleResponse, ListResponse, CreateResponse } from './types';
|
|
3
|
-
export declare class SupplierResource {
|
|
4
|
-
private readonly http;
|
|
5
|
-
constructor(http: HttpTransport);
|
|
6
|
-
list(options?: ListSuppliersOptions): Promise<ListResponse<Supplier>>;
|
|
7
|
-
get(id: string, options?: GetSupplierOptions): Promise<SingleResponse<Supplier>>;
|
|
8
|
-
create(input: CreateSupplierInput, idempotencyKey?: string): Promise<CreateResponse<Supplier>>;
|
|
9
|
-
update(id: string, input: UpdateSupplierInput, idempotencyKey?: string): Promise<SingleResponse<Supplier>>;
|
|
10
|
-
archive(id: string): Promise<void>;
|
|
11
|
-
merge(request: MergeRequest, idempotencyKey?: string): Promise<SingleResponse<Supplier>>;
|
|
12
|
-
getAudit(id: string): Promise<ListResponse<AuditLogEntry>>;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=suppliers.d.ts.map
|
package/dist/suppliers.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"suppliers.d.ts","sourceRoot":"","sources":["../src/suppliers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAE1C,IAAI,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAmBrE,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAYhF,MAAM,CACV,KAAK,EAAE,mBAAmB,EAC1B,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAS9B,MAAM,CACV,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,mBAAmB,EAC1B,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAS9B,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOlC,KAAK,CACT,OAAO,EAAE,YAAY,EACrB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAS9B,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;CAMjE"}
|
package/dist/suppliers.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SupplierResource = void 0;
|
|
4
|
-
class SupplierResource {
|
|
5
|
-
http;
|
|
6
|
-
constructor(http) {
|
|
7
|
-
this.http = http;
|
|
8
|
-
}
|
|
9
|
-
async list(options) {
|
|
10
|
-
const query = {};
|
|
11
|
-
if (options) {
|
|
12
|
-
if (options.limit !== undefined)
|
|
13
|
-
query.limit = String(options.limit);
|
|
14
|
-
if (options.cursor)
|
|
15
|
-
query.cursor = options.cursor;
|
|
16
|
-
if (options.sort)
|
|
17
|
-
query.sort = options.sort;
|
|
18
|
-
if (options.q)
|
|
19
|
-
query.q = options.q;
|
|
20
|
-
if (options.status)
|
|
21
|
-
query.status = options.status;
|
|
22
|
-
if (options.country)
|
|
23
|
-
query.country = options.country;
|
|
24
|
-
if (options.quality)
|
|
25
|
-
query.quality = options.quality;
|
|
26
|
-
if (options.include)
|
|
27
|
-
query.include = options.include.join(',');
|
|
28
|
-
}
|
|
29
|
-
return this.http.request({
|
|
30
|
-
method: 'GET',
|
|
31
|
-
path: '/v1/suppliers',
|
|
32
|
-
query,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
async get(id, options) {
|
|
36
|
-
const query = {};
|
|
37
|
-
if (options?.include) {
|
|
38
|
-
query.include = options.include.join(',');
|
|
39
|
-
}
|
|
40
|
-
return this.http.request({
|
|
41
|
-
method: 'GET',
|
|
42
|
-
path: `/v1/suppliers/${encodeURIComponent(id)}`,
|
|
43
|
-
query,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
async create(input, idempotencyKey) {
|
|
47
|
-
return this.http.request({
|
|
48
|
-
method: 'POST',
|
|
49
|
-
path: '/v1/suppliers',
|
|
50
|
-
body: input,
|
|
51
|
-
idempotencyKey,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
async update(id, input, idempotencyKey) {
|
|
55
|
-
return this.http.request({
|
|
56
|
-
method: 'PUT',
|
|
57
|
-
path: `/v1/suppliers/${encodeURIComponent(id)}`,
|
|
58
|
-
body: input,
|
|
59
|
-
idempotencyKey,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
async archive(id) {
|
|
63
|
-
await this.http.request({
|
|
64
|
-
method: 'DELETE',
|
|
65
|
-
path: `/v1/suppliers/${encodeURIComponent(id)}`,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
async merge(request, idempotencyKey) {
|
|
69
|
-
return this.http.request({
|
|
70
|
-
method: 'POST',
|
|
71
|
-
path: '/v1/suppliers/merge',
|
|
72
|
-
body: request,
|
|
73
|
-
idempotencyKey,
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
async getAudit(id) {
|
|
77
|
-
return this.http.request({
|
|
78
|
-
method: 'GET',
|
|
79
|
-
path: `/v1/suppliers/${encodeURIComponent(id)}/audit`,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
exports.SupplierResource = SupplierResource;
|
|
84
|
-
//# sourceMappingURL=suppliers.js.map
|
package/dist/suppliers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"suppliers.js","sourceRoot":"","sources":["../src/suppliers.ts"],"names":[],"mappings":";;;AAcA,MAAa,gBAAgB;IACE;IAA7B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD,KAAK,CAAC,IAAI,CAAC,OAA8B;QACvC,MAAM,KAAK,GAAuC,EAAE,CAAC;QACrD,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;gBAAE,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACrE,IAAI,OAAO,CAAC,MAAM;gBAAE,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAClD,IAAI,OAAO,CAAC,IAAI;gBAAE,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAC5C,IAAI,OAAO,CAAC,CAAC;gBAAE,KAAK,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;YACnC,IAAI,OAAO,CAAC,MAAM;gBAAE,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAClD,IAAI,OAAO,CAAC,OAAO;gBAAE,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;YACrD,IAAI,OAAO,CAAC,OAAO;gBAAE,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;YACrD,IAAI,OAAO,CAAC,OAAO;gBAAE,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAyB;YAC/C,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