@salesforce/lds-adapters-industries-instant-pricing 0.1.0-dev1

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/LICENSE.txt ADDED
@@ -0,0 +1,82 @@
1
+ Terms of Use
2
+
3
+ Copyright 2022 Salesforce, Inc. All rights reserved.
4
+
5
+ These Terms of Use govern the download, installation, and/or use of this
6
+ software provided by Salesforce, Inc. ("Salesforce") (the "Software"), were
7
+ last updated on April 15, 2022, and constitute a legally binding
8
+ agreement between you and Salesforce. If you do not agree to these Terms of
9
+ Use, do not install or use the Software.
10
+
11
+ Salesforce grants you a worldwide, non-exclusive, no-charge, royalty-free
12
+ copyright license to reproduce, prepare derivative works of, publicly
13
+ display, publicly perform, sublicense, and distribute the Software and
14
+ derivative works subject to these Terms. These Terms shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ Subject to the limited rights expressly granted hereunder, Salesforce
18
+ reserves all rights, title, and interest in and to all intellectual
19
+ property subsisting in the Software. No rights are granted to you hereunder
20
+ other than as expressly set forth herein. Users residing in countries on
21
+ the United States Office of Foreign Assets Control sanction list, or which
22
+ are otherwise subject to a US export embargo, may not use the Software.
23
+
24
+ Implementation of the Software may require development work, for which you
25
+ are responsible. The Software may contain bugs, errors and
26
+ incompatibilities and is made available on an AS IS basis without support,
27
+ updates, or service level commitments.
28
+
29
+ Salesforce reserves the right at any time to modify, suspend, or
30
+ discontinue, the Software (or any part thereof) with or without notice. You
31
+ agree that Salesforce shall not be liable to you or to any third party for
32
+ any modification, suspension, or discontinuance.
33
+
34
+ You agree to defend Salesforce against any claim, demand, suit or
35
+ proceeding made or brought against Salesforce by a third party arising out
36
+ of or accruing from (a) your use of the Software, and (b) any application
37
+ you develop with the Software that infringes any copyright, trademark,
38
+ trade secret, trade dress, patent, or other intellectual property right of
39
+ any person or defames any person or violates their rights of publicity or
40
+ privacy (each a "Claim Against Salesforce"), and will indemnify Salesforce
41
+ from any damages, attorney fees, and costs finally awarded against
42
+ Salesforce as a result of, or for any amounts paid by Salesforce under a
43
+ settlement approved by you in writing of, a Claim Against Salesforce,
44
+ provided Salesforce (x) promptly gives you written notice of the Claim
45
+ Against Salesforce, (y) gives you sole control of the defense and
46
+ settlement of the Claim Against Salesforce (except that you may not settle
47
+ any Claim Against Salesforce unless it unconditionally releases Salesforce
48
+ of all liability), and (z) gives you all reasonable assistance, at your
49
+ expense.
50
+
51
+ WITHOUT LIMITING THE GENERALITY OF THE FOREGOING, THE SOFTWARE IS NOT
52
+ SUPPORTED AND IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53
+ IMPLIED. IN NO EVENT SHALL SALESFORCE HAVE ANY LIABILITY FOR ANY DAMAGES,
54
+ INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
55
+ PUNITIVE, OR CONSEQUENTIAL DAMAGES, OR DAMAGES BASED ON LOST PROFITS, DATA,
56
+ OR USE, IN CONNECTION WITH THE SOFTWARE, HOWEVER CAUSED AND WHETHER IN
57
+ CONTRACT, TORT, OR UNDER ANY OTHER THEORY OF LIABILITY, WHETHER OR NOT YOU
58
+ HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
59
+
60
+ These Terms of Use shall be governed exclusively by the internal laws of
61
+ the State of California, without regard to its conflicts of laws
62
+ rules. Each party hereby consents to the exclusive jurisdiction of the
63
+ state and federal courts located in San Francisco County, California to
64
+ adjudicate any dispute arising out of or relating to these Terms of Use and
65
+ the download, installation, and/or use of the Software. Except as expressly
66
+ stated herein, these Terms of Use constitute the entire agreement between
67
+ the parties, and supersede all prior and contemporaneous agreements,
68
+ proposals, or representations, written or oral, concerning their subject
69
+ matter. No modification, amendment, or waiver of any provision of these
70
+ Terms of Use shall be effective unless it is by an update to these Terms of
71
+ Use that Salesforce makes available, or is in writing and signed by the
72
+ party against whom the modification, amendment, or waiver is to be
73
+ asserted.
74
+
75
+ Data Privacy: Salesforce may collect, process, and store device,
76
+ system, and other information related to your use of the Software. This
77
+ information includes, but is not limited to, IP address, user metrics, and
78
+ other data ("Usage Data"). Salesforce may use Usage Data for analytics,
79
+ product development, and marketing purposes. You acknowledge that files
80
+ generated in conjunction with the Software may contain sensitive or
81
+ confidential data, and you are solely responsible for anonymizing and
82
+ protecting such data.
@@ -0,0 +1,377 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$1 } from '@luvio/engine';
8
+
9
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
+ const { keys: ObjectKeys, create: ObjectCreate } = Object;
11
+ const { isArray: ArrayIsArray$1 } = Array;
12
+ /**
13
+ * Validates an adapter config is well-formed.
14
+ * @param config The config to validate.
15
+ * @param adapter The adapter validation configuration.
16
+ * @param oneOf The keys the config must contain at least one of.
17
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
18
+ */
19
+ function validateConfig(config, adapter, oneOf) {
20
+ const { displayName } = adapter;
21
+ const { required, optional, unsupported } = adapter.parameters;
22
+ if (config === undefined ||
23
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
24
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
25
+ }
26
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
27
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
28
+ }
29
+ if (unsupported !== undefined &&
30
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
31
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
32
+ }
33
+ const supported = required.concat(optional);
34
+ if (ObjectKeys(config).some(key => !supported.includes(key))) {
35
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
36
+ }
37
+ }
38
+ function untrustedIsObject(untrusted) {
39
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
40
+ }
41
+ function areRequiredParametersPresent(config, configPropertyNames) {
42
+ return configPropertyNames.parameters.required.every(req => req in config);
43
+ }
44
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
45
+ return {
46
+ name,
47
+ required,
48
+ resourceType,
49
+ typeCheckShape,
50
+ isArrayShape,
51
+ coerceFn,
52
+ };
53
+ }
54
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
55
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
56
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
57
+ return {
58
+ displayName,
59
+ parameters: {
60
+ required,
61
+ optional,
62
+ }
63
+ };
64
+ }
65
+ const keyPrefix = 'instant-pricing';
66
+
67
+ const { isArray: ArrayIsArray } = Array;
68
+ const { stringify: JSONStringify } = JSON;
69
+ function createLink(ref) {
70
+ return {
71
+ __ref: serializeStructuredKey(ref),
72
+ };
73
+ }
74
+
75
+ function validate$1(obj, path = 'GetInstantPricingInputRepresentation') {
76
+ const v_error = (() => {
77
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
78
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
79
+ }
80
+ const obj_contextId = obj.contextId;
81
+ const path_contextId = path + '.contextId';
82
+ let obj_contextId_union0 = null;
83
+ const obj_contextId_union0_error = (() => {
84
+ if (typeof obj_contextId !== 'string') {
85
+ return new TypeError('Expected "string" but received "' + typeof obj_contextId + '" (at "' + path_contextId + '")');
86
+ }
87
+ })();
88
+ if (obj_contextId_union0_error != null) {
89
+ obj_contextId_union0 = obj_contextId_union0_error.message;
90
+ }
91
+ let obj_contextId_union1 = null;
92
+ const obj_contextId_union1_error = (() => {
93
+ if (obj_contextId !== null) {
94
+ return new TypeError('Expected "null" but received "' + typeof obj_contextId + '" (at "' + path_contextId + '")');
95
+ }
96
+ })();
97
+ if (obj_contextId_union1_error != null) {
98
+ obj_contextId_union1 = obj_contextId_union1_error.message;
99
+ }
100
+ if (obj_contextId_union0 && obj_contextId_union1) {
101
+ let message = 'Object doesn\'t match union (at "' + path_contextId + '")';
102
+ message += '\n' + obj_contextId_union0.split('\n').map((line) => '\t' + line).join('\n');
103
+ message += '\n' + obj_contextId_union1.split('\n').map((line) => '\t' + line).join('\n');
104
+ return new TypeError(message);
105
+ }
106
+ const obj_correlationId = obj.correlationId;
107
+ const path_correlationId = path + '.correlationId';
108
+ let obj_correlationId_union0 = null;
109
+ const obj_correlationId_union0_error = (() => {
110
+ if (typeof obj_correlationId !== 'string') {
111
+ return new TypeError('Expected "string" but received "' + typeof obj_correlationId + '" (at "' + path_correlationId + '")');
112
+ }
113
+ })();
114
+ if (obj_correlationId_union0_error != null) {
115
+ obj_correlationId_union0 = obj_correlationId_union0_error.message;
116
+ }
117
+ let obj_correlationId_union1 = null;
118
+ const obj_correlationId_union1_error = (() => {
119
+ if (obj_correlationId !== null) {
120
+ return new TypeError('Expected "null" but received "' + typeof obj_correlationId + '" (at "' + path_correlationId + '")');
121
+ }
122
+ })();
123
+ if (obj_correlationId_union1_error != null) {
124
+ obj_correlationId_union1 = obj_correlationId_union1_error.message;
125
+ }
126
+ if (obj_correlationId_union0 && obj_correlationId_union1) {
127
+ let message = 'Object doesn\'t match union (at "' + path_correlationId + '")';
128
+ message += '\n' + obj_correlationId_union0.split('\n').map((line) => '\t' + line).join('\n');
129
+ message += '\n' + obj_correlationId_union1.split('\n').map((line) => '\t' + line).join('\n');
130
+ return new TypeError(message);
131
+ }
132
+ const obj_records = obj.records;
133
+ const path_records = path + '.records';
134
+ if (!ArrayIsArray(obj_records)) {
135
+ return new TypeError('Expected "array" but received "' + typeof obj_records + '" (at "' + path_records + '")');
136
+ }
137
+ for (let i = 0; i < obj_records.length; i++) {
138
+ const obj_records_item = obj_records[i];
139
+ const path_records_item = path_records + '[' + i + ']';
140
+ if (typeof obj_records_item !== 'object' || ArrayIsArray(obj_records_item) || obj_records_item === null) {
141
+ return new TypeError('Expected "object" but received "' + typeof obj_records_item + '" (at "' + path_records_item + '")');
142
+ }
143
+ }
144
+ if (obj.requestScope !== undefined) {
145
+ const obj_requestScope = obj.requestScope;
146
+ const path_requestScope = path + '.requestScope';
147
+ if (typeof obj_requestScope !== 'boolean') {
148
+ return new TypeError('Expected "boolean" but received "' + typeof obj_requestScope + '" (at "' + path_requestScope + '")');
149
+ }
150
+ }
151
+ })();
152
+ return v_error === undefined ? null : v_error;
153
+ }
154
+
155
+ const TTL = 1000;
156
+ const VERSION = "1fc110cb13491550fd57015dbe2f752e";
157
+ function validate(obj, path = 'GetInstantPricingOutputRepresentation') {
158
+ const v_error = (() => {
159
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
160
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
161
+ }
162
+ const obj_contextId = obj.contextId;
163
+ const path_contextId = path + '.contextId';
164
+ let obj_contextId_union0 = null;
165
+ const obj_contextId_union0_error = (() => {
166
+ if (typeof obj_contextId !== 'string') {
167
+ return new TypeError('Expected "string" but received "' + typeof obj_contextId + '" (at "' + path_contextId + '")');
168
+ }
169
+ })();
170
+ if (obj_contextId_union0_error != null) {
171
+ obj_contextId_union0 = obj_contextId_union0_error.message;
172
+ }
173
+ let obj_contextId_union1 = null;
174
+ const obj_contextId_union1_error = (() => {
175
+ if (obj_contextId !== null) {
176
+ return new TypeError('Expected "null" but received "' + typeof obj_contextId + '" (at "' + path_contextId + '")');
177
+ }
178
+ })();
179
+ if (obj_contextId_union1_error != null) {
180
+ obj_contextId_union1 = obj_contextId_union1_error.message;
181
+ }
182
+ if (obj_contextId_union0 && obj_contextId_union1) {
183
+ let message = 'Object doesn\'t match union (at "' + path_contextId + '")';
184
+ message += '\n' + obj_contextId_union0.split('\n').map((line) => '\t' + line).join('\n');
185
+ message += '\n' + obj_contextId_union1.split('\n').map((line) => '\t' + line).join('\n');
186
+ return new TypeError(message);
187
+ }
188
+ const obj_correlationId = obj.correlationId;
189
+ const path_correlationId = path + '.correlationId';
190
+ let obj_correlationId_union0 = null;
191
+ const obj_correlationId_union0_error = (() => {
192
+ if (typeof obj_correlationId !== 'string') {
193
+ return new TypeError('Expected "string" but received "' + typeof obj_correlationId + '" (at "' + path_correlationId + '")');
194
+ }
195
+ })();
196
+ if (obj_correlationId_union0_error != null) {
197
+ obj_correlationId_union0 = obj_correlationId_union0_error.message;
198
+ }
199
+ let obj_correlationId_union1 = null;
200
+ const obj_correlationId_union1_error = (() => {
201
+ if (obj_correlationId !== null) {
202
+ return new TypeError('Expected "null" but received "' + typeof obj_correlationId + '" (at "' + path_correlationId + '")');
203
+ }
204
+ })();
205
+ if (obj_correlationId_union1_error != null) {
206
+ obj_correlationId_union1 = obj_correlationId_union1_error.message;
207
+ }
208
+ if (obj_correlationId_union0 && obj_correlationId_union1) {
209
+ let message = 'Object doesn\'t match union (at "' + path_correlationId + '")';
210
+ message += '\n' + obj_correlationId_union0.split('\n').map((line) => '\t' + line).join('\n');
211
+ message += '\n' + obj_correlationId_union1.split('\n').map((line) => '\t' + line).join('\n');
212
+ return new TypeError(message);
213
+ }
214
+ const obj_records = obj.records;
215
+ const path_records = path + '.records';
216
+ if (!ArrayIsArray(obj_records)) {
217
+ return new TypeError('Expected "array" but received "' + typeof obj_records + '" (at "' + path_records + '")');
218
+ }
219
+ for (let i = 0; i < obj_records.length; i++) {
220
+ const obj_records_item = obj_records[i];
221
+ const path_records_item = path_records + '[' + i + ']';
222
+ if (typeof obj_records_item !== 'object' || ArrayIsArray(obj_records_item) || obj_records_item === null) {
223
+ return new TypeError('Expected "object" but received "' + typeof obj_records_item + '" (at "' + path_records_item + '")');
224
+ }
225
+ }
226
+ const obj_success = obj.success;
227
+ const path_success = path + '.success';
228
+ if (typeof obj_success !== 'boolean') {
229
+ return new TypeError('Expected "boolean" but received "' + typeof obj_success + '" (at "' + path_success + '")');
230
+ }
231
+ })();
232
+ return v_error === undefined ? null : v_error;
233
+ }
234
+ const RepresentationType = 'GetInstantPricingOutputRepresentation';
235
+ function keyBuilder(luvio, config) {
236
+ return keyPrefix + '::' + RepresentationType + ':' + (config.contextId === null ? '' : config.contextId);
237
+ }
238
+ function keyBuilderFromType(luvio, object) {
239
+ const keyParams = {
240
+ contextId: object.contextId
241
+ };
242
+ return keyBuilder(luvio, keyParams);
243
+ }
244
+ function normalize(input, existing, path, luvio, store, timestamp) {
245
+ return input;
246
+ }
247
+ const select$1 = function GetInstantPricingOutputRepresentationSelect() {
248
+ return {
249
+ kind: 'Fragment',
250
+ version: VERSION,
251
+ private: [],
252
+ opaque: true
253
+ };
254
+ };
255
+ function equals(existing, incoming) {
256
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
257
+ return false;
258
+ }
259
+ return true;
260
+ }
261
+ const ingest = function GetInstantPricingOutputRepresentationIngest(input, path, luvio, store, timestamp) {
262
+ if (process.env.NODE_ENV !== 'production') {
263
+ const validateError = validate(input);
264
+ if (validateError !== null) {
265
+ throw validateError;
266
+ }
267
+ }
268
+ const key = keyBuilderFromType(luvio, input);
269
+ const ttlToUse = TTL;
270
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "instant-pricing", VERSION, RepresentationType, equals);
271
+ return createLink(key);
272
+ };
273
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
274
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
275
+ const rootKey = keyBuilderFromType(luvio, input);
276
+ rootKeySet.set(rootKey, {
277
+ namespace: keyPrefix,
278
+ representationName: RepresentationType,
279
+ mergeable: false
280
+ });
281
+ }
282
+
283
+ function select(luvio, params) {
284
+ return select$1();
285
+ }
286
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
287
+ getTypeCacheKeys(storeKeyMap, luvio, response);
288
+ }
289
+ function ingestSuccess(luvio, resourceParams, response) {
290
+ const { body } = response;
291
+ const key = keyBuilderFromType(luvio, body);
292
+ luvio.storeIngest(key, ingest, body);
293
+ const snapshot = luvio.storeLookup({
294
+ recordId: key,
295
+ node: select(),
296
+ variables: {},
297
+ });
298
+ if (process.env.NODE_ENV !== 'production') {
299
+ if (snapshot.state !== 'Fulfilled') {
300
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
301
+ }
302
+ }
303
+ deepFreeze(snapshot.data);
304
+ return snapshot;
305
+ }
306
+ function createResourceRequest(config) {
307
+ const headers = {};
308
+ return {
309
+ baseUri: '/services/data/v66.0',
310
+ basePath: '/industries/cpq/quotes/actions/get-instant-price',
311
+ method: 'post',
312
+ body: config.body,
313
+ urlParams: {},
314
+ queryParams: {},
315
+ headers,
316
+ priority: 'normal',
317
+ };
318
+ }
319
+
320
+ const adapterName = 'instantPricing';
321
+ const instantPricing_ConfigPropertyMetadata = [
322
+ generateParamConfigMetadata('getInstantPricingRequestPayload', true, 2 /* Body */, 4 /* Unsupported */),
323
+ ];
324
+ const instantPricing_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, instantPricing_ConfigPropertyMetadata);
325
+ const createResourceParams = /*#__PURE__*/ createResourceParams$1(instantPricing_ConfigPropertyMetadata);
326
+ function typeCheckConfig(untrustedConfig) {
327
+ const config = {};
328
+ const untrustedConfig_getInstantPricingRequestPayload = untrustedConfig.getInstantPricingRequestPayload;
329
+ const referenceGetInstantPricingInputRepresentationValidationError = validate$1(untrustedConfig_getInstantPricingRequestPayload);
330
+ if (referenceGetInstantPricingInputRepresentationValidationError === null) {
331
+ config.getInstantPricingRequestPayload = untrustedConfig_getInstantPricingRequestPayload;
332
+ }
333
+ return config;
334
+ }
335
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
336
+ if (!untrustedIsObject(untrustedConfig)) {
337
+ return null;
338
+ }
339
+ if (process.env.NODE_ENV !== 'production') {
340
+ validateConfig(untrustedConfig, configPropertyNames);
341
+ }
342
+ const config = typeCheckConfig(untrustedConfig);
343
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
344
+ return null;
345
+ }
346
+ return config;
347
+ }
348
+ function buildNetworkSnapshot(luvio, config, options) {
349
+ const resourceParams = createResourceParams(config);
350
+ const request = createResourceRequest(resourceParams);
351
+ return luvio.dispatchResourceRequest(request, options)
352
+ .then((response) => {
353
+ return luvio.handleSuccessResponse(() => {
354
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
355
+ return luvio.storeBroadcast().then(() => snapshot);
356
+ }, () => {
357
+ const cache = new StoreKeyMap();
358
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
359
+ return cache;
360
+ });
361
+ }, (response) => {
362
+ deepFreeze(response);
363
+ throw response;
364
+ });
365
+ }
366
+ const instantPricingAdapterFactory = (luvio) => {
367
+ return function instantPricing(untrustedConfig) {
368
+ const config = validateAdapterConfig(untrustedConfig, instantPricing_ConfigPropertyNames);
369
+ // Invalid or incomplete config
370
+ if (config === null) {
371
+ throw new Error('Invalid config for "instantPricing"');
372
+ }
373
+ return buildNetworkSnapshot(luvio, config);
374
+ };
375
+ };
376
+
377
+ export { instantPricingAdapterFactory };
@@ -0,0 +1,62 @@
1
+ import { Adapter as $64$luvio_engine_Adapter, Snapshot as $64$luvio_engine_Snapshot, UnfulfilledSnapshot as $64$luvio_engine_UnfulfilledSnapshot, AdapterConfigMetadata as $64$luvio_engine_AdapterConfigMetadata } from '@luvio/engine';
2
+ export declare const ObjectPrototypeHasOwnProperty: (v: PropertyKey) => boolean;
3
+ declare const ObjectKeys: {
4
+ (o: object): string[];
5
+ (o: {}): string[];
6
+ }, ObjectCreate: {
7
+ (o: object | null): any;
8
+ (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
9
+ };
10
+ export { ObjectCreate, ObjectKeys };
11
+ export declare const ArrayIsArray: (arg: any) => arg is any[];
12
+ export declare const ArrayPrototypePush: (...items: any[]) => number;
13
+ export interface AdapterValidationConfig {
14
+ displayName: string;
15
+ parameters: {
16
+ required: string[];
17
+ optional: string[];
18
+ unsupported?: string[];
19
+ };
20
+ }
21
+ /**
22
+ * Validates an adapter config is well-formed.
23
+ * @param config The config to validate.
24
+ * @param adapter The adapter validation configuration.
25
+ * @param oneOf The keys the config must contain at least one of.
26
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
27
+ */
28
+ export declare function validateConfig<T>(config: Untrusted<T>, adapter: AdapterValidationConfig, oneOf?: string[]): void;
29
+ export declare function untrustedIsObject<Base>(untrusted: unknown): untrusted is Untrusted<Base>;
30
+ export type UncoercedConfiguration<Base, Options extends {
31
+ [key in keyof Base]?: any;
32
+ }> = {
33
+ [Key in keyof Base]?: Base[Key] | Options[Key];
34
+ };
35
+ export type Untrusted<Base> = Partial<Base>;
36
+ export declare function areRequiredParametersPresent<T>(config: any, configPropertyNames: AdapterValidationConfig): config is T;
37
+ export declare function refreshable<C, D, R>(adapter: $64$luvio_engine_Adapter<C, D>, resolve: (config: unknown) => Promise<$64$luvio_engine_Snapshot<R>>): $64$luvio_engine_Adapter<C, D>;
38
+ export declare const SNAPSHOT_STATE_FULFILLED = "Fulfilled";
39
+ export declare const SNAPSHOT_STATE_UNFULFILLED = "Unfulfilled";
40
+ export declare const snapshotRefreshOptions: {
41
+ overrides: {
42
+ headers: {
43
+ 'Cache-Control': string;
44
+ };
45
+ };
46
+ };
47
+ /**
48
+ * A deterministic JSON stringify implementation. Heavily adapted from https://github.com/epoberezkin/fast-json-stable-stringify.
49
+ * This is needed because insertion order for JSON.stringify(object) affects output:
50
+ * JSON.stringify({a: 1, b: 2})
51
+ * "{"a":1,"b":2}"
52
+ * JSON.stringify({b: 2, a: 1})
53
+ * "{"b":2,"a":1}"
54
+ * @param data Data to be JSON-stringified.
55
+ * @returns JSON.stringified value with consistent ordering of keys.
56
+ */
57
+ export declare function stableJSONStringify(node: any): string | undefined;
58
+ export declare function getFetchResponseStatusText(status: number): string;
59
+ export declare function isUnfulfilledSnapshot<T, U>(snapshot: $64$luvio_engine_Snapshot<T, U>): snapshot is $64$luvio_engine_UnfulfilledSnapshot<T, U>;
60
+ export declare function generateParamConfigMetadata(name: string, required: boolean, resourceType: $64$luvio_engine_AdapterConfigMetadata['resourceType'], typeCheckShape: $64$luvio_engine_AdapterConfigMetadata['typeCheckShape'], isArrayShape?: boolean, coerceFn?: (v: unknown) => unknown): $64$luvio_engine_AdapterConfigMetadata;
61
+ export declare function buildAdapterValidationConfig(displayName: string, paramsMeta: $64$luvio_engine_AdapterConfigMetadata[]): AdapterValidationConfig;
62
+ export declare const keyPrefix = "instant-pricing";
@@ -0,0 +1,16 @@
1
+ import { AdapterConfigMetadata as $64$luvio_engine_AdapterConfigMetadata, Luvio as $64$luvio_engine_Luvio, DispatchResourceRequestContext as $64$luvio_engine_DispatchResourceRequestContext, AdapterFactory as $64$luvio_engine_AdapterFactory } from '@luvio/engine';
2
+ import { Untrusted as adapter$45$utils_Untrusted, AdapterValidationConfig as adapter$45$utils_AdapterValidationConfig } from './adapter-utils';
3
+ import { GetInstantPricingInputRepresentation as types_GetInstantPricingInputRepresentation_GetInstantPricingInputRepresentation } from '../types/GetInstantPricingInputRepresentation';
4
+ import { ResourceRequestConfig as resources_postIndustriesCpqQuotesActionsGetInstantPrice_ResourceRequestConfig } from '../resources/postIndustriesCpqQuotesActionsGetInstantPrice';
5
+ import { GetInstantPricingOutputRepresentation as types_GetInstantPricingOutputRepresentation_GetInstantPricingOutputRepresentation } from '../types/GetInstantPricingOutputRepresentation';
6
+ export declare const adapterName = "instantPricing";
7
+ export declare const instantPricing_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
8
+ export declare const instantPricing_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
9
+ export interface InstantPricingConfig {
10
+ getInstantPricingRequestPayload: types_GetInstantPricingInputRepresentation_GetInstantPricingInputRepresentation;
11
+ }
12
+ export declare const createResourceParams: (config: InstantPricingConfig) => resources_postIndustriesCpqQuotesActionsGetInstantPrice_ResourceRequestConfig;
13
+ export declare function typeCheckConfig(untrustedConfig: adapter$45$utils_Untrusted<InstantPricingConfig>): adapter$45$utils_Untrusted<InstantPricingConfig>;
14
+ export declare function validateAdapterConfig(untrustedConfig: unknown, configPropertyNames: adapter$45$utils_AdapterValidationConfig): InstantPricingConfig | null;
15
+ export declare function buildNetworkSnapshot(luvio: $64$luvio_engine_Luvio, config: InstantPricingConfig, options?: $64$luvio_engine_DispatchResourceRequestContext): Promise<import("@luvio/engine").FulfilledSnapshot<types_GetInstantPricingOutputRepresentation_GetInstantPricingOutputRepresentation, {}> | import("@luvio/engine").StaleSnapshot<types_GetInstantPricingOutputRepresentation_GetInstantPricingOutputRepresentation, {}> | import("@luvio/engine").PendingSnapshot<types_GetInstantPricingOutputRepresentation_GetInstantPricingOutputRepresentation, any>>;
16
+ export declare const instantPricingAdapterFactory: $64$luvio_engine_AdapterFactory<InstantPricingConfig, types_GetInstantPricingOutputRepresentation_GetInstantPricingOutputRepresentation>;
@@ -0,0 +1 @@
1
+ export { instantPricingAdapterFactory } from '../adapters/instantPricing';
@@ -0,0 +1,2 @@
1
+ declare let instantPricing: any;
2
+ export { instantPricing };
@@ -0,0 +1,13 @@
1
+ import { GetInstantPricingInputRepresentation as types_GetInstantPricingInputRepresentation_GetInstantPricingInputRepresentation } from '../types/GetInstantPricingInputRepresentation';
2
+ import { Luvio as $64$luvio_engine_Luvio, Fragment as $64$luvio_engine_Fragment, FetchResponse as $64$luvio_engine_FetchResponse, FulfilledSnapshot as $64$luvio_engine_FulfilledSnapshot, StaleSnapshot as $64$luvio_engine_StaleSnapshot, PendingSnapshot as $64$luvio_engine_PendingSnapshot, ResourceRequest as $64$luvio_engine_ResourceRequest } from '@luvio/engine';
3
+ import { GetInstantPricingOutputRepresentation as types_GetInstantPricingOutputRepresentation_GetInstantPricingOutputRepresentation } from '../types/GetInstantPricingOutputRepresentation';
4
+ export interface ResourceRequestConfig {
5
+ body: {
6
+ getInstantPricingRequestPayload: types_GetInstantPricingInputRepresentation_GetInstantPricingInputRepresentation;
7
+ };
8
+ }
9
+ export declare function select(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig): $64$luvio_engine_Fragment;
10
+ export declare function getResponseCacheKeys(storeKeyMap: any, luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: types_GetInstantPricingOutputRepresentation_GetInstantPricingOutputRepresentation): void;
11
+ export declare function ingestSuccess(luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: $64$luvio_engine_FetchResponse<types_GetInstantPricingOutputRepresentation_GetInstantPricingOutputRepresentation>): $64$luvio_engine_FulfilledSnapshot<types_GetInstantPricingOutputRepresentation_GetInstantPricingOutputRepresentation, {}> | $64$luvio_engine_StaleSnapshot<types_GetInstantPricingOutputRepresentation_GetInstantPricingOutputRepresentation, {}> | $64$luvio_engine_PendingSnapshot<types_GetInstantPricingOutputRepresentation_GetInstantPricingOutputRepresentation, any>;
12
+ export declare function createResourceRequest(config: ResourceRequestConfig): $64$luvio_engine_ResourceRequest;
13
+ export default createResourceRequest;
@@ -0,0 +1,37 @@
1
+ import { IngestPath as $64$luvio_engine_IngestPath, Luvio as $64$luvio_engine_Luvio, Store as $64$luvio_engine_Store, FragmentSelection as $64$luvio_engine_FragmentSelection, ResourceIngest as $64$luvio_engine_ResourceIngest, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
2
+ export declare const VERSION = "17e5f462340e8843b9f20d6c693554d0";
3
+ export declare function validate(obj: any, path?: string): TypeError | null;
4
+ export declare const RepresentationType: string;
5
+ export declare function normalize(input: GetInstantPricingInputRepresentation, existing: GetInstantPricingInputRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): GetInstantPricingInputRepresentationNormalized;
6
+ export declare const select: () => $64$luvio_engine_FragmentSelection;
7
+ export declare function equals(existing: GetInstantPricingInputRepresentationNormalized, incoming: GetInstantPricingInputRepresentationNormalized): boolean;
8
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
9
+ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableStoreKeyMetadataMap, luvio: $64$luvio_engine_Luvio, input: GetInstantPricingInputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
10
+ /**
11
+ * Input Representation for Get Instant pricing.
12
+ *
13
+ * Keys:
14
+ * (none)
15
+ */
16
+ export interface GetInstantPricingInputRepresentationNormalized {
17
+ /** Context Id */
18
+ contextId: string | null;
19
+ /** Correlation Id */
20
+ correlationId: string | null;
21
+ /** Input Object */
22
+ records: Array<{}>;
23
+ /** Context Data Persistence Scope */
24
+ requestScope?: boolean;
25
+ }
26
+ /**
27
+ * Input Representation for Get Instant pricing.
28
+ *
29
+ * Keys:
30
+ * (none)
31
+ */
32
+ export interface GetInstantPricingInputRepresentation {
33
+ contextId: string | null;
34
+ correlationId: string | null;
35
+ records: Array<{}>;
36
+ requestScope?: boolean;
37
+ }
@@ -0,0 +1,47 @@
1
+ import { KeyMetadata as $64$luvio_engine_KeyMetadata, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, Luvio as $64$luvio_engine_Luvio, IngestPath as $64$luvio_engine_IngestPath, Store as $64$luvio_engine_Store, BaseFragment as $64$luvio_engine_BaseFragment, ResourceIngest as $64$luvio_engine_ResourceIngest, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap } from '@luvio/engine';
2
+ export declare const TTL = 1000;
3
+ export declare const VERSION = "1fc110cb13491550fd57015dbe2f752e";
4
+ export declare function validate(obj: any, path?: string): TypeError | null;
5
+ export declare const RepresentationType: string;
6
+ export interface KeyParams extends $64$luvio_engine_KeyMetadata {
7
+ contextId: string | null;
8
+ }
9
+ export type GetInstantPricingOutputRepresentationNormalizedKeyMetadata = KeyParams & $64$luvio_engine_NormalizedKeyMetadata;
10
+ export type PartialGetInstantPricingOutputRepresentationNormalizedKeyMetadata = Partial<KeyParams> & $64$luvio_engine_NormalizedKeyMetadata;
11
+ export declare function keyBuilder(luvio: $64$luvio_engine_Luvio, config: KeyParams): string;
12
+ export declare function keyBuilder_StructuredKey(luvio: $64$luvio_engine_Luvio, config: KeyParams): GetInstantPricingOutputRepresentationNormalizedKeyMetadata;
13
+ export declare function keyBuilderFromType(luvio: $64$luvio_engine_Luvio, object: GetInstantPricingOutputRepresentation): string;
14
+ export declare function keyBuilderFromType_StructuredKey(luvio: $64$luvio_engine_Luvio, object: GetInstantPricingOutputRepresentation): $64$luvio_engine_NormalizedKeyMetadata;
15
+ export declare function normalize(input: GetInstantPricingOutputRepresentation, existing: GetInstantPricingOutputRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): GetInstantPricingOutputRepresentationNormalized;
16
+ export declare const select: () => $64$luvio_engine_BaseFragment;
17
+ export declare function equals(existing: GetInstantPricingOutputRepresentationNormalized, incoming: GetInstantPricingOutputRepresentationNormalized): boolean;
18
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
19
+ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableStoreKeyMetadataMap, luvio: $64$luvio_engine_Luvio, input: GetInstantPricingOutputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
20
+ /**
21
+ * Output representation for Instant Pricing API
22
+ *
23
+ * Keys:
24
+ * contextId (string | null): contextId
25
+ */
26
+ export interface GetInstantPricingOutputRepresentationNormalized {
27
+ /** Context Id */
28
+ contextId: string | null;
29
+ /** CorrelationId */
30
+ correlationId: string | null;
31
+ /** Records */
32
+ records: Array<{}>;
33
+ /** success */
34
+ success: boolean;
35
+ }
36
+ /**
37
+ * Output representation for Instant Pricing API
38
+ *
39
+ * Keys:
40
+ * contextId (string | null): contextId
41
+ */
42
+ export interface GetInstantPricingOutputRepresentation {
43
+ contextId: string | null;
44
+ correlationId: string | null;
45
+ records: Array<{}>;
46
+ success: boolean;
47
+ }