@intuned/runtime-dev 1.3.12-ua.5 → 1.3.13-kv.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.
@@ -36,18 +36,18 @@ export declare const runApiStorageStateSchema: z.ZodObject<{
36
36
  secure: z.ZodBoolean;
37
37
  sameSite: z.ZodEnum<["Strict", "Lax", "None"]>;
38
38
  }, "strip", z.ZodTypeAny, {
39
+ path: string;
39
40
  value: string;
40
41
  name: string;
41
- path: string;
42
42
  domain: string;
43
43
  expires: number;
44
44
  httpOnly: boolean;
45
45
  secure: boolean;
46
46
  sameSite: "Strict" | "Lax" | "None";
47
47
  }, {
48
+ path: string;
48
49
  value: string;
49
50
  name: string;
50
- path: string;
51
51
  domain: string;
52
52
  expires: number;
53
53
  httpOnly: boolean;
@@ -92,23 +92,23 @@ export declare const runApiStorageStateSchema: z.ZodObject<{
92
92
  name: string;
93
93
  }>, "many">;
94
94
  }, "strip", z.ZodTypeAny, {
95
+ origin: string;
95
96
  sessionStorage: {
96
97
  value: string;
97
98
  name: string;
98
99
  }[];
99
- origin: string;
100
100
  }, {
101
+ origin: string;
101
102
  sessionStorage: {
102
103
  value: string;
103
104
  name: string;
104
105
  }[];
105
- origin: string;
106
106
  }>, "many">>;
107
107
  }, "strip", z.ZodTypeAny, {
108
108
  cookies: {
109
+ path: string;
109
110
  value: string;
110
111
  name: string;
111
- path: string;
112
112
  domain: string;
113
113
  expires: number;
114
114
  httpOnly: boolean;
@@ -123,17 +123,17 @@ export declare const runApiStorageStateSchema: z.ZodObject<{
123
123
  }[];
124
124
  }[];
125
125
  sessionStorage?: {
126
+ origin: string;
126
127
  sessionStorage: {
127
128
  value: string;
128
129
  name: string;
129
130
  }[];
130
- origin: string;
131
131
  }[] | undefined;
132
132
  }, {
133
133
  cookies: {
134
+ path: string;
134
135
  value: string;
135
136
  name: string;
136
- path: string;
137
137
  domain: string;
138
138
  expires: number;
139
139
  httpOnly: boolean;
@@ -148,11 +148,11 @@ export declare const runApiStorageStateSchema: z.ZodObject<{
148
148
  }[];
149
149
  }[];
150
150
  sessionStorage?: {
151
+ origin: string;
151
152
  sessionStorage: {
152
153
  value: string;
153
154
  name: string;
154
155
  }[];
155
- origin: string;
156
156
  }[] | undefined;
157
157
  }>;
158
158
  export type RunApiStorageState = z.input<typeof runApiStorageStateSchema>;
@@ -178,18 +178,18 @@ export declare const runApiSessionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
178
178
  secure: z.ZodBoolean;
179
179
  sameSite: z.ZodEnum<["Strict", "Lax", "None"]>;
180
180
  }, "strip", z.ZodTypeAny, {
181
+ path: string;
181
182
  value: string;
182
183
  name: string;
183
- path: string;
184
184
  domain: string;
185
185
  expires: number;
186
186
  httpOnly: boolean;
187
187
  secure: boolean;
188
188
  sameSite: "Strict" | "Lax" | "None";
189
189
  }, {
190
+ path: string;
190
191
  value: string;
191
192
  name: string;
192
- path: string;
193
193
  domain: string;
194
194
  expires: number;
195
195
  httpOnly: boolean;
@@ -234,23 +234,23 @@ export declare const runApiSessionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
234
234
  name: string;
235
235
  }>, "many">;
236
236
  }, "strip", z.ZodTypeAny, {
237
+ origin: string;
237
238
  sessionStorage: {
238
239
  value: string;
239
240
  name: string;
240
241
  }[];
241
- origin: string;
242
242
  }, {
243
+ origin: string;
243
244
  sessionStorage: {
244
245
  value: string;
245
246
  name: string;
246
247
  }[];
247
- origin: string;
248
248
  }>, "many">>;
