@salesforce/lds-adapters-platform-named-credential 1.246.0 → 1.248.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/sfdc/index.js CHANGED
@@ -14,10 +14,10 @@
14
14
  /* proxy-compat-disable */
15
15
  import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
16
16
  import { withDefaultLuvio } from 'force/ldsEngine';
17
- import { serializeStructuredKey, StoreKeyMap, deepFreeze, createResourceParams as createResourceParams$3, typeCheckConfig as typeCheckConfig$3, ingestShape, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1 } from 'force/luvioEngine';
17
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$6, typeCheckConfig as typeCheckConfig$6, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2 } from 'force/luvioEngine';
18
18
 
19
19
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
- const { keys: ObjectKeys, create: ObjectCreate } = Object;
20
+ const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
21
21
  const { isArray: ArrayIsArray$1 } = Array;
22
22
  /**
23
23
  * Validates an adapter config is well-formed.
@@ -41,7 +41,7 @@ function validateConfig(config, adapter, oneOf) {
41
41
  throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
42
42
  }
43
43
  const supported = required.concat(optional);
44
- if (ObjectKeys(config).some(key => !supported.includes(key))) {
44
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
45
45
  throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
46
46
  }
47
47
  }
@@ -81,7 +81,9 @@ function buildAdapterValidationConfig(displayName, paramsMeta) {
81
81
  }
82
82
  const keyPrefix = 'named-credential';
83
83
 
84
+ const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
84
85
  const { isArray: ArrayIsArray } = Array;
86
+ const { stringify: JSONStringify } = JSON;
85
87
  function equalsArray(a, b, equalsItem) {
86
88
  const aLength = a.length;
87
89
  const bLength = b.length;
@@ -101,20 +103,366 @@ function createLink(ref) {
101
103
  };
102
104
  }
103
105
 
106
+ function validate$8(obj, path = 'CredentialInputRepresentation') {
107
+ const v_error = (() => {
108
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
109
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
110
+ }
111
+ if (obj.authenticationProtocol !== undefined) {
112
+ const obj_authenticationProtocol = obj.authenticationProtocol;
113
+ const path_authenticationProtocol = path + '.authenticationProtocol';
114
+ if (typeof obj_authenticationProtocol !== 'string') {
115
+ return new TypeError('Expected "string" but received "' + typeof obj_authenticationProtocol + '" (at "' + path_authenticationProtocol + '")');
116
+ }
117
+ }
118
+ if (obj.authenticationProtocolVariant !== undefined) {
119
+ const obj_authenticationProtocolVariant = obj.authenticationProtocolVariant;
120
+ const path_authenticationProtocolVariant = path + '.authenticationProtocolVariant';
121
+ if (typeof obj_authenticationProtocolVariant !== 'string') {
122
+ return new TypeError('Expected "string" but received "' + typeof obj_authenticationProtocolVariant + '" (at "' + path_authenticationProtocolVariant + '")');
123
+ }
124
+ }
125
+ const obj_credentials = obj.credentials;
126
+ const path_credentials = path + '.credentials';
127
+ if (typeof obj_credentials !== 'object' || ArrayIsArray(obj_credentials) || obj_credentials === null) {
128
+ return new TypeError('Expected "object" but received "' + typeof obj_credentials + '" (at "' + path_credentials + '")');
129
+ }
130
+ const obj_credentials_keys = ObjectKeys(obj_credentials);
131
+ for (let i = 0; i < obj_credentials_keys.length; i++) {
132
+ const key = obj_credentials_keys[i];
133
+ const obj_credentials_prop = obj_credentials[key];
134
+ const path_credentials_prop = path_credentials + '["' + key + '"]';
135
+ if (typeof obj_credentials_prop !== 'object' || ArrayIsArray(obj_credentials_prop) || obj_credentials_prop === null) {
136
+ return new TypeError('Expected "object" but received "' + typeof obj_credentials_prop + '" (at "' + path_credentials_prop + '")');
137
+ }
138
+ }
139
+ const obj_externalCredential = obj.externalCredential;
140
+ const path_externalCredential = path + '.externalCredential';
141
+ if (typeof obj_externalCredential !== 'string') {
142
+ return new TypeError('Expected "string" but received "' + typeof obj_externalCredential + '" (at "' + path_externalCredential + '")');
143
+ }
144
+ const obj_principalName = obj.principalName;
145
+ const path_principalName = path + '.principalName';
146
+ if (typeof obj_principalName !== 'string') {
147
+ return new TypeError('Expected "string" but received "' + typeof obj_principalName + '" (at "' + path_principalName + '")');
148
+ }
149
+ const obj_principalType = obj.principalType;
150
+ const path_principalType = path + '.principalType';
151
+ if (typeof obj_principalType !== 'string') {
152
+ return new TypeError('Expected "string" but received "' + typeof obj_principalType + '" (at "' + path_principalType + '")');
153
+ }
154
+ })();
155
+ return v_error === undefined ? null : v_error;
156
+ }
157
+
158
+ function validate$7(obj, path = 'CredentialValueRepresentation') {
159
+ const v_error = (() => {
160
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
161
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
162
+ }
163
+ const obj_encrypted = obj.encrypted;
164
+ const path_encrypted = path + '.encrypted';
165
+ if (typeof obj_encrypted !== 'boolean') {
166
+ return new TypeError('Expected "boolean" but received "' + typeof obj_encrypted + '" (at "' + path_encrypted + '")');
167
+ }
168
+ if (obj.revision !== undefined) {
169
+ const obj_revision = obj.revision;
170
+ const path_revision = path + '.revision';
171
+ let obj_revision_union0 = null;
172
+ const obj_revision_union0_error = (() => {
173
+ if (typeof obj_revision !== 'number' || (typeof obj_revision === 'number' && Math.floor(obj_revision) !== obj_revision)) {
174
+ return new TypeError('Expected "integer" but received "' + typeof obj_revision + '" (at "' + path_revision + '")');
175
+ }
176
+ })();
177
+ if (obj_revision_union0_error != null) {
178
+ obj_revision_union0 = obj_revision_union0_error.message;
179
+ }
180
+ let obj_revision_union1 = null;
181
+ const obj_revision_union1_error = (() => {
182
+ if (obj_revision !== null) {
183
+ return new TypeError('Expected "null" but received "' + typeof obj_revision + '" (at "' + path_revision + '")');
184
+ }
185
+ })();
186
+ if (obj_revision_union1_error != null) {
187
+ obj_revision_union1 = obj_revision_union1_error.message;
188
+ }
189
+ if (obj_revision_union0 && obj_revision_union1) {
190
+ let message = 'Object doesn\'t match union (at "' + path_revision + '")';
191
+ message += '\n' + obj_revision_union0.split('\n').map((line) => '\t' + line).join('\n');
192
+ message += '\n' + obj_revision_union1.split('\n').map((line) => '\t' + line).join('\n');
193
+ return new TypeError(message);
194
+ }
195
+ }
196
+ if (obj.value !== undefined) {
197
+ const obj_value = obj.value;
198
+ const path_value = path + '.value';
199
+ let obj_value_union0 = null;
200
+ const obj_value_union0_error = (() => {
201
+ if (typeof obj_value !== 'string') {
202
+ return new TypeError('Expected "string" but received "' + typeof obj_value + '" (at "' + path_value + '")');
203
+ }
204
+ })();
205
+ if (obj_value_union0_error != null) {
206
+ obj_value_union0 = obj_value_union0_error.message;
207
+ }
208
+ let obj_value_union1 = null;
209
+ const obj_value_union1_error = (() => {
210
+ if (obj_value !== null) {
211
+ return new TypeError('Expected "null" but received "' + typeof obj_value + '" (at "' + path_value + '")');
212
+ }
213
+ })();
214
+ if (obj_value_union1_error != null) {
215
+ obj_value_union1 = obj_value_union1_error.message;
216
+ }
217
+ if (obj_value_union0 && obj_value_union1) {
218
+ let message = 'Object doesn\'t match union (at "' + path_value + '")';
219
+ message += '\n' + obj_value_union0.split('\n').map((line) => '\t' + line).join('\n');
220
+ message += '\n' + obj_value_union1.split('\n').map((line) => '\t' + line).join('\n');
221
+ return new TypeError(message);
222
+ }
223
+ }
224
+ })();
225
+ return v_error === undefined ? null : v_error;
226
+ }
227
+
228
+ const TTL = 100;
229
+ const VERSION$5 = "cea79b36245bc9456aff9b5c491058d0";
230
+ function validate$6(obj, path = 'CredentialRepresentation') {
231
+ const v_error = (() => {
232
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
233
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
234
+ }
235
+ if (obj.authenticationProtocol !== undefined) {
236
+ const obj_authenticationProtocol = obj.authenticationProtocol;
237
+ const path_authenticationProtocol = path + '.authenticationProtocol';
238
+ if (typeof obj_authenticationProtocol !== 'string') {
239
+ return new TypeError('Expected "string" but received "' + typeof obj_authenticationProtocol + '" (at "' + path_authenticationProtocol + '")');
240
+ }
241
+ }
242
+ if (obj.authenticationProtocolVariant !== undefined) {
243
+ const obj_authenticationProtocolVariant = obj.authenticationProtocolVariant;
244
+ const path_authenticationProtocolVariant = path + '.authenticationProtocolVariant';
245
+ if (typeof obj_authenticationProtocolVariant !== 'string') {
246
+ return new TypeError('Expected "string" but received "' + typeof obj_authenticationProtocolVariant + '" (at "' + path_authenticationProtocolVariant + '")');
247
+ }
248
+ }
249
+ const obj_authenticationStatus = obj.authenticationStatus;
250
+ const path_authenticationStatus = path + '.authenticationStatus';
251
+ if (typeof obj_authenticationStatus !== 'string') {
252
+ return new TypeError('Expected "string" but received "' + typeof obj_authenticationStatus + '" (at "' + path_authenticationStatus + '")');
253
+ }
254
+ const obj_credentials = obj.credentials;
255
+ const path_credentials = path + '.credentials';
256
+ if (typeof obj_credentials !== 'object' || ArrayIsArray(obj_credentials) || obj_credentials === null) {
257
+ return new TypeError('Expected "object" but received "' + typeof obj_credentials + '" (at "' + path_credentials + '")');
258
+ }
259
+ const obj_credentials_keys = ObjectKeys(obj_credentials);
260
+ for (let i = 0; i < obj_credentials_keys.length; i++) {
261
+ const key = obj_credentials_keys[i];
262
+ const obj_credentials_prop = obj_credentials[key];
263
+ const path_credentials_prop = path_credentials + '["' + key + '"]';
264
+ const referencepath_credentials_propValidationError = validate$7(obj_credentials_prop, path_credentials_prop);
265
+ if (referencepath_credentials_propValidationError !== null) {
266
+ let message = 'Object doesn\'t match CredentialValueRepresentation (at "' + path_credentials_prop + '")\n';
267
+ message += referencepath_credentials_propValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
268
+ return new TypeError(message);
269
+ }
270
+ }
271
+ const obj_externalCredential = obj.externalCredential;
272
+ const path_externalCredential = path + '.externalCredential';
273
+ if (typeof obj_externalCredential !== 'string') {
274
+ return new TypeError('Expected "string" but received "' + typeof obj_externalCredential + '" (at "' + path_externalCredential + '")');
275
+ }
276
+ const obj_principalName = obj.principalName;
277
+ const path_principalName = path + '.principalName';
278
+ let obj_principalName_union0 = null;
279
+ const obj_principalName_union0_error = (() => {
280
+ if (typeof obj_principalName !== 'string') {
281
+ return new TypeError('Expected "string" but received "' + typeof obj_principalName + '" (at "' + path_principalName + '")');
282
+ }
283
+ })();
284
+ if (obj_principalName_union0_error != null) {
285
+ obj_principalName_union0 = obj_principalName_union0_error.message;
286
+ }
287
+ let obj_principalName_union1 = null;
288
+ const obj_principalName_union1_error = (() => {
289
+ if (obj_principalName !== null) {
290
+ return new TypeError('Expected "null" but received "' + typeof obj_principalName + '" (at "' + path_principalName + '")');
291
+ }
292
+ })();
293
+ if (obj_principalName_union1_error != null) {
294
+ obj_principalName_union1 = obj_principalName_union1_error.message;
295
+ }
296
+ if (obj_principalName_union0 && obj_principalName_union1) {
297
+ let message = 'Object doesn\'t match union (at "' + path_principalName + '")';
298
+ message += '\n' + obj_principalName_union0.split('\n').map((line) => '\t' + line).join('\n');
299
+ message += '\n' + obj_principalName_union1.split('\n').map((line) => '\t' + line).join('\n');
300
+ return new TypeError(message);
301
+ }
302
+ const obj_principalType = obj.principalType;
303
+ const path_principalType = path + '.principalType';
304
+ if (typeof obj_principalType !== 'string') {
305
+ return new TypeError('Expected "string" but received "' + typeof obj_principalType + '" (at "' + path_principalType + '")');
306
+ }
307
+ })();
308
+ return v_error === undefined ? null : v_error;
309
+ }
104
310
  const RepresentationType$3 = 'CredentialRepresentation';
105
- function keyBuilder$5(luvio, config) {
311
+ function keyBuilder$7(luvio, config) {
106
312
  return keyPrefix + '::' + RepresentationType$3 + ':' + config.externalCredential + ':' + config.principalType + ':' + (config.principalName === null ? '' : config.principalName);
107
313
  }
314
+ function keyBuilderFromType$2(luvio, object) {
315
+ const keyParams = {
316
+ externalCredential: object.externalCredential,
317
+ principalType: object.principalType,
318
+ principalName: object.principalName
319
+ };
320
+ return keyBuilder$7(luvio, keyParams);
321
+ }
322
+ function normalize$3(input, existing, path, luvio, store, timestamp) {
323
+ return input;
324
+ }
325
+ const select$a = function CredentialRepresentationSelect() {
326
+ return {
327
+ kind: 'Fragment',
328
+ version: VERSION$5,
329
+ private: [],
330
+ opaque: true
331
+ };
332
+ };
333
+ function equals$5(existing, incoming) {
334
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
335
+ return false;
336
+ }
337
+ return true;
338
+ }
339
+ const ingest$3 = function CredentialRepresentationIngest(input, path, luvio, store, timestamp) {
340
+ if (process.env.NODE_ENV !== 'production') {
341
+ const validateError = validate$6(input);
342
+ if (validateError !== null) {
343
+ throw validateError;
344
+ }
345
+ }
346
+ const key = keyBuilderFromType$2(luvio, input);
347
+ const ttlToUse = TTL;
348
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "named-credential", VERSION$5, RepresentationType$3, equals$5);
349
+ return createLink(key);
350
+ };
351
+ function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
352
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
353
+ const rootKey = keyBuilderFromType$2(luvio, input);
354
+ rootKeySet.set(rootKey, {
355
+ namespace: keyPrefix,
356
+ representationName: RepresentationType$3,
357
+ mergeable: false
358
+ });
359
+ }
360
+
361
+ function select$9(luvio, params) {
362
+ return select$a();
363
+ }
364
+ function getResponseCacheKeys$5(storeKeyMap, luvio, resourceParams, response) {
365
+ getTypeCacheKeys$3(storeKeyMap, luvio, response);
366
+ }
367
+ function ingestSuccess$4(luvio, resourceParams, response) {
368
+ const { body } = response;
369
+ const key = keyBuilderFromType$2(luvio, body);
370
+ luvio.storeIngest(key, ingest$3, body);
371
+ const snapshot = luvio.storeLookup({
372
+ recordId: key,
373
+ node: select$9(),
374
+ variables: {},
375
+ });
376
+ if (process.env.NODE_ENV !== 'production') {
377
+ if (snapshot.state !== 'Fulfilled') {
378
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
379
+ }
380
+ }
381
+ deepFreeze(snapshot.data);
382
+ return snapshot;
383
+ }
384
+ function createResourceRequest$5(config) {
385
+ const headers = {};
386
+ return {
387
+ baseUri: '/services/data/v60.0',
388
+ basePath: '/named-credentials/credential',
389
+ method: 'post',
390
+ body: config.body,
391
+ urlParams: {},
392
+ queryParams: config.queryParams,
393
+ headers,
394
+ priority: 'normal',
395
+ };
396
+ }
108
397
 
109
- function keyBuilder$4(luvio, params) {
110
- return keyBuilder$5(luvio, {
398
+ const adapterName$5 = 'createCredential';
399
+ const createCredential_ConfigPropertyMetadata = [
400
+ generateParamConfigMetadata('action', false, 1 /* QueryParameter */, 0 /* String */),
401
+ generateParamConfigMetadata('requestBody', true, 2 /* Body */, 4 /* Unsupported */),
402
+ ];
403
+ const createCredential_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$5, createCredential_ConfigPropertyMetadata);
404
+ const createResourceParams$5 = /*#__PURE__*/ createResourceParams$6(createCredential_ConfigPropertyMetadata);
405
+ function typeCheckConfig$5(untrustedConfig) {
406
+ const config = {};
407
+ typeCheckConfig$6(untrustedConfig, config, createCredential_ConfigPropertyMetadata);
408
+ const untrustedConfig_requestBody = untrustedConfig.requestBody;
409
+ const referenceCredentialInputRepresentationValidationError = validate$8(untrustedConfig_requestBody);
410
+ if (referenceCredentialInputRepresentationValidationError === null) {
411
+ config.requestBody = untrustedConfig_requestBody;
412
+ }
413
+ return config;
414
+ }
415
+ function validateAdapterConfig$5(untrustedConfig, configPropertyNames) {
416
+ if (!untrustedIsObject(untrustedConfig)) {
417
+ return null;
418
+ }
419
+ if (process.env.NODE_ENV !== 'production') {
420
+ validateConfig(untrustedConfig, configPropertyNames);
421
+ }
422
+ const config = typeCheckConfig$5(untrustedConfig);
423
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
424
+ return null;
425
+ }
426
+ return config;
427
+ }
428
+ function buildNetworkSnapshot$5(luvio, config, options) {
429
+ const resourceParams = createResourceParams$5(config);
430
+ const request = createResourceRequest$5(resourceParams);
431
+ return luvio.dispatchResourceRequest(request, options)
432
+ .then((response) => {
433
+ return luvio.handleSuccessResponse(() => {
434
+ const snapshot = ingestSuccess$4(luvio, resourceParams, response);
435
+ return luvio.storeBroadcast().then(() => snapshot);
436
+ }, () => {
437
+ const cache = new StoreKeyMap();
438
+ getResponseCacheKeys$5(cache, luvio, resourceParams, response.body);
439
+ return cache;
440
+ });
441
+ }, (response) => {
442
+ deepFreeze(response);
443
+ throw response;
444
+ });
445
+ }
446
+ const createCredentialAdapterFactory = (luvio) => {
447
+ return function createCredential(untrustedConfig) {
448
+ const config = validateAdapterConfig$5(untrustedConfig, createCredential_ConfigPropertyNames);
449
+ // Invalid or incomplete config
450
+ if (config === null) {
451
+ throw new Error('Invalid config for "createCredential"');
452
+ }
453
+ return buildNetworkSnapshot$5(luvio, config);
454
+ };
455
+ };
456
+
457
+ function keyBuilder$6(luvio, params) {
458
+ return keyBuilder$7(luvio, {
111
459
  externalCredential: params.queryParams.externalCredential || '',
112
460
  principalType: params.queryParams.principalType || '',
113
461
  principalName: params.queryParams.principalName || ''
114
462
  });
115
463
  }
