@salesforce/lds-adapters-community-microbatching 1.124.2 → 1.124.4

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.d.ts CHANGED
@@ -1 +1 @@
1
- export * from '../dist/types/src/generated/artifacts/sfdc';
1
+ export * from '../dist/es/es2018/types/src/generated/artifacts/sfdc';
package/sfdc/index.js CHANGED
@@ -15,323 +15,323 @@
15
15
  import { withDefaultLuvio } from 'force/ldsEngine';
16
16
  import { serializeStructuredKey, StoreKeyMap } from 'force/luvioEngine';
17
17
 
18
- const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
19
- const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
20
- const { isArray: ArrayIsArray$1 } = Array;
21
- /**
22
- * Validates an adapter config is well-formed.
23
- * @param config The config to validate.
24
- * @param adapter The adapter validation configuration.
25
- * @param oneOf The keys the config must contain at least one of.
26
- * @throws A TypeError if config doesn't satisfy the adapter's config validation.
27
- */
28
- function validateConfig(config, adapter, oneOf) {
29
- const { displayName } = adapter;
30
- const { required, optional, unsupported } = adapter.parameters;
31
- if (config === undefined ||
32
- required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
33
- throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
34
- }
35
- if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
36
- throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
37
- }
38
- if (unsupported !== undefined &&
39
- unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
40
- throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
41
- }
42
- const supported = required.concat(optional);
43
- if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
44
- throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
45
- }
46
- }
47
- function untrustedIsObject(untrusted) {
48
- return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
49
- }
50
- function areRequiredParametersPresent(config, configPropertyNames) {
51
- return configPropertyNames.parameters.required.every(req => req in config);
52
- }
18
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
19
+ const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
20
+ const { isArray: ArrayIsArray$1 } = Array;
21
+ /**
22
+ * Validates an adapter config is well-formed.
23
+ * @param config The config to validate.
24
+ * @param adapter The adapter validation configuration.
25
+ * @param oneOf The keys the config must contain at least one of.
26
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
27
+ */
28
+ function validateConfig(config, adapter, oneOf) {
29
+ const { displayName } = adapter;
30
+ const { required, optional, unsupported } = adapter.parameters;
31
+ if (config === undefined ||
32
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
33
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
34
+ }
35
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
36
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
37
+ }
38
+ if (unsupported !== undefined &&
39
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
40
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
41
+ }
42
+ const supported = required.concat(optional);
43
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
44
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
45
+ }
46
+ }
47
+ function untrustedIsObject(untrusted) {
48
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
49
+ }
50
+ function areRequiredParametersPresent(config, configPropertyNames) {
51
+ return configPropertyNames.parameters.required.every(req => req in config);
52
+ }
53
53
  const keyPrefix = 'microbatching';
54
54
 
