@salesforce/lds-adapters-industries-instant-pricing 0.1.0-dev1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +82 -0
- package/dist/es/es2018/industries-instant-pricing.js +377 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/instantPricing.d.ts +16 -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/postIndustriesCpqQuotesActionsGetInstantPrice.d.ts +13 -0
- package/dist/es/es2018/types/src/generated/types/GetInstantPricingInputRepresentation.d.ts +37 -0
- package/dist/es/es2018/types/src/generated/types/GetInstantPricingOutputRepresentation.d.ts +47 -0
- package/dist/es/es2018/types/src/generated/types/InstantPricingInputWrapperRepresentation.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/package.json +75 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +405 -0
- package/src/raml/api.raml +88 -0
- package/src/raml/luvio.raml +59 -0
package/dist/es/es2018/types/src/generated/types/InstantPricingInputWrapperRepresentation.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { GetInstantPricingInputRepresentation as GetInstantPricingInputRepresentation_GetInstantPricingInputRepresentation } from './GetInstantPricingInputRepresentation';
|
|
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 = "64061bc269e06cf72968e8c0f0421a84";
|
|
4
|
+
export declare function validate(obj: any, path?: string): TypeError | null;
|
|
5
|
+
export declare const RepresentationType: string;
|
|
6
|
+
export declare function normalize(input: InstantPricingInputWrapperRepresentation, existing: InstantPricingInputWrapperRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): InstantPricingInputWrapperRepresentationNormalized;
|
|
7
|
+
export declare const select: () => $64$luvio_engine_FragmentSelection;
|
|
8
|
+
export declare function equals(existing: InstantPricingInputWrapperRepresentationNormalized, incoming: InstantPricingInputWrapperRepresentationNormalized): 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: InstantPricingInputWrapperRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
|
|
11
|
+
/**
|
|
12
|
+
* Wrapper for instant pricing input representation
|
|
13
|
+
*
|
|
14
|
+
* Keys:
|
|
15
|
+
* (none)
|
|
16
|
+
*/
|
|
17
|
+
export interface InstantPricingInputWrapperRepresentationNormalized {
|
|
18
|
+
getInstantPricingRequestPayload: GetInstantPricingInputRepresentation_GetInstantPricingInputRepresentation;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Wrapper for instant pricing input representation
|
|
22
|
+
*
|
|
23
|
+
* Keys:
|
|
24
|
+
* (none)
|
|
25
|
+
*/
|
|
26
|
+
export interface InstantPricingInputWrapperRepresentation {
|
|
27
|
+
getInstantPricingRequestPayload: GetInstantPricingInputRepresentation_GetInstantPricingInputRepresentation;
|
|
28
|
+
}
|
|
@@ -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-industries-instant-pricing",
|
|
3
|
+
"version": "0.1.0-dev1",
|
|
4
|
+
"description": "Get Instant Pricing API for on-demand Pricing updates for any changes on the QuoteLine or OrderLine items",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
|
+
"main": "dist/es/es2018/industries-instant-pricing.js",
|
|
7
|
+
"module": "dist/es/es2018/industries-instant-pricing.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/industries-instant-pricing.js",
|
|
18
|
+
"require": "./dist/es/es2018/industries-instant-pricing.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": "industriesInstantPricingApi"
|
|
29
|
+
},
|
|
30
|
+
"contributors": [
|
|
31
|
+
"p.thammishetty@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-industries-instant-pricing",
|
|
40
|
+
"release:corejar": "yarn build && ../core-build/scripts/core.js --adapter=lds-adapters-industries-instant-pricing",
|
|
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
|
+
}
|
package/sfdc/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/es/es2018/types/src/generated/artifacts/sfdc';
|
package/sfdc/index.js
ADDED
|
@@ -0,0 +1,405 @@
|
|
|
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 = 'instant-pricing';
|
|
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$1(obj, path = 'GetInstantPricingInputRepresentation') {
|
|
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
|
+
const obj_contextId = obj.contextId;
|
|
90
|
+
const path_contextId = path + '.contextId';
|
|
91
|
+
let obj_contextId_union0 = null;
|
|
92
|
+
const obj_contextId_union0_error = (() => {
|
|
93
|
+
if (typeof obj_contextId !== 'string') {
|
|
94
|
+
return new TypeError('Expected "string" but received "' + typeof obj_contextId + '" (at "' + path_contextId + '")');
|
|
95
|
+
}
|
|
96
|
+
})();
|
|
97
|
+
if (obj_contextId_union0_error != null) {
|
|
98
|
+
obj_contextId_union0 = obj_contextId_union0_error.message;
|
|
99
|
+
}
|
|
100
|
+
let obj_contextId_union1 = null;
|
|
101
|
+
const obj_contextId_union1_error = (() => {
|
|
102
|
+
if (obj_contextId !== null) {
|
|
103
|
+
return new TypeError('Expected "null" but received "' + typeof obj_contextId + '" (at "' + path_contextId + '")');
|
|
104
|
+
}
|
|
105
|
+
})();
|
|
106
|
+
if (obj_contextId_union1_error != null) {
|
|
107
|
+
obj_contextId_union1 = obj_contextId_union1_error.message;
|
|
108
|
+
}
|
|
109
|
+
if (obj_contextId_union0 && obj_contextId_union1) {
|
|
110
|
+
let message = 'Object doesn\'t match union (at "' + path_contextId + '")';
|
|
111
|
+
message += '\n' + obj_contextId_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
112
|
+
message += '\n' + obj_contextId_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
113
|
+
return new TypeError(message);
|
|
114
|
+
}
|
|
115
|
+
const obj_correlationId = obj.correlationId;
|
|
116
|
+
const path_correlationId = path + '.correlationId';
|
|
117
|
+
let obj_correlationId_union0 = null;
|
|
118
|
+
const obj_correlationId_union0_error = (() => {
|
|
119
|
+
if (typeof obj_correlationId !== 'string') {
|
|
120
|
+
return new TypeError('Expected "string" but received "' + typeof obj_correlationId + '" (at "' + path_correlationId + '")');
|
|
121
|
+
}
|
|
122
|
+
})();
|
|
123
|
+
if (obj_correlationId_union0_error != null) {
|
|
124
|
+
obj_correlationId_union0 = obj_correlationId_union0_error.message;
|
|
125
|
+
}
|
|
126
|
+
let obj_correlationId_union1 = null;
|
|
127
|
+
const obj_correlationId_union1_error = (() => {
|
|
128
|
+
if (obj_correlationId !== null) {
|
|
129
|
+
return new TypeError('Expected "null" but received "' + typeof obj_correlationId + '" (at "' + path_correlationId + '")');
|
|
130
|
+
}
|
|
131
|
+
})();
|
|
132
|
+
if (obj_correlationId_union1_error != null) {
|
|
133
|
+
obj_correlationId_union1 = obj_correlationId_union1_error.message;
|
|
134
|
+
}
|
|
135
|
+
if (obj_correlationId_union0 && obj_correlationId_union1) {
|
|
136
|
+
let message = 'Object doesn\'t match union (at "' + path_correlationId + '")';
|
|
137
|
+
message += '\n' + obj_correlationId_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
138
|
+
message += '\n' + obj_correlationId_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
139
|
+
return new TypeError(message);
|
|
140
|
+
}
|
|
141
|
+
const obj_records = obj.records;
|
|
142
|
+
const path_records = path + '.records';
|
|
143
|
+
if (!ArrayIsArray(obj_records)) {
|
|
144
|
+
return new TypeError('Expected "array" but received "' + typeof obj_records + '" (at "' + path_records + '")');
|
|
145
|
+
}
|
|
146
|
+
for (let i = 0; i < obj_records.length; i++) {
|
|
147
|
+
const obj_records_item = obj_records[i];
|
|
148
|
+
const path_records_item = path_records + '[' + i + ']';
|
|
149
|
+
if (typeof obj_records_item !== 'object' || ArrayIsArray(obj_records_item) || obj_records_item === null) {
|
|
150
|
+
return new TypeError('Expected "object" but received "' + typeof obj_records_item + '" (at "' + path_records_item + '")');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (obj.requestScope !== undefined) {
|
|
154
|
+
const obj_requestScope = obj.requestScope;
|
|
155
|
+
const path_requestScope = path + '.requestScope';
|
|
156
|
+
if (typeof obj_requestScope !== 'boolean') {
|
|
157
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_requestScope + '" (at "' + path_requestScope + '")');
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
})();
|
|
161
|
+
return v_error === undefined ? null : v_error;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const TTL = 1000;
|
|
165
|
+
const VERSION = "1fc110cb13491550fd57015dbe2f752e";
|
|
166
|
+
function validate(obj, path = 'GetInstantPricingOutputRepresentation') {
|
|
167
|
+
const v_error = (() => {
|
|
168
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
169
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
170
|
+
}
|
|
171
|
+
const obj_contextId = obj.contextId;
|
|
172
|
+
const path_contextId = path + '.contextId';
|
|
173
|
+
let obj_contextId_union0 = null;
|
|
174
|
+
const obj_contextId_union0_error = (() => {
|
|
175
|
+
if (typeof obj_contextId !== 'string') {
|
|
176
|
+
return new TypeError('Expected "string" but received "' + typeof obj_contextId + '" (at "' + path_contextId + '")');
|
|
177
|
+
}
|
|
178
|
+
})();
|
|
179
|
+
if (obj_contextId_union0_error != null) {
|
|
180
|
+
obj_contextId_union0 = obj_contextId_union0_error.message;
|
|
181
|
+
}
|
|
182
|
+
let obj_contextId_union1 = null;
|
|
183
|
+
const obj_contextId_union1_error = (() => {
|
|
184
|
+
if (obj_contextId !== null) {
|
|
185
|
+
return new TypeError('Expected "null" but received "' + typeof obj_contextId + '" (at "' + path_contextId + '")');
|
|
186
|
+
}
|
|
187
|
+
})();
|
|
188
|
+
if (obj_contextId_union1_error != null) {
|
|
189
|
+
obj_contextId_union1 = obj_contextId_union1_error.message;
|
|
190
|
+
}
|
|
191
|
+
if (obj_contextId_union0 && obj_contextId_union1) {
|
|
192
|
+
let message = 'Object doesn\'t match union (at "' + path_contextId + '")';
|
|
193
|
+
message += '\n' + obj_contextId_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
194
|
+
message += '\n' + obj_contextId_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
195
|
+
return new TypeError(message);
|
|
196
|
+
}
|
|
197
|
+
const obj_correlationId = obj.correlationId;
|
|
198
|
+
const path_correlationId = path + '.correlationId';
|
|
199
|
+
let obj_correlationId_union0 = null;
|
|
200
|
+
const obj_correlationId_union0_error = (() => {
|
|
201
|
+
if (typeof obj_correlationId !== 'string') {
|
|
202
|
+
return new TypeError('Expected "string" but received "' + typeof obj_correlationId + '" (at "' + path_correlationId + '")');
|
|
203
|
+
}
|
|
204
|
+
})();
|
|
205
|
+
if (obj_correlationId_union0_error != null) {
|
|
206
|
+
obj_correlationId_union0 = obj_correlationId_union0_error.message;
|
|
207
|
+
}
|
|
208
|
+
let obj_correlationId_union1 = null;
|
|
209
|
+
const obj_correlationId_union1_error = (() => {
|
|
210
|
+
if (obj_correlationId !== null) {
|
|
211
|
+
return new TypeError('Expected "null" but received "' + typeof obj_correlationId + '" (at "' + path_correlationId + '")');
|
|
212
|
+
}
|
|
213
|
+
})();
|
|
214
|
+
if (obj_correlationId_union1_error != null) {
|
|
215
|
+
obj_correlationId_union1 = obj_correlationId_union1_error.message;
|
|
216
|
+
}
|
|
217
|
+
if (obj_correlationId_union0 && obj_correlationId_union1) {
|
|
218
|
+
let message = 'Object doesn\'t match union (at "' + path_correlationId + '")';
|
|
219
|
+
message += '\n' + obj_correlationId_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
220
|
+
message += '\n' + obj_correlationId_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
221
|
+
return new TypeError(message);
|
|
222
|
+
}
|
|
223
|
+
const obj_records = obj.records;
|
|
224
|
+
const path_records = path + '.records';
|
|
225
|
+
if (!ArrayIsArray(obj_records)) {
|
|
226
|
+
return new TypeError('Expected "array" but received "' + typeof obj_records + '" (at "' + path_records + '")');
|
|
227
|
+
}
|
|
228
|
+
for (let i = 0; i < obj_records.length; i++) {
|
|
229
|
+
const obj_records_item = obj_records[i];
|
|
230
|
+
const path_records_item = path_records + '[' + i + ']';
|
|
231
|
+
if (typeof obj_records_item !== 'object' || ArrayIsArray(obj_records_item) || obj_records_item === null) {
|
|
232
|
+
return new TypeError('Expected "object" but received "' + typeof obj_records_item + '" (at "' + path_records_item + '")');
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
const obj_success = obj.success;
|
|
236
|
+
const path_success = path + '.success';
|
|
237
|
+
if (typeof obj_success !== 'boolean') {
|
|
238
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_success + '" (at "' + path_success + '")');
|
|
239
|
+
}
|
|
240
|
+
})();
|
|
241
|
+
return v_error === undefined ? null : v_error;
|
|
242
|
+
}
|
|
243
|
+
const RepresentationType = 'GetInstantPricingOutputRepresentation';
|
|
244
|
+
function keyBuilder(luvio, config) {
|
|
245
|
+
return keyPrefix + '::' + RepresentationType + ':' + (config.contextId === null ? '' : config.contextId);
|
|
246
|
+
}
|
|
247
|
+
function keyBuilderFromType(luvio, object) {
|
|
248
|
+
const keyParams = {
|
|
249
|
+
contextId: object.contextId
|
|
250
|
+
};
|
|
251
|
+
return keyBuilder(luvio, keyParams);
|
|
252
|
+
}
|
|
253
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
254
|
+
return input;
|
|
255
|
+
}
|
|
256
|
+
const select$1 = function GetInstantPricingOutputRepresentationSelect() {
|
|
257
|
+
return {
|
|
258
|
+
kind: 'Fragment',
|
|
259
|
+
version: VERSION,
|
|
260
|
+
private: [],
|
|
261
|
+
opaque: true
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
function equals(existing, incoming) {
|
|
265
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
const ingest = function GetInstantPricingOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
271
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
272
|
+
const validateError = validate(input);
|
|
273
|
+
if (validateError !== null) {
|
|
274
|
+
throw validateError;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
const key = keyBuilderFromType(luvio, input);
|
|
278
|
+
const ttlToUse = TTL;
|
|
279
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "instant-pricing", VERSION, RepresentationType, equals);
|
|
280
|
+
return createLink(key);
|
|
281
|
+
};
|
|
282
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
283
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
284
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
285
|
+
rootKeySet.set(rootKey, {
|
|
286
|
+
namespace: keyPrefix,
|
|
287
|
+
representationName: RepresentationType,
|
|
288
|
+
mergeable: false
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function select(luvio, params) {
|
|
293
|
+
return select$1();
|
|
294
|
+
}
|
|
295
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
296
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
297
|
+
}
|
|
298
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
299
|
+
const { body } = response;
|
|
300
|
+
const key = keyBuilderFromType(luvio, body);
|
|
301
|
+
luvio.storeIngest(key, ingest, body);
|
|
302
|
+
const snapshot = luvio.storeLookup({
|
|
303
|
+
recordId: key,
|
|
304
|
+
node: select(),
|
|
305
|
+
variables: {},
|
|
306
|
+
});
|
|
307
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
308
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
309
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
deepFreeze(snapshot.data);
|
|
313
|
+
return snapshot;
|
|
314
|
+
}
|
|
315
|
+
function createResourceRequest(config) {
|
|
316
|
+
const headers = {};
|
|
317
|
+
return {
|
|
318
|
+
baseUri: '/services/data/v66.0',
|
|
319
|
+
basePath: '/industries/cpq/quotes/actions/get-instant-price',
|
|
320
|
+
method: 'post',
|
|
321
|
+
body: config.body,
|
|
322
|
+
urlParams: {},
|
|
323
|
+
queryParams: {},
|
|
324
|
+
headers,
|
|
325
|
+
priority: 'normal',
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
const adapterName = 'instantPricing';
|
|
330
|
+
const instantPricing_ConfigPropertyMetadata = [
|
|
331
|
+
generateParamConfigMetadata('getInstantPricingRequestPayload', true, 2 /* Body */, 4 /* Unsupported */),
|
|
332
|
+
];
|
|
333
|
+
const instantPricing_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, instantPricing_ConfigPropertyMetadata);
|
|
334
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$1(instantPricing_ConfigPropertyMetadata);
|
|
335
|
+
function typeCheckConfig(untrustedConfig) {
|
|
336
|
+
const config = {};
|
|
337
|
+
const untrustedConfig_getInstantPricingRequestPayload = untrustedConfig.getInstantPricingRequestPayload;
|
|
338
|
+
const referenceGetInstantPricingInputRepresentationValidationError = validate$1(untrustedConfig_getInstantPricingRequestPayload);
|
|
339
|
+
if (referenceGetInstantPricingInputRepresentationValidationError === null) {
|
|
340
|
+
config.getInstantPricingRequestPayload = untrustedConfig_getInstantPricingRequestPayload;
|
|
341
|
+
}
|
|
342
|
+
return config;
|
|
343
|
+
}
|
|
344
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
345
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
346
|
+
return null;
|
|
347
|
+
}
|
|
348
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
349
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
350
|
+
}
|
|
351
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
352
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
353
|
+
return null;
|
|
354
|
+
}
|
|
355
|
+
return config;
|
|
356
|
+
}
|
|
357
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
358
|
+
const resourceParams = createResourceParams(config);
|
|
359
|
+
const request = createResourceRequest(resourceParams);
|
|
360
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
361
|
+
.then((response) => {
|
|
362
|
+
return luvio.handleSuccessResponse(() => {
|
|
363
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
364
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
365
|
+
}, () => {
|
|
366
|
+
const cache = new StoreKeyMap();
|
|
367
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
368
|
+
return cache;
|
|
369
|
+
});
|
|
370
|
+
}, (response) => {
|
|
371
|
+
deepFreeze(response);
|
|
372
|
+
throw response;
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
const instantPricingAdapterFactory = (luvio) => {
|
|
376
|
+
return function instantPricing(untrustedConfig) {
|
|
377
|
+
const config = validateAdapterConfig(untrustedConfig, instantPricing_ConfigPropertyNames);
|
|
378
|
+
// Invalid or incomplete config
|
|
379
|
+
if (config === null) {
|
|
380
|
+
throw new Error('Invalid config for "instantPricing"');
|
|
381
|
+
}
|
|
382
|
+
return buildNetworkSnapshot(luvio, config);
|
|
383
|
+
};
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
let instantPricing;
|
|
387
|
+
// Notify Update Available
|
|
388
|
+
function bindExportsTo(luvio) {
|
|
389
|
+
// LDS Adapters
|
|
390
|
+
function unwrapSnapshotData(factory) {
|
|
391
|
+
const adapter = factory(luvio);
|
|
392
|
+
return (config) => adapter(config).then((snapshot) => snapshot.data);
|
|
393
|
+
}
|
|
394
|
+
return {
|
|
395
|
+
instantPricing: unwrapSnapshotData(instantPricingAdapterFactory),
|
|
396
|
+
// Imperative GET Adapters
|
|
397
|
+
// Notify Update Availables
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
withDefaultLuvio((luvio) => {
|
|
401
|
+
({ instantPricing } = bindExportsTo(luvio));
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
export { instantPricing };
|
|
405
|
+
// version: 0.1.0-dev1-c978a7b010
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#%RAML 1.0
|
|
2
|
+
securedBy:
|
|
3
|
+
- OAuth2
|
|
4
|
+
title: Salesforce Connect API
|
|
5
|
+
version: '59.0'
|
|
6
|
+
mediaType: application/json
|
|
7
|
+
protocols:
|
|
8
|
+
- https
|
|
9
|
+
baseUri: /services/data/v66.0
|
|
10
|
+
securitySchemes:
|
|
11
|
+
OAuth2:
|
|
12
|
+
type: OAuth 2.0
|
|
13
|
+
settings:
|
|
14
|
+
authorizationUri: https://example.com/oauth/authorize
|
|
15
|
+
accessTokenUri: ''
|
|
16
|
+
authorizationGrants:
|
|
17
|
+
- implicit
|
|
18
|
+
annotationTypes:
|
|
19
|
+
oas-readOnly:
|
|
20
|
+
type: boolean
|
|
21
|
+
allowedTargets: TypeDeclaration
|
|
22
|
+
oas-collectionFormat:
|
|
23
|
+
type: string
|
|
24
|
+
oas-body-name:
|
|
25
|
+
type: string
|
|
26
|
+
allowedTargets: TypeDeclaration
|
|
27
|
+
types:
|
|
28
|
+
InstantPricingInputWrapperRepresentation: # TODO hand rolled. W-13153901
|
|
29
|
+
description: Wrapper for instant pricing input representation
|
|
30
|
+
type: object
|
|
31
|
+
properties:
|
|
32
|
+
getInstantPricingRequestPayload: # TODO hand rolled. W-13153901
|
|
33
|
+
type: GetInstantPricingInputRepresentation
|
|
34
|
+
description: Instant Pricing Input Representation
|
|
35
|
+
GetInstantPricingInputRepresentation:
|
|
36
|
+
description: Input Representation for Get Instant pricing.
|
|
37
|
+
type: object
|
|
38
|
+
properties:
|
|
39
|
+
contextId:
|
|
40
|
+
description: Context Id
|
|
41
|
+
type: string | nil
|
|
42
|
+
correlationId:
|
|
43
|
+
description: Correlation Id
|
|
44
|
+
type: string | nil
|
|
45
|
+
records:
|
|
46
|
+
description: Input Object
|
|
47
|
+
type: array
|
|
48
|
+
items:
|
|
49
|
+
type: object
|
|
50
|
+
requestScope:
|
|
51
|
+
description: Context Data Persistence Scope
|
|
52
|
+
type: boolean
|
|
53
|
+
required: false
|
|
54
|
+
GetInstantPricingOutputRepresentation:
|
|
55
|
+
description: Output representation for Instant Pricing API
|
|
56
|
+
type: object
|
|
57
|
+
properties:
|
|
58
|
+
contextId:
|
|
59
|
+
description: Context Id
|
|
60
|
+
type: string | nil
|
|
61
|
+
correlationId:
|
|
62
|
+
description: CorrelationId
|
|
63
|
+
type: string | nil
|
|
64
|
+
records:
|
|
65
|
+
description: Records
|
|
66
|
+
type: array
|
|
67
|
+
items:
|
|
68
|
+
type: object # TODO hand rolled. W-13153901
|
|
69
|
+
success:
|
|
70
|
+
description: success
|
|
71
|
+
type: boolean
|
|
72
|
+
|
|
73
|
+
# TODO hand rolled. W-13153901
|
|
74
|
+
/industries/cpq/quotes/actions/get-instant-price:
|
|
75
|
+
post:
|
|
76
|
+
displayName: postGetInstantPricing
|
|
77
|
+
description: Get Instant pricing object
|
|
78
|
+
responses:
|
|
79
|
+
'200':
|
|
80
|
+
description: Success
|
|
81
|
+
body:
|
|
82
|
+
application/json:
|
|
83
|
+
type: GetInstantPricingOutputRepresentation
|
|
84
|
+
body:
|
|
85
|
+
application/json:
|
|
86
|
+
type: InstantPricingInputWrapperRepresentation
|
|
87
|
+
# TODO hand rolled. W-13153901
|
|
88
|
+
(oas-body-name): getInstantPricingRequestPayload
|