249
249
  }, "strip", z.ZodTypeAny, {
250
250
  cookies: {
251
+ path: string;
251
252
  value: string;
252
253
  name: string;
253
- path: string;
254
254
  domain: string;
255
255
  expires: number;
256
256
  httpOnly: boolean;
@@ -265,17 +265,17 @@ export declare const runApiSessionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
265
265
  }[];
266
266
  }[];
267
267
  sessionStorage?: {
268
+ origin: string;
268
269
  sessionStorage: {
269
270
  value: string;
270
271
  name: string;
271
272
  }[];
272
- origin: string;
273
273
  }[] | undefined;
274
274
  }, {
275
275
  cookies: {
276
+ path: string;
276
277
  value: string;
277
278
  name: string;
278
- path: string;
279
279
  domain: string;
280
280
  expires: number;
281
281
  httpOnly: boolean;
@@ -290,20 +290,20 @@ export declare const runApiSessionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
290
290
  }[];
291
291
  }[];
292
292
  sessionStorage?: {
293
+ origin: string;
293
294
  sessionStorage: {
294
295
  value: string;
295
296
  name: string;
296
297
  }[];
297
- origin: string;
298
298
  }[] | undefined;
299
299
  }>>>;
300
300
  }, "strip", z.ZodTypeAny, {
301
301
  type: "state";
302
302
  state?: {
303
303
  cookies: {
304
+ path: string;
304
305
  value: string;
305
306
  name: string;
306
- path: string;
307
307
  domain: string;
308
308
  expires: number;
309
309
  httpOnly: boolean;
@@ -318,20 +318,20 @@ export declare const runApiSessionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
318
318
  }[];
319
319
  }[];
320
320
  sessionStorage?: {
321
+ origin: string;
321
322
  sessionStorage: {
322
323
  value: string;
323
324
  name: string;
324
325
  }[];
325
- origin: string;
326
326
  }[] | undefined;
327
327
  } | null | undefined;
328
328
  }, {
329
329
  type: "state";
330
330
  state?: {
331
331
  cookies: {
332
+ path: string;
332
333
  value: string;
333
334
  name: string;
334
- path: string;
335
335
  domain: string;
336
336
  expires: number;
337
337
  httpOnly: boolean;
@@ -346,11 +346,11 @@ export declare const runApiSessionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
346
346
  }[];
347
347
  }[];
348
348
  sessionStorage?: {
349
+ origin: string;
349
350
  sessionStorage: {
350
351
  value: string;
351
352
  name: string;
352
353
  }[];
353
- origin: string;
354
354
  }[] | undefined;
355
355
  } | null | undefined;
356
356
  }>]>;
@@ -404,18 +404,18 @@ export declare const runApiParametersSchema: z.ZodObject<{
404
404
  secure: z.ZodBoolean;
405
405
  sameSite: z.ZodEnum<["Strict", "Lax", "None"]>;
406
406
  }, "strip", z.ZodTypeAny, {
407
+ path: string;
407
408
  value: string;
408
409
  name: string;
409
- path: string;
410
410
  domain: string;
411
411
  expires: number;
412
412
  httpOnly: boolean;
413
413
  secure: boolean;
414
414
  sameSite: "Strict" | "Lax" | "None";
415
415
  }, {
416
+ path: string;
416
417
  value: string;
417
418
  name: string;
418
- path: string;
419
419
  domain: string;
420
420
  expires: number;
421
421
  httpOnly: boolean;
@@ -460,23 +460,23 @@ export declare const runApiParametersSchema: z.ZodObject<{
460
460
  name: string;
461
461
  }>, "many">;
462
462
  }, "strip", z.ZodTypeAny, {
463
+ origin: string;
463
464
  sessionStorage: {
464
465
  value: string;
465
466
  name: string;
466
467
  }[];
467
- origin: string;
468
468
  }, {
469
+ origin: string;
469
470
  sessionStorage: {
470
471
  value: string;
471
472
  name: string;
472
473
  }[];
473
- origin: string;
474
474
  }>, "many">>;
