@salesforce/lds-adapters-revenue-place-order 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,371 @@
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 = 'place-order';
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$3(obj, path = 'ConfiguratorOptionsInputRepresentation') {
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
+ if (obj.addDefaultConfiguration !== undefined) {
81
+ const obj_addDefaultConfiguration = obj.addDefaultConfiguration;
82
+ const path_addDefaultConfiguration = path + '.addDefaultConfiguration';
83
+ if (typeof obj_addDefaultConfiguration !== 'boolean') {
84
+ return new TypeError('Expected "boolean" but received "' + typeof obj_addDefaultConfiguration + '" (at "' + path_addDefaultConfiguration + '")');
85
+ }
86
+ }
87
+ if (obj.executeConfigurationRules !== undefined) {
88
+ const obj_executeConfigurationRules = obj.executeConfigurationRules;
89
+ const path_executeConfigurationRules = path + '.executeConfigurationRules';
90
+ if (typeof obj_executeConfigurationRules !== 'boolean') {
91
+ return new TypeError('Expected "boolean" but received "' + typeof obj_executeConfigurationRules + '" (at "' + path_executeConfigurationRules + '")');
92
+ }
93
+ }
94
+ if (obj.validateAmendRenewCancel !== undefined) {
95
+ const obj_validateAmendRenewCancel = obj.validateAmendRenewCancel;
96
+ const path_validateAmendRenewCancel = path + '.validateAmendRenewCancel';
97
+ if (typeof obj_validateAmendRenewCancel !== 'boolean') {
98
+ return new TypeError('Expected "boolean" but received "' + typeof obj_validateAmendRenewCancel + '" (at "' + path_validateAmendRenewCancel + '")');
99
+ }
100
+ }
101
+ if (obj.validateProductCatalog !== undefined) {
102
+ const obj_validateProductCatalog = obj.validateProductCatalog;
103
+ const path_validateProductCatalog = path + '.validateProductCatalog';
104
+ if (typeof obj_validateProductCatalog !== 'boolean') {
105
+ return new TypeError('Expected "boolean" but received "' + typeof obj_validateProductCatalog + '" (at "' + path_validateProductCatalog + '")');
106
+ }
107
+ }
108
+ })();
109
+ return v_error === undefined ? null : v_error;
110
+ }
111
+
112
+ function validate$2(obj, path = 'PlaceOrderInputRepresentation') {
113
+ const v_error = (() => {
114
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
115
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
116
+ }
117
+ if (obj.catalogRatesPref !== undefined) {
118
+ const obj_catalogRatesPref = obj.catalogRatesPref;
119
+ const path_catalogRatesPref = path + '.catalogRatesPref';
120
+ if (typeof obj_catalogRatesPref !== 'string') {
121
+ return new TypeError('Expected "string" but received "' + typeof obj_catalogRatesPref + '" (at "' + path_catalogRatesPref + '")');
122
+ }
123
+ }
124
+ if (obj.configurationInput !== undefined) {
125
+ const obj_configurationInput = obj.configurationInput;
126
+ const path_configurationInput = path + '.configurationInput';
127
+ if (typeof obj_configurationInput !== 'string') {
128
+ return new TypeError('Expected "string" but received "' + typeof obj_configurationInput + '" (at "' + path_configurationInput + '")');
129
+ }
130
+ }
131
+ if (obj.configurationOptions !== undefined) {
132
+ const obj_configurationOptions = obj.configurationOptions;
133
+ const path_configurationOptions = path + '.configurationOptions';
134
+ const referencepath_configurationOptionsValidationError = validate$3(obj_configurationOptions, path_configurationOptions);
135
+ if (referencepath_configurationOptionsValidationError !== null) {
136
+ let message = 'Object doesn\'t match ConfiguratorOptionsInputRepresentation (at "' + path_configurationOptions + '")\n';
137
+ message += referencepath_configurationOptionsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
138
+ return new TypeError(message);
139
+ }
140
+ }
141
+ const obj_graph = obj.graph;
142
+ const path_graph = path + '.graph';
143
+ if (typeof obj_graph !== 'object' || ArrayIsArray(obj_graph) || obj_graph === null) {
144
+ return new TypeError('Expected "object" but received "' + typeof obj_graph + '" (at "' + path_graph + '")');
145
+ }
146
+ const obj_pricingPref = obj.pricingPref;
147
+ const path_pricingPref = path + '.pricingPref';
148
+ if (typeof obj_pricingPref !== 'string') {
149
+ return new TypeError('Expected "string" but received "' + typeof obj_pricingPref + '" (at "' + path_pricingPref + '")');
150
+ }
151
+ })();
152
+ return v_error === undefined ? null : v_error;
153
+ }
154
+
155
+ function validate$1(obj, path = 'PlaceOrderErrorResponseRepresentation') {
156
+ const v_error = (() => {
157
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
158
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
159
+ }
160
+ const obj_errorCode = obj.errorCode;
161
+ const path_errorCode = path + '.errorCode';
162
+ if (typeof obj_errorCode !== 'string') {
163
+ return new TypeError('Expected "string" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
164
+ }
165
+ const obj_message = obj.message;
166
+ const path_message = path + '.message';
167
+ if (typeof obj_message !== 'string') {
168
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
169
+ }
170
+ const obj_referenceId = obj.referenceId;
171
+ const path_referenceId = path + '.referenceId';
172
+ if (typeof obj_referenceId !== 'string') {
173
+ return new TypeError('Expected "string" but received "' + typeof obj_referenceId + '" (at "' + path_referenceId + '")');
174
+ }
175
+ })();
176
+ return v_error === undefined ? null : v_error;
177
+ }
178
+
179
+ const TTL = 1000;
180
+ const VERSION = "c091711201b7e247b20f49c526867ca7";
181
+ function validate(obj, path = 'PlaceOrderOutputRepresentation') {
182
+ const v_error = (() => {
183
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
184
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
185
+ }
186
+ const obj_errors = obj.errors;
187
+ const path_errors = path + '.errors';
188
+ if (!ArrayIsArray(obj_errors)) {
189
+ return new TypeError('Expected "array" but received "' + typeof obj_errors + '" (at "' + path_errors + '")');
190
+ }
191
+ for (let i = 0; i < obj_errors.length; i++) {
192
+ const obj_errors_item = obj_errors[i];
193
+ const path_errors_item = path_errors + '[' + i + ']';
194
+ const referencepath_errors_itemValidationError = validate$1(obj_errors_item, path_errors_item);
195
+ if (referencepath_errors_itemValidationError !== null) {
196
+ let message = 'Object doesn\'t match PlaceOrderErrorResponseRepresentation (at "' + path_errors_item + '")\n';
197
+ message += referencepath_errors_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
198
+ return new TypeError(message);
199
+ }
200
+ }
201
+ const obj_orderId = obj.orderId;
202
+ const path_orderId = path + '.orderId';
203
+ if (typeof obj_orderId !== 'string') {
204
+ return new TypeError('Expected "string" but received "' + typeof obj_orderId + '" (at "' + path_orderId + '")');
205
+ }
206
+ if (obj.requestId !== undefined) {
207
+ const obj_requestId = obj.requestId;
208
+ const path_requestId = path + '.requestId';
209
+ if (typeof obj_requestId !== 'string') {
210
+ return new TypeError('Expected "string" but received "' + typeof obj_requestId + '" (at "' + path_requestId + '")');
211
+ }
212
+ }
213
+ if (obj.statusURL !== undefined) {
214
+ const obj_statusURL = obj.statusURL;
215
+ const path_statusURL = path + '.statusURL';
216
+ if (typeof obj_statusURL !== 'string') {
217
+ return new TypeError('Expected "string" but received "' + typeof obj_statusURL + '" (at "' + path_statusURL + '")');
218
+ }
219
+ }
220
+ const obj_success = obj.success;
221
+ const path_success = path + '.success';
222
+ if (typeof obj_success !== 'boolean') {
223
+ return new TypeError('Expected "boolean" but received "' + typeof obj_success + '" (at "' + path_success + '")');
224
+ }
225
+ })();
226
+ return v_error === undefined ? null : v_error;
227
+ }
228
+ const RepresentationType = 'PlaceOrderOutputRepresentation';
229
+ function keyBuilder(luvio, config) {
230
+ return keyPrefix + '::' + RepresentationType + ':' + config.orderId;
231
+ }
232
+ function keyBuilderFromType(luvio, object) {
233
+ const keyParams = {
234
+ orderId: object.orderId
235
+ };
236
+ return keyBuilder(luvio, keyParams);
237
+ }
238
+ function normalize(input, existing, path, luvio, store, timestamp) {
239
+ return input;
240
+ }
241
+ const select$1 = function PlaceOrderOutputRepresentationSelect() {
242
+ return {
243
+ kind: 'Fragment',
244
+ version: VERSION,
245
+ private: [],
246
+ opaque: true
247
+ };
248
+ };
249
+ function equals(existing, incoming) {
250
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
251
+ return false;
252
+ }
253
+ return true;
254
+ }
255
+ const ingest = function PlaceOrderOutputRepresentationIngest(input, path, luvio, store, timestamp) {
256
+ if (process.env.NODE_ENV !== 'production') {
257
+ const validateError = validate(input);
258
+ if (validateError !== null) {
259
+ throw validateError;
260
+ }
261
+ }
262
+ const key = keyBuilderFromType(luvio, input);
263
+ const ttlToUse = TTL;
264
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "place-order", VERSION, RepresentationType, equals);
265
+ return createLink(key);
266
+ };
267
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
268
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
269
+ const rootKey = keyBuilderFromType(luvio, input);
270
+ rootKeySet.set(rootKey, {
271
+ namespace: keyPrefix,
272
+ representationName: RepresentationType,
273
+ mergeable: false
274
+ });
275
+ }
276
+
277
+ function select(luvio, params) {
278
+ return select$1();
279
+ }
280
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
281
+ getTypeCacheKeys(storeKeyMap, luvio, response);
282
+ }
283
+ function ingestSuccess(luvio, resourceParams, response) {
284
+ const { body } = response;
285
+ const key = keyBuilderFromType(luvio, body);
286
+ luvio.storeIngest(key, ingest, body);
287
+ const snapshot = luvio.storeLookup({
288
+ recordId: key,
289
+ node: select(),
290
+ variables: {},
291
+ });
292
+ if (process.env.NODE_ENV !== 'production') {
293
+ if (snapshot.state !== 'Fulfilled') {
294
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
295
+ }
296
+ }
297
+ deepFreeze(snapshot.data);
298
+ return snapshot;
299
+ }
300
+ function createResourceRequest(config) {
301
+ const headers = {};
302
+ return {
303
+ baseUri: '/services/data/v66.0',
304
+ basePath: '/commerce/sales-orders/actions/place',
305
+ method: 'post',
306
+ body: config.body,
307
+ urlParams: {},
308
+ queryParams: {},
309
+ headers,
310
+ priority: 'normal',
311
+ };
312
+ }
313
+
314
+ const adapterName = 'placeOrder';
315
+ const placeOrder_ConfigPropertyMetadata = [
316
+ generateParamConfigMetadata('inputRequest', true, 2 /* Body */, 4 /* Unsupported */),
317
+ ];
318
+ const placeOrder_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, placeOrder_ConfigPropertyMetadata);
319
+ const createResourceParams = /*#__PURE__*/ createResourceParams$1(placeOrder_ConfigPropertyMetadata);
320
+ function typeCheckConfig(untrustedConfig) {
321
+ const config = {};
322
+ const untrustedConfig_inputRequest = untrustedConfig.inputRequest;
323
+ const referencePlaceOrderInputRepresentationValidationError = validate$2(untrustedConfig_inputRequest);
324
+ if (referencePlaceOrderInputRepresentationValidationError === null) {
325
+ config.inputRequest = untrustedConfig_inputRequest;
326
+ }
327
+ return config;
328
+ }
329
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
330
+ if (!untrustedIsObject(untrustedConfig)) {
331
+ return null;
332
+ }
333
+ if (process.env.NODE_ENV !== 'production') {
334
+ validateConfig(untrustedConfig, configPropertyNames);
335
+ }
336
+ const config = typeCheckConfig(untrustedConfig);
337
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
338
+ return null;
339
+ }
340
+ return config;
341
+ }
342
+ function buildNetworkSnapshot(luvio, config, options) {
343
+ const resourceParams = createResourceParams(config);
344
+ const request = createResourceRequest(resourceParams);
345
+ return luvio.dispatchResourceRequest(request, options)
346
+ .then((response) => {
347
+ return luvio.handleSuccessResponse(() => {
348
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
349
+ return luvio.storeBroadcast().then(() => snapshot);
350
+ }, () => {
351
+ const cache = new StoreKeyMap();
352
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
353
+ return cache;
354
+ });
355
+ }, (response) => {
356
+ deepFreeze(response);
357
+ throw response;
358
+ });
359
+ }
360
+ const placeOrderAdapterFactory = (luvio) => {
361
+ return function placeOrder(untrustedConfig) {
362
+ const config = validateAdapterConfig(untrustedConfig, placeOrder_ConfigPropertyNames);
363
+ // Invalid or incomplete config
364
+ if (config === null) {
365
+ throw new Error('Invalid config for "placeOrder"');
366
+ }
367
+ return buildNetworkSnapshot(luvio, config);
368
+ };
369
+ };
370
+
371
+ export { placeOrderAdapterFactory };
@@ -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 = "place-order";
@@ -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 { PlaceOrderInputRepresentation as types_PlaceOrderInputRepresentation_PlaceOrderInputRepresentation } from '../types/PlaceOrderInputRepresentation';
4
+ import { ResourceRequestConfig as resources_postCommerceSalesOrdersActionsPlace_ResourceRequestConfig } from '../resources/postCommerceSalesOrdersActionsPlace';
5
+ import { PlaceOrderOutputRepresentation as types_PlaceOrderOutputRepresentation_PlaceOrderOutputRepresentation } from '../types/PlaceOrderOutputRepresentation';
6
+ export declare const adapterName = "placeOrder";
7
+ export declare const placeOrder_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
8
+ export declare const placeOrder_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
9
+ export interface PlaceOrderConfig {
10
+ inputRequest: types_PlaceOrderInputRepresentation_PlaceOrderInputRepresentation;
11
+ }
12
+ export declare const createResourceParams: (config: PlaceOrderConfig) => resources_postCommerceSalesOrdersActionsPlace_ResourceRequestConfig;
13
+ export declare function typeCheckConfig(untrustedConfig: adapter$45$utils_Untrusted<PlaceOrderConfig>): adapter$45$utils_Untrusted<PlaceOrderConfig>;
14
+ export declare function validateAdapterConfig(untrustedConfig: unknown, configPropertyNames: adapter$45$utils_AdapterValidationConfig): PlaceOrderConfig | null;
15
+ export declare function buildNetworkSnapshot(luvio: $64$luvio_engine_Luvio, config: PlaceOrderConfig, options?: $64$luvio_engine_DispatchResourceRequestContext): Promise<import("@luvio/engine").FulfilledSnapshot<types_PlaceOrderOutputRepresentation_PlaceOrderOutputRepresentation, {}> | import("@luvio/engine").StaleSnapshot<types_PlaceOrderOutputRepresentation_PlaceOrderOutputRepresentation, {}> | import("@luvio/engine").PendingSnapshot<types_PlaceOrderOutputRepresentation_PlaceOrderOutputRepresentation, any>>;
16
+ export declare const placeOrderAdapterFactory: $64$luvio_engine_AdapterFactory<PlaceOrderConfig, types_PlaceOrderOutputRepresentation_PlaceOrderOutputRepresentation>;
@@ -0,0 +1 @@
1
+ export { placeOrderAdapterFactory } from '../adapters/placeOrder';
@@ -0,0 +1,2 @@
1
+ declare let placeOrder: any;
2
+ export { placeOrder };
@@ -0,0 +1,13 @@
1
+ import { PlaceOrderInputRepresentation as types_PlaceOrderInputRepresentation_PlaceOrderInputRepresentation } from '../types/PlaceOrderInputRepresentation';
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 { PlaceOrderOutputRepresentation as types_PlaceOrderOutputRepresentation_PlaceOrderOutputRepresentation } from '../types/PlaceOrderOutputRepresentation';
4
+ export interface ResourceRequestConfig {
5
+ body: {
6
+ inputRequest: types_PlaceOrderInputRepresentation_PlaceOrderInputRepresentation;
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_PlaceOrderOutputRepresentation_PlaceOrderOutputRepresentation): void;
11
+ export declare function ingestSuccess(luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: $64$luvio_engine_FetchResponse<types_PlaceOrderOutputRepresentation_PlaceOrderOutputRepresentation>): $64$luvio_engine_FulfilledSnapshot<types_PlaceOrderOutputRepresentation_PlaceOrderOutputRepresentation, {}> | $64$luvio_engine_StaleSnapshot<types_PlaceOrderOutputRepresentation_PlaceOrderOutputRepresentation, {}> | $64$luvio_engine_PendingSnapshot<types_PlaceOrderOutputRepresentation_PlaceOrderOutputRepresentation, 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 = "e21b1d6113b662cbaf3514ea2c1eeaa4";
3
+ export declare function validate(obj: any, path?: string): TypeError | null;
4
+ export declare const RepresentationType: string;
5
+ export declare function normalize(input: ConfiguratorOptionsInputRepresentation, existing: ConfiguratorOptionsInputRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): ConfiguratorOptionsInputRepresentationNormalized;
6
+ export declare const select: () => $64$luvio_engine_FragmentSelection;
7
+ export declare function equals(existing: ConfiguratorOptionsInputRepresentationNormalized, incoming: ConfiguratorOptionsInputRepresentationNormalized): 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: ConfiguratorOptionsInputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
10
+ /**
11
+ * Input Representation for the Configurator Options
12
+ *
13
+ * Keys:
14
+ * (none)
15
+ */
16
+ export interface ConfiguratorOptionsInputRepresentationNormalized {
17
+ /** Whether to add default configurations */
18
+ addDefaultConfiguration?: boolean;
19
+ /** Whether to execute Configuration Rules */
20
+ executeConfigurationRules?: boolean;
21
+ /** Whether to run amend/renew/cancel related validations */
22
+ validateAmendRenewCancel?: boolean;
23
+ /** Whether to run validations against the Product Catalog */
24
+ validateProductCatalog?: boolean;
25
+ }
26
+ /**
27
+ * Input Representation for the Configurator Options
28
+ *
29
+ * Keys:
30
+ * (none)
31
+ */
32
+ export interface ConfiguratorOptionsInputRepresentation {
33
+ addDefaultConfiguration?: boolean;
34
+ executeConfigurationRules?: boolean;
35
+ validateAmendRenewCancel?: boolean;
36
+ validateProductCatalog?: boolean;
37
+ }
@@ -0,0 +1,34 @@
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 = "ddf623566240bfe3028730fe73fe0892";
3
+ export declare function validate(obj: any, path?: string): TypeError | null;
4
+ export declare const RepresentationType: string;
5
+ export declare function normalize(input: PlaceOrderErrorResponseRepresentation, existing: PlaceOrderErrorResponseRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): PlaceOrderErrorResponseRepresentationNormalized;
6
+ export declare const select: () => $64$luvio_engine_FragmentSelection;
7
+ export declare function equals(existing: PlaceOrderErrorResponseRepresentationNormalized, incoming: PlaceOrderErrorResponseRepresentationNormalized): 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: PlaceOrderErrorResponseRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
10
+ /**
11
+ * Place Order Error response representation
12
+ *
13
+ * Keys:
14
+ * (none)
15
+ */
16
+ export interface PlaceOrderErrorResponseRepresentationNormalized {
17
+ /** Error Code */
18
+ errorCode: string;
19
+ /** Message stating the reason for error, if any */
20
+ message: string;
21
+ /** Reference ID */
22
+ referenceId: string;
23
+ }
24
+ /**
25
+ * Place Order Error response representation
26
+ *
27
+ * Keys:
28
+ * (none)
29
+ */
30
+ export interface PlaceOrderErrorResponseRepresentation {
31
+ errorCode: string;
32
+ message: string;
33
+ referenceId: string;
34
+ }