@salesforce/lds-runtime-mobile 1.318.0 → 1.320.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 +6823 -7054
- package/dist/types/NimbusDraftQueue.d.ts +1 -1
- package/dist/types/{draftsAdapters → drafts}/AbstractResourceRequestActionHandler.d.ts +21 -22
- package/dist/types/drafts/UiApiDraftRecordService.d.ts +43 -0
- package/{sfdc/types/draftsAdapters/ContentDocumentCompositeRepresentation → dist/types/drafts/contentDocument}/ContentDocumentCompositeRepresentationActionHandler.d.ts +13 -13
- package/{sfdc/types/draftsAdapters/ContentDocumentCompositeRepresentation → dist/types/drafts/contentDocument}/draftAwareAdapters/createContentDocumentAndVersion/index.d.ts +2 -2
- package/dist/types/drafts/index.d.ts +14 -0
- package/dist/types/{draftsAdapters/QuickActionExecutionRepresentation → drafts/quickActions}/QuickActionExecutionRepresentationHandler.d.ts +8 -13
- package/dist/types/drafts/quickActions/UpdateRecordQuickActionExecutionRepresentationHandler.d.ts +29 -0
- package/dist/types/{draftsAdapters/QuickActionExecutionRepresentation → drafts/quickActions}/draftAwareAdapters/performQuickAction.d.ts +1 -1
- package/{sfdc/types/draftsAdapters/QuickActionExecutionRepresentation → dist/types/drafts/quickActions}/draftAwareAdapters/updateRecordPerformQuickAction.d.ts +1 -1
- package/dist/types/drafts/records/actionHandlers/RecordEffectingHandler.d.ts +6 -0
- package/dist/types/drafts/records/actionHandlers/UiApiRecordActionHandler.d.ts +63 -0
- package/{sfdc/types/draftsAdapters/RecordRepresentation → dist/types/drafts/records}/draftAwareAdapters/createRecord.d.ts +2 -2
- package/{sfdc/types/draftsAdapters/RecordRepresentation → dist/types/drafts/records}/draftAwareAdapters/updateRecord.d.ts +2 -2
- package/dist/types/{draftsAdapters/RecordRepresentation → drafts/records}/environment/getRecordDraftEnvironment.d.ts +2 -2
- package/dist/types/{draftsAdapters/RecordRepresentation → drafts/records}/environment/getRecordsDraftEnvironment.d.ts +2 -2
- package/{sfdc/types/draftsAdapters/RecordRepresentation → dist/types/drafts/records}/environment/makeEnvironmentUiApiRecordDraftAware.d.ts +4 -4
- package/{sfdc/types/draftsAdapters/RecordRepresentation → dist/types/drafts/records}/records.d.ts +1 -1
- package/dist/types/drafts/sideEffects/SideEffectHandler.d.ts +14 -0
- package/dist/types/{sideEffects → drafts/sideEffects}/SideEffectService.d.ts +6 -6
- package/dist/types/drafts/utils/durableStore.d.ts +3 -0
- package/dist/types/durableStore/DurableRecordStore.d.ts +17 -0
- package/dist/types/durableStore/NimbusSqliteStore/tables/index.d.ts +0 -1
- package/dist/types/graphql/adapter/draftAwareGraphQLAdapterFactory.d.ts +6 -0
- package/dist/types/graphql/adapter/environmentAwareGraphQLBatchAdapterFactory.d.ts +4 -0
- package/dist/types/graphql/adapter/graphqlEvalAdapterFactory.d.ts +5 -0
- package/dist/types/graphql/adapter/utils.d.ts +2 -0
- package/dist/types/graphql/adapterFactory.d.ts +3 -0
- package/dist/types/graphql/array.d.ts +2 -0
- package/dist/types/graphql/base64.d.ts +4 -0
- package/dist/types/graphql/constants.d.ts +3 -0
- package/dist/types/graphql/context.d.ts +19 -0
- package/dist/types/graphql/dataloader.d.ts +26 -0
- package/dist/types/graphql/dateLiteral.d.ts +28 -0
- package/dist/types/graphql/dateTimePredication.d.ts +33 -0
- package/dist/types/graphql/evaluate.d.ts +12 -0
- package/dist/types/graphql/events.d.ts +37 -0
- package/dist/types/graphql/filterParser.d.ts +6 -0
- package/dist/types/graphql/index.d.ts +9 -0
- package/dist/types/graphql/instrumentLimits.d.ts +8 -0
- package/dist/types/graphql/language.d.ts +33 -0
- package/dist/types/graphql/lib.d.ts +52 -0
- package/dist/types/graphql/limit.d.ts +9 -0
- package/dist/types/graphql/orderByParser.d.ts +10 -0
- package/dist/types/graphql/pagination.d.ts +10 -0
- package/dist/types/graphql/query.d.ts +56 -0
- package/dist/types/graphql/recordLoader.d.ts +4 -0
- package/dist/types/graphql/resolvers/basic.d.ts +1 -0
- package/dist/types/graphql/resolvers/connection.d.ts +31 -0
- package/dist/types/graphql/resolvers/index.d.ts +8 -0
- package/dist/types/graphql/resolvers/pagination.d.ts +29 -0
- package/dist/types/graphql/schema.d.ts +51 -0
- package/dist/types/graphql/scopeParser.d.ts +4 -0
- package/dist/types/graphql/snapshot.d.ts +26 -0
- package/dist/types/graphql/staleRecords/batchingStaleRecordsAdapter.d.ts +10 -0
- package/dist/types/graphql/syntheticFields.d.ts +10 -0
- package/dist/types/graphql/typeguards.d.ts +19 -0
- package/dist/types/instrumentation/instrumentPrimingSession.d.ts +1 -1
- package/dist/types/instrumentation/metrics.d.ts +1 -1
- package/dist/types/main.d.ts +1 -0
- package/dist/types/priming/ConflictPool.d.ts +31 -0
- package/dist/types/priming/Emitter.d.ts +16 -0
- package/dist/types/priming/LdsPrimingRecordRefresher.d.ts +1 -1
- package/dist/types/priming/LdsRecordRefresher.d.ts +17 -0
- package/dist/types/priming/NimbusPrimingNetworkAdapter.d.ts +4 -4
- package/dist/types/priming/ObjectInfoLoader.d.ts +10 -0
- package/dist/types/priming/PrimingNetworkAdapter.d.ts +5 -0
- package/dist/types/priming/PrimingNetworkError.d.ts +5 -0
- package/dist/types/priming/PrimingSession.d.ts +67 -0
- package/dist/types/priming/PrimingStore.d.ts +27 -0
- package/dist/types/priming/RecordIngestor.d.ts +14 -0
- package/dist/types/priming/SqlitePrimingStore.d.ts +1 -1
- package/dist/types/priming/index.d.ts +10 -0
- package/dist/types/priming/metadata/MetadataHandler.d.ts +49 -0
- package/dist/types/priming/primingSessionFactory.d.ts +1 -1
- package/dist/types/priming/recordLoaders/NetworkRecordLoader.d.ts +16 -0
- package/dist/types/priming/recordLoaders/RecordLoader.d.ts +19 -0
- package/dist/types/priming/recordLoaders/RecordLoaderGraphQL.d.ts +37 -0
- package/dist/types/priming/recordLoaders/RecordLoaderGraphQLBatch.d.ts +11 -0
- package/dist/types/priming/recordLoaders/RecordLoaderSOQLComposite.d.ts +14 -0
- package/dist/types/priming/recordLoaders/SoqlRecordConverter.d.ts +32 -0
- package/dist/types/priming/recordLoaders/api.d.ts +2 -0
- package/dist/types/priming/recordLoaders/index.d.ts +4 -0
- package/dist/types/priming/typedBatch.d.ts +3 -0
- package/dist/types/priming/utils/merge.d.ts +31 -0
- package/dist/types/runtime.d.ts +1 -1
- package/package.json +14 -16
- package/sfdc/main.js +6823 -7054
- package/sfdc/types/NimbusDraftQueue.d.ts +1 -1
- package/sfdc/types/{draftsAdapters → drafts}/AbstractResourceRequestActionHandler.d.ts +21 -22
- package/sfdc/types/drafts/UiApiDraftRecordService.d.ts +43 -0
- package/{dist/types/draftsAdapters/ContentDocumentCompositeRepresentation → sfdc/types/drafts/contentDocument}/ContentDocumentCompositeRepresentationActionHandler.d.ts +13 -13
- package/{dist/types/draftsAdapters/ContentDocumentCompositeRepresentation → sfdc/types/drafts/contentDocument}/draftAwareAdapters/createContentDocumentAndVersion/index.d.ts +2 -2
- package/sfdc/types/drafts/index.d.ts +14 -0
- package/sfdc/types/{draftsAdapters/QuickActionExecutionRepresentation → drafts/quickActions}/QuickActionExecutionRepresentationHandler.d.ts +8 -13
- package/sfdc/types/drafts/quickActions/UpdateRecordQuickActionExecutionRepresentationHandler.d.ts +29 -0
- package/sfdc/types/{draftsAdapters/QuickActionExecutionRepresentation → drafts/quickActions}/draftAwareAdapters/performQuickAction.d.ts +1 -1
- package/{dist/types/draftsAdapters/QuickActionExecutionRepresentation → sfdc/types/drafts/quickActions}/draftAwareAdapters/updateRecordPerformQuickAction.d.ts +1 -1
- package/sfdc/types/drafts/records/actionHandlers/RecordEffectingHandler.d.ts +6 -0
- package/sfdc/types/drafts/records/actionHandlers/UiApiRecordActionHandler.d.ts +63 -0
- package/{dist/types/draftsAdapters/RecordRepresentation → sfdc/types/drafts/records}/draftAwareAdapters/createRecord.d.ts +2 -2
- package/{dist/types/draftsAdapters/RecordRepresentation → sfdc/types/drafts/records}/draftAwareAdapters/updateRecord.d.ts +2 -2
- package/sfdc/types/{draftsAdapters/RecordRepresentation → drafts/records}/environment/getRecordDraftEnvironment.d.ts +2 -2
- package/sfdc/types/{draftsAdapters/RecordRepresentation → drafts/records}/environment/getRecordsDraftEnvironment.d.ts +2 -2
- package/{dist/types/draftsAdapters/RecordRepresentation → sfdc/types/drafts/records}/environment/makeEnvironmentUiApiRecordDraftAware.d.ts +4 -4
- package/{dist/types/draftsAdapters/RecordRepresentation → sfdc/types/drafts/records}/records.d.ts +1 -1
- package/sfdc/types/drafts/sideEffects/SideEffectHandler.d.ts +14 -0
- package/sfdc/types/{sideEffects → drafts/sideEffects}/SideEffectService.d.ts +6 -6
- package/sfdc/types/drafts/utils/durableStore.d.ts +3 -0
- package/sfdc/types/durableStore/DurableRecordStore.d.ts +17 -0
- package/sfdc/types/durableStore/NimbusSqliteStore/tables/index.d.ts +0 -1
- package/sfdc/types/graphql/adapter/draftAwareGraphQLAdapterFactory.d.ts +6 -0
- package/sfdc/types/graphql/adapter/environmentAwareGraphQLBatchAdapterFactory.d.ts +4 -0
- package/sfdc/types/graphql/adapter/graphqlEvalAdapterFactory.d.ts +5 -0
- package/sfdc/types/graphql/adapter/utils.d.ts +2 -0
- package/sfdc/types/graphql/adapterFactory.d.ts +3 -0
- package/sfdc/types/graphql/array.d.ts +2 -0
- package/sfdc/types/graphql/base64.d.ts +4 -0
- package/sfdc/types/graphql/constants.d.ts +3 -0
- package/sfdc/types/graphql/context.d.ts +19 -0
- package/sfdc/types/graphql/dataloader.d.ts +26 -0
- package/sfdc/types/graphql/dateLiteral.d.ts +28 -0
- package/sfdc/types/graphql/dateTimePredication.d.ts +33 -0
- package/sfdc/types/graphql/evaluate.d.ts +12 -0
- package/sfdc/types/graphql/events.d.ts +37 -0
- package/sfdc/types/graphql/filterParser.d.ts +6 -0
- package/sfdc/types/graphql/index.d.ts +9 -0
- package/sfdc/types/graphql/instrumentLimits.d.ts +8 -0
- package/sfdc/types/graphql/language.d.ts +33 -0
- package/sfdc/types/graphql/lib.d.ts +52 -0
- package/sfdc/types/graphql/limit.d.ts +9 -0
- package/sfdc/types/graphql/orderByParser.d.ts +10 -0
- package/sfdc/types/graphql/pagination.d.ts +10 -0
- package/sfdc/types/graphql/query.d.ts +56 -0
- package/sfdc/types/graphql/recordLoader.d.ts +4 -0
- package/sfdc/types/graphql/resolvers/basic.d.ts +1 -0
- package/sfdc/types/graphql/resolvers/connection.d.ts +31 -0
- package/sfdc/types/graphql/resolvers/index.d.ts +8 -0
- package/sfdc/types/graphql/resolvers/pagination.d.ts +29 -0
- package/sfdc/types/graphql/schema.d.ts +51 -0
- package/sfdc/types/graphql/scopeParser.d.ts +4 -0
- package/sfdc/types/graphql/snapshot.d.ts +26 -0
- package/sfdc/types/graphql/staleRecords/batchingStaleRecordsAdapter.d.ts +10 -0
- package/sfdc/types/graphql/syntheticFields.d.ts +10 -0
- package/sfdc/types/graphql/typeguards.d.ts +19 -0
- package/sfdc/types/instrumentation/instrumentPrimingSession.d.ts +1 -1
- package/sfdc/types/instrumentation/metrics.d.ts +1 -1
- package/sfdc/types/main.d.ts +1 -0
- package/sfdc/types/priming/ConflictPool.d.ts +31 -0
- package/sfdc/types/priming/Emitter.d.ts +16 -0
- package/sfdc/types/priming/LdsPrimingRecordRefresher.d.ts +1 -1
- package/sfdc/types/priming/LdsRecordRefresher.d.ts +17 -0
- package/sfdc/types/priming/NimbusPrimingNetworkAdapter.d.ts +4 -4
- package/sfdc/types/priming/ObjectInfoLoader.d.ts +10 -0
- package/sfdc/types/priming/PrimingNetworkAdapter.d.ts +5 -0
- package/sfdc/types/priming/PrimingNetworkError.d.ts +5 -0
- package/sfdc/types/priming/PrimingSession.d.ts +67 -0
- package/sfdc/types/priming/PrimingStore.d.ts +27 -0
- package/sfdc/types/priming/RecordIngestor.d.ts +14 -0
- package/sfdc/types/priming/SqlitePrimingStore.d.ts +1 -1
- package/sfdc/types/priming/index.d.ts +10 -0
- package/sfdc/types/priming/metadata/MetadataHandler.d.ts +49 -0
- package/sfdc/types/priming/primingSessionFactory.d.ts +1 -1
- package/sfdc/types/priming/recordLoaders/NetworkRecordLoader.d.ts +16 -0
- package/sfdc/types/priming/recordLoaders/RecordLoader.d.ts +19 -0
- package/sfdc/types/priming/recordLoaders/RecordLoaderGraphQL.d.ts +37 -0
- package/sfdc/types/priming/recordLoaders/RecordLoaderGraphQLBatch.d.ts +11 -0
- package/sfdc/types/priming/recordLoaders/RecordLoaderSOQLComposite.d.ts +14 -0
- package/sfdc/types/priming/recordLoaders/SoqlRecordConverter.d.ts +32 -0
- package/sfdc/types/priming/recordLoaders/api.d.ts +2 -0
- package/sfdc/types/priming/recordLoaders/index.d.ts +4 -0
- package/sfdc/types/priming/typedBatch.d.ts +3 -0
- package/sfdc/types/priming/utils/merge.d.ts +31 -0
- package/sfdc/types/runtime.d.ts +1 -1
- package/dist/types/draftsAdapters/QuickActionExecutionRepresentation/UpdateRecordQuickActionExecutionRepresentationHandler.d.ts +0 -38
- package/dist/types/draftsAdapters/RecordRepresentation/actionHandlers/RecordEffectingHandler.d.ts +0 -6
- package/dist/types/draftsAdapters/RecordRepresentation/actionHandlers/UiApiRecordActionHandler.d.ts +0 -84
- package/dist/types/draftsAdapters/RecordRepresentation/replayDraftsOnRecord.d.ts +0 -40
- package/dist/types/draftsAdapters/UiApiDraftRecordService.d.ts +0 -57
- package/dist/types/draftsAdapters/index.d.ts +0 -14
- package/dist/types/draftsAdapters/utils/durableStore.d.ts +0 -12
- package/dist/types/durableStore/NimbusSqliteStore/tables/LdsDraftIdMapDataTable.d.ts +0 -5
- package/sfdc/types/draftsAdapters/QuickActionExecutionRepresentation/UpdateRecordQuickActionExecutionRepresentationHandler.d.ts +0 -38
- package/sfdc/types/draftsAdapters/RecordRepresentation/actionHandlers/RecordEffectingHandler.d.ts +0 -6
- package/sfdc/types/draftsAdapters/RecordRepresentation/actionHandlers/UiApiRecordActionHandler.d.ts +0 -84
- package/sfdc/types/draftsAdapters/RecordRepresentation/replayDraftsOnRecord.d.ts +0 -40
- package/sfdc/types/draftsAdapters/UiApiDraftRecordService.d.ts +0 -57
- package/sfdc/types/draftsAdapters/index.d.ts +0 -14
- package/sfdc/types/draftsAdapters/utils/durableStore.d.ts +0 -12
- package/sfdc/types/durableStore/NimbusSqliteStore/tables/LdsDraftIdMapDataTable.d.ts +0 -5
- /package/dist/types/{draftsAdapters → drafts}/IdempotentWrite.d.ts +0 -0
- /package/dist/types/{draftsAdapters/ContentDocumentCompositeRepresentation → drafts/contentDocument}/draftAwareAdapters/createContentDocumentAndVersion/events.d.ts +0 -0
- /package/dist/types/{draftsAdapters/ContentDocumentCompositeRepresentation → drafts/contentDocument}/shared.d.ts +0 -0
- /package/dist/types/{draftsAdapters/RecordRepresentation → drafts/records}/DraftRecordRepresentation.d.ts +0 -0
- /package/dist/types/{draftsAdapters/RecordRepresentation → drafts/records}/draftAwareAdapters/deleteRecord.d.ts +0 -0
- /package/dist/types/{sideEffects → drafts/sideEffects}/SideEffectStore.d.ts +0 -0
- /package/dist/types/{sideEffects → drafts/sideEffects}/index.d.ts +0 -0
- /package/dist/types/{sideEffects → drafts/sideEffects}/sideEffectEnvironment.d.ts +0 -0
- /package/dist/types/{sideEffects → drafts/sideEffects}/sideEffects.d.ts +0 -0
- /package/dist/types/{draftsAdapters → drafts}/utils/adapter.d.ts +0 -0
- /package/dist/types/{draftsAdapters → drafts}/utils/clone.d.ts +0 -0
- /package/dist/types/{draftsAdapters → drafts}/utils/error.d.ts +0 -0
- /package/dist/types/{draftsAdapters → drafts}/utils/language.d.ts +0 -0
- /package/sfdc/types/{draftsAdapters → drafts}/IdempotentWrite.d.ts +0 -0
- /package/sfdc/types/{draftsAdapters/ContentDocumentCompositeRepresentation → drafts/contentDocument}/draftAwareAdapters/createContentDocumentAndVersion/events.d.ts +0 -0
- /package/sfdc/types/{draftsAdapters/ContentDocumentCompositeRepresentation → drafts/contentDocument}/shared.d.ts +0 -0
- /package/sfdc/types/{draftsAdapters/RecordRepresentation → drafts/records}/DraftRecordRepresentation.d.ts +0 -0
- /package/sfdc/types/{draftsAdapters/RecordRepresentation → drafts/records}/draftAwareAdapters/deleteRecord.d.ts +0 -0
- /package/sfdc/types/{sideEffects → drafts/sideEffects}/SideEffectStore.d.ts +0 -0
- /package/sfdc/types/{sideEffects → drafts/sideEffects}/index.d.ts +0 -0
- /package/sfdc/types/{sideEffects → drafts/sideEffects}/sideEffectEnvironment.d.ts +0 -0
- /package/sfdc/types/{sideEffects → drafts/sideEffects}/sideEffects.d.ts +0 -0
- /package/sfdc/types/{draftsAdapters → drafts}/utils/adapter.d.ts +0 -0
- /package/sfdc/types/{draftsAdapters → drafts}/utils/clone.d.ts +0 -0
- /package/sfdc/types/{draftsAdapters → drafts}/utils/error.d.ts +0 -0
- /package/sfdc/types/{draftsAdapters → drafts}/utils/language.d.ts +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* When the priming session cannot resolve a record due to an unsupported conflict (i.e. draft conflict or spanning record conflict) the record
|
|
3
|
+
* must be refreshed via a tradition LDS adapter.
|
|
4
|
+
*/
|
|
5
|
+
export interface LdsRecordRefresher {
|
|
6
|
+
/**
|
|
7
|
+
* Refreshes a set of records through an LDS adapter
|
|
8
|
+
* @param records a map of apiName to ids and fields being requested
|
|
9
|
+
*/
|
|
10
|
+
loadRecords(records: Map<string, {
|
|
11
|
+
ids: string[];
|
|
12
|
+
fields: string[];
|
|
13
|
+
}>): Promise<{
|
|
14
|
+
loaded: string[];
|
|
15
|
+
errored: string[];
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type PrimingNetworkAdapter } from '
|
|
2
|
-
import type {
|
|
1
|
+
import { type PrimingNetworkAdapter } from '../priming';
|
|
2
|
+
import type { ObjectInfoRepresentation, ObjectInfoDirectoryRepresentation } from '@salesforce/lds-adapters-uiapi';
|
|
3
3
|
import type { LdsAbortController } from '@salesforce/lds-utils-adapters';
|
|
4
|
+
import type { Request, Response } from '@salesforce/nimbus-plugin-lds';
|
|
4
5
|
export declare class NimbusPrimingNetworkAdapter implements PrimingNetworkAdapter {
|
|
5
6
|
private sendRequestWithAbort;
|
|
6
|
-
|
|
7
|
-
postGraphQL(query: string, variables: Record<string, any>, abortController: LdsAbortController): Promise<GraphQLRepresentation>;
|
|
7
|
+
sendRequest(request: Request, abortController: LdsAbortController): Promise<Response>;
|
|
8
8
|
getObjectInfoDirectory(abortController: LdsAbortController): Promise<ObjectInfoDirectoryRepresentation>;
|
|
9
9
|
getObjectInfos(apiName: string[], abortController: LdsAbortController): Promise<Map<string, ObjectInfoRepresentation>>;
|
|
10
10
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ObjectInfoRepresentation, ObjectInfoDirectoryRepresentation } from '@salesforce/lds-adapters-uiapi';
|
|
2
|
+
interface ObjectInfoStatus {
|
|
3
|
+
expiration: number;
|
|
4
|
+
}
|
|
5
|
+
export interface ObjectInfoLoader {
|
|
6
|
+
getObjectInfos(apiNames: string[]): Promise<Record<string, ObjectInfoRepresentation>>;
|
|
7
|
+
getObjectInfoDirectory(): Promise<ObjectInfoDirectoryRepresentation | undefined>;
|
|
8
|
+
getCachedObjectInfoStatus(): Promise<Map<string, ObjectInfoStatus>>;
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Request, Response } from '@salesforce/nimbus-plugin-lds';
|
|
2
|
+
import type { LdsAbortController } from '@salesforce/lds-utils-adapters';
|
|
3
|
+
export interface PrimingNetworkAdapter {
|
|
4
|
+
sendRequest(request: Request, abortController: LdsAbortController): Promise<Response>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { RecordIngestor } from './RecordIngestor';
|
|
2
|
+
import type { RecordLoader } from './recordLoaders';
|
|
3
|
+
import type { PrimingWork } from './types';
|
|
4
|
+
import type { ObjectInfoLoader } from './ObjectInfoLoader';
|
|
5
|
+
import type { PrimingStore } from './PrimingStore';
|
|
6
|
+
import type { LdsRecordRefresher } from './LdsRecordRefresher';
|
|
7
|
+
import { EventEmitter } from './Emitter';
|
|
8
|
+
export interface PrimingSessionConfig {
|
|
9
|
+
store: PrimingStore;
|
|
10
|
+
recordLoader: RecordLoader;
|
|
11
|
+
recordIngestor: RecordIngestor;
|
|
12
|
+
objectInfoLoader: ObjectInfoLoader;
|
|
13
|
+
ldsRecordRefresher: LdsRecordRefresher;
|
|
14
|
+
batchSize?: number;
|
|
15
|
+
concurrency?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface PrimingEvents {
|
|
18
|
+
error: EventErrorPayload;
|
|
19
|
+
primed: EventPrimedPayload;
|
|
20
|
+
conflict: ConflictEventPayload;
|
|
21
|
+
'metadata-fetched': {
|
|
22
|
+
availableTypes: string[];
|
|
23
|
+
unavailableTypes: string[];
|
|
24
|
+
duration: number;
|
|
25
|
+
};
|
|
26
|
+
'batch-starting': {
|
|
27
|
+
queuedTime: number;
|
|
28
|
+
};
|
|
29
|
+
'batch-fetched': {
|
|
30
|
+
ids: string[];
|
|
31
|
+
duration: number;
|
|
32
|
+
};
|
|
33
|
+
'batch-written': {
|
|
34
|
+
written: string[];
|
|
35
|
+
conflicted: string[];
|
|
36
|
+
errors: string[];
|
|
37
|
+
duration: number;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
interface EventErrorPayload {
|
|
41
|
+
ids: string[];
|
|
42
|
+
code: 'precondition-error' | 'service-protection-error' | 'not-found' | 'service-unavailable' | 'unknown' | 'canceled';
|
|
43
|
+
message: string;
|
|
44
|
+
}
|
|
45
|
+
interface ConflictEventPayload {
|
|
46
|
+
ids: string[];
|
|
47
|
+
resolution: 'priming-merge' | 'priming-refresh' | 'lds-refresh';
|
|
48
|
+
}
|
|
49
|
+
type EventPrimedPayload = Array<string>;
|
|
50
|
+
export declare class PrimingSession extends EventEmitter<PrimingEvents> {
|
|
51
|
+
private batchSize;
|
|
52
|
+
private concurrency;
|
|
53
|
+
private recordLoader;
|
|
54
|
+
private recordIngestor;
|
|
55
|
+
private objectInfoLoader;
|
|
56
|
+
private networkWorkerPool;
|
|
57
|
+
private conflictPool;
|
|
58
|
+
private ldsRecordRefresher;
|
|
59
|
+
constructor(config: PrimingSessionConfig);
|
|
60
|
+
enqueue(work: PrimingWork): Promise<void>;
|
|
61
|
+
cancel(): void;
|
|
62
|
+
private enqueueBatches;
|
|
63
|
+
private processFetchedRecords;
|
|
64
|
+
private handleWriteConflicts;
|
|
65
|
+
private fetchMetadata;
|
|
66
|
+
}
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DurableRecordRepresentation } from '@salesforce/lds-durable-records';
|
|
2
|
+
import type { StoreMetadata } from '@luvio/engine';
|
|
3
|
+
export interface RecordWithMetadata {
|
|
4
|
+
record: DurableRecordRepresentation;
|
|
5
|
+
metadata: StoreMetadata;
|
|
6
|
+
}
|
|
7
|
+
export interface WriteResult {
|
|
8
|
+
written: string[];
|
|
9
|
+
conflicted: string[];
|
|
10
|
+
errors: {
|
|
11
|
+
ids: string[];
|
|
12
|
+
message: string;
|
|
13
|
+
}[];
|
|
14
|
+
}
|
|
15
|
+
export interface PrimingStore {
|
|
16
|
+
/**
|
|
17
|
+
* Writes records to the store
|
|
18
|
+
* @param records list of records to insert
|
|
19
|
+
* @returns list of ids that were written and list of ids that were not written due to already being present in the store
|
|
20
|
+
*/
|
|
21
|
+
writeRecords(records: RecordWithMetadata[], overwrite: boolean): Promise<WriteResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Reads records from the store
|
|
24
|
+
* @param ids
|
|
25
|
+
*/
|
|
26
|
+
readRecords(ids: string[]): Promise<RecordWithMetadata[]>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Luvio } from '@luvio/engine';
|
|
2
|
+
import type { DurableRecordRepresentation } from '@salesforce/lds-durable-records';
|
|
3
|
+
import type { PrimingStore, WriteResult } from './PrimingStore';
|
|
4
|
+
export declare class RecordIngestor {
|
|
5
|
+
private store;
|
|
6
|
+
private getLuvio;
|
|
7
|
+
constructor(store: PrimingStore, getLuvio: () => Luvio);
|
|
8
|
+
/**
|
|
9
|
+
* Inserts records into the store
|
|
10
|
+
* @param syntheticRecords list of records to insert
|
|
11
|
+
* @returns list of ids that were written and list of ids that were not written due to already being present in the store
|
|
12
|
+
*/
|
|
13
|
+
insertRecords(syntheticRecords: DurableRecordRepresentation[], overwrite?: boolean): Promise<WriteResult>;
|
|
14
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PrimingStore, RecordWithMetadata, WriteResult } from '
|
|
1
|
+
import type { PrimingStore, RecordWithMetadata, WriteResult } from '../priming';
|
|
2
2
|
import type { Luvio } from '@luvio/engine';
|
|
3
3
|
import type { NimbusSqliteStore } from '@salesforce/lds-store-nimbus';
|
|
4
4
|
export declare class SqlitePrimingStore implements PrimingStore {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { PrimingSession } from './PrimingSession';
|
|
2
|
+
export { RecordIngestor } from './RecordIngestor';
|
|
3
|
+
export { PrimingStore, RecordWithMetadata, WriteResult } from './PrimingStore';
|
|
4
|
+
export { MetadataHandler } from './metadata/MetadataHandler';
|
|
5
|
+
export { PrimingNetworkError } from './PrimingNetworkError';
|
|
6
|
+
export { RecordLoaderGraphQL, RecordLoaderGraphQLBatch, RecordLoaderSOQLComposite, } from './recordLoaders';
|
|
7
|
+
export type { RecordLoader } from './recordLoaders';
|
|
8
|
+
export type { LdsRecordRefresher } from './LdsRecordRefresher';
|
|
9
|
+
export type { PrimingEvents } from './PrimingSession';
|
|
10
|
+
export type { PrimingNetworkAdapter } from './PrimingNetworkAdapter';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { EventEmitter } from '../Emitter';
|
|
2
|
+
import type { ObjectInfoLoader } from '../ObjectInfoLoader';
|
|
3
|
+
export interface MetadataEvents {
|
|
4
|
+
progress: number;
|
|
5
|
+
error: MetadataError;
|
|
6
|
+
starting: {
|
|
7
|
+
cached: Set<string>;
|
|
8
|
+
expired: Set<string>;
|
|
9
|
+
missing: Set<string>;
|
|
10
|
+
};
|
|
11
|
+
primed: {
|
|
12
|
+
apiNames: Set<string>;
|
|
13
|
+
};
|
|
14
|
+
complete: {
|
|
15
|
+
apiNames: Map<string, CacheStatus>;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
interface ErrorCouldNotFetchDirectory {
|
|
19
|
+
type: 'directory-error';
|
|
20
|
+
}
|
|
21
|
+
interface ErrorCouldNotFetchObjectInfos {
|
|
22
|
+
type: 'object-info-error';
|
|
23
|
+
apiNames: Set<string>;
|
|
24
|
+
}
|
|
25
|
+
interface ErrorAlreadyStarted {
|
|
26
|
+
type: 'already-started';
|
|
27
|
+
}
|
|
28
|
+
type MetadataError = ErrorCouldNotFetchDirectory | ErrorCouldNotFetchObjectInfos | ErrorAlreadyStarted;
|
|
29
|
+
type CacheStatus = 'not-cached' | 'cached' | 'expired' | 'fetching' | 'error';
|
|
30
|
+
export declare class MetadataHandler extends EventEmitter<MetadataEvents> {
|
|
31
|
+
private objectInfoLoader;
|
|
32
|
+
private config;
|
|
33
|
+
private apiNames;
|
|
34
|
+
private progress;
|
|
35
|
+
private started;
|
|
36
|
+
private workPool;
|
|
37
|
+
private batchSize;
|
|
38
|
+
private concurrency;
|
|
39
|
+
constructor(objectInfoLoader: ObjectInfoLoader, config: {
|
|
40
|
+
batchSize?: number;
|
|
41
|
+
concurrency?: number;
|
|
42
|
+
});
|
|
43
|
+
start(): Promise<void>;
|
|
44
|
+
cancel(): void;
|
|
45
|
+
private getBatches;
|
|
46
|
+
private executeBatchedWork;
|
|
47
|
+
private updateProgress;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PrimingSession } from '
|
|
1
|
+
import { PrimingSession } from '../priming';
|
|
2
2
|
import type { Adapter, Luvio } from '@luvio/engine';
|
|
3
3
|
import type { NimbusSqliteStore } from '@salesforce/lds-store-nimbus';
|
|
4
4
|
import type { ObjectInfoService } from '../main';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { LdsAbortController } from '@salesforce/lds-utils-adapters';
|
|
2
|
+
import type { Request } from '@salesforce/nimbus-plugin-lds';
|
|
3
|
+
import type { AvailableTypedBatch } from '../types';
|
|
4
|
+
import type { RecordFetchResult, RecordLoader } from './RecordLoader';
|
|
5
|
+
import type { PrimingNetworkAdapter } from '../PrimingNetworkAdapter';
|
|
6
|
+
export declare abstract class NetworkRecordLoader implements RecordLoader {
|
|
7
|
+
private readonly networkAdapter;
|
|
8
|
+
constructor(networkAdapter: PrimingNetworkAdapter);
|
|
9
|
+
fetchRecordData(batch: AvailableTypedBatch, abortController: LdsAbortController): Promise<RecordFetchResult[]>;
|
|
10
|
+
private sendRequest;
|
|
11
|
+
protected abstract makeRequest<T>(batch: AvailableTypedBatch): {
|
|
12
|
+
request: Request;
|
|
13
|
+
context: T;
|
|
14
|
+
};
|
|
15
|
+
protected abstract generateFetchResults<T>(body: any, batchInput: AvailableTypedBatch, context: T): RecordFetchResult[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DurableRecordRepresentation } from '@salesforce/lds-durable-records';
|
|
2
|
+
import type { AvailableTypedBatch } from '../types';
|
|
3
|
+
import type { LdsAbortController } from '@salesforce/lds-utils-adapters';
|
|
4
|
+
interface RecordFetchResultSuccess {
|
|
5
|
+
ok: true;
|
|
6
|
+
records: DurableRecordRepresentation[];
|
|
7
|
+
missingIds: string[];
|
|
8
|
+
}
|
|
9
|
+
interface RecordFetchResultFailure {
|
|
10
|
+
ok: false;
|
|
11
|
+
error: 'network-error' | 'service-protection-error' | 'request-error' | 'unknown';
|
|
12
|
+
messages: string[];
|
|
13
|
+
missingIds: string[];
|
|
14
|
+
}
|
|
15
|
+
export type RecordFetchResult = RecordFetchResultSuccess | RecordFetchResultFailure;
|
|
16
|
+
export interface RecordLoader {
|
|
17
|
+
fetchRecordData(batch: AvailableTypedBatch, abortController: LdsAbortController): Promise<RecordFetchResult[]>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ObjectInfoRepresentation } from '@salesforce/lds-adapters-uiapi';
|
|
2
|
+
import type { DurableRecordRepresentation } from '@salesforce/lds-durable-records';
|
|
3
|
+
import type { Request } from '@salesforce/nimbus-plugin-lds';
|
|
4
|
+
import type { RecordFetchResult } from './RecordLoader';
|
|
5
|
+
import type { AvailableTypedBatch, TypedBatch } from '../types';
|
|
6
|
+
import { NetworkRecordLoader } from './NetworkRecordLoader';
|
|
7
|
+
type GraphQLNode = {
|
|
8
|
+
Id: string;
|
|
9
|
+
ApiName: string;
|
|
10
|
+
DisplayValue: {
|
|
11
|
+
value: string | null;
|
|
12
|
+
};
|
|
13
|
+
LastModifiedById: {
|
|
14
|
+
value: string | null;
|
|
15
|
+
};
|
|
16
|
+
LastModifiedDate: {
|
|
17
|
+
value: string | null;
|
|
18
|
+
};
|
|
19
|
+
RecordTypeId: {
|
|
20
|
+
value: string | null;
|
|
21
|
+
};
|
|
22
|
+
SystemModstamp: {
|
|
23
|
+
value: string | null;
|
|
24
|
+
};
|
|
25
|
+
WeakEtag: number;
|
|
26
|
+
[field: string]: any;
|
|
27
|
+
};
|
|
28
|
+
export declare class RecordLoaderGraphQL extends NetworkRecordLoader {
|
|
29
|
+
protected makeRequest(batch: TypedBatch): {
|
|
30
|
+
request: Request;
|
|
31
|
+
context: any;
|
|
32
|
+
};
|
|
33
|
+
protected generateFetchResults(repResult: any, batchInput: AvailableTypedBatch, _context: any): RecordFetchResult[];
|
|
34
|
+
protected generateGraphQLQuery(type: string, fields: string[]): string;
|
|
35
|
+
protected generateDurableRecordRepresentation(node: GraphQLNode, objectInfo: ObjectInfoRepresentation): DurableRecordRepresentation;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Request } from '@salesforce/nimbus-plugin-lds';
|
|
2
|
+
import type { AvailableTypedBatch, TypedBatch } from '../types';
|
|
3
|
+
import type { RecordFetchResult } from './RecordLoader';
|
|
4
|
+
import { RecordLoaderGraphQL } from './RecordLoaderGraphQL';
|
|
5
|
+
export declare class RecordLoaderGraphQLBatch extends RecordLoaderGraphQL {
|
|
6
|
+
makeRequest(batch: TypedBatch): {
|
|
7
|
+
request: Request;
|
|
8
|
+
context: string[][];
|
|
9
|
+
};
|
|
10
|
+
protected generateFetchResults(body: any, batchInput: AvailableTypedBatch, context: string[][]): RecordFetchResult[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Request } from '@salesforce/nimbus-plugin-lds';
|
|
2
|
+
import type { RecordFetchResult } from './RecordLoader';
|
|
3
|
+
import type { AvailableTypedBatch } from '../types';
|
|
4
|
+
import { NetworkRecordLoader } from './NetworkRecordLoader';
|
|
5
|
+
export declare class RecordLoaderSOQLComposite extends NetworkRecordLoader {
|
|
6
|
+
makeRequest(batch: AvailableTypedBatch): {
|
|
7
|
+
request: Request;
|
|
8
|
+
context: any;
|
|
9
|
+
};
|
|
10
|
+
protected generateFetchResults(batchResult: any, batchInput: AvailableTypedBatch, rawContext: any): RecordFetchResult[];
|
|
11
|
+
generateSelect(batch: AvailableTypedBatch): string;
|
|
12
|
+
generateWhere(ids: string[]): string;
|
|
13
|
+
private generateFetchResultForSoql;
|
|
14
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ObjectInfoRepresentation } from '@salesforce/lds-adapters-uiapi';
|
|
2
|
+
import type { DurableRecordRepresentation } from '@salesforce/lds-durable-records';
|
|
3
|
+
export interface RecordTypeInfo {
|
|
4
|
+
available: boolean;
|
|
5
|
+
defaultRecordTypeMapping: boolean;
|
|
6
|
+
master: boolean;
|
|
7
|
+
name: string;
|
|
8
|
+
recordTypeId: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class SoqlRecordConverter {
|
|
11
|
+
objectType: string;
|
|
12
|
+
records: Record<string, any>[];
|
|
13
|
+
recordTypeInfos: Map<string, RecordTypeInfo>;
|
|
14
|
+
fieldTypeMapping: Map<string, string>;
|
|
15
|
+
masterRecordTypeInfo: RecordTypeInfo | null;
|
|
16
|
+
filteredFields: Array<string>;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* Use the objectInfo to build a map of record types (and find the master/default type),
|
|
20
|
+
* as well as get a list of all fields and data types.
|
|
21
|
+
*
|
|
22
|
+
* @param objectInfo ObjectInfo information from server.
|
|
23
|
+
* @param records The records to process from soql endpoint.
|
|
24
|
+
* @returns instance of SoqlRecordConverter.
|
|
25
|
+
*/
|
|
26
|
+
static get(objectInfo: ObjectInfoRepresentation, records: Record<string, any>[]): SoqlRecordConverter;
|
|
27
|
+
constructor(objectType: string, records: Record<string, any>[], recordTypeInfos: Map<string, RecordTypeInfo>, fieldTypeMapping: Map<string, string>, masterRecordTypeInfo: RecordTypeInfo | null);
|
|
28
|
+
convert(): DurableRecordRepresentation[];
|
|
29
|
+
private convertRecord;
|
|
30
|
+
private weakEtag;
|
|
31
|
+
private formatFieldValueIfNeeded;
|
|
32
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { RecordLoader, RecordFetchResult } from './RecordLoader';
|
|
2
|
+
export { RecordLoaderGraphQL } from './RecordLoaderGraphQL';
|
|
3
|
+
export { RecordLoaderGraphQLBatch } from './RecordLoaderGraphQLBatch';
|
|
4
|
+
export { RecordLoaderSOQLComposite } from './RecordLoaderSOQLComposite';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { DurableRecordRepresentation } from '@salesforce/lds-durable-records';
|
|
2
|
+
import type { ObjectInfoRepresentation } from '@salesforce/lds-adapters-uiapi';
|
|
3
|
+
type MergeCode = 'success' | 'conflict-missing-fields' | 'conflict-drafts' | 'conflict-spanning-record';
|
|
4
|
+
export interface MergeResultSuccess {
|
|
5
|
+
ok: true;
|
|
6
|
+
code: MergeCode;
|
|
7
|
+
needsWrite: boolean;
|
|
8
|
+
record: DurableRecordRepresentation;
|
|
9
|
+
}
|
|
10
|
+
export interface MergeResultConflict {
|
|
11
|
+
ok: false;
|
|
12
|
+
code: MergeCode;
|
|
13
|
+
hasDraft: boolean;
|
|
14
|
+
fieldUnion: string[];
|
|
15
|
+
}
|
|
16
|
+
type MergeResult = MergeResultSuccess | MergeResultConflict;
|
|
17
|
+
/**
|
|
18
|
+
* Merges (if possible) an incoming record from a priming session with an existing record in the durable store.
|
|
19
|
+
*
|
|
20
|
+
* IMPORTANT NOTE: this is not a suitable function to use for general merging of two DurableRecordRepresentation since it
|
|
21
|
+
* makes the assumption that the incoming record ONLY contains scalar field values and no spanning records. The same is not
|
|
22
|
+
* necessarily true for the existing record as it may have been populated in the cache outside of a priming session.
|
|
23
|
+
* This function should not be moved out of the priming module!
|
|
24
|
+
*
|
|
25
|
+
* @param existingRecord Existing record in the durable store
|
|
26
|
+
* @param incomingRecord Incoming record from the priming session
|
|
27
|
+
* @param objectInfo Object info for the incoming record type
|
|
28
|
+
* @returns Merge result describing the success or failure of the merge operation
|
|
29
|
+
*/
|
|
30
|
+
export declare function mergeRecord(existingRecord: DurableRecordRepresentation, incomingRecord: DurableRecordRepresentation, objectInfo: ObjectInfoRepresentation): MergeResult;
|
|
31
|
+
export {};
|
package/sfdc/types/runtime.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Luvio, Environment } from '@luvio/engine';
|
|
|
2
2
|
import { DraftManager } from '@salesforce/lds-drafts';
|
|
3
3
|
import type { DraftQueue } from '@salesforce/lds-drafts';
|
|
4
4
|
import type { NimbusSqliteStore } from '@salesforce/lds-store-nimbus';
|
|
5
|
-
import type { PrimingSession } from '
|
|
5
|
+
import type { PrimingSession } from './priming';
|
|
6
6
|
export interface Runtime {
|
|
7
7
|
luvio: Luvio;
|
|
8
8
|
internalLuvio: Luvio;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { ActionHandler, CompletedDraftAction, DraftAction, DraftQueue, PendingDraftAction, QueueOperation } from '@salesforce/lds-drafts';
|
|
2
|
-
import { AbstractResourceRequestActionHandler } from '../AbstractResourceRequestActionHandler';
|
|
3
|
-
import type { DurableStoreKeyMetadataMap, Luvio, NetworkAdapter, ResourceRequest } from '@luvio/engine';
|
|
4
|
-
import type { PerformActionInputRepresentation, QuickActionExecutionRepresentation } from '../../adapters/main';
|
|
5
|
-
import type { UiApiDraftRecordService } from '../UiApiDraftRecordService';
|
|
6
|
-
import type { RecordEffectingHandler } from '../RecordRepresentation/actionHandlers/RecordEffectingHandler';
|
|
7
|
-
import type { DraftRecordOperation, RecordDraftMetadata } from '../RecordRepresentation/replayDraftsOnRecord';
|
|
8
|
-
import { type DurableStore } from '@luvio/environments';
|
|
9
|
-
import type { DurableRecordRepresentation } from '@salesforce/lds-durable-records';
|
|
10
|
-
export declare const UPDATE_RECORD_QUICK_ACTION_HANDLER = "UPDATE_RECORD_QUICK_ACTION_HANDLER";
|
|
11
|
-
interface PerformUpdateRecordQuickActionResourceRequest extends Omit<ResourceRequest, 'body' | 'method'> {
|
|
12
|
-
body: PerformActionInputRepresentation;
|
|
13
|
-
method: 'patch';
|
|
14
|
-
}
|
|
15
|
-
export declare class UpdateRecordQuickActionExecutionRepresentationHandler extends AbstractResourceRequestActionHandler<QuickActionExecutionRepresentation, {}> implements RecordEffectingHandler {
|
|
16
|
-
private readonly draftRecordService;
|
|
17
|
-
private readonly durableStore;
|
|
18
|
-
readonly isDraftId: (targetId: string) => boolean;
|
|
19
|
-
handlerId: string;
|
|
20
|
-
getDenormedRecord: (key: string) => Promise<DurableRecordRepresentation | undefined>;
|
|
21
|
-
constructor(getLuvio: () => Luvio, draftRecordService: UiApiDraftRecordService, draftQueue: DraftQueue, networkAdapter: NetworkAdapter, durableStore: DurableStore, isDraftId: (targetId: string) => boolean);
|
|
22
|
-
draftActionToDraftOperation(queueEntry: DraftAction<PerformUpdateRecordQuickActionResourceRequest, QuickActionExecutionRepresentation>): DraftRecordOperation[] | undefined;
|
|
23
|
-
handleActionEnqueued(action: PendingDraftAction<PerformUpdateRecordQuickActionResourceRequest>): Promise<void>;
|
|
24
|
-
canHandlePublish(_key: string): boolean;
|
|
25
|
-
canRepresentationContainDraftMetadata(_representationName: string): boolean;
|
|
26
|
-
getIdFromRequest(request: ResourceRequest): Promise<string>;
|
|
27
|
-
getIdFromResponseBody(responseBody: QuickActionExecutionRepresentation): string;
|
|
28
|
-
buildTagForTargetId(id: string): string;
|
|
29
|
-
getDataForAction(action: DraftAction<ResourceRequest, QuickActionExecutionRepresentation>): Promise<QuickActionExecutionRepresentation | undefined>;
|
|
30
|
-
getDraftMetadata(key: string): Promise<RecordDraftMetadata | undefined>;
|
|
31
|
-
applyDraftsToIncomingData(key: string, data: unknown, _draftMetadata: {} | undefined, publishFn: (key: string, data: any) => void): void;
|
|
32
|
-
handleActionRemoved(action: DraftAction<ResourceRequest, QuickActionExecutionRepresentation>): Promise<void>;
|
|
33
|
-
handleActionCompleted(action: CompletedDraftAction<ResourceRequest, QuickActionExecutionRepresentation>, _queueOperations: QueueOperation[], _allHandlers: ActionHandler<unknown, unknown, unknown>[]): Promise<void>;
|
|
34
|
-
buildCacheKeysFromResponse(_response: QuickActionExecutionRepresentation): DurableStoreKeyMetadataMap;
|
|
35
|
-
synchronousIngest(response: QuickActionExecutionRepresentation): void;
|
|
36
|
-
mergeRequestBody<T>(): T;
|
|
37
|
-
}
|
|
38
|
-
export {};
|
package/dist/types/draftsAdapters/RecordRepresentation/actionHandlers/RecordEffectingHandler.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { DraftAction } from '@salesforce/lds-drafts';
|
|
2
|
-
import type { DraftRecordOperation } from '../replayDraftsOnRecord';
|
|
3
|
-
export interface RecordEffectingHandler {
|
|
4
|
-
draftActionToDraftOperation(queueEntry: DraftAction<unknown, unknown>): DraftRecordOperation[] | undefined;
|
|
5
|
-
handlerId: string;
|
|
6
|
-
}
|
package/dist/types/draftsAdapters/RecordRepresentation/actionHandlers/UiApiRecordActionHandler.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { Adapter, DurableStoreKeyMetadataMap, Luvio, NetworkAdapter, ResourceRequest } from '@luvio/engine';
|
|
2
|
-
import type { GetRecordConfig, ObjectInfoRepresentation, RecordRepresentation, RecordRepresentationNormalized, RecordInputRepresentation } from '../../../adapters/main';
|
|
3
|
-
import type { ActionHandler, CompletedDraftAction, DraftAction, DraftActionMetadata, DraftIdAndKeyMapping, DraftQueue, PendingDraftAction, QueueOperation } from '@salesforce/lds-drafts';
|
|
4
|
-
import type { FieldRepresentation, ObjectInfoService } from '../../utils/types';
|
|
5
|
-
import { AbstractResourceRequestActionHandler } from '../../AbstractResourceRequestActionHandler';
|
|
6
|
-
import type { DraftRecordOperation, RecordDraftMetadata } from '../replayDraftsOnRecord';
|
|
7
|
-
import type { UiApiDraftRecordService, ReferenceIdFieldInfo } from '../../UiApiDraftRecordService';
|
|
8
|
-
import type { RecordEffectingHandler } from './RecordEffectingHandler';
|
|
9
|
-
import type { DurableStore } from '@luvio/environments';
|
|
10
|
-
export declare const LDS_ACTION_HANDLER_ID = "LDS_ACTION_HANDLER";
|
|
11
|
-
export declare const LDS_ACTION_METADATA_API_NAME = "LDS_ACTION_METADATA_API_NAME";
|
|
12
|
-
export type FormatDisplayValue = (value: boolean | number | string | null, datatype: string) => null | string;
|
|
13
|
-
interface RecordEndpointResourceRequest extends Omit<ResourceRequest, 'body' | 'method'> {
|
|
14
|
-
body: RecordInputRepresentation;
|
|
15
|
-
method: 'post' | 'patch' | 'delete';
|
|
16
|
-
}
|
|
17
|
-
export type RecordResourceRequest = RecordEndpointResourceRequest;
|
|
18
|
-
export declare class UiApiActionHandler extends AbstractResourceRequestActionHandler<RecordRepresentation, RecordDraftMetadata> implements RecordEffectingHandler {
|
|
19
|
-
protected readonly getLuvio: () => Luvio;
|
|
20
|
-
protected readonly networkAdapter: NetworkAdapter;
|
|
21
|
-
private readonly durableStore;
|
|
22
|
-
protected readonly draftQueue: DraftQueue;
|
|
23
|
-
private readonly getRecordAdapter;
|
|
24
|
-
private readonly objectInfoService;
|
|
25
|
-
readonly isDraftId: (targetId: string) => boolean;
|
|
26
|
-
private readonly recordService;
|
|
27
|
-
handlerId: string;
|
|
28
|
-
constructor(getLuvio: () => Luvio, networkAdapter: NetworkAdapter, durableStore: DurableStore, draftQueue: DraftQueue, getRecordAdapter: Adapter<GetRecordConfig, RecordRepresentation>, objectInfoService: ObjectInfoService, isDraftId: (targetId: string) => boolean, recordService: UiApiDraftRecordService);
|
|
29
|
-
buildPendingAction(request: RecordResourceRequest, queue: DraftAction<unknown, unknown>[]): Promise<PendingDraftAction<ResourceRequest>>;
|
|
30
|
-
getBackdatingFields(objectInfo: ObjectInfoRepresentation, requestMethod: string, pendingAction: PendingDraftAction<RecordResourceRequest>): {
|
|
31
|
-
[key: string]: string;
|
|
32
|
-
};
|
|
33
|
-
getRedirectMappings(action: CompletedDraftAction<ResourceRequest, RecordRepresentation>): DraftIdAndKeyMapping[] | undefined;
|
|
34
|
-
handleActionCompleted(completedAction: CompletedDraftAction<ResourceRequest, RecordRepresentation>, queueOperations: QueueOperation[], allHandlers: ActionHandler<unknown, unknown, unknown>[]): Promise<void>;
|
|
35
|
-
handleActionEnqueued(action: PendingDraftAction<ResourceRequest>): Promise<void>;
|
|
36
|
-
fetchReferenceRecord(referenceFields: ReferenceIdFieldInfo[]): Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
* identify the API Name from the record ID and its field representation. For example, ApiName for `001x0000004cKfzAAE` is `Account` if its field info reference to `Account`
|
|
39
|
-
* representation
|
|
40
|
-
* @param id
|
|
41
|
-
* @param fieldInfo
|
|
42
|
-
* @returns apiName
|
|
43
|
-
*/
|
|
44
|
-
identifyApiName(id: string, fieldInfo: FieldRepresentation): Promise<string | undefined>;
|
|
45
|
-
canRepresentationContainDraftMetadata(representationName: string): boolean;
|
|
46
|
-
canHandlePublish(key: string): boolean;
|
|
47
|
-
buildTagForTargetId(id: string): string;
|
|
48
|
-
getIdFromRequest(request: RecordResourceRequest): Promise<string>;
|
|
49
|
-
getIdFromResponseBody(responseBody: RecordRepresentation): string;
|
|
50
|
-
draftActionToDraftOperation(action: DraftAction<RecordResourceRequest, RecordRepresentation>): DraftRecordOperation[];
|
|
51
|
-
getDraftMetadata(key: string): Promise<RecordDraftMetadata | undefined>;
|
|
52
|
-
isActionRecordAction(action: DraftAction<unknown, unknown>): action is DraftAction<RecordResourceRequest, RecordRepresentation>;
|
|
53
|
-
/**
|
|
54
|
-
* Gets the record associated with the passed in action
|
|
55
|
-
*
|
|
56
|
-
* @param action The draft action related to this record
|
|
57
|
-
* @param _queue The draft queue
|
|
58
|
-
* @returns The record with the updated draft queue applied. References are not included and must be applied at ingest.
|
|
59
|
-
*
|
|
60
|
-
* or
|
|
61
|
-
*
|
|
62
|
-
* undefined if the record no
|
|
63
|
-
* longer exists (i.e. the post action for a draft-created record was deleted)
|
|
64
|
-
*
|
|
65
|
-
* @throws if there are actions on an existing record but that record doesn't live in the durable store
|
|
66
|
-
*/
|
|
67
|
-
getDataForAction(action: DraftAction<ResourceRequest, RecordRepresentation>): Promise<RecordRepresentation | undefined>;
|
|
68
|
-
applyDraftsToIncomingData(key: string, data: RecordRepresentationNormalized, draftMetadata: RecordDraftMetadata | undefined, publishData: (key: string, data: RecordRepresentationNormalized) => void): void;
|
|
69
|
-
updateMetadata(existingMetadata: DraftActionMetadata, incomingMetadata: DraftActionMetadata): DraftActionMetadata;
|
|
70
|
-
private getApiNameForRecordId;
|
|
71
|
-
/**
|
|
72
|
-
* Inspects the resource request to ensure this handler can handle it
|
|
73
|
-
* Inspects the resource request for draft id references. Replaces the draft ids
|
|
74
|
-
* with their canonical ids if they exist otherwise returns the request as is
|
|
75
|
-
* @param request The original resource request
|
|
76
|
-
* @returns the request with draft ids replaced or undefined if this handler is not capable of handling it
|
|
77
|
-
*/
|
|
78
|
-
private resolveResourceRequest;
|
|
79
|
-
buildCacheKeysFromResponse(response: RecordRepresentation): DurableStoreKeyMetadataMap;
|
|
80
|
-
synchronousIngest(response: RecordRepresentation): void;
|
|
81
|
-
mergeRequestBody<T>(targetBody: T, sourceBody: T): T;
|
|
82
|
-
}
|
|
83
|
-
export declare function isLDSDraftAction<Response>(action: DraftAction<unknown, unknown>): action is DraftAction<ResourceRequest, Response>;
|
|
84
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { Luvio } from '@luvio/engine';
|
|
2
|
-
import { type ObjectInfoRepresentation } from '@salesforce/lds-adapters-uiapi';
|
|
3
|
-
import type { FormatDisplayValue } from './actionHandlers/UiApiRecordActionHandler';
|
|
4
|
-
import { type DraftRecordRepresentation } from './DraftRecordRepresentation';
|
|
5
|
-
interface BaseDraftRecordOperation {
|
|
6
|
-
apiName: string;
|
|
7
|
-
id: string;
|
|
8
|
-
draftActionId: string;
|
|
9
|
-
timestamp: number;
|
|
10
|
-
}
|
|
11
|
-
export interface CreateDraftRecordOperation extends BaseDraftRecordOperation {
|
|
12
|
-
type: 'create';
|
|
13
|
-
fields: Record<string, any>;
|
|
14
|
-
}
|
|
15
|
-
export interface UpdateDraftRecordOperation extends BaseDraftRecordOperation {
|
|
16
|
-
type: 'update';
|
|
17
|
-
fields: Record<string, any>;
|
|
18
|
-
}
|
|
19
|
-
export interface DeleteDraftRecordOperation extends BaseDraftRecordOperation {
|
|
20
|
-
type: 'delete';
|
|
21
|
-
}
|
|
22
|
-
export type DraftRecordOperation = CreateDraftRecordOperation | UpdateDraftRecordOperation | DeleteDraftRecordOperation;
|
|
23
|
-
export interface RecordDraftMetadata {
|
|
24
|
-
luvio: Luvio;
|
|
25
|
-
recordOperations: DraftRecordOperation[];
|
|
26
|
-
objectInfos: Map<string, ObjectInfoRepresentation>;
|
|
27
|
-
referencedRecords: Map<string, DraftRecordRepresentation>;
|
|
28
|
-
userId: string;
|
|
29
|
-
formatDisplayValue: FormatDisplayValue;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Replays an ordered draft list on top of a record. If undefined is passed in, the first draft must
|
|
33
|
-
* be a POST action
|
|
34
|
-
* @param record The base record to apply drafts to
|
|
35
|
-
* @param drafts The list of drafts to apply to the record
|
|
36
|
-
* @param userId The current user id, will be the last modified id
|
|
37
|
-
*/
|
|
38
|
-
export declare function replayDraftsOnRecord(record: DraftRecordRepresentation | undefined, draftMetadata: RecordDraftMetadata | undefined): DraftRecordRepresentation | undefined;
|
|
39
|
-
export declare function applyReferenceLinksToDraft(record: DraftRecordRepresentation, draftMetadata: RecordDraftMetadata): DraftRecordRepresentation;
|
|
40
|
-
export {};
|