@intuned/runtime-dev 1.3.13-kv.1 → 1.3.14-ts-runtime-helpers
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/bin/intuned-get-headless-user-agent +4 -0
- package/dist/commands/get-headless-user-agent.d.ts +1 -0
- package/dist/commands/get-headless-user-agent.js +18 -0
- package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +6 -6
- package/dist/commands/intuned-cli/commands/types.d.ts +2 -2
- package/dist/commands/intuned-cli/controller/authSession.d.ts +6 -6
- package/dist/commands/intuned-cli/helpers/auth.d.ts +1 -1
- package/dist/commands/intuned-cli/helpers/errors.d.ts +1 -1
- package/dist/commands/intuned-cli/helpers/errors.js +2 -2
- package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +8 -140
- package/dist/commands/intuned-cli/helpers/intunedJson.js +12 -79
- package/dist/common/binStartupScript.js +8 -5
- package/dist/common/constants.d.ts +2 -0
- package/dist/common/constants.js +4 -2
- package/dist/common/{extensionsHelpers.d.ts → extension/extensionsHelpers.d.ts} +1 -1
- package/dist/common/{extensionsHelpers.js → extension/extensionsHelpers.js} +62 -6
- package/dist/common/extension/intunedExtensionServer.d.ts +25 -0
- package/dist/common/extension/intunedExtensionServer.js +164 -0
- package/dist/common/extension/types.d.ts +21 -0
- package/dist/common/extension/types.js +5 -0
- package/dist/common/intunedJson.d.ts +229 -0
- package/dist/common/intunedJson.js +133 -0
- package/dist/common/launchBrowser.d.ts +6 -0
- package/dist/common/launchBrowser.js +42 -17
- package/dist/common/runApi/index.js +6 -0
- package/dist/common/runApi/types.d.ts +20 -20
- package/dist/common/settingsSchema.d.ts +15 -1
- package/dist/common/settingsSchema.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +44 -1
- package/dist/runtime/captcha.d.ts +18 -0
- package/dist/runtime/captcha.js +190 -0
- package/dist/runtime/captcha.test.js +214 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +43 -0
- package/dist/runtime/persistentStore.test.js +101 -0
- package/package.json +4 -1
- package/WebTemplate.zip +0 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _vitest = require("vitest");
|
|
4
|
+
var _captcha = require("./captcha");
|
|
5
|
+
_vitest.vi.mock("fastify", () => {
|
|
6
|
+
const fastify = () => ({
|
|
7
|
+
post: _vitest.vi.fn(),
|
|
8
|
+
setNotFoundHandler: _vitest.vi.fn(),
|
|
9
|
+
listen: _vitest.vi.fn(async () => undefined),
|
|
10
|
+
close: _vitest.vi.fn(async () => undefined)
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
default: fastify
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
class FakeExtensionServer {
|
|
17
|
+
captchas = new Map();
|
|
18
|
+
subscribers = new Set();
|
|
19
|
+
subscribeCalls = 0;
|
|
20
|
+
unsubscribeCalls = 0;
|
|
21
|
+
seed(captchas) {
|
|
22
|
+
this.captchas.clear();
|
|
23
|
+
for (const c of captchas) this.captchas.set(c.id, c);
|
|
24
|
+
}
|
|
25
|
+
async upsertCaptcha(captcha) {
|
|
26
|
+
this.captchas.set(captcha.id, captcha);
|
|
27
|
+
for (const h of this.subscribers) {
|
|
28
|
+
await h(captcha);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async getCaptchas(_page, status) {
|
|
32
|
+
const list = [...this.captchas.values()];
|
|
33
|
+
return status ? list.filter(c => c.status === status) : list;
|
|
34
|
+
}
|
|
35
|
+
async subscribe(_page, handler) {
|
|
36
|
+
this.subscribeCalls += 1;
|
|
37
|
+
this.subscribers.add(handler);
|
|
38
|
+
}
|
|
39
|
+
async unsubscribe(_page, handler) {
|
|
40
|
+
this.unsubscribeCalls += 1;
|
|
41
|
+
this.subscribers.delete(handler);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
let server;
|
|
45
|
+
_vitest.vi.mock("../common/extension/intunedExtensionServer", () => {
|
|
46
|
+
return {
|
|
47
|
+
getIntunedExtensionServer: () => server
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
function makeMockPage() {
|
|
51
|
+
return {
|
|
52
|
+
waitForLoadState: _vitest.vi.fn().mockResolvedValue(undefined)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
(0, _vitest.beforeEach)(() => {
|
|
56
|
+
_vitest.vi.useFakeTimers();
|
|
57
|
+
server = new FakeExtensionServer();
|
|
58
|
+
});
|
|
59
|
+
(0, _vitest.afterEach)(() => {
|
|
60
|
+
_vitest.vi.useRealTimers();
|
|
61
|
+
_vitest.vi.restoreAllMocks();
|
|
62
|
+
});
|
|
63
|
+
(0, _vitest.describe)("runtime/captcha", () => {
|
|
64
|
+
(0, _vitest.it)("waitForCaptchaSolve: resolves after settle period when no captchas are present", async () => {
|
|
65
|
+
const page = makeMockPage();
|
|
66
|
+
const p = (0, _captcha.waitForCaptchaSolve)(page, {
|
|
67
|
+
timeoutInMs: 1000,
|
|
68
|
+
settlePeriodInMs: 10
|
|
69
|
+
});
|
|
70
|
+
await _vitest.vi.advanceTimersByTimeAsync(10);
|
|
71
|
+
await p;
|
|
72
|
+
(0, _vitest.expect)(page.waitForLoadState).not.toHaveBeenCalled();
|
|
73
|
+
(0, _vitest.expect)(server.subscribeCalls).toBe(1);
|
|
74
|
+
(0, _vitest.expect)(server.unsubscribeCalls).toBe(1);
|
|
75
|
+
});
|
|
76
|
+
(0, _vitest.it)("withWaitForCaptchaSolve: preserves return value and waits for networkidle by default", async () => {
|
|
77
|
+
const page = makeMockPage();
|
|
78
|
+
const p = (0, _captcha.withWaitForCaptchaSolve)(async () => "ok", {
|
|
79
|
+
page,
|
|
80
|
+
timeoutInMs: 1000,
|
|
81
|
+
settleDurationMs: 10
|
|
82
|
+
});
|
|
83
|
+
await _vitest.vi.advanceTimersByTimeAsync(10);
|
|
84
|
+
await (0, _vitest.expect)(p).resolves.toBe("ok");
|
|
85
|
+
(0, _vitest.expect)(page.waitForLoadState).toHaveBeenCalledWith("networkidle");
|
|
86
|
+
});
|
|
87
|
+
(0, _vitest.it)("withWaitForCaptchaSolve: skips networkidle when disabled", async () => {
|
|
88
|
+
const page = makeMockPage();
|
|
89
|
+
const p = (0, _captcha.withWaitForCaptchaSolve)(async () => "ok", {
|
|
90
|
+
page,
|
|
91
|
+
timeoutInMs: 1000,
|
|
92
|
+
settleDurationMs: 10,
|
|
93
|
+
waitForNetworkSettled: false
|
|
94
|
+
});
|
|
95
|
+
await _vitest.vi.advanceTimersByTimeAsync(10);
|
|
96
|
+
await (0, _vitest.expect)(p).resolves.toBe("ok");
|
|
97
|
+
(0, _vitest.expect)(page.waitForLoadState).not.toHaveBeenCalled();
|
|
98
|
+
});
|
|
99
|
+
(0, _vitest.it)("waitForCaptchaSolve: completes when a solving captcha becomes solved", async () => {
|
|
100
|
+
const page = makeMockPage();
|
|
101
|
+
server.seed([{
|
|
102
|
+
id: "c1",
|
|
103
|
+
tabId: 0,
|
|
104
|
+
type: "recaptcha",
|
|
105
|
+
status: "solving",
|
|
106
|
+
retryCount: 0
|
|
107
|
+
}]);
|
|
108
|
+
const p = (0, _captcha.waitForCaptchaSolve)(page, {
|
|
109
|
+
timeoutInMs: 1000,
|
|
110
|
+
settlePeriodInMs: 10
|
|
111
|
+
});
|
|
112
|
+
await Promise.resolve();
|
|
113
|
+
await server.upsertCaptcha({
|
|
114
|
+
id: "c1",
|
|
115
|
+
tabId: 0,
|
|
116
|
+
type: "recaptcha",
|
|
117
|
+
status: "solved",
|
|
118
|
+
retryCount: 0
|
|
119
|
+
});
|
|
120
|
+
await _vitest.vi.advanceTimersByTimeAsync(10);
|
|
121
|
+
await (0, _vitest.expect)(p).resolves.toBeUndefined();
|
|
122
|
+
});
|
|
123
|
+
(0, _vitest.it)("waitForCaptchaSolve: throws on captcha error", async () => {
|
|
124
|
+
const page = makeMockPage();
|
|
125
|
+
server.seed([{
|
|
126
|
+
id: "c1",
|
|
127
|
+
tabId: 0,
|
|
128
|
+
type: "recaptcha",
|
|
129
|
+
status: "solving",
|
|
130
|
+
retryCount: 0
|
|
131
|
+
}]);
|
|
132
|
+
const p = (0, _captcha.waitForCaptchaSolve)(page, {
|
|
133
|
+
timeoutInMs: 1000,
|
|
134
|
+
settlePeriodInMs: 10
|
|
135
|
+
});
|
|
136
|
+
const assertion = (0, _vitest.expect)(p).rejects.toThrow("CAPTCHA Solve Error: UNEXPECTED_ERROR");
|
|
137
|
+
await Promise.resolve();
|
|
138
|
+
await server.upsertCaptcha({
|
|
139
|
+
id: "c1",
|
|
140
|
+
tabId: 0,
|
|
141
|
+
type: "recaptcha",
|
|
142
|
+
status: "error",
|
|
143
|
+
retryCount: 0,
|
|
144
|
+
error: {
|
|
145
|
+
code: "UNEXPECTED_ERROR"
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
await _vitest.vi.advanceTimersByTimeAsync(10);
|
|
149
|
+
await assertion;
|
|
150
|
+
(0, _vitest.expect)(server.unsubscribeCalls).toBe(1);
|
|
151
|
+
});
|
|
152
|
+
(0, _vitest.it)("waitForCaptchaSolve: times out if captchas are still pending", async () => {
|
|
153
|
+
const page = makeMockPage();
|
|
154
|
+
server.seed([{
|
|
155
|
+
id: "c1",
|
|
156
|
+
tabId: 0,
|
|
157
|
+
type: "recaptcha",
|
|
158
|
+
status: "solving",
|
|
159
|
+
retryCount: 0
|
|
160
|
+
}]);
|
|
161
|
+
const p = (0, _captcha.waitForCaptchaSolve)(page, {
|
|
162
|
+
timeoutInMs: 5,
|
|
163
|
+
settlePeriodInMs: 1
|
|
164
|
+
});
|
|
165
|
+
const assertion = (0, _vitest.expect)(p).rejects.toThrow("CAPTCHA Solve timed out with pending captchas.");
|
|
166
|
+
await Promise.resolve();
|
|
167
|
+
await _vitest.vi.advanceTimersByTimeAsync(6);
|
|
168
|
+
await _vitest.vi.advanceTimersByTimeAsync(1);
|
|
169
|
+
await assertion;
|
|
170
|
+
(0, _vitest.expect)(server.unsubscribeCalls).toBe(1);
|
|
171
|
+
});
|
|
172
|
+
(0, _vitest.it)("waitForCaptchaSolve: waits for all captchas to resolve", async () => {
|
|
173
|
+
const page = makeMockPage();
|
|
174
|
+
server.seed([{
|
|
175
|
+
id: "c1",
|
|
176
|
+
tabId: 0,
|
|
177
|
+
type: "recaptcha",
|
|
178
|
+
status: "solving",
|
|
179
|
+
retryCount: 0
|
|
180
|
+
}, {
|
|
181
|
+
id: "c2",
|
|
182
|
+
tabId: 0,
|
|
183
|
+
type: "hcaptcha",
|
|
184
|
+
status: "solving",
|
|
185
|
+
retryCount: 0
|
|
186
|
+
}]);
|
|
187
|
+
const p = (0, _captcha.waitForCaptchaSolve)(page, {
|
|
188
|
+
timeoutInMs: 1000,
|
|
189
|
+
settlePeriodInMs: 10
|
|
190
|
+
});
|
|
191
|
+
await Promise.resolve();
|
|
192
|
+
await server.upsertCaptcha({
|
|
193
|
+
id: "c1",
|
|
194
|
+
tabId: 0,
|
|
195
|
+
type: "recaptcha",
|
|
196
|
+
status: "solved",
|
|
197
|
+
retryCount: 0
|
|
198
|
+
});
|
|
199
|
+
await _vitest.vi.advanceTimersByTimeAsync(10);
|
|
200
|
+
let settled = false;
|
|
201
|
+
p.then(() => settled = true).catch(() => settled = true);
|
|
202
|
+
await Promise.resolve();
|
|
203
|
+
(0, _vitest.expect)(settled).toBe(false);
|
|
204
|
+
await server.upsertCaptcha({
|
|
205
|
+
id: "c2",
|
|
206
|
+
tabId: 0,
|
|
207
|
+
type: "hcaptcha",
|
|
208
|
+
status: "detached",
|
|
209
|
+
retryCount: 0
|
|
210
|
+
});
|
|
211
|
+
await _vitest.vi.advanceTimersByTimeAsync(10);
|
|
212
|
+
await (0, _vitest.expect)(p).resolves.toBeUndefined();
|
|
213
|
+
});
|
|
214
|
+
});
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ export { persistentStore } from "./persistentStore";
|
|
|
5
5
|
export { getAuthSessionParameters } from "./getAuthSessionParameters";
|
|
6
6
|
export { runInfo } from "./runInfo";
|
|
7
7
|
export { RunError } from "./RunError";
|
|
8
|
+
export { waitForCaptchaSolve, withWaitForCaptchaSolve, onCaptchaEvent, onceCaptchaEvent, removeCaptchaEventListener, pauseCaptchaSolver, resumeCaptchaSolver, } from "./captcha";
|
|
8
9
|
export { getDownloadDirectoryPath } from "./downloadDirectory";
|
package/dist/runtime/index.js
CHANGED
|
@@ -39,18 +39,60 @@ Object.defineProperty(exports, "getDownloadDirectoryPath", {
|
|
|
39
39
|
return _downloadDirectory.getDownloadDirectoryPath;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
+
Object.defineProperty(exports, "onCaptchaEvent", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _captcha.onCaptchaEvent;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "onceCaptchaEvent", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _captcha.onceCaptchaEvent;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "pauseCaptchaSolver", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _captcha.pauseCaptchaSolver;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
42
60
|
Object.defineProperty(exports, "persistentStore", {
|
|
43
61
|
enumerable: true,
|
|
44
62
|
get: function () {
|
|
45
63
|
return _persistentStore.persistentStore;
|
|
46
64
|
}
|
|
47
65
|
});
|
|
66
|
+
Object.defineProperty(exports, "removeCaptchaEventListener", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _captcha.removeCaptchaEventListener;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "resumeCaptchaSolver", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _captcha.resumeCaptchaSolver;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
48
78
|
Object.defineProperty(exports, "runInfo", {
|
|
49
79
|
enumerable: true,
|
|
50
80
|
get: function () {
|
|
51
81
|
return _runInfo.runInfo;
|
|
52
82
|
}
|
|
53
83
|
});
|
|
84
|
+
Object.defineProperty(exports, "waitForCaptchaSolve", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return _captcha.waitForCaptchaSolve;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "withWaitForCaptchaSolve", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _captcha.withWaitForCaptchaSolve;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
54
96
|
var _extendPayload = require("./extendPayload");
|
|
55
97
|
var _extendTimeout = require("./extendTimeout");
|
|
56
98
|
var _attemptStore = require("./attemptStore");
|
|
@@ -58,4 +100,5 @@ var _persistentStore = require("./persistentStore");
|
|
|
58
100
|
var _getAuthSessionParameters = require("./getAuthSessionParameters");
|
|
59
101
|
var _runInfo = require("./runInfo");
|
|
60
102
|
var _RunError = require("./RunError");
|
|
103
|
+
var _captcha = require("./captcha");
|
|
61
104
|
var _downloadDirectory = require("./downloadDirectory");
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _vitest = require("vitest");
|
|
4
|
+
var _zod = require("zod");
|
|
5
|
+
var _persistentStore = require("./persistentStore");
|
|
6
|
+
var _jwtTokenManager = require("../common/jwtTokenManager");
|
|
7
|
+
_vitest.vi.mock("../common/jwtTokenManager", () => ({
|
|
8
|
+
callBackendFunctionWithToken: _vitest.vi.fn()
|
|
9
|
+
}));
|
|
10
|
+
(0, _vitest.describe)("Cache", () => {
|
|
11
|
+
(0, _vitest.beforeEach)(() => {
|
|
12
|
+
_vitest.vi.clearAllMocks();
|
|
13
|
+
});
|
|
14
|
+
(0, _vitest.describe)("get", () => {
|
|
15
|
+
(0, _vitest.it)("should return value when successful", async () => {
|
|
16
|
+
const mockResponse = {
|
|
17
|
+
ok: true,
|
|
18
|
+
json: _vitest.vi.fn().mockResolvedValue({
|
|
19
|
+
value: "cached_data"
|
|
20
|
+
})
|
|
21
|
+
};
|
|
22
|
+
_vitest.vi.mocked(_jwtTokenManager.callBackendFunctionWithToken).mockResolvedValue(mockResponse);
|
|
23
|
+
const result = await _persistentStore.persistentStore.get("test_key");
|
|
24
|
+
(0, _vitest.expect)(result).toBe("cached_data");
|
|
25
|
+
(0, _vitest.expect)(_jwtTokenManager.callBackendFunctionWithToken).toHaveBeenCalledWith("kv-store/test_key", {
|
|
26
|
+
method: "GET"
|
|
27
|
+
});
|
|
28
|
+
(0, _vitest.expect)(mockResponse.json).toHaveBeenCalled();
|
|
29
|
+
});
|
|
30
|
+
(0, _vitest.it)("should throw error when response is not ok", async () => {
|
|
31
|
+
const mockResponse = {
|
|
32
|
+
ok: false,
|
|
33
|
+
json: _vitest.vi.fn().mockResolvedValue({
|
|
34
|
+
message: "Cache miss"
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
_vitest.vi.mocked(_jwtTokenManager.callBackendFunctionWithToken).mockResolvedValue(mockResponse);
|
|
38
|
+
await (0, _vitest.expect)(_persistentStore.persistentStore.get("test_key")).rejects.toThrow("Cache miss");
|
|
39
|
+
});
|
|
40
|
+
(0, _vitest.it)("should throw error for empty key", async () => {
|
|
41
|
+
await (0, _vitest.expect)(_persistentStore.persistentStore.get("")).rejects.toThrow(_zod.ZodError);
|
|
42
|
+
});
|
|
43
|
+
(0, _vitest.it)("should throw error for key with colon", async () => {
|
|
44
|
+
await (0, _vitest.expect)(_persistentStore.persistentStore.get("invalid:key")).rejects.toThrow(_zod.ZodError);
|
|
45
|
+
});
|
|
46
|
+
(0, _vitest.it)("should throw error for key with hash", async () => {
|
|
47
|
+
await (0, _vitest.expect)(_persistentStore.persistentStore.get("invalid#key")).rejects.toThrow(_zod.ZodError);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
(0, _vitest.describe)("set", () => {
|
|
51
|
+
(0, _vitest.it)("should call backend correctly when successful", async () => {
|
|
52
|
+
const mockResponse = {
|
|
53
|
+
ok: true,
|
|
54
|
+
json: _vitest.vi.fn().mockResolvedValue({})
|
|
55
|
+
};
|
|
56
|
+
_vitest.vi.mocked(_jwtTokenManager.callBackendFunctionWithToken).mockResolvedValue(mockResponse);
|
|
57
|
+
const testValue = {
|
|
58
|
+
data: "test"
|
|
59
|
+
};
|
|
60
|
+
await _persistentStore.persistentStore.set("test_key", testValue);
|
|
61
|
+
(0, _vitest.expect)(_jwtTokenManager.callBackendFunctionWithToken).toHaveBeenCalledWith("kv-store/test_key", {
|
|
62
|
+
method: "PUT",
|
|
63
|
+
body: JSON.stringify(testValue),
|
|
64
|
+
headers: {
|
|
65
|
+
"Content-Type": "application/json"
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
(0, _vitest.expect)(mockResponse.json).toHaveBeenCalled();
|
|
69
|
+
});
|
|
70
|
+
(0, _vitest.it)("should throw error when response is not ok", async () => {
|
|
71
|
+
const mockResponse = {
|
|
72
|
+
ok: false,
|
|
73
|
+
json: _vitest.vi.fn().mockResolvedValue({
|
|
74
|
+
message: "Set failed"
|
|
75
|
+
})
|
|
76
|
+
};
|
|
77
|
+
_vitest.vi.mocked(_jwtTokenManager.callBackendFunctionWithToken).mockResolvedValue(mockResponse);
|
|
78
|
+
await (0, _vitest.expect)(_persistentStore.persistentStore.set("test_key", "value")).rejects.toThrow("Set failed");
|
|
79
|
+
});
|
|
80
|
+
(0, _vitest.it)("should throw error for empty key", async () => {
|
|
81
|
+
await (0, _vitest.expect)(_persistentStore.persistentStore.set("", "value")).rejects.toThrow(_zod.ZodError);
|
|
82
|
+
});
|
|
83
|
+
(0, _vitest.it)("should throw error for key with forbidden characters", async () => {
|
|
84
|
+
await (0, _vitest.expect)(_persistentStore.persistentStore.set("invalid:key", "value")).rejects.toThrow(_zod.ZodError);
|
|
85
|
+
await (0, _vitest.expect)(_persistentStore.persistentStore.set("invalid#key", "value")).rejects.toThrow(_zod.ZodError);
|
|
86
|
+
});
|
|
87
|
+
(0, _vitest.it)("should handle different value types", async () => {
|
|
88
|
+
const mockResponse = {
|
|
89
|
+
ok: true,
|
|
90
|
+
json: _vitest.vi.fn().mockResolvedValue({})
|
|
91
|
+
};
|
|
92
|
+
_vitest.vi.mocked(_jwtTokenManager.callBackendFunctionWithToken).mockResolvedValue(mockResponse);
|
|
93
|
+
await _persistentStore.persistentStore.set("key1", "string_value");
|
|
94
|
+
await _persistentStore.persistentStore.set("key2", {
|
|
95
|
+
object: "value"
|
|
96
|
+
});
|
|
97
|
+
await _persistentStore.persistentStore.set("key3", 123);
|
|
98
|
+
(0, _vitest.expect)(_jwtTokenManager.callBackendFunctionWithToken).toHaveBeenCalledTimes(3);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intuned/runtime-dev",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.14-ts-runtime-helpers",
|
|
4
4
|
"description": "Intuned runtime",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js",
|
|
@@ -30,6 +30,7 @@
|
|
|
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",
|
|
33
34
|
"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",
|
|
34
35
|
"test": "vitest run",
|
|
35
36
|
"test:watch": "vitest",
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
"intuned-browser-start": "bin/intuned-browser-start",
|
|
51
52
|
"intuned-browser-save-state": "bin/intuned-browser-save-state",
|
|
52
53
|
"intuned-ts-check": "bin/intuned-ts-check",
|
|
54
|
+
"intuned-get-headless-user-agent": "bin/intuned-get-headless-user-agent",
|
|
53
55
|
"intuned": "bin/intuned"
|
|
54
56
|
},
|
|
55
57
|
"dependencies": {
|
|
@@ -68,6 +70,7 @@
|
|
|
68
70
|
"commander": "14.0.0",
|
|
69
71
|
"cross-fetch": "^4.0.0",
|
|
70
72
|
"dotenv": "^16.3.1",
|
|
73
|
+
"fastify": "4.29.0",
|
|
71
74
|
"fs-extra": "^11.3.0",
|
|
72
75
|
"image-size": "^1.1.1",
|
|
73
76
|
"jsonc-parser": "^3.3.1",
|
package/WebTemplate.zip
DELETED
|
Binary file
|