@intuned/runtime-dev 1.3.24-pipe.9 → 1.3.25-sm.0

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.
@@ -31,12 +31,12 @@ async function executeCLI(apiName, mode, inputData, options) {
31
31
  const settings = await (0, _settings.getSettings)();
32
32
  if (settings.authSessions.enabled) {
33
33
  if (!options.authSessionPath) {
34
- throw new Error("AuthSessions are enabled but no AuthSession provided.\n" + "Please provide --auth-session-path option.\n" + "See https://docs.intunedhq.com/docs/cli/auth-sessions for more information.");
34
+ throw new Error("AuthSessions are enabled but no AuthSession provided.\n" + "Please provide --auth-session-path option.\n" + "See https://intunedhq.com/docs/main/05-references/cli/dev for more information.");
35
35
  }
36
36
  authSessionPathToUse = options.authSessionPath;
37
37
  } else {
38
38
  if (options.authSessionPath) {
39
- throw new Error("Authentication is not enabled but AuthSession was provided.\n" + "Enable AuthSessions in Intuned.json to use this feature.\n" + "See https://docs.intunedhq.com/docs/cli/auth-sessions for more information.");
39
+ throw new Error("Authentication is not enabled but AuthSession was provided.\n" + "Enable AuthSessions in Intuned.json to use this feature.\n" + "See https://intunedhq.com/docs/main/05-references/cli/dev for more information.");
40
40
  }
41
41
  }
42
42
  const runApiResult = await (0, _runApi.runApi)({
@@ -16,7 +16,7 @@ _commander.program.description("load AuthSession to browser").option("--cdpAddre
16
16
  }) => {
17
17
  const setting = await (0, _settings.getSettings)();
18
18
  if (!setting.authSessions.enabled) {
19
- throw new Error("Authentication required but not configured.\n" + "Enable AuthSessions in Intuned.json to use this feature.\n" + "See https://docs.intunedhq.com/docs/cli/auth-sessions for more information.");
19
+ throw new Error("Authentication required but not configured.\n" + "Enable AuthSessions in Intuned.json to use this feature.\n" + "See https://intunedhq.com/docs/main/05-references/cli/dev for more information.");
20
20
  }
21
21
  await (0, _playwrightContext.withPlaywrightContext)({
22
22
  cdpAddress
@@ -26,7 +26,7 @@ _commander.program.description("run AuthSession check").option("--cdpAddress <cd
26
26
  }) => {
27
27
  const setting = await (0, _settings.getSettings)();
28
28
  if (!setting.authSessions.enabled) {
29
- throw new Error("Authentication required but not configured.\n" + "Enable AuthSessions in Intuned.json to use this feature.\n" + "See https://docs.intunedhq.com/docs/cli/auth-sessions for more information.");
29
+ throw new Error("Authentication required but not configured.\n" + "Enable AuthSessions in Intuned.json to use this feature.\n" + "See https://intunedhq.com/docs/main/05-references/cli/dev for more information.");
30
30
  }
31
31
  const checkFilePath = (0, _fileUtils.getFullPathInProject)(_constants.AUTH_SESSIONS_FOLDER_NAME, "check");
32
32
  if (!fs.exists(checkFilePath)) {
@@ -34,7 +34,7 @@ _commander.program.description("run AuthSession create").option("--cdpAddress <c
34
34
  }
35
35
  const setting = await (0, _settings.getSettings)();
36
36
  if (!setting.authSessions.enabled) {
37
- throw new Error("Authentication required but not configured.\n" + "Enable AuthSessions in Intuned.json to use this feature.\n" + "See https://docs.intunedhq.com/docs/cli/auth-sessions for more information.");
37
+ throw new Error("Authentication required but not configured.\n" + "Enable AuthSessions in Intuned.json to use this feature.\n" + "See https://intunedhq.com/docs/main/05-references/cli/dev for more information.");
38
38
  }
39
39
  const createFilePath = (0, _fileUtils.getFullPathInProject)(_constants.AUTH_SESSIONS_FOLDER_NAME, "create.ts");
40
40
  if (!fs.exists(createFilePath)) {
@@ -47,7 +47,7 @@ async function build(outfile, mode, template) {
47
47
  include: ["node_modules/**", `intuned/${template}/**`, "dist", "../typescript-runtime/**"],
48
48
  extensions: [".js"],
49
49
  ignoreGlobal: false,
50
- sourceMap: false,
50
+ sourceMap: true,
51
51
  dynamicRequireTargets: ["api/**/*.js", "auth-sessions/**/*.js"],
52
52
  requireReturnsDefault: "auto",
53
53
  transformMixedEsModules: true
@@ -68,7 +68,8 @@ async function build(outfile, mode, template) {
68
68
  await bundle.write({
69
69
  format: "cjs",
70
70
  file: outfile,
71
- inlineDynamicImports: true
71
+ inlineDynamicImports: true,
72
+ sourcemap: "inline"
72
73
  });
73
74
  console.log(`✨ Build succeeded: ${outfile}`);
74
75
  } catch (error) {
@@ -141,6 +141,7 @@ function runAutomationCLI(importFunction) {
141
141
  if (!client.closed) {
142
142
  await client.close();
143
143
  }
144
+ process.exit(0);
144
145
  });
145
146
  _commander.program.parse(process.argv);
146
147
  }
@@ -4,17 +4,11 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
4
4
  projectName: z.ZodOptional<z.ZodString>;
5
5
  workspaceId: z.ZodOptional<z.ZodString>;
6
6
  metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
7
- defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
8
7
  defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
9
- testAuthSessionInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
10
8
  }, "strip", z.ZodTypeAny, {
11
- defaultJobInput?: Record<string, any> | undefined;
12
9
  defaultRunPlaygroundInput?: Record<string, any> | undefined;
13
- testAuthSessionInput?: Record<string, any> | undefined;
14
10
  }, {
15
- defaultJobInput?: unknown;
16
11
  defaultRunPlaygroundInput?: unknown;
17
- testAuthSessionInput?: unknown;
18
12
  }>>>;
19
13
  browserSize: z.ZodCatch<z.ZodOptional<z.ZodObject<{
20
14
  width: z.ZodNumber;
@@ -37,17 +31,11 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
37
31
  projectName: z.ZodOptional<z.ZodString>;
38
32
  workspaceId: z.ZodOptional<z.ZodString>;
39
33
  metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
40
- defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
41
34
  defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
42
- testAuthSessionInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
43
35
  }, "strip", z.ZodTypeAny, {
44
- defaultJobInput?: Record<string, any> | undefined;
45
36
  defaultRunPlaygroundInput?: Record<string, any> | undefined;
46
- testAuthSessionInput?: Record<string, any> | undefined;
47
37
  }, {
48
- defaultJobInput?: unknown;
49
38
  defaultRunPlaygroundInput?: unknown;
50
- testAuthSessionInput?: unknown;
51
39
  }>>>;
52
40
  browserSize: z.ZodCatch<z.ZodOptional<z.ZodObject<{
53
41
  width: z.ZodNumber;
@@ -70,17 +58,11 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
70
58
  projectName: z.ZodOptional<z.ZodString>;
71
59
  workspaceId: z.ZodOptional<z.ZodString>;
72
60
  metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
73
- defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
74
61
  defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
75
- testAuthSessionInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
76
62
  }, "strip", z.ZodTypeAny, {
77
- defaultJobInput?: Record<string, any> | undefined;
78
63
  defaultRunPlaygroundInput?: Record<string, any> | undefined;
79
- testAuthSessionInput?: Record<string, any> | undefined;
80
64
  }, {
81
- defaultJobInput?: unknown;
82
65
  defaultRunPlaygroundInput?: unknown;
83
- testAuthSessionInput?: unknown;
84
66
  }>>>;
85
67
  browserSize: z.ZodCatch<z.ZodOptional<z.ZodObject<{
86
68
  width: z.ZodNumber;
@@ -192,9 +174,7 @@ export declare function loadIntunedJson(): Promise<Err<never, string> | Ok<{
192
174
  workspaceId?: string | undefined;
193
175
  projectName?: string | undefined;
194
176
  metadata?: {
195
- defaultJobInput?: Record<string, any> | undefined;
196
177
  defaultRunPlaygroundInput?: Record<string, any> | undefined;
197
- testAuthSessionInput?: Record<string, any> | undefined;
198
178
  } | undefined;
199
179
  browserSize?: {
200
180
  width: number;
@@ -235,9 +215,7 @@ export declare function loadIntunedJsonSync(): Err<never, string> | Ok<{
235
215
  workspaceId?: string | undefined;
236
216
  projectName?: string | undefined;
237
217
  metadata?: {
238
- defaultJobInput?: Record<string, any> | undefined;
239
218
  defaultRunPlaygroundInput?: Record<string, any> | undefined;
240
- testAuthSessionInput?: Record<string, any> | undefined;
241
219
  } | undefined;
242
220
  browserSize?: {
243
221
  width: number;
@@ -24,9 +24,7 @@ const intunedJsonSchema = exports.intunedJsonSchema = _zod.z.object({
24
24
  projectName: _zod.z.string().optional(),
25
25
  workspaceId: _zod.z.string().optional(),
26
26
  metadata: _zod.z.object({
27
- defaultJobInput: _zod.z.record(_zod.z.any()).optional().catch(undefined),
28
- defaultRunPlaygroundInput: _zod.z.record(_zod.z.any()).optional().catch(undefined),
29
- testAuthSessionInput: _zod.z.record(_zod.z.any()).optional().catch(undefined)
27
+ defaultRunPlaygroundInput: _zod.z.record(_zod.z.any()).optional().catch(undefined)
30
28
  }).optional().catch(undefined),
31
29
  browserSize: _zod.z.object({
32
30
  width: _zod.z.number().int().min(200).max(3840),
@@ -80,7 +80,7 @@ class JwtTokenManager {
80
80
  headers
81
81
  });
82
82
  if (result.status === 401 && process.env[_constants.CLI_ENV_VAR_KEY] === "true") {
83
- console.warn("Unauthorized backend function call - make sure to provision your project to Intuned to set up the correct API credentials.\n" + "Run 'intuned provision' or see https://docs.intunedhq.com/docs/05-references/cli#provision-project for more information.");
83
+ console.warn("Unauthorized backend function call - make sure to provision your project to Intuned to set up the correct API credentials.\n" + "Run 'intuned provision' or see https://intunedhq.com/docs/main/05-references/cli#provision-project for more information.");
84
84
  }
85
85
  return result;
86
86
  }
@@ -101,7 +101,7 @@ class JwtTokenManager {
101
101
  return `${domain}/api/${workspaceId}/functions/${projectId}`;
102
102
  } catch (e) {
103
103
  if (process.env[_constants.CLI_ENV_VAR_KEY] === "true") {
104
- throw new Error(`API credentials not set - make sure to provision your project to Intuned to set up the correct API credentials.\n` + `Run 'intuned provision' or see https://docs.intunedhq.com/docs/05-references/cli#provision-project for more information.\n` + `Original error: ${e.message}`);
104
+ throw new Error(`API credentials not set - make sure to provision your project to Intuned to set up the correct API credentials.\n` + `Run 'intuned provision' or see https://intunedhq.com/docs/main/05-references/cli#provision-project for more information.\n` + `Original error: ${e.message}`);
105
105
  }
106
106
  }
107
107
  }
@@ -31,7 +31,7 @@ var require_errors = __commonJS({
31
31
  "../packages/runtime-interface/dist/errors.js"(exports2) {
32
32
  "use strict";
33
33
  Object.defineProperty(exports2, "__esModule", { value: true });
34
- exports2.ResultTooBigError = exports2.InternalInvalidInputError = exports2.AutomationError = exports2.MaxLevelsExceededError = exports2.AuthCheckFailedError = exports2.AuthCheckNotFoundError = exports2.AuthRequiredError = exports2.AbortedError = exports2.InvalidCheckError = exports2.InvalidApiError = exports2.ApiNotFoundError = exports2.RunAutomationError = exports2.runAutomationErrorCodes = exports2.resultTooBigErrorCode = exports2.internalInvalidInputErrorCode = exports2.automationError = exports2.maxLevelsExceededErrorCode = exports2.authCheckFailedErrorCode = exports2.authCheckNotFoundErrorCode = exports2.authRequiredErrorCode = exports2.abortedErrorCode = exports2.invalidCheckErrorCode = exports2.invalidApiErrorCode = exports2.apiNotFoundErrorCode = void 0;
34
+ exports2.ResultTooBigError = exports2.InternalInvalidInputError = exports2.AutomationError = exports2.MaxLevelsExceededError = exports2.AuthCheckFailedError = exports2.AuthCheckNotFoundError = exports2.AuthRequiredError = exports2.AbortedError = exports2.InvalidCheckError = exports2.InvalidApiError = exports2.ApiNotFoundError = exports2.RunAutomationError = exports2.runAutomationErrorCodes = exports2.runtimeErrorCode = exports2.resultTooBigErrorCode = exports2.internalInvalidInputErrorCode = exports2.automationError = exports2.maxLevelsExceededErrorCode = exports2.authCheckFailedErrorCode = exports2.authCheckNotFoundErrorCode = exports2.authRequiredErrorCode = exports2.abortedErrorCode = exports2.invalidCheckErrorCode = exports2.invalidApiErrorCode = exports2.apiNotFoundErrorCode = void 0;
35
35
  exports2.apiNotFoundErrorCode = "APINotFoundError";
36
36
  exports2.invalidApiErrorCode = "InvalidAPIError";
37
37
  exports2.invalidCheckErrorCode = "InvalidCheckError";
@@ -43,6 +43,7 @@ var require_errors = __commonJS({
43
43
  exports2.automationError = "AutomationError";
44
44
  exports2.internalInvalidInputErrorCode = "InternalInvalidInputError";
45
45
  exports2.resultTooBigErrorCode = "ResultTooBigError";
46
+ exports2.runtimeErrorCode = "RuntimeError";
46
47
  exports2.runAutomationErrorCodes = [
47
48
  exports2.apiNotFoundErrorCode,
48
49
  exports2.invalidApiErrorCode,
@@ -54,7 +55,8 @@ var require_errors = __commonJS({
54
55
  exports2.maxLevelsExceededErrorCode,
55
56
  exports2.automationError,
56
57
  exports2.internalInvalidInputErrorCode,
57
- exports2.resultTooBigErrorCode
58
+ exports2.resultTooBigErrorCode,
59
+ exports2.runtimeErrorCode
58
60
  ];
59
61
  var RunAutomationError = class {
60
62
  constructor(code, message) {
@@ -357,14 +359,9 @@ var require_interfaceClient = __commonJS({
357
359
  var util_1 = require("util");
358
360
  var SocketClient = class _SocketClient {
359
361
  constructor(socket) {
360
- this.dataListener = null;
361
362
  this.socket = socket;
362
- this.closeAbortController = new AbortController();
363
363
  }
364
364
  async sendJSON(data) {
365
- if (this.socket.closed) {
366
- return;
367
- }
368
365
  const dataToSend = JSON.stringify(data);
369
366
  const length = Buffer.byteLength(dataToSend);
370
367
  const buffer = Buffer.alloc(_SocketClient.LENGTH_HEADER_LENGTH + length);
@@ -374,30 +371,21 @@ var require_interfaceClient = __commonJS({
374
371
  }
375
372
  async *receiveJSON() {
376
373
  let buffer = Buffer.alloc(0);
377
- let endListener;
378
- let rejectListener;
379
374
  const endPromise = new Promise((resolve, reject) => {
380
- endListener = () => resolve();
381
- this.socket.once("end", endListener);
382
- rejectListener = (e) => reject(e);
383
- this.socket.once("error", rejectListener);
384
- });
385
- const closePromise = new Promise((resolve) => {
386
- this.closeAbortController.signal.addEventListener("abort", () => resolve());
375
+ this.socket.once("end", () => {
376
+ resolve();
377
+ });
378
+ this.socket.once("error", reject);
387
379
  });
388
380
  while (true) {
389
381
  const chunk = await Promise.race([
390
- new Promise((resolve) => {
391
- this.dataListener = (data2) => {
392
- if (typeof data2 === "string") {
393
- return resolve(Buffer.from(data2));
394
- }
395
- resolve(data2);
396
- };
397
- this.socket.once("data", this.dataListener);
398
- }),
399
- endPromise,
400
- closePromise
382
+ new Promise((resolve) => this.socket.once("data", (data2) => {
383
+ if (typeof data2 === "string") {
384
+ return resolve(Buffer.from(data2));
385
+ }
386
+ resolve(data2);
387
+ })),
388
+ endPromise
401
389
  ]);
402
390
  if (!(chunk instanceof Buffer)) {
403
391
  break;
@@ -418,42 +406,8 @@ var require_interfaceClient = __commonJS({
418
406
  yield JSON.parse(data.toString());
419
407
  }
420
408
  }
421
- async close(mode = "client") {
422
- console.log(`[${process.pid}] Closing socket client`);
423
- if (this.dataListener) {
424
- this.socket.off("data", this.dataListener);
425
- console.log(`[${process.pid}] Removed data listener`);
426
- } else {
427
- console.log(`[${process.pid}] No data listener to remove`);
428
- }
429
- this.closeAbortController.abort();
430
- console.log(`[${process.pid}] Called abort on closeAbortController`);
431
- if (mode === "client") {
432
- console.log(`[${process.pid}] Sending FIN to socket`);
433
- await (0, util_1.promisify)((cb) => this.socket.end(cb))();
434
- const closeResult = await Promise.race([
435
- new Promise((resolve) => this.socket.once("close", () => resolve("closed"))),
436
- new Promise((resolve) => this.socket.once("error", () => resolve("error"))),
437
- (0, promises_1.setTimeout)(3e3, "timeout")
438
- ]);
439
- console.log(`[${process.pid}] Socket close result: ${closeResult}`);
440
- if (closeResult === "timeout") {
441
- console.warn(`[${process.pid}] Socket did not close within timeout, destroying socket`);
442
- this.socket.destroy();
443
- }
444
- return;
445
- }
446
- const receiveEndResult = await Promise.race([
447
- new Promise((resolve) => this.socket.once("end", () => resolve("end"))),
448
- new Promise((resolve) => this.socket.once("error", () => resolve("error"))),
449
- (0, promises_1.setTimeout)(3e3, "timeout")
450
- ]);
451
- console.log(`[${process.pid}] Socket receive end result: ${receiveEndResult}`);
452
- if (receiveEndResult === "end") {
453
- console.log(`[${process.pid}] Socket ended gracefully`);
454
- return;
455
- }
456
- console.log(`[${process.pid}] Socket did not end gracefully, destroying socket`);
409
+ async close() {
410
+ this.socket.end();
457
411
  this.socket.destroy();
458
412
  }
459
413
  get closed() {
@@ -478,7 +432,7 @@ var require_interfaceClient = __commonJS({
478
432
  constructor(filePath) {
479
433
  this.fileStream = fs.createReadStream(filePath, { encoding: "utf-8" });
480
434
  }
481
- sendJSON(data) {
435
+ async sendJSON(data) {
482
436
  console.log("Sending message", data);
483
437
  }
484
438
  async *receiveJSON() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.3.24-pipe.9",
3
+ "version": "1.3.25-sm.0",
4
4
  "description": "Intuned runtime",
5
5
  "packageManager": "yarn@4.12.0",
6
6
  "main": "./dist/index.js",
@@ -80,7 +80,7 @@
80
80
  "image-size": "^1.1.1",
81
81
  "jsonc-parser": "^3.3.1",
82
82
  "jsonwebtoken": "9.0.2",
83
- "lodash": "4.17.21",
83
+ "lodash": "4.18.1",
84
84
  "milliparsec": "2.3.0",
85
85
  "nanoid": "3",
86
86
  "neverthrow": "6.1.0",
@@ -1,7 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(npm info:*)"
5
- ]
6
- }
7
- }