@salesforce/lds-adapters-revenue-place-quote 0.131.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/LICENSE.txt +82 -0
- package/dist/es/es2018/revenue-place-quote.js +341 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +66 -0
- package/dist/es/es2018/types/src/generated/adapters/updateQuote.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +1 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +2 -0
- package/dist/es/es2018/types/src/generated/resources/postCommerceQuotesActionsPlace.d.ts +13 -0
- package/dist/es/es2018/types/src/generated/types/PlaceQuoteErrorResponseRepresentation.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/types/PlaceQuoteInputRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/PlaceQuoteInputWrapperRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/PlaceQuoteOutputRepresentation.d.ts +52 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +39 -0
- package/package.json +68 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +368 -0
- package/src/raml/api.raml +96 -0
- package/src/raml/luvio.raml +72 -0
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,341 @@
|
|
|
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, StoreKeyMap } from '@luvio/engine';
|
|
8
|
+
|
|
9
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
+
const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = 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$1(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
|
+
const keyPrefix = 'place-quote';
|
|
45
|
+
|
|
46
|
+
const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
47
|
+
const { isArray: ArrayIsArray } = Array;
|
|
48
|
+
const { stringify: JSONStringify } = JSON;
|
|
49
|
+
function deepFreeze$2(value) {
|
|
50
|
+
// No need to freeze primitives
|
|
51
|
+
if (typeof value !== 'object' || value === null) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (ArrayIsArray(value)) {
|
|
55
|
+
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
56
|
+
deepFreeze$2(value[i]);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
const keys = ObjectKeys(value);
|
|
61
|
+
for (let i = 0, len = keys.length; i < len; i += 1) {
|
|
62
|
+
deepFreeze$2(value[keys[i]]);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
ObjectFreeze(value);
|
|
66
|
+
}
|
|
67
|
+
function createLink(ref) {
|
|
68
|
+
return {
|
|
69
|
+
__ref: serializeStructuredKey(ref),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function validate$2(obj, path = 'PlaceQuoteInputRepresentation') {
|
|
74
|
+
const v_error = (() => {
|
|
75
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
76
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
77
|
+
}
|
|
78
|
+
const obj_graph = obj.graph;
|
|
79
|
+
const path_graph = path + '.graph';
|
|
80
|
+
if (typeof obj_graph !== 'object' || ArrayIsArray(obj_graph) || obj_graph === null) {
|
|
81
|
+
return new TypeError('Expected "object" but received "' + typeof obj_graph + '" (at "' + path_graph + '")');
|
|
82
|
+
}
|
|
83
|
+
const obj_pricingPref = obj.pricingPref;
|
|
84
|
+
const path_pricingPref = path + '.pricingPref';
|
|
85
|
+
if (typeof obj_pricingPref !== 'string') {
|
|
86
|
+
return new TypeError('Expected "string" but received "' + typeof obj_pricingPref + '" (at "' + path_pricingPref + '")');
|
|
87
|
+
}
|
|
88
|
+
})();
|
|
89
|
+
return v_error === undefined ? null : v_error;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function validate$1(obj, path = 'PlaceQuoteErrorResponseRepresentation') {
|
|
93
|
+
const v_error = (() => {
|
|
94
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
95
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
96
|
+
}
|
|
97
|
+
const obj_errorCode = obj.errorCode;
|
|
98
|
+
const path_errorCode = path + '.errorCode';
|
|
99
|
+
if (typeof obj_errorCode !== 'string') {
|
|
100
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
|
|
101
|
+
}
|
|
102
|
+
const obj_message = obj.message;
|
|
103
|
+
const path_message = path + '.message';
|
|
104
|
+
if (typeof obj_message !== 'string') {
|
|
105
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
106
|
+
}
|
|
107
|
+
const obj_referenceId = obj.referenceId;
|
|
108
|
+
const path_referenceId = path + '.referenceId';
|
|
109
|
+
if (typeof obj_referenceId !== 'string') {
|
|
110
|
+
return new TypeError('Expected "string" but received "' + typeof obj_referenceId + '" (at "' + path_referenceId + '")');
|
|
111
|
+
}
|
|
112
|
+
})();
|
|
113
|
+
return v_error === undefined ? null : v_error;
|
|
114
|
+
}
|
|
115
|
+
function deepFreeze$1(input) {
|
|
116
|
+
ObjectFreeze(input);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const TTL = 1000;
|
|
120
|
+
const VERSION = "32a768cba447434ebb8e37e67aed1302";
|
|
121
|
+
function validate(obj, path = 'PlaceQuoteOutputRepresentation') {
|
|
122
|
+
const v_error = (() => {
|
|
123
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
124
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
125
|
+
}
|
|
126
|
+
const obj_quoteId = obj.quoteId;
|
|
127
|
+
const path_quoteId = path + '.quoteId';
|
|
128
|
+
if (typeof obj_quoteId !== 'string') {
|
|
129
|
+
return new TypeError('Expected "string" but received "' + typeof obj_quoteId + '" (at "' + path_quoteId + '")');
|
|
130
|
+
}
|
|
131
|
+
const obj_requestIdentifier = obj.requestIdentifier;
|
|
132
|
+
const path_requestIdentifier = path + '.requestIdentifier';
|
|
133
|
+
if (typeof obj_requestIdentifier !== 'string') {
|
|
134
|
+
return new TypeError('Expected "string" but received "' + typeof obj_requestIdentifier + '" (at "' + path_requestIdentifier + '")');
|
|
135
|
+
}
|
|
136
|
+
const obj_responseError = obj.responseError;
|
|
137
|
+
const path_responseError = path + '.responseError';
|
|
138
|
+
if (!ArrayIsArray(obj_responseError)) {
|
|
139
|
+
return new TypeError('Expected "array" but received "' + typeof obj_responseError + '" (at "' + path_responseError + '")');
|
|
140
|
+
}
|
|
141
|
+
for (let i = 0; i < obj_responseError.length; i++) {
|
|
142
|
+
const obj_responseError_item = obj_responseError[i];
|
|
143
|
+
const path_responseError_item = path_responseError + '[' + i + ']';
|
|
144
|
+
const referencepath_responseError_itemValidationError = validate$1(obj_responseError_item, path_responseError_item);
|
|
145
|
+
if (referencepath_responseError_itemValidationError !== null) {
|
|
146
|
+
let message = 'Object doesn\'t match PlaceQuoteErrorResponseRepresentation (at "' + path_responseError_item + '")\n';
|
|
147
|
+
message += referencepath_responseError_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
148
|
+
return new TypeError(message);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const obj_statusURL = obj.statusURL;
|
|
152
|
+
const path_statusURL = path + '.statusURL';
|
|
153
|
+
if (typeof obj_statusURL !== 'string') {
|
|
154
|
+
return new TypeError('Expected "string" but received "' + typeof obj_statusURL + '" (at "' + path_statusURL + '")');
|
|
155
|
+
}
|
|
156
|
+
const obj_success = obj.success;
|
|
157
|
+
const path_success = path + '.success';
|
|
158
|
+
if (typeof obj_success !== 'boolean') {
|
|
159
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_success + '" (at "' + path_success + '")');
|
|
160
|
+
}
|
|
161
|
+
})();
|
|
162
|
+
return v_error === undefined ? null : v_error;
|
|
163
|
+
}
|
|
164
|
+
const RepresentationType = 'PlaceQuoteOutputRepresentation';
|
|
165
|
+
function keyBuilder(luvio, config) {
|
|
166
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.quoteId;
|
|
167
|
+
}
|
|
168
|
+
function keyBuilderFromType(luvio, object) {
|
|
169
|
+
const keyParams = {
|
|
170
|
+
quoteId: object.quoteId
|
|
171
|
+
};
|
|
172
|
+
return keyBuilder(luvio, keyParams);
|
|
173
|
+
}
|
|
174
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
175
|
+
return input;
|
|
176
|
+
}
|
|
177
|
+
const select$1 = function PlaceQuoteOutputRepresentationSelect() {
|
|
178
|
+
return {
|
|
179
|
+
kind: 'Fragment',
|
|
180
|
+
version: VERSION,
|
|
181
|
+
private: [],
|
|
182
|
+
opaque: true
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
function equals(existing, incoming) {
|
|
186
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
function deepFreeze(input) {
|
|
192
|
+
const input_responseError = input.responseError;
|
|
193
|
+
for (let i = 0; i < input_responseError.length; i++) {
|
|
194
|
+
const input_responseError_item = input_responseError[i];
|
|
195
|
+
deepFreeze$1(input_responseError_item);
|
|
196
|
+
}
|
|
197
|
+
ObjectFreeze(input_responseError);
|
|
198
|
+
ObjectFreeze(input);
|
|
199
|
+
}
|
|
200
|
+
const ingest = function PlaceQuoteOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
201
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
202
|
+
const validateError = validate(input);
|
|
203
|
+
if (validateError !== null) {
|
|
204
|
+
throw validateError;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const key = keyBuilderFromType(luvio, input);
|
|
208
|
+
const existingRecord = store.readEntry(key);
|
|
209
|
+
const ttlToUse = TTL;
|
|
210
|
+
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
211
|
+
fullPath: key,
|
|
212
|
+
parent: path.parent,
|
|
213
|
+
propertyName: path.propertyName,
|
|
214
|
+
ttl: ttlToUse
|
|
215
|
+
});
|
|
216
|
+
deepFreeze(input);
|
|
217
|
+
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
218
|
+
luvio.storePublish(key, incomingRecord);
|
|
219
|
+
}
|
|
220
|
+
{
|
|
221
|
+
const storeMetadataParams = {
|
|
222
|
+
ttl: ttlToUse,
|
|
223
|
+
namespace: "place-quote",
|
|
224
|
+
version: VERSION,
|
|
225
|
+
representationName: RepresentationType,
|
|
226
|
+
};
|
|
227
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
228
|
+
}
|
|
229
|
+
return createLink(key);
|
|
230
|
+
};
|
|
231
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
232
|
+
const rootKeySet = new StoreKeyMap();
|
|
233
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
234
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
235
|
+
rootKeySet.set(rootKey, {
|
|
236
|
+
namespace: keyPrefix,
|
|
237
|
+
representationName: RepresentationType,
|
|
238
|
+
mergeable: false
|
|
239
|
+
});
|
|
240
|
+
return rootKeySet;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function select(luvio, params) {
|
|
244
|
+
return select$1();
|
|
245
|
+
}
|
|
246
|
+
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
247
|
+
return getTypeCacheKeys(luvio, response);
|
|
248
|
+
}
|
|
249
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
250
|
+
const { body } = response;
|
|
251
|
+
const key = keyBuilderFromType(luvio, body);
|
|
252
|
+
luvio.storeIngest(key, ingest, body);
|
|
253
|
+
const snapshot = luvio.storeLookup({
|
|
254
|
+
recordId: key,
|
|
255
|
+
node: select(),
|
|
256
|
+
variables: {},
|
|
257
|
+
});
|
|
258
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
259
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
260
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return snapshot;
|
|
264
|
+
}
|
|
265
|
+
function createResourceRequest(config) {
|
|
266
|
+
const headers = {};
|
|
267
|
+
return {
|
|
268
|
+
baseUri: '/services/data/v58.0',
|
|
269
|
+
basePath: '/commerce/quotes/actions/place',
|
|
270
|
+
method: 'post',
|
|
271
|
+
body: config.body,
|
|
272
|
+
urlParams: {},
|
|
273
|
+
queryParams: {},
|
|
274
|
+
headers,
|
|
275
|
+
priority: 'normal',
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const updateQuote_ConfigPropertyNames = {
|
|
280
|
+
displayName: 'updateQuote',
|
|
281
|
+
parameters: {
|
|
282
|
+
required: ['PlaceQuoteInput'],
|
|
283
|
+
optional: []
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
function createResourceParams(config) {
|
|
287
|
+
const resourceParams = {
|
|
288
|
+
body: {
|
|
289
|
+
PlaceQuoteInput: config.PlaceQuoteInput
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
return resourceParams;
|
|
293
|
+
}
|
|
294
|
+
function typeCheckConfig(untrustedConfig) {
|
|
295
|
+
const config = {};
|
|
296
|
+
const untrustedConfig_PlaceQuoteInput = untrustedConfig.PlaceQuoteInput;
|
|
297
|
+
const referencePlaceQuoteInputRepresentationValidationError = validate$2(untrustedConfig_PlaceQuoteInput);
|
|
298
|
+
if (referencePlaceQuoteInputRepresentationValidationError === null) {
|
|
299
|
+
config.PlaceQuoteInput = untrustedConfig_PlaceQuoteInput;
|
|
300
|
+
}
|
|
301
|
+
return config;
|
|
302
|
+
}
|
|
303
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
304
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
308
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
309
|
+
}
|
|
310
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
311
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
312
|
+
return null;
|
|
313
|
+
}
|
|
314
|
+
return config;
|
|
315
|
+
}
|
|
316
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
317
|
+
const resourceParams = createResourceParams(config);
|
|
318
|
+
const request = createResourceRequest(resourceParams);
|
|
319
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
320
|
+
.then((response) => {
|
|
321
|
+
return luvio.handleSuccessResponse(() => {
|
|
322
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
323
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
324
|
+
}, () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
325
|
+
}, (response) => {
|
|
326
|
+
deepFreeze$2(response);
|
|
327
|
+
throw response;
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
const updateQuoteAdapterFactory = (luvio) => {
|
|
331
|
+
return function updateQuote(untrustedConfig) {
|
|
332
|
+
const config = validateAdapterConfig(untrustedConfig, updateQuote_ConfigPropertyNames);
|
|
333
|
+
// Invalid or incomplete config
|
|
334
|
+
if (config === null) {
|
|
335
|
+
throw new Error('Invalid config for "updateQuote"');
|
|
336
|
+
}
|
|
337
|
+
return buildNetworkSnapshot(luvio, config);
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
export { updateQuoteAdapterFactory };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Adapter as $64$luvio_engine_Adapter, Snapshot as $64$luvio_engine_Snapshot, UnfulfilledSnapshot as $64$luvio_engine_UnfulfilledSnapshot } from '@luvio/engine';
|
|
2
|
+
export declare const ObjectPrototypeHasOwnProperty: (v: PropertyKey) => boolean;
|
|
3
|
+
declare const ObjectKeys: {
|
|
4
|
+
(o: object): string[];
|
|
5
|
+
(o: {}): string[];
|
|
6
|
+
}, ObjectFreeze: {
|
|
7
|
+
<T extends Function>(f: T): T;
|
|
8
|
+
<T_1 extends {
|
|
9
|
+
[idx: string]: object | U | null | undefined;
|
|
10
|
+
}, U extends string | number | bigint | boolean | symbol>(o: T_1): Readonly<T_1>;
|
|
11
|
+
<T_2>(o: T_2): Readonly<T_2>;
|
|
12
|
+
}, ObjectCreate: {
|
|
13
|
+
(o: object | null): any;
|
|
14
|
+
(o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
|
|
15
|
+
};
|
|
16
|
+
export { ObjectFreeze, ObjectCreate, ObjectKeys };
|
|
17
|
+
export declare const ArrayIsArray: (arg: any) => arg is any[];
|
|
18
|
+
export declare const ArrayPrototypePush: (...items: any[]) => number;
|
|
19
|
+
export interface AdapterValidationConfig {
|
|
20
|
+
displayName: string;
|
|
21
|
+
parameters: {
|
|
22
|
+
required: string[];
|
|
23
|
+
optional: string[];
|
|
24
|
+
unsupported?: string[];
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Validates an adapter config is well-formed.
|
|
29
|
+
* @param config The config to validate.
|
|
30
|
+
* @param adapter The adapter validation configuration.
|
|
31
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
32
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
33
|
+
*/
|
|
34
|
+
export declare function validateConfig<T>(config: Untrusted<T>, adapter: AdapterValidationConfig, oneOf?: string[]): void;
|
|
35
|
+
export declare function untrustedIsObject<Base>(untrusted: unknown): untrusted is Untrusted<Base>;
|
|
36
|
+
export type UncoercedConfiguration<Base, Options extends {
|
|
37
|
+
[key in keyof Base]?: any;
|
|
38
|
+
}> = {
|
|
39
|
+
[Key in keyof Base]?: Base[Key] | Options[Key];
|
|
40
|
+
};
|
|
41
|
+
export type Untrusted<Base> = Partial<Base>;
|
|
42
|
+
export declare function areRequiredParametersPresent<T>(config: any, configPropertyNames: AdapterValidationConfig): config is T;
|
|
43
|
+
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>;
|
|
44
|
+
export declare const SNAPSHOT_STATE_FULFILLED = "Fulfilled";
|
|
45
|
+
export declare const SNAPSHOT_STATE_UNFULFILLED = "Unfulfilled";
|
|
46
|
+
export declare const snapshotRefreshOptions: {
|
|
47
|
+
overrides: {
|
|
48
|
+
headers: {
|
|
49
|
+
'Cache-Control': string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* A deterministic JSON stringify implementation. Heavily adapted from https://github.com/epoberezkin/fast-json-stable-stringify.
|
|
55
|
+
* This is needed because insertion order for JSON.stringify(object) affects output:
|
|
56
|
+
* JSON.stringify({a: 1, b: 2})
|
|
57
|
+
* "{"a":1,"b":2}"
|
|
58
|
+
* JSON.stringify({b: 2, a: 1})
|
|
59
|
+
* "{"b":2,"a":1}"
|
|
60
|
+
* @param data Data to be JSON-stringified.
|
|
61
|
+
* @returns JSON.stringified value with consistent ordering of keys.
|
|
62
|
+
*/
|
|
63
|
+
export declare function stableJSONStringify(node: any): string | undefined;
|
|
64
|
+
export declare function getFetchResponseStatusText(status: number): string;
|
|
65
|
+
export declare function isUnfulfilledSnapshot<T, U>(snapshot: $64$luvio_engine_Snapshot<T, U>): snapshot is $64$luvio_engine_UnfulfilledSnapshot<T, U>;
|
|
66
|
+
export declare const keyPrefix = "place-quote";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AdapterValidationConfig as adapter$45$utils_AdapterValidationConfig, Untrusted as adapter$45$utils_Untrusted } from './adapter-utils';
|
|
2
|
+
import { PlaceQuoteInputRepresentation as types_PlaceQuoteInputRepresentation_PlaceQuoteInputRepresentation } from '../types/PlaceQuoteInputRepresentation';
|
|
3
|
+
import { ResourceRequestConfig as resources_postCommerceQuotesActionsPlace_ResourceRequestConfig } from '../resources/postCommerceQuotesActionsPlace';
|
|
4
|
+
import { Luvio as $64$luvio_engine_Luvio, DispatchResourceRequestContext as $64$luvio_engine_DispatchResourceRequestContext, AdapterFactory as $64$luvio_engine_AdapterFactory } from '@luvio/engine';
|
|
5
|
+
import { PlaceQuoteOutputRepresentation as types_PlaceQuoteOutputRepresentation_PlaceQuoteOutputRepresentation } from '../types/PlaceQuoteOutputRepresentation';
|
|
6
|
+
export declare const adapterName = "updateQuote";
|
|
7
|
+
export declare const updateQuote_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
|
|
8
|
+
export interface UpdateQuoteConfig {
|
|
9
|
+
PlaceQuoteInput: types_PlaceQuoteInputRepresentation_PlaceQuoteInputRepresentation;
|
|
10
|
+
}
|
|
11
|
+
export declare function createResourceParams(config: UpdateQuoteConfig): resources_postCommerceQuotesActionsPlace_ResourceRequestConfig;
|
|
12
|
+
export declare function typeCheckConfig(untrustedConfig: adapter$45$utils_Untrusted<UpdateQuoteConfig>): adapter$45$utils_Untrusted<UpdateQuoteConfig>;
|
|
13
|
+
export declare function validateAdapterConfig(untrustedConfig: unknown, configPropertyNames: adapter$45$utils_AdapterValidationConfig): UpdateQuoteConfig | null;
|
|
14
|
+
export declare function buildNetworkSnapshot(luvio: $64$luvio_engine_Luvio, config: UpdateQuoteConfig, options?: $64$luvio_engine_DispatchResourceRequestContext): Promise<import("@luvio/engine").FulfilledSnapshot<types_PlaceQuoteOutputRepresentation_PlaceQuoteOutputRepresentation, {}> | import("@luvio/engine").StaleSnapshot<types_PlaceQuoteOutputRepresentation_PlaceQuoteOutputRepresentation, {}> | import("@luvio/engine").PendingSnapshot<types_PlaceQuoteOutputRepresentation_PlaceQuoteOutputRepresentation, any>>;
|
|
15
|
+
export declare const updateQuoteAdapterFactory: $64$luvio_engine_AdapterFactory<UpdateQuoteConfig, types_PlaceQuoteOutputRepresentation_PlaceQuoteOutputRepresentation>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { updateQuoteAdapterFactory } from '../adapters/updateQuote';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PlaceQuoteInputRepresentation as types_PlaceQuoteInputRepresentation_PlaceQuoteInputRepresentation } from '../types/PlaceQuoteInputRepresentation';
|
|
2
|
+
import { Luvio as $64$luvio_engine_Luvio, Fragment as $64$luvio_engine_Fragment, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap, 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 { PlaceQuoteOutputRepresentation as types_PlaceQuoteOutputRepresentation_PlaceQuoteOutputRepresentation } from '../types/PlaceQuoteOutputRepresentation';
|
|
4
|
+
export interface ResourceRequestConfig {
|
|
5
|
+
body: {
|
|
6
|
+
PlaceQuoteInput: types_PlaceQuoteInputRepresentation_PlaceQuoteInputRepresentation;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare function select(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig): $64$luvio_engine_Fragment;
|
|
10
|
+
export declare function getResponseCacheKeys(luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: types_PlaceQuoteOutputRepresentation_PlaceQuoteOutputRepresentation): $64$luvio_engine_DurableStoreKeyMetadataMap;
|
|
11
|
+
export declare function ingestSuccess(luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: $64$luvio_engine_FetchResponse<types_PlaceQuoteOutputRepresentation_PlaceQuoteOutputRepresentation>): $64$luvio_engine_FulfilledSnapshot<types_PlaceQuoteOutputRepresentation_PlaceQuoteOutputRepresentation, {}> | $64$luvio_engine_StaleSnapshot<types_PlaceQuoteOutputRepresentation_PlaceQuoteOutputRepresentation, {}> | $64$luvio_engine_PendingSnapshot<types_PlaceQuoteOutputRepresentation_PlaceQuoteOutputRepresentation, any>;
|
|
12
|
+
export declare function createResourceRequest(config: ResourceRequestConfig): $64$luvio_engine_ResourceRequest;
|
|
13
|
+
export default createResourceRequest;
|
|
@@ -0,0 +1,35 @@
|
|
|
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, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap } from '@luvio/engine';
|
|
2
|
+
export declare const VERSION = "81b80dc423701677916b6c10ff7f2695";
|
|
3
|
+
export declare function validate(obj: any, path?: string): TypeError | null;
|
|
4
|
+
export declare const RepresentationType: string;
|
|
5
|
+
export declare function normalize(input: PlaceQuoteErrorResponseRepresentation, existing: PlaceQuoteErrorResponseRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): PlaceQuoteErrorResponseRepresentationNormalized;
|
|
6
|
+
export declare const select: () => $64$luvio_engine_FragmentSelection;
|
|
7
|
+
export declare function equals(existing: PlaceQuoteErrorResponseRepresentationNormalized, incoming: PlaceQuoteErrorResponseRepresentationNormalized): boolean;
|
|
8
|
+
export declare function deepFreeze(input: PlaceQuoteErrorResponseRepresentation): void;
|
|
9
|
+
export declare const ingest: $64$luvio_engine_ResourceIngest;
|
|
10
|
+
export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, input: PlaceQuoteErrorResponseRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): $64$luvio_engine_DurableStoreKeyMetadataMap;
|
|
11
|
+
/**
|
|
12
|
+
* Error response representation
|
|
13
|
+
*
|
|
14
|
+
* Keys:
|
|
15
|
+
* (none)
|
|
16
|
+
*/
|
|
17
|
+
export interface PlaceQuoteErrorResponseRepresentationNormalized {
|
|
18
|
+
/** Code for Error */
|
|
19
|
+
errorCode: string;
|
|
20
|
+
/** Message stating the reason for error, if any */
|
|
21
|
+
message: string;
|
|
22
|
+
/** The Id of where the error lies */
|
|
23
|
+
referenceId: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Error response representation
|
|
27
|
+
*
|
|
28
|
+
* Keys:
|
|
29
|
+
* (none)
|
|
30
|
+
*/
|
|
31
|
+
export interface PlaceQuoteErrorResponseRepresentation {
|
|
32
|
+
errorCode: string;
|
|
33
|
+
message: string;
|
|
34
|
+
referenceId: string;
|
|
35
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap } from '@luvio/engine';
|
|
2
|
+
export declare const VERSION = "5156b5e9455c223122d51fea6284e011";
|
|
3
|
+
export declare function validate(obj: any, path?: string): TypeError | null;
|
|
4
|
+
export declare const RepresentationType: string;
|
|
5
|
+
export declare function normalize(input: PlaceQuoteInputRepresentation, existing: PlaceQuoteInputRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): PlaceQuoteInputRepresentationNormalized;
|
|
6
|
+
export declare const select: () => $64$luvio_engine_FragmentSelection;
|
|
7
|
+
export declare function equals(existing: PlaceQuoteInputRepresentationNormalized, incoming: PlaceQuoteInputRepresentationNormalized): boolean;
|
|
8
|
+
export declare function deepFreeze(input: PlaceQuoteInputRepresentation): void;
|
|
9
|
+
export declare const ingest: $64$luvio_engine_ResourceIngest;
|
|
10
|
+
export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, input: PlaceQuoteInputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): $64$luvio_engine_DurableStoreKeyMetadataMap;
|
|
11
|
+
/**
|
|
12
|
+
* Input representation for place quote.
|
|
13
|
+
*
|
|
14
|
+
* Keys:
|
|
15
|
+
* (none)
|
|
16
|
+
*/
|
|
17
|
+
export interface PlaceQuoteInputRepresentationNormalized {
|
|
18
|
+
/** SObject Graph representing the quote structure for place quote */
|
|
19
|
+
graph: {};
|
|
20
|
+
/** Pricing Preference for place quote */
|
|
21
|
+
pricingPref: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Input representation for place quote.
|
|
25
|
+
*
|
|
26
|
+
* Keys:
|
|
27
|
+
* (none)
|
|
28
|
+
*/
|
|
29
|
+
export interface PlaceQuoteInputRepresentation {
|
|
30
|
+
graph: {};
|
|
31
|
+
pricingPref: string;
|
|
32
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PlaceQuoteInputRepresentation as PlaceQuoteInputRepresentation_PlaceQuoteInputRepresentation } from './PlaceQuoteInputRepresentation';
|
|
2
|
+
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, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap } from '@luvio/engine';
|
|
3
|
+
export declare const VERSION = "37f5819e43ff2bb119ab42371ea28276";
|
|
4
|
+
export declare function validate(obj: any, path?: string): TypeError | null;
|
|
5
|
+
export declare const RepresentationType: string;
|
|
6
|
+
export declare function normalize(input: PlaceQuoteInputWrapperRepresentation, existing: PlaceQuoteInputWrapperRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): PlaceQuoteInputWrapperRepresentationNormalized;
|
|
7
|
+
export declare const select: () => $64$luvio_engine_FragmentSelection;
|
|
8
|
+
export declare function equals(existing: PlaceQuoteInputWrapperRepresentationNormalized, incoming: PlaceQuoteInputWrapperRepresentationNormalized): boolean;
|
|
9
|
+
export declare function deepFreeze(input: PlaceQuoteInputWrapperRepresentation): void;
|
|
10
|
+
export declare const ingest: $64$luvio_engine_ResourceIngest;
|
|
11
|
+
export declare function getTypeCacheKeys(luvio: $64$luvio_engine_Luvio, input: PlaceQuoteInputWrapperRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): $64$luvio_engine_DurableStoreKeyMetadataMap;
|
|
12
|
+
/**
|
|
13
|
+
* Wrapper for place quote input representation
|
|
14
|
+
*
|
|
15
|
+
* Keys:
|
|
16
|
+
* (none)
|
|
17
|
+
*/
|
|
18
|
+
export interface PlaceQuoteInputWrapperRepresentationNormalized {
|
|
19
|
+
PlaceQuoteInput: PlaceQuoteInputRepresentation_PlaceQuoteInputRepresentation;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Wrapper for place quote input representation
|
|
23
|
+
*
|
|
24
|
+
* Keys:
|
|
25
|
+
* (none)
|
|
26
|
+
*/
|
|
27
|
+
export interface PlaceQuoteInputWrapperRepresentation {
|
|
28
|
+
PlaceQuoteInput: PlaceQuoteInputRepresentation_PlaceQuoteInputRepresentation;
|
|
29
|
+
}
|