@intuned/runtime-dev 0.0.1 → 0.1.0-test.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/InterfaceTemplate/index.ts +1 -0
- package/Intuned.json +5 -0
- package/WebTemplate/api.ts +92 -90
- package/WebTemplate/controllers/authSessions/check.ts +23 -29
- package/WebTemplate/controllers/authSessions/create.ts +46 -71
- package/WebTemplate/controllers/authSessions/index.ts +4 -4
- package/WebTemplate/controllers/authSessions/killOperation.ts +1 -1
- package/WebTemplate/controllers/authSessions/resumeOperation.ts +28 -52
- package/WebTemplate/controllers/authSessions/store.ts +11 -6
- package/WebTemplate/controllers/runApi/helpers.ts +49 -146
- package/WebTemplate/index.playwright.ts +42 -32
- package/WebTemplate/index.vanilla.ts +2 -20
- package/WebTemplate/jobs.ts +2 -13
- package/WebTemplate/utils.ts +1 -85
- package/WebTemplate.zip +0 -0
- package/api/authed.ts +12 -0
- package/api/test.ts +3 -0
- package/api/test2.ts +25 -0
- package/auth-sessions/check.ts +9 -0
- package/auth-sessions/create.ts +32 -0
- package/authSessions +1 -0
- package/bin/intuned-api-run +2 -0
- package/bin/intuned-auth-session-check +2 -0
- package/bin/intuned-auth-session-create +2 -0
- package/bin/intuned-auth-session-load +2 -0
- package/bin/intuned-auth-session-refresh +2 -0
- package/bin/intuned-browser-save-state +2 -0
- package/bin/intuned-browser-start +2 -0
- package/bin/intuned-build +2 -0
- package/bin/intuned-ts-check +2 -0
- package/dist/commands/api/run.d.ts +6 -0
- package/dist/commands/api/run.js +113 -0
- package/dist/commands/auth-sessions/load.d.ts +2 -0
- package/dist/commands/auth-sessions/load.js +32 -0
- package/dist/commands/auth-sessions/run-check.d.ts +2 -0
- package/dist/commands/auth-sessions/run-check.js +56 -0
- package/dist/commands/auth-sessions/run-create.d.ts +2 -0
- package/dist/commands/auth-sessions/run-create.js +96 -0
- package/dist/commands/browser/save-state.d.ts +2 -0
- package/dist/commands/browser/save-state.js +17 -0
- package/dist/commands/browser/start-browser.d.ts +2 -0
- package/dist/commands/browser/start-browser.js +14 -0
- package/dist/commands/build.d.ts +2 -0
- package/dist/commands/build.js +83 -0
- package/dist/commands/common/browserUtils.d.ts +14 -0
- package/dist/commands/common/browserUtils.js +58 -0
- package/dist/commands/common/getDefaultExportFromFile.d.ts +1 -0
- package/dist/commands/common/getDefaultExportFromFile.js +19 -0
- package/dist/commands/common/getFirstLineNumber.d.ts +9 -0
- package/dist/commands/common/getFirstLineNumber.js +103 -0
- package/{src/commands/common/getFirstLineNumber.test.ts → dist/commands/common/getFirstLineNumber.test.js} +75 -121
- package/dist/commands/common/sendMessageToClient.d.ts +1 -0
- package/dist/commands/common/sendMessageToClient.js +10 -0
- package/dist/commands/common/utils/fileUtils.d.ts +6 -0
- package/dist/commands/common/utils/fileUtils.js +33 -0
- package/dist/commands/common/utils/settings.d.ts +2 -0
- package/dist/commands/common/utils/settings.js +28 -0
- package/dist/commands/common/utils/unixSocket.d.ts +9 -0
- package/dist/commands/common/utils/unixSocket.js +45 -0
- package/dist/commands/common/utils/webTemplate.d.ts +1 -0
- package/dist/commands/common/utils/webTemplate.js +31 -0
- package/dist/commands/interface/run.d.ts +2 -0
- package/dist/commands/interface/run.js +161 -0
- package/dist/commands/ts-check.d.ts +2 -0
- package/dist/commands/ts-check.js +54 -0
- package/dist/common/Logger/Logger/index.d.ts +12 -0
- package/dist/common/Logger/Logger/index.js +60 -0
- package/{src/common/Logger/Logger/types.ts → dist/common/Logger/Logger/types.d.ts} +4 -5
- package/dist/common/Logger/Logger/types.js +5 -0
- package/dist/common/Logger/index.d.ts +12 -0
- package/dist/common/Logger/index.js +60 -0
- package/{src/common/Logger/types.ts → dist/common/Logger/types.d.ts} +4 -5
- package/dist/common/Logger/types.js +5 -0
- package/dist/common/asyncLocalStorage/index.d.ts +16 -0
- package/dist/common/asyncLocalStorage/index.js +17 -0
- package/dist/common/cleanEnvironmentVariables.d.ts +1 -0
- package/dist/common/cleanEnvironmentVariables.js +16 -0
- package/dist/common/constants.d.ts +1 -0
- package/dist/common/constants.js +7 -0
- package/dist/common/contextStorageStateHelpers.d.ts +14 -0
- package/dist/common/contextStorageStateHelpers.js +50 -0
- package/dist/common/getPlaywrightConstructs.d.ts +30 -0
- package/dist/common/getPlaywrightConstructs.js +192 -0
- package/dist/common/jwtTokenManager.d.ts +16 -0
- package/dist/common/jwtTokenManager.js +81 -0
- package/dist/common/runApi/errors.d.ts +71 -0
- package/dist/common/runApi/errors.js +172 -0
- package/dist/common/runApi/index.d.ts +12 -0
- package/dist/common/runApi/index.js +288 -0
- package/dist/common/runApi/types.d.ts +486 -0
- package/dist/common/runApi/types.js +50 -0
- package/dist/common/settingsSchema.d.ts +19 -0
- package/dist/common/settingsSchema.js +17 -0
- package/dist/common/telemetry.d.ts +3 -0
- package/dist/common/telemetry.js +32 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +69 -0
- package/dist/runtime/RunError.d.ts +5 -0
- package/dist/runtime/RunError.js +19 -0
- package/dist/runtime/downloadDirectory.d.ts +1 -0
- package/dist/runtime/downloadDirectory.js +19 -0
- package/dist/runtime/enums.d.js +5 -0
- package/dist/runtime/enums.js +18 -0
- package/dist/runtime/executionHelpers.test.js +53 -0
- package/dist/runtime/export.d.js +5 -0
- package/dist/runtime/extendPayload.d.ts +2 -0
- package/dist/runtime/extendPayload.js +21 -0
- package/dist/runtime/extendTimeout.d.ts +1 -0
- package/dist/runtime/extendTimeout.js +30 -0
- package/{src/runtime/index.ts → dist/runtime/index.d.ts} +2 -3
- package/dist/runtime/index.js +53 -0
- package/dist/runtime/requestMoreInfo.d.ts +18 -0
- package/dist/runtime/requestMoreInfo.js +25 -0
- package/dist/runtime/runInfo.d.ts +2 -0
- package/dist/runtime/runInfo.js +21 -0
- package/output.txt +39 -0
- package/package.json +9 -7
- package/testing +0 -0
- package/tsconfig.json +2 -1
- package/.vite/deps_temp_01af7156/package.json +0 -3
- package/.vscode/extensions.json +0 -3
- package/.vscode/launch.json +0 -102
- package/.vscode/settings.json +0 -12
- package/playwright.config.ts +0 -48
- package/src/commands/api/run.ts +0 -225
- package/src/commands/auth-sessions/load.ts +0 -42
- package/src/commands/auth-sessions/run-check.ts +0 -70
- package/src/commands/auth-sessions/run-create.ts +0 -124
- package/src/commands/browser/save-state.ts +0 -22
- package/src/commands/browser/start-browser.ts +0 -17
- package/src/commands/build.ts +0 -125
- package/src/commands/common/browserUtils.ts +0 -80
- package/src/commands/common/getDefaultExportFromFile.ts +0 -13
- package/src/commands/common/getFirstLineNumber.ts +0 -146
- package/src/commands/common/sendMessageToClient.ts +0 -8
- package/src/commands/common/utils/fileUtils.ts +0 -25
- package/src/commands/common/utils/settings.ts +0 -23
- package/src/commands/common/utils/webTemplate.ts +0 -46
- package/src/commands/testing/saveVisibleHtml.ts +0 -29
- package/src/commands/ts-check.ts +0 -88
- package/src/common/Logger/Logger/index.ts +0 -64
- package/src/common/Logger/index.ts +0 -64
- package/src/common/asyncLocalStorage/index.ts +0 -29
- package/src/common/cleanEnvironmentVariables.ts +0 -13
- package/src/common/constants.ts +0 -1
- package/src/common/contextStorageStateHelpers.ts +0 -71
- package/src/common/getPlaywrightConstructs.ts +0 -283
- package/src/common/jwtTokenManager.ts +0 -111
- package/src/common/settingsSchema.ts +0 -16
- package/src/common/telemetry.ts +0 -49
- package/src/index.ts +0 -14
- package/src/runtime/RunError.ts +0 -16
- package/src/runtime/downloadDirectory.ts +0 -14
- package/src/runtime/enums.ts +0 -11
- package/src/runtime/executionHelpers.test.ts +0 -70
- package/src/runtime/extendPayload.ts +0 -22
- package/src/runtime/extendTimeout.ts +0 -32
- package/src/runtime/requestMoreInfo.ts +0 -40
- package/src/runtime/runInfo.ts +0 -19
- package/vite.config.ts +0 -17
- /package/{src → dist}/common/assets/browser_scripts.js +0 -0
- /package/{src → dist}/runtime/enums.d.ts +0 -0
- /package/{src → dist}/runtime/export.d.ts +0 -0
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
import type { IntunedStorageState } from "../contextStorageStateHelpers";
|
|
2
|
+
import type { Payload } from "../../runtime/export";
|
|
3
|
+
import type { Result } from "neverthrow";
|
|
4
|
+
import type { RunAutomationError } from "./errors";
|
|
5
|
+
import z from "zod";
|
|
6
|
+
export interface PayloadToAppend {
|
|
7
|
+
apiName: string;
|
|
8
|
+
parameters: Record<string, any>;
|
|
9
|
+
}
|
|
10
|
+
export interface RunAutomationSuccessResult {
|
|
11
|
+
result: any;
|
|
12
|
+
status: number;
|
|
13
|
+
payloadToAppend: PayloadToAppend[] | null;
|
|
14
|
+
session?: IntunedStorageState;
|
|
15
|
+
}
|
|
16
|
+
export interface RunAutomationErrorResult {
|
|
17
|
+
error: string;
|
|
18
|
+
message: string;
|
|
19
|
+
status?: number;
|
|
20
|
+
details?: any;
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}
|
|
23
|
+
export type RunAutomationResult = RunAutomationSuccessResult | RunAutomationErrorResult;
|
|
24
|
+
export interface RunAutomationResponse {
|
|
25
|
+
status: number;
|
|
26
|
+
body: RunAutomationResult;
|
|
27
|
+
}
|
|
28
|
+
export declare const runApiSessionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
29
|
+
type: z.ZodLiteral<"file">;
|
|
30
|
+
path: z.ZodString;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
type: "file";
|
|
33
|
+
path: string;
|
|
34
|
+
}, {
|
|
35
|
+
type: "file";
|
|
36
|
+
path: string;
|
|
37
|
+
}>, z.ZodObject<{
|
|
38
|
+
type: z.ZodLiteral<"state">;
|
|
39
|
+
state: z.ZodType<{
|
|
40
|
+
cookies: {
|
|
41
|
+
name: string;
|
|
42
|
+
value: string;
|
|
43
|
+
domain: string;
|
|
44
|
+
path: string;
|
|
45
|
+
expires: number;
|
|
46
|
+
httpOnly: boolean;
|
|
47
|
+
secure: boolean;
|
|
48
|
+
sameSite: "Strict" | "Lax" | "None";
|
|
49
|
+
}[];
|
|
50
|
+
origins: {
|
|
51
|
+
origin: string;
|
|
52
|
+
localStorage: {
|
|
53
|
+
name: string;
|
|
54
|
+
value: string;
|
|
55
|
+
}[];
|
|
56
|
+
}[];
|
|
57
|
+
} & {
|
|
58
|
+
sessionStorage?: import("../contextStorageStateHelpers").OriginSessionStorage[] | undefined;
|
|
59
|
+
}, z.ZodTypeDef, {
|
|
60
|
+
cookies: {
|
|
61
|
+
name: string;
|
|
62
|
+
value: string;
|
|
63
|
+
domain: string;
|
|
64
|
+
path: string;
|
|
65
|
+
expires: number;
|
|
66
|
+
httpOnly: boolean;
|
|
67
|
+
secure: boolean;
|
|
68
|
+
sameSite: "Strict" | "Lax" | "None";
|
|
69
|
+
}[];
|
|
70
|
+
origins: {
|
|
71
|
+
origin: string;
|
|
72
|
+
localStorage: {
|
|
73
|
+
name: string;
|
|
74
|
+
value: string;
|
|
75
|
+
}[];
|
|
76
|
+
}[];
|
|
77
|
+
} & {
|
|
78
|
+
sessionStorage?: import("../contextStorageStateHelpers").OriginSessionStorage[] | undefined;
|
|
79
|
+
}>;
|
|
80
|
+
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
type: "state";
|
|
82
|
+
state: {
|
|
83
|
+
cookies: {
|
|
84
|
+
name: string;
|
|
85
|
+
value: string;
|
|
86
|
+
domain: string;
|
|
87
|
+
path: string;
|
|
88
|
+
expires: number;
|
|
89
|
+
httpOnly: boolean;
|
|
90
|
+
secure: boolean;
|
|
91
|
+
sameSite: "Strict" | "Lax" | "None";
|
|
92
|
+
}[];
|
|
93
|
+
origins: {
|
|
94
|
+
origin: string;
|
|
95
|
+
localStorage: {
|
|
96
|
+
name: string;
|
|
97
|
+
value: string;
|
|
98
|
+
}[];
|
|
99
|
+
}[];
|
|
100
|
+
} & {
|
|
101
|
+
sessionStorage?: import("../contextStorageStateHelpers").OriginSessionStorage[] | undefined;
|
|
102
|
+
};
|
|
103
|
+
}, {
|
|
104
|
+
type: "state";
|
|
105
|
+
state: {
|
|
106
|
+
cookies: {
|
|
107
|
+
name: string;
|
|
108
|
+
value: string;
|
|
109
|
+
domain: string;
|
|
110
|
+
path: string;
|
|
111
|
+
expires: number;
|
|
112
|
+
httpOnly: boolean;
|
|
113
|
+
secure: boolean;
|
|
114
|
+
sameSite: "Strict" | "Lax" | "None";
|
|
115
|
+
}[];
|
|
116
|
+
origins: {
|
|
117
|
+
origin: string;
|
|
118
|
+
localStorage: {
|
|
119
|
+
name: string;
|
|
120
|
+
value: string;
|
|
121
|
+
}[];
|
|
122
|
+
}[];
|
|
123
|
+
} & {
|
|
124
|
+
sessionStorage?: import("../contextStorageStateHelpers").OriginSessionStorage[] | undefined;
|
|
125
|
+
};
|
|
126
|
+
}>]>;
|
|
127
|
+
export declare const runApiParametersSchema: z.ZodObject<{
|
|
128
|
+
functionsToken: z.ZodOptional<z.ZodString>;
|
|
129
|
+
automationFunction: z.ZodObject<{
|
|
130
|
+
name: z.ZodString;
|
|
131
|
+
params: z.ZodOptional<z.ZodAny>;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
name: string;
|
|
134
|
+
params?: any;
|
|
135
|
+
}, {
|
|
136
|
+
name: string;
|
|
137
|
+
params?: any;
|
|
138
|
+
}>;
|
|
139
|
+
tracing: z.ZodDefault<z.ZodOptional<z.ZodDiscriminatedUnion<"enabled", [z.ZodObject<{
|
|
140
|
+
enabled: z.ZodLiteral<false>;
|
|
141
|
+
}, "strip", z.ZodTypeAny, {
|
|
142
|
+
enabled: false;
|
|
143
|
+
}, {
|
|
144
|
+
enabled: false;
|
|
145
|
+
}>, z.ZodObject<{
|
|
146
|
+
enabled: z.ZodLiteral<true>;
|
|
147
|
+
filePath: z.ZodString;
|
|
148
|
+
}, "strip", z.ZodTypeAny, {
|
|
149
|
+
enabled: true;
|
|
150
|
+
filePath: string;
|
|
151
|
+
}, {
|
|
152
|
+
enabled: true;
|
|
153
|
+
filePath: string;
|
|
154
|
+
}>]>>>;
|
|
155
|
+
auth: z.ZodOptional<z.ZodObject<{
|
|
156
|
+
session: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
157
|
+
type: z.ZodLiteral<"file">;
|
|
158
|
+
path: z.ZodString;
|
|
159
|
+
}, "strip", z.ZodTypeAny, {
|
|
160
|
+
type: "file";
|
|
161
|
+
path: string;
|
|
162
|
+
}, {
|
|
163
|
+
type: "file";
|
|
164
|
+
path: string;
|
|
165
|
+
}>, z.ZodObject<{
|
|
166
|
+
type: z.ZodLiteral<"state">;
|
|
167
|
+
state: z.ZodType<{
|
|
168
|
+
cookies: {
|
|
169
|
+
name: string;
|
|
170
|
+
value: string;
|
|
171
|
+
domain: string;
|
|
172
|
+
path: string;
|
|
173
|
+
expires: number;
|
|
174
|
+
httpOnly: boolean;
|
|
175
|
+
secure: boolean;
|
|
176
|
+
sameSite: "Strict" | "Lax" | "None";
|
|
177
|
+
}[];
|
|
178
|
+
origins: {
|
|
179
|
+
origin: string;
|
|
180
|
+
localStorage: {
|
|
181
|
+
name: string;
|
|
182
|
+
value: string;
|
|
183
|
+
}[];
|
|
184
|
+
}[];
|
|
185
|
+
} & {
|
|
186
|
+
sessionStorage?: import("../contextStorageStateHelpers").OriginSessionStorage[] | undefined;
|
|
187
|
+
}, z.ZodTypeDef, {
|
|
188
|
+
cookies: {
|
|
189
|
+
name: string;
|
|
190
|
+
value: string;
|
|
191
|
+
domain: string;
|
|
192
|
+
path: string;
|
|
193
|
+
expires: number;
|
|
194
|
+
httpOnly: boolean;
|
|
195
|
+
secure: boolean;
|
|
196
|
+
sameSite: "Strict" | "Lax" | "None";
|
|
197
|
+
}[];
|
|
198
|
+
origins: {
|
|
199
|
+
origin: string;
|
|
200
|
+
localStorage: {
|
|
201
|
+
name: string;
|
|
202
|
+
value: string;
|
|
203
|
+
}[];
|
|
204
|
+
}[];
|
|
205
|
+
} & {
|
|
206
|
+
sessionStorage?: import("../contextStorageStateHelpers").OriginSessionStorage[] | undefined;
|
|
207
|
+
}>;
|
|
208
|
+
}, "strip", z.ZodTypeAny, {
|
|
209
|
+
type: "state";
|
|
210
|
+
state: {
|
|
211
|
+
cookies: {
|
|
212
|
+
name: string;
|
|
213
|
+
value: string;
|
|
214
|
+
domain: string;
|
|
215
|
+
path: string;
|
|
216
|
+
expires: number;
|
|
217
|
+
httpOnly: boolean;
|
|
218
|
+
secure: boolean;
|
|
219
|
+
sameSite: "Strict" | "Lax" | "None";
|
|
220
|
+
}[];
|
|
221
|
+
origins: {
|
|
222
|
+
origin: string;
|
|
223
|
+
localStorage: {
|
|
224
|
+
name: string;
|
|
225
|
+
value: string;
|
|
226
|
+
}[];
|
|
227
|
+
}[];
|
|
228
|
+
} & {
|
|
229
|
+
sessionStorage?: import("../contextStorageStateHelpers").OriginSessionStorage[] | undefined;
|
|
230
|
+
};
|
|
231
|
+
}, {
|
|
232
|
+
type: "state";
|
|
233
|
+
state: {
|
|
234
|
+
cookies: {
|
|
235
|
+
name: string;
|
|
236
|
+
value: string;
|
|
237
|
+
domain: string;
|
|
238
|
+
path: string;
|
|
239
|
+
expires: number;
|
|
240
|
+
httpOnly: boolean;
|
|
241
|
+
secure: boolean;
|
|
242
|
+
sameSite: "Strict" | "Lax" | "None";
|
|
243
|
+
}[];
|
|
244
|
+
origins: {
|
|
245
|
+
origin: string;
|
|
246
|
+
localStorage: {
|
|
247
|
+
name: string;
|
|
248
|
+
value: string;
|
|
249
|
+
}[];
|
|
250
|
+
}[];
|
|
251
|
+
} & {
|
|
252
|
+
sessionStorage?: import("../contextStorageStateHelpers").OriginSessionStorage[] | undefined;
|
|
253
|
+
};
|
|
254
|
+
}>]>;
|
|
255
|
+
runCheck: z.ZodDefault<z.ZodBoolean>;
|
|
256
|
+
}, "strip", z.ZodTypeAny, {
|
|
257
|
+
session: {
|
|
258
|
+
type: "file";
|
|
259
|
+
path: string;
|
|
260
|
+
} | {
|
|
261
|
+
type: "state";
|
|
262
|
+
state: {
|
|
263
|
+
cookies: {
|
|
264
|
+
name: string;
|
|
265
|
+
value: string;
|
|
266
|
+
domain: string;
|
|
267
|
+
path: string;
|
|
268
|
+
expires: number;
|
|
269
|
+
httpOnly: boolean;
|
|
270
|
+
secure: boolean;
|
|
271
|
+
sameSite: "Strict" | "Lax" | "None";
|
|
272
|
+
}[];
|
|
273
|
+
origins: {
|
|
274
|
+
origin: string;
|
|
275
|
+
localStorage: {
|
|
276
|
+
name: string;
|
|
277
|
+
value: string;
|
|
278
|
+
}[];
|
|
279
|
+
}[];
|
|
280
|
+
} & {
|
|
281
|
+
sessionStorage?: import("../contextStorageStateHelpers").OriginSessionStorage[] | undefined;
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
runCheck: boolean;
|
|
285
|
+
}, {
|
|
286
|
+
session: {
|
|
287
|
+
type: "file";
|
|
288
|
+
path: string;
|
|
289
|
+
} | {
|
|
290
|
+
type: "state";
|
|
291
|
+
state: {
|
|
292
|
+
cookies: {
|
|
293
|
+
name: string;
|
|
294
|
+
value: string;
|
|
295
|
+
domain: string;
|
|
296
|
+
path: string;
|
|
297
|
+
expires: number;
|
|
298
|
+
httpOnly: boolean;
|
|
299
|
+
secure: boolean;
|
|
300
|
+
sameSite: "Strict" | "Lax" | "None";
|
|
301
|
+
}[];
|
|
302
|
+
origins: {
|
|
303
|
+
origin: string;
|
|
304
|
+
localStorage: {
|
|
305
|
+
name: string;
|
|
306
|
+
value: string;
|
|
307
|
+
}[];
|
|
308
|
+
}[];
|
|
309
|
+
} & {
|
|
310
|
+
sessionStorage?: import("../contextStorageStateHelpers").OriginSessionStorage[] | undefined;
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
runCheck?: boolean | undefined;
|
|
314
|
+
}>>;
|
|
315
|
+
runOptions: z.ZodDefault<z.ZodDiscriminatedUnion<"environment", [z.ZodObject<{
|
|
316
|
+
environment: z.ZodLiteral<"deployed">;
|
|
317
|
+
headless: z.ZodDefault<z.ZodBoolean>;
|
|
318
|
+
proxy: z.ZodOptional<z.ZodObject<{
|
|
319
|
+
server: z.ZodString;
|
|
320
|
+
username: z.ZodString;
|
|
321
|
+
password: z.ZodString;
|
|
322
|
+
}, "strip", z.ZodTypeAny, {
|
|
323
|
+
server: string;
|
|
324
|
+
username: string;
|
|
325
|
+
password: string;
|
|
326
|
+
}, {
|
|
327
|
+
server: string;
|
|
328
|
+
username: string;
|
|
329
|
+
password: string;
|
|
330
|
+
}>>;
|
|
331
|
+
}, "strip", z.ZodTypeAny, {
|
|
332
|
+
environment: "deployed";
|
|
333
|
+
headless: boolean;
|
|
334
|
+
proxy?: {
|
|
335
|
+
server: string;
|
|
336
|
+
username: string;
|
|
337
|
+
password: string;
|
|
338
|
+
} | undefined;
|
|
339
|
+
}, {
|
|
340
|
+
environment: "deployed";
|
|
341
|
+
headless?: boolean | undefined;
|
|
342
|
+
proxy?: {
|
|
343
|
+
server: string;
|
|
344
|
+
username: string;
|
|
345
|
+
password: string;
|
|
346
|
+
} | undefined;
|
|
347
|
+
}>, z.ZodObject<{
|
|
348
|
+
environment: z.ZodLiteral<"ide">;
|
|
349
|
+
cdpAddress: z.ZodString;
|
|
350
|
+
mode: z.ZodUnion<[z.ZodLiteral<"vanilla">, z.ZodLiteral<"playwright">, z.ZodLiteral<"playwright-standalone">, z.ZodLiteral<"playwright-headless">]>;
|
|
351
|
+
}, "strip", z.ZodTypeAny, {
|
|
352
|
+
mode: "vanilla" | "playwright" | "playwright-standalone" | "playwright-headless";
|
|
353
|
+
environment: "ide";
|
|
354
|
+
cdpAddress: string;
|
|
355
|
+
}, {
|
|
356
|
+
mode: "vanilla" | "playwright" | "playwright-standalone" | "playwright-headless";
|
|
357
|
+
environment: "ide";
|
|
358
|
+
cdpAddress: string;
|
|
359
|
+
}>]>>;
|
|
360
|
+
retrieveSession: z.ZodDefault<z.ZodBoolean>;
|
|
361
|
+
}, "strip", z.ZodTypeAny, {
|
|
362
|
+
automationFunction: {
|
|
363
|
+
name: string;
|
|
364
|
+
params?: any;
|
|
365
|
+
};
|
|
366
|
+
tracing: {
|
|
367
|
+
enabled: false;
|
|
368
|
+
} | {
|
|
369
|
+
enabled: true;
|
|
370
|
+
filePath: string;
|
|
371
|
+
};
|
|
372
|
+
runOptions: {
|
|
373
|
+
environment: "deployed";
|
|
374
|
+
headless: boolean;
|
|
375
|
+
proxy?: {
|
|
376
|
+
server: string;
|
|
377
|
+
username: string;
|
|
378
|
+
password: string;
|
|
379
|
+
} | undefined;
|
|
380
|
+
} | {
|
|
381
|
+
mode: "vanilla" | "playwright" | "playwright-standalone" | "playwright-headless";
|
|
382
|
+
environment: "ide";
|
|
383
|
+
cdpAddress: string;
|
|
384
|
+
};
|
|
385
|
+
retrieveSession: boolean;
|
|
386
|
+
functionsToken?: string | undefined;
|
|
387
|
+
auth?: {
|
|
388
|
+
session: {
|
|
389
|
+
type: "file";
|
|
390
|
+
path: string;
|
|
391
|
+
} | {
|
|
392
|
+
type: "state";
|
|
393
|
+
state: {
|
|
394
|
+
cookies: {
|
|
395
|
+
name: string;
|
|
396
|
+
value: string;
|
|
397
|
+
domain: string;
|
|
398
|
+
path: string;
|
|
399
|
+
expires: number;
|
|
400
|
+
httpOnly: boolean;
|
|
401
|
+
secure: boolean;
|
|
402
|
+
sameSite: "Strict" | "Lax" | "None";
|
|
403
|
+
}[];
|
|
404
|
+
origins: {
|
|
405
|
+
origin: string;
|
|
406
|
+
localStorage: {
|
|
407
|
+
name: string;
|
|
408
|
+
value: string;
|
|
409
|
+
}[];
|
|
410
|
+
}[];
|
|
411
|
+
} & {
|
|
412
|
+
sessionStorage?: import("../contextStorageStateHelpers").OriginSessionStorage[] | undefined;
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
runCheck: boolean;
|
|
416
|
+
} | undefined;
|
|
417
|
+
}, {
|
|
418
|
+
automationFunction: {
|
|
419
|
+
name: string;
|
|
420
|
+
params?: any;
|
|
421
|
+
};
|
|
422
|
+
functionsToken?: string | undefined;
|
|
423
|
+
tracing?: {
|
|
424
|
+
enabled: false;
|
|
425
|
+
} | {
|
|
426
|
+
enabled: true;
|
|
427
|
+
filePath: string;
|
|
428
|
+
} | undefined;
|
|
429
|
+
auth?: {
|
|
430
|
+
session: {
|
|
431
|
+
type: "file";
|
|
432
|
+
path: string;
|
|
433
|
+
} | {
|
|
434
|
+
type: "state";
|
|
435
|
+
state: {
|
|
436
|
+
cookies: {
|
|
437
|
+
name: string;
|
|
438
|
+
value: string;
|
|
439
|
+
domain: string;
|
|
440
|
+
path: string;
|
|
441
|
+
expires: number;
|
|
442
|
+
httpOnly: boolean;
|
|
443
|
+
secure: boolean;
|
|
444
|
+
sameSite: "Strict" | "Lax" | "None";
|
|
445
|
+
}[];
|
|
446
|
+
origins: {
|
|
447
|
+
origin: string;
|
|
448
|
+
localStorage: {
|
|
449
|
+
name: string;
|
|
450
|
+
value: string;
|
|
451
|
+
}[];
|
|
452
|
+
}[];
|
|
453
|
+
} & {
|
|
454
|
+
sessionStorage?: import("../contextStorageStateHelpers").OriginSessionStorage[] | undefined;
|
|
455
|
+
};
|
|
456
|
+
};
|
|
457
|
+
runCheck?: boolean | undefined;
|
|
458
|
+
} | undefined;
|
|
459
|
+
runOptions?: {
|
|
460
|
+
environment: "deployed";
|
|
461
|
+
headless?: boolean | undefined;
|
|
462
|
+
proxy?: {
|
|
463
|
+
server: string;
|
|
464
|
+
username: string;
|
|
465
|
+
password: string;
|
|
466
|
+
} | undefined;
|
|
467
|
+
} | {
|
|
468
|
+
mode: "vanilla" | "playwright" | "playwright-standalone" | "playwright-headless";
|
|
469
|
+
environment: "ide";
|
|
470
|
+
cdpAddress: string;
|
|
471
|
+
} | undefined;
|
|
472
|
+
retrieveSession?: boolean | undefined;
|
|
473
|
+
}>;
|
|
474
|
+
export type RunApiSession = z.infer<typeof runApiSessionSchema>;
|
|
475
|
+
export type RunApiParameters = z.input<typeof runApiParametersSchema>;
|
|
476
|
+
export type ExtendedRunApiParameters = RunApiParameters & {
|
|
477
|
+
abortSignal?: AbortSignal;
|
|
478
|
+
};
|
|
479
|
+
export type RunApiResultOk<R = any> = {
|
|
480
|
+
result: R;
|
|
481
|
+
extendedPayloads?: Payload[];
|
|
482
|
+
};
|
|
483
|
+
export type RunApiResultWithSessionOk<R = any> = RunApiResultOk<R> & {
|
|
484
|
+
session: IntunedStorageState;
|
|
485
|
+
};
|
|
486
|
+
export type RunApiResult<R = any, FullResult extends RunApiResultOk<R> = RunApiResultOk<R>> = Result<FullResult, RunAutomationError>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.runApiSessionSchema = exports.runApiParametersSchema = void 0;
|
|
7
|
+
var _zod = _interopRequireDefault(require("zod"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const runApiSessionSchema = exports.runApiSessionSchema = _zod.default.discriminatedUnion("type", [_zod.default.object({
|
|
10
|
+
type: _zod.default.literal("file"),
|
|
11
|
+
path: _zod.default.string()
|
|
12
|
+
}), _zod.default.object({
|
|
13
|
+
type: _zod.default.literal("state"),
|
|
14
|
+
state: _zod.default.custom(v => v)
|
|
15
|
+
})]);
|
|
16
|
+
const runApiParametersSchema = exports.runApiParametersSchema = _zod.default.object({
|
|
17
|
+
functionsToken: _zod.default.string().optional(),
|
|
18
|
+
automationFunction: _zod.default.object({
|
|
19
|
+
name: _zod.default.string(),
|
|
20
|
+
params: _zod.default.any().optional()
|
|
21
|
+
}),
|
|
22
|
+
tracing: _zod.default.discriminatedUnion("enabled", [_zod.default.object({
|
|
23
|
+
enabled: _zod.default.literal(false)
|
|
24
|
+
}), _zod.default.object({
|
|
25
|
+
enabled: _zod.default.literal(true),
|
|
26
|
+
filePath: _zod.default.string()
|
|
27
|
+
})]).optional().default({
|
|
28
|
+
enabled: false
|
|
29
|
+
}),
|
|
30
|
+
auth: _zod.default.object({
|
|
31
|
+
session: runApiSessionSchema,
|
|
32
|
+
runCheck: _zod.default.boolean().default(false)
|
|
33
|
+
}).optional(),
|
|
34
|
+
runOptions: _zod.default.discriminatedUnion("environment", [_zod.default.object({
|
|
35
|
+
environment: _zod.default.literal("deployed"),
|
|
36
|
+
headless: _zod.default.boolean().default(true),
|
|
37
|
+
proxy: _zod.default.object({
|
|
38
|
+
server: _zod.default.string(),
|
|
39
|
+
username: _zod.default.string(),
|
|
40
|
+
password: _zod.default.string()
|
|
41
|
+
}).optional()
|
|
42
|
+
}), _zod.default.object({
|
|
43
|
+
environment: _zod.default.literal("ide"),
|
|
44
|
+
cdpAddress: _zod.default.string(),
|
|
45
|
+
mode: _zod.default.union([_zod.default.literal("vanilla"), _zod.default.literal("playwright"), _zod.default.literal("playwright-standalone"), _zod.default.literal("playwright-headless")])
|
|
46
|
+
})]).default({
|
|
47
|
+
environment: "deployed"
|
|
48
|
+
}),
|
|
49
|
+
retrieveSession: _zod.default.boolean().default(false)
|
|
50
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
export declare const settingsSchema: z.ZodObject<{
|
|
3
|
+
authSessions: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
4
|
+
enabled: z.ZodBoolean;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
}, {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
}>>>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
authSessions: {
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
};
|
|
14
|
+
}, {
|
|
15
|
+
authSessions?: {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
} | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
export type IntunedSettings = z.infer<typeof settingsSchema>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.settingsSchema = void 0;
|
|
7
|
+
var z = _interopRequireWildcard(require("zod"));
|
|
8
|
+
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); }
|
|
9
|
+
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 && Object.prototype.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; }
|
|
10
|
+
const authSessionsSchema = z.object({
|
|
11
|
+
enabled: z.boolean()
|
|
12
|
+
}).optional().default({
|
|
13
|
+
enabled: false
|
|
14
|
+
});
|
|
15
|
+
const settingsSchema = exports.settingsSchema = z.object({
|
|
16
|
+
authSessions: authSessionsSchema
|
|
17
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getTelemetryClient = getTelemetryClient;
|
|
7
|
+
exports.initializeAppInsights = initializeAppInsights;
|
|
8
|
+
var appInsights = _interopRequireWildcard(require("applicationinsights"));
|
|
9
|
+
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); }
|
|
10
|
+
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 && Object.prototype.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; }
|
|
11
|
+
function gracefulShutdown() {
|
|
12
|
+
console.log("Shutting down, so flushing app insights.");
|
|
13
|
+
appInsights.defaultClient.flush();
|
|
14
|
+
process.exit();
|
|
15
|
+
}
|
|
16
|
+
function initializeAppInsights() {
|
|
17
|
+
const appInsightsConnectionString = process.env.APPINSIGHTS_CONNECTION_STRING;
|
|
18
|
+
if (appInsightsConnectionString) {
|
|
19
|
+
console.log("Initializing app insights.");
|
|
20
|
+
appInsights.setup(appInsightsConnectionString).setAutoCollectConsole(true, true).setAutoCollectDependencies(true).setAutoCollectExceptions(true).setAutoCollectHeartbeat(true).setAutoCollectPerformance(true, true).setAutoCollectRequests(true).setAutoDependencyCorrelation(true).setDistributedTracingMode(appInsights.DistributedTracingModes.AI_AND_W3C).setSendLiveMetrics(true).setUseDiskRetryCaching(true);
|
|
21
|
+
appInsights.defaultClient.context.tags[appInsights.defaultClient.context.keys.cloudRole] = "@intuned/sdk";
|
|
22
|
+
if (process.env.FLY_APP_NAME) {
|
|
23
|
+
appInsights.defaultClient.context.tags[appInsights.defaultClient.context.keys.cloudRoleInstance] = process.env.FLY_APP_NAME;
|
|
24
|
+
}
|
|
25
|
+
process.on("SIGTERM", gracefulShutdown);
|
|
26
|
+
process.on("SIGINT", gracefulShutdown);
|
|
27
|
+
appInsights.start();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function getTelemetryClient() {
|
|
31
|
+
return appInsights.defaultClient;
|
|
32
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { extendPayload, extendTimeout, runInfo, RunError, requestMultipleChoice, requestOTP, } from "./runtime";
|
|
2
|
+
export { runWithContext, getExecutionContext, } from "./common/asyncLocalStorage";
|
|
3
|
+
export { getDownloadDirectoryPath } from "./runtime/downloadDirectory";
|
|
4
|
+
export { getProductionPlaywrightConstructs } from "./common/getPlaywrightConstructs";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "RunError", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _runtime.RunError;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "extendPayload", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _runtime.extendPayload;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "extendTimeout", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _runtime.extendTimeout;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "getDownloadDirectoryPath", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _downloadDirectory.getDownloadDirectoryPath;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "getExecutionContext", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _asyncLocalStorage.getExecutionContext;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "getProductionPlaywrightConstructs", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _getPlaywrightConstructs.getProductionPlaywrightConstructs;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "requestMultipleChoice", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _runtime.requestMultipleChoice;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "requestOTP", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _runtime.requestOTP;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "runInfo", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _runtime.runInfo;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "runWithContext", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _asyncLocalStorage.runWithContext;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
var _runtime = require("./runtime");
|
|
67
|
+
var _asyncLocalStorage = require("./common/asyncLocalStorage");
|
|
68
|
+
var _downloadDirectory = require("./runtime/downloadDirectory");
|
|
69
|
+
var _getPlaywrightConstructs = require("./common/getPlaywrightConstructs");
|