@intuned/runtime-dev 1.3.1-api-token.6 → 1.3.3-fix.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.
Files changed (37) hide show
  1. package/dist/commands/api/run.js +5 -3
  2. package/dist/commands/auth-sessions/load.js +3 -3
  3. package/dist/commands/auth-sessions/run-check.js +1 -2
  4. package/dist/commands/auth-sessions/run-create.js +12 -35
  5. package/dist/commands/interface/run.d.ts +1 -1
  6. package/dist/commands/interface/run.js +14 -40
  7. package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +2 -1
  8. package/dist/commands/intuned-cli/commands/types.d.ts +1 -1
  9. package/dist/commands/intuned-cli/controller/__test__/api.test.js +1 -2
  10. package/dist/commands/intuned-cli/controller/api.js +1 -2
  11. package/dist/commands/intuned-cli/controller/authSession.js +3 -4
  12. package/dist/commands/intuned-cli/controller/save.js +27 -28
  13. package/dist/commands/intuned-cli/helpers/errors.d.ts +2 -2
  14. package/dist/commands/intuned-cli/helpers/errors.js +8 -4
  15. package/dist/commands/intuned-cli/main.js +2 -2
  16. package/dist/common/asyncLocalStorage/index.d.ts +1 -0
  17. package/dist/common/playwrightContext.d.ts +54 -0
  18. package/dist/common/{getPlaywrightConstructs.js → playwrightContext.js} +148 -79
  19. package/dist/common/runApi/importUsingImportFunction.d.ts +9 -0
  20. package/dist/common/runApi/importUsingImportFunction.js +46 -0
  21. package/dist/common/runApi/index.d.ts +2 -7
  22. package/dist/common/runApi/index.js +92 -177
  23. package/dist/common/runApi/types.d.ts +3 -7
  24. package/dist/common/runApi/types.js +1 -2
  25. package/dist/common/setupContextHook.d.ts +17 -0
  26. package/dist/common/setupContextHook.js +22 -0
  27. package/dist/index.d.ts +2 -2
  28. package/dist/index.js +13 -19
  29. package/dist/runtime/attemptStore.d.ts +2 -0
  30. package/dist/runtime/attemptStore.js +23 -0
  31. package/dist/runtime/export.d.ts +51 -41
  32. package/dist/runtime/index.d.ts +1 -2
  33. package/dist/runtime/index.js +7 -13
  34. package/package.json +3 -1
  35. package/dist/common/getPlaywrightConstructs.d.ts +0 -30
  36. package/dist/runtime/requestMoreInfo.d.ts +0 -18
  37. package/dist/runtime/requestMoreInfo.js +0 -25
@@ -126,6 +126,8 @@ export interface RunErrorOptions {
126
126
  }
127
127
 
128
128
  /**
129
+ * @deprecated This error is deprecated. it will be treated like any normal error
130
+ *
129
131
  * Represents an error that occurs during a run.
130
132
  *
131
133
  * @class
@@ -154,65 +156,73 @@ export declare class RunError extends Error {
154
156
  }
155
157
 
156
158
  /**
157
- * in the create auth session flow, you might to need a multiple choice answer from the user, requestMultipleChoice prompts the user with the question and possible options and returns their selection.
158
- *
159
- * **Note:** This function is currently in beta and may be subject to changes.
159
+ * Retrieves the parameters for the authentication session currently being used.
160
160
  *
161
- * @param {string} message - The message to display to the user.
162
- * @param {string[]} choices - An array of choices to present to the user.
161
+ * @returns {AuthSessionParameters} An object containing the parameters for the current authentication session.
163
162
  *
164
163
  * @example
165
- * ```typescript requestMultipleChoice
166
- * // in auth-sessions/create.ts
167
- *
168
- * import { requestMultipleChoice } from "@intuned/sdk/runtime"
169
- *
170
- * const message = "What is your favorite color?";
171
- * const choices = ["Red", "Blue", "Green", "Yellow"];
172
- *
173
- * const selectedChoice = yield requestMultipleChoice(message, choices);
164
+ * ```typescript getAuthSessionParameters
165
+ * import { getAuthSessionParameters } from "@intuned/sdk/runtime"
174
166
  *
175
- * console.log(selectedChoice);
167
+ * const authSessionParams = getAuthSessionParameters();
168
+ * console.log(authSessionParams);
176
169
  * ```
177
170
  */
178
- export declare function requestMultipleChoice(
179
- message: string,
180
- choices: string[]
181
- ): unknown;
171
+ export declare function getAuthSessionParameters(): Promise<any>;
182
172
 
