@browserbasehq/sdk 1.4.4 → 2.0.0-alpha.1
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/CHANGELOG.md +5 -0
- package/LICENSE +198 -4
- package/README.md +266 -81
- package/_shims/MultipartBody.d.ts +9 -0
- package/_shims/MultipartBody.d.ts.map +1 -0
- package/_shims/MultipartBody.js +16 -0
- package/_shims/MultipartBody.js.map +1 -0
- package/_shims/MultipartBody.mjs +12 -0
- package/_shims/MultipartBody.mjs.map +1 -0
- package/_shims/README.md +46 -0
- package/_shims/auto/runtime-bun.d.ts +5 -0
- package/_shims/auto/runtime-bun.d.ts.map +1 -0
- package/_shims/auto/runtime-bun.js +21 -0
- package/_shims/auto/runtime-bun.js.map +1 -0
- package/_shims/auto/runtime-bun.mjs +2 -0
- package/_shims/auto/runtime-bun.mjs.map +1 -0
- package/_shims/auto/runtime-node.d.ts +5 -0
- package/_shims/auto/runtime-node.d.ts.map +1 -0
- package/_shims/auto/runtime-node.js +21 -0
- package/_shims/auto/runtime-node.js.map +1 -0
- package/_shims/auto/runtime-node.mjs +2 -0
- package/_shims/auto/runtime-node.mjs.map +1 -0
- package/_shims/auto/runtime.d.ts +5 -0
- package/_shims/auto/runtime.d.ts.map +1 -0
- package/_shims/auto/runtime.js +21 -0
- package/_shims/auto/runtime.js.map +1 -0
- package/_shims/auto/runtime.mjs +2 -0
- package/_shims/auto/runtime.mjs.map +1 -0
- package/_shims/auto/types-node.d.ts +5 -0
- package/_shims/auto/types-node.d.ts.map +1 -0
- package/_shims/auto/types-node.js +21 -0
- package/_shims/auto/types-node.js.map +1 -0
- package/_shims/auto/types-node.mjs +2 -0
- package/_shims/auto/types-node.mjs.map +1 -0
- package/_shims/auto/types.d.ts +101 -0
- package/_shims/auto/types.js +3 -0
- package/_shims/auto/types.mjs +3 -0
- package/_shims/bun-runtime.d.ts +6 -0
- package/_shims/bun-runtime.d.ts.map +1 -0
- package/_shims/bun-runtime.js +13 -0
- package/_shims/bun-runtime.js.map +1 -0
- package/_shims/bun-runtime.mjs +10 -0
- package/_shims/bun-runtime.mjs.map +1 -0
- package/_shims/index.d.ts +81 -0
- package/_shims/index.js +13 -0
- package/_shims/index.mjs +7 -0
- package/_shims/manual-types.d.ts +12 -0
- package/_shims/manual-types.js +3 -0
- package/_shims/manual-types.mjs +3 -0
- package/_shims/node-runtime.d.ts +3 -0
- package/_shims/node-runtime.d.ts.map +1 -0
- package/_shims/node-runtime.js +88 -0
- package/_shims/node-runtime.js.map +1 -0
- package/_shims/node-runtime.mjs +56 -0
- package/_shims/node-runtime.mjs.map +1 -0
- package/_shims/node-types.d.ts +42 -0
- package/_shims/node-types.js +3 -0
- package/_shims/node-types.mjs +3 -0
- package/_shims/registry.d.ts +37 -0
- package/_shims/registry.d.ts.map +1 -0
- package/_shims/registry.js +41 -0
- package/_shims/registry.js.map +1 -0
- package/_shims/registry.mjs +37 -0
- package/_shims/registry.mjs.map +1 -0
- package/_shims/web-runtime.d.ts +5 -0
- package/_shims/web-runtime.d.ts.map +1 -0
- package/_shims/web-runtime.js +77 -0
- package/_shims/web-runtime.js.map +1 -0
- package/_shims/web-runtime.mjs +71 -0
- package/_shims/web-runtime.mjs.map +1 -0
- package/_shims/web-types.d.ts +83 -0
- package/_shims/web-types.js +3 -0
- package/_shims/web-types.mjs +3 -0
- package/core.d.ts +240 -0
- package/core.d.ts.map +1 -0
- package/core.js +903 -0
- package/core.js.map +1 -0
- package/core.mjs +871 -0
- package/core.mjs.map +1 -0
- package/error.d.ts +53 -0
- package/error.d.ts.map +1 -0
- package/error.js +143 -0
- package/error.js.map +1 -0
- package/error.mjs +127 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +132 -0
- package/index.d.ts +132 -0
- package/index.d.ts.map +1 -0
- package/index.js +115 -0
- package/index.js.map +1 -0
- package/index.mjs +87 -0
- package/index.mjs.map +1 -0
- package/package.json +93 -31
- package/resource.d.ts +6 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +11 -0
- package/resource.js.map +1 -0
- package/resource.mjs +7 -0
- package/resource.mjs.map +1 -0
- package/resources/contexts.d.ts +82 -0
- package/resources/contexts.d.ts.map +1 -0
- package/resources/contexts.js +29 -0
- package/resources/contexts.js.map +1 -0
- package/resources/contexts.mjs +25 -0
- package/resources/contexts.mjs.map +1 -0
- package/resources/extensions.d.ts +35 -0
- package/resources/extensions.d.ts.map +1 -0
- package/resources/extensions.js +56 -0
- package/resources/extensions.js.map +1 -0
- package/resources/extensions.mjs +29 -0
- package/resources/extensions.mjs.map +1 -0
- package/resources/index.d.ts +5 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +13 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +6 -0
- package/resources/index.mjs.map +1 -0
- package/resources/projects.d.ts +36 -0
- package/resources/projects.d.ts.map +1 -0
- package/resources/projects.js +29 -0
- package/resources/projects.js.map +1 -0
- package/resources/projects.mjs +25 -0
- package/resources/projects.mjs.map +1 -0
- package/resources/sessions/downloads.d.ts +10 -0
- package/resources/sessions/downloads.d.ts.map +1 -0
- package/resources/sessions/downloads.js +15 -0
- package/resources/sessions/downloads.js.map +1 -0
- package/resources/sessions/downloads.mjs +11 -0
- package/resources/sessions/downloads.mjs.map +1 -0
- package/resources/sessions/index.d.ts +6 -0
- package/resources/sessions/index.d.ts.map +1 -0
- package/resources/sessions/index.js +15 -0
- package/resources/sessions/index.js.map +1 -0
- package/resources/sessions/index.mjs +7 -0
- package/resources/sessions/index.mjs.map +1 -0
- package/resources/sessions/logs.d.ts +47 -0
- package/resources/sessions/logs.d.ts.map +1 -0
- package/resources/sessions/logs.js +17 -0
- package/resources/sessions/logs.js.map +1 -0
- package/resources/sessions/logs.mjs +13 -0
- package/resources/sessions/logs.mjs.map +1 -0
- package/resources/sessions/recording.d.ts +29 -0
- package/resources/sessions/recording.d.ts.map +1 -0
- package/resources/sessions/recording.js +17 -0
- package/resources/sessions/recording.js.map +1 -0
- package/resources/sessions/recording.mjs +13 -0
- package/resources/sessions/recording.mjs.map +1 -0
- package/resources/sessions/sessions.d.ts +338 -0
- package/resources/sessions/sessions.d.ts.map +1 -0
- package/resources/sessions/sessions.js +80 -0
- package/resources/sessions/sessions.js.map +1 -0
- package/resources/sessions/sessions.mjs +53 -0
- package/resources/sessions/sessions.mjs.map +1 -0
- package/resources/sessions/uploads.d.ts +20 -0
- package/resources/sessions/uploads.d.ts.map +1 -0
- package/resources/sessions/uploads.js +41 -0
- package/resources/sessions/uploads.js.map +1 -0
- package/resources/sessions/uploads.mjs +14 -0
- package/resources/sessions/uploads.mjs.map +1 -0
- package/shims/node.d.ts +26 -0
- package/shims/node.d.ts.map +1 -0
- package/shims/node.js +6 -0
- package/shims/node.js.map +1 -0
- package/shims/node.mjs +4 -0
- package/shims/node.mjs.map +1 -0
- package/shims/web.d.ts +26 -0
- package/shims/web.d.ts.map +1 -0
- package/shims/web.js +6 -0
- package/shims/web.js.map +1 -0
- package/shims/web.mjs +4 -0
- package/shims/web.mjs.map +1 -0
- package/src/_shims/MultipartBody.ts +9 -0
- package/src/_shims/README.md +46 -0
- package/src/_shims/auto/runtime-bun.ts +4 -0
- package/src/_shims/auto/runtime-node.ts +4 -0
- package/src/_shims/auto/runtime.ts +4 -0
- package/src/_shims/auto/types-node.ts +4 -0
- package/src/_shims/auto/types.d.ts +101 -0
- package/src/_shims/auto/types.js +3 -0
- package/src/_shims/auto/types.mjs +3 -0
- package/src/_shims/bun-runtime.ts +14 -0
- package/src/_shims/index.d.ts +81 -0
- package/src/_shims/index.js +13 -0
- package/src/_shims/index.mjs +7 -0
- package/src/_shims/manual-types.d.ts +12 -0
- package/src/_shims/manual-types.js +3 -0
- package/src/_shims/manual-types.mjs +3 -0
- package/src/_shims/node-runtime.ts +81 -0
- package/src/_shims/node-types.d.ts +42 -0
- package/src/_shims/node-types.js +3 -0
- package/src/_shims/node-types.mjs +3 -0
- package/src/_shims/registry.ts +67 -0
- package/src/_shims/web-runtime.ts +103 -0
- package/src/_shims/web-types.d.ts +83 -0
- package/src/_shims/web-types.js +3 -0
- package/src/_shims/web-types.mjs +3 -0
- package/src/core.ts +1197 -0
- package/src/error.ts +146 -0
- package/src/index.ts +210 -0
- package/src/lib/.keep +4 -0
- package/src/resource.ts +11 -0
- package/src/resources/contexts.ts +108 -0
- package/src/resources/extensions.ts +55 -0
- package/src/resources/index.ts +21 -0
- package/src/resources/projects.ts +56 -0
- package/src/resources/sessions/downloads.ts +14 -0
- package/src/resources/sessions/index.ts +16 -0
- package/src/resources/sessions/logs.ts +68 -0
- package/src/resources/sessions/recording.ts +40 -0
- package/src/resources/sessions/sessions.ts +451 -0
- package/src/resources/sessions/uploads.ts +34 -0
- package/src/shims/node.ts +50 -0
- package/src/shims/web.ts +50 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +256 -0
- package/src/version.ts +1 -0
- package/uploads.d.ts +75 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +170 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +157 -0
- package/uploads.mjs.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
- package/dist/index.d.ts +0 -138
- package/dist/index.js +0 -228
- package/dist/integrations/ai-sdk.d.ts +0 -18
- package/dist/integrations/ai-sdk.js +0 -19
- package/dist/recorder/call-metadata.d.ts +0 -66
- package/dist/recorder/call-metadata.js +0 -2
- package/dist/recorder/crypto.d.ts +0 -1
- package/dist/recorder/crypto.js +0 -10
- package/dist/recorder/css-utils.d.ts +0 -2
- package/dist/recorder/css-utils.js +0 -34
- package/dist/recorder/generator.d.ts +0 -31
- package/dist/recorder/generator.js +0 -154
- package/dist/recorder/javascript-generator.d.ts +0 -29
- package/dist/recorder/javascript-generator.js +0 -256
- package/dist/recorder/language.d.ts +0 -127
- package/dist/recorder/language.js +0 -21
- package/dist/recorder/recorder-types.d.ts +0 -108
- package/dist/recorder/recorder-types.js +0 -2
- package/dist/recorder/recorder.d.ts +0 -35
- package/dist/recorder/recorder.js +0 -333
- package/dist/recorder/time.d.ts +0 -1
- package/dist/recorder/time.js +0 -42
- package/dist/recorder/timeout-runner.d.ts +0 -6
- package/dist/recorder/timeout-runner.js +0 -19
- package/dist/recorder/utils/isomorphic/css-parser.d.ts +0 -41
- package/dist/recorder/utils/isomorphic/css-parser.js +0 -291
- package/dist/recorder/utils/isomorphic/css-tokenizer.d.ts +0 -171
- package/dist/recorder/utils/isomorphic/css-tokenizer.js +0 -986
- package/dist/recorder/utils/isomorphic/locator-generators.d.ts +0 -79
- package/dist/recorder/utils/isomorphic/locator-generators.js +0 -666
- package/dist/recorder/utils/isomorphic/locator-parser.d.ts +0 -17
- package/dist/recorder/utils/isomorphic/locator-parser.js +0 -244
- package/dist/recorder/utils/isomorphic/locator-utils.d.ts +0 -43
- package/dist/recorder/utils/isomorphic/locator-utils.js +0 -69
- package/dist/recorder/utils/isomorphic/selector-parser.d.ts +0 -48
- package/dist/recorder/utils/isomorphic/selector-parser.js +0 -483
- package/dist/recorder/utils/isomorphic/string-utils.d.ts +0 -28
- package/dist/recorder/utils/isomorphic/string-utils.js +0 -123
- package/dist/recorder/utils.d.ts +0 -20
- package/dist/recorder/utils.js +0 -32
package/dist/recorder/crypto.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createGuid = createGuid;
|
|
7
|
-
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
-
function createGuid() {
|
|
9
|
-
return crypto_1.default.randomBytes(16).toString('hex');
|
|
10
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cssEscape = cssEscape;
|
|
4
|
-
exports.quoteCSSAttributeValue = quoteCSSAttributeValue;
|
|
5
|
-
function cssEscape(s) {
|
|
6
|
-
let result = '';
|
|
7
|
-
for (let i = 0; i < s.length; i++)
|
|
8
|
-
result += cssEscapeOne(s, i);
|
|
9
|
-
return result;
|
|
10
|
-
}
|
|
11
|
-
function quoteCSSAttributeValue(text) {
|
|
12
|
-
return `"${cssEscape(text).replace(/\\ /g, ' ')}"`;
|
|
13
|
-
}
|
|
14
|
-
function cssEscapeOne(s, i) {
|
|
15
|
-
// https://drafts.csswg.org/cssom/#serialize-an-identifier
|
|
16
|
-
const c = s.charCodeAt(i);
|
|
17
|
-
if (c === 0x0000)
|
|
18
|
-
return '\uFFFD';
|
|
19
|
-
if ((c >= 0x0001 && c <= 0x001f) ||
|
|
20
|
-
(c >= 0x0030 &&
|
|
21
|
-
c <= 0x0039 &&
|
|
22
|
-
(i === 0 || (i === 1 && s.charCodeAt(0) === 0x002d))))
|
|
23
|
-
return '\\' + c.toString(16) + ' ';
|
|
24
|
-
if (i === 0 && c === 0x002d && s.length === 1)
|
|
25
|
-
return '\\' + s.charAt(i);
|
|
26
|
-
if (c >= 0x0080 ||
|
|
27
|
-
c === 0x002d ||
|
|
28
|
-
c === 0x005f ||
|
|
29
|
-
(c >= 0x0030 && c <= 0x0039) ||
|
|
30
|
-
(c >= 0x0041 && c <= 0x005a) ||
|
|
31
|
-
(c >= 0x0061 && c <= 0x007a))
|
|
32
|
-
return s.charAt(i);
|
|
33
|
-
return '\\' + s.charAt(i);
|
|
34
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import type { BrowserContextOptions, LaunchOptions, Frame } from 'playwright-core';
|
|
3
|
-
import type { LanguageGenerator } from './language';
|
|
4
|
-
import type { Action, Signal, FrameDescription } from './recorder-types';
|
|
5
|
-
export type ActionInContext = {
|
|
6
|
-
frame: FrameDescription;
|
|
7
|
-
action: Action;
|
|
8
|
-
committed?: boolean;
|
|
9
|
-
};
|
|
10
|
-
export declare class CodeGenerator extends EventEmitter {
|
|
11
|
-
private _currentAction;
|
|
12
|
-
private _lastAction;
|
|
13
|
-
private _actions;
|
|
14
|
-
private _enabled;
|
|
15
|
-
private _options;
|
|
16
|
-
constructor(browserName: string, enabled: boolean, launchOptions: LaunchOptions, contextOptions: BrowserContextOptions, deviceName: string | undefined, saveStorage: string | undefined);
|
|
17
|
-
restart(): void;
|
|
18
|
-
setEnabled(enabled: boolean): void;
|
|
19
|
-
addAction(action: ActionInContext): void;
|
|
20
|
-
willPerformAction(action: ActionInContext): void;
|
|
21
|
-
performedActionFailed(action: ActionInContext): void;
|
|
22
|
-
didPerformAction(actionInContext: ActionInContext): void;
|
|
23
|
-
commitLastAction(): void;
|
|
24
|
-
signal(pageAlias: string, frame: Frame, signal: Signal): void;
|
|
25
|
-
generateStructure(languageGenerator: LanguageGenerator): {
|
|
26
|
-
header: string;
|
|
27
|
-
footer: string;
|
|
28
|
-
actions: string[];
|
|
29
|
-
text: string;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CodeGenerator = void 0;
|
|
4
|
-
const events_1 = require("events");
|
|
5
|
-
class CodeGenerator extends events_1.EventEmitter {
|
|
6
|
-
_currentAction = null;
|
|
7
|
-
_lastAction = null;
|
|
8
|
-
_actions = [];
|
|
9
|
-
_enabled;
|
|
10
|
-
_options;
|
|
11
|
-
constructor(browserName, enabled, launchOptions, contextOptions, deviceName, saveStorage) {
|
|
12
|
-
super();
|
|
13
|
-
// Make a copy of options to modify them later.
|
|
14
|
-
launchOptions = { headless: false, ...launchOptions };
|
|
15
|
-
contextOptions = { ...contextOptions };
|
|
16
|
-
this._enabled = enabled;
|
|
17
|
-
this._options = {
|
|
18
|
-
browserName,
|
|
19
|
-
launchOptions,
|
|
20
|
-
contextOptions,
|
|
21
|
-
deviceName,
|
|
22
|
-
saveStorage,
|
|
23
|
-
};
|
|
24
|
-
this.restart();
|
|
25
|
-
}
|
|
26
|
-
restart() {
|
|
27
|
-
this._currentAction = null;
|
|
28
|
-
this._lastAction = null;
|
|
29
|
-
this._actions = [];
|
|
30
|
-
this.emit('change');
|
|
31
|
-
}
|
|
32
|
-
setEnabled(enabled) {
|
|
33
|
-
this._enabled = enabled;
|
|
34
|
-
}
|
|
35
|
-
addAction(action) {
|
|
36
|
-
if (!this._enabled)
|
|
37
|
-
return;
|
|
38
|
-
this.willPerformAction(action);
|
|
39
|
-
this.didPerformAction(action);
|
|
40
|
-
}
|
|
41
|
-
willPerformAction(action) {
|
|
42
|
-
if (!this._enabled)
|
|
43
|
-
return;
|
|
44
|
-
this._currentAction = action;
|
|
45
|
-
}
|
|
46
|
-
performedActionFailed(action) {
|
|
47
|
-
if (!this._enabled)
|
|
48
|
-
return;
|
|
49
|
-
if (this._currentAction === action)
|
|
50
|
-
this._currentAction = null;
|
|
51
|
-
}
|
|
52
|
-
didPerformAction(actionInContext) {
|
|
53
|
-
if (!this._enabled)
|
|
54
|
-
return;
|
|
55
|
-
const action = actionInContext.action;
|
|
56
|
-
let eraseLastAction = false;
|
|
57
|
-
if (this._lastAction &&
|
|
58
|
-
this._lastAction.frame.pageAlias === actionInContext.frame.pageAlias) {
|
|
59
|
-
const lastAction = this._lastAction.action;
|
|
60
|
-
// We augment last action based on the type.
|
|
61
|
-
if (this._lastAction &&
|
|
62
|
-
action.name === 'fill' &&
|
|
63
|
-
lastAction.name === 'fill') {
|
|
64
|
-
if (action.selector === lastAction.selector)
|
|
65
|
-
eraseLastAction = true;
|
|
66
|
-
}
|
|
67
|
-
if (lastAction &&
|
|
68
|
-
action.name === 'click' &&
|
|
69
|
-
lastAction.name === 'click') {
|
|
70
|
-
if (action.selector === lastAction.selector &&
|
|
71
|
-
action.clickCount > lastAction.clickCount)
|
|
72
|
-
eraseLastAction = true;
|
|
73
|
-
}
|
|
74
|
-
if (lastAction &&
|
|
75
|
-
action.name === 'navigate' &&
|
|
76
|
-
lastAction.name === 'navigate') {
|
|
77
|
-
if (action.url === lastAction.url) {
|
|
78
|
-
// Already at a target URL.
|
|
79
|
-
this._currentAction = null;
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
// Check and uncheck erase click.
|
|
84
|
-
if (lastAction &&
|
|
85
|
-
(action.name === 'check' || action.name === 'uncheck') &&
|
|
86
|
-
lastAction.name === 'click') {
|
|
87
|
-
if (action.selector === lastAction.selector)
|
|
88
|
-
eraseLastAction = true;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
this._lastAction = actionInContext;
|
|
92
|
-
this._currentAction = null;
|
|
93
|
-
if (eraseLastAction)
|
|
94
|
-
this._actions.pop();
|
|
95
|
-
this._actions.push(actionInContext);
|
|
96
|
-
this.emit('change');
|
|
97
|
-
}
|
|
98
|
-
commitLastAction() {
|
|
99
|
-
if (!this._enabled)
|
|
100
|
-
return;
|
|
101
|
-
const action = this._lastAction;
|
|
102
|
-
if (action)
|
|
103
|
-
action.committed = true;
|
|
104
|
-
}
|
|
105
|
-
signal(pageAlias, frame, signal) {
|
|
106
|
-
if (!this._enabled)
|
|
107
|
-
return;
|
|
108
|
-
// Signal either arrives while action is being performed or shortly after.
|
|
109
|
-
if (this._currentAction) {
|
|
110
|
-
this._currentAction.action.signals.push(signal);
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
if (this._lastAction &&
|
|
114
|
-
(!this._lastAction.committed || signal.name !== 'navigation')) {
|
|
115
|
-
const signals = this._lastAction.action.signals;
|
|
116
|
-
if (signal.name === 'navigation' &&
|
|
117
|
-
signals.length &&
|
|
118
|
-
signals[signals.length - 1].name === 'download')
|
|
119
|
-
return;
|
|
120
|
-
if (signal.name === 'download' &&
|
|
121
|
-
signals.length &&
|
|
122
|
-
signals[signals.length - 1].name === 'navigation')
|
|
123
|
-
signals.length = signals.length - 1;
|
|
124
|
-
this._lastAction.action.signals.push(signal);
|
|
125
|
-
this.emit('change');
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
// @ts-ignore
|
|
129
|
-
if (signal.name === 'navigation' && frame.page().mainFrame() === frame) {
|
|
130
|
-
this.addAction({
|
|
131
|
-
frame: {
|
|
132
|
-
pageAlias,
|
|
133
|
-
isMainFrame: true,
|
|
134
|
-
},
|
|
135
|
-
committed: true,
|
|
136
|
-
action: {
|
|
137
|
-
name: 'navigate',
|
|
138
|
-
url: frame.url(),
|
|
139
|
-
signals: [],
|
|
140
|
-
},
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
generateStructure(languageGenerator) {
|
|
145
|
-
const header = languageGenerator.generateHeader(this._options);
|
|
146
|
-
const footer = languageGenerator.generateFooter(this._options.saveStorage);
|
|
147
|
-
const actions = this._actions
|
|
148
|
-
.map((a) => languageGenerator.generateAction(a))
|
|
149
|
-
.filter(Boolean);
|
|
150
|
-
const text = [header, ...actions, footer].join('\n');
|
|
151
|
-
return { header, footer, actions, text };
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
exports.CodeGenerator = CodeGenerator;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { Language, LanguageGenerator, LanguageGeneratorOptions } from './language';
|
|
2
|
-
import type { ActionInContext } from './generator';
|
|
3
|
-
export declare class JavaScriptLanguageGenerator implements LanguageGenerator {
|
|
4
|
-
id: string;
|
|
5
|
-
groupName: string;
|
|
6
|
-
name: string;
|
|
7
|
-
highlighter: Language;
|
|
8
|
-
private _isTest;
|
|
9
|
-
constructor(isTest: boolean);
|
|
10
|
-
generateAction(actionInContext: ActionInContext): string;
|
|
11
|
-
private _generateActionCall;
|
|
12
|
-
private _asLocator;
|
|
13
|
-
generateHeader(options: LanguageGeneratorOptions): string;
|
|
14
|
-
generateFooter(saveStorage: string | undefined): string;
|
|
15
|
-
generateTestHeader(options: LanguageGeneratorOptions): string;
|
|
16
|
-
generateTestFooter(saveStorage: string | undefined): string;
|
|
17
|
-
generateStandaloneHeader(options: LanguageGeneratorOptions): string;
|
|
18
|
-
generateStandaloneFooter(saveStorage: string | undefined): string;
|
|
19
|
-
}
|
|
20
|
-
export declare class JavaScriptFormatter {
|
|
21
|
-
private _baseIndent;
|
|
22
|
-
private _baseOffset;
|
|
23
|
-
private _lines;
|
|
24
|
-
constructor(offset?: number);
|
|
25
|
-
prepend(text: string): void;
|
|
26
|
-
add(text: string): void;
|
|
27
|
-
newLine(): void;
|
|
28
|
-
format(): string;
|
|
29
|
-
}
|
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JavaScriptFormatter = exports.JavaScriptLanguageGenerator = void 0;
|
|
4
|
-
const language_1 = require("./language");
|
|
5
|
-
const utils_1 = require("./utils");
|
|
6
|
-
// TODO: rename to files
|
|
7
|
-
const locator_generators_1 = require("./utils/isomorphic/locator-generators");
|
|
8
|
-
const string_utils_1 = require("./utils/isomorphic/string-utils");
|
|
9
|
-
class JavaScriptLanguageGenerator {
|
|
10
|
-
id;
|
|
11
|
-
groupName = 'Node.js';
|
|
12
|
-
name;
|
|
13
|
-
highlighter = 'javascript';
|
|
14
|
-
_isTest;
|
|
15
|
-
constructor(isTest) {
|
|
16
|
-
this.id = isTest ? 'playwright-test' : 'javascript';
|
|
17
|
-
this.name = isTest ? 'Test Runner' : 'Library';
|
|
18
|
-
this._isTest = isTest;
|
|
19
|
-
}
|
|
20
|
-
generateAction(actionInContext) {
|
|
21
|
-
const action = actionInContext.action;
|
|
22
|
-
if (this._isTest &&
|
|
23
|
-
(action.name === 'openPage' || action.name === 'closePage'))
|
|
24
|
-
return '';
|
|
25
|
-
const pageAlias = actionInContext.frame.pageAlias;
|
|
26
|
-
const formatter = new JavaScriptFormatter(2);
|
|
27
|
-
if (action.name === 'openPage') {
|
|
28
|
-
formatter.add(`const ${pageAlias} = await context.newPage();`);
|
|
29
|
-
if (action.url &&
|
|
30
|
-
action.url !== 'about:blank' &&
|
|
31
|
-
action.url !== 'chrome://newtab/')
|
|
32
|
-
formatter.add(`await ${pageAlias}.goto(${quote(action.url)});`);
|
|
33
|
-
return formatter.format();
|
|
34
|
-
}
|
|
35
|
-
let subject;
|
|
36
|
-
if (actionInContext.frame.isMainFrame) {
|
|
37
|
-
subject = pageAlias;
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
// @ts-expect-error
|
|
41
|
-
const locators = actionInContext.frame.selectorsChain.map((selector) => `.frameLocator(${quote(selector)})`);
|
|
42
|
-
subject = `${pageAlias}${locators.join('')}`;
|
|
43
|
-
}
|
|
44
|
-
const signals = (0, language_1.toSignalMap)(action);
|
|
45
|
-
if (signals.dialog) {
|
|
46
|
-
formatter.add(` ${pageAlias}.once('dialog', dialog => {
|
|
47
|
-
console.log(\`Dialog message: $\{dialog.message()}\`);
|
|
48
|
-
dialog.dismiss().catch(() => {});
|
|
49
|
-
});`);
|
|
50
|
-
}
|
|
51
|
-
if (signals.popup)
|
|
52
|
-
formatter.add(`const ${signals.popup.popupAlias}Promise = ${pageAlias}.waitForEvent('popup');`);
|
|
53
|
-
if (signals.download)
|
|
54
|
-
formatter.add(`const download${signals.download.downloadAlias}Promise = ${pageAlias}.waitForEvent('download');`);
|
|
55
|
-
formatter.add(this._generateActionCall(subject, action));
|
|
56
|
-
if (signals.popup)
|
|
57
|
-
formatter.add(`const ${signals.popup.popupAlias} = await ${signals.popup.popupAlias}Promise;`);
|
|
58
|
-
if (signals.download)
|
|
59
|
-
formatter.add(`const download${signals.download.downloadAlias} = await download${signals.download.downloadAlias}Promise;`);
|
|
60
|
-
return formatter.format();
|
|
61
|
-
}
|
|
62
|
-
_generateActionCall(subject, action) {
|
|
63
|
-
switch (action.name) {
|
|
64
|
-
case 'openPage':
|
|
65
|
-
throw Error('Not reached');
|
|
66
|
-
case 'closePage':
|
|
67
|
-
return `await ${subject}.close();`;
|
|
68
|
-
case 'click': {
|
|
69
|
-
let method = 'click';
|
|
70
|
-
if (action.clickCount === 2)
|
|
71
|
-
method = 'dblclick';
|
|
72
|
-
const modifiers = (0, utils_1.toModifiers)(action.modifiers);
|
|
73
|
-
const options = {};
|
|
74
|
-
if (action.button !== 'left')
|
|
75
|
-
options.button = action.button;
|
|
76
|
-
if (modifiers.length)
|
|
77
|
-
options.modifiers = modifiers;
|
|
78
|
-
if (action.clickCount > 2)
|
|
79
|
-
options.clickCount = action.clickCount;
|
|
80
|
-
if (action.position)
|
|
81
|
-
options.position = action.position;
|
|
82
|
-
const optionsString = formatOptions(options, false);
|
|
83
|
-
return `await ${subject}.${this._asLocator(action.selector)}.${method}(${optionsString});`;
|
|
84
|
-
}
|
|
85
|
-
case 'check':
|
|
86
|
-
return `await ${subject}.${this._asLocator(action.selector)}.check();`;
|
|
87
|
-
case 'uncheck':
|
|
88
|
-
return `await ${subject}.${this._asLocator(action.selector)}.uncheck();`;
|
|
89
|
-
case 'fill':
|
|
90
|
-
return `await ${subject}.${this._asLocator(action.selector)}.fill(${quote(action.text)});`;
|
|
91
|
-
case 'setInputFiles':
|
|
92
|
-
return `await ${subject}.${this._asLocator(action.selector)}.setInputFiles(${formatObject(action.files.length === 1 ? action.files[0] : action.files)});`;
|
|
93
|
-
case 'press': {
|
|
94
|
-
const modifiers = (0, utils_1.toModifiers)(action.modifiers);
|
|
95
|
-
const shortcut = [...modifiers, action.key].join('+');
|
|
96
|
-
return `await ${subject}.${this._asLocator(action.selector)}.press(${quote(shortcut)});`;
|
|
97
|
-
}
|
|
98
|
-
case 'navigate':
|
|
99
|
-
return `await ${subject}.goto(${quote(action.url)});`;
|
|
100
|
-
case 'select':
|
|
101
|
-
return `await ${subject}.${this._asLocator(action.selector)}.selectOption(${formatObject(action.options.length > 1 ? action.options : action.options[0])});`;
|
|
102
|
-
case 'assertText':
|
|
103
|
-
return `${this._isTest ? '' : '// '}await expect(${subject}.${this._asLocator(action.selector)}).${action.substring ? 'toContainText' : 'toHaveText'}(${quote(action.text)});`;
|
|
104
|
-
case 'assertChecked':
|
|
105
|
-
return `${this._isTest ? '' : '// '}await expect(${subject}.${this._asLocator(action.selector)})${action.checked ? '' : '.not'}.toBeChecked();`;
|
|
106
|
-
case 'assertVisible':
|
|
107
|
-
return `${this._isTest ? '' : '// '}await expect(${subject}.${this._asLocator(action.selector)}).toBeVisible();`;
|
|
108
|
-
case 'assertValue': {
|
|
109
|
-
const assertion = action.value
|
|
110
|
-
? `toHaveValue(${quote(action.value)})`
|
|
111
|
-
: `toBeEmpty()`;
|
|
112
|
-
return `${this._isTest ? '' : '// '}await expect(${subject}.${this._asLocator(action.selector)}).${assertion};`;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
_asLocator(selector) {
|
|
117
|
-
return (0, locator_generators_1.asLocator)('javascript', selector);
|
|
118
|
-
}
|
|
119
|
-
generateHeader(options) {
|
|
120
|
-
if (this._isTest)
|
|
121
|
-
return this.generateTestHeader(options);
|
|
122
|
-
return this.generateStandaloneHeader(options);
|
|
123
|
-
}
|
|
124
|
-
generateFooter(saveStorage) {
|
|
125
|
-
if (this._isTest)
|
|
126
|
-
return this.generateTestFooter(saveStorage);
|
|
127
|
-
return this.generateStandaloneFooter(saveStorage);
|
|
128
|
-
}
|
|
129
|
-
generateTestHeader(options) {
|
|
130
|
-
const formatter = new JavaScriptFormatter();
|
|
131
|
-
const useText = formatContextOptions(options.contextOptions, options.deviceName);
|
|
132
|
-
formatter.add(`
|
|
133
|
-
import { test, expect${options.deviceName ? ', devices' : ''} } from '@playwright/test';
|
|
134
|
-
${useText ? '\ntest.use(' + useText + ');\n' : ''}
|
|
135
|
-
test('test', async ({ page }) => {`);
|
|
136
|
-
return formatter.format();
|
|
137
|
-
}
|
|
138
|
-
generateTestFooter(saveStorage) {
|
|
139
|
-
return `});`;
|
|
140
|
-
}
|
|
141
|
-
// TODO: fix header
|
|
142
|
-
generateStandaloneHeader(options) {
|
|
143
|
-
const formatter = new JavaScriptFormatter();
|
|
144
|
-
formatter.add(`
|
|
145
|
-
const { ${options.browserName}${options.deviceName ? ', devices' : ''} } = require('playwright');
|
|
146
|
-
|
|
147
|
-
(async () => {
|
|
148
|
-
const browser = await ${options.browserName}.launch(${formatObjectOrVoid(options.launchOptions)});
|
|
149
|
-
const context = await browser.newContext(${formatContextOptions(options.contextOptions, options.deviceName)});`);
|
|
150
|
-
return formatter.format();
|
|
151
|
-
}
|
|
152
|
-
generateStandaloneFooter(saveStorage) {
|
|
153
|
-
const storageStateLine = saveStorage
|
|
154
|
-
? `\n await context.storageState({ path: ${quote(saveStorage)} });`
|
|
155
|
-
: '';
|
|
156
|
-
return `\n // ---------------------${storageStateLine}
|
|
157
|
-
await context.close();
|
|
158
|
-
await browser.close();
|
|
159
|
-
})();`;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
exports.JavaScriptLanguageGenerator = JavaScriptLanguageGenerator;
|
|
163
|
-
function formatOptions(value, hasArguments) {
|
|
164
|
-
const keys = Object.keys(value);
|
|
165
|
-
if (!keys.length)
|
|
166
|
-
return '';
|
|
167
|
-
return (hasArguments ? ', ' : '') + formatObject(value);
|
|
168
|
-
}
|
|
169
|
-
function formatObject(value, indent = ' ') {
|
|
170
|
-
if (typeof value === 'string')
|
|
171
|
-
return quote(value);
|
|
172
|
-
if (Array.isArray(value))
|
|
173
|
-
return `[${value.map((o) => formatObject(o)).join(', ')}]`;
|
|
174
|
-
if (typeof value === 'object') {
|
|
175
|
-
const keys = Object.keys(value)
|
|
176
|
-
.filter((key) => value[key] !== undefined)
|
|
177
|
-
.sort();
|
|
178
|
-
if (!keys.length)
|
|
179
|
-
return '{}';
|
|
180
|
-
const tokens = [];
|
|
181
|
-
for (const key of keys)
|
|
182
|
-
tokens.push(`${key}: ${formatObject(value[key])}`);
|
|
183
|
-
return `{\n${indent}${tokens.join(`,\n${indent}`)}\n}`;
|
|
184
|
-
}
|
|
185
|
-
return String(value);
|
|
186
|
-
}
|
|
187
|
-
function formatObjectOrVoid(value, indent = ' ') {
|
|
188
|
-
const result = formatObject(value, indent);
|
|
189
|
-
return result === '{}' ? '' : result;
|
|
190
|
-
}
|
|
191
|
-
// NOTE: disabled device for now to simplify build
|
|
192
|
-
function formatContextOptions(options, deviceName) {
|
|
193
|
-
// const device = deviceName && deviceDescriptors[deviceName]
|
|
194
|
-
// if (!device) return formatObjectOrVoid(options)
|
|
195
|
-
return formatObjectOrVoid(options);
|
|
196
|
-
// Filter out all the properties from the device descriptor.
|
|
197
|
-
// let serializedObject = formatObjectOrVoid(
|
|
198
|
-
// sanitizeDeviceOptions(device, options)
|
|
199
|
-
// )
|
|
200
|
-
// // When there are no additional context options, we still want to spread the device inside.
|
|
201
|
-
// if (!serializedObject) serializedObject = '{\n}'
|
|
202
|
-
// const lines = serializedObject.split('\n')
|
|
203
|
-
// lines.splice(1, 0, `...devices[${quote(deviceName!)}],`)
|
|
204
|
-
// return lines.join('\n')
|
|
205
|
-
}
|
|
206
|
-
class JavaScriptFormatter {
|
|
207
|
-
_baseIndent;
|
|
208
|
-
_baseOffset;
|
|
209
|
-
_lines = [];
|
|
210
|
-
constructor(offset = 0) {
|
|
211
|
-
this._baseIndent = ' '.repeat(2);
|
|
212
|
-
this._baseOffset = ' '.repeat(offset);
|
|
213
|
-
}
|
|
214
|
-
prepend(text) {
|
|
215
|
-
this._lines = text
|
|
216
|
-
.trim()
|
|
217
|
-
.split('\n')
|
|
218
|
-
.map((line) => line.trim())
|
|
219
|
-
.concat(this._lines);
|
|
220
|
-
}
|
|
221
|
-
add(text) {
|
|
222
|
-
this._lines.push(...text
|
|
223
|
-
.trim()
|
|
224
|
-
.split('\n')
|
|
225
|
-
.map((line) => line.trim()));
|
|
226
|
-
}
|
|
227
|
-
newLine() {
|
|
228
|
-
this._lines.push('');
|
|
229
|
-
}
|
|
230
|
-
format() {
|
|
231
|
-
let spaces = '';
|
|
232
|
-
let previousLine = '';
|
|
233
|
-
return this._lines
|
|
234
|
-
.map((line) => {
|
|
235
|
-
if (line === '')
|
|
236
|
-
return line;
|
|
237
|
-
if (line.startsWith('}') || line.startsWith(']'))
|
|
238
|
-
spaces = spaces.substring(this._baseIndent.length);
|
|
239
|
-
const extraSpaces = /^(for|while|if|try).*\(.*\)$/.test(previousLine)
|
|
240
|
-
? this._baseIndent
|
|
241
|
-
: '';
|
|
242
|
-
previousLine = line;
|
|
243
|
-
const callCarryOver = line.startsWith('.set');
|
|
244
|
-
line =
|
|
245
|
-
spaces + extraSpaces + (callCarryOver ? this._baseIndent : '') + line;
|
|
246
|
-
if (line.endsWith('{') || line.endsWith('['))
|
|
247
|
-
spaces += this._baseIndent;
|
|
248
|
-
return this._baseOffset + line;
|
|
249
|
-
})
|
|
250
|
-
.join('\n');
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
exports.JavaScriptFormatter = JavaScriptFormatter;
|
|
254
|
-
function quote(text) {
|
|
255
|
-
return (0, string_utils_1.escapeWithQuotes)(text, "'");
|
|
256
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import type { BrowserContextOptions, LaunchOptions } from 'playwright-core';
|
|
2
|
-
import type { ActionInContext } from './generator';
|
|
3
|
-
import type { Point } from './recorder-types';
|
|
4
|
-
export type Signal = NavigationSignal | PopupSignal | DownloadSignal | DialogSignal;
|
|
5
|
-
export type ActionName = 'check' | 'click' | 'closePage' | 'fill' | 'navigate' | 'openPage' | 'press' | 'select' | 'uncheck' | 'setInputFiles' | 'assertText' | 'assertValue' | 'assertChecked' | 'assertVisible';
|
|
6
|
-
export type ActionBase = {
|
|
7
|
-
name: ActionName;
|
|
8
|
-
signals: Signal[];
|
|
9
|
-
};
|
|
10
|
-
export type ClickAction = ActionBase & {
|
|
11
|
-
name: 'click';
|
|
12
|
-
selector: string;
|
|
13
|
-
button: 'left' | 'middle' | 'right';
|
|
14
|
-
modifiers: number;
|
|
15
|
-
clickCount: number;
|
|
16
|
-
position?: Point;
|
|
17
|
-
};
|
|
18
|
-
export type CheckAction = ActionBase & {
|
|
19
|
-
name: 'check';
|
|
20
|
-
selector: string;
|
|
21
|
-
};
|
|
22
|
-
export type UncheckAction = ActionBase & {
|
|
23
|
-
name: 'uncheck';
|
|
24
|
-
selector: string;
|
|
25
|
-
};
|
|
26
|
-
export type FillAction = ActionBase & {
|
|
27
|
-
name: 'fill';
|
|
28
|
-
selector: string;
|
|
29
|
-
text: string;
|
|
30
|
-
};
|
|
31
|
-
export type NavigateAction = ActionBase & {
|
|
32
|
-
name: 'navigate';
|
|
33
|
-
url: string;
|
|
34
|
-
};
|
|
35
|
-
export type OpenPageAction = ActionBase & {
|
|
36
|
-
name: 'openPage';
|
|
37
|
-
url: string;
|
|
38
|
-
};
|
|
39
|
-
export type ClosesPageAction = ActionBase & {
|
|
40
|
-
name: 'closePage';
|
|
41
|
-
};
|
|
42
|
-
export type PressAction = ActionBase & {
|
|
43
|
-
name: 'press';
|
|
44
|
-
selector: string;
|
|
45
|
-
key: string;
|
|
46
|
-
modifiers: number;
|
|
47
|
-
};
|
|
48
|
-
export type SelectAction = ActionBase & {
|
|
49
|
-
name: 'select';
|
|
50
|
-
selector: string;
|
|
51
|
-
options: string[];
|
|
52
|
-
};
|
|
53
|
-
export type SetInputFilesAction = ActionBase & {
|
|
54
|
-
name: 'setInputFiles';
|
|
55
|
-
selector: string;
|
|
56
|
-
files: string[];
|
|
57
|
-
};
|
|
58
|
-
export type AssertTextAction = ActionBase & {
|
|
59
|
-
name: 'assertText';
|
|
60
|
-
selector: string;
|
|
61
|
-
text: string;
|
|
62
|
-
substring: boolean;
|
|
63
|
-
};
|
|
64
|
-
export type AssertValueAction = ActionBase & {
|
|
65
|
-
name: 'assertValue';
|
|
66
|
-
selector: string;
|
|
67
|
-
value: string;
|
|
68
|
-
};
|
|
69
|
-
export type AssertCheckedAction = ActionBase & {
|
|
70
|
-
name: 'assertChecked';
|
|
71
|
-
selector: string;
|
|
72
|
-
checked: boolean;
|
|
73
|
-
};
|
|
74
|
-
export type AssertVisibleAction = ActionBase & {
|
|
75
|
-
name: 'assertVisible';
|
|
76
|
-
selector: string;
|
|
77
|
-
};
|
|
78
|
-
export type Action = ClickAction | CheckAction | ClosesPageAction | OpenPageAction | UncheckAction | FillAction | NavigateAction | PressAction | SelectAction | SetInputFilesAction | AssertTextAction | AssertValueAction | AssertCheckedAction | AssertVisibleAction;
|
|
79
|
-
export type AssertAction = AssertCheckedAction | AssertValueAction | AssertTextAction | AssertVisibleAction;
|
|
80
|
-
export type BaseSignal = {};
|
|
81
|
-
export type NavigationSignal = BaseSignal & {
|
|
82
|
-
name: 'navigation';
|
|
83
|
-
url: string;
|
|
84
|
-
};
|
|
85
|
-
export type PopupSignal = BaseSignal & {
|
|
86
|
-
name: 'popup';
|
|
87
|
-
popupAlias: string;
|
|
88
|
-
};
|
|
89
|
-
export type DownloadSignal = BaseSignal & {
|
|
90
|
-
name: 'download';
|
|
91
|
-
downloadAlias: string;
|
|
92
|
-
};
|
|
93
|
-
export type DialogSignal = BaseSignal & {
|
|
94
|
-
name: 'dialog';
|
|
95
|
-
dialogAlias: string;
|
|
96
|
-
};
|
|
97
|
-
export type Language = 'javascript' | 'python' | 'java' | 'csharp' | 'jsonl';
|
|
98
|
-
export type LanguageGeneratorOptions = {
|
|
99
|
-
browserName: string;
|
|
100
|
-
launchOptions: LaunchOptions;
|
|
101
|
-
contextOptions: BrowserContextOptions;
|
|
102
|
-
deviceName?: string;
|
|
103
|
-
saveStorage?: string;
|
|
104
|
-
};
|
|
105
|
-
export interface LanguageGenerator {
|
|
106
|
-
id: string;
|
|
107
|
-
groupName: string;
|
|
108
|
-
name: string;
|
|
109
|
-
highlighter: Language;
|
|
110
|
-
generateHeader(options: LanguageGeneratorOptions): string;
|
|
111
|
-
generateAction(actionInContext: ActionInContext): string;
|
|
112
|
-
generateFooter(saveStorage: string | undefined): string;
|
|
113
|
-
}
|
|
114
|
-
export declare function toSignalMap(action: Action): {
|
|
115
|
-
popup: {
|
|
116
|
-
name: "popup";
|
|
117
|
-
popupAlias: string;
|
|
118
|
-
};
|
|
119
|
-
download: {
|
|
120
|
-
name: "download";
|
|
121
|
-
downloadAlias: string;
|
|
122
|
-
};
|
|
123
|
-
dialog: {
|
|
124
|
-
name: "dialog";
|
|
125
|
-
dialogAlias: string;
|
|
126
|
-
};
|
|
127
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toSignalMap = toSignalMap;
|
|
4
|
-
function toSignalMap(action) {
|
|
5
|
-
let popup;
|
|
6
|
-
let download;
|
|
7
|
-
let dialog;
|
|
8
|
-
for (const signal of action.signals) {
|
|
9
|
-
if (signal.name === 'popup')
|
|
10
|
-
popup = signal;
|
|
11
|
-
else if (signal.name === 'download')
|
|
12
|
-
download = signal;
|
|
13
|
-
else if (signal.name === 'dialog')
|
|
14
|
-
dialog = signal;
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
popup,
|
|
18
|
-
download,
|
|
19
|
-
dialog,
|
|
20
|
-
};
|
|
21
|
-
}
|