@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.
@@ -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 = "ec4f22cf797e83e32253f34a2341922f";
4
+ export declare function validate(obj: any, path?: string): TypeError | null;
5
+ export declare const RepresentationType: string;
6
+ export declare function normalize(input: PlaceOrderInputRepresentation, existing: PlaceOrderInputRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): PlaceOrderInputRepresentationNormalized;
7
+ export declare const select: () => $64$luvio_engine_FragmentSelection;
8
+ export declare function equals(existing: PlaceOrderInputRepresentationNormalized, incoming: PlaceOrderInputRepresentationNormalized): 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: PlaceOrderInputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
11
+ /**
12
+ * Place Order API input representation
13
+ *
14
+ * Keys:
15
+ * (none)
16
+ */
17
+ export interface PlaceOrderInputRepresentationNormalized {
18
+ /** Catalog Rates Preference for this place order process. */
19
+ catalogRatesPref?: string;
20
+ /** Configuration input to control the call to config API */
21
+ configurationInput?: string;
22
+ configurationOptions?: ConfiguratorOptionsInputRepresentation_ConfiguratorOptionsInputRepresentation;
23
+ /** The sobject graph representing the order payload to be ingested. */
24
+ graph: {};
25
+ /** Pricing Preference for this place order process. */
26
+ pricingPref: string;
27
+ }
28
+ /**
29
+ * Place Order API input representation
30
+ *
31
+ * Keys:
32
+ * (none)
33
+ */
34
+ export interface PlaceOrderInputRepresentation {
35
+ catalogRatesPref?: string;
36
+ configurationInput?: string;
37
+ configurationOptions?: ConfiguratorOptionsInputRepresentation_ConfiguratorOptionsInputRepresentation;
38
+ graph: {};
39
+ pricingPref: string;
40
+ }
@@ -0,0 +1,28 @@
1
+ import { PlaceOrderInputRepresentation as PlaceOrderInputRepresentation_PlaceOrderInputRepresentation } from './PlaceOrderInputRepresentation';
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 = "815b3d66f04cfc6994715d053b786a7e";
4
+ export declare function validate(obj: any, path?: string): TypeError | null;
5
+ export declare const RepresentationType: string;
6
+ export declare function normalize(input: PlaceOrderInputWrapperRepresentation, existing: PlaceOrderInputWrapperRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): PlaceOrderInputWrapperRepresentationNormalized;
7
+ export declare const select: () => $64$luvio_engine_FragmentSelection;
8
+ export declare function equals(existing: PlaceOrderInputWrapperRepresentationNormalized, incoming: PlaceOrderInputWrapperRepresentationNormalized): 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: PlaceOrderInputWrapperRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
11
+ /**
12
+ * Wrapper for place order input representation
13
+ *
14
+ * Keys:
15
+ * (none)
16
+ */
17
+ export interface PlaceOrderInputWrapperRepresentationNormalized {
18
+ inputRequest: PlaceOrderInputRepresentation_PlaceOrderInputRepresentation;
19
+ }
20
+ /**
21
+ * Wrapper for place order input representation
22
+ *
23
+ * Keys:
24
+ * (none)
25
+ */
26
+ export interface PlaceOrderInputWrapperRepresentation {
27
+ inputRequest: PlaceOrderInputRepresentation_PlaceOrderInputRepresentation;
28
+ }
@@ -0,0 +1,51 @@
1
+ import { PlaceOrderErrorResponseRepresentation as PlaceOrderErrorResponseRepresentation_PlaceOrderErrorResponseRepresentation } from './PlaceOrderErrorResponseRepresentation';
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 = "c091711201b7e247b20f49c526867ca7";
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
+ orderId: string;
9
+ }
10
+ export type PlaceOrderOutputRepresentationNormalizedKeyMetadata = KeyParams & $64$luvio_engine_NormalizedKeyMetadata;
11
+ export type PartialPlaceOrderOutputRepresentationNormalizedKeyMetadata = 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): PlaceOrderOutputRepresentationNormalizedKeyMetadata;
14
+ export declare function keyBuilderFromType(luvio: $64$luvio_engine_Luvio, object: PlaceOrderOutputRepresentation): string;
15
+ export declare function keyBuilderFromType_StructuredKey(luvio: $64$luvio_engine_Luvio, object: PlaceOrderOutputRepresentation): $64$luvio_engine_NormalizedKeyMetadata;
16
+ export declare function normalize(input: PlaceOrderOutputRepresentation, existing: PlaceOrderOutputRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): PlaceOrderOutputRepresentationNormalized;
17
+ export declare const select: () => $64$luvio_engine_BaseFragment;
18
+ export declare function equals(existing: PlaceOrderOutputRepresentationNormalized, incoming: PlaceOrderOutputRepresentationNormalized): 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: PlaceOrderOutputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
21
+ /**
22
+ * Place Order API output representation
23
+ *
24
+ * Keys:
25
+ * orderId (string): orderId
26
+ */
27
+ export interface PlaceOrderOutputRepresentationNormalized {
28
+ /** List of errors encountered during the synchronous processing. */
29
+ errors: Array<PlaceOrderErrorResponseRepresentation_PlaceOrderErrorResponseRepresentation>;
30
+ /** Order Id */
31
+ orderId: string;
32
+ /** The request id of the process that can be used to query async status. */
33
+ requestId?: string;
34
+ /** The async status URL, if available */
35
+ statusURL?: string;
36
+ /** Whether or not the synchronous part of the processing is successful */
37
+ success: boolean;
38
+ }
39
+ /**
40
+ * Place Order API output representation
41
+ *
42
+ * Keys:
43
+ * orderId (string): orderId
44
+ */
45
+ export interface PlaceOrderOutputRepresentation {
46
+ errors: Array<PlaceOrderErrorResponseRepresentation_PlaceOrderErrorResponseRepresentation>;
47
+ orderId: string;
48
+ requestId?: string;
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,69 @@
1
+ {
2
+ "name": "@salesforce/lds-adapters-revenue-place-order",
3
+ "version": "0.1.0-dev1",
4
+ "description": "Place Order Connect API ",
5
+ "license": "SEE LICENSE IN LICENSE.txt",
6
+ "main": "dist/es/es2018/revenue-place-order.js",
7
+ "module": "dist/es/es2018/revenue-place-order.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-order.js",
18
+ "require": "./dist/es/es2018/revenue-place-order.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": "revenuePlaceOrderApi"
29
+ },
30
+ "contributors": [
31
+ "hkoti@salesforce.com",
32
+ "s.vishwabharathi@salesforce.com"
33
+ ],
34
+ "scripts": {
35
+ "build": "yarn build:services",
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",
39
+ "release:core": "../../scripts/release/core.js --adapter=lds-adapters-revenue-place-order",
40
+ "release:corejar": "yarn build && ../core-build/scripts/core.js --adapter=lds-adapters-revenue-place-order",
41
+ "test:unit": "jest"
42
+ },
43
+ "dependencies": {
44
+ "@salesforce/lds-bindings": "^0.1.0-dev1",
45
+ "raml2html": "^7.8.0"
46
+ },
47
+ "devDependencies": {
48
+ "@salesforce/lds-compiler-plugins": "^0.1.0-dev1",
49
+ "@salesforce/lds-karma": "^0.1.0-dev1"
50
+ },
51
+ "nx": {
52
+ "targets": {
53
+ "build": {
54
+ "outputs": [
55
+ "{projectRoot}/dist",
56
+ "{projectRoot}/sfdc"
57
+ ]
58
+ },
59
+ "build:raml": {
60
+ "outputs": [
61
+ "{projectRoot}/src/generated"
62
+ ]
63
+ }
64
+ }
65
+ },
66
+ "volta": {
67
+ "extends": "../../package.json"
68
+ }
69
+ }
@@ -0,0 +1 @@
1
+ export * from '../dist/es/es2018/types/src/generated/artifacts/sfdc';
package/sfdc/index.js ADDED
@@ -0,0 +1,399 @@
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-order';
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 = 'PlaceOrderInputRepresentation') {
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 = 'PlaceOrderErrorResponseRepresentation') {
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 = "c091711201b7e247b20f49c526867ca7";
190
+ function validate(obj, path = 'PlaceOrderOutputRepresentation') {
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_errors = obj.errors;
196
+ const path_errors = path + '.errors';
197
+ if (!ArrayIsArray(obj_errors)) {
198
+ return new TypeError('Expected "array" but received "' + typeof obj_errors + '" (at "' + path_errors + '")');
199
+ }
200
+ for (let i = 0; i < obj_errors.length; i++) {
201
+ const obj_errors_item = obj_errors[i];
202
+ const path_errors_item = path_errors + '[' + i + ']';
203
+ const referencepath_errors_itemValidationError = validate$1(obj_errors_item, path_errors_item);
204
+ if (referencepath_errors_itemValidationError !== null) {
205
+ let message = 'Object doesn\'t match PlaceOrderErrorResponseRepresentation (at "' + path_errors_item + '")\n';
206
+ message += referencepath_errors_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
207
+ return new TypeError(message);
208
+ }
209
+ }
210
+ const obj_orderId = obj.orderId;
211
+ const path_orderId = path + '.orderId';
212
+ if (typeof obj_orderId !== 'string') {
213
+ return new TypeError('Expected "string" but received "' + typeof obj_orderId + '" (at "' + path_orderId + '")');
214
+ }
215
+ if (obj.requestId !== undefined) {
216
+ const obj_requestId = obj.requestId;
217
+ const path_requestId = path + '.requestId';
218
+ if (typeof obj_requestId !== 'string') {
219
+ return new TypeError('Expected "string" but received "' + typeof obj_requestId + '" (at "' + path_requestId + '")');
220
+ }
221
+ }
222
+ if (obj.statusURL !== undefined) {
223
+ const obj_statusURL = obj.statusURL;
224
+ const path_statusURL = path + '.statusURL';
225
+ if (typeof obj_statusURL !== 'string') {
226
+ return new TypeError('Expected "string" but received "' + typeof obj_statusURL + '" (at "' + path_statusURL + '")');
227
+ }
228
+ }
229
+ const obj_success = obj.success;
230
+ const path_success = path + '.success';
231
+ if (typeof obj_success !== 'boolean') {
232
+ return new TypeError('Expected "boolean" but received "' + typeof obj_success + '" (at "' + path_success + '")');
233
+ }
234
+ })();
235
+ return v_error === undefined ? null : v_error;
236
+ }
237
+ const RepresentationType = 'PlaceOrderOutputRepresentation';
238
+ function keyBuilder(luvio, config) {
239
+ return keyPrefix + '::' + RepresentationType + ':' + config.orderId;
240
+ }
241
+ function keyBuilderFromType(luvio, object) {
242
+ const keyParams = {
243
+ orderId: object.orderId
244
+ };
245
+ return keyBuilder(luvio, keyParams);
246
+ }
247
+ function normalize(input, existing, path, luvio, store, timestamp) {
248
+ return input;
249
+ }
250
+ const select$1 = function PlaceOrderOutputRepresentationSelect() {
251
+ return {
252
+ kind: 'Fragment',
253
+ version: VERSION,
254
+ private: [],
255
+ opaque: true
256
+ };
257
+ };
258
+ function equals(existing, incoming) {
259
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
260
+ return false;
261
+ }
262
+ return true;
263
+ }
264
+ const ingest = function PlaceOrderOutputRepresentationIngest(input, path, luvio, store, timestamp) {
265
+ if (process.env.NODE_ENV !== 'production') {
266
+ const validateError = validate(input);
267
+ if (validateError !== null) {
268
+ throw validateError;
269
+ }
270
+ }
271
+ const key = keyBuilderFromType(luvio, input);
272
+ const ttlToUse = TTL;
273
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "place-order", VERSION, RepresentationType, equals);
274
+ return createLink(key);
275
+ };
276
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
277
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
278
+ const rootKey = keyBuilderFromType(luvio, input);
279
+ rootKeySet.set(rootKey, {
280
+ namespace: keyPrefix,
281
+ representationName: RepresentationType,
282
+ mergeable: false
283
+ });
284
+ }
285
+
286
+ function select(luvio, params) {
287
+ return select$1();
288
+ }
289
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
290
+ getTypeCacheKeys(storeKeyMap, luvio, response);
291
+ }
292
+ function ingestSuccess(luvio, resourceParams, response) {
293
+ const { body } = response;
294
+ const key = keyBuilderFromType(luvio, body);
295
+ luvio.storeIngest(key, ingest, body);
296
+ const snapshot = luvio.storeLookup({
297
+ recordId: key,
298
+ node: select(),
299
+ variables: {},
300
+ });
301
+ if (process.env.NODE_ENV !== 'production') {
302
+ if (snapshot.state !== 'Fulfilled') {
303
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
304
+ }
305
+ }
306
+ deepFreeze(snapshot.data);
307
+ return snapshot;
308
+ }
309
+ function createResourceRequest(config) {
310
+ const headers = {};
311
+ return {
312
+ baseUri: '/services/data/v66.0',
313
+ basePath: '/commerce/sales-orders/actions/place',
314
+ method: 'post',
315
+ body: config.body,
316
+ urlParams: {},
317
+ queryParams: {},
318
+ headers,
319
+ priority: 'normal',
320
+ };
321
+ }
322
+
323
+ const adapterName = 'placeOrder';
324
+ const placeOrder_ConfigPropertyMetadata = [
325
+ generateParamConfigMetadata('inputRequest', true, 2 /* Body */, 4 /* Unsupported */),
326
+ ];
327
+ const placeOrder_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, placeOrder_ConfigPropertyMetadata);
328
+ const createResourceParams = /*#__PURE__*/ createResourceParams$1(placeOrder_ConfigPropertyMetadata);
329
+ function typeCheckConfig(untrustedConfig) {
330
+ const config = {};
331
+ const untrustedConfig_inputRequest = untrustedConfig.inputRequest;
332
+ const referencePlaceOrderInputRepresentationValidationError = validate$2(untrustedConfig_inputRequest);
333
+ if (referencePlaceOrderInputRepresentationValidationError === null) {
334
+ config.inputRequest = untrustedConfig_inputRequest;
335
+ }
336
+ return config;
337
+ }
338
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
339
+ if (!untrustedIsObject(untrustedConfig)) {
340
+ return null;
341
+ }
342
+ if (process.env.NODE_ENV !== 'production') {
343
+ validateConfig(untrustedConfig, configPropertyNames);
344
+ }
345
+ const config = typeCheckConfig(untrustedConfig);
346
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
347
+ return null;
348
+ }
349
+ return config;
350
+ }
351
+ function buildNetworkSnapshot(luvio, config, options) {
352
+ const resourceParams = createResourceParams(config);
353
+ const request = createResourceRequest(resourceParams);
354
+ return luvio.dispatchResourceRequest(request, options)
355
+ .then((response) => {
356
+ return luvio.handleSuccessResponse(() => {
357
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
358
+ return luvio.storeBroadcast().then(() => snapshot);
359
+ }, () => {
360
+ const cache = new StoreKeyMap();
361
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
362
+ return cache;
363
+ });
364
+ }, (response) => {
365
+ deepFreeze(response);
366
+ throw response;
367
+ });
368
+ }
369
+ const placeOrderAdapterFactory = (luvio) => {
370
+ return function placeOrder(untrustedConfig) {
371
+ const config = validateAdapterConfig(untrustedConfig, placeOrder_ConfigPropertyNames);
372
+ // Invalid or incomplete config
373
+ if (config === null) {
374
+ throw new Error('Invalid config for "placeOrder"');
375
+ }
376
+ return buildNetworkSnapshot(luvio, config);
377
+ };
378
+ };
379
+
380
+ let placeOrder;
381
+ // Notify Update Available
382
+ function bindExportsTo(luvio) {
383
+ // LDS Adapters
384
+ function unwrapSnapshotData(factory) {
385
+ const adapter = factory(luvio);
386
+ return (config) => adapter(config).then((snapshot) => snapshot.data);
387
+ }
388
+ return {
389
+ placeOrder: unwrapSnapshotData(placeOrderAdapterFactory),
390
+ // Imperative GET Adapters
391
+ // Notify Update Availables
392
+ };
393
+ }
394
+ withDefaultLuvio((luvio) => {
395
+ ({ placeOrder } = bindExportsTo(luvio));
396
+ });
397
+
398
+ export { placeOrder };
399
+ // version: 0.1.0-dev1-c978a7b010