deepspace 0.5.7 → 0.6.1
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/CHANGELOG.md +16 -0
- package/dist/cli.js +286 -85
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +26 -3
- package/dist/index.js +124 -13
- package/dist/index.js.map +1 -1
- package/dist/testing.d.ts +115 -0
- package/features/cron/src/CronLogPage.tsx +3 -3
- package/package.json +2 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as _playwright_test from '@playwright/test';
|
|
2
|
+
import { BrowserContext, Page, Browser } from '@playwright/test';
|
|
3
|
+
export { expect } from '@playwright/test';
|
|
4
|
+
|
|
5
|
+
interface MultiplayerUser {
|
|
6
|
+
context: BrowserContext;
|
|
7
|
+
page: Page;
|
|
8
|
+
email: string;
|
|
9
|
+
name: string;
|
|
10
|
+
/** Test account user ID, if known from the accounts registry. */
|
|
11
|
+
userId?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Fixture function signature. Pass either a count (`users(2)`) or an
|
|
15
|
+
* array of account names (`users(['Alice', 'Bob'])`). Returns one entry
|
|
16
|
+
* per requested user.
|
|
17
|
+
*/
|
|
18
|
+
type UsersFixture = (selector: number | string[], options?: {
|
|
19
|
+
label?: string;
|
|
20
|
+
}) => Promise<MultiplayerUser[]>;
|
|
21
|
+
interface MultiplayerFixtures {
|
|
22
|
+
users: UsersFixture;
|
|
23
|
+
}
|
|
24
|
+
declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & MultiplayerFixtures, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Account-credential plumbing for the testing module.
|
|
28
|
+
*
|
|
29
|
+
* Reads test accounts from `~/.deepspace/test-accounts.json` (the same
|
|
30
|
+
* file `deepspace test-accounts create` writes). Each account has at
|
|
31
|
+
* minimum `{email, password}`; `name` and `label` are optional.
|
|
32
|
+
*
|
|
33
|
+
* Used by the multi-user Playwright fixture in `./fixtures.ts` and is
|
|
34
|
+
* also exported standalone in case suites want to do their own
|
|
35
|
+
* orchestration.
|
|
36
|
+
*/
|
|
37
|
+
interface TestAccount {
|
|
38
|
+
email: string;
|
|
39
|
+
password: string;
|
|
40
|
+
name?: string;
|
|
41
|
+
label?: string | null;
|
|
42
|
+
id?: string;
|
|
43
|
+
userId?: string;
|
|
44
|
+
createdAt?: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Load all test accounts the developer has created. Returns an empty
|
|
48
|
+
* array if the file doesn't exist yet.
|
|
49
|
+
*/
|
|
50
|
+
declare function loadAllTestAccounts(): TestAccount[];
|
|
51
|
+
/**
|
|
52
|
+
* Pick `count` test accounts from the local registry, optionally
|
|
53
|
+
* filtered by `label`. Order-stable: sorted by `createdAt` ascending so
|
|
54
|
+
* the first test account you created is always the first one returned.
|
|
55
|
+
*
|
|
56
|
+
* Throws with a helpful message if not enough accounts exist.
|
|
57
|
+
*/
|
|
58
|
+
declare function pickTestAccounts(count: number, options?: {
|
|
59
|
+
label?: string;
|
|
60
|
+
}): TestAccount[];
|
|
61
|
+
/**
|
|
62
|
+
* Find a single account by name. Used by `users(['Alice', 'Bob'])`.
|
|
63
|
+
* Throws if not found.
|
|
64
|
+
*/
|
|
65
|
+
declare function findTestAccountByName(name: string): TestAccount;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Per-account `storageState` cache for Playwright.
|
|
69
|
+
*
|
|
70
|
+
* Better Auth applies a per-IP rate limit on `/api/auth/sign-in/email`
|
|
71
|
+
* (~5 sign-ins / 60s / endpoint). A multiplayer suite that spins up
|
|
72
|
+
* 5+ users per spec would hit the limit and start failing in non-obvious
|
|
73
|
+
* ways. This module signs each account in *once*, persists the
|
|
74
|
+
* resulting browser cookies + storage to disk, and reuses the file on
|
|
75
|
+
* subsequent runs.
|
|
76
|
+
*
|
|
77
|
+
* Cache layout:
|
|
78
|
+
* ~/.deepspace/playwright-states/<sha256(email)>.json
|
|
79
|
+
*
|
|
80
|
+
* Validity: a cached file is reused if Playwright successfully loads it
|
|
81
|
+
* AND the resulting context produces a non-anonymous session on the
|
|
82
|
+
* target app. If validation fails, we fall back to a fresh sign-in and
|
|
83
|
+
* overwrite the cache.
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
interface EnsureStorageStateOptions {
|
|
87
|
+
/** Max age of a cached state file before we re-sign-in. Default 7 days. */
|
|
88
|
+
maxAgeMs?: number;
|
|
89
|
+
/** Force a fresh sign-in even if the cache is fresh. */
|
|
90
|
+
force?: boolean;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Ensure a Playwright `storageState` file exists for `account` and
|
|
94
|
+
* return its path. Signs in once if the cache is missing, stale, or
|
|
95
|
+
* `force: true`.
|
|
96
|
+
*/
|
|
97
|
+
declare function ensureStorageState(browser: Browser, account: {
|
|
98
|
+
email: string;
|
|
99
|
+
password: string;
|
|
100
|
+
}, baseURL: string, options?: EnsureStorageStateOptions): Promise<string>;
|
|
101
|
+
/**
|
|
102
|
+
* Convenience: open a fresh `BrowserContext` for `account` using the
|
|
103
|
+
* cached storage state (signing in if needed). The caller is responsible
|
|
104
|
+
* for closing the context.
|
|
105
|
+
*/
|
|
106
|
+
declare function newSignedInContext(browser: Browser, account: {
|
|
107
|
+
email: string;
|
|
108
|
+
password: string;
|
|
109
|
+
}, baseURL: string, options?: EnsureStorageStateOptions): Promise<BrowserContext>;
|
|
110
|
+
/** Read a cached storageState file (mostly for debugging). */
|
|
111
|
+
declare function readCachedState(email: string): unknown | null;
|
|
112
|
+
/** Where the cache for `email` lives. Useful for diagnostics. */
|
|
113
|
+
declare function getStatePathForEmail(email: string): string;
|
|
114
|
+
|
|
115
|
+
export { type EnsureStorageStateOptions, type MultiplayerUser, type TestAccount, type UsersFixture, ensureStorageState, findTestAccountByName, getStatePathForEmail, loadAllTestAccounts, newSignedInContext, pickTestAccounts, readCachedState, test };
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Cron Log Page
|
|
3
3
|
*
|
|
4
4
|
* Subscribes to the app's CronRoom via `useCronMonitor` and renders live
|
|
5
|
-
* task state + execution history. The DO is keyed by `
|
|
6
|
-
* a single shared CronRoom DO instance backs the
|
|
7
|
-
* as RecordRoom.
|
|
5
|
+
* task state + execution history. The DO is keyed by `SCOPE_ID`
|
|
6
|
+
* (`app:${APP_ID}`) so a single shared CronRoom DO instance backs the
|
|
7
|
+
* whole app — same pattern as RecordRoom.
|
|
8
8
|
*
|
|
9
9
|
* Used both as a UI surface for verifying that scheduled tasks are firing
|
|
10
10
|
* in production, and as the data source for the cron e2e spec at
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deepspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=22.15.0"
|
|
6
6
|
},
|
|
@@ -112,6 +112,7 @@
|
|
|
112
112
|
"better-sqlite3": "^12.0.0",
|
|
113
113
|
"clsx": "^2.1.1",
|
|
114
114
|
"framer-motion": "^12.38.0",
|
|
115
|
+
"jsdom": "^29.1.1",
|
|
115
116
|
"lucide-react": "^1.7.0",
|
|
116
117
|
"react-router-dom": "^7.1.0",
|
|
117
118
|
"tailwind-merge": "^3.5.0",
|