@salesforce/lds-adapters-sales-evfsdk 1.285.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/sfdc/index.js ADDED
@@ -0,0 +1,572 @@
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$1, StoreKeyMap, createResourceParams as createResourceParams$2, typeCheckConfig as typeCheckConfig$2 } 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 = 'evfSdk';
83
+
84
+ const { isArray: ArrayIsArray } = Array;
85
+ function equalsArray(a, b, equalsItem) {
86
+ const aLength = a.length;
87
+ const bLength = b.length;
88
+ if (aLength !== bLength) {
89
+ return false;
90
+ }
91
+ for (let i = 0; i < aLength; i++) {
92
+ if (equalsItem(a[i], b[i]) === false) {
93
+ return false;
94
+ }
95
+ }
96
+ return true;
97
+ }
98
+ function createLink(ref) {
99
+ return {
100
+ __ref: serializeStructuredKey(ref),
101
+ };
102
+ }
103
+
104
+ const VERSION$2 = "6cd59f422d42dae130829d614e96fd00";
105
+ function validate$2(obj, path = 'ResponseStatus') {
106
+ const v_error = (() => {
107
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
108
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
109
+ }
110
+ const obj_code = obj.code;
111
+ const path_code = path + '.code';
112
+ if (typeof obj_code !== 'string') {
113
+ return new TypeError('Expected "string" but received "' + typeof obj_code + '" (at "' + path_code + '")');
114
+ }
115
+ const obj_message = obj.message;
116
+ const path_message = path + '.message';
117
+ if (typeof obj_message !== 'string') {
118
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
119
+ }
120
+ })();
121
+ return v_error === undefined ? null : v_error;
122
+ }
123
+ const select$4 = function ResponseStatusSelect() {
124
+ return {
125
+ kind: 'Fragment',
126
+ version: VERSION$2,
127
+ private: [],
128
+ selections: [
129
+ {
130
+ name: 'code',
131
+ kind: 'Scalar'
132
+ },
133
+ {
134
+ name: 'message',
135
+ kind: 'Scalar'
136
+ }
137
+ ]
138
+ };
139
+ };
140
+ function equals$2(existing, incoming) {
141
+ const existing_code = existing.code;
142
+ const incoming_code = incoming.code;
143
+ if (!(existing_code === incoming_code)) {
144
+ return false;
145
+ }
146
+ const existing_message = existing.message;
147
+ const incoming_message = incoming.message;
148
+ if (!(existing_message === incoming_message)) {
149
+ return false;
150
+ }
151
+ return true;
152
+ }
153
+
154
+ const VERSION$1 = "944b3e6ec30480d518e5f389303c2957";
155
+ function validate$1(obj, path = 'EventTypesOutput') {
156
+ const v_error = (() => {
157
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
158
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
159
+ }
160
+ const obj_eventTypes = obj.eventTypes;
161
+ const path_eventTypes = path + '.eventTypes';
162
+ if (!ArrayIsArray(obj_eventTypes)) {
163
+ return new TypeError('Expected "array" but received "' + typeof obj_eventTypes + '" (at "' + path_eventTypes + '")');
164
+ }
165
+ for (let i = 0; i < obj_eventTypes.length; i++) {
166
+ const obj_eventTypes_item = obj_eventTypes[i];
167
+ const path_eventTypes_item = path_eventTypes + '[' + i + ']';
168
+ if (typeof obj_eventTypes_item !== 'string') {
169
+ return new TypeError('Expected "string" but received "' + typeof obj_eventTypes_item + '" (at "' + path_eventTypes_item + '")');
170
+ }
171
+ }
172
+ const obj_status = obj.status;
173
+ const path_status = path + '.status';
174
+ const referencepath_statusValidationError = validate$2(obj_status, path_status);
175
+ if (referencepath_statusValidationError !== null) {
176
+ let message = 'Object doesn\'t match ResponseStatus (at "' + path_status + '")\n';
177
+ message += referencepath_statusValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
178
+ return new TypeError(message);
179
+ }
180
+ })();
181
+ return v_error === undefined ? null : v_error;
182
+ }
183
+ const RepresentationType$1 = 'EventTypesOutput';
184
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
185
+ return input;
186
+ }
187
+ const select$3 = function EventTypesOutputSelect() {
188
+ const { selections: ResponseStatus__selections, opaque: ResponseStatus__opaque, } = select$4();
189
+ return {
190
+ kind: 'Fragment',
191
+ version: VERSION$1,
192
+ private: [],
193
+ selections: [
194
+ {
195
+ name: 'eventTypes',
196
+ kind: 'Scalar',
197
+ plural: true
198
+ },
199
+ {
200
+ name: 'status',
201
+ kind: 'Object',
202
+ selections: ResponseStatus__selections
203
+ }
204
+ ]
205
+ };
206
+ };
207
+ function equals$1(existing, incoming) {
208
+ const existing_eventTypes = existing.eventTypes;
209
+ const incoming_eventTypes = incoming.eventTypes;
210
+ const equals_eventTypes_items = equalsArray(existing_eventTypes, incoming_eventTypes, (existing_eventTypes_item, incoming_eventTypes_item) => {
211
+ if (!(existing_eventTypes_item === incoming_eventTypes_item)) {
212
+ return false;
213
+ }
214
+ });
215
+ if (equals_eventTypes_items === false) {
216
+ return false;
217
+ }
218
+ const existing_status = existing.status;
219
+ const incoming_status = incoming.status;
220
+ if (!(equals$2(existing_status, incoming_status))) {
221
+ return false;
222
+ }
223
+ return true;
224
+ }
225
+ const ingest$1 = function EventTypesOutputIngest(input, path, luvio, store, timestamp) {
226
+ if (process.env.NODE_ENV !== 'production') {
227
+ const validateError = validate$1(input);
228
+ if (validateError !== null) {
229
+ throw validateError;
230
+ }
231
+ }
232
+ const key = path.fullPath;
233
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 30000;
234
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "evfSdk", VERSION$1, RepresentationType$1, equals$1);
235
+ return createLink(key);
236
+ };
237
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
238
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
239
+ const rootKey = fullPathFactory();
240
+ rootKeySet.set(rootKey, {
241
+ namespace: keyPrefix,
242
+ representationName: RepresentationType$1,
243
+ mergeable: false
244
+ });
245
+ }
246
+
247
+ function select$2(luvio, params) {
248
+ return select$3();
249
+ }
250
+ function keyBuilder$2(luvio, params) {
251
+ return keyPrefix + '::EventTypesOutput:(' + ')';
252
+ }
253
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
254
+ getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$2());
255
+ }
256
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
257
+ const { body } = response;
258
+ const key = keyBuilder$2();
259
+ luvio.storeIngest(key, ingest$1, body);
260
+ const snapshot = luvio.storeLookup({
261
+ recordId: key,
262
+ node: select$2(),
263
+ variables: {},
264
+ }, snapshotRefresh);
265
+ if (process.env.NODE_ENV !== 'production') {
266
+ if (snapshot.state !== 'Fulfilled') {
267
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
268
+ }
269
+ }
270
+ deepFreeze(snapshot.data);
271
+ return snapshot;
272
+ }
273
+ function ingestError(luvio, params, error, snapshotRefresh) {
274
+ const key = keyBuilder$2();
275
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
276
+ luvio.storeIngestError(key, errorSnapshot);
277
+ return errorSnapshot;
278
+ }
279
+ function createResourceRequest$1(config) {
280
+ const headers = {};
281
+ return {
282
+ baseUri: '/services/data/v61.0',
283
+ basePath: '/connect/evf/sdk/event-types',
284
+ method: 'get',
285
+ body: null,
286
+ urlParams: {},
287
+ queryParams: {},
288
+ headers,
289
+ priority: 'normal',
290
+ };
291
+ }
292
+
293
+ const adapterName$1 = 'getEventTypes';
294
+ const getEventTypes_ConfigPropertyMetadata = [];
295
+ const getEventTypes_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getEventTypes_ConfigPropertyMetadata);
296
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(getEventTypes_ConfigPropertyMetadata);
297
+ function keyBuilder$1(luvio, config) {
298
+ createResourceParams$1(config);
299
+ return keyBuilder$2();
300
+ }
301
+ function typeCheckConfig$1(untrustedConfig) {
302
+ const config = {};
303
+ return config;
304
+ }
305
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
306
+ if (!untrustedIsObject(untrustedConfig)) {
307
+ return null;
308
+ }
309
+ if (process.env.NODE_ENV !== 'production') {
310
+ validateConfig(untrustedConfig, configPropertyNames);
311
+ }
312
+ const config = typeCheckConfig$1();
313
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
314
+ return null;
315
+ }
316
+ return config;
317
+ }
318
+ function adapterFragment(luvio, config) {
319
+ createResourceParams$1(config);
320
+ return select$2();
321
+ }
322
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
323
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
324
+ config,
325
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
326
+ });
327
+ return luvio.storeBroadcast().then(() => snapshot);
328
+ }
329
+ function onFetchResponseError(luvio, config, resourceParams, response) {
330
+ const snapshot = ingestError(luvio, resourceParams, response, {
331
+ config,
332
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
333
+ });
334
+ return luvio.storeBroadcast().then(() => snapshot);
335
+ }
336
+ function buildNetworkSnapshot$1(luvio, config, options) {
337
+ const resourceParams = createResourceParams$1(config);
338
+ const request = createResourceRequest$1();
339
+ return luvio.dispatchResourceRequest(request, options)
340
+ .then((response) => {
341
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
342
+ const cache = new StoreKeyMap();
343
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
344
+ return cache;
345
+ });
346
+ }, (response) => {
347
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
348
+ });
349
+ }
350
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
351
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
352
+ }
353
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
354
+ const { luvio, config } = context;
355
+ const selector = {
356
+ recordId: keyBuilder$1(luvio, config),
357
+ node: adapterFragment(luvio, config),
358
+ variables: {},
359
+ };
360
+ const cacheSnapshot = storeLookup(selector, {
361
+ config,
362
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
363
+ });
364
+ return cacheSnapshot;
365
+ }
366
+ const getEventTypesAdapterFactory = (luvio) => function evfSdk__getEventTypes(untrustedConfig, requestContext) {
367
+ const config = validateAdapterConfig$1(untrustedConfig, getEventTypes_ConfigPropertyNames);
368
+ // Invalid or incomplete config
369
+ if (config === null) {
370
+ return null;
371
+ }
372
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
373
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
374
+ };
375
+
376
+ const VERSION = "8e3c59d1edb1e360b97a3a87ead05a6e";
377
+ function validate(obj, path = 'PublishEventOutput') {
378
+ const v_error = (() => {
379
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
380
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
381
+ }
382
+ const obj_status = obj.status;
383
+ const path_status = path + '.status';
384
+ const referencepath_statusValidationError = validate$2(obj_status, path_status);
385
+ if (referencepath_statusValidationError !== null) {
386
+ let message = 'Object doesn\'t match ResponseStatus (at "' + path_status + '")\n';
387
+ message += referencepath_statusValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
388
+ return new TypeError(message);
389
+ }
390
+ })();
391
+ return v_error === undefined ? null : v_error;
392
+ }
393
+ const RepresentationType = 'PublishEventOutput';
394
+ function keyBuilder(luvio, config) {
395
+ return keyPrefix + '::' + RepresentationType + ':' + config.id;
396
+ }
397
+ function keyBuilderFromType(luvio, object) {
398
+ const keyParams = {
399
+ id: object.status.message
400
+ };
401
+ return keyBuilder(luvio, keyParams);
402
+ }
403
+ function normalize(input, existing, path, luvio, store, timestamp) {
404
+ return input;
405
+ }
406
+ const select$1 = function PublishEventOutputSelect() {
407
+ const { selections: ResponseStatus__selections, opaque: ResponseStatus__opaque, } = select$4();
408
+ return {
409
+ kind: 'Fragment',
410
+ version: VERSION,
411
+ private: [],
412
+ selections: [
413
+ {
414
+ name: 'status',
415
+ kind: 'Object',
416
+ selections: ResponseStatus__selections
417
+ }
418
+ ]
419
+ };
420
+ };
421
+ function equals(existing, incoming) {
422
+ const existing_status = existing.status;
423
+ const incoming_status = incoming.status;
424
+ if (!(equals$2(existing_status, incoming_status))) {
425
+ return false;
426
+ }
427
+ return true;
428
+ }
429
+ const ingest = function PublishEventOutputIngest(input, path, luvio, store, timestamp) {
430
+ if (process.env.NODE_ENV !== 'production') {
431
+ const validateError = validate(input);
432
+ if (validateError !== null) {
433
+ throw validateError;
434
+ }
435
+ }
436
+ const key = keyBuilderFromType(luvio, input);
437
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 30000;
438
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "evfSdk", VERSION, RepresentationType, equals);
439
+ return createLink(key);
440
+ };
441
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
442
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
443
+ const rootKey = keyBuilderFromType(luvio, input);
444
+ rootKeySet.set(rootKey, {
445
+ namespace: keyPrefix,
446
+ representationName: RepresentationType,
447
+ mergeable: false
448
+ });
449
+ }
450
+
451
+ function select(luvio, params) {
452
+ return select$1();
453
+ }
454
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
455
+ getTypeCacheKeys(storeKeyMap, luvio, response);
456
+ }
457
+ function ingestSuccess(luvio, resourceParams, response) {
458
+ const { body } = response;
459
+ const key = keyBuilderFromType(luvio, body);
460
+ luvio.storeIngest(key, ingest, body);
461
+ const snapshot = luvio.storeLookup({
462
+ recordId: key,
463
+ node: select(),
464
+ variables: {},
465
+ });
466
+ if (process.env.NODE_ENV !== 'production') {
467
+ if (snapshot.state !== 'Fulfilled') {
468
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
469
+ }
470
+ }
471
+ deepFreeze(snapshot.data);
472
+ return snapshot;
473
+ }
474
+ function createResourceRequest(config) {
475
+ const headers = {};
476
+ return {
477
+ baseUri: '/services/data/v61.0',
478
+ basePath: '/connect/evf/sdk/event',
479
+ method: 'post',
480
+ body: config.body,
481
+ urlParams: {},
482
+ queryParams: {},
483
+ headers,
484
+ priority: 'normal',
485
+ };
486
+ }
487
+
488
+ const adapterName = 'publishEvent';
489
+ const publishEvent_ConfigPropertyMetadata = [
490
+ generateParamConfigMetadata('contextId', true, 2 /* Body */, 0 /* String */),
491
+ generateParamConfigMetadata('feature', true, 2 /* Body */, 0 /* String */),
492
+ generateParamConfigMetadata('name', true, 2 /* Body */, 0 /* String */),
493
+ generateParamConfigMetadata('score', true, 2 /* Body */, 3 /* Integer */),
494
+ generateParamConfigMetadata('type', true, 2 /* Body */, 0 /* String */),
495
+ ];
496
+ const publishEvent_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, publishEvent_ConfigPropertyMetadata);
497
+ const createResourceParams = /*#__PURE__*/ createResourceParams$2(publishEvent_ConfigPropertyMetadata);
498
+ function typeCheckConfig(untrustedConfig) {
499
+ const config = {};
500
+ typeCheckConfig$2(untrustedConfig, config, publishEvent_ConfigPropertyMetadata);
501
+ return config;
502
+ }
503
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
504
+ if (!untrustedIsObject(untrustedConfig)) {
505
+ return null;
506
+ }
507
+ if (process.env.NODE_ENV !== 'production') {
508
+ validateConfig(untrustedConfig, configPropertyNames);
509
+ }
510
+ const config = typeCheckConfig(untrustedConfig);
511
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
512
+ return null;
513
+ }
514
+ return config;
515
+ }
516
+ function buildNetworkSnapshot(luvio, config, options) {
517
+ const resourceParams = createResourceParams(config);
518
+ const request = createResourceRequest(resourceParams);
519
+ return luvio.dispatchResourceRequest(request, options)
520
+ .then((response) => {
521
+ return luvio.handleSuccessResponse(() => {
522
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
523
+ return luvio.storeBroadcast().then(() => snapshot);
524
+ }, () => {
525
+ const cache = new StoreKeyMap();
526
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
527
+ return cache;
528
+ });
529
+ }, (response) => {
530
+ deepFreeze(response);
531
+ throw response;
532
+ });
533
+ }
534
+ const publishEventAdapterFactory = (luvio) => {
535
+ return function publishEvent(untrustedConfig) {
536
+ const config = validateAdapterConfig(untrustedConfig, publishEvent_ConfigPropertyNames);
537
+ // Invalid or incomplete config
538
+ if (config === null) {
539
+ throw new Error('Invalid config for "publishEvent"');
540
+ }
541
+ return buildNetworkSnapshot(luvio, config);
542
+ };
543
+ };
544
+
545
+ let getEventTypes;
546
+ let publishEvent;
547
+ // Imperative GET Adapters
548
+ let getEventTypes_imperative;
549
+ // Adapter Metadata
550
+ const getEventTypesMetadata = { apiFamily: 'evfSdk', name: 'getEventTypes' };
551
+ // Notify Update Available
552
+ function bindExportsTo(luvio) {
553
+ // LDS Adapters
554
+ const getEventTypes_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getEventTypes', getEventTypesAdapterFactory), getEventTypesMetadata);
555
+ function unwrapSnapshotData(factory) {
556
+ const adapter = factory(luvio);
557
+ return (config) => adapter(config).then((snapshot) => snapshot.data);
558
+ }
559
+ return {
560
+ getEventTypes: createWireAdapterConstructor(luvio, getEventTypes_ldsAdapter, getEventTypesMetadata),
561
+ publishEvent: unwrapSnapshotData(publishEventAdapterFactory),
562
+ // Imperative GET Adapters
563
+ getEventTypes_imperative: createImperativeAdapter(luvio, getEventTypes_ldsAdapter, getEventTypesMetadata),
564
+ // Notify Update Availables
565
+ };
566
+ }
567
+ withDefaultLuvio((luvio) => {
568
+ ({ getEventTypes, publishEvent, getEventTypes_imperative } = bindExportsTo(luvio));
569
+ });
570
+
571
+ export { getEventTypes, getEventTypes_imperative, publishEvent };
572
+ // version: 1.285.0-c97dec82e
@@ -0,0 +1,106 @@
1
+ #%RAML 1.0
2
+ securedBy:
3
+ - OAuth2
4
+ title: Salesforce Connect API
5
+ version: '61.0'
6
+ mediaType: application/json
7
+ protocols:
8
+ - https
9
+ baseUri: /services/data/v61.0
10
+ securitySchemes:
11
+ OAuth2:
12
+ type: OAuth 2.0
13
+ settings:
14
+ authorizationUri: https://example.com/oauth/authorize
15
+ accessTokenUri: ''
16
+ authorizationGrants:
17
+ - implicit
18
+ annotationTypes:
19
+ oas-readOnly:
20
+ type: boolean
21
+ allowedTargets: TypeDeclaration
22
+ oas-collectionFormat:
23
+ type: string
24
+ oas-body-name:
25
+ type: string
26
+ allowedTargets: TypeDeclaration
27
+ types:
28
+ EventTypesOutput:
29
+ description: A list of valid event types of the EVF SDK API 1.0 Resource.
30
+ type: object
31
+ properties:
32
+ eventTypes:
33
+ description: The list of valid event types
34
+ type: array
35
+ items:
36
+ type: string
37
+ status:
38
+ description: Get the status of the HTTP response
39
+ type: ResponseStatus
40
+ PublishEventInput:
41
+ description: Input representation for the EVF post ML engagement event
42
+ type: object
43
+ properties:
44
+ contextId:
45
+ description: The event context - the page where the event took place
46
+ type: string
47
+ feature:
48
+ description: The feature/app the event belongs to - of type EVFFeatureEnum
49
+ type: string
50
+ name:
51
+ description: The name of the event i.e. the name of the button clicked, the
52
+ form name that was submitted etc
53
+ type: string
54
+ score:
55
+ description: The event score, i.e. the impact/importance of the event from
56
+ 0 to 100
57
+ type: integer
58
+ type:
59
+ description: The engagement type, i.e. BUTTON_CLICK, HOVER, SCROLL - of type
60
+ EvfEventType
61
+ type: string
62
+ PublishEventOutput:
63
+ description: The output representation of the EVF SDK API 1.0 Resource.
64
+ type: object
65
+ properties:
66
+ status:
67
+ description: Get the status of the HTTP response
68
+ type: ResponseStatus
69
+ ResponseStatus:
70
+ description: The output representation of the Status of the request.
71
+ type: object
72
+ properties:
73
+ code:
74
+ description: get status code
75
+ type: string
76
+ message:
77
+ description: Get Error Message
78
+ type: string
79
+ /connect/evf:
80
+ /sdk:
81
+ /event:
82
+ post:
83
+ displayName: postPublishEvent
84
+ description: Post Resource method to publish events to the EVF Service
85
+ responses:
86
+ '200':
87
+ description: Success
88
+ body:
89
+ application/json:
90
+ type: PublishEventOutput
91
+ body:
92
+ application/json:
93
+ description: the event object of type PublishEventInput
94
+ type: PublishEventInput
95
+ # TODO hand-rolled W-9271732 (removed required: false)
96
+ (oas-body-name): event
97
+ /event-types:
98
+ get:
99
+ displayName: getGetEventTypes
100
+ description: Get the list of valid event types
101
+ responses:
102
+ '200':
103
+ description: Success
104
+ body:
105
+ application/json:
106
+ type: EventTypesOutput