@salesforce/lds-adapters-revenue-place-quote 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.
@@ -0,0 +1,40 @@
1
+ import { ConfiguratorOptionsInputRepresentation as ConfiguratorOptionsInputRepresentation_ConfiguratorOptionsInputRepresentation } from './ConfiguratorOptionsInputRepresentation';
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, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
3
+ export declare const VERSION = "6cfb8106b4989e61b22259fab0ac9cb1";
4
+ export declare function validate(obj: any, path?: string): TypeError | null;
5
+ export declare const RepresentationType: string;
6
+ 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;
7
+ export declare const select: () => $64$luvio_engine_FragmentSelection;
8
+ export declare function equals(existing: PlaceQuoteInputRepresentationNormalized, incoming: PlaceQuoteInputRepresentationNormalized): boolean;
9
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
10
+ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableStoreKeyMetadataMap, luvio: $64$luvio_engine_Luvio, input: PlaceQuoteInputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
11
+ /**
12
+ * Input representation for place quote.
13
+ *
14
+ * Keys:
15
+ * (none)
16
+ */
17
+ export interface PlaceQuoteInputRepresentationNormalized {
18
+ /** Catalog Rates Preference for place quote */
19
+ catalogRatesPref?: string;
20
+ /** Configuration input to control the call to config API */
21
+ configurationInput?: string;
22
+ configurationOptions?: ConfiguratorOptionsInputRepresentation_ConfiguratorOptionsInputRepresentation;
23
+ /** SObject Graph representing the quote structure for place quote */
24
+ graph: {};
25
+ /** Pricing Preference for place quote */
26
+ pricingPref: string;
27
+ }
28
+ /**
29
+ * Input representation for place quote.
30
+ *
31
+ * Keys:
32
+ * (none)
33
+ */
34
+ export interface PlaceQuoteInputRepresentation {
35
+ catalogRatesPref?: string;
36
+ configurationInput?: string;
37
+ configurationOptions?: ConfiguratorOptionsInputRepresentation_ConfiguratorOptionsInputRepresentation;
38
+ graph: {};
39
+ pricingPref: string;
40
+ }
@@ -0,0 +1,28 @@
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, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } 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 const ingest: $64$luvio_engine_ResourceIngest;
10
+ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableStoreKeyMetadataMap, luvio: $64$luvio_engine_Luvio, input: PlaceQuoteInputWrapperRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
11
+ /**
12
+ * Wrapper for place quote input representation
13
+ *
14
+ * Keys:
15
+ * (none)
16
+ */
17
+ export interface PlaceQuoteInputWrapperRepresentationNormalized {
18
+ PlaceQuoteInput: PlaceQuoteInputRepresentation_PlaceQuoteInputRepresentation;
19
+ }
20
+ /**
21
+ * Wrapper for place quote input representation
22
+ *
23
+ * Keys:
24
+ * (none)
25
+ */
26
+ export interface PlaceQuoteInputWrapperRepresentation {
27
+ PlaceQuoteInput: PlaceQuoteInputRepresentation_PlaceQuoteInputRepresentation;
28
+ }
@@ -0,0 +1,51 @@
1
+ import { PlaceQuoteErrorResponseRepresentation as PlaceQuoteErrorResponseRepresentation_PlaceQuoteErrorResponseRepresentation } from './PlaceQuoteErrorResponseRepresentation';
2
+ 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';
3
+ export declare const TTL = 1000;
4
+ export declare const VERSION = "32a768cba447434ebb8e37e67aed1302";
5
+ export declare function validate(obj: any, path?: string): TypeError | null;
6
+ export declare const RepresentationType: string;
7
+ export interface KeyParams extends $64$luvio_engine_KeyMetadata {
8
+ quoteId: string;
9
+ }
10
+ export type PlaceQuoteOutputRepresentationNormalizedKeyMetadata = KeyParams & $64$luvio_engine_NormalizedKeyMetadata;
11
+ export type PartialPlaceQuoteOutputRepresentationNormalizedKeyMetadata = Partial<KeyParams> & $64$luvio_engine_NormalizedKeyMetadata;
12
+ export declare function keyBuilder(luvio: $64$luvio_engine_Luvio, config: KeyParams): string;
13
+ export declare function keyBuilder_StructuredKey(luvio: $64$luvio_engine_Luvio, config: KeyParams): PlaceQuoteOutputRepresentationNormalizedKeyMetadata;
14
+ export declare function keyBuilderFromType(luvio: $64$luvio_engine_Luvio, object: PlaceQuoteOutputRepresentation): string;
15
+ export declare function keyBuilderFromType_StructuredKey(luvio: $64$luvio_engine_Luvio, object: PlaceQuoteOutputRepresentation): $64$luvio_engine_NormalizedKeyMetadata;
16
+ export declare function normalize(input: PlaceQuoteOutputRepresentation, existing: PlaceQuoteOutputRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): PlaceQuoteOutputRepresentationNormalized;
17
+ export declare const select: () => $64$luvio_engine_BaseFragment;
18
+ export declare function equals(existing: PlaceQuoteOutputRepresentationNormalized, incoming: PlaceQuoteOutputRepresentationNormalized): boolean;
19
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
20
+ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableStoreKeyMetadataMap, luvio: $64$luvio_engine_Luvio, input: PlaceQuoteOutputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
21
+ /**
22
+ * Place Quote output representation
23
+ *
24
+ * Keys:
25
+ * quoteId (string): quoteId
26
+ */
27
+ export interface PlaceQuoteOutputRepresentationNormalized {
28
+ /** QUOTE ID */
29
+ quoteId: string;
30
+ /** Unique request identifier that can be used to poll async request */
31
+ requestIdentifier: string;
32
+ /** response error */
33
+ responseError: Array<PlaceQuoteErrorResponseRepresentation_PlaceQuoteErrorResponseRepresentation>;
34
+ /** a StatusURL for tracking this operation */
35
+ statusURL: string;
36
+ /** success */
37
+ success: boolean;
38
+ }
39
+ /**
40
+ * Place Quote output representation
41
+ *
42
+ * Keys:
43
+ * quoteId (string): quoteId
44
+ */
45
+ export interface PlaceQuoteOutputRepresentation {
46
+ quoteId: string;
47
+ requestIdentifier: string;
48
+ responseError: Array<PlaceQuoteErrorResponseRepresentation_PlaceQuoteErrorResponseRepresentation>;
49
+ statusURL: string;
50
+ success: boolean;
51
+ }
@@ -0,0 +1,32 @@
1
+ import { NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
2
+ export declare const ObjectKeys: {
3
+ (o: object): string[];
4
+ (o: {}): string[];
5
+ }, ObjectCreate: {
6
+ (o: object | null): any;
7
+ (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
8
+ }, ObjectAssign: {
9
+ <T extends {}, U>(target: T, source: U): T & U;
10
+ <T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
11
+ <T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
12
+ (target: object, ...sources: any[]): any;
13
+ };
14
+ export declare const ArrayIsArray: (arg: any) => arg is any[];
15
+ export declare const JSONStringify: {
16
+ (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
17
+ (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string;
18
+ };
19
+ type AllowedPrimitives = boolean | string | number | Date | null;
20
+ type Value<T> = T extends AllowedPrimitives ? T : RecursivePartial<T>;
21
+ export type RecursivePartial<T> = null | {
22
+ [P in keyof T]?: T[P] extends Array<infer U> ? Array<Value<U>> | null : Value<T[P]> | null;
23
+ };
24
+ export declare function equalsArray<U, V extends U[]>(a: V, b: V, equalsItem: (itemA: U, itemB: U) => boolean | void): boolean;
25
+ export declare function equalsObject<U, V extends {
26
+ [key: string]: U;
27
+ }>(a: V, b: V, equalsProp: (propA: U, propB: U) => boolean | void): boolean;
28
+ export declare function createLink(ref: string | $64$luvio_engine_NormalizedKeyMetadata): {
29
+ __ref: string;
30
+ };
31
+ export declare function assignMetadataLink(entry: any, metadataKey: string | $64$luvio_engine_NormalizedKeyMetadata): void;
32
+ export {};
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@salesforce/lds-adapters-revenue-place-quote",
3
+ "version": "0.1.0-dev1",
4
+ "description": "Place Quote API for partial items and price/taxation updates async",
5
+ "license": "SEE LICENSE IN LICENSE.txt",
6
+ "main": "dist/es/es2018/revenue-place-quote.js",
7
+ "module": "dist/es/es2018/revenue-place-quote.js",
8
+ "types": "dist/es/es2018/types/src/generated/artifacts/main.d.ts",
9
+ "files": [
10
+ "dist",
11
+ "sfdc",
12
+ "src/raml/*"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/es/es2018/types/src/generated/artifacts/main.d.ts",
17
+ "import": "./dist/es/es2018/revenue-place-quote.js",
18
+ "require": "./dist/es/es2018/revenue-place-quote.js"
19
+ },
20
+ "./sfdc": {
21
+ "types": "./sfdc/index.d.ts",
22
+ "import": "./sfdc/index.js",
23
+ "default": "./sfdc/index.js"
24
+ }
25
+ },
26
+ "sfdc": {
27
+ "namespace": "lightning",
28
+ "module": "revenuePlaceQuoteApi"
29
+ },
30
+ "contributors": [
31
+ "thane.fenton@salesforce.com"
32
+ ],
33
+ "scripts": {
34
+ "build": "yarn build:services",
35
+ "build:karma": "rollup --bundleConfigAsCjs --config rollup.config.karma.js",
36
+ "build:raml": "luvio generate src/raml/luvio.raml src/generated -p '../lds-compiler-plugins'",
37
+ "build:services": "rollup --bundleConfigAsCjs --config rollup.config.js",
38
+ "clean": "rm -rf dist sfdc src/generated karma/dist",
39
+ "release:core": "../../scripts/release/core.js --adapter=lds-adapters-revenue-place-quote",
40
+ "release:corejar": "yarn build && ../core-build/scripts/core.js --adapter=lds-adapters-revenue-place-quote",
41
+ "start": "nx build:karma && karma start",
42
+ "test": "nx build:karma && karma start --single-run",
43
+ "test:unit": "jest"
44
+ },
45
+ "dependencies": {
46
+ "@salesforce/lds-bindings": "^0.1.0-dev1"
47
+ },
48
+ "devDependencies": {
49
+ "@salesforce/lds-compiler-plugins": "^0.1.0-dev1",
50
+ "@salesforce/lds-karma": "^0.1.0-dev1"
51
+ },
52
+ "nx": {
53
+ "targets": {
54
+ "build": {
55
+ "outputs": [
56
+ "{projectRoot}/dist",
57
+ "{projectRoot}/sfdc"
58
+ ]
59
+ },
60
+ "build:raml": {
61
+ "outputs": [
62
+ "{projectRoot}/src/generated"
63
+ ]
64
+ },
65
+ "build:karma": {
66
+ "outputs": [
67
+ "{projectRoot}/karma/dist"
68
+ ]
69
+ }
70
+ }
71
+ },
72
+ "volta": {
73
+ "extends": "../../package.json"
74
+ }
75
+ }
@@ -0,0 +1 @@
1
+ export * from '../dist/es/es2018/types/src/generated/artifacts/sfdc';
package/sfdc/index.js ADDED
@@ -0,0 +1,395 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ /*
8
+ * ATTENTION!
9
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
10
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
11
+ * Any changes made to this file in p4 will be automatically overwritten.
12
+ * *******************************************************************************************
13
+ */
14
+ /* proxy-compat-disable */
15
+ import { withDefaultLuvio } from 'force/ldsEngine';
16
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$1 } from 'force/luvioEngine';
17
+
18
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
19
+ const { keys: ObjectKeys, create: ObjectCreate } = Object;
20
+ const { isArray: ArrayIsArray$1 } = Array;
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
+ function validateConfig(config, adapter, oneOf) {
29
+ const { displayName } = adapter;
30
+ const { required, optional, unsupported } = adapter.parameters;
31
+ if (config === undefined ||
32
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
33
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
34
+ }
35
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
36
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
37
+ }
38
+ if (unsupported !== undefined &&
39
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
40
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
41
+ }
42
+ const supported = required.concat(optional);
43
+ if (ObjectKeys(config).some(key => !supported.includes(key))) {
44
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
45
+ }
46
+ }
47
+ function untrustedIsObject(untrusted) {
48
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
49
+ }
50
+ function areRequiredParametersPresent(config, configPropertyNames) {
51
+ return configPropertyNames.parameters.required.every(req => req in config);
52
+ }
53
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
54
+ return {
55
+ name,
56
+ required,
57
+ resourceType,
58
+ typeCheckShape,
59
+ isArrayShape,
60
+ coerceFn,
61
+ };
62
+ }
63
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
64
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
65
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
66
+ return {
67
+ displayName,
68
+ parameters: {
69
+ required,
70
+ optional,
71
+ }
72
+ };
73
+ }
74
+ const keyPrefix = 'place-quote';
75
+
76
+ const { isArray: ArrayIsArray } = Array;
77
+ const { stringify: JSONStringify } = JSON;
78
+ function createLink(ref) {
79
+ return {
80
+ __ref: serializeStructuredKey(ref),
81
+ };
82
+ }
83
+
84
+ function validate$3(obj, path = 'ConfiguratorOptionsInputRepresentation') {
85
+ const v_error = (() => {
86
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
87
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
88
+ }
89
+ if (obj.addDefaultConfiguration !== undefined) {
90
+ const obj_addDefaultConfiguration = obj.addDefaultConfiguration;
91
+ const path_addDefaultConfiguration = path + '.addDefaultConfiguration';
92
+ if (typeof obj_addDefaultConfiguration !== 'boolean') {
93
+ return new TypeError('Expected "boolean" but received "' + typeof obj_addDefaultConfiguration + '" (at "' + path_addDefaultConfiguration + '")');
94
+ }
95
+ }
96
+ if (obj.executeConfigurationRules !== undefined) {
97
+ const obj_executeConfigurationRules = obj.executeConfigurationRules;
98
+ const path_executeConfigurationRules = path + '.executeConfigurationRules';
99
+ if (typeof obj_executeConfigurationRules !== 'boolean') {
100
+ return new TypeError('Expected "boolean" but received "' + typeof obj_executeConfigurationRules + '" (at "' + path_executeConfigurationRules + '")');
101
+ }
102
+ }
103
+ if (obj.validateAmendRenewCancel !== undefined) {
104
+ const obj_validateAmendRenewCancel = obj.validateAmendRenewCancel;
105
+ const path_validateAmendRenewCancel = path + '.validateAmendRenewCancel';
106
+ if (typeof obj_validateAmendRenewCancel !== 'boolean') {
107
+ return new TypeError('Expected "boolean" but received "' + typeof obj_validateAmendRenewCancel + '" (at "' + path_validateAmendRenewCancel + '")');
108
+ }
109
+ }
110
+ if (obj.validateProductCatalog !== undefined) {
111
+ const obj_validateProductCatalog = obj.validateProductCatalog;
112
+ const path_validateProductCatalog = path + '.validateProductCatalog';
113
+ if (typeof obj_validateProductCatalog !== 'boolean') {
114
+ return new TypeError('Expected "boolean" but received "' + typeof obj_validateProductCatalog + '" (at "' + path_validateProductCatalog + '")');
115
+ }
116
+ }
117
+ })();
118
+ return v_error === undefined ? null : v_error;
119
+ }
120
+
121
+ function validate$2(obj, path = 'PlaceQuoteInputRepresentation') {
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
+ if (obj.catalogRatesPref !== undefined) {
127
+ const obj_catalogRatesPref = obj.catalogRatesPref;
128
+ const path_catalogRatesPref = path + '.catalogRatesPref';
129
+ if (typeof obj_catalogRatesPref !== 'string') {
130
+ return new TypeError('Expected "string" but received "' + typeof obj_catalogRatesPref + '" (at "' + path_catalogRatesPref + '")');
131
+ }
132
+ }
133
+ if (obj.configurationInput !== undefined) {
134
+ const obj_configurationInput = obj.configurationInput;
135
+ const path_configurationInput = path + '.configurationInput';
136
+ if (typeof obj_configurationInput !== 'string') {
137
+ return new TypeError('Expected "string" but received "' + typeof obj_configurationInput + '" (at "' + path_configurationInput + '")');
138
+ }
139
+ }
140
+ if (obj.configurationOptions !== undefined) {
141
+ const obj_configurationOptions = obj.configurationOptions;
142
+ const path_configurationOptions = path + '.configurationOptions';
143
+ const referencepath_configurationOptionsValidationError = validate$3(obj_configurationOptions, path_configurationOptions);
144
+ if (referencepath_configurationOptionsValidationError !== null) {
145
+ let message = 'Object doesn\'t match ConfiguratorOptionsInputRepresentation (at "' + path_configurationOptions + '")\n';
146
+ message += referencepath_configurationOptionsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
147
+ return new TypeError(message);
148
+ }
149
+ }
150
+ const obj_graph = obj.graph;
151
+ const path_graph = path + '.graph';
152
+ if (typeof obj_graph !== 'object' || ArrayIsArray(obj_graph) || obj_graph === null) {
153
+ return new TypeError('Expected "object" but received "' + typeof obj_graph + '" (at "' + path_graph + '")');
154
+ }
155
+ const obj_pricingPref = obj.pricingPref;
156
+ const path_pricingPref = path + '.pricingPref';
157
+ if (typeof obj_pricingPref !== 'string') {
158
+ return new TypeError('Expected "string" but received "' + typeof obj_pricingPref + '" (at "' + path_pricingPref + '")');
159
+ }
160
+ })();
161
+ return v_error === undefined ? null : v_error;
162
+ }
163
+
164
+ function validate$1(obj, path = 'PlaceQuoteErrorResponseRepresentation') {
165
+ const v_error = (() => {
166
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
167
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
168
+ }
169
+ const obj_errorCode = obj.errorCode;
170
+ const path_errorCode = path + '.errorCode';
171
+ if (typeof obj_errorCode !== 'string') {
172
+ return new TypeError('Expected "string" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
173
+ }
174
+ const obj_message = obj.message;
175
+ const path_message = path + '.message';
176
+ if (typeof obj_message !== 'string') {
177
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
178
+ }
179
+ const obj_referenceId = obj.referenceId;
180
+ const path_referenceId = path + '.referenceId';
181
+ if (typeof obj_referenceId !== 'string') {
182
+ return new TypeError('Expected "string" but received "' + typeof obj_referenceId + '" (at "' + path_referenceId + '")');
183
+ }
184
+ })();
185
+ return v_error === undefined ? null : v_error;
186
+ }
187
+
188
+ const TTL = 1000;
189
+ const VERSION = "32a768cba447434ebb8e37e67aed1302";
190
+ function validate(obj, path = 'PlaceQuoteOutputRepresentation') {
191
+ const v_error = (() => {
192
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
193
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
194
+ }
195
+ const obj_quoteId = obj.quoteId;
196
+ const path_quoteId = path + '.quoteId';
197
+ if (typeof obj_quoteId !== 'string') {
198
+ return new TypeError('Expected "string" but received "' + typeof obj_quoteId + '" (at "' + path_quoteId + '")');
199
+ }
200
+ const obj_requestIdentifier = obj.requestIdentifier;
201
+ const path_requestIdentifier = path + '.requestIdentifier';
202
+ if (typeof obj_requestIdentifier !== 'string') {
203
+ return new TypeError('Expected "string" but received "' + typeof obj_requestIdentifier + '" (at "' + path_requestIdentifier + '")');
204
+ }
205
+ const obj_responseError = obj.responseError;
206
+ const path_responseError = path + '.responseError';
207
+ if (!ArrayIsArray(obj_responseError)) {
208
+ return new TypeError('Expected "array" but received "' + typeof obj_responseError + '" (at "' + path_responseError + '")');
209
+ }
210
+ for (let i = 0; i < obj_responseError.length; i++) {
211
+ const obj_responseError_item = obj_responseError[i];
212
+ const path_responseError_item = path_responseError + '[' + i + ']';
213
+ const referencepath_responseError_itemValidationError = validate$1(obj_responseError_item, path_responseError_item);
214
+ if (referencepath_responseError_itemValidationError !== null) {
215
+ let message = 'Object doesn\'t match PlaceQuoteErrorResponseRepresentation (at "' + path_responseError_item + '")\n';
216
+ message += referencepath_responseError_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
217
+ return new TypeError(message);
218
+ }
219
+ }
220
+ const obj_statusURL = obj.statusURL;
221
+ const path_statusURL = path + '.statusURL';
222
+ if (typeof obj_statusURL !== 'string') {
223
+ return new TypeError('Expected "string" but received "' + typeof obj_statusURL + '" (at "' + path_statusURL + '")');
224
+ }
225
+ const obj_success = obj.success;
226
+ const path_success = path + '.success';
227
+ if (typeof obj_success !== 'boolean') {
228
+ return new TypeError('Expected "boolean" but received "' + typeof obj_success + '" (at "' + path_success + '")');
229
+ }
230
+ })();
231
+ return v_error === undefined ? null : v_error;
232
+ }
233
+ const RepresentationType = 'PlaceQuoteOutputRepresentation';
234
+ function keyBuilder(luvio, config) {
235
+ return keyPrefix + '::' + RepresentationType + ':' + config.quoteId;
236
+ }
237
+ function keyBuilderFromType(luvio, object) {
238
+ const keyParams = {
239
+ quoteId: object.quoteId
240
+ };
241
+ return keyBuilder(luvio, keyParams);
242
+ }
243
+ function normalize(input, existing, path, luvio, store, timestamp) {
244
+ return input;
245
+ }
246
+ const select$1 = function PlaceQuoteOutputRepresentationSelect() {
247
+ return {
248
+ kind: 'Fragment',
249
+ version: VERSION,
250
+ private: [],
251
+ opaque: true
252
+ };
253
+ };
254
+ function equals(existing, incoming) {
255
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
256
+ return false;
257
+ }
258
+ return true;
259
+ }
260
+ const ingest = function PlaceQuoteOutputRepresentationIngest(input, path, luvio, store, timestamp) {
261
+ if (process.env.NODE_ENV !== 'production') {
262
+ const validateError = validate(input);
263
+ if (validateError !== null) {
264
+ throw validateError;
265
+ }
266
+ }
267
+ const key = keyBuilderFromType(luvio, input);
268
+ const ttlToUse = TTL;
269
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "place-quote", VERSION, RepresentationType, equals);
270
+ return createLink(key);
271
+ };
272
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
273
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
274
+ const rootKey = keyBuilderFromType(luvio, input);
275
+ rootKeySet.set(rootKey, {
276
+ namespace: keyPrefix,
277
+ representationName: RepresentationType,
278
+ mergeable: false
279
+ });
280
+ }
281
+
282
+ function select(luvio, params) {
283
+ return select$1();
284
+ }
285
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
286
+ getTypeCacheKeys(storeKeyMap, luvio, response);
287
+ }
288
+ function ingestSuccess(luvio, resourceParams, response) {
289
+ const { body } = response;
290
+ const key = keyBuilderFromType(luvio, body);
291
+ luvio.storeIngest(key, ingest, body);
292
+ const snapshot = luvio.storeLookup({
293
+ recordId: key,
294
+ node: select(),
295
+ variables: {},
296
+ });
297
+ if (process.env.NODE_ENV !== 'production') {
298
+ if (snapshot.state !== 'Fulfilled') {
299
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
300
+ }
301
+ }
302
+ deepFreeze(snapshot.data);
303
+ return snapshot;
304
+ }
305
+ function createResourceRequest(config) {
306
+ const headers = {};
307
+ return {
308
+ baseUri: '/services/data/v66.0',
309
+ basePath: '/commerce/quotes/actions/place',
310
+ method: 'post',
311
+ body: config.body,
312
+ urlParams: {},
313
+ queryParams: {},
314
+ headers,
315
+ priority: 'normal',
316
+ };
317
+ }
318
+
319
+ const adapterName = 'updateQuote';
320
+ const updateQuote_ConfigPropertyMetadata = [
321
+ generateParamConfigMetadata('PlaceQuoteInput', true, 2 /* Body */, 4 /* Unsupported */),
322
+ ];
323
+ const updateQuote_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, updateQuote_ConfigPropertyMetadata);
324
+ const createResourceParams = /*#__PURE__*/ createResourceParams$1(updateQuote_ConfigPropertyMetadata);
325
+ function typeCheckConfig(untrustedConfig) {
326
+ const config = {};
327
+ const untrustedConfig_PlaceQuoteInput = untrustedConfig.PlaceQuoteInput;
328
+ const referencePlaceQuoteInputRepresentationValidationError = validate$2(untrustedConfig_PlaceQuoteInput);
329
+ if (referencePlaceQuoteInputRepresentationValidationError === null) {
330
+ config.PlaceQuoteInput = untrustedConfig_PlaceQuoteInput;
331
+ }
332
+ return config;
333
+ }
334
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
335
+ if (!untrustedIsObject(untrustedConfig)) {
336
+ return null;
337
+ }
338
+ if (process.env.NODE_ENV !== 'production') {
339
+ validateConfig(untrustedConfig, configPropertyNames);
340
+ }
341
+ const config = typeCheckConfig(untrustedConfig);
342
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
343
+ return null;
344
+ }
345
+ return config;
346
+ }
347
+ function buildNetworkSnapshot(luvio, config, options) {
348
+ const resourceParams = createResourceParams(config);
349
+ const request = createResourceRequest(resourceParams);
350
+ return luvio.dispatchResourceRequest(request, options)
351
+ .then((response) => {
352
+ return luvio.handleSuccessResponse(() => {
353
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
354
+ return luvio.storeBroadcast().then(() => snapshot);
355
+ }, () => {
356
+ const cache = new StoreKeyMap();
357
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
358
+ return cache;
359
+ });
360
+ }, (response) => {
361
+ deepFreeze(response);
362
+ throw response;
363
+ });
364
+ }
365
+ const updateQuoteAdapterFactory = (luvio) => {
366
+ return function updateQuote(untrustedConfig) {
367
+ const config = validateAdapterConfig(untrustedConfig, updateQuote_ConfigPropertyNames);
368
+ // Invalid or incomplete config
369
+ if (config === null) {
370
+ throw new Error('Invalid config for "updateQuote"');
371
+ }
372
+ return buildNetworkSnapshot(luvio, config);
373
+ };
374
+ };
375
+
376
+ let updateQuote;
377
+ // Notify Update Available
378
+ function bindExportsTo(luvio) {
379
+ // LDS Adapters
380
+ function unwrapSnapshotData(factory) {
381
+ const adapter = factory(luvio);
382
+ return (config) => adapter(config).then((snapshot) => snapshot.data);
383
+ }
384
+ return {
385
+ updateQuote: unwrapSnapshotData(updateQuoteAdapterFactory),
386
+ // Imperative GET Adapters
387
+ // Notify Update Availables
388
+ };
389
+ }
390
+ withDefaultLuvio((luvio) => {
391
+ ({ updateQuote } = bindExportsTo(luvio));
392
+ });
393
+
394
+ export { updateQuote };
395
+ // version: 0.1.0-dev1-c978a7b010