@intuned/runtime-dev 1.3.9-dev10 → 1.3.9-dev11

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.
@@ -4,6 +4,7 @@ export declare const baseRunAuthSessionCommandOptionsSchema: import("zod").ZodOb
4
4
  headless: import("zod").ZodDefault<import("zod").ZodBoolean>;
5
5
  timeout: import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodDefault<import("zod").ZodString>, import("ms").StringValue, string | undefined>, number, string | undefined>;
6
6
  keepBrowserOpen: import("zod").ZodDefault<import("zod").ZodBoolean>;
7
+ cdpUrl: import("zod").ZodOptional<import("zod").ZodString>;
7
8
  trace: import("zod").ZodDefault<import("zod").ZodBoolean>;
8
9
  checkAttempts: import("zod").ZodDefault<import("zod").ZodNumber>;
9
10
  createAttempts: import("zod").ZodDefault<import("zod").ZodNumber>;
@@ -15,11 +16,13 @@ export declare const baseRunAuthSessionCommandOptionsSchema: import("zod").ZodOb
15
16
  checkAttempts: number;
16
17
  createAttempts: number;
17
18
  proxy?: string | undefined;
19
+ cdpUrl?: string | undefined;
18
20
  }, {
19
21
  proxy?: string | undefined;
20
22
  headless?: boolean | undefined;
21
23
  timeout?: string | undefined;
22
24
  keepBrowserOpen?: boolean | undefined;
25
+ cdpUrl?: string | undefined;
23
26
  trace?: boolean | undefined;
24
27
  checkAttempts?: number | undefined;
25
28
  createAttempts?: number | undefined;
@@ -8,24 +8,28 @@ export declare const timeoutSchema: z.ZodEffects<z.ZodEffects<z.ZodDefault<z.Zod
8
8
  export declare const headlessSchema: z.ZodDefault<z.ZodBoolean>;
9
9
  export declare const traceSchema: z.ZodDefault<z.ZodBoolean>;
10
10
  export declare const keepBrowserOpenSchema: z.ZodDefault<z.ZodBoolean>;
11
+ export declare const cdpUrlSchema: z.ZodOptional<z.ZodString>;
11
12
  export declare const baseCommandOptionsSchema: z.ZodObject<{
12
13
  proxy: z.ZodOptional<z.ZodString>;
13
14
  timeout: z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodString>, ms.StringValue, string | undefined>, number, string | undefined>;
14
15
  headless: z.ZodDefault<z.ZodBoolean>;
15
16
  trace: z.ZodDefault<z.ZodBoolean>;
16
17
  keepBrowserOpen: z.ZodDefault<z.ZodBoolean>;
18
+ cdpUrl: z.ZodOptional<z.ZodString>;
17
19
  }, "strip", z.ZodTypeAny, {
18
20
  headless: boolean;
19
21
  timeout: number;
20
22
  keepBrowserOpen: boolean;
21
23
  trace: boolean;
22
24
  proxy?: string | undefined;
25
+ cdpUrl?: string | undefined;
23
26
  }, {
24
27
  proxy?: string | undefined;
25
28
  timeout?: string | undefined;
26
29
  headless?: boolean | undefined;
27
30
  trace?: boolean | undefined;
28
31
  keepBrowserOpen?: boolean | undefined;
32
+ cdpUrl?: string | undefined;
29
33
  }>;
30
34
  export type BaseCommandOptions = z.infer<typeof baseCommandOptionsSchema>;
31
35
  export declare function withBaseOptions(command: Command): Command;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.traceSchema = exports.timeoutSchema = exports.proxySchema = exports.keepBrowserOpenSchema = exports.headlessSchema = exports.baseCommandOptionsSchema = exports.authSessionCreateAttemptsSchema = exports.authSessionCheckAttemptsSchema = void 0;
6
+ exports.traceSchema = exports.timeoutSchema = exports.proxySchema = exports.keepBrowserOpenSchema = exports.headlessSchema = exports.cdpUrlSchema = exports.baseCommandOptionsSchema = exports.authSessionCreateAttemptsSchema = exports.authSessionCheckAttemptsSchema = void 0;
7
7
  exports.withBaseOptions = withBaseOptions;
8
8
  var _ms = _interopRequireDefault(require("ms"));
9
9
  var _zod = require("zod");
@@ -17,13 +17,15 @@ const timeoutSchema = exports.timeoutSchema = _zod.z.string().default("10 mins")
17
17
  const headlessSchema = exports.headlessSchema = _zod.z.boolean().default(false);
18
18
  const traceSchema = exports.traceSchema = _zod.z.boolean().default(false);
19
19
  const keepBrowserOpenSchema = exports.keepBrowserOpenSchema = _zod.z.boolean().default(false);
20
+ const cdpUrlSchema = exports.cdpUrlSchema = _zod.z.string().url().optional();
20
21
  const baseCommandOptionsSchema = exports.baseCommandOptionsSchema = _zod.z.object({
21
22
  proxy: proxySchema,
22
23
  timeout: timeoutSchema,
23
24
  headless: headlessSchema,
24
25
  trace: traceSchema,
25
- keepBrowserOpen: keepBrowserOpenSchema
26
+ keepBrowserOpen: keepBrowserOpenSchema,
27
+ cdpUrl: cdpUrlSchema
26
28
  });
27
29
  function withBaseOptions(command) {
28
- return command.option("--proxy <url>", "Proxy URL to use for browser").option("--timeout <time>", "Timeout for each attempt - milliseconds or ms-formatted string", "10 mins").option("--headless", "Run the attempts in a headless browser (default: false). This will not open a browser window.").option("--trace", "Capture a trace of each attempt, useful for debugging.").option("--keep-browser-open", "Keep the last browser open after the command completes, useful for debugging.");
30
+ return command.option("--proxy <url>", "Proxy URL to use for browser").option("--timeout <time>", "Timeout for each attempt - milliseconds or ms-formatted string", "10 mins").option("--headless", "Run the attempts in a headless browser (default: false). This will not open a browser window.").option("--trace", "Capture a trace of each attempt, useful for debugging.").option("--keep-browser-open", "Keep the last browser open after the command completes, useful for debugging.").option("--cdp-url <url>", "[Experimental] Chrome DevTools Protocol URL to connect to an existing browser instance. Disables proxy, headless, keep_browser_open options.");
29
31
  }
@@ -29,7 +29,7 @@ declare function handleApiResult({ apiResult, outputFile, }: {
29
29
  export declare const _handleApiResult: typeof handleApiResult;
30
30
  declare function writeResultToFile(outputFile: string, result: any, payloadToAppend?: Payload[]): Promise<void>;
31
31
  export declare const _writeResultToFile: typeof writeResultToFile;
32
- declare function attemptApi({ apiName, inputData, auth, proxy, headless, timeout, traceId, keepBrowserOpen, }: {
32
+ declare function attemptApi({ apiName, inputData, auth, proxy, headless, timeout, traceId, keepBrowserOpen, cdpUrl, }: {
33
33
  apiName: string;
34
34
  inputData: object | null | undefined;
35
35
  auth?: RunApiStorageState;
@@ -150,7 +150,8 @@ async function attemptApi({
150
150
  headless,
151
151
  timeout,
152
152
  traceId,
153
- keepBrowserOpen
153
+ keepBrowserOpen,
154
+ cdpUrl
154
155
  }) {
155
156
  return await (0, _helpers.withTimeout)(async abortSignal => (0, _helpers.withCLITrace)(async tracing => {
156
157
  const runApiResult = await (0, _runApi.runApi)({
@@ -161,7 +162,8 @@ async function attemptApi({
161
162
  runOptions: await (0, _browser.getCLIRunOptions)({
162
163
  headless,
163
164
  proxy,
164
- keepBrowserOpen
165
+ keepBrowserOpen,
166
+ cdpUrl
165
167
  }),
166
168
  auth: auth ? {
167
169
  session: {
@@ -128,12 +128,12 @@ export declare function executeAttemptCheckAuthSessionCLI({ id, ...rest }: {
128
128
  origin: string;
129
129
  }[] | undefined;
130
130
  }>;
131
- declare function runCheck({ auth, proxy, headless, timeout, traceId, keepBrowserOpen, }: {
131
+ declare function runCheck({ auth, proxy, headless, timeout, traceId, keepBrowserOpen, cdpUrl, }: {
132
132
  auth: RunApiStorageState;
133
133
  traceId?: string;
134
134
  } & Omit<BaseCommandOptions, "trace">): Promise<boolean>;
135
135
  export declare const _runCheck: typeof runCheck;
136
- declare function runCreate({ authSessionInput, proxy, headless, timeout, traceId, keepBrowserOpen, }: {
136
+ declare function runCreate({ authSessionInput, proxy, headless, timeout, traceId, keepBrowserOpen, cdpUrl, }: {
137
137
  authSessionInput: Record<string, any>;
138
138
  traceId?: string;
139
139
  } & Omit<BaseCommandOptions, "trace">): Promise<{
@@ -171,7 +171,8 @@ async function runCheck({
171
171
  headless,
172
172
  timeout,
173
173
  traceId,
174
- keepBrowserOpen
174
+ keepBrowserOpen,
175
+ cdpUrl
175
176
  }) {
176
177
  return await (0, _helpers.withTimeout)(async abortSignal => (0, _helpers.withCLITrace)(async tracing => {
177
178
  const runApiResult = await (0, _runApi.runApi)({
@@ -181,7 +182,8 @@ async function runCheck({
181
182
  runOptions: await (0, _browser.getCLIRunOptions)({
182
183
  headless,
183
184
  proxy,
184
- keepBrowserOpen
185
+ keepBrowserOpen,
186
+ cdpUrl
185
187
  }),
186
188
  auth: {
187
189
  session: {
@@ -210,7 +212,8 @@ async function runCreate({
210
212
  headless,
211
213
  timeout,
212
214
  traceId,
213
- keepBrowserOpen
215
+ keepBrowserOpen,
216
+ cdpUrl
214
217
  }) {
215
218
  return await (0, _helpers.withTimeout)(async abortSignal => (0, _helpers.withCLITrace)(async tracing => {
216
219
  const result = await (0, _runApi.runApi)({
@@ -221,7 +224,8 @@ async function runCreate({
221
224
  runOptions: await (0, _browser.getCLIRunOptions)({
222
225
  headless,
223
226
  proxy,
224
- keepBrowserOpen
227
+ keepBrowserOpen,
228
+ cdpUrl
225
229
  }),
226
230
  retrieveSession: true,
227
231
  tracing,
@@ -39,6 +39,17 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
39
39
  };
40
40
  });
41
41
  (0, _vitest.describe)("Browser CLI options", () => {
42
+ (0, _vitest.it)("returns cdp options if cdpUrl is set", async () => {
43
+ const options = await (0, _browser.getCLIRunOptions)({
44
+ keepBrowserOpen: true,
45
+ headless: true,
46
+ cdpUrl: "cdp_url"
47
+ });
48
+ (0, _vitest.expect)(options).toEqual(_vitest.expect.objectContaining({
49
+ environment: "cdp",
50
+ cdpAddress: "cdp_url"
51
+ }));
52
+ });
42
53
  (0, _vitest.it)("returns standalone options if keepBrowserOpen is not set", async () => {
43
54
  const options = await (0, _browser.getCLIRunOptions)({
44
55
  keepBrowserOpen: false,
@@ -4,10 +4,11 @@ import { z } from "zod";
4
4
  declare let context: BrowserContext | null;
5
5
  export declare function _getContextForTest(): typeof context;
6
6
  type RunApiRunOptions = z.infer<typeof runApiParametersSchema>["runOptions"];
7
- export declare function getCLIRunOptions({ headless, proxy, keepBrowserOpen, }: {
7
+ export declare function getCLIRunOptions({ headless, proxy, keepBrowserOpen, cdpUrl, }: {
8
8
  headless: boolean;
9
9
  proxy?: string;
10
10
  keepBrowserOpen: boolean;
11
+ cdpUrl?: string;
11
12
  }): Promise<RunApiRunOptions>;
12
13
  export declare function isCliBrowserLaunched(): boolean;
13
14
  export declare function closeCliBrowser(): Promise<void>;
@@ -20,11 +20,18 @@ function _getContextForTest() {
20
20
  async function getCLIRunOptions({
21
21
  headless,
22
22
  proxy,
23
- keepBrowserOpen
23
+ keepBrowserOpen,
24
+ cdpUrl
24
25
  }) {
25
26
  if (context) {
26
27
  await closeCliBrowser();
27
28
  }
29
+ if (cdpUrl) {
30
+ return {
31
+ environment: "cdp",
32
+ cdpAddress: cdpUrl
33
+ };
34
+ }
28
35
  if (!keepBrowserOpen) {
29
36
  return {
30
37
  environment: "standalone",
@@ -22,7 +22,8 @@ function cliCommandWrapper(argsSchema, optionsSchema, fn) {
22
22
  return (0, _validation.logInvalidInput)(parseResult);
23
23
  }
24
24
  const [_, parsedOptions] = parseResult.data;
25
- keepBrowserOpen = "keepBrowserOpen" in parsedOptions && parsedOptions.keepBrowserOpen === true;
25
+ const cdpUrl = "cdpUrl" in parsedOptions ? parsedOptions.cdpUrl : undefined;
26
+ keepBrowserOpen = !cdpUrl && "keepBrowserOpen" in parsedOptions && parsedOptions.keepBrowserOpen === true;
26
27
  if (keepBrowserOpen) {
27
28
  (0, _terminal.terminal)(`^+--keep-open is set, the CLI will not close the last browser after the command completes^:\n`);
28
29
  }
@@ -1,14 +1,10 @@
1
1
  "use strict";
2
2
 
3
- var _dotenv = _interopRequireDefault(require("dotenv"));
4
3
  var _constants = require("../../common/constants");
5
4
  var _backend = require("./helpers/backend");
6
5
  var _commands = require("./commands");
7
6
  var _helpers = require("./helpers");
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- _dotenv.default.config({
10
- path: `.env`
11
- });
7
+ require("../../common/binStartupScript");
12
8
  process.env[_constants.CLI_ENV_VAR_KEY] = "true";
13
9
  process.env.RUN_ENVIRONMENT = "AUTHORING";
14
10
  if (!process.env.FUNCTIONS_DOMAIN) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.3.9-dev10",
3
+ "version": "1.3.9-dev11",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",