@intuned/runtime-dev 1.2.1-hooks.13 → 1.2.1-hooks.14

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,6 +1,6 @@
1
1
  import type * as playwright from "playwright";
2
- import type { RunAutomationError } from "./runApi/errors";
3
- import type { Err, Ok } from "neverthrow";
2
+ import { type RunAutomationError } from "./runApi/errors";
3
+ import { type Err, type Ok } from "neverthrow";
4
4
  import { type ImportFunction } from "./runApi/importUsingImportFunction";
5
5
  export type InitializeContextHookOptions = {
6
6
  apiName: string;
@@ -10,7 +10,7 @@ export type InitializeContextHookOptions = {
10
10
  export type SetupContextHook = (options: InitializeContextHookOptions) => Promise<{
11
11
  page: playwright.Page | null;
12
12
  context: playwright.BrowserContext;
13
- cleanup: () => Promise<void>;
13
+ cleanup?: () => Promise<void>;
14
14
  } | null>;
15
15
  export declare function loadSetupContextHook({ importFunction, }: {
16
16
  importFunction: ImportFunction;
@@ -4,13 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.loadSetupContextHook = loadSetupContextHook;
7
+ var _errors = require("./runApi/errors");
8
+ var _neverthrow = require("neverthrow");
7
9
  var _importUsingImportFunction = require("./runApi/importUsingImportFunction");
8
10
  const setupContextHookPath = "hooks/setupContext";
9
11
  async function loadSetupContextHook({
10
12
  importFunction
11
13
  }) {
12
- return await (0, _importUsingImportFunction.importUsingImportFunction)({
14
+ const importedFunctionResult = await (0, _importUsingImportFunction.importUsingImportFunction)({
13
15
  path: setupContextHookPath,
14
16
  importFunction
15
17
  });
18
+ if (importedFunctionResult.isErr() && importedFunctionResult.error instanceof _errors.ApiNotFoundError) {
19
+ return (0, _neverthrow.ok)(null);
20
+ }
21
+ return importedFunctionResult;
16
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.2.1-hooks.13",
3
+ "version": "1.2.1-hooks.14",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",