@intuned/runtime-dev 0.1.0-test.30 → 0.1.0-test.32
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/InterfaceTemplate/index.ts +1 -1
- package/WebTemplate/controllers/runApi/helpers.ts +1 -1
- package/dist/commands/interface/run.d.ts +1 -1
- package/dist/commands/interface/run.js +24 -10
- package/dist/common/getPlaywrightConstructs.js +5 -1
- package/dist/common/runApi/index.js +6 -5
- package/dist/common/runApi/types.d.ts +276 -61
- package/dist/common/runApi/types.js +26 -2
- package/package.json +1 -1
- package/playwright.config.js +0 -43
- package/preserve-dynamic-imports.js +0 -16
- package/testing +0 -0
- package/vite.config.js +0 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { runAutomationCLI } from "@intuned/runtime/dist/commands/interface/run";
|
|
@@ -65,6 +65,7 @@ export async function runApi({
|
|
|
65
65
|
|
|
66
66
|
const abortController = new AbortController();
|
|
67
67
|
|
|
68
|
+
backendFunctionsTokenManager.token = functionsToken;
|
|
68
69
|
const resultWithTimeout = await waitWithExtendableTimeout({
|
|
69
70
|
promise: runApiInternal({
|
|
70
71
|
automationFunction: {
|
|
@@ -91,7 +92,6 @@ export async function runApi({
|
|
|
91
92
|
filePath: getTraceFilePath(runId, attemptNumber),
|
|
92
93
|
}
|
|
93
94
|
: { enabled: false },
|
|
94
|
-
functionsToken,
|
|
95
95
|
abortSignal: abortController.signal,
|
|
96
96
|
importFunction: importModule,
|
|
97
97
|
}),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export
|
|
2
|
+
export declare function runAutomationCLI(importFunction?: (path: string) => Promise<any>): void;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.runAutomationCLI = runAutomationCLI;
|
|
4
8
|
var _commander = require("commander");
|
|
5
9
|
var _dotenv = _interopRequireDefault(require("dotenv"));
|
|
6
10
|
var _asyncLocalStorage = require("../../common/asyncLocalStorage");
|
|
@@ -18,6 +22,7 @@ const startRunApiSchema = _zod.default.object({
|
|
|
18
22
|
type: _zod.default.literal("start"),
|
|
19
23
|
parameters: _runApi.runApiParametersSchema.extend({
|
|
20
24
|
retrieveSession: _zod.default.boolean(),
|
|
25
|
+
functionsToken: _zod.default.string().optional(),
|
|
21
26
|
context: _zod.default.object({
|
|
22
27
|
jobId: _zod.default.string().optional(),
|
|
23
28
|
jobRunId: _zod.default.string().optional(),
|
|
@@ -46,7 +51,7 @@ const inputSchema = _zod.default.union([startRunApiSchema, nextRunApiSchema, abo
|
|
|
46
51
|
_dotenv.default.config({
|
|
47
52
|
path: `.env`
|
|
48
53
|
});
|
|
49
|
-
function
|
|
54
|
+
function runAutomationCLI(importFunction) {
|
|
50
55
|
_commander.program.description("run user automation and communicate using unix socket").argument("<socket-path>", "path to unix socket").action(async socketPath => {
|
|
51
56
|
let context;
|
|
52
57
|
const throttleTime = 1_000;
|
|
@@ -73,7 +78,9 @@ function main(importFunction) {
|
|
|
73
78
|
const jsonUnixSocket = new _unixSocket.JSONUnixSocket(client);
|
|
74
79
|
async function runGeneratorAndSendResult(next) {
|
|
75
80
|
const _generator = generator;
|
|
76
|
-
if (_generator == null) return
|
|
81
|
+
if (_generator == null) return {
|
|
82
|
+
done: true
|
|
83
|
+
};
|
|
77
84
|
const result = await (0, _asyncLocalStorage.runWithContext)(context, () => _generator.next(next));
|
|
78
85
|
if (result.done) {
|
|
79
86
|
const resultToSend = result.value.isOk() ? result.value.value : result.value.error.json;
|
|
@@ -83,14 +90,15 @@ function main(importFunction) {
|
|
|
83
90
|
result: resultToSend,
|
|
84
91
|
success
|
|
85
92
|
});
|
|
86
|
-
return true;
|
|
87
93
|
} else {
|
|
88
94
|
jsonUnixSocket.sendJSON({
|
|
89
95
|
type: "yield",
|
|
90
96
|
result: result.value
|
|
91
97
|
});
|
|
92
|
-
return false;
|
|
93
98
|
}
|
|
99
|
+
return {
|
|
100
|
+
done: result.done ?? false
|
|
101
|
+
};
|
|
94
102
|
}
|
|
95
103
|
for await (const data of jsonUnixSocket.receiveJSON()) {
|
|
96
104
|
const inputParseResult = inputSchema.safeParse(data);
|
|
@@ -99,7 +107,7 @@ function main(importFunction) {
|
|
|
99
107
|
jsonUnixSocket.sendJSON({
|
|
100
108
|
type: "done",
|
|
101
109
|
result: {
|
|
102
|
-
error: "
|
|
110
|
+
error: "InternalInvalidInputError",
|
|
103
111
|
message: "Invalid input",
|
|
104
112
|
details: {
|
|
105
113
|
errors: inputParseResult.error.errors
|
|
@@ -120,12 +128,12 @@ function main(importFunction) {
|
|
|
120
128
|
break;
|
|
121
129
|
}
|
|
122
130
|
if (input.type === "start") {
|
|
123
|
-
|
|
131
|
+
_jwtTokenManager.backendFunctionsTokenManager.token = input.parameters.functionsToken;
|
|
132
|
+
generator = (0, _runApi.runApiGenerator)({
|
|
124
133
|
...input.parameters,
|
|
125
134
|
abortSignal: abortController.signal,
|
|
126
135
|
importFunction
|
|
127
136
|
});
|
|
128
|
-
generator = gen;
|
|
129
137
|
context = {
|
|
130
138
|
extendedPayloads: [],
|
|
131
139
|
runEnvironment: input.parameters.runOptions.environment === "deployed" ? _enums.RunEnvironment.DEPLOYED : _enums.RunEnvironment.IDE,
|
|
@@ -141,7 +149,10 @@ function main(importFunction) {
|
|
|
141
149
|
...(input.parameters.context ?? {}),
|
|
142
150
|
proxy: getProxyUrlFromRunOptions(input.parameters.runOptions)
|
|
143
151
|
};
|
|
144
|
-
|
|
152
|
+
const {
|
|
153
|
+
done
|
|
154
|
+
} = await runGeneratorAndSendResult();
|
|
155
|
+
if (done) {
|
|
145
156
|
break;
|
|
146
157
|
}
|
|
147
158
|
continue;
|
|
@@ -150,7 +161,10 @@ function main(importFunction) {
|
|
|
150
161
|
if (!generator) {
|
|
151
162
|
throw new Error("generator not started");
|
|
152
163
|
}
|
|
153
|
-
|
|
164
|
+
const {
|
|
165
|
+
done
|
|
166
|
+
} = await runGeneratorAndSendResult(input.parameters.value);
|
|
167
|
+
if (done) {
|
|
154
168
|
break;
|
|
155
169
|
}
|
|
156
170
|
continue;
|
|
@@ -173,5 +187,5 @@ function getProxyUrlFromRunOptions(runOptions) {
|
|
|
173
187
|
return url.toString();
|
|
174
188
|
}
|
|
175
189
|
if (require.main === module) {
|
|
176
|
-
|
|
190
|
+
runAutomationCLI();
|
|
177
191
|
}
|
|
@@ -151,7 +151,11 @@ async function loadSessionToContext({
|
|
|
151
151
|
}) {
|
|
152
152
|
let sessionToLoad;
|
|
153
153
|
if (session.type === "state") {
|
|
154
|
-
|
|
154
|
+
const state = session.state;
|
|
155
|
+
if (state === undefined || state === null) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
sessionToLoad = state;
|
|
155
159
|
} else {
|
|
156
160
|
const fullPath = (0, _fileUtils.getFullPathInProject)(session.path);
|
|
157
161
|
sessionToLoad = await fs.readJson(fullPath);
|
|
@@ -15,7 +15,6 @@ var _downloadDirectory = require("../../runtime/downloadDirectory");
|
|
|
15
15
|
var _asyncLocalStorage = require("../asyncLocalStorage");
|
|
16
16
|
var _fsExtra = _interopRequireWildcard(require("fs-extra"));
|
|
17
17
|
var fs = _fsExtra;
|
|
18
|
-
var _jwtTokenManager = require("../jwtTokenManager");
|
|
19
18
|
var _contextStorageStateHelpers = require("../contextStorageStateHelpers");
|
|
20
19
|
var _neverthrow = require("neverthrow");
|
|
21
20
|
var _errors = require("./errors.js");
|
|
@@ -57,10 +56,8 @@ async function* runApiGenerator({
|
|
|
57
56
|
automationFunction,
|
|
58
57
|
runOptions,
|
|
59
58
|
tracing,
|
|
60
|
-
auth
|
|
61
|
-
functionsToken
|
|
59
|
+
auth
|
|
62
60
|
} = _types.runApiParametersSchema.parse(input);
|
|
63
|
-
_jwtTokenManager.backendFunctionsTokenManager.token = functionsToken;
|
|
64
61
|
let page;
|
|
65
62
|
let context;
|
|
66
63
|
let downloadsPath;
|
|
@@ -120,7 +117,11 @@ async function* runApiGenerator({
|
|
|
120
117
|
});
|
|
121
118
|
});
|
|
122
119
|
if (auth && auth.session.type === "state") {
|
|
123
|
-
|
|
120
|
+
const state = auth.session.state;
|
|
121
|
+
if (state === undefined || state === null) {
|
|
122
|
+
return (0, _neverthrow.err)(new _errors.AuthRequiredError());
|
|
123
|
+
}
|
|
124
|
+
await (0, _contextStorageStateHelpers.setContextStorageState)(context, state);
|
|
124
125
|
}
|
|
125
126
|
async function* runAutomation() {
|
|
126
127
|
var _getExecutionContext;
|
|
@@ -36,12 +36,91 @@ export declare const runApiSessionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
36
36
|
path: string;
|
|
37
37
|
}>, z.ZodObject<{
|
|
38
38
|
type: z.ZodLiteral<"state">;
|
|
39
|
-
state: z.
|
|
40
|
-
cookies: {
|
|
39
|
+
state: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
40
|
+
cookies: z.ZodArray<z.ZodObject<{
|
|
41
|
+
name: z.ZodString;
|
|
42
|
+
value: z.ZodString;
|
|
43
|
+
domain: z.ZodString;
|
|
44
|
+
path: z.ZodString;
|
|
45
|
+
expires: z.ZodNumber;
|
|
46
|
+
httpOnly: z.ZodBoolean;
|
|
47
|
+
secure: z.ZodBoolean;
|
|
48
|
+
sameSite: z.ZodEnum<["Strict", "Lax", "None"]>;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
50
|
name: string;
|
|
42
51
|
value: string;
|
|
52
|
+
path: string;
|
|
43
53
|
domain: string;
|
|
54
|
+
expires: number;
|
|
55
|
+
httpOnly: boolean;
|
|
56
|
+
secure: boolean;
|
|
57
|
+
sameSite: "Strict" | "Lax" | "None";
|
|
58
|
+
}, {
|
|
59
|
+
name: string;
|
|
60
|
+
value: string;
|
|
61
|
+
path: string;
|
|
62
|
+
domain: string;
|
|
63
|
+
expires: number;
|
|
64
|
+
httpOnly: boolean;
|
|
65
|
+
secure: boolean;
|
|
66
|
+
sameSite: "Strict" | "Lax" | "None";
|
|
67
|
+
}>, "many">;
|
|
68
|
+
origins: z.ZodArray<z.ZodObject<{
|
|
69
|
+
origin: z.ZodString;
|
|
70
|
+
localStorage: z.ZodArray<z.ZodObject<{
|
|
71
|
+
name: z.ZodString;
|
|
72
|
+
value: z.ZodString;
|
|
73
|
+
}, "strip", z.ZodTypeAny, {
|
|
74
|
+
name: string;
|
|
75
|
+
value: string;
|
|
76
|
+
}, {
|
|
77
|
+
name: string;
|
|
78
|
+
value: string;
|
|
79
|
+
}>, "many">;
|
|
80
|
+
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
origin: string;
|
|
82
|
+
localStorage: {
|
|
83
|
+
name: string;
|
|
84
|
+
value: string;
|
|
85
|
+
}[];
|
|
86
|
+
}, {
|
|
87
|
+
origin: string;
|
|
88
|
+
localStorage: {
|
|
89
|
+
name: string;
|
|
90
|
+
value: string;
|
|
91
|
+
}[];
|
|
92
|
+
}>, "many">;
|
|
93
|
+
sessionStorage: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
94
|
+
origin: z.ZodString;
|
|
95
|
+
sessionStorage: z.ZodArray<z.ZodObject<{
|
|
96
|
+
name: z.ZodString;
|
|
97
|
+
value: z.ZodString;
|
|
98
|
+
}, "strip", z.ZodTypeAny, {
|
|
99
|
+
name: string;
|
|
100
|
+
value: string;
|
|
101
|
+
}, {
|
|
102
|
+
name: string;
|
|
103
|
+
value: string;
|
|
104
|
+
}>, "many">;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
origin: string;
|
|
107
|
+
sessionStorage: {
|
|
108
|
+
name: string;
|
|
109
|
+
value: string;
|
|
110
|
+
}[];
|
|
111
|
+
}, {
|
|
112
|
+
origin: string;
|
|
113
|
+
sessionStorage: {
|
|
114
|
+
name: string;
|
|
115
|
+
value: string;
|
|
116
|
+
}[];
|
|
117
|
+
}>, "many">>;
|
|
118
|
+
}, "strip", z.ZodTypeAny, {
|
|
119
|
+
cookies: {
|
|
120
|
+
name: string;
|
|
121
|
+
value: string;
|
|
44
122
|
path: string;
|
|
123
|
+
domain: string;
|
|
45
124
|
expires: number;
|
|
46
125
|
httpOnly: boolean;
|
|
47
126
|
secure: boolean;
|
|
@@ -54,14 +133,19 @@ export declare const runApiSessionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
54
133
|
value: string;
|
|
55
134
|
}[];
|
|
56
135
|
}[];
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
136
|
+
sessionStorage?: {
|
|
137
|
+
origin: string;
|
|
138
|
+
sessionStorage: {
|
|
139
|
+
name: string;
|
|
140
|
+
value: string;
|
|
141
|
+
}[];
|
|
142
|
+
}[] | undefined;
|
|
143
|
+
}, {
|
|
60
144
|
cookies: {
|
|
61
145
|
name: string;
|
|
62
146
|
value: string;
|
|
63
|
-
domain: string;
|
|
64
147
|
path: string;
|
|
148
|
+
domain: string;
|
|
65
149
|
expires: number;
|
|
66
150
|
httpOnly: boolean;
|
|
67
151
|
secure: boolean;
|
|
@@ -74,17 +158,22 @@ export declare const runApiSessionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
74
158
|
value: string;
|
|
75
159
|
}[];
|
|
76
160
|
}[];
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
161
|
+
sessionStorage?: {
|
|
162
|
+
origin: string;
|
|
163
|
+
sessionStorage: {
|
|
164
|
+
name: string;
|
|
165
|
+
value: string;
|
|
166
|
+
}[];
|
|
167
|
+
}[] | undefined;
|
|
168
|
+
}>>>;
|
|
80
169
|
}, "strip", z.ZodTypeAny, {
|
|
81
170
|
type: "state";
|
|
82
|
-
state
|
|
171
|
+
state?: {
|
|
83
172
|
cookies: {
|
|
84
173
|
name: string;
|
|
85
174
|
value: string;
|
|
86
|
-
domain: string;
|
|
87
175
|
path: string;
|
|
176
|
+
domain: string;
|
|
88
177
|
expires: number;
|
|
89
178
|
httpOnly: boolean;
|
|
90
179
|
secure: boolean;
|
|
@@ -97,17 +186,22 @@ export declare const runApiSessionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
97
186
|
value: string;
|
|
98
187
|
}[];
|
|
99
188
|
}[];
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
189
|
+
sessionStorage?: {
|
|
190
|
+
origin: string;
|
|
191
|
+
sessionStorage: {
|
|
192
|
+
name: string;
|
|
193
|
+
value: string;
|
|
194
|
+
}[];
|
|
195
|
+
}[] | undefined;
|
|
196
|
+
} | null | undefined;
|
|
103
197
|
}, {
|
|
104
198
|
type: "state";
|
|
105
|
-
state
|
|
199
|
+
state?: {
|
|
106
200
|
cookies: {
|
|
107
201
|
name: string;
|
|
108
202
|
value: string;
|
|
109
|
-
domain: string;
|
|
110
203
|
path: string;
|
|
204
|
+
domain: string;
|
|
111
205
|
expires: number;
|
|
112
206
|
httpOnly: boolean;
|
|
113
207
|
secure: boolean;
|
|
@@ -120,12 +214,16 @@ export declare const runApiSessionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
120
214
|
value: string;
|
|
121
215
|
}[];
|
|
122
216
|
}[];
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
217
|
+
sessionStorage?: {
|
|
218
|
+
origin: string;
|
|
219
|
+
sessionStorage: {
|
|
220
|
+
name: string;
|
|
221
|
+
value: string;
|
|
222
|
+
}[];
|
|
223
|
+
}[] | undefined;
|
|
224
|
+
} | null | undefined;
|
|
126
225
|
}>]>;
|
|
127
226
|
export declare const runApiParametersSchema: z.ZodObject<{
|
|
128
|
-
functionsToken: z.ZodOptional<z.ZodString>;
|
|
129
227
|
automationFunction: z.ZodObject<{
|
|
130
228
|
name: z.ZodString;
|
|
131
229
|
params: z.ZodOptional<z.ZodAny>;
|
|
@@ -164,12 +262,91 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
164
262
|
path: string;
|
|
165
263
|
}>, z.ZodObject<{
|
|
166
264
|
type: z.ZodLiteral<"state">;
|
|
167
|
-
state: z.
|
|
168
|
-
cookies: {
|
|
265
|
+
state: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
266
|
+
cookies: z.ZodArray<z.ZodObject<{
|
|
267
|
+
name: z.ZodString;
|
|
268
|
+
value: z.ZodString;
|
|
269
|
+
domain: z.ZodString;
|
|
270
|
+
path: z.ZodString;
|
|
271
|
+
expires: z.ZodNumber;
|
|
272
|
+
httpOnly: z.ZodBoolean;
|
|
273
|
+
secure: z.ZodBoolean;
|
|
274
|
+
sameSite: z.ZodEnum<["Strict", "Lax", "None"]>;
|
|
275
|
+
}, "strip", z.ZodTypeAny, {
|
|
276
|
+
name: string;
|
|
277
|
+
value: string;
|
|
278
|
+
path: string;
|
|
279
|
+
domain: string;
|
|
280
|
+
expires: number;
|
|
281
|
+
httpOnly: boolean;
|
|
282
|
+
secure: boolean;
|
|
283
|
+
sameSite: "Strict" | "Lax" | "None";
|
|
284
|
+
}, {
|
|
169
285
|
name: string;
|
|
170
286
|
value: string;
|
|
287
|
+
path: string;
|
|
171
288
|
domain: string;
|
|
289
|
+
expires: number;
|
|
290
|
+
httpOnly: boolean;
|
|
291
|
+
secure: boolean;
|
|
292
|
+
sameSite: "Strict" | "Lax" | "None";
|
|
293
|
+
}>, "many">;
|
|
294
|
+
origins: z.ZodArray<z.ZodObject<{
|
|
295
|
+
origin: z.ZodString;
|
|
296
|
+
localStorage: z.ZodArray<z.ZodObject<{
|
|
297
|
+
name: z.ZodString;
|
|
298
|
+
value: z.ZodString;
|
|
299
|
+
}, "strip", z.ZodTypeAny, {
|
|
300
|
+
name: string;
|
|
301
|
+
value: string;
|
|
302
|
+
}, {
|
|
303
|
+
name: string;
|
|
304
|
+
value: string;
|
|
305
|
+
}>, "many">;
|
|
306
|
+
}, "strip", z.ZodTypeAny, {
|
|
307
|
+
origin: string;
|
|
308
|
+
localStorage: {
|
|
309
|
+
name: string;
|
|
310
|
+
value: string;
|
|
311
|
+
}[];
|
|
312
|
+
}, {
|
|
313
|
+
origin: string;
|
|
314
|
+
localStorage: {
|
|
315
|
+
name: string;
|
|
316
|
+
value: string;
|
|
317
|
+
}[];
|
|
318
|
+
}>, "many">;
|
|
319
|
+
sessionStorage: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
320
|
+
origin: z.ZodString;
|
|
321
|
+
sessionStorage: z.ZodArray<z.ZodObject<{
|
|
322
|
+
name: z.ZodString;
|
|
323
|
+
value: z.ZodString;
|
|
324
|
+
}, "strip", z.ZodTypeAny, {
|
|
325
|
+
name: string;
|
|
326
|
+
value: string;
|
|
327
|
+
}, {
|
|
328
|
+
name: string;
|
|
329
|
+
value: string;
|
|
330
|
+
}>, "many">;
|
|
331
|
+
}, "strip", z.ZodTypeAny, {
|
|
332
|
+
origin: string;
|
|
333
|
+
sessionStorage: {
|
|
334
|
+
name: string;
|
|
335
|
+
value: string;
|
|
336
|
+
}[];
|
|
337
|
+
}, {
|
|
338
|
+
origin: string;
|
|
339
|
+
sessionStorage: {
|
|
340
|
+
name: string;
|
|
341
|
+
value: string;
|
|
342
|
+
}[];
|
|
343
|
+
}>, "many">>;
|
|
344
|
+
}, "strip", z.ZodTypeAny, {
|
|
345
|
+
cookies: {
|
|
346
|
+
name: string;
|
|
347
|
+
value: string;
|
|
172
348
|
path: string;
|
|
349
|
+
domain: string;
|
|
173
350
|
expires: number;
|
|
174
351
|
httpOnly: boolean;
|
|
175
352
|
secure: boolean;
|
|
@@ -182,14 +359,19 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
182
359
|
value: string;
|
|
183
360
|
}[];
|
|
184
361
|
}[];
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
362
|
+
sessionStorage?: {
|
|
363
|
+
origin: string;
|
|
364
|
+
sessionStorage: {
|
|
365
|
+
name: string;
|
|
366
|
+
value: string;
|
|
367
|
+
}[];
|
|
368
|
+
}[] | undefined;
|
|
369
|
+
}, {
|
|
188
370
|
cookies: {
|
|
189
371
|
name: string;
|
|
190
372
|
value: string;
|
|
191
|
-
domain: string;
|
|
192
373
|
path: string;
|
|
374
|
+
domain: string;
|
|
193
375
|
expires: number;
|
|
194
376
|
httpOnly: boolean;
|
|
195
377
|
secure: boolean;
|
|
@@ -202,17 +384,22 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
202
384
|
value: string;
|
|
203
385
|
}[];
|
|
204
386
|
}[];
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
387
|
+
sessionStorage?: {
|
|
388
|
+
origin: string;
|
|
389
|
+
sessionStorage: {
|
|
390
|
+
name: string;
|
|
391
|
+
value: string;
|
|
392
|
+
}[];
|
|
393
|
+
}[] | undefined;
|
|
394
|
+
}>>>;
|
|
208
395
|
}, "strip", z.ZodTypeAny, {
|
|
209
396
|
type: "state";
|
|
210
|
-
state
|
|
397
|
+
state?: {
|
|
211
398
|
cookies: {
|
|
212
399
|
name: string;
|
|
213
400
|
value: string;
|
|
214
|
-
domain: string;
|
|
215
401
|
path: string;
|
|
402
|
+
domain: string;
|
|
216
403
|
expires: number;
|
|
217
404
|
httpOnly: boolean;
|
|
218
405
|
secure: boolean;
|
|
@@ -225,17 +412,22 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
225
412
|
value: string;
|
|
226
413
|
}[];
|
|
227
414
|
}[];
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
415
|
+
sessionStorage?: {
|
|
416
|
+
origin: string;
|
|
417
|
+
sessionStorage: {
|
|
418
|
+
name: string;
|
|
419
|
+
value: string;
|
|
420
|
+
}[];
|
|
421
|
+
}[] | undefined;
|
|
422
|
+
} | null | undefined;
|
|
231
423
|
}, {
|
|
232
424
|
type: "state";
|
|
233
|
-
state
|
|
425
|
+
state?: {
|
|
234
426
|
cookies: {
|
|
235
427
|
name: string;
|
|
236
428
|
value: string;
|
|
237
|
-
domain: string;
|
|
238
429
|
path: string;
|
|
430
|
+
domain: string;
|
|
239
431
|
expires: number;
|
|
240
432
|
httpOnly: boolean;
|
|
241
433
|
secure: boolean;
|
|
@@ -248,9 +440,14 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
248
440
|
value: string;
|
|
249
441
|
}[];
|
|
250
442
|
}[];
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
443
|
+
sessionStorage?: {
|
|
444
|
+
origin: string;
|
|
445
|
+
sessionStorage: {
|
|
446
|
+
name: string;
|
|
447
|
+
value: string;
|
|
448
|
+
}[];
|
|
449
|
+
}[] | undefined;
|
|
450
|
+
} | null | undefined;
|
|
254
451
|
}>]>;
|
|
255
452
|
runCheck: z.ZodDefault<z.ZodBoolean>;
|
|
256
453
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -259,12 +456,12 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
259
456
|
path: string;
|
|
260
457
|
} | {
|
|
261
458
|
type: "state";
|
|
262
|
-
state
|
|
459
|
+
state?: {
|
|
263
460
|
cookies: {
|
|
264
461
|
name: string;
|
|
265
462
|
value: string;
|
|
266
|
-
domain: string;
|
|
267
463
|
path: string;
|
|
464
|
+
domain: string;
|
|
268
465
|
expires: number;
|
|
269
466
|
httpOnly: boolean;
|
|
270
467
|
secure: boolean;
|
|
@@ -277,9 +474,14 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
277
474
|
value: string;
|
|
278
475
|
}[];
|
|
279
476
|
}[];
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
477
|
+
sessionStorage?: {
|
|
478
|
+
origin: string;
|
|
479
|
+
sessionStorage: {
|
|
480
|
+
name: string;
|
|
481
|
+
value: string;
|
|
482
|
+
}[];
|
|
483
|
+
}[] | undefined;
|
|
484
|
+
} | null | undefined;
|
|
283
485
|
};
|
|
284
486
|
runCheck: boolean;
|
|
285
487
|
}, {
|
|
@@ -288,12 +490,12 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
288
490
|
path: string;
|
|
289
491
|
} | {
|
|
290
492
|
type: "state";
|
|
291
|
-
state
|
|
493
|
+
state?: {
|
|
292
494
|
cookies: {
|
|
293
495
|
name: string;
|
|
294
496
|
value: string;
|
|
295
|
-
domain: string;
|
|
296
497
|
path: string;
|
|
498
|
+
domain: string;
|
|
297
499
|
expires: number;
|
|
298
500
|
httpOnly: boolean;
|
|
299
501
|
secure: boolean;
|
|
@@ -306,9 +508,14 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
306
508
|
value: string;
|
|
307
509
|
}[];
|
|
308
510
|
}[];
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
511
|
+
sessionStorage?: {
|
|
512
|
+
origin: string;
|
|
513
|
+
sessionStorage: {
|
|
514
|
+
name: string;
|
|
515
|
+
value: string;
|
|
516
|
+
}[];
|
|
517
|
+
}[] | undefined;
|
|
518
|
+
} | null | undefined;
|
|
312
519
|
};
|
|
313
520
|
runCheck?: boolean | undefined;
|
|
314
521
|
}>>;
|
|
@@ -383,19 +590,18 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
383
590
|
cdpAddress: string;
|
|
384
591
|
};
|
|
385
592
|
retrieveSession: boolean;
|
|
386
|
-
functionsToken?: string | undefined;
|
|
387
593
|
auth?: {
|
|
388
594
|
session: {
|
|
389
595
|
type: "file";
|
|
390
596
|
path: string;
|
|
391
597
|
} | {
|
|
392
598
|
type: "state";
|
|
393
|
-
state
|
|
599
|
+
state?: {
|
|
394
600
|
cookies: {
|
|
395
601
|
name: string;
|
|
396
602
|
value: string;
|
|
397
|
-
domain: string;
|
|
398
603
|
path: string;
|
|
604
|
+
domain: string;
|
|
399
605
|
expires: number;
|
|
400
606
|
httpOnly: boolean;
|
|
401
607
|
secure: boolean;
|
|
@@ -408,9 +614,14 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
408
614
|
value: string;
|
|
409
615
|
}[];
|
|
410
616
|
}[];
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
617
|
+
sessionStorage?: {
|
|
618
|
+
origin: string;
|
|
619
|
+
sessionStorage: {
|
|
620
|
+
name: string;
|
|
621
|
+
value: string;
|
|
622
|
+
}[];
|
|
623
|
+
}[] | undefined;
|
|
624
|
+
} | null | undefined;
|
|
414
625
|
};
|
|
415
626
|
runCheck: boolean;
|
|
416
627
|
} | undefined;
|
|
@@ -419,7 +630,6 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
419
630
|
name: string;
|
|
420
631
|
params?: any;
|
|
421
632
|
};
|
|
422
|
-
functionsToken?: string | undefined;
|
|
423
633
|
tracing?: {
|
|
424
634
|
enabled: false;
|
|
425
635
|
} | {
|
|
@@ -432,12 +642,12 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
432
642
|
path: string;
|
|
433
643
|
} | {
|
|
434
644
|
type: "state";
|
|
435
|
-
state
|
|
645
|
+
state?: {
|
|
436
646
|
cookies: {
|
|
437
647
|
name: string;
|
|
438
648
|
value: string;
|
|
439
|
-
domain: string;
|
|
440
649
|
path: string;
|
|
650
|
+
domain: string;
|
|
441
651
|
expires: number;
|
|
442
652
|
httpOnly: boolean;
|
|
443
653
|
secure: boolean;
|
|
@@ -450,9 +660,14 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
450
660
|
value: string;
|
|
451
661
|
}[];
|
|
452
662
|
}[];
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
663
|
+
sessionStorage?: {
|
|
664
|
+
origin: string;
|
|
665
|
+
sessionStorage: {
|
|
666
|
+
name: string;
|
|
667
|
+
value: string;
|
|
668
|
+
}[];
|
|
669
|
+
}[] | undefined;
|
|
670
|
+
} | null | undefined;
|
|
456
671
|
};
|
|
457
672
|
runCheck?: boolean | undefined;
|
|
458
673
|
} | undefined;
|
|
@@ -11,10 +11,34 @@ const runApiSessionSchema = exports.runApiSessionSchema = _zod.default.discrimin
|
|
|
11
11
|
path: _zod.default.string()
|
|
12
12
|
}), _zod.default.object({
|
|
13
13
|
type: _zod.default.literal("state"),
|
|
14
|
-
state: _zod.default.
|
|
14
|
+
state: _zod.default.object({
|
|
15
|
+
cookies: _zod.default.array(_zod.default.object({
|
|
16
|
+
name: _zod.default.string(),
|
|
17
|
+
value: _zod.default.string(),
|
|
18
|
+
domain: _zod.default.string(),
|
|
19
|
+
path: _zod.default.string(),
|
|
20
|
+
expires: _zod.default.number(),
|
|
21
|
+
httpOnly: _zod.default.boolean(),
|
|
22
|
+
secure: _zod.default.boolean(),
|
|
23
|
+
sameSite: _zod.default.enum(["Strict", "Lax", "None"])
|
|
24
|
+
})),
|
|
25
|
+
origins: _zod.default.array(_zod.default.object({
|
|
26
|
+
origin: _zod.default.string(),
|
|
27
|
+
localStorage: _zod.default.array(_zod.default.object({
|
|
28
|
+
name: _zod.default.string(),
|
|
29
|
+
value: _zod.default.string()
|
|
30
|
+
}))
|
|
31
|
+
})),
|
|
32
|
+
sessionStorage: _zod.default.array(_zod.default.object({
|
|
33
|
+
origin: _zod.default.string(),
|
|
34
|
+
sessionStorage: _zod.default.array(_zod.default.object({
|
|
35
|
+
name: _zod.default.string(),
|
|
36
|
+
value: _zod.default.string()
|
|
37
|
+
}))
|
|
38
|
+
})).optional()
|
|
39
|
+
}).nullable().optional()
|
|
15
40
|
})]);
|
|
16
41
|
const runApiParametersSchema = exports.runApiParametersSchema = _zod.default.object({
|
|
17
|
-
functionsToken: _zod.default.string().optional(),
|
|
18
42
|
automationFunction: _zod.default.object({
|
|
19
43
|
name: _zod.default.string(),
|
|
20
44
|
params: _zod.default.any().optional()
|
package/package.json
CHANGED
package/playwright.config.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { defineConfig, devices } from "@intuned/playwright-test";
|
|
2
|
-
/**
|
|
3
|
-
* Read environment variables from file.
|
|
4
|
-
* https://github.com/motdotla/dotenv
|
|
5
|
-
*/
|
|
6
|
-
// require('dotenv').config();
|
|
7
|
-
/**
|
|
8
|
-
* See https://playwright.dev/docs/test-configuration.
|
|
9
|
-
*/
|
|
10
|
-
export default defineConfig({
|
|
11
|
-
testDir: "./e2e-tests",
|
|
12
|
-
/* Run tests in files in parallel */
|
|
13
|
-
fullyParallel: true,
|
|
14
|
-
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
15
|
-
forbidOnly: !!process.env.CI,
|
|
16
|
-
/* Retry on CI only */
|
|
17
|
-
retries: process.env.CI ? 2 : 0,
|
|
18
|
-
/* Opt out of parallel tests on CI. */
|
|
19
|
-
workers: process.env.CI ? 1 : undefined,
|
|
20
|
-
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
|
21
|
-
reporter: "html",
|
|
22
|
-
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
23
|
-
use: {
|
|
24
|
-
/* Base URL to use in actions like `await page.goto('/')`. */
|
|
25
|
-
// baseURL: 'http://127.0.0.1:3000',
|
|
26
|
-
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
27
|
-
trace: "on-first-retry",
|
|
28
|
-
// headless: false,
|
|
29
|
-
},
|
|
30
|
-
/* Configure projects for major browsers */
|
|
31
|
-
projects: [
|
|
32
|
-
{
|
|
33
|
-
name: "chromium",
|
|
34
|
-
use: { ...devices["Desktop Chrome"] },
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
/* Run your local dev server before starting the tests */
|
|
38
|
-
// webServer: {
|
|
39
|
-
// command: 'npm run start',
|
|
40
|
-
// url: 'http://127.0.0.1:3000',
|
|
41
|
-
// reuseExistingServer: !process.env.CI,
|
|
42
|
-
// },
|
|
43
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
module.exports = function ({ template }) {
|
|
2
|
-
return {
|
|
3
|
-
visitor: {
|
|
4
|
-
CallExpression(path) {
|
|
5
|
-
if (path.node.callee.type === "Import") {
|
|
6
|
-
const buildRequire = template(`Promise.resolve(require(ARGUMENT))`);
|
|
7
|
-
path.replaceWith(
|
|
8
|
-
buildRequire({
|
|
9
|
-
ARGUMENT: path.node.arguments[0],
|
|
10
|
-
})
|
|
11
|
-
);
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
};
|
package/testing
DELETED
|
Binary file
|
package/vite.config.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "vite";
|
|
2
|
-
import macros from "vite-plugin-babel-macros";
|
|
3
|
-
require('dotenv').config();
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
test: {
|
|
6
|
-
reporters: ['verbose', "html"],
|
|
7
|
-
outputFile: { html: './reports/html/index.html' },
|
|
8
|
-
testTimeout: 30000,
|
|
9
|
-
env: {
|
|
10
|
-
RUN_ENVIRONMENT: "AUTHORING",
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
plugins: [
|
|
14
|
-
macros(),
|
|
15
|
-
],
|
|
16
|
-
});
|