@salesforce/lds-adapters-industries-externaldocument 1.100.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +82 -0
- package/dist/es/es2018/industries-externaldocument.js +801 -0
- package/dist/types/src/generated/adapters/adapter-utils.d.ts +66 -0
- package/dist/types/src/generated/adapters/createExternalDocument.d.ts +15 -0
- package/dist/types/src/generated/adapters/getExternalDocument.d.ts +27 -0
- package/dist/types/src/generated/adapters/saveExternalDocument.d.ts +15 -0
- package/dist/types/src/generated/artifacts/main.d.ts +3 -0
- package/dist/types/src/generated/artifacts/sfdc.d.ts +5 -0
- package/dist/types/src/generated/resources/getConnectExternalDocument.d.ts +16 -0
- package/dist/types/src/generated/resources/patchConnectExternalDocument.d.ts +13 -0
- package/dist/types/src/generated/resources/postConnectExternalDocument.d.ts +13 -0
- package/dist/types/src/generated/types/ExternalDocCreationInputRepresentation.d.ts +39 -0
- package/dist/types/src/generated/types/ExternalDocCreationInputRepresentationWrapper.d.ts +39 -0
- package/dist/types/src/generated/types/ExternalDocCreationOutputRepresentation.d.ts +48 -0
- package/dist/types/src/generated/types/ExternalDocumentMetadataRepresentation.d.ts +33 -0
- package/dist/types/src/generated/types/ExternalDocumentOutputRepresentation.d.ts +45 -0
- package/dist/types/src/generated/types/ObjectReferenceRepresentation.d.ts +36 -0
- package/dist/types/src/generated/types/SaveExternalDocumentInputRepresentation.d.ts +36 -0
- package/dist/types/src/generated/types/SaveExternalDocumentInputRepresentationWrapper.d.ts +39 -0
- package/dist/types/src/generated/types/SaveExternalDocumentRepresentation.d.ts +45 -0
- package/dist/types/src/generated/types/SectionRepresentation.d.ts +36 -0
- package/dist/types/src/generated/types/UsagesRepresentation.d.ts +33 -0
- package/dist/types/src/generated/types/type-utils.d.ts +39 -0
- package/dist/umd/es2018/industries-externaldocument.js +811 -0
- package/dist/umd/es5/industries-externaldocument.js +816 -0
- package/package.json +70 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +842 -0
- package/src/raml/api.raml +225 -0
- package/src/raml/luvio.raml +55 -0
|
@@ -0,0 +1,801 @@
|
|
|
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, StoreKeyMap } from '@luvio/engine';
|
|
8
|
+
|
|
9
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
+
const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = 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$1(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
|
+
const keyPrefix = 'ExternalDocument';
|
|
52
|
+
|
|
53
|
+
const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
54
|
+
const { isArray: ArrayIsArray } = Array;
|
|
55
|
+
const { stringify: JSONStringify } = JSON;
|
|
56
|
+
function deepFreeze$3(value) {
|
|
57
|
+
// No need to freeze primitives
|
|
58
|
+
if (typeof value !== 'object' || value === null) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (ArrayIsArray(value)) {
|
|
62
|
+
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
63
|
+
deepFreeze$3(value[i]);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
const keys = ObjectKeys(value);
|
|
68
|
+
for (let i = 0, len = keys.length; i < len; i += 1) {
|
|
69
|
+
deepFreeze$3(value[keys[i]]);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
ObjectFreeze(value);
|
|
73
|
+
}
|
|
74
|
+
function createLink(ref) {
|
|
75
|
+
return {
|
|
76
|
+
__ref: serializeStructuredKey(ref),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const TTL$2 = 60000;
|
|
81
|
+
const VERSION$2 = "641dbe0f048b436a2f7b34ac9bf1ddd1";
|
|
82
|
+
function validate$4(obj, path = 'ExternalDocumentOutputRepresentation') {
|
|
83
|
+
const v_error = (() => {
|
|
84
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
85
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
86
|
+
}
|
|
87
|
+
const obj_contentVersionId = obj.contentVersionId;
|
|
88
|
+
const path_contentVersionId = path + '.contentVersionId';
|
|
89
|
+
if (typeof obj_contentVersionId !== 'string') {
|
|
90
|
+
return new TypeError('Expected "string" but received "' + typeof obj_contentVersionId + '" (at "' + path_contentVersionId + '")');
|
|
91
|
+
}
|
|
92
|
+
const obj_externalDocumentId = obj.externalDocumentId;
|
|
93
|
+
const path_externalDocumentId = path + '.externalDocumentId';
|
|
94
|
+
if (typeof obj_externalDocumentId !== 'string') {
|
|
95
|
+
return new TypeError('Expected "string" but received "' + typeof obj_externalDocumentId + '" (at "' + path_externalDocumentId + '")');
|
|
96
|
+
}
|
|
97
|
+
const obj_externalUserId = obj.externalUserId;
|
|
98
|
+
const path_externalUserId = path + '.externalUserId';
|
|
99
|
+
if (typeof obj_externalUserId !== 'string') {
|
|
100
|
+
return new TypeError('Expected "string" but received "' + typeof obj_externalUserId + '" (at "' + path_externalUserId + '")');
|
|
101
|
+
}
|
|
102
|
+
const obj_referenceObject = obj.referenceObject;
|
|
103
|
+
const path_referenceObject = path + '.referenceObject';
|
|
104
|
+
if (typeof obj_referenceObject !== 'string') {
|
|
105
|
+
return new TypeError('Expected "string" but received "' + typeof obj_referenceObject + '" (at "' + path_referenceObject + '")');
|
|
106
|
+
}
|
|
107
|
+
const obj_referenceObjectId = obj.referenceObjectId;
|
|
108
|
+
const path_referenceObjectId = path + '.referenceObjectId';
|
|
109
|
+
if (typeof obj_referenceObjectId !== 'string') {
|
|
110
|
+
return new TypeError('Expected "string" but received "' + typeof obj_referenceObjectId + '" (at "' + path_referenceObjectId + '")');
|
|
111
|
+
}
|
|
112
|
+
const obj_url = obj.url;
|
|
113
|
+
const path_url = path + '.url';
|
|
114
|
+
if (typeof obj_url !== 'string') {
|
|
115
|
+
return new TypeError('Expected "string" but received "' + typeof obj_url + '" (at "' + path_url + '")');
|
|
116
|
+
}
|
|
117
|
+
})();
|
|
118
|
+
return v_error === undefined ? null : v_error;
|
|
119
|
+
}
|
|
120
|
+
const RepresentationType$2 = 'ExternalDocumentOutputRepresentation';
|
|
121
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
122
|
+
return input;
|
|
123
|
+
}
|
|
124
|
+
const select$5 = function ExternalDocumentOutputRepresentationSelect() {
|
|
125
|
+
return {
|
|
126
|
+
kind: 'Fragment',
|
|
127
|
+
version: VERSION$2,
|
|
128
|
+
private: [],
|
|
129
|
+
opaque: true
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
function equals$2(existing, incoming) {
|
|
133
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
function deepFreeze$2(input) {
|
|
139
|
+
ObjectFreeze(input);
|
|
140
|
+
}
|
|
141
|
+
const ingest$2 = function ExternalDocumentOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
142
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
143
|
+
const validateError = validate$4(input);
|
|
144
|
+
if (validateError !== null) {
|
|
145
|
+
throw validateError;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const key = path.fullPath;
|
|
149
|
+
const existingRecord = store.readEntry(key);
|
|
150
|
+
const ttlToUse = TTL$2;
|
|
151
|
+
let incomingRecord = normalize$2(input, store.readEntry(key), {
|
|
152
|
+
fullPath: key,
|
|
153
|
+
parent: path.parent,
|
|
154
|
+
propertyName: path.propertyName,
|
|
155
|
+
ttl: ttlToUse
|
|
156
|
+
});
|
|
157
|
+
deepFreeze$2(input);
|
|
158
|
+
if (existingRecord === undefined || equals$2(existingRecord, incomingRecord) === false) {
|
|
159
|
+
luvio.storePublish(key, incomingRecord);
|
|
160
|
+
}
|
|
161
|
+
{
|
|
162
|
+
const storeMetadataParams = {
|
|
163
|
+
ttl: ttlToUse,
|
|
164
|
+
namespace: "ExternalDocument",
|
|
165
|
+
version: VERSION$2,
|
|
166
|
+
representationName: RepresentationType$2,
|
|
167
|
+
};
|
|
168
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
169
|
+
}
|
|
170
|
+
return createLink(key);
|
|
171
|
+
};
|
|
172
|
+
function getTypeCacheKeys$2(luvio, input, fullPathFactory) {
|
|
173
|
+
const rootKeySet = new StoreKeyMap();
|
|
174
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
175
|
+
const rootKey = fullPathFactory();
|
|
176
|
+
rootKeySet.set(rootKey, {
|
|
177
|
+
namespace: keyPrefix,
|
|
178
|
+
representationName: RepresentationType$2,
|
|
179
|
+
mergeable: false
|
|
180
|
+
});
|
|
181
|
+
return rootKeySet;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function select$4(luvio, params) {
|
|
185
|
+
return select$5();
|
|
186
|
+
}
|
|
187
|
+
function keyBuilder$3(luvio, params) {
|
|
188
|
+
return keyPrefix + '::ExternalDocumentOutputRepresentation:(' + 'externalDocumentId:' + params.queryParams.externalDocumentId + ',' + 'refObjectId:' + params.queryParams.refObjectId + ')';
|
|
189
|
+
}
|
|
190
|
+
function getResponseCacheKeys$2(luvio, resourceParams, response) {
|
|
191
|
+
return getTypeCacheKeys$2(luvio, response, () => keyBuilder$3(luvio, resourceParams));
|
|
192
|
+
}
|
|
193
|
+
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
194
|
+
const { body } = response;
|
|
195
|
+
const key = keyBuilder$3(luvio, resourceParams);
|
|
196
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
197
|
+
const snapshot = luvio.storeLookup({
|
|
198
|
+
recordId: key,
|
|
199
|
+
node: select$4(),
|
|
200
|
+
variables: {},
|
|
201
|
+
}, snapshotRefresh);
|
|
202
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
203
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
204
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return snapshot;
|
|
208
|
+
}
|
|
209
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
210
|
+
const key = keyBuilder$3(luvio, params);
|
|
211
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
212
|
+
const storeMetadataParams = {
|
|
213
|
+
ttl: TTL$2,
|
|
214
|
+
namespace: keyPrefix,
|
|
215
|
+
version: VERSION$2,
|
|
216
|
+
representationName: RepresentationType$2
|
|
217
|
+
};
|
|
218
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
219
|
+
return errorSnapshot;
|
|
220
|
+
}
|
|
221
|
+
function createResourceRequest$2(config) {
|
|
222
|
+
const headers = {};
|
|
223
|
+
return {
|
|
224
|
+
baseUri: '/services/data/v58.0',
|
|
225
|
+
basePath: '/connect/external-document',
|
|
226
|
+
method: 'get',
|
|
227
|
+
body: null,
|
|
228
|
+
urlParams: {},
|
|
229
|
+
queryParams: config.queryParams,
|
|
230
|
+
headers,
|
|
231
|
+
priority: 'normal',
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const getExternalDocument_ConfigPropertyNames = {
|
|
236
|
+
displayName: 'getExternalDocument',
|
|
237
|
+
parameters: {
|
|
238
|
+
required: [],
|
|
239
|
+
optional: ['externalDocumentId', 'refObjectId']
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
function createResourceParams$2(config) {
|
|
243
|
+
const resourceParams = {
|
|
244
|
+
queryParams: {
|
|
245
|
+
externalDocumentId: config.externalDocumentId, refObjectId: config.refObjectId
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
return resourceParams;
|
|
249
|
+
}
|
|
250
|
+
function keyBuilder$2(luvio, config) {
|
|
251
|
+
const resourceParams = createResourceParams$2(config);
|
|
252
|
+
return keyBuilder$3(luvio, resourceParams);
|
|
253
|
+
}
|
|
254
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
255
|
+
const config = {};
|
|
256
|
+
const untrustedConfig_externalDocumentId = untrustedConfig.externalDocumentId;
|
|
257
|
+
if (typeof untrustedConfig_externalDocumentId === 'string') {
|
|
258
|
+
config.externalDocumentId = untrustedConfig_externalDocumentId;
|
|
259
|
+
}
|
|
260
|
+
const untrustedConfig_refObjectId = untrustedConfig.refObjectId;
|
|
261
|
+
if (typeof untrustedConfig_refObjectId === 'string') {
|
|
262
|
+
config.refObjectId = untrustedConfig_refObjectId;
|
|
263
|
+
}
|
|
264
|
+
return config;
|
|
265
|
+
}
|
|
266
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
267
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
271
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
272
|
+
}
|
|
273
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
274
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
return config;
|
|
278
|
+
}
|
|
279
|
+
function adapterFragment(luvio, config) {
|
|
280
|
+
createResourceParams$2(config);
|
|
281
|
+
return select$4();
|
|
282
|
+
}
|
|
283
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
284
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
285
|
+
config,
|
|
286
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
287
|
+
});
|
|
288
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
289
|
+
}
|
|
290
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
291
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
292
|
+
config,
|
|
293
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
294
|
+
});
|
|
295
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
296
|
+
}
|
|
297
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
298
|
+
const resourceParams = createResourceParams$2(config);
|
|
299
|
+
const request = createResourceRequest$2(resourceParams);
|
|
300
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
301
|
+
.then((response) => {
|
|
302
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys$2(luvio, resourceParams, response.body));
|
|
303
|
+
}, (response) => {
|
|
304
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
308
|
+
const { luvio, config } = context;
|
|
309
|
+
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
310
|
+
const dispatchOptions = {
|
|
311
|
+
resourceRequestContext: {
|
|
312
|
+
requestCorrelator,
|
|
313
|
+
luvioRequestMethod: undefined,
|
|
314
|
+
},
|
|
315
|
+
eventObservers
|
|
316
|
+
};
|
|
317
|
+
if (networkPriority !== 'normal') {
|
|
318
|
+
dispatchOptions.overrides = {
|
|
319
|
+
priority: networkPriority
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
return buildNetworkSnapshot$2(luvio, config, dispatchOptions);
|
|
323
|
+
}
|
|
324
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
325
|
+
const { luvio, config } = context;
|
|
326
|
+
const selector = {
|
|
327
|
+
recordId: keyBuilder$2(luvio, config),
|
|
328
|
+
node: adapterFragment(luvio, config),
|
|
329
|
+
variables: {},
|
|
330
|
+
};
|
|
331
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
332
|
+
config,
|
|
333
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
334
|
+
});
|
|
335
|
+
return cacheSnapshot;
|
|
336
|
+
}
|
|
337
|
+
const getExternalDocumentAdapterFactory = (luvio) => function ExternalDocument__getExternalDocument(untrustedConfig, requestContext) {
|
|
338
|
+
const config = validateAdapterConfig$2(untrustedConfig, getExternalDocument_ConfigPropertyNames);
|
|
339
|
+
// Invalid or incomplete config
|
|
340
|
+
if (config === null) {
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
344
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
function validate$3(obj, path = 'SaveExternalDocumentInputRepresentation') {
|
|
348
|
+
const v_error = (() => {
|
|
349
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
350
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
351
|
+
}
|
|
352
|
+
const obj_externalDocumentId = obj.externalDocumentId;
|
|
353
|
+
const path_externalDocumentId = path + '.externalDocumentId';
|
|
354
|
+
if (typeof obj_externalDocumentId !== 'string') {
|
|
355
|
+
return new TypeError('Expected "string" but received "' + typeof obj_externalDocumentId + '" (at "' + path_externalDocumentId + '")');
|
|
356
|
+
}
|
|
357
|
+
const obj_isAsync = obj.isAsync;
|
|
358
|
+
const path_isAsync = path + '.isAsync';
|
|
359
|
+
if (typeof obj_isAsync !== 'boolean') {
|
|
360
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isAsync + '" (at "' + path_isAsync + '")');
|
|
361
|
+
}
|
|
362
|
+
const obj_metadata = obj.metadata;
|
|
363
|
+
const path_metadata = path + '.metadata';
|
|
364
|
+
if (typeof obj_metadata !== 'object' || ArrayIsArray(obj_metadata) || obj_metadata === null) {
|
|
365
|
+
return new TypeError('Expected "object" but received "' + typeof obj_metadata + '" (at "' + path_metadata + '")');
|
|
366
|
+
}
|
|
367
|
+
})();
|
|
368
|
+
return v_error === undefined ? null : v_error;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
const TTL$1 = 60000;
|
|
372
|
+
const VERSION$1 = "0073b6a90cebc73156c21fe3fd09256a";
|
|
373
|
+
function validate$2(obj, path = 'SaveExternalDocumentRepresentation') {
|
|
374
|
+
const v_error = (() => {
|
|
375
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
376
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
377
|
+
}
|
|
378
|
+
const obj_id = obj.id;
|
|
379
|
+
const path_id = path + '.id';
|
|
380
|
+
if (typeof obj_id !== 'string') {
|
|
381
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
382
|
+
}
|
|
383
|
+
const obj_isSuccess = obj.isSuccess;
|
|
384
|
+
const path_isSuccess = path + '.isSuccess';
|
|
385
|
+
if (typeof obj_isSuccess !== 'boolean') {
|
|
386
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
|
|
387
|
+
}
|
|
388
|
+
if (obj.message !== undefined) {
|
|
389
|
+
const obj_message = obj.message;
|
|
390
|
+
const path_message = path + '.message';
|
|
391
|
+
if (typeof obj_message !== 'string') {
|
|
392
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
})();
|
|
396
|
+
return v_error === undefined ? null : v_error;
|
|
397
|
+
}
|
|
398
|
+
const RepresentationType$1 = 'SaveExternalDocumentRepresentation';
|
|
399
|
+
function keyBuilder$1(luvio, config) {
|
|
400
|
+
return keyPrefix + '::' + RepresentationType$1 + ':' + config.id;
|
|
401
|
+
}
|
|
402
|
+
function keyBuilderFromType$1(luvio, object) {
|
|
403
|
+
const keyParams = {
|
|
404
|
+
id: object.id
|
|
405
|
+
};
|
|
406
|
+
return keyBuilder$1(luvio, keyParams);
|
|
407
|
+
}
|
|
408
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
409
|
+
return input;
|
|
410
|
+
}
|
|
411
|
+
const select$3 = function SaveExternalDocumentRepresentationSelect() {
|
|
412
|
+
return {
|
|
413
|
+
kind: 'Fragment',
|
|
414
|
+
version: VERSION$1,
|
|
415
|
+
private: [],
|
|
416
|
+
opaque: true
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
function equals$1(existing, incoming) {
|
|
420
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
421
|
+
return false;
|
|
422
|
+
}
|
|
423
|
+
return true;
|
|
424
|
+
}
|
|
425
|
+
function deepFreeze$1(input) {
|
|
426
|
+
ObjectFreeze(input);
|
|
427
|
+
}
|
|
428
|
+
const ingest$1 = function SaveExternalDocumentRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
429
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
430
|
+
const validateError = validate$2(input);
|
|
431
|
+
if (validateError !== null) {
|
|
432
|
+
throw validateError;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
const key = keyBuilderFromType$1(luvio, input);
|
|
436
|
+
const existingRecord = store.readEntry(key);
|
|
437
|
+
const ttlToUse = TTL$1;
|
|
438
|
+
let incomingRecord = normalize$1(input, store.readEntry(key), {
|
|
439
|
+
fullPath: key,
|
|
440
|
+
parent: path.parent,
|
|
441
|
+
propertyName: path.propertyName,
|
|
442
|
+
ttl: ttlToUse
|
|
443
|
+
});
|
|
444
|
+
deepFreeze$1(input);
|
|
445
|
+
if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
|
|
446
|
+
luvio.storePublish(key, incomingRecord);
|
|
447
|
+
}
|
|
448
|
+
{
|
|
449
|
+
const storeMetadataParams = {
|
|
450
|
+
ttl: ttlToUse,
|
|
451
|
+
namespace: "ExternalDocument",
|
|
452
|
+
version: VERSION$1,
|
|
453
|
+
representationName: RepresentationType$1,
|
|
454
|
+
};
|
|
455
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
456
|
+
}
|
|
457
|
+
return createLink(key);
|
|
458
|
+
};
|
|
459
|
+
function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
|
|
460
|
+
const rootKeySet = new StoreKeyMap();
|
|
461
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
462
|
+
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
463
|
+
rootKeySet.set(rootKey, {
|
|
464
|
+
namespace: keyPrefix,
|
|
465
|
+
representationName: RepresentationType$1,
|
|
466
|
+
mergeable: false
|
|
467
|
+
});
|
|
468
|
+
return rootKeySet;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
function select$2(luvio, params) {
|
|
472
|
+
return select$3();
|
|
473
|
+
}
|
|
474
|
+
function getResponseCacheKeys$1(luvio, resourceParams, response) {
|
|
475
|
+
return getTypeCacheKeys$1(luvio, response);
|
|
476
|
+
}
|
|
477
|
+
function ingestSuccess$1(luvio, resourceParams, response) {
|
|
478
|
+
const { body } = response;
|
|
479
|
+
const key = keyBuilderFromType$1(luvio, body);
|
|
480
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
481
|
+
const snapshot = luvio.storeLookup({
|
|
482
|
+
recordId: key,
|
|
483
|
+
node: select$2(),
|
|
484
|
+
variables: {},
|
|
485
|
+
});
|
|
486
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
487
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
488
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return snapshot;
|
|
492
|
+
}
|
|
493
|
+
function createResourceRequest$1(config) {
|
|
494
|
+
const headers = {};
|
|
495
|
+
return {
|
|
496
|
+
baseUri: '/services/data/v58.0',
|
|
497
|
+
basePath: '/connect/external-document',
|
|
498
|
+
method: 'patch',
|
|
499
|
+
body: config.body,
|
|
500
|
+
urlParams: {},
|
|
501
|
+
queryParams: {},
|
|
502
|
+
headers,
|
|
503
|
+
priority: 'normal',
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
const saveExternalDocument_ConfigPropertyNames = {
|
|
508
|
+
displayName: 'saveExternalDocument',
|
|
509
|
+
parameters: {
|
|
510
|
+
required: ['saveExternalDocumentInput'],
|
|
511
|
+
optional: []
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
function createResourceParams$1(config) {
|
|
515
|
+
const resourceParams = {
|
|
516
|
+
body: {
|
|
517
|
+
saveExternalDocumentInput: config.saveExternalDocumentInput
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
return resourceParams;
|
|
521
|
+
}
|
|
522
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
523
|
+
const config = {};
|
|
524
|
+
const untrustedConfig_saveExternalDocumentInput = untrustedConfig.saveExternalDocumentInput;
|
|
525
|
+
const referenceSaveExternalDocumentInputRepresentationValidationError = validate$3(untrustedConfig_saveExternalDocumentInput);
|
|
526
|
+
if (referenceSaveExternalDocumentInputRepresentationValidationError === null) {
|
|
527
|
+
config.saveExternalDocumentInput = untrustedConfig_saveExternalDocumentInput;
|
|
528
|
+
}
|
|
529
|
+
return config;
|
|
530
|
+
}
|
|
531
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
532
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
533
|
+
return null;
|
|
534
|
+
}
|
|
535
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
536
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
537
|
+
}
|
|
538
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
539
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
540
|
+
return null;
|
|
541
|
+
}
|
|
542
|
+
return config;
|
|
543
|
+
}
|
|
544
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
545
|
+
const resourceParams = createResourceParams$1(config);
|
|
546
|
+
const request = createResourceRequest$1(resourceParams);
|
|
547
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
548
|
+
.then((response) => {
|
|
549
|
+
return luvio.handleSuccessResponse(() => {
|
|
550
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response);
|
|
551
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
552
|
+
}, () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
|
|
553
|
+
}, (response) => {
|
|
554
|
+
deepFreeze$3(response);
|
|
555
|
+
throw response;
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
const saveExternalDocumentAdapterFactory = (luvio) => {
|
|
559
|
+
return function saveExternalDocument(untrustedConfig) {
|
|
560
|
+
const config = validateAdapterConfig$1(untrustedConfig, saveExternalDocument_ConfigPropertyNames);
|
|
561
|
+
// Invalid or incomplete config
|
|
562
|
+
if (config === null) {
|
|
563
|
+
throw new Error('Invalid config for "saveExternalDocument"');
|
|
564
|
+
}
|
|
565
|
+
return buildNetworkSnapshot$1(luvio, config);
|
|
566
|
+
};
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
function validate$1(obj, path = 'ExternalDocCreationInputRepresentation') {
|
|
570
|
+
const v_error = (() => {
|
|
571
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
572
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
573
|
+
}
|
|
574
|
+
const obj_contentVersionId = obj.contentVersionId;
|
|
575
|
+
const path_contentVersionId = path + '.contentVersionId';
|
|
576
|
+
if (typeof obj_contentVersionId !== 'string') {
|
|
577
|
+
return new TypeError('Expected "string" but received "' + typeof obj_contentVersionId + '" (at "' + path_contentVersionId + '")');
|
|
578
|
+
}
|
|
579
|
+
const obj_documentNamePrefix = obj.documentNamePrefix;
|
|
580
|
+
const path_documentNamePrefix = path + '.documentNamePrefix';
|
|
581
|
+
if (typeof obj_documentNamePrefix !== 'string') {
|
|
582
|
+
return new TypeError('Expected "string" but received "' + typeof obj_documentNamePrefix + '" (at "' + path_documentNamePrefix + '")');
|
|
583
|
+
}
|
|
584
|
+
const obj_isAsync = obj.isAsync;
|
|
585
|
+
const path_isAsync = path + '.isAsync';
|
|
586
|
+
if (typeof obj_isAsync !== 'string') {
|
|
587
|
+
return new TypeError('Expected "string" but received "' + typeof obj_isAsync + '" (at "' + path_isAsync + '")');
|
|
588
|
+
}
|
|
589
|
+
const obj_refObjectId = obj.refObjectId;
|
|
590
|
+
const path_refObjectId = path + '.refObjectId';
|
|
591
|
+
if (typeof obj_refObjectId !== 'string') {
|
|
592
|
+
return new TypeError('Expected "string" but received "' + typeof obj_refObjectId + '" (at "' + path_refObjectId + '")');
|
|
593
|
+
}
|
|
594
|
+
})();
|
|
595
|
+
return v_error === undefined ? null : v_error;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
const TTL = 60000;
|
|
599
|
+
const VERSION = "62b6ff2897ad48f08a170ff28e50d628";
|
|
600
|
+
function validate(obj, path = 'ExternalDocCreationOutputRepresentation') {
|
|
601
|
+
const v_error = (() => {
|
|
602
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
603
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
604
|
+
}
|
|
605
|
+
const obj_externalDocumentDetails = obj.externalDocumentDetails;
|
|
606
|
+
const path_externalDocumentDetails = path + '.externalDocumentDetails';
|
|
607
|
+
if (typeof obj_externalDocumentDetails !== 'object' || ArrayIsArray(obj_externalDocumentDetails) || obj_externalDocumentDetails === null) {
|
|
608
|
+
return new TypeError('Expected "object" but received "' + typeof obj_externalDocumentDetails + '" (at "' + path_externalDocumentDetails + '")');
|
|
609
|
+
}
|
|
610
|
+
const obj_isSuccess = obj.isSuccess;
|
|
611
|
+
const path_isSuccess = path + '.isSuccess';
|
|
612
|
+
if (typeof obj_isSuccess !== 'boolean') {
|
|
613
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
|
|
614
|
+
}
|
|
615
|
+
const obj_message = obj.message;
|
|
616
|
+
const path_message = path + '.message';
|
|
617
|
+
if (typeof obj_message !== 'string') {
|
|
618
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
619
|
+
}
|
|
620
|
+
const obj_ssoLinkUrl = obj.ssoLinkUrl;
|
|
621
|
+
const path_ssoLinkUrl = path + '.ssoLinkUrl';
|
|
622
|
+
if (typeof obj_ssoLinkUrl !== 'string') {
|
|
623
|
+
return new TypeError('Expected "string" but received "' + typeof obj_ssoLinkUrl + '" (at "' + path_ssoLinkUrl + '")');
|
|
624
|
+
}
|
|
625
|
+
})();
|
|
626
|
+
return v_error === undefined ? null : v_error;
|
|
627
|
+
}
|
|
628
|
+
const RepresentationType = 'ExternalDocCreationOutputRepresentation';
|
|
629
|
+
function keyBuilder(luvio, config) {
|
|
630
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.isSuccess;
|
|
631
|
+
}
|
|
632
|
+
function keyBuilderFromType(luvio, object) {
|
|
633
|
+
const keyParams = {
|
|
634
|
+
isSuccess: object.isSuccess
|
|
635
|
+
};
|
|
636
|
+
return keyBuilder(luvio, keyParams);
|
|
637
|
+
}
|
|
638
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
639
|
+
return input;
|
|
640
|
+
}
|
|
641
|
+
const select$1 = function ExternalDocCreationOutputRepresentationSelect() {
|
|
642
|
+
return {
|
|
643
|
+
kind: 'Fragment',
|
|
644
|
+
version: VERSION,
|
|
645
|
+
private: [],
|
|
646
|
+
opaque: true
|
|
647
|
+
};
|
|
648
|
+
};
|
|
649
|
+
function equals(existing, incoming) {
|
|
650
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
651
|
+
return false;
|
|
652
|
+
}
|
|
653
|
+
return true;
|
|
654
|
+
}
|
|
655
|
+
function deepFreeze(input) {
|
|
656
|
+
const input_externalDocumentDetails = input.externalDocumentDetails;
|
|
657
|
+
ObjectFreeze(input_externalDocumentDetails);
|
|
658
|
+
ObjectFreeze(input);
|
|
659
|
+
}
|
|
660
|
+
const ingest = function ExternalDocCreationOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
661
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
662
|
+
const validateError = validate(input);
|
|
663
|
+
if (validateError !== null) {
|
|
664
|
+
throw validateError;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
const key = keyBuilderFromType(luvio, input);
|
|
668
|
+
const existingRecord = store.readEntry(key);
|
|
669
|
+
const ttlToUse = TTL;
|
|
670
|
+
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
671
|
+
fullPath: key,
|
|
672
|
+
parent: path.parent,
|
|
673
|
+
propertyName: path.propertyName,
|
|
674
|
+
ttl: ttlToUse
|
|
675
|
+
});
|
|
676
|
+
deepFreeze(input);
|
|
677
|
+
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
678
|
+
luvio.storePublish(key, incomingRecord);
|
|
679
|
+
}
|
|
680
|
+
{
|
|
681
|
+
const storeMetadataParams = {
|
|
682
|
+
ttl: ttlToUse,
|
|
683
|
+
namespace: "ExternalDocument",
|
|
684
|
+
version: VERSION,
|
|
685
|
+
representationName: RepresentationType,
|
|
686
|
+
};
|
|
687
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
688
|
+
}
|
|
689
|
+
return createLink(key);
|
|
690
|
+
};
|
|
691
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
692
|
+
const rootKeySet = new StoreKeyMap();
|
|
693
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
694
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
695
|
+
rootKeySet.set(rootKey, {
|
|
696
|
+
namespace: keyPrefix,
|
|
697
|
+
representationName: RepresentationType,
|
|
698
|
+
mergeable: false
|
|
699
|
+
});
|
|
700
|
+
return rootKeySet;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
function select(luvio, params) {
|
|
704
|
+
return select$1();
|
|
705
|
+
}
|
|
706
|
+
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
707
|
+
return getTypeCacheKeys(luvio, response);
|
|
708
|
+
}
|
|
709
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
710
|
+
const { body } = response;
|
|
711
|
+
const key = keyBuilderFromType(luvio, body);
|
|
712
|
+
luvio.storeIngest(key, ingest, body);
|
|
713
|
+
const snapshot = luvio.storeLookup({
|
|
714
|
+
recordId: key,
|
|
715
|
+
node: select(),
|
|
716
|
+
variables: {},
|
|
717
|
+
});
|
|
718
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
719
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
720
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
return snapshot;
|
|
724
|
+
}
|
|
725
|
+
function createResourceRequest(config) {
|
|
726
|
+
const headers = {};
|
|
727
|
+
return {
|
|
728
|
+
baseUri: '/services/data/v58.0',
|
|
729
|
+
basePath: '/connect/external-document',
|
|
730
|
+
method: 'post',
|
|
731
|
+
body: config.body,
|
|
732
|
+
urlParams: {},
|
|
733
|
+
queryParams: {},
|
|
734
|
+
headers,
|
|
735
|
+
priority: 'normal',
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
const createExternalDocument_ConfigPropertyNames = {
|
|
740
|
+
displayName: 'createExternalDocument',
|
|
741
|
+
parameters: {
|
|
742
|
+
required: ['createExternalDocumentInput'],
|
|
743
|
+
optional: []
|
|
744
|
+
}
|
|
745
|
+
};
|
|
746
|
+
function createResourceParams(config) {
|
|
747
|
+
const resourceParams = {
|
|
748
|
+
body: {
|
|
749
|
+
createExternalDocumentInput: config.createExternalDocumentInput
|
|
750
|
+
}
|
|
751
|
+
};
|
|
752
|
+
return resourceParams;
|
|
753
|
+
}
|
|
754
|
+
function typeCheckConfig(untrustedConfig) {
|
|
755
|
+
const config = {};
|
|
756
|
+
const untrustedConfig_createExternalDocumentInput = untrustedConfig.createExternalDocumentInput;
|
|
757
|
+
const referenceExternalDocCreationInputRepresentationValidationError = validate$1(untrustedConfig_createExternalDocumentInput);
|
|
758
|
+
if (referenceExternalDocCreationInputRepresentationValidationError === null) {
|
|
759
|
+
config.createExternalDocumentInput = untrustedConfig_createExternalDocumentInput;
|
|
760
|
+
}
|
|
761
|
+
return config;
|
|
762
|
+
}
|
|
763
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
764
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
765
|
+
return null;
|
|
766
|
+
}
|
|
767
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
768
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
769
|
+
}
|
|
770
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
771
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
772
|
+
return null;
|
|
773
|
+
}
|
|
774
|
+
return config;
|
|
775
|
+
}
|
|
776
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
777
|
+
const resourceParams = createResourceParams(config);
|
|
778
|
+
const request = createResourceRequest(resourceParams);
|
|
779
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
780
|
+
.then((response) => {
|
|
781
|
+
return luvio.handleSuccessResponse(() => {
|
|
782
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
783
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
784
|
+
}, () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
785
|
+
}, (response) => {
|
|
786
|
+
deepFreeze$3(response);
|
|
787
|
+
throw response;
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
const createExternalDocumentAdapterFactory = (luvio) => {
|
|
791
|
+
return function createExternalDocument(untrustedConfig) {
|
|
792
|
+
const config = validateAdapterConfig(untrustedConfig, createExternalDocument_ConfigPropertyNames);
|
|
793
|
+
// Invalid or incomplete config
|
|
794
|
+
if (config === null) {
|
|
795
|
+
throw new Error('Invalid config for "createExternalDocument"');
|
|
796
|
+
}
|
|
797
|
+
return buildNetworkSnapshot(luvio, config);
|
|
798
|
+
};
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
export { createExternalDocumentAdapterFactory, getExternalDocumentAdapterFactory, saveExternalDocumentAdapterFactory };
|