@salesforce/lds-adapters-marketing-prospect 0.1.0-dev1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/marketing-prospect.js +1027 -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/getConversionEntries.d.ts +32 -0
  5. package/dist/es/es2018/types/src/generated/adapters/getPostConversionEntries.d.ts +43 -0
  6. package/dist/es/es2018/types/src/generated/adapters/getProspectFieldMappings.d.ts +26 -0
  7. package/dist/es/es2018/types/src/generated/adapters/saveProspectFieldMappings.d.ts +16 -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 +8 -0
  10. package/dist/es/es2018/types/src/generated/resources/getConnectProspectConversion.d.ts +20 -0
  11. package/dist/es/es2018/types/src/generated/resources/getConnectProspectFieldMapping.d.ts +12 -0
  12. package/dist/es/es2018/types/src/generated/resources/postConnectProspectConversion.d.ts +31 -0
  13. package/dist/es/es2018/types/src/generated/resources/postConnectProspectFieldMapping.d.ts +13 -0
  14. package/dist/es/es2018/types/src/generated/types/ConversionEntriesRepresentation.d.ts +33 -0
  15. package/dist/es/es2018/types/src/generated/types/ConversionEntryRepresentation.d.ts +59 -0
  16. package/dist/es/es2018/types/src/generated/types/ConversionPostInputRepresentation.d.ts +86 -0
  17. package/dist/es/es2018/types/src/generated/types/FieldInfo.d.ts +38 -0
  18. package/dist/es/es2018/types/src/generated/types/FieldMapping.d.ts +32 -0
  19. package/dist/es/es2018/types/src/generated/types/FieldMappingInput.d.ts +32 -0
  20. package/dist/es/es2018/types/src/generated/types/InputObjectFieldMapping.d.ts +33 -0
  21. package/dist/es/es2018/types/src/generated/types/OutputObjectFieldMapping.d.ts +62 -0
  22. package/dist/es/es2018/types/src/generated/types/ProspectFieldMappingInputRepresentation.d.ts +30 -0
  23. package/dist/es/es2018/types/src/generated/types/ProspectFieldMappingOutputGetRepresentation.d.ts +39 -0
  24. package/dist/es/es2018/types/src/generated/types/ProspectFieldMappingOutputPostRepresentation.d.ts +44 -0
  25. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  26. package/package.json +66 -0
  27. package/sfdc/index.d.ts +1 -0
  28. package/sfdc/index.js +1096 -0
  29. package/src/raml/api.raml +309 -0
  30. package/src/raml/luvio.raml +62 -0
