@salesforce/lds-adapters-platform-devworkspace 1.353.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.
Files changed (24) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/platform-devworkspace.js +867 -0
  3. package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
  4. package/dist/es/es2018/types/src/generated/adapters/getDevWorkspaceDetails.d.ts +27 -0
  5. package/dist/es/es2018/types/src/generated/adapters/getDevWorkspaceMetadata.d.ts +28 -0
  6. package/dist/es/es2018/types/src/generated/adapters/getDevWorkspaces.d.ts +26 -0
  7. package/dist/es/es2018/types/src/generated/adapters/updateDevWorkspaceMetadata.d.ts +17 -0
  8. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +4 -0
  9. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +9 -0
  10. package/dist/es/es2018/types/src/generated/resources/getConnectWorkspaces.d.ts +12 -0
  11. package/dist/es/es2018/types/src/generated/resources/getConnectWorkspacesByDevWorkspaceId.d.ts +15 -0
  12. package/dist/es/es2018/types/src/generated/resources/getConnectWorkspacesMetadataByDevWorkspaceId.d.ts +16 -0
  13. package/dist/es/es2018/types/src/generated/resources/patchConnectWorkspacesMetadataByDevWorkspaceId.d.ts +16 -0
  14. package/dist/es/es2018/types/src/generated/types/DevWorkspaceDetailsCollectionRepresentation.d.ts +33 -0
  15. package/dist/es/es2018/types/src/generated/types/DevWorkspaceDetailsRepresentation.d.ts +41 -0
  16. package/dist/es/es2018/types/src/generated/types/DevWorkspaceMetadataCollectionOutputRepresentation.d.ts +42 -0
  17. package/dist/es/es2018/types/src/generated/types/DevWorkspaceMetadataDetailOutputRepresentation.d.ts +47 -0
  18. package/dist/es/es2018/types/src/generated/types/DevWorkspaceMetadataIdCollectionInputRepresentation.d.ts +31 -0
  19. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  20. package/package.json +66 -0
  21. package/sfdc/index.d.ts +1 -0
  22. package/sfdc/index.js +980 -0
  23. package/src/raml/api.raml +167 -0
  24. package/src/raml/luvio.raml +43 -0
