@salesforce/lds-runtime-mobile 1.326.0 → 1.328.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +44 -55
- package/dist/types/NimbusDraftQueue.d.ts +1 -0
- package/dist/types/drafts/AbstractResourceRequestActionHandler.d.ts +0 -2
- package/package.json +14 -14
- package/sfdc/main.js +44 -55
- package/sfdc/types/NimbusDraftQueue.d.ts +1 -0
- package/sfdc/types/drafts/AbstractResourceRequestActionHandler.d.ts +0 -2
package/dist/main.js
CHANGED
|
@@ -19,14 +19,11 @@ import { withRegistration, register } from '@salesforce/lds-default-luvio';
|
|
|
19
19
|
import { setupInstrumentation, instrumentAdapter as instrumentAdapter$1, instrumentLuvio, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation } from '@salesforce/lds-instrumentation';
|
|
20
20
|
import { HttpStatusCode, setBypassDeepFreeze, StoreKeySet, serializeStructuredKey, StringKeyInMemoryStore, Reader, deepFreeze, emitAdapterEvent, ingestShape, coerceConfig as coerceConfig$1, typeCheckConfig as typeCheckConfig$h, createResourceParams as createResourceParams$h, StoreKeyMap, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$f, resolveLink, createCustomAdapterEventEmitter, isFileReference, Environment, Luvio, InMemoryStore } from '@luvio/engine';
|
|
21
21
|
import { isSupportedEntity, configuration, getObjectInfoAdapterFactory, RECORD_ID_PREFIX, RECORD_FIELDS_KEY_JUNCTION, isStoreKeyRecordViewEntity, extractRecordIdFromStoreKey, buildRecordRepKeyFromId, keyBuilderRecord, RecordRepresentationTTL, keyBuilderQuickActionExecutionRepresentation, ingestQuickActionExecutionRepresentation, getRecordId18 as getRecordId18$1, getRecordsAdapterFactory as getRecordsAdapterFactory$1, RecordRepresentationRepresentationType, ObjectInfoRepresentationType, getObjectInfosAdapterFactory, getObjectInfoDirectoryAdapterFactory, UiApiNamespace, RecordRepresentationType, RecordRepresentationVersion } from '@salesforce/lds-adapters-uiapi';
|
|
22
|
-
import ldsIdempotencyWriteDisabled from '@salesforce/gate/lds.idempotencyWriteDisabled';
|
|
23
|
-
import ldsBackdatingEnabled from '@salesforce/gate/lds.backdatingEnabled';
|
|
24
22
|
import { Kind as Kind$1, visit as visit$1, isObjectType, defaultFieldResolver, buildSchema, parse as parse$5, extendSchema, isScalarType, execute, print } from '@luvio/graphql-parser';
|
|
25
23
|
import FIRST_DAY_OF_WEEK from '@salesforce/i18n/firstDayOfWeek';
|
|
26
24
|
import graphqQueryFieldLimit from '@salesforce/gate/lmr.graphqQueryFieldLimit';
|
|
27
25
|
import caseSensitiveUserId from '@salesforce/user/Id';
|
|
28
26
|
import { idleDetector, getInstrumentation } from 'o11y/client';
|
|
29
|
-
import ldsUseShortUrlGate from '@salesforce/gate/lds.useShortUrl';
|
|
30
27
|
import { instrument as instrument$1 } from '@salesforce/lds-bindings';
|
|
31
28
|
import ldsAdapterO11yLoggingGate from '@salesforce/gate/lmr.ldsAdapterO11yLogging';
|
|
32
29
|
import LOCALE from '@salesforce/i18n/locale';
|
|
@@ -37,12 +34,8 @@ import shortTimeFormat from '@salesforce/i18n/dateTime.shortTimeFormat';
|
|
|
37
34
|
import shortDateTimeFormat from '@salesforce/i18n/dateTime.shortDateTimeFormat';
|
|
38
35
|
import { getDateTimeFormat, getDateTimeISO8601Parser, getNumberFormat } from 'lightning/i18nService';
|
|
39
36
|
import formattingOptions from 'lightning/i18nCldrOptions';
|
|
40
|
-
import eagerEvalValidAt from '@salesforce/gate/lds.eagerEvalValidAt';
|
|
41
|
-
import eagerEvalStaleWhileRevalidate from '@salesforce/gate/lds.eagerEvalStaleWhileRevalidate';
|
|
42
|
-
import eagerEvalDefaultCachePolicy from '@salesforce/gate/lds.eagerEvalDefaultCachePolicy';
|
|
43
37
|
import ldsPrimingGraphqlBatch from '@salesforce/gate/lds.primingGraphqlBatch';
|
|
44
38
|
import lmrPrimingUseSoql from '@salesforce/gate/lmr.primingUseSoql';
|
|
45
|
-
import ldsMetadataRefreshEnabled from '@salesforce/gate/lds.metadataRefreshEnabled';
|
|
46
39
|
import graphqlL2AdapterGate from '@salesforce/gate/lmr.graphqlL2Adapter';
|
|
47
40
|
|
|
48
41
|
/**
|
|
@@ -77,7 +70,7 @@ function instrument(newInstrumentation) {
|
|
|
77
70
|
const LDS_RECORDS_AGGREGATE_UI = 'LDS_Records_AggregateUi';
|
|
78
71
|
// Boundary which represents the limit that we start chunking at,
|
|
79
72
|
// determined by comma separated string length of fields
|
|
80
|
-
const MAX_STRING_LENGTH_PER_CHUNK
|
|
73
|
+
const MAX_STRING_LENGTH_PER_CHUNK = 10000;
|
|
81
74
|
// UIAPI limit
|
|
82
75
|
const MAX_AGGREGATE_UI_CHUNK_LIMIT = 50;
|
|
83
76
|
function createOkResponse$1(body) {
|
|
@@ -181,7 +174,7 @@ function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resource
|
|
|
181
174
|
});
|
|
182
175
|
}
|
|
183
176
|
function shouldUseAggregateUiForGetRecord(fieldsArray, optionalFieldsArray) {
|
|
184
|
-
return fieldsArray.length + optionalFieldsArray.length >= MAX_STRING_LENGTH_PER_CHUNK
|
|
177
|
+
return fieldsArray.length + optionalFieldsArray.length >= MAX_STRING_LENGTH_PER_CHUNK;
|
|
185
178
|
}
|
|
186
179
|
function buildAggregateUiUrl$1(params, resourceRequest) {
|
|
187
180
|
const { fields, optionalFields } = params;
|
|
@@ -200,7 +193,7 @@ function buildGetRecordByFieldsCompositeRequest(resourceRequest, recordsComposit
|
|
|
200
193
|
const { fieldsArray, optionalFieldsArray, fieldsLength, optionalFieldsLength } = recordsCompositeRequest;
|
|
201
194
|
// Formula: # of fields per chunk = floor(avg field length / max length per chunk)
|
|
202
195
|
const averageFieldStringLength = Math.floor((fieldsLength + optionalFieldsLength) / (fieldsArray.length + optionalFieldsArray.length));
|
|
203
|
-
const fieldsPerChunk = Math.floor(MAX_STRING_LENGTH_PER_CHUNK
|
|
196
|
+
const fieldsPerChunk = Math.floor(MAX_STRING_LENGTH_PER_CHUNK / averageFieldStringLength);
|
|
204
197
|
const optionalFieldsChunks = [];
|
|
205
198
|
// Do the same for optional tracked fields
|
|
206
199
|
for (let i = 0, j = optionalFieldsArray.length; i < j; i += fieldsPerChunk) {
|
|
@@ -2133,6 +2126,12 @@ class DurableDraftQueue {
|
|
|
2133
2126
|
draftCount: this.draftStore.getCount(),
|
|
2134
2127
|
});
|
|
2135
2128
|
}
|
|
2129
|
+
stopQueueWhileRunning(action) {
|
|
2130
|
+
this.stopQueueManually(true);
|
|
2131
|
+
return action().finally(() => {
|
|
2132
|
+
this.startQueueSafe();
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2136
2135
|
/**
|
|
2137
2136
|
* Used to stop the queue within DraftQueue without user interaction
|
|
2138
2137
|
*/
|
|
@@ -2917,6 +2916,14 @@ class DraftManager {
|
|
|
2917
2916
|
stopQueue() {
|
|
2918
2917
|
return this.draftQueue.stopQueue();
|
|
2919
2918
|
}
|
|
2919
|
+
/**
|
|
2920
|
+
* Stops the draft queue manually without notifying the user and then runs the passed action.
|
|
2921
|
+
* After the action is completed it will safely start the queue if the user had set it to be
|
|
2922
|
+
* started.
|
|
2923
|
+
*/
|
|
2924
|
+
stopQueueWhileRunning(action) {
|
|
2925
|
+
return this.draftQueue.stopQueueWhileRunning(action);
|
|
2926
|
+
}
|
|
2920
2927
|
/**
|
|
2921
2928
|
* Subscribes the listener to changes to the draft queue.
|
|
2922
2929
|
*
|
|
@@ -41834,11 +41841,6 @@ class AbstractResourceRequestActionHandler {
|
|
|
41834
41841
|
this.recordService = recordService;
|
|
41835
41842
|
// determined by Server setup.
|
|
41836
41843
|
this.isIdempotencySupported = true;
|
|
41837
|
-
// idempotency write flag set by lds
|
|
41838
|
-
this.isLdsIdempotencyWriteDisabled = ldsIdempotencyWriteDisabled.isOpen({
|
|
41839
|
-
fallback: false,
|
|
41840
|
-
});
|
|
41841
|
-
this.isBackdatingEnabled = ldsBackdatingEnabled.isOpen({ fallback: false });
|
|
41842
41844
|
}
|
|
41843
41845
|
enqueue(data) {
|
|
41844
41846
|
return this.draftQueue.enqueue(this.handlerId, data);
|
|
@@ -41937,8 +41939,7 @@ class AbstractResourceRequestActionHandler {
|
|
|
41937
41939
|
updatedAction.data.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
|
|
41938
41940
|
actionDataChanged = true;
|
|
41939
41941
|
}
|
|
41940
|
-
if (
|
|
41941
|
-
response.status === HttpStatusCode.BadRequest &&
|
|
41942
|
+
if (response.status === HttpStatusCode.BadRequest &&
|
|
41942
41943
|
this.isBackdatingError(response.body, action)) {
|
|
41943
41944
|
updatedAction.timestamp = Date.now();
|
|
41944
41945
|
updatedAction.data.body.fields = {
|
|
@@ -42213,7 +42214,7 @@ class AbstractResourceRequestActionHandler {
|
|
|
42213
42214
|
return [action.targetId];
|
|
42214
42215
|
}
|
|
42215
42216
|
hasIdempotencySupport() {
|
|
42216
|
-
return this.isIdempotencySupported
|
|
42217
|
+
return this.isIdempotencySupported;
|
|
42217
42218
|
}
|
|
42218
42219
|
async ingestResponses(responses, action) {
|
|
42219
42220
|
const luvio = this.getLuvio();
|
|
@@ -42341,8 +42342,7 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
|
|
|
42341
42342
|
}
|
|
42342
42343
|
// handles backdating
|
|
42343
42344
|
const objectInfo = await this.objectInfoService.getObjectInfo(targetApiName);
|
|
42344
|
-
if (
|
|
42345
|
-
pendingAction.data &&
|
|
42345
|
+
if (pendingAction.data &&
|
|
42346
42346
|
pendingAction.data.method !== 'delete' && //'delete' action does not have fields
|
|
42347
42347
|
objectInfo) {
|
|
42348
42348
|
const appendedFields = this.getBackdatingFields(objectInfo, resolvedRequest.method, pendingAction);
|
|
@@ -43053,7 +43053,7 @@ class ContentDocumentCompositeRepresentationActionHandler extends AbstractResour
|
|
|
43053
43053
|
if (objectInfo === undefined) {
|
|
43054
43054
|
throw Error(`Could not generate draft. Object info is missing`);
|
|
43055
43055
|
}
|
|
43056
|
-
if (
|
|
43056
|
+
if (pendingAction.data) {
|
|
43057
43057
|
pendingAction.data.body.namedEntries = [
|
|
43058
43058
|
...pendingAction.data.body.namedEntries,
|
|
43059
43059
|
...this.getBackdatingNameEntries(objectInfo, pendingAction.timestamp),
|
|
@@ -49305,18 +49305,6 @@ function createSeenRecords(ids, currentSnapshot) {
|
|
|
49305
49305
|
}
|
|
49306
49306
|
return seenRecords;
|
|
49307
49307
|
}
|
|
49308
|
-
function createErrorSnapshot(result, snapshot) {
|
|
49309
|
-
return {
|
|
49310
|
-
...snapshot,
|
|
49311
|
-
data: undefined,
|
|
49312
|
-
state: 'Error',
|
|
49313
|
-
error: {
|
|
49314
|
-
body: {
|
|
49315
|
-
message: result.errors,
|
|
49316
|
-
},
|
|
49317
|
-
},
|
|
49318
|
-
};
|
|
49319
|
-
}
|
|
49320
49308
|
function createLocalEvalSnapshot(data, seenRecords, recordId, rebuildWithLocalEval, refresh) {
|
|
49321
49309
|
return {
|
|
49322
49310
|
refresh,
|
|
@@ -49834,7 +49822,18 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
|
|
|
49834
49822
|
// currently by design if there are any graphql errors we return an ErrorSnapshot
|
|
49835
49823
|
// partial results are not supported at this time
|
|
49836
49824
|
if (gqlResult.errors !== undefined && gqlResult.errors.length > 0) {
|
|
49837
|
-
|
|
49825
|
+
const errors = gqlResult.errors || [];
|
|
49826
|
+
let responseErrors = errors.map((e) => {
|
|
49827
|
+
return { message: e instanceof Error ? e.message : String(e) };
|
|
49828
|
+
});
|
|
49829
|
+
return {
|
|
49830
|
+
data: undefined,
|
|
49831
|
+
state: 'Error',
|
|
49832
|
+
error: {
|
|
49833
|
+
errorType: 'adapterError',
|
|
49834
|
+
error: responseErrors,
|
|
49835
|
+
},
|
|
49836
|
+
};
|
|
49838
49837
|
}
|
|
49839
49838
|
// if the non-eval'ed snapshot was an error then we return a synthetic
|
|
49840
49839
|
// Fulfilled snapshot (this only happens in this code path if
|
|
@@ -50378,7 +50377,7 @@ class ScopedFieldsCollection {
|
|
|
50378
50377
|
* which there max fields list length will not exceeded the specified maxLength
|
|
50379
50378
|
* @param maxLength
|
|
50380
50379
|
*/
|
|
50381
|
-
split(maxLength =
|
|
50380
|
+
split(maxLength = MAX_URL_LENGTH) {
|
|
50382
50381
|
const size = this.size();
|
|
50383
50382
|
if (size > maxLength) {
|
|
50384
50383
|
const fieldsArray = [];
|
|
@@ -50465,7 +50464,6 @@ class ScopedFieldsCollection {
|
|
|
50465
50464
|
}
|
|
50466
50465
|
}
|
|
50467
50466
|
|
|
50468
|
-
const MAX_STRING_LENGTH_PER_CHUNK = 10000;
|
|
50469
50467
|
//Salesforce/Akamai cdn uri max size is 8898 bytes, short than normal. Per
|
|
50470
50468
|
//https://help.salesforce.com/s/articleView?id=sf.community_builder_cdn_considerations.htm&type=5
|
|
50471
50469
|
//Due to we don't know the domain ResourceRequest, here we give 8000
|
|
@@ -50700,22 +50698,18 @@ function arrayOrEmpty(array) {
|
|
|
50700
50698
|
return array !== undefined && isArray(array) ? array : [];
|
|
50701
50699
|
}
|
|
50702
50700
|
/**
|
|
50703
|
-
* Calculate the max
|
|
50704
|
-
*
|
|
50705
|
-
*
|
|
50701
|
+
* Calculate the max length per chunk.
|
|
50702
|
+
* Max chunk size is MAX_URL_LENGTH - the url without fields and optional fields.
|
|
50703
|
+
*
|
|
50706
50704
|
* @param resourceRequest
|
|
50707
50705
|
* @returns
|
|
50708
50706
|
*/
|
|
50709
50707
|
function getMaxLengthPerChunkAllowed(request) {
|
|
50710
|
-
if (!ldsUseShortUrlGate.isOpen({ fallback: false })) {
|
|
50711
|
-
return MAX_STRING_LENGTH_PER_CHUNK;
|
|
50712
|
-
}
|
|
50713
50708
|
// Too much work to get exact length of the final url, so use stringified json to get the rough length.
|
|
50714
50709
|
const roughUrlLengthWithoutFieldsAndOptionFields = request.basePath.length +
|
|
50715
50710
|
request.baseUri.length +
|
|
50716
50711
|
(request.urlParams ? stringify$1(request.urlParams).length : 0) +
|
|
50717
50712
|
stringify$1({ ...request.queryParams, fields: {}, optionalFields: {} }).length;
|
|
50718
|
-
// MAX_URL_LENGTH - full lenght without fields, optionalFields
|
|
50719
50713
|
return MAX_URL_LENGTH - roughUrlLengthWithoutFieldsAndOptionFields;
|
|
50720
50714
|
}
|
|
50721
50715
|
// we don't have access to the host so we cannot calculate the exact length of the url
|
|
@@ -51015,6 +51009,9 @@ class NimbusDraftQueue {
|
|
|
51015
51009
|
stopQueue() {
|
|
51016
51010
|
return Promise.reject(new Error('Cannot call stopQueue from the NimbusDraftQueue'));
|
|
51017
51011
|
}
|
|
51012
|
+
stopQueueWhileRunning(_action) {
|
|
51013
|
+
return Promise.reject(new Error('Cannot call stopQueueWhileRunning from the NimbusDraftQueue'));
|
|
51014
|
+
}
|
|
51018
51015
|
replaceAction(_actionId, _withActionId) {
|
|
51019
51016
|
return Promise.reject(new Error('Cannot call replaceAction from the NimbusDraftQueue'));
|
|
51020
51017
|
}
|
|
@@ -52294,22 +52291,14 @@ function makeEnvironmentGraphqlAware(environment) {
|
|
|
52294
52291
|
return upstream;
|
|
52295
52292
|
};
|
|
52296
52293
|
const { cachePolicy } = adapterRequestContext;
|
|
52297
|
-
if (
|
|
52298
|
-
cachePolicy &&
|
|
52294
|
+
if (cachePolicy &&
|
|
52299
52295
|
cachePolicy.type === 'valid-at' &&
|
|
52300
52296
|
cachePolicy.timestamp === 0 &&
|
|
52301
52297
|
cachePolicy.basePolicy &&
|
|
52302
52298
|
cachePolicy.basePolicy.type === 'stale-while-revalidate') {
|
|
52303
52299
|
localBuildCachedSnapshot = hoistUnfulfilledToStale;
|
|
52304
52300
|
}
|
|
52305
|
-
if (
|
|
52306
|
-
cachePolicy &&
|
|
52307
|
-
cachePolicy.type === 'stale-while-revalidate' &&
|
|
52308
|
-
cachePolicy.staleDurationSeconds >= Number.MAX_SAFE_INTEGER) {
|
|
52309
|
-
localBuildCachedSnapshot = hoistUnfulfilledToStale;
|
|
52310
|
-
}
|
|
52311
|
-
if (eagerEvalDefaultCachePolicy.isOpen({ fallback: false }) &&
|
|
52312
|
-
(cachePolicy === undefined || cachePolicy === null)) {
|
|
52301
|
+
if (cachePolicy === undefined || cachePolicy === null) {
|
|
52313
52302
|
localBuildCachedSnapshot = hoistUnfulfilledToStale;
|
|
52314
52303
|
}
|
|
52315
52304
|
return environment.applyCachePolicy(luvio, adapterRequestContext, buildSnapshotContext, localBuildCachedSnapshot, buildNetworkSnapshot);
|
|
@@ -55203,7 +55192,7 @@ function getRuntime() {
|
|
|
55203
55192
|
const gqlEnv = makeEnvironmentGraphqlAware(baseEnv);
|
|
55204
55193
|
const durableEnv = makeDurable(gqlEnv, {
|
|
55205
55194
|
durableStore: lazyDurableStore,
|
|
55206
|
-
enableDurableMetadataRefresh:
|
|
55195
|
+
enableDurableMetadataRefresh: true,
|
|
55207
55196
|
// disable luvio deep freeze in headless environments
|
|
55208
55197
|
disableDeepFreeze: typeof window === 'undefined',
|
|
55209
55198
|
shouldFlush,
|
|
@@ -55324,4 +55313,4 @@ register({
|
|
|
55324
55313
|
});
|
|
55325
55314
|
|
|
55326
55315
|
export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
|
|
55327
|
-
// version: 1.
|
|
55316
|
+
// version: 1.328.0-f3d79bc783
|
|
@@ -16,6 +16,7 @@ export declare class NimbusDraftQueue implements DraftQueue {
|
|
|
16
16
|
removeDraftAction(_actionId: string): Promise<void>;
|
|
17
17
|
startQueue(): Promise<void>;
|
|
18
18
|
stopQueue(): Promise<void>;
|
|
19
|
+
stopQueueWhileRunning(_action: () => Promise<void>): Promise<void>;
|
|
19
20
|
replaceAction<Data, Response>(_actionId: string, _withActionId: string): Promise<DraftAction<Data, Response>>;
|
|
20
21
|
mergeActions<Data, Response>(_targetActionId: string, _sourceActionId: string): Promise<DraftAction<Data, Response>>;
|
|
21
22
|
retryAction<Data, Response>(_actionId: string): Promise<DraftAction<Data, Response>>;
|
|
@@ -21,8 +21,6 @@ export declare abstract class AbstractResourceRequestActionHandler<ResponseType>
|
|
|
21
21
|
protected readonly getLuvio: () => Luvio;
|
|
22
22
|
protected readonly recordService: UiApiDraftRecordService;
|
|
23
23
|
isIdempotencySupported: boolean;
|
|
24
|
-
isLdsIdempotencyWriteDisabled: boolean;
|
|
25
|
-
isBackdatingEnabled: boolean;
|
|
26
24
|
constructor(draftQueue: DraftQueue, networkAdapter: NetworkAdapter, getLuvio: () => Luvio, recordService: UiApiDraftRecordService);
|
|
27
25
|
enqueue(data: ResourceRequest): Promise<PendingDraftAction<ResourceRequest>>;
|
|
28
26
|
buildPendingAction(request: ResourceRequest, queue: DraftAction<unknown, unknown>[]): Promise<PendingDraftAction<ResourceRequest>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-mobile",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.328.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS runtime for mobile/hybrid environments.",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -32,23 +32,23 @@
|
|
|
32
32
|
"release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-mobile"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@salesforce/lds-adapters-uiapi": "^1.
|
|
36
|
-
"@salesforce/lds-bindings": "^1.
|
|
37
|
-
"@salesforce/lds-instrumentation": "^1.
|
|
35
|
+
"@salesforce/lds-adapters-uiapi": "^1.328.0",
|
|
36
|
+
"@salesforce/lds-bindings": "^1.328.0",
|
|
37
|
+
"@salesforce/lds-instrumentation": "^1.328.0",
|
|
38
38
|
"@salesforce/user": "0.0.21",
|
|
39
39
|
"o11y": "250.7.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@salesforce/lds-adapters-graphql": "^1.
|
|
43
|
-
"@salesforce/lds-drafts": "^1.
|
|
44
|
-
"@salesforce/lds-durable-records": "^1.
|
|
45
|
-
"@salesforce/lds-network-adapter": "^1.
|
|
46
|
-
"@salesforce/lds-network-nimbus": "^1.
|
|
47
|
-
"@salesforce/lds-store-binary": "^1.
|
|
48
|
-
"@salesforce/lds-store-nimbus": "^1.
|
|
49
|
-
"@salesforce/lds-store-sql": "^1.
|
|
50
|
-
"@salesforce/lds-utils-adapters": "^1.
|
|
51
|
-
"@salesforce/nimbus-plugin-lds": "^1.
|
|
42
|
+
"@salesforce/lds-adapters-graphql": "^1.328.0",
|
|
43
|
+
"@salesforce/lds-drafts": "^1.328.0",
|
|
44
|
+
"@salesforce/lds-durable-records": "^1.328.0",
|
|
45
|
+
"@salesforce/lds-network-adapter": "^1.328.0",
|
|
46
|
+
"@salesforce/lds-network-nimbus": "^1.328.0",
|
|
47
|
+
"@salesforce/lds-store-binary": "^1.328.0",
|
|
48
|
+
"@salesforce/lds-store-nimbus": "^1.328.0",
|
|
49
|
+
"@salesforce/lds-store-sql": "^1.328.0",
|
|
50
|
+
"@salesforce/lds-utils-adapters": "^1.328.0",
|
|
51
|
+
"@salesforce/nimbus-plugin-lds": "^1.328.0",
|
|
52
52
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
53
53
|
"wait-for-expect": "^3.0.2"
|
|
54
54
|
},
|
package/sfdc/main.js
CHANGED
|
@@ -19,14 +19,11 @@ import { withRegistration, register } from 'force/ldsEngine';
|
|
|
19
19
|
import { setupInstrumentation, instrumentAdapter as instrumentAdapter$1, instrumentLuvio, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation } from 'force/ldsInstrumentation';
|
|
20
20
|
import { HttpStatusCode, setBypassDeepFreeze, StoreKeySet, serializeStructuredKey, StringKeyInMemoryStore, Reader, deepFreeze, emitAdapterEvent, ingestShape, coerceConfig as coerceConfig$1, typeCheckConfig as typeCheckConfig$h, createResourceParams as createResourceParams$h, StoreKeyMap, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$f, resolveLink, createCustomAdapterEventEmitter, isFileReference, Environment, Luvio, InMemoryStore } from 'force/luvioEngine';
|
|
21
21
|
import { isSupportedEntity, configuration, getObjectInfoAdapterFactory, RECORD_ID_PREFIX, RECORD_FIELDS_KEY_JUNCTION, isStoreKeyRecordViewEntity, extractRecordIdFromStoreKey, buildRecordRepKeyFromId, keyBuilderRecord, RecordRepresentationTTL, keyBuilderQuickActionExecutionRepresentation, ingestQuickActionExecutionRepresentation, getRecordId18 as getRecordId18$1, getRecordsAdapterFactory as getRecordsAdapterFactory$1, RecordRepresentationRepresentationType, ObjectInfoRepresentationType, getObjectInfosAdapterFactory, getObjectInfoDirectoryAdapterFactory, UiApiNamespace, RecordRepresentationType, RecordRepresentationVersion } from 'force/ldsAdaptersUiapi';
|
|
22
|
-
import ldsIdempotencyWriteDisabled from '@salesforce/gate/lds.idempotencyWriteDisabled';
|
|
23
|
-
import ldsBackdatingEnabled from '@salesforce/gate/lds.backdatingEnabled';
|
|
24
22
|
import { Kind as Kind$1, visit as visit$1, isObjectType, defaultFieldResolver, buildSchema, parse as parse$5, extendSchema, isScalarType, execute, print } from 'force/ldsGraphqlParser';
|
|
25
23
|
import FIRST_DAY_OF_WEEK from '@salesforce/i18n/firstDayOfWeek';
|
|
26
24
|
import graphqQueryFieldLimit from '@salesforce/gate/lmr.graphqQueryFieldLimit';
|
|
27
25
|
import caseSensitiveUserId from '@salesforce/user/Id';
|
|
28
26
|
import { idleDetector, getInstrumentation } from 'o11y/client';
|
|
29
|
-
import ldsUseShortUrlGate from '@salesforce/gate/lds.useShortUrl';
|
|
30
27
|
import { instrument as instrument$1 } from 'force/ldsBindings';
|
|
31
28
|
import ldsAdapterO11yLoggingGate from '@salesforce/gate/lmr.ldsAdapterO11yLogging';
|
|
32
29
|
import LOCALE from '@salesforce/i18n/locale';
|
|
@@ -37,12 +34,8 @@ import shortTimeFormat from '@salesforce/i18n/dateTime.shortTimeFormat';
|
|
|
37
34
|
import shortDateTimeFormat from '@salesforce/i18n/dateTime.shortDateTimeFormat';
|
|
38
35
|
import { getDateTimeFormat, getDateTimeISO8601Parser, getNumberFormat } from 'lightning/i18nService';
|
|
39
36
|
import formattingOptions from 'lightning/i18nCldrOptions';
|
|
40
|
-
import eagerEvalValidAt from '@salesforce/gate/lds.eagerEvalValidAt';
|
|
41
|
-
import eagerEvalStaleWhileRevalidate from '@salesforce/gate/lds.eagerEvalStaleWhileRevalidate';
|
|
42
|
-
import eagerEvalDefaultCachePolicy from '@salesforce/gate/lds.eagerEvalDefaultCachePolicy';
|
|
43
37
|
import ldsPrimingGraphqlBatch from '@salesforce/gate/lds.primingGraphqlBatch';
|
|
44
38
|
import lmrPrimingUseSoql from '@salesforce/gate/lmr.primingUseSoql';
|
|
45
|
-
import ldsMetadataRefreshEnabled from '@salesforce/gate/lds.metadataRefreshEnabled';
|
|
46
39
|
import graphqlL2AdapterGate from '@salesforce/gate/lmr.graphqlL2Adapter';
|
|
47
40
|
|
|
48
41
|
/**
|
|
@@ -77,7 +70,7 @@ function instrument(newInstrumentation) {
|
|
|
77
70
|
const LDS_RECORDS_AGGREGATE_UI = 'LDS_Records_AggregateUi';
|
|
78
71
|
// Boundary which represents the limit that we start chunking at,
|
|
79
72
|
// determined by comma separated string length of fields
|
|
80
|
-
const MAX_STRING_LENGTH_PER_CHUNK
|
|
73
|
+
const MAX_STRING_LENGTH_PER_CHUNK = 10000;
|
|
81
74
|
// UIAPI limit
|
|
82
75
|
const MAX_AGGREGATE_UI_CHUNK_LIMIT = 50;
|
|
83
76
|
function createOkResponse$1(body) {
|
|
@@ -181,7 +174,7 @@ function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resource
|
|
|
181
174
|
});
|
|
182
175
|
}
|
|
183
176
|
function shouldUseAggregateUiForGetRecord(fieldsArray, optionalFieldsArray) {
|
|
184
|
-
return fieldsArray.length + optionalFieldsArray.length >= MAX_STRING_LENGTH_PER_CHUNK
|
|
177
|
+
return fieldsArray.length + optionalFieldsArray.length >= MAX_STRING_LENGTH_PER_CHUNK;
|
|
185
178
|
}
|
|
186
179
|
function buildAggregateUiUrl$1(params, resourceRequest) {
|
|
187
180
|
const { fields, optionalFields } = params;
|
|
@@ -200,7 +193,7 @@ function buildGetRecordByFieldsCompositeRequest(resourceRequest, recordsComposit
|
|
|
200
193
|
const { fieldsArray, optionalFieldsArray, fieldsLength, optionalFieldsLength } = recordsCompositeRequest;
|
|
201
194
|
// Formula: # of fields per chunk = floor(avg field length / max length per chunk)
|
|
202
195
|
const averageFieldStringLength = Math.floor((fieldsLength + optionalFieldsLength) / (fieldsArray.length + optionalFieldsArray.length));
|
|
203
|
-
const fieldsPerChunk = Math.floor(MAX_STRING_LENGTH_PER_CHUNK
|
|
196
|
+
const fieldsPerChunk = Math.floor(MAX_STRING_LENGTH_PER_CHUNK / averageFieldStringLength);
|
|
204
197
|
const optionalFieldsChunks = [];
|
|
205
198
|
// Do the same for optional tracked fields
|
|
206
199
|
for (let i = 0, j = optionalFieldsArray.length; i < j; i += fieldsPerChunk) {
|
|
@@ -2133,6 +2126,12 @@ class DurableDraftQueue {
|
|
|
2133
2126
|
draftCount: this.draftStore.getCount(),
|
|
2134
2127
|
});
|
|
2135
2128
|
}
|
|
2129
|
+
stopQueueWhileRunning(action) {
|
|
2130
|
+
this.stopQueueManually(true);
|
|
2131
|
+
return action().finally(() => {
|
|
2132
|
+
this.startQueueSafe();
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2136
2135
|
/**
|
|
2137
2136
|
* Used to stop the queue within DraftQueue without user interaction
|
|
2138
2137
|
*/
|
|
@@ -2917,6 +2916,14 @@ class DraftManager {
|
|
|
2917
2916
|
stopQueue() {
|
|
2918
2917
|
return this.draftQueue.stopQueue();
|
|
2919
2918
|
}
|
|
2919
|
+
/**
|
|
2920
|
+
* Stops the draft queue manually without notifying the user and then runs the passed action.
|
|
2921
|
+
* After the action is completed it will safely start the queue if the user had set it to be
|
|
2922
|
+
* started.
|
|
2923
|
+
*/
|
|
2924
|
+
stopQueueWhileRunning(action) {
|
|
2925
|
+
return this.draftQueue.stopQueueWhileRunning(action);
|
|
2926
|
+
}
|
|
2920
2927
|
/**
|
|
2921
2928
|
* Subscribes the listener to changes to the draft queue.
|
|
2922
2929
|
*
|
|
@@ -41834,11 +41841,6 @@ class AbstractResourceRequestActionHandler {
|
|
|
41834
41841
|
this.recordService = recordService;
|
|
41835
41842
|
// determined by Server setup.
|
|
41836
41843
|
this.isIdempotencySupported = true;
|
|
41837
|
-
// idempotency write flag set by lds
|
|
41838
|
-
this.isLdsIdempotencyWriteDisabled = ldsIdempotencyWriteDisabled.isOpen({
|
|
41839
|
-
fallback: false,
|
|
41840
|
-
});
|
|
41841
|
-
this.isBackdatingEnabled = ldsBackdatingEnabled.isOpen({ fallback: false });
|
|
41842
41844
|
}
|
|
41843
41845
|
enqueue(data) {
|
|
41844
41846
|
return this.draftQueue.enqueue(this.handlerId, data);
|
|
@@ -41937,8 +41939,7 @@ class AbstractResourceRequestActionHandler {
|
|
|
41937
41939
|
updatedAction.data.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
|
|
41938
41940
|
actionDataChanged = true;
|
|
41939
41941
|
}
|
|
41940
|
-
if (
|
|
41941
|
-
response.status === HttpStatusCode.BadRequest &&
|
|
41942
|
+
if (response.status === HttpStatusCode.BadRequest &&
|
|
41942
41943
|
this.isBackdatingError(response.body, action)) {
|
|
41943
41944
|
updatedAction.timestamp = Date.now();
|
|
41944
41945
|
updatedAction.data.body.fields = {
|
|
@@ -42213,7 +42214,7 @@ class AbstractResourceRequestActionHandler {
|
|
|
42213
42214
|
return [action.targetId];
|
|
42214
42215
|
}
|
|
42215
42216
|
hasIdempotencySupport() {
|
|
42216
|
-
return this.isIdempotencySupported
|
|
42217
|
+
return this.isIdempotencySupported;
|
|
42217
42218
|
}
|
|
42218
42219
|
async ingestResponses(responses, action) {
|
|
42219
42220
|
const luvio = this.getLuvio();
|
|
@@ -42341,8 +42342,7 @@ class UiApiActionHandler extends AbstractResourceRequestActionHandler {
|
|
|
42341
42342
|
}
|
|
42342
42343
|
// handles backdating
|
|
42343
42344
|
const objectInfo = await this.objectInfoService.getObjectInfo(targetApiName);
|
|
42344
|
-
if (
|
|
42345
|
-
pendingAction.data &&
|
|
42345
|
+
if (pendingAction.data &&
|
|
42346
42346
|
pendingAction.data.method !== 'delete' && //'delete' action does not have fields
|
|
42347
42347
|
objectInfo) {
|
|
42348
42348
|
const appendedFields = this.getBackdatingFields(objectInfo, resolvedRequest.method, pendingAction);
|
|
@@ -43053,7 +43053,7 @@ class ContentDocumentCompositeRepresentationActionHandler extends AbstractResour
|
|
|
43053
43053
|
if (objectInfo === undefined) {
|
|
43054
43054
|
throw Error(`Could not generate draft. Object info is missing`);
|
|
43055
43055
|
}
|
|
43056
|
-
if (
|
|
43056
|
+
if (pendingAction.data) {
|
|
43057
43057
|
pendingAction.data.body.namedEntries = [
|
|
43058
43058
|
...pendingAction.data.body.namedEntries,
|
|
43059
43059
|
...this.getBackdatingNameEntries(objectInfo, pendingAction.timestamp),
|
|
@@ -49305,18 +49305,6 @@ function createSeenRecords(ids, currentSnapshot) {
|
|
|
49305
49305
|
}
|
|
49306
49306
|
return seenRecords;
|
|
49307
49307
|
}
|
|
49308
|
-
function createErrorSnapshot(result, snapshot) {
|
|
49309
|
-
return {
|
|
49310
|
-
...snapshot,
|
|
49311
|
-
data: undefined,
|
|
49312
|
-
state: 'Error',
|
|
49313
|
-
error: {
|
|
49314
|
-
body: {
|
|
49315
|
-
message: result.errors,
|
|
49316
|
-
},
|
|
49317
|
-
},
|
|
49318
|
-
};
|
|
49319
|
-
}
|
|
49320
49308
|
function createLocalEvalSnapshot(data, seenRecords, recordId, rebuildWithLocalEval, refresh) {
|
|
49321
49309
|
return {
|
|
49322
49310
|
refresh,
|
|
@@ -49834,7 +49822,18 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
|
|
|
49834
49822
|
// currently by design if there are any graphql errors we return an ErrorSnapshot
|
|
49835
49823
|
// partial results are not supported at this time
|
|
49836
49824
|
if (gqlResult.errors !== undefined && gqlResult.errors.length > 0) {
|
|
49837
|
-
|
|
49825
|
+
const errors = gqlResult.errors || [];
|
|
49826
|
+
let responseErrors = errors.map((e) => {
|
|
49827
|
+
return { message: e instanceof Error ? e.message : String(e) };
|
|
49828
|
+
});
|
|
49829
|
+
return {
|
|
49830
|
+
data: undefined,
|
|
49831
|
+
state: 'Error',
|
|
49832
|
+
error: {
|
|
49833
|
+
errorType: 'adapterError',
|
|
49834
|
+
error: responseErrors,
|
|
49835
|
+
},
|
|
49836
|
+
};
|
|
49838
49837
|
}
|
|
49839
49838
|
// if the non-eval'ed snapshot was an error then we return a synthetic
|
|
49840
49839
|
// Fulfilled snapshot (this only happens in this code path if
|
|
@@ -50378,7 +50377,7 @@ class ScopedFieldsCollection {
|
|
|
50378
50377
|
* which there max fields list length will not exceeded the specified maxLength
|
|
50379
50378
|
* @param maxLength
|
|
50380
50379
|
*/
|
|
50381
|
-
split(maxLength =
|
|
50380
|
+
split(maxLength = MAX_URL_LENGTH) {
|
|
50382
50381
|
const size = this.size();
|
|
50383
50382
|
if (size > maxLength) {
|
|
50384
50383
|
const fieldsArray = [];
|
|
@@ -50465,7 +50464,6 @@ class ScopedFieldsCollection {
|
|
|
50465
50464
|
}
|
|
50466
50465
|
}
|
|
50467
50466
|
|
|
50468
|
-
const MAX_STRING_LENGTH_PER_CHUNK = 10000;
|
|
50469
50467
|
//Salesforce/Akamai cdn uri max size is 8898 bytes, short than normal. Per
|
|
50470
50468
|
//https://help.salesforce.com/s/articleView?id=sf.community_builder_cdn_considerations.htm&type=5
|
|
50471
50469
|
//Due to we don't know the domain ResourceRequest, here we give 8000
|
|
@@ -50700,22 +50698,18 @@ function arrayOrEmpty(array) {
|
|
|
50700
50698
|
return array !== undefined && isArray(array) ? array : [];
|
|
50701
50699
|
}
|
|
50702
50700
|
/**
|
|
50703
|
-
* Calculate the max
|
|
50704
|
-
*
|
|
50705
|
-
*
|
|
50701
|
+
* Calculate the max length per chunk.
|
|
50702
|
+
* Max chunk size is MAX_URL_LENGTH - the url without fields and optional fields.
|
|
50703
|
+
*
|
|
50706
50704
|
* @param resourceRequest
|
|
50707
50705
|
* @returns
|
|
50708
50706
|
*/
|
|
50709
50707
|
function getMaxLengthPerChunkAllowed(request) {
|
|
50710
|
-
if (!ldsUseShortUrlGate.isOpen({ fallback: false })) {
|
|
50711
|
-
return MAX_STRING_LENGTH_PER_CHUNK;
|
|
50712
|
-
}
|
|
50713
50708
|
// Too much work to get exact length of the final url, so use stringified json to get the rough length.
|
|
50714
50709
|
const roughUrlLengthWithoutFieldsAndOptionFields = request.basePath.length +
|
|
50715
50710
|
request.baseUri.length +
|
|
50716
50711
|
(request.urlParams ? stringify$1(request.urlParams).length : 0) +
|
|
50717
50712
|
stringify$1({ ...request.queryParams, fields: {}, optionalFields: {} }).length;
|
|
50718
|
-
// MAX_URL_LENGTH - full lenght without fields, optionalFields
|
|
50719
50713
|
return MAX_URL_LENGTH - roughUrlLengthWithoutFieldsAndOptionFields;
|
|
50720
50714
|
}
|
|
50721
50715
|
// we don't have access to the host so we cannot calculate the exact length of the url
|
|
@@ -51015,6 +51009,9 @@ class NimbusDraftQueue {
|
|
|
51015
51009
|
stopQueue() {
|
|
51016
51010
|
return Promise.reject(new Error('Cannot call stopQueue from the NimbusDraftQueue'));
|
|
51017
51011
|
}
|
|
51012
|
+
stopQueueWhileRunning(_action) {
|
|
51013
|
+
return Promise.reject(new Error('Cannot call stopQueueWhileRunning from the NimbusDraftQueue'));
|
|
51014
|
+
}
|
|
51018
51015
|
replaceAction(_actionId, _withActionId) {
|
|
51019
51016
|
return Promise.reject(new Error('Cannot call replaceAction from the NimbusDraftQueue'));
|
|
51020
51017
|
}
|
|
@@ -52294,22 +52291,14 @@ function makeEnvironmentGraphqlAware(environment) {
|
|
|
52294
52291
|
return upstream;
|
|
52295
52292
|
};
|
|
52296
52293
|
const { cachePolicy } = adapterRequestContext;
|
|
52297
|
-
if (
|
|
52298
|
-
cachePolicy &&
|
|
52294
|
+
if (cachePolicy &&
|
|
52299
52295
|
cachePolicy.type === 'valid-at' &&
|
|
52300
52296
|
cachePolicy.timestamp === 0 &&
|
|
52301
52297
|
cachePolicy.basePolicy &&
|
|
52302
52298
|
cachePolicy.basePolicy.type === 'stale-while-revalidate') {
|
|
52303
52299
|
localBuildCachedSnapshot = hoistUnfulfilledToStale;
|
|
52304
52300
|
}
|
|
52305
|
-
if (
|
|
52306
|
-
cachePolicy &&
|
|
52307
|
-
cachePolicy.type === 'stale-while-revalidate' &&
|
|
52308
|
-
cachePolicy.staleDurationSeconds >= Number.MAX_SAFE_INTEGER) {
|
|
52309
|
-
localBuildCachedSnapshot = hoistUnfulfilledToStale;
|
|
52310
|
-
}
|
|
52311
|
-
if (eagerEvalDefaultCachePolicy.isOpen({ fallback: false }) &&
|
|
52312
|
-
(cachePolicy === undefined || cachePolicy === null)) {
|
|
52301
|
+
if (cachePolicy === undefined || cachePolicy === null) {
|
|
52313
52302
|
localBuildCachedSnapshot = hoistUnfulfilledToStale;
|
|
52314
52303
|
}
|
|
52315
52304
|
return environment.applyCachePolicy(luvio, adapterRequestContext, buildSnapshotContext, localBuildCachedSnapshot, buildNetworkSnapshot);
|
|
@@ -55203,7 +55192,7 @@ function getRuntime() {
|
|
|
55203
55192
|
const gqlEnv = makeEnvironmentGraphqlAware(baseEnv);
|
|
55204
55193
|
const durableEnv = makeDurable(gqlEnv, {
|
|
55205
55194
|
durableStore: lazyDurableStore,
|
|
55206
|
-
enableDurableMetadataRefresh:
|
|
55195
|
+
enableDurableMetadataRefresh: true,
|
|
55207
55196
|
// disable luvio deep freeze in headless environments
|
|
55208
55197
|
disableDeepFreeze: typeof window === 'undefined',
|
|
55209
55198
|
shouldFlush,
|
|
@@ -55324,4 +55313,4 @@ register({
|
|
|
55324
55313
|
});
|
|
55325
55314
|
|
|
55326
55315
|
export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, registerReportObserver, reportGraphqlQueryParseError };
|
|
55327
|
-
// version: 1.
|
|
55316
|
+
// version: 1.328.0-f3d79bc783
|
|
@@ -16,6 +16,7 @@ export declare class NimbusDraftQueue implements DraftQueue {
|
|
|
16
16
|
removeDraftAction(_actionId: string): Promise<void>;
|
|
17
17
|
startQueue(): Promise<void>;
|
|
18
18
|
stopQueue(): Promise<void>;
|
|
19
|
+
stopQueueWhileRunning(_action: () => Promise<void>): Promise<void>;
|
|
19
20
|
replaceAction<Data, Response>(_actionId: string, _withActionId: string): Promise<DraftAction<Data, Response>>;
|
|
20
21
|
mergeActions<Data, Response>(_targetActionId: string, _sourceActionId: string): Promise<DraftAction<Data, Response>>;
|
|
21
22
|
retryAction<Data, Response>(_actionId: string): Promise<DraftAction<Data, Response>>;
|
|
@@ -21,8 +21,6 @@ export declare abstract class AbstractResourceRequestActionHandler<ResponseType>
|
|
|
21
21
|
protected readonly getLuvio: () => Luvio;
|
|
22
22
|
protected readonly recordService: UiApiDraftRecordService;
|
|
23
23
|
isIdempotencySupported: boolean;
|
|
24
|
-
isLdsIdempotencyWriteDisabled: boolean;
|
|
25
|
-
isBackdatingEnabled: boolean;
|
|
26
24
|
constructor(draftQueue: DraftQueue, networkAdapter: NetworkAdapter, getLuvio: () => Luvio, recordService: UiApiDraftRecordService);
|
|
27
25
|
enqueue(data: ResourceRequest): Promise<PendingDraftAction<ResourceRequest>>;
|
|
28
26
|
buildPendingAction(request: ResourceRequest, queue: DraftAction<unknown, unknown>[]): Promise<PendingDraftAction<ResourceRequest>>;
|