@salesforce/lds-adapters-platform-named-credential 1.124.2 → 1.124.4

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.
Files changed (30) hide show
  1. package/dist/es/es2018/platform-named-credential.js +990 -990
  2. package/dist/{types → es/es2018/types}/src/generated/adapters/adapter-utils.d.ts +66 -66
  3. package/dist/{types → es/es2018/types}/src/generated/adapters/deleteCredential.d.ts +15 -15
  4. package/dist/{types → es/es2018/types}/src/generated/adapters/getExternalCredentials.d.ts +25 -25
  5. package/dist/{types → es/es2018/types}/src/generated/adapters/getOAuthCredentialAuthUrl.d.ts +15 -15
  6. package/dist/{types → es/es2018/types}/src/generated/artifacts/main.d.ts +3 -3
  7. package/dist/{types → es/es2018/types}/src/generated/artifacts/sfdc.d.ts +5 -5
  8. package/dist/{types → es/es2018/types}/src/generated/resources/deleteNamedCredentialsCredential.d.ts +14 -14
  9. package/dist/{types → es/es2018/types}/src/generated/resources/getNamedCredentialsCredential.d.ts +17 -17
  10. package/dist/{types → es/es2018/types}/src/generated/resources/getNamedCredentialsExternalCredentials.d.ts +12 -12
  11. package/dist/{types → es/es2018/types}/src/generated/resources/getNamedCredentialsExternalCredentialsByDeveloperName.d.ts +15 -15
  12. package/dist/{types → es/es2018/types}/src/generated/resources/postNamedCredentialsCredential.d.ts +18 -18
  13. package/dist/{types → es/es2018/types}/src/generated/resources/postNamedCredentialsCredentialAuthUrlOAuth.d.ts +13 -13
  14. package/dist/{types → es/es2018/types}/src/generated/resources/putNamedCredentialsCredential.d.ts +18 -18
  15. package/dist/{types → es/es2018/types}/src/generated/types/CredentialInputRepresentation.d.ts +45 -45
  16. package/dist/{types → es/es2018/types}/src/generated/types/CredentialMapRepresentation.d.ts +33 -33
  17. package/dist/{types → es/es2018/types}/src/generated/types/CredentialRepresentation.d.ts +63 -63
  18. package/dist/{types → es/es2018/types}/src/generated/types/ExternalCredentialListRepresentation.d.ts +39 -39
  19. package/dist/{types → es/es2018/types}/src/generated/types/ExternalCredentialPrincipalRepresentation.d.ts +35 -35
  20. package/dist/{types → es/es2018/types}/src/generated/types/ExternalCredentialRepresentation.d.ts +55 -55
  21. package/dist/{types → es/es2018/types}/src/generated/types/NamedCredentialRepresentation.d.ts +32 -32
  22. package/dist/{types → es/es2018/types}/src/generated/types/OAuthCredentialAuthUrlInputRepresentation.d.ts +38 -38
  23. package/dist/{types → es/es2018/types}/src/generated/types/OAuthCredentialAuthUrlInputRepresentationWrapper.d.ts +30 -30
  24. package/dist/{types → es/es2018/types}/src/generated/types/OAuthCredentialAuthUrlRepresentation.d.ts +47 -47
  25. package/dist/{types → es/es2018/types}/src/generated/types/type-utils.d.ts +39 -39
  26. package/package.json +5 -5
  27. package/sfdc/index.d.ts +1 -1
  28. package/sfdc/index.js +1019 -1019
  29. package/dist/umd/es2018/platform-named-credential.js +0 -1039
  30. package/dist/umd/es5/platform-named-credential.js +0 -1045
