@salesforce/lds-runtime-mobile 0.131.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/LICENSE.txt +82 -0
- package/dist/main.js +16194 -0
- package/dist/types/DraftQueueFactory.d.ts +3 -0
- package/dist/types/NimbusBinaryStore.d.ts +2 -0
- package/dist/types/NimbusDraftQueue.d.ts +28 -0
- package/dist/types/RecordIdGenerator.d.ts +15 -0
- package/dist/types/__mocks__/@salesforce/i18n/currency.d.ts +2 -0
- package/dist/types/__mocks__/@salesforce/i18n/dateTime.shortDateFormat.d.ts +2 -0
- package/dist/types/__mocks__/@salesforce/i18n/dateTime.shortDateTimeFormat.d.ts +2 -0
- package/dist/types/__mocks__/@salesforce/i18n/dateTime.shortTimeFormat.d.ts +2 -0
- package/dist/types/__mocks__/@salesforce/i18n/locale.d.ts +2 -0
- package/dist/types/__mocks__/@salesforce/i18n/timeZone.d.ts +2 -0
- package/dist/types/__mocks__/@salesforce/user/Id.d.ts +2 -0
- package/dist/types/__mocks__/force/ldsGraphqlParser.d.ts +3 -0
- package/dist/types/__mocks__/lightning/i18nCldrOptions.d.ts +2 -0
- package/dist/types/__mocks__/lightning/i18nService.d.ts +10 -0
- package/dist/types/__mocks__/o11y/activity.d.ts +2 -0
- package/dist/types/__mocks__/o11y/client.d.ts +5 -0
- package/dist/types/__mocks__/o11y/idleDetector.d.ts +2 -0
- package/dist/types/__mocks__/o11y/instrumentation.d.ts +15 -0
- package/dist/types/durableStore/NimbusSqliteStore/NimbusSqliteStore.d.ts +20 -0
- package/dist/types/durableStore/NimbusSqliteStore/tables/AbstractKeyValueDataTable.d.ts +14 -0
- package/dist/types/durableStore/NimbusSqliteStore/tables/LdsDataTable.d.ts +15 -0
- package/dist/types/durableStore/NimbusSqliteStore/tables/LdsDataTableBase.d.ts +8 -0
- package/dist/types/durableStore/NimbusSqliteStore/tables/LdsDraftIdMapDataTable.d.ts +5 -0
- package/dist/types/durableStore/NimbusSqliteStore/tables/LdsDraftsDataTable.d.ts +5 -0
- package/dist/types/durableStore/NimbusSqliteStore/tables/LdsInternalDataTable.d.ts +15 -0
- package/dist/types/durableStore/NimbusSqliteStore/tables/index.d.ts +5 -0
- package/dist/types/durableStore/NimbusSqliteStore/tables/utils.d.ts +2 -0
- package/dist/types/durableStore/index.d.ts +2 -0
- package/dist/types/durableStore/makeEnvironmentGraphqlAware.d.ts +2 -0
- package/dist/types/environment/enableLazyObjectInfoCaching.d.ts +13 -0
- package/dist/types/inspection/setupInspection.d.ts +2 -0
- package/dist/types/instrumentation/instrumentDraftQueue.d.ts +5 -0
- package/dist/types/instrumentation/instrumentGraphQLEval.d.ts +2 -0
- package/dist/types/instrumentation/instrumentMobileAdapter.d.ts +6 -0
- package/dist/types/instrumentation/instrumentPrimingSession.d.ts +2 -0
- package/dist/types/instrumentation/instrumentationContentDocumentVersionAdapter.d.ts +2 -0
- package/dist/types/instrumentation/instrumentationUtils.d.ts +10 -0
- package/dist/types/instrumentation/metrics.d.ts +16 -0
- package/dist/types/instrumentation/withInstrumentation.d.ts +12 -0
- package/dist/types/localization/formatDisplayValue.d.ts +6 -0
- package/dist/types/main.d.ts +6 -0
- package/dist/types/mocks.d.ts +1 -0
- package/dist/types/priming/NimbusPrimingNetworkAdapter.d.ts +6 -0
- package/dist/types/priming/SqlitePrimingStore.d.ts +10 -0
- package/dist/types/priming/primingSessionFactory.d.ts +12 -0
- package/dist/types/runtime.d.ts +17 -0
- package/dist/types/utils/ObjectInfoService.d.ts +43 -0
- package/dist/types/utils/adapters.d.ts +18 -0
- package/dist/types/utils/language.d.ts +29 -0
- package/dist/types/utils/utils.d.ts +13 -0
- package/package.json +96 -0
- package/sfdc/main.js +16194 -0
- package/sfdc/types/DraftQueueFactory.d.ts +3 -0
- package/sfdc/types/NimbusBinaryStore.d.ts +2 -0
- package/sfdc/types/NimbusDraftQueue.d.ts +28 -0
- package/sfdc/types/RecordIdGenerator.d.ts +15 -0
- package/sfdc/types/__mocks__/@salesforce/i18n/currency.d.ts +2 -0
- package/sfdc/types/__mocks__/@salesforce/i18n/dateTime.shortDateFormat.d.ts +2 -0
- package/sfdc/types/__mocks__/@salesforce/i18n/dateTime.shortDateTimeFormat.d.ts +2 -0
- package/sfdc/types/__mocks__/@salesforce/i18n/dateTime.shortTimeFormat.d.ts +2 -0
- package/sfdc/types/__mocks__/@salesforce/i18n/locale.d.ts +2 -0
- package/sfdc/types/__mocks__/@salesforce/i18n/timeZone.d.ts +2 -0
- package/sfdc/types/__mocks__/@salesforce/user/Id.d.ts +2 -0
- package/sfdc/types/__mocks__/force/ldsGraphqlParser.d.ts +3 -0
- package/sfdc/types/__mocks__/lightning/i18nCldrOptions.d.ts +2 -0
- package/sfdc/types/__mocks__/lightning/i18nService.d.ts +10 -0
- package/sfdc/types/__mocks__/o11y/activity.d.ts +2 -0
- package/sfdc/types/__mocks__/o11y/client.d.ts +5 -0
- package/sfdc/types/__mocks__/o11y/idleDetector.d.ts +2 -0
- package/sfdc/types/__mocks__/o11y/instrumentation.d.ts +15 -0
- package/sfdc/types/durableStore/NimbusSqliteStore/NimbusSqliteStore.d.ts +20 -0
- package/sfdc/types/durableStore/NimbusSqliteStore/tables/AbstractKeyValueDataTable.d.ts +14 -0
- package/sfdc/types/durableStore/NimbusSqliteStore/tables/LdsDataTable.d.ts +15 -0
- package/sfdc/types/durableStore/NimbusSqliteStore/tables/LdsDataTableBase.d.ts +8 -0
- package/sfdc/types/durableStore/NimbusSqliteStore/tables/LdsDraftIdMapDataTable.d.ts +5 -0
- package/sfdc/types/durableStore/NimbusSqliteStore/tables/LdsDraftsDataTable.d.ts +5 -0
- package/sfdc/types/durableStore/NimbusSqliteStore/tables/LdsInternalDataTable.d.ts +15 -0
- package/sfdc/types/durableStore/NimbusSqliteStore/tables/index.d.ts +5 -0
- package/sfdc/types/durableStore/NimbusSqliteStore/tables/utils.d.ts +2 -0
- package/sfdc/types/durableStore/index.d.ts +2 -0
- package/sfdc/types/durableStore/makeEnvironmentGraphqlAware.d.ts +2 -0
- package/sfdc/types/environment/enableLazyObjectInfoCaching.d.ts +13 -0
- package/sfdc/types/inspection/setupInspection.d.ts +2 -0
- package/sfdc/types/instrumentation/instrumentDraftQueue.d.ts +5 -0
- package/sfdc/types/instrumentation/instrumentGraphQLEval.d.ts +2 -0
- package/sfdc/types/instrumentation/instrumentMobileAdapter.d.ts +6 -0
- package/sfdc/types/instrumentation/instrumentPrimingSession.d.ts +2 -0
- package/sfdc/types/instrumentation/instrumentationContentDocumentVersionAdapter.d.ts +2 -0
- package/sfdc/types/instrumentation/instrumentationUtils.d.ts +10 -0
- package/sfdc/types/instrumentation/metrics.d.ts +16 -0
- package/sfdc/types/instrumentation/withInstrumentation.d.ts +12 -0
- package/sfdc/types/localization/formatDisplayValue.d.ts +6 -0
- package/sfdc/types/main.d.ts +6 -0
- package/sfdc/types/mocks.d.ts +1 -0
- package/sfdc/types/priming/NimbusPrimingNetworkAdapter.d.ts +6 -0
- package/sfdc/types/priming/SqlitePrimingStore.d.ts +10 -0
- package/sfdc/types/priming/primingSessionFactory.d.ts +12 -0
- package/sfdc/types/runtime.d.ts +17 -0
- package/sfdc/types/utils/ObjectInfoService.d.ts +43 -0
- package/sfdc/types/utils/adapters.d.ts +18 -0
- package/sfdc/types/utils/language.d.ts +29 -0
- package/sfdc/types/utils/utils.d.ts +13 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { DraftAction, DraftQueue, ProcessActionResult, DraftQueueState, DraftQueueChangeListener, DraftActionMetadata, ActionHandler, CustomActionExecutor, PendingDraftAction } from '@salesforce/lds-drafts';
|
|
2
|
+
/**
|
|
3
|
+
* An implementation of the DraftQueue interface which serializes
|
|
4
|
+
* requests and sends them across the Nimbus bridge and deserializes the result.
|
|
5
|
+
*
|
|
6
|
+
* This instance is leveraged in the LMR webview which proxies DraftQueue requests
|
|
7
|
+
* to a concrete implementation running in jscore.
|
|
8
|
+
*/
|
|
9
|
+
export declare class NimbusDraftQueue implements DraftQueue {
|
|
10
|
+
enqueue<Data, Response>(handlerId: string, data: unknown): Promise<{
|
|
11
|
+
action: PendingDraftAction<Data>;
|
|
12
|
+
data: Response;
|
|
13
|
+
}>;
|
|
14
|
+
registerOnChangedListener(_listener: DraftQueueChangeListener): () => Promise<void>;
|
|
15
|
+
processNextAction(): Promise<ProcessActionResult>;
|
|
16
|
+
getQueueActions(): Promise<DraftAction<unknown, unknown>[]>;
|
|
17
|
+
getDataForAction<T>(action: DraftAction<T, unknown>): Promise<T | undefined>;
|
|
18
|
+
getQueueState(): DraftQueueState;
|
|
19
|
+
removeDraftAction(_actionId: string): Promise<void>;
|
|
20
|
+
startQueue(): Promise<void>;
|
|
21
|
+
stopQueue(): Promise<void>;
|
|
22
|
+
replaceAction<Data, Response>(_actionId: string, _withActionId: string): Promise<DraftAction<Data, Response>>;
|
|
23
|
+
mergeActions<Data, Response>(_targetActionId: string, _sourceActionId: string): Promise<DraftAction<Data, Response>>;
|
|
24
|
+
setMetadata(_actionId: string, _metadata: DraftActionMetadata): Promise<DraftAction<unknown, unknown>>;
|
|
25
|
+
addHandler(_handler: ActionHandler<unknown, unknown, unknown>): Promise<void>;
|
|
26
|
+
addCustomHandler(_id: string, _executor: CustomActionExecutor): Promise<void>;
|
|
27
|
+
removeHandler(_id: string): Promise<void>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const recordIdGenerator: (id: string) => {
|
|
2
|
+
/**
|
|
3
|
+
* Returns a new record id with the provided prefix
|
|
4
|
+
*/
|
|
5
|
+
newRecordId: (prefix: string) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Returns true if the recordId was generated using this generator; false otherwise
|
|
8
|
+
*/
|
|
9
|
+
isGenerated: (recordId: string) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Returns a number value of when the record was generated.
|
|
12
|
+
* Throws if the recordId passed is invalid or the recordId was not generated.
|
|
13
|
+
*/
|
|
14
|
+
recordGenerationTime: (recordId: string) => number;
|
|
15
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare function getNumberFormat(): {
|
|
2
|
+
format: () => string;
|
|
3
|
+
};
|
|
4
|
+
declare function getDateTimeFormat(): {
|
|
5
|
+
format: (date: number) => string;
|
|
6
|
+
};
|
|
7
|
+
declare function getDateTimeISO8601Parser(): {
|
|
8
|
+
parse: (input: string) => number | Date;
|
|
9
|
+
};
|
|
10
|
+
export { getNumberFormat, getDateTimeFormat, getDateTimeISO8601Parser };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { instrumentation } from './instrumentation';
|
|
2
|
+
export { activity } from './activity';
|
|
3
|
+
export { instrumentation } from './instrumentation';
|
|
4
|
+
export { idleDetector } from './idleDetector';
|
|
5
|
+
export declare function getInstrumentation(_name: string): typeof instrumentation;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Activity, MetricsTags, Schema, SchematizedData } from 'o11y/client';
|
|
2
|
+
declare function log(_schema: Schema, _data?: SchematizedData): void;
|
|
3
|
+
declare function error(_err: Error, _userSchemaOrText?: string, _data?: SchematizedData): void;
|
|
4
|
+
declare function startActivity(_name: string): Activity;
|
|
5
|
+
declare function incrementCounter(_operation: string, _increment?: number, _hasError?: boolean, _tags?: MetricsTags): void;
|
|
6
|
+
declare function trackValue(_operation: string, _value: number, _hasError?: boolean, _tags?: MetricsTags): void;
|
|
7
|
+
export declare const instrumentation: {
|
|
8
|
+
log: typeof log;
|
|
9
|
+
error: typeof error;
|
|
10
|
+
startActivity: typeof startActivity;
|
|
11
|
+
incrementCounter: typeof incrementCounter;
|
|
12
|
+
trackValue: typeof trackValue;
|
|
13
|
+
};
|
|
14
|
+
export declare const METRIC_KEYS: {};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SqliteResult, SqliteStore, SqliteType } from '@salesforce/lds-store-sql';
|
|
2
|
+
import type { SqliteStorePlugin } from '@salesforce/nimbus-plugin-lds';
|
|
3
|
+
import type { DurableStore, DurableStoreEntries, DurableStoreOperation, OnDurableStoreChangedListener } from '@luvio/environments';
|
|
4
|
+
export declare class NimbusSqliteStore implements SqliteStore, DurableStore {
|
|
5
|
+
private plugin;
|
|
6
|
+
private readonly dataTableMap;
|
|
7
|
+
private readonly internalDataTable;
|
|
8
|
+
constructor(plugin: SqliteStorePlugin);
|
|
9
|
+
isEvalSupported(): boolean;
|
|
10
|
+
query(sql: string, params: SqliteType[]): Promise<SqliteResult>;
|
|
11
|
+
getEntries<T>(entryIds: string[], segment: string): Promise<DurableStoreEntries<T> | undefined>;
|
|
12
|
+
getAllEntries<T>(segment: string): Promise<DurableStoreEntries<T> | undefined>;
|
|
13
|
+
setEntries<T>(entries: DurableStoreEntries<T>, segment: string): Promise<void>;
|
|
14
|
+
batchOperations<T>(operations: DurableStoreOperation<T>[]): Promise<void>;
|
|
15
|
+
evictEntries(entryIds: string[], segment: string): Promise<void>;
|
|
16
|
+
registerOnChangedListener(listener: OnDurableStoreChangedListener): () => Promise<void>;
|
|
17
|
+
private getTable;
|
|
18
|
+
private idsToDeleteOperation;
|
|
19
|
+
private batchOperationAsPromise;
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SqliteOperation, SqliteStorePlugin } from '@salesforce/nimbus-plugin-lds';
|
|
2
|
+
import type { DurableStoreEntries } from '@luvio/environments';
|
|
3
|
+
import type { LdsDataTableBase } from '../tables';
|
|
4
|
+
export declare abstract class AbstractKeyValueDataTable implements LdsDataTableBase {
|
|
5
|
+
readonly tableName: SqliteOperation['table'];
|
|
6
|
+
readonly plugin: SqliteStorePlugin;
|
|
7
|
+
private columnNames;
|
|
8
|
+
private conflictColumnNames;
|
|
9
|
+
constructor(plugin: SqliteStorePlugin, tableName: SqliteOperation['table']);
|
|
10
|
+
getByKeys<T>(keys: string[]): Promise<DurableStoreEntries<T>>;
|
|
11
|
+
getAll<T>(): Promise<DurableStoreEntries<T>>;
|
|
12
|
+
entriesToUpsertOperations<T>(entries: DurableStoreEntries<T>, segment: string): SqliteOperation;
|
|
13
|
+
private mapToDurableEntries;
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SqliteOperation, SqliteStorePlugin } from '@salesforce/nimbus-plugin-lds';
|
|
2
|
+
import type { DurableStoreEntries } from '@luvio/environments';
|
|
3
|
+
import type { LdsDataTableBase } from '../tables/LdsDataTableBase';
|
|
4
|
+
export declare class LdsDataTable implements LdsDataTableBase {
|
|
5
|
+
readonly tableName = "lds_data";
|
|
6
|
+
readonly plugin: SqliteStorePlugin;
|
|
7
|
+
private columnNames;
|
|
8
|
+
private conflictColumnNames;
|
|
9
|
+
private getAllQuery;
|
|
10
|
+
constructor(plugin: SqliteStorePlugin);
|
|
11
|
+
getByKeys<T>(keys: string[]): Promise<DurableStoreEntries<T>>;
|
|
12
|
+
getAll<T>(): Promise<DurableStoreEntries<T>>;
|
|
13
|
+
entriesToUpsertOperations<T>(entries: DurableStoreEntries<T>, segment: string): SqliteOperation;
|
|
14
|
+
private mapToDurableEntries;
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DurableStoreEntries } from '@luvio/environments';
|
|
2
|
+
import type { SqliteOperation } from '@salesforce/nimbus-plugin-lds';
|
|
3
|
+
export interface LdsDataTableBase {
|
|
4
|
+
tableName: SqliteOperation['table'];
|
|
5
|
+
getByKeys<T>(keys: string[], segment?: string): Promise<DurableStoreEntries<T>>;
|
|
6
|
+
getAll<T>(segment?: string): Promise<DurableStoreEntries<T>>;
|
|
7
|
+
entriesToUpsertOperations<T>(entries: DurableStoreEntries<T>, segment: string): SqliteOperation;
|
|
8
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SqliteStorePlugin } from '@salesforce/nimbus-plugin-lds';
|
|
2
|
+
import { AbstractKeyValueDataTable } from './AbstractKeyValueDataTable';
|
|
3
|
+
export declare class LdsDraftIdMapDataTable extends AbstractKeyValueDataTable {
|
|
4
|
+
constructor(plugin: SqliteStorePlugin);
|
|
5
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SqliteOperation, SqliteStorePlugin } from '@salesforce/nimbus-plugin-lds';
|
|
2
|
+
import type { DurableStoreEntries } from '@luvio/environments';
|
|
3
|
+
import type { LdsDataTableBase } from '../tables';
|
|
4
|
+
export declare class LdsInternalDataTable implements LdsDataTableBase {
|
|
5
|
+
readonly tableName = "lds_internal";
|
|
6
|
+
readonly plugin: SqliteStorePlugin;
|
|
7
|
+
private columnNames;
|
|
8
|
+
private conflictColumnNames;
|
|
9
|
+
private getAllQuery;
|
|
10
|
+
constructor(plugin: SqliteStorePlugin);
|
|
11
|
+
getByKeys<T>(keys: string[], namespace: string): Promise<DurableStoreEntries<T>>;
|
|
12
|
+
getAll<T>(namespace: string): Promise<DurableStoreEntries<T>>;
|
|
13
|
+
entriesToUpsertOperations<T>(entries: DurableStoreEntries<T>, segment: string): SqliteOperation;
|
|
14
|
+
private mapToDurableEntries;
|
|
15
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { LdsDataTable } from './LdsDataTable';
|
|
2
|
+
export { LdsDraftsDataTable } from './LdsDraftsDataTable';
|
|
3
|
+
export { LdsDraftIdMapDataTable } from './LdsDraftIdMapDataTable';
|
|
4
|
+
export { LdsInternalDataTable } from './LdsInternalDataTable';
|
|
5
|
+
export { LdsDataTableBase } from './LdsDataTableBase';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare function selectColumnsFromTableWhereKeyIn(columnNames: string[], table: string, keyColumnName: string, whereIn: string[]): string;
|
|
2
|
+
export declare function selectColumnsFromTableWhereKeyInNamespaced(columnNames: string[], table: string, keyColumnName: string, whereIn: string[], namespaceColumnName: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Environment } from '@luvio/engine';
|
|
2
|
+
import type { ObjectInfoRepresentation } from '@salesforce/lds-adapters-uiapi';
|
|
3
|
+
export type EnsureCachedObjectInfoFunction = (apiName: string, objectInfo?: ObjectInfoRepresentation) => Promise<void>;
|
|
4
|
+
/**
|
|
5
|
+
* This environment observes incoming data for records and object info representations
|
|
6
|
+
* If the incoming data is a record or object info it extracts the apiName
|
|
7
|
+
* and calls a provided function which will ensure the associated object info is cached
|
|
8
|
+
*
|
|
9
|
+
* @param env base environment
|
|
10
|
+
* @param ensureObjectInfoCached function to cache the object info if not already cached
|
|
11
|
+
* @returns configured environment
|
|
12
|
+
*/
|
|
13
|
+
export declare function enableObjectInfoCaching(env: Environment, ensureObjectInfoCached: EnsureCachedObjectInfoFunction): Environment;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReportObserver } from '@salesforce/lds-instrumentation';
|
|
2
|
+
import type { Luvio, InMemoryStore } from '@luvio/engine';
|
|
3
|
+
type Unsubscribe = () => void;
|
|
4
|
+
export declare function setupMobileInstrumentation(luvio: Luvio, store: InMemoryStore): void;
|
|
5
|
+
export declare function registerReportObserver(reportObserver: ReportObserver): Unsubscribe;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AdapterRequestContext, LuvioAdapterEventObserver } from '@luvio/engine';
|
|
2
|
+
export declare function attachObserversToAdapterRequestContext(observers: LuvioAdapterEventObserver[], adapterRequestContext?: AdapterRequestContext): AdapterRequestContext;
|
|
3
|
+
/**
|
|
4
|
+
* Use this method to sanitize the unknown error object when
|
|
5
|
+
* we are unsure of the type of the error thrown
|
|
6
|
+
*
|
|
7
|
+
* @param err Unknown object to sanitize
|
|
8
|
+
* @returns an instance of error
|
|
9
|
+
*/
|
|
10
|
+
export declare function normalizeError(err: unknown): Error;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const O11Y_NAMESPACE_LDS_MOBILE = "lds-mobile";
|
|
2
|
+
export declare const DRAFT_QUEUE_TOTAL_MERGE_ACTIONS_CALLS = "draft-queue-total-mergeActions-calls";
|
|
3
|
+
export declare const ldsMobileInstrumentation: import("o11y/dist/modules/o11y/client/interfaces").Instrumentation;
|
|
4
|
+
export declare function reportGraphqlQueryParseError(err: unknown): void;
|
|
5
|
+
export declare function reportGraphqlSqlEvalPreconditionError(err: unknown): void;
|
|
6
|
+
export declare function reportGraphqlCreateSnapshotError(err: unknown): void;
|
|
7
|
+
export declare function reportGraphQlEvalDbReadDuration(duration: number): void;
|
|
8
|
+
export declare function reportGraphqlAdapterError(errorCode: string): void;
|
|
9
|
+
export declare function reportDraftActionEvent(state: 'added' | 'completed' | 'deleted' | 'updated' | 'failed'): void;
|
|
10
|
+
export declare function reportDraftQueueState(state: 'started' | 'error' | 'waiting' | 'stopped'): void;
|
|
11
|
+
export declare function reportDraftAwareContentDocumentVersionSynthesizeError(err: unknown): void;
|
|
12
|
+
export declare function reportDraftAwareContentVersionSynthesizeCalls(mimeType: string): void;
|
|
13
|
+
/** Priming */
|
|
14
|
+
export declare function reportPrimingSessionCreated(): void;
|
|
15
|
+
export declare function reportPrimingError(errorType: string, recordCount: number): void;
|
|
16
|
+
export declare function reportPrimingSuccess(recordCount: number): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type WithInstrumentation = (operation: () => Promise<any>, config: InstrumentationConfig) => Promise<any>;
|
|
2
|
+
export interface InstrumentationConfig {
|
|
3
|
+
tags: Record<string, string>;
|
|
4
|
+
metricName: string;
|
|
5
|
+
logError: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* HOF (high-order-function) that instruments any async operation. If the operation
|
|
9
|
+
* has an error then the hasError param will be set on the call to o11y.incrementCounter
|
|
10
|
+
* and an "errorMessage" tag containing the Error.message will be added to the tags.
|
|
11
|
+
*/
|
|
12
|
+
export declare const withInstrumentation: <T>(operation: () => Promise<T>, config?: InstrumentationConfig) => Promise<T>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const FORMATTABLE_DISPLAY_VALUE_TYPES: string[];
|
|
2
|
+
/**
|
|
3
|
+
* Formats the display value for a draft field
|
|
4
|
+
* @param value the value to format
|
|
5
|
+
*/
|
|
6
|
+
export declare function formatDisplayValue(value: boolean | number | string | null, datatype: string): null | string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { getRuntime } from './runtime';
|
|
2
|
+
export { getRuntime };
|
|
3
|
+
export type { ObjectInfoService } from './utils/ObjectInfoService';
|
|
4
|
+
export type { ObservabilityContext } from '@salesforce/nimbus-plugin-lds';
|
|
5
|
+
export { registerReportObserver } from './instrumentation/instrumentMobileAdapter';
|
|
6
|
+
export { reportGraphqlQueryParseError } from './instrumentation/metrics';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MockNimbusBinaryStorePlugin, mockNimbusBinaryStorePlugin, } from './__tests__/MockNimbusBinaryStorePlugin.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PrimingNetworkAdapter } from '@salesforce/lds-priming';
|
|
2
|
+
import type { GraphQLRepresentation } from '@salesforce/lds-adapters-uiapi';
|
|
3
|
+
import type { LdsAbortController } from '@salesforce/lds-utils-adapters';
|
|
4
|
+
export declare class NimbusPrimingNetworkAdapter implements PrimingNetworkAdapter {
|
|
5
|
+
postGraphQL(query: string, variables: Record<string, any>, abortController: LdsAbortController): Promise<GraphQLRepresentation>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PrimingStore, RecordWithMetadata, WriteResult } from '@salesforce/lds-priming';
|
|
2
|
+
import type { Luvio } from '@luvio/engine';
|
|
3
|
+
import type { SqliteStore } from '@salesforce/lds-store-sql';
|
|
4
|
+
export declare class SqlitePrimingStore implements PrimingStore {
|
|
5
|
+
private readonly getLuvio;
|
|
6
|
+
private readonly store;
|
|
7
|
+
constructor(getLuvio: () => Luvio, store: SqliteStore);
|
|
8
|
+
writeRecords(records: RecordWithMetadata[]): Promise<WriteResult>;
|
|
9
|
+
private writeBatch;
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PrimingSession } from '@salesforce/lds-priming';
|
|
2
|
+
import type { Luvio } from '@luvio/engine';
|
|
3
|
+
import type { NimbusSqliteStore } from '../durableStore/NimbusSqliteStore/NimbusSqliteStore';
|
|
4
|
+
import type { ObjectInfoService } from '../main';
|
|
5
|
+
export interface PrimingSessionFactoryConfig {
|
|
6
|
+
store: NimbusSqliteStore;
|
|
7
|
+
objectInfoService: ObjectInfoService;
|
|
8
|
+
getLuvio: () => Luvio;
|
|
9
|
+
concurrency?: number;
|
|
10
|
+
batchSize?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function primingSessionFactory(config: PrimingSessionFactoryConfig): PrimingSession;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Luvio } from '@luvio/engine';
|
|
2
|
+
import { DraftManager } from '@salesforce/lds-drafts';
|
|
3
|
+
import type { DraftQueue } from '@salesforce/lds-drafts';
|
|
4
|
+
import type { PrimingSession } from '@salesforce/lds-priming';
|
|
5
|
+
export interface Runtime {
|
|
6
|
+
luvio: Luvio;
|
|
7
|
+
draftQueue: DraftQueue;
|
|
8
|
+
draftManager: DraftManager;
|
|
9
|
+
createPrimingSession: (config: {
|
|
10
|
+
concurrency?: number;
|
|
11
|
+
batchSize?: number;
|
|
12
|
+
}) => PrimingSession;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* This returns the LDS on Mobile Runtime singleton object.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getRuntime(): Runtime;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Adapter } from '@luvio/engine';
|
|
2
|
+
import type { DurableStore } from '@luvio/environments';
|
|
3
|
+
import type { ObjectInfoRepresentation, SimplifiedBatchRepresentation, getObjectInfoAdapterFactory, getObjectInfosAdapterFactory } from '@salesforce/lds-adapters-uiapi';
|
|
4
|
+
export declare const OBJECT_INFO_PREFIX_SEGMENT = "OBJECT_INFO_PREFIX_SEGMENT";
|
|
5
|
+
export interface ObjectInfoIndex {
|
|
6
|
+
apiName: string;
|
|
7
|
+
keyPrefix: string | null;
|
|
8
|
+
}
|
|
9
|
+
type ObjectInfoAdapterReturn = ReturnType<typeof getObjectInfoAdapterFactory>;
|
|
10
|
+
type ObjectInfosAdapterReturn = ReturnType<typeof getObjectInfosAdapterFactory>;
|
|
11
|
+
type ObjectInfoConfig = Parameters<ObjectInfoAdapterReturn>[0];
|
|
12
|
+
type ObjectInfosConfig = Parameters<ObjectInfosAdapterReturn>[0];
|
|
13
|
+
export type ObjectInfoMap = {
|
|
14
|
+
[apiName: string]: ObjectInfoRepresentation;
|
|
15
|
+
};
|
|
16
|
+
export declare class ObjectInfoService {
|
|
17
|
+
private getObjectInfoAdapter;
|
|
18
|
+
private getObjectInfosAdapter;
|
|
19
|
+
private durableStore;
|
|
20
|
+
objectInfoMemoryCache: {
|
|
21
|
+
[apiName: string]: string | null;
|
|
22
|
+
};
|
|
23
|
+
constructor(getObjectInfoAdapter: Adapter<ObjectInfoConfig, ObjectInfoRepresentation>, getObjectInfosAdapter: Adapter<ObjectInfosConfig, SimplifiedBatchRepresentation>, durableStore: DurableStore);
|
|
24
|
+
apiNameForPrefix: (prefix: string) => Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Size of return map not necessarily correlated with number of inputs. The
|
|
27
|
+
* ObjectInfoMap returned will only be populated with values of apiNames returned
|
|
28
|
+
* from the adapter.
|
|
29
|
+
*/
|
|
30
|
+
getObjectInfos(apiNames: string[]): Promise<ObjectInfoMap>;
|
|
31
|
+
ensureObjectInfoCached: (apiName: string, entry?: ObjectInfoRepresentation) => Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Caches ObjectInfo(ApiName and KeyPrefix) in Durable Store
|
|
34
|
+
*
|
|
35
|
+
* @param apiName eg: 'Account'
|
|
36
|
+
* @param objectInfo Object Info
|
|
37
|
+
*
|
|
38
|
+
* @returns Promise
|
|
39
|
+
*/
|
|
40
|
+
private createObjectInfoMapping;
|
|
41
|
+
private isObjectInfoInDurableStore;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { InMemoryStore, NetworkAdapter } from '@luvio/engine';
|
|
2
|
+
import { Luvio } from '@luvio/engine';
|
|
3
|
+
import type { DurableStore } from '@luvio/environments';
|
|
4
|
+
import type { EnsureCachedObjectInfoFunction } from '../environment/enableLazyObjectInfoCaching';
|
|
5
|
+
/**
|
|
6
|
+
Builds adapter instances for environments that have cross-adapter dependencies.
|
|
7
|
+
These are only to be used internally in this module and not exported.
|
|
8
|
+
They do not use draft environments, just the makeDurable environment.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildInternalAdapters(store: InMemoryStore, networkAdapter: NetworkAdapter, durableStore: DurableStore, ensureObjectInfoCached: EnsureCachedObjectInfoFunction): {
|
|
11
|
+
luvio: Luvio;
|
|
12
|
+
durableEnvironment: import("@luvio/environments").DurableEnvironment;
|
|
13
|
+
adapters: {
|
|
14
|
+
getRecord: import("@luvio/engine").Adapter<import("@salesforce/lds-adapters-uiapi").GetRecordConfig, import("@salesforce/lds-adapters-uiapi").RecordRepresentation>;
|
|
15
|
+
getObjectInfo: import("@luvio/engine").Adapter<import("@salesforce/lds-adapters-uiapi").GetObjectInfoConfig, import("@salesforce/lds-adapters-uiapi").ObjectInfoRepresentation>;
|
|
16
|
+
getObjectInfos: import("@luvio/engine").Adapter<import("@salesforce/lds-adapters-uiapi/dist/es/es2018/types/src/generated/adapters/getObjectInfos").GetObjectInfosConfig, import("@salesforce/lds-adapters-uiapi").SimplifiedBatchRepresentation>;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare const keys: {
|
|
2
|
+
(o: object): string[];
|
|
3
|
+
(o: {}): string[];
|
|
4
|
+
}, create: {
|
|
5
|
+
(o: object | null): any;
|
|
6
|
+
(o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
|
|
7
|
+
}, assign: {
|
|
8
|
+
<T extends {}, U>(target: T, source: U): T & U;
|
|
9
|
+
<T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
|
|
10
|
+
<T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
|
|
11
|
+
(target: object, ...sources: any[]): any;
|
|
12
|
+
}, entries: {
|
|
13
|
+
<T>(o: {
|
|
14
|
+
[s: string]: T;
|
|
15
|
+
} | ArrayLike<T>): [string, T][];
|
|
16
|
+
(o: {}): [string, any][];
|
|
17
|
+
};
|
|
18
|
+
declare const stringify: {
|
|
19
|
+
(value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
|
|
20
|
+
(value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string;
|
|
21
|
+
}, parse: (text: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => any;
|
|
22
|
+
declare const push: (...items: any[]) => number, join: (separator?: string | undefined) => string, slice: (start?: number | undefined, end?: number | undefined) => any[];
|
|
23
|
+
declare const isArray: (arg: any) => arg is any[], from: {
|
|
24
|
+
<T>(arrayLike: ArrayLike<T>): T[];
|
|
25
|
+
<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
26
|
+
<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
27
|
+
<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
28
|
+
};
|
|
29
|
+
export { keys as ObjectKeys, create as ObjectCreate, assign as ObjectAssign, entries as ObjectEntries, push as ArrayPrototypePush, join as ArrayPrototypeJoin, slice as ArrayPrototypeSlice, isArray as ArrayIsArray, from as ArrayFrom, stringify as JSONStringify, parse as JSONParse, };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A deterministic JSON stringify implementation. Heavily adapted from https://github.com/epoberezkin/fast-json-stable-stringify.
|
|
3
|
+
* This is needed because insertion order for JSON.stringify(object) affects output:
|
|
4
|
+
* JSON.stringify({a: 1, b: 2})
|
|
5
|
+
* "{"a":1,"b":2}"
|
|
6
|
+
* JSON.stringify({b: 2, a: 1})
|
|
7
|
+
* "{"b":2,"a":1}"
|
|
8
|
+
* Modified from the apex implementation to sort arrays non-destructively.
|
|
9
|
+
* @param data Data to be JSON-stringified.
|
|
10
|
+
* @returns JSON.stringified value with consistent ordering of keys.
|
|
11
|
+
*/
|
|
12
|
+
export declare function stableJSONStringify(node: any): string | undefined;
|
|
13
|
+
export declare function isPromise<D>(value: D | Promise<D> | null): value is Promise<D>;
|
package/package.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@salesforce/lds-runtime-mobile",
|
|
3
|
+
"version": "0.131.0",
|
|
4
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
+
"description": "LDS runtime for mobile/hybrid environments.",
|
|
6
|
+
"main": "dist/main.js",
|
|
7
|
+
"module": "dist/main.js",
|
|
8
|
+
"types": "dist/types/main.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"sfdc"
|
|
12
|
+
],
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/types/main.d.ts",
|
|
16
|
+
"import": "./dist/main.js",
|
|
17
|
+
"default": "./dist/main.js"
|
|
18
|
+
},
|
|
19
|
+
"./sfdc": {
|
|
20
|
+
"types": "./sfdc/types/main.d.ts",
|
|
21
|
+
"import": "./sfdc/main.js",
|
|
22
|
+
"default": "./sfdc/main.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"prepare": "yarn build",
|
|
27
|
+
"build": "rollup --config rollup.config.js",
|
|
28
|
+
"test:debug": "node --inspect-brk ../../node_modules/.bin/jest --runInBand",
|
|
29
|
+
"test:unit": "NODE_ENV=production jest",
|
|
30
|
+
"test:size": "luvioBundlesize",
|
|
31
|
+
"clean": "rm -rf dist sfdc",
|
|
32
|
+
"release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-mobile"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@salesforce/lds-adapters-uiapi": "1.131.0-244.6",
|
|
36
|
+
"@salesforce/lds-bindings": "1.131.0-244.6",
|
|
37
|
+
"@salesforce/lds-instrumentation": "1.131.0-244.6",
|
|
38
|
+
"@salesforce/lds-priming": "1.131.0-244.6",
|
|
39
|
+
"@salesforce/user": "0.0.12",
|
|
40
|
+
"o11y": "244.0.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@salesforce/lds-adapters-graphql": "1.131.0-244.6",
|
|
44
|
+
"@salesforce/lds-drafts": "1.131.0-244.6",
|
|
45
|
+
"@salesforce/lds-drafts-adapters-uiapi": "1.131.0-244.6",
|
|
46
|
+
"@salesforce/lds-graphql-eval": "1.131.0-244.6",
|
|
47
|
+
"@salesforce/lds-network-adapter": "1.131.0-244.6",
|
|
48
|
+
"@salesforce/lds-network-nimbus": "1.131.0-244.6",
|
|
49
|
+
"@salesforce/lds-store-binary": "1.131.0-244.6",
|
|
50
|
+
"@salesforce/lds-store-sql": "1.131.0-244.6",
|
|
51
|
+
"@salesforce/lds-utils-adapters": "1.131.0-244.6",
|
|
52
|
+
"@salesforce/nimbus-plugin-lds": "1.131.0-244.6",
|
|
53
|
+
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
54
|
+
"wait-for-expect": "^3.0.2"
|
|
55
|
+
},
|
|
56
|
+
"luvioBundlesize": [
|
|
57
|
+
{
|
|
58
|
+
"path": "./dist/main.js",
|
|
59
|
+
"maxSize": {
|
|
60
|
+
"none": "700 kB",
|
|
61
|
+
"min": "280 kB",
|
|
62
|
+
"compressed": "110 kB"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"path": "./sfdc/main.js",
|
|
67
|
+
"maxSize": {
|
|
68
|
+
"none": "700 kB",
|
|
69
|
+
"min": "280 kB",
|
|
70
|
+
"compressed": "110 kB"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"sfdc": {
|
|
75
|
+
"overrides": {
|
|
76
|
+
"artifacts": {
|
|
77
|
+
"main.js": {
|
|
78
|
+
"output": {
|
|
79
|
+
"path": "ui-bridge-components/modules/native/ldsRuntimeMobile/ldsRuntimeMobile.js"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"nx": {
|
|
86
|
+
"targets": {
|
|
87
|
+
"build": {
|
|
88
|
+
"outputs": [
|
|
89
|
+
"packages/lds-runtime-mobile/dist",
|
|
90
|
+
"packages/lds-runtime-mobile/sfdc",
|
|
91
|
+
"packages/lds-runtime-mobile/src/__tests__/fixtures"
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|