475
475
  }, "strip", z.ZodTypeAny, {
476
476
  cookies: {
477
+ path: string;
477
478
  value: string;
478
479
  name: string;
479
- path: string;
480
480
  domain: string;
481
481
  expires: number;
482
482
  httpOnly: boolean;
@@ -491,17 +491,17 @@ export declare const runApiParametersSchema: z.ZodObject<{
491
491
  }[];
492
492
  }[];
493
493
  sessionStorage?: {
494
+ origin: string;
494
495
  sessionStorage: {
495
496
  value: string;
496
497
  name: string;
497
498
  }[];
498
- origin: string;
499
499
  }[] | undefined;
500
500
  }, {
501
501
  cookies: {
502
+ path: string;
502
503
  value: string;
503
504
  name: string;
504
- path: string;
505
505
  domain: string;
506
506
  expires: number;
507
507
  httpOnly: boolean;
@@ -516,20 +516,20 @@ export declare const runApiParametersSchema: z.ZodObject<{
516
516
  }[];
517
517
  }[];
518
518
  sessionStorage?: {
519
+ origin: string;
519
520
  sessionStorage: {
520
521
  value: string;
521
522
  name: string;
522
523
  }[];
523
- origin: string;
524
524
  }[] | undefined;
525
525
  }>>>;
526
526
  }, "strip", z.ZodTypeAny, {
527
527
  type: "state";
528
528
  state?: {
529
529
  cookies: {
530
+ path: string;
530
531
  value: string;
531
532
  name: string;
532
- path: string;
533
533
  domain: string;
534
534
  expires: number;
535
535
  httpOnly: boolean;
@@ -544,20 +544,20 @@ export declare const runApiParametersSchema: z.ZodObject<{
544
544
  }[];
545
545
  }[];
546
546
  sessionStorage?: {
547
+ origin: string;
547
548
  sessionStorage: {
548
549
  value: string;
549
550
  name: string;
550
551
  }[];
551
- origin: string;
552
552
  }[] | undefined;
553
553
  } | null | undefined;
554
554
  }, {
555
555
  type: "state";
556
556
  state?: {
557
557
  cookies: {
558
+ path: string;
558
559
  value: string;
559
560
  name: string;
560
- path: string;
561
561
  domain: string;
562
562
  expires: number;
563
563
  httpOnly: boolean;
@@ -572,11 +572,11 @@ export declare const runApiParametersSchema: z.ZodObject<{
572
572
  }[];
573
573
  }[];
574
574
  sessionStorage?: {
575
+ origin: string;
575
576
  sessionStorage: {
576
577
  value: string;
577
578
  name: string;
578
579
  }[];
579
- origin: string;
580
580
  }[] | undefined;
581
581
  } | null | undefined;
582
582
  }>]>;
@@ -588,9 +588,9 @@ export declare const runApiParametersSchema: z.ZodObject<{
588
588
  type: "state";
589
589
  state?: {
590
590
  cookies: {
591
+ path: string;
591
592
  value: string;
592
593
  name: string;
593
- path: string;
594
594
  domain: string;
595
595
  expires: number;
596
596
  httpOnly: boolean;
@@ -605,11 +605,11 @@ export declare const runApiParametersSchema: z.ZodObject<{
605
605
  }[];
606
606
  }[];
607
607
  sessionStorage?: {
608
+ origin: string;
608
609
  sessionStorage: {
609
610
  value: string;
610
611
  name: string;
611
612
  }[];
612
- origin: string;
613
613
  }[] | undefined;
614
614
  } | null | undefined;
615
615
  };
