@intuned/runtime-dev 1.1.8-bot-detection → 1.2.0-cli.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.
- package/.babelrc +2 -2
- package/CHANGELOG.md +5 -1
- package/WebTemplate.zip +0 -0
- package/bin/intuned +2 -0
- package/dist/commands/api/run.js +8 -2
- package/dist/commands/auth-sessions/run-check.js +18 -4
- package/dist/commands/auth-sessions/run-create.js +2 -1
- package/dist/commands/cli-auth-sessions/create.js +1 -1
- package/dist/commands/cli-auth-sessions/utils.d.ts +1 -1
- package/dist/commands/cli-auth-sessions/utils.js +2 -3
- package/dist/commands/common/browserUtils.d.ts +1 -1
- package/dist/commands/common/browserUtils.js +1 -1
- package/dist/commands/common/getFirstLineNumber.js +2 -4
- package/dist/commands/deploy/utils.js +1 -2
- package/dist/commands/init/utils.js +1 -7
- package/dist/commands/interface/run.js +7 -6
- package/dist/commands/intuned-cli/commands/attempt.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/attempt.command.js +8 -0
- package/dist/commands/intuned-cli/commands/attempt_api.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/attempt_api.command.js +40 -0
- package/dist/commands/intuned-cli/commands/attempt_authsession.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +8 -0
- package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +24 -0
- package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +36 -0
- package/dist/commands/intuned-cli/commands/build.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/build.command.js +12 -0
- package/dist/commands/intuned-cli/commands/command.d.ts +2 -0
- package/dist/commands/intuned-cli/commands/command.js +9 -0
- package/dist/commands/intuned-cli/commands/deploy.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/deploy.command.js +47 -0
- package/dist/commands/intuned-cli/commands/helpers.d.ts +26 -0
- package/dist/commands/intuned-cli/commands/helpers.js +126 -0
- package/dist/commands/intuned-cli/commands/index.d.ts +15 -0
- package/dist/commands/intuned-cli/commands/index.js +170 -0
- package/dist/commands/intuned-cli/commands/init.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/init.command.js +14 -0
- package/dist/commands/intuned-cli/commands/run.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/run.command.js +8 -0
- package/dist/commands/intuned-cli/commands/run_api.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/run_api.command.js +54 -0
- package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +21 -0
- package/dist/commands/intuned-cli/commands/run_authsession.command.js +13 -0
- package/dist/commands/intuned-cli/commands/run_authsession_create.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +39 -0
- package/dist/commands/intuned-cli/commands/run_authsession_update.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +39 -0
- package/dist/commands/intuned-cli/commands/run_authsession_validate.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +37 -0
- package/dist/commands/intuned-cli/commands/types.d.ts +21 -0
- package/dist/commands/intuned-cli/commands/types.js +21 -0
- package/dist/commands/intuned-cli/controller/api.d.ts +19 -0
- package/dist/commands/intuned-cli/controller/api.js +179 -0
- package/dist/commands/intuned-cli/controller/authSession.d.ts +32 -0
- package/dist/commands/intuned-cli/controller/authSession.js +295 -0
- package/dist/commands/intuned-cli/controller/build.d.ts +1 -0
- package/dist/commands/intuned-cli/controller/build.js +36 -0
- package/dist/commands/intuned-cli/controller/deploy.d.ts +15 -0
- package/dist/commands/intuned-cli/controller/deploy.js +397 -0
- package/dist/commands/intuned-cli/controller/index.d.ts +1 -0
- package/dist/commands/intuned-cli/controller/index.js +45 -0
- package/dist/commands/intuned-cli/controller/init.d.ts +5 -0
- package/dist/commands/intuned-cli/controller/init.js +139 -0
- package/dist/commands/intuned-cli/index.d.ts +1 -0
- package/dist/commands/intuned-cli/index.js +16 -0
- package/dist/commands/intuned-cli/main.d.ts +1 -0
- package/dist/commands/intuned-cli/main.js +12 -0
- package/dist/commands/intuned-cli/terminal.d.ts +1 -0
- package/dist/commands/intuned-cli/terminal.js +12 -0
- package/dist/commands/run-api-cli/utils.js +6 -6
- package/dist/common/assets/browser_scripts.js +2509 -2143
- package/dist/common/asyncLocalStorage/index.d.ts +1 -2
- package/dist/common/backendFunctions/getAuthSessionParameters.d.ts +1 -0
- package/dist/common/backendFunctions/getAuthSessionParameters.js +38 -0
- package/dist/common/cli/cliReadme.d.ts +1 -1
- package/dist/common/cli/cliReadme.js +14 -23
- package/dist/common/cli/constants.d.ts +4 -2
- package/dist/common/cli/constants.js +7 -3
- package/dist/common/cli/types.d.ts +2 -2
- package/dist/common/cli/utils.d.ts +5 -2
- package/dist/common/cli/utils.js +6 -2
- package/dist/common/constants.d.ts +1 -0
- package/dist/common/constants.js +2 -1
- package/dist/common/contextStorageStateHelpers.d.ts +1 -1
- package/dist/common/getPlaywrightConstructs.d.ts +1 -1
- package/dist/common/getPlaywrightConstructs.js +12 -12
- package/dist/common/jwtTokenManager.js +3 -5
- package/dist/common/runApi/errors.d.ts +1 -1
- package/dist/common/runApi/errors.js +5 -6
- package/dist/common/runApi/index.d.ts +4 -1
- package/dist/common/runApi/index.js +21 -21
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -0
- package/dist/runtime/executionHelpers.test.js +3 -4
- package/dist/runtime/export.d.ts +16 -0
- package/dist/runtime/extendPayload.js +1 -1
- package/dist/runtime/extendTimeout.js +0 -7
- package/dist/runtime/getAuthSessionParameters.d.ts +1 -0
- package/dist/runtime/getAuthSessionParameters.js +20 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +7 -0
- package/package.json +10 -7
- package/template.tsconfig.json +4 -7
|
@@ -5,12 +5,11 @@ export declare const asyncLocalStorage: AsyncLocalStorage<InternalRunInfo>;
|
|
|
5
5
|
export declare function runWithContext<R, TArgs extends any[]>(contextData: InternalRunInfo, callback: (...args: TArgs) => R, ...args: TArgs): R;
|
|
6
6
|
interface TimeoutInfo {
|
|
7
7
|
extendTimeoutCallback?: () => Promise<void>;
|
|
8
|
-
timeoutDuration?: number;
|
|
9
|
-
timeoutTimestamp?: number;
|
|
10
8
|
}
|
|
11
9
|
export interface InternalRunInfo extends RunInfo {
|
|
12
10
|
extendedPayloads: Payload[];
|
|
13
11
|
timeoutInfo?: TimeoutInfo;
|
|
12
|
+
getAuthSessionParameters?: () => Promise<any>;
|
|
14
13
|
}
|
|
15
14
|
export declare function getExecutionContext(): InternalRunInfo | undefined;
|
|
16
15
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getAuthSessionParameters(): Promise<any>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getAuthSessionParameters = getAuthSessionParameters;
|
|
7
|
+
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
|
8
|
+
var _asyncLocalStorage = require("../asyncLocalStorage");
|
|
9
|
+
var _zod = require("zod");
|
|
10
|
+
var _jwtTokenManager = require("../jwtTokenManager");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
const authSessionParametersResponseSchema = _zod.z.object({
|
|
13
|
+
parameters: _zod.z.any().refine(v => v !== undefined)
|
|
14
|
+
});
|
|
15
|
+
async function getAuthSessionParameters() {
|
|
16
|
+
const context = (0, _asyncLocalStorage.getExecutionContext)();
|
|
17
|
+
if (!context) {
|
|
18
|
+
throw new Error("getAuthSessionParameters failed due to an internal error (context was not found).");
|
|
19
|
+
}
|
|
20
|
+
const authSessionId = context.authSessionId;
|
|
21
|
+
if ((0, _isNil.default)(authSessionId)) {
|
|
22
|
+
throw new Error("Auth sessions are not enabled");
|
|
23
|
+
}
|
|
24
|
+
const response = await (0, _jwtTokenManager.callBackendFunctionWithToken)(`auth-session/${authSessionId}/parameters`, {
|
|
25
|
+
method: "GET"
|
|
26
|
+
});
|
|
27
|
+
const body = await response.text();
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
throw new Error(`getAuthSessionParameters failed with status ${response.status}: ${body}`);
|
|
30
|
+
}
|
|
31
|
+
let json;
|
|
32
|
+
try {
|
|
33
|
+
json = JSON.parse(body);
|
|
34
|
+
} catch (e) {
|
|
35
|
+
throw new Error(`Expected JSON response, but got ${body}`);
|
|
36
|
+
}
|
|
37
|
+
return authSessionParametersResponseSchema.parse(json).parameters;
|
|
38
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const cliReadme = "# Intuned CLI\n## Introduction\nThe Intuned CLI exposes a
|
|
1
|
+
export declare const cliReadme = "# Intuned CLI\n## Introduction\nThe Intuned CLI exposes a variety of commands to develop your Intuned projects locally\n\n## Development Commands\n\nFor each command, add `--help` to see more details and options.\n\n### Initialize a Project\n`npx -p @intuned/runtime init`\n\n### Run an API\n`yarn intuned run <api-name>`\nor\n`npm run intuned run <api-name>`\n\n\n### Build a Project\n`yarn intuned build`\n\n### Deploy a Project\n`yarn intuned deploy [project-name]`\nor\n`npm run intuned deploy [project-name]`\n\n\n\n### Create an auth session\n`yarn intuned authsession create <parameters>`\nor\n`npm intuned authsession create <parameters>`\n\n\n\n### Validate an auth session\n`yarn intuned authsession validate <auth-session-name>`\nor\n`npm intuned authsession validate <auth-session-name>`\n\n## Configuration\n\n### Environment Variables and Settings\n- `workspaceId`: Your Intuned workspace ID ([How to get your workspaceId](https://docs.intunedhq.com/docs/guides/platform/how-to-get-a-workspace-id))\n - Set in `intuned.json` file under the `workspaceId` property\n - Or provide via CLI with `--workspace-id` flag during deployment\n \n- `projectName`: The name of your Intuned project\n - Set in `intuned.json` file under the `projectName` property\n - Or override via command line when deploying with `yarn deploy my-project-name` or `npm run deploy my-project-name`\n \n- `INTUNED_API_KEY`: Your Intuned API key\n - Set as an environment variable: `export INTUNED_API_KEY=your_api_key_here`\n - Or include in your .env file for development\n - Or provide via CLI with `--api-key` flag during deployment\n\n## Project Structure\n\n### Generated Artifacts\n- `./intuned.json`: Project configuration file\n- `./api`: Folder containing API implementation files\n- `./auth-sessions`: Folder containing auth APIs\n- `./parameters`: Folder for API parameters injection\n- `./output`: Folder containing generated output files\n- `./auth-sessions-instances`: Folder containing auth session instances\n\n## Types of auth sessions\n- `MANUAL`: Manual auth session, records the session using a recorder and stores it in the `auth-sessions-instances` folder\n- `API`: Auth session created via create API, stores the session in the `auth-sessions-instances` folder\n\n### Notes\n- You can use either `yarn` or `npm run` to execute commands\n- All commands must be run from the project root directory\n- Verify you're in the correct location by confirming the presence of package.json and intuned.json\n- Running commands from subdirectories may result in errors\n- You can manage your deployed projects through the Intuned platform\n- WARNING: \u26A0\uFE0F Changes to TS Config may break some Intuned functionalities\n";
|
|
@@ -6,51 +6,42 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.cliReadme = void 0;
|
|
7
7
|
const cliReadme = exports.cliReadme = `# Intuned CLI
|
|
8
8
|
## Introduction
|
|
9
|
-
The Intuned CLI exposes a
|
|
9
|
+
The Intuned CLI exposes a variety of commands to develop your Intuned projects locally
|
|
10
10
|
|
|
11
11
|
## Development Commands
|
|
12
12
|
|
|
13
|
+
For each command, add \`--help\` to see more details and options.
|
|
14
|
+
|
|
13
15
|
### Initialize a Project
|
|
14
16
|
\`npx -p @intuned/runtime init\`
|
|
15
17
|
|
|
16
18
|
### Run an API
|
|
17
|
-
\`yarn run
|
|
19
|
+
\`yarn intuned run <api-name>\`
|
|
18
20
|
or
|
|
19
|
-
\`npm run run
|
|
21
|
+
\`npm run intuned run <api-name>\`
|
|
20
22
|
|
|
21
|
-
Options:
|
|
22
|
-
- \`-i, --parameters-file file-path\`: JSON file containing API parameters
|
|
23
|
-
- \`-s, --store-results\`: Store the results in \`./output/[runId]/results.json\` and \`./output/[runId]/extendedPayloads.json\`
|
|
24
|
-
- \`-a, --auth-session <session>\`: Name of the auth session instance to use if project is auth-enabled
|
|
25
23
|
|
|
26
24
|
### Build a Project
|
|
27
|
-
\`yarn
|
|
25
|
+
\`yarn intuned build\`
|
|
28
26
|
|
|
29
27
|
### Deploy a Project
|
|
30
|
-
\`yarn deploy
|
|
28
|
+
\`yarn intuned deploy [project-name]\`
|
|
31
29
|
or
|
|
32
|
-
\`npm run deploy
|
|
30
|
+
\`npm run intuned deploy [project-name]\`
|
|
33
31
|
|
|
34
|
-
- \`project-name\`: Optional name that overrides the one in intuned.json
|
|
35
|
-
- Options:
|
|
36
|
-
- \`--workspace-id\`: Overrides the workspace ID in intuned.json
|
|
37
|
-
- \`--api-key\`: Overrides the API key from environment variables
|
|
38
32
|
|
|
39
33
|
|
|
40
34
|
### Create an auth session
|
|
41
|
-
\`yarn create
|
|
35
|
+
\`yarn intuned authsession create <parameters>\`
|
|
42
36
|
or
|
|
43
|
-
\`npm create
|
|
37
|
+
\`npm intuned authsession create <parameters>\`
|
|
38
|
+
|
|
44
39
|
|
|
45
|
-
- \`auth-session-name\`: Optional name/id of the auth session instance to use, if not provided, a name will be generated with the current timestamp
|
|
46
|
-
- Options:
|
|
47
|
-
- \`--input\`: Auth session input parameters file path
|
|
48
40
|
|
|
49
|
-
###
|
|
50
|
-
\`yarn
|
|
41
|
+
### Validate an auth session
|
|
42
|
+
\`yarn intuned authsession validate <auth-session-name>\`
|
|
51
43
|
or
|
|
52
|
-
\`npm
|
|
53
|
-
- \`auth-session-name\`: Name/id of the auth session instance to check, required
|
|
44
|
+
\`npm intuned authsession validate <auth-session-name>\`
|
|
54
45
|
|
|
55
46
|
## Configuration
|
|
56
47
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const CURRENT_PLAYWRIGHT_VERSION = "1.44.1";
|
|
2
|
-
export declare const ProjectDeploymentStatus:
|
|
3
|
-
export declare const PROJECT_DEPLOY_TIMEOUT
|
|
2
|
+
export declare const ProjectDeploymentStatus: readonly ["completed", "failed", "pending", "not_found"];
|
|
3
|
+
export declare const PROJECT_DEPLOY_TIMEOUT: number;
|
|
4
|
+
export declare const PROJECT_DEPLOY_CHECK_PERIOD: number;
|
|
4
5
|
export declare const userCLIScripts: {
|
|
5
6
|
"dev:local": string;
|
|
6
7
|
dev: string;
|
|
@@ -22,6 +23,7 @@ export declare const userCLIScripts: {
|
|
|
22
23
|
export declare const tsConfigCli: {
|
|
23
24
|
compilerOptions: {
|
|
24
25
|
moduleResolution: string;
|
|
26
|
+
module: string;
|
|
25
27
|
target: string;
|
|
26
28
|
outDir: string;
|
|
27
29
|
sourceMap: boolean;
|
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.userCLIScripts = exports.tsConfigCli = exports.ProjectDeploymentStatus = exports.PROJECT_DEPLOY_TIMEOUT = exports.CURRENT_PLAYWRIGHT_VERSION = void 0;
|
|
6
|
+
exports.userCLIScripts = exports.tsConfigCli = exports.ProjectDeploymentStatus = exports.PROJECT_DEPLOY_TIMEOUT = exports.PROJECT_DEPLOY_CHECK_PERIOD = exports.CURRENT_PLAYWRIGHT_VERSION = void 0;
|
|
7
|
+
var _ms = _interopRequireDefault(require("ms"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
9
|
const CURRENT_PLAYWRIGHT_VERSION = exports.CURRENT_PLAYWRIGHT_VERSION = "1.44.1";
|
|
8
10
|
const ProjectDeploymentStatus = exports.ProjectDeploymentStatus = ["completed", "failed", "pending", "not_found"];
|
|
9
|
-
const PROJECT_DEPLOY_TIMEOUT = exports.PROJECT_DEPLOY_TIMEOUT =
|
|
11
|
+
const PROJECT_DEPLOY_TIMEOUT = exports.PROJECT_DEPLOY_TIMEOUT = (0, _ms.default)("10 minutes");
|
|
12
|
+
const PROJECT_DEPLOY_CHECK_PERIOD = exports.PROJECT_DEPLOY_CHECK_PERIOD = (0, _ms.default)("5 seconds");
|
|
10
13
|
const userCLIScripts = exports.userCLIScripts = {
|
|
11
14
|
"dev:local": "intuned-api-run sample playwright -j '{}'",
|
|
12
15
|
dev: "intuned-api-run",
|
|
@@ -27,7 +30,8 @@ const userCLIScripts = exports.userCLIScripts = {
|
|
|
27
30
|
};
|
|
28
31
|
const tsConfigCli = exports.tsConfigCli = {
|
|
29
32
|
compilerOptions: {
|
|
30
|
-
moduleResolution: "
|
|
33
|
+
moduleResolution: "NodeNext",
|
|
34
|
+
module: "NodeNext",
|
|
31
35
|
target: "ES2021",
|
|
32
36
|
outDir: "./dist",
|
|
33
37
|
sourceMap: false,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const templateIds:
|
|
2
|
-
export type TemplateId =
|
|
1
|
+
export declare const templateIds: readonly ["default", "empty", "linkedin-recorder", "api-auth-sessions", "nested-scheduling", "ai-extractors", "npm-auth-sessions"];
|
|
2
|
+
export type TemplateId = typeof templateIds[number];
|
|
3
3
|
/**
|
|
4
4
|
* A simple, tree-like structure to describe the contents of a folder to be mounted.
|
|
5
5
|
*
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
export declare function getAuthCredentials(options:
|
|
1
|
+
export declare function getAuthCredentials(options: {
|
|
2
|
+
workspaceId?: string;
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
}): Promise<{
|
|
2
5
|
workspaceId: any;
|
|
3
|
-
apiKey:
|
|
6
|
+
apiKey: string;
|
|
4
7
|
}>;
|
|
5
8
|
export declare function getBaseUrl(): string;
|
|
6
9
|
export declare function getSettingIntunedJSON(key: string): Promise<any>;
|
package/dist/common/cli/utils.js
CHANGED
|
@@ -8,14 +8,18 @@ exports.getBaseUrl = getBaseUrl;
|
|
|
8
8
|
exports.getSettingIntunedJSON = getSettingIntunedJSON;
|
|
9
9
|
var _path = _interopRequireDefault(require("path"));
|
|
10
10
|
var fs = _interopRequireWildcard(require("fs-extra"));
|
|
11
|
+
var _helpers = require("../../commands/intuned-cli/commands/helpers");
|
|
11
12
|
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); }
|
|
12
13
|
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; }
|
|
13
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
15
|
async function getAuthCredentials(options) {
|
|
15
16
|
const workspaceId = options.workspaceId || (await getSettingIntunedJSON("workspaceId"));
|
|
16
17
|
const apiKey = options.apiKey || process.env.INTUNED_API_KEY;
|
|
17
|
-
if (!workspaceId
|
|
18
|
-
throw new
|
|
18
|
+
if (!workspaceId) {
|
|
19
|
+
throw new _helpers.CLIError("Workspace ID is required. Please provide it via command line options or Intuned.json");
|
|
20
|
+
}
|
|
21
|
+
if (!apiKey) {
|
|
22
|
+
throw new _helpers.CLIError("API key is required. Please provide it via command line options or INTUNED_API_KEY environment variable.");
|
|
19
23
|
}
|
|
20
24
|
return {
|
|
21
25
|
workspaceId,
|
package/dist/common/constants.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.AUTH_SESSIONS_INSTANCES_FOLDER_NAME = exports.AUTH_SESSIONS_FOLDER_NAME = void 0;
|
|
6
|
+
exports.AUTH_SESSIONS_INSTANCES_FOLDER_NAME = exports.AUTH_SESSIONS_FOLDER_NAME = exports.API_FOLDER_NAME = void 0;
|
|
7
|
+
const API_FOLDER_NAME = exports.API_FOLDER_NAME = "api";
|
|
7
8
|
const AUTH_SESSIONS_FOLDER_NAME = exports.AUTH_SESSIONS_FOLDER_NAME = "auth-sessions";
|
|
8
9
|
const AUTH_SESSIONS_INSTANCES_FOLDER_NAME = exports.AUTH_SESSIONS_INSTANCES_FOLDER_NAME = "auth-sessions-instances";
|
|
@@ -7,7 +7,7 @@ exports.getPlaywrightConstructsForMode = getPlaywrightConstructsForMode;
|
|
|
7
7
|
exports.getProductionPlaywrightConstructs = getProductionPlaywrightConstructs;
|
|
8
8
|
exports.getRemotePlaywrightContext = getRemotePlaywrightContext;
|
|
9
9
|
exports.loadSessionToContext = loadSessionToContext;
|
|
10
|
-
var playwright = _interopRequireWildcard(require("
|
|
10
|
+
var playwright = _interopRequireWildcard(require("playwright"));
|
|
11
11
|
var _fsExtra = _interopRequireWildcard(require("fs-extra"));
|
|
12
12
|
var fs = _fsExtra;
|
|
13
13
|
var _contextStorageStateHelpers = require("./contextStorageStateHelpers");
|
|
@@ -43,19 +43,12 @@ async function getProductionPlaywrightConstructs({
|
|
|
43
43
|
if (headless) {
|
|
44
44
|
extraArgs.push("--headless=new");
|
|
45
45
|
}
|
|
46
|
-
const executablePath = playwright.chromium.executablePath();
|
|
47
|
-
const chromium127Path = executablePath.replace("chromium-1117", "chromium-1124");
|
|
48
|
-
const isChrome127There = await (0, _fsExtra.exists)(chromium127Path);
|
|
49
|
-
const userAgent = `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${isChrome127There ? 127 : 125}.0.0.0 Safari/537.36`;
|
|
50
46
|
const userDataDir = await createUserDirWithPreferences();
|
|
51
47
|
const context = await playwright.chromium.launchPersistentContext(userDataDir, {
|
|
52
48
|
headless,
|
|
53
|
-
|
|
49
|
+
viewport: null,
|
|
54
50
|
proxy,
|
|
55
|
-
|
|
56
|
-
args: extraArgs,
|
|
57
|
-
downloadsPath,
|
|
58
|
-
userAgent
|
|
51
|
+
downloadsPath
|
|
59
52
|
});
|
|
60
53
|
context.once("close", async () => {
|
|
61
54
|
try {
|
|
@@ -76,6 +69,9 @@ async function getProductionPlaywrightConstructs({
|
|
|
76
69
|
});
|
|
77
70
|
}
|
|
78
71
|
const assetsFile = _path.default.join(__dirname, "./assets/browser_scripts.js");
|
|
72
|
+
await context.addInitScript({
|
|
73
|
+
path: assetsFile
|
|
74
|
+
});
|
|
79
75
|
let page = context.pages().at(0);
|
|
80
76
|
if (page) {
|
|
81
77
|
const scriptString = await (0, _fsExtra.readFile)(assetsFile, "utf8");
|
|
@@ -88,7 +84,6 @@ async function getProductionPlaywrightConstructs({
|
|
|
88
84
|
context
|
|
89
85
|
};
|
|
90
86
|
}
|
|
91
|
-
const getChromiumLaunchArgsToIgnore = () => ["--disable-field-trial-config", "--disable-background-networking", "--enable-features=NetworkService,NetworkServiceInProcess", "--disable-background-timer-throttling", "--disable-backgrounding-occluded-windows", "--disable-back-forward-cache", "--disable-breakpad", "--disable-client-side-phishing-detection", "--disable-component-extensions-with-background-pages", "--disable-component-update", "--no-default-browser-check", "--disable-default-apps", "--disable-dev-shm-usage", "--disable-extensions", "--disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,TranslateUI", "--allow-pre-commit-input", "--disable-hang-monitor", "--disable-ipc-flooding-protection", "--disable-prompt-on-repost", "--disable-renderer-backgrounding", "--force-color-profile=srgb", "--metrics-recording-only", "--no-first-run", "--enable-automation", "--password-store=basic", "--use-mock-keychain", "--no-service-autorun", "--export-tagged-pdf", "--enable-use-zoom-for-dsf=false"];
|
|
92
87
|
async function getPlaywrightConstructsForMode(mode, cdpAddress, authSession) {
|
|
93
88
|
if (mode == "playwright-standalone") {
|
|
94
89
|
if (!cdpAddress) {
|
|
@@ -101,10 +96,15 @@ async function getPlaywrightConstructsForMode(mode, cdpAddress, authSession) {
|
|
|
101
96
|
throw new Error("no context found");
|
|
102
97
|
}
|
|
103
98
|
const assetsFile = _path.default.join(__dirname, "./assets/browser_scripts.js");
|
|
99
|
+
await context.addInitScript({
|
|
100
|
+
path: assetsFile
|
|
101
|
+
});
|
|
104
102
|
const pages = await context.pages();
|
|
105
103
|
let page = null;
|
|
106
104
|
if (pages.length > 0) {
|
|
107
105
|
page = pages[0];
|
|
106
|
+
const scriptString = await fs.readFile(assetsFile, "utf8");
|
|
107
|
+
await page.evaluate(scriptString);
|
|
108
108
|
} else {
|
|
109
109
|
page = await context.newPage();
|
|
110
110
|
}
|
|
@@ -155,7 +155,7 @@ async function loadSessionToContext({
|
|
|
155
155
|
await (0, _contextStorageStateHelpers.setStorageState)(context, sessionToLoad);
|
|
156
156
|
}
|
|
157
157
|
async function getRemotePlaywrightContext(cdpAddress) {
|
|
158
|
-
const playwright = await Promise.resolve().then(() => _interopRequireWildcard(require("
|
|
158
|
+
const playwright = await Promise.resolve().then(() => _interopRequireWildcard(require("playwright")));
|
|
159
159
|
let browser = null;
|
|
160
160
|
if (!cdpAddress) {
|
|
161
161
|
throw new Error("cdpAddress is required");
|
|
@@ -36,8 +36,7 @@ class JwtTokenManager {
|
|
|
36
36
|
return Math.max(timeToRefresh, timeWindow);
|
|
37
37
|
}
|
|
38
38
|
async scheduleTokenRefresh() {
|
|
39
|
-
|
|
40
|
-
if (((_process$env$RUN_ENVI = process.env.RUN_ENVIRONMENT) === null || _process$env$RUN_ENVI === void 0 ? void 0 : _process$env$RUN_ENVI.toLowerCase()) !== "authoring") return;
|
|
39
|
+
if (process.env.RUN_ENVIRONMENT?.toLowerCase() !== "authoring") return;
|
|
41
40
|
const timeToRefresh = this.timeToRefresh;
|
|
42
41
|
if (timeToRefresh === undefined) return;
|
|
43
42
|
if (this.tokenRefreshTimeout) clearTimeout(this.tokenRefreshTimeout);
|
|
@@ -51,8 +50,7 @@ class JwtTokenManager {
|
|
|
51
50
|
}, timeToRefresh);
|
|
52
51
|
}
|
|
53
52
|
async refreshToken() {
|
|
54
|
-
|
|
55
|
-
if (((_process$env$RUN_ENVI2 = process.env.RUN_ENVIRONMENT) === null || _process$env$RUN_ENVI2 === void 0 ? void 0 : _process$env$RUN_ENVI2.toLowerCase()) !== "authoring") return;
|
|
53
|
+
if (process.env.RUN_ENVIRONMENT?.toLowerCase() !== "authoring") return;
|
|
56
54
|
const res = await this.fetchWithToken(this.refreshTokenPath, {
|
|
57
55
|
method: "GET"
|
|
58
56
|
});
|
|
@@ -65,7 +63,7 @@ class JwtTokenManager {
|
|
|
65
63
|
if (newToken) this._token = newToken;
|
|
66
64
|
}
|
|
67
65
|
fetchWithToken(...[input, init]) {
|
|
68
|
-
const headers = new Headers(init
|
|
66
|
+
const headers = new Headers(init?.headers);
|
|
69
67
|
headers.set("Authorization", `Bearer ${this.token}`);
|
|
70
68
|
return (0, _crossFetch.default)(input, {
|
|
71
69
|
...init,
|
|
@@ -10,7 +10,7 @@ export declare const maxLevelsExceededErrorCode = "MaxLevelsExceededError";
|
|
|
10
10
|
export declare const automationError = "AutomationError";
|
|
11
11
|
export declare const internalInvalidInputErrorCode = "InternalInvalidInputError";
|
|
12
12
|
export declare const runAutomationErrorCodes: readonly ["APINotFoundError", "InvalidAPIError", "InvalidCheckError", "AbortedError", "AuthRequiredError", "AuthCheckNotFoundError", "AuthCheckFailedError", "MaxLevelsExceededError", "AutomationError", "InternalInvalidInputError"];
|
|
13
|
-
export type RunAutomationErrorCode =
|
|
13
|
+
export type RunAutomationErrorCode = typeof runAutomationErrorCodes[number];
|
|
14
14
|
export declare abstract class RunAutomationError<T = any> {
|
|
15
15
|
code: RunAutomationErrorCode;
|
|
16
16
|
statusCode: number;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.runAutomationErrorCodes = exports.maxLevelsExceededErrorCode = exports.invalidCheckErrorCode = exports.invalidApiErrorCode = exports.internalInvalidInputErrorCode = exports.automationError = exports.authRequiredErrorCode = exports.authCheckNotFoundErrorCode = exports.authCheckFailedErrorCode = exports.apiNotFoundErrorCode = exports.abortedErrorCode = exports.RunAutomationError = exports.MaxLevelsExceededError = exports.InvalidCheckError = exports.InvalidApiError = exports.InternalInvalidInputError = exports.AutomationError = exports.AuthRequiredError = exports.AuthCheckNotFoundError = exports.AuthCheckFailedError = exports.ApiNotFoundError = exports.AbortedError = void 0;
|
|
7
7
|
var _runtime = require("../../runtime");
|
|
8
|
-
var playwright = _interopRequireWildcard(require("
|
|
8
|
+
var playwright = _interopRequireWildcard(require("playwright-core"));
|
|
9
9
|
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); }
|
|
10
10
|
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; }
|
|
11
11
|
const apiNotFoundErrorCode = exports.apiNotFoundErrorCode = "APINotFoundError";
|
|
@@ -22,11 +22,10 @@ const runAutomationErrorCodes = exports.runAutomationErrorCodes = [apiNotFoundEr
|
|
|
22
22
|
class RunAutomationError {
|
|
23
23
|
wrapped = false;
|
|
24
24
|
get json() {
|
|
25
|
-
var _this$cause;
|
|
26
25
|
return {
|
|
27
26
|
code: this.code,
|
|
28
27
|
details: this.details,
|
|
29
|
-
cause:
|
|
28
|
+
cause: this.cause?.json
|
|
30
29
|
};
|
|
31
30
|
}
|
|
32
31
|
}
|
|
@@ -136,10 +135,10 @@ class AutomationError extends RunAutomationError {
|
|
|
136
135
|
};
|
|
137
136
|
}
|
|
138
137
|
this.statusCode = 500;
|
|
139
|
-
this.message = `[${
|
|
138
|
+
this.message = `[${error?.name ?? error}] ${error?.message}`;
|
|
140
139
|
this.details = {
|
|
141
|
-
name: error
|
|
142
|
-
message: error
|
|
140
|
+
name: error?.name,
|
|
141
|
+
message: error?.message
|
|
143
142
|
};
|
|
144
143
|
}
|
|
145
144
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Result } from "neverthrow";
|
|
2
2
|
import { RunAutomationError } from "./errors";
|
|
3
|
-
import { Page, BrowserContext } from "
|
|
3
|
+
import { Page, BrowserContext } from "playwright";
|
|
4
4
|
import { ExtendedRunApiParameters, RunApiResult, RunApiResultWithSessionOk } from "./types";
|
|
5
5
|
export * from "./types";
|
|
6
6
|
export * from "./errors";
|
|
@@ -8,6 +8,9 @@ export declare function runApiGenerator<ResultType = any, _YieldType = any, _Nex
|
|
|
8
8
|
retrieveSession: true;
|
|
9
9
|
}): AsyncGenerator<_YieldType, RunApiResult<ResultType, RunApiResultWithSessionOk>, _NextType>;
|
|
10
10
|
export declare function runApiGenerator<ResultType = any, _YieldType = any, _NextType = any>(params: ExtendedRunApiParameters): AsyncGenerator<_YieldType, RunApiResult<ResultType>, _NextType>;
|
|
11
|
+
export declare function runApi<ResultType = any>(params: ExtendedRunApiParameters & {
|
|
12
|
+
retrieveSession: true;
|
|
13
|
+
}): Promise<RunApiResult<ResultType, RunApiResultWithSessionOk>>;
|
|
11
14
|
export declare function runApi<ResultType = any>(params: ExtendedRunApiParameters): Promise<RunApiResult<ResultType>>;
|
|
12
15
|
export declare function checkAuthSessionWithRetries(page: Page, context: BrowserContext, checkFn: (..._: any) => Promise<boolean>, retries?: number): Promise<Result<boolean, RunAutomationError>>;
|
|
13
16
|
export type ImportFunction = ExtendedRunApiParameters["importFunction"];
|
|
@@ -80,17 +80,15 @@ async function* runApiGenerator({
|
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
try {
|
|
83
|
-
|
|
84
|
-
await ((_context = context) === null || _context === void 0 ? void 0 : _context.tracing.stop({
|
|
83
|
+
await context?.tracing.stop({
|
|
85
84
|
path: tracing.filePath
|
|
86
|
-
})
|
|
85
|
+
});
|
|
87
86
|
} catch (error) {
|
|
88
|
-
console.log(errorMessage, error
|
|
87
|
+
console.log(errorMessage, error?.message);
|
|
89
88
|
await (0, _fsExtra.remove)(tracing.filePath);
|
|
90
89
|
}
|
|
91
90
|
}
|
|
92
91
|
async function* runAutomation() {
|
|
93
|
-
var _getExecutionContext;
|
|
94
92
|
let page;
|
|
95
93
|
const validatedModuleResult = await importUsingImportFunction(automationFunction.name, importFunction);
|
|
96
94
|
if (validatedModuleResult.isErr()) {
|
|
@@ -98,7 +96,7 @@ async function* runApiGenerator({
|
|
|
98
96
|
}
|
|
99
97
|
const importedModule = validatedModuleResult.value;
|
|
100
98
|
let checkFn;
|
|
101
|
-
if (auth
|
|
99
|
+
if (auth?.runCheck) {
|
|
102
100
|
if (!auth.session) {
|
|
103
101
|
return (0, _neverthrow.err)(new _errors.AuthRequiredError());
|
|
104
102
|
}
|
|
@@ -130,7 +128,7 @@ async function* runApiGenerator({
|
|
|
130
128
|
headless,
|
|
131
129
|
proxy,
|
|
132
130
|
downloadsPath,
|
|
133
|
-
storageState: auth
|
|
131
|
+
storageState: auth?.session
|
|
134
132
|
}));
|
|
135
133
|
} else {
|
|
136
134
|
const {
|
|
@@ -140,7 +138,7 @@ async function* runApiGenerator({
|
|
|
140
138
|
({
|
|
141
139
|
page,
|
|
142
140
|
context
|
|
143
|
-
} = await (0, _getPlaywrightConstructs.getPlaywrightConstructsForMode)(mode, cdpAddress, auth
|
|
141
|
+
} = await (0, _getPlaywrightConstructs.getPlaywrightConstructsForMode)(mode, cdpAddress, auth?.session));
|
|
144
142
|
}
|
|
145
143
|
if (tracing.enabled) {
|
|
146
144
|
await context.tracing.start({
|
|
@@ -152,20 +150,23 @@ async function* runApiGenerator({
|
|
|
152
150
|
}
|
|
153
151
|
(0, _cleanEnvironmentVariables.cleanEnvironmentVariables)();
|
|
154
152
|
if (checkFn !== undefined) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
153
|
+
try {
|
|
154
|
+
console.log("Running auth check");
|
|
155
|
+
const authCheckResult = await checkAuthSessionWithRetries(page, context, checkFn, 2);
|
|
156
|
+
if (authCheckResult.isErr()) {
|
|
157
|
+
const error = authCheckResult.error;
|
|
158
|
+
if (["APINotFoundError", "InvalidAPIError"].includes(error.code)) {
|
|
159
|
+
return (0, _neverthrow.err)(new _errors.InvalidCheckError(`Auth session check function failed`, error));
|
|
160
|
+
}
|
|
161
|
+
return authCheckResult;
|
|
161
162
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
if (!authCheckResult.value) {
|
|
164
|
+
return (0, _neverthrow.err)(new _errors.AuthCheckFailedError());
|
|
165
|
+
}
|
|
166
|
+
} catch (error) {
|
|
165
167
|
return (0, _neverthrow.err)(new _errors.AuthCheckFailedError());
|
|
166
168
|
}
|
|
167
169
|
}
|
|
168
|
-
console.log("Running automation");
|
|
169
170
|
const automationFunctionParameters = [...(automationFunction.params !== undefined ? [automationFunction.params] : []), page, context];
|
|
170
171
|
let result;
|
|
171
172
|
if (importedModule.type === "async-generator") {
|
|
@@ -185,7 +186,7 @@ async function* runApiGenerator({
|
|
|
185
186
|
}
|
|
186
187
|
return (0, _neverthrow.ok)({
|
|
187
188
|
result,
|
|
188
|
-
extendedPayloads: (
|
|
189
|
+
extendedPayloads: (0, _asyncLocalStorage.getExecutionContext)()?.extendedPayloads,
|
|
189
190
|
session: retrieveSession ? await (0, _contextStorageStateHelpers.getStorageState)(context) : undefined
|
|
190
191
|
});
|
|
191
192
|
}
|
|
@@ -206,11 +207,10 @@ async function* runApiGenerator({
|
|
|
206
207
|
} catch (error) {
|
|
207
208
|
return (0, _neverthrow.err)(new _errors.AutomationError(error));
|
|
208
209
|
} finally {
|
|
209
|
-
var _context2;
|
|
210
210
|
await saveTraceIfNeeded({
|
|
211
211
|
errorMessage: "failed to save trace"
|
|
212
212
|
});
|
|
213
|
-
await
|
|
213
|
+
await context?.close();
|
|
214
214
|
if (downloadsPath !== undefined) {
|
|
215
215
|
await fs.remove(downloadsPath);
|
|
216
216
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { extendPayload, extendTimeout, runInfo, RunError, requestMultipleChoice, requestOTP, } from "./runtime";
|
|
1
|
+
export { extendPayload, extendTimeout, runInfo, RunError, requestMultipleChoice, requestOTP, getAuthSessionParameters, } from "./runtime";
|
|
2
2
|
export { runWithContext, getExecutionContext, } from "./common/asyncLocalStorage";
|
|
3
3
|
export { getDownloadDirectoryPath } from "./runtime/downloadDirectory";
|
|
4
4
|
export { getProductionPlaywrightConstructs } from "./common/getPlaywrightConstructs";
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "extendTimeout", {
|
|
|
21
21
|
return _runtime.extendTimeout;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "getAuthSessionParameters", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _runtime.getAuthSessionParameters;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
24
30
|
Object.defineProperty(exports, "getDownloadDirectoryPath", {
|
|
25
31
|
enumerable: true,
|
|
26
32
|
get: function () {
|
|
@@ -24,13 +24,12 @@ var _enums = require("./enums");
|
|
|
24
24
|
runId: "test-run-id",
|
|
25
25
|
extendedPayloads: []
|
|
26
26
|
}, () => {
|
|
27
|
-
|
|
28
|
-
(0, _vitest.expect)((_getExecutionContext = (0, _asyncLocalStorage.getExecutionContext)()) === null || _getExecutionContext === void 0 ? void 0 : _getExecutionContext.extendedPayloads).toEqual([]);
|
|
27
|
+
(0, _vitest.expect)((0, _asyncLocalStorage.getExecutionContext)()?.extendedPayloads).toEqual([]);
|
|
29
28
|
(0, _.extendPayload)({
|
|
30
29
|
api: "test-api",
|
|
31
30
|
parameters: {}
|
|
32
31
|
});
|
|
33
|
-
(0, _vitest.expect)((
|
|
32
|
+
(0, _vitest.expect)((0, _asyncLocalStorage.getExecutionContext)()?.extendedPayloads).toEqual([{
|
|
34
33
|
api: "test-api",
|
|
35
34
|
parameters: {}
|
|
36
35
|
}]);
|
|
@@ -47,7 +46,7 @@ var _enums = require("./enums");
|
|
|
47
46
|
parameters: {}
|
|
48
47
|
});
|
|
49
48
|
const context = (0, _asyncLocalStorage.getExecutionContext)();
|
|
50
|
-
(0, _vitest.expect)(context
|
|
49
|
+
(0, _vitest.expect)(context?.extendedPayloads).toHaveLength(4);
|
|
51
50
|
});
|
|
52
51
|
});
|
|
53
52
|
});
|
package/dist/runtime/export.d.ts
CHANGED
|
@@ -99,6 +99,7 @@ export interface RunInfo {
|
|
|
99
99
|
jobRunId?: string;
|
|
100
100
|
queueId?: string;
|
|
101
101
|
proxy?: string;
|
|
102
|
+
authSessionId?: string;
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
/**
|
|
@@ -200,3 +201,18 @@ export declare function requestMultipleChoice(
|
|
|
200
201
|
* ```
|
|
201
202
|
*/
|
|
202
203
|
export declare function requestOTP(message: string): unknown;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Retrieves the parameters for the authentication session currently being used.
|
|
207
|
+
*
|
|
208
|
+
* @returns {AuthSessionParameters} An object containing the parameters for the current authentication session.
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```typescript getAuthSessionParameters
|
|
212
|
+
* import { getAuthSessionParameters } from "@intuned/sdk/runtime"
|
|
213
|
+
*
|
|
214
|
+
* const authSessionParams = getAuthSessionParameters();
|
|
215
|
+
* console.log(authSessionParams);
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
export declare function getAuthSessionParameters(): Promise<any>;
|
|
@@ -16,6 +16,6 @@ function extendPayload(payload) {
|
|
|
16
16
|
context.extendedPayloads = [...items];
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
context
|
|
19
|
+
context?.extendedPayloads.push(...items);
|
|
20
20
|
(0, _extendTimeout.extendTimeout)();
|
|
21
21
|
}
|
|
@@ -17,13 +17,6 @@ function extendTimeout() {
|
|
|
17
17
|
if (!timeoutInfo) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
if (timeoutInfo.timeoutTimestamp !== undefined && timeoutInfo.timeoutDuration !== undefined) {
|
|
21
|
-
const newTimeoutStamp = Date.now() + timeoutInfo.timeoutDuration;
|
|
22
|
-
if (newTimeoutStamp - timeoutInfo.timeoutTimestamp < _DEBOUNCE_TIME) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
timeoutInfo.timeoutTimestamp = newTimeoutStamp;
|
|
26
|
-
}
|
|
27
20
|
if (timeoutInfo.extendTimeoutCallback !== undefined) {
|
|
28
21
|
void timeoutInfo.extendTimeoutCallback().catch(() => undefined);
|
|
29
22
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getAuthSessionParameters(): Promise<any>;
|