@salesforce/lds-adapters-industries-fieldset 1.114.3 → 1.181.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.
@@ -0,0 +1,348 @@
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, deepFreeze, StoreKeyMap } 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
+ const keyPrefix = 'fieldset';
52
+
53
+ const { isArray: ArrayIsArray } = Array;
54
+ const { stringify: JSONStringify } = JSON;
55
+ function createLink(ref) {
56
+ return {
57
+ __ref: serializeStructuredKey(ref),
58
+ };
59
+ }
60
+
61
+ function validate$1(obj, path = 'FieldSetOutputRepresentation') {
62
+ const v_error = (() => {
63
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
64
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
65
+ }
66
+ const obj_description = obj.description;
67
+ const path_description = path + '.description';
68
+ if (typeof obj_description !== 'string') {
69
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
70
+ }
71
+ const obj_fieldSetApiName = obj.fieldSetApiName;
72
+ const path_fieldSetApiName = path + '.fieldSetApiName';
73
+ if (typeof obj_fieldSetApiName !== 'string') {
74
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldSetApiName + '" (at "' + path_fieldSetApiName + '")');
75
+ }
76
+ const obj_fieldSetName = obj.fieldSetName;
77
+ const path_fieldSetName = path + '.fieldSetName';
78
+ if (typeof obj_fieldSetName !== 'string') {
79
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldSetName + '" (at "' + path_fieldSetName + '")');
80
+ }
81
+ })();
82
+ return v_error === undefined ? null : v_error;
83
+ }
84
+
85
+ const TTL = 60000;
86
+ const VERSION = "9331c49beaa527d8e4e448bb04fcd1e8";
87
+ function validate(obj, path = 'FieldSetsOutputRepresentation') {
88
+ const v_error = (() => {
89
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
90
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
91
+ }
92
+ const obj_fieldSets = obj.fieldSets;
93
+ const path_fieldSets = path + '.fieldSets';
94
+ if (!ArrayIsArray(obj_fieldSets)) {
95
+ return new TypeError('Expected "array" but received "' + typeof obj_fieldSets + '" (at "' + path_fieldSets + '")');
96
+ }
97
+ for (let i = 0; i < obj_fieldSets.length; i++) {
98
+ const obj_fieldSets_item = obj_fieldSets[i];
99
+ const path_fieldSets_item = path_fieldSets + '[' + i + ']';
100
+ const referencepath_fieldSets_itemValidationError = validate$1(obj_fieldSets_item, path_fieldSets_item);
101
+ if (referencepath_fieldSets_itemValidationError !== null) {
102
+ let message = 'Object doesn\'t match FieldSetOutputRepresentation (at "' + path_fieldSets_item + '")\n';
103
+ message += referencepath_fieldSets_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
104
+ return new TypeError(message);
105
+ }
106
+ }
107
+ const obj_objectName = obj.objectName;
108
+ const path_objectName = path + '.objectName';
109
+ if (typeof obj_objectName !== 'string') {
110
+ return new TypeError('Expected "string" but received "' + typeof obj_objectName + '" (at "' + path_objectName + '")');
111
+ }
112
+ })();
113
+ return v_error === undefined ? null : v_error;
114
+ }
115
+ const RepresentationType = 'FieldSetsOutputRepresentation';
116
+ function keyBuilder$2(luvio, config) {
117
+ return keyPrefix + '::' + RepresentationType + ':' + config.objectName;
118
+ }
119
+ function keyBuilderFromType(luvio, object) {
120
+ const keyParams = {
121
+ objectName: object.objectName
122
+ };
123
+ return keyBuilder$2(luvio, keyParams);
124
+ }
125
+ function normalize(input, existing, path, luvio, store, timestamp) {
126
+ return input;
127
+ }
128
+ const select$1 = function FieldSetsOutputRepresentationSelect() {
129
+ return {
130
+ kind: 'Fragment',
131
+ version: VERSION,
132
+ private: [],
133
+ opaque: true
134
+ };
135
+ };
136
+ function equals(existing, incoming) {
137
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
138
+ return false;
139
+ }
140
+ return true;
141
+ }
142
+ const ingest = function FieldSetsOutputRepresentationIngest(input, path, luvio, store, timestamp) {
143
+ if (process.env.NODE_ENV !== 'production') {
144
+ const validateError = validate(input);
145
+ if (validateError !== null) {
146
+ throw validateError;
147
+ }
148
+ }
149
+ const key = keyBuilderFromType(luvio, input);
150
+ const existingRecord = store.readEntry(key);
151
+ const ttlToUse = TTL;
152
+ let incomingRecord = normalize(input, store.readEntry(key), {
153
+ fullPath: key,
154
+ parent: path.parent,
155
+ propertyName: path.propertyName,
156
+ ttl: ttlToUse
157
+ });
158
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
159
+ luvio.storePublish(key, incomingRecord);
160
+ }
161
+ {
162
+ const storeMetadataParams = {
163
+ ttl: ttlToUse,
164
+ namespace: "fieldset",
165
+ version: VERSION,
166
+ representationName: RepresentationType,
167
+ };
168
+ luvio.publishStoreMetadata(key, storeMetadataParams);
169
+ }
170
+ return createLink(key);
171
+ };
172
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
173
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
174
+ const rootKey = keyBuilderFromType(luvio, input);
175
+ rootKeySet.set(rootKey, {
176
+ namespace: keyPrefix,
177
+ representationName: RepresentationType,
178
+ mergeable: false
179
+ });
180
+ }
181
+
182
+ function select(luvio, params) {
183
+ return select$1();
184
+ }
185
+ function keyBuilder$1(luvio, params) {
186
+ return keyBuilder$2(luvio, {
187
+ objectName: params.urlParams.objectName
188
+ });
189
+ }
190
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
191
+ getTypeCacheKeys(storeKeyMap, luvio, response);
192
+ }
193
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
194
+ const { body } = response;
195
+ const key = keyBuilder$1(luvio, resourceParams);
196
+ luvio.storeIngest(key, ingest, body);
197
+ const snapshot = luvio.storeLookup({
198
+ recordId: key,
199
+ node: select(),
200
+ variables: {},
201
+ }, snapshotRefresh);
202
+ if (process.env.NODE_ENV !== 'production') {
203
+ if (snapshot.state !== 'Fulfilled') {
204
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
205
+ }
206
+ }
207
+ deepFreeze(snapshot.data);
208
+ return snapshot;
209
+ }
210
+ function ingestError(luvio, params, error, snapshotRefresh) {
211
+ const key = keyBuilder$1(luvio, params);
212
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
213
+ const storeMetadataParams = {
214
+ ttl: TTL,
215
+ namespace: keyPrefix,
216
+ version: VERSION,
217
+ representationName: RepresentationType
218
+ };
219
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
220
+ return errorSnapshot;
221
+ }
222
+ function createResourceRequest(config) {
223
+ const headers = {};
224
+ return {
225
+ baseUri: '/services/data/v59.0',
226
+ basePath: '/connect/fieldset/' + config.urlParams.objectName + '',
227
+ method: 'get',
228
+ body: null,
229
+ urlParams: config.urlParams,
230
+ queryParams: {},
231
+ headers,
232
+ priority: 'normal',
233
+ };
234
+ }
235
+
236
+ const getFieldSets_ConfigPropertyNames = {
237
+ displayName: 'getFieldSets',
238
+ parameters: {
239
+ required: ['objectName'],
240
+ optional: []
241
+ }
242
+ };
243
+ function createResourceParams(config) {
244
+ const resourceParams = {
245
+ urlParams: {
246
+ objectName: config.objectName
247
+ }
248
+ };
249
+ return resourceParams;
250
+ }
251
+ function keyBuilder(luvio, config) {
252
+ const resourceParams = createResourceParams(config);
253
+ return keyBuilder$1(luvio, resourceParams);
254
+ }
255
+ function typeCheckConfig(untrustedConfig) {
256
+ const config = {};
257
+ const untrustedConfig_objectName = untrustedConfig.objectName;
258
+ if (typeof untrustedConfig_objectName === 'string') {
259
+ config.objectName = untrustedConfig_objectName;
260
+ }
261
+ return config;
262
+ }
263
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
264
+ if (!untrustedIsObject(untrustedConfig)) {
265
+ return null;
266
+ }
267
+ if (process.env.NODE_ENV !== 'production') {
268
+ validateConfig(untrustedConfig, configPropertyNames);
269
+ }
270
+ const config = typeCheckConfig(untrustedConfig);
271
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
272
+ return null;
273
+ }
274
+ return config;
275
+ }
276
+ function adapterFragment(luvio, config) {
277
+ createResourceParams(config);
278
+ return select();
279
+ }
280
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
281
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
282
+ config,
283
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
284
+ });
285
+ return luvio.storeBroadcast().then(() => snapshot);
286
+ }
287
+ function onFetchResponseError(luvio, config, resourceParams, response) {
288
+ const snapshot = ingestError(luvio, resourceParams, response, {
289
+ config,
290
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
291
+ });
292
+ return luvio.storeBroadcast().then(() => snapshot);
293
+ }
294
+ function buildNetworkSnapshot(luvio, config, options) {
295
+ const resourceParams = createResourceParams(config);
296
+ const request = createResourceRequest(resourceParams);
297
+ return luvio.dispatchResourceRequest(request, options)
298
+ .then((response) => {
299
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
300
+ const cache = new StoreKeyMap();
301
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
302
+ return cache;
303
+ });
304
+ }, (response) => {
305
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
306
+ });
307
+ }
308
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
309
+ const { luvio, config } = context;
310
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
311
+ const dispatchOptions = {
312
+ resourceRequestContext: {
313
+ requestCorrelator,
314
+ luvioRequestMethod: undefined,
315
+ },
316
+ eventObservers
317
+ };
318
+ if (networkPriority !== 'normal') {
319
+ dispatchOptions.overrides = {
320
+ priority: networkPriority
321
+ };
322
+ }
323
+ return buildNetworkSnapshot(luvio, config, dispatchOptions);
324
+ }
325
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
326
+ const { luvio, config } = context;
327
+ const selector = {
328
+ recordId: keyBuilder(luvio, config),
329
+ node: adapterFragment(luvio, config),
330
+ variables: {},
331
+ };
332
+ const cacheSnapshot = storeLookup(selector, {
333
+ config,
334
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
335
+ });
336
+ return cacheSnapshot;
337
+ }
338
+ const getFieldSetsAdapterFactory = (luvio) => function fieldset__getFieldSets(untrustedConfig, requestContext) {
339
+ const config = validateAdapterConfig(untrustedConfig, getFieldSets_ConfigPropertyNames);
340
+ // Invalid or incomplete config
341
+ if (config === null) {
342
+ return null;
343
+ }
344
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
345
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
346
+ };
347
+
348
+ export { getFieldSetsAdapterFactory };
@@ -0,0 +1,60 @@
1
+ import { Adapter as $64$luvio_engine_Adapter, Snapshot as $64$luvio_engine_Snapshot, UnfulfilledSnapshot as $64$luvio_engine_UnfulfilledSnapshot } from '@luvio/engine';
2
+ export declare const ObjectPrototypeHasOwnProperty: (v: PropertyKey) => boolean;
3
+ declare const ObjectKeys: {
4
+ (o: object): string[];
5
+ (o: {}): string[];
6
+ }, ObjectCreate: {
7
+ (o: object | null): any;
8
+ (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
9
+ };
10
+ export { ObjectCreate, ObjectKeys };
11
+ export declare const ArrayIsArray: (arg: any) => arg is any[];
12
+ export declare const ArrayPrototypePush: (...items: any[]) => number;
13
+ export interface AdapterValidationConfig {
14
+ displayName: string;
15
+ parameters: {
16
+ required: string[];
17
+ optional: string[];
18
+ unsupported?: string[];
19
+ };
20
+ }
21
+ /**
22
+ * Validates an adapter config is well-formed.
23
+ * @param config The config to validate.
24
+ * @param adapter The adapter validation configuration.
25
+ * @param oneOf The keys the config must contain at least one of.
26
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
27
+ */
28
+ export declare function validateConfig<T>(config: Untrusted<T>, adapter: AdapterValidationConfig, oneOf?: string[]): void;
29
+ export declare function untrustedIsObject<Base>(untrusted: unknown): untrusted is Untrusted<Base>;
30
+ export type UncoercedConfiguration<Base, Options extends {
31
+ [key in keyof Base]?: any;
32
+ }> = {
33
+ [Key in keyof Base]?: Base[Key] | Options[Key];
34
+ };
35
+ export type Untrusted<Base> = Partial<Base>;
36
+ export declare function areRequiredParametersPresent<T>(config: any, configPropertyNames: AdapterValidationConfig): config is T;
37
+ export declare function refreshable<C, D, R>(adapter: $64$luvio_engine_Adapter<C, D>, resolve: (config: unknown) => Promise<$64$luvio_engine_Snapshot<R>>): $64$luvio_engine_Adapter<C, D>;
38
+ export declare const SNAPSHOT_STATE_FULFILLED = "Fulfilled";
39
+ export declare const SNAPSHOT_STATE_UNFULFILLED = "Unfulfilled";
40
+ export declare const snapshotRefreshOptions: {
41
+ overrides: {
42
+ headers: {
43
+ 'Cache-Control': string;
44
+ };
45
+ };
46
+ };
47
+ /**
48
+ * A deterministic JSON stringify implementation. Heavily adapted from https://github.com/epoberezkin/fast-json-stable-stringify.
49
+ * This is needed because insertion order for JSON.stringify(object) affects output:
50
+ * JSON.stringify({a: 1, b: 2})
51
+ * "{"a":1,"b":2}"
52
+ * JSON.stringify({b: 2, a: 1})
53
+ * "{"b":2,"a":1}"
54
+ * @param data Data to be JSON-stringified.
55
+ * @returns JSON.stringified value with consistent ordering of keys.
56
+ */
57
+ export declare function stableJSONStringify(node: any): string | undefined;
58
+ export declare function getFetchResponseStatusText(status: number): string;
59
+ export declare function isUnfulfilledSnapshot<T, U>(snapshot: $64$luvio_engine_Snapshot<T, U>): snapshot is $64$luvio_engine_UnfulfilledSnapshot<T, U>;
60
+ export declare const keyPrefix = "fieldset";
@@ -0,0 +1,27 @@
1
+ import { AdapterValidationConfig as adapter$45$utils_AdapterValidationConfig, Untrusted as adapter$45$utils_Untrusted, UncoercedConfiguration as adapter$45$utils_UncoercedConfiguration } from './adapter-utils';
2
+ import { ResourceRequestConfig as resources_getConnectFieldsetByObjectName_ResourceRequestConfig } from '../resources/getConnectFieldsetByObjectName';
3
+ import { Luvio as $64$luvio_engine_Luvio, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, Fragment as $64$luvio_engine_Fragment, Snapshot as $64$luvio_engine_Snapshot, FetchResponse as $64$luvio_engine_FetchResponse, ErrorResponse as $64$luvio_engine_ErrorResponse, DispatchResourceRequestContext as $64$luvio_engine_DispatchResourceRequestContext, CoercedAdapterRequestContext as $64$luvio_engine_CoercedAdapterRequestContext, StoreLookup as $64$luvio_engine_StoreLookup, AdapterFactory as $64$luvio_engine_AdapterFactory } from '@luvio/engine';
4
+ import { FieldSetsOutputRepresentation as types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation, KeyParams as types_FieldSetsOutputRepresentation_KeyParams } from '../types/FieldSetsOutputRepresentation';
5
+ export declare const adapterName = "getFieldSets";
6
+ export declare const getFieldSets_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
7
+ export interface GetFieldSetsConfig {
8
+ objectName: string;
9
+ }
10
+ export declare function createResourceParams(config: GetFieldSetsConfig): resources_getConnectFieldsetByObjectName_ResourceRequestConfig;
11
+ export declare function keyBuilder(luvio: $64$luvio_engine_Luvio, config: GetFieldSetsConfig): string;
12
+ export declare function keyBuilder_StructuredKey(luvio: $64$luvio_engine_Luvio, config: GetFieldSetsConfig): $64$luvio_engine_NormalizedKeyMetadata;
13
+ export declare function typeCheckConfig(untrustedConfig: adapter$45$utils_Untrusted<GetFieldSetsConfig>): adapter$45$utils_Untrusted<GetFieldSetsConfig>;
14
+ export declare function validateAdapterConfig(untrustedConfig: unknown, configPropertyNames: adapter$45$utils_AdapterValidationConfig): GetFieldSetsConfig | null;
15
+ export declare function adapterFragment(luvio: $64$luvio_engine_Luvio, config: GetFieldSetsConfig): $64$luvio_engine_Fragment;
16
+ export declare function buildCachedSnapshot(luvio: $64$luvio_engine_Luvio, config: GetFieldSetsConfig): $64$luvio_engine_Snapshot<types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation, any>;
17
+ export declare function onFetchResponseSuccess(luvio: $64$luvio_engine_Luvio, config: GetFieldSetsConfig, resourceParams: resources_getConnectFieldsetByObjectName_ResourceRequestConfig, response: $64$luvio_engine_FetchResponse<types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation>): Promise<import("@luvio/engine").FulfilledSnapshot<types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation, {}> | import("@luvio/engine").StaleSnapshot<types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation, {}> | import("@luvio/engine").PendingSnapshot<types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation, any>>;
18
+ export declare function onFetchResponseError(luvio: $64$luvio_engine_Luvio, config: GetFieldSetsConfig, resourceParams: resources_getConnectFieldsetByObjectName_ResourceRequestConfig, response: $64$luvio_engine_ErrorResponse): Promise<import("@luvio/engine").ErrorSnapshot>;
19
+ export declare function buildNetworkSnapshot(luvio: $64$luvio_engine_Luvio, config: GetFieldSetsConfig, options?: $64$luvio_engine_DispatchResourceRequestContext): Promise<$64$luvio_engine_Snapshot<types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation, any>>;
20
+ export type BuildSnapshotContext = {
21
+ luvio: $64$luvio_engine_Luvio;
22
+ config: GetFieldSetsConfig;
23
+ };
24
+ export declare function buildNetworkSnapshotCachePolicy(context: BuildSnapshotContext, coercedAdapterRequestContext: $64$luvio_engine_CoercedAdapterRequestContext): Promise<$64$luvio_engine_Snapshot<types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation, any>>;
25
+ export declare function buildCachedSnapshotCachePolicy(context: BuildSnapshotContext, storeLookup: $64$luvio_engine_StoreLookup<types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation>): $64$luvio_engine_Snapshot<types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation, any>;
26
+ export declare const getFieldSetsAdapterFactory: $64$luvio_engine_AdapterFactory<GetFieldSetsConfig, types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation>;
27
+ export declare const notifyChangeFactory: (luvio: $64$luvio_engine_Luvio, options?: $64$luvio_engine_DispatchResourceRequestContext) => (configs: adapter$45$utils_UncoercedConfiguration<types_FieldSetsOutputRepresentation_KeyParams, any>[]) => void;
@@ -0,0 +1 @@
1
+ export { getFieldSetsAdapterFactory } from '../adapters/getFieldSets';
@@ -0,0 +1,4 @@
1
+ declare let getFieldSets: any;
2
+ declare let getFieldSetsNotifyChange: any;
3
+ declare let getFieldSets_imperative: any;
4
+ export { getFieldSets, getFieldSetsNotifyChange, getFieldSets_imperative };
@@ -0,0 +1,16 @@
1
+ import { Luvio as $64$luvio_engine_Luvio, Fragment as $64$luvio_engine_Fragment, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, FetchResponse as $64$luvio_engine_FetchResponse, SnapshotRefresh as $64$luvio_engine_SnapshotRefresh, FulfilledSnapshot as $64$luvio_engine_FulfilledSnapshot, StaleSnapshot as $64$luvio_engine_StaleSnapshot, PendingSnapshot as $64$luvio_engine_PendingSnapshot, ErrorResponse as $64$luvio_engine_ErrorResponse, ErrorSnapshot as $64$luvio_engine_ErrorSnapshot, ResourceRequest as $64$luvio_engine_ResourceRequest } from '@luvio/engine';
2
+ import { FieldSetsOutputRepresentation as types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation } from '../types/FieldSetsOutputRepresentation';
3
+ export interface ResourceRequestConfig {
4
+ urlParams: {
5
+ objectName: string;
6
+ };
7
+ }
8
+ export declare function select(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig): $64$luvio_engine_Fragment;
9
+ export declare function keyBuilder(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig): string;
10
+ export declare function keyBuilder_StructuredKey(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig): $64$luvio_engine_NormalizedKeyMetadata;
11
+ export declare function getResponseCacheKeys(storeKeyMap: any, luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation): void;
12
+ export declare function ingestSuccess(luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: $64$luvio_engine_FetchResponse<types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation>, snapshotRefresh?: $64$luvio_engine_SnapshotRefresh<types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation>): $64$luvio_engine_FulfilledSnapshot<types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation, {}> | $64$luvio_engine_StaleSnapshot<types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation, {}> | $64$luvio_engine_PendingSnapshot<types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation, any>;
13
+ export declare function ingestError(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig, error: $64$luvio_engine_ErrorResponse, snapshotRefresh?: $64$luvio_engine_SnapshotRefresh<types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation>): $64$luvio_engine_ErrorSnapshot;
14
+ export declare function createResourceRequest(config: ResourceRequestConfig): $64$luvio_engine_ResourceRequest;
15
+ export default createResourceRequest;
16
+ export declare function createResourceRequestFromRepresentation(representation: types_FieldSetsOutputRepresentation_FieldSetsOutputRepresentation): $64$luvio_engine_ResourceRequest;
@@ -0,0 +1,34 @@
1
+ import { IngestPath as $64$luvio_engine_IngestPath, Luvio as $64$luvio_engine_Luvio, Store as $64$luvio_engine_Store, FragmentSelection as $64$luvio_engine_FragmentSelection, ResourceIngest as $64$luvio_engine_ResourceIngest, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
2
+ export declare const VERSION = "e28eb9777b6150635071513bda495c06";
3
+ export declare function validate(obj: any, path?: string): TypeError | null;
4
+ export declare const RepresentationType: string;
5
+ export declare function normalize(input: FieldSetOutputRepresentation, existing: FieldSetOutputRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): FieldSetOutputRepresentationNormalized;
6
+ export declare const select: () => $64$luvio_engine_FragmentSelection;
7
+ export declare function equals(existing: FieldSetOutputRepresentationNormalized, incoming: FieldSetOutputRepresentationNormalized): boolean;
8
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
9
+ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableStoreKeyMetadataMap, luvio: $64$luvio_engine_Luvio, input: FieldSetOutputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
10
+ /**
11
+ * Field Set Output Representation
12
+ *
13
+ * Keys:
14
+ * (none)
15
+ */
16
+ export interface FieldSetOutputRepresentationNormalized {
17
+ /** field set description */
18
+ description: string;
19
+ /** field set api name */
20
+ fieldSetApiName: string;
21
+ /** field set name */
22
+ fieldSetName: string;
23
+ }
24
+ /**
25
+ * Field Set Output Representation
26
+ *
27
+ * Keys:
28
+ * (none)
29
+ */
30
+ export interface FieldSetOutputRepresentation {
31
+ description: string;
32
+ fieldSetApiName: string;
33
+ fieldSetName: string;
34
+ }
@@ -0,0 +1,42 @@
1
+ import { FieldSetOutputRepresentation as FieldSetOutputRepresentation_FieldSetOutputRepresentation } from './FieldSetOutputRepresentation';
2
+ import { KeyMetadata as $64$luvio_engine_KeyMetadata, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, Luvio as $64$luvio_engine_Luvio, IngestPath as $64$luvio_engine_IngestPath, Store as $64$luvio_engine_Store, BaseFragment as $64$luvio_engine_BaseFragment, ResourceIngest as $64$luvio_engine_ResourceIngest, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap } from '@luvio/engine';
3
+ export declare const TTL = 60000;
4
+ export declare const VERSION = "9331c49beaa527d8e4e448bb04fcd1e8";
5
+ export declare function validate(obj: any, path?: string): TypeError | null;
6
+ export declare const RepresentationType: string;
7
+ export interface KeyParams extends $64$luvio_engine_KeyMetadata {
8
+ objectName: string;
9
+ }
10
+ export type FieldSetsOutputRepresentationNormalizedKeyMetadata = KeyParams & $64$luvio_engine_NormalizedKeyMetadata;
11
+ export type PartialFieldSetsOutputRepresentationNormalizedKeyMetadata = Partial<KeyParams> & $64$luvio_engine_NormalizedKeyMetadata;
12
+ export declare function keyBuilder(luvio: $64$luvio_engine_Luvio, config: KeyParams): string;
13
+ export declare function keyBuilder_StructuredKey(luvio: $64$luvio_engine_Luvio, config: KeyParams): FieldSetsOutputRepresentationNormalizedKeyMetadata;
14
+ export declare function keyBuilderFromType(luvio: $64$luvio_engine_Luvio, object: FieldSetsOutputRepresentation): string;
15
+ export declare function keyBuilderFromType_StructuredKey(luvio: $64$luvio_engine_Luvio, object: FieldSetsOutputRepresentation): $64$luvio_engine_NormalizedKeyMetadata;
16
+ export declare function normalize(input: FieldSetsOutputRepresentation, existing: FieldSetsOutputRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): FieldSetsOutputRepresentationNormalized;
17
+ export declare const select: () => $64$luvio_engine_BaseFragment;
18
+ export declare function equals(existing: FieldSetsOutputRepresentationNormalized, incoming: FieldSetsOutputRepresentationNormalized): boolean;
19
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
20
+ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableStoreKeyMetadataMap, luvio: $64$luvio_engine_Luvio, input: FieldSetsOutputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
21
+ /**
22
+ * Field Sets Output Representation
23
+ *
24
+ * Keys:
25
+ * objectName (string): objectName
26
+ */
27
+ export interface FieldSetsOutputRepresentationNormalized {
28
+ /** list of field sets of an entity */
29
+ fieldSets: Array<FieldSetOutputRepresentation_FieldSetOutputRepresentation>;
30
+ /** field set object name */
31
+ objectName: string;
32
+ }
33
+ /**
34
+ * Field Sets Output Representation
35
+ *
36
+ * Keys:
37
+ * objectName (string): objectName
38
+ */
39
+ export interface FieldSetsOutputRepresentation {
40
+ fieldSets: Array<FieldSetOutputRepresentation_FieldSetOutputRepresentation>;
41
+ objectName: string;
42
+ }
@@ -0,0 +1,32 @@
1
+ import { NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
2
+ export declare const ObjectKeys: {
3
+ (o: object): string[];
4
+ (o: {}): string[];
5
+ }, ObjectCreate: {
6
+ (o: object | null): any;
7
+ (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
8
+ }, ObjectAssign: {
9
+ <T extends {}, U>(target: T, source: U): T & U;
10
+ <T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
11
+ <T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
12
+ (target: object, ...sources: any[]): any;
13
+ };
14
+ export declare const ArrayIsArray: (arg: any) => arg is any[];
15
+ export declare const JSONStringify: {
16
+ (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
17
+ (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string;
18
+ };
19
+ type AllowedPrimitives = boolean | string | number | Date | null;
20
+ type Value<T> = T extends AllowedPrimitives ? T : RecursivePartial<T>;
21
+ export type RecursivePartial<T> = null | {
22
+ [P in keyof T]?: T[P] extends Array<infer U> ? Array<Value<U>> | null : Value<T[P]> | null;
23
+ };
24
+ export declare function equalsArray<U, V extends U[]>(a: V, b: V, equalsItem: (itemA: U, itemB: U) => boolean | void): boolean;
25
+ export declare function equalsObject<U, V extends {
26
+ [key: string]: U;
27
+ }>(a: V, b: V, equalsProp: (propA: U, propB: U) => boolean | void): boolean;
28
+ export declare function createLink(ref: string | $64$luvio_engine_NormalizedKeyMetadata): {
29
+ __ref: string;
30
+ };
31
+ export declare function assignMetadataLink(entry: any, metadataKey: string | $64$luvio_engine_NormalizedKeyMetadata): void;
32
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-industries-fieldset",
3
- "version": "1.114.3",
3
+ "version": "1.181.0",
4
4
  "description": "Field Set",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "dist/es/es2018/industries-fieldset.js",
@@ -0,0 +1 @@
1
+ export * from '../dist/es/es2018/types/src/generated/artifacts/sfdc';
package/sfdc/index.js ADDED
@@ -0,0 +1,424 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ /* *******************************************************************************************
8
+ * ATTENTION!
9
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
10
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
11
+ * Any changes made to this file in p4 will be automatically overwritten.
12
+ * *******************************************************************************************
13
+ */
14
+ /* proxy-compat-disable */
15
+ import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
16
+ import { withDefaultLuvio } from 'force/ldsEngine';
17
+ import { serializeStructuredKey, deepFreeze, StoreKeyMap } from 'force/luvioEngine';
18
+
19
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
+ const { keys: ObjectKeys, create: ObjectCreate } = Object;
21
+ const { isArray: ArrayIsArray$1 } = Array;
22
+ /**
23
+ * Validates an adapter config is well-formed.
24
+ * @param config The config to validate.
25
+ * @param adapter The adapter validation configuration.
26
+ * @param oneOf The keys the config must contain at least one of.
27
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
28
+ */
29
+ function validateConfig(config, adapter, oneOf) {
30
+ const { displayName } = adapter;
31
+ const { required, optional, unsupported } = adapter.parameters;
32
+ if (config === undefined ||
33
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
34
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
35
+ }
36
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
37
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
38
+ }
39
+ if (unsupported !== undefined &&
40
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
41
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
42
+ }
43
+ const supported = required.concat(optional);
44
+ if (ObjectKeys(config).some(key => !supported.includes(key))) {
45
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
46
+ }
47
+ }
48
+ function untrustedIsObject(untrusted) {
49
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
50
+ }
51
+ function areRequiredParametersPresent(config, configPropertyNames) {
52
+ return configPropertyNames.parameters.required.every(req => req in config);
53
+ }
54
+ const snapshotRefreshOptions = {
55
+ overrides: {
56
+ headers: {
57
+ 'Cache-Control': 'no-cache',
58
+ },
59
+ }
60
+ };
61
+ const keyPrefix = 'fieldset';
62
+
63
+ const { isArray: ArrayIsArray } = Array;
64
+ const { stringify: JSONStringify } = JSON;
65
+ function createLink(ref) {
66
+ return {
67
+ __ref: serializeStructuredKey(ref),
68
+ };
69
+ }
70
+
71
+ function validate$1(obj, path = 'FieldSetOutputRepresentation') {
72
+ const v_error = (() => {
73
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
74
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
75
+ }
76
+ const obj_description = obj.description;
77
+ const path_description = path + '.description';
78
+ if (typeof obj_description !== 'string') {
79
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
80
+ }
81
+ const obj_fieldSetApiName = obj.fieldSetApiName;
82
+ const path_fieldSetApiName = path + '.fieldSetApiName';
83
+ if (typeof obj_fieldSetApiName !== 'string') {
84
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldSetApiName + '" (at "' + path_fieldSetApiName + '")');
85
+ }
86
+ const obj_fieldSetName = obj.fieldSetName;
87
+ const path_fieldSetName = path + '.fieldSetName';
88
+ if (typeof obj_fieldSetName !== 'string') {
89
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldSetName + '" (at "' + path_fieldSetName + '")');
90
+ }
91
+ })();
92
+ return v_error === undefined ? null : v_error;
93
+ }
94
+
95
+ const TTL = 60000;
96
+ const VERSION = "9331c49beaa527d8e4e448bb04fcd1e8";
97
+ function validate(obj, path = 'FieldSetsOutputRepresentation') {
98
+ const v_error = (() => {
99
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
100
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
101
+ }
102
+ const obj_fieldSets = obj.fieldSets;
103
+ const path_fieldSets = path + '.fieldSets';
104
+ if (!ArrayIsArray(obj_fieldSets)) {
105
+ return new TypeError('Expected "array" but received "' + typeof obj_fieldSets + '" (at "' + path_fieldSets + '")');
106
+ }
107
+ for (let i = 0; i < obj_fieldSets.length; i++) {
108
+ const obj_fieldSets_item = obj_fieldSets[i];
109
+ const path_fieldSets_item = path_fieldSets + '[' + i + ']';
110
+ const referencepath_fieldSets_itemValidationError = validate$1(obj_fieldSets_item, path_fieldSets_item);
111
+ if (referencepath_fieldSets_itemValidationError !== null) {
112
+ let message = 'Object doesn\'t match FieldSetOutputRepresentation (at "' + path_fieldSets_item + '")\n';
113
+ message += referencepath_fieldSets_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
114
+ return new TypeError(message);
115
+ }
116
+ }
117
+ const obj_objectName = obj.objectName;
118
+ const path_objectName = path + '.objectName';
119
+ if (typeof obj_objectName !== 'string') {
120
+ return new TypeError('Expected "string" but received "' + typeof obj_objectName + '" (at "' + path_objectName + '")');
121
+ }
122
+ })();
123
+ return v_error === undefined ? null : v_error;
124
+ }
125
+ const RepresentationType = 'FieldSetsOutputRepresentation';
126
+ function keyBuilder$2(luvio, config) {
127
+ return keyPrefix + '::' + RepresentationType + ':' + config.objectName;
128
+ }
129
+ function keyBuilderFromType(luvio, object) {
130
+ const keyParams = {
131
+ objectName: object.objectName
132
+ };
133
+ return keyBuilder$2(luvio, keyParams);
134
+ }
135
+ function normalize(input, existing, path, luvio, store, timestamp) {
136
+ return input;
137
+ }
138
+ const select$1 = function FieldSetsOutputRepresentationSelect() {
139
+ return {
140
+ kind: 'Fragment',
141
+ version: VERSION,
142
+ private: [],
143
+ opaque: true
144
+ };
145
+ };
146
+ function equals(existing, incoming) {
147
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
148
+ return false;
149
+ }
150
+ return true;
151
+ }
152
+ const ingest = function FieldSetsOutputRepresentationIngest(input, path, luvio, store, timestamp) {
153
+ if (process.env.NODE_ENV !== 'production') {
154
+ const validateError = validate(input);
155
+ if (validateError !== null) {
156
+ throw validateError;
157
+ }
158
+ }
159
+ const key = keyBuilderFromType(luvio, input);
160
+ const existingRecord = store.readEntry(key);
161
+ const ttlToUse = TTL;
162
+ let incomingRecord = normalize(input, store.readEntry(key), {
163
+ fullPath: key,
164
+ parent: path.parent,
165
+ propertyName: path.propertyName,
166
+ ttl: ttlToUse
167
+ });
168
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
169
+ luvio.storePublish(key, incomingRecord);
170
+ }
171
+ {
172
+ const storeMetadataParams = {
173
+ ttl: ttlToUse,
174
+ namespace: "fieldset",
175
+ version: VERSION,
176
+ representationName: RepresentationType,
177
+ };
178
+ luvio.publishStoreMetadata(key, storeMetadataParams);
179
+ }
180
+ return createLink(key);
181
+ };
182
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
183
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
184
+ const rootKey = keyBuilderFromType(luvio, input);
185
+ rootKeySet.set(rootKey, {
186
+ namespace: keyPrefix,
187
+ representationName: RepresentationType,
188
+ mergeable: false
189
+ });
190
+ }
191
+
192
+ function select(luvio, params) {
193
+ return select$1();
194
+ }
195
+ function keyBuilder$1(luvio, params) {
196
+ return keyBuilder$2(luvio, {
197
+ objectName: params.urlParams.objectName
198
+ });
199
+ }
200
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
201
+ getTypeCacheKeys(storeKeyMap, luvio, response);
202
+ }
203
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
204
+ const { body } = response;
205
+ const key = keyBuilder$1(luvio, resourceParams);
206
+ luvio.storeIngest(key, ingest, body);
207
+ const snapshot = luvio.storeLookup({
208
+ recordId: key,
209
+ node: select(),
210
+ variables: {},
211
+ }, snapshotRefresh);
212
+ if (process.env.NODE_ENV !== 'production') {
213
+ if (snapshot.state !== 'Fulfilled') {
214
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
215
+ }
216
+ }
217
+ deepFreeze(snapshot.data);
218
+ return snapshot;
219
+ }
220
+ function ingestError(luvio, params, error, snapshotRefresh) {
221
+ const key = keyBuilder$1(luvio, params);
222
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
223
+ const storeMetadataParams = {
224
+ ttl: TTL,
225
+ namespace: keyPrefix,
226
+ version: VERSION,
227
+ representationName: RepresentationType
228
+ };
229
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
230
+ return errorSnapshot;
231
+ }
232
+ function createResourceRequest(config) {
233
+ const headers = {};
234
+ return {
235
+ baseUri: '/services/data/v59.0',
236
+ basePath: '/connect/fieldset/' + config.urlParams.objectName + '',
237
+ method: 'get',
238
+ body: null,
239
+ urlParams: config.urlParams,
240
+ queryParams: {},
241
+ headers,
242
+ priority: 'normal',
243
+ };
244
+ }
245
+ function createResourceRequestFromRepresentation(representation) {
246
+ const config = {
247
+ urlParams: {},
248
+ };
249
+ config.urlParams.objectName = representation.objectName;
250
+ return createResourceRequest(config);
251
+ }
252
+
253
+ const getFieldSets_ConfigPropertyNames = {
254
+ displayName: 'getFieldSets',
255
+ parameters: {
256
+ required: ['objectName'],
257
+ optional: []
258
+ }
259
+ };
260
+ function createResourceParams(config) {
261
+ const resourceParams = {
262
+ urlParams: {
263
+ objectName: config.objectName
264
+ }
265
+ };
266
+ return resourceParams;
267
+ }
268
+ function keyBuilder(luvio, config) {
269
+ const resourceParams = createResourceParams(config);
270
+ return keyBuilder$1(luvio, resourceParams);
271
+ }
272
+ function typeCheckConfig(untrustedConfig) {
273
+ const config = {};
274
+ const untrustedConfig_objectName = untrustedConfig.objectName;
275
+ if (typeof untrustedConfig_objectName === 'string') {
276
+ config.objectName = untrustedConfig_objectName;
277
+ }
278
+ return config;
279
+ }
280
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
281
+ if (!untrustedIsObject(untrustedConfig)) {
282
+ return null;
283
+ }
284
+ if (process.env.NODE_ENV !== 'production') {
285
+ validateConfig(untrustedConfig, configPropertyNames);
286
+ }
287
+ const config = typeCheckConfig(untrustedConfig);
288
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
289
+ return null;
290
+ }
291
+ return config;
292
+ }
293
+ function adapterFragment(luvio, config) {
294
+ createResourceParams(config);
295
+ return select();
296
+ }
297
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
298
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
299
+ config,
300
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
301
+ });
302
+ return luvio.storeBroadcast().then(() => snapshot);
303
+ }
304
+ function onFetchResponseError(luvio, config, resourceParams, response) {
305
+ const snapshot = ingestError(luvio, resourceParams, response, {
306
+ config,
307
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
308
+ });
309
+ return luvio.storeBroadcast().then(() => snapshot);
310
+ }
311
+ function buildNetworkSnapshot(luvio, config, options) {
312
+ const resourceParams = createResourceParams(config);
313
+ const request = createResourceRequest(resourceParams);
314
+ return luvio.dispatchResourceRequest(request, options)
315
+ .then((response) => {
316
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
317
+ const cache = new StoreKeyMap();
318
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
319
+ return cache;
320
+ });
321
+ }, (response) => {
322
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
323
+ });
324
+ }
325
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
326
+ const { luvio, config } = context;
327
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
328
+ const dispatchOptions = {
329
+ resourceRequestContext: {
330
+ requestCorrelator,
331
+ luvioRequestMethod: undefined,
332
+ },
333
+ eventObservers
334
+ };
335
+ if (networkPriority !== 'normal') {
336
+ dispatchOptions.overrides = {
337
+ priority: networkPriority
338
+ };
339
+ }
340
+ return buildNetworkSnapshot(luvio, config, dispatchOptions);
341
+ }
342
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
343
+ const { luvio, config } = context;
344
+ const selector = {
345
+ recordId: keyBuilder(luvio, config),
346
+ node: adapterFragment(luvio, config),
347
+ variables: {},
348
+ };
349
+ const cacheSnapshot = storeLookup(selector, {
350
+ config,
351
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
352
+ });
353
+ return cacheSnapshot;
354
+ }
355
+ const getFieldSetsAdapterFactory = (luvio) => function fieldset__getFieldSets(untrustedConfig, requestContext) {
356
+ const config = validateAdapterConfig(untrustedConfig, getFieldSets_ConfigPropertyNames);
357
+ // Invalid or incomplete config
358
+ if (config === null) {
359
+ return null;
360
+ }
361
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
362
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
363
+ };
364
+ const notifyChangeFactory = (luvio, options) => {
365
+ return function getConnectFieldsetByObjectNameNotifyChange(configs) {
366
+ const keys = configs.map(c => keyBuilder$2(luvio, c));
367
+ luvio.getNotifyChangeStoreEntries(keys).then(entries => {
368
+ for (let i = 0, len = entries.length; i < len; i++) {
369
+ const { key, record: val } = entries[i];
370
+ const refreshRequest = createResourceRequestFromRepresentation(val);
371
+ luvio.dispatchResourceRequest(refreshRequest, options)
372
+ .then((response) => {
373
+ return luvio.handleSuccessResponse(() => {
374
+ const { body } = response;
375
+ luvio.storeIngest(key, ingest, body);
376
+ return luvio.storeBroadcast();
377
+ }, () => {
378
+ const cache = new StoreKeyMap();
379
+ getTypeCacheKeys(cache, luvio, response.body);
380
+ return cache;
381
+ });
382
+ }, (error) => {
383
+ return luvio.handleErrorResponse(() => {
384
+ const errorSnapshot = luvio.errorSnapshot(error);
385
+ luvio.storeIngestError(key, errorSnapshot, {
386
+ ttl: TTL,
387
+ namespace: keyPrefix,
388
+ version: VERSION,
389
+ representationName: RepresentationType
390
+ });
391
+ return luvio.storeBroadcast().then(() => errorSnapshot);
392
+ });
393
+ });
394
+ }
395
+ });
396
+ };
397
+ };
398
+
399
+ let getFieldSets;
400
+ let getFieldSetsNotifyChange;
401
+ // Imperative GET Adapters
402
+ let getFieldSets_imperative;
403
+ // Adapter Metadata
404
+ const getFieldSetsMetadata = { apiFamily: 'fieldset', name: 'getFieldSets', ttl: 60000 };
405
+ function bindExportsTo(luvio) {
406
+ // LDS Adapters
407
+ const getFieldSets_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getFieldSets', getFieldSetsAdapterFactory), getFieldSetsMetadata);
408
+ return {
409
+ getFieldSets: createWireAdapterConstructor(luvio, getFieldSets_ldsAdapter, getFieldSetsMetadata),
410
+ getFieldSetsNotifyChange: createLDSAdapter(luvio, 'getFieldSetsNotifyChange', notifyChangeFactory),
411
+ // Imperative GET Adapters
412
+ getFieldSets_imperative: createImperativeAdapter(luvio, getFieldSets_ldsAdapter, getFieldSetsMetadata)
413
+ };
414
+ }
415
+ withDefaultLuvio((luvio) => {
416
+ ({
417
+ getFieldSets,
418
+ getFieldSetsNotifyChange,
419
+ getFieldSets_imperative
420
+ } = bindExportsTo(luvio));
421
+ });
422
+
423
+ export { getFieldSets, getFieldSetsNotifyChange, getFieldSets_imperative };
424
+ // version: 1.181.0-fd5b8e93e