@salesforce/lds-adapters-platform-interaction-runtime 1.362.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +82 -0
- package/dist/es/es2018/platform-interaction-runtime.js +281 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/getFlowMetadata.d.ts +28 -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 +3 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectInteractionRuntimeFlowMetadata.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/types/FlowMetadataResponseRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/package.json +66 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +316 -0
- package/src/raml/api.raml +57 -0
- package/src/raml/luvio.raml +31 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Terms of Use
|
|
2
|
+
|
|
3
|
+
Copyright 2022 Salesforce, Inc. All rights reserved.
|
|
4
|
+
|
|
5
|
+
These Terms of Use govern the download, installation, and/or use of this
|
|
6
|
+
software provided by Salesforce, Inc. ("Salesforce") (the "Software"), were
|
|
7
|
+
last updated on April 15, 2022, and constitute a legally binding
|
|
8
|
+
agreement between you and Salesforce. If you do not agree to these Terms of
|
|
9
|
+
Use, do not install or use the Software.
|
|
10
|
+
|
|
11
|
+
Salesforce grants you a worldwide, non-exclusive, no-charge, royalty-free
|
|
12
|
+
copyright license to reproduce, prepare derivative works of, publicly
|
|
13
|
+
display, publicly perform, sublicense, and distribute the Software and
|
|
14
|
+
derivative works subject to these Terms. These Terms shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
Subject to the limited rights expressly granted hereunder, Salesforce
|
|
18
|
+
reserves all rights, title, and interest in and to all intellectual
|
|
19
|
+
property subsisting in the Software. No rights are granted to you hereunder
|
|
20
|
+
other than as expressly set forth herein. Users residing in countries on
|
|
21
|
+
the United States Office of Foreign Assets Control sanction list, or which
|
|
22
|
+
are otherwise subject to a US export embargo, may not use the Software.
|
|
23
|
+
|
|
24
|
+
Implementation of the Software may require development work, for which you
|
|
25
|
+
are responsible. The Software may contain bugs, errors and
|
|
26
|
+
incompatibilities and is made available on an AS IS basis without support,
|
|
27
|
+
updates, or service level commitments.
|
|
28
|
+
|
|
29
|
+
Salesforce reserves the right at any time to modify, suspend, or
|
|
30
|
+
discontinue, the Software (or any part thereof) with or without notice. You
|
|
31
|
+
agree that Salesforce shall not be liable to you or to any third party for
|
|
32
|
+
any modification, suspension, or discontinuance.
|
|
33
|
+
|
|
34
|
+
You agree to defend Salesforce against any claim, demand, suit or
|
|
35
|
+
proceeding made or brought against Salesforce by a third party arising out
|
|
36
|
+
of or accruing from (a) your use of the Software, and (b) any application
|
|
37
|
+
you develop with the Software that infringes any copyright, trademark,
|
|
38
|
+
trade secret, trade dress, patent, or other intellectual property right of
|
|
39
|
+
any person or defames any person or violates their rights of publicity or
|
|
40
|
+
privacy (each a "Claim Against Salesforce"), and will indemnify Salesforce
|
|
41
|
+
from any damages, attorney fees, and costs finally awarded against
|
|
42
|
+
Salesforce as a result of, or for any amounts paid by Salesforce under a
|
|
43
|
+
settlement approved by you in writing of, a Claim Against Salesforce,
|
|
44
|
+
provided Salesforce (x) promptly gives you written notice of the Claim
|
|
45
|
+
Against Salesforce, (y) gives you sole control of the defense and
|
|
46
|
+
settlement of the Claim Against Salesforce (except that you may not settle
|
|
47
|
+
any Claim Against Salesforce unless it unconditionally releases Salesforce
|
|
48
|
+
of all liability), and (z) gives you all reasonable assistance, at your
|
|
49
|
+
expense.
|
|
50
|
+
|
|
51
|
+
WITHOUT LIMITING THE GENERALITY OF THE FOREGOING, THE SOFTWARE IS NOT
|
|
52
|
+
SUPPORTED AND IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
53
|
+
IMPLIED. IN NO EVENT SHALL SALESFORCE HAVE ANY LIABILITY FOR ANY DAMAGES,
|
|
54
|
+
INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
|
|
55
|
+
PUNITIVE, OR CONSEQUENTIAL DAMAGES, OR DAMAGES BASED ON LOST PROFITS, DATA,
|
|
56
|
+
OR USE, IN CONNECTION WITH THE SOFTWARE, HOWEVER CAUSED AND WHETHER IN
|
|
57
|
+
CONTRACT, TORT, OR UNDER ANY OTHER THEORY OF LIABILITY, WHETHER OR NOT YOU
|
|
58
|
+
HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
59
|
+
|
|
60
|
+
These Terms of Use shall be governed exclusively by the internal laws of
|
|
61
|
+
the State of California, without regard to its conflicts of laws
|
|
62
|
+
rules. Each party hereby consents to the exclusive jurisdiction of the
|
|
63
|
+
state and federal courts located in San Francisco County, California to
|
|
64
|
+
adjudicate any dispute arising out of or relating to these Terms of Use and
|
|
65
|
+
the download, installation, and/or use of the Software. Except as expressly
|
|
66
|
+
stated herein, these Terms of Use constitute the entire agreement between
|
|
67
|
+
the parties, and supersede all prior and contemporaneous agreements,
|
|
68
|
+
proposals, or representations, written or oral, concerning their subject
|
|
69
|
+
matter. No modification, amendment, or waiver of any provision of these
|
|
70
|
+
Terms of Use shall be effective unless it is by an update to these Terms of
|
|
71
|
+
Use that Salesforce makes available, or is in writing and signed by the
|
|
72
|
+
party against whom the modification, amendment, or waiver is to be
|
|
73
|
+
asserted.
|
|
74
|
+
|
|
75
|
+
Data Privacy: Salesforce may collect, process, and store device,
|
|
76
|
+
system, and other information related to your use of the Software. This
|
|
77
|
+
information includes, but is not limited to, IP address, user metrics, and
|
|
78
|
+
other data ("Usage Data"). Salesforce may use Usage Data for analytics,
|
|
79
|
+
product development, and marketing purposes. You acknowledge that files
|
|
80
|
+
generated in conjunction with the Software may contain sensitive or
|
|
81
|
+
confidential data, and you are solely responsible for anonymizing and
|
|
82
|
+
protecting such data.
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckConfig as typeCheckConfig$1, StoreKeyMap, createResourceParams as createResourceParams$1 } from '@luvio/engine';
|
|
8
|
+
|
|
9
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
+
const { keys: ObjectKeys, create: ObjectCreate } = Object;
|
|
11
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
12
|
+
/**
|
|
13
|
+
* Validates an adapter config is well-formed.
|
|
14
|
+
* @param config The config to validate.
|
|
15
|
+
* @param adapter The adapter validation configuration.
|
|
16
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
17
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
18
|
+
*/
|
|
19
|
+
function validateConfig(config, adapter, oneOf) {
|
|
20
|
+
const { displayName } = adapter;
|
|
21
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
22
|
+
if (config === undefined ||
|
|
23
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
24
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
25
|
+
}
|
|
26
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
27
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
28
|
+
}
|
|
29
|
+
if (unsupported !== undefined &&
|
|
30
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
31
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
32
|
+
}
|
|
33
|
+
const supported = required.concat(optional);
|
|
34
|
+
if (ObjectKeys(config).some(key => !supported.includes(key))) {
|
|
35
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function untrustedIsObject(untrusted) {
|
|
39
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
40
|
+
}
|
|
41
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
42
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
43
|
+
}
|
|
44
|
+
const snapshotRefreshOptions = {
|
|
45
|
+
overrides: {
|
|
46
|
+
headers: {
|
|
47
|
+
'Cache-Control': 'no-cache',
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
52
|
+
return {
|
|
53
|
+
name,
|
|
54
|
+
required,
|
|
55
|
+
resourceType,
|
|
56
|
+
typeCheckShape,
|
|
57
|
+
isArrayShape,
|
|
58
|
+
coerceFn,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
62
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
63
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
64
|
+
return {
|
|
65
|
+
displayName,
|
|
66
|
+
parameters: {
|
|
67
|
+
required,
|
|
68
|
+
optional,
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const keyPrefix = 'InteractionRuntime';
|
|
73
|
+
|
|
74
|
+
const { isArray: ArrayIsArray } = Array;
|
|
75
|
+
const { stringify: JSONStringify } = JSON;
|
|
76
|
+
function createLink(ref) {
|
|
77
|
+
return {
|
|
78
|
+
__ref: serializeStructuredKey(ref),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const TTL = 3600000;
|
|
83
|
+
const VERSION = "b513eb396e89dd15cc16d4d20194db51";
|
|
84
|
+
function validate(obj, path = 'FlowMetadataResponseRepresentation') {
|
|
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_error = obj.error;
|
|
90
|
+
const path_error = path + '.error';
|
|
91
|
+
if (obj_error === undefined) {
|
|
92
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_error + '" (at "' + path_error + '")');
|
|
93
|
+
}
|
|
94
|
+
const obj_response = obj.response;
|
|
95
|
+
const path_response = path + '.response';
|
|
96
|
+
if (typeof obj_response !== 'object' || ArrayIsArray(obj_response) || obj_response === null) {
|
|
97
|
+
return new TypeError('Expected "object" but received "' + typeof obj_response + '" (at "' + path_response + '")');
|
|
98
|
+
}
|
|
99
|
+
})();
|
|
100
|
+
return v_error === undefined ? null : v_error;
|
|
101
|
+
}
|
|
102
|
+
const RepresentationType = 'FlowMetadataResponseRepresentation';
|
|
103
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
104
|
+
return input;
|
|
105
|
+
}
|
|
106
|
+
const select$1 = function FlowMetadataResponseRepresentationSelect() {
|
|
107
|
+
return {
|
|
108
|
+
kind: 'Fragment',
|
|
109
|
+
version: VERSION,
|
|
110
|
+
private: [],
|
|
111
|
+
opaque: true
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
function equals(existing, incoming) {
|
|
115
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
const ingest = function FlowMetadataResponseRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
121
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
122
|
+
const validateError = validate(input);
|
|
123
|
+
if (validateError !== null) {
|
|
124
|
+
throw validateError;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const key = path.fullPath;
|
|
128
|
+
const ttlToUse = TTL;
|
|
129
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "InteractionRuntime", VERSION, RepresentationType, equals);
|
|
130
|
+
return createLink(key);
|
|
131
|
+
};
|
|
132
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
133
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
134
|
+
const rootKey = fullPathFactory();
|
|
135
|
+
rootKeySet.set(rootKey, {
|
|
136
|
+
namespace: keyPrefix,
|
|
137
|
+
representationName: RepresentationType,
|
|
138
|
+
mergeable: false
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function select(luvio, params) {
|
|
143
|
+
return select$1();
|
|
144
|
+
}
|
|
145
|
+
function keyBuilder$1(luvio, params) {
|
|
146
|
+
return keyPrefix + '::FlowMetadataResponseRepresentation:(' + 'flowDevName:' + params.queryParams.flowDevName + ',' + 'flowVersionId:' + params.queryParams.flowVersionId + ')';
|
|
147
|
+
}
|
|
148
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
149
|
+
getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
150
|
+
}
|
|
151
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
152
|
+
const { body } = response;
|
|
153
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
154
|
+
luvio.storeIngest(key, ingest, body);
|
|
155
|
+
const snapshot = luvio.storeLookup({
|
|
156
|
+
recordId: key,
|
|
157
|
+
node: select(),
|
|
158
|
+
variables: {},
|
|
159
|
+
}, snapshotRefresh);
|
|
160
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
161
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
162
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
deepFreeze(snapshot.data);
|
|
166
|
+
return snapshot;
|
|
167
|
+
}
|
|
168
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
169
|
+
const key = keyBuilder$1(luvio, params);
|
|
170
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
171
|
+
const storeMetadataParams = {
|
|
172
|
+
ttl: TTL,
|
|
173
|
+
namespace: keyPrefix,
|
|
174
|
+
version: VERSION,
|
|
175
|
+
representationName: RepresentationType
|
|
176
|
+
};
|
|
177
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
178
|
+
return errorSnapshot;
|
|
179
|
+
}
|
|
180
|
+
function createResourceRequest(config) {
|
|
181
|
+
const headers = {};
|
|
182
|
+
return {
|
|
183
|
+
baseUri: '/services/data/v65.0',
|
|
184
|
+
basePath: '/connect/interaction/runtime/flowMetadata',
|
|
185
|
+
method: 'get',
|
|
186
|
+
body: null,
|
|
187
|
+
urlParams: {},
|
|
188
|
+
queryParams: config.queryParams,
|
|
189
|
+
headers,
|
|
190
|
+
priority: 'normal',
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const adapterName = 'getFlowMetadata';
|
|
195
|
+
const getFlowMetadata_ConfigPropertyMetadata = [
|
|
196
|
+
generateParamConfigMetadata('flowDevName', true, 1 /* QueryParameter */, 0 /* String */),
|
|
197
|
+
generateParamConfigMetadata('flowVersionId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
198
|
+
];
|
|
199
|
+
const getFlowMetadata_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getFlowMetadata_ConfigPropertyMetadata);
|
|
200
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$1(getFlowMetadata_ConfigPropertyMetadata);
|
|
201
|
+
function keyBuilder(luvio, config) {
|
|
202
|
+
const resourceParams = createResourceParams(config);
|
|
203
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
204
|
+
}
|
|
205
|
+
function typeCheckConfig(untrustedConfig) {
|
|
206
|
+
const config = {};
|
|
207
|
+
typeCheckConfig$1(untrustedConfig, config, getFlowMetadata_ConfigPropertyMetadata);
|
|
208
|
+
return config;
|
|
209
|
+
}
|
|
210
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
211
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
215
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
216
|
+
}
|
|
217
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
218
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
return config;
|
|
222
|
+
}
|
|
223
|
+
function adapterFragment(luvio, config) {
|
|
224
|
+
createResourceParams(config);
|
|
225
|
+
return select();
|
|
226
|
+
}
|
|
227
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
228
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
229
|
+
config,
|
|
230
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
231
|
+
});
|
|
232
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
233
|
+
}
|
|
234
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
235
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
236
|
+
config,
|
|
237
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
238
|
+
});
|
|
239
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
240
|
+
}
|
|
241
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
242
|
+
const resourceParams = createResourceParams(config);
|
|
243
|
+
const request = createResourceRequest(resourceParams);
|
|
244
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
245
|
+
.then((response) => {
|
|
246
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
247
|
+
const cache = new StoreKeyMap();
|
|
248
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
249
|
+
return cache;
|
|
250
|
+
});
|
|
251
|
+
}, (response) => {
|
|
252
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
256
|
+
return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
|
|
257
|
+
}
|
|
258
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
259
|
+
const { luvio, config } = context;
|
|
260
|
+
const selector = {
|
|
261
|
+
recordId: keyBuilder(luvio, config),
|
|
262
|
+
node: adapterFragment(luvio, config),
|
|
263
|
+
variables: {},
|
|
264
|
+
};
|
|
265
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
266
|
+
config,
|
|
267
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
268
|
+
});
|
|
269
|
+
return cacheSnapshot;
|
|
270
|
+
}
|
|
271
|
+
const getFlowMetadataAdapterFactory = (luvio) => function InteractionRuntime__getFlowMetadata(untrustedConfig, requestContext) {
|
|
272
|
+
const config = validateAdapterConfig(untrustedConfig, getFlowMetadata_ConfigPropertyNames);
|
|
273
|
+
// Invalid or incomplete config
|
|
274
|
+
if (config === null) {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
278
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
export { getFlowMetadataAdapterFactory };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Adapter as $64$luvio_engine_Adapter, Snapshot as $64$luvio_engine_Snapshot, UnfulfilledSnapshot as $64$luvio_engine_UnfulfilledSnapshot, AdapterConfigMetadata as $64$luvio_engine_AdapterConfigMetadata } from '@luvio/engine';
|
|
2
|
+
export declare const ObjectPrototypeHasOwnProperty: (v: PropertyKey) => boolean;
|
|
3
|
+
declare const ObjectKeys: {
|
|
4
|
+
(o: object): string[];
|
|
5
|
+
(o: {}): string[];
|
|
6
|
+
}, ObjectCreate: {
|
|
7
|
+
(o: object | null): any;
|
|
8
|
+
(o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
|
|
9
|
+
};
|
|
10
|
+
export { ObjectCreate, ObjectKeys };
|
|
11
|
+
export declare const ArrayIsArray: (arg: any) => arg is any[];
|
|
12
|
+
export declare const ArrayPrototypePush: (...items: any[]) => number;
|
|
13
|
+
export interface AdapterValidationConfig {
|
|
14
|
+
displayName: string;
|
|
15
|
+
parameters: {
|
|
16
|
+
required: string[];
|
|
17
|
+
optional: string[];
|
|
18
|
+
unsupported?: string[];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
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
|
+
export declare function validateConfig<T>(config: Untrusted<T>, adapter: AdapterValidationConfig, oneOf?: string[]): void;
|
|
29
|
+
export declare function untrustedIsObject<Base>(untrusted: unknown): untrusted is Untrusted<Base>;
|
|
30
|
+
export type UncoercedConfiguration<Base, Options extends {
|
|
31
|
+
[key in keyof Base]?: any;
|
|
32
|
+
}> = {
|
|
33
|
+
[Key in keyof Base]?: Base[Key] | Options[Key];
|
|
34
|
+
};
|
|
35
|
+
export type Untrusted<Base> = Partial<Base>;
|
|
36
|
+
export declare function areRequiredParametersPresent<T>(config: any, configPropertyNames: AdapterValidationConfig): config is T;
|
|
37
|
+
export declare function refreshable<C, D, R>(adapter: $64$luvio_engine_Adapter<C, D>, resolve: (config: unknown) => Promise<$64$luvio_engine_Snapshot<R>>): $64$luvio_engine_Adapter<C, D>;
|
|
38
|
+
export declare const SNAPSHOT_STATE_FULFILLED = "Fulfilled";
|
|
39
|
+
export declare const SNAPSHOT_STATE_UNFULFILLED = "Unfulfilled";
|
|
40
|
+
export declare const snapshotRefreshOptions: {
|
|
41
|
+
overrides: {
|
|
42
|
+
headers: {
|
|
43
|
+
'Cache-Control': string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* A deterministic JSON stringify implementation. Heavily adapted from https://github.com/epoberezkin/fast-json-stable-stringify.
|
|
49
|
+
* This is needed because insertion order for JSON.stringify(object) affects output:
|
|
50
|
+
* JSON.stringify({a: 1, b: 2})
|
|
51
|
+
* "{"a":1,"b":2}"
|
|
52
|
+
* JSON.stringify({b: 2, a: 1})
|
|
53
|
+
* "{"b":2,"a":1}"
|
|
54
|
+
* @param data Data to be JSON-stringified.
|
|
55
|
+
* @returns JSON.stringified value with consistent ordering of keys.
|
|
56
|
+
*/
|
|
57
|
+
export declare function stableJSONStringify(node: any): string | undefined;
|
|
58
|
+
export declare function getFetchResponseStatusText(status: number): string;
|
|
59
|
+
export declare function isUnfulfilledSnapshot<T, U>(snapshot: $64$luvio_engine_Snapshot<T, U>): snapshot is $64$luvio_engine_UnfulfilledSnapshot<T, U>;
|
|
60
|
+
export declare function generateParamConfigMetadata(name: string, required: boolean, resourceType: $64$luvio_engine_AdapterConfigMetadata['resourceType'], typeCheckShape: $64$luvio_engine_AdapterConfigMetadata['typeCheckShape'], isArrayShape?: boolean, coerceFn?: (v: unknown) => unknown): $64$luvio_engine_AdapterConfigMetadata;
|
|
61
|
+
export declare function buildAdapterValidationConfig(displayName: string, paramsMeta: $64$luvio_engine_AdapterConfigMetadata[]): AdapterValidationConfig;
|
|
62
|
+
export declare const keyPrefix = "InteractionRuntime";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AdapterConfigMetadata as $64$luvio_engine_AdapterConfigMetadata, Luvio as $64$luvio_engine_Luvio, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, Fragment as $64$luvio_engine_Fragment, Snapshot as $64$luvio_engine_Snapshot, FetchResponse as $64$luvio_engine_FetchResponse, ErrorResponse as $64$luvio_engine_ErrorResponse, DispatchResourceRequestContext as $64$luvio_engine_DispatchResourceRequestContext, CoercedAdapterRequestContext as $64$luvio_engine_CoercedAdapterRequestContext, StoreLookup as $64$luvio_engine_StoreLookup, AdapterFactory as $64$luvio_engine_AdapterFactory } from '@luvio/engine';
|
|
2
|
+
import { Untrusted as adapter$45$utils_Untrusted, AdapterValidationConfig as adapter$45$utils_AdapterValidationConfig } from './adapter-utils';
|
|
3
|
+
import { ResourceRequestConfig as resources_getConnectInteractionRuntimeFlowMetadata_ResourceRequestConfig } from '../resources/getConnectInteractionRuntimeFlowMetadata';
|
|
4
|
+
import { FlowMetadataResponseRepresentation as types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation } from '../types/FlowMetadataResponseRepresentation';
|
|
5
|
+
export declare const adapterName = "getFlowMetadata";
|
|
6
|
+
export declare const getFlowMetadata_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
|
|
7
|
+
export declare const getFlowMetadata_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
|
|
8
|
+
export interface GetFlowMetadataConfig {
|
|
9
|
+
flowDevName: string;
|
|
10
|
+
flowVersionId?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const createResourceParams: (config: GetFlowMetadataConfig) => resources_getConnectInteractionRuntimeFlowMetadata_ResourceRequestConfig;
|
|
13
|
+
export declare function keyBuilder(luvio: $64$luvio_engine_Luvio, config: GetFlowMetadataConfig): string;
|
|
14
|
+
export declare function keyBuilder_StructuredKey(luvio: $64$luvio_engine_Luvio, config: GetFlowMetadataConfig): $64$luvio_engine_NormalizedKeyMetadata;
|
|
15
|
+
export declare function typeCheckConfig(untrustedConfig: adapter$45$utils_Untrusted<GetFlowMetadataConfig>): adapter$45$utils_Untrusted<GetFlowMetadataConfig>;
|
|
16
|
+
export declare function validateAdapterConfig(untrustedConfig: unknown, configPropertyNames: adapter$45$utils_AdapterValidationConfig): GetFlowMetadataConfig | null;
|
|
17
|
+
export declare function adapterFragment(luvio: $64$luvio_engine_Luvio, config: GetFlowMetadataConfig): $64$luvio_engine_Fragment;
|
|
18
|
+
export declare function buildCachedSnapshot(luvio: $64$luvio_engine_Luvio, config: GetFlowMetadataConfig): $64$luvio_engine_Snapshot<types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation, any>;
|
|
19
|
+
export declare function onFetchResponseSuccess(luvio: $64$luvio_engine_Luvio, config: GetFlowMetadataConfig, resourceParams: resources_getConnectInteractionRuntimeFlowMetadata_ResourceRequestConfig, response: $64$luvio_engine_FetchResponse<types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation>): Promise<import("@luvio/engine").FulfilledSnapshot<types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation, {}> | import("@luvio/engine").StaleSnapshot<types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation, {}> | import("@luvio/engine").PendingSnapshot<types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation, any>>;
|
|
20
|
+
export declare function onFetchResponseError(luvio: $64$luvio_engine_Luvio, config: GetFlowMetadataConfig, resourceParams: resources_getConnectInteractionRuntimeFlowMetadata_ResourceRequestConfig, response: $64$luvio_engine_ErrorResponse): Promise<import("@luvio/engine").ErrorSnapshot>;
|
|
21
|
+
export declare function buildNetworkSnapshot(luvio: $64$luvio_engine_Luvio, config: GetFlowMetadataConfig, options?: $64$luvio_engine_DispatchResourceRequestContext): Promise<$64$luvio_engine_Snapshot<types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation, any>>;
|
|
22
|
+
export type BuildSnapshotContext = {
|
|
23
|
+
luvio: $64$luvio_engine_Luvio;
|
|
24
|
+
config: GetFlowMetadataConfig;
|
|
25
|
+
};
|
|
26
|
+
export declare function buildNetworkSnapshotCachePolicy(context: BuildSnapshotContext, coercedAdapterRequestContext: $64$luvio_engine_CoercedAdapterRequestContext): Promise<$64$luvio_engine_Snapshot<types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation, any>>;
|
|
27
|
+
export declare function buildCachedSnapshotCachePolicy(context: BuildSnapshotContext, storeLookup: $64$luvio_engine_StoreLookup<types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation>): $64$luvio_engine_Snapshot<types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation, any>;
|
|
28
|
+
export declare const getFlowMetadataAdapterFactory: $64$luvio_engine_AdapterFactory<GetFlowMetadataConfig, types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getFlowMetadataAdapterFactory } from '../adapters/getFlowMetadata';
|
package/dist/es/es2018/types/src/generated/resources/getConnectInteractionRuntimeFlowMetadata.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Luvio as $64$luvio_engine_Luvio, Fragment as $64$luvio_engine_Fragment, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, FetchResponse as $64$luvio_engine_FetchResponse, SnapshotRefresh as $64$luvio_engine_SnapshotRefresh, FulfilledSnapshot as $64$luvio_engine_FulfilledSnapshot, StaleSnapshot as $64$luvio_engine_StaleSnapshot, PendingSnapshot as $64$luvio_engine_PendingSnapshot, ErrorResponse as $64$luvio_engine_ErrorResponse, ErrorSnapshot as $64$luvio_engine_ErrorSnapshot, ResourceRequest as $64$luvio_engine_ResourceRequest } from '@luvio/engine';
|
|
2
|
+
import { FlowMetadataResponseRepresentation as types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation } from '../types/FlowMetadataResponseRepresentation';
|
|
3
|
+
export interface ResourceRequestConfig {
|
|
4
|
+
queryParams: {
|
|
5
|
+
flowDevName: string;
|
|
6
|
+
flowVersionId?: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare function select(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig): $64$luvio_engine_Fragment;
|
|
10
|
+
export declare function keyBuilder(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig): string;
|
|
11
|
+
export declare function keyBuilder_StructuredKey(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig): $64$luvio_engine_NormalizedKeyMetadata;
|
|
12
|
+
export declare function getResponseCacheKeys(storeKeyMap: any, luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation): void;
|
|
13
|
+
export declare function ingestSuccess(luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: $64$luvio_engine_FetchResponse<types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation>, snapshotRefresh?: $64$luvio_engine_SnapshotRefresh<types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation>): $64$luvio_engine_FulfilledSnapshot<types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation, {}> | $64$luvio_engine_StaleSnapshot<types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation, {}> | $64$luvio_engine_PendingSnapshot<types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation, any>;
|
|
14
|
+
export declare function ingestError(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig, error: $64$luvio_engine_ErrorResponse, snapshotRefresh?: $64$luvio_engine_SnapshotRefresh<types_FlowMetadataResponseRepresentation_FlowMetadataResponseRepresentation>): $64$luvio_engine_ErrorSnapshot;
|
|
15
|
+
export declare function createResourceRequest(config: ResourceRequestConfig): $64$luvio_engine_ResourceRequest;
|
|
16
|
+
export default createResourceRequest;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { IngestPath as $64$luvio_engine_IngestPath, Luvio as $64$luvio_engine_Luvio, Store as $64$luvio_engine_Store, BaseFragment as $64$luvio_engine_BaseFragment, ResourceIngest as $64$luvio_engine_ResourceIngest, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
|
|
2
|
+
export declare const TTL = 3600000;
|
|
3
|
+
export declare const VERSION = "b513eb396e89dd15cc16d4d20194db51";
|
|
4
|
+
export declare function validate(obj: any, path?: string): TypeError | null;
|
|
5
|
+
export declare const RepresentationType: string;
|
|
6
|
+
export declare function normalize(input: FlowMetadataResponseRepresentation, existing: FlowMetadataResponseRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): FlowMetadataResponseRepresentationNormalized;
|
|
7
|
+
export declare const select: () => $64$luvio_engine_BaseFragment;
|
|
8
|
+
export declare function equals(existing: FlowMetadataResponseRepresentationNormalized, incoming: FlowMetadataResponseRepresentationNormalized): 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: FlowMetadataResponseRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
|
|
11
|
+
/**
|
|
12
|
+
* Flow Metadata Response Representation
|
|
13
|
+
*
|
|
14
|
+
* Keys:
|
|
15
|
+
* (none)
|
|
16
|
+
*/
|
|
17
|
+
export interface FlowMetadataResponseRepresentationNormalized {
|
|
18
|
+
/** Error */
|
|
19
|
+
error: unknown;
|
|
20
|
+
/** Flow Metadata Response */
|
|
21
|
+
response: {};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Flow Metadata Response Representation
|
|
25
|
+
*
|
|
26
|
+
* Keys:
|
|
27
|
+
* (none)
|
|
28
|
+
*/
|
|
29
|
+
export interface FlowMetadataResponseRepresentation {
|
|
30
|
+
error: unknown;
|
|
31
|
+
response: {};
|
|
32
|
+
}
|
|
@@ -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,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@salesforce/lds-adapters-platform-interaction-runtime",
|
|
3
|
+
"version": "1.362.0",
|
|
4
|
+
"description": "This family holds apis to invoke/navigate flows and also to load metadata required by offline flow engine.",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
|
+
"main": "dist/es/es2018/platform-interaction-runtime.js",
|
|
7
|
+
"module": "dist/es/es2018/platform-interaction-runtime.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/platform-interaction-runtime.js",
|
|
18
|
+
"require": "./dist/es/es2018/platform-interaction-runtime.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": "platformInteractionRuntimeApi"
|
|
29
|
+
},
|
|
30
|
+
"contributors": [
|
|
31
|
+
"ayush.kedia@salesforce.com"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "yarn build:services",
|
|
35
|
+
"build:raml": "luvio generate src/raml/luvio.raml src/generated -p '../lds-compiler-plugins'",
|
|
36
|
+
"build:services": "rollup --bundleConfigAsCjs --config rollup.config.js",
|
|
37
|
+
"clean": "rm -rf dist sfdc src/generated",
|
|
38
|
+
"release:core": "../../scripts/release/core.js --adapter=lds-adapters-platform-interaction-runtime",
|
|
39
|
+
"release:corejar": "yarn build && ../core-build/scripts/core.js --adapter=lds-adapters-platform-interaction-runtime",
|
|
40
|
+
"test:unit": "jest"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@salesforce/lds-bindings": "^1.362.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@salesforce/lds-compiler-plugins": "^1.362.0"
|
|
47
|
+
},
|
|
48
|
+
"nx": {
|
|
49
|
+
"targets": {
|
|
50
|
+
"build": {
|
|
51
|
+
"outputs": [
|
|
52
|
+
"{projectRoot}/dist",
|
|
53
|
+
"{projectRoot}/sfdc"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"build:raml": {
|
|
57
|
+
"outputs": [
|
|
58
|
+
"{projectRoot}/src/generated"
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"volta": {
|
|
64
|
+
"extends": "../../package.json"
|
|
65
|
+
}
|
|
66
|
+
}
|
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,316 @@
|
|
|
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 { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
|
|
16
|
+
import { withDefaultLuvio } from 'force/ldsEngine';
|
|
17
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckConfig as typeCheckConfig$1, StoreKeyMap, createResourceParams as createResourceParams$1 } from 'force/luvioEngine';
|
|
18
|
+
|
|
19
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
20
|
+
const { keys: ObjectKeys, create: ObjectCreate } = Object;
|
|
21
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
22
|
+
/**
|
|
23
|
+
* Validates an adapter config is well-formed.
|
|
24
|
+
* @param config The config to validate.
|
|
25
|
+
* @param adapter The adapter validation configuration.
|
|
26
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
27
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
28
|
+
*/
|
|
29
|
+
function validateConfig(config, adapter, oneOf) {
|
|
30
|
+
const { displayName } = adapter;
|
|
31
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
32
|
+
if (config === undefined ||
|
|
33
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
34
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
35
|
+
}
|
|
36
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
37
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
38
|
+
}
|
|
39
|
+
if (unsupported !== undefined &&
|
|
40
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
41
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
42
|
+
}
|
|
43
|
+
const supported = required.concat(optional);
|
|
44
|
+
if (ObjectKeys(config).some(key => !supported.includes(key))) {
|
|
45
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function untrustedIsObject(untrusted) {
|
|
49
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
50
|
+
}
|
|
51
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
52
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
53
|
+
}
|
|
54
|
+
const snapshotRefreshOptions = {
|
|
55
|
+
overrides: {
|
|
56
|
+
headers: {
|
|
57
|
+
'Cache-Control': 'no-cache',
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
62
|
+
return {
|
|
63
|
+
name,
|
|
64
|
+
required,
|
|
65
|
+
resourceType,
|
|
66
|
+
typeCheckShape,
|
|
67
|
+
isArrayShape,
|
|
68
|
+
coerceFn,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
72
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
73
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
74
|
+
return {
|
|
75
|
+
displayName,
|
|
76
|
+
parameters: {
|
|
77
|
+
required,
|
|
78
|
+
optional,
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const keyPrefix = 'InteractionRuntime';
|
|
83
|
+
|
|
84
|
+
const { isArray: ArrayIsArray } = Array;
|
|
85
|
+
const { stringify: JSONStringify } = JSON;
|
|
86
|
+
function createLink(ref) {
|
|
87
|
+
return {
|
|
88
|
+
__ref: serializeStructuredKey(ref),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const TTL = 3600000;
|
|
93
|
+
const VERSION = "b513eb396e89dd15cc16d4d20194db51";
|
|
94
|
+
function validate(obj, path = 'FlowMetadataResponseRepresentation') {
|
|
95
|
+
const v_error = (() => {
|
|
96
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
97
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
98
|
+
}
|
|
99
|
+
const obj_error = obj.error;
|
|
100
|
+
const path_error = path + '.error';
|
|
101
|
+
if (obj_error === undefined) {
|
|
102
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_error + '" (at "' + path_error + '")');
|
|
103
|
+
}
|
|
104
|
+
const obj_response = obj.response;
|
|
105
|
+
const path_response = path + '.response';
|
|
106
|
+
if (typeof obj_response !== 'object' || ArrayIsArray(obj_response) || obj_response === null) {
|
|
107
|
+
return new TypeError('Expected "object" but received "' + typeof obj_response + '" (at "' + path_response + '")');
|
|
108
|
+
}
|
|
109
|
+
})();
|
|
110
|
+
return v_error === undefined ? null : v_error;
|
|
111
|
+
}
|
|
112
|
+
const RepresentationType = 'FlowMetadataResponseRepresentation';
|
|
113
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
114
|
+
return input;
|
|
115
|
+
}
|
|
116
|
+
const select$1 = function FlowMetadataResponseRepresentationSelect() {
|
|
117
|
+
return {
|
|
118
|
+
kind: 'Fragment',
|
|
119
|
+
version: VERSION,
|
|
120
|
+
private: [],
|
|
121
|
+
opaque: true
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
function equals(existing, incoming) {
|
|
125
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
const ingest = function FlowMetadataResponseRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
131
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
132
|
+
const validateError = validate(input);
|
|
133
|
+
if (validateError !== null) {
|
|
134
|
+
throw validateError;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const key = path.fullPath;
|
|
138
|
+
const ttlToUse = TTL;
|
|
139
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "InteractionRuntime", VERSION, RepresentationType, equals);
|
|
140
|
+
return createLink(key);
|
|
141
|
+
};
|
|
142
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
143
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
144
|
+
const rootKey = fullPathFactory();
|
|
145
|
+
rootKeySet.set(rootKey, {
|
|
146
|
+
namespace: keyPrefix,
|
|
147
|
+
representationName: RepresentationType,
|
|
148
|
+
mergeable: false
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function select(luvio, params) {
|
|
153
|
+
return select$1();
|
|
154
|
+
}
|
|
155
|
+
function keyBuilder$1(luvio, params) {
|
|
156
|
+
return keyPrefix + '::FlowMetadataResponseRepresentation:(' + 'flowDevName:' + params.queryParams.flowDevName + ',' + 'flowVersionId:' + params.queryParams.flowVersionId + ')';
|
|
157
|
+
}
|
|
158
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
159
|
+
getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
160
|
+
}
|
|
161
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
162
|
+
const { body } = response;
|
|
163
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
164
|
+
luvio.storeIngest(key, ingest, body);
|
|
165
|
+
const snapshot = luvio.storeLookup({
|
|
166
|
+
recordId: key,
|
|
167
|
+
node: select(),
|
|
168
|
+
variables: {},
|
|
169
|
+
}, snapshotRefresh);
|
|
170
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
171
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
172
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
deepFreeze(snapshot.data);
|
|
176
|
+
return snapshot;
|
|
177
|
+
}
|
|
178
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
179
|
+
const key = keyBuilder$1(luvio, params);
|
|
180
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
181
|
+
const storeMetadataParams = {
|
|
182
|
+
ttl: TTL,
|
|
183
|
+
namespace: keyPrefix,
|
|
184
|
+
version: VERSION,
|
|
185
|
+
representationName: RepresentationType
|
|
186
|
+
};
|
|
187
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
188
|
+
return errorSnapshot;
|
|
189
|
+
}
|
|
190
|
+
function createResourceRequest(config) {
|
|
191
|
+
const headers = {};
|
|
192
|
+
return {
|
|
193
|
+
baseUri: '/services/data/v65.0',
|
|
194
|
+
basePath: '/connect/interaction/runtime/flowMetadata',
|
|
195
|
+
method: 'get',
|
|
196
|
+
body: null,
|
|
197
|
+
urlParams: {},
|
|
198
|
+
queryParams: config.queryParams,
|
|
199
|
+
headers,
|
|
200
|
+
priority: 'normal',
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const adapterName = 'getFlowMetadata';
|
|
205
|
+
const getFlowMetadata_ConfigPropertyMetadata = [
|
|
206
|
+
generateParamConfigMetadata('flowDevName', true, 1 /* QueryParameter */, 0 /* String */),
|
|
207
|
+
generateParamConfigMetadata('flowVersionId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
208
|
+
];
|
|
209
|
+
const getFlowMetadata_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getFlowMetadata_ConfigPropertyMetadata);
|
|
210
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$1(getFlowMetadata_ConfigPropertyMetadata);
|
|
211
|
+
function keyBuilder(luvio, config) {
|
|
212
|
+
const resourceParams = createResourceParams(config);
|
|
213
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
214
|
+
}
|
|
215
|
+
function typeCheckConfig(untrustedConfig) {
|
|
216
|
+
const config = {};
|
|
217
|
+
typeCheckConfig$1(untrustedConfig, config, getFlowMetadata_ConfigPropertyMetadata);
|
|
218
|
+
return config;
|
|
219
|
+
}
|
|
220
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
221
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
225
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
226
|
+
}
|
|
227
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
228
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
return config;
|
|
232
|
+
}
|
|
233
|
+
function adapterFragment(luvio, config) {
|
|
234
|
+
createResourceParams(config);
|
|
235
|
+
return select();
|
|
236
|
+
}
|
|
237
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
238
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
239
|
+
config,
|
|
240
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
241
|
+
});
|
|
242
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
243
|
+
}
|
|
244
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
245
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
246
|
+
config,
|
|
247
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
248
|
+
});
|
|
249
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
250
|
+
}
|
|
251
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
252
|
+
const resourceParams = createResourceParams(config);
|
|
253
|
+
const request = createResourceRequest(resourceParams);
|
|
254
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
255
|
+
.then((response) => {
|
|
256
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
257
|
+
const cache = new StoreKeyMap();
|
|
258
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
259
|
+
return cache;
|
|
260
|
+
});
|
|
261
|
+
}, (response) => {
|
|
262
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
266
|
+
return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
|
|
267
|
+
}
|
|
268
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
269
|
+
const { luvio, config } = context;
|
|
270
|
+
const selector = {
|
|
271
|
+
recordId: keyBuilder(luvio, config),
|
|
272
|
+
node: adapterFragment(luvio, config),
|
|
273
|
+
variables: {},
|
|
274
|
+
};
|
|
275
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
276
|
+
config,
|
|
277
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
278
|
+
});
|
|
279
|
+
return cacheSnapshot;
|
|
280
|
+
}
|
|
281
|
+
const getFlowMetadataAdapterFactory = (luvio) => function InteractionRuntime__getFlowMetadata(untrustedConfig, requestContext) {
|
|
282
|
+
const config = validateAdapterConfig(untrustedConfig, getFlowMetadata_ConfigPropertyNames);
|
|
283
|
+
// Invalid or incomplete config
|
|
284
|
+
if (config === null) {
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
288
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
let getFlowMetadata;
|
|
292
|
+
// Imperative GET Adapters
|
|
293
|
+
let getFlowMetadata_imperative;
|
|
294
|
+
// Adapter Metadata
|
|
295
|
+
const getFlowMetadataMetadata = {
|
|
296
|
+
apiFamily: 'InteractionRuntime',
|
|
297
|
+
name: 'getFlowMetadata',
|
|
298
|
+
ttl: 3600000,
|
|
299
|
+
};
|
|
300
|
+
// Notify Update Available
|
|
301
|
+
function bindExportsTo(luvio) {
|
|
302
|
+
// LDS Adapters
|
|
303
|
+
const getFlowMetadata_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getFlowMetadata', getFlowMetadataAdapterFactory), getFlowMetadataMetadata);
|
|
304
|
+
return {
|
|
305
|
+
getFlowMetadata: createWireAdapterConstructor(luvio, getFlowMetadata_ldsAdapter, getFlowMetadataMetadata),
|
|
306
|
+
// Imperative GET Adapters
|
|
307
|
+
getFlowMetadata_imperative: createImperativeAdapter(luvio, getFlowMetadata_ldsAdapter, getFlowMetadataMetadata),
|
|
308
|
+
// Notify Update Availables
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
withDefaultLuvio((luvio) => {
|
|
312
|
+
({ getFlowMetadata, getFlowMetadata_imperative } = bindExportsTo(luvio));
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
export { getFlowMetadata, getFlowMetadata_imperative };
|
|
316
|
+
// version: 1.362.0-d2e818ae61
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#%RAML 1.0
|
|
2
|
+
securedBy:
|
|
3
|
+
- OAuth2
|
|
4
|
+
title: Salesforce Connect API
|
|
5
|
+
version: '65.0'
|
|
6
|
+
mediaType: application/json
|
|
7
|
+
protocols:
|
|
8
|
+
- https
|
|
9
|
+
baseUri: /services/data/v65.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
|
+
FlowMetadataResponseRepresentation:
|
|
29
|
+
description: Flow Metadata Response Representation
|
|
30
|
+
type: object
|
|
31
|
+
properties:
|
|
32
|
+
error:
|
|
33
|
+
description: Error
|
|
34
|
+
type: any
|
|
35
|
+
response:
|
|
36
|
+
description: Flow Metadata Response
|
|
37
|
+
type: object
|
|
38
|
+
|
|
39
|
+
/connect/interaction:
|
|
40
|
+
/runtime:
|
|
41
|
+
/flowMetadata:
|
|
42
|
+
get:
|
|
43
|
+
displayName: getFlowMetadata
|
|
44
|
+
description: Retrieves flow metadata
|
|
45
|
+
responses:
|
|
46
|
+
'200':
|
|
47
|
+
description: Success
|
|
48
|
+
body:
|
|
49
|
+
application/json:
|
|
50
|
+
type: FlowMetadataResponseRepresentation
|
|
51
|
+
queryParameters:
|
|
52
|
+
flowDevName:
|
|
53
|
+
type: string
|
|
54
|
+
required: true
|
|
55
|
+
flowVersionId:
|
|
56
|
+
type: string
|
|
57
|
+
required: false
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#%RAML 1.0 Overlay
|
|
2
|
+
extends: ./api.raml
|
|
3
|
+
|
|
4
|
+
uses:
|
|
5
|
+
luvio: luvio://annotations.raml
|
|
6
|
+
|
|
7
|
+
(luvio.keyPrefix): 'InteractionRuntime'
|
|
8
|
+
(luvio.ttl): 3600000
|
|
9
|
+
|
|
10
|
+
types:
|
|
11
|
+
FlowMetadataResponseRepresentation:
|
|
12
|
+
(luvio.ttl): 3600000 # 1 hour
|
|
13
|
+
(luvio.opaque): true # This tells that the response structure is complex and
|
|
14
|
+
|
|
15
|
+
/connect/interaction/runtime:
|
|
16
|
+
/flowMetadata:
|
|
17
|
+
get:
|
|
18
|
+
(luvio.adapter):
|
|
19
|
+
name: getFlowMetadata
|
|
20
|
+
queryParameters:
|
|
21
|
+
flowDevName:
|
|
22
|
+
type: string
|
|
23
|
+
required: true
|
|
24
|
+
flowVersionId:
|
|
25
|
+
type: string
|
|
26
|
+
required: false
|
|
27
|
+
responses:
|
|
28
|
+
200:
|
|
29
|
+
body:
|
|
30
|
+
application/json:
|
|
31
|
+
type: FlowMetadataResponseRepresentation
|