package/sfdc/index.js ADDED
@@ -0,0 +1,1096 @@
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, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$3, typeCheckConfig as typeCheckConfig$4, StoreKeyMap, createResourceParams as createResourceParams$4 } 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
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
62
+ return {
63
+ name,
64
+ required,
65
+ resourceType,
66
+ typeCheckShape,
67
+ isArrayShape,
68
+ coerceFn,
69
+ };
70
+ }
71
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
72
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
73
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
74
+ return {
75
+ displayName,
76
+ parameters: {
77
+ required,
78
+ optional,
79
+ }
80
+ };
81
+ }
82
+ const keyPrefix = 'Prospect';
83
+
84
+ const { isArray: ArrayIsArray } = Array;
85
+ const { stringify: JSONStringify } = JSON;
86
+ function createLink(ref) {
87
+ return {
88
+ __ref: serializeStructuredKey(ref),
89
+ };
90
+ }
91
+
92
+ function validate$6(obj, path = 'ConversionEntryRepresentation') {
93
+ const v_error = (() => {
94
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
95
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
96
+ }
97
+ const obj_accountId = obj.accountId;
98
+ const path_accountId = path + '.accountId';
99
+ if (typeof obj_accountId !== 'string') {
100
+ return new TypeError('Expected "string" but received "' + typeof obj_accountId + '" (at "' + path_accountId + '")');
101
+ }
102
+ const obj_apiErrorCode = obj.apiErrorCode;
103
+ const path_apiErrorCode = path + '.apiErrorCode';
104
+ if (typeof obj_apiErrorCode !== 'string') {
105
+ return new TypeError('Expected "string" but received "' + typeof obj_apiErrorCode + '" (at "' + path_apiErrorCode + '")');
106
+ }
107
+ const obj_contactId = obj.contactId;
108
+ const path_contactId = path + '.contactId';
109
+ if (typeof obj_contactId !== 'string') {
110
+ return new TypeError('Expected "string" but received "' + typeof obj_contactId + '" (at "' + path_contactId + '")');
111
+ }
112
+ const obj_exceptionMsg = obj.exceptionMsg;
113
+ const path_exceptionMsg = path + '.exceptionMsg';
114
+ if (typeof obj_exceptionMsg !== 'string') {
115
+ return new TypeError('Expected "string" but received "' + typeof obj_exceptionMsg + '" (at "' + path_exceptionMsg + '")');
116
+ }
117
+ const obj_httpStatusCode = obj.httpStatusCode;
118
+ const path_httpStatusCode = path + '.httpStatusCode';
119
+ if (typeof obj_httpStatusCode !== 'string') {
120
+ return new TypeError('Expected "string" but received "' + typeof obj_httpStatusCode + '" (at "' + path_httpStatusCode + '")');
121
+ }
122
+ const obj_leadId = obj.leadId;
123
+ const path_leadId = path + '.leadId';
124
+ if (typeof obj_leadId !== 'string') {
125
+ return new TypeError('Expected "string" but received "' + typeof obj_leadId + '" (at "' + path_leadId + '")');
126
+ }
127
+ const obj_opportunityId = obj.opportunityId;
128
+ const path_opportunityId = path + '.opportunityId';
129
+ if (typeof obj_opportunityId !== 'string') {
130
+ return new TypeError('Expected "string" but received "' + typeof obj_opportunityId + '" (at "' + path_opportunityId + '")');
131
+ }
132
+ const obj_prospectId = obj.prospectId;
133
+ const path_prospectId = path + '.prospectId';
134
+ if (typeof obj_prospectId !== 'string') {
135
+ return new TypeError('Expected "string" but received "' + typeof obj_prospectId + '" (at "' + path_prospectId + '")');
136
+ }
137
+ })();
138
+ return v_error === undefined ? null : v_error;
139
+ }
140
+
141
+ const TTL$2 = 60000;
142
+ const VERSION$2 = "407aa680ebc397cf36cc1727ac369a87";
143
+ function validate$5(obj, path = 'ConversionEntriesRepresentation') {
144
+ const v_error = (() => {
145
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
146
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
147
+ }
148
+ const obj_conversionEntries = obj.conversionEntries;
149
+ const path_conversionEntries = path + '.conversionEntries';
150
+ if (!ArrayIsArray(obj_conversionEntries)) {
151
+ return new TypeError('Expected "array" but received "' + typeof obj_conversionEntries + '" (at "' + path_conversionEntries + '")');
152
+ }
153
+ for (let i = 0; i < obj_conversionEntries.length; i++) {
154
+ const obj_conversionEntries_item = obj_conversionEntries[i];
155
+ const path_conversionEntries_item = path_conversionEntries + '[' + i + ']';
156
+ const referencepath_conversionEntries_itemValidationError = validate$6(obj_conversionEntries_item, path_conversionEntries_item);
157
+ if (referencepath_conversionEntries_itemValidationError !== null) {
158
+ let message = 'Object doesn\'t match ConversionEntryRepresentation (at "' + path_conversionEntries_item + '")\n';
159
+ message += referencepath_conversionEntries_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
160
+ return new TypeError(message);
161
+ }
162
+ }
163
+ if (obj.postConversionEntries !== undefined) {
164
+ const obj_postConversionEntries = obj.postConversionEntries;
165
+ const path_postConversionEntries = path + '.postConversionEntries';
166
+ if (!ArrayIsArray(obj_postConversionEntries)) {
167
+ return new TypeError('Expected "array" but received "' + typeof obj_postConversionEntries + '" (at "' + path_postConversionEntries + '")');
168
+ }
169
+ for (let i = 0; i < obj_postConversionEntries.length; i++) {
170
+ const obj_postConversionEntries_item = obj_postConversionEntries[i];
171
+ const path_postConversionEntries_item = path_postConversionEntries + '[' + i + ']';
172
+ const referencepath_postConversionEntries_itemValidationError = validate$6(obj_postConversionEntries_item, path_postConversionEntries_item);
173
+ if (referencepath_postConversionEntries_itemValidationError !== null) {
174
+ let message = 'Object doesn\'t match ConversionEntryRepresentation (at "' + path_postConversionEntries_item + '")\n';
175
+ message += referencepath_postConversionEntries_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
176
+ return new TypeError(message);
177
+ }
178
+ }
179
+ }
180
+ })();
181
+ return v_error === undefined ? null : v_error;
182
+ }
183
+ const RepresentationType$2 = 'ConversionEntriesRepresentation';
184
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
185
+ return input;
186
+ }
187
+ const select$6 = function ConversionEntriesRepresentationSelect() {
188
+ return {
189
+ kind: 'Fragment',
190
+ version: VERSION$2,
191
+ private: [],
192
+ opaque: true
193
+ };
194
+ };
195
+ function equals$2(existing, incoming) {
196
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
197
+ return false;
198
+ }
199
+ return true;
200
+ }
201
+ const ingest$2 = function ConversionEntriesRepresentationIngest(input, path, luvio, store, timestamp) {
202
+ if (process.env.NODE_ENV !== 'production') {
203
+ const validateError = validate$5(input);
204
+ if (validateError !== null) {
205
+ throw validateError;
206
+ }
207
+ }
208
+ const key = path.fullPath;
209
+ const ttlToUse = TTL$2;
210
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "Prospect", VERSION$2, RepresentationType$2, equals$2);
211
+ return createLink(key);
212
+ };
213
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
214
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
215
+ const rootKey = fullPathFactory();
216
+ rootKeySet.set(rootKey, {
217
+ namespace: keyPrefix,
218
+ representationName: RepresentationType$2,
219
+ mergeable: false
220
+ });
221
+ }
222
+
223
+ function select$5(luvio, params) {
224
+ return select$6();
225
+ }
226
+ function keyBuilder$6(luvio, params) {
227
+ return keyPrefix + '::ConversionEntriesRepresentation:(' + 'contactMap:' + params.queryParams.contactMap + ',' + 'leadMap:' + params.queryParams.leadMap + ',' + 'owner:' + params.queryParams.owner + ',' + 'personAccountMap:' + params.queryParams.personAccountMap + ',' + 'prospectId:' + params.queryParams.prospectId + ',' + 'status:' + params.queryParams.status + ')';
228
+ }
229
+ function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
230
+ getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$6(luvio, resourceParams));
231
+ }
232
+ function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
233
+ const { body } = response;
234
+ const key = keyBuilder$6(luvio, resourceParams);
235
+ luvio.storeIngest(key, ingest$2, body);
236
+ const snapshot = luvio.storeLookup({
237
+ recordId: key,
238
+ node: select$5(),
239
+ variables: {},
240
+ }, snapshotRefresh);
241
+ if (process.env.NODE_ENV !== 'production') {
242
+ if (snapshot.state !== 'Fulfilled') {
243
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
244
+ }
245
+ }
246
+ deepFreeze(snapshot.data);
247
+ return snapshot;
248
+ }
249
+ function ingestError$2(luvio, params, error, snapshotRefresh) {
250
+ const key = keyBuilder$6(luvio, params);
251
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
252
+ const storeMetadataParams = {
253
+ ttl: TTL$2,
254
+ namespace: keyPrefix,
255
+ version: VERSION$2,
256
+ representationName: RepresentationType$2
257
+ };
258
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
259
+ return errorSnapshot;
260
+ }
261
+ function createResourceRequest$3(config) {
262
+ const headers = {};
263
+ return {
264
+ baseUri: '/services/data/v66.0',
265
+ basePath: '/connect/ProspectConversion',
266
+ method: 'get',
267
+ body: null,
268
+ urlParams: {},
269
+ queryParams: config.queryParams,
270
+ headers,
271
+ priority: 'normal',
272
+ };
273
+ }
274
+
275
+ const adapterName$3 = 'getConversionEntries';
276
+ const getConversionEntries_ConfigPropertyMetadata = [
277
+ generateParamConfigMetadata('contactMap', false, 1 /* QueryParameter */, 0 /* String */),
278
+ generateParamConfigMetadata('leadMap', false, 1 /* QueryParameter */, 0 /* String */),
279
+ generateParamConfigMetadata('owner', false, 1 /* QueryParameter */, 0 /* String */),
280
+ generateParamConfigMetadata('personAccountMap', false, 1 /* QueryParameter */, 0 /* String */),
281
+ generateParamConfigMetadata('prospectId', false, 1 /* QueryParameter */, 0 /* String */),
282
+ generateParamConfigMetadata('status', false, 1 /* QueryParameter */, 0 /* String */),
283
+ ];
284
+ const getConversionEntries_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, getConversionEntries_ConfigPropertyMetadata);
285
+ const createResourceParams$3 = /*#__PURE__*/ createResourceParams$4(getConversionEntries_ConfigPropertyMetadata);
286
+ function keyBuilder$5(luvio, config) {
287
+ const resourceParams = createResourceParams$3(config);
288
+ return keyBuilder$6(luvio, resourceParams);
289
+ }
290
+ function typeCheckConfig$3(untrustedConfig) {
291
+ const config = {};
292
+ typeCheckConfig$4(untrustedConfig, config, getConversionEntries_ConfigPropertyMetadata);
293
+ return config;
294
+ }
295
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
296
+ if (!untrustedIsObject(untrustedConfig)) {
297
+ return null;
298
+ }
299
+ if (process.env.NODE_ENV !== 'production') {
300
+ validateConfig(untrustedConfig, configPropertyNames);
301
+ }
302
+ const config = typeCheckConfig$3(untrustedConfig);
303
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
304
+ return null;
305
+ }
306
+ return config;
307
+ }
308
+ function adapterFragment$2(luvio, config) {
309
+ createResourceParams$3(config);
310
+ return select$5();
311
+ }
312
+ function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
313
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
314
+ config,
315
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
316
+ });
317
+ return luvio.storeBroadcast().then(() => snapshot);
318
+ }
319
+ function onFetchResponseError$2(luvio, config, resourceParams, response) {
320
+ const snapshot = ingestError$2(luvio, resourceParams, response, {
321
+ config,
322
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
323
+ });
324
+ return luvio.storeBroadcast().then(() => snapshot);
325
+ }
326
+ function buildNetworkSnapshot$3(luvio, config, options) {
327
+ const resourceParams = createResourceParams$3(config);
328
+ const request = createResourceRequest$3(resourceParams);
329
+ return luvio.dispatchResourceRequest(request, options)
330
+ .then((response) => {
331
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => {
332
+ const cache = new StoreKeyMap();
333
+ getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
334
+ return cache;
335
+ });
336
+ }, (response) => {
337
+ return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
338
+ });
339
+ }
340
+ function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
341
+ return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot$3, undefined, false);
342
+ }
343
+ function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
344
+ const { luvio, config } = context;
345
+ const selector = {
346
+ recordId: keyBuilder$5(luvio, config),
347
+ node: adapterFragment$2(luvio, config),
348
+ variables: {},
349
+ };
350
+ const cacheSnapshot = storeLookup(selector, {
351
+ config,
352
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
353
+ });
354
+ return cacheSnapshot;
355
+ }
356
+ const getConversionEntriesAdapterFactory = (luvio) => function Prospect__getConversionEntries(untrustedConfig, requestContext) {
357
+ const config = validateAdapterConfig$3(untrustedConfig, getConversionEntries_ConfigPropertyNames);
358
+ // Invalid or incomplete config
359
+ if (config === null) {
360
+ return null;
361
+ }
362
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
363
+ buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
364
+ };
365
+
366
+ function select$4(luvio, params) {
367
+ return select$6();
368
+ }
369
+ function keyBuilder$4(luvio, params) {
370
+ return keyPrefix + '::ConversionEntriesRepresentation:(' + 'accountName:' + params.body.accountName + '::' + 'contactFirstName:' + params.body.contactFirstName + '::' + 'contactLastName:' + params.body.contactLastName + '::' + 'contactSalutation:' + params.body.contactSalutation + '::' + 'convertedStatus:' + params.body.convertedStatus + '::' + 'createOpportunity:' + params.body.createOpportunity + '::' + 'existingAccountId:' + params.body.existingAccountId + '::' + 'existingContactId:' + params.body.existingContactId + '::' + 'existingLeadId:' + params.body.existingLeadId + '::' + 'existingOpportunityId:' + params.body.existingOpportunityId + '::' + 'leadCompany:' + params.body.leadCompany + '::' + 'leadFirstName:' + params.body.leadFirstName + '::' + 'leadLastName:' + params.body.leadLastName + '::' + 'leadSalutation:' + params.body.leadSalutation + '::' + 'opportunityName:' + params.body.opportunityName + '::' + 'ownerId:' + params.body.ownerId + '::' + 'prospectId:' + params.body.prospectId + ')';
371
+ }
372
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
373
+ getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$4(luvio, resourceParams));
374
+ }
375
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
376
+ const { body } = response;
377
+ const key = keyBuilder$4(luvio, resourceParams);
378
+ luvio.storeIngest(key, ingest$2, body);
379
+ const snapshot = luvio.storeLookup({
380
+ recordId: key,
381
+ node: select$4(),
382
+ variables: {},
383
+ }, snapshotRefresh);
384
+ if (process.env.NODE_ENV !== 'production') {
385
+ if (snapshot.state !== 'Fulfilled') {
386
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
387
+ }
388
+ }
389
+ deepFreeze(snapshot.data);
390
+ return snapshot;
391
+ }
392
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
393
+ const key = keyBuilder$4(luvio, params);
394
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
395
+ const storeMetadataParams = {
396
+ ttl: TTL$2,
397
+ namespace: keyPrefix,
398
+ version: VERSION$2,
399
+ representationName: RepresentationType$2
400
+ };
401
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
402
+ return errorSnapshot;
403
+ }
404
+ function createResourceRequest$2(config) {
405
+ const headers = {};
406
+ return {
407
+ baseUri: '/services/data/v66.0',
408
+ basePath: '/connect/ProspectConversion',
409
+ method: 'post',
410
+ body: config.body,
411
+ urlParams: {},
412
+ queryParams: {},
413
+ headers,
414
+ priority: 'normal',
415
+ };
416
+ }
417
+
418
+ const adapterName$2 = 'getPostConversionEntries';
419
+ const getPostConversionEntries_ConfigPropertyMetadata = [
420
+ generateParamConfigMetadata('accountName', true, 2 /* Body */, 0 /* String */),
421
+ generateParamConfigMetadata('contactFirstName', true, 2 /* Body */, 0 /* String */),
422
+ generateParamConfigMetadata('contactLastName', true, 2 /* Body */, 0 /* String */),
423
+ generateParamConfigMetadata('contactSalutation', true, 2 /* Body */, 0 /* String */),
424
+ generateParamConfigMetadata('convertedStatus', true, 2 /* Body */, 0 /* String */),
425
+ generateParamConfigMetadata('createOpportunity', true, 2 /* Body */, 1 /* Boolean */),
426
+ generateParamConfigMetadata('existingAccountId', true, 2 /* Body */, 0 /* String */),
427
+ generateParamConfigMetadata('existingContactId', true, 2 /* Body */, 0 /* String */),
428
+ generateParamConfigMetadata('existingLeadId', true, 2 /* Body */, 0 /* String */),
429
+ generateParamConfigMetadata('existingOpportunityId', true, 2 /* Body */, 0 /* String */),
430
+ generateParamConfigMetadata('leadCompany', true, 2 /* Body */, 0 /* String */),
431
+ generateParamConfigMetadata('leadFirstName', true, 2 /* Body */, 0 /* String */),
432
+ generateParamConfigMetadata('leadLastName', true, 2 /* Body */, 0 /* String */),
433
+ generateParamConfigMetadata('leadSalutation', true, 2 /* Body */, 0 /* String */),
434
+ generateParamConfigMetadata('opportunityName', true, 2 /* Body */, 0 /* String */),
435
+ generateParamConfigMetadata('ownerId', true, 2 /* Body */, 0 /* String */),
436
+ generateParamConfigMetadata('prospectId', true, 2 /* Body */, 0 /* String */),
437
+ ];
438
+ const getPostConversionEntries_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getPostConversionEntries_ConfigPropertyMetadata);
439
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$4(getPostConversionEntries_ConfigPropertyMetadata);
440
+ function keyBuilder$3(luvio, config) {
441
+ const resourceParams = createResourceParams$2(config);
442
+ return keyBuilder$4(luvio, resourceParams);
443
+ }
444
+ function typeCheckConfig$2(untrustedConfig) {
445
+ const config = {};
446
+ typeCheckConfig$4(untrustedConfig, config, getPostConversionEntries_ConfigPropertyMetadata);
447
+ return config;
448
+ }
449
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
450
+ if (!untrustedIsObject(untrustedConfig)) {
451
+ return null;
452
+ }
453
+ if (process.env.NODE_ENV !== 'production') {
454
+ validateConfig(untrustedConfig, configPropertyNames);
455
+ }
456
+ const config = typeCheckConfig$2(untrustedConfig);
457
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
458
+ return null;
459
+ }
460
+ return config;
461
+ }
462
+ function adapterFragment$1(luvio, config) {
463
+ createResourceParams$2(config);
464
+ return select$4();
465
+ }
466
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
467
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
468
+ config,
469
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
470
+ });
471
+ return luvio.storeBroadcast().then(() => snapshot);
472
+ }
473
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
474
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
475
+ config,
476
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
477
+ });
478
+ return luvio.storeBroadcast().then(() => snapshot);
479
+ }
480
+ function buildNetworkSnapshot$2(luvio, config, options) {
481
+ const resourceParams = createResourceParams$2(config);
482
+ const request = createResourceRequest$2(resourceParams);
483
+ return luvio.dispatchResourceRequest(request, options)
484
+ .then((response) => {
485
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
486
+ const cache = new StoreKeyMap();
487
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
488
+ return cache;
489
+ });
490
+ }, (response) => {
491
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
492
+ });
493
+ }
494
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
495
+ return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, 'get', false);
496
+ }
497
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
498
+ const { luvio, config } = context;
499
+ const selector = {
500
+ recordId: keyBuilder$3(luvio, config),
501
+ node: adapterFragment$1(luvio, config),
502
+ variables: {},
503
+ };
504
+ const cacheSnapshot = storeLookup(selector, {
505
+ config,
506
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
507
+ });
508
+ return cacheSnapshot;
509
+ }
510
+ const getPostConversionEntriesAdapterFactory = (luvio) => function Prospect__getPostConversionEntries(untrustedConfig, requestContext) {
511
+ const config = validateAdapterConfig$2(untrustedConfig, getPostConversionEntries_ConfigPropertyNames);
512
+ // Invalid or incomplete config
513
+ if (config === null) {
514
+ return null;
515
+ }
516
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
517
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
518
+ };
519
+
520
+ function validate$4(obj, path = 'FieldMapping') {
521
+ const v_error = (() => {
522
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
523
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
524
+ }
525
+ const obj_inputField = obj.inputField;
526
+ const path_inputField = path + '.inputField';
527
+ if (typeof obj_inputField !== 'string') {
528
+ return new TypeError('Expected "string" but received "' + typeof obj_inputField + '" (at "' + path_inputField + '")');
529
+ }
530
+ const obj_outputField = obj.outputField;
531
+ const path_outputField = path + '.outputField';
532
+ if (typeof obj_outputField !== 'string') {
533
+ return new TypeError('Expected "string" but received "' + typeof obj_outputField + '" (at "' + path_outputField + '")');
534
+ }
535
+ })();
536
+ return v_error === undefined ? null : v_error;
537
+ }
538
+
539
+ function validate$3(obj, path = 'OutputObjectFieldMapping') {
540
+ const v_error = (() => {
541
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
542
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
543
+ }
544
+ const obj_mappedFields = obj.mappedFields;
545
+ const path_mappedFields = path + '.mappedFields';
546
+ if (!ArrayIsArray(obj_mappedFields)) {
547
+ return new TypeError('Expected "array" but received "' + typeof obj_mappedFields + '" (at "' + path_mappedFields + '")');
548
+ }
549
+ for (let i = 0; i < obj_mappedFields.length; i++) {
550
+ const obj_mappedFields_item = obj_mappedFields[i];
551
+ const path_mappedFields_item = path_mappedFields + '[' + i + ']';
552
+ if (typeof obj_mappedFields_item !== 'object' || Array.isArray(obj_mappedFields_item)) {
553
+ return new TypeError('Expected "object" but received "' + typeof obj_mappedFields_item + '" (at "' + path_mappedFields_item + '")');
554
+ }
555
+ }
556
+ const obj_outputObject = obj.outputObject;
557
+ const path_outputObject = path + '.outputObject';
558
+ if (typeof obj_outputObject !== 'string') {
559
+ return new TypeError('Expected "string" but received "' + typeof obj_outputObject + '" (at "' + path_outputObject + '")');
560
+ }
561
+ const obj_unmappedInputObjectFields = obj.unmappedInputObjectFields;
562
+ const path_unmappedInputObjectFields = path + '.unmappedInputObjectFields';
563
+ if (!ArrayIsArray(obj_unmappedInputObjectFields)) {
564
+ return new TypeError('Expected "array" but received "' + typeof obj_unmappedInputObjectFields + '" (at "' + path_unmappedInputObjectFields + '")');
565
+ }
566
+ for (let i = 0; i < obj_unmappedInputObjectFields.length; i++) {
567
+ const obj_unmappedInputObjectFields_item = obj_unmappedInputObjectFields[i];
568
+ const path_unmappedInputObjectFields_item = path_unmappedInputObjectFields + '[' + i + ']';
569
+ if (typeof obj_unmappedInputObjectFields_item !== 'object' || Array.isArray(obj_unmappedInputObjectFields_item)) {
570
+ return new TypeError('Expected "object" but received "' + typeof obj_unmappedInputObjectFields_item + '" (at "' + path_unmappedInputObjectFields_item + '")');
571
+ }
572
+ }
573
+ const obj_unmappedOutputObjectFields = obj.unmappedOutputObjectFields;
574
+ const path_unmappedOutputObjectFields = path + '.unmappedOutputObjectFields';
575
+ if (!ArrayIsArray(obj_unmappedOutputObjectFields)) {
576
+ return new TypeError('Expected "array" but received "' + typeof obj_unmappedOutputObjectFields + '" (at "' + path_unmappedOutputObjectFields + '")');
577
+ }
578
+ for (let i = 0; i < obj_unmappedOutputObjectFields.length; i++) {
579
+ const obj_unmappedOutputObjectFields_item = obj_unmappedOutputObjectFields[i];
580
+ const path_unmappedOutputObjectFields_item = path_unmappedOutputObjectFields + '[' + i + ']';
581
+ if (typeof obj_unmappedOutputObjectFields_item !== 'object' || Array.isArray(obj_unmappedOutputObjectFields_item)) {
582
+ return new TypeError('Expected "object" but received "' + typeof obj_unmappedOutputObjectFields_item + '" (at "' + path_unmappedOutputObjectFields_item + '")');
583
+ }
584
+ }
585
+ })();
586
+ return v_error === undefined ? null : v_error;
587
+ }
588
+
589
+ const TTL$1 = 1000;
590
+ const VERSION$1 = "67ce8674432bf552758d6c31fe7b1e2c";
591
+ function validate$2(obj, path = 'ProspectFieldMappingOutputGetRepresentation') {
592
+ const v_error = (() => {
593
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
594
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
595
+ }
596
+ const obj_apiErrorCode = obj.apiErrorCode;
597
+ const path_apiErrorCode = path + '.apiErrorCode';
598
+ if (typeof obj_apiErrorCode !== 'string') {
599
+ return new TypeError('Expected "string" but received "' + typeof obj_apiErrorCode + '" (at "' + path_apiErrorCode + '")');
600
+ }
601
+ const obj_apiErrorMsg = obj.apiErrorMsg;
602
+ const path_apiErrorMsg = path + '.apiErrorMsg';
603
+ if (typeof obj_apiErrorMsg !== 'string') {
604
+ return new TypeError('Expected "string" but received "' + typeof obj_apiErrorMsg + '" (at "' + path_apiErrorMsg + '")');
605
+ }
606
+ const obj_httpStatusCode = obj.httpStatusCode;
607
+ const path_httpStatusCode = path + '.httpStatusCode';
608
+ if (typeof obj_httpStatusCode !== 'string') {
609
+ return new TypeError('Expected "string" but received "' + typeof obj_httpStatusCode + '" (at "' + path_httpStatusCode + '")');
610
+ }
611
+ const obj_outputObjectFieldMappings = obj.outputObjectFieldMappings;
612
+ const path_outputObjectFieldMappings = path + '.outputObjectFieldMappings';
613
+ if (!ArrayIsArray(obj_outputObjectFieldMappings)) {
614
+ return new TypeError('Expected "array" but received "' + typeof obj_outputObjectFieldMappings + '" (at "' + path_outputObjectFieldMappings + '")');
615
+ }
616
+ for (let i = 0; i < obj_outputObjectFieldMappings.length; i++) {
617
+ const obj_outputObjectFieldMappings_item = obj_outputObjectFieldMappings[i];
618
+ const path_outputObjectFieldMappings_item = path_outputObjectFieldMappings + '[' + i + ']';
619
+ const referencepath_outputObjectFieldMappings_itemValidationError = validate$3(obj_outputObjectFieldMappings_item, path_outputObjectFieldMappings_item);
620
+ if (referencepath_outputObjectFieldMappings_itemValidationError !== null) {
621
+ let message = 'Object doesn\'t match OutputObjectFieldMapping (at "' + path_outputObjectFieldMappings_item + '")\n';
622
+ message += referencepath_outputObjectFieldMappings_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
623
+ return new TypeError(message);
624
+ }
625
+ }
626
+ })();
627
+ return v_error === undefined ? null : v_error;
628
+ }
629
+ const RepresentationType$1 = 'ProspectFieldMappingOutputGetRepresentation';
630
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
631
+ return input;
632
+ }
633
+ const select$3 = function ProspectFieldMappingOutputGetRepresentationSelect() {
634
+ return {
635
+ kind: 'Fragment',
636
+ version: VERSION$1,
637
+ private: [],
638
+ opaque: true
639
+ };
640
+ };
641
+ function equals$1(existing, incoming) {
642
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
643
+ return false;
644
+ }
645
+ return true;
646
+ }
647
+ const ingest$1 = function ProspectFieldMappingOutputGetRepresentationIngest(input, path, luvio, store, timestamp) {
648
+ if (process.env.NODE_ENV !== 'production') {
649
+ const validateError = validate$2(input);
650
+ if (validateError !== null) {
651
+ throw validateError;
652
+ }
653
+ }
654
+ const key = path.fullPath;
655
+ const ttlToUse = TTL$1;
656
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "Prospect", VERSION$1, RepresentationType$1, equals$1);
657
+ return createLink(key);
658
+ };
659
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
660
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
661
+ const rootKey = fullPathFactory();
662
+ rootKeySet.set(rootKey, {
663
+ namespace: keyPrefix,
664
+ representationName: RepresentationType$1,
665
+ mergeable: false
666
+ });
667
+ }
668
+
669
+ function select$2(luvio, params) {
670
+ return select$3();
671
+ }
672
+ function keyBuilder$2(luvio, params) {
673
+ return keyPrefix + '::ProspectFieldMappingOutputGetRepresentation:(' + ')';
674
+ }
675
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
676
+ getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$2());
677
+ }
678
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
679
+ const { body } = response;
680
+ const key = keyBuilder$2();
681
+ luvio.storeIngest(key, ingest$1, body);
682
+ const snapshot = luvio.storeLookup({
683
+ recordId: key,
684
+ node: select$2(),
685
+ variables: {},
686
+ }, snapshotRefresh);
687
+ if (process.env.NODE_ENV !== 'production') {
688
+ if (snapshot.state !== 'Fulfilled') {
689
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
690
+ }
691
+ }
692
+ deepFreeze(snapshot.data);
693
+ return snapshot;
694
+ }
695
+ function ingestError(luvio, params, error, snapshotRefresh) {
696
+ const key = keyBuilder$2();
697
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
698
+ const storeMetadataParams = {
699
+ ttl: TTL$1,
700
+ namespace: keyPrefix,
701
+ version: VERSION$1,
702
+ representationName: RepresentationType$1
703
+ };
704
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
705
+ return errorSnapshot;
706
+ }
707
+ function createResourceRequest$1(config) {
708
+ const headers = {};
709
+ return {
710
+ baseUri: '/services/data/v66.0',
711
+ basePath: '/connect/ProspectFieldMapping',
712
+ method: 'get',
713
+ body: null,
714
+ urlParams: {},
715
+ queryParams: {},
716
+ headers,
717
+ priority: 'normal',
718
+ };
719
+ }
720
+
721
+ const adapterName$1 = 'getProspectFieldMappings';
722
+ const getProspectFieldMappings_ConfigPropertyMetadata = [];
723
+ const getProspectFieldMappings_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getProspectFieldMappings_ConfigPropertyMetadata);
724
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$4(getProspectFieldMappings_ConfigPropertyMetadata);
725
+ function keyBuilder$1(luvio, config) {
726
+ createResourceParams$1(config);
727
+ return keyBuilder$2();
728
+ }
729
+ function typeCheckConfig$1(untrustedConfig) {
730
+ const config = {};
731
+ return config;
732
+ }
733
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
734
+ if (!untrustedIsObject(untrustedConfig)) {
735
+ return null;
736
+ }
737
+ if (process.env.NODE_ENV !== 'production') {
738
+ validateConfig(untrustedConfig, configPropertyNames);
739
+ }
740
+ const config = typeCheckConfig$1();
741
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
742
+ return null;
743
+ }
744
+ return config;
745
+ }
746
+ function adapterFragment(luvio, config) {
747
+ createResourceParams$1(config);
748
+ return select$2();
749
+ }
750
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
751
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
752
+ config,
753
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
754
+ });
755
+ return luvio.storeBroadcast().then(() => snapshot);
756
+ }
757
+ function onFetchResponseError(luvio, config, resourceParams, response) {
758
+ const snapshot = ingestError(luvio, resourceParams, response, {
759
+ config,
760
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
761
+ });
762
+ return luvio.storeBroadcast().then(() => snapshot);
763
+ }
764
+ function buildNetworkSnapshot$1(luvio, config, options) {
765
+ const resourceParams = createResourceParams$1(config);
766
+ const request = createResourceRequest$1();
767
+ return luvio.dispatchResourceRequest(request, options)
768
+ .then((response) => {
769
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
770
+ const cache = new StoreKeyMap();
771
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
772
+ return cache;
773
+ });
774
+ }, (response) => {
775
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
776
+ });
777
+ }
778
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
779
+ return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
780
+ }
781
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
782
+ const { luvio, config } = context;
783
+ const selector = {
784
+ recordId: keyBuilder$1(luvio, config),
785
+ node: adapterFragment(luvio, config),
786
+ variables: {},
787
+ };
788
+ const cacheSnapshot = storeLookup(selector, {
789
+ config,
790
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
791
+ });
792
+ return cacheSnapshot;
793
+ }
794
+ const getProspectFieldMappingsAdapterFactory = (luvio) => function Prospect__getProspectFieldMappings(untrustedConfig, requestContext) {
795
+ const config = validateAdapterConfig$1(untrustedConfig, getProspectFieldMappings_ConfigPropertyNames);
796
+ // Invalid or incomplete config
797
+ if (config === null) {
798
+ return null;
799
+ }
800
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
801
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
802
+ };
803
+
804
+ function validate$1(obj, path = 'InputObjectFieldMapping') {
805
+ const v_error = (() => {
806
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
807
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
808
+ }
809
+ if (obj.mappedFields !== undefined) {
810
+ const obj_mappedFields = obj.mappedFields;
811
+ const path_mappedFields = path + '.mappedFields';
812
+ if (!ArrayIsArray(obj_mappedFields)) {
813
+ return new TypeError('Expected "array" but received "' + typeof obj_mappedFields + '" (at "' + path_mappedFields + '")');
814
+ }
815
+ for (let i = 0; i < obj_mappedFields.length; i++) {
816
+ const obj_mappedFields_item = obj_mappedFields[i];
817
+ const path_mappedFields_item = path_mappedFields + '[' + i + ']';
818
+ const referencepath_mappedFields_itemValidationError = validate$4(obj_mappedFields_item, path_mappedFields_item);
819
+ if (referencepath_mappedFields_itemValidationError !== null) {
820
+ let message = 'Object doesn\'t match FieldMapping (at "' + path_mappedFields_item + '")\n';
821
+ message += referencepath_mappedFields_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
822
+ return new TypeError(message);
823
+ }
824
+ }
825
+ }
826
+ if (obj.outputObject !== undefined) {
827
+ const obj_outputObject = obj.outputObject;
828
+ const path_outputObject = path + '.outputObject';
829
+ if (typeof obj_outputObject !== 'string') {
830
+ return new TypeError('Expected "string" but received "' + typeof obj_outputObject + '" (at "' + path_outputObject + '")');
831
+ }
832
+ }
833
+ })();
834
+ return v_error === undefined ? null : v_error;
835
+ }
836
+
837
+ const TTL = 500;
838
+ const VERSION = "a6993f1f7ae745dc378e2bb9a1fc610b";
839
+ function validate(obj, path = 'ProspectFieldMappingOutputPostRepresentation') {
840
+ const v_error = (() => {
841
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
842
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
843
+ }
844
+ const obj_apiErrorCode = obj.apiErrorCode;
845
+ const path_apiErrorCode = path + '.apiErrorCode';
846
+ if (typeof obj_apiErrorCode !== 'string') {
847
+ return new TypeError('Expected "string" but received "' + typeof obj_apiErrorCode + '" (at "' + path_apiErrorCode + '")');
848
+ }
849
+ const obj_apiErrorMsg = obj.apiErrorMsg;
850
+ const path_apiErrorMsg = path + '.apiErrorMsg';
851
+ if (typeof obj_apiErrorMsg !== 'string') {
852
+ return new TypeError('Expected "string" but received "' + typeof obj_apiErrorMsg + '" (at "' + path_apiErrorMsg + '")');
853
+ }
854
+ const obj_httpStatusCode = obj.httpStatusCode;
855
+ const path_httpStatusCode = path + '.httpStatusCode';
856
+ if (typeof obj_httpStatusCode !== 'string') {
857
+ return new TypeError('Expected "string" but received "' + typeof obj_httpStatusCode + '" (at "' + path_httpStatusCode + '")');
858
+ }
859
+ })();
860
+ return v_error === undefined ? null : v_error;
861
+ }
862
+ const RepresentationType = 'ProspectFieldMappingOutputPostRepresentation';
863
+ function keyBuilder(luvio, config) {
864
+ return keyPrefix + '::' + RepresentationType + ':' + config.httpStatusCode;
865
+ }
866
+ function keyBuilderFromType(luvio, object) {
867
+ const keyParams = {
868
+ httpStatusCode: object.httpStatusCode
869
+ };
870
+ return keyBuilder(luvio, keyParams);
871
+ }
872
+ function normalize(input, existing, path, luvio, store, timestamp) {
873
+ return input;
874
+ }
875
+ const select$1 = function ProspectFieldMappingOutputPostRepresentationSelect() {
876
+ return {
877
+ kind: 'Fragment',
878
+ version: VERSION,
879
+ private: [],
880
+ selections: [
881
+ {
882
+ name: 'apiErrorCode',
883
+ kind: 'Scalar'
884
+ },
885
+ {
886
+ name: 'apiErrorMsg',
887
+ kind: 'Scalar'
888
+ },
889
+ {
890
+ name: 'httpStatusCode',
891
+ kind: 'Scalar'
892
+ }
893
+ ]
894
+ };
895
+ };
896
+ function equals(existing, incoming) {
897
+ const existing_apiErrorCode = existing.apiErrorCode;
898
+ const incoming_apiErrorCode = incoming.apiErrorCode;
899
+ if (!(existing_apiErrorCode === incoming_apiErrorCode)) {
900
+ return false;
901
+ }
902
+ const existing_apiErrorMsg = existing.apiErrorMsg;
903
+ const incoming_apiErrorMsg = incoming.apiErrorMsg;
904
+ if (!(existing_apiErrorMsg === incoming_apiErrorMsg)) {
905
+ return false;
906
+ }
907
+ const existing_httpStatusCode = existing.httpStatusCode;
908
+ const incoming_httpStatusCode = incoming.httpStatusCode;
909
+ if (!(existing_httpStatusCode === incoming_httpStatusCode)) {
910
+ return false;
911
+ }
912
+ return true;
913
+ }
914
+ const ingest = function ProspectFieldMappingOutputPostRepresentationIngest(input, path, luvio, store, timestamp) {
915
+ if (process.env.NODE_ENV !== 'production') {
916
+ const validateError = validate(input);
917
+ if (validateError !== null) {
918
+ throw validateError;
919
+ }
920
+ }
921
+ const key = keyBuilderFromType(luvio, input);
922
+ const ttlToUse = TTL;
923
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "Prospect", VERSION, RepresentationType, equals);
924
+ return createLink(key);
925
+ };
926
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
927
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
928
+ const rootKey = keyBuilderFromType(luvio, input);
929
+ rootKeySet.set(rootKey, {
930
+ namespace: keyPrefix,
931
+ representationName: RepresentationType,
932
+ mergeable: false
933
+ });
934
+ }
935
+
936
+ function select(luvio, params) {
937
+ return select$1();
938
+ }
939
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
940
+ getTypeCacheKeys(storeKeyMap, luvio, response);
941
+ }
942
+ function ingestSuccess(luvio, resourceParams, response) {
943
+ const { body } = response;
944
+ const key = keyBuilderFromType(luvio, body);
945
+ luvio.storeIngest(key, ingest, body);
946
+ const snapshot = luvio.storeLookup({
947
+ recordId: key,
948
+ node: select(),
949
+ variables: {},
950
+ });
951
+ if (process.env.NODE_ENV !== 'production') {
952
+ if (snapshot.state !== 'Fulfilled') {
953
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
954
+ }
955
+ }
956
+ deepFreeze(snapshot.data);
957
+ return snapshot;
958
+ }
959
+ function createResourceRequest(config) {
960
+ const headers = {};
961
+ return {
962
+ baseUri: '/services/data/v66.0',
963
+ basePath: '/connect/ProspectFieldMapping',
964
+ method: 'post',
965
+ body: config.body,
966
+ urlParams: {},
967
+ queryParams: {},
968
+ headers,
969
+ priority: 'normal',
970
+ };
971
+ }
972
+
973
+ const adapterName = 'saveProspectFieldMappings';
974
+ const saveProspectFieldMappings_ConfigPropertyMetadata = [
975
+ generateParamConfigMetadata('inputObjectFieldMappings', false, 2 /* Body */, 4 /* Unsupported */, true),
976
+ ];
977
+ const saveProspectFieldMappings_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, saveProspectFieldMappings_ConfigPropertyMetadata);
978
+ const createResourceParams = /*#__PURE__*/ createResourceParams$4(saveProspectFieldMappings_ConfigPropertyMetadata);
979
+ function typeCheckConfig(untrustedConfig) {
980
+ const config = {};
981
+ const untrustedConfig_inputObjectFieldMappings = untrustedConfig.inputObjectFieldMappings;
982
+ if (ArrayIsArray$1(untrustedConfig_inputObjectFieldMappings)) {
983
+ const untrustedConfig_inputObjectFieldMappings_array = [];
984
+ for (let i = 0, arrayLength = untrustedConfig_inputObjectFieldMappings.length; i < arrayLength; i++) {
985
+ const untrustedConfig_inputObjectFieldMappings_item = untrustedConfig_inputObjectFieldMappings[i];
986
+ const referenceInputObjectFieldMappingValidationError = validate$1(untrustedConfig_inputObjectFieldMappings_item);
987
+ if (referenceInputObjectFieldMappingValidationError === null) {
988
+ untrustedConfig_inputObjectFieldMappings_array.push(untrustedConfig_inputObjectFieldMappings_item);
989
+ }
990
+ }
991
+ config.inputObjectFieldMappings = untrustedConfig_inputObjectFieldMappings_array;
992
+ }
993
+ return config;
994
+ }
995
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
996
+ if (!untrustedIsObject(untrustedConfig)) {
997
+ return null;
998
+ }
999
+ if (process.env.NODE_ENV !== 'production') {
1000
+ validateConfig(untrustedConfig, configPropertyNames);
1001
+ }
1002
+ const config = typeCheckConfig(untrustedConfig);
1003
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1004
+ return null;
1005
+ }
1006
+ return config;
1007
+ }
1008
+ function buildNetworkSnapshot(luvio, config, options) {
1009
+ const resourceParams = createResourceParams(config);
1010
+ const request = createResourceRequest(resourceParams);
1011
+ return luvio.dispatchResourceRequest(request, options)
1012
+ .then((response) => {
1013
+ return luvio.handleSuccessResponse(() => {
1014
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
1015
+ return luvio.storeBroadcast().then(() => snapshot);
1016
+ }, () => {
1017
+ const cache = new StoreKeyMap();
1018
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
1019
+ return cache;
1020
+ });
1021
+ }, (response) => {
1022
+ deepFreeze(response);
1023
+ throw response;
1024
+ });
1025
+ }
1026
+ const saveProspectFieldMappingsAdapterFactory = (luvio) => {
1027
+ return function saveProspectFieldMappings(untrustedConfig) {
1028
+ const config = validateAdapterConfig(untrustedConfig, saveProspectFieldMappings_ConfigPropertyNames);
1029
+ // Invalid or incomplete config
1030
+ if (config === null) {
1031
+ throw new Error('Invalid config for "saveProspectFieldMappings"');
1032
+ }
1033
+ return buildNetworkSnapshot(luvio, config);
1034
+ };
1035
+ };
1036
+
1037
+ let getConversionEntries;
1038
+ let getPostConversionEntries;
1039
+ let getProspectFieldMappings;
1040
+ let saveProspectFieldMappings;
1041
+ // Imperative GET Adapters
1042
+ let getConversionEntries_imperative;
1043
+ let getPostConversionEntries_imperative;
1044
+ let getProspectFieldMappings_imperative;
1045
+ // Adapter Metadata
1046
+ const getConversionEntriesMetadata = {
1047
+ apiFamily: 'Prospect',
1048
+ name: 'getConversionEntries',
1049
+ ttl: 60000,
1050
+ };
1051
+ const getPostConversionEntriesMetadata = {
1052
+ apiFamily: 'Prospect',
1053
+ name: 'getPostConversionEntries',
1054
+ ttl: 60000,
1055
+ };
1056
+ const getProspectFieldMappingsMetadata = {
1057
+ apiFamily: 'Prospect',
1058
+ name: 'getProspectFieldMappings',
1059
+ ttl: 1000,
1060
+ };
1061
+ // Notify Update Available
1062
+ function bindExportsTo(luvio) {
1063
+ // LDS Adapters
1064
+ const getConversionEntries_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getConversionEntries', getConversionEntriesAdapterFactory), getConversionEntriesMetadata);
1065
+ const getPostConversionEntries_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getPostConversionEntries', getPostConversionEntriesAdapterFactory), getPostConversionEntriesMetadata);
1066
+ const getProspectFieldMappings_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getProspectFieldMappings', getProspectFieldMappingsAdapterFactory), getProspectFieldMappingsMetadata);
1067
+ function unwrapSnapshotData(factory) {
1068
+ const adapter = factory(luvio);
1069
+ return (config) => adapter(config).then((snapshot) => snapshot.data);
1070
+ }
1071
+ return {
1072
+ getConversionEntries: createWireAdapterConstructor(luvio, getConversionEntries_ldsAdapter, getConversionEntriesMetadata),
1073
+ getPostConversionEntries: createWireAdapterConstructor(luvio, getPostConversionEntries_ldsAdapter, getPostConversionEntriesMetadata),
1074
+ getProspectFieldMappings: createWireAdapterConstructor(luvio, getProspectFieldMappings_ldsAdapter, getProspectFieldMappingsMetadata),
1075
+ saveProspectFieldMappings: unwrapSnapshotData(saveProspectFieldMappingsAdapterFactory),
1076
+ // Imperative GET Adapters
1077
+ getConversionEntries_imperative: createImperativeAdapter(luvio, getConversionEntries_ldsAdapter, getConversionEntriesMetadata),
1078
+ getPostConversionEntries_imperative: createImperativeAdapter(luvio, getPostConversionEntries_ldsAdapter, getPostConversionEntriesMetadata),
1079
+ getProspectFieldMappings_imperative: createImperativeAdapter(luvio, getProspectFieldMappings_ldsAdapter, getProspectFieldMappingsMetadata),
1080
+ // Notify Update Availables
1081
+ };
1082
+ }
1083
+ withDefaultLuvio((luvio) => {
1084
+ ({
1085
+ getConversionEntries,
1086
+ getPostConversionEntries,
1087
+ getProspectFieldMappings,
1088
+ saveProspectFieldMappings,
1089
+ getConversionEntries_imperative,
1090
+ getPostConversionEntries_imperative,
1091
+ getProspectFieldMappings_imperative,
1092
+ } = bindExportsTo(luvio));
1093
+ });
1094
+
1095
+ export { getConversionEntries, getConversionEntries_imperative, getPostConversionEntries, getPostConversionEntries_imperative, getProspectFieldMappings, getProspectFieldMappings_imperative, saveProspectFieldMappings };
1096
+ // version: 0.1.0-dev1-c978a7b010