@salesforce/lds-adapters-platform-flow 1.124.2 → 1.124.3
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/dist/es/es2018/platform-flow.js +540 -540
- package/dist/{types → es/es2018/types}/src/adapters/navigateFlow.d.ts +6 -6
- package/dist/{types → es/es2018/types}/src/adapters/resumeFlow.d.ts +6 -6
- package/dist/{types → es/es2018/types}/src/adapters/startFlow.d.ts +6 -6
- package/dist/{types/src/generated → es/es2018/types/src}/artifacts/main.d.ts +3 -3
- package/dist/{types → es/es2018/types}/src/artifacts/sfdc.d.ts +4 -4
- package/dist/{types → es/es2018/types}/src/generated/adapters/adapter-utils.d.ts +66 -66
- package/dist/{types → es/es2018/types}/src/generated/adapters/navigateFlow.d.ts +27 -27
- package/dist/{types → es/es2018/types}/src/generated/adapters/resumeFlow.d.ts +26 -26
- package/dist/{types → es/es2018/types}/src/generated/adapters/startFlow.d.ts +31 -31
- package/dist/{types/src → es/es2018/types/src/generated}/artifacts/main.d.ts +3 -3
- package/dist/{types → es/es2018/types}/src/generated/artifacts/sfdc.d.ts +7 -7
- package/dist/{types → es/es2018/types}/src/generated/resources/postConnectInteractionRuntimeNavigateFlow.d.ts +16 -16
- package/dist/{types → es/es2018/types}/src/generated/resources/postConnectInteractionRuntimeResumeFlow.d.ts +15 -15
- package/dist/{types → es/es2018/types}/src/generated/resources/postConnectInteractionRuntimeStartFlow.d.ts +20 -20
- package/dist/{types → es/es2018/types}/src/generated/types/FlowRuntimeHashbagRepresentation.d.ts +28 -28
- package/dist/{types → es/es2018/types}/src/generated/types/FlowRuntimeNavigateFlowRepresentation.d.ts +40 -40
- package/dist/{types → es/es2018/types}/src/generated/types/FlowRuntimeNavigateFlowWrapperRepresentation.d.ts +29 -29
- package/dist/{types → es/es2018/types}/src/generated/types/FlowRuntimeNavigationFieldValue.d.ts +32 -32
- package/dist/{types → es/es2018/types}/src/generated/types/FlowRuntimeNavigationResult.d.ts +28 -28
- package/dist/{types → es/es2018/types}/src/generated/types/FlowRuntimeResponseRepresentation.d.ts +31 -31
- package/dist/{types → es/es2018/types}/src/generated/types/FlowRuntimeResumeFlowRepresentation.d.ts +28 -28
- package/dist/{types → es/es2018/types}/src/generated/types/FlowRuntimeRunFlowRepresentation.d.ts +38 -38
- package/dist/{types → es/es2018/types}/src/generated/types/type-utils.d.ts +39 -39
- package/package.json +5 -5
- package/sfdc/index.d.ts +1 -1
- package/sfdc/index.js +556 -556
- package/dist/umd/es2018/platform-flow.js +0 -591
- package/dist/umd/es5/platform-flow.js +0 -600
|
@@ -6,576 +6,576 @@
|
|
|
6
6
|
|
|
7
7
|
import { StoreKeyMap } from '@luvio/engine';
|
|
8
8
|
|
|
9
|
-
const { freeze: ObjectFreeze$1, keys: ObjectKeys$1, create: ObjectCreate$1, assign: ObjectAssign } = Object;
|
|
10
|
-
const { isArray: ArrayIsArray$1 } = Array;
|
|
11
|
-
function deepFreeze$2(value) {
|
|
12
|
-
// No need to freeze primitives
|
|
13
|
-
if (typeof value !== 'object' || value === null) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
if (ArrayIsArray$1(value)) {
|
|
17
|
-
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
18
|
-
deepFreeze$2(value[i]);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
const keys = ObjectKeys$1(value);
|
|
23
|
-
for (let i = 0, len = keys.length; i < len; i += 1) {
|
|
24
|
-
deepFreeze$2(value[keys[i]]);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
ObjectFreeze$1(value);
|
|
9
|
+
const { freeze: ObjectFreeze$1, keys: ObjectKeys$1, create: ObjectCreate$1, assign: ObjectAssign } = Object;
|
|
10
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
11
|
+
function deepFreeze$2(value) {
|
|
12
|
+
// No need to freeze primitives
|
|
13
|
+
if (typeof value !== 'object' || value === null) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (ArrayIsArray$1(value)) {
|
|
17
|
+
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
18
|
+
deepFreeze$2(value[i]);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
const keys = ObjectKeys$1(value);
|
|
23
|
+
for (let i = 0, len = keys.length; i < len; i += 1) {
|
|
24
|
+
deepFreeze$2(value[keys[i]]);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
ObjectFreeze$1(value);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
31
|
-
const { keys: ObjectKeys, freeze: ObjectFreeze, create: ObjectCreate } = Object;
|
|
32
|
-
const { stringify: JSONStringify } = JSON;
|
|
33
|
-
const { isArray: ArrayIsArray } = Array;
|
|
34
|
-
/**
|
|
35
|
-
* Validates an adapter config is well-formed.
|
|
36
|
-
* @param config The config to validate.
|
|
37
|
-
* @param adapter The adapter validation configuration.
|
|
38
|
-
* @param oneOf The keys the config must contain at least one of.
|
|
39
|
-
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
40
|
-
*/
|
|
41
|
-
function validateConfig(config, adapter, oneOf) {
|
|
42
|
-
const { displayName } = adapter;
|
|
43
|
-
const { required, optional, unsupported } = adapter.parameters;
|
|
44
|
-
if (config === undefined ||
|
|
45
|
-
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
46
|
-
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
47
|
-
}
|
|
48
|
-
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
49
|
-
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
50
|
-
}
|
|
51
|
-
if (unsupported !== undefined &&
|
|
52
|
-
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
53
|
-
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
54
|
-
}
|
|
55
|
-
const supported = required.concat(optional);
|
|
56
|
-
if (ObjectKeys(config).some(key => !supported.includes(key))) {
|
|
57
|
-
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function untrustedIsObject(untrusted) {
|
|
61
|
-
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray(untrusted) === false;
|
|
62
|
-
}
|
|
63
|
-
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
64
|
-
return configPropertyNames.parameters.required.every(req => req in config);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* A deterministic JSON stringify implementation. Heavily adapted from https://github.com/epoberezkin/fast-json-stable-stringify.
|
|
68
|
-
* This is needed because insertion order for JSON.stringify(object) affects output:
|
|
69
|
-
* JSON.stringify({a: 1, b: 2})
|
|
70
|
-
* "{"a":1,"b":2}"
|
|
71
|
-
* JSON.stringify({b: 2, a: 1})
|
|
72
|
-
* "{"b":2,"a":1}"
|
|
73
|
-
* @param data Data to be JSON-stringified.
|
|
74
|
-
* @returns JSON.stringified value with consistent ordering of keys.
|
|
75
|
-
*/
|
|
76
|
-
function stableJSONStringify(node) {
|
|
77
|
-
// This is for Date values.
|
|
78
|
-
if (node && node.toJSON && typeof node.toJSON === 'function') {
|
|
79
|
-
// eslint-disable-next-line no-param-reassign
|
|
80
|
-
node = node.toJSON();
|
|
81
|
-
}
|
|
82
|
-
if (node === undefined) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
if (typeof node === 'number') {
|
|
86
|
-
return isFinite(node) ? '' + node : 'null';
|
|
87
|
-
}
|
|
88
|
-
if (typeof node !== 'object') {
|
|
89
|
-
return JSONStringify(node);
|
|
90
|
-
}
|
|
91
|
-
let i;
|
|
92
|
-
let out;
|
|
93
|
-
if (ArrayIsArray(node)) {
|
|
94
|
-
out = '[';
|
|
95
|
-
for (i = 0; i < node.length; i++) {
|
|
96
|
-
if (i) {
|
|
97
|
-
out += ',';
|
|
98
|
-
}
|
|
99
|
-
out += stableJSONStringify(node[i]) || 'null';
|
|
100
|
-
}
|
|
101
|
-
return out + ']';
|
|
102
|
-
}
|
|
103
|
-
if (node === null) {
|
|
104
|
-
return 'null';
|
|
105
|
-
}
|
|
106
|
-
const keys = ObjectKeys(node).sort();
|
|
107
|
-
out = '';
|
|
108
|
-
for (i = 0; i < keys.length; i++) {
|
|
109
|
-
const key = keys[i];
|
|
110
|
-
const value = stableJSONStringify(node[key]);
|
|
111
|
-
if (!value) {
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
if (out) {
|
|
115
|
-
out += ',';
|
|
116
|
-
}
|
|
117
|
-
out += JSONStringify(key) + ':' + value;
|
|
118
|
-
}
|
|
119
|
-
return '{' + out + '}';
|
|
120
|
-
}
|
|
30
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
31
|
+
const { keys: ObjectKeys, freeze: ObjectFreeze, create: ObjectCreate } = Object;
|
|
32
|
+
const { stringify: JSONStringify } = JSON;
|
|
33
|
+
const { isArray: ArrayIsArray } = Array;
|
|
34
|
+
/**
|
|
35
|
+
* Validates an adapter config is well-formed.
|
|
36
|
+
* @param config The config to validate.
|
|
37
|
+
* @param adapter The adapter validation configuration.
|
|
38
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
39
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
40
|
+
*/
|
|
41
|
+
function validateConfig(config, adapter, oneOf) {
|
|
42
|
+
const { displayName } = adapter;
|
|
43
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
44
|
+
if (config === undefined ||
|
|
45
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
46
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
47
|
+
}
|
|
48
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
49
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
50
|
+
}
|
|
51
|
+
if (unsupported !== undefined &&
|
|
52
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
53
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
54
|
+
}
|
|
55
|
+
const supported = required.concat(optional);
|
|
56
|
+
if (ObjectKeys(config).some(key => !supported.includes(key))) {
|
|
57
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function untrustedIsObject(untrusted) {
|
|
61
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray(untrusted) === false;
|
|
62
|
+
}
|
|
63
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
64
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A deterministic JSON stringify implementation. Heavily adapted from https://github.com/epoberezkin/fast-json-stable-stringify.
|
|
68
|
+
* This is needed because insertion order for JSON.stringify(object) affects output:
|
|
69
|
+
* JSON.stringify({a: 1, b: 2})
|
|
70
|
+
* "{"a":1,"b":2}"
|
|
71
|
+
* JSON.stringify({b: 2, a: 1})
|
|
72
|
+
* "{"b":2,"a":1}"
|
|
73
|
+
* @param data Data to be JSON-stringified.
|
|
74
|
+
* @returns JSON.stringified value with consistent ordering of keys.
|
|
75
|
+
*/
|
|
76
|
+
function stableJSONStringify(node) {
|
|
77
|
+
// This is for Date values.
|
|
78
|
+
if (node && node.toJSON && typeof node.toJSON === 'function') {
|
|
79
|
+
// eslint-disable-next-line no-param-reassign
|
|
80
|
+
node = node.toJSON();
|
|
81
|
+
}
|
|
82
|
+
if (node === undefined) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (typeof node === 'number') {
|
|
86
|
+
return isFinite(node) ? '' + node : 'null';
|
|
87
|
+
}
|
|
88
|
+
if (typeof node !== 'object') {
|
|
89
|
+
return JSONStringify(node);
|
|
90
|
+
}
|
|
91
|
+
let i;
|
|
92
|
+
let out;
|
|
93
|
+
if (ArrayIsArray(node)) {
|
|
94
|
+
out = '[';
|
|
95
|
+
for (i = 0; i < node.length; i++) {
|
|
96
|
+
if (i) {
|
|
97
|
+
out += ',';
|
|
98
|
+
}
|
|
99
|
+
out += stableJSONStringify(node[i]) || 'null';
|
|
100
|
+
}
|
|
101
|
+
return out + ']';
|
|
102
|
+
}
|
|
103
|
+
if (node === null) {
|
|
104
|
+
return 'null';
|
|
105
|
+
}
|
|
106
|
+
const keys = ObjectKeys(node).sort();
|
|
107
|
+
out = '';
|
|
108
|
+
for (i = 0; i < keys.length; i++) {
|
|
109
|
+
const key = keys[i];
|
|
110
|
+
const value = stableJSONStringify(node[key]);
|
|
111
|
+
if (!value) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (out) {
|
|
115
|
+
out += ',';
|
|
116
|
+
}
|
|
117
|
+
out += JSONStringify(key) + ':' + value;
|
|
118
|
+
}
|
|
119
|
+
return '{' + out + '}';
|
|
120
|
+
}
|
|
121
121
|
const keyPrefix = 'FlowRuntime';
|
|
122
122
|
|
|
123
|
-
function deepFreeze$1(input) {
|
|
124
|
-
const input_keys = Object.keys(input);
|
|
125
|
-
const input_length = input_keys.length;
|
|
126
|
-
for (let i = 0; i < input_length; i++) {
|
|
127
|
-
const key = input_keys[i];
|
|
128
|
-
const input_prop = input[key];
|
|
129
|
-
deepFreeze$2(input_prop);
|
|
130
|
-
}
|
|
131
|
-
ObjectFreeze$1(input);
|
|
123
|
+
function deepFreeze$1(input) {
|
|
124
|
+
const input_keys = Object.keys(input);
|
|
125
|
+
const input_length = input_keys.length;
|
|
126
|
+
for (let i = 0; i < input_length; i++) {
|
|
127
|
+
const key = input_keys[i];
|
|
128
|
+
const input_prop = input[key];
|
|
129
|
+
deepFreeze$2(input_prop);
|
|
130
|
+
}
|
|
131
|
+
ObjectFreeze$1(input);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
const RepresentationType = 'FlowRuntimeResponseRepresentation';
|
|
135
|
-
function deepFreeze(input) {
|
|
136
|
-
const input_error = input.error;
|
|
137
|
-
if (input_error !== undefined) {
|
|
138
|
-
deepFreeze$2(input_error);
|
|
139
|
-
}
|
|
140
|
-
const input_response = input.response;
|
|
141
|
-
if (input_response !== undefined) {
|
|
142
|
-
if (input_response !== null && typeof input_response === 'object') {
|
|
143
|
-
deepFreeze$1(input_response);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
ObjectFreeze$1(input);
|
|
147
|
-
}
|
|
148
|
-
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
149
|
-
const rootKeySet = new StoreKeyMap();
|
|
150
|
-
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
151
|
-
const rootKey = fullPathFactory();
|
|
152
|
-
rootKeySet.set(rootKey, {
|
|
153
|
-
namespace: keyPrefix,
|
|
154
|
-
representationName: RepresentationType,
|
|
155
|
-
mergeable: false
|
|
156
|
-
});
|
|
157
|
-
return rootKeySet;
|
|
134
|
+
const RepresentationType = 'FlowRuntimeResponseRepresentation';
|
|
135
|
+
function deepFreeze(input) {
|
|
136
|
+
const input_error = input.error;
|
|
137
|
+
if (input_error !== undefined) {
|
|
138
|
+
deepFreeze$2(input_error);
|
|
139
|
+
}
|
|
140
|
+
const input_response = input.response;
|
|
141
|
+
if (input_response !== undefined) {
|
|
142
|
+
if (input_response !== null && typeof input_response === 'object') {
|
|
143
|
+
deepFreeze$1(input_response);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
ObjectFreeze$1(input);
|
|
147
|
+
}
|
|
148
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
149
|
+
const rootKeySet = new StoreKeyMap();
|
|
150
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
151
|
+
const rootKey = fullPathFactory();
|
|
152
|
+
rootKeySet.set(rootKey, {
|
|
153
|
+
namespace: keyPrefix,
|
|
154
|
+
representationName: RepresentationType,
|
|
155
|
+
mergeable: false
|
|
156
|
+
});
|
|
157
|
+
return rootKeySet;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
function keyBuilder$2(luvio, params) {
|
|
161
|
-
return keyPrefix + '::FlowRuntimeResponseRepresentation:(' + 'flowDevName:' + params.body.flowDevName + '::' + (params.body.flowVersionId === undefined ? 'flowVersionId' : 'flowVersionId:' + params.body.flowVersionId) + '::' + (params.body.arguments === undefined ? 'arguments' : 'arguments:' + params.body.arguments) + '::' + (params.body.enableTrace === undefined ? 'enableTrace' : 'enableTrace:' + params.body.enableTrace) + '::' + (params.body.enableRollbackMode === undefined ? 'enableRollbackMode' : 'enableRollbackMode:' + params.body.enableRollbackMode) + '::' + (params.body.debugAsUserId === undefined ? 'debugAsUserId' : 'debugAsUserId:' + params.body.debugAsUserId) + ')';
|
|
162
|
-
}
|
|
163
|
-
function getResponseCacheKeys$2(luvio, resourceParams, response) {
|
|
164
|
-
return getTypeCacheKeys(luvio, response, () => keyBuilder$2(luvio, resourceParams));
|
|
165
|
-
}
|
|
166
|
-
function createResourceRequest$2(config) {
|
|
167
|
-
const headers = {};
|
|
168
|
-
return {
|
|
169
|
-
baseUri: '/services/data/v58.0',
|
|
170
|
-
basePath: '/connect/interaction/runtime/startFlow',
|
|
171
|
-
method: 'post',
|
|
172
|
-
body: config.body,
|
|
173
|
-
urlParams: {},
|
|
174
|
-
queryParams: {},
|
|
175
|
-
headers,
|
|
176
|
-
priority: 'normal',
|
|
177
|
-
};
|
|
160
|
+
function keyBuilder$2(luvio, params) {
|
|
161
|
+
return keyPrefix + '::FlowRuntimeResponseRepresentation:(' + 'flowDevName:' + params.body.flowDevName + '::' + (params.body.flowVersionId === undefined ? 'flowVersionId' : 'flowVersionId:' + params.body.flowVersionId) + '::' + (params.body.arguments === undefined ? 'arguments' : 'arguments:' + params.body.arguments) + '::' + (params.body.enableTrace === undefined ? 'enableTrace' : 'enableTrace:' + params.body.enableTrace) + '::' + (params.body.enableRollbackMode === undefined ? 'enableRollbackMode' : 'enableRollbackMode:' + params.body.enableRollbackMode) + '::' + (params.body.debugAsUserId === undefined ? 'debugAsUserId' : 'debugAsUserId:' + params.body.debugAsUserId) + ')';
|
|
162
|
+
}
|
|
163
|
+
function getResponseCacheKeys$2(luvio, resourceParams, response) {
|
|
164
|
+
return getTypeCacheKeys(luvio, response, () => keyBuilder$2(luvio, resourceParams));
|
|
165
|
+
}
|
|
166
|
+
function createResourceRequest$2(config) {
|
|
167
|
+
const headers = {};
|
|
168
|
+
return {
|
|
169
|
+
baseUri: '/services/data/v58.0',
|
|
170
|
+
basePath: '/connect/interaction/runtime/startFlow',
|
|
171
|
+
method: 'post',
|
|
172
|
+
body: config.body,
|
|
173
|
+
urlParams: {},
|
|
174
|
+
queryParams: {},
|
|
175
|
+
headers,
|
|
176
|
+
priority: 'normal',
|
|
177
|
+
};
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
const startFlow_ConfigPropertyNames = {
|
|
181
|
-
displayName: 'startFlow',
|
|
182
|
-
parameters: {
|
|
183
|
-
required: ['flowDevName'],
|
|
184
|
-
optional: ['flowVersionId', 'arguments', 'enableTrace', 'enableRollbackMode', 'debugAsUserId']
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
function createResourceParams$2(config) {
|
|
188
|
-
const resourceParams = {
|
|
189
|
-
body: {
|
|
190
|
-
flowDevName: config.flowDevName
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
if (config['flowVersionId'] !== undefined) {
|
|
194
|
-
resourceParams.body['flowVersionId'] = config['flowVersionId'];
|
|
195
|
-
}
|
|
196
|
-
if (config['arguments'] !== undefined) {
|
|
197
|
-
resourceParams.body['arguments'] = config['arguments'];
|
|
198
|
-
}
|
|
199
|
-
if (config['enableTrace'] !== undefined) {
|
|
200
|
-
resourceParams.body['enableTrace'] = config['enableTrace'];
|
|
201
|
-
}
|
|
202
|
-
if (config['enableRollbackMode'] !== undefined) {
|
|
203
|
-
resourceParams.body['enableRollbackMode'] = config['enableRollbackMode'];
|
|
204
|
-
}
|
|
205
|
-
if (config['debugAsUserId'] !== undefined) {
|
|
206
|
-
resourceParams.body['debugAsUserId'] = config['debugAsUserId'];
|
|
207
|
-
}
|
|
208
|
-
return resourceParams;
|
|
209
|
-
}
|
|
210
|
-
function typeCheckConfig$2(untrustedConfig) {
|
|
211
|
-
const config = {};
|
|
212
|
-
const untrustedConfig_flowDevName = untrustedConfig.flowDevName;
|
|
213
|
-
if (typeof untrustedConfig_flowDevName === 'string') {
|
|
214
|
-
config.flowDevName = untrustedConfig_flowDevName;
|
|
215
|
-
}
|
|
216
|
-
const untrustedConfig_flowVersionId = untrustedConfig.flowVersionId;
|
|
217
|
-
if (typeof untrustedConfig_flowVersionId === 'string') {
|
|
218
|
-
config.flowVersionId = untrustedConfig_flowVersionId;
|
|
219
|
-
}
|
|
220
|
-
const untrustedConfig_arguments = untrustedConfig.arguments;
|
|
221
|
-
if (typeof untrustedConfig_arguments === 'string') {
|
|
222
|
-
config.arguments = untrustedConfig_arguments;
|
|
223
|
-
}
|
|
224
|
-
const untrustedConfig_enableTrace = untrustedConfig.enableTrace;
|
|
225
|
-
if (typeof untrustedConfig_enableTrace === 'boolean') {
|
|
226
|
-
config.enableTrace = untrustedConfig_enableTrace;
|
|
227
|
-
}
|
|
228
|
-
const untrustedConfig_enableRollbackMode = untrustedConfig.enableRollbackMode;
|
|
229
|
-
if (typeof untrustedConfig_enableRollbackMode === 'boolean') {
|
|
230
|
-
config.enableRollbackMode = untrustedConfig_enableRollbackMode;
|
|
231
|
-
}
|
|
232
|
-
const untrustedConfig_debugAsUserId = untrustedConfig.debugAsUserId;
|
|
233
|
-
if (typeof untrustedConfig_debugAsUserId === 'string') {
|
|
234
|
-
config.debugAsUserId = untrustedConfig_debugAsUserId;
|
|
235
|
-
}
|
|
236
|
-
return config;
|
|
237
|
-
}
|
|
238
|
-
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
239
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
240
|
-
return null;
|
|
241
|
-
}
|
|
242
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
243
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
244
|
-
}
|
|
245
|
-
const config = typeCheckConfig$2(untrustedConfig);
|
|
246
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
247
|
-
return null;
|
|
248
|
-
}
|
|
249
|
-
return config;
|
|
180
|
+
const startFlow_ConfigPropertyNames = {
|
|
181
|
+
displayName: 'startFlow',
|
|
182
|
+
parameters: {
|
|
183
|
+
required: ['flowDevName'],
|
|
184
|
+
optional: ['flowVersionId', 'arguments', 'enableTrace', 'enableRollbackMode', 'debugAsUserId']
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
function createResourceParams$2(config) {
|
|
188
|
+
const resourceParams = {
|
|
189
|
+
body: {
|
|
190
|
+
flowDevName: config.flowDevName
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
if (config['flowVersionId'] !== undefined) {
|
|
194
|
+
resourceParams.body['flowVersionId'] = config['flowVersionId'];
|
|
195
|
+
}
|
|
196
|
+
if (config['arguments'] !== undefined) {
|
|
197
|
+
resourceParams.body['arguments'] = config['arguments'];
|
|
198
|
+
}
|
|
199
|
+
if (config['enableTrace'] !== undefined) {
|
|
200
|
+
resourceParams.body['enableTrace'] = config['enableTrace'];
|
|
201
|
+
}
|
|
202
|
+
if (config['enableRollbackMode'] !== undefined) {
|
|
203
|
+
resourceParams.body['enableRollbackMode'] = config['enableRollbackMode'];
|
|
204
|
+
}
|
|
205
|
+
if (config['debugAsUserId'] !== undefined) {
|
|
206
|
+
resourceParams.body['debugAsUserId'] = config['debugAsUserId'];
|
|
207
|
+
}
|
|
208
|
+
return resourceParams;
|
|
209
|
+
}
|
|
210
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
211
|
+
const config = {};
|
|
212
|
+
const untrustedConfig_flowDevName = untrustedConfig.flowDevName;
|
|
213
|
+
if (typeof untrustedConfig_flowDevName === 'string') {
|
|
214
|
+
config.flowDevName = untrustedConfig_flowDevName;
|
|
215
|
+
}
|
|
216
|
+
const untrustedConfig_flowVersionId = untrustedConfig.flowVersionId;
|
|
217
|
+
if (typeof untrustedConfig_flowVersionId === 'string') {
|
|
218
|
+
config.flowVersionId = untrustedConfig_flowVersionId;
|
|
219
|
+
}
|
|
220
|
+
const untrustedConfig_arguments = untrustedConfig.arguments;
|
|
221
|
+
if (typeof untrustedConfig_arguments === 'string') {
|
|
222
|
+
config.arguments = untrustedConfig_arguments;
|
|
223
|
+
}
|
|
224
|
+
const untrustedConfig_enableTrace = untrustedConfig.enableTrace;
|
|
225
|
+
if (typeof untrustedConfig_enableTrace === 'boolean') {
|
|
226
|
+
config.enableTrace = untrustedConfig_enableTrace;
|
|
227
|
+
}
|
|
228
|
+
const untrustedConfig_enableRollbackMode = untrustedConfig.enableRollbackMode;
|
|
229
|
+
if (typeof untrustedConfig_enableRollbackMode === 'boolean') {
|
|
230
|
+
config.enableRollbackMode = untrustedConfig_enableRollbackMode;
|
|
231
|
+
}
|
|
232
|
+
const untrustedConfig_debugAsUserId = untrustedConfig.debugAsUserId;
|
|
233
|
+
if (typeof untrustedConfig_debugAsUserId === 'string') {
|
|
234
|
+
config.debugAsUserId = untrustedConfig_debugAsUserId;
|
|
235
|
+
}
|
|
236
|
+
return config;
|
|
237
|
+
}
|
|
238
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
239
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
243
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
244
|
+
}
|
|
245
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
246
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
return config;
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
253
|
-
const resourceParams = createResourceParams$2(config);
|
|
254
|
-
const request = createResourceRequest$2(resourceParams);
|
|
255
|
-
return luvio
|
|
256
|
-
.dispatchResourceRequest(request, options)
|
|
257
|
-
.then((response) => {
|
|
258
|
-
return luvio.handleSuccessResponse(() => {
|
|
259
|
-
deepFreeze(response.body);
|
|
260
|
-
return Promise.resolve(response.body);
|
|
261
|
-
}, () => {
|
|
262
|
-
return getResponseCacheKeys$2(luvio, resourceParams, response.body);
|
|
263
|
-
});
|
|
264
|
-
}, (response) => {
|
|
265
|
-
return luvio.handleErrorResponse(() => {
|
|
266
|
-
// We want to throw these exceptions to be caught in the runtime layer
|
|
267
|
-
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
268
|
-
throw new Error(response.body.message || response.body.error || response.body);
|
|
269
|
-
});
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
const startFlowAdapterFactory = (luvio) => function flowRuntime__startFlow(untrustedConfig) {
|
|
273
|
-
const config = validateAdapterConfig$2(untrustedConfig, startFlow_ConfigPropertyNames);
|
|
274
|
-
// Invalid or incomplete config
|
|
275
|
-
if (config === null) {
|
|
276
|
-
return null;
|
|
277
|
-
}
|
|
278
|
-
return buildNetworkSnapshot$2(luvio, config);
|
|
252
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
253
|
+
const resourceParams = createResourceParams$2(config);
|
|
254
|
+
const request = createResourceRequest$2(resourceParams);
|
|
255
|
+
return luvio
|
|
256
|
+
.dispatchResourceRequest(request, options)
|
|
257
|
+
.then((response) => {
|
|
258
|
+
return luvio.handleSuccessResponse(() => {
|
|
259
|
+
deepFreeze(response.body);
|
|
260
|
+
return Promise.resolve(response.body);
|
|
261
|
+
}, () => {
|
|
262
|
+
return getResponseCacheKeys$2(luvio, resourceParams, response.body);
|
|
263
|
+
});
|
|
264
|
+
}, (response) => {
|
|
265
|
+
return luvio.handleErrorResponse(() => {
|
|
266
|
+
// We want to throw these exceptions to be caught in the runtime layer
|
|
267
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
268
|
+
throw new Error(response.body.message || response.body.error || response.body);
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
const startFlowAdapterFactory = (luvio) => function flowRuntime__startFlow(untrustedConfig) {
|
|
273
|
+
const config = validateAdapterConfig$2(untrustedConfig, startFlow_ConfigPropertyNames);
|
|
274
|
+
// Invalid or incomplete config
|
|
275
|
+
if (config === null) {
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
return buildNetworkSnapshot$2(luvio, config);
|
|
279
279
|
};
|
|
280
280
|
|
|
281
|
-
function keyBuilder$1(luvio, params) {
|
|
282
|
-
return keyPrefix + '::FlowRuntimeResponseRepresentation:(' + 'request.action:' + params.body.request.action + '::' + 'request.serializedState:' + params.body.request.serializedState + '::' + (params.body.request.fields === undefined ? 'request.fields' : 'request.fields:' + params.body.request.fields) + '::' + (params.body.request.uiElementVisited === undefined ? 'request.uiElementVisited' : 'request.uiElementVisited:' + params.body.request.uiElementVisited) + '::' + (params.body.request.enableTrace === undefined ? 'request.enableTrace' : 'request.enableTrace:' + params.body.request.enableTrace) + '::' + stableJSONStringify(params.body.request.lcErrors) + ')';
|
|
283
|
-
}
|
|
284
|
-
function getResponseCacheKeys$1(luvio, resourceParams, response) {
|
|
285
|
-
return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
286
|
-
}
|
|
287
|
-
function createResourceRequest$1(config) {
|
|
288
|
-
const headers = {};
|
|
289
|
-
return {
|
|
290
|
-
baseUri: '/services/data/v58.0',
|
|
291
|
-
basePath: '/connect/interaction/runtime/navigateFlow',
|
|
292
|
-
method: 'post',
|
|
293
|
-
body: config.body,
|
|
294
|
-
urlParams: {},
|
|
295
|
-
queryParams: {},
|
|
296
|
-
headers,
|
|
297
|
-
priority: 'normal',
|
|
298
|
-
};
|
|
281
|
+
function keyBuilder$1(luvio, params) {
|
|
282
|
+
return keyPrefix + '::FlowRuntimeResponseRepresentation:(' + 'request.action:' + params.body.request.action + '::' + 'request.serializedState:' + params.body.request.serializedState + '::' + (params.body.request.fields === undefined ? 'request.fields' : 'request.fields:' + params.body.request.fields) + '::' + (params.body.request.uiElementVisited === undefined ? 'request.uiElementVisited' : 'request.uiElementVisited:' + params.body.request.uiElementVisited) + '::' + (params.body.request.enableTrace === undefined ? 'request.enableTrace' : 'request.enableTrace:' + params.body.request.enableTrace) + '::' + stableJSONStringify(params.body.request.lcErrors) + ')';
|
|
283
|
+
}
|
|
284
|
+
function getResponseCacheKeys$1(luvio, resourceParams, response) {
|
|
285
|
+
return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
286
|
+
}
|
|
287
|
+
function createResourceRequest$1(config) {
|
|
288
|
+
const headers = {};
|
|
289
|
+
return {
|
|
290
|
+
baseUri: '/services/data/v58.0',
|
|
291
|
+
basePath: '/connect/interaction/runtime/navigateFlow',
|
|
292
|
+
method: 'post',
|
|
293
|
+
body: config.body,
|
|
294
|
+
urlParams: {},
|
|
295
|
+
queryParams: {},
|
|
296
|
+
headers,
|
|
297
|
+
priority: 'normal',
|
|
298
|
+
};
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
function validate$2(obj, path = 'FlowRuntimeNavigationFieldValue') {
|
|
302
|
-
const v_error = (() => {
|
|
303
|
-
if (typeof obj !== 'object' || ArrayIsArray$1(obj) || obj === null) {
|
|
304
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
305
|
-
}
|
|
306
|
-
const obj_field = obj.field;
|
|
307
|
-
const path_field = path + '.field';
|
|
308
|
-
if (typeof obj_field !== 'string') {
|
|
309
|
-
return new TypeError('Expected "string" but received "' + typeof obj_field + '" (at "' + path_field + '")');
|
|
310
|
-
}
|
|
311
|
-
if (obj.isVisible !== undefined) {
|
|
312
|
-
const obj_isVisible = obj.isVisible;
|
|
313
|
-
const path_isVisible = path + '.isVisible';
|
|
314
|
-
let obj_isVisible_union0 = null;
|
|
315
|
-
const obj_isVisible_union0_error = (() => {
|
|
316
|
-
if (typeof obj_isVisible !== 'boolean') {
|
|
317
|
-
return new TypeError('Expected "boolean" but received "' + typeof obj_isVisible + '" (at "' + path_isVisible + '")');
|
|
318
|
-
}
|
|
319
|
-
})();
|
|
320
|
-
if (obj_isVisible_union0_error != null) {
|
|
321
|
-
obj_isVisible_union0 = obj_isVisible_union0_error.message;
|
|
322
|
-
}
|
|
323
|
-
let obj_isVisible_union1 = null;
|
|
324
|
-
const obj_isVisible_union1_error = (() => {
|
|
325
|
-
if (obj_isVisible !== null) {
|
|
326
|
-
return new TypeError('Expected "null" but received "' + typeof obj_isVisible + '" (at "' + path_isVisible + '")');
|
|
327
|
-
}
|
|
328
|
-
})();
|
|
329
|
-
if (obj_isVisible_union1_error != null) {
|
|
330
|
-
obj_isVisible_union1 = obj_isVisible_union1_error.message;
|
|
331
|
-
}
|
|
332
|
-
if (obj_isVisible_union0 && obj_isVisible_union1) {
|
|
333
|
-
let message = 'Object doesn\'t match union (at "' + path_isVisible + '")';
|
|
334
|
-
message += '\n' + obj_isVisible_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
335
|
-
message += '\n' + obj_isVisible_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
336
|
-
return new TypeError(message);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
if (obj.value !== undefined) {
|
|
340
|
-
const obj_value = obj.value;
|
|
341
|
-
const path_value = path + '.value';
|
|
342
|
-
if (obj_value === undefined) {
|
|
343
|
-
return new TypeError('Expected "defined" but received "' + typeof obj_value + '" (at "' + path_value + '")');
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
})();
|
|
347
|
-
return v_error === undefined ? null : v_error;
|
|
301
|
+
function validate$2(obj, path = 'FlowRuntimeNavigationFieldValue') {
|
|
302
|
+
const v_error = (() => {
|
|
303
|
+
if (typeof obj !== 'object' || ArrayIsArray$1(obj) || obj === null) {
|
|
304
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
305
|
+
}
|
|
306
|
+
const obj_field = obj.field;
|
|
307
|
+
const path_field = path + '.field';
|
|
308
|
+
if (typeof obj_field !== 'string') {
|
|
309
|
+
return new TypeError('Expected "string" but received "' + typeof obj_field + '" (at "' + path_field + '")');
|
|
310
|
+
}
|
|
311
|
+
if (obj.isVisible !== undefined) {
|
|
312
|
+
const obj_isVisible = obj.isVisible;
|
|
313
|
+
const path_isVisible = path + '.isVisible';
|
|
314
|
+
let obj_isVisible_union0 = null;
|
|
315
|
+
const obj_isVisible_union0_error = (() => {
|
|
316
|
+
if (typeof obj_isVisible !== 'boolean') {
|
|
317
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isVisible + '" (at "' + path_isVisible + '")');
|
|
318
|
+
}
|
|
319
|
+
})();
|
|
320
|
+
if (obj_isVisible_union0_error != null) {
|
|
321
|
+
obj_isVisible_union0 = obj_isVisible_union0_error.message;
|
|
322
|
+
}
|
|
323
|
+
let obj_isVisible_union1 = null;
|
|
324
|
+
const obj_isVisible_union1_error = (() => {
|
|
325
|
+
if (obj_isVisible !== null) {
|
|
326
|
+
return new TypeError('Expected "null" but received "' + typeof obj_isVisible + '" (at "' + path_isVisible + '")');
|
|
327
|
+
}
|
|
328
|
+
})();
|
|
329
|
+
if (obj_isVisible_union1_error != null) {
|
|
330
|
+
obj_isVisible_union1 = obj_isVisible_union1_error.message;
|
|
331
|
+
}
|
|
332
|
+
if (obj_isVisible_union0 && obj_isVisible_union1) {
|
|
333
|
+
let message = 'Object doesn\'t match union (at "' + path_isVisible + '")';
|
|
334
|
+
message += '\n' + obj_isVisible_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
335
|
+
message += '\n' + obj_isVisible_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
336
|
+
return new TypeError(message);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
if (obj.value !== undefined) {
|
|
340
|
+
const obj_value = obj.value;
|
|
341
|
+
const path_value = path + '.value';
|
|
342
|
+
if (obj_value === undefined) {
|
|
343
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_value + '" (at "' + path_value + '")');
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
})();
|
|
347
|
+
return v_error === undefined ? null : v_error;
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
function validate$1(obj, path = 'FlowRuntimeHashbagRepresentation') {
|
|
351
|
-
const v_error = (() => {
|
|
352
|
-
if (typeof obj !== 'object' || ArrayIsArray$1(obj) || obj === null) {
|
|
353
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
354
|
-
}
|
|
355
|
-
const obj_keys = ObjectKeys$1(obj);
|
|
356
|
-
for (let i = 0; i < obj_keys.length; i++) {
|
|
357
|
-
const key = obj_keys[i];
|
|
358
|
-
const obj_prop = obj[key];
|
|
359
|
-
const path_prop = path + '["' + key + '"]';
|
|
360
|
-
if (obj_prop === undefined) {
|
|
361
|
-
return new TypeError('Expected "defined" but received "' + typeof obj_prop + '" (at "' + path_prop + '")');
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
})();
|
|
365
|
-
return v_error === undefined ? null : v_error;
|
|
350
|
+
function validate$1(obj, path = 'FlowRuntimeHashbagRepresentation') {
|
|
351
|
+
const v_error = (() => {
|
|
352
|
+
if (typeof obj !== 'object' || ArrayIsArray$1(obj) || obj === null) {
|
|
353
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
354
|
+
}
|
|
355
|
+
const obj_keys = ObjectKeys$1(obj);
|
|
356
|
+
for (let i = 0; i < obj_keys.length; i++) {
|
|
357
|
+
const key = obj_keys[i];
|
|
358
|
+
const obj_prop = obj[key];
|
|
359
|
+
const path_prop = path + '["' + key + '"]';
|
|
360
|
+
if (obj_prop === undefined) {
|
|
361
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_prop + '" (at "' + path_prop + '")');
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
})();
|
|
365
|
+
return v_error === undefined ? null : v_error;
|
|
366
366
|
}
|
|
367
367
|
|
|
368
|
-
function validate(obj, path = 'FlowRuntimeNavigateFlowRepresentation') {
|
|
369
|
-
const v_error = (() => {
|
|
370
|
-
if (typeof obj !== 'object' || ArrayIsArray$1(obj) || obj === null) {
|
|
371
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
372
|
-
}
|
|
373
|
-
const obj_action = obj.action;
|
|
374
|
-
const path_action = path + '.action';
|
|
375
|
-
if (typeof obj_action !== 'string') {
|
|
376
|
-
return new TypeError('Expected "string" but received "' + typeof obj_action + '" (at "' + path_action + '")');
|
|
377
|
-
}
|
|
378
|
-
if (obj.enableTrace !== undefined) {
|
|
379
|
-
const obj_enableTrace = obj.enableTrace;
|
|
380
|
-
const path_enableTrace = path + '.enableTrace';
|
|
381
|
-
if (typeof obj_enableTrace !== 'boolean') {
|
|
382
|
-
return new TypeError('Expected "boolean" but received "' + typeof obj_enableTrace + '" (at "' + path_enableTrace + '")');
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
if (obj.fields !== undefined) {
|
|
386
|
-
const obj_fields = obj.fields;
|
|
387
|
-
const path_fields = path + '.fields';
|
|
388
|
-
if (!ArrayIsArray$1(obj_fields)) {
|
|
389
|
-
return new TypeError('Expected "array" but received "' + typeof obj_fields + '" (at "' + path_fields + '")');
|
|
390
|
-
}
|
|
391
|
-
for (let i = 0; i < obj_fields.length; i++) {
|
|
392
|
-
const obj_fields_item = obj_fields[i];
|
|
393
|
-
const path_fields_item = path_fields + '[' + i + ']';
|
|
394
|
-
const referencepath_fields_itemValidationError = validate$2(obj_fields_item, path_fields_item);
|
|
395
|
-
if (referencepath_fields_itemValidationError !== null) {
|
|
396
|
-
let message = 'Object doesn\'t match FlowRuntimeNavigationFieldValue (at "' + path_fields_item + '")\n';
|
|
397
|
-
message += referencepath_fields_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
398
|
-
return new TypeError(message);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
if (obj.lcErrors !== undefined) {
|
|
403
|
-
const obj_lcErrors = obj.lcErrors;
|
|
404
|
-
const path_lcErrors = path + '.lcErrors';
|
|
405
|
-
const referencepath_lcErrorsValidationError = validate$1(obj_lcErrors, path_lcErrors);
|
|
406
|
-
if (referencepath_lcErrorsValidationError !== null) {
|
|
407
|
-
let message = 'Object doesn\'t match FlowRuntimeHashbagRepresentation (at "' + path_lcErrors + '")\n';
|
|
408
|
-
message += referencepath_lcErrorsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
409
|
-
return new TypeError(message);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
const obj_serializedState = obj.serializedState;
|
|
413
|
-
const path_serializedState = path + '.serializedState';
|
|
414
|
-
if (typeof obj_serializedState !== 'string') {
|
|
415
|
-
return new TypeError('Expected "string" but received "' + typeof obj_serializedState + '" (at "' + path_serializedState + '")');
|
|
416
|
-
}
|
|
417
|
-
if (obj.uiElementVisited !== undefined) {
|
|
418
|
-
const obj_uiElementVisited = obj.uiElementVisited;
|
|
419
|
-
const path_uiElementVisited = path + '.uiElementVisited';
|
|
420
|
-
if (typeof obj_uiElementVisited !== 'boolean') {
|
|
421
|
-
return new TypeError('Expected "boolean" but received "' + typeof obj_uiElementVisited + '" (at "' + path_uiElementVisited + '")');
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
})();
|
|
425
|
-
return v_error === undefined ? null : v_error;
|
|
368
|
+
function validate(obj, path = 'FlowRuntimeNavigateFlowRepresentation') {
|
|
369
|
+
const v_error = (() => {
|
|
370
|
+
if (typeof obj !== 'object' || ArrayIsArray$1(obj) || obj === null) {
|
|
371
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
372
|
+
}
|
|
373
|
+
const obj_action = obj.action;
|
|
374
|
+
const path_action = path + '.action';
|
|
375
|
+
if (typeof obj_action !== 'string') {
|
|
376
|
+
return new TypeError('Expected "string" but received "' + typeof obj_action + '" (at "' + path_action + '")');
|
|
377
|
+
}
|
|
378
|
+
if (obj.enableTrace !== undefined) {
|
|
379
|
+
const obj_enableTrace = obj.enableTrace;
|
|
380
|
+
const path_enableTrace = path + '.enableTrace';
|
|
381
|
+
if (typeof obj_enableTrace !== 'boolean') {
|
|
382
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_enableTrace + '" (at "' + path_enableTrace + '")');
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
if (obj.fields !== undefined) {
|
|
386
|
+
const obj_fields = obj.fields;
|
|
387
|
+
const path_fields = path + '.fields';
|
|
388
|
+
if (!ArrayIsArray$1(obj_fields)) {
|
|
389
|
+
return new TypeError('Expected "array" but received "' + typeof obj_fields + '" (at "' + path_fields + '")');
|
|
390
|
+
}
|
|
391
|
+
for (let i = 0; i < obj_fields.length; i++) {
|
|
392
|
+
const obj_fields_item = obj_fields[i];
|
|
393
|
+
const path_fields_item = path_fields + '[' + i + ']';
|
|
394
|
+
const referencepath_fields_itemValidationError = validate$2(obj_fields_item, path_fields_item);
|
|
395
|
+
if (referencepath_fields_itemValidationError !== null) {
|
|
396
|
+
let message = 'Object doesn\'t match FlowRuntimeNavigationFieldValue (at "' + path_fields_item + '")\n';
|
|
397
|
+
message += referencepath_fields_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
398
|
+
return new TypeError(message);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
if (obj.lcErrors !== undefined) {
|
|
403
|
+
const obj_lcErrors = obj.lcErrors;
|
|
404
|
+
const path_lcErrors = path + '.lcErrors';
|
|
405
|
+
const referencepath_lcErrorsValidationError = validate$1(obj_lcErrors, path_lcErrors);
|
|
406
|
+
if (referencepath_lcErrorsValidationError !== null) {
|
|
407
|
+
let message = 'Object doesn\'t match FlowRuntimeHashbagRepresentation (at "' + path_lcErrors + '")\n';
|
|
408
|
+
message += referencepath_lcErrorsValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
409
|
+
return new TypeError(message);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
const obj_serializedState = obj.serializedState;
|
|
413
|
+
const path_serializedState = path + '.serializedState';
|
|
414
|
+
if (typeof obj_serializedState !== 'string') {
|
|
415
|
+
return new TypeError('Expected "string" but received "' + typeof obj_serializedState + '" (at "' + path_serializedState + '")');
|
|
416
|
+
}
|
|
417
|
+
if (obj.uiElementVisited !== undefined) {
|
|
418
|
+
const obj_uiElementVisited = obj.uiElementVisited;
|
|
419
|
+
const path_uiElementVisited = path + '.uiElementVisited';
|
|
420
|
+
if (typeof obj_uiElementVisited !== 'boolean') {
|
|
421
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_uiElementVisited + '" (at "' + path_uiElementVisited + '")');
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
})();
|
|
425
|
+
return v_error === undefined ? null : v_error;
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
-
const navigateFlow_ConfigPropertyNames = {
|
|
429
|
-
displayName: 'navigateFlow',
|
|
430
|
-
parameters: {
|
|
431
|
-
required: ['request'],
|
|
432
|
-
optional: []
|
|
433
|
-
}
|
|
434
|
-
};
|
|
435
|
-
function createResourceParams$1(config) {
|
|
436
|
-
const resourceParams = {
|
|
437
|
-
body: {
|
|
438
|
-
request: config.request
|
|
439
|
-
}
|
|
440
|
-
};
|
|
441
|
-
return resourceParams;
|
|
442
|
-
}
|
|
443
|
-
function typeCheckConfig$1(untrustedConfig) {
|
|
444
|
-
const config = {};
|
|
445
|
-
const untrustedConfig_request = untrustedConfig.request;
|
|
446
|
-
const referenceFlowRuntimeNavigateFlowRepresentationValidationError = validate(untrustedConfig_request);
|
|
447
|
-
if (referenceFlowRuntimeNavigateFlowRepresentationValidationError === null) {
|
|
448
|
-
config.request = untrustedConfig_request;
|
|
449
|
-
}
|
|
450
|
-
return config;
|
|
451
|
-
}
|
|
452
|
-
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
453
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
454
|
-
return null;
|
|
455
|
-
}
|
|
456
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
457
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
458
|
-
}
|
|
459
|
-
const config = typeCheckConfig$1(untrustedConfig);
|
|
460
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
461
|
-
return null;
|
|
462
|
-
}
|
|
463
|
-
return config;
|
|
428
|
+
const navigateFlow_ConfigPropertyNames = {
|
|
429
|
+
displayName: 'navigateFlow',
|
|
430
|
+
parameters: {
|
|
431
|
+
required: ['request'],
|
|
432
|
+
optional: []
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
function createResourceParams$1(config) {
|
|
436
|
+
const resourceParams = {
|
|
437
|
+
body: {
|
|
438
|
+
request: config.request
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
return resourceParams;
|
|
442
|
+
}
|
|
443
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
444
|
+
const config = {};
|
|
445
|
+
const untrustedConfig_request = untrustedConfig.request;
|
|
446
|
+
const referenceFlowRuntimeNavigateFlowRepresentationValidationError = validate(untrustedConfig_request);
|
|
447
|
+
if (referenceFlowRuntimeNavigateFlowRepresentationValidationError === null) {
|
|
448
|
+
config.request = untrustedConfig_request;
|
|
449
|
+
}
|
|
450
|
+
return config;
|
|
451
|
+
}
|
|
452
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
453
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
454
|
+
return null;
|
|
455
|
+
}
|
|
456
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
457
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
458
|
+
}
|
|
459
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
460
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
461
|
+
return null;
|
|
462
|
+
}
|
|
463
|
+
return config;
|
|
464
464
|
}
|
|
465
465
|
|
|
466
|
-
function buildNetworkSnapshot$1(luvio, config, context) {
|
|
467
|
-
const resourceParams = createResourceParams$1(config);
|
|
468
|
-
const request = createResourceRequest$1(resourceParams);
|
|
469
|
-
return luvio
|
|
470
|
-
.dispatchResourceRequest(request, context)
|
|
471
|
-
.then((response) => {
|
|
472
|
-
return luvio.handleSuccessResponse(() => {
|
|
473
|
-
deepFreeze(response.body);
|
|
474
|
-
return Promise.resolve(response.body);
|
|
475
|
-
}, () => {
|
|
476
|
-
return getResponseCacheKeys$1(luvio, resourceParams, response.body);
|
|
477
|
-
});
|
|
478
|
-
}, (response) => {
|
|
479
|
-
return luvio.handleErrorResponse(() => {
|
|
480
|
-
// We want to throw these exceptions to be caught in the runtime layer
|
|
481
|
-
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
482
|
-
throw new Error(response.body.message || response.body.error || response.body);
|
|
483
|
-
});
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
const navigateFlowAdapterFactory = (luvio) => function flowRuntime__navigateFlow(untrustedConfig) {
|
|
487
|
-
const config = validateAdapterConfig$1(untrustedConfig, navigateFlow_ConfigPropertyNames);
|
|
488
|
-
// Invalid or incomplete config
|
|
489
|
-
if (config === null) {
|
|
490
|
-
return null;
|
|
491
|
-
}
|
|
492
|
-
return buildNetworkSnapshot$1(luvio, config);
|
|
466
|
+
function buildNetworkSnapshot$1(luvio, config, context) {
|
|
467
|
+
const resourceParams = createResourceParams$1(config);
|
|
468
|
+
const request = createResourceRequest$1(resourceParams);
|
|
469
|
+
return luvio
|
|
470
|
+
.dispatchResourceRequest(request, context)
|
|
471
|
+
.then((response) => {
|
|
472
|
+
return luvio.handleSuccessResponse(() => {
|
|
473
|
+
deepFreeze(response.body);
|
|
474
|
+
return Promise.resolve(response.body);
|
|
475
|
+
}, () => {
|
|
476
|
+
return getResponseCacheKeys$1(luvio, resourceParams, response.body);
|
|
477
|
+
});
|
|
478
|
+
}, (response) => {
|
|
479
|
+
return luvio.handleErrorResponse(() => {
|
|
480
|
+
// We want to throw these exceptions to be caught in the runtime layer
|
|
481
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
482
|
+
throw new Error(response.body.message || response.body.error || response.body);
|
|
483
|
+
});
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
const navigateFlowAdapterFactory = (luvio) => function flowRuntime__navigateFlow(untrustedConfig) {
|
|
487
|
+
const config = validateAdapterConfig$1(untrustedConfig, navigateFlow_ConfigPropertyNames);
|
|
488
|
+
// Invalid or incomplete config
|
|
489
|
+
if (config === null) {
|
|
490
|
+
return null;
|
|
491
|
+
}
|
|
492
|
+
return buildNetworkSnapshot$1(luvio, config);
|
|
493
493
|
};
|
|
494
494
|
|
|
495
|
-
function keyBuilder(luvio, params) {
|
|
496
|
-
return keyPrefix + '::FlowRuntimeResponseRepresentation:(' + 'pausedInterviewId:' + params.body.pausedInterviewId + ')';
|
|
497
|
-
}
|
|
498
|
-
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
499
|
-
return getTypeCacheKeys(luvio, response, () => keyBuilder(luvio, resourceParams));
|
|
500
|
-
}
|
|
501
|
-
function createResourceRequest(config) {
|
|
502
|
-
const headers = {};
|
|
503
|
-
return {
|
|
504
|
-
baseUri: '/services/data/v58.0',
|
|
505
|
-
basePath: '/connect/interaction/runtime/resumeFlow',
|
|
506
|
-
method: 'post',
|
|
507
|
-
body: config.body,
|
|
508
|
-
urlParams: {},
|
|
509
|
-
queryParams: {},
|
|
510
|
-
headers,
|
|
511
|
-
priority: 'normal',
|
|
512
|
-
};
|
|
495
|
+
function keyBuilder(luvio, params) {
|
|
496
|
+
return keyPrefix + '::FlowRuntimeResponseRepresentation:(' + 'pausedInterviewId:' + params.body.pausedInterviewId + ')';
|
|
497
|
+
}
|
|
498
|
+
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
499
|
+
return getTypeCacheKeys(luvio, response, () => keyBuilder(luvio, resourceParams));
|
|
500
|
+
}
|
|
501
|
+
function createResourceRequest(config) {
|
|
502
|
+
const headers = {};
|
|
503
|
+
return {
|
|
504
|
+
baseUri: '/services/data/v58.0',
|
|
505
|
+
basePath: '/connect/interaction/runtime/resumeFlow',
|
|
506
|
+
method: 'post',
|
|
507
|
+
body: config.body,
|
|
508
|
+
urlParams: {},
|
|
509
|
+
queryParams: {},
|
|
510
|
+
headers,
|
|
511
|
+
priority: 'normal',
|
|
512
|
+
};
|
|
513
513
|
}
|
|
514
514
|
|
|
515
|
-
const resumeFlow_ConfigPropertyNames = {
|
|
516
|
-
displayName: 'resumeFlow',
|
|
517
|
-
parameters: {
|
|
518
|
-
required: ['pausedInterviewId'],
|
|
519
|
-
optional: []
|
|
520
|
-
}
|
|
521
|
-
};
|
|
522
|
-
function createResourceParams(config) {
|
|
523
|
-
const resourceParams = {
|
|
524
|
-
body: {
|
|
525
|
-
pausedInterviewId: config.pausedInterviewId
|
|
526
|
-
}
|
|
527
|
-
};
|
|
528
|
-
return resourceParams;
|
|
529
|
-
}
|
|
530
|
-
function typeCheckConfig(untrustedConfig) {
|
|
531
|
-
const config = {};
|
|
532
|
-
const untrustedConfig_pausedInterviewId = untrustedConfig.pausedInterviewId;
|
|
533
|
-
if (typeof untrustedConfig_pausedInterviewId === 'string') {
|
|
534
|
-
config.pausedInterviewId = untrustedConfig_pausedInterviewId;
|
|
535
|
-
}
|
|
536
|
-
return config;
|
|
537
|
-
}
|
|
538
|
-
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
539
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
540
|
-
return null;
|
|
541
|
-
}
|
|
542
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
543
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
544
|
-
}
|
|
545
|
-
const config = typeCheckConfig(untrustedConfig);
|
|
546
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
547
|
-
return null;
|
|
548
|
-
}
|
|
549
|
-
return config;
|
|
515
|
+
const resumeFlow_ConfigPropertyNames = {
|
|
516
|
+
displayName: 'resumeFlow',
|
|
517
|
+
parameters: {
|
|
518
|
+
required: ['pausedInterviewId'],
|
|
519
|
+
optional: []
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
function createResourceParams(config) {
|
|
523
|
+
const resourceParams = {
|
|
524
|
+
body: {
|
|
525
|
+
pausedInterviewId: config.pausedInterviewId
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
return resourceParams;
|
|
529
|
+
}
|
|
530
|
+
function typeCheckConfig(untrustedConfig) {
|
|
531
|
+
const config = {};
|
|
532
|
+
const untrustedConfig_pausedInterviewId = untrustedConfig.pausedInterviewId;
|
|
533
|
+
if (typeof untrustedConfig_pausedInterviewId === 'string') {
|
|
534
|
+
config.pausedInterviewId = untrustedConfig_pausedInterviewId;
|
|
535
|
+
}
|
|
536
|
+
return config;
|
|
537
|
+
}
|
|
538
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
539
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
540
|
+
return null;
|
|
541
|
+
}
|
|
542
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
543
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
544
|
+
}
|
|
545
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
546
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
547
|
+
return null;
|
|
548
|
+
}
|
|
549
|
+
return config;
|
|
550
550
|
}
|
|
551
551
|
|
|
552
|
-
function buildNetworkSnapshot(luvio, config, options) {
|
|
553
|
-
const resourceParams = createResourceParams(config);
|
|
554
|
-
const request = createResourceRequest(resourceParams);
|
|
555
|
-
return luvio
|
|
556
|
-
.dispatchResourceRequest(request, options)
|
|
557
|
-
.then((response) => {
|
|
558
|
-
return luvio.handleSuccessResponse(() => {
|
|
559
|
-
deepFreeze(response.body);
|
|
560
|
-
return Promise.resolve(response.body);
|
|
561
|
-
}, () => {
|
|
562
|
-
return getResponseCacheKeys(luvio, resourceParams, response.body);
|
|
563
|
-
});
|
|
564
|
-
}, (response) => {
|
|
565
|
-
return luvio.handleErrorResponse(() => {
|
|
566
|
-
// We want to throw these exceptions to be caught in the runtime layer
|
|
567
|
-
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
568
|
-
throw new Error(response.body.message || response.body.error || response.body);
|
|
569
|
-
});
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
const resumeFlowAdapterFactory = (luvio) => function flowRuntime__resumeFlow(untrustedConfig) {
|
|
573
|
-
const config = validateAdapterConfig(untrustedConfig, resumeFlow_ConfigPropertyNames);
|
|
574
|
-
// Invalid or incomplete config
|
|
575
|
-
if (config === null) {
|
|
576
|
-
return null;
|
|
577
|
-
}
|
|
578
|
-
return buildNetworkSnapshot(luvio, config);
|
|
552
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
553
|
+
const resourceParams = createResourceParams(config);
|
|
554
|
+
const request = createResourceRequest(resourceParams);
|
|
555
|
+
return luvio
|
|
556
|
+
.dispatchResourceRequest(request, options)
|
|
557
|
+
.then((response) => {
|
|
558
|
+
return luvio.handleSuccessResponse(() => {
|
|
559
|
+
deepFreeze(response.body);
|
|
560
|
+
return Promise.resolve(response.body);
|
|
561
|
+
}, () => {
|
|
562
|
+
return getResponseCacheKeys(luvio, resourceParams, response.body);
|
|
563
|
+
});
|
|
564
|
+
}, (response) => {
|
|
565
|
+
return luvio.handleErrorResponse(() => {
|
|
566
|
+
// We want to throw these exceptions to be caught in the runtime layer
|
|
567
|
+
// eslint-disable-next-line @salesforce/lds/no-error-in-production
|
|
568
|
+
throw new Error(response.body.message || response.body.error || response.body);
|
|
569
|
+
});
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
const resumeFlowAdapterFactory = (luvio) => function flowRuntime__resumeFlow(untrustedConfig) {
|
|
573
|
+
const config = validateAdapterConfig(untrustedConfig, resumeFlow_ConfigPropertyNames);
|
|
574
|
+
// Invalid or incomplete config
|
|
575
|
+
if (config === null) {
|
|
576
|
+
return null;
|
|
577
|
+
}
|
|
578
|
+
return buildNetworkSnapshot(luvio, config);
|
|
579
579
|
};
|
|
580
580
|
|
|
581
581
|
export { navigateFlowAdapterFactory, resumeFlowAdapterFactory, startFlowAdapterFactory };
|