@salesforce/lds-runtime-mobile 1.354.0-dev1 → 1.355.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 +72 -12
- package/dist/types/drafts/quickActions/AbstractQuickActionHandler.d.ts +11 -0
- package/dist/types/drafts/quickActions/QuickActionExecutionRepresentationHandler.d.ts +2 -2
- package/dist/types/drafts/quickActions/UpdateRecordQuickActionExecutionRepresentationHandler.d.ts +2 -2
- package/dist/types/durableStore/DurableRecordStore.d.ts +1 -0
- package/package.json +14 -14
- package/sfdc/main.js +72 -12
- package/sfdc/types/drafts/quickActions/AbstractQuickActionHandler.d.ts +11 -0
- package/sfdc/types/drafts/quickActions/QuickActionExecutionRepresentationHandler.d.ts +2 -2
- package/sfdc/types/drafts/quickActions/UpdateRecordQuickActionExecutionRepresentationHandler.d.ts +2 -2
- package/sfdc/types/durableStore/DurableRecordStore.d.ts +1 -0
package/dist/main.js
CHANGED
|
@@ -527,7 +527,7 @@ function isDeprecatedDurableStoreEntry(durableRecord) {
|
|
|
527
527
|
return false;
|
|
528
528
|
}
|
|
529
529
|
const DefaultDurableSegment = 'DEFAULT';
|
|
530
|
-
const RedirectDurableSegment = 'REDIRECT_KEYS';
|
|
530
|
+
const RedirectDurableSegment$1 = 'REDIRECT_KEYS';
|
|
531
531
|
const MessagingDurableSegment = 'MESSAGING';
|
|
532
532
|
const MessageNotifyStoreUpdateAvailable = 'notifyStoreUpdateAvailable';
|
|
533
533
|
|
|
@@ -854,7 +854,7 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStor
|
|
|
854
854
|
data: { key, redirect: value },
|
|
855
855
|
},
|
|
856
856
|
},
|
|
857
|
-
segment: RedirectDurableSegment,
|
|
857
|
+
segment: RedirectDurableSegment$1,
|
|
858
858
|
});
|
|
859
859
|
});
|
|
860
860
|
// evicts
|
|
@@ -914,7 +914,7 @@ function buildIngestStagingStore(environment) {
|
|
|
914
914
|
}
|
|
915
915
|
|
|
916
916
|
async function reviveRedirects(durableStore, env) {
|
|
917
|
-
const entries = await durableStore.getAllEntries(RedirectDurableSegment);
|
|
917
|
+
const entries = await durableStore.getAllEntries(RedirectDurableSegment$1);
|
|
918
918
|
if (entries) {
|
|
919
919
|
for (const durableEntry of Object.keys(entries)) {
|
|
920
920
|
const entry = entries[durableEntry];
|
|
@@ -1080,7 +1080,7 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
|
|
|
1080
1080
|
else if (change.segment === AdapterContextSegment) {
|
|
1081
1081
|
adapterContextSegmentKeys.push(...change.ids);
|
|
1082
1082
|
}
|
|
1083
|
-
else if (change.segment === RedirectDurableSegment) {
|
|
1083
|
+
else if (change.segment === RedirectDurableSegment$1) {
|
|
1084
1084
|
redirectSegmentKeys.push(...change.ids);
|
|
1085
1085
|
}
|
|
1086
1086
|
else if (change.segment === MessagingDurableSegment) {
|
|
@@ -1088,7 +1088,7 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
|
|
|
1088
1088
|
}
|
|
1089
1089
|
}
|
|
1090
1090
|
if (redirectSegmentKeys.length > 0) {
|
|
1091
|
-
const redirectEntries = await durableStore.getEntries(redirectSegmentKeys, RedirectDurableSegment);
|
|
1091
|
+
const redirectEntries = await durableStore.getEntries(redirectSegmentKeys, RedirectDurableSegment$1);
|
|
1092
1092
|
if (redirectEntries !== undefined) {
|
|
1093
1093
|
const redirectKeys = Object.keys(redirectEntries);
|
|
1094
1094
|
for (const key of redirectKeys) {
|
|
@@ -42716,8 +42716,44 @@ class UiApiDraftRecordService {
|
|
|
42716
42716
|
}
|
|
42717
42717
|
}
|
|
42718
42718
|
|
|
42719
|
+
class AbstractQuickActionHandler extends AbstractResourceRequestActionHandler {
|
|
42720
|
+
constructor(draftQueue, networkAdapter, getLuvio, recordService) {
|
|
42721
|
+
super(draftQueue, networkAdapter, getLuvio, recordService);
|
|
42722
|
+
}
|
|
42723
|
+
async buildPendingAction(request, queue) {
|
|
42724
|
+
this.resolveResourceRequestBody(request.body);
|
|
42725
|
+
return await super.buildPendingAction(request, queue);
|
|
42726
|
+
}
|
|
42727
|
+
resolveResourceRequestBody(body) {
|
|
42728
|
+
let contextId = body.contextId;
|
|
42729
|
+
if (contextId && this.isDraftId(contextId)) {
|
|
42730
|
+
const draftKey = getRecordKeyForId(this.getLuvio(), contextId);
|
|
42731
|
+
const canonicalKey = this.getLuvio().storeGetCanonicalKey(draftKey);
|
|
42732
|
+
if (draftKey !== canonicalKey) {
|
|
42733
|
+
const canonicalId = extractRecordIdFromStoreKey(canonicalKey);
|
|
42734
|
+
if (canonicalId !== undefined) {
|
|
42735
|
+
body.contextId = canonicalId;
|
|
42736
|
+
}
|
|
42737
|
+
}
|
|
42738
|
+
}
|
|
42739
|
+
for (const field of keys$2(body.fields)) {
|
|
42740
|
+
const fieldValue = body.fields[field];
|
|
42741
|
+
if (typeof fieldValue === 'string' && this.isDraftId(fieldValue)) {
|
|
42742
|
+
const draftKey = getRecordKeyForId(this.getLuvio(), fieldValue);
|
|
42743
|
+
const canonicalKey = this.getLuvio().storeGetCanonicalKey(draftKey);
|
|
42744
|
+
if (draftKey !== canonicalKey) {
|
|
42745
|
+
const canonicalId = extractRecordIdFromStoreKey(canonicalKey);
|
|
42746
|
+
if (canonicalId !== undefined) {
|
|
42747
|
+
body.fields[field] = canonicalId;
|
|
42748
|
+
}
|
|
42749
|
+
}
|
|
42750
|
+
}
|
|
42751
|
+
}
|
|
42752
|
+
}
|
|
42753
|
+
}
|
|
42754
|
+
|
|
42719
42755
|
const QUICK_ACTION_HANDLER = 'QUICK_ACTION_HANDLER';
|
|
42720
|
-
class QuickActionExecutionRepresentationHandler extends
|
|
42756
|
+
class QuickActionExecutionRepresentationHandler extends AbstractQuickActionHandler {
|
|
42721
42757
|
constructor(getLuvio, draftRecordService, draftQueue, networkAdapter, isDraftId, sideEffectService, objectInfoService, getRecord) {
|
|
42722
42758
|
super(draftQueue, networkAdapter, getLuvio, draftRecordService);
|
|
42723
42759
|
this.draftRecordService = draftRecordService;
|
|
@@ -42786,7 +42822,7 @@ class QuickActionExecutionRepresentationHandler extends AbstractResourceRequestA
|
|
|
42786
42822
|
}
|
|
42787
42823
|
|
|
42788
42824
|
const UPDATE_RECORD_QUICK_ACTION_HANDLER = 'UPDATE_RECORD_QUICK_ACTION_HANDLER';
|
|
42789
|
-
class UpdateRecordQuickActionExecutionRepresentationHandler extends
|
|
42825
|
+
class UpdateRecordQuickActionExecutionRepresentationHandler extends AbstractQuickActionHandler {
|
|
42790
42826
|
constructor(getLuvio, draftRecordService, draftQueue, networkAdapter, isDraftId, sideEffectService) {
|
|
42791
42827
|
super(draftQueue, networkAdapter, getLuvio, draftRecordService);
|
|
42792
42828
|
this.draftRecordService = draftRecordService;
|
|
@@ -43350,7 +43386,10 @@ function createRecordDraftAdapterFactory(actionHandler, durableRecordStore) {
|
|
|
43350
43386
|
const action = await actionHandler.enqueue(request).catch((err) => {
|
|
43351
43387
|
throw transformErrorToDraftSynthesisError(err);
|
|
43352
43388
|
});
|
|
43353
|
-
|
|
43389
|
+
let record = await durableRecordStore.getRecord(action.tag);
|
|
43390
|
+
if (!record) {
|
|
43391
|
+
record = await durableRecordStore.getRedirectedRecord(action.tag);
|
|
43392
|
+
}
|
|
43354
43393
|
if (record) {
|
|
43355
43394
|
return {
|
|
43356
43395
|
state: 'Fulfilled',
|
|
@@ -43378,7 +43417,10 @@ function updateRecordDraftAdapterFactory(actionHandler, durableRecordStore) {
|
|
|
43378
43417
|
const action = await actionHandler.enqueue(request).catch((err) => {
|
|
43379
43418
|
throw transformErrorToDraftSynthesisError(err);
|
|
43380
43419
|
});
|
|
43381
|
-
|
|
43420
|
+
let record = await durableRecordStore.getRecord(action.tag);
|
|
43421
|
+
if (!record) {
|
|
43422
|
+
record = await durableRecordStore.getRedirectedRecord(action.tag);
|
|
43423
|
+
}
|
|
43382
43424
|
if (record) {
|
|
43383
43425
|
return {
|
|
43384
43426
|
state: 'Fulfilled',
|
|
@@ -53539,12 +53581,15 @@ class SoqlRecordConverter {
|
|
|
53539
53581
|
};
|
|
53540
53582
|
}
|
|
53541
53583
|
weakEtag(lastModifiedDate) {
|
|
53584
|
+
if (!lastModifiedDate)
|
|
53585
|
+
return 0;
|
|
53542
53586
|
const date = new Date(lastModifiedDate);
|
|
53543
|
-
|
|
53587
|
+
const timestamp = date.getTime();
|
|
53588
|
+
return isNaN(timestamp) ? 0 : timestamp; // milliseconds which matches GQL results
|
|
53544
53589
|
}
|
|
53545
53590
|
formatFieldValueIfNeeded(field, value) {
|
|
53546
53591
|
if (!value)
|
|
53547
|
-
return
|
|
53592
|
+
return null;
|
|
53548
53593
|
if (this.fieldTypeMapping.get(field) === 'DateTime') {
|
|
53549
53594
|
const date = new Date(value);
|
|
53550
53595
|
return date.toISOString();
|
|
@@ -55259,6 +55304,8 @@ function isStoreRecordError$1(storeRecord) {
|
|
|
55259
55304
|
return storeRecord.__type === 'error';
|
|
55260
55305
|
}
|
|
55261
55306
|
|
|
55307
|
+
// NB: This is not exported from luvio, redefined here to avoid changing luvio in patch
|
|
55308
|
+
const RedirectDurableSegment = 'REDIRECT_KEYS';
|
|
55262
55309
|
class DurableRecordStore {
|
|
55263
55310
|
constructor(durableStore, getLuvio) {
|
|
55264
55311
|
this.durableStore = durableStore;
|
|
@@ -55274,6 +55321,19 @@ class DurableRecordStore {
|
|
|
55274
55321
|
const map = await this.getRecords([canonicalKey]);
|
|
55275
55322
|
return map.get(canonicalKey);
|
|
55276
55323
|
}
|
|
55324
|
+
// This method will first lookup a redirected key directly in L2, and if a redirected key exists fetch the record with that key.
|
|
55325
|
+
async getRedirectedRecord(key) {
|
|
55326
|
+
const entries = await this.durableStore.getEntries([key], RedirectDurableSegment);
|
|
55327
|
+
if (entries === undefined) {
|
|
55328
|
+
return undefined;
|
|
55329
|
+
}
|
|
55330
|
+
const redirectedEntry = entries[key];
|
|
55331
|
+
if (redirectedEntry === undefined || redirectedEntry.data === undefined) {
|
|
55332
|
+
return undefined;
|
|
55333
|
+
}
|
|
55334
|
+
const redirectedRecord = await this.getRecord(redirectedEntry.data.redirect);
|
|
55335
|
+
return redirectedRecord;
|
|
55336
|
+
}
|
|
55277
55337
|
async getRecords(keys) {
|
|
55278
55338
|
const withMetadata = await this.getRecordsWithMetadata(keys);
|
|
55279
55339
|
const map = new Map();
|
|
@@ -55676,4 +55736,4 @@ register({
|
|
|
55676
55736
|
});
|
|
55677
55737
|
|
|
55678
55738
|
export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, ingest$1o as ingestDenormalizedRecordRepresentation, registerReportObserver, reportGraphqlQueryParseError };
|
|
55679
|
-
// version: 1.
|
|
55739
|
+
// version: 1.355.0-4ae8017b1b
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AbstractResourceRequestActionHandler } from '../AbstractResourceRequestActionHandler';
|
|
2
|
+
import { QuickActionExecutionRepresentation } from '@salesforce/lds-adapters-uiapi';
|
|
3
|
+
import { NetworkAdapter, ResourceRequest } from '@luvio/engine';
|
|
4
|
+
import { DraftAction, DraftQueue, PendingDraftAction } from '@salesforce/lds-drafts';
|
|
5
|
+
import { Luvio } from '@luvio/engine';
|
|
6
|
+
import { UiApiDraftRecordService } from '../UiApiDraftRecordService';
|
|
7
|
+
export declare abstract class AbstractQuickActionHandler extends AbstractResourceRequestActionHandler<QuickActionExecutionRepresentation> {
|
|
8
|
+
constructor(draftQueue: DraftQueue, networkAdapter: NetworkAdapter, getLuvio: () => Luvio, recordService: UiApiDraftRecordService);
|
|
9
|
+
buildPendingAction(request: ResourceRequest, queue: DraftAction<unknown, unknown>[]): Promise<PendingDraftAction<ResourceRequest>>;
|
|
10
|
+
private resolveResourceRequestBody;
|
|
11
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CompletedDraftAction, QueueOperation, DraftAction, DraftQueue } from '@salesforce/lds-drafts';
|
|
2
|
-
import {
|
|
2
|
+
import { AbstractQuickActionHandler } from './AbstractQuickActionHandler';
|
|
3
3
|
import type { PerformActionInputRepresentation, QuickActionExecutionRepresentation, RecordRepresentation } from '@salesforce/lds-adapters-uiapi';
|
|
4
4
|
import { GetRecordConfig } from '@salesforce/lds-adapters-uiapi';
|
|
5
5
|
import type { DurableStoreKeyMetadataMap, Luvio, NetworkAdapter, ResourceRequest, Adapter } from '@luvio/engine';
|
|
@@ -13,7 +13,7 @@ interface PerformQuickActionResourceRequest extends Omit<ResourceRequest, 'body'
|
|
|
13
13
|
body: PerformActionInputRepresentation;
|
|
14
14
|
method: 'post';
|
|
15
15
|
}
|
|
16
|
-
export declare class QuickActionExecutionRepresentationHandler extends
|
|
16
|
+
export declare class QuickActionExecutionRepresentationHandler extends AbstractQuickActionHandler implements RecordEffectingHandler {
|
|
17
17
|
private readonly draftRecordService;
|
|
18
18
|
readonly isDraftId: (targetId: string) => boolean;
|
|
19
19
|
private readonly sideEffectService;
|
package/dist/types/drafts/quickActions/UpdateRecordQuickActionExecutionRepresentationHandler.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { CompletedDraftAction, DraftAction, DraftQueue, QueueOperation } from '@salesforce/lds-drafts';
|
|
2
|
-
import { AbstractResourceRequestActionHandler } from '../AbstractResourceRequestActionHandler';
|
|
3
2
|
import type { DurableStoreKeyMetadataMap, Luvio, NetworkAdapter, ResourceRequest } from '@luvio/engine';
|
|
4
3
|
import type { PerformActionInputRepresentation, QuickActionExecutionRepresentation } from '@salesforce/lds-adapters-uiapi';
|
|
5
4
|
import type { UiApiDraftRecordService } from '../UiApiDraftRecordService';
|
|
6
5
|
import type { RecordEffectingHandler } from '../records/actionHandlers/RecordEffectingHandler';
|
|
7
6
|
import type { SideEffect } from '../sideEffects/sideEffects';
|
|
8
7
|
import { type SideEffectService } from '../sideEffects/SideEffectService';
|
|
8
|
+
import { AbstractQuickActionHandler } from './AbstractQuickActionHandler';
|
|
9
9
|
export declare const UPDATE_RECORD_QUICK_ACTION_HANDLER = "UPDATE_RECORD_QUICK_ACTION_HANDLER";
|
|
10
10
|
interface PerformUpdateRecordQuickActionResourceRequest extends Omit<ResourceRequest, 'body' | 'method'> {
|
|
11
11
|
body: PerformActionInputRepresentation;
|
|
12
12
|
method: 'patch';
|
|
13
13
|
}
|
|
14
|
-
export declare class UpdateRecordQuickActionExecutionRepresentationHandler extends
|
|
14
|
+
export declare class UpdateRecordQuickActionExecutionRepresentationHandler extends AbstractQuickActionHandler implements RecordEffectingHandler {
|
|
15
15
|
private readonly draftRecordService;
|
|
16
16
|
readonly isDraftId: (targetId: string) => boolean;
|
|
17
17
|
private readonly sideEffectService;
|
|
@@ -8,6 +8,7 @@ export declare class DurableRecordStore {
|
|
|
8
8
|
constructor(durableStore: DurableStore & SqliteStore, getLuvio: () => Luvio);
|
|
9
9
|
exists(key: string): Promise<boolean>;
|
|
10
10
|
getRecord(key: string): Promise<DurableRecordRepresentation | undefined>;
|
|
11
|
+
getRedirectedRecord(key: string): Promise<DurableRecordRepresentation | undefined>;
|
|
11
12
|
getRecords(keys: string[]): Promise<Map<string, DurableRecordRepresentation>>;
|
|
12
13
|
getRecordsWithMetadata(keys: string[]): Promise<Map<string, {
|
|
13
14
|
record: DurableRecordRepresentation;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-runtime-mobile",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.355.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,24 +32,24 @@
|
|
|
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.355.0",
|
|
36
|
+
"@salesforce/lds-bindings": "^1.355.0",
|
|
37
|
+
"@salesforce/lds-instrumentation": "^1.355.0",
|
|
38
38
|
"@salesforce/user": "0.0.21",
|
|
39
39
|
"o11y": "250.7.0",
|
|
40
40
|
"o11y_schema": "256.126.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@salesforce/lds-adapters-graphql": "^1.
|
|
44
|
-
"@salesforce/lds-drafts": "^1.
|
|
45
|
-
"@salesforce/lds-durable-records": "^1.
|
|
46
|
-
"@salesforce/lds-network-adapter": "^1.
|
|
47
|
-
"@salesforce/lds-network-nimbus": "^1.
|
|
48
|
-
"@salesforce/lds-store-binary": "^1.
|
|
49
|
-
"@salesforce/lds-store-nimbus": "^1.
|
|
50
|
-
"@salesforce/lds-store-sql": "^1.
|
|
51
|
-
"@salesforce/lds-utils-adapters": "^1.
|
|
52
|
-
"@salesforce/nimbus-plugin-lds": "^1.
|
|
43
|
+
"@salesforce/lds-adapters-graphql": "^1.355.0",
|
|
44
|
+
"@salesforce/lds-drafts": "^1.355.0",
|
|
45
|
+
"@salesforce/lds-durable-records": "^1.355.0",
|
|
46
|
+
"@salesforce/lds-network-adapter": "^1.355.0",
|
|
47
|
+
"@salesforce/lds-network-nimbus": "^1.355.0",
|
|
48
|
+
"@salesforce/lds-store-binary": "^1.355.0",
|
|
49
|
+
"@salesforce/lds-store-nimbus": "^1.355.0",
|
|
50
|
+
"@salesforce/lds-store-sql": "^1.355.0",
|
|
51
|
+
"@salesforce/lds-utils-adapters": "^1.355.0",
|
|
52
|
+
"@salesforce/nimbus-plugin-lds": "^1.355.0",
|
|
53
53
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
54
54
|
"wait-for-expect": "^3.0.2"
|
|
55
55
|
},
|
package/sfdc/main.js
CHANGED
|
@@ -527,7 +527,7 @@ function isDeprecatedDurableStoreEntry(durableRecord) {
|
|
|
527
527
|
return false;
|
|
528
528
|
}
|
|
529
529
|
const DefaultDurableSegment = 'DEFAULT';
|
|
530
|
-
const RedirectDurableSegment = 'REDIRECT_KEYS';
|
|
530
|
+
const RedirectDurableSegment$1 = 'REDIRECT_KEYS';
|
|
531
531
|
const MessagingDurableSegment = 'MESSAGING';
|
|
532
532
|
const MessageNotifyStoreUpdateAvailable = 'notifyStoreUpdateAvailable';
|
|
533
533
|
|
|
@@ -854,7 +854,7 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStor
|
|
|
854
854
|
data: { key, redirect: value },
|
|
855
855
|
},
|
|
856
856
|
},
|
|
857
|
-
segment: RedirectDurableSegment,
|
|
857
|
+
segment: RedirectDurableSegment$1,
|
|
858
858
|
});
|
|
859
859
|
});
|
|
860
860
|
// evicts
|
|
@@ -914,7 +914,7 @@ function buildIngestStagingStore(environment) {
|
|
|
914
914
|
}
|
|
915
915
|
|
|
916
916
|
async function reviveRedirects(durableStore, env) {
|
|
917
|
-
const entries = await durableStore.getAllEntries(RedirectDurableSegment);
|
|
917
|
+
const entries = await durableStore.getAllEntries(RedirectDurableSegment$1);
|
|
918
918
|
if (entries) {
|
|
919
919
|
for (const durableEntry of Object.keys(entries)) {
|
|
920
920
|
const entry = entries[durableEntry];
|
|
@@ -1080,7 +1080,7 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
|
|
|
1080
1080
|
else if (change.segment === AdapterContextSegment) {
|
|
1081
1081
|
adapterContextSegmentKeys.push(...change.ids);
|
|
1082
1082
|
}
|
|
1083
|
-
else if (change.segment === RedirectDurableSegment) {
|
|
1083
|
+
else if (change.segment === RedirectDurableSegment$1) {
|
|
1084
1084
|
redirectSegmentKeys.push(...change.ids);
|
|
1085
1085
|
}
|
|
1086
1086
|
else if (change.segment === MessagingDurableSegment) {
|
|
@@ -1088,7 +1088,7 @@ function makeDurable(environment, { durableStore, instrumentation, useRevivingSt
|
|
|
1088
1088
|
}
|
|
1089
1089
|
}
|
|
1090
1090
|
if (redirectSegmentKeys.length > 0) {
|
|
1091
|
-
const redirectEntries = await durableStore.getEntries(redirectSegmentKeys, RedirectDurableSegment);
|
|
1091
|
+
const redirectEntries = await durableStore.getEntries(redirectSegmentKeys, RedirectDurableSegment$1);
|
|
1092
1092
|
if (redirectEntries !== undefined) {
|
|
1093
1093
|
const redirectKeys = Object.keys(redirectEntries);
|
|
1094
1094
|
for (const key of redirectKeys) {
|
|
@@ -42716,8 +42716,44 @@ class UiApiDraftRecordService {
|
|
|
42716
42716
|
}
|
|
42717
42717
|
}
|
|
42718
42718
|
|
|
42719
|
+
class AbstractQuickActionHandler extends AbstractResourceRequestActionHandler {
|
|
42720
|
+
constructor(draftQueue, networkAdapter, getLuvio, recordService) {
|
|
42721
|
+
super(draftQueue, networkAdapter, getLuvio, recordService);
|
|
42722
|
+
}
|
|
42723
|
+
async buildPendingAction(request, queue) {
|
|
42724
|
+
this.resolveResourceRequestBody(request.body);
|
|
42725
|
+
return await super.buildPendingAction(request, queue);
|
|
42726
|
+
}
|
|
42727
|
+
resolveResourceRequestBody(body) {
|
|
42728
|
+
let contextId = body.contextId;
|
|
42729
|
+
if (contextId && this.isDraftId(contextId)) {
|
|
42730
|
+
const draftKey = getRecordKeyForId(this.getLuvio(), contextId);
|
|
42731
|
+
const canonicalKey = this.getLuvio().storeGetCanonicalKey(draftKey);
|
|
42732
|
+
if (draftKey !== canonicalKey) {
|
|
42733
|
+
const canonicalId = extractRecordIdFromStoreKey(canonicalKey);
|
|
42734
|
+
if (canonicalId !== undefined) {
|
|
42735
|
+
body.contextId = canonicalId;
|
|
42736
|
+
}
|
|
42737
|
+
}
|
|
42738
|
+
}
|
|
42739
|
+
for (const field of keys$2(body.fields)) {
|
|
42740
|
+
const fieldValue = body.fields[field];
|
|
42741
|
+
if (typeof fieldValue === 'string' && this.isDraftId(fieldValue)) {
|
|
42742
|
+
const draftKey = getRecordKeyForId(this.getLuvio(), fieldValue);
|
|
42743
|
+
const canonicalKey = this.getLuvio().storeGetCanonicalKey(draftKey);
|
|
42744
|
+
if (draftKey !== canonicalKey) {
|
|
42745
|
+
const canonicalId = extractRecordIdFromStoreKey(canonicalKey);
|
|
42746
|
+
if (canonicalId !== undefined) {
|
|
42747
|
+
body.fields[field] = canonicalId;
|
|
42748
|
+
}
|
|
42749
|
+
}
|
|
42750
|
+
}
|
|
42751
|
+
}
|
|
42752
|
+
}
|
|
42753
|
+
}
|
|
42754
|
+
|
|
42719
42755
|
const QUICK_ACTION_HANDLER = 'QUICK_ACTION_HANDLER';
|
|
42720
|
-
class QuickActionExecutionRepresentationHandler extends
|
|
42756
|
+
class QuickActionExecutionRepresentationHandler extends AbstractQuickActionHandler {
|
|
42721
42757
|
constructor(getLuvio, draftRecordService, draftQueue, networkAdapter, isDraftId, sideEffectService, objectInfoService, getRecord) {
|
|
42722
42758
|
super(draftQueue, networkAdapter, getLuvio, draftRecordService);
|
|
42723
42759
|
this.draftRecordService = draftRecordService;
|
|
@@ -42786,7 +42822,7 @@ class QuickActionExecutionRepresentationHandler extends AbstractResourceRequestA
|
|
|
42786
42822
|
}
|
|
42787
42823
|
|
|
42788
42824
|
const UPDATE_RECORD_QUICK_ACTION_HANDLER = 'UPDATE_RECORD_QUICK_ACTION_HANDLER';
|
|
42789
|
-
class UpdateRecordQuickActionExecutionRepresentationHandler extends
|
|
42825
|
+
class UpdateRecordQuickActionExecutionRepresentationHandler extends AbstractQuickActionHandler {
|
|
42790
42826
|
constructor(getLuvio, draftRecordService, draftQueue, networkAdapter, isDraftId, sideEffectService) {
|
|
42791
42827
|
super(draftQueue, networkAdapter, getLuvio, draftRecordService);
|
|
42792
42828
|
this.draftRecordService = draftRecordService;
|
|
@@ -43350,7 +43386,10 @@ function createRecordDraftAdapterFactory(actionHandler, durableRecordStore) {
|
|
|
43350
43386
|
const action = await actionHandler.enqueue(request).catch((err) => {
|
|
43351
43387
|
throw transformErrorToDraftSynthesisError(err);
|
|
43352
43388
|
});
|
|
43353
|
-
|
|
43389
|
+
let record = await durableRecordStore.getRecord(action.tag);
|
|
43390
|
+
if (!record) {
|
|
43391
|
+
record = await durableRecordStore.getRedirectedRecord(action.tag);
|
|
43392
|
+
}
|
|
43354
43393
|
if (record) {
|
|
43355
43394
|
return {
|
|
43356
43395
|
state: 'Fulfilled',
|
|
@@ -43378,7 +43417,10 @@ function updateRecordDraftAdapterFactory(actionHandler, durableRecordStore) {
|
|
|
43378
43417
|
const action = await actionHandler.enqueue(request).catch((err) => {
|
|
43379
43418
|
throw transformErrorToDraftSynthesisError(err);
|
|
43380
43419
|
});
|
|
43381
|
-
|
|
43420
|
+
let record = await durableRecordStore.getRecord(action.tag);
|
|
43421
|
+
if (!record) {
|
|
43422
|
+
record = await durableRecordStore.getRedirectedRecord(action.tag);
|
|
43423
|
+
}
|
|
43382
43424
|
if (record) {
|
|
43383
43425
|
return {
|
|
43384
43426
|
state: 'Fulfilled',
|
|
@@ -53539,12 +53581,15 @@ class SoqlRecordConverter {
|
|
|
53539
53581
|
};
|
|
53540
53582
|
}
|
|
53541
53583
|
weakEtag(lastModifiedDate) {
|
|
53584
|
+
if (!lastModifiedDate)
|
|
53585
|
+
return 0;
|
|
53542
53586
|
const date = new Date(lastModifiedDate);
|
|
53543
|
-
|
|
53587
|
+
const timestamp = date.getTime();
|
|
53588
|
+
return isNaN(timestamp) ? 0 : timestamp; // milliseconds which matches GQL results
|
|
53544
53589
|
}
|
|
53545
53590
|
formatFieldValueIfNeeded(field, value) {
|
|
53546
53591
|
if (!value)
|
|
53547
|
-
return
|
|
53592
|
+
return null;
|
|
53548
53593
|
if (this.fieldTypeMapping.get(field) === 'DateTime') {
|
|
53549
53594
|
const date = new Date(value);
|
|
53550
53595
|
return date.toISOString();
|
|
@@ -55259,6 +55304,8 @@ function isStoreRecordError$1(storeRecord) {
|
|
|
55259
55304
|
return storeRecord.__type === 'error';
|
|
55260
55305
|
}
|
|
55261
55306
|
|
|
55307
|
+
// NB: This is not exported from luvio, redefined here to avoid changing luvio in patch
|
|
55308
|
+
const RedirectDurableSegment = 'REDIRECT_KEYS';
|
|
55262
55309
|
class DurableRecordStore {
|
|
55263
55310
|
constructor(durableStore, getLuvio) {
|
|
55264
55311
|
this.durableStore = durableStore;
|
|
@@ -55274,6 +55321,19 @@ class DurableRecordStore {
|
|
|
55274
55321
|
const map = await this.getRecords([canonicalKey]);
|
|
55275
55322
|
return map.get(canonicalKey);
|
|
55276
55323
|
}
|
|
55324
|
+
// This method will first lookup a redirected key directly in L2, and if a redirected key exists fetch the record with that key.
|
|
55325
|
+
async getRedirectedRecord(key) {
|
|
55326
|
+
const entries = await this.durableStore.getEntries([key], RedirectDurableSegment);
|
|
55327
|
+
if (entries === undefined) {
|
|
55328
|
+
return undefined;
|
|
55329
|
+
}
|
|
55330
|
+
const redirectedEntry = entries[key];
|
|
55331
|
+
if (redirectedEntry === undefined || redirectedEntry.data === undefined) {
|
|
55332
|
+
return undefined;
|
|
55333
|
+
}
|
|
55334
|
+
const redirectedRecord = await this.getRecord(redirectedEntry.data.redirect);
|
|
55335
|
+
return redirectedRecord;
|
|
55336
|
+
}
|
|
55277
55337
|
async getRecords(keys) {
|
|
55278
55338
|
const withMetadata = await this.getRecordsWithMetadata(keys);
|
|
55279
55339
|
const map = new Map();
|
|
@@ -55676,4 +55736,4 @@ register({
|
|
|
55676
55736
|
});
|
|
55677
55737
|
|
|
55678
55738
|
export { O11Y_NAMESPACE_LDS_MOBILE, getRuntime, ingest$1o as ingestDenormalizedRecordRepresentation, registerReportObserver, reportGraphqlQueryParseError };
|
|
55679
|
-
// version: 1.
|
|
55739
|
+
// version: 1.355.0-4ae8017b1b
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AbstractResourceRequestActionHandler } from '../AbstractResourceRequestActionHandler';
|
|
2
|
+
import { QuickActionExecutionRepresentation } from '@salesforce/lds-adapters-uiapi';
|
|
3
|
+
import { NetworkAdapter, ResourceRequest } from '@luvio/engine';
|
|
4
|
+
import { DraftAction, DraftQueue, PendingDraftAction } from '@salesforce/lds-drafts';
|
|
5
|
+
import { Luvio } from '@luvio/engine';
|
|
6
|
+
import { UiApiDraftRecordService } from '../UiApiDraftRecordService';
|
|
7
|
+
export declare abstract class AbstractQuickActionHandler extends AbstractResourceRequestActionHandler<QuickActionExecutionRepresentation> {
|
|
8
|
+
constructor(draftQueue: DraftQueue, networkAdapter: NetworkAdapter, getLuvio: () => Luvio, recordService: UiApiDraftRecordService);
|
|
9
|
+
buildPendingAction(request: ResourceRequest, queue: DraftAction<unknown, unknown>[]): Promise<PendingDraftAction<ResourceRequest>>;
|
|
10
|
+
private resolveResourceRequestBody;
|
|
11
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CompletedDraftAction, QueueOperation, DraftAction, DraftQueue } from '@salesforce/lds-drafts';
|
|
2
|
-
import {
|
|
2
|
+
import { AbstractQuickActionHandler } from './AbstractQuickActionHandler';
|
|
3
3
|
import type { PerformActionInputRepresentation, QuickActionExecutionRepresentation, RecordRepresentation } from '@salesforce/lds-adapters-uiapi';
|
|
4
4
|
import { GetRecordConfig } from '@salesforce/lds-adapters-uiapi';
|
|
5
5
|
import type { DurableStoreKeyMetadataMap, Luvio, NetworkAdapter, ResourceRequest, Adapter } from '@luvio/engine';
|
|
@@ -13,7 +13,7 @@ interface PerformQuickActionResourceRequest extends Omit<ResourceRequest, 'body'
|
|
|
13
13
|
body: PerformActionInputRepresentation;
|
|
14
14
|
method: 'post';
|
|
15
15
|
}
|
|
16
|
-
export declare class QuickActionExecutionRepresentationHandler extends
|
|
16
|
+
export declare class QuickActionExecutionRepresentationHandler extends AbstractQuickActionHandler implements RecordEffectingHandler {
|
|
17
17
|
private readonly draftRecordService;
|
|
18
18
|
readonly isDraftId: (targetId: string) => boolean;
|
|
19
19
|
private readonly sideEffectService;
|
package/sfdc/types/drafts/quickActions/UpdateRecordQuickActionExecutionRepresentationHandler.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { CompletedDraftAction, DraftAction, DraftQueue, QueueOperation } from '@salesforce/lds-drafts';
|
|
2
|
-
import { AbstractResourceRequestActionHandler } from '../AbstractResourceRequestActionHandler';
|
|
3
2
|
import type { DurableStoreKeyMetadataMap, Luvio, NetworkAdapter, ResourceRequest } from '@luvio/engine';
|
|
4
3
|
import type { PerformActionInputRepresentation, QuickActionExecutionRepresentation } from '@salesforce/lds-adapters-uiapi';
|
|
5
4
|
import type { UiApiDraftRecordService } from '../UiApiDraftRecordService';
|
|
6
5
|
import type { RecordEffectingHandler } from '../records/actionHandlers/RecordEffectingHandler';
|
|
7
6
|
import type { SideEffect } from '../sideEffects/sideEffects';
|
|
8
7
|
import { type SideEffectService } from '../sideEffects/SideEffectService';
|
|
8
|
+
import { AbstractQuickActionHandler } from './AbstractQuickActionHandler';
|
|
9
9
|
export declare const UPDATE_RECORD_QUICK_ACTION_HANDLER = "UPDATE_RECORD_QUICK_ACTION_HANDLER";
|
|
10
10
|
interface PerformUpdateRecordQuickActionResourceRequest extends Omit<ResourceRequest, 'body' | 'method'> {
|
|
11
11
|
body: PerformActionInputRepresentation;
|
|
12
12
|
method: 'patch';
|
|
13
13
|
}
|
|
14
|
-
export declare class UpdateRecordQuickActionExecutionRepresentationHandler extends
|
|
14
|
+
export declare class UpdateRecordQuickActionExecutionRepresentationHandler extends AbstractQuickActionHandler implements RecordEffectingHandler {
|
|
15
15
|
private readonly draftRecordService;
|
|
16
16
|
readonly isDraftId: (targetId: string) => boolean;
|
|
17
17
|
private readonly sideEffectService;
|
|
@@ -8,6 +8,7 @@ export declare class DurableRecordStore {
|
|
|
8
8
|
constructor(durableStore: DurableStore & SqliteStore, getLuvio: () => Luvio);
|
|
9
9
|
exists(key: string): Promise<boolean>;
|
|
10
10
|
getRecord(key: string): Promise<DurableRecordRepresentation | undefined>;
|
|
11
|
+
getRedirectedRecord(key: string): Promise<DurableRecordRepresentation | undefined>;
|
|
11
12
|
getRecords(keys: string[]): Promise<Map<string, DurableRecordRepresentation>>;
|
|
12
13
|
getRecordsWithMetadata(keys: string[]): Promise<Map<string, {
|
|
13
14
|
record: DurableRecordRepresentation;
|