@@ -1,1045 +0,0 @@
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.platformNamedCredential = {}, 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 = 'named-credential';
56
-
57
- var ObjectFreeze = Object.freeze, ObjectKeys = Object.keys;
58
- var ArrayIsArray = Array.isArray;
59
- function equalsArray(a, b, equalsItem) {
60
- var aLength = a.length;
61
- var bLength = b.length;
62
- if (aLength !== bLength) {
63
- return false;
64
- }
65
- for (var i = 0; i < aLength; i++) {
66
- if (equalsItem(a[i], b[i]) === false) {
67
- return false;
68
- }
69
- }
70
- return true;
71
- }
72
- function deepFreeze(value) {
73
- // No need to freeze primitives
74
- if (typeof value !== 'object' || value === null) {
75
- return;
76
- }
77
- if (ArrayIsArray(value)) {
78
- for (var i = 0, len = value.length; i < len; i += 1) {
79
- deepFreeze(value[i]);
80
- }
81
- }
82
- else {
83
- var keys = ObjectKeys(value);
84
- for (var i = 0, len = keys.length; i < len; i += 1) {
85
- deepFreeze(value[keys[i]]);
86
- }
87
- }
88
- ObjectFreeze(value);
89
- }
90
- function createLink(ref) {
91
- return {
92
- __ref: engine.serializeStructuredKey(ref),
93
- };
94
- }
95
-
96
- var RepresentationType$3 = 'CredentialRepresentation';
97
- function keyBuilder$5(luvio, config) {
98
- return keyPrefix + '::' + RepresentationType$3 + ':' + config.externalCredential + ':' + config.principalType + ':' + (config.principalName === null ? '' : config.principalName);
99
- }
100
-
101
- function keyBuilder$4(luvio, params) {
102
- return keyBuilder$5(luvio, {
103
- externalCredential: params.queryParams.externalCredential || '',
104
- principalType: params.queryParams.principalType || '',
105
- principalName: params.queryParams.principalName || ''
106
- });
107
- }
108
- function getResponseCacheKeys$2(luvio, resourceParams) {
109
- var key = keyBuilder$4(luvio, resourceParams);
110
- var cacheKeyMap = new engine.StoreKeyMap();
111
- cacheKeyMap.set(key, {
112
- namespace: keyPrefix,
113
- representationName: RepresentationType$3,
114
- mergeable: false
115
- });
116
- return cacheKeyMap;
117
- }
118
- function evictSuccess(luvio, resourceParams) {
119
- var key = keyBuilder$4(luvio, resourceParams);
120
- luvio.storeEvict(key);
121
- }
122
- function createResourceRequest$2(config) {
123
- var headers = {};
124
- return {
125
- baseUri: '/services/data/v58.0',
126
- basePath: '/named-credentials/credential',
127
- method: 'delete',
128
- body: null,
129
- urlParams: {},
130
- queryParams: config.queryParams,
131
- headers: headers,
132
- priority: 'normal',
133
- };
134
- }
135
-
136
- var adapterName = 'deleteCredential';
137
- var deleteCredential_ConfigPropertyNames = {
138
- displayName: 'deleteCredential',
139
- parameters: {
140
- required: [],
141
- optional: ['externalCredential', 'principalName', 'principalType']
142
- }
143
- };
144
- function createResourceParams$2(config) {
145
- var resourceParams = {
146
- queryParams: {
147
- externalCredential: config.externalCredential, principalName: config.principalName, principalType: config.principalType
148
- }
149
- };
150
- return resourceParams;
151
- }
152
- function typeCheckConfig$2(untrustedConfig) {
153
- var config = {};
154
- var untrustedConfig_externalCredential = untrustedConfig.externalCredential;
155
- if (typeof untrustedConfig_externalCredential === 'string') {
156
- config.externalCredential = untrustedConfig_externalCredential;
157
- }
158
- var untrustedConfig_principalName = untrustedConfig.principalName;
159
- if (typeof untrustedConfig_principalName === 'string') {
160
- config.principalName = untrustedConfig_principalName;
161
- }
162
- var untrustedConfig_principalType = untrustedConfig.principalType;
163
- if (typeof untrustedConfig_principalType === 'string') {
164
- config.principalType = untrustedConfig_principalType;
165
- }
166
- return config;
167
- }
168
- function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
169
- if (!untrustedIsObject(untrustedConfig)) {
170
- return null;
171
- }
172
- if (process.env.NODE_ENV !== 'production') {
173
- validateConfig(untrustedConfig, configPropertyNames);
174
- }
175
- var config = typeCheckConfig$2(untrustedConfig);
176
- if (!areRequiredParametersPresent(config, configPropertyNames)) {
177
- return null;
178
- }
179
- return config;
180
- }
181
- function buildNetworkSnapshot$2(luvio, config, options) {
182
- var resourceParams = createResourceParams$2(config);
183
- var request = createResourceRequest$2(resourceParams);
184
- return luvio.dispatchResourceRequest(request, options)
185
- .then(function () {
186
- return luvio.handleSuccessResponse(function () {
187
- evictSuccess(luvio, resourceParams);
188
- return luvio.storeBroadcast();
189
- }, function () { return getResponseCacheKeys$2(luvio, resourceParams); });
190
- }, function (response) {
191
- deepFreeze(response);
192
- throw response;
193
- });
194
- }
195
- var deleteCredentialAdapterFactory = function (luvio) {
196
- return function namedCredentialdeleteCredential(untrustedConfig) {
197
- var config = validateAdapterConfig$2(untrustedConfig, deleteCredential_ConfigPropertyNames);
198
- // Invalid or incomplete config
199
- if (config === null) {
200
- throw new Error("Invalid config for \"".concat(adapterName, "\""));
201
- }
202
- return buildNetworkSnapshot$2(luvio, config);
203
- };
204
- };
205
-
206
- function validate$5(obj, path) {
207
- if (path === void 0) { path = 'OAuthCredentialAuthUrlInputRepresentation'; }
208
- var v_error = (function () {
209
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
210
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
211
- }
212
- var obj_externalCredential = obj.externalCredential;
213
- var path_externalCredential = path + '.externalCredential';
214
- if (typeof obj_externalCredential !== 'string') {
215
- return new TypeError('Expected "string" but received "' + typeof obj_externalCredential + '" (at "' + path_externalCredential + '")');
216
- }
217
- var obj_principalName = obj.principalName;
218
- var path_principalName = path + '.principalName';
219
- if (typeof obj_principalName !== 'string') {
220
- return new TypeError('Expected "string" but received "' + typeof obj_principalName + '" (at "' + path_principalName + '")');
221
- }
222
- var obj_principalType = obj.principalType;
223
- var path_principalType = path + '.principalType';
224
- if (typeof obj_principalType !== 'string') {
225
- return new TypeError('Expected "string" but received "' + typeof obj_principalType + '" (at "' + path_principalType + '")');
226
- }
227
- var obj_returnUrl = obj.returnUrl;
228
- var path_returnUrl = path + '.returnUrl';
229
- if (typeof obj_returnUrl !== 'string') {
230
- return new TypeError('Expected "string" but received "' + typeof obj_returnUrl + '" (at "' + path_returnUrl + '")');
231
- }
232
- })();
233
- return v_error === undefined ? null : v_error;
234
- }
235
-
236
- var VERSION$4 = "1e72de165572264bf8309eccfc284fd6";
237
- function validate$4(obj, path) {
238
- if (path === void 0) { path = 'OAuthCredentialAuthUrlRepresentation'; }
239
- var v_error = (function () {
240
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
241
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
242
- }
243
- var obj_authenticationUrl = obj.authenticationUrl;
244
- var path_authenticationUrl = path + '.authenticationUrl';
245
- if (typeof obj_authenticationUrl !== 'string') {
246
- return new TypeError('Expected "string" but received "' + typeof obj_authenticationUrl + '" (at "' + path_authenticationUrl + '")');
247
- }
248
- var obj_externalCredential = obj.externalCredential;
249
- var path_externalCredential = path + '.externalCredential';
250
- if (typeof obj_externalCredential !== 'string') {
251
- return new TypeError('Expected "string" but received "' + typeof obj_externalCredential + '" (at "' + path_externalCredential + '")');
252
- }
253
- var obj_principalName = obj.principalName;
254
- var path_principalName = path + '.principalName';
255
- if (typeof obj_principalName !== 'string') {
256
- return new TypeError('Expected "string" but received "' + typeof obj_principalName + '" (at "' + path_principalName + '")');
257
- }
258
- var obj_principalType = obj.principalType;
259
- var path_principalType = path + '.principalType';
260
- if (typeof obj_principalType !== 'string') {
261
- return new TypeError('Expected "string" but received "' + typeof obj_principalType + '" (at "' + path_principalType + '")');
262
- }
263
- })();
264
- return v_error === undefined ? null : v_error;
265
- }
266
- var RepresentationType$2 = 'OAuthCredentialAuthUrlRepresentation';
267
- function keyBuilder$3(luvio, config) {
268
- return keyPrefix + '::' + RepresentationType$2 + ':' + config.authenticationUrl;
269
- }
270
- function keyBuilderFromType$1(luvio, object) {
271
- var keyParams = {
272
- authenticationUrl: object.authenticationUrl
273
- };
274
- return keyBuilder$3(luvio, keyParams);
275
- }
276
- function normalize$2(input, existing, path, luvio, store, timestamp) {
277
- return input;
278
- }
279
- var select$6 = function OAuthCredentialAuthUrlRepresentationSelect() {
280
- return {
281
- kind: 'Fragment',
282
- version: VERSION$4,
283
- private: [],
284
- selections: [
285
- {
286
- name: 'authenticationUrl',
287
- kind: 'Scalar'
288
- },
289
- {
290
- name: 'externalCredential',
291
- kind: 'Scalar'
292
- },
293
- {
294
- name: 'principalName',
295
- kind: 'Scalar'
296
- },
297
- {
298
- name: 'principalType',
299
- kind: 'Scalar'
300
- }
301
- ]
302
- };
303
- };
304
- function equals$4(existing, incoming) {
305
- var existing_authenticationUrl = existing.authenticationUrl;
306
- var incoming_authenticationUrl = incoming.authenticationUrl;
307
- if (!(existing_authenticationUrl === incoming_authenticationUrl)) {
308
- return false;
309
- }
310
- var existing_externalCredential = existing.externalCredential;
311
- var incoming_externalCredential = incoming.externalCredential;
312
- if (!(existing_externalCredential === incoming_externalCredential)) {
313
- return false;
314
- }
315
- var existing_principalName = existing.principalName;
316
- var incoming_principalName = incoming.principalName;
317
- if (!(existing_principalName === incoming_principalName)) {
318
- return false;
319
- }
320
- var existing_principalType = existing.principalType;
321
- var incoming_principalType = incoming.principalType;
322
- if (!(existing_principalType === incoming_principalType)) {
323
- return false;
324
- }
325
- return true;
326
- }
327
- var ingest$2 = function OAuthCredentialAuthUrlRepresentationIngest(input, path, luvio, store, timestamp) {
328
- if (process.env.NODE_ENV !== 'production') {
329
- var validateError = validate$4(input);
330
- if (validateError !== null) {
331
- throw validateError;
332
- }
333
- }
334
- var key = keyBuilderFromType$1(luvio, input);
335
- var existingRecord = store.readEntry(key);
336
- var ttlToUse = path.ttl !== undefined ? path.ttl : 300000;
337
- var incomingRecord = normalize$2(input, store.readEntry(key), {
338
- fullPath: key,
339
- parent: path.parent,
340
- propertyName: path.propertyName,
341
- ttl: ttlToUse
342
- });
343
- if (existingRecord === undefined || equals$4(existingRecord, incomingRecord) === false) {
344
- luvio.storePublish(key, incomingRecord);
345
- }
346
- if (ttlToUse !== undefined) {
347
- var storeMetadataParams = {
348
- ttl: ttlToUse,
349
- namespace: "named-credential",
350
- version: VERSION$4,
351
- representationName: RepresentationType$2,
352
- };
353
- luvio.publishStoreMetadata(key, storeMetadataParams);
354
- }
355
- return createLink(key);
356
- };
357
- function getTypeCacheKeys$2(luvio, input, fullPathFactory) {
358
- var rootKeySet = new engine.StoreKeyMap();
359
- // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
360
- var rootKey = keyBuilderFromType$1(luvio, input);
361
- rootKeySet.set(rootKey, {
362
- namespace: keyPrefix,
363
- representationName: RepresentationType$2,
364
- mergeable: false
365
- });
366
- return rootKeySet;
367
- }
368
-
369
- function select$5(luvio, params) {
370
- return select$6();
371
- }
372
- function getResponseCacheKeys$1(luvio, resourceParams, response) {
373
- return getTypeCacheKeys$2(luvio, response);
374
- }
375
- function ingestSuccess$1(luvio, resourceParams, response) {
376
- var body = response.body;
377
- var key = keyBuilderFromType$1(luvio, body);
378
- luvio.storeIngest(key, ingest$2, body);
379
- var snapshot = luvio.storeLookup({
380
- recordId: key,
381
- node: select$5(),
382
- variables: {},
383
- });
384
- if (process.env.NODE_ENV !== 'production') {
385
- if (snapshot.state !== 'Fulfilled') {
386
- throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
387
- }
388
- }
389
- return snapshot;
390
- }
391
- function createResourceRequest$1(config) {
392
- var headers = {};
393
- return {
394
- baseUri: '/services/data/v58.0',
395
- basePath: '/named-credentials/credential/auth-url/o-auth',
396
- method: 'post',
397
- body: config.body,
398
- urlParams: {},
399
- queryParams: {},
400
- headers: headers,
401
- priority: 'normal',
402
- };
403
- }
404
-
405
- var getOAuthCredentialAuthUrl_ConfigPropertyNames = {
406
- displayName: 'getOAuthCredentialAuthUrl',
407
- parameters: {
408
- required: ['requestBody'],
409
- optional: []
410
- }
411
- };
412
- function createResourceParams$1(config) {
413
- var resourceParams = {
414
- body: {
415
- requestBody: config.requestBody
416
- }
417
- };
418
- return resourceParams;
419
- }
420
- function typeCheckConfig$1(untrustedConfig) {
421
- var config = {};
422
- var untrustedConfig_requestBody = untrustedConfig.requestBody;
423
- var referenceOAuthCredentialAuthUrlInputRepresentationValidationError = validate$5(untrustedConfig_requestBody);
424
- if (referenceOAuthCredentialAuthUrlInputRepresentationValidationError === null) {
425
- config.requestBody = untrustedConfig_requestBody;
426
- }
427
- return config;
428
- }
429
- function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
430
- if (!untrustedIsObject(untrustedConfig)) {
431
- return null;
432
- }
433
- if (process.env.NODE_ENV !== 'production') {
434
- validateConfig(untrustedConfig, configPropertyNames);
435
- }
436
- var config = typeCheckConfig$1(untrustedConfig);
437
- if (!areRequiredParametersPresent(config, configPropertyNames)) {
438
- return null;
439
- }
440
- return config;
441
- }
442
- function buildNetworkSnapshot$1(luvio, config, options) {
443
- var resourceParams = createResourceParams$1(config);
444
- var request = createResourceRequest$1(resourceParams);
445
- return luvio.dispatchResourceRequest(request, options)
446
- .then(function (response) {
447
- return luvio.handleSuccessResponse(function () {
448
- var snapshot = ingestSuccess$1(luvio, resourceParams, response);
449
- return luvio.storeBroadcast().then(function () { return snapshot; });
450
- }, function () { return getResponseCacheKeys$1(luvio, resourceParams, response.body); });
451
- }, function (response) {
452
- deepFreeze(response);
453
- throw response;
454
- });
455
- }
456
- var getOAuthCredentialAuthUrlAdapterFactory = function (luvio) {
457
- return function getOAuthCredentialAuthUrl(untrustedConfig) {
458
- var config = validateAdapterConfig$1(untrustedConfig, getOAuthCredentialAuthUrl_ConfigPropertyNames);
459
- // Invalid or incomplete config
460
- if (config === null) {
461
- throw new Error('Invalid config for "getOAuthCredentialAuthUrl"');
462
- }
463
- return buildNetworkSnapshot$1(luvio, config);
464
- };
465
- };
466
-
467
- var VERSION$3 = "0874099e8f2a31ddf81f3ce490386603";
468
- function validate$3(obj, path) {
469
- if (path === void 0) { path = 'ExternalCredentialPrincipalRepresentation'; }
470
- var v_error = (function () {
471
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
472
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
473
- }
474
- var obj_authenticationStatus = obj.authenticationStatus;
475
- var path_authenticationStatus = path + '.authenticationStatus';
476
- if (typeof obj_authenticationStatus !== 'string') {
477
- return new TypeError('Expected "string" but received "' + typeof obj_authenticationStatus + '" (at "' + path_authenticationStatus + '")');
478
- }
479
- var obj_principalName = obj.principalName;
480
- var path_principalName = path + '.principalName';
481
- if (typeof obj_principalName !== 'string') {
482
- return new TypeError('Expected "string" but received "' + typeof obj_principalName + '" (at "' + path_principalName + '")');
483
- }
484
- var obj_principalType = obj.principalType;
485
- var path_principalType = path + '.principalType';
486
- if (typeof obj_principalType !== 'string') {
487
- return new TypeError('Expected "string" but received "' + typeof obj_principalType + '" (at "' + path_principalType + '")');
488
- }
489
- })();
490
- return v_error === undefined ? null : v_error;
491
- }
492
- var select$4 = function ExternalCredentialPrincipalRepresentationSelect() {
493
- return {
494
- kind: 'Fragment',
495
- version: VERSION$3,
496
- private: [],
497
- selections: [
498
- {
499
- name: 'authenticationStatus',
500
- kind: 'Scalar'
501
- },
502
- {
503
- name: 'principalName',
504
- kind: 'Scalar'
505
- },
506
- {
507
- name: 'principalType',
508
- kind: 'Scalar'
509
- }
510
- ]
511
- };
512
- };
513
- function equals$3(existing, incoming) {
514
- var existing_authenticationStatus = existing.authenticationStatus;
515
- var incoming_authenticationStatus = incoming.authenticationStatus;
516
- if (!(existing_authenticationStatus === incoming_authenticationStatus)) {
517
- return false;
518
- }
519
- var existing_principalName = existing.principalName;
520
- var incoming_principalName = incoming.principalName;
521
- if (!(existing_principalName === incoming_principalName)) {
522
- return false;
523
- }
524
- var existing_principalType = existing.principalType;
525
- var incoming_principalType = incoming.principalType;
526
- if (!(existing_principalType === incoming_principalType)) {
527
- return false;
528
- }
529
- return true;
530
- }
531
-
532
- var VERSION$2 = "95db03e0e8990cc8f51f006ccf355bf9";
533
- function validate$2(obj, path) {
534
- if (path === void 0) { path = 'NamedCredentialRepresentation'; }
535
- var v_error = (function () {
536
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
537
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
538
- }
539
- var obj_developerName = obj.developerName;
540
- var path_developerName = path + '.developerName';
541
- if (typeof obj_developerName !== 'string') {
542
- return new TypeError('Expected "string" but received "' + typeof obj_developerName + '" (at "' + path_developerName + '")');
543
- }
544
- var obj_masterLabel = obj.masterLabel;
545
- var path_masterLabel = path + '.masterLabel';
546
- if (typeof obj_masterLabel !== 'string') {
547
- return new TypeError('Expected "string" but received "' + typeof obj_masterLabel + '" (at "' + path_masterLabel + '")');
548
- }
549
- })();
550
- return v_error === undefined ? null : v_error;
551
- }
552
- var select$3 = function NamedCredentialRepresentationSelect() {
553
- return {
554
- kind: 'Fragment',
555
- version: VERSION$2,
556
- private: [],
557
- selections: [
558
- {
559
- name: 'developerName',
560
- kind: 'Scalar'
561
- },
562
- {
563
- name: 'masterLabel',
564
- kind: 'Scalar'
565
- }
566
- ]
567
- };
568
- };
569
- function equals$2(existing, incoming) {
570
- var existing_developerName = existing.developerName;
571
- var incoming_developerName = incoming.developerName;
572
- if (!(existing_developerName === incoming_developerName)) {
573
- return false;
574
- }
575
- var existing_masterLabel = existing.masterLabel;
576
- var incoming_masterLabel = incoming.masterLabel;
577
- if (!(existing_masterLabel === incoming_masterLabel)) {
578
- return false;
579
- }
580
- return true;
581
- }
582
-
583
- var VERSION$1 = "fd37a032d72e3491fe4d211486a3fea1";
584
- function validate$1(obj, path) {
585
- if (path === void 0) { path = 'ExternalCredentialRepresentation'; }
586
- var v_error = (function () {
587
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
588
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
589
- }
590
- var obj_authenticationProtocol = obj.authenticationProtocol;
591
- var path_authenticationProtocol = path + '.authenticationProtocol';
592
- if (typeof obj_authenticationProtocol !== 'string') {
593
- return new TypeError('Expected "string" but received "' + typeof obj_authenticationProtocol + '" (at "' + path_authenticationProtocol + '")');
594
- }
595
- var obj_authenticationStatus = obj.authenticationStatus;
596
- var path_authenticationStatus = path + '.authenticationStatus';
597
- if (typeof obj_authenticationStatus !== 'string') {
598
- return new TypeError('Expected "string" but received "' + typeof obj_authenticationStatus + '" (at "' + path_authenticationStatus + '")');
599
- }
600
- var obj_developerName = obj.developerName;
601
- var path_developerName = path + '.developerName';
602
- if (typeof obj_developerName !== 'string') {
603
- return new TypeError('Expected "string" but received "' + typeof obj_developerName + '" (at "' + path_developerName + '")');
604
- }
605
- var obj_masterLabel = obj.masterLabel;
606
- var path_masterLabel = path + '.masterLabel';
607
- if (typeof obj_masterLabel !== 'string') {
608
- return new TypeError('Expected "string" but received "' + typeof obj_masterLabel + '" (at "' + path_masterLabel + '")');
609
- }
610
- var obj_principals = obj.principals;
611
- var path_principals = path + '.principals';
612
- if (!ArrayIsArray(obj_principals)) {
613
- return new TypeError('Expected "array" but received "' + typeof obj_principals + '" (at "' + path_principals + '")');
614
- }
615
- for (var i = 0; i < obj_principals.length; i++) {
616
- var obj_principals_item = obj_principals[i];
617
- var path_principals_item = path_principals + '[' + i + ']';
618
- var referencepath_principals_itemValidationError = validate$3(obj_principals_item, path_principals_item);
619
- if (referencepath_principals_itemValidationError !== null) {
620
- var message = 'Object doesn\'t match ExternalCredentialPrincipalRepresentation (at "' + path_principals_item + '")\n';
621
- message += referencepath_principals_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
622
- return new TypeError(message);
623
- }
624
- }
625
- var obj_relatedNamedCredentials = obj.relatedNamedCredentials;
626
- var path_relatedNamedCredentials = path + '.relatedNamedCredentials';
627
- if (!ArrayIsArray(obj_relatedNamedCredentials)) {
628
- return new TypeError('Expected "array" but received "' + typeof obj_relatedNamedCredentials + '" (at "' + path_relatedNamedCredentials + '")');
629
- }
630
- for (var i = 0; i < obj_relatedNamedCredentials.length; i++) {
631
- var obj_relatedNamedCredentials_item = obj_relatedNamedCredentials[i];
632
- var path_relatedNamedCredentials_item = path_relatedNamedCredentials + '[' + i + ']';
633
- var referencepath_relatedNamedCredentials_itemValidationError = validate$2(obj_relatedNamedCredentials_item, path_relatedNamedCredentials_item);
634
- if (referencepath_relatedNamedCredentials_itemValidationError !== null) {
635
- var message = 'Object doesn\'t match NamedCredentialRepresentation (at "' + path_relatedNamedCredentials_item + '")\n';
636
- message += referencepath_relatedNamedCredentials_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
637
- return new TypeError(message);
638
- }
639
- }
640
- })();
641
- return v_error === undefined ? null : v_error;
642
- }
643
- var RepresentationType$1 = 'ExternalCredentialRepresentation';
644
- function keyBuilder$2(luvio, config) {
645
- return keyPrefix + '::' + RepresentationType$1 + ':' + config.developerName;
646
- }
647
- function keyBuilderFromType(luvio, object) {
648
- var keyParams = {
649
- developerName: object.developerName
650
- };
651
- return keyBuilder$2(luvio, keyParams);
652
- }
653
- function normalize$1(input, existing, path, luvio, store, timestamp) {
654
- return input;
655
- }
656
- var select$2 = function ExternalCredentialRepresentationSelect() {
657
- var _a = select$4(), ExternalCredentialPrincipalRepresentation__selections = _a.selections;
658
- var _b = select$3(), NamedCredentialRepresentation__selections = _b.selections;
659
- return {
660
- kind: 'Fragment',
661
- version: VERSION$1,
662
- private: [],
663
- selections: [
664
- {
665
- name: 'authenticationProtocol',
666
- kind: 'Scalar'
667
- },
668
- {
669
- name: 'authenticationStatus',
670
- kind: 'Scalar'
671
- },
672
- {
673
- name: 'developerName',
674
- kind: 'Scalar'
675
- },
676
- {
677
- name: 'masterLabel',
678
- kind: 'Scalar'
679
- },
680
- {
681
- name: 'principals',
682
- kind: 'Object',
683
- plural: true,
684
- selections: ExternalCredentialPrincipalRepresentation__selections
685
- },
686
- {
687
- name: 'relatedNamedCredentials',
688
- kind: 'Object',
689
- plural: true,
690
- selections: NamedCredentialRepresentation__selections
691
- }
692
- ]
693
- };
694
- };
695
- function equals$1(existing, incoming) {
696
- var existing_authenticationProtocol = existing.authenticationProtocol;
697
- var incoming_authenticationProtocol = incoming.authenticationProtocol;
698
- if (!(existing_authenticationProtocol === incoming_authenticationProtocol)) {
699
- return false;
700
- }
701
- var existing_authenticationStatus = existing.authenticationStatus;
702
- var incoming_authenticationStatus = incoming.authenticationStatus;
703
- if (!(existing_authenticationStatus === incoming_authenticationStatus)) {
704
- return false;
705
- }
706
- var existing_developerName = existing.developerName;
707
- var incoming_developerName = incoming.developerName;
708
- if (!(existing_developerName === incoming_developerName)) {
709
- return false;
710
- }
711
- var existing_masterLabel = existing.masterLabel;
712
- var incoming_masterLabel = incoming.masterLabel;
713
- if (!(existing_masterLabel === incoming_masterLabel)) {
714
- return false;
715
- }
716
- var existing_principals = existing.principals;
717
- var incoming_principals = incoming.principals;
718
- var equals_principals_items = equalsArray(existing_principals, incoming_principals, function (existing_principals_item, incoming_principals_item) {
719
- if (!(equals$3(existing_principals_item, incoming_principals_item))) {
720
- return false;
721
- }
722
- });
723
- if (equals_principals_items === false) {
724
- return false;
725
- }
726
- var existing_relatedNamedCredentials = existing.relatedNamedCredentials;
727
- var incoming_relatedNamedCredentials = incoming.relatedNamedCredentials;
728
- var equals_relatedNamedCredentials_items = equalsArray(existing_relatedNamedCredentials, incoming_relatedNamedCredentials, function (existing_relatedNamedCredentials_item, incoming_relatedNamedCredentials_item) {
729
- if (!(equals$2(existing_relatedNamedCredentials_item, incoming_relatedNamedCredentials_item))) {
730
- return false;
731
- }
732
- });
733
- if (equals_relatedNamedCredentials_items === false) {
734
- return false;
735
- }
736
- return true;
737
- }
738
- var ingest$1 = function ExternalCredentialRepresentationIngest(input, path, luvio, store, timestamp) {
739
- if (process.env.NODE_ENV !== 'production') {
740
- var validateError = validate$1(input);
741
- if (validateError !== null) {
742
- throw validateError;
743
- }
744
- }
745
- var key = keyBuilderFromType(luvio, input);
746
- var existingRecord = store.readEntry(key);
747
- var ttlToUse = path.ttl !== undefined ? path.ttl : 300000;
748
- var incomingRecord = normalize$1(input, store.readEntry(key), {
749
- fullPath: key,
750
- parent: path.parent,
751
- propertyName: path.propertyName,
752
- ttl: ttlToUse
753
- });
754
- if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
755
- luvio.storePublish(key, incomingRecord);
756
- }
757
- if (ttlToUse !== undefined) {
758
- var storeMetadataParams = {
759
- ttl: ttlToUse,
760
- namespace: "named-credential",
761
- version: VERSION$1,
762
- representationName: RepresentationType$1,
763
- };
764
- luvio.publishStoreMetadata(key, storeMetadataParams);
765
- }
766
- return createLink(key);
767
- };
768
- function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
769
- var rootKeySet = new engine.StoreKeyMap();
770
- // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
771
- var rootKey = keyBuilderFromType(luvio, input);
772
- rootKeySet.set(rootKey, {
773
- namespace: keyPrefix,
774
- representationName: RepresentationType$1,
775
- mergeable: false
776
- });
777
- return rootKeySet;
778
- }
779
-
780
- var VERSION = "81417919a5a3d6b3e4fc26ab05d87aea";
781
- function validate(obj, path) {
782
- if (path === void 0) { path = 'ExternalCredentialListRepresentation'; }
783
- var v_error = (function () {
784
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
785
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
786
- }
787
- var obj_externalCredentials = obj.externalCredentials;
788
- var path_externalCredentials = path + '.externalCredentials';
789
- if (!ArrayIsArray(obj_externalCredentials)) {
790
- return new TypeError('Expected "array" but received "' + typeof obj_externalCredentials + '" (at "' + path_externalCredentials + '")');
791
- }
792
- for (var i = 0; i < obj_externalCredentials.length; i++) {
793
- var obj_externalCredentials_item = obj_externalCredentials[i];
794
- var path_externalCredentials_item = path_externalCredentials + '[' + i + ']';
795
- if (typeof obj_externalCredentials_item !== 'object') {
796
- return new TypeError('Expected "object" but received "' + typeof obj_externalCredentials_item + '" (at "' + path_externalCredentials_item + '")');
797
- }
798
- }
799
- })();
800
- return v_error === undefined ? null : v_error;
801
- }
802
- var RepresentationType = 'ExternalCredentialListRepresentation';
803
- function normalize(input, existing, path, luvio, store, timestamp) {
804
- var input_externalCredentials = input.externalCredentials;
805
- var input_externalCredentials_id = path.fullPath + '__externalCredentials';
806
- for (var i = 0; i < input_externalCredentials.length; i++) {
807
- var input_externalCredentials_item = input_externalCredentials[i];
808
- var input_externalCredentials_item_id = input_externalCredentials_id + '__' + i;
809
- input_externalCredentials[i] = ingest$1(input_externalCredentials_item, {
810
- fullPath: input_externalCredentials_item_id,
811
- propertyName: i,
812
- parent: {
813
- data: input,
814
- key: path.fullPath,
815
- existing: existing,
816
- },
817
- ttl: path.ttl
818
- }, luvio, store);
819
- }
820
- return input;
821
- }
822
- var select$1 = function ExternalCredentialListRepresentationSelect() {
823
- return {
824
- kind: 'Fragment',
825
- version: VERSION,
826
- private: [],
827
- selections: [
828
- {
829
- name: 'externalCredentials',
830
- kind: 'Link',
831
- plural: true,
832
- fragment: select$2()
833
- }
834
- ]
835
- };
836
- };
837
- function equals(existing, incoming) {
838
- var existing_externalCredentials = existing.externalCredentials;
839
- var incoming_externalCredentials = incoming.externalCredentials;
840
- var equals_externalCredentials_items = equalsArray(existing_externalCredentials, incoming_externalCredentials, function (existing_externalCredentials_item, incoming_externalCredentials_item) {
841
- if (!(existing_externalCredentials_item.__ref === incoming_externalCredentials_item.__ref)) {
842
- return false;
843
- }
844
- });
845
- if (equals_externalCredentials_items === false) {
846
- return false;
847
- }
848
- return true;
849
- }
850
- var ingest = function ExternalCredentialListRepresentationIngest(input, path, luvio, store, timestamp) {
851
- if (process.env.NODE_ENV !== 'production') {
852
- var validateError = validate(input);
853
- if (validateError !== null) {
854
- throw validateError;
855
- }
856
- }
857
- var key = path.fullPath;
858
- var existingRecord = store.readEntry(key);
859
- var ttlToUse = path.ttl !== undefined ? path.ttl : 300000;
860
- var incomingRecord = normalize(input, store.readEntry(key), {
861
- fullPath: key,
862
- parent: path.parent,
863
- propertyName: path.propertyName,
864
- ttl: ttlToUse
865
- }, luvio, store);
866
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
867
- luvio.storePublish(key, incomingRecord);
868
- }
869
- if (ttlToUse !== undefined) {
870
- var storeMetadataParams = {
871
- ttl: ttlToUse,
872
- namespace: "named-credential",
873
- version: VERSION,
874
- representationName: RepresentationType,
875
- };
876
- luvio.publishStoreMetadata(key, storeMetadataParams);
877
- }
878
- return createLink(key);
879
- };
880
- function getTypeCacheKeys(luvio, input, fullPathFactory) {
881
- var rootKeySet = new engine.StoreKeyMap();
882
- // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
883
- var rootKey = fullPathFactory();
884
- rootKeySet.set(rootKey, {
885
- namespace: keyPrefix,
886
- representationName: RepresentationType,
887
- mergeable: false
888
- });
889
- var input_externalCredentials_length = input.externalCredentials.length;
890
- for (var i = 0; i < input_externalCredentials_length; i++) {
891
- rootKeySet.merge(getTypeCacheKeys$1(luvio, input.externalCredentials[i]));
892
- }
893
- return rootKeySet;
894
- }
895
-
896
- function select(luvio, params) {
897
- return select$1();
898
- }
899
- function keyBuilder$1(luvio, params) {
900
- return keyPrefix + '::ExternalCredentialListRepresentation:(' + ')';
901
- }
902
- function getResponseCacheKeys(luvio, resourceParams, response) {
903
- return getTypeCacheKeys(luvio, response, function () { return keyBuilder$1(); });
904
- }
905
- function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
906
- var body = response.body;
907
- var key = keyBuilder$1();
908
- luvio.storeIngest(key, ingest, body);
909
- var snapshot = luvio.storeLookup({
910
- recordId: key,
911
- node: select(),
912
- variables: {},
913
- }, snapshotRefresh);
914
- if (process.env.NODE_ENV !== 'production') {
915
- if (snapshot.state !== 'Fulfilled') {
916
- throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
917
- }
918
- }
919
- return snapshot;
920
- }
921
- function ingestError(luvio, params, error, snapshotRefresh) {
922
- var key = keyBuilder$1();
923
- var errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
924
- luvio.storeIngestError(key, errorSnapshot);
925
- return errorSnapshot;
926
- }
927
- function createResourceRequest(config) {
928
- var headers = {};
929
- return {
930
- baseUri: '/services/data/v58.0',
931
- basePath: '/named-credentials/external-credentials',
932
- method: 'get',
933
- body: null,
934
- urlParams: {},
935
- queryParams: {},
936
- headers: headers,
937
- priority: 'normal',
938
- };
939
- }
940
-
941
- var getExternalCredentials_ConfigPropertyNames = {
942
- displayName: 'getExternalCredentials',
943
- parameters: {
944
- required: [],
945
- optional: []
946
- }
947
- };
948
- function createResourceParams(config) {
949
- var resourceParams = {};
950
- return resourceParams;
951
- }
952
- function keyBuilder(luvio, config) {
953
- return keyBuilder$1();
954
- }
955
- function typeCheckConfig(untrustedConfig) {
956
- var config = {};
957
- return config;
958
- }
959
- function validateAdapterConfig(untrustedConfig, configPropertyNames) {
960
- if (!untrustedIsObject(untrustedConfig)) {
961
- return null;
962
- }
963
- if (process.env.NODE_ENV !== 'production') {
964
- validateConfig(untrustedConfig, configPropertyNames);
965
- }
966
- var config = typeCheckConfig();
967
- if (!areRequiredParametersPresent(config, configPropertyNames)) {
968
- return null;
969
- }
970
- return config;
971
- }
972
- function adapterFragment(luvio, config) {
973
- return select();
974
- }
975
- function onFetchResponseSuccess(luvio, config, resourceParams, response) {
976
- var snapshot = ingestSuccess(luvio, resourceParams, response, {
977
- config: config,
978
- resolve: function () { return buildNetworkSnapshot(luvio, config, snapshotRefreshOptions); }
979
- });
980
- return luvio.storeBroadcast().then(function () { return snapshot; });
981
- }
982
- function onFetchResponseError(luvio, config, resourceParams, response) {
983
- var snapshot = ingestError(luvio, resourceParams, response, {
984
- config: config,
985
- resolve: function () { return buildNetworkSnapshot(luvio, config, snapshotRefreshOptions); }
986
- });
987
- return luvio.storeBroadcast().then(function () { return snapshot; });
988
- }
989
- function buildNetworkSnapshot(luvio, config, options) {
990
- var resourceParams = createResourceParams();
991
- var request = createResourceRequest();
992
- return luvio.dispatchResourceRequest(request, options)
993
- .then(function (response) {
994
- return luvio.handleSuccessResponse(function () { return onFetchResponseSuccess(luvio, config, resourceParams, response); }, function () { return getResponseCacheKeys(luvio, resourceParams, response.body); });
995
- }, function (response) {
996
- return luvio.handleErrorResponse(function () { return onFetchResponseError(luvio, config, resourceParams, response); });
997
- });
998
- }
999
- function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1000
- var luvio = context.luvio, config = context.config;
1001
- var networkPriority = coercedAdapterRequestContext.networkPriority, requestCorrelator = coercedAdapterRequestContext.requestCorrelator, eventObservers = coercedAdapterRequestContext.eventObservers;
1002
- var dispatchOptions = {
1003
- resourceRequestContext: {
1004
- requestCorrelator: requestCorrelator,
1005
- luvioRequestMethod: undefined,
1006
- },
1007
- eventObservers: eventObservers
1008
- };
1009
- if (networkPriority !== 'normal') {
1010
- dispatchOptions.overrides = {
1011
- priority: networkPriority
1012
- };
1013
- }
1014
- return buildNetworkSnapshot(luvio, config, dispatchOptions);
1015
- }
1016
- function buildCachedSnapshotCachePolicy(context, storeLookup) {
1017
- var luvio = context.luvio, config = context.config;
1018
- var selector = {
1019
- recordId: keyBuilder(),
1020
- node: adapterFragment(),
1021
- variables: {},
1022
- };
1023
- var cacheSnapshot = storeLookup(selector, {
1024
- config: config,
1025
- resolve: function () { return buildNetworkSnapshot(luvio, config, snapshotRefreshOptions); }
1026
- });
1027
- return cacheSnapshot;
1028
- }
1029
- var getExternalCredentialsAdapterFactory = function (luvio) { return function namedCredential__getExternalCredentials(untrustedConfig, requestContext) {
1030
- var config = validateAdapterConfig(untrustedConfig, getExternalCredentials_ConfigPropertyNames);
1031
- // Invalid or incomplete config
1032
- if (config === null) {
1033
- return null;
1034
- }
1035
- return luvio.applyCachePolicy((requestContext || {}), { config: config, luvio: luvio }, // BuildSnapshotContext
1036
- buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1037
- }; };
1038
-
1039
- exports.deleteCredentialAdapterFactory = deleteCredentialAdapterFactory;
1040
- exports.getExternalCredentialsAdapterFactory = getExternalCredentialsAdapterFactory;
1041
- exports.getOAuthCredentialAuthUrlAdapterFactory = getOAuthCredentialAuthUrlAdapterFactory;
1042
-
1043
- Object.defineProperty(exports, '__esModule', { value: true });
1044
-
1045
- }));