@@ -621,9 +621,9 @@ export declare const runApiParametersSchema: z.ZodObject<{
621
621
  type: "state";
622
622
  state?: {
623
623
  cookies: {
624
+ path: string;
624
625
  value: string;
625
626
  name: string;
626
- path: string;
627
627
  domain: string;
628
628
  expires: number;
629
629
  httpOnly: boolean;
@@ -638,11 +638,11 @@ export declare const runApiParametersSchema: z.ZodObject<{
638
638
  }[];
639
639
  }[];
640
640
  sessionStorage?: {
641
+ origin: string;
641
642
  sessionStorage: {
642
643
  value: string;
643
644
  name: string;
644
645
  }[];
645
- origin: string;
646
646
  }[] | undefined;
647
647
  } | null | undefined;
648
648
  };
@@ -722,9 +722,9 @@ export declare const runApiParametersSchema: z.ZodObject<{
722
722
  type: "state";
723
723
  state?: {
724
724
  cookies: {
725
+ path: string;
725
726
  value: string;
726
727
  name: string;
727
- path: string;
728
728
  domain: string;
729
729
  expires: number;
730
730
  httpOnly: boolean;
@@ -739,11 +739,11 @@ export declare const runApiParametersSchema: z.ZodObject<{
739
739
  }[];
740
740
  }[];
741
741
  sessionStorage?: {
742
+ origin: string;
742
743
  sessionStorage: {
743
744
  value: string;
744
745
  name: string;
745
746
  }[];
746
- origin: string;
747
747
  }[] | undefined;
748
748
  } | null | undefined;
749
749
  };
@@ -767,9 +767,9 @@ export declare const runApiParametersSchema: z.ZodObject<{
767
767
  type: "state";
768
768
  state?: {
769
769
  cookies: {
770
+ path: string;
770
771
  value: string;
771
772
  name: string;
772
- path: string;
773
773
  domain: string;
774
774
  expires: number;
775
775
  httpOnly: boolean;
@@ -784,11 +784,11 @@ export declare const runApiParametersSchema: z.ZodObject<{
784
784
  }[];
785
785
  }[];
786
786
  sessionStorage?: {
787
+ origin: string;
787
788
  sessionStorage: {
788
789
  value: string;
789
790
  name: string;
790
791
  }[];
791
- origin: string;
792
792
  }[] | undefined;
793
793
  } | null | undefined;
794
794
  };