183
173
  /**
184
- * **Note:** This function is currently in beta and may be subject to changes.
185
- *
186
- * requestOTP help you to ask the user for an otp in the create auth-session flow.
187
- *
188
- * @param {string} message - The message to display to the user.
174
+ * @interface Store
175
+ * @property {function} get - Retrieves a value from the store by key
176
+ * @property {function} set - Sets a value in the store by key
189
177
  *
190
178
  * @example
191
- * ```typescript requestOTP
192
- * // in auth-sessions/create.ts
193
- *
194
- * import { requestOTP } from "@intuned/sdk/runtime"
179
+ * ```typescript Store usage
180
+ * import { store } from "@intuned/sdk/runtime"
195
181
  *
196
- * const message = "please submit and OTP from your authenticator app";
182
+ * // Set a value in the store
183
+ * store.set('userPreference', { theme: 'dark' });
197
184
  *
198
- * const otp = yield requestOTP(message);
199
- *
200
- * console.log(otp);
185
+ * // Get a value from the store
186
+ * const preference = store.get('userPreference');
201
187
  * ```
202
188
  */
203
- export declare function requestOTP(message: string): unknown;
189
+ export interface Store {
190
+ /**
191
+ * Retrieves a value from the store by key.
192
+ *
193
+ * @param {string} key - The key to retrieve the value for
194
+ * @returns {any} The value associated with the key, or undefined if not found
195
+ */
196
+ get(key: string): any;
197
+
198
+ /**
199
+ * Sets a value in the store by key.
200
+ *
201
+ * @param {string} key - The key to set the value for
202
+ * @param {any} value - The value to store
203
+ * @throws {Error} Throws an error if the store operation fails
204
+ */
205
+ set(key: string, value: any): void;
206
+ }
204
207
 
205
208
  /**
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
+ * ## Description
210
+ * A persistent key-value store that maintains data within the execution context.
211
+ * This store allows you to share data between different parts of your API execution.
209
212
  *
210
213
  * @example
211
- * ```typescript getAuthSessionParameters
212
- * import { getAuthSessionParameters } from "@intuned/sdk/runtime"
214
+ * ```typescript Store usage
215
+ * import { store } from "@intuned/sdk/runtime"
213
216
  *
214
- * const authSessionParams = getAuthSessionParameters();
215
- * console.log(authSessionParams);
217
+ * // Set a value in the store
218
+ * store.set('sessionData', { userId: '123', token: 'abc' });
219
+ *
220
+ * // Get a value from the store
221
+ * const sessionData = store.get('sessionData');
222
+ * console.log(sessionData.userId); // '123'
223
+ *
224
+ * // Handle missing values
225
+ * const missingData = store.get('nonexistent'); // undefined
216
226
  * ```
217
227
  */
218
- export declare function getAuthSessionParameters(): Promise<any>;
228
+ export declare const attemptStore: Store;
@@ -1,8 +1,7 @@
1
1
  export { extendPayload } from "./extendPayload";
2
2
  export { extendTimeout } from "./extendTimeout";
3
+ export { attemptStore } from "./attemptStore";
3
4
  export { getAuthSessionParameters } from "./getAuthSessionParameters";
4
5
  export { runInfo } from "./runInfo";
5
6
  export { RunError } from "./RunError";
