@salesforce/lds-runtime-mobile 1.380.0-dev5 → 1.380.0-dev6
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 +136 -43
- package/package.json +32 -32
- package/sfdc/main.js +136 -43
package/dist/main.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { withRegistration, register } from '@salesforce/lds-default-luvio';
|
|
19
19
|
import { setupInstrumentation, instrumentAdapter as instrumentAdapter$1, instrumentLuvio, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation } from '@salesforce/lds-instrumentation';
|
|
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';
|
|
20
|
+
import { HttpStatusCode as HttpStatusCode$1, 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
22
|
import { getInstrumentation, idleDetector } from 'o11y/client';
|
|
23
23
|
import { Kind as Kind$2, visit as visit$2, isObjectType, defaultFieldResolver, buildSchema, parse as parse$8, extendSchema, isScalarType, execute, print as print$1 } from '@luvio/graphql-parser';
|
|
@@ -81,7 +81,7 @@ const MAX_STRING_LENGTH_PER_CHUNK = 10000;
|
|
|
81
81
|
const MAX_AGGREGATE_UI_CHUNK_LIMIT = 50;
|
|
82
82
|
function createOkResponse$1(body) {
|
|
83
83
|
return {
|
|
84
|
-
status: HttpStatusCode.Ok,
|
|
84
|
+
status: HttpStatusCode$1.Ok,
|
|
85
85
|
body,
|
|
86
86
|
statusText: 'ok',
|
|
87
87
|
headers: {},
|
|
@@ -90,15 +90,15 @@ function createOkResponse$1(body) {
|
|
|
90
90
|
}
|
|
91
91
|
function getErrorResponseText(status) {
|
|
92
92
|
switch (status) {
|
|
93
|
-
case HttpStatusCode.Ok:
|
|
93
|
+
case HttpStatusCode$1.Ok:
|
|
94
94
|
return 'OK';
|
|
95
|
-
case HttpStatusCode.NotModified:
|
|
95
|
+
case HttpStatusCode$1.NotModified:
|
|
96
96
|
return 'Not Modified';
|
|
97
|
-
case HttpStatusCode.NotFound:
|
|
97
|
+
case HttpStatusCode$1.NotFound:
|
|
98
98
|
return 'Not Found';
|
|
99
|
-
case HttpStatusCode.BadRequest:
|
|
99
|
+
case HttpStatusCode$1.BadRequest:
|
|
100
100
|
return 'Bad Request';
|
|
101
|
-
case HttpStatusCode.ServerError:
|
|
101
|
+
case HttpStatusCode$1.ServerError:
|
|
102
102
|
return 'Server Error';
|
|
103
103
|
default:
|
|
104
104
|
return `Unexpected HTTP Status Code: ${status}`;
|
|
@@ -150,14 +150,14 @@ function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resource
|
|
|
150
150
|
body.compositeResponse === undefined ||
|
|
151
151
|
body.compositeResponse.length === 0) {
|
|
152
152
|
// We shouldn't even get into this state - a 200 with no body?
|
|
153
|
-
throw createErrorResponse(HttpStatusCode.ServerError, {
|
|
153
|
+
throw createErrorResponse(HttpStatusCode$1.ServerError, {
|
|
154
154
|
error: 'No response body in executeAggregateUi found',
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
const merged = body.compositeResponse.reduce((seed, response) => {
|
|
158
|
-
if (response.httpStatusCode !== HttpStatusCode.Ok) {
|
|
158
|
+
if (response.httpStatusCode !== HttpStatusCode$1.Ok) {
|
|
159
159
|
instrumentation$3.getRecordAggregateReject(() => recordId);
|
|
160
|
-
throw createErrorResponse(HttpStatusCode.ServerError, {
|
|
160
|
+
throw createErrorResponse(HttpStatusCode$1.ServerError, {
|
|
161
161
|
error: response.message,
|
|
162
162
|
});
|
|
163
163
|
}
|
|
@@ -239,8 +239,8 @@ const UIAPI_RECORDS_BATCH_PATH = `${UI_API_BASE_URI}/records/batch/`;
|
|
|
239
239
|
const QUERY_TOO_COMPLICATED_ERROR_CODE = 'QUERY_TOO_COMPLICATED';
|
|
240
240
|
function fetchResponseIsQueryTooComplicated(error) {
|
|
241
241
|
const { body } = error;
|
|
242
|
-
if (error.status === HttpStatusCode.BadRequest && body !== undefined) {
|
|
243
|
-
return (body.statusCode === HttpStatusCode.BadRequest &&
|
|
242
|
+
if (error.status === HttpStatusCode$1.BadRequest && body !== undefined) {
|
|
243
|
+
return (body.statusCode === HttpStatusCode$1.BadRequest &&
|
|
244
244
|
body.errorCode === QUERY_TOO_COMPLICATED_ERROR_CODE);
|
|
245
245
|
}
|
|
246
246
|
return false;
|
|
@@ -1866,15 +1866,15 @@ class DraftFetchResponse {
|
|
|
1866
1866
|
get statusText() {
|
|
1867
1867
|
const { status } = this;
|
|
1868
1868
|
switch (status) {
|
|
1869
|
-
case HttpStatusCode.Ok:
|
|
1869
|
+
case HttpStatusCode$1.Ok:
|
|
1870
1870
|
return 'OK';
|
|
1871
|
-
case HttpStatusCode.Created:
|
|
1871
|
+
case HttpStatusCode$1.Created:
|
|
1872
1872
|
return 'Created';
|
|
1873
|
-
case HttpStatusCode.NoContent:
|
|
1873
|
+
case HttpStatusCode$1.NoContent:
|
|
1874
1874
|
return 'No Content';
|
|
1875
|
-
case HttpStatusCode.BadRequest:
|
|
1875
|
+
case HttpStatusCode$1.BadRequest:
|
|
1876
1876
|
return 'Bad Request';
|
|
1877
|
-
case HttpStatusCode.ServerError:
|
|
1877
|
+
case HttpStatusCode$1.ServerError:
|
|
1878
1878
|
return 'Server Error';
|
|
1879
1879
|
default:
|
|
1880
1880
|
return `Unexpected HTTP Status Code: ${status}`;
|
|
@@ -1895,11 +1895,11 @@ class DraftErrorFetchResponse {
|
|
|
1895
1895
|
get statusText() {
|
|
1896
1896
|
const { status } = this;
|
|
1897
1897
|
switch (status) {
|
|
1898
|
-
case HttpStatusCode.BadRequest:
|
|
1898
|
+
case HttpStatusCode$1.BadRequest:
|
|
1899
1899
|
return 'Bad Request';
|
|
1900
|
-
case HttpStatusCode.ServerError:
|
|
1900
|
+
case HttpStatusCode$1.ServerError:
|
|
1901
1901
|
return 'Server Error';
|
|
1902
|
-
case HttpStatusCode.NotFound:
|
|
1902
|
+
case HttpStatusCode$1.NotFound:
|
|
1903
1903
|
return 'Not Found';
|
|
1904
1904
|
default:
|
|
1905
1905
|
return `Unexpected HTTP Status Code: ${status}`;
|
|
@@ -1907,13 +1907,13 @@ class DraftErrorFetchResponse {
|
|
|
1907
1907
|
}
|
|
1908
1908
|
}
|
|
1909
1909
|
function createOkResponse(body) {
|
|
1910
|
-
return new DraftFetchResponse(HttpStatusCode.Ok, body);
|
|
1910
|
+
return new DraftFetchResponse(HttpStatusCode$1.Ok, body);
|
|
1911
1911
|
}
|
|
1912
1912
|
function createBadRequestResponse(body) {
|
|
1913
|
-
return new DraftErrorFetchResponse(HttpStatusCode.BadRequest, body);
|
|
1913
|
+
return new DraftErrorFetchResponse(HttpStatusCode$1.BadRequest, body);
|
|
1914
1914
|
}
|
|
1915
1915
|
function createNotFoundResponse(body) {
|
|
1916
|
-
return new DraftErrorFetchResponse(HttpStatusCode.NotFound, body);
|
|
1916
|
+
return new DraftErrorFetchResponse(HttpStatusCode$1.NotFound, body);
|
|
1917
1917
|
}
|
|
1918
1918
|
function transformErrorToDraftSynthesisError(error) {
|
|
1919
1919
|
if (isDraftSynthesisError(error)) {
|
|
@@ -1930,7 +1930,7 @@ function createDraftSynthesisErrorResponse(message = 'failed to synthesize draft
|
|
|
1930
1930
|
if (errorType !== undefined) {
|
|
1931
1931
|
error.errorType = errorType;
|
|
1932
1932
|
}
|
|
1933
|
-
return new DraftErrorFetchResponse(HttpStatusCode.BadRequest, error);
|
|
1933
|
+
return new DraftErrorFetchResponse(HttpStatusCode$1.BadRequest, error);
|
|
1934
1934
|
}
|
|
1935
1935
|
|
|
1936
1936
|
/**
|
|
@@ -41882,7 +41882,7 @@ class AbstractResourceRequestActionHandler {
|
|
|
41882
41882
|
retryDelayInMs = getRetryAfterInMs(response.headers);
|
|
41883
41883
|
shouldRetry = true;
|
|
41884
41884
|
break;
|
|
41885
|
-
case HttpStatusCode.ServerError: {
|
|
41885
|
+
case HttpStatusCode$1.ServerError: {
|
|
41886
41886
|
shouldRetry = true;
|
|
41887
41887
|
if (this.handleIdempotencyServerError(response.body, updatedAction, false, ERROR_CODE_IDEMPOTENCY_BACKEND_OPERATION_ERROR)) {
|
|
41888
41888
|
this.isIdempotencySupported = false;
|
|
@@ -41905,7 +41905,7 @@ class AbstractResourceRequestActionHandler {
|
|
|
41905
41905
|
}
|
|
41906
41906
|
break;
|
|
41907
41907
|
}
|
|
41908
|
-
case HttpStatusCode.BadRequest: {
|
|
41908
|
+
case HttpStatusCode$1.BadRequest: {
|
|
41909
41909
|
if (this.handleIdempotencyServerError(response.body, updatedAction, false, ERROR_CODE_IDEMPOTENCY_FEATURE_NOT_ENABLED, ERROR_CODE_IDEMPOTENCY_NOT_SUPPORTED)) {
|
|
41910
41910
|
retryDelayInMs = 0;
|
|
41911
41911
|
actionDataChanged = true;
|
|
@@ -41923,13 +41923,13 @@ class AbstractResourceRequestActionHandler {
|
|
|
41923
41923
|
}
|
|
41924
41924
|
}
|
|
41925
41925
|
}
|
|
41926
|
-
if (response.status === HttpStatusCode.BadRequest &&
|
|
41926
|
+
if (response.status === HttpStatusCode$1.BadRequest &&
|
|
41927
41927
|
this.hasIdempotencySupport() &&
|
|
41928
41928
|
updatedAction.data.headers[HTTP_HEADER_IDEMPOTENCY_KEY] !== undefined) {
|
|
41929
41929
|
updatedAction.data.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
|
|
41930
41930
|
actionDataChanged = true;
|
|
41931
41931
|
}
|
|
41932
|
-
if (response.status === HttpStatusCode.BadRequest &&
|
|
41932
|
+
if (response.status === HttpStatusCode$1.BadRequest &&
|
|
41933
41933
|
this.isBackdatingError(response.body, action)) {
|
|
41934
41934
|
updatedAction.timestamp = Date.now();
|
|
41935
41935
|
updatedAction.data.body.fields = {
|
|
@@ -50528,7 +50528,7 @@ function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio, is
|
|
|
50528
50528
|
// remove injected fields from response.
|
|
50529
50529
|
const data = snapshot.data;
|
|
50530
50530
|
const userResults = data.results.map((compositeResult, index) => {
|
|
50531
|
-
if (compositeResult.statusCode === HttpStatusCode.Ok) {
|
|
50531
|
+
if (compositeResult.statusCode === HttpStatusCode$1.Ok) {
|
|
50532
50532
|
return {
|
|
50533
50533
|
result: removeSyntheticFields(compositeResult.result, config.batchQuery[index].query),
|
|
50534
50534
|
statusCode: compositeResult.statusCode,
|
|
@@ -50745,15 +50745,15 @@ function ldsParamsToString(params) {
|
|
|
50745
50745
|
}
|
|
50746
50746
|
function statusTextFromStatusCode(status) {
|
|
50747
50747
|
switch (status) {
|
|
50748
|
-
case HttpStatusCode.Ok:
|
|
50748
|
+
case HttpStatusCode$1.Ok:
|
|
50749
50749
|
return 'OK';
|
|
50750
|
-
case HttpStatusCode.NotModified:
|
|
50750
|
+
case HttpStatusCode$1.NotModified:
|
|
50751
50751
|
return 'Not Modified';
|
|
50752
|
-
case HttpStatusCode.NotFound:
|
|
50752
|
+
case HttpStatusCode$1.NotFound:
|
|
50753
50753
|
return 'Not Found';
|
|
50754
|
-
case HttpStatusCode.BadRequest:
|
|
50754
|
+
case HttpStatusCode$1.BadRequest:
|
|
50755
50755
|
return 'Bad Request';
|
|
50756
|
-
case HttpStatusCode.ServerError:
|
|
50756
|
+
case HttpStatusCode$1.ServerError:
|
|
50757
50757
|
return 'Server Error';
|
|
50758
50758
|
default:
|
|
50759
50759
|
return `Unexpected HTTP Status Code: ${status}`;
|
|
@@ -51121,7 +51121,7 @@ function mergeAggregateUiResponse(response, mergeFunc) {
|
|
|
51121
51121
|
return {
|
|
51122
51122
|
...response,
|
|
51123
51123
|
ok: false,
|
|
51124
|
-
status: HttpStatusCode.ServerError,
|
|
51124
|
+
status: HttpStatusCode$1.ServerError,
|
|
51125
51125
|
statusText: PARSE_ERROR,
|
|
51126
51126
|
body: [
|
|
51127
51127
|
{
|
|
@@ -51179,9 +51179,9 @@ function mergeBatchRecordsFields(first, second, collectionMergeFunc) {
|
|
|
51179
51179
|
for (let i = 0, len = targetResults.length; i < len; i += 1) {
|
|
51180
51180
|
const targetResult = targetResults[i];
|
|
51181
51181
|
const sourceResult = sourceResults[i];
|
|
51182
|
-
if (targetResult.statusCode !== HttpStatusCode.Ok)
|
|
51182
|
+
if (targetResult.statusCode !== HttpStatusCode$1.Ok)
|
|
51183
51183
|
continue;
|
|
51184
|
-
if (sourceResult.statusCode !== HttpStatusCode.Ok) {
|
|
51184
|
+
if (sourceResult.statusCode !== HttpStatusCode$1.Ok) {
|
|
51185
51185
|
targetResults[i] = sourceResult;
|
|
51186
51186
|
continue;
|
|
51187
51187
|
}
|
|
@@ -55929,6 +55929,47 @@ function toError(x) {
|
|
|
55929
55929
|
}
|
|
55930
55930
|
return new Error(typeof x === "string" ? x : JSON.stringify(x));
|
|
55931
55931
|
}
|
|
55932
|
+
var HttpStatusCode = /* @__PURE__ */ ((HttpStatusCode2) => {
|
|
55933
|
+
HttpStatusCode2[HttpStatusCode2["Ok"] = 200] = "Ok";
|
|
55934
|
+
HttpStatusCode2[HttpStatusCode2["Created"] = 201] = "Created";
|
|
55935
|
+
HttpStatusCode2[HttpStatusCode2["NoContent"] = 204] = "NoContent";
|
|
55936
|
+
HttpStatusCode2[HttpStatusCode2["NotModified"] = 304] = "NotModified";
|
|
55937
|
+
HttpStatusCode2[HttpStatusCode2["BadRequest"] = 400] = "BadRequest";
|
|
55938
|
+
HttpStatusCode2[HttpStatusCode2["Unauthorized"] = 401] = "Unauthorized";
|
|
55939
|
+
HttpStatusCode2[HttpStatusCode2["Forbidden"] = 403] = "Forbidden";
|
|
55940
|
+
HttpStatusCode2[HttpStatusCode2["NotFound"] = 404] = "NotFound";
|
|
55941
|
+
HttpStatusCode2[HttpStatusCode2["ServerError"] = 500] = "ServerError";
|
|
55942
|
+
HttpStatusCode2[HttpStatusCode2["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
55943
|
+
return HttpStatusCode2;
|
|
55944
|
+
})(HttpStatusCode || {});
|
|
55945
|
+
function getStatusText(status) {
|
|
55946
|
+
switch (status) {
|
|
55947
|
+
case 200:
|
|
55948
|
+
return "OK";
|
|
55949
|
+
case 201:
|
|
55950
|
+
return "Created";
|
|
55951
|
+
case 304:
|
|
55952
|
+
return "Not Modified";
|
|
55953
|
+
case 400:
|
|
55954
|
+
return "Bad Request";
|
|
55955
|
+
case 404:
|
|
55956
|
+
return "Not Found";
|
|
55957
|
+
case 500:
|
|
55958
|
+
return "Server Error";
|
|
55959
|
+
default:
|
|
55960
|
+
return `Unexpected HTTP Status Code: ${status}`;
|
|
55961
|
+
}
|
|
55962
|
+
}
|
|
55963
|
+
class FetchResponse extends Error {
|
|
55964
|
+
constructor(status, body, headers) {
|
|
55965
|
+
super();
|
|
55966
|
+
this.status = status;
|
|
55967
|
+
this.body = body;
|
|
55968
|
+
this.headers = headers || {};
|
|
55969
|
+
this.ok = status >= 200 && this.status <= 299;
|
|
55970
|
+
this.statusText = getStatusText(status);
|
|
55971
|
+
}
|
|
55972
|
+
}
|
|
55932
55973
|
class InternalError extends Error {
|
|
55933
55974
|
constructor(data) {
|
|
55934
55975
|
super();
|
|
@@ -56751,9 +56792,6 @@ class AuraResourceCacheControlCommand extends AuraCacheControlCommand {
|
|
|
56751
56792
|
super(services);
|
|
56752
56793
|
this.services = services;
|
|
56753
56794
|
}
|
|
56754
|
-
execute() {
|
|
56755
|
-
return super.execute();
|
|
56756
|
-
}
|
|
56757
56795
|
readFromCache(cache) {
|
|
56758
56796
|
var _a;
|
|
56759
56797
|
const data = (_a = cache.get(this.buildKey())) == null ? void 0 : _a.value;
|
|
@@ -57355,6 +57393,59 @@ class MaxAgeCacheControlStrategy extends CacheControlStrategy {
|
|
|
57355
57393
|
];
|
|
57356
57394
|
}
|
|
57357
57395
|
}
|
|
57396
|
+
class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
|
|
57397
|
+
execute(options) {
|
|
57398
|
+
const startTime = this.services.instrumentation ? this.services.instrumentation.currentTimeMs() : 0;
|
|
57399
|
+
return this.services.cacheInclusionPolicy.read({
|
|
57400
|
+
l1: this.filteredCache,
|
|
57401
|
+
readFromL1: (l1) => this.requestRunner.readFromCache(l1)
|
|
57402
|
+
}).then((result) => {
|
|
57403
|
+
if (result.isOk()) {
|
|
57404
|
+
this.collectCacheHitInstrumentation(
|
|
57405
|
+
startTime,
|
|
57406
|
+
options == null ? void 0 : options.instrumentationAttributes
|
|
57407
|
+
);
|
|
57408
|
+
return ok$1(void 0);
|
|
57409
|
+
}
|
|
57410
|
+
this.collectCacheMissInstrumentation(startTime, options == null ? void 0 : options.instrumentationAttributes);
|
|
57411
|
+
const error = new UserVisibleError(
|
|
57412
|
+
new FetchResponse(HttpStatusCode.GatewayTimeout, {
|
|
57413
|
+
error: "Cache miss for only-if-cached request"
|
|
57414
|
+
})
|
|
57415
|
+
);
|
|
57416
|
+
return err$1(error);
|
|
57417
|
+
});
|
|
57418
|
+
}
|
|
57419
|
+
get expiredChecks() {
|
|
57420
|
+
return [
|
|
57421
|
+
(cacheControlMetadata) => cacheControlMetadata.type === "no-store"
|
|
57422
|
+
];
|
|
57423
|
+
}
|
|
57424
|
+
collectCacheHitInstrumentation(startTime, instrumentationAttributes) {
|
|
57425
|
+
if (this.services.instrumentation) {
|
|
57426
|
+
const meter = this.services.instrumentation.metrics.getMeter("onestore");
|
|
57427
|
+
meter.createCounter(`command.only-if-cached.cache-hit.count`).add(1, instrumentationAttributes);
|
|
57428
|
+
meter.createHistogram(
|
|
57429
|
+
`command.only-if-cached.cache-hit.duration`
|
|
57430
|
+
).record(
|
|
57431
|
+
this.services.instrumentation.currentTimeMs() - startTime,
|
|
57432
|
+
instrumentationAttributes
|
|
57433
|
+
);
|
|
57434
|
+
}
|
|
57435
|
+
}
|
|
57436
|
+
collectCacheMissInstrumentation(startTime, instrumentationAttributes) {
|
|
57437
|
+
if (this.services.instrumentation) {
|
|
57438
|
+
const meter = this.services.instrumentation.metrics.getMeter("onestore");
|
|
57439
|
+
meter.createCounter(`command.only-if-cached.cache-miss.count`).add(1, instrumentationAttributes);
|
|
57440
|
+
meter.createHistogram(
|
|
57441
|
+
`command.only-if-cached.cache-miss.duration`
|
|
57442
|
+
).record(
|
|
57443
|
+
this.services.instrumentation.currentTimeMs() - startTime,
|
|
57444
|
+
instrumentationAttributes
|
|
57445
|
+
);
|
|
57446
|
+
}
|
|
57447
|
+
}
|
|
57448
|
+
}
|
|
57358
57449
|
class CacheController {
|
|
57359
57450
|
constructor(services) {
|
|
57360
57451
|
this.services = services;
|
|
@@ -57368,6 +57459,8 @@ class CacheController {
|
|
|
57368
57459
|
return new MaxAgeCacheControlStrategy(this.services, config, requestRunner);
|
|
57369
57460
|
} else if (config.type === "no-cache") {
|
|
57370
57461
|
return new NoCacheCacheControlStrategy(this.services, config, requestRunner);
|
|
57462
|
+
} else if (config.type === "only-if-cached") {
|
|
57463
|
+
return new OnlyIfCachedCacheControlStrategy(this.services, config, requestRunner);
|
|
57371
57464
|
}
|
|
57372
57465
|
throw new Error(`Unknown cache control strategy ${config.type}`);
|
|
57373
57466
|
}
|
|
@@ -57886,7 +57979,7 @@ function buildServiceDescriptor$5(luvio) {
|
|
|
57886
57979
|
},
|
|
57887
57980
|
};
|
|
57888
57981
|
}
|
|
57889
|
-
// version: 1.380.0-
|
|
57982
|
+
// version: 1.380.0-dev6-9d4fd6e5dc
|
|
57890
57983
|
|
|
57891
57984
|
/**
|
|
57892
57985
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -57912,7 +58005,7 @@ function buildServiceDescriptor$4(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
57912
58005
|
},
|
|
57913
58006
|
};
|
|
57914
58007
|
}
|
|
57915
|
-
// version: 1.380.0-
|
|
58008
|
+
// version: 1.380.0-dev6-9d4fd6e5dc
|
|
57916
58009
|
|
|
57917
58010
|
/*!
|
|
57918
58011
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -60065,4 +60158,4 @@ register({
|
|
|
60065
60158
|
});
|
|
60066
60159
|
|
|
60067
60160
|
export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, ingest$1o as ingestDenormalizedRecordRepresentation, initializeOneStore, registerReportObserver, reportGraphqlQueryParseError };
|
|
60068
|
-
// version: 1.380.0-
|
|
60161
|
+
// version: 1.380.0-dev6-1891f38076
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-mobile",
|
|
3
|
-
"version": "1.380.0-
|
|
3
|
+
"version": "1.380.0-dev6",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "LDS runtime for mobile/hybrid environments.",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -32,42 +32,42 @@
|
|
|
32
32
|
"release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-mobile"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@luvio/service-provisioner": "5.
|
|
36
|
-
"@salesforce/lds-adapters-uiapi": "^1.380.0-
|
|
37
|
-
"@salesforce/lds-bindings": "^1.380.0-
|
|
38
|
-
"@salesforce/lds-instrumentation": "^1.380.0-
|
|
39
|
-
"@salesforce/lds-luvio-service": "^1.380.0-
|
|
40
|
-
"@salesforce/lds-luvio-uiapi-records-service": "^1.380.0-
|
|
35
|
+
"@luvio/service-provisioner": "5.60.0-dev1",
|
|
36
|
+
"@salesforce/lds-adapters-uiapi": "^1.380.0-dev6",
|
|
37
|
+
"@salesforce/lds-bindings": "^1.380.0-dev6",
|
|
38
|
+
"@salesforce/lds-instrumentation": "^1.380.0-dev6",
|
|
39
|
+
"@salesforce/lds-luvio-service": "^1.380.0-dev6",
|
|
40
|
+
"@salesforce/lds-luvio-uiapi-records-service": "^1.380.0-dev6",
|
|
41
41
|
"@salesforce/user": "0.0.21",
|
|
42
42
|
"o11y": "250.7.0",
|
|
43
43
|
"o11y_schema": "256.126.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@luvio/command-aura-network": "5.
|
|
47
|
-
"@luvio/command-aura-normalized-cache-control": "5.
|
|
48
|
-
"@luvio/command-aura-resource-cache-control": "5.
|
|
49
|
-
"@luvio/command-fetch-network": "5.
|
|
50
|
-
"@luvio/command-http-normalized-cache-control": "5.
|
|
51
|
-
"@luvio/command-network": "5.
|
|
52
|
-
"@luvio/service-cache": "5.
|
|
53
|
-
"@luvio/service-cache-control": "5.
|
|
54
|
-
"@luvio/service-cache-inclusion-policy": "5.
|
|
55
|
-
"@luvio/service-fetch-network": "5.
|
|
56
|
-
"@luvio/service-instrument-command": "5.
|
|
57
|
-
"@luvio/service-instrumentation": "5.
|
|
58
|
-
"@luvio/service-pubsub": "5.
|
|
59
|
-
"@luvio/service-store": "5.
|
|
60
|
-
"@luvio/utils": "5.
|
|
61
|
-
"@salesforce/lds-adapters-graphql": "^1.380.0-
|
|
62
|
-
"@salesforce/lds-drafts": "^1.380.0-
|
|
63
|
-
"@salesforce/lds-durable-records": "^1.380.0-
|
|
64
|
-
"@salesforce/lds-network-adapter": "^1.380.0-
|
|
65
|
-
"@salesforce/lds-network-nimbus": "^1.380.0-
|
|
66
|
-
"@salesforce/lds-store-binary": "^1.380.0-
|
|
67
|
-
"@salesforce/lds-store-nimbus": "^1.380.0-
|
|
68
|
-
"@salesforce/lds-store-sql": "^1.380.0-
|
|
69
|
-
"@salesforce/lds-utils-adapters": "^1.380.0-
|
|
70
|
-
"@salesforce/nimbus-plugin-lds": "^1.380.0-
|
|
46
|
+
"@luvio/command-aura-network": "5.60.0-dev1",
|
|
47
|
+
"@luvio/command-aura-normalized-cache-control": "5.60.0-dev1",
|
|
48
|
+
"@luvio/command-aura-resource-cache-control": "5.60.0-dev1",
|
|
49
|
+
"@luvio/command-fetch-network": "5.60.0-dev1",
|
|
50
|
+
"@luvio/command-http-normalized-cache-control": "5.60.0-dev1",
|
|
51
|
+
"@luvio/command-network": "5.60.0-dev1",
|
|
52
|
+
"@luvio/service-cache": "5.60.0-dev1",
|
|
53
|
+
"@luvio/service-cache-control": "5.60.0-dev1",
|
|
54
|
+
"@luvio/service-cache-inclusion-policy": "5.60.0-dev1",
|
|
55
|
+
"@luvio/service-fetch-network": "5.60.0-dev1",
|
|
56
|
+
"@luvio/service-instrument-command": "5.60.0-dev1",
|
|
57
|
+
"@luvio/service-instrumentation": "5.60.0-dev1",
|
|
58
|
+
"@luvio/service-pubsub": "5.60.0-dev1",
|
|
59
|
+
"@luvio/service-store": "5.60.0-dev1",
|
|
60
|
+
"@luvio/utils": "5.60.0-dev1",
|
|
61
|
+
"@salesforce/lds-adapters-graphql": "^1.380.0-dev6",
|
|
62
|
+
"@salesforce/lds-drafts": "^1.380.0-dev6",
|
|
63
|
+
"@salesforce/lds-durable-records": "^1.380.0-dev6",
|
|
64
|
+
"@salesforce/lds-network-adapter": "^1.380.0-dev6",
|
|
65
|
+
"@salesforce/lds-network-nimbus": "^1.380.0-dev6",
|
|
66
|
+
"@salesforce/lds-store-binary": "^1.380.0-dev6",
|
|
67
|
+
"@salesforce/lds-store-nimbus": "^1.380.0-dev6",
|
|
68
|
+
"@salesforce/lds-store-sql": "^1.380.0-dev6",
|
|
69
|
+
"@salesforce/lds-utils-adapters": "^1.380.0-dev6",
|
|
70
|
+
"@salesforce/nimbus-plugin-lds": "^1.380.0-dev6",
|
|
71
71
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
72
72
|
"wait-for-expect": "^3.0.2"
|
|
73
73
|
},
|
package/sfdc/main.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { withRegistration, register } from 'force/ldsEngine';
|
|
19
19
|
import { setupInstrumentation, instrumentAdapter as instrumentAdapter$1, instrumentLuvio, setLdsAdaptersUiapiInstrumentation, setLdsNetworkAdapterInstrumentation } from 'force/ldsInstrumentation';
|
|
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';
|
|
20
|
+
import { HttpStatusCode as HttpStatusCode$1, 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
22
|
import { getInstrumentation, idleDetector } from 'o11y/client';
|
|
23
23
|
import { Kind as Kind$2, visit as visit$2, isObjectType, defaultFieldResolver, buildSchema, parse as parse$8, extendSchema, isScalarType, execute, print as print$1 } from 'force/ldsGraphqlParser';
|
|
@@ -81,7 +81,7 @@ const MAX_STRING_LENGTH_PER_CHUNK = 10000;
|
|
|
81
81
|
const MAX_AGGREGATE_UI_CHUNK_LIMIT = 50;
|
|
82
82
|
function createOkResponse$1(body) {
|
|
83
83
|
return {
|
|
84
|
-
status: HttpStatusCode.Ok,
|
|
84
|
+
status: HttpStatusCode$1.Ok,
|
|
85
85
|
body,
|
|
86
86
|
statusText: 'ok',
|
|
87
87
|
headers: {},
|
|
@@ -90,15 +90,15 @@ function createOkResponse$1(body) {
|
|
|
90
90
|
}
|
|
91
91
|
function getErrorResponseText(status) {
|
|
92
92
|
switch (status) {
|
|
93
|
-
case HttpStatusCode.Ok:
|
|
93
|
+
case HttpStatusCode$1.Ok:
|
|
94
94
|
return 'OK';
|
|
95
|
-
case HttpStatusCode.NotModified:
|
|
95
|
+
case HttpStatusCode$1.NotModified:
|
|
96
96
|
return 'Not Modified';
|
|
97
|
-
case HttpStatusCode.NotFound:
|
|
97
|
+
case HttpStatusCode$1.NotFound:
|
|
98
98
|
return 'Not Found';
|
|
99
|
-
case HttpStatusCode.BadRequest:
|
|
99
|
+
case HttpStatusCode$1.BadRequest:
|
|
100
100
|
return 'Bad Request';
|
|
101
|
-
case HttpStatusCode.ServerError:
|
|
101
|
+
case HttpStatusCode$1.ServerError:
|
|
102
102
|
return 'Server Error';
|
|
103
103
|
default:
|
|
104
104
|
return `Unexpected HTTP Status Code: ${status}`;
|
|
@@ -150,14 +150,14 @@ function dispatchSplitRecordAggregateUiAction(recordId, networkAdapter, resource
|
|
|
150
150
|
body.compositeResponse === undefined ||
|
|
151
151
|
body.compositeResponse.length === 0) {
|
|
152
152
|
// We shouldn't even get into this state - a 200 with no body?
|
|
153
|
-
throw createErrorResponse(HttpStatusCode.ServerError, {
|
|
153
|
+
throw createErrorResponse(HttpStatusCode$1.ServerError, {
|
|
154
154
|
error: 'No response body in executeAggregateUi found',
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
const merged = body.compositeResponse.reduce((seed, response) => {
|
|
158
|
-
if (response.httpStatusCode !== HttpStatusCode.Ok) {
|
|
158
|
+
if (response.httpStatusCode !== HttpStatusCode$1.Ok) {
|
|
159
159
|
instrumentation$3.getRecordAggregateReject(() => recordId);
|
|
160
|
-
throw createErrorResponse(HttpStatusCode.ServerError, {
|
|
160
|
+
throw createErrorResponse(HttpStatusCode$1.ServerError, {
|
|
161
161
|
error: response.message,
|
|
162
162
|
});
|
|
163
163
|
}
|
|
@@ -239,8 +239,8 @@ const UIAPI_RECORDS_BATCH_PATH = `${UI_API_BASE_URI}/records/batch/`;
|
|
|
239
239
|
const QUERY_TOO_COMPLICATED_ERROR_CODE = 'QUERY_TOO_COMPLICATED';
|
|
240
240
|
function fetchResponseIsQueryTooComplicated(error) {
|
|
241
241
|
const { body } = error;
|
|
242
|
-
if (error.status === HttpStatusCode.BadRequest && body !== undefined) {
|
|
243
|
-
return (body.statusCode === HttpStatusCode.BadRequest &&
|
|
242
|
+
if (error.status === HttpStatusCode$1.BadRequest && body !== undefined) {
|
|
243
|
+
return (body.statusCode === HttpStatusCode$1.BadRequest &&
|
|
244
244
|
body.errorCode === QUERY_TOO_COMPLICATED_ERROR_CODE);
|
|
245
245
|
}
|
|
246
246
|
return false;
|
|
@@ -1866,15 +1866,15 @@ class DraftFetchResponse {
|
|
|
1866
1866
|
get statusText() {
|
|
1867
1867
|
const { status } = this;
|
|
1868
1868
|
switch (status) {
|
|
1869
|
-
case HttpStatusCode.Ok:
|
|
1869
|
+
case HttpStatusCode$1.Ok:
|
|
1870
1870
|
return 'OK';
|
|
1871
|
-
case HttpStatusCode.Created:
|
|
1871
|
+
case HttpStatusCode$1.Created:
|
|
1872
1872
|
return 'Created';
|
|
1873
|
-
case HttpStatusCode.NoContent:
|
|
1873
|
+
case HttpStatusCode$1.NoContent:
|
|
1874
1874
|
return 'No Content';
|
|
1875
|
-
case HttpStatusCode.BadRequest:
|
|
1875
|
+
case HttpStatusCode$1.BadRequest:
|
|
1876
1876
|
return 'Bad Request';
|
|
1877
|
-
case HttpStatusCode.ServerError:
|
|
1877
|
+
case HttpStatusCode$1.ServerError:
|
|
1878
1878
|
return 'Server Error';
|
|
1879
1879
|
default:
|
|
1880
1880
|
return `Unexpected HTTP Status Code: ${status}`;
|
|
@@ -1895,11 +1895,11 @@ class DraftErrorFetchResponse {
|
|
|
1895
1895
|
get statusText() {
|
|
1896
1896
|
const { status } = this;
|
|
1897
1897
|
switch (status) {
|
|
1898
|
-
case HttpStatusCode.BadRequest:
|
|
1898
|
+
case HttpStatusCode$1.BadRequest:
|
|
1899
1899
|
return 'Bad Request';
|
|
1900
|
-
case HttpStatusCode.ServerError:
|
|
1900
|
+
case HttpStatusCode$1.ServerError:
|
|
1901
1901
|
return 'Server Error';
|
|
1902
|
-
case HttpStatusCode.NotFound:
|
|
1902
|
+
case HttpStatusCode$1.NotFound:
|
|
1903
1903
|
return 'Not Found';
|
|
1904
1904
|
default:
|
|
1905
1905
|
return `Unexpected HTTP Status Code: ${status}`;
|
|
@@ -1907,13 +1907,13 @@ class DraftErrorFetchResponse {
|
|
|
1907
1907
|
}
|
|
1908
1908
|
}
|
|
1909
1909
|
function createOkResponse(body) {
|
|
1910
|
-
return new DraftFetchResponse(HttpStatusCode.Ok, body);
|
|
1910
|
+
return new DraftFetchResponse(HttpStatusCode$1.Ok, body);
|
|
1911
1911
|
}
|
|
1912
1912
|
function createBadRequestResponse(body) {
|
|
1913
|
-
return new DraftErrorFetchResponse(HttpStatusCode.BadRequest, body);
|
|
1913
|
+
return new DraftErrorFetchResponse(HttpStatusCode$1.BadRequest, body);
|
|
1914
1914
|
}
|
|
1915
1915
|
function createNotFoundResponse(body) {
|
|
1916
|
-
return new DraftErrorFetchResponse(HttpStatusCode.NotFound, body);
|
|
1916
|
+
return new DraftErrorFetchResponse(HttpStatusCode$1.NotFound, body);
|
|
1917
1917
|
}
|
|
1918
1918
|
function transformErrorToDraftSynthesisError(error) {
|
|
1919
1919
|
if (isDraftSynthesisError(error)) {
|
|
@@ -1930,7 +1930,7 @@ function createDraftSynthesisErrorResponse(message = 'failed to synthesize draft
|
|
|
1930
1930
|
if (errorType !== undefined) {
|
|
1931
1931
|
error.errorType = errorType;
|
|
1932
1932
|
}
|
|
1933
|
-
return new DraftErrorFetchResponse(HttpStatusCode.BadRequest, error);
|
|
1933
|
+
return new DraftErrorFetchResponse(HttpStatusCode$1.BadRequest, error);
|
|
1934
1934
|
}
|
|
1935
1935
|
|
|
1936
1936
|
/**
|
|
@@ -41882,7 +41882,7 @@ class AbstractResourceRequestActionHandler {
|
|
|
41882
41882
|
retryDelayInMs = getRetryAfterInMs(response.headers);
|
|
41883
41883
|
shouldRetry = true;
|
|
41884
41884
|
break;
|
|
41885
|
-
case HttpStatusCode.ServerError: {
|
|
41885
|
+
case HttpStatusCode$1.ServerError: {
|
|
41886
41886
|
shouldRetry = true;
|
|
41887
41887
|
if (this.handleIdempotencyServerError(response.body, updatedAction, false, ERROR_CODE_IDEMPOTENCY_BACKEND_OPERATION_ERROR)) {
|
|
41888
41888
|
this.isIdempotencySupported = false;
|
|
@@ -41905,7 +41905,7 @@ class AbstractResourceRequestActionHandler {
|
|
|
41905
41905
|
}
|
|
41906
41906
|
break;
|
|
41907
41907
|
}
|
|
41908
|
-
case HttpStatusCode.BadRequest: {
|
|
41908
|
+
case HttpStatusCode$1.BadRequest: {
|
|
41909
41909
|
if (this.handleIdempotencyServerError(response.body, updatedAction, false, ERROR_CODE_IDEMPOTENCY_FEATURE_NOT_ENABLED, ERROR_CODE_IDEMPOTENCY_NOT_SUPPORTED)) {
|
|
41910
41910
|
retryDelayInMs = 0;
|
|
41911
41911
|
actionDataChanged = true;
|
|
@@ -41923,13 +41923,13 @@ class AbstractResourceRequestActionHandler {
|
|
|
41923
41923
|
}
|
|
41924
41924
|
}
|
|
41925
41925
|
}
|
|
41926
|
-
if (response.status === HttpStatusCode.BadRequest &&
|
|
41926
|
+
if (response.status === HttpStatusCode$1.BadRequest &&
|
|
41927
41927
|
this.hasIdempotencySupport() &&
|
|
41928
41928
|
updatedAction.data.headers[HTTP_HEADER_IDEMPOTENCY_KEY] !== undefined) {
|
|
41929
41929
|
updatedAction.data.headers[HTTP_HEADER_IDEMPOTENCY_KEY] = uuidv4();
|
|
41930
41930
|
actionDataChanged = true;
|
|
41931
41931
|
}
|
|
41932
|
-
if (response.status === HttpStatusCode.BadRequest &&
|
|
41932
|
+
if (response.status === HttpStatusCode$1.BadRequest &&
|
|
41933
41933
|
this.isBackdatingError(response.body, action)) {
|
|
41934
41934
|
updatedAction.timestamp = Date.now();
|
|
41935
41935
|
updatedAction.data.body.fields = {
|
|
@@ -50528,7 +50528,7 @@ function environmentAwareGraphQLBatchAdapterFactory(objectInfoService, luvio, is
|
|
|
50528
50528
|
// remove injected fields from response.
|
|
50529
50529
|
const data = snapshot.data;
|
|
50530
50530
|
const userResults = data.results.map((compositeResult, index) => {
|
|
50531
|
-
if (compositeResult.statusCode === HttpStatusCode.Ok) {
|
|
50531
|
+
if (compositeResult.statusCode === HttpStatusCode$1.Ok) {
|
|
50532
50532
|
return {
|
|
50533
50533
|
result: removeSyntheticFields(compositeResult.result, config.batchQuery[index].query),
|
|
50534
50534
|
statusCode: compositeResult.statusCode,
|
|
@@ -50745,15 +50745,15 @@ function ldsParamsToString(params) {
|
|
|
50745
50745
|
}
|
|
50746
50746
|
function statusTextFromStatusCode(status) {
|
|
50747
50747
|
switch (status) {
|
|
50748
|
-
case HttpStatusCode.Ok:
|
|
50748
|
+
case HttpStatusCode$1.Ok:
|
|
50749
50749
|
return 'OK';
|
|
50750
|
-
case HttpStatusCode.NotModified:
|
|
50750
|
+
case HttpStatusCode$1.NotModified:
|
|
50751
50751
|
return 'Not Modified';
|
|
50752
|
-
case HttpStatusCode.NotFound:
|
|
50752
|
+
case HttpStatusCode$1.NotFound:
|
|
50753
50753
|
return 'Not Found';
|
|
50754
|
-
case HttpStatusCode.BadRequest:
|
|
50754
|
+
case HttpStatusCode$1.BadRequest:
|
|
50755
50755
|
return 'Bad Request';
|
|
50756
|
-
case HttpStatusCode.ServerError:
|
|
50756
|
+
case HttpStatusCode$1.ServerError:
|
|
50757
50757
|
return 'Server Error';
|
|
50758
50758
|
default:
|
|
50759
50759
|
return `Unexpected HTTP Status Code: ${status}`;
|
|
@@ -51121,7 +51121,7 @@ function mergeAggregateUiResponse(response, mergeFunc) {
|
|
|
51121
51121
|
return {
|
|
51122
51122
|
...response,
|
|
51123
51123
|
ok: false,
|
|
51124
|
-
status: HttpStatusCode.ServerError,
|
|
51124
|
+
status: HttpStatusCode$1.ServerError,
|
|
51125
51125
|
statusText: PARSE_ERROR,
|
|
51126
51126
|
body: [
|
|
51127
51127
|
{
|
|
@@ -51179,9 +51179,9 @@ function mergeBatchRecordsFields(first, second, collectionMergeFunc) {
|
|
|
51179
51179
|
for (let i = 0, len = targetResults.length; i < len; i += 1) {
|
|
51180
51180
|
const targetResult = targetResults[i];
|
|
51181
51181
|
const sourceResult = sourceResults[i];
|
|
51182
|
-
if (targetResult.statusCode !== HttpStatusCode.Ok)
|
|
51182
|
+
if (targetResult.statusCode !== HttpStatusCode$1.Ok)
|
|
51183
51183
|
continue;
|
|
51184
|
-
if (sourceResult.statusCode !== HttpStatusCode.Ok) {
|
|
51184
|
+
if (sourceResult.statusCode !== HttpStatusCode$1.Ok) {
|
|
51185
51185
|
targetResults[i] = sourceResult;
|
|
51186
51186
|
continue;
|
|
51187
51187
|
}
|
|
@@ -55929,6 +55929,47 @@ function toError(x) {
|
|
|
55929
55929
|
}
|
|
55930
55930
|
return new Error(typeof x === "string" ? x : JSON.stringify(x));
|
|
55931
55931
|
}
|
|
55932
|
+
var HttpStatusCode = /* @__PURE__ */ ((HttpStatusCode2) => {
|
|
55933
|
+
HttpStatusCode2[HttpStatusCode2["Ok"] = 200] = "Ok";
|
|
55934
|
+
HttpStatusCode2[HttpStatusCode2["Created"] = 201] = "Created";
|
|
55935
|
+
HttpStatusCode2[HttpStatusCode2["NoContent"] = 204] = "NoContent";
|
|
55936
|
+
HttpStatusCode2[HttpStatusCode2["NotModified"] = 304] = "NotModified";
|
|
55937
|
+
HttpStatusCode2[HttpStatusCode2["BadRequest"] = 400] = "BadRequest";
|
|
55938
|
+
HttpStatusCode2[HttpStatusCode2["Unauthorized"] = 401] = "Unauthorized";
|
|
55939
|
+
HttpStatusCode2[HttpStatusCode2["Forbidden"] = 403] = "Forbidden";
|
|
55940
|
+
HttpStatusCode2[HttpStatusCode2["NotFound"] = 404] = "NotFound";
|
|
55941
|
+
HttpStatusCode2[HttpStatusCode2["ServerError"] = 500] = "ServerError";
|
|
55942
|
+
HttpStatusCode2[HttpStatusCode2["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
55943
|
+
return HttpStatusCode2;
|
|
55944
|
+
})(HttpStatusCode || {});
|
|
55945
|
+
function getStatusText(status) {
|
|
55946
|
+
switch (status) {
|
|
55947
|
+
case 200:
|
|
55948
|
+
return "OK";
|
|
55949
|
+
case 201:
|
|
55950
|
+
return "Created";
|
|
55951
|
+
case 304:
|
|
55952
|
+
return "Not Modified";
|
|
55953
|
+
case 400:
|
|
55954
|
+
return "Bad Request";
|
|
55955
|
+
case 404:
|
|
55956
|
+
return "Not Found";
|
|
55957
|
+
case 500:
|
|
55958
|
+
return "Server Error";
|
|
55959
|
+
default:
|
|
55960
|
+
return `Unexpected HTTP Status Code: ${status}`;
|
|
55961
|
+
}
|
|
55962
|
+
}
|
|
55963
|
+
class FetchResponse extends Error {
|
|
55964
|
+
constructor(status, body, headers) {
|
|
55965
|
+
super();
|
|
55966
|
+
this.status = status;
|
|
55967
|
+
this.body = body;
|
|
55968
|
+
this.headers = headers || {};
|
|
55969
|
+
this.ok = status >= 200 && this.status <= 299;
|
|
55970
|
+
this.statusText = getStatusText(status);
|
|
55971
|
+
}
|
|
55972
|
+
}
|
|
55932
55973
|
class InternalError extends Error {
|
|
55933
55974
|
constructor(data) {
|
|
55934
55975
|
super();
|
|
@@ -56751,9 +56792,6 @@ class AuraResourceCacheControlCommand extends AuraCacheControlCommand {
|
|
|
56751
56792
|
super(services);
|
|
56752
56793
|
this.services = services;
|
|
56753
56794
|
}
|
|
56754
|
-
execute() {
|
|
56755
|
-
return super.execute();
|
|
56756
|
-
}
|
|
56757
56795
|
readFromCache(cache) {
|
|
56758
56796
|
var _a;
|
|
56759
56797
|
const data = (_a = cache.get(this.buildKey())) == null ? void 0 : _a.value;
|
|
@@ -57355,6 +57393,59 @@ class MaxAgeCacheControlStrategy extends CacheControlStrategy {
|
|
|
57355
57393
|
];
|
|
57356
57394
|
}
|
|
57357
57395
|
}
|
|
57396
|
+
class OnlyIfCachedCacheControlStrategy extends CacheControlStrategy {
|
|
57397
|
+
execute(options) {
|
|
57398
|
+
const startTime = this.services.instrumentation ? this.services.instrumentation.currentTimeMs() : 0;
|
|
57399
|
+
return this.services.cacheInclusionPolicy.read({
|
|
57400
|
+
l1: this.filteredCache,
|
|
57401
|
+
readFromL1: (l1) => this.requestRunner.readFromCache(l1)
|
|
57402
|
+
}).then((result) => {
|
|
57403
|
+
if (result.isOk()) {
|
|
57404
|
+
this.collectCacheHitInstrumentation(
|
|
57405
|
+
startTime,
|
|
57406
|
+
options == null ? void 0 : options.instrumentationAttributes
|
|
57407
|
+
);
|
|
57408
|
+
return ok$1(void 0);
|
|
57409
|
+
}
|
|
57410
|
+
this.collectCacheMissInstrumentation(startTime, options == null ? void 0 : options.instrumentationAttributes);
|
|
57411
|
+
const error = new UserVisibleError(
|
|
57412
|
+
new FetchResponse(HttpStatusCode.GatewayTimeout, {
|
|
57413
|
+
error: "Cache miss for only-if-cached request"
|
|
57414
|
+
})
|
|
57415
|
+
);
|
|
57416
|
+
return err$1(error);
|
|
57417
|
+
});
|
|
57418
|
+
}
|
|
57419
|
+
get expiredChecks() {
|
|
57420
|
+
return [
|
|
57421
|
+
(cacheControlMetadata) => cacheControlMetadata.type === "no-store"
|
|
57422
|
+
];
|
|
57423
|
+
}
|
|
57424
|
+
collectCacheHitInstrumentation(startTime, instrumentationAttributes) {
|
|
57425
|
+
if (this.services.instrumentation) {
|
|
57426
|
+
const meter = this.services.instrumentation.metrics.getMeter("onestore");
|
|
57427
|
+
meter.createCounter(`command.only-if-cached.cache-hit.count`).add(1, instrumentationAttributes);
|
|
57428
|
+
meter.createHistogram(
|
|
57429
|
+
`command.only-if-cached.cache-hit.duration`
|
|
57430
|
+
).record(
|
|
57431
|
+
this.services.instrumentation.currentTimeMs() - startTime,
|
|
57432
|
+
instrumentationAttributes
|
|
57433
|
+
);
|
|
57434
|
+
}
|
|
57435
|
+
}
|
|
57436
|
+
collectCacheMissInstrumentation(startTime, instrumentationAttributes) {
|
|
57437
|
+
if (this.services.instrumentation) {
|
|
57438
|
+
const meter = this.services.instrumentation.metrics.getMeter("onestore");
|
|
57439
|
+
meter.createCounter(`command.only-if-cached.cache-miss.count`).add(1, instrumentationAttributes);
|
|
57440
|
+
meter.createHistogram(
|
|
57441
|
+
`command.only-if-cached.cache-miss.duration`
|
|
57442
|
+
).record(
|
|
57443
|
+
this.services.instrumentation.currentTimeMs() - startTime,
|
|
57444
|
+
instrumentationAttributes
|
|
57445
|
+
);
|
|
57446
|
+
}
|
|
57447
|
+
}
|
|
57448
|
+
}
|
|
57358
57449
|
class CacheController {
|
|
57359
57450
|
constructor(services) {
|
|
57360
57451
|
this.services = services;
|
|
@@ -57368,6 +57459,8 @@ class CacheController {
|
|
|
57368
57459
|
return new MaxAgeCacheControlStrategy(this.services, config, requestRunner);
|
|
57369
57460
|
} else if (config.type === "no-cache") {
|
|
57370
57461
|
return new NoCacheCacheControlStrategy(this.services, config, requestRunner);
|
|
57462
|
+
} else if (config.type === "only-if-cached") {
|
|
57463
|
+
return new OnlyIfCachedCacheControlStrategy(this.services, config, requestRunner);
|
|
57371
57464
|
}
|
|
57372
57465
|
throw new Error(`Unknown cache control strategy ${config.type}`);
|
|
57373
57466
|
}
|
|
@@ -57886,7 +57979,7 @@ function buildServiceDescriptor$5(luvio) {
|
|
|
57886
57979
|
},
|
|
57887
57980
|
};
|
|
57888
57981
|
}
|
|
57889
|
-
// version: 1.380.0-
|
|
57982
|
+
// version: 1.380.0-dev6-9d4fd6e5dc
|
|
57890
57983
|
|
|
57891
57984
|
/**
|
|
57892
57985
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -57912,7 +58005,7 @@ function buildServiceDescriptor$4(notifyRecordUpdateAvailable, getNormalizedLuvi
|
|
|
57912
58005
|
},
|
|
57913
58006
|
};
|
|
57914
58007
|
}
|
|
57915
|
-
// version: 1.380.0-
|
|
58008
|
+
// version: 1.380.0-dev6-9d4fd6e5dc
|
|
57916
58009
|
|
|
57917
58010
|
/*!
|
|
57918
58011
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -60065,4 +60158,4 @@ register({
|
|
|
60065
60158
|
});
|
|
60066
60159
|
|
|
60067
60160
|
export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, ingest$1o as ingestDenormalizedRecordRepresentation, initializeOneStore, registerReportObserver, reportGraphqlQueryParseError };
|
|
60068
|
-
// version: 1.380.0-
|
|
60161
|
+
// version: 1.380.0-dev6-1891f38076
|