deepspace 0.8.0 → 0.8.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepspace",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "engines": {
5
5
  "node": ">=22.15.0"
6
6
  },
@@ -47,7 +47,7 @@
47
47
  "better-auth": "1.6.23",
48
48
  "citty": "^0.2.0",
49
49
  "cross-spawn": "^7.0.6",
50
- "esbuild": "^0.25.0",
50
+ "esbuild": "^0.27.0",
51
51
  "hono": "^4.6.0",
52
52
  "jose": "^6.1.0",
53
53
  "smol-toml": "^1.6.1",
package/dist/testing.d.ts DELETED
@@ -1,115 +0,0 @@
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 };