6
- export { requestMultipleChoice, requestOTP } from "./requestMoreInfo";
7
- export type { RequestMoreInfoDetails } from "./requestMoreInfo";
8
7
  export { getDownloadDirectoryPath } from "./downloadDirectory";
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "RunError", {
9
9
  return _RunError.RunError;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "attemptStore", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _attemptStore.attemptStore;
16
+ }
17
+ });
12
18
  Object.defineProperty(exports, "extendPayload", {
13
19
  enumerable: true,
14
20
  get: function () {
@@ -33,18 +39,6 @@ Object.defineProperty(exports, "getDownloadDirectoryPath", {
33
39
  return _downloadDirectory.getDownloadDirectoryPath;
34
40
  }
35
41
  });
36
- Object.defineProperty(exports, "requestMultipleChoice", {
37
- enumerable: true,
38
- get: function () {
39
- return _requestMoreInfo.requestMultipleChoice;
40
- }
41
- });
42
- Object.defineProperty(exports, "requestOTP", {
43
- enumerable: true,
44
- get: function () {
45
- return _requestMoreInfo.requestOTP;
46
- }
47
- });
48
42
  Object.defineProperty(exports, "runInfo", {
49
43
  enumerable: true,
50
44
  get: function () {
@@ -53,8 +47,8 @@ Object.defineProperty(exports, "runInfo", {
53
47
  });
54
48
  var _extendPayload = require("./extendPayload");
55
49
  var _extendTimeout = require("./extendTimeout");
50
+ var _attemptStore = require("./attemptStore");
56
51
  var _getAuthSessionParameters = require("./getAuthSessionParameters");
57
52
  var _runInfo = require("./runInfo");
58
53
  var _RunError = require("./RunError");
59
- var _requestMoreInfo = require("./requestMoreInfo");
60
54
  var _downloadDirectory = require("./downloadDirectory");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.3.1-api-token.6",
3
+ "version": "1.3.3-fix.0",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
@@ -79,6 +79,7 @@
79
79
  "nanoid": "3",
80
80
  "neverthrow": "6.1.0",
81
81
  "playwright-extra": "4.3.6",
82
+ "portfinder": "^1.0.37",
82
83
  "prettier": "2.8.0",
83
84
  "promptly": "3.2.0",
84
85
  "rollup": "3.26.2",
@@ -118,6 +119,7 @@
118
119
  "eslint-plugin-deprecation": "^1.3.3",
119
120
  "eslint-plugin-prettier": "^4.2.1",
120
121
  "msw": "^2.1.2",
122
+ "playwright": "^1.55.0",
121
123
  "typedoc": "^0.25.13",
122
124
  "typedoc-plugin-frontmatter": "^1.0.0",
123
125
  "typedoc-plugin-markdown": "^4.0.2",
@@ -1,30 +0,0 @@
1
- import * as playwright from "playwright";
2
- import type { RunApiSession } from "./runApi";
3
- interface Proxy {
4
- server: string;
5
- username: string;
6
- password: string;
7
- }
8
- interface GetPlaywrightConstructsOptions {
9
- proxy?: Proxy;
10
- headless?: boolean;
11
- storageState?: RunApiSession;
12
- downloadsPath: string;
13
- }
14
- export declare function getProductionPlaywrightConstructs({ proxy, headless, storageState, downloadsPath, }: GetPlaywrightConstructsOptions): Promise<{
15
- page: playwright.Page;
16
- context: playwright.BrowserContext;
17
- }>;
18
- export declare function getPlaywrightConstructsForMode(mode: "vanilla" | "playwright" | "playwright-standalone" | "playwright-headless", cdpAddress: string | undefined, authSession?: RunApiSession): Promise<{
19
- page: playwright.Page;
20
- context: playwright.BrowserContext;
21
- }>;
22
- export declare function loadSessionToContext({ context, session, }: {
23
- context: playwright.BrowserContext;
24
- session: RunApiSession;
25
- }): Promise<void>;
26
- export declare function getRemotePlaywrightContext(cdpAddress: string): Promise<{
27
- browser: playwright.Browser;
28
- context: playwright.BrowserContext;
29
- }>;
30
- export {};
@@ -1,18 +0,0 @@
1
- interface RequestMoreInfoReturnTypeBase {
2
- [REQUEST_MORE_INFO_KEY]: true;
3
- action: "request_more_info";
4
- }
5
- interface RequestMultipleChoiceReturnType extends RequestMoreInfoReturnTypeBase {
6
- messageToUser: string;
7
- choices: string[];
8
- requestType: "multiple_choice";
9
- }
10
- interface RequestOtpReturnType extends RequestMoreInfoReturnTypeBase {
11
- messageToUser: string;
12
- requestType: "otp";
13
- }
14
- declare const REQUEST_MORE_INFO_KEY: unique symbol;
15
- export declare function requestOTP(messageToUser: string): RequestOtpReturnType;
16
- export declare function requestMultipleChoice(messageToUser: string, choices: string[]): RequestMultipleChoiceReturnType;
17
- export type RequestMoreInfoDetails = RequestMultipleChoiceReturnType | RequestOtpReturnType;
18
- export {};
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.requestMultipleChoice = requestMultipleChoice;
7
- exports.requestOTP = requestOTP;
8
- const REQUEST_MORE_INFO_KEY = Symbol("REQUEST_MORE_INFO");
9
- function requestOTP(messageToUser) {
10
- return {
11
- [REQUEST_MORE_INFO_KEY]: true,
12
- action: "request_more_info",
13
- messageToUser,
14
- requestType: "otp"
15
- };
16
- }
17
- function requestMultipleChoice(messageToUser, choices) {
18
- return {
19
- [REQUEST_MORE_INFO_KEY]: true,
20
- action: "request_more_info",
21
- messageToUser,
22
- requestType: "multiple_choice",
23
- choices
24
- };
25
- }