116
- function getResponseCacheKeys$2(cacheKeyMap, luvio, resourceParams) {
117
- const key = keyBuilder$4(luvio, resourceParams);
464
+ function getResponseCacheKeys$4(cacheKeyMap, luvio, resourceParams) {
465
+ const key = keyBuilder$6(luvio, resourceParams);
118
466
  cacheKeyMap.set(key, {
119
467
  namespace: keyPrefix,
120
468
  representationName: RepresentationType$3,
@@ -122,10 +470,10 @@ function getResponseCacheKeys$2(cacheKeyMap, luvio, resourceParams) {
122
470
  });
123
471
  }
124
472
  function evictSuccess(luvio, resourceParams) {
125
- const key = keyBuilder$4(luvio, resourceParams);
473
+ const key = keyBuilder$6(luvio, resourceParams);
126
474
  luvio.storeEvict(key);
127
475
  }
128
- function createResourceRequest$2(config) {
476
+ function createResourceRequest$4(config) {
129
477
  const headers = {};
130
478
  return {
131
479
  baseUri: '/services/data/v60.0',
@@ -139,35 +487,35 @@ function createResourceRequest$2(config) {
139
487
  };
140
488
  }
141
489
 
142
- const adapterName$2 = 'deleteCredential';
490
+ const adapterName$4 = 'deleteCredential';
143
491
  const deleteCredential_ConfigPropertyMetadata = [
144
492
  generateParamConfigMetadata('externalCredential', false, 1 /* QueryParameter */, 0 /* String */),
145
493
  generateParamConfigMetadata('principalName', false, 1 /* QueryParameter */, 0 /* String */),
146
494
  generateParamConfigMetadata('principalType', false, 1 /* QueryParameter */, 0 /* String */),
147
495
  ];
148
- const deleteCredential_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, deleteCredential_ConfigPropertyMetadata);
149
- const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(deleteCredential_ConfigPropertyMetadata);
150
- function typeCheckConfig$2(untrustedConfig) {
496
+ const deleteCredential_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, deleteCredential_ConfigPropertyMetadata);
497
+ const createResourceParams$4 = /*#__PURE__*/ createResourceParams$6(deleteCredential_ConfigPropertyMetadata);
498
+ function typeCheckConfig$4(untrustedConfig) {
151
499
  const config = {};
152
- typeCheckConfig$3(untrustedConfig, config, deleteCredential_ConfigPropertyMetadata);
500
+ typeCheckConfig$6(untrustedConfig, config, deleteCredential_ConfigPropertyMetadata);
153
501
  return config;
154
502
  }
155
- function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
503
+ function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
156
504
  if (!untrustedIsObject(untrustedConfig)) {
157
505
  return null;
158
506
  }
159
507
  if (process.env.NODE_ENV !== 'production') {
160
508
  validateConfig(untrustedConfig, configPropertyNames);
161
509
  }
162
- const config = typeCheckConfig$2(untrustedConfig);
510
+ const config = typeCheckConfig$4(untrustedConfig);
163
511
  if (!areRequiredParametersPresent(config, configPropertyNames)) {
164
512
  return null;
165
513
  }
166
514
  return config;
167
515
  }
168
- function buildNetworkSnapshot$2(luvio, config, options) {
169
- const resourceParams = createResourceParams$2(config);
170
- const request = createResourceRequest$2(resourceParams);
516
+ function buildNetworkSnapshot$4(luvio, config, options) {
517
+ const resourceParams = createResourceParams$4(config);
518
+ const request = createResourceRequest$4(resourceParams);
171
519
  return luvio.dispatchResourceRequest(request, options)
172
520
  .then(() => {
173
521
  return luvio.handleSuccessResponse(() => {
@@ -175,7 +523,7 @@ function buildNetworkSnapshot$2(luvio, config, options) {
175
523
  return luvio.storeBroadcast();
176
524
  }, () => {
177
525
  const cache = new StoreKeyMap();
178
- getResponseCacheKeys$2(cache, luvio, resourceParams);
526
+ getResponseCacheKeys$4(cache, luvio, resourceParams);
179
527
  return cache;
180
528
  });
181
529
  }, (response) => {
@@ -185,13 +533,157 @@ function buildNetworkSnapshot$2(luvio, config, options) {
185
533
  }
186
534
  const deleteCredentialAdapterFactory = (luvio) => {
187
535
  return function namedCredentialdeleteCredential(untrustedConfig) {
188
- const config = validateAdapterConfig$2(untrustedConfig, deleteCredential_ConfigPropertyNames);
536
+ const config = validateAdapterConfig$4(untrustedConfig, deleteCredential_ConfigPropertyNames);
189
537
  // Invalid or incomplete config
190
538
  if (config === null) {
191
- throw new Error(`Invalid config for "${adapterName$2}"`);
539
+ throw new Error(`Invalid config for "${adapterName$4}"`);
540
+ }
541
+ return buildNetworkSnapshot$4(luvio, config);
542
+ };
543
+ };
544
+
545
+ function select$8(luvio, params) {
546
+ return select$a();
547
+ }
548
+ function keyBuilder$5(luvio, params) {
549
+ return keyBuilder$7(luvio, {
550
+ externalCredential: params.queryParams.externalCredential || '',
551
+ principalType: params.queryParams.principalType || '',
552
+ principalName: params.queryParams.principalName || ''
553
+ });
554
+ }
555
+ function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
556
+ getTypeCacheKeys$3(storeKeyMap, luvio, response);
557
+ }
558
+ function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
559
+ const { body } = response;
560
+ const key = keyBuilder$5(luvio, resourceParams);
561
+ luvio.storeIngest(key, ingest$3, body);
562
+ const snapshot = luvio.storeLookup({
563
+ recordId: key,
564
+ node: select$8(),
565
+ variables: {},
566
+ }, snapshotRefresh);
567
+ if (process.env.NODE_ENV !== 'production') {
568
+ if (snapshot.state !== 'Fulfilled') {
569
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
192
570
  }
193
- return buildNetworkSnapshot$2(luvio, config);
571
+ }
572
+ deepFreeze(snapshot.data);
573
+ return snapshot;
574
+ }
575
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
576
+ const key = keyBuilder$5(luvio, params);
577
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
578
+ const storeMetadataParams = {
579
+ ttl: TTL,
580
+ namespace: keyPrefix,
581
+ version: VERSION$5,
582
+ representationName: RepresentationType$3
583
+ };
584
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
585
+ return errorSnapshot;
586
+ }
587
+ function createResourceRequest$3(config) {
588
+ const headers = {};
589
+ return {
590
+ baseUri: '/services/data/v60.0',
591
+ basePath: '/named-credentials/credential',
592
+ method: 'get',
593
+ body: null,
594
+ urlParams: {},
595
+ queryParams: config.queryParams,
596
+ headers,
597
+ priority: 'normal',
598
+ };
599
+ }
600
+
601
+ const adapterName$3 = 'getCredential';
602
+ const getCredential_ConfigPropertyMetadata = [
603
+ generateParamConfigMetadata('externalCredential', false, 1 /* QueryParameter */, 0 /* String */),
604
+ generateParamConfigMetadata('principalName', false, 1 /* QueryParameter */, 0 /* String */),
605
+ generateParamConfigMetadata('principalType', false, 1 /* QueryParameter */, 0 /* String */),
606
+ ];
607
+ const getCredential_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, getCredential_ConfigPropertyMetadata);
608
+ const createResourceParams$3 = /*#__PURE__*/ createResourceParams$6(getCredential_ConfigPropertyMetadata);
609
+ function keyBuilder$4(luvio, config) {
610
+ const resourceParams = createResourceParams$3(config);
611
+ return keyBuilder$5(luvio, resourceParams);
612
+ }
613
+ function typeCheckConfig$3(untrustedConfig) {
614
+ const config = {};
615
+ typeCheckConfig$6(untrustedConfig, config, getCredential_ConfigPropertyMetadata);
616
+ return config;
617
+ }
618
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
619
+ if (!untrustedIsObject(untrustedConfig)) {
620
+ return null;
621
+ }
622
+ if (process.env.NODE_ENV !== 'production') {
623
+ validateConfig(untrustedConfig, configPropertyNames);
624
+ }
625
+ const config = typeCheckConfig$3(untrustedConfig);
626
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
627
+ return null;
628
+ }
629
+ return config;
630
+ }
631
+ function adapterFragment$1(luvio, config) {
632
+ createResourceParams$3(config);
633
+ return select$8();
634
+ }
635
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
636
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
637
+ config,
638
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
639
+ });
640
+ return luvio.storeBroadcast().then(() => snapshot);
641
+ }
642
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
643
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
644
+ config,
645
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
646
+ });
647
+ return luvio.storeBroadcast().then(() => snapshot);
648
+ }
649
+ function buildNetworkSnapshot$3(luvio, config, options) {
650
+ const resourceParams = createResourceParams$3(config);
651
+ const request = createResourceRequest$3(resourceParams);
652
+ return luvio.dispatchResourceRequest(request, options)
653
+ .then((response) => {
654
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
655
+ const cache = new StoreKeyMap();
656
+ getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
657
+ return cache;
658
+ });
659
+ }, (response) => {
660
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
661
+ });
662
+ }
663
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
664
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$3, undefined, false);
665
+ }
666
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
667
+ const { luvio, config } = context;
668
+ const selector = {
669
+ recordId: keyBuilder$4(luvio, config),
670
+ node: adapterFragment$1(luvio, config),
671
+ variables: {},
194
672
  };
