@salesforce/lds-adapters-sales-automation-rules 1.108.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,326 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ (function (global, factory) {
8
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@luvio/engine')) :
9
+ typeof define === 'function' && define.amd ? define(['exports', '@luvio/engine'], factory) :
10
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.salesAutomationRules = {}, global.engine));
11
+ })(this, (function (exports, engine) { 'use strict';
12
+
13
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
14
+ const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
15
+ const { isArray: ArrayIsArray$1 } = Array;
16
+ /**
17
+ * Validates an adapter config is well-formed.
18
+ * @param config The config to validate.
19
+ * @param adapter The adapter validation configuration.
20
+ * @param oneOf The keys the config must contain at least one of.
21
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
22
+ */
23
+ function validateConfig(config, adapter, oneOf) {
24
+ const { displayName } = adapter;
25
+ const { required, optional, unsupported } = adapter.parameters;
26
+ if (config === undefined ||
27
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
28
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
29
+ }
30
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
31
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
32
+ }
33
+ if (unsupported !== undefined &&
34
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
35
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
36
+ }
37
+ const supported = required.concat(optional);
38
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
39
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
40
+ }
41
+ }
42
+ function untrustedIsObject(untrusted) {
43
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
44
+ }
45
+ function areRequiredParametersPresent(config, configPropertyNames) {
46
+ return configPropertyNames.parameters.required.every(req => req in config);
47
+ }
48
+ const keyPrefix = 'sales-automation-rules';
49
+
50
+ const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
51
+ const { isArray: ArrayIsArray } = Array;
52
+ function deepFreeze(value) {
53
+ // No need to freeze primitives
54
+ if (typeof value !== 'object' || value === null) {
55
+ return;
56
+ }
57
+ if (ArrayIsArray(value)) {
58
+ for (let i = 0, len = value.length; i < len; i += 1) {
59
+ deepFreeze(value[i]);
60
+ }
61
+ }
62
+ else {
63
+ const keys = ObjectKeys(value);
64
+ for (let i = 0, len = keys.length; i < len; i += 1) {
65
+ deepFreeze(value[keys[i]]);
66
+ }
67
+ }
68
+ ObjectFreeze(value);
69
+ }
70
+ function createLink(ref) {
71
+ return {
72
+ __ref: engine.serializeStructuredKey(ref),
73
+ };
74
+ }
75
+
76
+ function validate$1(obj, path = 'AutomatedActionApplyReminderInputRepresentation') {
77
+ const v_error = (() => {
78
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
79
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
80
+ }
81
+ if (obj.id !== undefined) {
82
+ const obj_id = obj.id;
83
+ const path_id = path + '.id';
84
+ if (typeof obj_id !== 'string') {
85
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
86
+ }
87
+ }
88
+ })();
89
+ return v_error === undefined ? null : v_error;
90
+ }
91
+
92
+ const VERSION = "fd4b3e3f68670957abe851597ce776bc";
93
+ function validate(obj, path = 'AutomatedActionApplyReminderRepresentation') {
94
+ const v_error = (() => {
95
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
96
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
97
+ }
98
+ const obj_errorCode = obj.errorCode;
99
+ const path_errorCode = path + '.errorCode';
100
+ if (typeof obj_errorCode !== 'string') {
101
+ return new TypeError('Expected "string" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
102
+ }
103
+ const obj_errorMessage = obj.errorMessage;
104
+ const path_errorMessage = path + '.errorMessage';
105
+ if (typeof obj_errorMessage !== 'string') {
106
+ return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
107
+ }
108
+ const obj_isSuccess = obj.isSuccess;
109
+ const path_isSuccess = path + '.isSuccess';
110
+ if (typeof obj_isSuccess !== 'boolean') {
111
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
112
+ }
113
+ const obj_reminderId = obj.reminderId;
114
+ const path_reminderId = path + '.reminderId';
115
+ if (typeof obj_reminderId !== 'string') {
116
+ return new TypeError('Expected "string" but received "' + typeof obj_reminderId + '" (at "' + path_reminderId + '")');
117
+ }
118
+ })();
119
+ return v_error === undefined ? null : v_error;
120
+ }
121
+ const RepresentationType = 'AutomatedActionApplyReminderRepresentation';
122
+ function keyBuilder(luvio, config) {
123
+ return keyPrefix + '::' + RepresentationType + ':' + config.id;
124
+ }
125
+ function keyBuilderFromType(luvio, object) {
126
+ const keyParams = {
127
+ id: object.reminderId
128
+ };
129
+ return keyBuilder(luvio, keyParams);
130
+ }
131
+ function normalize(input, existing, path, luvio, store, timestamp) {
132
+ return input;
133
+ }
134
+ const select$1 = function AutomatedActionApplyReminderRepresentationSelect() {
135
+ return {
136
+ kind: 'Fragment',
137
+ version: VERSION,
138
+ private: [],
139
+ selections: [
140
+ {
141
+ name: 'errorCode',
142
+ kind: 'Scalar'
143
+ },
144
+ {
145
+ name: 'errorMessage',
146
+ kind: 'Scalar'
147
+ },
148
+ {
149
+ name: 'isSuccess',
150
+ kind: 'Scalar'
151
+ },
152
+ {
153
+ name: 'reminderId',
154
+ kind: 'Scalar'
155
+ }
156
+ ]
157
+ };
158
+ };
159
+ function equals(existing, incoming) {
160
+ const existing_isSuccess = existing.isSuccess;
161
+ const incoming_isSuccess = incoming.isSuccess;
162
+ if (!(existing_isSuccess === incoming_isSuccess)) {
163
+ return false;
164
+ }
165
+ const existing_errorCode = existing.errorCode;
166
+ const incoming_errorCode = incoming.errorCode;
167
+ if (!(existing_errorCode === incoming_errorCode)) {
168
+ return false;
169
+ }
170
+ const existing_errorMessage = existing.errorMessage;
171
+ const incoming_errorMessage = incoming.errorMessage;
172
+ if (!(existing_errorMessage === incoming_errorMessage)) {
173
+ return false;
174
+ }
175
+ const existing_reminderId = existing.reminderId;
176
+ const incoming_reminderId = incoming.reminderId;
177
+ if (!(existing_reminderId === incoming_reminderId)) {
178
+ return false;
179
+ }
180
+ return true;
181
+ }
182
+ const ingest = function AutomatedActionApplyReminderRepresentationIngest(input, path, luvio, store, timestamp) {
183
+ if (process.env.NODE_ENV !== 'production') {
184
+ const validateError = validate(input);
185
+ if (validateError !== null) {
186
+ throw validateError;
187
+ }
188
+ }
189
+ const key = keyBuilderFromType(luvio, input);
190
+ const existingRecord = store.readEntry(key);
191
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 1000;
192
+ let incomingRecord = normalize(input, store.readEntry(key), {
193
+ fullPath: key,
194
+ parent: path.parent,
195
+ propertyName: path.propertyName,
196
+ ttl: ttlToUse
197
+ });
198
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
199
+ luvio.storePublish(key, incomingRecord);
200
+ }
201
+ if (ttlToUse !== undefined) {
202
+ const storeMetadataParams = {
203
+ ttl: ttlToUse,
204
+ namespace: "sales-automation-rules",
205
+ version: VERSION,
206
+ representationName: RepresentationType,
207
+ };
208
+ luvio.publishStoreMetadata(key, storeMetadataParams);
209
+ }
210
+ return createLink(key);
211
+ };
212
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
213
+ const rootKeySet = new engine.StoreKeyMap();
214
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
215
+ const rootKey = keyBuilderFromType(luvio, input);
216
+ rootKeySet.set(rootKey, {
217
+ namespace: keyPrefix,
218
+ representationName: RepresentationType,
219
+ mergeable: false
220
+ });
221
+ return rootKeySet;
222
+ }
223
+
224
+ function select(luvio, params) {
225
+ return select$1();
226
+ }
227
+ function getResponseCacheKeys(luvio, resourceParams, response) {
228
+ return getTypeCacheKeys(luvio, response);
229
+ }
230
+ function ingestSuccess(luvio, resourceParams, response) {
231
+ const { body } = response;
232
+ const key = keyBuilderFromType(luvio, body);
233
+ luvio.storeIngest(key, ingest, body);
234
+ const snapshot = luvio.storeLookup({
235
+ recordId: key,
236
+ node: select(),
237
+ variables: {},
238
+ });
239
+ if (process.env.NODE_ENV !== 'production') {
240
+ if (snapshot.state !== 'Fulfilled') {
241
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
242
+ }
243
+ }
244
+ return snapshot;
245
+ }
246
+ function createResourceRequest(config) {
247
+ const headers = {};
248
+ return {
249
+ baseUri: '/services/data/v58.0',
250
+ basePath: '/connect/automated-actions/reminder/apply',
251
+ method: 'put',
252
+ body: config.body,
253
+ urlParams: {},
254
+ queryParams: {},
255
+ headers,
256
+ priority: 'normal',
257
+ };
258
+ }
259
+
260
+ const applyReminder_ConfigPropertyNames = {
261
+ displayName: 'applyReminder',
262
+ parameters: {
263
+ required: ['ApplyReminderInput'],
264
+ optional: []
265
+ }
266
+ };
267
+ function createResourceParams(config) {
268
+ const resourceParams = {
269
+ body: {
270
+ ApplyReminderInput: config.ApplyReminderInput
271
+ }
272
+ };
273
+ return resourceParams;
274
+ }
275
+ function typeCheckConfig(untrustedConfig) {
276
+ const config = {};
277
+ const untrustedConfig_ApplyReminderInput = untrustedConfig.ApplyReminderInput;
278
+ const referenceAutomatedActionApplyReminderInputRepresentationValidationError = validate$1(untrustedConfig_ApplyReminderInput);
279
+ if (referenceAutomatedActionApplyReminderInputRepresentationValidationError === null) {
280
+ config.ApplyReminderInput = untrustedConfig_ApplyReminderInput;
281
+ }
282
+ return config;
283
+ }
284
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
285
+ if (!untrustedIsObject(untrustedConfig)) {
286
+ return null;
287
+ }
288
+ if (process.env.NODE_ENV !== 'production') {
289
+ validateConfig(untrustedConfig, configPropertyNames);
290
+ }
291
+ const config = typeCheckConfig(untrustedConfig);
292
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
293
+ return null;
294
+ }
295
+ return config;
296
+ }
297
+ function buildNetworkSnapshot(luvio, config, options) {
298
+ const resourceParams = createResourceParams(config);
299
+ const request = createResourceRequest(resourceParams);
300
+ return luvio.dispatchResourceRequest(request, options)
301
+ .then((response) => {
302
+ return luvio.handleSuccessResponse(() => {
303
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
304
+ return luvio.storeBroadcast().then(() => snapshot);
305
+ }, () => getResponseCacheKeys(luvio, resourceParams, response.body));
306
+ }, (response) => {
307
+ deepFreeze(response);
308
+ throw response;
309
+ });
310
+ }
311
+ const applyReminderAdapterFactory = (luvio) => {
312
+ return function applyReminder(untrustedConfig) {
313
+ const config = validateAdapterConfig(untrustedConfig, applyReminder_ConfigPropertyNames);
314
+ // Invalid or incomplete config
315
+ if (config === null) {
316
+ throw new Error('Invalid config for "applyReminder"');
317
+ }
318
+ return buildNetworkSnapshot(luvio, config);
319
+ };
320
+ };
321
+
322
+ exports.applyReminderAdapterFactory = applyReminderAdapterFactory;
323
+
324
+ Object.defineProperty(exports, '__esModule', { value: true });
325
+
326
+ }));
@@ -0,0 +1,328 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ (function (global, factory) {
8
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@luvio/engine')) :
9
+ typeof define === 'function' && define.amd ? define(['exports', '@luvio/engine'], factory) :
10
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.salesAutomationRules = {}, global.engine));
11
+ })(this, (function (exports, engine) { 'use strict';
12
+
13
+ var ObjectPrototypeHasOwnProperty = Object.prototype.hasOwnProperty;
14
+ var ObjectKeys$1 = Object.keys;
15
+ var ArrayIsArray$1 = Array.isArray;
16
+ /**
17
+ * Validates an adapter config is well-formed.
18
+ * @param config The config to validate.
19
+ * @param adapter The adapter validation configuration.
20
+ * @param oneOf The keys the config must contain at least one of.
21
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
22
+ */
23
+ function validateConfig(config, adapter, oneOf) {
24
+ var displayName = adapter.displayName;
25
+ var _a = adapter.parameters, required = _a.required, optional = _a.optional, unsupported = _a.unsupported;
26
+ if (config === undefined ||
27
+ required.every(function (req) { return ObjectPrototypeHasOwnProperty.call(config, req); }) === false) {
28
+ throw new TypeError("adapter ".concat(displayName, " configuration must specify ").concat(required.sort().join(', ')));
29
+ }
30
+ if (oneOf && oneOf.some(function (req) { return ObjectPrototypeHasOwnProperty.call(config, req); }) === false) {
31
+ throw new TypeError("adapter ".concat(displayName, " configuration must specify one of ").concat(oneOf.sort().join(', ')));
32
+ }
33
+ if (unsupported !== undefined &&
34
+ unsupported.some(function (req) { return ObjectPrototypeHasOwnProperty.call(config, req); })) {
35
+ throw new TypeError("adapter ".concat(displayName, " does not yet support ").concat(unsupported.sort().join(', ')));
36
+ }
37
+ var supported = required.concat(optional);
38
+ if (ObjectKeys$1(config).some(function (key) { return !supported.includes(key); })) {
39
+ throw new TypeError("adapter ".concat(displayName, " configuration supports only ").concat(supported.sort().join(', ')));
40
+ }
41
+ }
42
+ function untrustedIsObject(untrusted) {
43
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
44
+ }
45
+ function areRequiredParametersPresent(config, configPropertyNames) {
46
+ return configPropertyNames.parameters.required.every(function (req) { return req in config; });
47
+ }
48
+ var keyPrefix = 'sales-automation-rules';
49
+
50
+ var ObjectFreeze = Object.freeze, ObjectKeys = Object.keys;
51
+ var ArrayIsArray = Array.isArray;
52
+ function deepFreeze(value) {
53
+ // No need to freeze primitives
54
+ if (typeof value !== 'object' || value === null) {
55
+ return;
56
+ }
57
+ if (ArrayIsArray(value)) {
58
+ for (var i = 0, len = value.length; i < len; i += 1) {
59
+ deepFreeze(value[i]);
60
+ }
61
+ }
62
+ else {
63
+ var keys = ObjectKeys(value);
64
+ for (var i = 0, len = keys.length; i < len; i += 1) {
65
+ deepFreeze(value[keys[i]]);
66
+ }
67
+ }
68
+ ObjectFreeze(value);
69
+ }
70
+ function createLink(ref) {
71
+ return {
72
+ __ref: engine.serializeStructuredKey(ref),
73
+ };
74
+ }
75
+
76
+ function validate$1(obj, path) {
77
+ if (path === void 0) { path = 'AutomatedActionApplyReminderInputRepresentation'; }
78
+ var v_error = (function () {
79
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
80
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
81
+ }
82
+ if (obj.id !== undefined) {
83
+ var obj_id = obj.id;
84
+ var path_id = path + '.id';
85
+ if (typeof obj_id !== 'string') {
86
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
87
+ }
88
+ }
89
+ })();
90
+ return v_error === undefined ? null : v_error;
91
+ }
92
+
93
+ var VERSION = "fd4b3e3f68670957abe851597ce776bc";
94
+ function validate(obj, path) {
95
+ if (path === void 0) { path = 'AutomatedActionApplyReminderRepresentation'; }
96
+ var v_error = (function () {
97
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
98
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
99
+ }
100
+ var obj_errorCode = obj.errorCode;
101
+ var path_errorCode = path + '.errorCode';
102
+ if (typeof obj_errorCode !== 'string') {
103
+ return new TypeError('Expected "string" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
104
+ }
105
+ var obj_errorMessage = obj.errorMessage;
106
+ var path_errorMessage = path + '.errorMessage';
107
+ if (typeof obj_errorMessage !== 'string') {
108
+ return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
109
+ }
110
+ var obj_isSuccess = obj.isSuccess;
111
+ var path_isSuccess = path + '.isSuccess';
112
+ if (typeof obj_isSuccess !== 'boolean') {
113
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
114
+ }
115
+ var obj_reminderId = obj.reminderId;
116
+ var path_reminderId = path + '.reminderId';
117
+ if (typeof obj_reminderId !== 'string') {
118
+ return new TypeError('Expected "string" but received "' + typeof obj_reminderId + '" (at "' + path_reminderId + '")');
119
+ }
120
+ })();
121
+ return v_error === undefined ? null : v_error;
122
+ }
123
+ var RepresentationType = 'AutomatedActionApplyReminderRepresentation';
124
+ function keyBuilder(luvio, config) {
125
+ return keyPrefix + '::' + RepresentationType + ':' + config.id;
126
+ }
127
+ function keyBuilderFromType(luvio, object) {
128
+ var keyParams = {
129
+ id: object.reminderId
130
+ };
131
+ return keyBuilder(luvio, keyParams);
132
+ }
133
+ function normalize(input, existing, path, luvio, store, timestamp) {
134
+ return input;
135
+ }
136
+ var select$1 = function AutomatedActionApplyReminderRepresentationSelect() {
137
+ return {
138
+ kind: 'Fragment',
139
+ version: VERSION,
140
+ private: [],
141
+ selections: [
142
+ {
143
+ name: 'errorCode',
144
+ kind: 'Scalar'
145
+ },
146
+ {
147
+ name: 'errorMessage',
148
+ kind: 'Scalar'
149
+ },
150
+ {
151
+ name: 'isSuccess',
152
+ kind: 'Scalar'
153
+ },
154
+ {
155
+ name: 'reminderId',
156
+ kind: 'Scalar'
157
+ }
158
+ ]
159
+ };
160
+ };
161
+ function equals(existing, incoming) {
162
+ var existing_isSuccess = existing.isSuccess;
163
+ var incoming_isSuccess = incoming.isSuccess;
164
+ if (!(existing_isSuccess === incoming_isSuccess)) {
165
+ return false;
166
+ }
167
+ var existing_errorCode = existing.errorCode;
168
+ var incoming_errorCode = incoming.errorCode;
169
+ if (!(existing_errorCode === incoming_errorCode)) {
170
+ return false;
171
+ }
172
+ var existing_errorMessage = existing.errorMessage;
173
+ var incoming_errorMessage = incoming.errorMessage;
174
+ if (!(existing_errorMessage === incoming_errorMessage)) {
175
+ return false;
176
+ }
177
+ var existing_reminderId = existing.reminderId;
178
+ var incoming_reminderId = incoming.reminderId;
179
+ if (!(existing_reminderId === incoming_reminderId)) {
180
+ return false;
181
+ }
182
+ return true;
183
+ }
184
+ var ingest = function AutomatedActionApplyReminderRepresentationIngest(input, path, luvio, store, timestamp) {
185
+ if (process.env.NODE_ENV !== 'production') {
186
+ var validateError = validate(input);
187
+ if (validateError !== null) {
188
+ throw validateError;
189
+ }
190
+ }
191
+ var key = keyBuilderFromType(luvio, input);
192
+ var existingRecord = store.readEntry(key);
193
+ var ttlToUse = path.ttl !== undefined ? path.ttl : 1000;
194
+ var incomingRecord = normalize(input, store.readEntry(key), {
195
+ fullPath: key,
196
+ parent: path.parent,
197
+ propertyName: path.propertyName,
198
+ ttl: ttlToUse
199
+ });
200
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
201
+ luvio.storePublish(key, incomingRecord);
202
+ }
203
+ if (ttlToUse !== undefined) {
204
+ var storeMetadataParams = {
205
+ ttl: ttlToUse,
206
+ namespace: "sales-automation-rules",
207
+ version: VERSION,
208
+ representationName: RepresentationType,
209
+ };
210
+ luvio.publishStoreMetadata(key, storeMetadataParams);
211
+ }
212
+ return createLink(key);
213
+ };
214
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
215
+ var rootKeySet = new engine.StoreKeyMap();
216
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
217
+ var rootKey = keyBuilderFromType(luvio, input);
218
+ rootKeySet.set(rootKey, {
219
+ namespace: keyPrefix,
220
+ representationName: RepresentationType,
221
+ mergeable: false
222
+ });
223
+ return rootKeySet;
224
+ }
225
+
226
+ function select(luvio, params) {
227
+ return select$1();
228
+ }
229
+ function getResponseCacheKeys(luvio, resourceParams, response) {
230
+ return getTypeCacheKeys(luvio, response);
231
+ }
232
+ function ingestSuccess(luvio, resourceParams, response) {
233
+ var body = response.body;
234
+ var key = keyBuilderFromType(luvio, body);
235
+ luvio.storeIngest(key, ingest, body);
236
+ var snapshot = luvio.storeLookup({
237
+ recordId: key,
238
+ node: select(),
239
+ variables: {},
240
+ });
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
+ return snapshot;
247
+ }
248
+ function createResourceRequest(config) {
249
+ var headers = {};
250
+ return {
251
+ baseUri: '/services/data/v58.0',
252
+ basePath: '/connect/automated-actions/reminder/apply',
253
+ method: 'put',
254
+ body: config.body,
255
+ urlParams: {},
256
+ queryParams: {},
257
+ headers: headers,
258
+ priority: 'normal',
259
+ };
260
+ }
261
+
262
+ var applyReminder_ConfigPropertyNames = {
263
+ displayName: 'applyReminder',
264
+ parameters: {
265
+ required: ['ApplyReminderInput'],
266
+ optional: []
267
+ }
268
+ };
269
+ function createResourceParams(config) {
270
+ var resourceParams = {
271
+ body: {
272
+ ApplyReminderInput: config.ApplyReminderInput
273
+ }
274
+ };
275
+ return resourceParams;
276
+ }
277
+ function typeCheckConfig(untrustedConfig) {
278
+ var config = {};
279
+ var untrustedConfig_ApplyReminderInput = untrustedConfig.ApplyReminderInput;
280
+ var referenceAutomatedActionApplyReminderInputRepresentationValidationError = validate$1(untrustedConfig_ApplyReminderInput);
281
+ if (referenceAutomatedActionApplyReminderInputRepresentationValidationError === null) {
282
+ config.ApplyReminderInput = untrustedConfig_ApplyReminderInput;
283
+ }
284
+ return config;
285
+ }
286
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
287
+ if (!untrustedIsObject(untrustedConfig)) {
288
+ return null;
289
+ }
290
+ if (process.env.NODE_ENV !== 'production') {
291
+ validateConfig(untrustedConfig, configPropertyNames);
292
+ }
293
+ var config = typeCheckConfig(untrustedConfig);
294
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
295
+ return null;
296
+ }
297
+ return config;
298
+ }
299
+ function buildNetworkSnapshot(luvio, config, options) {
300
+ var resourceParams = createResourceParams(config);
301
+ var request = createResourceRequest(resourceParams);
302
+ return luvio.dispatchResourceRequest(request, options)
303
+ .then(function (response) {
304
+ return luvio.handleSuccessResponse(function () {
305
+ var snapshot = ingestSuccess(luvio, resourceParams, response);
306
+ return luvio.storeBroadcast().then(function () { return snapshot; });
307
+ }, function () { return getResponseCacheKeys(luvio, resourceParams, response.body); });
308
+ }, function (response) {
309
+ deepFreeze(response);
310
+ throw response;
311
+ });
312
+ }
313
+ var applyReminderAdapterFactory = function (luvio) {
314
+ return function applyReminder(untrustedConfig) {
315
+ var config = validateAdapterConfig(untrustedConfig, applyReminder_ConfigPropertyNames);
316
+ // Invalid or incomplete config
317
+ if (config === null) {
318
+ throw new Error('Invalid config for "applyReminder"');
319
+ }
320
+ return buildNetworkSnapshot(luvio, config);
321
+ };
322
+ };
323
+
324
+ exports.applyReminderAdapterFactory = applyReminderAdapterFactory;
325
+
326
+ Object.defineProperty(exports, '__esModule', { value: true });
327
+
328
+ }));