@intuned/runtime-dev 1.3.18-interface.2 → 1.3.18-interface.21

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 (225) hide show
  1. package/.babelrc +6 -0
  2. package/.claude/settings.local.json +7 -0
  3. package/InterfaceTemplate/__utils.ts +3 -1
  4. package/dist/commands/api/run.d.ts +6 -0
  5. package/dist/commands/api/run.js +119 -0
  6. package/dist/commands/auth-sessions/load.d.ts +2 -0
  7. package/dist/commands/auth-sessions/load.js +35 -0
  8. package/dist/commands/auth-sessions/run-check.d.ts +2 -0
  9. package/dist/commands/auth-sessions/run-check.js +74 -0
  10. package/dist/commands/auth-sessions/run-create.d.ts +2 -0
  11. package/dist/commands/auth-sessions/run-create.js +78 -0
  12. package/dist/commands/browser/save-state.d.ts +2 -0
  13. package/dist/commands/browser/save-state.js +17 -0
  14. package/dist/commands/browser/start-browser.d.ts +2 -0
  15. package/dist/commands/browser/start-browser.js +14 -0
  16. package/dist/commands/build.d.ts +1 -0
  17. package/dist/commands/build.js +83 -0
  18. package/dist/commands/common/browserUtils.d.ts +14 -0
  19. package/dist/commands/common/browserUtils.js +57 -0
  20. package/dist/commands/common/getFirstLineNumber.d.ts +9 -0
  21. package/dist/commands/common/getFirstLineNumber.js +101 -0
  22. package/dist/commands/common/getFirstLineNumber.test.js +227 -0
  23. package/dist/commands/common/projectExclusions.d.ts +2 -0
  24. package/dist/commands/common/projectExclusions.js +8 -0
  25. package/dist/commands/common/sendMessageToClient.d.ts +1 -0
  26. package/dist/commands/common/sendMessageToClient.js +10 -0
  27. package/dist/commands/common/tsNodeImport.d.ts +2 -0
  28. package/dist/commands/common/tsNodeImport.js +42 -0
  29. package/dist/commands/common/utils/fileUtils.d.ts +6 -0
  30. package/dist/commands/common/utils/fileUtils.js +32 -0
  31. package/dist/commands/common/utils/interfaceClient.d.ts +31 -0
  32. package/dist/commands/common/utils/interfaceClient.js +98 -0
  33. package/dist/commands/common/utils/settings.d.ts +2 -0
  34. package/dist/commands/common/utils/settings.js +31 -0
  35. package/dist/commands/common/utils/template.d.ts +2 -0
  36. package/dist/commands/common/utils/template.js +30 -0
  37. package/dist/commands/get-headless-user-agent.d.ts +1 -0
  38. package/dist/commands/get-headless-user-agent.js +18 -0
  39. package/dist/commands/interface/run.d.ts +1 -0
  40. package/dist/commands/interface/run.js +189 -0
  41. package/dist/commands/intuned-cli/commands/attempt.command.d.ts +1 -0
  42. package/dist/commands/intuned-cli/commands/attempt.command.js +8 -0
  43. package/dist/commands/intuned-cli/commands/attempt_api.command.d.ts +1 -0
  44. package/dist/commands/intuned-cli/commands/attempt_api.command.js +30 -0
  45. package/dist/commands/intuned-cli/commands/attempt_authsession.command.d.ts +1 -0
  46. package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +8 -0
  47. package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.d.ts +1 -0
  48. package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +19 -0
  49. package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.d.ts +1 -0
  50. package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +24 -0
  51. package/dist/commands/intuned-cli/commands/authsession.command.d.ts +1 -0
  52. package/dist/commands/intuned-cli/commands/authsession.command.js +8 -0
  53. package/dist/commands/intuned-cli/commands/authsession_record.command.d.ts +1 -0
  54. package/dist/commands/intuned-cli/commands/authsession_record.command.js +32 -0
  55. package/dist/commands/intuned-cli/commands/authsession_scaffold.command.d.ts +1 -0
  56. package/dist/commands/intuned-cli/commands/authsession_scaffold.command.js +16 -0
  57. package/dist/commands/intuned-cli/commands/build.command.d.ts +1 -0
  58. package/dist/commands/intuned-cli/commands/build.command.js +12 -0
  59. package/dist/commands/intuned-cli/commands/command.d.ts +2 -0
  60. package/dist/commands/intuned-cli/commands/command.js +9 -0
  61. package/dist/commands/intuned-cli/commands/deploy.command.d.ts +1 -0
  62. package/dist/commands/intuned-cli/commands/deploy.command.js +42 -0
  63. package/dist/commands/intuned-cli/commands/index.d.ts +18 -0
  64. package/dist/commands/intuned-cli/commands/index.js +203 -0
  65. package/dist/commands/intuned-cli/commands/provision.command.d.ts +13 -0
  66. package/dist/commands/intuned-cli/commands/provision.command.js +50 -0
  67. package/dist/commands/intuned-cli/commands/run.command.d.ts +1 -0
  68. package/dist/commands/intuned-cli/commands/run.command.js +8 -0
  69. package/dist/commands/intuned-cli/commands/run_api.command.d.ts +1 -0
  70. package/dist/commands/intuned-cli/commands/run_api.command.js +46 -0
  71. package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +35 -0
  72. package/dist/commands/intuned-cli/commands/run_authsession.command.js +17 -0
  73. package/dist/commands/intuned-cli/commands/run_authsession_create.command.d.ts +1 -0
  74. package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +35 -0
  75. package/dist/commands/intuned-cli/commands/run_authsession_update.command.d.ts +1 -0
  76. package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +35 -0
  77. package/dist/commands/intuned-cli/commands/run_authsession_validate.command.d.ts +1 -0
  78. package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +33 -0
  79. package/dist/commands/intuned-cli/commands/types.d.ts +39 -0
  80. package/dist/commands/intuned-cli/commands/types.js +33 -0
  81. package/dist/commands/intuned-cli/constants/index.d.ts +17 -0
  82. package/dist/commands/intuned-cli/constants/index.js +25 -0
  83. package/dist/commands/intuned-cli/controller/__test__/api.test.js +399 -0
  84. package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +1061 -0
  85. package/dist/commands/intuned-cli/controller/api.d.ts +42 -0
  86. package/dist/commands/intuned-cli/controller/api.js +194 -0
  87. package/dist/commands/intuned-cli/controller/authSession.d.ts +209 -0
  88. package/dist/commands/intuned-cli/controller/authSession.js +425 -0
  89. package/dist/commands/intuned-cli/controller/build.d.ts +1 -0
  90. package/dist/commands/intuned-cli/controller/build.js +35 -0
  91. package/dist/commands/intuned-cli/controller/deploy.d.ts +5 -0
  92. package/dist/commands/intuned-cli/controller/deploy.js +317 -0
  93. package/dist/commands/intuned-cli/controller/index.d.ts +1 -0
  94. package/dist/commands/intuned-cli/controller/index.js +45 -0
  95. package/dist/commands/intuned-cli/controller/provision.d.ts +21 -0
  96. package/dist/commands/intuned-cli/controller/provision.js +299 -0
  97. package/dist/commands/intuned-cli/controller/scaffold.d.ts +1 -0
  98. package/dist/commands/intuned-cli/controller/scaffold.js +77 -0
  99. package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +152 -0
  100. package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +41 -0
  101. package/dist/commands/intuned-cli/helpers/api.d.ts +3 -0
  102. package/dist/commands/intuned-cli/helpers/api.js +16 -0
  103. package/dist/commands/intuned-cli/helpers/auth.d.ts +46 -0
  104. package/dist/commands/intuned-cli/helpers/auth.js +147 -0
  105. package/dist/commands/intuned-cli/helpers/backend.d.ts +8 -0
  106. package/dist/commands/intuned-cli/helpers/backend.js +35 -0
  107. package/dist/commands/intuned-cli/helpers/browser.d.ts +14 -0
  108. package/dist/commands/intuned-cli/helpers/browser.js +93 -0
  109. package/dist/commands/intuned-cli/helpers/context.d.ts +3 -0
  110. package/dist/commands/intuned-cli/helpers/context.js +33 -0
  111. package/dist/commands/intuned-cli/helpers/errors.d.ts +16 -0
  112. package/dist/commands/intuned-cli/helpers/errors.js +44 -0
  113. package/dist/commands/intuned-cli/helpers/index.d.ts +12 -0
  114. package/dist/commands/intuned-cli/helpers/index.js +137 -0
  115. package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +39 -0
  116. package/dist/commands/intuned-cli/helpers/intunedJson.js +20 -0
  117. package/dist/commands/intuned-cli/helpers/prompts.d.ts +3 -0
  118. package/dist/commands/intuned-cli/helpers/prompts.js +71 -0
  119. package/dist/commands/intuned-cli/helpers/proxy.d.ts +5 -0
  120. package/dist/commands/intuned-cli/helpers/proxy.js +23 -0
  121. package/dist/commands/intuned-cli/helpers/terminal.d.ts +5 -0
  122. package/dist/commands/intuned-cli/helpers/terminal.js +13 -0
  123. package/dist/commands/intuned-cli/helpers/timeout.d.ts +1 -0
  124. package/dist/commands/intuned-cli/helpers/timeout.js +23 -0
  125. package/dist/commands/intuned-cli/helpers/traces.d.ts +2 -0
  126. package/dist/commands/intuned-cli/helpers/traces.js +32 -0
  127. package/dist/commands/intuned-cli/helpers/validation.d.ts +2 -0
  128. package/dist/commands/intuned-cli/helpers/validation.js +14 -0
  129. package/dist/commands/intuned-cli/helpers/wrapper.d.ts +2 -0
  130. package/dist/commands/intuned-cli/helpers/wrapper.js +76 -0
  131. package/dist/commands/intuned-cli/index.d.ts +1 -0
  132. package/dist/commands/intuned-cli/index.js +16 -0
  133. package/dist/commands/intuned-cli/main.d.ts +1 -0
  134. package/dist/commands/intuned-cli/main.js +35 -0
  135. package/dist/commands/intuned-cli/types.d.ts +70 -0
  136. package/dist/commands/intuned-cli/types.js +22 -0
  137. package/dist/commands/ts-check.d.ts +2 -0
  138. package/dist/commands/ts-check.js +55 -0
  139. package/dist/common/Logger/Logger/index.d.ts +12 -0
  140. package/dist/common/Logger/Logger/index.js +60 -0
  141. package/dist/common/Logger/Logger/types.d.ts +8 -0
  142. package/dist/common/Logger/Logger/types.js +5 -0
  143. package/dist/common/Logger/index.d.ts +12 -0
  144. package/dist/common/Logger/index.js +60 -0
  145. package/dist/common/Logger/types.d.ts +8 -0
  146. package/dist/common/Logger/types.js +5 -0
  147. package/dist/common/assets/browser_scripts.js +2580 -0
  148. package/dist/common/asyncLocalStorage/index.d.ts +16 -0
  149. package/dist/common/asyncLocalStorage/index.js +17 -0
  150. package/dist/common/backendFunctions/getAuthSessionParameters.d.ts +1 -0
  151. package/dist/common/backendFunctions/getAuthSessionParameters.js +38 -0
  152. package/dist/common/binStartupScript.d.ts +1 -0
  153. package/dist/common/binStartupScript.js +36 -0
  154. package/dist/common/browserTabs.d.ts +72 -0
  155. package/dist/common/browserTabs.js +74 -0
  156. package/dist/common/cleanEnvironmentVariables.d.ts +1 -0
  157. package/dist/common/cleanEnvironmentVariables.js +16 -0
  158. package/dist/common/constants.d.ts +11 -0
  159. package/dist/common/constants.js +17 -0
  160. package/dist/common/contextStorageStateHelpers.d.ts +22 -0
  161. package/dist/common/contextStorageStateHelpers.js +84 -0
  162. package/dist/common/extension/extensionsHelpers.d.ts +11 -0
  163. package/dist/common/extension/extensionsHelpers.js +147 -0
  164. package/dist/common/extension/intunedExtensionServer.d.ts +24 -0
  165. package/dist/common/extension/intunedExtensionServer.js +178 -0
  166. package/dist/common/extension/types.d.ts +219 -0
  167. package/dist/common/extension/types.js +51 -0
  168. package/dist/common/formatZodError.d.ts +2 -0
  169. package/dist/common/formatZodError.js +18 -0
  170. package/dist/common/intunedJson.d.ts +229 -0
  171. package/dist/common/intunedJson.js +132 -0
  172. package/dist/common/jwtTokenManager.d.ts +17 -0
  173. package/dist/common/jwtTokenManager.js +113 -0
  174. package/dist/common/launchBrowser.d.ts +34 -0
  175. package/dist/common/launchBrowser.js +247 -0
  176. package/dist/common/playwrightContext.d.ts +29 -0
  177. package/dist/common/playwrightContext.js +148 -0
  178. package/dist/common/runApi/importUsingImportFunction.d.ts +7 -0
  179. package/dist/common/runApi/importUsingImportFunction.js +46 -0
  180. package/dist/common/runApi/index.d.ts +8 -0
  181. package/dist/common/runApi/index.js +177 -0
  182. package/dist/common/settingsSchema.d.ts +537 -0
  183. package/dist/common/settingsSchema.js +57 -0
  184. package/dist/common/setupContextHook.d.ts +16 -0
  185. package/dist/common/setupContextHook.js +22 -0
  186. package/dist/common/telemetry.d.ts +3 -0
  187. package/dist/common/telemetry.js +31 -0
  188. package/dist/index.d.ts +4 -0
  189. package/dist/index.js +117 -0
  190. package/dist/runtime/RunError.d.ts +5 -0
  191. package/dist/runtime/RunError.js +19 -0
  192. package/dist/runtime/attemptStore.d.ts +2 -0
  193. package/dist/runtime/attemptStore.js +23 -0
  194. package/dist/runtime/captcha.d.ts +15 -0
  195. package/dist/runtime/captcha.js +191 -0
  196. package/dist/runtime/captcha.test.js +821 -0
  197. package/dist/runtime/downloadDirectory.d.ts +1 -0
  198. package/dist/runtime/downloadDirectory.js +19 -0
  199. package/dist/runtime/enums.d.js +5 -0
  200. package/dist/runtime/enums.d.ts +11 -0
  201. package/dist/runtime/enums.js +18 -0
  202. package/dist/runtime/executionHelpers.test.js +52 -0
  203. package/dist/runtime/export.d.js +5 -0
  204. package/dist/runtime/export.d.ts +284 -0
  205. package/dist/runtime/extendPayload.d.ts +2 -0
  206. package/dist/runtime/extendPayload.js +21 -0
  207. package/dist/runtime/extendTimeout.d.ts +1 -0
  208. package/dist/runtime/extendTimeout.js +23 -0
  209. package/dist/runtime/getAiGatewayConfig.d.ts +10 -0
  210. package/dist/runtime/getAiGatewayConfig.js +16 -0
  211. package/dist/runtime/getAuthSessionParameters.d.ts +1 -0
  212. package/dist/runtime/getAuthSessionParameters.js +20 -0
  213. package/dist/runtime/index.d.ts +10 -0
  214. package/dist/runtime/index.js +111 -0
  215. package/dist/runtime/persistentStore.d.ts +2 -0
  216. package/dist/runtime/persistentStore.js +37 -0
  217. package/dist/runtime/persistentStore.test.js +101 -0
  218. package/dist/runtime/runInfo.d.ts +2 -0
  219. package/dist/runtime/runInfo.js +21 -0
  220. package/dist/vendor/runtime-interface.d.ts +1 -0
  221. package/dist/vendor/runtime-interface.js +479 -0
  222. package/package.json +8 -3
  223. package/tsup.config.ts +12 -0
  224. package/WebTemplate.zip +0 -0
  225. package/api/sample.ts +0 -4
