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