@salesforce/lds-worker-api 1.100.2
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/draftQueueImplementation.d.ts +2 -0
- package/dist/sfdc/es/executeAdapter.d.ts +71 -0
- package/dist/sfdc/es/language.d.ts +13 -0
- package/dist/sfdc/es/ldsWorkerApi.js +746 -0
- package/dist/sfdc/es/lightningAdapterApi.d.ts +11 -0
- package/dist/sfdc/es/main.d.ts +8 -0
- package/dist/sfdc/es/nimbusDraftQueue.d.ts +6 -0
- package/dist/sfdc/es/primingApi.d.ts +19 -0
- package/dist/sfdc/es/responses.d.ts +44 -0
- package/dist/sfdc/es/standalone-stubs/instrumentation.d.ts +21 -0
- package/dist/sfdc/es/standalone-stubs/o11y.d.ts +18 -0
- package/dist/sfdc/es/standalone-stubs/unwrap.d.ts +1 -0
- package/dist/sfdc/es/standalone.d.ts +1 -0
- package/dist/sfdc/es/ttl.d.ts +2 -0
- package/dist/standalone/es/draftQueueImplementation.d.ts +2 -0
- package/dist/standalone/es/executeAdapter.d.ts +71 -0
- package/dist/standalone/es/language.d.ts +13 -0
- package/dist/standalone/es/lds-runtime-mobile/src/__mocks__/@salesforce/i18n/currency.d.ts +2 -0
- package/dist/standalone/es/lds-runtime-mobile/src/__mocks__/@salesforce/i18n/dateTime.shortDateFormat.d.ts +2 -0
- package/dist/standalone/es/lds-runtime-mobile/src/__mocks__/@salesforce/i18n/dateTime.shortDateTimeFormat.d.ts +2 -0
- package/dist/standalone/es/lds-runtime-mobile/src/__mocks__/@salesforce/i18n/dateTime.shortTimeFormat.d.ts +2 -0
- package/dist/standalone/es/lds-runtime-mobile/src/__mocks__/@salesforce/i18n/locale.d.ts +2 -0
- package/dist/standalone/es/lds-runtime-mobile/src/__mocks__/@salesforce/i18n/timeZone.d.ts +2 -0
- package/dist/standalone/es/lds-runtime-mobile/src/__mocks__/@salesforce/user/Id.d.ts +2 -0
- package/dist/standalone/es/lds-runtime-mobile/src/__mocks__/lightning/i18nCldrOptions.d.ts +2 -0
- package/dist/standalone/es/lds-runtime-mobile/src/__mocks__/lightning/i18nService.d.ts +10 -0
- package/dist/standalone/es/lds-worker-api/src/standalone-stubs/unwrap.d.ts +1 -0
- package/dist/standalone/es/lds-worker-api.js +79227 -0
- package/dist/standalone/es/lightningAdapterApi.d.ts +11 -0
- package/dist/standalone/es/main.d.ts +8 -0
- package/dist/standalone/es/nimbusDraftQueue.d.ts +6 -0
- package/dist/standalone/es/primingApi.d.ts +19 -0
- package/dist/standalone/es/responses.d.ts +44 -0
- package/dist/standalone/es/standalone-stubs/instrumentation.d.ts +21 -0
- package/dist/standalone/es/standalone-stubs/o11y.d.ts +18 -0
- package/dist/standalone/es/standalone.d.ts +1 -0
- package/dist/standalone/es/ttl.d.ts +2 -0
- package/dist/standalone/umd/draftQueueImplementation.d.ts +2 -0
- package/dist/standalone/umd/executeAdapter.d.ts +71 -0
- package/dist/standalone/umd/language.d.ts +13 -0
- package/dist/standalone/umd/lds-runtime-mobile/src/__mocks__/@salesforce/i18n/currency.d.ts +2 -0
- package/dist/standalone/umd/lds-runtime-mobile/src/__mocks__/@salesforce/i18n/dateTime.shortDateFormat.d.ts +2 -0
- package/dist/standalone/umd/lds-runtime-mobile/src/__mocks__/@salesforce/i18n/dateTime.shortDateTimeFormat.d.ts +2 -0
- package/dist/standalone/umd/lds-runtime-mobile/src/__mocks__/@salesforce/i18n/dateTime.shortTimeFormat.d.ts +2 -0
- package/dist/standalone/umd/lds-runtime-mobile/src/__mocks__/@salesforce/i18n/locale.d.ts +2 -0
- package/dist/standalone/umd/lds-runtime-mobile/src/__mocks__/@salesforce/i18n/timeZone.d.ts +2 -0
- package/dist/standalone/umd/lds-runtime-mobile/src/__mocks__/@salesforce/user/Id.d.ts +2 -0
- package/dist/standalone/umd/lds-runtime-mobile/src/__mocks__/lightning/i18nCldrOptions.d.ts +2 -0
- package/dist/standalone/umd/lds-runtime-mobile/src/__mocks__/lightning/i18nService.d.ts +10 -0
- package/dist/standalone/umd/lds-worker-api/src/standalone-stubs/unwrap.d.ts +1 -0
- package/dist/standalone/umd/lds-worker-api.js +79250 -0
- package/dist/standalone/umd/lightningAdapterApi.d.ts +11 -0
- package/dist/standalone/umd/main.d.ts +8 -0
- package/dist/standalone/umd/nimbusDraftQueue.d.ts +6 -0
- package/dist/standalone/umd/primingApi.d.ts +19 -0
- package/dist/standalone/umd/responses.d.ts +44 -0
- package/dist/standalone/umd/standalone-stubs/instrumentation.d.ts +21 -0
- package/dist/standalone/umd/standalone-stubs/o11y.d.ts +18 -0
- package/dist/standalone/umd/standalone.d.ts +1 -0
- package/dist/standalone/umd/ttl.d.ts +2 -0
- package/package.json +74 -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 +517 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/createRecord/objectInfos/Pilot-objectInfo.network-mock.json +347 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/createRecord/scalar-displayValue-nonIntl-fallback-response.adapter-snapshot.result.json +82 -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 +82 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/createRecord/scalar-displayValue.adapter-testcase.json +23 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/adapter-forward-assignedtome.adapter-testcase.json +34 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/adapter-forward-baseline.adapter-testcase.json +24 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/adapter-forward-child-relationship.adapter-testcase.json +29 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/adapter-forward-parent-relationship.adapter-testcase.json +29 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/adapter-forward-reserved-entity-name.adapter-testcase.json +25 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/assignedtome.adapter-testcase.json +33 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/l2DataSet.js +250 -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/objectInfos/Account.network-mock.json +2784 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/AssignedResource.network-mock.json +863 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/Case.network-mock.json +1856 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/ServiceAppointment.network-mock.json +2888 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/ServiceResource.network-mock.json +1316 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/TimeSheetEntry.network-mock.json +977 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/WorkOrder.network-mock.json +3058 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectInfos/WorkType.network-mock.json +940 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/objectinfo.adapter-testcase.json +18 -0
- package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/graphQL/polyfield.adapter-testcase.json +43 -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/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/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/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/network-mock.schema.json +14 -0
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
type AdapterMapValue = Adapter<unknown, unknown> | ImperativeAdapter<unknown, unknown> | undefined;
|
|
7
|
+
type ImperativeAdapterMapValue = ImperativeAdapter<unknown, unknown> | undefined;
|
|
8
|
+
declare function getDMLAdapterFromName(name: string): AdapterMapValue;
|
|
9
|
+
declare function getImperativeAdapterFromName(name: string): ImperativeAdapterMapValue;
|
|
10
|
+
declare function getImperativeAdapterNames(): string[];
|
|
11
|
+
export { getImperativeAdapterFromName, getDMLAdapterFromName, getImperativeAdapterNames, gqlApi };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { subscribeToAdapter, invokeAdapter, invokeAdapterWithMetadata, invokeAdapterWithDraftToReplace, 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
|
+
export { subscribeToAdapter, invokeAdapter, invokeAdapterWithMetadata, invokeAdapterWithDraftToReplace, executeAdapter, executeMutatingAdapter, nimbusDraftQueue, draftQueue, draftManager, setUiApiRecordTTL, setMetadataTTL, registerReportObserver, getImperativeAdapterNames, createPrimingSession, };
|
|
@@ -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,19 @@
|
|
|
1
|
+
interface PrimingError {
|
|
2
|
+
ids: string[];
|
|
3
|
+
code: ErrorCode;
|
|
4
|
+
message: string;
|
|
5
|
+
}
|
|
6
|
+
type ErrorCode = 'precondition-error' | 'not-found' | 'service-unavailable' | 'unknown';
|
|
7
|
+
interface PrimingEventHandler {
|
|
8
|
+
onError?: (error: PrimingError) => void;
|
|
9
|
+
onPrimed?: (ids: string[]) => void;
|
|
10
|
+
}
|
|
11
|
+
export interface PrimingSessionConfig {
|
|
12
|
+
primingEventHandler?: PrimingEventHandler;
|
|
13
|
+
concurrency?: number;
|
|
14
|
+
batchSize?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function createPrimingSession(config: PrimingSessionConfig): {
|
|
17
|
+
enqueue: (work: PrimingWork) => Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
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,18 @@
|
|
|
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
|
+
export declare const mockInstrumentation: {
|
|
7
|
+
startActivity: typeof startActivity;
|
|
8
|
+
error: () => void;
|
|
9
|
+
trackValue: (_operation: string, _value: number, _hasError?: boolean, _tags?: MetricsTags) => void;
|
|
10
|
+
incrementCounter: (_operation: string, _increment?: number, _hasError?: boolean, _tags?: MetricsTags) => void;
|
|
11
|
+
};
|
|
12
|
+
export declare const getInstrumentation: () => {
|
|
13
|
+
startActivity: typeof startActivity;
|
|
14
|
+
error: () => void;
|
|
15
|
+
trackValue: (_operation: string, _value: number, _hasError?: boolean, _tags?: MetricsTags) => void;
|
|
16
|
+
incrementCounter: (_operation: string, _increment?: number, _hasError?: boolean, _tags?: MetricsTags) => void;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './main';
|
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@salesforce/lds-worker-api",
|
|
3
|
+
"version": "1.100.2",
|
|
4
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
+
"description": "",
|
|
6
|
+
"main": "dist/standalone/umd/lds-worker-api.js",
|
|
7
|
+
"module": "dist/standalone/es/lds-worker-api.js",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"src/__tests__/data-driven-tests/fixtures"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/standalone/es/lds-worker-api.js",
|
|
15
|
+
"require": "./dist/standalone/umd/lds-worker-api.js",
|
|
16
|
+
"types": "./dist/standalone/es/main.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./sfdc": {
|
|
19
|
+
"import": "./dist/sfdc/es/ldsWorkerApi.js",
|
|
20
|
+
"types": "./dist/sfdc/es/main.d.ts",
|
|
21
|
+
"default": "./dist/sfdc/es/ldsWorkerApi.js"
|
|
22
|
+
},
|
|
23
|
+
"./test-fixtures": {
|
|
24
|
+
"default": "./src/__tests__/data-driven-tests/fixtures"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"prepare": "yarn build",
|
|
29
|
+
"build": "rollup --config rollup.config.js",
|
|
30
|
+
"test:unit": "NODE_ENV=production jest",
|
|
31
|
+
"test:size": "bundlesize",
|
|
32
|
+
"clean": "rm -rf dist",
|
|
33
|
+
"release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-worker-api"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@luvio/adapter-test-library": "0.135.4",
|
|
37
|
+
"@luvio/engine": "0.135.4",
|
|
38
|
+
"@luvio/environments": "0.135.4",
|
|
39
|
+
"@oat-sa/rollup-plugin-wildcard-external": "^0.1.0",
|
|
40
|
+
"@salesforce/lds-adapters-graphql": "^1.100.2",
|
|
41
|
+
"@salesforce/lds-adapters-uiapi": "^1.100.2",
|
|
42
|
+
"@salesforce/lds-default-luvio": "^1.100.2",
|
|
43
|
+
"@salesforce/lds-drafts": "^1.100.2",
|
|
44
|
+
"@salesforce/lds-graphql-parser": "^1.100.2",
|
|
45
|
+
"@salesforce/lds-luvio-engine": "^1.100.2",
|
|
46
|
+
"@salesforce/lds-priming": "^1.100.2",
|
|
47
|
+
"@salesforce/lds-runtime-mobile": "^1.100.2",
|
|
48
|
+
"@salesforce/nimbus-plugin-lds": "^1.100.2",
|
|
49
|
+
"ajv": "^8.11.0",
|
|
50
|
+
"glob": "^7.1.5",
|
|
51
|
+
"nimbus-types": "^2.0.0-alpha1",
|
|
52
|
+
"o11y": "244.0.0",
|
|
53
|
+
"wait-for-expect": "^3.0.2"
|
|
54
|
+
},
|
|
55
|
+
"bundlesize": [
|
|
56
|
+
{
|
|
57
|
+
"path": "./dist/sfdc/es/ldsWorkerApi.js",
|
|
58
|
+
"maxSize": "7.5 kB",
|
|
59
|
+
"compression": "brotli"
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"sfdc": {
|
|
63
|
+
"overrides": {
|
|
64
|
+
"artifactDirectory": "dist/sfdc/es",
|
|
65
|
+
"artifacts": {
|
|
66
|
+
"ldsWorkerApi.js": {
|
|
67
|
+
"output": {
|
|
68
|
+
"path": "ui-bridge-components/modules/native/ldsWorkerApi/ldsWorkerApi.js"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
package/src/__tests__/data-driven-tests/fixtures/adapter-testcases/adapter-testcase.schema.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "./fixtures/adapter-testcases/adapter-testcase.schema.json",
|
|
4
|
+
"title": "Adapter Test Case",
|
|
5
|
+
"description": "A test case for Adapter, defining inputs, network responses, and expected outputs",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"testCaseName": {
|
|
9
|
+
"description": "The name of the test case.",
|
|
10
|
+
"type": "string"
|
|
11
|
+
},
|
|
12
|
+
"adapters": {
|
|
13
|
+
"description": "The adapters to invoke.",
|
|
14
|
+
"type": "array",
|
|
15
|
+
"items": {
|
|
16
|
+
"$ref": "#/$defs/Adapter"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"networkMocks": {
|
|
20
|
+
"description": "Mock network responses. Should be an array of paths to *.network-mock.json files (paths are relative to 'fixtures' folder).",
|
|
21
|
+
"type": "array",
|
|
22
|
+
"items": {
|
|
23
|
+
"type": "string"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"beforeJS": {
|
|
27
|
+
"description": "Javascript code to run at the beginning of the test case. Should be inline script or a path to *.js file. the stirng will be treated as a js file path if the string ends with .js",
|
|
28
|
+
"type": "string"
|
|
29
|
+
},
|
|
30
|
+
"afterJS": {
|
|
31
|
+
"description": "Javascript code to run at the end of the test case.",
|
|
32
|
+
"type": "string"
|
|
33
|
+
},
|
|
34
|
+
"l2DataSetPath": {
|
|
35
|
+
"description": "The data rows to populate into lds_data L2 table. Should be a path to *.tsv file. IMPORTANT: *.tsv uses tab as field separator. Default VSCode editor don't support tab character well. Install VSCode TSV plugin to solve it.",
|
|
36
|
+
"type": "string"
|
|
37
|
+
},
|
|
38
|
+
"freezeTime": {
|
|
39
|
+
"description": "If set to true then test runners MUST freeze time to 2020-01-01T00:00:00.000Z before the test and increment the frozen time by 1ms after each adapter is called, or else the adapter results will not be deterministic and adapter sequencing won't work. NOTE: Adapter/environment code uses either Date.now or 'new Date()' to get current time, so overriding Date.now() and Date.constructor is one potential way to freeze time.",
|
|
40
|
+
"type": "boolean"
|
|
41
|
+
},
|
|
42
|
+
"disabled": {
|
|
43
|
+
"description": "Should this test be disabled (ie: not picked automatically by test runner)?",
|
|
44
|
+
"type": "boolean"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"additionalProperties": false,
|
|
48
|
+
"required": ["testCaseName", "adapters"],
|
|
49
|
+
|
|
50
|
+
"$defs": {
|
|
51
|
+
"Adapter": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"properties": {
|
|
54
|
+
"name": {
|
|
55
|
+
"description": "The name of the adapter to invoke.",
|
|
56
|
+
"type": "string"
|
|
57
|
+
},
|
|
58
|
+
"config": {
|
|
59
|
+
"description": "The config to pass into the adapter.",
|
|
60
|
+
"type": "object"
|
|
61
|
+
},
|
|
62
|
+
"requestContext": {
|
|
63
|
+
"description": "The requestContext to pass into the adapter.",
|
|
64
|
+
"type": "object"
|
|
65
|
+
},
|
|
66
|
+
"expectedToSucceed": {
|
|
67
|
+
"description": "The adapter call expected to succeed or error out. If not specified, expectedSnapshot will be checked if expectedSnapshot specified",
|
|
68
|
+
"type": "boolean"
|
|
69
|
+
},
|
|
70
|
+
"expectedResult": {
|
|
71
|
+
"description": "The snapshot data/error that comes back from the adapter. Should be the path to a JSON file (relative to 'fixtures' folder).",
|
|
72
|
+
"type": "string"
|
|
73
|
+
},
|
|
74
|
+
"_comment": {
|
|
75
|
+
"description": "comment for the adapter purpose",
|
|
76
|
+
"type": "string"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"additionalProperties": false,
|
|
80
|
+
"required": ["name", "config"]
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"data": {
|
|
3
|
+
"apiName": "Aircraft",
|
|
4
|
+
"childRelationships": {},
|
|
5
|
+
"fields": {
|
|
6
|
+
"LastFliedBy": {
|
|
7
|
+
"displayValue": null,
|
|
8
|
+
"value": {
|
|
9
|
+
"apiName": "Pilot",
|
|
10
|
+
"childRelationships": {},
|
|
11
|
+
"fields": {
|
|
12
|
+
"FirstName": {
|
|
13
|
+
"displayValue": null,
|
|
14
|
+
"value": "Tom"
|
|
15
|
+
},
|
|
16
|
+
"LastName": {
|
|
17
|
+
"displayValue": null,
|
|
18
|
+
"value": "Hanks"
|
|
19
|
+
},
|
|
20
|
+
"Name": {
|
|
21
|
+
"displayValue": null,
|
|
22
|
+
"value": null
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"id": "a010GR4ORmHKPlBQNX",
|
|
26
|
+
"lastModifiedById": "005B0000000GR4OIAW",
|
|
27
|
+
"lastModifiedDate": "2020-01-01T00:00:00.001Z",
|
|
28
|
+
"recordTypeId": "012000000000000AAA",
|
|
29
|
+
"recordTypeInfo": null,
|
|
30
|
+
"systemModstamp": "2020-01-01T00:00:00.001Z",
|
|
31
|
+
"drafts": {
|
|
32
|
+
"created": true,
|
|
33
|
+
"edited": false,
|
|
34
|
+
"deleted": false,
|
|
35
|
+
"serverValues": {},
|
|
36
|
+
"draftActionIds": ["157783680000100"],
|
|
37
|
+
"latestDraftActionId": "157783680000100"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"LastFliedById": {
|
|
42
|
+
"displayValue": null,
|
|
43
|
+
"value": "a010GR4ORmHKPlBQNX"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"id": "a0w0GR4ORmHKPlCQNX",
|
|
47
|
+
"lastModifiedById": "005B0000000GR4OIAW",
|
|
48
|
+
"lastModifiedDate": "2020-01-01T00:00:00.003Z",
|
|
49
|
+
"recordTypeId": "012000000000000AAA",
|
|
50
|
+
"recordTypeInfo": null,
|
|
51
|
+
"systemModstamp": "2020-01-01T00:00:00.002Z",
|
|
52
|
+
"drafts": {
|
|
53
|
+
"created": true,
|
|
54
|
+
"edited": true,
|
|
55
|
+
"deleted": false,
|
|
56
|
+
"serverValues": {},
|
|
57
|
+
"draftActionIds": ["157783680000200", "157783680000300"],
|
|
58
|
+
"latestDraftActionId": "157783680000300"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"testCaseName": "updateRecord shows correct name.displayValue for nested record",
|
|
3
|
+
"adapters": [
|
|
4
|
+
{
|
|
5
|
+
"_comment": "create pilot Chesley Burnett",
|
|
6
|
+
"name": "createRecord",
|
|
7
|
+
"config": {
|
|
8
|
+
"apiName": "Pilot",
|
|
9
|
+
"fields": {
|
|
10
|
+
"FirstName": "Chesley",
|
|
11
|
+
"LastName": "Burnett"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"_comment": "create pilot Tom Hanks",
|
|
17
|
+
"name": "createRecord",
|
|
18
|
+
"config": {
|
|
19
|
+
"apiName": "Pilot",
|
|
20
|
+
"fields": {
|
|
21
|
+
"FirstName": "Tom",
|
|
22
|
+
"LastName": "Hanks"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"_comment": "create record aircraft(Boeing 737) last flied by Chesley Burnett",
|
|
28
|
+
"name": "createRecord",
|
|
29
|
+
"config": {
|
|
30
|
+
"apiName": "Aircraft",
|
|
31
|
+
"fields": {
|
|
32
|
+
"Name": "Boeing 737 9765",
|
|
33
|
+
"LastFliedById": "a010GR4ORmHKPlAQNX"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"_comment": "update Boeing 737 record last flied by to Tom Hanks",
|
|
39
|
+
"name": "updateRecord",
|
|
40
|
+
"config": {
|
|
41
|
+
"recordId": "a0w0GR4ORmHKPlCQNX",
|
|
42
|
+
"fields": {
|
|
43
|
+
"LastFliedById": "a010GR4ORmHKPlBQNX"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"_comment": "get Boeing 737 record last flied by name",
|
|
49
|
+
"name": "getRecord",
|
|
50
|
+
"config": {
|
|
51
|
+
"recordId": "a0w0GR4ORmHKPlCQNX",
|
|
52
|
+
"fields": [
|
|
53
|
+
"Aircraft.LastFliedById",
|
|
54
|
+
"Aircraft.LastFliedBy.Name",
|
|
55
|
+
"Aircraft.LastFliedBy.FirstName",
|
|
56
|
+
"Aircraft.LastFliedBy.LastName"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"expectedResult": "./adapter-testcases/createRecord/name-displayValue-response.adapter-snapshot.result.json"
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"networkMocks": [
|
|
63
|
+
"./adapter-testcases/createRecord/objectInfos/Pilot-objectInfo.network-mock.json",
|
|
64
|
+
"./adapter-testcases/createRecord/objectInfos/Aircraft-objectInfo.network-mock.json"
|
|
65
|
+
],
|
|
66
|
+
"freezeTime": true
|
|
67
|
+
}
|