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