@intuned/runtime-dev 0.1.0-test.13 → 0.1.0-test.15
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/bin/intuned-api-run +1 -1
- package/bin/intuned-auth-session-check +1 -1
- package/bin/intuned-auth-session-create +1 -1
- package/bin/intuned-auth-session-load +1 -1
- package/bin/intuned-auth-session-refresh +1 -1
- package/bin/intuned-browser-save-state +1 -1
- package/bin/intuned-browser-start +1 -1
- package/bin/intuned-build +1 -1
- package/bin/intuned-ts-check +1 -1
- package/dist/commands/api/run.js +83 -156
- package/dist/commands/auth-sessions/load.js +20 -20
- package/dist/commands/auth-sessions/run-check.js +39 -45
- package/dist/commands/auth-sessions/run-create.js +74 -84
- package/dist/commands/browser/save-state.js +7 -12
- package/dist/commands/browser/start-browser.js +4 -7
- package/dist/commands/build.js +62 -96
- package/dist/commands/common/browserUtils.js +30 -41
- package/dist/commands/common/getDefaultExportFromFile.d.ts +0 -1
- package/dist/commands/common/getDefaultExportFromFile.js +0 -12
- package/dist/commands/common/getFirstLineNumber.js +83 -90
- package/dist/commands/common/{getFirstLineNumber.test.ts → getFirstLineNumber.test.js} +2 -1
- package/dist/commands/common/sendMessageToClient.js +2 -4
- package/dist/commands/common/utils/fileUtils.js +16 -16
- package/dist/commands/common/utils/settings.js +18 -16
- package/dist/commands/common/utils/unixSocket.js +36 -43
- package/dist/commands/common/utils/webTemplate.js +19 -25
- package/dist/commands/interface/run.js +133 -139
- package/dist/commands/ts-check.js +41 -44
- package/dist/common/Logger/Logger/index.js +46 -40
- package/dist/common/Logger/Logger/types.js +1 -1
- package/dist/common/Logger/index.js +46 -40
- package/dist/common/Logger/types.js +1 -1
- package/dist/common/asyncLocalStorage/index.js +4 -4
- package/dist/common/cleanEnvironmentVariables.js +9 -11
- package/dist/common/constants.js +1 -1
- package/dist/common/contextStorageStateHelpers.js +38 -36
- package/dist/common/getPlaywrightConstructs.js +158 -187
- package/dist/common/jwtTokenManager.js +61 -74
- package/dist/common/runApi/errors.js +121 -130
- package/dist/common/runApi/index.js +231 -217
- package/dist/common/runApi/types.js +41 -55
- package/dist/common/settingsSchema.js +6 -9
- package/dist/common/telemetry.js +16 -27
- package/dist/index.js +3 -3
- package/dist/runtime/RunError.js +10 -10
- package/dist/runtime/downloadDirectory.js +10 -10
- package/dist/runtime/enums.d.ts +11 -1
- package/dist/runtime/enums.js +12 -12
- package/dist/runtime/export.d.ts +202 -1
- package/dist/runtime/extendPayload.js +12 -12
- package/dist/runtime/extendTimeout.js +20 -19
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/requestMoreInfo.js +14 -14
- package/dist/runtime/runInfo.js +12 -11
- package/package.json +2 -3
- package/dist/commands/api/run.ts +0 -105
- package/dist/commands/auth-sessions/load.ts +0 -30
- package/dist/commands/auth-sessions/run-check.ts +0 -51
- package/dist/commands/auth-sessions/run-create.ts +0 -91
- package/dist/commands/browser/save-state.ts +0 -14
- package/dist/commands/browser/start-browser.ts +0 -11
- package/dist/commands/build.ts +0 -78
- package/dist/commands/common/browserUtils.ts +0 -45
- package/dist/commands/common/getDefaultExportFromFile.ts +0 -11
- package/dist/commands/common/getFirstLineNumber.ts +0 -96
- package/dist/commands/common/sendMessageToClient.ts +0 -3
- package/dist/commands/common/utils/fileUtils.ts +0 -23
- package/dist/commands/common/utils/settings.ts +0 -22
- package/dist/commands/common/utils/unixSocket.ts +0 -38
- package/dist/commands/common/utils/webTemplate.ts +0 -22
- package/dist/commands/interface/run.ts +0 -156
- package/dist/commands/ts-check.ts +0 -50
- package/dist/common/Logger/Logger/index.ts +0 -53
- package/dist/common/Logger/index.ts +0 -53
- package/dist/common/asyncLocalStorage/index.ts +0 -9
- package/dist/common/cleanEnvironmentVariables.ts +0 -10
- package/dist/common/constants.ts +0 -1
- package/dist/common/contextStorageStateHelpers.ts +0 -43
- package/dist/common/getPlaywrightConstructs.ts +0 -181
- package/dist/common/jwtTokenManager.ts +0 -71
- package/dist/common/runApi/errors.ts +0 -154
- package/dist/common/runApi/index.ts +0 -253
- package/dist/common/runApi/types.ts +0 -43
- package/dist/common/settingsSchema.ts +0 -9
- package/dist/common/telemetry.ts +0 -23
- package/dist/index.ts +0 -4
- package/dist/runtime/RunError.ts +0 -12
- package/dist/runtime/downloadDirectory.ts +0 -13
- package/dist/runtime/enums.ts +0 -12
- package/dist/runtime/extendPayload.ts +0 -15
- package/dist/runtime/extendTimeout.ts +0 -24
- package/dist/runtime/index.ts +0 -6
- package/dist/runtime/requestMoreInfo.ts +0 -18
- package/dist/runtime/runInfo.ts +0 -15
- /package/dist/{common/Logger/Logger/types.ts → runtime/enums.d.js} +0 -0
- /package/dist/runtime/{executionHelpers.test.ts → executionHelpers.test.js} +0 -0
- /package/dist/{common/Logger/types.ts → runtime/export.d.js} +0 -0
|
@@ -9,155 +9,146 @@ export const authCheckNotFoundErrorCode = "AuthCheckNotFoundError";
|
|
|
9
9
|
export const authCheckFailedErrorCode = "AuthCheckFailedError";
|
|
10
10
|
export const maxLevelsExceededErrorCode = "MaxLevelsExceededError";
|
|
11
11
|
export const automationError = "AutomationError";
|
|
12
|
-
export const runAutomationErrorCodes = [
|
|
13
|
-
apiNotFoundErrorCode,
|
|
14
|
-
invalidApiErrorCode,
|
|
15
|
-
invalidCheckErrorCode,
|
|
16
|
-
abortedErrorCode,
|
|
17
|
-
authRequiredErrorCode,
|
|
18
|
-
authCheckNotFoundErrorCode,
|
|
19
|
-
authCheckFailedErrorCode,
|
|
20
|
-
maxLevelsExceededErrorCode,
|
|
21
|
-
automationError,
|
|
22
|
-
];
|
|
12
|
+
export const runAutomationErrorCodes = [apiNotFoundErrorCode, invalidApiErrorCode, invalidCheckErrorCode, abortedErrorCode, authRequiredErrorCode, authCheckNotFoundErrorCode, authCheckFailedErrorCode, maxLevelsExceededErrorCode, automationError];
|
|
23
13
|
export class RunAutomationError {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
error: this.code,
|
|
34
|
-
message: this.message,
|
|
35
|
-
},
|
|
36
|
-
};
|
|
14
|
+
wrapped = false;
|
|
15
|
+
get apiResponse() {
|
|
16
|
+
if (this.wrapped) {
|
|
17
|
+
return {
|
|
18
|
+
status: 200,
|
|
19
|
+
body: {
|
|
20
|
+
status: this.statusCode,
|
|
21
|
+
error: this.code,
|
|
22
|
+
message: this.message
|
|
37
23
|
}
|
|
38
|
-
|
|
39
|
-
status: this.statusCode,
|
|
40
|
-
body: {
|
|
41
|
-
error: this.code,
|
|
42
|
-
message: this.message,
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
get json() {
|
|
47
|
-
return {
|
|
48
|
-
code: this.code,
|
|
49
|
-
details: this.details,
|
|
50
|
-
cause: this.cause?.json,
|
|
51
|
-
};
|
|
24
|
+
};
|
|
52
25
|
}
|
|
26
|
+
return {
|
|
27
|
+
status: this.statusCode,
|
|
28
|
+
body: {
|
|
29
|
+
error: this.code,
|
|
30
|
+
message: this.message
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
get json() {
|
|
35
|
+
var _this$cause;
|
|
36
|
+
return {
|
|
37
|
+
code: this.code,
|
|
38
|
+
details: this.details,
|
|
39
|
+
cause: (_this$cause = this.cause) === null || _this$cause === void 0 ? void 0 : _this$cause.json
|
|
40
|
+
};
|
|
41
|
+
}
|
|
53
42
|
}
|
|
54
43
|
export class ApiNotFoundError extends RunAutomationError {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
44
|
+
constructor(apiName) {
|
|
45
|
+
super();
|
|
46
|
+
this.code = apiNotFoundErrorCode;
|
|
47
|
+
this.statusCode = 404;
|
|
48
|
+
this.message = `API ${apiName} not found`;
|
|
49
|
+
}
|
|
61
50
|
}
|
|
62
51
|
export class InvalidApiError extends RunAutomationError {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
52
|
+
constructor(message) {
|
|
53
|
+
super();
|
|
54
|
+
this.code = invalidApiErrorCode;
|
|
55
|
+
this.statusCode = 400;
|
|
56
|
+
this.message = `API is invalid: ${message}`;
|
|
57
|
+
}
|
|
69
58
|
}
|
|
70
59
|
export class InvalidCheckError extends RunAutomationError {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
60
|
+
constructor(message, cause) {
|
|
61
|
+
super();
|
|
62
|
+
this.code = invalidCheckErrorCode;
|
|
63
|
+
this.statusCode = 400;
|
|
64
|
+
this.message = message;
|
|
65
|
+
this.cause = cause;
|
|
66
|
+
}
|
|
78
67
|
}
|
|
79
68
|
export class AbortedError extends RunAutomationError {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
69
|
+
constructor() {
|
|
70
|
+
super();
|
|
71
|
+
this.code = abortedErrorCode;
|
|
72
|
+
this.statusCode = 200;
|
|
73
|
+
this.message = "Operation was aborted";
|
|
74
|
+
}
|
|
86
75
|
}
|
|
87
76
|
export class AuthRequiredError extends RunAutomationError {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
77
|
+
constructor() {
|
|
78
|
+
super();
|
|
79
|
+
this.code = authRequiredErrorCode;
|
|
80
|
+
this.statusCode = 401;
|
|
81
|
+
this.message = "Authentication is required";
|
|
82
|
+
}
|
|
94
83
|
}
|
|
95
84
|
export class AuthCheckNotFoundError extends RunAutomationError {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
85
|
+
constructor() {
|
|
86
|
+
super();
|
|
87
|
+
this.code = authCheckNotFoundErrorCode;
|
|
88
|
+
this.statusCode = 404;
|
|
89
|
+
this.message = "Auth check not found";
|
|
90
|
+
}
|
|
102
91
|
}
|
|
103
92
|
export class AuthCheckFailedError extends RunAutomationError {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
93
|
+
constructor() {
|
|
94
|
+
super();
|
|
95
|
+
this.code = authCheckFailedErrorCode;
|
|
96
|
+
this.statusCode = 401;
|
|
97
|
+
this.message = "auth session check failed";
|
|
98
|
+
}
|
|
99
|
+
get apiResponse() {
|
|
100
|
+
return {
|
|
101
|
+
status: 200,
|
|
102
|
+
body: {
|
|
103
|
+
status: this.statusCode,
|
|
104
|
+
error: "AUTH_SESSION_CHECK_FAILED",
|
|
105
|
+
message: this.message
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
120
109
|
}
|
|
121
110
|
export class MaxLevelsExceededError extends RunAutomationError {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
111
|
+
constructor(levels) {
|
|
112
|
+
super();
|
|
113
|
+
this.code = maxLevelsExceededErrorCode;
|
|
114
|
+
this.statusCode = 400;
|
|
115
|
+
this.message = `Max levels exceeded. Only ${levels} levels are supported`;
|
|
116
|
+
this.details = {
|
|
117
|
+
levels
|
|
118
|
+
};
|
|
119
|
+
}
|
|
129
120
|
}
|
|
130
121
|
export class AutomationError extends RunAutomationError {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
if (error instanceof RunError) {
|
|
145
|
-
this.wrapped = true;
|
|
146
|
-
this.statusCode = error.options.status_code ?? 500;
|
|
147
|
-
this.message = `[${error.options.error_code ?? error.name}] ${error.message}`;
|
|
148
|
-
this.details = {
|
|
149
|
-
name: error.name,
|
|
150
|
-
statusCode: error.options.status_code,
|
|
151
|
-
errorCode: error.options.error_code,
|
|
152
|
-
message: error.message,
|
|
153
|
-
options: error.options,
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
this.statusCode = 500;
|
|
157
|
-
this.message = `[${error?.name ?? error}] ${error?.message}`;
|
|
158
|
-
this.details = {
|
|
159
|
-
name: error?.name,
|
|
160
|
-
message: error?.message,
|
|
161
|
-
};
|
|
122
|
+
constructor(error) {
|
|
123
|
+
super();
|
|
124
|
+
this.error = error;
|
|
125
|
+
this.code = automationError;
|
|
126
|
+
if (error instanceof playwright.errors.TimeoutError) {
|
|
127
|
+
this.statusCode = 500;
|
|
128
|
+
this.message = `[${error.name}] ${error.message}`;
|
|
129
|
+
this.details = {
|
|
130
|
+
name: error.name,
|
|
131
|
+
message: error.message
|
|
132
|
+
};
|
|
133
|
+
return;
|
|
162
134
|
}
|
|
163
|
-
|
|
135
|
+
if (error instanceof RunError) {
|
|
136
|
+
this.wrapped = true;
|
|
137
|
+
this.statusCode = error.options.status_code ?? 500;
|
|
138
|
+
this.message = `[${error.options.error_code ?? error.name}] ${error.message}`;
|
|
139
|
+
this.details = {
|
|
140
|
+
name: error.name,
|
|
141
|
+
statusCode: error.options.status_code,
|
|
142
|
+
errorCode: error.options.error_code,
|
|
143
|
+
message: error.message,
|
|
144
|
+
options: error.options
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
this.statusCode = 500;
|
|
148
|
+
this.message = `[${(error === null || error === void 0 ? void 0 : error.name) ?? error}] ${error === null || error === void 0 ? void 0 : error.message}`;
|
|
149
|
+
this.details = {
|
|
150
|
+
name: error === null || error === void 0 ? void 0 : error.name,
|
|
151
|
+
message: error === null || error === void 0 ? void 0 : error.message
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|