@intuned/runtime-dev 1.3.12-ua.4 → 1.3.12-ua.6

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.
@@ -1,4 +1,4 @@
1
- import { RunAutomationError } from "../../../common/runApi";
1
+ import { RunAutomationError } from "../../../common/runApi/errors";
2
2
  export declare class CLIError extends Error {
3
3
  autoColor: boolean;
4
4
  constructor(message: string, options?: {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.CLIError = exports.CLIAssertionError = exports.AbortedCLIError = void 0;
7
7
  exports.logAutomationError = logAutomationError;
8
- var _runApi = require("../../../common/runApi");
8
+ var _errors = require("../../../common/runApi/errors");
9
9
  var _terminal = require("./terminal");
10
10
  class CLIError extends Error {
11
11
  constructor(message, options) {
@@ -31,7 +31,7 @@ class CLIAssertionError extends CLIError {
31
31
  exports.CLIAssertionError = CLIAssertionError;
32
32
  function logAutomationError(error) {
33
33
  (0, _terminal.terminal)(`^r^+An error occurred while running the API:^:\n`);
34
- if (error instanceof _runApi.AutomationError) {
34
+ if (error instanceof _errors.AutomationError) {
35
35
  if (error.error.stack) {
36
36
  const stackLines = error.error.stack.split("\n").filter(line => !line.includes("@intuned/runtime") && !line.includes("node:"));
37
37
  (0, _terminal.terminal)(`^r${stackLines.join("\n")}^:\n`);
@@ -1,139 +1,4 @@
1
- import { z } from "zod";
2
- export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
3
- projectName: z.ZodOptional<z.ZodString>;
4
- workspaceId: z.ZodOptional<z.ZodString>;
5
- metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
6
- defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
7
- defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
8
- testAuthSessionInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
9
- }, "strip", z.ZodTypeAny, {
10
- defaultJobInput?: Record<string, any> | undefined;
11
- defaultRunPlaygroundInput?: Record<string, any> | undefined;
12
- testAuthSessionInput?: Record<string, any> | undefined;
13
- }, {
14
- defaultJobInput?: unknown;
15
- defaultRunPlaygroundInput?: unknown;
16
- testAuthSessionInput?: unknown;
17
- }>>>;
18
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
19
- projectName: z.ZodOptional<z.ZodString>;
20
- workspaceId: z.ZodOptional<z.ZodString>;
21
- metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
22
- defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
23
- defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
24
- testAuthSessionInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
25
- }, "strip", z.ZodTypeAny, {
26
- defaultJobInput?: Record<string, any> | undefined;
27
- defaultRunPlaygroundInput?: Record<string, any> | undefined;
28
- testAuthSessionInput?: Record<string, any> | undefined;
29
- }, {
30
- defaultJobInput?: unknown;
31
- defaultRunPlaygroundInput?: unknown;
32
- testAuthSessionInput?: unknown;
33
- }>>>;
34
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
35
- projectName: z.ZodOptional<z.ZodString>;
36
- workspaceId: z.ZodOptional<z.ZodString>;
37
- metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
38
- defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
39
- defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
40
- testAuthSessionInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
41
- }, "strip", z.ZodTypeAny, {
42
- defaultJobInput?: Record<string, any> | undefined;
43
- defaultRunPlaygroundInput?: Record<string, any> | undefined;
44
- testAuthSessionInput?: Record<string, any> | undefined;
45
- }, {
46
- defaultJobInput?: unknown;
47
- defaultRunPlaygroundInput?: unknown;
48
- testAuthSessionInput?: unknown;
49
- }>>>;
50
- }, z.ZodTypeAny, "passthrough">>, z.ZodUnion<[z.ZodObject<{
51
- authSessions: z.ZodObject<{
52
- enabled: z.ZodLiteral<false>;
53
- }, "strip", z.ZodTypeAny, {
54
- enabled: false;
55
- }, {
56
- enabled: false;
57
- }>;
58
- apiAccess: z.ZodObject<{
59
- enabled: z.ZodLiteral<false>;
60
- }, "strip", z.ZodTypeAny, {
61
- enabled: false;
62
- }, {
63
- enabled: false;
64
- }>;
65
- }, "strip", z.ZodTypeAny, {
66
- authSessions: {
67
- enabled: false;
68
- };
69
- apiAccess: {
70
- enabled: false;
71
- };
72
- }, {
73
- authSessions: {
74
- enabled: false;
75
- };
76
- apiAccess: {
77
- enabled: false;
78
- };
79
- }>, z.ZodObject<{
80
- authSessions: z.ZodUnion<[z.ZodObject<{
81
- enabled: z.ZodLiteral<false>;
82
- }, "strip", z.ZodTypeAny, {
83
- enabled: false;
84
- }, {
85
- enabled: false;
86
- }>, z.ZodObject<{
87
- enabled: z.ZodLiteral<true>;
88
- type: z.ZodEnum<["MANUAL", "API"]>;
89
- startUrl: z.ZodOptional<z.ZodString>;
90
- finishUrl: z.ZodOptional<z.ZodString>;
91
- }, "strip", z.ZodTypeAny, {
92
- type: "API" | "MANUAL";
93
- enabled: true;
94
- startUrl?: string | undefined;
95
- finishUrl?: string | undefined;
96
- }, {
97
- type: "API" | "MANUAL";
98
- enabled: true;
99
- startUrl?: string | undefined;
100
- finishUrl?: string | undefined;
101
- }>]>;
102
- apiAccess: z.ZodObject<{
103
- enabled: z.ZodLiteral<true>;
104
- }, "strip", z.ZodTypeAny, {
105
- enabled: true;
106
- }, {
107
- enabled: true;
108
- }>;
109
- }, "strip", z.ZodTypeAny, {
110
- authSessions: {
111
- enabled: false;
112
- } | {
113
- type: "API" | "MANUAL";
114
- enabled: true;
115
- startUrl?: string | undefined;
116
- finishUrl?: string | undefined;
117
- };
118
- apiAccess: {
119
- enabled: true;
120
- };
121
- }, {
122
- authSessions: {
123
- enabled: false;
124
- } | {
125
- type: "API" | "MANUAL";
126
- enabled: true;
127
- startUrl?: string | undefined;
128
- finishUrl?: string | undefined;
129
- };
130
- apiAccess: {
131
- enabled: true;
132
- };
133
- }>]>>;
134
- export type IntunedJson = z.infer<typeof intunedJsonSchema>;
135
- export declare const intunedSettingsFileNames: readonly ["Intuned.json", "Intuned.jsonc", "Intuned.yaml", "Intuned.yml", "Intuned.toml"];
136
- export declare function loadIntunedJson(): Promise<{
1
+ export declare const loadIntunedJson: () => Promise<{
137
2
  projectName?: string | undefined;
138
3
  workspaceId?: string | undefined;
139
4
  metadata?: {
@@ -141,6 +6,9 @@ export declare function loadIntunedJson(): Promise<{
141
6
  defaultRunPlaygroundInput?: Record<string, any> | undefined;
142
7
  testAuthSessionInput?: Record<string, any> | undefined;
143
8
  } | undefined;
9
+ stealthMode?: {
10
+ enabled: boolean;
11
+ } | undefined;
144
12
  } & {
145
13
  [k: string]: unknown;
146
14
  } & ({
@@ -163,9 +31,9 @@ export declare function loadIntunedJson(): Promise<{
163
31
  enabled: true;
164
32
  };
165
33
  })>;
166
- export declare function getIntunedSettingsFile(): Promise<{
167
- name: typeof intunedSettingsFileNames[number];
34
+ export declare const getIntunedSettingsFile: () => Promise<{
35
+ name: "Intuned.json" | "Intuned.jsonc" | "Intuned.yaml" | "Intuned.yml" | "Intuned.toml";
168
36
  path: string;
169
37
  parse: (content: string) => any;
170
38
  }>;
171
- export declare function getIntunedSettingsFileName(): Promise<string>;
39
+ export declare const getIntunedSettingsFileName: () => Promise<"Intuned.json" | "Intuned.jsonc" | "Intuned.yaml" | "Intuned.yml" | "Intuned.toml">;
@@ -3,85 +3,18 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getIntunedSettingsFile = getIntunedSettingsFile;
7
- exports.getIntunedSettingsFileName = getIntunedSettingsFileName;
8
- exports.intunedSettingsFileNames = exports.intunedJsonSchema = void 0;
9
- exports.loadIntunedJson = loadIntunedJson;
10
- var _path = _interopRequireDefault(require("path"));
11
- var fs = _interopRequireWildcard(require("fs-extra"));
12
- var _zod = require("zod");
6
+ exports.loadIntunedJson = exports.getIntunedSettingsFileName = exports.getIntunedSettingsFile = void 0;
13
7
  var _errors = require("./errors");
14
- var JSONC = _interopRequireWildcard(require("jsonc-parser"));
15
- var YAML = _interopRequireWildcard(require("yaml"));
16
- var TOML = _interopRequireWildcard(require("smol-toml"));
17
- 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); }
18
- 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 && {}.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; }
19
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
20
- const intunedJsonSchema = exports.intunedJsonSchema = _zod.z.object({
21
- projectName: _zod.z.string().optional(),
22
- workspaceId: _zod.z.string().optional(),
23
- metadata: _zod.z.object({
24
- defaultJobInput: _zod.z.record(_zod.z.any()).optional().catch(undefined),
25
- defaultRunPlaygroundInput: _zod.z.record(_zod.z.any()).optional().catch(undefined),
26
- testAuthSessionInput: _zod.z.record(_zod.z.any()).optional().catch(undefined)
27
- }).optional().catch(undefined)
28
- }).passthrough().and(_zod.z.union([_zod.z.object({
29
- authSessions: _zod.z.object({
30
- enabled: _zod.z.literal(false)
31
- }),
32
- apiAccess: _zod.z.object({
33
- enabled: _zod.z.literal(false)
34
- })
35
- }), _zod.z.object({
36
- authSessions: _zod.z.union([_zod.z.object({
37
- enabled: _zod.z.literal(false)
38
- }), _zod.z.object({
39
- enabled: _zod.z.literal(true),
40
- type: _zod.z.enum(["MANUAL", "API"]),
41
- startUrl: _zod.z.string().optional(),
42
- finishUrl: _zod.z.string().optional()
43
- })]),
44
- apiAccess: _zod.z.object({
45
- enabled: _zod.z.literal(true)
46
- })
47
- })]));
48
- const intunedSettingsFileNames = exports.intunedSettingsFileNames = ["Intuned.json", "Intuned.jsonc", "Intuned.yaml", "Intuned.yml", "Intuned.toml"];
49
- async function loadIntunedJson() {
50
- const settingsFile = await getIntunedSettingsFile();
51
- const intunedJsonContent = await fs.readFile(settingsFile.path, "utf-8");
52
- let intunedJson;
53
- try {
54
- intunedJson = settingsFile.parse(intunedJsonContent);
55
- } catch (e) {
56
- throw new _errors.CLIError(`Failed to parse ${settingsFile.name}: ${e.message}`);
57
- }
58
- const parseResult = intunedJsonSchema.safeParse(intunedJson);
59
- if (!parseResult.success) {
60
- const formattedError = parseResult.error.errors.map(e => `- ${e.path.join(".")}: ${e.message}`).join("\n");
61
- throw new _errors.CLIError(`${settingsFile.name} is not valid:\n${formattedError}\nPlease fix the errors and try again.`);
62
- }
63
- return parseResult.data;
64
- }
65
- const intunedSettingsParsers = {
66
- "Intuned.json": JSON.parse,
67
- "Intuned.jsonc": JSONC.parse,
68
- "Intuned.yaml": YAML.parse,
69
- "Intuned.yml": YAML.parse,
70
- "Intuned.toml": TOML.parse
71
- };
72
- async function getIntunedSettingsFile() {
73
- for (const fileName of intunedSettingsFileNames) {
74
- const filePath = _path.default.join(process.cwd(), fileName);
75
- if (await fs.exists(filePath)) {
76
- return {
77
- name: fileName,
78
- path: filePath,
79
- parse: intunedSettingsParsers[fileName]
80
- };
8
+ var _intunedJson = require("../../../common/intunedJson");
9
+ function unwrapped(fn) {
10
+ return async (...args) => {
11
+ const result = await fn(...args);
12
+ if (result.isErr()) {
13
+ throw new _errors.CLIError(result.error);
81
14
  }
82
- }
83
- throw new _errors.CLIError(`No Intuned settings file found.`);
15
+ return result.value;
16
+ };
84
17
  }
85
- async function getIntunedSettingsFileName() {
86
- return (await getIntunedSettingsFile()).name;
87
- }
18
+ const loadIntunedJson = exports.loadIntunedJson = unwrapped(_intunedJson.loadIntunedJson);
19
+ const getIntunedSettingsFile = exports.getIntunedSettingsFile = unwrapped(_intunedJson.getIntunedSettingsFile);
20
+ const getIntunedSettingsFileName = exports.getIntunedSettingsFileName = unwrapped(_intunedJson.getIntunedSettingsFileName);
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  var _dotenv = _interopRequireDefault(require("dotenv"));
4
- var fs = _interopRequireWildcard(require("fs"));
5
4
  var path = _interopRequireWildcard(require("path"));
5
+ var _intunedJson = require("./intunedJson");
6
6
  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); }
7
7
  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 && {}.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; }
8
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -11,10 +11,13 @@ _dotenv.default.config({
11
11
  });
12
12
  function isStealthModeEnabled() {
13
13
  try {
14
- const intunedConfigPath = path.resolve(process.cwd(), process.env.ROOT || "./", "Intuned.json");
15
- const configContent = fs.readFileSync(intunedConfigPath, "utf8");
16
- const config = JSON.parse(configContent);
17
- return config.stealthMode?.enabled === true;
14
+ const settingsResult = (0, _intunedJson.loadIntunedJsonSync)();
15
+ if (settingsResult.isErr()) {
16
+ console.error(`Warning: Failed to load Intuned settings: ${settingsResult.error}
17
+ Stealth mode will not be enabled.`);
18
+ return false;
19
+ }
20
+ return settingsResult.value.stealthMode?.enabled === true;
18
21
  } catch (error) {
19
22
  console.error("Error reading Intuned.json:", error.message);
20
23
  return false;
@@ -0,0 +1,229 @@
1
+ import { z } from "zod";
2
+ import { type Err, type Ok } from "neverthrow";
3
+ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
4
+ projectName: z.ZodOptional<z.ZodString>;
5
+ workspaceId: z.ZodOptional<z.ZodString>;
6
+ metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
7
+ defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
8
+ defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
9
+ testAuthSessionInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ defaultJobInput?: Record<string, any> | undefined;
12
+ defaultRunPlaygroundInput?: Record<string, any> | undefined;
13
+ testAuthSessionInput?: Record<string, any> | undefined;
14
+ }, {
15
+ defaultJobInput?: unknown;
16
+ defaultRunPlaygroundInput?: unknown;
17
+ testAuthSessionInput?: unknown;
18
+ }>>>;
19
+ stealthMode: z.ZodCatch<z.ZodOptional<z.ZodObject<{
20
+ enabled: z.ZodBoolean;
21
+ }, "strip", z.ZodTypeAny, {
22
+ enabled: boolean;
23
+ }, {
24
+ enabled: boolean;
25
+ }>>>;
26
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
27
+ projectName: z.ZodOptional<z.ZodString>;
28
+ workspaceId: z.ZodOptional<z.ZodString>;
29
+ metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
30
+ defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
31
+ defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
32
+ testAuthSessionInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ defaultJobInput?: Record<string, any> | undefined;
35
+ defaultRunPlaygroundInput?: Record<string, any> | undefined;
36
+ testAuthSessionInput?: Record<string, any> | undefined;
37
+ }, {
38
+ defaultJobInput?: unknown;
39
+ defaultRunPlaygroundInput?: unknown;
40
+ testAuthSessionInput?: unknown;
41
+ }>>>;
42
+ stealthMode: z.ZodCatch<z.ZodOptional<z.ZodObject<{
43
+ enabled: z.ZodBoolean;
44
+ }, "strip", z.ZodTypeAny, {
45
+ enabled: boolean;
46
+ }, {
47
+ enabled: boolean;
48
+ }>>>;
49
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
50
+ projectName: z.ZodOptional<z.ZodString>;
51
+ workspaceId: z.ZodOptional<z.ZodString>;
52
+ metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
53
+ defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
54
+ defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
55
+ testAuthSessionInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
56
+ }, "strip", z.ZodTypeAny, {
57
+ defaultJobInput?: Record<string, any> | undefined;
58
+ defaultRunPlaygroundInput?: Record<string, any> | undefined;
59
+ testAuthSessionInput?: Record<string, any> | undefined;
60
+ }, {
61
+ defaultJobInput?: unknown;
62
+ defaultRunPlaygroundInput?: unknown;
63
+ testAuthSessionInput?: unknown;
64
+ }>>>;
65
+ stealthMode: z.ZodCatch<z.ZodOptional<z.ZodObject<{
66
+ enabled: z.ZodBoolean;
67
+ }, "strip", z.ZodTypeAny, {
68
+ enabled: boolean;
69
+ }, {
70
+ enabled: boolean;
71
+ }>>>;
72
+ }, z.ZodTypeAny, "passthrough">>, z.ZodUnion<[z.ZodObject<{
73
+ authSessions: z.ZodObject<{
74
+ enabled: z.ZodLiteral<false>;
75
+ }, "strip", z.ZodTypeAny, {
76
+ enabled: false;
77
+ }, {
78
+ enabled: false;
79
+ }>;
80
+ apiAccess: z.ZodObject<{
81
+ enabled: z.ZodLiteral<false>;
82
+ }, "strip", z.ZodTypeAny, {
83
+ enabled: false;
84
+ }, {
85
+ enabled: false;
86
+ }>;
87
+ }, "strip", z.ZodTypeAny, {
88
+ authSessions: {
89
+ enabled: false;
90
+ };
91
+ apiAccess: {
92
+ enabled: false;
93
+ };
94
+ }, {
95
+ authSessions: {
96
+ enabled: false;
97
+ };
98
+ apiAccess: {
99
+ enabled: false;
100
+ };
101
+ }>, z.ZodObject<{
102
+ authSessions: z.ZodUnion<[z.ZodObject<{
103
+ enabled: z.ZodLiteral<false>;
104
+ }, "strip", z.ZodTypeAny, {
105
+ enabled: false;
106
+ }, {
107
+ enabled: false;
108
+ }>, z.ZodObject<{
109
+ enabled: z.ZodLiteral<true>;
110
+ type: z.ZodEnum<["MANUAL", "API"]>;
111
+ startUrl: z.ZodOptional<z.ZodString>;
112
+ finishUrl: z.ZodOptional<z.ZodString>;
113
+ }, "strip", z.ZodTypeAny, {
114
+ type: "API" | "MANUAL";
115
+ enabled: true;
116
+ startUrl?: string | undefined;
117
+ finishUrl?: string | undefined;
118
+ }, {
119
+ type: "API" | "MANUAL";
120
+ enabled: true;
121
+ startUrl?: string | undefined;
122
+ finishUrl?: string | undefined;
123
+ }>]>;
124
+ apiAccess: z.ZodObject<{
125
+ enabled: z.ZodLiteral<true>;
126
+ }, "strip", z.ZodTypeAny, {
127
+ enabled: true;
128
+ }, {
129
+ enabled: true;
130
+ }>;
131
+ }, "strip", z.ZodTypeAny, {
132
+ authSessions: {
133
+ enabled: false;
134
+ } | {
135
+ type: "API" | "MANUAL";
136
+ enabled: true;
137
+ startUrl?: string | undefined;
138
+ finishUrl?: string | undefined;
139
+ };
140
+ apiAccess: {
141
+ enabled: true;
142
+ };
143
+ }, {
144
+ authSessions: {
145
+ enabled: false;
146
+ } | {
147
+ type: "API" | "MANUAL";
148
+ enabled: true;
149
+ startUrl?: string | undefined;
150
+ finishUrl?: string | undefined;
151
+ };
152
+ apiAccess: {
153
+ enabled: true;
154
+ };
155
+ }>]>>;
156
+ export type IntunedJson = z.infer<typeof intunedJsonSchema>;
157
+ export declare const intunedSettingsFileNames: readonly ["Intuned.json", "Intuned.jsonc", "Intuned.yaml", "Intuned.yml", "Intuned.toml"];
158
+ export declare function loadIntunedJson(): Promise<Err<never, string> | Ok<{
159
+ projectName?: string | undefined;
160
+ workspaceId?: string | undefined;
161
+ metadata?: {
162
+ defaultJobInput?: Record<string, any> | undefined;
163
+ defaultRunPlaygroundInput?: Record<string, any> | undefined;
164
+ testAuthSessionInput?: Record<string, any> | undefined;
165
+ } | undefined;
166
+ stealthMode?: {
167
+ enabled: boolean;
168
+ } | undefined;
169
+ } & {
170
+ [k: string]: unknown;
171
+ } & ({
172
+ authSessions: {
173
+ enabled: false;
174
+ };
175
+ apiAccess: {
176
+ enabled: false;
177
+ };
178
+ } | {
179
+ authSessions: {
180
+ enabled: false;
181
+ } | {
182
+ type: "API" | "MANUAL";
183
+ enabled: true;
184
+ startUrl?: string | undefined;
185
+ finishUrl?: string | undefined;
186
+ };
187
+ apiAccess: {
188
+ enabled: true;
189
+ };
190
+ }), never>>;
191
+ export declare function getIntunedSettingsFile(): Promise<Ok<{
192
+ name: typeof intunedSettingsFileNames[number];
193
+ path: string;
194
+ parse: (content: string) => any;
195
+ }, never> | Err<never, string>>;
196
+ export declare function getIntunedSettingsFileName(): Promise<Err<never, string> | Ok<"Intuned.json" | "Intuned.jsonc" | "Intuned.yaml" | "Intuned.yml" | "Intuned.toml", never>>;
197
+ export declare function loadIntunedJsonSync(): Err<never, string> | Ok<{
198
+ projectName?: string | undefined;
199
+ workspaceId?: string | undefined;
200
+ metadata?: {
201
+ defaultJobInput?: Record<string, any> | undefined;
202
+ defaultRunPlaygroundInput?: Record<string, any> | undefined;
203
+ testAuthSessionInput?: Record<string, any> | undefined;
204
+ } | undefined;
205
+ stealthMode?: {
206
+ enabled: boolean;
207
+ } | undefined;
208
+ } & {
209
+ [k: string]: unknown;
210
+ } & ({
211
+ authSessions: {
212
+ enabled: false;
213
+ };
214
+ apiAccess: {
215
+ enabled: false;
216
+ };
217
+ } | {
218
+ authSessions: {
219
+ enabled: false;
220
+ } | {
221
+ type: "API" | "MANUAL";
222
+ enabled: true;
223
+ startUrl?: string | undefined;
224
+ finishUrl?: string | undefined;
225
+ };
226
+ apiAccess: {
227
+ enabled: true;
228
+ };
229
+ }), never>;
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getIntunedSettingsFile = getIntunedSettingsFile;
7
+ exports.getIntunedSettingsFileName = getIntunedSettingsFileName;
8
+ exports.intunedSettingsFileNames = exports.intunedJsonSchema = void 0;
9
+ exports.loadIntunedJson = loadIntunedJson;
10
+ exports.loadIntunedJsonSync = loadIntunedJsonSync;
11
+ var _path = _interopRequireDefault(require("path"));
12
+ var fs = _interopRequireWildcard(require("fs-extra"));
13
+ var _zod = require("zod");
14
+ var JSONC = _interopRequireWildcard(require("jsonc-parser"));
15
+ var YAML = _interopRequireWildcard(require("yaml"));
16
+ var TOML = _interopRequireWildcard(require("smol-toml"));
17
+ var _neverthrow = require("neverthrow");
18
+ 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); }
19
+ 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 && {}.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; }
20
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
+ const playwright = undefined;
22
+ const intunedJsonSchema = exports.intunedJsonSchema = _zod.z.object({
23
+ projectName: _zod.z.string().optional(),
24
+ workspaceId: _zod.z.string().optional(),
25
+ metadata: _zod.z.object({
26
+ defaultJobInput: _zod.z.record(_zod.z.any()).optional().catch(undefined),
27
+ defaultRunPlaygroundInput: _zod.z.record(_zod.z.any()).optional().catch(undefined),
28
+ testAuthSessionInput: _zod.z.record(_zod.z.any()).optional().catch(undefined)
29
+ }).optional().catch(undefined),
30
+ stealthMode: _zod.z.object({
31
+ enabled: _zod.z.boolean()
32
+ }).optional().catch(undefined)
33
+ }).passthrough().and(_zod.z.union([_zod.z.object({
34
+ authSessions: _zod.z.object({
35
+ enabled: _zod.z.literal(false)
36
+ }),
37
+ apiAccess: _zod.z.object({
38
+ enabled: _zod.z.literal(false)
39
+ })
40
+ }), _zod.z.object({
41
+ authSessions: _zod.z.union([_zod.z.object({
42
+ enabled: _zod.z.literal(false)
43
+ }), _zod.z.object({
44
+ enabled: _zod.z.literal(true),
45
+ type: _zod.z.enum(["MANUAL", "API"]),
46
+ startUrl: _zod.z.string().optional(),
47
+ finishUrl: _zod.z.string().optional()
48
+ })]),
49
+ apiAccess: _zod.z.object({
50
+ enabled: _zod.z.literal(true)
51
+ })
52
+ })]));
53
+ const intunedSettingsFileNames = exports.intunedSettingsFileNames = ["Intuned.json", "Intuned.jsonc", "Intuned.yaml", "Intuned.yml", "Intuned.toml"];
54
+ async function loadIntunedJson() {
55
+ const settingsFileResult = await getIntunedSettingsFile();
56
+ if (!settingsFileResult.isOk()) {
57
+ return settingsFileResult;
58
+ }
59
+ const settingsFile = settingsFileResult.value;
60
+ const intunedJsonContent = await fs.readFile(settingsFile.path, "utf-8");
61
+ let intunedJson;
62
+ try {
63
+ intunedJson = settingsFile.parse(intunedJsonContent);
64
+ } catch (e) {
65
+ return (0, _neverthrow.err)(`Failed to parse ${settingsFile.name}: ${e.message}`);
66
+ }
67
+ const parseResult = intunedJsonSchema.safeParse(intunedJson);
68
+ if (!parseResult.success) {
69
+ const formattedError = parseResult.error.errors.map(e => `- ${e.path.join(".")}: ${e.message}`).join("\n");
70
+ return (0, _neverthrow.err)(`${settingsFile.name} is not valid:\n${formattedError}\nPlease fix the errors and try again.`);
71
+ }
72
+ return (0, _neverthrow.ok)(parseResult.data);
73
+ }
74
+ const intunedSettingsParsers = {
75
+ "Intuned.json": JSON.parse,
76
+ "Intuned.jsonc": JSONC.parse,
77
+ "Intuned.yaml": YAML.parse,
78
+ "Intuned.yml": YAML.parse,
79
+ "Intuned.toml": TOML.parse
80
+ };
81
+ async function getIntunedSettingsFile() {
82
+ for (const fileName of intunedSettingsFileNames) {
83
+ const filePath = _path.default.join(process.cwd(), fileName);
84
+ if (await fs.exists(filePath)) {
85
+ return (0, _neverthrow.ok)({
86
+ name: fileName,
87
+ path: filePath,
88
+ parse: intunedSettingsParsers[fileName]
89
+ });
90
+ }
91
+ }
92
+ return (0, _neverthrow.err)("No Intuned settings file found.");
93
+ }
94
+ async function getIntunedSettingsFileName() {
95
+ const settingsFileResult = await getIntunedSettingsFile();
96
+ if (!settingsFileResult.isOk()) {
97
+ return settingsFileResult;
98
+ }
99
+ return (0, _neverthrow.ok)(settingsFileResult.value.name);
100
+ }
101
+ function loadIntunedJsonSync() {
102
+ const settingsFileResult = getIntunedSettingsFileSync();
103
+ if (!settingsFileResult.isOk()) {
104
+ return settingsFileResult;
105
+ }
106
+ const settingsFile = settingsFileResult.value;
107
+ const intunedJsonContent = fs.readFileSync(settingsFile.path, "utf-8");
108
+ let intunedJson;
109
+ try {
110
+ intunedJson = settingsFile.parse(intunedJsonContent);
111
+ } catch (e) {
112
+ return (0, _neverthrow.err)(`Failed to parse ${settingsFile.name}: ${e.message}`);
113
+ }
114
+ const parseResult = intunedJsonSchema.safeParse(intunedJson);
115
+ if (!parseResult.success) {
116
+ const formattedError = parseResult.error.errors.map(e => `- ${e.path.join(".")}: ${e.message}`).join("\n");
117
+ return (0, _neverthrow.err)(`${settingsFile.name} is not valid:\n${formattedError}\nPlease fix the errors and try again.`);
118
+ }
119
+ return (0, _neverthrow.ok)(parseResult.data);
120
+ }
121
+ function getIntunedSettingsFileSync() {
122
+ for (const fileName of intunedSettingsFileNames) {
123
+ const filePath = _path.default.join(process.cwd(), fileName);
124
+ if (fs.existsSync(filePath)) {
125
+ return (0, _neverthrow.ok)({
126
+ name: fileName,
127
+ path: filePath,
128
+ parse: intunedSettingsParsers[fileName]
129
+ });
130
+ }
131
+ }
132
+ return (0, _neverthrow.err)("No Intuned settings file found.");
133
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.3.12-ua.4",
3
+ "version": "1.3.12-ua.6",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",