@lingxia/types 0.17.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automation/index.d.ts +1039 -128
- package/dist/automation/index.d.ts.map +1 -1
- package/dist/automation/index.js +61 -3
- package/dist/automation/index.js.map +1 -1
- package/dist/error.d.ts +19 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +23 -1
- package/dist/error.js.map +1 -1
- package/dist/esm/automation/index.js +60 -4
- package/dist/esm/automation/index.js.map +1 -1
- package/dist/esm/error.js +21 -0
- package/dist/esm/error.js.map +1 -1
- package/dist/esm/generated/error.js +1 -0
- package/dist/esm/generated/error.js.map +1 -1
- package/dist/esm/generated/i18n.js +10 -1
- package/dist/esm/generated/i18n.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/mocks.js +2 -0
- package/dist/esm/mocks.js.map +1 -0
- package/dist/esm/page.js +2 -0
- package/dist/esm/page.js.map +1 -0
- package/dist/esm/testing/public-api.js +133 -48
- package/dist/esm/testing/public-api.js.map +1 -1
- package/dist/generated/error.d.ts +4 -0
- package/dist/generated/error.d.ts.map +1 -1
- package/dist/generated/error.js +1 -0
- package/dist/generated/error.js.map +1 -1
- package/dist/generated/i18n.d.ts +1 -1
- package/dist/generated/i18n.d.ts.map +1 -1
- package/dist/generated/i18n.js +10 -1
- package/dist/generated/i18n.js.map +1 -1
- package/dist/generated/logic-web.d.ts +24 -3
- package/dist/generated/logic.d.ts +772 -381
- package/dist/generated/logic.d.ts.map +1 -1
- package/dist/index.d.ts +17 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mocks.d.ts +58 -0
- package/dist/mocks.d.ts.map +1 -0
- package/dist/mocks.js +3 -0
- package/dist/mocks.js.map +1 -0
- package/dist/page.d.ts +26 -0
- package/dist/page.d.ts.map +1 -0
- package/dist/page.js +3 -0
- package/dist/page.js.map +1 -0
- package/dist/process.d.ts +15 -4
- package/dist/process.d.ts.map +1 -1
- package/dist/testing/public-api.d.ts +127 -51
- package/dist/testing/public-api.d.ts.map +1 -1
- package/dist/testing/public-api.js +133 -48
- package/dist/testing/public-api.js.map +1 -1
- package/package.json +8 -5
- package/src/automation/index.ts +1066 -128
- package/src/error.ts +23 -0
- package/src/generated/error.ts +1 -0
- package/src/generated/i18n.ts +10 -1
- package/src/generated/logic-web.d.ts +24 -3
- package/src/generated/logic.ts +830 -405
- package/src/index.ts +19 -10
- package/src/mocks.ts +62 -0
- package/src/page.ts +26 -0
- package/src/process.ts +14 -4
- package/src/testing/public-api.ts +155 -49
- package/dist/automation-test-globals.d.ts +0 -14
package/src/index.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
export * from './generated/logic.js';
|
|
8
8
|
export type { Automation } from './automation/index.js';
|
|
9
|
+
export type { MockAnswer, MockContext, MockHandler, MockRequest, Mocks } from './mocks.js';
|
|
9
10
|
export * from './error.js';
|
|
10
11
|
export * from './generated/error.js';
|
|
11
12
|
export * from './generated/i18n.js';
|
|
@@ -18,7 +19,9 @@ import type {
|
|
|
18
19
|
AppLifecycleName,
|
|
19
20
|
BinaryFileData,
|
|
20
21
|
FsWriteOptions,
|
|
22
|
+
ManagedPath,
|
|
21
23
|
NoLifecycleTypos,
|
|
24
|
+
NoReservedPageMembers,
|
|
22
25
|
PageConfig,
|
|
23
26
|
PageInstance,
|
|
24
27
|
PageLifecycleName,
|
|
@@ -36,19 +39,24 @@ declare global {
|
|
|
36
39
|
* signature above covers the string case.
|
|
37
40
|
*/
|
|
38
41
|
write(
|
|
39
|
-
path:
|
|
42
|
+
path: ManagedPath,
|
|
40
43
|
data: BinaryFileData,
|
|
41
|
-
options?: Omit<FsWriteOptions, 'encoding'>
|
|
44
|
+
options?: Omit<FsWriteOptions, 'encoding'> & { encoding?: never }
|
|
42
45
|
): Promise<void>;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
interface Lx {
|
|
46
49
|
/**
|
|
47
|
-
* In-process UI/runtime automation.
|
|
50
|
+
* In-process UI/runtime automation, as app Logic may use it.
|
|
48
51
|
*
|
|
49
|
-
* Select the
|
|
50
|
-
* `.lxapp(appid)
|
|
51
|
-
*
|
|
52
|
+
* Select the calling app with `.lxapp()` (requires the `automation`
|
|
53
|
+
* privilege) or another running app with `.lxapp(appid)`; the host tiers
|
|
54
|
+
* (`lxapps`, `browser`, `shell`, `device`, `desktop`, `terminal`) require
|
|
55
|
+
* `host`, checked when the property is read. A privilege holds only when
|
|
56
|
+
* it is allowed for the app and the native host sealed a session grant
|
|
57
|
+
* for it; `lingxia dev` and the Runner do not widen that. Test-run-only
|
|
58
|
+
* members (`network`, nav `waitUntil: 'ready'`) belong to
|
|
59
|
+
* `HostRunAutomation`, the root of an `lxdev test` program.
|
|
52
60
|
*/
|
|
53
61
|
automation(): Automation;
|
|
54
62
|
}
|
|
@@ -69,14 +77,15 @@ declare global {
|
|
|
69
77
|
function getApp<T extends AppInstance = AppInstance>(): T | null;
|
|
70
78
|
/**
|
|
71
79
|
* `TData` comes from `data`, `TCustom` from everything else you declare, so
|
|
72
|
-
* `this.data` is
|
|
73
|
-
* top-level keys against `data`.
|
|
80
|
+
* `this.data` is a readonly view of that type, `this.myMethod()` resolves,
|
|
81
|
+
* and `setData` checks top-level keys against `data`.
|
|
74
82
|
*/
|
|
75
|
-
function Page<TData extends
|
|
83
|
+
function Page<TData extends object, TCustom>(
|
|
76
84
|
config: PageConfig<TData> &
|
|
77
85
|
TCustom &
|
|
78
86
|
NoLifecycleTypos<TCustom, PageLifecycleName> &
|
|
79
|
-
|
|
87
|
+
NoReservedPageMembers<TCustom> &
|
|
88
|
+
ThisType<PageInstance<TData> & Omit<TCustom, keyof PageInstance>>
|
|
80
89
|
): void;
|
|
81
90
|
function getCurrentPages<T extends PageInstance = PageInstance>(): T[];
|
|
82
91
|
}
|
package/src/mocks.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for an lxapp's `mocks/index.ts`: the complete set of mock
|
|
3
|
+
* handlers, one per call the app makes, answered in development when the
|
|
4
|
+
* mock selection says so (`mocks/config.json`, `lingxia dev --mock`,
|
|
5
|
+
* `lxdev mock`). Import them type-only; mocks never ship:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import type { Mocks } from '@lingxia/types/mocks';
|
|
9
|
+
*
|
|
10
|
+
* let signedIn = true; // module state: fresh on save, reset, restart and each spec
|
|
11
|
+
*
|
|
12
|
+
* export default {
|
|
13
|
+
* 'GET **\/devices': () => (signedIn ? { json: DEVICES } : { status: 401 }),
|
|
14
|
+
* 'DELETE **\/sessions/current': () => { signedIn = false; return { status: 204 }; },
|
|
15
|
+
* 'GET **\/legal': { json: [] },
|
|
16
|
+
* } satisfies Mocks;
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
import type { NetworkRouteAnswer } from './automation/index.js';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* What a handler answers: exactly a route answer — `{ status?, headers?,
|
|
23
|
+
* json | body, contentType?, delay? }`, `{ abort: 'failed' }`,
|
|
24
|
+
* `{ hang: true }`, `{ sse: [...] }`, or `{ continue: true, patchJson? }`
|
|
25
|
+
* (the real backend answers). One answer per call: `sequence`, `times`,
|
|
26
|
+
* `match` and `bodyBase64` are scenario fields.
|
|
27
|
+
*/
|
|
28
|
+
export type MockAnswer = NetworkRouteAnswer;
|
|
29
|
+
|
|
30
|
+
/** The call a handler answers. */
|
|
31
|
+
export type MockRequest = {
|
|
32
|
+
/** Fetch cancellation when supplied; null otherwise (including SSE). */
|
|
33
|
+
signal: AbortSignal | null;
|
|
34
|
+
/** Upper-case. */
|
|
35
|
+
method: string;
|
|
36
|
+
url: URL;
|
|
37
|
+
/** What the app sent. */
|
|
38
|
+
headers: Headers;
|
|
39
|
+
/** The body as text; rejects for a stream, `Blob` or `FormData` body. */
|
|
40
|
+
text(): Promise<string>;
|
|
41
|
+
json<T = unknown>(): Promise<T>;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** What a handler can use besides the request. */
|
|
45
|
+
export type MockContext = {
|
|
46
|
+
/** The original `fetch`, not intercepted: proxy without recursing. */
|
|
47
|
+
fetch: typeof fetch;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Answers one call. Throwing, returning `undefined` or an invalid answer
|
|
52
|
+
* fails the request (`TypeError: fetch failed`); it never falls through to
|
|
53
|
+
* the real backend.
|
|
54
|
+
*/
|
|
55
|
+
export type MockHandler = (req: MockRequest, ctx: MockContext) => MockAnswer | Promise<MockAnswer>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The default export of `mocks/index.ts`: keys are HTTP targets
|
|
59
|
+
* (`'GET **\/devices/*'`, `'* **\/x'`, `'POST /regex/'`), tried in order;
|
|
60
|
+
* values are answers or handlers.
|
|
61
|
+
*/
|
|
62
|
+
export type Mocks = Record<string, MockAnswer | MockHandler>;
|
package/src/page.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `T` where every value survives the JSON transfer `setData` makes to the
|
|
3
|
+
* View; a function, Date, Map, Set, promise or class instance becomes
|
|
4
|
+
* `never`, so a contract holding one does not compile. `undefined` members
|
|
5
|
+
* are allowed: the transfer drops them, as an optional member reads.
|
|
6
|
+
*/
|
|
7
|
+
export type JsonData<T> =
|
|
8
|
+
0 extends 1 & T ? any
|
|
9
|
+
: unknown extends T ? unknown
|
|
10
|
+
: T extends string | number | boolean | null | undefined ? T
|
|
11
|
+
: T extends (...args: never[]) => unknown ? never
|
|
12
|
+
: T extends Date | RegExp | Map<unknown, unknown> | Set<unknown> | PromiseLike<unknown> | symbol | bigint ? never
|
|
13
|
+
: T extends readonly unknown[] ? { [K in keyof T]: JsonData<T[K]> }
|
|
14
|
+
: T extends object ? { [K in keyof T]: JsonData<T[K]> }
|
|
15
|
+
: never;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A shared, type-only page contract: the page's `data` and public actions,
|
|
19
|
+
* written once and used by Logic, View and tests. Importing it installs no
|
|
20
|
+
* Logic globals. `Data` must be JSON (see `JsonData`); otherwise the
|
|
21
|
+
* contract has no `data`, and every use of it names the problem.
|
|
22
|
+
*/
|
|
23
|
+
export type PageContract<Data = unknown, Actions = unknown> =
|
|
24
|
+
[Data] extends [JsonData<Data>]
|
|
25
|
+
? { readonly data: Data; readonly actions: Actions }
|
|
26
|
+
: { readonly __pageDataMustBeJson: "PageContract data must be JSON: no functions, Dates, Maps, Sets or class instances" };
|
package/src/process.ts
CHANGED
|
@@ -31,6 +31,14 @@ export interface RongSpawnOptionsWithCmd extends RongSpawnOptions {
|
|
|
31
31
|
cmd: string[];
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/** Synchronous spawning cannot deliver async callbacks or react to an AbortSignal. */
|
|
35
|
+
export type RongSpawnSyncOptions = Omit<RongSpawnOptions, 'onExit' | 'signal' | 'killSignal'> & {
|
|
36
|
+
onExit?: never;
|
|
37
|
+
signal?: never;
|
|
38
|
+
killSignal?: never;
|
|
39
|
+
};
|
|
40
|
+
export type RongSpawnSyncOptionsWithCmd = RongSpawnSyncOptions & { cmd: string[] };
|
|
41
|
+
|
|
34
42
|
export interface RongSyncSubprocess {
|
|
35
43
|
readonly exitCode: number | null;
|
|
36
44
|
readonly success: boolean;
|
|
@@ -96,8 +104,10 @@ export interface RongShellCommand extends PromiseLike<RongShellResult> {
|
|
|
96
104
|
export interface RongShellTag {
|
|
97
105
|
(strings: TemplateStringsArray, ...values: unknown[]): RongShellCommand;
|
|
98
106
|
(command: string): RongShellCommand;
|
|
99
|
-
cwd(
|
|
100
|
-
|
|
107
|
+
cwd(): string | undefined;
|
|
108
|
+
cwd(path: string): RongShellTag;
|
|
109
|
+
env(): RongEnvMap | undefined;
|
|
110
|
+
env(values: RongEnvMap): RongShellTag;
|
|
101
111
|
throws(value?: boolean): RongShellTag;
|
|
102
112
|
nothrow(): RongShellTag;
|
|
103
113
|
quiet(): RongShellTag;
|
|
@@ -122,8 +132,8 @@ declare global {
|
|
|
122
132
|
readonly stderr: RongOutputHandle;
|
|
123
133
|
spawn(cmd: string[], options?: RongSpawnOptions): RongSubprocess;
|
|
124
134
|
spawn(options: RongSpawnOptionsWithCmd): RongSubprocess;
|
|
125
|
-
spawnSync(cmd: string[], options?:
|
|
126
|
-
spawnSync(options:
|
|
135
|
+
spawnSync(cmd: string[], options?: RongSpawnSyncOptions): RongSyncSubprocess;
|
|
136
|
+
spawnSync(options: RongSpawnSyncOptionsWithCmd): RongSyncSubprocess;
|
|
127
137
|
readonly $: RongShellTag;
|
|
128
138
|
readonly ShellError: {
|
|
129
139
|
new (message: string): RongShellError;
|
|
@@ -2,6 +2,8 @@ import type {
|
|
|
2
2
|
Automation,
|
|
3
3
|
BrowserCookies,
|
|
4
4
|
BrowserDriver,
|
|
5
|
+
ClockDriver,
|
|
6
|
+
DialogDriver,
|
|
5
7
|
DesktopApp,
|
|
6
8
|
DesktopAx,
|
|
7
9
|
DesktopClipboard,
|
|
@@ -14,8 +16,13 @@ import type {
|
|
|
14
16
|
DeviceDriver,
|
|
15
17
|
LxAppDriver,
|
|
16
18
|
LxAppManager,
|
|
19
|
+
MockDriver,
|
|
17
20
|
NavDriver,
|
|
21
|
+
NetworkDriver,
|
|
22
|
+
NetworkRoute,
|
|
23
|
+
Scenario,
|
|
18
24
|
PageDriver,
|
|
25
|
+
ProfileDriver,
|
|
19
26
|
PageKey,
|
|
20
27
|
PagePointer,
|
|
21
28
|
ShellDriver,
|
|
@@ -25,18 +32,21 @@ import type {
|
|
|
25
32
|
AppearanceApi,
|
|
26
33
|
AppCacheApi,
|
|
27
34
|
AutostartApi,
|
|
35
|
+
BannerApi,
|
|
28
36
|
CompressVideoTask,
|
|
29
37
|
ControlApi,
|
|
30
38
|
ControlAppearanceApi,
|
|
31
39
|
ControlDisplayLanguageApi,
|
|
32
40
|
DisplayLanguageApi,
|
|
33
41
|
DownloadTask,
|
|
42
|
+
ClipboardApi,
|
|
34
43
|
FileSystemApi,
|
|
35
44
|
HostAppApi,
|
|
36
45
|
HostAppUpdateInfo,
|
|
37
46
|
HostAppUpdateTask,
|
|
38
47
|
LxFile,
|
|
39
48
|
NavigationBarApi,
|
|
49
|
+
NotificationApi,
|
|
40
50
|
PageMessagePort,
|
|
41
51
|
PreviewMediaHandle,
|
|
42
52
|
TabSurface,
|
|
@@ -57,11 +67,16 @@ import type {
|
|
|
57
67
|
} from '../generated/logic.js';
|
|
58
68
|
|
|
59
69
|
export const LX_API_NAMES = [
|
|
60
|
-
'
|
|
70
|
+
'host',
|
|
61
71
|
'automation',
|
|
72
|
+
'alert',
|
|
73
|
+
'confirm',
|
|
74
|
+
'pickFile',
|
|
75
|
+
'pickFiles',
|
|
62
76
|
'chooseDirectory',
|
|
63
77
|
'chooseFile',
|
|
64
78
|
'chooseMedia',
|
|
79
|
+
'clipboard',
|
|
65
80
|
'compressImage',
|
|
66
81
|
'compressVideo',
|
|
67
82
|
'connectWifi',
|
|
@@ -127,22 +142,40 @@ export const LX_API_NAMES = [
|
|
|
127
142
|
const HOST_APP_API = [
|
|
128
143
|
'appearance',
|
|
129
144
|
'autostart',
|
|
145
|
+
'banner',
|
|
130
146
|
'cache',
|
|
131
147
|
'checkUpdate',
|
|
148
|
+
'claimCustomUpdate',
|
|
132
149
|
'control',
|
|
133
150
|
'displayLanguage',
|
|
134
151
|
'env',
|
|
135
152
|
'exit',
|
|
136
153
|
'getBaseInfo',
|
|
154
|
+
'getServiceEnv',
|
|
155
|
+
'notification',
|
|
137
156
|
'screenshot',
|
|
138
157
|
'setBadge',
|
|
158
|
+
'toggleServiceEnv',
|
|
139
159
|
] as const;
|
|
140
|
-
// `autostart`, `control`, and `
|
|
141
|
-
// runtime walk of `lx.
|
|
160
|
+
// `autostart`, `banner`, `control`, `cache`, and `notification` are injected
|
|
161
|
+
// only where they apply, so a runtime walk of `lx.host` must not require them.
|
|
142
162
|
const HOST_APP_RUNTIME_API = HOST_APP_API.filter(
|
|
143
|
-
(name) =>
|
|
163
|
+
(name) =>
|
|
164
|
+
name !== 'autostart' &&
|
|
165
|
+
name !== 'banner' &&
|
|
166
|
+
name !== 'control' &&
|
|
167
|
+
name !== 'cache' &&
|
|
168
|
+
name !== 'notification',
|
|
144
169
|
);
|
|
145
170
|
const AUTOSTART_API = ['isEnabled', 'setEnabled'] as const;
|
|
171
|
+
const BANNER_API = ['dismiss', 'show'] as const;
|
|
172
|
+
const NOTIFICATION_API = [
|
|
173
|
+
'cancel',
|
|
174
|
+
'cancelAll',
|
|
175
|
+
'getPermission',
|
|
176
|
+
'requestPermission',
|
|
177
|
+
'show',
|
|
178
|
+
] as const;
|
|
146
179
|
const APP_CACHE_API = ['clear', 'size'] as const;
|
|
147
180
|
const DISPLAY_LANGUAGE_API = ['get', 'watch'] as const;
|
|
148
181
|
const CONTROL_API = ['appearance', 'displayLanguage'] as const;
|
|
@@ -166,10 +199,11 @@ const TERMINAL_FONTS_API = ['list'] as const;
|
|
|
166
199
|
const TERMINAL_PREVIEW_API = ['clear', 'close', 'show'] as const;
|
|
167
200
|
const WINDOWS_TERMINAL_API = ['install', 'setEnabled', 'status'] as const;
|
|
168
201
|
const ENV_API = ['USER_CACHE_PATH', 'USER_DATA_PATH'] as const;
|
|
169
|
-
const SURFACE_NAMESPACE_API = ['
|
|
202
|
+
const SURFACE_NAMESPACE_API = ['getByKey', 'watchContext', 'openDeclared', 'openPage', 'openUrl'] as const;
|
|
170
203
|
const SHELL_API = ['openApp', 'openBuiltin', 'openDeclared', 'reconfigure', 'sidebarActions'] as const;
|
|
171
204
|
const SHELL_SIDEBAR_ACTIONS_API = ['clear', 'remove', 'replace', 'update'] as const;
|
|
172
|
-
const TRAY_API = ['hide', 'onClick', '
|
|
205
|
+
const TRAY_API = ['hide', 'onClick', 'setIcon', 'setMenu', 'setTitle', 'show'] as const;
|
|
206
|
+
const CLIPBOARD_API = ['clear', 'read', 'readText', 'types', 'write', 'writeText'] as const;
|
|
173
207
|
const FILE_SYSTEM_API = [
|
|
174
208
|
'copy',
|
|
175
209
|
'exists',
|
|
@@ -212,9 +246,26 @@ const AUTOMATION_API = [
|
|
|
212
246
|
'shell',
|
|
213
247
|
'terminal',
|
|
214
248
|
] as const;
|
|
215
|
-
const SHELL_DRIVER_API = ['pins', 'setPin'] as const;
|
|
249
|
+
const SHELL_DRIVER_API = ['pins', 'setPin', 'reorderPins'] as const;
|
|
216
250
|
const TERMINAL_DRIVER_API = ['input', 'newTab', 'setMaximized', 'snapshot', 'split'] as const;
|
|
217
|
-
const LXAPP_DRIVER_API = ['eval', 'info', 'nav', 'page', 'pages', 'surfaceLayout'] as const;
|
|
251
|
+
const LXAPP_DRIVER_API = ['clock', 'dialogs', 'eval', 'info', 'mock', 'nav', 'network', 'page', 'pages', 'profile', 'surfaceLayout'] as const;
|
|
252
|
+
const MOCK_DRIVER_API = ['reset', 'use'] as const;
|
|
253
|
+
const CLOCK_DRIVER_API = ['install', 'runAll', 'setSystemTime', 'tick', 'uninstall'] as const;
|
|
254
|
+
const DIALOG_DRIVER_API = [
|
|
255
|
+
'actionSheets',
|
|
256
|
+
'answerNextActionSheet',
|
|
257
|
+
'answerNextModal',
|
|
258
|
+
'modals',
|
|
259
|
+
'setAnswerMode',
|
|
260
|
+
'toasts',
|
|
261
|
+
'unanswered',
|
|
262
|
+
'unwatch',
|
|
263
|
+
'watch',
|
|
264
|
+
] as const;
|
|
265
|
+
const PROFILE_DRIVER_API = ['checkpoint', 'drop', 'restore'] as const;
|
|
266
|
+
const NETWORK_DRIVER_API = ['captureResponses', 'requests', 'responses', 'route', 'unrouteAll'] as const;
|
|
267
|
+
const NETWORK_ROUTE_API = ['id', 'pattern', 'requests', 'requestsAfter', 'unroute'] as const;
|
|
268
|
+
const SCENARIO_API = ['calls', 'callsAfter', 'name', 'rules', 'unroute', 'variant'] as const;
|
|
218
269
|
const LXAPP_MANAGER_API = [
|
|
219
270
|
'applink',
|
|
220
271
|
'close',
|
|
@@ -227,6 +278,7 @@ const LXAPP_MANAGER_API = [
|
|
|
227
278
|
'windows',
|
|
228
279
|
] as const;
|
|
229
280
|
const PAGE_DRIVER_API = [
|
|
281
|
+
'action',
|
|
230
282
|
'click',
|
|
231
283
|
'eval',
|
|
232
284
|
'fill',
|
|
@@ -333,9 +385,10 @@ export const LX_RUNTIME_SURFACES = [
|
|
|
333
385
|
members: LX_API_NAMES,
|
|
334
386
|
optionalMembers: ['terminal'],
|
|
335
387
|
properties: [
|
|
336
|
-
'
|
|
388
|
+
'clipboard',
|
|
337
389
|
'env',
|
|
338
390
|
'fs',
|
|
391
|
+
'host',
|
|
339
392
|
'navigationBar',
|
|
340
393
|
'shell',
|
|
341
394
|
'surface',
|
|
@@ -345,57 +398,71 @@ export const LX_RUNTIME_SURFACES = [
|
|
|
345
398
|
],
|
|
346
399
|
},
|
|
347
400
|
{
|
|
348
|
-
name: 'lx.
|
|
401
|
+
name: 'lx.host',
|
|
349
402
|
layer: 'logic',
|
|
350
|
-
expression: 'lx.
|
|
403
|
+
expression: 'lx.host',
|
|
351
404
|
members: HOST_APP_RUNTIME_API,
|
|
352
405
|
properties: ['appearance', 'displayLanguage', 'env'],
|
|
353
406
|
},
|
|
354
407
|
{
|
|
355
|
-
name: 'lx.
|
|
408
|
+
name: 'lx.host.autostart',
|
|
356
409
|
layer: 'logic',
|
|
357
|
-
expression: 'lx.
|
|
410
|
+
expression: 'lx.host.autostart',
|
|
358
411
|
members: AUTOSTART_API,
|
|
359
412
|
optional: true,
|
|
360
413
|
},
|
|
361
414
|
{
|
|
362
|
-
name: 'lx.
|
|
415
|
+
name: 'lx.host.banner',
|
|
416
|
+
layer: 'logic',
|
|
417
|
+
expression: 'lx.host.banner',
|
|
418
|
+
members: BANNER_API,
|
|
419
|
+
optional: true,
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
name: 'lx.host.notification',
|
|
363
423
|
layer: 'logic',
|
|
364
|
-
expression: 'lx.
|
|
424
|
+
expression: 'lx.host.notification',
|
|
425
|
+
members: NOTIFICATION_API,
|
|
426
|
+
optional: true,
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
name: 'lx.host.cache',
|
|
430
|
+
layer: 'logic',
|
|
431
|
+
expression: 'lx.host.cache',
|
|
365
432
|
members: APP_CACHE_API,
|
|
366
433
|
optional: true,
|
|
367
434
|
},
|
|
368
435
|
{
|
|
369
|
-
name: 'lx.
|
|
436
|
+
name: 'lx.host.displayLanguage',
|
|
370
437
|
layer: 'logic',
|
|
371
|
-
expression: 'lx.
|
|
438
|
+
expression: 'lx.host.displayLanguage',
|
|
372
439
|
members: DISPLAY_LANGUAGE_API,
|
|
373
440
|
},
|
|
374
441
|
{
|
|
375
|
-
name: 'lx.
|
|
442
|
+
name: 'lx.host.control',
|
|
376
443
|
layer: 'logic',
|
|
377
|
-
expression: 'lx.
|
|
444
|
+
expression: 'lx.host.control',
|
|
378
445
|
members: CONTROL_API,
|
|
379
446
|
properties: CONTROL_API,
|
|
380
447
|
optional: true,
|
|
381
448
|
},
|
|
382
449
|
{
|
|
383
|
-
name: 'lx.
|
|
450
|
+
name: 'lx.host.control.displayLanguage',
|
|
384
451
|
layer: 'logic',
|
|
385
|
-
expression: 'lx.
|
|
452
|
+
expression: 'lx.host.control?.displayLanguage',
|
|
386
453
|
members: CONTROL_DISPLAY_LANGUAGE_API,
|
|
387
454
|
optional: true,
|
|
388
455
|
},
|
|
389
456
|
{
|
|
390
|
-
name: 'lx.
|
|
457
|
+
name: 'lx.host.appearance',
|
|
391
458
|
layer: 'logic',
|
|
392
|
-
expression: 'lx.
|
|
459
|
+
expression: 'lx.host.appearance',
|
|
393
460
|
members: APPEARANCE_API,
|
|
394
461
|
},
|
|
395
462
|
{
|
|
396
|
-
name: 'lx.
|
|
463
|
+
name: 'lx.host.control.appearance',
|
|
397
464
|
layer: 'logic',
|
|
398
|
-
expression: 'lx.
|
|
465
|
+
expression: 'lx.host.control?.appearance',
|
|
399
466
|
members: CONTROL_APPEARANCE_API,
|
|
400
467
|
optional: true,
|
|
401
468
|
},
|
|
@@ -476,6 +543,7 @@ export const LX_RUNTIME_SURFACES = [
|
|
|
476
543
|
},
|
|
477
544
|
{ name: 'lx.tray', layer: 'logic', expression: 'lx.tray', members: TRAY_API },
|
|
478
545
|
{ name: 'lx.fs', layer: 'logic', expression: 'lx.fs', members: FILE_SYSTEM_API },
|
|
546
|
+
{ name: 'lx.clipboard', layer: 'logic', expression: 'lx.clipboard', members: CLIPBOARD_API },
|
|
479
547
|
{ name: 'Storage', layer: 'logic', expression: 'lx.getStorage()', members: STORAGE_API },
|
|
480
548
|
{ name: 'UpdateManager', layer: 'logic', expression: 'lx.getUpdateManager()', members: UPDATE_MANAGER_API },
|
|
481
549
|
{
|
|
@@ -501,8 +569,9 @@ export const LX_RUNTIME_SURFACES = [
|
|
|
501
569
|
layer: 'automation',
|
|
502
570
|
expression: 'lx.automation().lxapp()',
|
|
503
571
|
members: LXAPP_DRIVER_API,
|
|
504
|
-
properties: ['nav', 'page'],
|
|
572
|
+
properties: ['clock', 'dialogs', 'mock', 'nav', 'network', 'page', 'profile'],
|
|
505
573
|
},
|
|
574
|
+
{ name: 'MockDriver', layer: 'automation', expression: 'lx.automation().lxapp().mock', members: MOCK_DRIVER_API },
|
|
506
575
|
{
|
|
507
576
|
name: 'PageDriver',
|
|
508
577
|
layer: 'automation',
|
|
@@ -513,6 +582,44 @@ export const LX_RUNTIME_SURFACES = [
|
|
|
513
582
|
{ name: 'PagePointer', layer: 'automation', expression: 'lx.automation().lxapp().page.pointer', members: PAGE_POINTER_API },
|
|
514
583
|
{ name: 'PageKey', layer: 'automation', expression: 'lx.automation().lxapp().page.key', members: PAGE_KEY_API },
|
|
515
584
|
{ name: 'NavDriver', layer: 'automation', expression: 'lx.automation().lxapp().nav', members: NAV_DRIVER_API },
|
|
585
|
+
{
|
|
586
|
+
name: 'NetworkDriver',
|
|
587
|
+
layer: 'automation',
|
|
588
|
+
expression: 'lx.automation().lxapp().network',
|
|
589
|
+
members: NETWORK_DRIVER_API,
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
name: 'ProfileDriver',
|
|
593
|
+
layer: 'automation',
|
|
594
|
+
expression: 'lx.automation().lxapp().profile',
|
|
595
|
+
members: PROFILE_DRIVER_API,
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
name: 'ClockDriver',
|
|
599
|
+
layer: 'automation',
|
|
600
|
+
expression: 'lx.automation().lxapp().clock',
|
|
601
|
+
members: CLOCK_DRIVER_API,
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
name: 'DialogDriver',
|
|
605
|
+
layer: 'automation',
|
|
606
|
+
expression: 'lx.automation().lxapp().dialogs',
|
|
607
|
+
members: DIALOG_DRIVER_API,
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
name: 'NetworkRoute',
|
|
611
|
+
layer: 'automation',
|
|
612
|
+
expression: 'lx.automation().lxapp().network.route()',
|
|
613
|
+
members: NETWORK_ROUTE_API,
|
|
614
|
+
properties: ['id', 'pattern'],
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
name: 'Scenario',
|
|
618
|
+
layer: 'automation',
|
|
619
|
+
expression: 'lx.automation().lxapp().mock.use()',
|
|
620
|
+
members: SCENARIO_API,
|
|
621
|
+
properties: ['name', 'rules', 'variant'],
|
|
622
|
+
},
|
|
516
623
|
{ name: 'LxAppManager', layer: 'automation', expression: 'lx.automation().lxapps', members: LXAPP_MANAGER_API },
|
|
517
624
|
{ name: 'DeviceDriver', layer: 'automation', expression: 'lx.automation().device', members: DEVICE_DRIVER_API },
|
|
518
625
|
{
|
|
@@ -549,22 +656,11 @@ export const LX_RUNTIME_CAPABILITY_NAMES = LX_RUNTIME_SURFACES.flatMap(({ name,
|
|
|
549
656
|
/** Canonical identifiers used by runtime shape automation coverage. */
|
|
550
657
|
export const LX_RUNTIME_SHAPE_NAMES = LX_RUNTIME_CAPABILITY_NAMES.map((name) => `shape:${name}`);
|
|
551
658
|
|
|
552
|
-
const DOWNLOAD_TASK_API = [
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
'next',
|
|
558
|
-
'pause',
|
|
559
|
-
'resume',
|
|
560
|
-
'return',
|
|
561
|
-
'then',
|
|
562
|
-
'wait',
|
|
563
|
-
] as const;
|
|
564
|
-
const UPLOAD_TASK_API = ['cancel', 'catch', 'finally', 'next', 'return', 'then', 'wait'] as const;
|
|
565
|
-
const COMPRESS_VIDEO_TASK_API = ['cancel', 'catch', 'finally', 'next', 'return', 'then', 'wait'] as const;
|
|
566
|
-
const HOST_UPDATE_INFO_API = ['apply', 'isForceUpdate', 'releaseNotes', 'size', 'version'] as const;
|
|
567
|
-
const HOST_UPDATE_TASK_API = ['catch', 'finally', 'next', 'return', 'then', 'wait'] as const;
|
|
659
|
+
const DOWNLOAD_TASK_API = ["result", "progress", "pause", "resume", "cancel"] as const;
|
|
660
|
+
const UPLOAD_TASK_API = ["result", "progress", "cancel"] as const;
|
|
661
|
+
const COMPRESS_VIDEO_TASK_API = ["result", "progress", "cancel"] as const;
|
|
662
|
+
const HOST_UPDATE_INFO_API = ['apply', 'channel', 'releaseNotes', 'size', 'version'] as const;
|
|
663
|
+
const HOST_UPDATE_TASK_API = ["result", "progress"] as const;
|
|
568
664
|
const PREVIEW_MEDIA_API = ['completed', 'current', 'onChange', 'presented'] as const;
|
|
569
665
|
const PAGE_SURFACE_API = [
|
|
570
666
|
'alive',
|
|
@@ -616,7 +712,7 @@ export const LX_RETURNED_OBJECT_SURFACES = [
|
|
|
616
712
|
{
|
|
617
713
|
name: 'DownloadTask',
|
|
618
714
|
members: DOWNLOAD_TASK_API,
|
|
619
|
-
properties: [],
|
|
715
|
+
properties: ['result', 'progress'],
|
|
620
716
|
optionalProperties: [],
|
|
621
717
|
fixture: 'external-service',
|
|
622
718
|
factory: 'lx.downloadFile',
|
|
@@ -624,7 +720,7 @@ export const LX_RETURNED_OBJECT_SURFACES = [
|
|
|
624
720
|
{
|
|
625
721
|
name: 'UploadTask',
|
|
626
722
|
members: UPLOAD_TASK_API,
|
|
627
|
-
properties: [],
|
|
723
|
+
properties: ['result', 'progress'],
|
|
628
724
|
optionalProperties: [],
|
|
629
725
|
fixture: 'external-service',
|
|
630
726
|
factory: 'lx.uploadFile',
|
|
@@ -632,7 +728,7 @@ export const LX_RETURNED_OBJECT_SURFACES = [
|
|
|
632
728
|
{
|
|
633
729
|
name: 'CompressVideoTask',
|
|
634
730
|
members: COMPRESS_VIDEO_TASK_API,
|
|
635
|
-
properties: [],
|
|
731
|
+
properties: ['result', 'progress'],
|
|
636
732
|
optionalProperties: [],
|
|
637
733
|
fixture: 'external-media',
|
|
638
734
|
factory: 'lx.compressVideo',
|
|
@@ -640,15 +736,15 @@ export const LX_RETURNED_OBJECT_SURFACES = [
|
|
|
640
736
|
{
|
|
641
737
|
name: 'HostAppUpdateInfo',
|
|
642
738
|
members: HOST_UPDATE_INFO_API,
|
|
643
|
-
properties: ['
|
|
739
|
+
properties: ['channel', 'releaseNotes', 'size', 'version'],
|
|
644
740
|
optionalProperties: ['releaseNotes', 'size'],
|
|
645
741
|
fixture: 'external-service',
|
|
646
|
-
factory: 'lx.
|
|
742
|
+
factory: 'lx.host.checkUpdate().update',
|
|
647
743
|
},
|
|
648
744
|
{
|
|
649
745
|
name: 'HostAppUpdateTask',
|
|
650
746
|
members: HOST_UPDATE_TASK_API,
|
|
651
|
-
properties: [],
|
|
747
|
+
properties: ['result', 'progress'],
|
|
652
748
|
optionalProperties: [],
|
|
653
749
|
fixture: 'external-service',
|
|
654
750
|
factory: 'HostAppUpdateInfo.apply',
|
|
@@ -731,6 +827,8 @@ export type LxApiManifestGate = [
|
|
|
731
827
|
AssertTrue<Exact<PublishedLx, typeof LX_API_NAMES>>,
|
|
732
828
|
AssertTrue<Exact<HostAppApi, typeof HOST_APP_API>>,
|
|
733
829
|
AssertTrue<Exact<AutostartApi, typeof AUTOSTART_API>>,
|
|
830
|
+
AssertTrue<Exact<BannerApi, typeof BANNER_API>>,
|
|
831
|
+
AssertTrue<Exact<NotificationApi, typeof NOTIFICATION_API>>,
|
|
734
832
|
AssertTrue<Exact<AppCacheApi, typeof APP_CACHE_API>>,
|
|
735
833
|
AssertTrue<Exact<DisplayLanguageApi, typeof DISPLAY_LANGUAGE_API>>,
|
|
736
834
|
AssertTrue<Exact<ControlApi, typeof CONTROL_API>>,
|
|
@@ -749,6 +847,7 @@ export type LxApiManifestGate = [
|
|
|
749
847
|
AssertTrue<Exact<ShellApi['sidebarActions'], typeof SHELL_SIDEBAR_ACTIONS_API>>,
|
|
750
848
|
AssertTrue<Exact<TrayApi, typeof TRAY_API>>,
|
|
751
849
|
AssertTrue<Exact<FileSystemApi, typeof FILE_SYSTEM_API>>,
|
|
850
|
+
AssertTrue<Exact<ClipboardApi, typeof CLIPBOARD_API>>,
|
|
752
851
|
AssertTrue<Exact<LxFile, typeof LX_FILE_API>>,
|
|
753
852
|
AssertTrue<Exact<Storage, typeof STORAGE_API>>,
|
|
754
853
|
AssertTrue<Exact<UpdateManager, typeof UPDATE_MANAGER_API>>,
|
|
@@ -762,6 +861,13 @@ export type LxApiManifestGate = [
|
|
|
762
861
|
AssertTrue<Exact<PagePointer, typeof PAGE_POINTER_API>>,
|
|
763
862
|
AssertTrue<Exact<PageKey, typeof PAGE_KEY_API>>,
|
|
764
863
|
AssertTrue<Exact<NavDriver, typeof NAV_DRIVER_API>>,
|
|
864
|
+
AssertTrue<Exact<NetworkDriver, typeof NETWORK_DRIVER_API>>,
|
|
865
|
+
AssertTrue<Exact<NetworkRoute, typeof NETWORK_ROUTE_API>>,
|
|
866
|
+
AssertTrue<Exact<Scenario, typeof SCENARIO_API>>,
|
|
867
|
+
AssertTrue<Exact<MockDriver, typeof MOCK_DRIVER_API>>,
|
|
868
|
+
AssertTrue<Exact<ProfileDriver, typeof PROFILE_DRIVER_API>>,
|
|
869
|
+
AssertTrue<Exact<ClockDriver, typeof CLOCK_DRIVER_API>>,
|
|
870
|
+
AssertTrue<Exact<DialogDriver, typeof DIALOG_DRIVER_API>>,
|
|
765
871
|
AssertTrue<Exact<DeviceDriver, typeof DEVICE_DRIVER_API>>,
|
|
766
872
|
AssertTrue<Exact<BrowserDriver, typeof BROWSER_DRIVER_API>>,
|
|
767
873
|
AssertTrue<Exact<BrowserCookies, typeof BROWSER_COOKIES_API>>,
|
|
@@ -782,6 +888,6 @@ export type LxApiManifestGate = [
|
|
|
782
888
|
AssertTrue<Exact<PreviewMediaHandle, typeof PREVIEW_MEDIA_API>>,
|
|
783
889
|
AssertTrue<Exact<SurfaceApi, typeof SURFACE_NAMESPACE_API>>,
|
|
784
890
|
AssertTrue<Exact<PageSurface, typeof PAGE_SURFACE_API>>,
|
|
785
|
-
AssertTrue<Exact<TabSurface, typeof TAB_SURFACE_API>>,
|
|
891
|
+
AssertTrue<Exact<Extract<TabSurface, { scope: 'tab' }>, typeof TAB_SURFACE_API>>,
|
|
786
892
|
AssertTrue<Exact<PageMessagePort, typeof PAGE_MESSAGE_PORT_API>>,
|
|
787
893
|
];
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference path="./logic-globals.d.ts" />
|
|
2
|
-
|
|
3
|
-
import type { Automation } from './automation/index.js';
|
|
4
|
-
|
|
5
|
-
/** Globals exposed by the `lxdev test` JavaScript runtime. */
|
|
6
|
-
interface AutomationTestLx {
|
|
7
|
-
automation(): Automation;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
declare global {
|
|
11
|
-
const lx: AutomationTestLx;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export {};
|