@@ -0,0 +1,867 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$3, StoreKeyMap, createResourceParams as createResourceParams$4, typeCheckConfig as typeCheckConfig$4 } from '@luvio/engine';
8
+
9
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
+ const { keys: ObjectKeys, create: ObjectCreate } = Object;
11
+ const { isArray: ArrayIsArray$1 } = Array;
12
+ /**
13
+ * Validates an adapter config is well-formed.
14
+ * @param config The config to validate.
15
+ * @param adapter The adapter validation configuration.
16
+ * @param oneOf The keys the config must contain at least one of.
17
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
18
+ */
19
+ function validateConfig(config, adapter, oneOf) {
20
+ const { displayName } = adapter;
21
+ const { required, optional, unsupported } = adapter.parameters;
22
+ if (config === undefined ||
23
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
24
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
25
+ }
26
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
27
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
28
+ }
29
+ if (unsupported !== undefined &&
30
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
31
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
32
+ }
33
+ const supported = required.concat(optional);
34
+ if (ObjectKeys(config).some(key => !supported.includes(key))) {
35
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
36
+ }
37
+ }
38
+ function untrustedIsObject(untrusted) {
39
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
40
+ }
41
+ function areRequiredParametersPresent(config, configPropertyNames) {
42
+ return configPropertyNames.parameters.required.every(req => req in config);
43
+ }
44
+ const snapshotRefreshOptions = {
45
+ overrides: {
46
+ headers: {
47
+ 'Cache-Control': 'no-cache',
48
+ },
49
+ }
50
+ };
51
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
52
+ return {
53
+ name,
54
+ required,
55
+ resourceType,
56
+ typeCheckShape,
57
+ isArrayShape,
58
+ coerceFn,
59
+ };
60
+ }
61
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
62
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
63
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
64
+ return {
65
+ displayName,
66
+ parameters: {
67
+ required,
68
+ optional,
69
+ }
70
+ };
71
+ }
72
+ const keyPrefix = 'DevWorkspace';
73
+
74
+ const { isArray: ArrayIsArray } = Array;
75
+ const { stringify: JSONStringify } = JSON;
76
+ function createLink(ref) {
77
+ return {
78
+ __ref: serializeStructuredKey(ref),
79
+ };
80
+ }
81
+
82
+ const TTL$2 = 30000;
83
+ const VERSION$2 = "1166698d4405d889c2c0334905b1eed9";
84
+ function validate$3(obj, path = 'DevWorkspaceDetailsRepresentation') {
85
+ const v_error = (() => {
86
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
87
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
88
+ }
89
+ const obj_description = obj.description;
90
+ const path_description = path + '.description';
91
+ if (typeof obj_description !== 'string') {
92
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
93
+ }
94
+ const obj_devWorkspaceId = obj.devWorkspaceId;
95
+ const path_devWorkspaceId = path + '.devWorkspaceId';
96
+ if (typeof obj_devWorkspaceId !== 'string') {
97
+ return new TypeError('Expected "string" but received "' + typeof obj_devWorkspaceId + '" (at "' + path_devWorkspaceId + '")');
98
+ }
99
+ const obj_developerName = obj.developerName;
100
+ const path_developerName = path + '.developerName';
101
+ if (typeof obj_developerName !== 'string') {
102
+ return new TypeError('Expected "string" but received "' + typeof obj_developerName + '" (at "' + path_developerName + '")');
103
+ }
104
+ const obj_lastModifiedDate = obj.lastModifiedDate;
105
+ const path_lastModifiedDate = path + '.lastModifiedDate';
106
+ if (typeof obj_lastModifiedDate !== 'string') {
107
+ return new TypeError('Expected "string" but received "' + typeof obj_lastModifiedDate + '" (at "' + path_lastModifiedDate + '")');
108
+ }
109
+ const obj_masterLabel = obj.masterLabel;
110
+ const path_masterLabel = path + '.masterLabel';
111
+ if (typeof obj_masterLabel !== 'string') {
112
+ return new TypeError('Expected "string" but received "' + typeof obj_masterLabel + '" (at "' + path_masterLabel + '")');
113
+ }
114
+ })();
115
+ return v_error === undefined ? null : v_error;
116
+ }
117
+ const RepresentationType$2 = 'DevWorkspaceDetailsRepresentation';
118
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
119
+ return input;
120
+ }
121
+ const select$6 = function DevWorkspaceDetailsRepresentationSelect() {
122
+ return {
123
+ kind: 'Fragment',
124
+ version: VERSION$2,
125
+ private: [],
126
+ opaque: true
127
+ };
128
+ };
129
+ function equals$2(existing, incoming) {
130
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
131
+ return false;
132
+ }
133
+ return true;
134
+ }
135
+ const ingest$2 = function DevWorkspaceDetailsRepresentationIngest(input, path, luvio, store, timestamp) {
136
+ if (process.env.NODE_ENV !== 'production') {
137
+ const validateError = validate$3(input);
138
+ if (validateError !== null) {
139
+ throw validateError;
140
+ }
141
+ }
142
+ const key = path.fullPath;
143
+ const ttlToUse = TTL$2;
144
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "DevWorkspace", VERSION$2, RepresentationType$2, equals$2);
145
+ return createLink(key);
146
+ };
147
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
148
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
149
+ const rootKey = fullPathFactory();
150
+ rootKeySet.set(rootKey, {
151
+ namespace: keyPrefix,
152
+ representationName: RepresentationType$2,
153
+ mergeable: false
154
+ });
155
+ }
156
+
157
+ const TTL$1 = 30000;
158
+ const VERSION$1 = "b17ed56948c949bdf3ffb0c5b035ea16";
159
+ function validate$2(obj, path = 'DevWorkspaceDetailsCollectionRepresentation') {
160
+ const v_error = (() => {
161
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
162
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
163
+ }
164
+ const obj_count = obj.count;
165
+ const path_count = path + '.count';
166
+ if (typeof obj_count !== 'number' || (typeof obj_count === 'number' && Math.floor(obj_count) !== obj_count)) {
167
+ return new TypeError('Expected "integer" but received "' + typeof obj_count + '" (at "' + path_count + '")');
168
+ }
169
+ const obj_devWorkspaces = obj.devWorkspaces;
170
+ const path_devWorkspaces = path + '.devWorkspaces';
171
+ if (!ArrayIsArray(obj_devWorkspaces)) {
172
+ return new TypeError('Expected "array" but received "' + typeof obj_devWorkspaces + '" (at "' + path_devWorkspaces + '")');
173
+ }
174
+ for (let i = 0; i < obj_devWorkspaces.length; i++) {
175
+ const obj_devWorkspaces_item = obj_devWorkspaces[i];
176
+ const path_devWorkspaces_item = path_devWorkspaces + '[' + i + ']';
177
+ const referencepath_devWorkspaces_itemValidationError = validate$3(obj_devWorkspaces_item, path_devWorkspaces_item);
178
+ if (referencepath_devWorkspaces_itemValidationError !== null) {
179
+ let message = 'Object doesn\'t match DevWorkspaceDetailsRepresentation (at "' + path_devWorkspaces_item + '")\n';
180
+ message += referencepath_devWorkspaces_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
181
+ return new TypeError(message);
182
+ }
183
+ }
184
+ })();
185
+ return v_error === undefined ? null : v_error;
186
+ }
187
+ const RepresentationType$1 = 'DevWorkspaceDetailsCollectionRepresentation';
188
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
189
+ return input;
190
+ }
191
+ const select$5 = function DevWorkspaceDetailsCollectionRepresentationSelect() {
192
+ return {
193
+ kind: 'Fragment',
194
+ version: VERSION$1,
195
+ private: [],
196
+ opaque: true
197
+ };
198
+ };
199
+ function equals$1(existing, incoming) {
200
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
201
+ return false;
202
+ }
203
+ return true;
204
+ }
205
+ const ingest$1 = function DevWorkspaceDetailsCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
206
+ if (process.env.NODE_ENV !== 'production') {
207
+ const validateError = validate$2(input);
208
+ if (validateError !== null) {
209
+ throw validateError;
210
+ }
211
+ }
212
+ const key = path.fullPath;
213
+ const ttlToUse = TTL$1;
214
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "DevWorkspace", VERSION$1, RepresentationType$1, equals$1);
215
+ return createLink(key);
216
+ };
217
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
218
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
219
+ const rootKey = fullPathFactory();
220
+ rootKeySet.set(rootKey, {
221
+ namespace: keyPrefix,
222
+ representationName: RepresentationType$1,
223
+ mergeable: false
224
+ });
225
+ }
226
+
227
+ function select$4(luvio, params) {
228
+ return select$5();
229
+ }
230
+ function keyBuilder$6(luvio, params) {
231
+ return keyPrefix + '::DevWorkspaceDetailsCollectionRepresentation:(' + ')';
232
+ }
233
+ function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
234
+ getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$6());
235
+ }
236
+ function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
237
+ const { body } = response;
238
+ const key = keyBuilder$6();
239
+ luvio.storeIngest(key, ingest$1, body);
240
+ const snapshot = luvio.storeLookup({
241
+ recordId: key,
242
+ node: select$4(),
243
+ variables: {},
244
+ }, snapshotRefresh);
245
+ if (process.env.NODE_ENV !== 'production') {
246
+ if (snapshot.state !== 'Fulfilled') {
247
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
248
+ }
249
+ }
250
+ deepFreeze(snapshot.data);
251
+ return snapshot;
252
+ }
253
+ function ingestError$2(luvio, params, error, snapshotRefresh) {
254
+ const key = keyBuilder$6();
255
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
256
+ const storeMetadataParams = {
257
+ ttl: TTL$1,
258
+ namespace: keyPrefix,
259
+ version: VERSION$1,
260
+ representationName: RepresentationType$1
261
+ };
262
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
263
+ return errorSnapshot;
264
+ }
265
+ function createResourceRequest$3(config) {
266
+ const headers = {};
267
+ return {
268
+ baseUri: '/services/data/v64.0',
269
+ basePath: '/connect/workspaces',
270
+ method: 'get',
271
+ body: null,
272
+ urlParams: {},
273
+ queryParams: {},
274
+ headers,
275
+ priority: 'normal',
276
+ };
277
+ }
278
+
279
+ const adapterName$3 = 'getDevWorkspaces';
280
+ const getDevWorkspaces_ConfigPropertyMetadata = [];
281
+ const getDevWorkspaces_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, getDevWorkspaces_ConfigPropertyMetadata);
282
+ const createResourceParams$3 = /*#__PURE__*/ createResourceParams$4(getDevWorkspaces_ConfigPropertyMetadata);
283
+ function keyBuilder$5(luvio, config) {
284
+ createResourceParams$3(config);
285
+ return keyBuilder$6();
286
+ }
287
+ function typeCheckConfig$3(untrustedConfig) {
288
+ const config = {};
289
+ return config;
290
+ }
291
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
292
+ if (!untrustedIsObject(untrustedConfig)) {
293
+ return null;
294
+ }
295
+ if (process.env.NODE_ENV !== 'production') {
296
+ validateConfig(untrustedConfig, configPropertyNames);
297
+ }
298
+ const config = typeCheckConfig$3();
299
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
300
+ return null;
301
+ }
302
+ return config;
303
+ }
304
+ function adapterFragment$2(luvio, config) {
305
+ createResourceParams$3(config);
306
+ return select$4();
307
+ }
308
+ function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
309
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
310
+ config,
311
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
312
+ });
313
+ return luvio.storeBroadcast().then(() => snapshot);
314
+ }
315
+ function onFetchResponseError$2(luvio, config, resourceParams, response) {
316
+ const snapshot = ingestError$2(luvio, resourceParams, response, {
317
+ config,
318
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
319
+ });
320
+ return luvio.storeBroadcast().then(() => snapshot);
321
+ }
322
+ function buildNetworkSnapshot$3(luvio, config, options) {
323
+ const resourceParams = createResourceParams$3(config);
324
+ const request = createResourceRequest$3();
325
+ return luvio.dispatchResourceRequest(request, options)
326
+ .then((response) => {
327
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => {
328
+ const cache = new StoreKeyMap();
329
+ getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
330
+ return cache;
331
+ });
332
+ }, (response) => {
333
+ return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
334
+ });
335
+ }
336
+ function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
337
+ return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot$3, undefined, false);
338
+ }
339
+ function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
340
+ const { luvio, config } = context;
341
+ const selector = {
342
+ recordId: keyBuilder$5(luvio, config),
343
+ node: adapterFragment$2(luvio, config),
344
+ variables: {},
345
+ };
346
+ const cacheSnapshot = storeLookup(selector, {
347
+ config,
348
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
349
+ });
350
+ return cacheSnapshot;
351
+ }
352
+ const getDevWorkspacesAdapterFactory = (luvio) => function DevWorkspace__getDevWorkspaces(untrustedConfig, requestContext) {
353
+ const config = validateAdapterConfig$3(untrustedConfig, getDevWorkspaces_ConfigPropertyNames);
354
+ // Invalid or incomplete config
355
+ if (config === null) {
356
+ return null;
357
+ }
358
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
359
+ buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
360
+ };
361
+
362
+ function select$3(luvio, params) {
363
+ return select$6();
364
+ }
365
+ function keyBuilder$4(luvio, params) {
366
+ return keyPrefix + '::DevWorkspaceDetailsRepresentation:(' + 'devWorkspaceId:' + params.urlParams.devWorkspaceId + ')';
367
+ }
368
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
369
+ getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$4(luvio, resourceParams));
370
+ }
371
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
372
+ const { body } = response;
373
+ const key = keyBuilder$4(luvio, resourceParams);
374
+ luvio.storeIngest(key, ingest$2, body);
375
+ const snapshot = luvio.storeLookup({
376
+ recordId: key,
377
+ node: select$3(),
378
+ variables: {},
379
+ }, snapshotRefresh);
380
+ if (process.env.NODE_ENV !== 'production') {
381
+ if (snapshot.state !== 'Fulfilled') {
382
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
383
+ }
384
+ }
385
+ deepFreeze(snapshot.data);
386
+ return snapshot;
387
+ }
388
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
389
+ const key = keyBuilder$4(luvio, params);
390
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
391
+ const storeMetadataParams = {
392
+ ttl: TTL$2,
393
+ namespace: keyPrefix,
394
+ version: VERSION$2,
395
+ representationName: RepresentationType$2
396
+ };
397
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
398
+ return errorSnapshot;
399
+ }
400
+ function createResourceRequest$2(config) {
401
+ const headers = {};
402
+ return {
403
+ baseUri: '/services/data/v64.0',
404
+ basePath: '/connect/workspaces/' + config.urlParams.devWorkspaceId + '',
405
+ method: 'get',
406
+ body: null,
407
+ urlParams: config.urlParams,
408
+ queryParams: {},
409
+ headers,
410
+ priority: 'normal',
411
+ };
412
+ }
413
+
414
+ const adapterName$2 = 'getDevWorkspaceDetails';
415
+ const getDevWorkspaceDetails_ConfigPropertyMetadata = [
416
+ generateParamConfigMetadata('devWorkspaceId', true, 0 /* UrlParameter */, 0 /* String */),
417
+ ];
418
+ const getDevWorkspaceDetails_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getDevWorkspaceDetails_ConfigPropertyMetadata);
419
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$4(getDevWorkspaceDetails_ConfigPropertyMetadata);
420
+ function keyBuilder$3(luvio, config) {
421
+ const resourceParams = createResourceParams$2(config);
422
+ return keyBuilder$4(luvio, resourceParams);
423
+ }
424
+ function typeCheckConfig$2(untrustedConfig) {
425
+ const config = {};
426
+ typeCheckConfig$4(untrustedConfig, config, getDevWorkspaceDetails_ConfigPropertyMetadata);
427
+ return config;
428
+ }
429
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
430
+ if (!untrustedIsObject(untrustedConfig)) {
431
+ return null;
432
+ }
433
+ if (process.env.NODE_ENV !== 'production') {
434
+ validateConfig(untrustedConfig, configPropertyNames);
435
+ }
436
+ const config = typeCheckConfig$2(untrustedConfig);
437
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
438
+ return null;
439
+ }
440
+ return config;
441
+ }
442
+ function adapterFragment$1(luvio, config) {
443
+ createResourceParams$2(config);
444
+ return select$3();
445
+ }
446
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
447
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
448
+ config,
449
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
450
+ });
451
+ return luvio.storeBroadcast().then(() => snapshot);
452
+ }
453
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
454
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
455
+ config,
456
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
457
+ });
458
+ return luvio.storeBroadcast().then(() => snapshot);
459
+ }
460
+ function buildNetworkSnapshot$2(luvio, config, options) {
461
+ const resourceParams = createResourceParams$2(config);
462
+ const request = createResourceRequest$2(resourceParams);
463
+ return luvio.dispatchResourceRequest(request, options)
464
+ .then((response) => {
465
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
466
+ const cache = new StoreKeyMap();
467
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
468
+ return cache;
469
+ });
470
+ }, (response) => {
471
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
472
+ });
473
+ }
474
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
475
+ return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
476
+ }
477
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
478
+ const { luvio, config } = context;
479
+ const selector = {
480
+ recordId: keyBuilder$3(luvio, config),
481
+ node: adapterFragment$1(luvio, config),
482
+ variables: {},
483
+ };
484
+ const cacheSnapshot = storeLookup(selector, {
485
+ config,
486
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
487
+ });
488
+ return cacheSnapshot;
489
+ }
490
+ const getDevWorkspaceDetailsAdapterFactory = (luvio) => function DevWorkspace__getDevWorkspaceDetails(untrustedConfig, requestContext) {
491
+ const config = validateAdapterConfig$2(untrustedConfig, getDevWorkspaceDetails_ConfigPropertyNames);
492
+ // Invalid or incomplete config
493
+ if (config === null) {
494
+ return null;
495
+ }
496
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
497
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
498
+ };
499
+
500
+ function validate$1(obj, path = 'DevWorkspaceMetadataDetailOutputRepresentation') {
501
+ const v_error = (() => {
502
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
503
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
504
+ }
505
+ if (obj.actionURL !== undefined) {
506
+ const obj_actionURL = obj.actionURL;
507
+ const path_actionURL = path + '.actionURL';
508
+ if (typeof obj_actionURL !== 'string') {
509
+ return new TypeError('Expected "string" but received "' + typeof obj_actionURL + '" (at "' + path_actionURL + '")');
510
+ }
511
+ }
512
+ if (obj.developerName !== undefined) {
513
+ const obj_developerName = obj.developerName;
514
+ const path_developerName = path + '.developerName';
515
+ if (typeof obj_developerName !== 'string') {
516
+ return new TypeError('Expected "string" but received "' + typeof obj_developerName + '" (at "' + path_developerName + '")');
517
+ }
518
+ }
519
+ if (obj.label !== undefined) {
520
+ const obj_label = obj.label;
521
+ const path_label = path + '.label';
522
+ if (typeof obj_label !== 'string') {
523
+ return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
524
+ }
525
+ }
526
+ if (obj.lastModifiedDate !== undefined) {
527
+ const obj_lastModifiedDate = obj.lastModifiedDate;
528
+ const path_lastModifiedDate = path + '.lastModifiedDate';
529
+ if (typeof obj_lastModifiedDate !== 'string') {
530
+ return new TypeError('Expected "string" but received "' + typeof obj_lastModifiedDate + '" (at "' + path_lastModifiedDate + '")');
531
+ }
532
+ }
533
+ const obj_metadataId = obj.metadataId;
534
+ const path_metadataId = path + '.metadataId';
535
+ if (typeof obj_metadataId !== 'string') {
536
+ return new TypeError('Expected "string" but received "' + typeof obj_metadataId + '" (at "' + path_metadataId + '")');
537
+ }
538
+ if (obj.metadataType !== undefined) {
539
+ const obj_metadataType = obj.metadataType;
540
+ const path_metadataType = path + '.metadataType';
541
+ if (typeof obj_metadataType !== 'string') {
542
+ return new TypeError('Expected "string" but received "' + typeof obj_metadataType + '" (at "' + path_metadataType + '")');
543
+ }
544
+ }
545
+ if (obj.metadataTypeLabel !== undefined) {
546
+ const obj_metadataTypeLabel = obj.metadataTypeLabel;
547
+ const path_metadataTypeLabel = path + '.metadataTypeLabel';
548
+ if (typeof obj_metadataTypeLabel !== 'string') {
549
+ return new TypeError('Expected "string" but received "' + typeof obj_metadataTypeLabel + '" (at "' + path_metadataTypeLabel + '")');
550
+ }
551
+ }
552
+ })();
553
+ return v_error === undefined ? null : v_error;
554
+ }
555
+
556
+ const TTL = 30000;
557
+ const VERSION = "6f291079c7238a3cbf0e3ef2b6461767";
558
+ function validate(obj, path = 'DevWorkspaceMetadataCollectionOutputRepresentation') {
559
+ const v_error = (() => {
560
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
561
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
562
+ }
563
+ const obj_currentDevWorkspaceId = obj.currentDevWorkspaceId;
564
+ const path_currentDevWorkspaceId = path + '.currentDevWorkspaceId';
565
+ if (typeof obj_currentDevWorkspaceId !== 'string') {
566
+ return new TypeError('Expected "string" but received "' + typeof obj_currentDevWorkspaceId + '" (at "' + path_currentDevWorkspaceId + '")');
567
+ }
568
+ const obj_devWorkspaceMetadata = obj.devWorkspaceMetadata;
569
+ const path_devWorkspaceMetadata = path + '.devWorkspaceMetadata';
570
+ if (!ArrayIsArray(obj_devWorkspaceMetadata)) {
571
+ return new TypeError('Expected "array" but received "' + typeof obj_devWorkspaceMetadata + '" (at "' + path_devWorkspaceMetadata + '")');
572
+ }
573
+ for (let i = 0; i < obj_devWorkspaceMetadata.length; i++) {
574
+ const obj_devWorkspaceMetadata_item = obj_devWorkspaceMetadata[i];
575
+ const path_devWorkspaceMetadata_item = path_devWorkspaceMetadata + '[' + i + ']';
576
+ const referencepath_devWorkspaceMetadata_itemValidationError = validate$1(obj_devWorkspaceMetadata_item, path_devWorkspaceMetadata_item);
577
+ if (referencepath_devWorkspaceMetadata_itemValidationError !== null) {
578
+ let message = 'Object doesn\'t match DevWorkspaceMetadataDetailOutputRepresentation (at "' + path_devWorkspaceMetadata_item + '")\n';
579
+ message += referencepath_devWorkspaceMetadata_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
580
+ return new TypeError(message);
581
+ }
582
+ }
583
+ })();
584
+ return v_error === undefined ? null : v_error;
585
+ }
586
+ const RepresentationType = 'DevWorkspaceMetadataCollectionOutputRepresentation';
587
+ function keyBuilder$2(luvio, config) {
588
+ return keyPrefix + '::' + RepresentationType + ':' + config.workspaceId;
589
+ }
590
+ function keyBuilderFromType(luvio, object) {
591
+ const keyParams = {
592
+ workspaceId: object.currentDevWorkspaceId
593
+ };
594
+ return keyBuilder$2(luvio, keyParams);
595
+ }
596
+ function normalize(input, existing, path, luvio, store, timestamp) {
597
+ return input;
598
+ }
599
+ const select$2 = function DevWorkspaceMetadataCollectionOutputRepresentationSelect() {
600
+ return {
601
+ kind: 'Fragment',
602
+ version: VERSION,
603
+ private: [],
604
+ opaque: true
605
+ };
606
+ };
607
+ function equals(existing, incoming) {
608
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
609
+ return false;
610
+ }
611
+ return true;
612
+ }
613
+ const ingest = function DevWorkspaceMetadataCollectionOutputRepresentationIngest(input, path, luvio, store, timestamp) {
614
+ if (process.env.NODE_ENV !== 'production') {
615
+ const validateError = validate(input);
616
+ if (validateError !== null) {
617
+ throw validateError;
618
+ }
619
+ }
620
+ const key = keyBuilderFromType(luvio, input);
621
+ const ttlToUse = TTL;
622
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "DevWorkspace", VERSION, RepresentationType, equals);
623
+ return createLink(key);
624
+ };
625
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
626
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
627
+ const rootKey = keyBuilderFromType(luvio, input);
628
+ rootKeySet.set(rootKey, {
629
+ namespace: keyPrefix,
630
+ representationName: RepresentationType,
631
+ mergeable: false
632
+ });
633
+ }
634
+
635
+ function select$1(luvio, params) {
636
+ return select$2();
637
+ }
638
+ function keyBuilder$1(luvio, params) {
639
+ return keyBuilder$2(luvio, {
640
+ workspaceId: params.urlParams.devWorkspaceId
641
+ });
642
+ }
643
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
644
+ getTypeCacheKeys(storeKeyMap, luvio, response);
645
+ }
646
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
647
+ const { body } = response;
648
+ const key = keyBuilder$1(luvio, resourceParams);
649
+ luvio.storeIngest(key, ingest, body);
650
+ const snapshot = luvio.storeLookup({
651
+ recordId: key,
652
+ node: select$1(),
653
+ variables: {},
654
+ }, snapshotRefresh);
655
+ if (process.env.NODE_ENV !== 'production') {
656
+ if (snapshot.state !== 'Fulfilled') {
657
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
658
+ }
659
+ }
660
+ deepFreeze(snapshot.data);
661
+ return snapshot;
662
+ }
663
+ function ingestError(luvio, params, error, snapshotRefresh) {
664
+ const key = keyBuilder$1(luvio, params);
665
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
666
+ const storeMetadataParams = {
667
+ ttl: TTL,
668
+ namespace: keyPrefix,
669
+ version: VERSION,
670
+ representationName: RepresentationType
671
+ };
672
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
673
+ return errorSnapshot;
674
+ }
675
+ function createResourceRequest$1(config) {
676
+ const headers = {};
677
+ return {
678
+ baseUri: '/services/data/v64.0',
679
+ basePath: '/connect/workspaces/' + config.urlParams.devWorkspaceId + '/metadata',
680
+ method: 'get',
681
+ body: null,
682
+ urlParams: config.urlParams,
683
+ queryParams: {},
684
+ headers,
685
+ priority: 'normal',
686
+ };
687
+ }
688
+
689
+ const adapterName$1 = 'getDevWorkspaceMetadata';
690
+ const getDevWorkspaceMetadata_ConfigPropertyMetadata = [
691
+ generateParamConfigMetadata('devWorkspaceId', true, 0 /* UrlParameter */, 0 /* String */),
692
+ ];
693
+ const getDevWorkspaceMetadata_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getDevWorkspaceMetadata_ConfigPropertyMetadata);
694
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$4(getDevWorkspaceMetadata_ConfigPropertyMetadata);
695
+ function keyBuilder(luvio, config) {
696
+ const resourceParams = createResourceParams$1(config);
697
+ return keyBuilder$1(luvio, resourceParams);
698
+ }
699
+ function typeCheckConfig$1(untrustedConfig) {
700
+ const config = {};
701
+ typeCheckConfig$4(untrustedConfig, config, getDevWorkspaceMetadata_ConfigPropertyMetadata);
702
+ return config;
703
+ }
704
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
705
+ if (!untrustedIsObject(untrustedConfig)) {
706
+ return null;
707
+ }
708
+ if (process.env.NODE_ENV !== 'production') {
709
+ validateConfig(untrustedConfig, configPropertyNames);
710
+ }
711
+ const config = typeCheckConfig$1(untrustedConfig);
712
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
713
+ return null;
714
+ }
715
+ return config;
716
+ }
717
+ function adapterFragment(luvio, config) {
718
+ createResourceParams$1(config);
719
+ return select$1();
720
+ }
721
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
722
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
723
+ config,
724
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
725
+ });
726
+ return luvio.storeBroadcast().then(() => snapshot);
727
+ }
728
+ function onFetchResponseError(luvio, config, resourceParams, response) {
729
+ const snapshot = ingestError(luvio, resourceParams, response, {
730
+ config,
731
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
732
+ });
733
+ return luvio.storeBroadcast().then(() => snapshot);
734
+ }
735
+ function buildNetworkSnapshot$1(luvio, config, options) {
736
+ const resourceParams = createResourceParams$1(config);
737
+ const request = createResourceRequest$1(resourceParams);
738
+ return luvio.dispatchResourceRequest(request, options)
739
+ .then((response) => {
740
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
741
+ const cache = new StoreKeyMap();
742
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
743
+ return cache;
744
+ });
745
+ }, (response) => {
746
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
747
+ });
748
+ }
749
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
750
+ return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
751
+ }
752
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
753
+ const { luvio, config } = context;
754
+ const selector = {
755
+ recordId: keyBuilder(luvio, config),
756
+ node: adapterFragment(luvio, config),
757
+ variables: {},
758
+ };
759
+ const cacheSnapshot = storeLookup(selector, {
760
+ config,
761
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
762
+ });
763
+ return cacheSnapshot;
764
+ }
765
+ const getDevWorkspaceMetadataAdapterFactory = (luvio) => function DevWorkspace__getDevWorkspaceMetadata(untrustedConfig, requestContext) {
766
+ const config = validateAdapterConfig$1(untrustedConfig, getDevWorkspaceMetadata_ConfigPropertyNames);
767
+ // Invalid or incomplete config
768
+ if (config === null) {
769
+ return null;
770
+ }
771
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
772
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
773
+ };
774
+
775
+ function select(luvio, params) {
776
+ return select$2();
777
+ }
778
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
779
+ getTypeCacheKeys(storeKeyMap, luvio, response);
780
+ }
781
+ function ingestSuccess(luvio, resourceParams, response) {
782
+ const { body } = response;
783
+ const key = keyBuilderFromType(luvio, body);
784
+ luvio.storeIngest(key, ingest, body);
785
+ const snapshot = luvio.storeLookup({
786
+ recordId: key,
787
+ node: select(),
788
+ variables: {},
789
+ });
790
+ if (process.env.NODE_ENV !== 'production') {
791
+ if (snapshot.state !== 'Fulfilled') {
792
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
793
+ }
794
+ }
795
+ deepFreeze(snapshot.data);
796
+ return snapshot;
797
+ }
798
+ function createResourceRequest(config) {
799
+ const headers = {};
800
+ return {
801
+ baseUri: '/services/data/v64.0',
802
+ basePath: '/connect/workspaces/' + config.urlParams.devWorkspaceId + '/metadata',
803
+ method: 'patch',
804
+ body: config.body,
805
+ urlParams: config.urlParams,
806
+ queryParams: {},
807
+ headers,
808
+ priority: 'normal',
809
+ };
810
+ }
811
+
812
+ const adapterName = 'updateDevWorkspaceMetadata';
813
+ const updateDevWorkspaceMetadata_ConfigPropertyMetadata = [
814
+ generateParamConfigMetadata('devWorkspaceId', true, 0 /* UrlParameter */, 0 /* String */),
815
+ generateParamConfigMetadata('metadataIds', true, 2 /* Body */, 0 /* String */, true),
816
+ generateParamConfigMetadata('operationType', true, 2 /* Body */, 0 /* String */),
817
+ ];
818
+ const updateDevWorkspaceMetadata_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, updateDevWorkspaceMetadata_ConfigPropertyMetadata);
819
+ const createResourceParams = /*#__PURE__*/ createResourceParams$4(updateDevWorkspaceMetadata_ConfigPropertyMetadata);
820
+ function typeCheckConfig(untrustedConfig) {
821
+ const config = {};
822
+ typeCheckConfig$4(untrustedConfig, config, updateDevWorkspaceMetadata_ConfigPropertyMetadata);
823
+ return config;
824
+ }
825
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
826
+ if (!untrustedIsObject(untrustedConfig)) {
827
+ return null;
828
+ }
829
+ if (process.env.NODE_ENV !== 'production') {
830
+ validateConfig(untrustedConfig, configPropertyNames);
831
+ }
832
+ const config = typeCheckConfig(untrustedConfig);
833
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
834
+ return null;
835
+ }
836
+ return config;
837
+ }
838
+ function buildNetworkSnapshot(luvio, config, options) {
839
+ const resourceParams = createResourceParams(config);
840
+ const request = createResourceRequest(resourceParams);
841
+ return luvio.dispatchResourceRequest(request, options)
842
+ .then((response) => {
843
+ return luvio.handleSuccessResponse(() => {
844
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
845
+ return luvio.storeBroadcast().then(() => snapshot);
846
+ }, () => {
847
+ const cache = new StoreKeyMap();
848
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
849
+ return cache;
850
+ });
851
+ }, (response) => {
852
+ deepFreeze(response);
853
+ throw response;
854
+ });
855
+ }
856
+ const updateDevWorkspaceMetadataAdapterFactory = (luvio) => {
857
+ return function updateDevWorkspaceMetadata(untrustedConfig) {
858
+ const config = validateAdapterConfig(untrustedConfig, updateDevWorkspaceMetadata_ConfigPropertyNames);
859
+ // Invalid or incomplete config
860
+ if (config === null) {
861
+ throw new Error('Invalid config for "updateDevWorkspaceMetadata"');
862
+ }
863
+ return buildNetworkSnapshot(luvio, config);
864
+ };
865
+ };
866
+
867
+ export { getDevWorkspaceDetailsAdapterFactory, getDevWorkspaceMetadataAdapterFactory, getDevWorkspacesAdapterFactory, updateDevWorkspaceMetadataAdapterFactory };