@salesforce/lds-worker-api 0.1.0-dev1
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/LICENSE.txt +82 -0
- package/README.md +9 -0
- package/dist/sfdc/es/ldsWorkerApi.js +1374 -0
- package/dist/sfdc/es/types/cachePurging.d.ts +50 -0
- package/dist/sfdc/es/types/customLuvioAdapter.d.ts +13 -0
- package/dist/sfdc/es/types/customOneStoreAdapter.d.ts +21 -0
- package/dist/sfdc/es/types/draftQueueImplementation.d.ts +2 -0
- package/dist/sfdc/es/types/executeAdapter.d.ts +103 -0
- package/dist/sfdc/es/types/language.d.ts +13 -0
- package/dist/sfdc/es/types/lightningAdapterApi.d.ts +15 -0
- package/dist/sfdc/es/types/main.d.ts +11 -0
- package/dist/sfdc/es/types/nimbusDraftQueue.d.ts +6 -0
- package/dist/sfdc/es/types/primingApi.d.ts +25 -0
- package/dist/sfdc/es/types/responses.d.ts +44 -0
- package/dist/sfdc/es/types/standalone-stubs/instrumentation.d.ts +21 -0
- package/dist/sfdc/es/types/standalone-stubs/o11y.d.ts +23 -0
- package/dist/sfdc/es/types/standalone-stubs/unwrap.d.ts +1 -0
- package/dist/sfdc/es/types/standalone.d.ts +1 -0
- package/dist/sfdc/es/types/ttl.d.ts +2 -0
- package/dist/standalone/es/lds-worker-api.js +134127 -0
- package/dist/standalone/es/types/cachePurging.d.ts +50 -0
- package/dist/standalone/es/types/customLuvioAdapter.d.ts +13 -0
- package/dist/standalone/es/types/customOneStoreAdapter.d.ts +21 -0
- package/dist/standalone/es/types/draftQueueImplementation.d.ts +2 -0
- package/dist/standalone/es/types/executeAdapter.d.ts +103 -0
- package/dist/standalone/es/types/language.d.ts +13 -0
- package/dist/standalone/es/types/lightningAdapterApi.d.ts +15 -0
- package/dist/standalone/es/types/main.d.ts +11 -0
- package/dist/standalone/es/types/nimbusDraftQueue.d.ts +6 -0
- package/dist/standalone/es/types/primingApi.d.ts +25 -0
- package/dist/standalone/es/types/responses.d.ts +44 -0
- package/dist/standalone/es/types/standalone-stubs/instrumentation.d.ts +21 -0
- package/dist/standalone/es/types/standalone-stubs/o11y.d.ts +23 -0
- package/dist/standalone/es/types/standalone-stubs/unwrap.d.ts +1 -0
- package/dist/standalone/es/types/standalone.d.ts +1 -0
- package/dist/standalone/es/types/ttl.d.ts +2 -0
- package/dist/standalone/umd/lds-worker-api.js +134154 -0
- package/dist/standalone/umd/types/cachePurging.d.ts +50 -0
- package/dist/standalone/umd/types/customLuvioAdapter.d.ts +13 -0
- package/dist/standalone/umd/types/customOneStoreAdapter.d.ts +21 -0
- package/dist/standalone/umd/types/draftQueueImplementation.d.ts +2 -0
- package/dist/standalone/umd/types/executeAdapter.d.ts +103 -0
- package/dist/standalone/umd/types/language.d.ts +13 -0
- package/dist/standalone/umd/types/lightningAdapterApi.d.ts +15 -0
- package/dist/standalone/umd/types/main.d.ts +11 -0
- package/dist/standalone/umd/types/nimbusDraftQueue.d.ts +6 -0
- package/dist/standalone/umd/types/primingApi.d.ts +25 -0
- package/dist/standalone/umd/types/responses.d.ts +44 -0
- package/dist/standalone/umd/types/standalone-stubs/instrumentation.d.ts +21 -0
- package/dist/standalone/umd/types/standalone-stubs/o11y.d.ts +23 -0
- package/dist/standalone/umd/types/standalone-stubs/unwrap.d.ts +1 -0
- package/dist/standalone/umd/types/standalone.d.ts +1 -0
- package/dist/standalone/umd/types/ttl.d.ts +2 -0
- package/package.json +78 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/adapter-testcase.schema.json +83 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/createRecord/name-displayValue-response.adapter-snapshot.result.json +61 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/createRecord/name-displayValue.adapter-testcase.json +67 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/createRecord/objectInfos/Aircraft-objectInfo.network-mock.json +582 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/createRecord/objectInfos/Pilot-objectInfo.network-mock.json +367 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/createRecord/scalar-displayValue-nonIntl-fallback-response.adapter-snapshot.result.json +90 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/createRecord/scalar-displayValue-nonIntl-fallback.adapter-testcase.json +25 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/createRecord/scalar-displayValue-response.adapter-snapshot.result.json +90 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/createRecord/scalar-displayValue.adapter-testcase.json +24 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/adapter-forward-assignedtome.adapter-testcase.json +37 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/adapter-forward-baseline.adapter-testcase.json +27 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/adapter-forward-child-relationship.adapter-testcase.json +32 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/adapter-forward-parent-relationship.adapter-testcase.json +32 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/adapter-forward-reserved-entity-name.adapter-testcase.json +28 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/assignedtome.adapter-testcase.json +36 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/date-predicate.adapter-testcase.json +26 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/graphql-get-errors.adapter-testcase.json +26 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/l2DataSet.js +252 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/legacy/getTimeSheetEntry-baseline.adapter-testcase.json +21 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/legacy/getTimeSheetEntry-where-orderby-allfields-spanningfield-500records.adapter-testcase.json +28 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/legacy/getTimeSheetEntry-where-orderby-allfields-spanningfield.adapter-testcase.json +28 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/legacy/getTimeSheetEntry-where-orderby-allfields.adapter-testcase.json +21 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/legacy/getTimeSheetEntry-where-orderby.adapter-testcase.json +21 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/legacy/getTimeSheetEntry-where.adapter-testcase.json +21 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/multiple-recordquery.adapter-testcase.json +31 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/Account.network-mock.json +2920 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/AssignedResource.network-mock.json +928 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/Case.network-mock.json +2008 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/ServiceAppointment.network-mock.json +3123 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/ServiceResource.network-mock.json +1412 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/TimeSheetEntry.network-mock.json +1027 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/User.network-mock.json +7031 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/WorkOrder.network-mock.json +3216 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/WorkType.network-mock.json +986 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectinfo.adapter-testcase.json +21 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/polyfield.adapter-testcase.json +46 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/polyquery-and-operator.adapter-testcase.json +31 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/serverresponse/adapter-forward-baseline.server-response.network-mock.json +416 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/serverresponse/adapter-forward-child-relationship.server-response.network-mock.json +103 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/serverresponse/adapter-forward-parent-relationship.server-response.network-mock.json +93 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/serverresponse/adapter-forward-reserved-entity-name.server-response.network-mock.json +97 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/serverresponse/assignedtome.server-response.network-mock.json +666 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/serverresponse/date-predicate.server-response.network-mock.json +56 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/serverresponse/graphql-get-errors.server-response.network-mock.json +19 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/serverresponse/multiple-recordquery.server-response.network-mock.json +201 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/serverresponse/objectinfos.server-response.network-mock.json +210 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/serverresponse/polyfield.server-response.network-mock.json +724 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/serverresponse/polyquery-and-operator.server-response.network-mock.json +103 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/snapshotdata/adapter-forward-assignedtome.adapter-snapshot.result.json +72 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/snapshotdata/adapter-forward-baseline.adapter-snapshot.result.json +245 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/snapshotdata/adapter-forward-child-relationship.adapter-snapshot.result.json +30 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/snapshotdata/adapter-forward-parent-relationship.adapter-snapshot.result.json +26 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/snapshotdata/adapter-forward-reserved-entity-name.adapter-snapshot.result.json +32 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/snapshotdata/assignedtome.adapter-snapshot.result.json +70 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/snapshotdata/date-predicate.adapter-snapshot.result.json +18 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/snapshotdata/graphql-get-errors.adapter-snapshot.result.json +16 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/snapshotdata/multiple-recordquery.adapter-snapshot.result.json +53 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/snapshotdata/objectinfos.adapter-snapshot.result.json +170 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/snapshotdata/polyfield.adapter-snapshot.result.json +29 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/snapshotdata/polyquery-and-operator.adapter-snapshot.result.json +23 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/metadataVersion/adapter-snapshot.result.json +9 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/metadataVersion/old-metadata-fails-cache-only-adapter-call.adapter-testcase.json +16 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/metadataVersion/old-metadata-fails-cache-only-adapter-call.l2DataSet.tsv +2 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/metadataVersion/old-version-fails-cache-only-adapter-call.adapter-testcase.json +16 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/metadataVersion/old-version-fails-cache-only-adapter-call.l2DataSet.tsv +2 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/network-mock.schema.json +14 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
interface EvictStarted {
|
|
2
|
+
status: 'Started';
|
|
3
|
+
}
|
|
4
|
+
interface EvictRunning {
|
|
5
|
+
status: 'Running';
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
interface BatchEvicted {
|
|
9
|
+
status: 'Evicted';
|
|
10
|
+
skippedEntries: string[];
|
|
11
|
+
evictedEntries: string[];
|
|
12
|
+
}
|
|
13
|
+
interface EvictSucceeded {
|
|
14
|
+
status: 'Succeeded';
|
|
15
|
+
}
|
|
16
|
+
interface EvictError {
|
|
17
|
+
status: 'Error';
|
|
18
|
+
message: string;
|
|
19
|
+
}
|
|
20
|
+
interface EvictCancelled {
|
|
21
|
+
status: 'Canceled';
|
|
22
|
+
}
|
|
23
|
+
export type EvictProgress = BatchEvicted | EvictSucceeded | EvictError | EvictCancelled;
|
|
24
|
+
export type ProgressUpdateCallback = (progess: EvictProgress) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Purging records specified by an array of record id from durable store
|
|
27
|
+
* @param recordIds record id array
|
|
28
|
+
* @onProgressUpdate call back to report evict progress
|
|
29
|
+
*
|
|
30
|
+
* @returns started or already running based whether there's an active eviction going on or not.
|
|
31
|
+
*
|
|
32
|
+
* The record will not be purged if the record has draft.
|
|
33
|
+
*/
|
|
34
|
+
export declare function evictCacheRecordsByIds(recordIds: string[], onProgressUpdate: ProgressUpdateCallback): EvictStarted | EvictRunning;
|
|
35
|
+
/**
|
|
36
|
+
* Purging the db entries which passed expired time by specified days
|
|
37
|
+
* from durable store.
|
|
38
|
+
* @param expiredByDays
|
|
39
|
+
* @param onProgressUpdate
|
|
40
|
+
*
|
|
41
|
+
* @returns started or already running based whether there's an active eviction going on or not.
|
|
42
|
+
*
|
|
43
|
+
* Important: records with draft, objectInfo entries will not be purged even expired by the specified days.
|
|
44
|
+
*/
|
|
45
|
+
export declare function evictExpiredCacheEntries(expiredByDays: number, onProgressUpdate: ProgressUpdateCallback): EvictStarted | EvictRunning;
|
|
46
|
+
/**
|
|
47
|
+
* Signal to stop current eviction if there's an active eviction going on.
|
|
48
|
+
*/
|
|
49
|
+
export declare function stopEviction(): void;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Unsubscribe } from '@luvio/engine';
|
|
2
|
+
import { NativeAdapterRequestContext, type NativeCallbackValue, type NativeOnSnapshot } from './executeAdapter';
|
|
3
|
+
import { type ImperativeAdapterMapValue, type AdapterMapValue } from './lightningAdapterApi';
|
|
4
|
+
export declare function importLuvioAdapterModule(specifier: string): Promise<LuvioAdapterModule>;
|
|
5
|
+
declare class LuvioAdapterModule {
|
|
6
|
+
imperativeAdapterMap: Record<string, ImperativeAdapterMapValue>;
|
|
7
|
+
dmlAdapterMap: Record<string, AdapterMapValue>;
|
|
8
|
+
constructor(module: any);
|
|
9
|
+
invokeAdapter<Config>(adapterName: string, config: Config, nativeAdapterRequestContext?: NativeAdapterRequestContext): Promise<NativeCallbackValue>;
|
|
10
|
+
subscribeAdapter<Config>(adapterName: string, config: Config, nativeAdapterRequestContext: NativeAdapterRequestContext, callback: NativeOnSnapshot): Unsubscribe;
|
|
11
|
+
private invokeDmlAdapter;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Unsubscribe } from '@luvio/engine';
|
|
2
|
+
export type OneStoreNativeCallbackValue = OneStoreNativeCallbackData | OneStoreNativeCallbackError;
|
|
3
|
+
export type OneStoreNativeCallbackData = {
|
|
4
|
+
data: any | undefined;
|
|
5
|
+
error?: undefined;
|
|
6
|
+
};
|
|
7
|
+
export type OneStoreNativeCallbackError = {
|
|
8
|
+
data?: undefined;
|
|
9
|
+
error: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function importOneStoreAdapterModule(specifier: string): Promise<OneStoreAdapterModule>;
|
|
12
|
+
declare class OneStoreAdapterModule {
|
|
13
|
+
module: any;
|
|
14
|
+
constructor(module: any);
|
|
15
|
+
invoke<Config>(adapterOrCommandName: string, config: Config): Promise<OneStoreNativeCallbackValue>;
|
|
16
|
+
subscribe<Config>(adapterOrCommandName: string, config: Config, callback: (value: OneStoreNativeCallbackValue) => void): Promise<Unsubscribe | undefined>;
|
|
17
|
+
private isCommandWireAdapter;
|
|
18
|
+
private hasInvoke;
|
|
19
|
+
private hasSubscribe;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { AdapterRequestContext, CachePolicy, LuvioAdapterEventObserver } from '@luvio/engine';
|
|
2
|
+
import type { DataCallbackTuple } from '@salesforce/lds-bindings';
|
|
3
|
+
import type { DraftQueueItemMetadata } from '@salesforce/lds-drafts';
|
|
4
|
+
import type { NativeErrorResponse } from './responses';
|
|
5
|
+
import type { ObservabilityContext } from '@salesforce/lds-runtime-mobile';
|
|
6
|
+
export declare const ldsMobileInstrumentation: import("o11y/dist/modules/o11y/client/interfaces").Instrumentation;
|
|
7
|
+
export type NativeCallbackValue = NativeCallbackData | NativeCallbackError | NativeCallbackErrors;
|
|
8
|
+
export type NativeCallbackData = {
|
|
9
|
+
data: any | undefined;
|
|
10
|
+
error?: undefined;
|
|
11
|
+
errors?: undefined;
|
|
12
|
+
};
|
|
13
|
+
export type NativeCallbackError = {
|
|
14
|
+
data?: undefined;
|
|
15
|
+
error: NativeErrorResponse;
|
|
16
|
+
errors?: undefined;
|
|
17
|
+
};
|
|
18
|
+
export type NativeCallbackErrors = {
|
|
19
|
+
data?: undefined;
|
|
20
|
+
error?: undefined;
|
|
21
|
+
errors: NativeErrorResponse[];
|
|
22
|
+
};
|
|
23
|
+
export type NativeOnSnapshot = (value: NativeCallbackValue) => void;
|
|
24
|
+
export type NativeOnResponse = (value: NativeCallbackValue) => void;
|
|
25
|
+
export type Unsubscribe = () => void;
|
|
26
|
+
type NativeCachePolicy = CachePolicy;
|
|
27
|
+
type NativeAdapterRequestPriority = 'high' | 'normal' | 'background';
|
|
28
|
+
type NativeObservabilityContext = ObservabilityContext;
|
|
29
|
+
type NativeLuvioEventObserver = LuvioAdapterEventObserver;
|
|
30
|
+
export interface NativeAdapterRequestContext {
|
|
31
|
+
cachePolicy?: NativeCachePolicy;
|
|
32
|
+
priority?: NativeAdapterRequestPriority;
|
|
33
|
+
observabilityContext?: NativeObservabilityContext;
|
|
34
|
+
luvioEventObserver?: NativeLuvioEventObserver;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Coerces a request context passed in from native to a luvio request context
|
|
38
|
+
* @param nativeRequestContext request context passed in from native
|
|
39
|
+
* @returns Coerced luvio request context
|
|
40
|
+
*/
|
|
41
|
+
export declare function buildAdapterRequestContext(nativeRequestContext: NativeAdapterRequestContext | undefined): AdapterRequestContext | undefined;
|
|
42
|
+
export declare function buildInvalidConfigError(error: unknown): NativeCallbackError;
|
|
43
|
+
export declare function buildNativeCallbackValue(adapterCallbackValue: DataCallbackTuple<unknown>): NativeCallbackValue;
|
|
44
|
+
/**
|
|
45
|
+
* Executes the adapter with the given adapterId and config. Will call onSnapshot
|
|
46
|
+
* callback with data or error. Returns an unsubscribe function that should
|
|
47
|
+
* be called to stop receiving updated snapshots.
|
|
48
|
+
*
|
|
49
|
+
* This function returns an error if the given adapterId cannot be found or is not
|
|
50
|
+
* a GET wire adapter. It will also return an error if it fails to parse the config string.
|
|
51
|
+
*/
|
|
52
|
+
export declare function subscribeToAdapter(adapterId: string, config: string, onSnapshot: NativeOnSnapshot, nativeAdapterRequestContext?: NativeAdapterRequestContext): Unsubscribe;
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated There is no situation in which any consumer actually wants to replace the draft.
|
|
55
|
+
* call {@link invokeAdapterWithDraftToMerge} instead`.
|
|
56
|
+
* Keep it for now for app back compatibility.
|
|
57
|
+
* Will be removed in future, ideally 2 releases later.
|
|
58
|
+
*/
|
|
59
|
+
export declare function invokeAdapterWithDraftToReplace(adapterId: string, config: string, draftIdToReplace: string, onResponse: NativeOnResponse, nativeAdapterRequestContext?: NativeAdapterRequestContext): void;
|
|
60
|
+
/**
|
|
61
|
+
* Executes the specified adapter with the given @param adapterId and @param config. Then
|
|
62
|
+
* it merges the draft with the given id with the draft generated by
|
|
63
|
+
* the mutating adapter. Will call onResult callback once with data or error.
|
|
64
|
+
*
|
|
65
|
+
* This function returns an error if the given adapterId cannot be found, or if the
|
|
66
|
+
* adapterId is not a mutating adapter if a draft isn't created, or
|
|
67
|
+
* if it fails to parse the given config string.
|
|
68
|
+
*
|
|
69
|
+
* If the @param adapterId is deleteRecod, the invocation of it will generate a delele draft.
|
|
70
|
+
* The newly generated delete draft will replace the draft specified by @param targetDraftId
|
|
71
|
+
*/
|
|
72
|
+
export declare function invokeAdapterWithDraftToMerge(adapterId: string, config: string, targetDraftId: string, onResponse: NativeOnResponse, nativeAdapterRequestContext?: NativeAdapterRequestContext): void;
|
|
73
|
+
/**
|
|
74
|
+
* Executes the specified adapter with the given adapterId and config. Then
|
|
75
|
+
* it sets the given metadata on the draft created by the mutating adapter. Will call
|
|
76
|
+
* onResult callback once with data or error.
|
|
77
|
+
*
|
|
78
|
+
* This function returns an error if the given adapterId cannot be found, or if the
|
|
79
|
+
* adapterId is not a mutating adapter, or if a draft isn't created, or if it
|
|
80
|
+
* fails to parse the given config string.
|
|
81
|
+
*/
|
|
82
|
+
export declare function invokeAdapterWithMetadata(adapterId: string, config: string, metadata: DraftQueueItemMetadata, onResponse: NativeOnResponse, nativeAdapterRequestContext?: NativeAdapterRequestContext): void;
|
|
83
|
+
/**
|
|
84
|
+
* Executes the specified adapter with the given adapterId and config. Will call
|
|
85
|
+
* onResponse callback once with data or error.
|
|
86
|
+
*
|
|
87
|
+
* This function returns an error if the given adapterId cannot be found or if it
|
|
88
|
+
* fails to parse the given config string.
|
|
89
|
+
*/
|
|
90
|
+
export declare function invokeAdapter(adapterId: string, config: string, onResponse: NativeOnResponse, nativeAdapterRequestContext?: NativeAdapterRequestContext): void;
|
|
91
|
+
/**
|
|
92
|
+
* @deprecated Use invokeAdapter or subscribeToAdapter instead
|
|
93
|
+
*
|
|
94
|
+
* W-9173084 Will remove this
|
|
95
|
+
*/
|
|
96
|
+
export declare function executeAdapter(adapterId: string, config: string, onSnapshot: NativeOnSnapshot, nativeAdapterRequestContext?: NativeAdapterRequestContext): Unsubscribe;
|
|
97
|
+
/**
|
|
98
|
+
* @deprecated Use invokeAdapter instead
|
|
99
|
+
*
|
|
100
|
+
* W-9173084 Will remove this
|
|
101
|
+
*/
|
|
102
|
+
export declare function executeMutatingAdapter(adapterId: string, config: string, onResult: NativeOnResponse, nativeAdapterRequestContext?: NativeAdapterRequestContext): void;
|
|
103
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const create: {
|
|
2
|
+
(o: object | null): any;
|
|
3
|
+
(o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
|
|
4
|
+
}, keys: {
|
|
5
|
+
(o: object): string[];
|
|
6
|
+
(o: {}): string[];
|
|
7
|
+
};
|
|
8
|
+
declare const stringify: {
|
|
9
|
+
(value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
|
|
10
|
+
(value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string;
|
|
11
|
+
}, parse: (text: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => any;
|
|
12
|
+
declare const isArray: (arg: any) => arg is any[];
|
|
13
|
+
export { create as ObjectCreate, keys as ObjectKeys, stringify as JSONStringify, parse as JSONParse, isArray as IsArray, };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ImperativeAdapter } from '@salesforce/lds-bindings';
|
|
2
|
+
import type { Adapter } from '@luvio/engine';
|
|
3
|
+
import * as gqlApi from 'force/ldsAdaptersGraphql';
|
|
4
|
+
export declare const IMPERATIVE_ADAPTER_SUFFIX = "_imperative";
|
|
5
|
+
export declare const UNSTABLE_ADAPTER_PREFIX = "unstable_";
|
|
6
|
+
export type AdapterMapValue = Adapter<unknown, unknown> | ImperativeAdapter<unknown, unknown> | undefined;
|
|
7
|
+
export type ImperativeAdapterMapValue = ImperativeAdapter<unknown, unknown> | undefined;
|
|
8
|
+
export declare function buildAdapterMaps(map: Record<string, AdapterMapValue>): {
|
|
9
|
+
dmlAdapterMap: Record<string, AdapterMapValue>;
|
|
10
|
+
imperativeAdapterMap: Record<string, ImperativeAdapterMapValue>;
|
|
11
|
+
};
|
|
12
|
+
declare function getDMLAdapterFromName(name: string): AdapterMapValue;
|
|
13
|
+
declare function getImperativeAdapterFromName(name: string): ImperativeAdapterMapValue;
|
|
14
|
+
declare function getImperativeAdapterNames(): string[];
|
|
15
|
+
export { getImperativeAdapterFromName, getDMLAdapterFromName, getImperativeAdapterNames, gqlApi };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { subscribeToAdapter, invokeAdapter, invokeAdapterWithMetadata, invokeAdapterWithDraftToReplace, invokeAdapterWithDraftToMerge, executeAdapter, executeMutatingAdapter } from './executeAdapter';
|
|
2
|
+
import { getImperativeAdapterNames } from './lightningAdapterApi';
|
|
3
|
+
import { nimbusDraftQueue } from './nimbusDraftQueue';
|
|
4
|
+
import { draftQueue, draftManager } from './draftQueueImplementation';
|
|
5
|
+
import { setUiApiRecordTTL, setMetadataTTL } from './ttl';
|
|
6
|
+
import { registerReportObserver } from '@salesforce/lds-runtime-mobile';
|
|
7
|
+
import { createPrimingSession } from './primingApi';
|
|
8
|
+
import { evictCacheRecordsByIds, evictExpiredCacheEntries, stopEviction } from './cachePurging';
|
|
9
|
+
import { importLuvioAdapterModule } from './customLuvioAdapter';
|
|
10
|
+
import { importOneStoreAdapterModule } from './customOneStoreAdapter';
|
|
11
|
+
export { subscribeToAdapter, invokeAdapter, invokeAdapterWithMetadata, invokeAdapterWithDraftToReplace, invokeAdapterWithDraftToMerge, executeAdapter, executeMutatingAdapter, nimbusDraftQueue, draftQueue, draftManager, setUiApiRecordTTL, setMetadataTTL, registerReportObserver, getImperativeAdapterNames, createPrimingSession, evictCacheRecordsByIds, evictExpiredCacheEntries, stopEviction, importLuvioAdapterModule, importOneStoreAdapterModule, };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DraftQueue as NimbusDraftQueue } from '@salesforce/nimbus-plugin-lds';
|
|
2
|
+
/**
|
|
3
|
+
* Implements the DraftQueue interface from nimbus-plugin-lds by passing requests
|
|
4
|
+
* to the instance of the lds-drafts' DraftQueue implementation
|
|
5
|
+
*/
|
|
6
|
+
export declare const nimbusDraftQueue: NimbusDraftQueue;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { PrimingSession } from '@salesforce/lds-runtime-mobile';
|
|
2
|
+
interface PrimingError {
|
|
3
|
+
ids: string[];
|
|
4
|
+
code: ErrorCode;
|
|
5
|
+
message: string;
|
|
6
|
+
}
|
|
7
|
+
type ErrorCode = 'precondition-error' | 'not-found' | 'service-protection-error' | 'service-unavailable' | 'canceled' | 'unknown';
|
|
8
|
+
export interface PrimingEventHandler {
|
|
9
|
+
onError?: (error: PrimingError) => void;
|
|
10
|
+
onPrimed?: (ids: string[]) => void;
|
|
11
|
+
}
|
|
12
|
+
export interface PrimingSessionConfig {
|
|
13
|
+
primingEventHandler?: PrimingEventHandler;
|
|
14
|
+
concurrency?: number;
|
|
15
|
+
batchSize?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function createPrimingSession(config: PrimingSessionConfig): {
|
|
18
|
+
enqueue: (work: PrimingWork, context?: import("@salesforce/lds-runtime-mobile").ObservabilityContext | undefined) => Promise<void>;
|
|
19
|
+
cancel: () => void;
|
|
20
|
+
on: <K extends keyof import("@salesforce/lds-runtime-mobile/dist/types/priming").PrimingEvents>(eventName: K, callback: (payload: import("@salesforce/lds-runtime-mobile/dist/types/priming").PrimingEvents[K]) => void) => PrimingSession;
|
|
21
|
+
once: <K_1 extends keyof import("@salesforce/lds-runtime-mobile/dist/types/priming").PrimingEvents>(eventName: K_1, callback: (payload: import("@salesforce/lds-runtime-mobile/dist/types/priming").PrimingEvents[K_1]) => void) => PrimingSession;
|
|
22
|
+
off: <K_2 extends keyof import("@salesforce/lds-runtime-mobile/dist/types/priming").PrimingEvents>(eventName: K_2, callback: (payload: import("@salesforce/lds-runtime-mobile/dist/types/priming").PrimingEvents[K_2]) => void) => PrimingSession;
|
|
23
|
+
registerEventHandler: (handler: PrimingEventHandler) => () => void;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { FetchResponse, FetchErrorResponse, Headers, AdapterErrorResponse, NetworkAdapterErrorResponse } from '@luvio/engine';
|
|
2
|
+
import { HttpStatusCode } from '@luvio/engine';
|
|
3
|
+
export declare const NATIVE_ERROR_CODE = "NATIVE_ERROR";
|
|
4
|
+
export declare const NON_MUTATING_ADAPTER_MESSAGE = "adapterId must be a mutating adapter";
|
|
5
|
+
export declare const NO_DRAFT_CREATED_MESSAGE = "the adapter did not generate a draft";
|
|
6
|
+
export declare const DRAFT_DOESNT_EXIST_MESSAGE = "the specified draft does not exist";
|
|
7
|
+
/**
|
|
8
|
+
* Error objects don't serialize well over the js-native wire, so our class turns
|
|
9
|
+
* an Error into an object that serializes real nice
|
|
10
|
+
*/
|
|
11
|
+
export declare class NativeNetworkAdapterErrorResponse implements NetworkAdapterErrorResponse {
|
|
12
|
+
message: string;
|
|
13
|
+
name: string;
|
|
14
|
+
errorType: NetworkAdapterErrorResponse['errorType'];
|
|
15
|
+
constructor(error: NetworkAdapterErrorResponse);
|
|
16
|
+
}
|
|
17
|
+
export declare class NativeAdapterErrorResponse implements AdapterErrorResponse {
|
|
18
|
+
errorType: AdapterErrorResponse['errorType'];
|
|
19
|
+
error: unknown;
|
|
20
|
+
constructor(error: AdapterErrorResponse);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* NativeErrorResponse is the native version of Luvio's ErrorResponse type.
|
|
24
|
+
*
|
|
25
|
+
* It is either a non-ok http response or an Error. It has a discriminator property
|
|
26
|
+
* "errorType" to distinguish between the two types of errors.
|
|
27
|
+
*/
|
|
28
|
+
export type NativeErrorResponse = NativeFetchErrorResponse | NativeNetworkAdapterErrorResponse | NativeAdapterErrorResponse;
|
|
29
|
+
export declare class NativeFetchResponse<T> implements FetchResponse<T> {
|
|
30
|
+
status: HttpStatusCode;
|
|
31
|
+
body: T;
|
|
32
|
+
headers: Headers;
|
|
33
|
+
constructor(status: HttpStatusCode, body: T);
|
|
34
|
+
get statusText(): string;
|
|
35
|
+
get ok(): boolean;
|
|
36
|
+
}
|
|
37
|
+
export declare class NativeFetchErrorResponse extends NativeFetchResponse<unknown> implements FetchErrorResponse {
|
|
38
|
+
errorType: FetchErrorResponse['errorType'];
|
|
39
|
+
}
|
|
40
|
+
export declare function createNativeFetchErrorResponse(message: string): NativeFetchErrorResponse;
|
|
41
|
+
/**
|
|
42
|
+
* This function takes an unknown error and normalizes it to an Error object
|
|
43
|
+
*/
|
|
44
|
+
export declare function normalizeError(error: unknown): Error;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const instrumentation: {
|
|
2
|
+
instrumentAdapter(createFunction: Function, _metadata: any): Function;
|
|
3
|
+
};
|
|
4
|
+
export declare function instrumentAdapter(createFunction: Function, _metadata: any): Function;
|
|
5
|
+
export declare function incrementGetRecordNotifyChangeAllowCount(): void;
|
|
6
|
+
export declare function incrementGetRecordNotifyChangeDropCount(): void;
|
|
7
|
+
export declare function incrementNotifyRecordUpdateAvailableAllowCount(): void;
|
|
8
|
+
export declare function incrementNotifyRecordUpdateAvailableDropCount(): void;
|
|
9
|
+
export declare function refreshApiEvent(): void;
|
|
10
|
+
export declare function instrumentGraphqlAdapter(createFunction: Function, _metadata: any): Function;
|
|
11
|
+
export declare function setLdsAdaptersUiapiInstrumentation(_uiapiRegistration: any): void;
|
|
12
|
+
export declare function setLdsNetworkAdapterInstrumentation(_networkAdapterRegistration: any): void;
|
|
13
|
+
export declare function setupInstrumentation(_luvio: any, _store: any): void;
|
|
14
|
+
export declare function instrumentLuvio(_context: unknown): void;
|
|
15
|
+
export declare const REFRESH_UIAPI_KEY = "refreshUiApi";
|
|
16
|
+
export declare const METRIC_KEYS: {};
|
|
17
|
+
export declare const O11Y_NAMESPACE_LDS_MOBILE = "lds-mobile";
|
|
18
|
+
export declare const withInstrumentation: () => undefined;
|
|
19
|
+
export declare class MetricsReporter {
|
|
20
|
+
reportGraphqlQueryParseError(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IdleDetector, Activity } from 'o11y/dist/modules/o11y/client/interfaces';
|
|
2
|
+
export declare const idleDetector: IdleDetector;
|
|
3
|
+
export declare const activity: Partial<Activity>;
|
|
4
|
+
type MetricsTags = Record<string, number | string | boolean>;
|
|
5
|
+
declare function startActivity(_name: string): Activity;
|
|
6
|
+
declare function log(_schema: any, _data?: any): void;
|
|
7
|
+
export declare const mockInstrumentation: {
|
|
8
|
+
log: typeof log;
|
|
9
|
+
startActivity: typeof startActivity;
|
|
10
|
+
error: () => void;
|
|
11
|
+
trackValue: (_operation: string, _value: number, _hasError?: boolean, _tags?: MetricsTags) => void;
|
|
12
|
+
incrementCounter: (_operation: string, _increment?: number, _hasError?: boolean, _tags?: MetricsTags) => void;
|
|
13
|
+
bucketValue: (_operation: string, _value: number, _buckets: number[]) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const getInstrumentation: () => {
|
|
16
|
+
log: typeof log;
|
|
17
|
+
startActivity: typeof startActivity;
|
|
18
|
+
error: () => void;
|
|
19
|
+
trackValue: (_operation: string, _value: number, _hasError?: boolean, _tags?: MetricsTags) => void;
|
|
20
|
+
incrementCounter: (_operation: string, _increment?: number, _hasError?: boolean, _tags?: MetricsTags) => void;
|
|
21
|
+
bucketValue: (_operation: string, _value: number, _buckets: number[]) => void;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function unwrap<T>(data: T): T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './main';
|