673
+ const cacheSnapshot = storeLookup(selector, {
674
+ config,
675
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
676
+ });
677
+ return cacheSnapshot;
678
+ }
679
+ const getCredentialAdapterFactory = (luvio) => function namedCredential__getCredential(untrustedConfig, requestContext) {
680
+ const config = validateAdapterConfig$3(untrustedConfig, getCredential_ConfigPropertyNames);
681
+ // Invalid or incomplete config
682
+ if (config === null) {
683
+ return null;
684
+ }
685
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
686
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
195
687
  };
196
688
 
197
689
  const VERSION$4 = "0874099e8f2a31ddf81f3ce490386603";
@@ -218,7 +710,7 @@ function validate$5(obj, path = 'ExternalCredentialPrincipalRepresentation') {
218
710
  })();
219
711
  return v_error === undefined ? null : v_error;
220
712
  }
221
- const select$6 = function ExternalCredentialPrincipalRepresentationSelect() {
713
+ const select$7 = function ExternalCredentialPrincipalRepresentationSelect() {
222
714
  return {
223
715
  kind: 'Fragment',
224
716
  version: VERSION$4,
@@ -277,7 +769,7 @@ function validate$4(obj, path = 'NamedCredentialRepresentation') {
277
769
  })();
278
770
  return v_error === undefined ? null : v_error;
279
771
  }
280
- const select$5 = function NamedCredentialRepresentationSelect() {
772
+ const select$6 = function NamedCredentialRepresentationSelect() {
281
773
  return {
282
774
  kind: 'Fragment',
283
775
  version: VERSION$3,
@@ -380,9 +872,9 @@ function keyBuilderFromType$1(luvio, object) {
380
872
  function normalize$2(input, existing, path, luvio, store, timestamp) {
381
873
  return input;
382
874
  }
383
- const select$4 = function ExternalCredentialRepresentationSelect() {
384
- const { selections: ExternalCredentialPrincipalRepresentation__selections, opaque: ExternalCredentialPrincipalRepresentation__opaque, } = select$6();
385
- const { selections: NamedCredentialRepresentation__selections, opaque: NamedCredentialRepresentation__opaque, } = select$5();
875
+ const select$5 = function ExternalCredentialRepresentationSelect() {
876
+ const { selections: ExternalCredentialPrincipalRepresentation__selections, opaque: ExternalCredentialPrincipalRepresentation__opaque, } = select$7();
877
+ const { selections: NamedCredentialRepresentation__selections, opaque: NamedCredentialRepresentation__opaque, } = select$6();
386
878
  return {
387
879
  kind: 'Fragment',
388
880
  version: VERSION$2,
@@ -525,7 +1017,7 @@ function normalize$1(input, existing, path, luvio, store, timestamp) {
525
1017
  }
526
1018
  return input;
527
1019
  }
528
- const select$3 = function ExternalCredentialListRepresentationSelect() {
1020
+ const select$4 = function ExternalCredentialListRepresentationSelect() {
529
1021
  return {
530
1022
  kind: 'Fragment',
531
1023
  version: VERSION$1,
@@ -535,7 +1027,7 @@ const select$3 = function ExternalCredentialListRepresentationSelect() {
535
1027
  name: 'externalCredentials',
536
1028
  kind: 'Link',
537
1029
  plural: true,
538
- fragment: select$4()
1030
+ fragment: select$5()
539
1031
  }
540
1032
  ]
541
1033
  };
@@ -579,22 +1071,22 @@ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
579
1071
  }
580
1072
  }
581
1073
 
582
- function select$2(luvio, params) {
583
- return select$3();
1074
+ function select$3(luvio, params) {
1075
+ return select$4();
584
1076
  }
585
1077
  function keyBuilder$2(luvio, params) {
586
1078
  return keyPrefix + '::ExternalCredentialListRepresentation:(' + ')';
587
1079
  }
588
- function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
1080
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
589
1081
  getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$2());
590
1082
  }
591
- function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
1083
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
592
1084
  const { body } = response;
593
1085
  const key = keyBuilder$2();
594
1086
  luvio.storeIngest(key, ingest$1, body);
595
1087
  const snapshot = luvio.storeLookup({
596
1088
  recordId: key,
597
- node: select$2(),
1089
+ node: select$3(),
598
1090
  variables: {},
599
1091
  }, snapshotRefresh);
600
1092
  if (process.env.NODE_ENV !== 'production') {
@@ -611,7 +1103,7 @@ function ingestError(luvio, params, error, snapshotRefresh) {
611
1103
  luvio.storeIngestError(key, errorSnapshot);
612
1104
  return errorSnapshot;
613
1105
  }
614
- function createResourceRequest$1(config) {
1106
+ function createResourceRequest$2(config) {
615
1107
  const headers = {};
616
1108
  return {
617
1109
  baseUri: '/services/data/v60.0',
@@ -625,57 +1117,57 @@ function createResourceRequest$1(config) {
625
1117
  };
626
1118
  }
627
1119
 
628
- const adapterName$1 = 'getExternalCredentials';
1120
+ const adapterName$2 = 'getExternalCredentials';
629
1121
  const getExternalCredentials_ConfigPropertyMetadata = [];
630
- const getExternalCredentials_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getExternalCredentials_ConfigPropertyMetadata);
631
- const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(getExternalCredentials_ConfigPropertyMetadata);
1122
+ const getExternalCredentials_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getExternalCredentials_ConfigPropertyMetadata);
1123
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$6(getExternalCredentials_ConfigPropertyMetadata);
632
1124
  function keyBuilder$1(luvio, config) {
633
- createResourceParams$1(config);
1125
+ createResourceParams$2(config);
634
1126
  return keyBuilder$2();
635
1127
  }
636
- function typeCheckConfig$1(untrustedConfig) {
1128
+ function typeCheckConfig$2(untrustedConfig) {
637
1129
  const config = {};
638
1130
  return config;
639
1131
  }
640
- function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
1132
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
641
1133
  if (!untrustedIsObject(untrustedConfig)) {
642
1134
  return null;
643
1135
  }
644
1136
  if (process.env.NODE_ENV !== 'production') {
645
1137
  validateConfig(untrustedConfig, configPropertyNames);
646
1138
  }
647
- const config = typeCheckConfig$1();
1139
+ const config = typeCheckConfig$2();
648
1140
  if (!areRequiredParametersPresent(config, configPropertyNames)) {
649
1141
  return null;
650
1142
  }
651
1143
  return config;
652
1144
  }
653
1145
  function adapterFragment(luvio, config) {
654
- createResourceParams$1(config);
655
- return select$2();
1146
+ createResourceParams$2(config);
1147
+ return select$3();
656
1148
  }
657
1149
  function onFetchResponseSuccess(luvio, config, resourceParams, response) {
658
- const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
1150
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
659
1151
  config,
660
- resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1152
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
661
1153
  });
662
1154
  return luvio.storeBroadcast().then(() => snapshot);
663
1155
  }
664
1156
  function onFetchResponseError(luvio, config, resourceParams, response) {
665
1157
  const snapshot = ingestError(luvio, resourceParams, response, {
666
1158
  config,
667
- resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1159
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
668
1160
  });
669
1161
  return luvio.storeBroadcast().then(() => snapshot);
670
1162
  }
671
- function buildNetworkSnapshot$1(luvio, config, options) {
672
- const resourceParams = createResourceParams$1(config);
673
- const request = createResourceRequest$1();
1163
+ function buildNetworkSnapshot$2(luvio, config, options) {
1164
+ const resourceParams = createResourceParams$2(config);
1165
+ const request = createResourceRequest$2();
674
1166
  return luvio.dispatchResourceRequest(request, options)
675
1167
  .then((response) => {
676
1168
  return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
677
1169
  const cache = new StoreKeyMap();
678
- getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
1170
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
679
1171
  return cache;
680
1172
  });
681
1173
  }, (response) => {
@@ -683,7 +1175,7 @@ function buildNetworkSnapshot$1(luvio, config, options) {
683
1175
  });
684
1176
  }
685
1177
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
686
- return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
1178
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
687
1179
  }
688
1180
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
689
1181
  const { luvio, config } = context;
@@ -694,12 +1186,12 @@ function buildCachedSnapshotCachePolicy(context, storeLookup) {
694
1186
  };
695
1187
  const cacheSnapshot = storeLookup(selector, {
696
1188
  config,
697
- resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1189
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
698
1190
  });
699
1191
  return cacheSnapshot;
700
1192
  }
701
1193
  const getExternalCredentialsAdapterFactory = (luvio) => function namedCredential__getExternalCredentials(untrustedConfig, requestContext) {
702
- const config = validateAdapterConfig$1(untrustedConfig, getExternalCredentials_ConfigPropertyNames);
1194
+ const config = validateAdapterConfig$2(untrustedConfig, getExternalCredentials_ConfigPropertyNames);
703
1195
  // Invalid or incomplete config
704
1196
  if (config === null) {
705
1197
  return null;
@@ -779,7 +1271,7 @@ function keyBuilderFromType(luvio, object) {
779
1271
  function normalize(input, existing, path, luvio, store, timestamp) {
780
1272
  return input;
781
1273
  }
782
- const select$1 = function OAuthCredentialAuthUrlRepresentationSelect() {
1274
+ const select$2 = function OAuthCredentialAuthUrlRepresentationSelect() {
783
1275
  return {
784
1276
  kind: 'Fragment',
785
1277
  version: VERSION,
@@ -849,19 +1341,19 @@ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
849
1341
  });
850
1342
  }
851
1343
 
852
- function select(luvio, params) {
853
- return select$1();
1344
+ function select$1(luvio, params) {
1345
+ return select$2();
854
1346
  }
855
- function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1347
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
856
1348
  getTypeCacheKeys(storeKeyMap, luvio, response);
857
1349
  }
858
- function ingestSuccess(luvio, resourceParams, response) {
1350
+ function ingestSuccess$1(luvio, resourceParams, response) {
859
1351
  const { body } = response;
860
1352
  const key = keyBuilderFromType(luvio, body);
861
1353
  luvio.storeIngest(key, ingest, body);
862
1354
  const snapshot = luvio.storeLookup({
863
1355
  recordId: key,
864
- node: select(),
1356
+ node: select$1(),
865
1357
  variables: {},
866
1358
  });
867
1359
  if (process.env.NODE_ENV !== 'production') {
@@ -872,7 +1364,7 @@ function ingestSuccess(luvio, resourceParams, response) {
872
1364
  deepFreeze(snapshot.data);
873
1365
  return snapshot;
874
1366
  }
875
- function createResourceRequest(config) {
1367
+ function createResourceRequest$1(config) {
876
1368
  const headers = {};
877
1369
  return {
878
1370
  baseUri: '/services/data/v60.0',
@@ -886,13 +1378,13 @@ function createResourceRequest(config) {
886
1378
  };
887
1379
  }
888
1380
 
889
- const adapterName = 'getOAuthCredentialAuthUrl';
1381
+ const adapterName$1 = 'getOAuthCredentialAuthUrl';
890
1382
  const getOAuthCredentialAuthUrl_ConfigPropertyMetadata = [
891
1383
  generateParamConfigMetadata('requestBody', true, 2 /* Body */, 4 /* Unsupported */),
892
1384
  ];
893
- const getOAuthCredentialAuthUrl_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getOAuthCredentialAuthUrl_ConfigPropertyMetadata);
894
- const createResourceParams = /*#__PURE__*/ createResourceParams$3(getOAuthCredentialAuthUrl_ConfigPropertyMetadata);
895
- function typeCheckConfig(untrustedConfig) {
1385
+ const getOAuthCredentialAuthUrl_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getOAuthCredentialAuthUrl_ConfigPropertyMetadata);
1386
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$6(getOAuthCredentialAuthUrl_ConfigPropertyMetadata);
1387
+ function typeCheckConfig$1(untrustedConfig) {
896
1388
  const config = {};
897
1389
  const untrustedConfig_requestBody = untrustedConfig.requestBody;
898
1390
  const referenceOAuthCredentialAuthUrlInputRepresentationValidationError = validate$1(untrustedConfig_requestBody);
@@ -901,6 +1393,100 @@ function typeCheckConfig(untrustedConfig) {
901
1393
  }
902
1394
  return config;
903
1395
  }
1396
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
1397
+ if (!untrustedIsObject(untrustedConfig)) {
1398
+ return null;
1399
+ }
1400
+ if (process.env.NODE_ENV !== 'production') {
1401
+ validateConfig(untrustedConfig, configPropertyNames);
1402
+ }
1403
+ const config = typeCheckConfig$1(untrustedConfig);
1404
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1405
+ return null;
1406
+ }
1407
+ return config;
1408
+ }
1409
+ function buildNetworkSnapshot$1(luvio, config, options) {
1410
+ const resourceParams = createResourceParams$1(config);
1411
+ const request = createResourceRequest$1(resourceParams);
1412
+ return luvio.dispatchResourceRequest(request, options)
1413
+ .then((response) => {
1414
+ return luvio.handleSuccessResponse(() => {
1415
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response);
1416
+ return luvio.storeBroadcast().then(() => snapshot);
1417
+ }, () => {
1418
+ const cache = new StoreKeyMap();
1419
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
1420
+ return cache;
1421
+ });
1422
+ }, (response) => {
1423
+ deepFreeze(response);
1424
+ throw response;
1425
+ });
1426
+ }
1427
+ const getOAuthCredentialAuthUrlAdapterFactory = (luvio) => {
1428
+ return function getOAuthCredentialAuthUrl(untrustedConfig) {
1429
+ const config = validateAdapterConfig$1(untrustedConfig, getOAuthCredentialAuthUrl_ConfigPropertyNames);
1430
+ // Invalid or incomplete config
1431
+ if (config === null) {
1432
+ throw new Error('Invalid config for "getOAuthCredentialAuthUrl"');
1433
+ }
1434
+ return buildNetworkSnapshot$1(luvio, config);
1435
+ };
1436
+ };
1437
+
1438
+ function select(luvio, params) {
1439
+ return select$a();
1440
+ }
1441
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1442
+ getTypeCacheKeys$3(storeKeyMap, luvio, response);
1443
+ }
1444
+ function ingestSuccess(luvio, resourceParams, response) {
1445
+ const { body } = response;
1446
+ const key = keyBuilderFromType$2(luvio, body);
1447
+ luvio.storeIngest(key, ingest$3, body);
1448
+ const snapshot = luvio.storeLookup({
1449
+ recordId: key,
1450
+ node: select(),
1451
+ variables: {},
1452
+ });
1453
+ if (process.env.NODE_ENV !== 'production') {
1454
+ if (snapshot.state !== 'Fulfilled') {
1455
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1456
+ }
1457
+ }
1458
+ deepFreeze(snapshot.data);
1459
+ return snapshot;
1460
+ }
1461
+ function createResourceRequest(config) {
1462
+ const headers = {};
1463
+ return {
1464
+ baseUri: '/services/data/v60.0',
1465
+ basePath: '/named-credentials/credential',
1466
+ method: 'put',
1467
+ body: config.body,
1468
+ urlParams: {},
1469
+ queryParams: {},
1470
+ headers,
1471
+ priority: 'normal',
1472
+ };
1473
+ }
1474
+
1475
+ const adapterName = 'updateCredential';
1476
+ const updateCredential_ConfigPropertyMetadata = [
1477
+ generateParamConfigMetadata('requestBody', true, 2 /* Body */, 4 /* Unsupported */),
1478
+ ];
1479
+ const updateCredential_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, updateCredential_ConfigPropertyMetadata);
1480
+ const createResourceParams = /*#__PURE__*/ createResourceParams$6(updateCredential_ConfigPropertyMetadata);
1481
+ function typeCheckConfig(untrustedConfig) {
1482
+ const config = {};
1483
+ const untrustedConfig_requestBody = untrustedConfig.requestBody;
1484
+ const referenceCredentialInputRepresentationValidationError = validate$8(untrustedConfig_requestBody);
1485
+ if (referenceCredentialInputRepresentationValidationError === null) {
1486
+ config.requestBody = untrustedConfig_requestBody;
1487
+ }
1488
+ return config;
1489
+ }
904
1490
  function validateAdapterConfig(untrustedConfig, configPropertyNames) {
905
1491
  if (!untrustedIsObject(untrustedConfig)) {
906
1492
  return null;
@@ -932,46 +1518,60 @@ function buildNetworkSnapshot(luvio, config, options) {
932
1518
  throw response;
933
1519
  });
934
1520
  }
935
- const getOAuthCredentialAuthUrlAdapterFactory = (luvio) => {
936
- return function getOAuthCredentialAuthUrl(untrustedConfig) {
937
- const config = validateAdapterConfig(untrustedConfig, getOAuthCredentialAuthUrl_ConfigPropertyNames);
1521
+ const updateCredentialAdapterFactory = (luvio) => {
1522
+ return function updateCredential(untrustedConfig) {
1523
+ const config = validateAdapterConfig(untrustedConfig, updateCredential_ConfigPropertyNames);
938
1524
  // Invalid or incomplete config
939
1525
  if (config === null) {
940
- throw new Error('Invalid config for "getOAuthCredentialAuthUrl"');
1526
+ throw new Error('Invalid config for "updateCredential"');
941
1527
  }
942
1528
  return buildNetworkSnapshot(luvio, config);
943
1529
  };
944
1530
  };
945
1531
 
1532
+ let createCredential;
946
1533
  let deleteCredential;
1534
+ let getCredential;
947
1535
  let getExternalCredentials;
948
1536
  let getOAuthCredentialAuthUrl;
1537
+ let updateCredential;
949
1538
  // Imperative GET Adapters
1539
+ let getCredential_imperative;
950
1540
  let getExternalCredentials_imperative;
1541
+ const getCredentialMetadata = { apiFamily: 'namedcredential', name: 'getCredential', ttl: 100 };
951
1542
  const getExternalCredentialsMetadata = { apiFamily: 'namedcredential', name: 'getExternalCredentials' };
952
1543
  function bindExportsTo(luvio) {
953
1544
  // LDS Adapters
1545
+ const getCredential_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getCredential', getCredentialAdapterFactory), getCredentialMetadata);
954
1546
  const getExternalCredentials_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getExternalCredentials', getExternalCredentialsAdapterFactory), getExternalCredentialsMetadata);
955
1547
  function unwrapSnapshotData(factory) {
956
1548
  const adapter = factory(luvio);
957
1549
  return (config) => adapter(config).then(snapshot => snapshot.data);
958
1550
  }
959
1551
  return {
960
- deleteCredential: createLDSAdapter(luvio, adapterName$2, deleteCredentialAdapterFactory),
1552
+ createCredential: unwrapSnapshotData(createCredentialAdapterFactory),
1553
+ deleteCredential: createLDSAdapter(luvio, adapterName$4, deleteCredentialAdapterFactory),
1554
+ getCredential: createWireAdapterConstructor(luvio, getCredential_ldsAdapter, getCredentialMetadata),
961
1555
  getExternalCredentials: createWireAdapterConstructor(luvio, getExternalCredentials_ldsAdapter, getExternalCredentialsMetadata),
962
1556
  getOAuthCredentialAuthUrl: unwrapSnapshotData(getOAuthCredentialAuthUrlAdapterFactory),
1557
+ updateCredential: unwrapSnapshotData(updateCredentialAdapterFactory),
963
1558
  // Imperative GET Adapters
1559
+ getCredential_imperative: createImperativeAdapter(luvio, getCredential_ldsAdapter, getCredentialMetadata),
964
1560
  getExternalCredentials_imperative: createImperativeAdapter(luvio, getExternalCredentials_ldsAdapter, getExternalCredentialsMetadata)
965
1561
  };
966
1562
  }
967
1563
  withDefaultLuvio((luvio) => {
968
1564
  ({
1565
+ createCredential,
969
1566
  deleteCredential,
1567
+ getCredential,
970
1568
  getExternalCredentials,
971
1569
  getOAuthCredentialAuthUrl,
1570
+ updateCredential,
1571
+ getCredential_imperative,
972
1572
  getExternalCredentials_imperative
973
1573
  } = bindExportsTo(luvio));
974
1574
  });
975
1575
 
976
- export { deleteCredential, getExternalCredentials, getExternalCredentials_imperative, getOAuthCredentialAuthUrl };
977
- // version: 1.246.0-3f6b4cf3f
1576
+ export { createCredential, deleteCredential, getCredential, getCredential_imperative, getExternalCredentials, getExternalCredentials_imperative, getOAuthCredentialAuthUrl, updateCredential };
1577
+ // version: 1.248.0-0a41f7ec3