@intuned/runtime-dev 1.2.1-hooks.9 → 1.2.1-results.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/CHANGELOG.md +2 -1
- package/dist/commands/api/run.js +6 -2
- package/dist/commands/auth-sessions/load.js +3 -3
- package/dist/commands/auth-sessions/run-check.js +2 -1
- package/dist/commands/auth-sessions/run-create.js +35 -12
- package/dist/commands/interface/run.d.ts +1 -1
- package/dist/commands/interface/run.js +40 -14
- package/dist/commands/intuned-cli/controller/api.js +2 -1
- package/dist/commands/intuned-cli/controller/authSession.d.ts +6 -6
- package/dist/commands/intuned-cli/controller/authSession.js +4 -3
- package/dist/commands/intuned-cli/helpers/auth.d.ts +1 -1
- package/dist/commands/intuned-cli/helpers/errors.d.ts +2 -2
- package/dist/commands/intuned-cli/helpers/errors.js +4 -8
- package/dist/common/asyncLocalStorage/index.d.ts +0 -1
- package/dist/common/getPlaywrightConstructs.d.ts +30 -0
- package/dist/common/{playwrightContext.js → getPlaywrightConstructs.js} +80 -132
- package/dist/common/runApi/errors.d.ts +9 -2
- package/dist/common/runApi/errors.js +17 -3
- package/dist/common/runApi/index.d.ts +7 -2
- package/dist/common/runApi/index.js +185 -87
- package/dist/common/runApi/types.d.ts +25 -21
- package/dist/common/runApi/types.js +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +20 -7
- package/dist/runtime/export.d.ts +43 -49
- package/dist/runtime/index.d.ts +2 -1
- package/dist/runtime/index.js +11 -5
- package/dist/runtime/requestMoreInfo.d.ts +18 -0
- package/dist/runtime/requestMoreInfo.js +25 -0
- package/package.json +1 -3
- package/dist/common/initializeContextHook.d.ts +0 -16
- package/dist/common/initializeContextHook.js +0 -15
- package/dist/common/playwrightContext.d.ts +0 -49
- package/dist/common/runApi/importUsingImportFunction.d.ts +0 -9
- package/dist/common/runApi/importUsingImportFunction.js +0 -46
- package/dist/runtime/store.d.ts +0 -2
- package/dist/runtime/store.js +0 -23
|
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
|
+
runApiGenerator: true,
|
|
7
8
|
runApi: true,
|
|
8
9
|
checkAuthSessionWithRetries: true
|
|
9
10
|
};
|
|
10
11
|
exports.checkAuthSessionWithRetries = checkAuthSessionWithRetries;
|
|
11
12
|
exports.runApi = runApi;
|
|
13
|
+
exports.runApiGenerator = runApiGenerator;
|
|
12
14
|
var _downloadDirectory = require("../../runtime/downloadDirectory");
|
|
13
15
|
var _asyncLocalStorage = require("../asyncLocalStorage");
|
|
14
16
|
var _fsExtra = _interopRequireWildcard(require("fs-extra"));
|
|
@@ -28,7 +30,7 @@ Object.keys(_errors).forEach(function (key) {
|
|
|
28
30
|
});
|
|
29
31
|
});
|
|
30
32
|
var _constants = require("../constants");
|
|
31
|
-
var
|
|
33
|
+
var _getPlaywrightConstructs = require("../getPlaywrightConstructs");
|
|
32
34
|
var _types = require("./types");
|
|
33
35
|
Object.keys(_types).forEach(function (key) {
|
|
34
36
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -43,13 +45,19 @@ Object.keys(_types).forEach(function (key) {
|
|
|
43
45
|
});
|
|
44
46
|
var _formatZodError = require("../formatZodError");
|
|
45
47
|
var _cleanEnvironmentVariables = require("../cleanEnvironmentVariables");
|
|
46
|
-
var _importUsingImportFunction = require("./importUsingImportFunction");
|
|
47
48
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
48
49
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
49
|
-
|
|
50
|
+
function getObjectSizeInBytes(obj) {
|
|
51
|
+
try {
|
|
52
|
+
return new TextEncoder().encode(JSON.stringify(obj)).length;
|
|
53
|
+
} catch (error) {
|
|
54
|
+
return new TextEncoder().encode(String(obj)).length;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async function* runApiGenerator({
|
|
58
|
+
retrieveSession = false,
|
|
50
59
|
abortSignal,
|
|
51
60
|
importFunction,
|
|
52
|
-
retrieveSession = false,
|
|
53
61
|
...input
|
|
54
62
|
}) {
|
|
55
63
|
let traceStarted = false;
|
|
@@ -58,10 +66,7 @@ async function runApi({
|
|
|
58
66
|
return (0, _neverthrow.err)(new _errors.InternalInvalidInputError("Input validation failed", (0, _formatZodError.formatZodError)(inputParseResult.error)));
|
|
59
67
|
}
|
|
60
68
|
const {
|
|
61
|
-
automationFunction
|
|
62
|
-
name,
|
|
63
|
-
params
|
|
64
|
-
},
|
|
69
|
+
automationFunction,
|
|
65
70
|
runOptions,
|
|
66
71
|
tracing,
|
|
67
72
|
auth
|
|
@@ -73,103 +78,166 @@ async function runApi({
|
|
|
73
78
|
resolve(abortSymbol);
|
|
74
79
|
});
|
|
75
80
|
});
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
let context;
|
|
82
|
+
let downloadsPath;
|
|
83
|
+
async function saveTraceIfNeeded({
|
|
84
|
+
errorMessage
|
|
85
|
+
}) {
|
|
86
|
+
if (!tracing.enabled || !traceStarted) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
await context?.tracing.stop({
|
|
91
|
+
path: tracing.filePath
|
|
92
|
+
});
|
|
93
|
+
} catch (error) {
|
|
94
|
+
console.log(errorMessage, error?.message);
|
|
95
|
+
await (0, _fsExtra.remove)(tracing.filePath);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async function* runAutomation() {
|
|
99
|
+
let page;
|
|
100
|
+
const validatedModuleResult = await importUsingImportFunction(automationFunction.name, importFunction);
|
|
81
101
|
if (validatedModuleResult.isErr()) {
|
|
82
102
|
return (0, _neverthrow.err)(validatedModuleResult.error);
|
|
83
103
|
}
|
|
84
|
-
const
|
|
104
|
+
const importedModule = validatedModuleResult.value;
|
|
105
|
+
let checkFn;
|
|
106
|
+
if (auth?.runCheck) {
|
|
107
|
+
if (!auth.session) {
|
|
108
|
+
return (0, _neverthrow.err)(new _errors.AuthRequiredError());
|
|
109
|
+
}
|
|
110
|
+
const checkImportResult = await importUsingImportFunction(`${_constants.AUTH_SESSIONS_FOLDER_NAME}/check`, importFunction);
|
|
111
|
+
if (checkImportResult.isErr()) {
|
|
112
|
+
return (0, _neverthrow.err)(checkImportResult.error);
|
|
113
|
+
}
|
|
114
|
+
if (checkImportResult.value.type !== "async") {
|
|
115
|
+
return (0, _neverthrow.err)(new _errors.InvalidCheckError("Check function is not an async function"));
|
|
116
|
+
}
|
|
117
|
+
checkFn = checkImportResult.value.func;
|
|
118
|
+
}
|
|
85
119
|
if (auth && auth.session.type === "state") {
|
|
86
120
|
const state = auth.session.state;
|
|
87
121
|
if (state === undefined || state === null) {
|
|
88
122
|
return (0, _neverthrow.err)(new _errors.AuthRequiredError());
|
|
89
123
|
}
|
|
90
124
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
125
|
+
if (runOptions.environment === "standalone") {
|
|
126
|
+
downloadsPath = (0, _downloadDirectory.getDownloadDirectoryPath)();
|
|
127
|
+
const {
|
|
128
|
+
headless,
|
|
129
|
+
proxy
|
|
130
|
+
} = runOptions;
|
|
131
|
+
({
|
|
132
|
+
page,
|
|
133
|
+
context
|
|
134
|
+
} = await (0, _getPlaywrightConstructs.getProductionPlaywrightConstructs)({
|
|
135
|
+
headless,
|
|
136
|
+
proxy,
|
|
137
|
+
downloadsPath,
|
|
138
|
+
storageState: auth?.session
|
|
139
|
+
}));
|
|
140
|
+
} else {
|
|
141
|
+
const {
|
|
142
|
+
mode,
|
|
143
|
+
cdpAddress
|
|
144
|
+
} = runOptions;
|
|
145
|
+
({
|
|
146
|
+
page,
|
|
147
|
+
context
|
|
148
|
+
} = await (0, _getPlaywrightConstructs.getPlaywrightConstructsForMode)(mode, cdpAddress, auth?.session));
|
|
149
|
+
}
|
|
150
|
+
if (tracing.enabled) {
|
|
151
|
+
await context.tracing.start({
|
|
152
|
+
screenshots: true,
|
|
153
|
+
snapshots: true,
|
|
154
|
+
sources: true
|
|
121
155
|
});
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
await context.tracing.start({
|
|
127
|
-
screenshots: true,
|
|
128
|
-
snapshots: true,
|
|
129
|
-
sources: true
|
|
130
|
-
});
|
|
131
|
-
traceStarted = true;
|
|
132
|
-
}
|
|
133
|
-
(0, _cleanEnvironmentVariables.cleanEnvironmentVariables)();
|
|
134
|
-
const automationFunctionParameters = [...(params !== undefined ? [params] : []), page, context];
|
|
156
|
+
traceStarted = true;
|
|
157
|
+
}
|
|
158
|
+
(0, _cleanEnvironmentVariables.cleanEnvironmentVariables)();
|
|
159
|
+
if (checkFn !== undefined) {
|
|
135
160
|
try {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
161
|
+
console.log("Running auth check");
|
|
162
|
+
const authCheckResult = await checkAuthSessionWithRetries(page, context, checkFn, 2);
|
|
163
|
+
if (authCheckResult.isErr()) {
|
|
164
|
+
const error = authCheckResult.error;
|
|
165
|
+
if (["APINotFoundError", "InvalidAPIError"].includes(error.code)) {
|
|
166
|
+
return (0, _neverthrow.err)(new _errors.InvalidCheckError(`Auth session check function failed`, error));
|
|
167
|
+
}
|
|
168
|
+
return authCheckResult;
|
|
169
|
+
}
|
|
170
|
+
if (!authCheckResult.value) {
|
|
171
|
+
return (0, _neverthrow.err)(new _errors.AuthCheckFailedError());
|
|
172
|
+
}
|
|
141
173
|
} catch (error) {
|
|
142
|
-
return (0, _neverthrow.err)(new _errors.
|
|
143
|
-
} finally {
|
|
144
|
-
await saveTraceIfNeeded({
|
|
145
|
-
errorMessage: "failed to save trace"
|
|
146
|
-
});
|
|
174
|
+
return (0, _neverthrow.err)(new _errors.AuthCheckFailedError());
|
|
147
175
|
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
176
|
+
}
|
|
177
|
+
const automationFunctionParameters = [...(automationFunction.params !== undefined ? [automationFunction.params] : []), page, context];
|
|
178
|
+
let result;
|
|
179
|
+
if (importedModule.type === "async-generator") {
|
|
180
|
+
const generator = importedModule.generator(...automationFunctionParameters);
|
|
181
|
+
let next = undefined;
|
|
182
|
+
while (true) {
|
|
183
|
+
const generatorResult = await generator.next(...(next ? [next] : []));
|
|
184
|
+
if (!generatorResult.done) {
|
|
185
|
+
next = yield generatorResult.value;
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
result = generatorResult.value;
|
|
189
|
+
break;
|
|
160
190
|
}
|
|
161
191
|
} else {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
192
|
+
result = await importedModule.func(...automationFunctionParameters);
|
|
193
|
+
}
|
|
194
|
+
const MAX_RESULT_SIZE_BYTES = 2 * 1024 * 1024;
|
|
195
|
+
const resultSizeInBytes = getObjectSizeInBytes(result);
|
|
196
|
+
if (resultSizeInBytes > MAX_RESULT_SIZE_BYTES) {
|
|
197
|
+
return (0, _neverthrow.err)(new _errors.ResultTooBigError(resultSizeInBytes, MAX_RESULT_SIZE_BYTES));
|
|
198
|
+
}
|
|
199
|
+
return (0, _neverthrow.ok)({
|
|
200
|
+
result,
|
|
201
|
+
extendedPayloads: (0, _asyncLocalStorage.getExecutionContext)()?.extendedPayloads,
|
|
202
|
+
session: retrieveSession ? await (0, _contextStorageStateHelpers.getStorageState)(context) : undefined
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
try {
|
|
206
|
+
const generator = runAutomation();
|
|
207
|
+
let next = undefined;
|
|
208
|
+
while (true) {
|
|
209
|
+
const result = await Promise.race([generator.next(await next), abortPromise]);
|
|
210
|
+
if (result === abortSymbol) {
|
|
211
|
+
return (0, _neverthrow.err)(new _errors.AbortedError());
|
|
212
|
+
}
|
|
213
|
+
if (!result.done) {
|
|
214
|
+
next = yield result.value;
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
return result.value;
|
|
218
|
+
}
|
|
219
|
+
} catch (error) {
|
|
220
|
+
return (0, _neverthrow.err)(new _errors.AutomationError(error));
|
|
221
|
+
} finally {
|
|
222
|
+
await saveTraceIfNeeded({
|
|
223
|
+
errorMessage: "failed to save trace"
|
|
224
|
+
});
|
|
225
|
+
await context?.close();
|
|
226
|
+
if (downloadsPath !== undefined) {
|
|
227
|
+
await fs.remove(downloadsPath);
|
|
166
228
|
}
|
|
167
229
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
230
|
+
}
|
|
231
|
+
async function runApi(params) {
|
|
232
|
+
const generator = runApiGenerator(params);
|
|
233
|
+
const {
|
|
234
|
+
value,
|
|
235
|
+
done
|
|
236
|
+
} = await generator.next();
|
|
237
|
+
if (done) {
|
|
238
|
+
return value;
|
|
171
239
|
}
|
|
172
|
-
return
|
|
240
|
+
return (0, _neverthrow.err)(new _errors.InvalidApiError("Expected API to be async function, got async generator"));
|
|
173
241
|
}
|
|
174
242
|
async function checkAuthSessionWithRetries(page, context, checkFn, retries = 3) {
|
|
175
243
|
if (retries === 0) {
|
|
@@ -183,4 +251,34 @@ async function checkAuthSessionWithRetries(page, context, checkFn, retries = 3)
|
|
|
183
251
|
tryNumber++;
|
|
184
252
|
}
|
|
185
253
|
return (0, _neverthrow.ok)(false);
|
|
254
|
+
}
|
|
255
|
+
async function importUsingImportFunction(path, importFunction) {
|
|
256
|
+
try {
|
|
257
|
+
const importedResult = await importFunction(path);
|
|
258
|
+
if (importedResult.isErr()) {
|
|
259
|
+
if (importedResult.error.type === "not_found") {
|
|
260
|
+
return (0, _neverthrow.err)(new _errors.ApiNotFoundError(path));
|
|
261
|
+
}
|
|
262
|
+
return (0, _neverthrow.err)(new _errors.AutomationError(importedResult.error.error));
|
|
263
|
+
}
|
|
264
|
+
const imported = importedResult.value;
|
|
265
|
+
if (!imported || !imported.default || !imported.default.constructor) {
|
|
266
|
+
return (0, _neverthrow.err)(new _errors.InvalidApiError("API file path does not have a default export"));
|
|
267
|
+
}
|
|
268
|
+
if (imported.default.constructor.name === "AsyncGeneratorFunction") {
|
|
269
|
+
return (0, _neverthrow.ok)({
|
|
270
|
+
type: "async-generator",
|
|
271
|
+
generator: imported.default
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
if (imported.default.constructor.name === "AsyncFunction") {
|
|
275
|
+
return (0, _neverthrow.ok)({
|
|
276
|
+
type: "async",
|
|
277
|
+
func: imported.default
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
return (0, _neverthrow.err)(new _errors.InvalidApiError("API file path does not have a default async function/generator export"));
|
|
281
|
+
} catch (error) {
|
|
282
|
+
return (0, _neverthrow.err)(new _errors.AutomationError(error));
|
|
283
|
+
}
|
|
186
284
|
}
|
|
@@ -36,18 +36,18 @@ export declare const runApiStorageStateSchema: z.ZodObject<{
|
|
|
36
36
|
secure: z.ZodBoolean;
|
|
37
37
|
sameSite: z.ZodEnum<["Strict", "Lax", "None"]>;
|
|
38
38
|
}, "strip", z.ZodTypeAny, {
|
|
39
|
-
path: string;
|
|
40
39
|
value: string;
|
|
41
40
|
name: string;
|
|
41
|
+
path: string;
|
|
42
42
|
domain: string;
|
|
43
43
|
expires: number;
|
|
44
44
|
httpOnly: boolean;
|
|
45
45
|
secure: boolean;
|
|
46
46
|
sameSite: "Strict" | "Lax" | "None";
|
|
47
47
|
}, {
|
|
48
|
-
path: string;
|
|
49
48
|
value: string;
|
|
50
49
|
name: string;
|
|
50
|
+
path: string;
|
|
51
51
|
domain: string;
|
|
52
52
|
expires: number;
|
|
53
53
|
httpOnly: boolean;
|
|
@@ -106,9 +106,9 @@ export declare const runApiStorageStateSchema: z.ZodObject<{
|
|
|
106
106
|
}>, "many">>;
|
|
107
107
|
}, "strip", z.ZodTypeAny, {
|
|
108
108
|
cookies: {
|
|
109
|
-
path: string;
|
|
110
109
|
value: string;
|
|
111
110
|
name: string;
|
|
111
|
+
path: string;
|
|
112
112
|
domain: string;
|
|
113
113
|
expires: number;
|
|
114
114
|
httpOnly: boolean;
|
|
@@ -131,9 +131,9 @@ export declare const runApiStorageStateSchema: z.ZodObject<{
|
|
|
131
131
|
}[] | undefined;
|
|
132
132
|
}, {
|
|
133
133
|
cookies: {
|
|
134
|
-
path: string;
|
|
135
134
|
value: string;
|
|
136
135
|
name: string;
|
|
136
|
+
path: string;
|
|
137
137
|
domain: string;
|
|
138
138
|
expires: number;
|
|
139
139
|
httpOnly: boolean;
|
|
@@ -178,18 +178,18 @@ export declare const runApiSessionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
178
178
|
secure: z.ZodBoolean;
|
|
179
179
|
sameSite: z.ZodEnum<["Strict", "Lax", "None"]>;
|
|
180
180
|
}, "strip", z.ZodTypeAny, {
|
|
181
|
-
path: string;
|
|
182
181
|
value: string;
|
|
183
182
|
name: string;
|
|
183
|
+
path: string;
|
|
184
184
|
domain: string;
|
|
185
185
|
expires: number;
|
|
186
186
|
httpOnly: boolean;
|
|
187
187
|
secure: boolean;
|
|
188
188
|
sameSite: "Strict" | "Lax" | "None";
|
|
189
189
|
}, {
|
|
190
|
-
path: string;
|
|
191
190
|
value: string;
|
|
192
191
|
name: string;
|
|
192
|
+
path: string;
|
|
193
193
|
domain: string;
|
|
194
194
|
expires: number;
|
|
195
195
|
httpOnly: boolean;
|
|
@@ -248,9 +248,9 @@ export declare const runApiSessionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
248
248
|
}>, "many">>;
|
|
249
249
|
}, "strip", z.ZodTypeAny, {
|
|
250
250
|
cookies: {
|
|
251
|
-
path: string;
|
|
252
251
|
value: string;
|
|
253
252
|
name: string;
|
|
253
|
+
path: string;
|
|
254
254
|
domain: string;
|
|
255
255
|
expires: number;
|
|
256
256
|
httpOnly: boolean;
|
|
@@ -273,9 +273,9 @@ export declare const runApiSessionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
273
273
|
}[] | undefined;
|
|
274
274
|
}, {
|
|
275
275
|
cookies: {
|
|
276
|
-
path: string;
|
|
277
276
|
value: string;
|
|
278
277
|
name: string;
|
|
278
|
+
path: string;
|
|
279
279
|
domain: string;
|
|
280
280
|
expires: number;
|
|
281
281
|
httpOnly: boolean;
|
|
@@ -301,9 +301,9 @@ export declare const runApiSessionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
301
301
|
type: "state";
|
|
302
302
|
state?: {
|
|
303
303
|
cookies: {
|
|
304
|
-
path: string;
|
|
305
304
|
value: string;
|
|
306
305
|
name: string;
|
|
306
|
+
path: string;
|
|
307
307
|
domain: string;
|
|
308
308
|
expires: number;
|
|
309
309
|
httpOnly: boolean;
|
|
@@ -329,9 +329,9 @@ export declare const runApiSessionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
329
329
|
type: "state";
|
|
330
330
|
state?: {
|
|
331
331
|
cookies: {
|
|
332
|
-
path: string;
|
|
333
332
|
value: string;
|
|
334
333
|
name: string;
|
|
334
|
+
path: string;
|
|
335
335
|
domain: string;
|
|
336
336
|
expires: number;
|
|
337
337
|
httpOnly: boolean;
|
|
@@ -404,18 +404,18 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
404
404
|
secure: z.ZodBoolean;
|
|
405
405
|
sameSite: z.ZodEnum<["Strict", "Lax", "None"]>;
|
|
406
406
|
}, "strip", z.ZodTypeAny, {
|
|
407
|
-
path: string;
|
|
408
407
|
value: string;
|
|
409
408
|
name: string;
|
|
409
|
+
path: string;
|
|
410
410
|
domain: string;
|
|
411
411
|
expires: number;
|
|
412
412
|
httpOnly: boolean;
|
|
413
413
|
secure: boolean;
|
|
414
414
|
sameSite: "Strict" | "Lax" | "None";
|
|
415
415
|
}, {
|
|
416
|
-
path: string;
|
|
417
416
|
value: string;
|
|
418
417
|
name: string;
|
|
418
|
+
path: string;
|
|
419
419
|
domain: string;
|
|
420
420
|
expires: number;
|
|
421
421
|
httpOnly: boolean;
|
|
@@ -474,9 +474,9 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
474
474
|
}>, "many">>;
|
|
475
475
|
}, "strip", z.ZodTypeAny, {
|
|
476
476
|
cookies: {
|
|
477
|
-
path: string;
|
|
478
477
|
value: string;
|
|
479
478
|
name: string;
|
|
479
|
+
path: string;
|
|
480
480
|
domain: string;
|
|
481
481
|
expires: number;
|
|
482
482
|
httpOnly: boolean;
|
|
@@ -499,9 +499,9 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
499
499
|
}[] | undefined;
|
|
500
500
|
}, {
|
|
501
501
|
cookies: {
|
|
502
|
-
path: string;
|
|
503
502
|
value: string;
|
|
504
503
|
name: string;
|
|
504
|
+
path: string;
|
|
505
505
|
domain: string;
|
|
506
506
|
expires: number;
|
|
507
507
|
httpOnly: boolean;
|
|
@@ -527,9 +527,9 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
527
527
|
type: "state";
|
|
528
528
|
state?: {
|
|
529
529
|
cookies: {
|
|
530
|
-
path: string;
|
|
531
530
|
value: string;
|
|
532
531
|
name: string;
|
|
532
|
+
path: string;
|
|
533
533
|
domain: string;
|
|
534
534
|
expires: number;
|
|
535
535
|
httpOnly: boolean;
|
|
@@ -555,9 +555,9 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
555
555
|
type: "state";
|
|
556
556
|
state?: {
|
|
557
557
|
cookies: {
|
|
558
|
-
path: string;
|
|
559
558
|
value: string;
|
|
560
559
|
name: string;
|
|
560
|
+
path: string;
|
|
561
561
|
domain: string;
|
|
562
562
|
expires: number;
|
|
563
563
|
httpOnly: boolean;
|
|
@@ -580,6 +580,7 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
580
580
|
}[] | undefined;
|
|
581
581
|
} | null | undefined;
|
|
582
582
|
}>]>;
|
|
583
|
+
runCheck: z.ZodDefault<z.ZodBoolean>;
|
|
583
584
|
}, "strip", z.ZodTypeAny, {
|
|
584
585
|
session: {
|
|
585
586
|
path: string;
|
|
@@ -588,9 +589,9 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
588
589
|
type: "state";
|
|
589
590
|
state?: {
|
|
590
591
|
cookies: {
|
|
591
|
-
path: string;
|
|
592
592
|
value: string;
|
|
593
593
|
name: string;
|
|
594
|
+
path: string;
|
|
594
595
|
domain: string;
|
|
595
596
|
expires: number;
|
|
596
597
|
httpOnly: boolean;
|
|
@@ -613,6 +614,7 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
613
614
|
}[] | undefined;
|
|
614
615
|
} | null | undefined;
|
|
615
616
|
};
|
|
617
|
+
runCheck: boolean;
|
|
616
618
|
}, {
|
|
617
619
|
session: {
|
|
618
620
|
path: string;
|
|
@@ -621,9 +623,9 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
621
623
|
type: "state";
|
|
622
624
|
state?: {
|
|
623
625
|
cookies: {
|
|
624
|
-
path: string;
|
|
625
626
|
value: string;
|
|
626
627
|
name: string;
|
|
628
|
+
path: string;
|
|
627
629
|
domain: string;
|
|
628
630
|
expires: number;
|
|
629
631
|
httpOnly: boolean;
|
|
@@ -646,6 +648,7 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
646
648
|
}[] | undefined;
|
|
647
649
|
} | null | undefined;
|
|
648
650
|
};
|
|
651
|
+
runCheck?: boolean | undefined;
|
|
649
652
|
}>>;
|
|
650
653
|
runOptions: z.ZodDefault<z.ZodDiscriminatedUnion<"environment", [z.ZodObject<{
|
|
651
654
|
environment: z.ZodLiteral<"standalone">;
|
|
@@ -726,9 +729,9 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
726
729
|
type: "state";
|
|
727
730
|
state?: {
|
|
728
731
|
cookies: {
|
|
729
|
-
path: string;
|
|
730
732
|
value: string;
|
|
731
733
|
name: string;
|
|
734
|
+
path: string;
|
|
732
735
|
domain: string;
|
|
733
736
|
expires: number;
|
|
734
737
|
httpOnly: boolean;
|
|
@@ -751,6 +754,7 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
751
754
|
}[] | undefined;
|
|
752
755
|
} | null | undefined;
|
|
753
756
|
};
|
|
757
|
+
runCheck: boolean;
|
|
754
758
|
} | undefined;
|
|
755
759
|
}, {
|
|
756
760
|
automationFunction: {
|
|
@@ -771,9 +775,9 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
771
775
|
type: "state";
|
|
772
776
|
state?: {
|
|
773
777
|
cookies: {
|
|
774
|
-
path: string;
|
|
775
778
|
value: string;
|
|
776
779
|
name: string;
|
|
780
|
+
path: string;
|
|
777
781
|
domain: string;
|
|
778
782
|
expires: number;
|
|
779
783
|
httpOnly: boolean;
|
|
@@ -796,6 +800,7 @@ export declare const runApiParametersSchema: z.ZodObject<{
|
|
|
796
800
|
}[] | undefined;
|
|
797
801
|
} | null | undefined;
|
|
798
802
|
};
|
|
803
|
+
runCheck?: boolean | undefined;
|
|
799
804
|
} | undefined;
|
|
800
805
|
runOptions?: {
|
|
801
806
|
environment: "standalone";
|
|
@@ -832,4 +837,3 @@ export type RunApiResultWithSessionOk<R = any> = RunApiResultOk<R> & {
|
|
|
832
837
|
session: RunApiStorageState;
|
|
833
838
|
};
|
|
834
839
|
export type RunApiResult<R = any, FullResult extends RunApiResultOk<R> = RunApiResultOk<R>> = Result<FullResult, RunAutomationError>;
|
|
835
|
-
export type { ImportFunction } from "./importUsingImportFunction";
|
|
@@ -53,7 +53,8 @@ const runApiParametersSchema = exports.runApiParametersSchema = _zod.default.obj
|
|
|
53
53
|
enabled: false
|
|
54
54
|
}),
|
|
55
55
|
auth: _zod.default.object({
|
|
56
|
-
session: runApiSessionSchema
|
|
56
|
+
session: runApiSessionSchema,
|
|
57
|
+
runCheck: _zod.default.boolean().default(false)
|
|
57
58
|
}).optional(),
|
|
58
59
|
runOptions: _zod.default.discriminatedUnion("environment", [_zod.default.object({
|
|
59
60
|
environment: _zod.default.literal("standalone"),
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { extendPayload, extendTimeout, runInfo, RunError,
|
|
1
|
+
export { extendPayload, extendTimeout, runInfo, RunError, requestMultipleChoice, requestOTP, getAuthSessionParameters, } from "./runtime";
|
|
2
2
|
export { runWithContext, getExecutionContext, } from "./common/asyncLocalStorage";
|
|
3
3
|
export { getDownloadDirectoryPath } from "./runtime/downloadDirectory";
|
|
4
|
+
export { getProductionPlaywrightConstructs } from "./common/getPlaywrightConstructs";
|
package/dist/index.js
CHANGED
|
@@ -39,24 +39,37 @@ Object.defineProperty(exports, "getExecutionContext", {
|
|
|
39
39
|
return _asyncLocalStorage.getExecutionContext;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
-
Object.defineProperty(exports, "
|
|
42
|
+
Object.defineProperty(exports, "getProductionPlaywrightConstructs", {
|
|
43
43
|
enumerable: true,
|
|
44
44
|
get: function () {
|
|
45
|
-
return
|
|
45
|
+
return _getPlaywrightConstructs.getProductionPlaywrightConstructs;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
-
Object.defineProperty(exports, "
|
|
48
|
+
Object.defineProperty(exports, "requestMultipleChoice", {
|
|
49
49
|
enumerable: true,
|
|
50
50
|
get: function () {
|
|
51
|
-
return
|
|
51
|
+
return _runtime.requestMultipleChoice;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "requestOTP", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _runtime.requestOTP;
|
|
52
58
|
}
|
|
53
59
|
});
|
|
54
|
-
Object.defineProperty(exports, "
|
|
60
|
+
Object.defineProperty(exports, "runInfo", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _runtime.runInfo;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "runWithContext", {
|
|
55
67
|
enumerable: true,
|
|
56
68
|
get: function () {
|
|
57
|
-
return
|
|
69
|
+
return _asyncLocalStorage.runWithContext;
|
|
58
70
|
}
|
|
59
71
|
});
|
|
60
72
|
var _runtime = require("./runtime");
|
|
61
73
|
var _asyncLocalStorage = require("./common/asyncLocalStorage");
|
|
62
|
-
var _downloadDirectory = require("./runtime/downloadDirectory");
|
|
74
|
+
var _downloadDirectory = require("./runtime/downloadDirectory");
|
|
75
|
+
var _getPlaywrightConstructs = require("./common/getPlaywrightConstructs");
|