@@ -0,0 +1 @@
1
+ export declare function runAutomationCLI<ResultType = any>(importFunction?: (path: string) => Promise<any>): void;
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.runAutomationCLI = runAutomationCLI;
7
+ var _commander = require("commander");
8
+ var _dotenv = _interopRequireDefault(require("dotenv"));
9
+ var _asyncLocalStorage = require("../../common/asyncLocalStorage");
10
+ var _runApi = require("../../common/runApi");
11
+ var _enums = require("../../runtime/enums");
12
+ var _promises = require("timers/promises");
13
+ var _jwtTokenManager = require("../../common/jwtTokenManager");
14
+ var _formatZodError = require("../../common/formatZodError");
15
+ var _neverthrow = require("neverthrow");
16
+ var _getAuthSessionParameters = require("../../common/backendFunctions/getAuthSessionParameters");
17
+ var _runtimeInterface = require("../../vendor/runtime-interface");
18
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
20
+ _dotenv.default.config({
21
+ path: `.env`
22
+ });
23
+ function runAutomationCLI(importFunction) {
24
+ _commander.program.description("run user automation and communicate using unix socket").argument("<input>", "In unix socket mode: path to the unix socket. In jsonl mode: path to the jsonl file. In tcp socket mode: host:port").option("--mode [mode]", "Communication mode: unix, jsonl, or tcp").action(async (input, {
25
+ mode = "unix"
26
+ }) => {
27
+ let context;
28
+ const throttleTime = 60 * 1000;
29
+ let timeoutTimestamp = Date.now();
30
+ const client = createClient(mode, input);
31
+ const abortController = new AbortController();
32
+ const interruptSignalHandler = async () => {
33
+ abortController.abort();
34
+ await (0, _promises.setTimeout)(60_000);
35
+ await client.close();
36
+ process.exit(1);
37
+ };
38
+ process.on("SIGINT", interruptSignalHandler);
39
+ process.on("SIGTERM", interruptSignalHandler);
40
+ const messagesGenerator = client.receiveJSON();
41
+ async function receiveMessages() {
42
+ const data = await messagesGenerator.next();
43
+ if (data.done) {
44
+ return;
45
+ }
46
+ const inputParseResult = _runtimeInterface.runApiInputSchema.safeParse(data.value);
47
+ if (!inputParseResult.success) {
48
+ console.error("Validation error:", (0, _formatZodError.formatZodError)(inputParseResult.error));
49
+ return {
50
+ type: "error",
51
+ error: new _runtimeInterface.InternalInvalidInputError("Invalid input", (0, _formatZodError.formatZodError)(inputParseResult.error))
52
+ };
53
+ }
54
+ const input = inputParseResult.data;
55
+ return input;
56
+ }
57
+ let resultPromise = null;
58
+ async function handleMessage(message) {
59
+ if (message.type === "abort") {
60
+ abortController.abort();
61
+ return;
62
+ }
63
+ if (message.type === "tokenUpdate") {
64
+ _jwtTokenManager.backendFunctionsTokenManager.token = message.parameters.functionsToken;
65
+ return;
66
+ }
67
+ if (message.type === "start") {
68
+ context = {
69
+ extendedPayloads: [],
70
+ runEnvironment: message.parameters.runOptions.environment === "standalone" ? _enums.RunEnvironment.DEPLOYED : _enums.RunEnvironment.IDE,
71
+ timeoutInfo: {
72
+ extendTimeoutCallback: async () => {
73
+ if (Date.now() - timeoutTimestamp < throttleTime) return;
74
+ timeoutTimestamp = Date.now();
75
+ client.sendJSON({
76
+ type: "extend"
77
+ });
78
+ }
79
+ },
80
+ getAuthSessionParameters: _getAuthSessionParameters.getAuthSessionParameters,
81
+ ...(message.parameters.context ?? {}),
82
+ proxy: getProxyUrlFromRunOptions(message.parameters.runOptions)
83
+ };
84
+ _jwtTokenManager.backendFunctionsTokenManager.token = message.parameters.functionsToken;
85
+ resultPromise = (0, _asyncLocalStorage.runWithContext)(context, async () => {
86
+ return await (0, _runApi.runApi)({
87
+ ...message.parameters,
88
+ abortSignal: abortController.signal,
89
+ importFunction: importFunction ?? _defaultImport
90
+ });
91
+ });
92
+ return;
93
+ }
94
+ }
95
+ let receiveMessagesPromise = receiveMessages();
96
+ while (true) {
97
+ const messageOrResult = await Promise.race([receiveMessagesPromise.then(message => ({
98
+ type: "message",
99
+ message
100
+ })), ...(resultPromise ? [resultPromise.then(result => ({
101
+ type: "result",
102
+ result
103
+ }))] : [])]);
104
+ if (messageOrResult.type === "message") {
105
+ const {
106
+ message
107
+ } = messageOrResult;
108
+ if (message === undefined) {
109
+ break;
110
+ }
111
+ if (message.type === "error") {
112
+ client.sendJSON({
113
+ type: "done",
114
+ result: message.error.json,
115
+ success: false
116
+ });
117
+ break;
118
+ }
119
+ if (message.type === "ping") {
120
+ client.sendJSON({
121
+ type: "pong"
122
+ });
123
+ break;
124
+ }
125
+ await handleMessage(message);
126
+ receiveMessagesPromise = receiveMessages();
127
+ continue;
128
+ }
129
+ const {
130
+ result
131
+ } = messageOrResult;
132
+ const success = result.isOk();
133
+ const resultToSend = success ? result.value : result.error.json;
134
+ client.sendJSON({
135
+ type: "done",
136
+ result: resultToSend,
137
+ success
138
+ });
139
+ break;
140
+ }
141
+ if (!client.closed) {
142
+ await client.close();
143
+ }
144
+ process.exit(0);
145
+ });
146
+ _commander.program.parse(process.argv);
147
+ }
148
+ function getProxyUrlFromRunOptions(runOptions) {
149
+ if (runOptions?.environment !== "standalone") return undefined;
150
+ const proxy = runOptions.proxy;
151
+ if (!proxy) return undefined;
152
+ const url = new URL(proxy.server);
153
+ url.username = proxy.username;
154
+ url.password = proxy.password;
155
+ return url.toString();
156
+ }
157
+ const _defaultImport = async path => {
158
+ try {
159
+ const imported = await (specifier => new Promise(r => r(specifier)).then(s => _interopRequireWildcard(require(s))))(`${process.cwd()}/${path}`);
160
+ return (0, _neverthrow.ok)(imported);
161
+ } catch (e) {
162
+ if ("code" in e && e.code === "MODULE_NOT_FOUND" || e.code === "ERR_MODULE_NOT_FOUND") {
163
+ return (0, _neverthrow.err)({
164
+ type: "not_found"
165
+ });
166
+ }
167
+ return (0, _neverthrow.err)({
168
+ type: "other",
169
+ error: e
170
+ });
171
+ }
172
+ };
173
+ function createClient(mode, input) {
174
+ if (mode === "jsonl") {
175
+ return new _runtimeInterface.JSONLFileClient(input);
176
+ }
177
+ if (mode === "tcp") {
178
+ const [host, portString] = input.split(":");
179
+ const port = Number(portString);
180
+ if (!host || isNaN(port)) {
181
+ throw new Error("Invalid tcp input, expected format host:port");
182
+ }
183
+ return new _runtimeInterface.TCPSocketClient(host, port);
184
+ }
185
+ return new _runtimeInterface.UnixSocketClient(input);
186
+ }
187
+ if (require.main === module) {
188
+ runAutomationCLI();
189
+ }
@@ -0,0 +1 @@
1
+ export declare const attemptCommand: import("commander").Command;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.attemptCommand = void 0;
7
+ var _command = require("./command");
8
+ const attemptCommand = exports.attemptCommand = _command.program.command("attempt").description("Execute an Intuned attempt");
@@ -0,0 +1 @@
1
+ export declare const attemptApiCommand: import("commander").Command;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.attemptApiCommand = void 0;
7
+ var _api = require("../controller/api");
8
+ var _controller = require("../controller");
9
+ var _zod = require("zod");
10
+ var _types = require("./types");
11
+ var _helpers = require("../helpers");
12
+ var _attempt = require("./attempt.command");
13
+ const argsSchema = _zod.z.tuple([_zod.z.string().min(1, "API name is required"), _zod.z.string().min(1, "Parameters are required")]);
14
+ const optionsSchema = _types.baseCommandOptionsSchema.extend({
15
+ authSession: _zod.z.string().optional(),
16
+ outputFile: _zod.z.string().optional()
17
+ });
18
+ const attemptApiCommand = exports.attemptApiCommand = (0, _types.withBaseOptions)(_attempt.attemptCommand.command("api").description("Execute an Intuned API attempt with parameters").argument("<api-name>", "Name of the API to run").argument("<parameters>", "Path to the JSON file containing API parameters OR the parameters as a JSON string").option("-a, --auth-session <id>", "ID of the AuthSession to use for the API. This is expected to be in ./auth-sessions-instances/<id>.json").option("-o, --output-file <path>", "output file path")).action((0, _helpers.cliCommandWrapper)(argsSchema, optionsSchema, async ([apiName, parameters], {
19
+ authSession,
20
+ ...rest
21
+ }) => {
22
+ await (0, _helpers.assertAuthConsistent)(authSession);
23
+ const parametersData = await (0, _controller.loadParameters)(parameters);
24
+ await (0, _api.executeAttemptApiCLI)({
25
+ apiName,
26
+ inputData: parametersData,
27
+ authSessionId: authSession,
28
+ ...rest
29
+ });
30
+ }));
@@ -0,0 +1 @@
1
+ export declare const attemptAuthSessionCommand: import("commander").Command;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.attemptAuthSessionCommand = void 0;
7
+ var _attempt = require("./attempt.command");
8
+ const attemptAuthSessionCommand = exports.attemptAuthSessionCommand = _attempt.attemptCommand.command("authsession").description("Manage AuthSessions");
@@ -0,0 +1 @@
1
+ export declare const attemptAuthSessionCheckCommand: import("commander").Command;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.attemptAuthSessionCheckCommand = void 0;
7
+ var _zod = require("zod");
8
+ var _authSession = require("../controller/authSession");
9
+ var _attempt_authsession = require("./attempt_authsession.command");
10
+ var _helpers = require("../helpers");
11
+ var _types = require("./types");
12
+ const argsSchema = _zod.z.tuple([_zod.z.string().min(1, "ID of the AuthSession is required")]);
13
+ const attemptAuthSessionCheckCommand = exports.attemptAuthSessionCheckCommand = (0, _types.withBaseOptions)(_attempt_authsession.attemptAuthSessionCommand.command("check").description("Check an existing AuthSession").argument("<id>", "ID of the AuthSession to check")).action((0, _helpers.cliCommandWrapper)(argsSchema, _types.baseCommandOptionsSchema, async ([id], options) => {
14
+ await (0, _helpers.assertAuthEnabled)();
15
+ await (0, _authSession.executeAttemptCheckAuthSessionCLI)({
16
+ id,
17
+ ...options
18
+ });
19
+ }));
@@ -0,0 +1 @@
1
+ export declare const attemptAuthSessionCreateCommand: import("commander").Command;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.attemptAuthSessionCreateCommand = void 0;
7
+ var _controller = require("../controller");
8
+ var _zod = require("zod");
9
+ var _authSession = require("../controller/authSession");
10
+ var _attempt_authsession = require("./attempt_authsession.command");
11
+ var _helpers = require("../helpers");
12
+ var _types = require("./types");
13
+ const argsSchema = _zod.z.tuple([_zod.z.string().min(1, "Parameters are required")]);
14
+ const optionsSchema = _types.baseCommandOptionsSchema.extend({
15
+ id: _zod.z.string().optional()
16
+ });
17
+ const attemptAuthSessionCreateCommand = exports.attemptAuthSessionCreateCommand = (0, _types.withBaseOptions)(_attempt_authsession.attemptAuthSessionCommand.command("create").description("Create a new AuthSession").argument("<parameters>", "Parameters for the AuthSession command").option("--id <id>", "ID of the AuthSession to use for the command. Defaults to ./auth-sessions-instances/[current timestamp].json")).action((0, _helpers.cliCommandWrapper)(argsSchema, optionsSchema, async ([parameters], options) => {
18
+ await (0, _helpers.assertAuthEnabled)();
19
+ const authSessionInput = (await (0, _controller.loadParameters)(parameters)) ?? {};
20
+ await (0, _authSession.executeAttemptCreateAuthSessionCLI)({
21
+ input: authSessionInput,
22
+ ...options
23
+ });
24
+ }));
@@ -0,0 +1 @@
1
+ export declare const authSessionCommand: import("commander").Command;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.authSessionCommand = void 0;
7
+ var _command = require("./command");
8
+ const authSessionCommand = exports.authSessionCommand = _command.program.command("authsession").description("Manage AuthSessions");
@@ -0,0 +1 @@
1
+ export declare const authSessionRecordCommand: import("commander").Command | null;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.authSessionRecordCommand = void 0;
7
+ var _zod = require("zod");
8
+ var _authSession = require("../controller/authSession");
9
+ var _helpers = require("../helpers");
10
+ var _authsession = require("./authsession.command");
11
+ var _run_authsession = require("./run_authsession.command");
12
+ var _types = require("./types");
13
+ const optionsSchema = _run_authsession.baseRunAuthSessionCommandOptionsSchema.extend({
14
+ id: _zod.z.string().optional()
15
+ });
16
+ const isAuthSessionRecorderEnabled = process.env.INTUNED_AUTH_SESSION_RECORDER_ENABLED === "true";
17
+ const authSessionRecordCommand = exports.authSessionRecordCommand = isAuthSessionRecorderEnabled ? (0, _types.withBaseOptions)(_authsession.authSessionCommand.command("record").description("Record a new AuthSession").option("--id <id>", "ID of the AuthSession to use for the command. Defaults to auth-session-[current timestamp]").option("--check-attempts <number>", "Number of attempts to check the AuthSession validity", "1")).action((0, _helpers.cliCommandWrapper)(undefined, optionsSchema, async (_, {
18
+ checkAttempts,
19
+ ...rest
20
+ }) => {
21
+ await (0, _helpers.assertAuthEnabled)();
22
+ const {
23
+ startUrl,
24
+ finishUrl
25
+ } = await (0, _helpers.getAuthSessionRecorderParameters)();
26
+ await (0, _authSession.executeRecordAuthSessionCLI)({
27
+ checkRetries: checkAttempts,
28
+ startUrl,
29
+ finishUrl,
30
+ ...rest
31
+ });
32
+ })) : null;
@@ -0,0 +1 @@
1
+ export declare const authSessionScaffoldCommand: import("commander").Command;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.authSessionScaffoldCommand = void 0;
7
+ var _zod = require("zod");
8
+ var _helpers = require("../helpers");
9
+ var _authsession = require("./authsession.command");
10
+ var _types = require("./types");
11
+ var _scaffold = require("../controller/scaffold");
12
+ const optionsSchema = _zod.z.object({});
13
+ const authSessionScaffoldCommand = exports.authSessionScaffoldCommand = (0, _types.withBaseOptions)(_authsession.authSessionCommand.command("scaffold").description("Scaffold AuthSession files")).action((0, _helpers.cliCommandWrapper)(undefined, optionsSchema, async _ => {
14
+ await (0, _helpers.assertAuthEnabled)();
15
+ await (0, _scaffold.scaffoldAuthSessionFiles)();
16
+ }));
@@ -0,0 +1 @@
1
+ export declare const buildCommand: import("commander").Command;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.buildCommand = void 0;
7
+ var _command = require("./command");
8
+ var _build = require("../controller/build");
9
+ var _helpers = require("../helpers");
10
+ const buildCommand = exports.buildCommand = _command.program.command("build").description("Build Intuned project").action((0, _helpers.cliCommandWrapper)(undefined, undefined, async () => {
11
+ await (0, _build.runBuild)();
12
+ }));
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare const program: Command;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.program = void 0;
7
+ var _commander = require("commander");
8
+ const program = exports.program = new _commander.Command();
9
+ program.name("intuned").description("Intuned CLI for creating, developing and deploying Intuned projects").version("1.0.0").enablePositionalOptions(true);
@@ -0,0 +1 @@
1
+ export declare const deployCommand: import("commander").Command;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.deployCommand = void 0;
7
+ var _command = require("./command");
8
+ var _dotenv = _interopRequireDefault(require("dotenv"));
9
+ var _provision = require("../controller/provision");
10
+ var _deploy = require("../controller/deploy");
11
+ var _helpers = require("../helpers");
12
+ var _provision2 = require("./provision.command");
13
+ var _prompts = require("../helpers/prompts");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ _dotenv.default.config({
16
+ path: `.env`
17
+ });
18
+ const deployCommand = exports.deployCommand = _command.program.command("deploy").description("Deploy an Intuned project to the platform").argument("[project-name]", "Name of the project to deploy").option("-w, --workspace-id <id>", "Your Intuned workspace ID").option("-k, --api-key <key>", "Your Intuned API key").action((0, _helpers.cliCommandWrapper)(_provision2.saveOrDeployArgsSchema, _provision2.saveOrDeployOptionsSchema, async ([projectName], options) => {
19
+ const {
20
+ isValid,
21
+ errorMessage
22
+ } = await (0, _provision.validateIntunedProject)();
23
+ if (!isValid) {
24
+ const message = `^r^+Project to be deployed is not valid:^:^R ${errorMessage}:\n`;
25
+ throw new _helpers.CLIError(message, {
26
+ autoColor: false
27
+ });
28
+ }
29
+ const _projectName = projectName || (await (0, _helpers.loadIntunedJson)()).projectName || (await (0, _prompts.promptForProjectName)(name => {
30
+ const result = (0, _provision.validateProjectName)(name);
31
+ return result.isValid || result.errorMessage;
32
+ }));
33
+ if (!_projectName) {
34
+ throw new _helpers.CLIError(`Project name is required. Set it in ${await (0, _helpers.getIntunedSettingsFile)()} or provide it as an argument by running 'intuned deploy <project-name>'.`);
35
+ }
36
+ const projectNameValidation = (0, _provision.validateProjectName)(_projectName);
37
+ if (!projectNameValidation.isValid) {
38
+ throw new _helpers.CLIError(`Invalid project name: ${projectNameValidation.errorMessage}`);
39
+ }
40
+ const auth = await (0, _helpers.getAuthCredentials)(options);
41
+ await (0, _deploy.runDeployProject)(_projectName, auth);
42
+ }));
@@ -0,0 +1,18 @@
1
+ export * from "./command";
2
+ export * from "./build.command";
3
+ export * from "./deploy.command";
4
+ export * from "./provision.command";
5
+ export * from "./run.command";
6
+ export * from "./run_api.command";
7
+ export * from "./run_authsession.command";
8
+ export * from "./run_authsession_create.command";
9
+ export * from "./run_authsession_update.command";
10
+ export * from "./run_authsession_validate.command";
11
+ export * from "./attempt.command";
12
+ export * from "./attempt_api.command";
13
+ export * from "./attempt_authsession.command";
14
+ export * from "./attempt_authsession_create.command";
15
+ export * from "./attempt_authsession_check.command";
16
+ export * from "./authsession.command";
17
+ export * from "./authsession_record.command";
18
+ export * from "./authsession_scaffold.command";