@salesforce/lds-network-nimbus 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.
package/LICENSE.txt ADDED
@@ -0,0 +1,82 @@
1
+ Terms of Use
2
+
3
+ Copyright 2022 Salesforce, Inc. All rights reserved.
4
+
5
+ These Terms of Use govern the download, installation, and/or use of this
6
+ software provided by Salesforce, Inc. ("Salesforce") (the "Software"), were
7
+ last updated on April 15, 2022, and constitute a legally binding
8
+ agreement between you and Salesforce. If you do not agree to these Terms of
9
+ Use, do not install or use the Software.
10
+
11
+ Salesforce grants you a worldwide, non-exclusive, no-charge, royalty-free
12
+ copyright license to reproduce, prepare derivative works of, publicly
13
+ display, publicly perform, sublicense, and distribute the Software and
14
+ derivative works subject to these Terms. These Terms shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ Subject to the limited rights expressly granted hereunder, Salesforce
18
+ reserves all rights, title, and interest in and to all intellectual
19
+ property subsisting in the Software. No rights are granted to you hereunder
20
+ other than as expressly set forth herein. Users residing in countries on
21
+ the United States Office of Foreign Assets Control sanction list, or which
22
+ are otherwise subject to a US export embargo, may not use the Software.
23
+
24
+ Implementation of the Software may require development work, for which you
25
+ are responsible. The Software may contain bugs, errors and
26
+ incompatibilities and is made available on an AS IS basis without support,
27
+ updates, or service level commitments.
28
+
29
+ Salesforce reserves the right at any time to modify, suspend, or
30
+ discontinue, the Software (or any part thereof) with or without notice. You
31
+ agree that Salesforce shall not be liable to you or to any third party for
32
+ any modification, suspension, or discontinuance.
33
+
34
+ You agree to defend Salesforce against any claim, demand, suit or
35
+ proceeding made or brought against Salesforce by a third party arising out
36
+ of or accruing from (a) your use of the Software, and (b) any application
37
+ you develop with the Software that infringes any copyright, trademark,
38
+ trade secret, trade dress, patent, or other intellectual property right of
39
+ any person or defames any person or violates their rights of publicity or
40
+ privacy (each a "Claim Against Salesforce"), and will indemnify Salesforce
41
+ from any damages, attorney fees, and costs finally awarded against
42
+ Salesforce as a result of, or for any amounts paid by Salesforce under a
43
+ settlement approved by you in writing of, a Claim Against Salesforce,
44
+ provided Salesforce (x) promptly gives you written notice of the Claim
45
+ Against Salesforce, (y) gives you sole control of the defense and
46
+ settlement of the Claim Against Salesforce (except that you may not settle
47
+ any Claim Against Salesforce unless it unconditionally releases Salesforce
48
+ of all liability), and (z) gives you all reasonable assistance, at your
49
+ expense.
50
+
51
+ WITHOUT LIMITING THE GENERALITY OF THE FOREGOING, THE SOFTWARE IS NOT
52
+ SUPPORTED AND IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53
+ IMPLIED. IN NO EVENT SHALL SALESFORCE HAVE ANY LIABILITY FOR ANY DAMAGES,
54
+ INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
55
+ PUNITIVE, OR CONSEQUENTIAL DAMAGES, OR DAMAGES BASED ON LOST PROFITS, DATA,
56
+ OR USE, IN CONNECTION WITH THE SOFTWARE, HOWEVER CAUSED AND WHETHER IN
57
+ CONTRACT, TORT, OR UNDER ANY OTHER THEORY OF LIABILITY, WHETHER OR NOT YOU
58
+ HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
59
+
60
+ These Terms of Use shall be governed exclusively by the internal laws of
61
+ the State of California, without regard to its conflicts of laws
62
+ rules. Each party hereby consents to the exclusive jurisdiction of the
63
+ state and federal courts located in San Francisco County, California to
64
+ adjudicate any dispute arising out of or relating to these Terms of Use and
65
+ the download, installation, and/or use of the Software. Except as expressly
66
+ stated herein, these Terms of Use constitute the entire agreement between
67
+ the parties, and supersede all prior and contemporaneous agreements,
68
+ proposals, or representations, written or oral, concerning their subject
69
+ matter. No modification, amendment, or waiver of any provision of these
70
+ Terms of Use shall be effective unless it is by an update to these Terms of
71
+ Use that Salesforce makes available, or is in writing and signed by the
72
+ party against whom the modification, amendment, or waiver is to be
73
+ asserted.
74
+
75
+ Data Privacy: Salesforce may collect, process, and store device,
76
+ system, and other information related to your use of the Software. This
77
+ information includes, but is not limited to, IP address, user metrics, and
78
+ other data ("Usage Data"). Salesforce may use Usage Data for analytics,
79
+ product development, and marketing purposes. You acknowledge that files
80
+ generated in conjunction with the Software may contain sensitive or
81
+ confidential data, and you are solely responsible for anonymizing and
82
+ protecting such data.
package/dist/main.js ADDED
@@ -0,0 +1,695 @@
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 { idleDetector } from 'o11y/client';
8
+ import { HttpStatusCode } from '@luvio/engine';
9
+
10
+ const { keys, create, assign, entries } = Object;
11
+ const { stringify, parse } = JSON;
12
+ const { push, join, slice } = Array.prototype;
13
+ const { isArray, from } = Array;
14
+
15
+ function ldsParamsToString(params) {
16
+ const returnParams = create(null);
17
+ const keys$1 = keys(params);
18
+ for (let i = 0, len = keys$1.length; i < len; i++) {
19
+ const key = keys$1[i];
20
+ const value = params[key];
21
+ if (value === undefined) {
22
+ // filter out params that have no value
23
+ continue;
24
+ }
25
+ if (isArray(value)) {
26
+ // filter out empty arrays
27
+ if (value.length > 0) {
28
+ returnParams[key] = value.join(',');
29
+ }
30
+ }
31
+ else {
32
+ returnParams[key] = `${value}`;
33
+ }
34
+ if (isObject(value) === true && keys(value).length > 0) {
35
+ returnParams[key] = stringify(value);
36
+ }
37
+ }
38
+ return returnParams;
39
+ }
40
+ function statusTextFromStatusCode(status) {
41
+ switch (status) {
42
+ case HttpStatusCode.Ok:
43
+ return 'OK';
44
+ case HttpStatusCode.NotModified:
45
+ return 'Not Modified';
46
+ case HttpStatusCode.NotFound:
47
+ return 'Not Found';
48
+ case HttpStatusCode.BadRequest:
49
+ return 'Bad Request';
50
+ case HttpStatusCode.ServerError:
51
+ return 'Server Error';
52
+ default:
53
+ return `Unexpected HTTP Status Code: ${status}`;
54
+ }
55
+ }
56
+ function methodFromResourceRequestMethod(method) {
57
+ switch (method.toLowerCase()) {
58
+ case 'get':
59
+ return 'GET';
60
+ case 'put':
61
+ return 'PUT';
62
+ case 'post':
63
+ return 'POST';
64
+ case 'delete':
65
+ return 'DELETE';
66
+ case 'patch':
67
+ return 'PATCH';
68
+ default:
69
+ throw Error(`Unexpected method ${method}`);
70
+ }
71
+ }
72
+ function priorityFromResourceRequest(request) {
73
+ switch (request.priority) {
74
+ case 'background':
75
+ return 'background';
76
+ case 'high':
77
+ return 'high';
78
+ case 'normal':
79
+ default:
80
+ return 'normal';
81
+ }
82
+ }
83
+ function isStatusOk(status) {
84
+ return status >= 200 && status <= 299;
85
+ }
86
+ // adapted from adapter-utils untrustedIsObject
87
+ function isObject(value) {
88
+ return typeof value === 'object' && value !== null && isArray(value) === false;
89
+ }
90
+ function stringifyIfPresent(value) {
91
+ if (value === undefined || value === null) {
92
+ return null;
93
+ }
94
+ if (typeof value === 'string') {
95
+ return value;
96
+ }
97
+ return stringify(value);
98
+ }
99
+ function parseIfPresent(value) {
100
+ if (value === undefined || value === null || value === '') {
101
+ return null;
102
+ }
103
+ return parse(value);
104
+ }
105
+ function buildNimbusNetworkPluginRequest(resourceRequest, resourceRequestContext) {
106
+ const { basePath, baseUri, method, headers, queryParams, body } = resourceRequest;
107
+ let observabilityContext = null;
108
+ if (resourceRequestContext !== undefined &&
109
+ resourceRequestContext.requestCorrelator !== undefined &&
110
+ resourceRequestContext.requestCorrelator.observabilityContext !==
111
+ undefined) {
112
+ ({ observabilityContext = null } =
113
+ resourceRequestContext.requestCorrelator);
114
+ }
115
+ return {
116
+ method: methodFromResourceRequestMethod(method),
117
+ body: stringifyIfPresent(body),
118
+ headers,
119
+ queryParams: ldsParamsToString(queryParams),
120
+ path: `${baseUri}${basePath}`,
121
+ priority: priorityFromResourceRequest(resourceRequest),
122
+ observabilityContext,
123
+ };
124
+ }
125
+ function buildLdsResponse(response) {
126
+ const { body: responseBody, headers, status } = response;
127
+ const statusText = statusTextFromStatusCode(status);
128
+ return {
129
+ statusText,
130
+ status,
131
+ body: parseIfPresent(responseBody),
132
+ headers,
133
+ ok: isStatusOk(status),
134
+ };
135
+ }
136
+
137
+ // so eslint doesn't complain about nimbus
138
+ /* global __nimbus */
139
+ const tasker = idleDetector.declareNotifierTaskMulti('NimbusNetworkAdapter');
140
+ const NimbusNetworkAdapter = (request, resourceRequestContext) => {
141
+ tasker.add();
142
+ return new Promise((resolve, reject) => {
143
+ try {
144
+ __nimbus.plugins.LdsNetworkAdapter.sendRequest(buildNimbusNetworkPluginRequest(request, resourceRequestContext), (response) => {
145
+ try {
146
+ resolve(buildLdsResponse(response));
147
+ }
148
+ catch (error) {
149
+ // don't leave promise hanging, catch any errors (eg: if native side
150
+ // returns malformed response) and call reject
151
+ reject(error);
152
+ }
153
+ }, (error) => {
154
+ reject(new Error(`type: ${error.type}, message: ${error.message}`));
155
+ });
156
+ }
157
+ catch (error) {
158
+ // don't leave promise hanging, catch any errors (eg: if native side
159
+ // fails to parse the request), and call reject
160
+ reject(error);
161
+ }
162
+ }).finally(() => tasker.done());
163
+ };
164
+
165
+ /**
166
+ * related-list-records/batch fields and optional fields could be like below.
167
+ * /ui-api/related-list-records/batch/001R0000006l1xKIAQ/Contacts,Opportunities?
168
+ * optionalFields=Contacts:Contact.Id,Contact.Name;Opportunities:Opportunity.Id
169
+ *
170
+ * the pattern is [{relativeListId}:{[fields]};{relativeListId}:{[fields]}]
171
+ */
172
+ const SEPARATOR_BETWEEN_SCOPES = ';';
173
+ const SEPARATOR_BETWEEN_SCOPE_AND_FIELDS = ':';
174
+ const SEPARATOR_BETWEEN_FIELDS = ',';
175
+ const UNSCOPED_IDENTIFIER = 'unscoped';
176
+ class ScopedFields {
177
+ constructor(scope, fields) {
178
+ this.fields = {};
179
+ this.scope = scope;
180
+ for (let i = 0, len = fields.length; i < len; i += 1) {
181
+ this.fields[fields[i]] = true;
182
+ }
183
+ }
184
+ isUnScoped() {
185
+ return this.scope === UNSCOPED_IDENTIFIER;
186
+ }
187
+ addField(field) {
188
+ this.fields[field] = true;
189
+ }
190
+ addFields(fields) {
191
+ fields.forEach(this.addField, this);
192
+ }
193
+ toQueryParameterValue() {
194
+ const joinedFields = join.call(Object.keys(this.fields), SEPARATOR_BETWEEN_FIELDS);
195
+ return this.isUnScoped()
196
+ ? joinedFields
197
+ : join.call([this.scope, joinedFields], SEPARATOR_BETWEEN_SCOPE_AND_FIELDS);
198
+ }
199
+ toQueryParams() {
200
+ return this.isUnScoped() ? Object.keys(this.fields) : this.toQueryParameterValue();
201
+ }
202
+ /**
203
+ * parse Contacts:Contact.Id,Contact.Name into a QueryFields
204
+ */
205
+ static fromQueryParameterValue(paramValue) {
206
+ if (paramValue === null || paramValue === '')
207
+ return;
208
+ const scopeToFields = paramValue.split(SEPARATOR_BETWEEN_SCOPE_AND_FIELDS);
209
+ if (scopeToFields.length === 1) {
210
+ //unscoped
211
+ return new ScopedFields(UNSCOPED_IDENTIFIER, scopeToFields[0].split(SEPARATOR_BETWEEN_FIELDS));
212
+ }
213
+ else if (scopeToFields.length === 2) {
214
+ const scope = scopeToFields[0];
215
+ const fields = scopeToFields[1];
216
+ if (scope === undefined || fields === null)
217
+ return;
218
+ return new ScopedFields(scope, fields.split(SEPARATOR_BETWEEN_FIELDS));
219
+ }
220
+ else {
221
+ return;
222
+ }
223
+ }
224
+ }
225
+ class ScopedFieldsCollection {
226
+ constructor() {
227
+ this.listIdToFieldsMap = {};
228
+ }
229
+ /**
230
+ * merge the from ScopedFieldsCollection into current one
231
+ * @param from
232
+ */
233
+ merge(from) {
234
+ const { listIdToFieldsMap } = from;
235
+ const scopes = Object.keys(listIdToFieldsMap);
236
+ for (let i = 0, len = scopes.length; i < len; i += 1) {
237
+ const scope = scopes[i];
238
+ const scopedFields = listIdToFieldsMap[scope];
239
+ const existingScopedFields = this.listIdToFieldsMap[scope];
240
+ if (existingScopedFields) {
241
+ existingScopedFields.addFields(Object.keys(scopedFields.fields));
242
+ }
243
+ else {
244
+ this.listIdToFieldsMap[scope] = scopedFields;
245
+ }
246
+ }
247
+ }
248
+ toQueryParams() {
249
+ return this.countOfUnScoped() > 0
250
+ ? this.listIdToFieldsMap[UNSCOPED_IDENTIFIER].toQueryParams()
251
+ : this.toQueryParameterValue();
252
+ }
253
+ /**
254
+ * convert to query parameter value
255
+ * @returns
256
+ */
257
+ toQueryParameterValue() {
258
+ let result = [];
259
+ const scopes = Object.keys(this.listIdToFieldsMap);
260
+ for (let i = 0, len = scopes.length; i < len; i += 1) {
261
+ const chunk = this.listIdToFieldsMap[scopes[i]].toQueryParameterValue();
262
+ if (chunk !== undefined)
263
+ result.push(chunk);
264
+ }
265
+ return join.call(result, SEPARATOR_BETWEEN_SCOPES);
266
+ }
267
+ /**
268
+ * split the ScopedFields into multiple ScopedFields
269
+ * which there max fields list length will not exceeded the specified maxLength
270
+ * @param maxLength
271
+ */
272
+ split(maxLength = MAX_URL_LENGTH) {
273
+ const size = this.size();
274
+ if (size > maxLength) {
275
+ const fieldsArray = [];
276
+ const scopes = Object.keys(this.listIdToFieldsMap);
277
+ for (let i = 0, len = scopes.length; i < len; i += 1) {
278
+ const { scope, fields } = this.listIdToFieldsMap[scopes[i]];
279
+ Object.keys(fields).forEach((field) => {
280
+ fieldsArray.push([scope, field]);
281
+ });
282
+ }
283
+ // Formula: # of fields per chunk = floor( max length per chunk / avg field length)
284
+ const averageFieldStringLength = size / fieldsArray.length;
285
+ const fieldsPerChunk = Math.floor(maxLength / averageFieldStringLength);
286
+ let j = fieldsPerChunk;
287
+ let result = [];
288
+ let current = null;
289
+ for (let i = 0, len = fieldsArray.length; i < len; i += 1) {
290
+ const scope = fieldsArray[i][0];
291
+ const field = fieldsArray[i][1];
292
+ if (current === null || !current.listIdToFieldsMap[scope]) {
293
+ j = fieldsPerChunk;
294
+ current = new ScopedFieldsCollection();
295
+ current.listIdToFieldsMap[scope] = new ScopedFields(scope, [field]);
296
+ result.push(current);
297
+ }
298
+ else {
299
+ current.listIdToFieldsMap[scope].addField(field);
300
+ }
301
+ j--;
302
+ if (j === 0) {
303
+ current = null;
304
+ }
305
+ }
306
+ return result;
307
+ }
308
+ else if (size > 0) {
309
+ return [this];
310
+ }
311
+ else {
312
+ return [];
313
+ }
314
+ }
315
+ size() {
316
+ return this.toQueryParameterValue().length;
317
+ }
318
+ countOfUnScoped() {
319
+ let count = 0;
320
+ const fieldsArray = Object.values(this.listIdToFieldsMap);
321
+ for (let i = 0, len = fieldsArray.length; i < len; i += 1) {
322
+ if (fieldsArray[i].isUnScoped()) {
323
+ count++;
324
+ }
325
+ }
326
+ return count;
327
+ }
328
+ countOfScoped() {
329
+ return Object.keys.length - this.countOfUnScoped();
330
+ }
331
+ isUnScopedMixedWithScoped() {
332
+ return this.countOfUnScoped() > 0 && this.countOfScoped() > 0;
333
+ }
334
+ /**
335
+ *
336
+ * @param paramValue like Contacts:Contact.Id,Contact.Name;Opportunities:Opportunity.Id
337
+ * @returns
338
+ */
339
+ static fromQueryParameterValue(paramValue) {
340
+ const result = new ScopedFieldsCollection();
341
+ if (paramValue) {
342
+ const relativeListChunks = paramValue.split(SEPARATOR_BETWEEN_SCOPES);
343
+ if (relativeListChunks.length === 0)
344
+ return result;
345
+ for (let i = 0, len = relativeListChunks.length; i < len; i += 1) {
346
+ const parsed = ScopedFields.fromQueryParameterValue(relativeListChunks[i]);
347
+ if (parsed) {
348
+ result.listIdToFieldsMap[parsed.scope] = parsed;
349
+ }
350
+ }
351
+ if (result.isUnScopedMixedWithScoped()) {
352
+ throw Error('mixing scoped and unscoped field list is not allowed.');
353
+ }
354
+ }
355
+ return result;
356
+ }
357
+ }
358
+
359
+ //Salesforce/Akamai cdn uri max size is 8898 bytes, short than normal. Per
360
+ //https://help.salesforce.com/s/articleView?id=sf.community_builder_cdn_considerations.htm&type=5
361
+ //Due to we don't know the domain ResourceRequest, here we give 8000
362
+ const MAX_URL_LENGTH = 8000;
363
+ const PARSE_ERROR = 'PARSE_AGGREGATE_UI_RESPONSE_ERROR';
364
+ function isErrorResponse(response) {
365
+ return response.httpStatusCode >= 400;
366
+ }
367
+ /**
368
+ * merge the aggregate ui child responses into a single object representation
369
+ * @param response
370
+ * @param mergeFunc the function used to define how the records should be merged together
371
+ * @returns the merged record
372
+ */
373
+ function mergeAggregateUiResponse(response, mergeFunc) {
374
+ if (response.ok === false) {
375
+ return response;
376
+ }
377
+ const body = response.body;
378
+ try {
379
+ if (body === null ||
380
+ body === undefined ||
381
+ body.compositeResponse === undefined ||
382
+ body.compositeResponse.length === 0) {
383
+ // We shouldn't even get into this state - a 200 with no body?
384
+ // eslint-disable-next-line @salesforce/lds/no-error-in-production
385
+ throw new Error('No response body in executeAggregateUi found');
386
+ }
387
+ // if the body has any non-2xx statuses then that's an error and we return
388
+ // the network response with that error
389
+ const error = body.compositeResponse.find(isErrorResponse);
390
+ if (error !== undefined) {
391
+ const { httpStatusCode, body: errorBody } = error;
392
+ const statusText = errorBody.length > 0 ? errorBody[0].errorCode : '';
393
+ return {
394
+ ...response,
395
+ ok: false,
396
+ status: httpStatusCode,
397
+ statusText,
398
+ body: errorBody,
399
+ };
400
+ }
401
+ // if we got here there are no errors in body, cast as such
402
+ const responses = body.compositeResponse;
403
+ const merged = responses.reduce((seed, resp) => {
404
+ if (seed === null) {
405
+ return resp.body;
406
+ }
407
+ return mergeFunc(seed, resp.body);
408
+ }, null);
409
+ return {
410
+ ...response,
411
+ body: merged,
412
+ };
413
+ }
414
+ catch (error) {
415
+ return {
416
+ ...response,
417
+ ok: false,
418
+ status: HttpStatusCode.ServerError,
419
+ statusText: PARSE_ERROR,
420
+ body: [
421
+ {
422
+ errorCode: PARSE_ERROR,
423
+ message: error.toString(),
424
+ },
425
+ ],
426
+ };
427
+ }
428
+ }
429
+ function buildAggregateUiUrl(params, resourceRequest) {
430
+ const { fields, optionalFields } = params;
431
+ const mergedParams = {
432
+ ...resourceRequest.queryParams,
433
+ fields,
434
+ optionalFields,
435
+ };
436
+ const queryString = [];
437
+ for (const [key, value] of entries(mergedParams)) {
438
+ if (value !== undefined) {
439
+ queryString.push(`${key}=${isArray(value) ? value.join(',') : value}`);
440
+ }
441
+ }
442
+ return `${resourceRequest.baseUri}${resourceRequest.basePath}?${join.call(queryString, '&')}`;
443
+ }
444
+ function shouldUseAggregateUiForFields(fieldsArray, optionalFieldsArray, maxLengthPerChunk) {
445
+ return fieldsArray.length + optionalFieldsArray.length >= maxLengthPerChunk;
446
+ }
447
+ function isSpanningRecord(fieldValue) {
448
+ return fieldValue !== null && typeof fieldValue === 'object' && !Array.isArray(fieldValue);
449
+ }
450
+ function mergeRecordFields(first, second) {
451
+ const { fields: targetFields } = first;
452
+ const { fields: sourceFields } = second;
453
+ const fieldNames = keys(sourceFields);
454
+ for (let i = 0, len = fieldNames.length; i < len; i += 1) {
455
+ const fieldName = fieldNames[i];
456
+ const sourceField = sourceFields[fieldName];
457
+ const targetField = targetFields[fieldName];
458
+ if (isSpanningRecord(sourceField.value)) {
459
+ if (targetField === undefined) {
460
+ targetFields[fieldName] = sourceField;
461
+ continue;
462
+ }
463
+ mergeRecordFields(targetField.value, sourceField.value);
464
+ continue;
465
+ }
466
+ targetFields[fieldName] = sourceField;
467
+ }
468
+ return first;
469
+ }
470
+ function mergeBatchRecordsFields(first, second, collectionMergeFunc) {
471
+ const { results: targetResults } = first;
472
+ const { results: sourceResults } = second;
473
+ for (let i = 0, len = targetResults.length; i < len; i += 1) {
474
+ const targetResult = targetResults[i];
475
+ const sourceResult = sourceResults[i];
476
+ if (targetResult.statusCode !== HttpStatusCode.Ok)
477
+ continue;
478
+ if (sourceResult.statusCode !== HttpStatusCode.Ok) {
479
+ targetResults[i] = sourceResult;
480
+ continue;
481
+ }
482
+ collectionMergeFunc(targetResult.result, sourceResult.result);
483
+ }
484
+ return first;
485
+ }
486
+ /**
487
+ * Check to see if we have fields that are > max allowed characters long
488
+ * @param resourceRequest resource request to check
489
+ * @param endpoint Regular Expression to check the endpoint to aggregate
490
+ * @returns undefined if we should not aggregate. object if we should.
491
+ */
492
+ function createAggregateBatchRequestInfo(resourceRequest, endpoint, instrumentationSink) {
493
+ // only handle GETs on the given endpoint regex
494
+ if (!isGetRequestForEndpoint(endpoint, resourceRequest)) {
495
+ return undefined;
496
+ }
497
+ if (instrumentationSink) {
498
+ instrumentationSink.reportChunkCandidateUrlLength(calculateEstimatedTotalUrlLength(resourceRequest));
499
+ }
500
+ const { queryParams: { fields, optionalFields }, } = resourceRequest;
501
+ // only handle requests with fields or optional fields
502
+ if (fields === undefined && optionalFields === undefined) {
503
+ return undefined;
504
+ }
505
+ const fieldsArray = arrayOrEmpty(fields);
506
+ const optionalFieldsArray = arrayOrEmpty(optionalFields);
507
+ // if fields and optional fields are empty delegate request
508
+ if (fieldsArray.length === 0 && optionalFieldsArray.length === 0) {
509
+ return undefined;
510
+ }
511
+ const allowedMaxStringLengthPerChunk = getMaxLengthPerChunkAllowed(resourceRequest);
512
+ const fieldsString = fieldsArray.join(',');
513
+ const optionalFieldsString = optionalFieldsArray.join(',');
514
+ const shouldUseAggregate = shouldUseAggregateUiForFields(fieldsString, optionalFieldsString, allowedMaxStringLengthPerChunk);
515
+ if (!shouldUseAggregate) {
516
+ return undefined;
517
+ }
518
+ const fieldCollection = ScopedFieldsCollection.fromQueryParameterValue(fieldsString).split(allowedMaxStringLengthPerChunk);
519
+ const optionalFieldCollection = ScopedFieldsCollection.fromQueryParameterValue(optionalFieldsString).split(allowedMaxStringLengthPerChunk);
520
+ return {
521
+ fieldCollection,
522
+ optionalFieldCollection,
523
+ };
524
+ }
525
+ function createAggregateUiRequest(resourceRequest, compositeRequest) {
526
+ const aggregateUiPostBody = { compositeRequest };
527
+ const aggregateResourceRequest = {
528
+ method: 'post',
529
+ baseUri: resourceRequest.baseUri,
530
+ basePath: '/ui-api/aggregate-ui',
531
+ body: aggregateUiPostBody,
532
+ priority: resourceRequest.priority,
533
+ queryParams: {},
534
+ headers: {},
535
+ urlParams: {},
536
+ };
537
+ return aggregateResourceRequest;
538
+ }
539
+ function buildCompositeRequestByFields(referenceId, resourceRequest, recordsCompositeRequest) {
540
+ const { fieldCollection, optionalFieldCollection } = recordsCompositeRequest;
541
+ const compositeRequest = [];
542
+ if (fieldCollection !== undefined) {
543
+ for (let i = 0, len = fieldCollection.length; i < len; i += 1) {
544
+ const fieldChunk = fieldCollection[i].toQueryParams();
545
+ if (fieldChunk.length === 0) {
546
+ continue;
547
+ }
548
+ const url = buildAggregateUiUrl({
549
+ fields: fieldChunk,
550
+ }, resourceRequest);
551
+ push.call(compositeRequest, {
552
+ url,
553
+ referenceId: `${referenceId}_fields_${i}`,
554
+ });
555
+ }
556
+ }
557
+ if (optionalFieldCollection !== undefined) {
558
+ for (let i = 0, len = optionalFieldCollection.length; i < len; i += 1) {
559
+ const fieldChunk = optionalFieldCollection[i].toQueryParams();
560
+ if (fieldChunk.length === 0) {
561
+ continue;
562
+ }
563
+ const url = buildAggregateUiUrl({
564
+ optionalFields: fieldChunk,
565
+ }, resourceRequest);
566
+ push.call(compositeRequest, {
567
+ url,
568
+ referenceId: `${referenceId}_optionalFields_${i}`,
569
+ });
570
+ }
571
+ }
572
+ return compositeRequest;
573
+ }
574
+ /**
575
+ * Checks if a resource request is a GET method on the given endpoint
576
+ * @param endpoint Regular Expression of the endpoint
577
+ * @param request the resource request
578
+ */
579
+ function isGetRequestForEndpoint(endpoint, request) {
580
+ const { basePath, method } = request;
581
+ return endpoint.test(basePath) && method === 'get';
582
+ }
583
+ /**
584
+ * Checks if any is an array and returns it as an array.
585
+ * if not an array it returns an empty array.
586
+ * @param array the item to check is an array
587
+ * @returns the array or an empty array
588
+ */
589
+ function arrayOrEmpty(array) {
590
+ return array !== undefined && isArray(array) ? array : [];
591
+ }
592
+ /**
593
+ * Calculate the max length per chunk.
594
+ * Max chunk size is MAX_URL_LENGTH - the url without fields and optional fields.
595
+ *
596
+ * @param resourceRequest
597
+ * @returns
598
+ */
599
+ function getMaxLengthPerChunkAllowed(request) {
600
+ // Too much work to get exact length of the final url, so use stringified json to get the rough length.
601
+ const roughUrlLengthWithoutFieldsAndOptionFields = request.basePath.length +
602
+ request.baseUri.length +
603
+ (request.urlParams ? stringify(request.urlParams).length : 0) +
604
+ stringify({ ...request.queryParams, fields: {}, optionalFields: {} }).length;
605
+ return MAX_URL_LENGTH - roughUrlLengthWithoutFieldsAndOptionFields;
606
+ }
607
+ // we don't have access to the host so we cannot calculate the exact length of the url
608
+ // so we will estimate it
609
+ function calculateEstimatedTotalUrlLength(request) {
610
+ const { baseUri, basePath, queryParams } = request;
611
+ let url = `${baseUri}${basePath}`;
612
+ if (queryParams) {
613
+ const queryParamString = entries(queryParams)
614
+ .map(([key, value]) => `${key}=${value}`)
615
+ .join('&');
616
+ if (queryParamString) {
617
+ url += `?${queryParamString}`;
618
+ }
619
+ }
620
+ return url.length;
621
+ }
622
+
623
+ const RECORD_ENDPOINT_REGEX = /^\/ui-api\/records\/?(([a-zA-Z0-9]+))?$/;
624
+ const referenceId$1 = 'LDS_Records_AggregateUi';
625
+ /**
626
+ * Export to facilitate unit tests
627
+ * Merge the second getRecord result into the first one.
628
+ * If any is error response, merged result is error response.
629
+ * If both are sucesses, due to they are from same records,
630
+ * fields sub node will be merged recursively
631
+ */
632
+ function mergeGetRecordResult(first, second) {
633
+ // return the error if first is error.
634
+ if (isArray(first) && !isArray(second))
635
+ return first;
636
+ // return the error if second is error.
637
+ if (!isArray(first) && isArray(second))
638
+ return second;
639
+ // concat the error array if both are error
640
+ if (isArray(first) && isArray(second)) {
641
+ return [...first, ...second];
642
+ }
643
+ mergeRecordFields(first, second);
644
+ return first;
645
+ }
646
+ function makeNetworkChunkFieldsGetRecord(networkAdapter, instrumentationSink) {
647
+ return (resourceRequest, resourceRequestContext) => {
648
+ const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORD_ENDPOINT_REGEX, instrumentationSink);
649
+ if (batchRequestInfo === undefined) {
650
+ return networkAdapter(resourceRequest, resourceRequestContext);
651
+ }
652
+ const compositeRequest = buildCompositeRequestByFields(referenceId$1, resourceRequest, batchRequestInfo);
653
+ const aggregateRequest = createAggregateUiRequest(resourceRequest, compositeRequest);
654
+ return networkAdapter(aggregateRequest, resourceRequestContext).then((response) => {
655
+ return mergeAggregateUiResponse(response, mergeGetRecordResult);
656
+ });
657
+ };
658
+ }
659
+
660
+ const RECORDS_BATCH_ENDPOINT_REGEX = /^\/ui-api\/records\/batch\/?(([a-zA-Z0-9|,]+))?$/;
661
+ const referenceId = 'LDS_Records_Batch_AggregateUi';
662
+ function makeNetworkChunkFieldsGetRecordsBatch(networkAdapter, intrumentationSink) {
663
+ return (resourceRequest, resourceRequestContext) => {
664
+ const batchRequestInfo = createAggregateBatchRequestInfo(resourceRequest, RECORDS_BATCH_ENDPOINT_REGEX, intrumentationSink);
665
+ if (batchRequestInfo === undefined) {
666
+ return networkAdapter(resourceRequest, resourceRequestContext);
667
+ }
668
+ const compositeRequest = buildCompositeRequestByFields(referenceId, resourceRequest, batchRequestInfo);
669
+ const aggregateRequest = createAggregateUiRequest(resourceRequest, compositeRequest);
670
+ return networkAdapter(aggregateRequest, resourceRequestContext).then((response) => {
671
+ return mergeAggregateUiResponse(response, (first, second) => {
672
+ return mergeBatchRecordsFields(first, second, (a, b) => {
673
+ return mergeRecordFields(a, b);
674
+ });
675
+ });
676
+ });
677
+ };
678
+ }
679
+
680
+ /**
681
+ * Higher order function that accepts a network adapter and returns a new network adapter
682
+ * that is capable of performing field batching to ensure that URL length limits are respected
683
+ * when hitting record endpoints that accept a field list
684
+ *
685
+ * @param networkAdapter the network adapter to do the call.
686
+ */
687
+ function makeNetworkAdapterChunkRecordFields(networkAdapter, instrumentationSink) {
688
+ // endpoint handlers that support aggregate-ui field batching
689
+ const batchHandlers = [makeNetworkChunkFieldsGetRecord, makeNetworkChunkFieldsGetRecordsBatch];
690
+ return batchHandlers.reduce((network, handler) => {
691
+ return handler(network, instrumentationSink);
692
+ }, networkAdapter);
693
+ }
694
+
695
+ export { NimbusNetworkAdapter, makeNetworkAdapterChunkRecordFields };
@@ -0,0 +1,3 @@
1
+ export { NimbusNetworkAdapter } from './network/NimbusNetworkAdapter';
2
+ export { makeNetworkAdapterChunkRecordFields } from './network/record-field-batching/makeNetworkAdapterChunkRecordFields';
3
+ export { CompositeResponseEnvelope } from './network/record-field-batching/utils';
@@ -0,0 +1,2 @@
1
+ import type { NetworkAdapter } from '@luvio/engine';
2
+ export declare const NimbusNetworkAdapter: NetworkAdapter;
@@ -0,0 +1,11 @@
1
+ declare function stop(_userSchemaOrText?: any | string, _userData?: any): void;
2
+ declare function error(_error: Error, _userSchemaOrText?: any | string, _userData?: any): void;
3
+ declare function discard(): void;
4
+ declare function terminate(): void;
5
+ export declare const activity: {
6
+ stop: typeof stop;
7
+ error: typeof error;
8
+ discard: typeof discard;
9
+ terminate: typeof terminate;
10
+ };
11
+ export {};
@@ -0,0 +1,11 @@
1
+ export { activity } from './activity';
2
+ export { instrumentation } from './instrumentation';
3
+ export { idleDetector } from './idleDetector';
4
+ export declare function getInstrumentation(_name: string): {
5
+ log: (_schema: any, _data?: any) => void;
6
+ error: (_err: Error, _userSchemaOrText?: string | undefined, _data?: any) => void;
7
+ startActivity: (_name: string) => any;
8
+ incrementCounter: (_operation: string, _increment?: number | undefined, _hasError?: boolean | undefined, _tags?: any) => void;
9
+ trackValue: (_operation: string, _value: number, _hasError?: boolean | undefined, _tags?: any) => void;
10
+ bucketValue: (_operation: string, _value: number, _buckets: number[]) => void;
11
+ };
@@ -0,0 +1,18 @@
1
+ declare function requestIdleDetectedCallback(_callback: any): void;
2
+ declare function declareNotifierTaskSingle(_name: string): {
3
+ isBusy: boolean;
4
+ done: () => void;
5
+ };
6
+ declare function declareNotifierTaskMulti(_name: string, _existingBusyCount?: number): {
7
+ isBusy: boolean;
8
+ add: () => void;
9
+ done: () => void;
10
+ };
11
+ declare function declarePollableTaskMulti(_name: string, _isBusyChecker: any): void;
12
+ export declare const idleDetector: {
13
+ requestIdleDetectedCallback: typeof requestIdleDetectedCallback;
14
+ declareNotifierTaskSingle: typeof declareNotifierTaskSingle;
15
+ declareNotifierTaskMulti: typeof declareNotifierTaskMulti;
16
+ declarePollableTaskMulti: typeof declarePollableTaskMulti;
17
+ };
18
+ export {};
@@ -0,0 +1,16 @@
1
+ declare function log(_schema: any, _data?: any): void;
2
+ declare function error(_err: Error, _userSchemaOrText?: string, _data?: any): void;
3
+ declare function startActivity(_name: string): any;
4
+ declare function incrementCounter(_operation: string, _increment?: number, _hasError?: boolean, _tags?: any): void;
5
+ declare function trackValue(_operation: string, _value: number, _hasError?: boolean, _tags?: any): void;
6
+ declare function bucketValue(_operation: string, _value: number, _buckets: number[]): void;
7
+ export declare const instrumentation: {
8
+ log: typeof log;
9
+ error: typeof error;
10
+ startActivity: typeof startActivity;
11
+ incrementCounter: typeof incrementCounter;
12
+ trackValue: typeof trackValue;
13
+ bucketValue: typeof bucketValue;
14
+ };
15
+ export declare const METRIC_KEYS: {};
16
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { Request, Response } from '@salesforce/nimbus-plugin-lds';
2
+ import type { ResourceRequest, FetchResponse, ResourceRequestContext } from '@luvio/engine';
3
+ export declare function buildNimbusNetworkPluginRequest(resourceRequest: ResourceRequest, resourceRequestContext: ResourceRequestContext): Request;
4
+ export declare function buildLdsResponse(response: Response): FetchResponse<any>;
@@ -0,0 +1,44 @@
1
+ export declare class ScopedFields {
2
+ scope: string;
3
+ fields: Record<string, true>;
4
+ constructor(scope: string, fields: Array<string>);
5
+ isUnScoped(): boolean;
6
+ addField(field: string): void;
7
+ addFields(fields: Array<string>): void;
8
+ toQueryParameterValue(): string;
9
+ toQueryParams(): string | string[];
10
+ /**
11
+ * parse Contacts:Contact.Id,Contact.Name into a QueryFields
12
+ */
13
+ static fromQueryParameterValue(paramValue: string): ScopedFields | undefined;
14
+ }
15
+ export declare class ScopedFieldsCollection {
16
+ listIdToFieldsMap: Record<string, ScopedFields>;
17
+ /**
18
+ * merge the from ScopedFieldsCollection into current one
19
+ * @param from
20
+ */
21
+ merge(from: ScopedFieldsCollection): void;
22
+ toQueryParams(): string | string[];
23
+ /**
24
+ * convert to query parameter value
25
+ * @returns
26
+ */
27
+ toQueryParameterValue(): string;
28
+ /**
29
+ * split the ScopedFields into multiple ScopedFields
30
+ * which there max fields list length will not exceeded the specified maxLength
31
+ * @param maxLength
32
+ */
33
+ split(maxLength?: number): Array<ScopedFieldsCollection>;
34
+ size(): number;
35
+ countOfUnScoped(): number;
36
+ countOfScoped(): number;
37
+ isUnScopedMixedWithScoped(): boolean;
38
+ /**
39
+ *
40
+ * @param paramValue like Contacts:Contact.Id,Contact.Name;Opportunities:Opportunity.Id
41
+ * @returns
42
+ */
43
+ static fromQueryParameterValue(paramValue: String | null): ScopedFieldsCollection;
44
+ }
@@ -0,0 +1,11 @@
1
+ import type { NetworkAdapter } from '@luvio/engine';
2
+ /**
3
+ * Higher order function that accepts a network adapter and returns a new network adapter
4
+ * that is capable of performing field batching to ensure that URL length limits are respected
5
+ * when hitting record endpoints that accept a field list
6
+ *
7
+ * @param networkAdapter the network adapter to do the call.
8
+ */
9
+ export declare function makeNetworkAdapterChunkRecordFields(networkAdapter: NetworkAdapter, instrumentationSink: {
10
+ reportChunkCandidateUrlLength: (urlLength: number) => void;
11
+ }): NetworkAdapter;
@@ -0,0 +1,15 @@
1
+ import type { NetworkAdapter, FetchResponse } from '@luvio/engine';
2
+ import type { RecordRepresentation } from '@salesforce/lds-adapters-uiapi';
3
+ import type { AggregateResponse, InstrumentationSink, UiApiErrorResponse } from './utils';
4
+ export type GetRecordResult = RecordRepresentation | UiApiErrorResponse;
5
+ export type GetRecordAggregateResponse = AggregateResponse<GetRecordResult>;
6
+ export type GetRecordResponse = FetchResponse<GetRecordResult>;
7
+ /**
8
+ * Export to facilitate unit tests
9
+ * Merge the second getRecord result into the first one.
10
+ * If any is error response, merged result is error response.
11
+ * If both are sucesses, due to they are from same records,
12
+ * fields sub node will be merged recursively
13
+ */
14
+ export declare function mergeGetRecordResult(first: GetRecordResult, second: GetRecordResult): GetRecordResult;
15
+ export declare function makeNetworkChunkFieldsGetRecord(networkAdapter: NetworkAdapter, instrumentationSink: InstrumentationSink): NetworkAdapter;
@@ -0,0 +1,7 @@
1
+ import type { FetchResponse, NetworkAdapter } from '@luvio/engine';
2
+ import type { BatchRepresentation } from '@salesforce/lds-adapters-uiapi';
3
+ import type { AggregateResponse, InstrumentationSink } from './utils';
4
+ export declare const RECORDS_BATCH_ENDPOINT_REGEX: RegExp;
5
+ export type GetRecordsBatchAggregateResponse = AggregateResponse<BatchRepresentation>;
6
+ export type GetRecordsBatchResponse = FetchResponse<BatchRepresentation>;
7
+ export declare function makeNetworkChunkFieldsGetRecordsBatch(networkAdapter: NetworkAdapter, intrumentationSink: InstrumentationSink): NetworkAdapter;
@@ -0,0 +1,74 @@
1
+ import type { ResourceRequest, FetchResponse } from '@luvio/engine';
2
+ import { HttpStatusCode } from '@luvio/engine';
3
+ import type { RecordRepresentation, BatchRepresentation, RelatedListRecordCollectionRepresentation, RelatedListRecordCollectionBatchRepresentation } from '@salesforce/lds-adapters-uiapi';
4
+ import type { GetRecordResult } from './makeNetworkChunkFieldsGetRecord';
5
+ import { ScopedFieldsCollection } from './ScopedFields';
6
+ export declare const MAX_URL_LENGTH = 8000;
7
+ export interface CompositeRequest {
8
+ url: string;
9
+ referenceId: string;
10
+ }
11
+ interface UiApiClientOptions {
12
+ ifModifiedSince?: string;
13
+ ifUnmodifiedSince?: string;
14
+ }
15
+ export interface UiApiParams {
16
+ [name: string]: any;
17
+ clientOptions?: UiApiClientOptions;
18
+ }
19
+ export interface UiApiError {
20
+ errorCode: string;
21
+ message: string;
22
+ }
23
+ export type UiApiErrorResponse = Array<UiApiError>;
24
+ export type CompositeResponse<T> = {
25
+ body: T;
26
+ httpStatusCode: HttpStatusCode;
27
+ };
28
+ export interface CompositeResponseEnvelope<T> {
29
+ compositeResponse: CompositeResponse<T | UiApiErrorResponse>[];
30
+ }
31
+ /**
32
+ * Object Representation types allowed when merging
33
+ */
34
+ type SupportedAggregateRepresentation<T> = Extract<T, GetRecordResult | BatchRepresentation | RelatedListRecordCollectionRepresentation | RelatedListRecordCollectionBatchRepresentation>;
35
+ export type AggregateResponse<T> = FetchResponse<CompositeResponseEnvelope<SupportedAggregateRepresentation<T>> | UiApiErrorResponse>;
36
+ /**
37
+ * Supported batch representation
38
+ */
39
+ type SupportedBatchRepresentation = RelatedListRecordCollectionBatchRepresentation | BatchRepresentation;
40
+ /**
41
+ * Supported batch representation
42
+ */
43
+ type SupportedBatchCollectionRepresentation = RelatedListRecordCollectionRepresentation | RecordRepresentation;
44
+ export interface InstrumentationSink {
45
+ reportChunkCandidateUrlLength: (urlLength: number) => void;
46
+ }
47
+ /**
48
+ * merge the aggregate ui child responses into a single object representation
49
+ * @param response
50
+ * @param mergeFunc the function used to define how the records should be merged together
51
+ * @returns the merged record
52
+ */
53
+ export declare function mergeAggregateUiResponse<T>(response: AggregateResponse<T>, mergeFunc: (first: T, second: T) => SupportedAggregateRepresentation<T>): FetchResponse<SupportedAggregateRepresentation<T> | UiApiErrorResponse>;
54
+ export declare function buildAggregateUiUrl(params: UiApiParams, resourceRequest: ResourceRequest): string;
55
+ export declare function shouldUseAggregateUiForFields(fieldsArray: string, optionalFieldsArray: string, maxLengthPerChunk: number): boolean;
56
+ export declare function isSpanningRecord(fieldValue: null | string | string[] | number | boolean | RecordRepresentation): fieldValue is RecordRepresentation;
57
+ export declare function mergeRecordFields(first: RecordRepresentation, second: RecordRepresentation): RecordRepresentation;
58
+ export declare function mergeBatchRecordsFields(first: SupportedBatchRepresentation, second: SupportedBatchRepresentation, collectionMergeFunc: (first: SupportedBatchCollectionRepresentation, second: SupportedBatchCollectionRepresentation) => SupportedBatchCollectionRepresentation): SupportedBatchRepresentation;
59
+ /**
60
+ * Check to see if we have fields that are > max allowed characters long
61
+ * @param resourceRequest resource request to check
62
+ * @param endpoint Regular Expression to check the endpoint to aggregate
63
+ * @returns undefined if we should not aggregate. object if we should.
64
+ */
65
+ export declare function createAggregateBatchRequestInfo(resourceRequest: ResourceRequest, endpoint: RegExp, instrumentationSink?: InstrumentationSink): {
66
+ fieldCollection: ScopedFieldsCollection[];
67
+ optionalFieldCollection: ScopedFieldsCollection[];
68
+ } | undefined;
69
+ export declare function createAggregateUiRequest(resourceRequest: ResourceRequest, compositeRequest: CompositeRequest[]): ResourceRequest;
70
+ export declare function buildCompositeRequestByFields(referenceId: string, resourceRequest: ResourceRequest, recordsCompositeRequest: {
71
+ fieldCollection: ScopedFieldsCollection[] | undefined;
72
+ optionalFieldCollection: ScopedFieldsCollection[] | undefined;
73
+ }): CompositeRequest[];
74
+ export {};
@@ -0,0 +1,29 @@
1
+ declare const keys: {
2
+ (o: object): string[];
3
+ (o: {}): string[];
4
+ }, create: {
5
+ (o: object | null): any;
6
+ (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
7
+ }, assign: {
8
+ <T extends {}, U>(target: T, source: U): T & U;
9
+ <T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
10
+ <T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
11
+ (target: object, ...sources: any[]): any;
12
+ }, entries: {
13
+ <T>(o: {
14
+ [s: string]: T;
15
+ } | ArrayLike<T>): [string, T][];
16
+ (o: {}): [string, any][];
17
+ };
18
+ declare const stringify: {
19
+ (value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
20
+ (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string;
21
+ }, parse: (text: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => any;
22
+ declare const push: (...items: any[]) => number, join: (separator?: string | undefined) => string, slice: (start?: number | undefined, end?: number | undefined) => any[];
23
+ declare const isArray: (arg: any) => arg is any[], from: {
24
+ <T>(arrayLike: ArrayLike<T>): T[];
25
+ <T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
26
+ <T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
27
+ <T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
28
+ };
29
+ export { keys as ObjectKeys, create as ObjectCreate, assign as ObjectAssign, entries as ObjectEntries, push as ArrayPrototypePush, join as ArrayPrototypeJoin, slice as ArrayPrototypeSlice, isArray as ArrayIsArray, from as ArrayFrom, stringify as JSONStringify, parse as JSONParse, };
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@salesforce/lds-network-nimbus",
3
+ "version": "0.1.0-dev1",
4
+ "license": "SEE LICENSE IN LICENSE.txt",
5
+ "description": "A nimbus-plugin-based implementation of the Luvio NetworkAdapter.",
6
+ "main": "dist/main.js",
7
+ "module": "dist/main.js",
8
+ "types": "dist/types/main.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/types/main.d.ts",
15
+ "import": "./dist/main.js",
16
+ "default": "./dist/main.js"
17
+ }
18
+ },
19
+ "scripts": {
20
+ "prepare": "yarn build",
21
+ "build": "rollup --bundleConfigAsCjs --config rollup.config.js",
22
+ "test:debug": "node --inspect-brk ../../node_modules/.bin/jest --runInBand",
23
+ "test:unit": "NODE_ENV=production jest",
24
+ "test:size": "luvioBundlesize",
25
+ "clean": "rm -rf dist"
26
+ },
27
+ "dependencies": {
28
+ "@luvio/engine": "0.158.7",
29
+ "@salesforce/lds-instrumentation": "^0.1.0-dev1",
30
+ "o11y": "250.7.0"
31
+ },
32
+ "devDependencies": {
33
+ "@salesforce/lds-adapters-uiapi": "^0.1.0-dev1",
34
+ "@salesforce/nimbus-plugin-lds": "^0.1.0-dev1"
35
+ },
36
+ "luvioBundlesize": [
37
+ {
38
+ "path": "./dist/main.js",
39
+ "maxSize": {
40
+ "none": "33 kB",
41
+ "min": "13 kB",
42
+ "compressed": "7 kB"
43
+ }
44
+ }
45
+ ],
46
+ "volta": {
47
+ "extends": "../../package.json"
48
+ }
49
+ }