@lingxia/types 0.11.1 → 0.12.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 +289 -3
- package/dist/automation/index.d.ts.map +1 -1
- package/dist/automation-test-globals.d.ts +14 -0
- package/dist/error.d.ts +13 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +47 -1
- package/dist/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 +8 -0
- package/dist/generated/i18n.js.map +1 -1
- package/dist/generated/logic.d.ts +1055 -462
- package/dist/generated/logic.d.ts.map +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/testing/public-api.d.ts +429 -0
- package/dist/testing/public-api.d.ts.map +1 -0
- package/dist/testing/public-api.js +588 -0
- package/dist/testing/public-api.js.map +1 -0
- package/dist/testing/public-api.mjs +584 -0
- package/package.json +12 -3
- package/src/automation/index.ts +299 -3
- package/src/error.ts +47 -1
- package/src/generated/i18n.ts +8 -0
- package/src/generated/logic.ts +1117 -487
- package/src/index.ts +16 -0
- package/src/testing/public-api.ts +716 -0
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
export const LX_API_NAMES = [
|
|
2
|
+
'app',
|
|
3
|
+
'appearance',
|
|
4
|
+
'automation',
|
|
5
|
+
'chooseDirectory',
|
|
6
|
+
'chooseFile',
|
|
7
|
+
'chooseMedia',
|
|
8
|
+
'compressImage',
|
|
9
|
+
'compressVideo',
|
|
10
|
+
'connectWifi',
|
|
11
|
+
'createVideoContext',
|
|
12
|
+
'downloadFile',
|
|
13
|
+
'env',
|
|
14
|
+
'extractVideoThumbnail',
|
|
15
|
+
'fs',
|
|
16
|
+
'getConnectedWifi',
|
|
17
|
+
'getDeviceInfo',
|
|
18
|
+
'getImageInfo',
|
|
19
|
+
'getLocation',
|
|
20
|
+
'getLxAppInfo',
|
|
21
|
+
'getNetworkInfo',
|
|
22
|
+
'getScreenInfo',
|
|
23
|
+
'getStorage',
|
|
24
|
+
'getSystemSetting',
|
|
25
|
+
'getUpdateManager',
|
|
26
|
+
'getVideoInfo',
|
|
27
|
+
'getWifiList',
|
|
28
|
+
'hideToast',
|
|
29
|
+
'makePhoneCall',
|
|
30
|
+
'navigateBack',
|
|
31
|
+
'navigateBackApp',
|
|
32
|
+
'navigateTo',
|
|
33
|
+
'navigateToApp',
|
|
34
|
+
'navigationBar',
|
|
35
|
+
'onDeviceOrientationChange',
|
|
36
|
+
'onKeyDown',
|
|
37
|
+
'onKeyUp',
|
|
38
|
+
'onNetworkChange',
|
|
39
|
+
'onWifiConnected',
|
|
40
|
+
'openExternal',
|
|
41
|
+
'openFile',
|
|
42
|
+
'previewMedia',
|
|
43
|
+
'reLaunch',
|
|
44
|
+
'redirectTo',
|
|
45
|
+
'saveImageToPhotosAlbum',
|
|
46
|
+
'saveVideoToPhotosAlbum',
|
|
47
|
+
'scanCode',
|
|
48
|
+
'setDeviceOrientation',
|
|
49
|
+
'setMoreActions',
|
|
50
|
+
'share',
|
|
51
|
+
'shell',
|
|
52
|
+
'showActionSheet',
|
|
53
|
+
'showModal',
|
|
54
|
+
'showToast',
|
|
55
|
+
'startPullDownRefresh',
|
|
56
|
+
'startWifi',
|
|
57
|
+
'stopPullDownRefresh',
|
|
58
|
+
'stopWifi',
|
|
59
|
+
'supports',
|
|
60
|
+
'surface',
|
|
61
|
+
'switchTab',
|
|
62
|
+
'tabBar',
|
|
63
|
+
'terminal',
|
|
64
|
+
'tray',
|
|
65
|
+
'uploadFile',
|
|
66
|
+
'vibrateLong',
|
|
67
|
+
'vibrateShort',
|
|
68
|
+
];
|
|
69
|
+
const HOST_APP_API = [
|
|
70
|
+
'autostart',
|
|
71
|
+
'checkUpdate',
|
|
72
|
+
'envVersion',
|
|
73
|
+
'exit',
|
|
74
|
+
'getBaseInfo',
|
|
75
|
+
'onDisplayLanguageChange',
|
|
76
|
+
'screenshot',
|
|
77
|
+
'setBadge',
|
|
78
|
+
];
|
|
79
|
+
const HOST_APP_RUNTIME_API = HOST_APP_API.filter((name) => name !== 'autostart');
|
|
80
|
+
const AUTOSTART_API = ['isEnabled', 'setEnabled'];
|
|
81
|
+
const APPEARANCE_API = ['get', 'set'];
|
|
82
|
+
const NAVIGATION_BAR_API = ['update'];
|
|
83
|
+
const TAB_BAR_API = ['update'];
|
|
84
|
+
const TERMINAL_API = ['colorSchemes', 'fonts', 'settings', 'windows'];
|
|
85
|
+
const TERMINAL_SETTINGS_API = ['get', 'onChange', 'reset', 'update'];
|
|
86
|
+
const TERMINAL_COLOR_SCHEMES_API = ['createPreview', 'import', 'list'];
|
|
87
|
+
const TERMINAL_FONTS_API = ['list'];
|
|
88
|
+
const TERMINAL_PREVIEW_API = ['clear', 'close', 'show'];
|
|
89
|
+
const WINDOWS_TERMINAL_API = ['install', 'setEnabled', 'status'];
|
|
90
|
+
const ENV_API = ['USER_CACHE_PATH', 'USER_DATA_PATH'];
|
|
91
|
+
const SURFACE_NAMESPACE_API = ['get', 'onContext', 'openDeclared', 'openPage', 'openUrl'];
|
|
92
|
+
const SHELL_API = ['openApp', 'openBuiltin', 'openDeclared', 'reconfigure', 'sidebarActions'];
|
|
93
|
+
const SHELL_SIDEBAR_ACTIONS_API = ['clear', 'remove', 'replace', 'update'];
|
|
94
|
+
const TRAY_API = ['hide', 'onClick', 'setBadge', 'setIcon', 'setMenu', 'setTitle', 'show'];
|
|
95
|
+
const FILE_SYSTEM_API = [
|
|
96
|
+
'copy',
|
|
97
|
+
'exists',
|
|
98
|
+
'file',
|
|
99
|
+
'mkdir',
|
|
100
|
+
'readDir',
|
|
101
|
+
'remove',
|
|
102
|
+
'rename',
|
|
103
|
+
'stat',
|
|
104
|
+
'write',
|
|
105
|
+
];
|
|
106
|
+
const LX_FILE_API = [
|
|
107
|
+
'arrayBuffer',
|
|
108
|
+
'base64',
|
|
109
|
+
'bytes',
|
|
110
|
+
'exists',
|
|
111
|
+
'json',
|
|
112
|
+
'path',
|
|
113
|
+
'stat',
|
|
114
|
+
'text',
|
|
115
|
+
];
|
|
116
|
+
const STORAGE_API = ['clear', 'delete', 'get', 'info', 'list', 'set'];
|
|
117
|
+
const UPDATE_MANAGER_API = ['applyUpdate', 'onUpdateFailed', 'onUpdateReady'];
|
|
118
|
+
const VIDEO_CONTEXT_API = [
|
|
119
|
+
'exitFullScreen',
|
|
120
|
+
'pause',
|
|
121
|
+
'play',
|
|
122
|
+
'requestFullScreen',
|
|
123
|
+
'seek',
|
|
124
|
+
'setStreamSource',
|
|
125
|
+
'stop',
|
|
126
|
+
];
|
|
127
|
+
const AUTOMATION_API = [
|
|
128
|
+
'browser',
|
|
129
|
+
'desktop',
|
|
130
|
+
'device',
|
|
131
|
+
'lxapp',
|
|
132
|
+
'lxapps',
|
|
133
|
+
'shell',
|
|
134
|
+
'terminal',
|
|
135
|
+
];
|
|
136
|
+
const SHELL_DRIVER_API = ['pins', 'setPin'];
|
|
137
|
+
const TERMINAL_DRIVER_API = ['input', 'newTab', 'setMaximized', 'snapshot', 'split'];
|
|
138
|
+
const LXAPP_DRIVER_API = ['eval', 'info', 'nav', 'page', 'pages', 'surfaceLayout'];
|
|
139
|
+
const LXAPP_MANAGER_API = [
|
|
140
|
+
'close',
|
|
141
|
+
'current',
|
|
142
|
+
'list',
|
|
143
|
+
'open',
|
|
144
|
+
'restart',
|
|
145
|
+
'screenshot',
|
|
146
|
+
'uninstall',
|
|
147
|
+
'windows',
|
|
148
|
+
];
|
|
149
|
+
const PAGE_DRIVER_API = [
|
|
150
|
+
'click',
|
|
151
|
+
'eval',
|
|
152
|
+
'fill',
|
|
153
|
+
'key',
|
|
154
|
+
'pointer',
|
|
155
|
+
'press',
|
|
156
|
+
'query',
|
|
157
|
+
'screenshot',
|
|
158
|
+
'scroll',
|
|
159
|
+
'scrollTo',
|
|
160
|
+
'type',
|
|
161
|
+
'waitFor',
|
|
162
|
+
];
|
|
163
|
+
const PAGE_POINTER_API = ['click', 'down', 'drag', 'move', 'scroll', 'up'];
|
|
164
|
+
const PAGE_KEY_API = ['press', 'type'];
|
|
165
|
+
const NAV_DRIVER_API = [
|
|
166
|
+
'back',
|
|
167
|
+
'current',
|
|
168
|
+
'info',
|
|
169
|
+
'redirect',
|
|
170
|
+
'relaunch',
|
|
171
|
+
'stack',
|
|
172
|
+
'switchTab',
|
|
173
|
+
'to',
|
|
174
|
+
];
|
|
175
|
+
const DEVICE_DRIVER_API = ['get', 'list', 'set'];
|
|
176
|
+
const BROWSER_DRIVER_API = [
|
|
177
|
+
'activate',
|
|
178
|
+
'back',
|
|
179
|
+
'click',
|
|
180
|
+
'close',
|
|
181
|
+
'cookies',
|
|
182
|
+
'current',
|
|
183
|
+
'eval',
|
|
184
|
+
'fill',
|
|
185
|
+
'forward',
|
|
186
|
+
'open',
|
|
187
|
+
'press',
|
|
188
|
+
'query',
|
|
189
|
+
'reload',
|
|
190
|
+
'screenshot',
|
|
191
|
+
'scroll',
|
|
192
|
+
'scrollTo',
|
|
193
|
+
'tabs',
|
|
194
|
+
'type',
|
|
195
|
+
'wait',
|
|
196
|
+
];
|
|
197
|
+
const BROWSER_COOKIES_API = ['clear', 'delete', 'list', 'set'];
|
|
198
|
+
const DESKTOP_DRIVER_API = [
|
|
199
|
+
'app',
|
|
200
|
+
'ax',
|
|
201
|
+
'clipboard',
|
|
202
|
+
'displays',
|
|
203
|
+
'doctor',
|
|
204
|
+
'key',
|
|
205
|
+
'permissions',
|
|
206
|
+
'pixel',
|
|
207
|
+
'pointer',
|
|
208
|
+
'process',
|
|
209
|
+
'screenshot',
|
|
210
|
+
'snapshot',
|
|
211
|
+
'wait',
|
|
212
|
+
'window',
|
|
213
|
+
'windows',
|
|
214
|
+
];
|
|
215
|
+
const DESKTOP_POINTER_API = ['click', 'down', 'drag', 'move', 'scroll', 'up'];
|
|
216
|
+
const DESKTOP_KEY_API = ['down', 'press', 'type', 'up'];
|
|
217
|
+
const DESKTOP_WINDOW_API = [
|
|
218
|
+
'activate',
|
|
219
|
+
'close',
|
|
220
|
+
'focus',
|
|
221
|
+
'maximize',
|
|
222
|
+
'minimize',
|
|
223
|
+
'moveTo',
|
|
224
|
+
'moveToDisplay',
|
|
225
|
+
'raise',
|
|
226
|
+
'resize',
|
|
227
|
+
'restore',
|
|
228
|
+
'setAlwaysOnTop',
|
|
229
|
+
'status',
|
|
230
|
+
];
|
|
231
|
+
const DESKTOP_CLIPBOARD_API = ['clear', 'get', 'paste', 'set'];
|
|
232
|
+
const DESKTOP_AX_API = [
|
|
233
|
+
'collapse',
|
|
234
|
+
'expand',
|
|
235
|
+
'focus',
|
|
236
|
+
'hitTest',
|
|
237
|
+
'invoke',
|
|
238
|
+
'query',
|
|
239
|
+
'scrollIntoView',
|
|
240
|
+
'select',
|
|
241
|
+
'setValue',
|
|
242
|
+
'tree',
|
|
243
|
+
];
|
|
244
|
+
const DESKTOP_WAIT_API = ['ax', 'pixel', 'window'];
|
|
245
|
+
const DESKTOP_APP_API = ['launch', 'quit'];
|
|
246
|
+
const DESKTOP_PROCESS_API = ['kill', 'list'];
|
|
247
|
+
export const LX_RUNTIME_SURFACES = [
|
|
248
|
+
{
|
|
249
|
+
name: 'lx',
|
|
250
|
+
layer: 'logic',
|
|
251
|
+
expression: 'lx',
|
|
252
|
+
members: LX_API_NAMES,
|
|
253
|
+
optionalMembers: ['terminal'],
|
|
254
|
+
properties: [
|
|
255
|
+
'app',
|
|
256
|
+
'appearance',
|
|
257
|
+
'env',
|
|
258
|
+
'fs',
|
|
259
|
+
'navigationBar',
|
|
260
|
+
'shell',
|
|
261
|
+
'surface',
|
|
262
|
+
'tabBar',
|
|
263
|
+
'terminal',
|
|
264
|
+
'tray',
|
|
265
|
+
],
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: 'lx.app',
|
|
269
|
+
layer: 'logic',
|
|
270
|
+
expression: 'lx.app',
|
|
271
|
+
members: HOST_APP_RUNTIME_API,
|
|
272
|
+
properties: ['envVersion'],
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
name: 'lx.app.autostart',
|
|
276
|
+
layer: 'logic',
|
|
277
|
+
expression: 'lx.app.autostart',
|
|
278
|
+
members: AUTOSTART_API,
|
|
279
|
+
optional: true,
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: 'lx.appearance',
|
|
283
|
+
layer: 'logic',
|
|
284
|
+
expression: 'lx.appearance',
|
|
285
|
+
members: APPEARANCE_API,
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
name: 'lx.navigationBar',
|
|
289
|
+
layer: 'logic',
|
|
290
|
+
expression: 'lx.navigationBar',
|
|
291
|
+
members: NAVIGATION_BAR_API,
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: 'lx.tabBar',
|
|
295
|
+
layer: 'logic',
|
|
296
|
+
expression: 'lx.tabBar',
|
|
297
|
+
members: TAB_BAR_API,
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
name: 'lx.terminal',
|
|
301
|
+
layer: 'logic',
|
|
302
|
+
expression: 'lx.terminal',
|
|
303
|
+
members: TERMINAL_API,
|
|
304
|
+
properties: TERMINAL_API,
|
|
305
|
+
optional: true,
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
name: 'lx.terminal.settings',
|
|
309
|
+
layer: 'logic',
|
|
310
|
+
expression: 'lx.terminal?.settings',
|
|
311
|
+
members: TERMINAL_SETTINGS_API,
|
|
312
|
+
optional: true,
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
name: 'lx.terminal.colorSchemes',
|
|
316
|
+
layer: 'logic',
|
|
317
|
+
expression: 'lx.terminal?.colorSchemes',
|
|
318
|
+
members: TERMINAL_COLOR_SCHEMES_API,
|
|
319
|
+
optional: true,
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
name: 'lx.terminal.fonts',
|
|
323
|
+
layer: 'logic',
|
|
324
|
+
expression: 'lx.terminal?.fonts',
|
|
325
|
+
members: TERMINAL_FONTS_API,
|
|
326
|
+
optional: true,
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
name: 'lx.terminal.windows',
|
|
330
|
+
layer: 'logic',
|
|
331
|
+
expression: 'lx.terminal?.windows',
|
|
332
|
+
members: WINDOWS_TERMINAL_API,
|
|
333
|
+
optional: true,
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
name: 'lx.env',
|
|
337
|
+
layer: 'logic',
|
|
338
|
+
expression: 'lx.env',
|
|
339
|
+
members: ENV_API,
|
|
340
|
+
properties: ENV_API,
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
name: 'lx.surface',
|
|
344
|
+
layer: 'logic',
|
|
345
|
+
expression: 'lx.surface',
|
|
346
|
+
members: SURFACE_NAMESPACE_API,
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
name: 'lx.shell',
|
|
350
|
+
layer: 'logic',
|
|
351
|
+
expression: 'lx.shell',
|
|
352
|
+
members: SHELL_API,
|
|
353
|
+
properties: SHELL_API,
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
name: 'lx.shell.sidebarActions',
|
|
357
|
+
layer: 'logic',
|
|
358
|
+
expression: 'lx.shell.sidebarActions',
|
|
359
|
+
members: SHELL_SIDEBAR_ACTIONS_API,
|
|
360
|
+
},
|
|
361
|
+
{ name: 'lx.tray', layer: 'logic', expression: 'lx.tray', members: TRAY_API },
|
|
362
|
+
{ name: 'lx.fs', layer: 'logic', expression: 'lx.fs', members: FILE_SYSTEM_API },
|
|
363
|
+
{ name: 'Storage', layer: 'logic', expression: 'lx.getStorage()', members: STORAGE_API },
|
|
364
|
+
{ name: 'UpdateManager', layer: 'logic', expression: 'lx.getUpdateManager()', members: UPDATE_MANAGER_API },
|
|
365
|
+
{
|
|
366
|
+
name: 'Automation',
|
|
367
|
+
layer: 'automation',
|
|
368
|
+
expression: 'lx.automation()',
|
|
369
|
+
members: AUTOMATION_API,
|
|
370
|
+
properties: ['browser', 'desktop', 'device', 'lxapps', 'shell', 'terminal'],
|
|
371
|
+
},
|
|
372
|
+
{ name: 'ShellDriver', layer: 'automation', expression: 'lx.automation().shell', members: SHELL_DRIVER_API },
|
|
373
|
+
{
|
|
374
|
+
name: 'TerminalDriver',
|
|
375
|
+
layer: 'automation',
|
|
376
|
+
expression: 'lx.automation().terminal',
|
|
377
|
+
members: TERMINAL_DRIVER_API,
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
name: 'LxAppDriver',
|
|
381
|
+
layer: 'automation',
|
|
382
|
+
expression: 'lx.automation().lxapp()',
|
|
383
|
+
members: LXAPP_DRIVER_API,
|
|
384
|
+
properties: ['nav', 'page'],
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
name: 'PageDriver',
|
|
388
|
+
layer: 'automation',
|
|
389
|
+
expression: 'lx.automation().lxapp().page',
|
|
390
|
+
members: PAGE_DRIVER_API,
|
|
391
|
+
properties: ['key', 'pointer'],
|
|
392
|
+
},
|
|
393
|
+
{ name: 'PagePointer', layer: 'automation', expression: 'lx.automation().lxapp().page.pointer', members: PAGE_POINTER_API },
|
|
394
|
+
{ name: 'PageKey', layer: 'automation', expression: 'lx.automation().lxapp().page.key', members: PAGE_KEY_API },
|
|
395
|
+
{ name: 'NavDriver', layer: 'automation', expression: 'lx.automation().lxapp().nav', members: NAV_DRIVER_API },
|
|
396
|
+
{ name: 'LxAppManager', layer: 'automation', expression: 'lx.automation().lxapps', members: LXAPP_MANAGER_API },
|
|
397
|
+
{ name: 'DeviceDriver', layer: 'automation', expression: 'lx.automation().device', members: DEVICE_DRIVER_API },
|
|
398
|
+
{
|
|
399
|
+
name: 'BrowserDriver',
|
|
400
|
+
layer: 'automation',
|
|
401
|
+
expression: 'lx.automation().browser',
|
|
402
|
+
members: BROWSER_DRIVER_API,
|
|
403
|
+
properties: ['cookies'],
|
|
404
|
+
},
|
|
405
|
+
{ name: 'BrowserCookies', layer: 'automation', expression: 'lx.automation().browser.cookies', members: BROWSER_COOKIES_API },
|
|
406
|
+
{
|
|
407
|
+
name: 'DesktopDriver',
|
|
408
|
+
layer: 'automation',
|
|
409
|
+
expression: 'lx.automation().desktop',
|
|
410
|
+
members: DESKTOP_DRIVER_API,
|
|
411
|
+
properties: ['app', 'ax', 'clipboard', 'key', 'pointer', 'process', 'wait', 'window'],
|
|
412
|
+
},
|
|
413
|
+
{ name: 'DesktopPointer', layer: 'automation', expression: 'lx.automation().desktop.pointer', members: DESKTOP_POINTER_API },
|
|
414
|
+
{ name: 'DesktopKey', layer: 'automation', expression: 'lx.automation().desktop.key', members: DESKTOP_KEY_API },
|
|
415
|
+
{ name: 'DesktopWindow', layer: 'automation', expression: 'lx.automation().desktop.window', members: DESKTOP_WINDOW_API },
|
|
416
|
+
{ name: 'DesktopClipboard', layer: 'automation', expression: 'lx.automation().desktop.clipboard', members: DESKTOP_CLIPBOARD_API },
|
|
417
|
+
{ name: 'DesktopAx', layer: 'automation', expression: 'lx.automation().desktop.ax', members: DESKTOP_AX_API },
|
|
418
|
+
{ name: 'DesktopWait', layer: 'automation', expression: 'lx.automation().desktop.wait', members: DESKTOP_WAIT_API },
|
|
419
|
+
{ name: 'DesktopApp', layer: 'automation', expression: 'lx.automation().desktop.app', members: DESKTOP_APP_API },
|
|
420
|
+
{ name: 'DesktopProcess', layer: 'automation', expression: 'lx.automation().desktop.process', members: DESKTOP_PROCESS_API },
|
|
421
|
+
];
|
|
422
|
+
/** Canonical identifiers used by behavioral automation coverage. */
|
|
423
|
+
export const LX_RUNTIME_CAPABILITY_NAMES = LX_RUNTIME_SURFACES.flatMap(({ name, members }) => (members.map((member) => `${name}.${member}`)));
|
|
424
|
+
/** Canonical identifiers used by runtime shape automation coverage. */
|
|
425
|
+
export const LX_RUNTIME_SHAPE_NAMES = LX_RUNTIME_CAPABILITY_NAMES.map((name) => `shape:${name}`);
|
|
426
|
+
const DOWNLOAD_TASK_API = [
|
|
427
|
+
'abort',
|
|
428
|
+
'cancel',
|
|
429
|
+
'catch',
|
|
430
|
+
'finally',
|
|
431
|
+
'next',
|
|
432
|
+
'pause',
|
|
433
|
+
'resume',
|
|
434
|
+
'return',
|
|
435
|
+
'then',
|
|
436
|
+
'wait',
|
|
437
|
+
];
|
|
438
|
+
const UPLOAD_TASK_API = ['cancel', 'catch', 'finally', 'next', 'return', 'then', 'wait'];
|
|
439
|
+
const COMPRESS_VIDEO_TASK_API = ['cancel', 'catch', 'finally', 'next', 'return', 'then', 'wait'];
|
|
440
|
+
const HOST_UPDATE_INFO_API = ['apply', 'isForceUpdate', 'releaseNotes', 'size', 'version'];
|
|
441
|
+
const HOST_UPDATE_TASK_API = ['catch', 'finally', 'next', 'return', 'then', 'wait'];
|
|
442
|
+
const PREVIEW_MEDIA_API = ['completed', 'current', 'onChange', 'presented'];
|
|
443
|
+
const PAGE_SURFACE_API = [
|
|
444
|
+
'alive',
|
|
445
|
+
'close',
|
|
446
|
+
'hide',
|
|
447
|
+
'id',
|
|
448
|
+
'key',
|
|
449
|
+
'kind',
|
|
450
|
+
'onClose',
|
|
451
|
+
'onHide',
|
|
452
|
+
'onMessage',
|
|
453
|
+
'onShow',
|
|
454
|
+
'postMessage',
|
|
455
|
+
'realized',
|
|
456
|
+
'show',
|
|
457
|
+
'visible',
|
|
458
|
+
];
|
|
459
|
+
const TAB_SURFACE_API = [
|
|
460
|
+
'activate',
|
|
461
|
+
'alive',
|
|
462
|
+
'close',
|
|
463
|
+
'id',
|
|
464
|
+
'key',
|
|
465
|
+
'kind',
|
|
466
|
+
'onClose',
|
|
467
|
+
'realized',
|
|
468
|
+
'scope',
|
|
469
|
+
'visible',
|
|
470
|
+
];
|
|
471
|
+
const PAGE_MESSAGE_PORT_API = ['onMessage', 'postMessage'];
|
|
472
|
+
export const LX_RETURNED_OBJECT_SURFACES = [
|
|
473
|
+
{
|
|
474
|
+
name: 'LxFile',
|
|
475
|
+
members: LX_FILE_API,
|
|
476
|
+
properties: ['path'],
|
|
477
|
+
optionalProperties: [],
|
|
478
|
+
fixture: 'runtime-safe',
|
|
479
|
+
factory: 'lx.fs.file',
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
name: 'VideoContext',
|
|
483
|
+
members: VIDEO_CONTEXT_API,
|
|
484
|
+
properties: [],
|
|
485
|
+
optionalProperties: [],
|
|
486
|
+
fixture: 'runtime-safe',
|
|
487
|
+
factory: 'lx.createVideoContext',
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
name: 'DownloadTask',
|
|
491
|
+
members: DOWNLOAD_TASK_API,
|
|
492
|
+
properties: [],
|
|
493
|
+
optionalProperties: [],
|
|
494
|
+
fixture: 'external-service',
|
|
495
|
+
factory: 'lx.downloadFile',
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
name: 'UploadTask',
|
|
499
|
+
members: UPLOAD_TASK_API,
|
|
500
|
+
properties: [],
|
|
501
|
+
optionalProperties: [],
|
|
502
|
+
fixture: 'external-service',
|
|
503
|
+
factory: 'lx.uploadFile',
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
name: 'CompressVideoTask',
|
|
507
|
+
members: COMPRESS_VIDEO_TASK_API,
|
|
508
|
+
properties: [],
|
|
509
|
+
optionalProperties: [],
|
|
510
|
+
fixture: 'external-media',
|
|
511
|
+
factory: 'lx.compressVideo',
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
name: 'HostAppUpdateInfo',
|
|
515
|
+
members: HOST_UPDATE_INFO_API,
|
|
516
|
+
properties: ['isForceUpdate', 'releaseNotes', 'size', 'version'],
|
|
517
|
+
optionalProperties: ['releaseNotes', 'size'],
|
|
518
|
+
fixture: 'external-service',
|
|
519
|
+
factory: 'lx.app.checkUpdate().update',
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
name: 'HostAppUpdateTask',
|
|
523
|
+
members: HOST_UPDATE_TASK_API,
|
|
524
|
+
properties: [],
|
|
525
|
+
optionalProperties: [],
|
|
526
|
+
fixture: 'external-service',
|
|
527
|
+
factory: 'HostAppUpdateInfo.apply',
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
name: 'PreviewMediaHandle',
|
|
531
|
+
members: PREVIEW_MEDIA_API,
|
|
532
|
+
properties: ['completed', 'current', 'presented'],
|
|
533
|
+
optionalProperties: [],
|
|
534
|
+
fixture: 'external-ui',
|
|
535
|
+
factory: 'lx.previewMedia',
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
name: 'PageSurface',
|
|
539
|
+
members: PAGE_SURFACE_API,
|
|
540
|
+
properties: ['alive', 'id', 'key', 'kind', 'realized', 'visible'],
|
|
541
|
+
optionalProperties: ['key'],
|
|
542
|
+
fixture: 'surface',
|
|
543
|
+
factory: 'lx.surface.openPage',
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
name: 'TabSurface',
|
|
547
|
+
members: TAB_SURFACE_API,
|
|
548
|
+
properties: ['alive', 'id', 'key', 'kind', 'realized', 'scope', 'visible'],
|
|
549
|
+
optionalProperties: ['key'],
|
|
550
|
+
fixture: 'surface',
|
|
551
|
+
factory: 'lx.surface.openUrl',
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
name: 'PageMessagePort',
|
|
555
|
+
members: PAGE_MESSAGE_PORT_API,
|
|
556
|
+
properties: [],
|
|
557
|
+
optionalProperties: [],
|
|
558
|
+
fixture: 'navigation',
|
|
559
|
+
factory: 'lx.navigateTo',
|
|
560
|
+
},
|
|
561
|
+
];
|
|
562
|
+
/** Canonical identifiers for behavior exercised through objects returned by lx APIs. */
|
|
563
|
+
export const LX_RETURNED_OBJECT_CAPABILITY_NAMES = LX_RETURNED_OBJECT_SURFACES.flatMap(({ name, members }) => (members.map((member) => `${name}.${member}`)));
|
|
564
|
+
export const LX_RETURNED_OBJECT_SHAPE_NAMES = LX_RETURNED_OBJECT_CAPABILITY_NAMES.map((name) => `shape:${name}`);
|
|
565
|
+
/**
|
|
566
|
+
* Shape coverage a run on any host must prove. A surface marked `optional`, or
|
|
567
|
+
* a member listed in `optionalMembers`, is absent on hosts that do not build
|
|
568
|
+
* it — `lx.terminal` ships only inside the bundled Terminal Settings lxapp —
|
|
569
|
+
* so a suite that skips it has not covered it. Requiring it here would let the
|
|
570
|
+
* covers gate report a surface nobody touched as proven.
|
|
571
|
+
*/
|
|
572
|
+
export const LX_REQUIRED_RUNTIME_SHAPE_NAMES = [
|
|
573
|
+
...LX_RUNTIME_SURFACES.flatMap((surface) => {
|
|
574
|
+
if ('optional' in surface && surface.optional)
|
|
575
|
+
return [];
|
|
576
|
+
const optionalMembers = 'optionalMembers' in surface ? surface.optionalMembers : [];
|
|
577
|
+
return surface.members
|
|
578
|
+
.filter((member) => !optionalMembers.includes(member))
|
|
579
|
+
.map((member) => `shape:${surface.name}.${member}`);
|
|
580
|
+
}),
|
|
581
|
+
...LX_RETURNED_OBJECT_SURFACES
|
|
582
|
+
.filter(({ fixture }) => fixture === 'runtime-safe')
|
|
583
|
+
.flatMap(({ name, members }) => members.map((member) => `shape:${name}.${member}`)),
|
|
584
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingxia/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "TypeScript type definitions for the LingXia JS API",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -112,6 +112,14 @@
|
|
|
112
112
|
"import": "./dist/automation/index.js",
|
|
113
113
|
"require": "./dist/automation/index.js"
|
|
114
114
|
},
|
|
115
|
+
"./automation-test-globals": {
|
|
116
|
+
"types": "./dist/automation-test-globals.d.ts"
|
|
117
|
+
},
|
|
118
|
+
"./testing": {
|
|
119
|
+
"types": "./dist/testing/public-api.d.ts",
|
|
120
|
+
"import": "./dist/testing/public-api.mjs",
|
|
121
|
+
"require": "./dist/testing/public-api.js"
|
|
122
|
+
},
|
|
115
123
|
"./error": {
|
|
116
124
|
"types": "./dist/error.d.ts",
|
|
117
125
|
"import": "./dist/error.js",
|
|
@@ -129,8 +137,9 @@
|
|
|
129
137
|
"check:logic": "npm run gen:logic -- --check",
|
|
130
138
|
"check:quality": "node scripts/check-generated-quality.mjs",
|
|
131
139
|
"test:types": "tsc -p tests/tsconfig.json",
|
|
132
|
-
"
|
|
133
|
-
"
|
|
140
|
+
"test:runtime": "npm run build && node tests/error-runtime.mjs",
|
|
141
|
+
"build": "tsc && node scripts/copy-static-types.mjs",
|
|
142
|
+
"clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
134
143
|
"prepublishOnly": "npm run clean && npm run build"
|
|
135
144
|
},
|
|
136
145
|
"publishConfig": {
|