55
- const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
56
- const { isArray: ArrayIsArray } = Array;
57
- function deepFreeze(value) {
58
- // No need to freeze primitives
59
- if (typeof value !== 'object' || value === null) {
60
- return;
61
- }
62
- if (ArrayIsArray(value)) {
63
- for (let i = 0, len = value.length; i < len; i += 1) {
64
- deepFreeze(value[i]);
65
- }
66
- }
67
- else {
68
- const keys = ObjectKeys(value);
69
- for (let i = 0, len = keys.length; i < len; i += 1) {
70
- deepFreeze(value[keys[i]]);
71
- }
72
- }
73
- ObjectFreeze(value);
74
- }
75
- function createLink(ref) {
76
- return {
77
- __ref: serializeStructuredKey(ref),
78
- };
55
+ const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
56
+ const { isArray: ArrayIsArray } = Array;
57
+ function deepFreeze(value) {
58
+ // No need to freeze primitives
59
+ if (typeof value !== 'object' || value === null) {
60
+ return;
61
+ }
62
+ if (ArrayIsArray(value)) {
63
+ for (let i = 0, len = value.length; i < len; i += 1) {
64
+ deepFreeze(value[i]);
65
+ }
66
+ }
67
+ else {
68
+ const keys = ObjectKeys(value);
69
+ for (let i = 0, len = keys.length; i < len; i += 1) {
70
+ deepFreeze(value[keys[i]]);
71
+ }
72
+ }
73
+ ObjectFreeze(value);
74
+ }
75
+ function createLink(ref) {
76
+ return {
77
+ __ref: serializeStructuredKey(ref),
78
+ };
79
79
  }
80
80
 
81
- function validate$1(obj, path = 'MicrobatchingIngestionInputRepresentation') {
82
- const v_error = (() => {
83
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
84
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
85
- }
86
- if (obj.groupBy !== undefined) {
87
- const obj_groupBy = obj.groupBy;
88
- const path_groupBy = path + '.groupBy';
89
- if (typeof obj_groupBy !== 'string') {
90
- return new TypeError('Expected "string" but received "' + typeof obj_groupBy + '" (at "' + path_groupBy + '")');
91
- }
92
- }
93
- if (obj.keyPrefix !== undefined) {
94
- const obj_keyPrefix = obj.keyPrefix;
95
- const path_keyPrefix = path + '.keyPrefix';
96
- if (typeof obj_keyPrefix !== 'string') {
97
- return new TypeError('Expected "string" but received "' + typeof obj_keyPrefix + '" (at "' + path_keyPrefix + '")');
98
- }
99
- }
100
- const obj_processType = obj.processType;
101
- const path_processType = path + '.processType';
102
- if (typeof obj_processType !== 'string') {
103
- return new TypeError('Expected "string" but received "' + typeof obj_processType + '" (at "' + path_processType + '")');
104
- }
105
- const obj_requestBody = obj.requestBody;
106
- const path_requestBody = path + '.requestBody';
107
- if (typeof obj_requestBody !== 'object' || ArrayIsArray(obj_requestBody) || obj_requestBody === null) {
108
- return new TypeError('Expected "object" but received "' + typeof obj_requestBody + '" (at "' + path_requestBody + '")');
109
- }
110
- const obj_requestBody_keys = ObjectKeys(obj_requestBody);
111
- for (let i = 0; i < obj_requestBody_keys.length; i++) {
112
- const key = obj_requestBody_keys[i];
113
- const obj_requestBody_prop = obj_requestBody[key];
114
- const path_requestBody_prop = path_requestBody + '["' + key + '"]';
115
- if (obj_requestBody_prop === undefined) {
116
- return new TypeError('Expected "defined" but received "' + typeof obj_requestBody_prop + '" (at "' + path_requestBody_prop + '")');
117
- }
118
- }
119
- })();
120
- return v_error === undefined ? null : v_error;
81
+ function validate$1(obj, path = 'MicrobatchingIngestionInputRepresentation') {
82
+ const v_error = (() => {
83
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
84
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
85
+ }
86
+ if (obj.groupBy !== undefined) {
87
+ const obj_groupBy = obj.groupBy;
88
+ const path_groupBy = path + '.groupBy';
89
+ if (typeof obj_groupBy !== 'string') {
90
+ return new TypeError('Expected "string" but received "' + typeof obj_groupBy + '" (at "' + path_groupBy + '")');
91
+ }
92
+ }
93
+ if (obj.keyPrefix !== undefined) {
94
+ const obj_keyPrefix = obj.keyPrefix;
95
+ const path_keyPrefix = path + '.keyPrefix';
96
+ if (typeof obj_keyPrefix !== 'string') {
97
+ return new TypeError('Expected "string" but received "' + typeof obj_keyPrefix + '" (at "' + path_keyPrefix + '")');
98
+ }
99
+ }
100
+ const obj_processType = obj.processType;
101
+ const path_processType = path + '.processType';
102
+ if (typeof obj_processType !== 'string') {
103
+ return new TypeError('Expected "string" but received "' + typeof obj_processType + '" (at "' + path_processType + '")');
104
+ }
105
+ const obj_requestBody = obj.requestBody;
106
+ const path_requestBody = path + '.requestBody';
107
+ if (typeof obj_requestBody !== 'object' || ArrayIsArray(obj_requestBody) || obj_requestBody === null) {
108
+ return new TypeError('Expected "object" but received "' + typeof obj_requestBody + '" (at "' + path_requestBody + '")');
109
+ }
110
+ const obj_requestBody_keys = ObjectKeys(obj_requestBody);
111
+ for (let i = 0; i < obj_requestBody_keys.length; i++) {
112
+ const key = obj_requestBody_keys[i];
113
+ const obj_requestBody_prop = obj_requestBody[key];
114
+ const path_requestBody_prop = path_requestBody + '["' + key + '"]';
115
+ if (obj_requestBody_prop === undefined) {
116
+ return new TypeError('Expected "defined" but received "' + typeof obj_requestBody_prop + '" (at "' + path_requestBody_prop + '")');
117
+ }
118
+ }
119
+ })();
120
+ return v_error === undefined ? null : v_error;
121
121
  }