@@ -1,2 +1,2 @@
1
- import { Store } from "./export";
2
- export declare const attemptStore: Store;
1
+ import { AttemptStore } from "./export";
2
+ export declare const attemptStore: AttemptStore;
@@ -171,22 +171,22 @@ export declare class RunError extends Error {
171
171
  export declare function getAuthSessionParameters(): Promise<any>;
172
172
 
173
173
  /**
174
- * @interface Store
174
+ * @interface AttemptStore
175
175
  * @property {function} get - Retrieves a value from the store by key
176
176
  * @property {function} set - Sets a value in the store by key
177
177
  *
178
178
  * @example
179
- * ```typescript Store usage
180
- * import { store } from "@intuned/sdk/runtime"
179
+ * ```typescript AttemptStore usage
180
+ * import { attemptStore } from "@intuned/sdk/runtime"
181
181
  *
182
182
  * // Set a value in the store
183
- * store.set('userPreference', { theme: 'dark' });
183
+ * attemptStore.set('openAiClient', openaiClient);
184
184
  *
185
185
  * // Get a value from the store
186
- * const preference = store.get('userPreference');
186
+ * const openAiClient = attemptStore.get('openAiClient');
187
187
  * ```
188
188
  */
189
- export interface Store {
189
+ export interface AttemptStore {
190
190
  /**
191
191
  * Retrieves a value from the store by key.
192
192
  *
@@ -211,18 +211,74 @@ export interface Store {
211
211
  * This store allows you to share data between different parts of your API execution.
212
212
  *
213
213
  * @example
214
- * ```typescript Store usage
215
- * import { store } from "@intuned/sdk/runtime"
214
+ * ```typescript AttemptStore usage
215
+ * import { attemptStore } from "@intuned/sdk/runtime"
216
216
  *
217
217
  * // Set a value in the store
218
- * store.set('sessionData', { userId: '123', token: 'abc' });
218
+ * store.set('openAiClient', openaiClient);
219
219
  *
220
220
  * // Get a value from the store
221
- * const sessionData = store.get('sessionData');
222
- * console.log(sessionData.userId); // '123'
221
+ * const openAiClient = attemptStore.get('openAiClient');
222
+ * openAiClient.doSomething();
223
223
  *
224
224
  * // Handle missing values
225
- * const missingData = store.get('nonexistent'); // undefined
225
+ * const missingData = attemptStore.get('nonexistent'); // undefined
226
226
  * ```
227
227
  */
228
- export declare const attemptStore: Store;
228
+ export declare const attemptStore: AttemptStore;
229
+
230
+ /**
231
+ * @interface PersistentStore
232
+ * @property {function} get - Retrieves a value from the store by key
233
+ * @property {function} set - Sets a value in the store by key
234
+ *
235
+ * @example
236
+ * ```typescript PersistentStore usage
237
+ * import { persistentStore } from "@intuned/sdk/runtime"
238
+ *
239
+ * // Set a value in the store
240
+ * persistentStore.set('data', { foo: 'bar' });
241
+ *
242
+ * // Get a value from the store
243
+ * await persistentStore.get('data');
244
+ * ```
245
+ */
246
+ export interface PersistentStore {
247
+ /**
248
+ * Retrieves a value from the store by key.
249
+ *
250
+ * @param {string} key - The key to retrieve the value for
251
+ * @returns {any} The value associated with the key, or undefined if not found
252
+ */
253
+ get(key: string): Promise<any>;
254
+
255
+ /**
256
+ * Sets a value in the store by key.
257
+ *
258
+ * @param {string} key - The key to set the value for
259
+ * @param {any} value - The value to store
260
+ * @throws {Error} Throws an error if the store operation fails
261
+ */
262
+ set(key: string, value: any): Promise<void>;
263
+ }
264
+
265
+ /**
266
+ * ## Description
267
+ * A persistent key-value store that maintains data within the execution context.
268
+ * This store allows you to share data between different API executions.
269
+ *
270
+ * @example
271
+ * ```typescript PersistentStore usage
272
+ * import { persistentStore } from "@intuned/sdk/runtime"
273
+ *
274
+ * // Set a value in the store
275
+ * persistentStore.set('data', { foo: 'bar' });
276
+ *
277
+ * // Get a value from the store
278
+ * await persistentStore.get('data');
279
+ *
280
+ * // Handle missing values
281
+ * const missingData = await persistentStore.get('nonexistent'); // undefined
282
+ * ```
283
+ */
284
+ export declare const persistentStore: PersistentStore;
@@ -1,6 +1,7 @@
1
1
  export { extendPayload } from "./extendPayload";
2
2
  export { extendTimeout } from "./extendTimeout";
3
3
  export { attemptStore } from "./attemptStore";
4
+ export { persistentStore } from "./persistentStore";
4
5
  export { getAuthSessionParameters } from "./getAuthSessionParameters";
5
6
  export { runInfo } from "./runInfo";
6
7
  export { RunError } from "./RunError";
@@ -39,6 +39,12 @@ Object.defineProperty(exports, "getDownloadDirectoryPath", {
39
39
  return _downloadDirectory.getDownloadDirectoryPath;
40
40
  }
41
41
  });
42
+ Object.defineProperty(exports, "persistentStore", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _persistentStore.persistentStore;
46
+ }
47
+ });
42
48
  Object.defineProperty(exports, "runInfo", {
43
49
  enumerable: true,
44
50
  get: function () {
@@ -48,6 +54,7 @@ Object.defineProperty(exports, "runInfo", {
48
54
  var _extendPayload = require("./extendPayload");
49
55
  var _extendTimeout = require("./extendTimeout");
50
56
  var _attemptStore = require("./attemptStore");
57
+ var _persistentStore = require("./persistentStore");
51
58
  var _getAuthSessionParameters = require("./getAuthSessionParameters");
52
59
  var _runInfo = require("./runInfo");
53
60
  var _RunError = require("./RunError");
@@ -0,0 +1,2 @@
1
+ import type { PersistentStore } from "./export";
2
+ export declare const persistentStore: PersistentStore;
@@ -3,15 +3,15 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.cache = void 0;
6
+ exports.persistentStore = void 0;
7
7
  var _zod = require("zod");
8
8
  var _jwtTokenManager = require("../common/jwtTokenManager");
9
9
  const forbiddenCharacters = /[:#]/g;
10
10
  const keySchema = _zod.z.string().min(1, "Key must be at least 1 character long").refine(key => (key.match(forbiddenCharacters)?.length ?? 0) === 0, 'Key cannot contain the following characters: ":" or "#"');
11
- class Cache {
12
- async get(key) {
11
+ const persistentStore = exports.persistentStore = Object.freeze({
12
+ get: async key => {
13
13
  const parsedKey = keySchema.parse(key);
14
- const response = await (0, _jwtTokenManager.callBackendFunctionWithToken)(`cache/${parsedKey}`, {
14
+ const response = await (0, _jwtTokenManager.callBackendFunctionWithToken)(`kv-store/${parsedKey}`, {
15
15
  method: "GET"
16
16
  });
17
17
  const json = await response.json();
@@ -19,10 +19,10 @@ class Cache {
19
19
  throw new Error(json.message);
20
20
  }
21
21
  return json.value;
22
- }
23
- async set(key, value) {
22
+ },
23
+ set: async (key, value) => {
24
24
  const keyResult = keySchema.parse(key);
25
- const response = await (0, _jwtTokenManager.callBackendFunctionWithToken)(`cache/${keyResult}`, {
25
+ const response = await (0, _jwtTokenManager.callBackendFunctionWithToken)(`kv-store/${keyResult}`, {
26
26
  method: "PUT",
27
27
  body: JSON.stringify(value),
28
28
  headers: {
@@ -34,5 +34,4 @@ class Cache {
34
34
  throw new Error(json.message);
35
35
  }
36
36
  }
37
- }
38
- const cache = exports.cache = new Cache();
37
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.3.12-ua.5",
3
+ "version": "1.3.13-kv.0",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
@@ -30,7 +30,6 @@
30
30
  "intuned-auth-session-load": "vite-node ./src/commands/auth/load.ts",
31
31
  "intuned-ts-check": "yarn prepublishOnly && vite-node ./src/commands/ts-check.ts",
32
32
  "intuned": "vite-node ./src/commands/intuned-cli/main.ts",
33
- "intuned-get-headless-user-agent": "vite-node ./src/commands/get-headless-user-agent.ts",
34
33
  "build": "rm -rf dist && tsc -p tsconfig.json && yarn copy-dts && babel src --out-dir dist --extensions '.ts' && cp -r ./src/common/assets dist/common/assets",
35
34
  "test": "vitest run",
36
35
  "test:watch": "vitest",
@@ -51,7 +50,6 @@
51
50
  "intuned-browser-start": "bin/intuned-browser-start",
52
51
  "intuned-browser-save-state": "bin/intuned-browser-save-state",
53
52
  "intuned-ts-check": "bin/intuned-ts-check",
54
- "intuned-get-headless-user-agent": "bin/intuned-get-headless-user-agent",
55
53
  "intuned": "bin/intuned"
56
54
  },
57
55
  "dependencies": {
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- require("../dist/common/binStartupScript.js");
4
- require("../dist/commands/get-headless-user-agent.js");
@@ -1 +0,0 @@
1
- export {};
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- var _commander = require("commander");
4
- var _dotenv = _interopRequireDefault(require("dotenv"));
5
- var _launchBrowser = require("../common/launchBrowser");
6
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
7
- _dotenv.default.config();
8
- _commander.program.description("get headless user agent").action(async () => {
9
- try {
10
- console.log(await (0, _launchBrowser.getHeadlessUserAgent)({}));
11
- } catch (error) {
12
- console.error("Error getting headless user agent:", error);
13
- process.exit(1);
14
- }
15
- });
16
- _commander.program.parse(process.argv);