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