122
122
 
123
- const TTL = 100;
124
- const VERSION = "d9a668888b418883dcdd91e33b218549";
125
- function validate(obj, path = 'MicrobatchingIngestionOutputRepresentation') {
126
- const v_error = (() => {
127
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
128
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
129
- }
130
- const obj_recordUUID = obj.recordUUID;
131
- const path_recordUUID = path + '.recordUUID';
132
- if (typeof obj_recordUUID !== 'string') {
133
- return new TypeError('Expected "string" but received "' + typeof obj_recordUUID + '" (at "' + path_recordUUID + '")');
134
- }
135
- })();
136
- return v_error === undefined ? null : v_error;
137
- }
138
- const RepresentationType = 'MicrobatchingIngestionOutputRepresentation';
139
- function keyBuilder(luvio, config) {
140
- return keyPrefix + '::' + RepresentationType + ':' + config.recordUUID;
141
- }
142
- function keyBuilderFromType(luvio, object) {
143
- const keyParams = {
144
- recordUUID: object.recordUUID
145
- };
146
- return keyBuilder(luvio, keyParams);
147
- }
148
- function normalize(input, existing, path, luvio, store, timestamp) {
149
- return input;
150
- }
151
- const select$1 = function MicrobatchingIngestionOutputRepresentationSelect() {
152
- return {
153
- kind: 'Fragment',
154
- version: VERSION,
155
- private: [],
156
- selections: [
157
- {
158
- name: 'recordUUID',
159
- kind: 'Scalar'
160
- }
161
- ]
162
- };
163
- };
164
- function equals(existing, incoming) {
165
- const existing_recordUUID = existing.recordUUID;
166
- const incoming_recordUUID = incoming.recordUUID;
167
- if (!(existing_recordUUID === incoming_recordUUID)) {
168
- return false;
169
- }
170
- return true;
171
- }
172
- const ingest = function MicrobatchingIngestionOutputRepresentationIngest(input, path, luvio, store, timestamp) {
173
- if (process.env.NODE_ENV !== 'production') {
174
- const validateError = validate(input);
175
- if (validateError !== null) {
176
- throw validateError;
177
- }
178
- }
179
- const key = keyBuilderFromType(luvio, input);
180
- const existingRecord = store.readEntry(key);
181
- const ttlToUse = TTL;
182
- let incomingRecord = normalize(input, store.readEntry(key), {
183
- fullPath: key,
184
- parent: path.parent,
185
- propertyName: path.propertyName,
186
- ttl: ttlToUse
187
- });
188
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
189
- luvio.storePublish(key, incomingRecord);
190
- }
191
- {
192
- const storeMetadataParams = {
193
- ttl: ttlToUse,
194
- namespace: "microbatching",
195
- version: VERSION,
196
- representationName: RepresentationType,
197
- };
198
- luvio.publishStoreMetadata(key, storeMetadataParams);
199
- }
200
- return createLink(key);
201
- };
202
- function getTypeCacheKeys(luvio, input, fullPathFactory) {
203
- const rootKeySet = new StoreKeyMap();
204
- // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
205
- const rootKey = keyBuilderFromType(luvio, input);
206
- rootKeySet.set(rootKey, {
207
- namespace: keyPrefix,
208
- representationName: RepresentationType,
209
- mergeable: false
210
- });
211
- return rootKeySet;
123
+ const TTL = 100;
124
+ const VERSION = "d9a668888b418883dcdd91e33b218549";
125
+ function validate(obj, path = 'MicrobatchingIngestionOutputRepresentation') {
126
+ const v_error = (() => {
127
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
128
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
129
+ }
130
+ const obj_recordUUID = obj.recordUUID;
131
+ const path_recordUUID = path + '.recordUUID';
132
+ if (typeof obj_recordUUID !== 'string') {
133
+ return new TypeError('Expected "string" but received "' + typeof obj_recordUUID + '" (at "' + path_recordUUID + '")');
134
+ }
135
+ })();
136
+ return v_error === undefined ? null : v_error;
137
+ }
138
+ const RepresentationType = 'MicrobatchingIngestionOutputRepresentation';
139
+ function keyBuilder(luvio, config) {
140
+ return keyPrefix + '::' + RepresentationType + ':' + config.recordUUID;
141
+ }
142
+ function keyBuilderFromType(luvio, object) {
143
+ const keyParams = {
144
+ recordUUID: object.recordUUID
145
+ };
146
+ return keyBuilder(luvio, keyParams);
147
+ }
148
+ function normalize(input, existing, path, luvio, store, timestamp) {
149
+ return input;
150
+ }
151
+ const select$1 = function MicrobatchingIngestionOutputRepresentationSelect() {
152
+ return {
153
+ kind: 'Fragment',
154
+ version: VERSION,
155
+ private: [],
156
+ selections: [
157
+ {
158
+ name: 'recordUUID',
159
+ kind: 'Scalar'
160
+ }
161
+ ]
162
+ };
163
+ };
164
+ function equals(existing, incoming) {
165
+ const existing_recordUUID = existing.recordUUID;
166
+ const incoming_recordUUID = incoming.recordUUID;
167
+ if (!(existing_recordUUID === incoming_recordUUID)) {
168
+ return false;
169
+ }
170
+ return true;
171
+ }
172
+ const ingest = function MicrobatchingIngestionOutputRepresentationIngest(input, path, luvio, store, timestamp) {
173
+ if (process.env.NODE_ENV !== 'production') {
174
+ const validateError = validate(input);
175
+ if (validateError !== null) {
176
+ throw validateError;
177
+ }
178
+ }
179
+ const key = keyBuilderFromType(luvio, input);
180
+ const existingRecord = store.readEntry(key);
181
+ const ttlToUse = TTL;
182
+ let incomingRecord = normalize(input, store.readEntry(key), {
183
+ fullPath: key,
184
+ parent: path.parent,
185
+ propertyName: path.propertyName,
186
+ ttl: ttlToUse
187
+ });
188
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
189
+ luvio.storePublish(key, incomingRecord);
190
+ }
191
+ {
192
+ const storeMetadataParams = {
193
+ ttl: ttlToUse,
194
+ namespace: "microbatching",
195
+ version: VERSION,
196
+ representationName: RepresentationType,
197
+ };
198
+ luvio.publishStoreMetadata(key, storeMetadataParams);
199
+ }
200
+ return createLink(key);
201
+ };
202
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
203
+ const rootKeySet = new StoreKeyMap();
204
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
205
+ const rootKey = keyBuilderFromType(luvio, input);
206
+ rootKeySet.set(rootKey, {
207
+ namespace: keyPrefix,
208
+ representationName: RepresentationType,
209
+ mergeable: false
210
+ });
211
+ return rootKeySet;
212
212
  }
