@salesforce/lds-runtime-mobile 1.142.1 → 1.144.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 +101 -16
- package/dist/types/instrumentation/metrics.d.ts +1 -1
- package/package.json +1 -1
- package/sfdc/main.js +101 -16
- package/sfdc/types/instrumentation/metrics.d.ts +1 -1
package/dist/main.js
CHANGED
|
@@ -27,6 +27,9 @@ import shortTimeFormat from '@salesforce/i18n/dateTime.shortTimeFormat';
|
|
|
27
27
|
import shortDateTimeFormat from '@salesforce/i18n/dateTime.shortDateTimeFormat';
|
|
28
28
|
import { getDateTimeFormat, getDateTimeISO8601Parser, getNumberFormat } from 'lightning/i18nService';
|
|
29
29
|
import formattingOptions from 'lightning/i18nCldrOptions';
|
|
30
|
+
import eagerEvalValidAt from '@salesforce/gate/lds.eagerEvalValidAt';
|
|
31
|
+
import eagerEvalStaleWhileRevalidate from '@salesforce/gate/lds.eagerEvalStaleWhileRevalidate';
|
|
32
|
+
import eagerEvalDefaultCachePolicy from '@salesforce/gate/lds.eagerEvalDefaultCachePolicy';
|
|
30
33
|
|
|
31
34
|
/**
|
|
32
35
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -877,7 +880,7 @@ async function reviveOrCreateContext(adapterId, durableStore, durableStoreErrorH
|
|
|
877
880
|
}
|
|
878
881
|
return contextReturn();
|
|
879
882
|
}
|
|
880
|
-
function isUnfulfilledSnapshot(cachedSnapshotResult) {
|
|
883
|
+
function isUnfulfilledSnapshot$1(cachedSnapshotResult) {
|
|
881
884
|
if (cachedSnapshotResult === undefined) {
|
|
882
885
|
return false;
|
|
883
886
|
}
|
|
@@ -1161,7 +1164,7 @@ function makeDurable(environment, { durableStore, instrumentation }) {
|
|
|
1161
1164
|
const snapshot = buildCachedSnapshot(injectedBuildSnapshotContext, injectedStoreLookup, luvio);
|
|
1162
1165
|
// if the adapter attempted to do an L1 lookup and it was unfulfilled
|
|
1163
1166
|
// then we can attempt an L2 lookup
|
|
1164
|
-
if (isUnfulfilledSnapshot(snapshot)) {
|
|
1167
|
+
if (isUnfulfilledSnapshot$1(snapshot)) {
|
|
1165
1168
|
const start = Date.now();
|
|
1166
1169
|
emitDurableEnvironmentAdapterEvent({ type: 'l2-revive-start' }, adapterRequestContext.eventObservers);
|
|
1167
1170
|
const revivedSnapshot = reviveSnapshot(environment, durableStore, snapshot, durableStoreErrorHandler, () => injectedStoreLookup(snapshot.select, snapshot.refresh)).then((result) => {
|
|
@@ -4661,6 +4664,10 @@ var DraftQueueEventType;
|
|
|
4661
4664
|
* Triggered after an action had been added to the queue
|
|
4662
4665
|
*/
|
|
4663
4666
|
DraftQueueEventType["ActionAdded"] = "added";
|
|
4667
|
+
/**
|
|
4668
|
+
* Triggered when starting to upload and process an action
|
|
4669
|
+
*/
|
|
4670
|
+
DraftQueueEventType["ActionUploading"] = "uploading";
|
|
4664
4671
|
/**
|
|
4665
4672
|
* Triggered once an action failed
|
|
4666
4673
|
*/
|
|
@@ -5212,6 +5219,10 @@ class DurableDraftQueue {
|
|
|
5212
5219
|
if (this.state === DraftQueueState.Waiting) {
|
|
5213
5220
|
this.state = DraftQueueState.Started;
|
|
5214
5221
|
}
|
|
5222
|
+
this.notifyChangedListeners({
|
|
5223
|
+
type: DraftQueueEventType.ActionUploading,
|
|
5224
|
+
action: { ...action, status: DraftActionStatus.Uploading },
|
|
5225
|
+
});
|
|
5215
5226
|
return this.handle(action);
|
|
5216
5227
|
}
|
|
5217
5228
|
async handleServerError(action, error) {
|
|
@@ -5972,6 +5983,7 @@ var DraftActionOperationType;
|
|
|
5972
5983
|
var DraftQueueOperationType;
|
|
5973
5984
|
(function (DraftQueueOperationType) {
|
|
5974
5985
|
DraftQueueOperationType["ItemAdded"] = "added";
|
|
5986
|
+
DraftQueueOperationType["ItemUploading"] = "uploading";
|
|
5975
5987
|
DraftQueueOperationType["ItemDeleted"] = "deleted";
|
|
5976
5988
|
DraftQueueOperationType["ItemCompleted"] = "completed";
|
|
5977
5989
|
DraftQueueOperationType["ItemFailed"] = "failed";
|
|
@@ -6022,29 +6034,29 @@ function toQueueState(queue) {
|
|
|
6022
6034
|
class DraftManager {
|
|
6023
6035
|
constructor(draftQueue) {
|
|
6024
6036
|
this.listeners = [];
|
|
6025
|
-
this.
|
|
6026
|
-
draftQueue.registerOnChangedListener((event) => {
|
|
6027
|
-
if (this.shouldEmitDraftEvent(event)) {
|
|
6028
|
-
return this.callListeners(event);
|
|
6029
|
-
}
|
|
6030
|
-
return Promise.resolve();
|
|
6031
|
-
});
|
|
6032
|
-
}
|
|
6033
|
-
shouldEmitDraftEvent(event) {
|
|
6034
|
-
const { type } = event;
|
|
6035
|
-
return [
|
|
6037
|
+
this.draftEventsShouldBeEmitted = [
|
|
6036
6038
|
DraftQueueEventType.ActionAdded,
|
|
6039
|
+
DraftQueueEventType.ActionUploading,
|
|
6037
6040
|
DraftQueueEventType.ActionCompleted,
|
|
6038
6041
|
DraftQueueEventType.ActionDeleted,
|
|
6039
6042
|
DraftQueueEventType.ActionFailed,
|
|
6040
6043
|
DraftQueueEventType.ActionUpdated,
|
|
6041
6044
|
DraftQueueEventType.QueueStateChanged,
|
|
6042
|
-
]
|
|
6045
|
+
];
|
|
6046
|
+
this.draftQueue = draftQueue;
|
|
6047
|
+
draftQueue.registerOnChangedListener((event) => {
|
|
6048
|
+
if (this.draftEventsShouldBeEmitted.includes(event.type)) {
|
|
6049
|
+
return this.callListeners(event);
|
|
6050
|
+
}
|
|
6051
|
+
return Promise.resolve();
|
|
6052
|
+
});
|
|
6043
6053
|
}
|
|
6044
6054
|
draftQueueEventTypeToOperationType(type) {
|
|
6045
6055
|
switch (type) {
|
|
6046
6056
|
case DraftQueueEventType.ActionAdded:
|
|
6047
6057
|
return DraftQueueOperationType.ItemAdded;
|
|
6058
|
+
case DraftQueueEventType.ActionUploading:
|
|
6059
|
+
return DraftQueueOperationType.ItemUploading;
|
|
6048
6060
|
case DraftQueueEventType.ActionCompleted:
|
|
6049
6061
|
return DraftQueueOperationType.ItemCompleted;
|
|
6050
6062
|
case DraftQueueEventType.ActionDeleted:
|
|
@@ -12533,6 +12545,7 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
|
|
|
12533
12545
|
query: injectedAST,
|
|
12534
12546
|
},
|
|
12535
12547
|
luvio,
|
|
12548
|
+
gqlEval: true,
|
|
12536
12549
|
}, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy));
|
|
12537
12550
|
if (isErrorSnapshotThatShouldGetReturnedToCaller(nonEvaluatedSnapshot)) {
|
|
12538
12551
|
return nonEvaluatedSnapshot;
|
|
@@ -14229,6 +14242,7 @@ const DRAFT_QUEUE_STATE_ERROR = 'draft-queue-state-error';
|
|
|
14229
14242
|
const DRAFT_QUEUE_STATE_WAITING = 'draft-queue-state-waiting';
|
|
14230
14243
|
const DRAFT_QUEUE_STATE_STOPPED = 'draft-queue-state-stopped';
|
|
14231
14244
|
const DRAFT_QUEUE_ACTION_ADDED = 'draft-queue-action-added';
|
|
14245
|
+
const DRAFT_QUEUE_ACTION_UPLOADING = 'draft-queue-action-uploading';
|
|
14232
14246
|
const DRAFT_QUEUE_ACTION_COMPLETED = 'draft-queue-action-completed';
|
|
14233
14247
|
const DRAFT_QUEUE_ACTION_DELETED = 'draft-queue-action-deleted';
|
|
14234
14248
|
const DRAFT_QUEUE_ACTION_UPDATED = 'draft-queue-action-updated';
|
|
@@ -14283,6 +14297,9 @@ function reportDraftActionEvent(state) {
|
|
|
14283
14297
|
case 'added':
|
|
14284
14298
|
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_ADDED);
|
|
14285
14299
|
break;
|
|
14300
|
+
case 'uploading':
|
|
14301
|
+
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_UPLOADING);
|
|
14302
|
+
break;
|
|
14286
14303
|
case 'completed':
|
|
14287
14304
|
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_COMPLETED);
|
|
14288
14305
|
break;
|
|
@@ -14402,6 +14419,9 @@ function instrumentDraftQueue(queue) {
|
|
|
14402
14419
|
case DraftQueueEventType.ActionAdded:
|
|
14403
14420
|
reportDraftActionEvent('added');
|
|
14404
14421
|
break;
|
|
14422
|
+
case DraftQueueEventType.ActionUploading:
|
|
14423
|
+
reportDraftActionEvent('uploading');
|
|
14424
|
+
break;
|
|
14405
14425
|
case DraftQueueEventType.ActionCompleted:
|
|
14406
14426
|
reportDraftActionEvent('completed');
|
|
14407
14427
|
break;
|
|
@@ -15114,8 +15134,17 @@ function formatDisplayValue(value, datatype) {
|
|
|
15114
15134
|
}
|
|
15115
15135
|
}
|
|
15116
15136
|
|
|
15117
|
-
|
|
15137
|
+
function isUnfulfilledSnapshot(cachedSnapshotResult) {
|
|
15138
|
+
if (cachedSnapshotResult === undefined) {
|
|
15139
|
+
return false;
|
|
15140
|
+
}
|
|
15141
|
+
if ('then' in cachedSnapshotResult) {
|
|
15142
|
+
return false;
|
|
15143
|
+
}
|
|
15144
|
+
return cachedSnapshotResult.state === 'Unfulfilled';
|
|
15145
|
+
}
|
|
15118
15146
|
function makeEnvironmentGraphqlAware(environment) {
|
|
15147
|
+
//TODO: [W-12734162] - rebuild non-evaluated snapshot when graph rebuild is triggered. The dependency work on luvio needs to be done.
|
|
15119
15148
|
const rebuildSnapshot = function (snapshot, onRebuild) {
|
|
15120
15149
|
if (isStoreEvalSnapshot(snapshot)) {
|
|
15121
15150
|
snapshot.rebuildWithStoreEval(snapshot).then((rebuilt) => {
|
|
@@ -15131,8 +15160,64 @@ function makeEnvironmentGraphqlAware(environment) {
|
|
|
15131
15160
|
}
|
|
15132
15161
|
return environment.rebuildSnapshot(snapshot, onRebuild);
|
|
15133
15162
|
};
|
|
15163
|
+
const applyCachePolicy = function (luvio, adapterRequestContext, buildSnapshotContext, buildCachedSnapshot, buildNetworkSnapshot) {
|
|
15164
|
+
// Early exit for non-evaluating adapters
|
|
15165
|
+
let graphqlBuildSnapshotContext = buildSnapshotContext;
|
|
15166
|
+
if (graphqlBuildSnapshotContext.gqlEval !== true) {
|
|
15167
|
+
return environment.applyCachePolicy(luvio, adapterRequestContext, buildSnapshotContext, buildCachedSnapshot, buildNetworkSnapshot);
|
|
15168
|
+
}
|
|
15169
|
+
var localBuildCachedSnapshot = buildCachedSnapshot;
|
|
15170
|
+
const hoistUnfulfilledToStale = (context, storeLookup, luvio) => {
|
|
15171
|
+
const upstream = buildCachedSnapshot(context, storeLookup, luvio);
|
|
15172
|
+
if (upstream === undefined)
|
|
15173
|
+
return upstream;
|
|
15174
|
+
if (isUnfulfilledSnapshot(upstream)) {
|
|
15175
|
+
return {
|
|
15176
|
+
...upstream,
|
|
15177
|
+
data: upstream.data || {},
|
|
15178
|
+
state: 'Stale',
|
|
15179
|
+
};
|
|
15180
|
+
}
|
|
15181
|
+
else if ('then' in upstream) {
|
|
15182
|
+
return upstream.then((snapshot) => {
|
|
15183
|
+
if (snapshot === undefined)
|
|
15184
|
+
return snapshot;
|
|
15185
|
+
if (isUnfulfilledSnapshot(snapshot)) {
|
|
15186
|
+
return {
|
|
15187
|
+
...snapshot,
|
|
15188
|
+
data: snapshot.data || {},
|
|
15189
|
+
state: 'Stale',
|
|
15190
|
+
};
|
|
15191
|
+
}
|
|
15192
|
+
return snapshot;
|
|
15193
|
+
});
|
|
15194
|
+
}
|
|
15195
|
+
return upstream;
|
|
15196
|
+
};
|
|
15197
|
+
const { cachePolicy } = adapterRequestContext;
|
|
15198
|
+
if (eagerEvalValidAt.isOpen({ fallback: false }) &&
|
|
15199
|
+
cachePolicy &&
|
|
15200
|
+
cachePolicy.type === 'valid-at' &&
|
|
15201
|
+
cachePolicy.timestamp === 0 &&
|
|
15202
|
+
cachePolicy.basePolicy &&
|
|
15203
|
+
cachePolicy.basePolicy.type === 'stale-while-revalidate') {
|
|
15204
|
+
localBuildCachedSnapshot = hoistUnfulfilledToStale;
|
|
15205
|
+
}
|
|
15206
|
+
if (eagerEvalStaleWhileRevalidate.isOpen({ fallback: false }) &&
|
|
15207
|
+
cachePolicy &&
|
|
15208
|
+
cachePolicy.type === 'stale-while-revalidate' &&
|
|
15209
|
+
cachePolicy.staleDurationSeconds === Number.MAX_SAFE_INTEGER) {
|
|
15210
|
+
localBuildCachedSnapshot = hoistUnfulfilledToStale;
|
|
15211
|
+
}
|
|
15212
|
+
if (eagerEvalDefaultCachePolicy.isOpen({ fallback: false }) && cachePolicy === undefined) {
|
|
15213
|
+
localBuildCachedSnapshot = hoistUnfulfilledToStale;
|
|
15214
|
+
}
|
|
15215
|
+
return environment.applyCachePolicy(luvio, adapterRequestContext, buildSnapshotContext, localBuildCachedSnapshot, buildNetworkSnapshot);
|
|
15216
|
+
};
|
|
15134
15217
|
return create(environment, {
|
|
15135
15218
|
rebuildSnapshot: { value: rebuildSnapshot },
|
|
15219
|
+
applyCachePolicy: { value: applyCachePolicy },
|
|
15220
|
+
setDefaultCachePolicy: { value: environment.setDefaultCachePolicy.bind(environment) },
|
|
15136
15221
|
});
|
|
15137
15222
|
}
|
|
15138
15223
|
|
|
@@ -15885,4 +15970,4 @@ register({
|
|
|
15885
15970
|
});
|
|
15886
15971
|
|
|
15887
15972
|
export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
|
|
15888
|
-
// version: 1.
|
|
15973
|
+
// version: 1.144.0-ac4b15ad8
|
|
@@ -6,7 +6,7 @@ export declare function reportGraphqlSqlEvalPreconditionError(err: unknown): voi
|
|
|
6
6
|
export declare function reportGraphqlCreateSnapshotError(err: unknown): void;
|
|
7
7
|
export declare function reportGraphQlEvalDbReadDuration(duration: number): void;
|
|
8
8
|
export declare function reportGraphqlAdapterError(errorCode: string): void;
|
|
9
|
-
export declare function reportDraftActionEvent(state: 'added' | 'completed' | 'deleted' | 'updated' | 'failed'): void;
|
|
9
|
+
export declare function reportDraftActionEvent(state: 'added' | 'uploading' | 'completed' | 'deleted' | 'updated' | 'failed'): void;
|
|
10
10
|
export declare function reportDraftQueueState(state: 'started' | 'error' | 'waiting' | 'stopped'): void;
|
|
11
11
|
export declare function reportDraftAwareContentDocumentVersionSynthesizeError(err: unknown): void;
|
|
12
12
|
export declare function reportDraftAwareContentVersionSynthesizeCalls(mimeType: string): void;
|
package/package.json
CHANGED
package/sfdc/main.js
CHANGED
|
@@ -27,6 +27,9 @@ import shortTimeFormat from '@salesforce/i18n/dateTime.shortTimeFormat';
|
|
|
27
27
|
import shortDateTimeFormat from '@salesforce/i18n/dateTime.shortDateTimeFormat';
|
|
28
28
|
import { getDateTimeFormat, getDateTimeISO8601Parser, getNumberFormat } from 'lightning/i18nService';
|
|
29
29
|
import formattingOptions from 'lightning/i18nCldrOptions';
|
|
30
|
+
import eagerEvalValidAt from '@salesforce/gate/lds.eagerEvalValidAt';
|
|
31
|
+
import eagerEvalStaleWhileRevalidate from '@salesforce/gate/lds.eagerEvalStaleWhileRevalidate';
|
|
32
|
+
import eagerEvalDefaultCachePolicy from '@salesforce/gate/lds.eagerEvalDefaultCachePolicy';
|
|
30
33
|
|
|
31
34
|
/**
|
|
32
35
|
* Copyright (c) 2022, Salesforce, Inc.,
|
|
@@ -877,7 +880,7 @@ async function reviveOrCreateContext(adapterId, durableStore, durableStoreErrorH
|
|
|
877
880
|
}
|
|
878
881
|
return contextReturn();
|
|
879
882
|
}
|
|
880
|
-
function isUnfulfilledSnapshot(cachedSnapshotResult) {
|
|
883
|
+
function isUnfulfilledSnapshot$1(cachedSnapshotResult) {
|
|
881
884
|
if (cachedSnapshotResult === undefined) {
|
|
882
885
|
return false;
|
|
883
886
|
}
|
|
@@ -1161,7 +1164,7 @@ function makeDurable(environment, { durableStore, instrumentation }) {
|
|
|
1161
1164
|
const snapshot = buildCachedSnapshot(injectedBuildSnapshotContext, injectedStoreLookup, luvio);
|
|
1162
1165
|
// if the adapter attempted to do an L1 lookup and it was unfulfilled
|
|
1163
1166
|
// then we can attempt an L2 lookup
|
|
1164
|
-
if (isUnfulfilledSnapshot(snapshot)) {
|
|
1167
|
+
if (isUnfulfilledSnapshot$1(snapshot)) {
|
|
1165
1168
|
const start = Date.now();
|
|
1166
1169
|
emitDurableEnvironmentAdapterEvent({ type: 'l2-revive-start' }, adapterRequestContext.eventObservers);
|
|
1167
1170
|
const revivedSnapshot = reviveSnapshot(environment, durableStore, snapshot, durableStoreErrorHandler, () => injectedStoreLookup(snapshot.select, snapshot.refresh)).then((result) => {
|
|
@@ -4661,6 +4664,10 @@ var DraftQueueEventType;
|
|
|
4661
4664
|
* Triggered after an action had been added to the queue
|
|
4662
4665
|
*/
|
|
4663
4666
|
DraftQueueEventType["ActionAdded"] = "added";
|
|
4667
|
+
/**
|
|
4668
|
+
* Triggered when starting to upload and process an action
|
|
4669
|
+
*/
|
|
4670
|
+
DraftQueueEventType["ActionUploading"] = "uploading";
|
|
4664
4671
|
/**
|
|
4665
4672
|
* Triggered once an action failed
|
|
4666
4673
|
*/
|
|
@@ -5212,6 +5219,10 @@ class DurableDraftQueue {
|
|
|
5212
5219
|
if (this.state === DraftQueueState.Waiting) {
|
|
5213
5220
|
this.state = DraftQueueState.Started;
|
|
5214
5221
|
}
|
|
5222
|
+
this.notifyChangedListeners({
|
|
5223
|
+
type: DraftQueueEventType.ActionUploading,
|
|
5224
|
+
action: { ...action, status: DraftActionStatus.Uploading },
|
|
5225
|
+
});
|
|
5215
5226
|
return this.handle(action);
|
|
5216
5227
|
}
|
|
5217
5228
|
async handleServerError(action, error) {
|
|
@@ -5972,6 +5983,7 @@ var DraftActionOperationType;
|
|
|
5972
5983
|
var DraftQueueOperationType;
|
|
5973
5984
|
(function (DraftQueueOperationType) {
|
|
5974
5985
|
DraftQueueOperationType["ItemAdded"] = "added";
|
|
5986
|
+
DraftQueueOperationType["ItemUploading"] = "uploading";
|
|
5975
5987
|
DraftQueueOperationType["ItemDeleted"] = "deleted";
|
|
5976
5988
|
DraftQueueOperationType["ItemCompleted"] = "completed";
|
|
5977
5989
|
DraftQueueOperationType["ItemFailed"] = "failed";
|
|
@@ -6022,29 +6034,29 @@ function toQueueState(queue) {
|
|
|
6022
6034
|
class DraftManager {
|
|
6023
6035
|
constructor(draftQueue) {
|
|
6024
6036
|
this.listeners = [];
|
|
6025
|
-
this.
|
|
6026
|
-
draftQueue.registerOnChangedListener((event) => {
|
|
6027
|
-
if (this.shouldEmitDraftEvent(event)) {
|
|
6028
|
-
return this.callListeners(event);
|
|
6029
|
-
}
|
|
6030
|
-
return Promise.resolve();
|
|
6031
|
-
});
|
|
6032
|
-
}
|
|
6033
|
-
shouldEmitDraftEvent(event) {
|
|
6034
|
-
const { type } = event;
|
|
6035
|
-
return [
|
|
6037
|
+
this.draftEventsShouldBeEmitted = [
|
|
6036
6038
|
DraftQueueEventType.ActionAdded,
|
|
6039
|
+
DraftQueueEventType.ActionUploading,
|
|
6037
6040
|
DraftQueueEventType.ActionCompleted,
|
|
6038
6041
|
DraftQueueEventType.ActionDeleted,
|
|
6039
6042
|
DraftQueueEventType.ActionFailed,
|
|
6040
6043
|
DraftQueueEventType.ActionUpdated,
|
|
6041
6044
|
DraftQueueEventType.QueueStateChanged,
|
|
6042
|
-
]
|
|
6045
|
+
];
|
|
6046
|
+
this.draftQueue = draftQueue;
|
|
6047
|
+
draftQueue.registerOnChangedListener((event) => {
|
|
6048
|
+
if (this.draftEventsShouldBeEmitted.includes(event.type)) {
|
|
6049
|
+
return this.callListeners(event);
|
|
6050
|
+
}
|
|
6051
|
+
return Promise.resolve();
|
|
6052
|
+
});
|
|
6043
6053
|
}
|
|
6044
6054
|
draftQueueEventTypeToOperationType(type) {
|
|
6045
6055
|
switch (type) {
|
|
6046
6056
|
case DraftQueueEventType.ActionAdded:
|
|
6047
6057
|
return DraftQueueOperationType.ItemAdded;
|
|
6058
|
+
case DraftQueueEventType.ActionUploading:
|
|
6059
|
+
return DraftQueueOperationType.ItemUploading;
|
|
6048
6060
|
case DraftQueueEventType.ActionCompleted:
|
|
6049
6061
|
return DraftQueueOperationType.ItemCompleted;
|
|
6050
6062
|
case DraftQueueEventType.ActionDeleted:
|
|
@@ -12533,6 +12545,7 @@ function draftAwareGraphQLAdapterFactory(userId, objectInfoService, store, luvio
|
|
|
12533
12545
|
query: injectedAST,
|
|
12534
12546
|
},
|
|
12535
12547
|
luvio,
|
|
12548
|
+
gqlEval: true,
|
|
12536
12549
|
}, buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy));
|
|
12537
12550
|
if (isErrorSnapshotThatShouldGetReturnedToCaller(nonEvaluatedSnapshot)) {
|
|
12538
12551
|
return nonEvaluatedSnapshot;
|
|
@@ -14229,6 +14242,7 @@ const DRAFT_QUEUE_STATE_ERROR = 'draft-queue-state-error';
|
|
|
14229
14242
|
const DRAFT_QUEUE_STATE_WAITING = 'draft-queue-state-waiting';
|
|
14230
14243
|
const DRAFT_QUEUE_STATE_STOPPED = 'draft-queue-state-stopped';
|
|
14231
14244
|
const DRAFT_QUEUE_ACTION_ADDED = 'draft-queue-action-added';
|
|
14245
|
+
const DRAFT_QUEUE_ACTION_UPLOADING = 'draft-queue-action-uploading';
|
|
14232
14246
|
const DRAFT_QUEUE_ACTION_COMPLETED = 'draft-queue-action-completed';
|
|
14233
14247
|
const DRAFT_QUEUE_ACTION_DELETED = 'draft-queue-action-deleted';
|
|
14234
14248
|
const DRAFT_QUEUE_ACTION_UPDATED = 'draft-queue-action-updated';
|
|
@@ -14283,6 +14297,9 @@ function reportDraftActionEvent(state) {
|
|
|
14283
14297
|
case 'added':
|
|
14284
14298
|
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_ADDED);
|
|
14285
14299
|
break;
|
|
14300
|
+
case 'uploading':
|
|
14301
|
+
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_UPLOADING);
|
|
14302
|
+
break;
|
|
14286
14303
|
case 'completed':
|
|
14287
14304
|
ldsMobileInstrumentation.incrementCounter(DRAFT_QUEUE_ACTION_COMPLETED);
|
|
14288
14305
|
break;
|
|
@@ -14402,6 +14419,9 @@ function instrumentDraftQueue(queue) {
|
|
|
14402
14419
|
case DraftQueueEventType.ActionAdded:
|
|
14403
14420
|
reportDraftActionEvent('added');
|
|
14404
14421
|
break;
|
|
14422
|
+
case DraftQueueEventType.ActionUploading:
|
|
14423
|
+
reportDraftActionEvent('uploading');
|
|
14424
|
+
break;
|
|
14405
14425
|
case DraftQueueEventType.ActionCompleted:
|
|
14406
14426
|
reportDraftActionEvent('completed');
|
|
14407
14427
|
break;
|
|
@@ -15114,8 +15134,17 @@ function formatDisplayValue(value, datatype) {
|
|
|
15114
15134
|
}
|
|
15115
15135
|
}
|
|
15116
15136
|
|
|
15117
|
-
|
|
15137
|
+
function isUnfulfilledSnapshot(cachedSnapshotResult) {
|
|
15138
|
+
if (cachedSnapshotResult === undefined) {
|
|
15139
|
+
return false;
|
|
15140
|
+
}
|
|
15141
|
+
if ('then' in cachedSnapshotResult) {
|
|
15142
|
+
return false;
|
|
15143
|
+
}
|
|
15144
|
+
return cachedSnapshotResult.state === 'Unfulfilled';
|
|
15145
|
+
}
|
|
15118
15146
|
function makeEnvironmentGraphqlAware(environment) {
|
|
15147
|
+
//TODO: [W-12734162] - rebuild non-evaluated snapshot when graph rebuild is triggered. The dependency work on luvio needs to be done.
|
|
15119
15148
|
const rebuildSnapshot = function (snapshot, onRebuild) {
|
|
15120
15149
|
if (isStoreEvalSnapshot(snapshot)) {
|
|
15121
15150
|
snapshot.rebuildWithStoreEval(snapshot).then((rebuilt) => {
|
|
@@ -15131,8 +15160,64 @@ function makeEnvironmentGraphqlAware(environment) {
|
|
|
15131
15160
|
}
|
|
15132
15161
|
return environment.rebuildSnapshot(snapshot, onRebuild);
|
|
15133
15162
|
};
|
|
15163
|
+
const applyCachePolicy = function (luvio, adapterRequestContext, buildSnapshotContext, buildCachedSnapshot, buildNetworkSnapshot) {
|
|
15164
|
+
// Early exit for non-evaluating adapters
|
|
15165
|
+
let graphqlBuildSnapshotContext = buildSnapshotContext;
|
|
15166
|
+
if (graphqlBuildSnapshotContext.gqlEval !== true) {
|
|
15167
|
+
return environment.applyCachePolicy(luvio, adapterRequestContext, buildSnapshotContext, buildCachedSnapshot, buildNetworkSnapshot);
|
|
15168
|
+
}
|
|
15169
|
+
var localBuildCachedSnapshot = buildCachedSnapshot;
|
|
15170
|
+
const hoistUnfulfilledToStale = (context, storeLookup, luvio) => {
|
|
15171
|
+
const upstream = buildCachedSnapshot(context, storeLookup, luvio);
|
|
15172
|
+
if (upstream === undefined)
|
|
15173
|
+
return upstream;
|
|
15174
|
+
if (isUnfulfilledSnapshot(upstream)) {
|
|
15175
|
+
return {
|
|
15176
|
+
...upstream,
|
|
15177
|
+
data: upstream.data || {},
|
|
15178
|
+
state: 'Stale',
|
|
15179
|
+
};
|
|
15180
|
+
}
|
|
15181
|
+
else if ('then' in upstream) {
|
|
15182
|
+
return upstream.then((snapshot) => {
|
|
15183
|
+
if (snapshot === undefined)
|
|
15184
|
+
return snapshot;
|
|
15185
|
+
if (isUnfulfilledSnapshot(snapshot)) {
|
|
15186
|
+
return {
|
|
15187
|
+
...snapshot,
|
|
15188
|
+
data: snapshot.data || {},
|
|
15189
|
+
state: 'Stale',
|
|
15190
|
+
};
|
|
15191
|
+
}
|
|
15192
|
+
return snapshot;
|
|
15193
|
+
});
|
|
15194
|
+
}
|
|
15195
|
+
return upstream;
|
|
15196
|
+
};
|
|
15197
|
+
const { cachePolicy } = adapterRequestContext;
|
|
15198
|
+
if (eagerEvalValidAt.isOpen({ fallback: false }) &&
|
|
15199
|
+
cachePolicy &&
|
|
15200
|
+
cachePolicy.type === 'valid-at' &&
|
|
15201
|
+
cachePolicy.timestamp === 0 &&
|
|
15202
|
+
cachePolicy.basePolicy &&
|
|
15203
|
+
cachePolicy.basePolicy.type === 'stale-while-revalidate') {
|
|
15204
|
+
localBuildCachedSnapshot = hoistUnfulfilledToStale;
|
|
15205
|
+
}
|
|
15206
|
+
if (eagerEvalStaleWhileRevalidate.isOpen({ fallback: false }) &&
|
|
15207
|
+
cachePolicy &&
|
|
15208
|
+
cachePolicy.type === 'stale-while-revalidate' &&
|
|
15209
|
+
cachePolicy.staleDurationSeconds === Number.MAX_SAFE_INTEGER) {
|
|
15210
|
+
localBuildCachedSnapshot = hoistUnfulfilledToStale;
|
|
15211
|
+
}
|
|
15212
|
+
if (eagerEvalDefaultCachePolicy.isOpen({ fallback: false }) && cachePolicy === undefined) {
|
|
15213
|
+
localBuildCachedSnapshot = hoistUnfulfilledToStale;
|
|
15214
|
+
}
|
|
15215
|
+
return environment.applyCachePolicy(luvio, adapterRequestContext, buildSnapshotContext, localBuildCachedSnapshot, buildNetworkSnapshot);
|
|
15216
|
+
};
|
|
15134
15217
|
return create(environment, {
|
|
15135
15218
|
rebuildSnapshot: { value: rebuildSnapshot },
|
|
15219
|
+
applyCachePolicy: { value: applyCachePolicy },
|
|
15220
|
+
setDefaultCachePolicy: { value: environment.setDefaultCachePolicy.bind(environment) },
|
|
15136
15221
|
});
|
|
15137
15222
|
}
|
|
15138
15223
|
|
|
@@ -15885,4 +15970,4 @@ register({
|
|
|
15885
15970
|
});
|
|
15886
15971
|
|
|
15887
15972
|
export { getRuntime, registerReportObserver, reportGraphqlQueryParseError };
|
|
15888
|
-
// version: 1.
|
|
15973
|
+
// version: 1.144.0-ac4b15ad8
|
|
@@ -6,7 +6,7 @@ export declare function reportGraphqlSqlEvalPreconditionError(err: unknown): voi
|
|
|
6
6
|
export declare function reportGraphqlCreateSnapshotError(err: unknown): void;
|
|
7
7
|
export declare function reportGraphQlEvalDbReadDuration(duration: number): void;
|
|
8
8
|
export declare function reportGraphqlAdapterError(errorCode: string): void;
|
|
9
|
-
export declare function reportDraftActionEvent(state: 'added' | 'completed' | 'deleted' | 'updated' | 'failed'): void;
|
|
9
|
+
export declare function reportDraftActionEvent(state: 'added' | 'uploading' | 'completed' | 'deleted' | 'updated' | 'failed'): void;
|
|
10
10
|
export declare function reportDraftQueueState(state: 'started' | 'error' | 'waiting' | 'stopped'): void;
|
|
11
11
|
export declare function reportDraftAwareContentDocumentVersionSynthesizeError(err: unknown): void;
|
|
12
12
|
export declare function reportDraftAwareContentVersionSynthesizeCalls(mimeType: string): void;
|