213
213
 
214
- function select(luvio, params) {
215
- return select$1();
216
- }
217
- function getResponseCacheKeys(luvio, resourceParams, response) {
218
- return getTypeCacheKeys(luvio, response);
219
- }
220
- function ingestSuccess(luvio, resourceParams, response) {
221
- const { body } = response;
222
- const key = keyBuilderFromType(luvio, body);
223
- luvio.storeIngest(key, ingest, body);
224
- const snapshot = luvio.storeLookup({
225
- recordId: key,
226
- node: select(),
227
- variables: {},
228
- });
229
- if (process.env.NODE_ENV !== 'production') {
230
- if (snapshot.state !== 'Fulfilled') {
231
- throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
232
- }
233
- }
234
- return snapshot;
235
- }
236
- function createResourceRequest(config) {
237
- const headers = {};
238
- return {
239
- baseUri: '/services/data/v58.0',
240
- basePath: '/connect/communities/' + config.urlParams.communityId + '/microbatching',
241
- method: 'post',
242
- body: config.body,
243
- urlParams: config.urlParams,
244
- queryParams: {},
245
- headers,
246
- priority: 'normal',
247
- };
214
+ function select(luvio, params) {
215
+ return select$1();
216
+ }
217
+ function getResponseCacheKeys(luvio, resourceParams, response) {
218
+ return getTypeCacheKeys(luvio, response);
219
+ }
220
+ function ingestSuccess(luvio, resourceParams, response) {
221
+ const { body } = response;
222
+ const key = keyBuilderFromType(luvio, body);
223
+ luvio.storeIngest(key, ingest, body);
224
+ const snapshot = luvio.storeLookup({
225
+ recordId: key,
226
+ node: select(),
227
+ variables: {},
228
+ });
229
+ if (process.env.NODE_ENV !== 'production') {
230
+ if (snapshot.state !== 'Fulfilled') {
231
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
232
+ }
233
+ }
234
+ return snapshot;
235
+ }
236
+ function createResourceRequest(config) {
237
+ const headers = {};
238
+ return {
239
+ baseUri: '/services/data/v58.0',
240
+ basePath: '/connect/communities/' + config.urlParams.communityId + '/microbatching',
241
+ method: 'post',
242
+ body: config.body,
243
+ urlParams: config.urlParams,
244
+ queryParams: {},
245
+ headers,
246
+ priority: 'normal',
247
+ };
248
248
  }
249
249
 
250
- const ingestRecord_ConfigPropertyNames = {
251
- displayName: 'ingestRecord',
252
- parameters: {
253
- required: ['communityId', 'requestIngestionInput'],
254
- optional: []
255
- }
256
- };
257
- function createResourceParams(config) {
258
- const resourceParams = {
259
- urlParams: {
260
- communityId: config.communityId
261
- },
262
- body: {
263
- requestIngestionInput: config.requestIngestionInput
264
- }
265
- };
266
- return resourceParams;
267
- }
268
- function typeCheckConfig(untrustedConfig) {
269
- const config = {};
270
- const untrustedConfig_communityId = untrustedConfig.communityId;
271
- if (typeof untrustedConfig_communityId === 'string') {
272
- config.communityId = untrustedConfig_communityId;
273
- }
274
- const untrustedConfig_requestIngestionInput = untrustedConfig.requestIngestionInput;
275
- const referenceMicrobatchingIngestionInputRepresentationValidationError = validate$1(untrustedConfig_requestIngestionInput);
276
- if (referenceMicrobatchingIngestionInputRepresentationValidationError === null) {
277
- config.requestIngestionInput = untrustedConfig_requestIngestionInput;
278
- }
279
- return config;
280
- }
281
- function validateAdapterConfig(untrustedConfig, configPropertyNames) {
282
- if (!untrustedIsObject(untrustedConfig)) {
283
- return null;
284
- }
285
- if (process.env.NODE_ENV !== 'production') {
286
- validateConfig(untrustedConfig, configPropertyNames);
287
- }
288
- const config = typeCheckConfig(untrustedConfig);
289
- if (!areRequiredParametersPresent(config, configPropertyNames)) {
290
- return null;
291
- }
292
- return config;
293
- }
294
- function buildNetworkSnapshot(luvio, config, options) {
295
- const resourceParams = createResourceParams(config);
296
- const request = createResourceRequest(resourceParams);
297
- return luvio.dispatchResourceRequest(request, options)
298
- .then((response) => {
299
- return luvio.handleSuccessResponse(() => {
300
- const snapshot = ingestSuccess(luvio, resourceParams, response);
301
- return luvio.storeBroadcast().then(() => snapshot);
302
- }, () => getResponseCacheKeys(luvio, resourceParams, response.body));
303
- }, (response) => {
304
- deepFreeze(response);
305
- throw response;
306
- });
307
- }
308
- const ingestRecordAdapterFactory = (luvio) => {
309
- return function ingestRecord(untrustedConfig) {
310
- const config = validateAdapterConfig(untrustedConfig, ingestRecord_ConfigPropertyNames);
311
- // Invalid or incomplete config
312
- if (config === null) {
313
- throw new Error('Invalid config for "ingestRecord"');
314
- }
315
- return buildNetworkSnapshot(luvio, config);
316
- };
250
+ const ingestRecord_ConfigPropertyNames = {
251
+ displayName: 'ingestRecord',
252
+ parameters: {
253
+ required: ['communityId', 'requestIngestionInput'],
254
+ optional: []
255
+ }
256
+ };
257
+ function createResourceParams(config) {
258
+ const resourceParams = {
259
+ urlParams: {
260
+ communityId: config.communityId
261
+ },
262
+ body: {
263
+ requestIngestionInput: config.requestIngestionInput
264
+ }
265
+ };
266
+ return resourceParams;
267
+ }
268
+ function typeCheckConfig(untrustedConfig) {
269
+ const config = {};
270
+ const untrustedConfig_communityId = untrustedConfig.communityId;
271
+ if (typeof untrustedConfig_communityId === 'string') {
272
+ config.communityId = untrustedConfig_communityId;
273
+ }
274
+ const untrustedConfig_requestIngestionInput = untrustedConfig.requestIngestionInput;
275
+ const referenceMicrobatchingIngestionInputRepresentationValidationError = validate$1(untrustedConfig_requestIngestionInput);
276
+ if (referenceMicrobatchingIngestionInputRepresentationValidationError === null) {
277
+ config.requestIngestionInput = untrustedConfig_requestIngestionInput;
278
+ }
279
+ return config;
280
+ }
281
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
282
+ if (!untrustedIsObject(untrustedConfig)) {
283
+ return null;
284
+ }
285
+ if (process.env.NODE_ENV !== 'production') {
286
+ validateConfig(untrustedConfig, configPropertyNames);
287
+ }
288
+ const config = typeCheckConfig(untrustedConfig);
289
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
290
+ return null;
291
+ }
292
+ return config;
293
+ }
294
+ function buildNetworkSnapshot(luvio, config, options) {
295
+ const resourceParams = createResourceParams(config);
296
+ const request = createResourceRequest(resourceParams);
297
+ return luvio.dispatchResourceRequest(request, options)
298
+ .then((response) => {
299
+ return luvio.handleSuccessResponse(() => {
300
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
301
+ return luvio.storeBroadcast().then(() => snapshot);
302
+ }, () => getResponseCacheKeys(luvio, resourceParams, response.body));
303
+ }, (response) => {
304
+ deepFreeze(response);
305
+ throw response;
306
+ });
307
+ }
308
+ const ingestRecordAdapterFactory = (luvio) => {
309
+ return function ingestRecord(untrustedConfig) {
310
+ const config = validateAdapterConfig(untrustedConfig, ingestRecord_ConfigPropertyNames);
311
+ // Invalid or incomplete config
312
+ if (config === null) {
313
+ throw new Error('Invalid config for "ingestRecord"');
314
+ }
315
+ return buildNetworkSnapshot(luvio, config);
316
+ };
317
317
  };
318
318
 
319
- let ingestRecord;
320
- function bindExportsTo(luvio) {
321
- function unwrapSnapshotData(factory) {
322
- const adapter = factory(luvio);
323
- return (config) => adapter(config).then(snapshot => snapshot.data);
324
- }
325
- return {
326
- ingestRecord: unwrapSnapshotData(ingestRecordAdapterFactory),
327
- // Imperative GET Adapters
328
- };
329
- }
330
- withDefaultLuvio((luvio) => {
331
- ({
332
- ingestRecord,
333
- } = bindExportsTo(luvio));
319
+ let ingestRecord;
320
+ function bindExportsTo(luvio) {
321
+ function unwrapSnapshotData(factory) {
322
+ const adapter = factory(luvio);
323
+ return (config) => adapter(config).then(snapshot => snapshot.data);
324
+ }
325
+ return {
326
+ ingestRecord: unwrapSnapshotData(ingestRecordAdapterFactory),
327
+ // Imperative GET Adapters
328
+ };
329
+ }
330
+ withDefaultLuvio((luvio) => {
331
+ ({
332
+ ingestRecord,
333
+ } = bindExportsTo(luvio));
334
334
  });
335
335
 
336
336
  export { ingestRecord };
337
- // version: 1.124.2-4dc3034f1
337
+ // version: 1.124.4-fc08995da