@openparachute/hub 0.5.13 → 0.5.14-rc.10
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/README.md +109 -15
- package/package.json +2 -2
- package/src/__tests__/account-home-ui.test.ts +205 -0
- package/src/__tests__/admin-handlers.test.ts +74 -0
- package/src/__tests__/admin-host-admin-token.test.ts +62 -0
- package/src/__tests__/admin-vault-admin-token.test.ts +44 -0
- package/src/__tests__/admin-vaults.test.ts +70 -4
- package/src/__tests__/api-account.test.ts +191 -1
- package/src/__tests__/api-mint-token.test.ts +682 -3
- package/src/__tests__/api-modules-config.test.ts +16 -10
- package/src/__tests__/api-modules-ops.test.ts +97 -0
- package/src/__tests__/api-modules.test.ts +100 -83
- package/src/__tests__/api-ready.test.ts +135 -0
- package/src/__tests__/api-revoke-token.test.ts +384 -0
- package/src/__tests__/api-users.test.ts +390 -13
- package/src/__tests__/chrome-strip.test.ts +15 -15
- package/src/__tests__/cli.test.ts +7 -5
- package/src/__tests__/cloudflare-detect.test.ts +60 -5
- package/src/__tests__/expose-auth-preflight.test.ts +58 -50
- package/src/__tests__/expose-cloudflare.test.ts +114 -3
- package/src/__tests__/expose-interactive.test.ts +10 -4
- package/src/__tests__/expose-public-auto.test.ts +5 -1
- package/src/__tests__/expose.test.ts +49 -1
- package/src/__tests__/hub-db.test.ts +194 -29
- package/src/__tests__/hub-server.test.ts +322 -33
- package/src/__tests__/hub.test.ts +11 -0
- package/src/__tests__/init.test.ts +827 -0
- package/src/__tests__/lifecycle.test.ts +33 -1
- package/src/__tests__/migrate.test.ts +433 -51
- package/src/__tests__/notes-redirect.test.ts +20 -20
- package/src/__tests__/oauth-handlers.test.ts +1060 -29
- package/src/__tests__/oauth-ui.test.ts +12 -1
- package/src/__tests__/proxy-error-ui.test.ts +212 -0
- package/src/__tests__/proxy-state.test.ts +192 -0
- package/src/__tests__/resource-binding.test.ts +97 -0
- package/src/__tests__/scope-explanations.test.ts +36 -0
- package/src/__tests__/serve.test.ts +9 -9
- package/src/__tests__/services-manifest.test.ts +40 -40
- package/src/__tests__/setup-wizard.test.ts +1114 -66
- package/src/__tests__/setup.test.ts +1 -1
- package/src/__tests__/status.test.ts +39 -0
- package/src/__tests__/users.test.ts +396 -9
- package/src/__tests__/vault-auth-status.test.ts +271 -11
- package/src/__tests__/vault-hub-origin-env.test.ts +126 -0
- package/src/__tests__/well-known.test.ts +9 -9
- package/src/__tests__/wizard.test.ts +372 -0
- package/src/account-home-ui.ts +547 -0
- package/src/admin-handlers.ts +49 -17
- package/src/admin-host-admin-token.ts +25 -0
- package/src/admin-login-ui.ts +4 -4
- package/src/admin-vault-admin-token.ts +17 -0
- package/src/admin-vaults.ts +48 -15
- package/src/api-account.ts +72 -6
- package/src/api-mint-token.ts +132 -24
- package/src/api-modules-ops.ts +52 -16
- package/src/api-modules.ts +31 -14
- package/src/api-ready.ts +102 -0
- package/src/api-revoke-token.ts +107 -21
- package/src/api-users.ts +497 -58
- package/src/bun-link.ts +55 -0
- package/src/chrome-strip.ts +6 -6
- package/src/cli.ts +93 -24
- package/src/cloudflare/config.ts +10 -4
- package/src/cloudflare/detect.ts +73 -6
- package/src/commands/expose-auth-preflight.ts +55 -63
- package/src/commands/expose-cloudflare.ts +114 -10
- package/src/commands/expose-interactive.ts +10 -11
- package/src/commands/expose-public-auto.ts +6 -4
- package/src/commands/expose.ts +8 -0
- package/src/commands/init.ts +563 -0
- package/src/commands/install.ts +41 -23
- package/src/commands/lifecycle.ts +12 -0
- package/src/commands/migrate.ts +293 -41
- package/src/commands/status.ts +10 -1
- package/src/commands/wizard.ts +843 -0
- package/src/env-file.ts +10 -0
- package/src/help.ts +157 -17
- package/src/hub-db.ts +42 -0
- package/src/hub-server.ts +136 -23
- package/src/hub-settings.ts +13 -2
- package/src/hub.ts +16 -9
- package/src/notes-redirect.ts +5 -5
- package/src/oauth-handlers.ts +342 -173
- package/src/oauth-ui.ts +28 -2
- package/src/proxy-error-ui.ts +506 -0
- package/src/proxy-state.ts +131 -0
- package/src/resource-binding.ts +134 -0
- package/src/scope-attenuation.ts +85 -0
- package/src/scope-explanations.ts +94 -5
- package/src/service-spec.ts +39 -18
- package/src/setup-wizard.ts +1173 -117
- package/src/users.ts +307 -29
- package/src/vault/auth-status.ts +152 -25
- package/src/vault-hub-origin-env.ts +100 -0
- package/web/ui/dist/assets/index-2SSK7JbM.js +61 -0
- package/web/ui/dist/assets/index-B28SdMSz.css +1 -0
- package/web/ui/dist/index.html +2 -2
- package/src/__tests__/vault-tokens-create-interactive.test.ts +0 -183
- package/src/commands/vault-tokens-create-interactive.ts +0 -143
- package/web/ui/dist/assets/index-7DtAXz7y.css +0 -1
- package/web/ui/dist/assets/index-Dzrbe6EP.js +0 -61
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tests for the `/notes/*` → `/
|
|
2
|
+
* Tests for the `/notes/*` → `/surface/notes/*` redirect helper (Notes-as-app
|
|
3
3
|
* migration Phase 2, parachute-app design doc §16).
|
|
4
4
|
*
|
|
5
5
|
* Covers the path-match predicate, the target-URL builder, the DB-aware
|
|
@@ -52,30 +52,30 @@ describe("notes-redirect — isLegacyNotesPath", () => {
|
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
describe("notes-redirect — buildNotesRedirectTarget", () => {
|
|
55
|
-
test("rewrites the bare path /notes → /
|
|
56
|
-
expect(buildNotesRedirectTarget("/notes", "")).toBe("/
|
|
55
|
+
test("rewrites the bare path /notes → /surface/notes", () => {
|
|
56
|
+
expect(buildNotesRedirectTarget("/notes", "")).toBe("/surface/notes");
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
test("rewrites the trailing-slash form /notes/ → /
|
|
60
|
-
expect(buildNotesRedirectTarget("/notes/", "")).toBe("/
|
|
59
|
+
test("rewrites the trailing-slash form /notes/ → /surface/notes/", () => {
|
|
60
|
+
expect(buildNotesRedirectTarget("/notes/", "")).toBe("/surface/notes/");
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
test("rewrites a sub-path /notes/sw.js → /
|
|
64
|
-
expect(buildNotesRedirectTarget("/notes/sw.js", "")).toBe("/
|
|
63
|
+
test("rewrites a sub-path /notes/sw.js → /surface/notes/sw.js", () => {
|
|
64
|
+
expect(buildNotesRedirectTarget("/notes/sw.js", "")).toBe("/surface/notes/sw.js");
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
test("preserves a single-param query string", () => {
|
|
68
|
-
expect(buildNotesRedirectTarget("/notes/foo", "?q=1")).toBe("/
|
|
68
|
+
expect(buildNotesRedirectTarget("/notes/foo", "?q=1")).toBe("/surface/notes/foo?q=1");
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
test("preserves a multi-param query string verbatim (no re-encoding)", () => {
|
|
72
72
|
expect(buildNotesRedirectTarget("/notes/foo", "?a=1&b=hello%20world")).toBe(
|
|
73
|
-
"/
|
|
73
|
+
"/surface/notes/foo?a=1&b=hello%20world",
|
|
74
74
|
);
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
test("preserves the bare /notes + query (no trailing slash on rewrite)", () => {
|
|
78
|
-
expect(buildNotesRedirectTarget("/notes", "?next=foo")).toBe("/
|
|
78
|
+
expect(buildNotesRedirectTarget("/notes", "?next=foo")).toBe("/surface/notes?next=foo");
|
|
79
79
|
});
|
|
80
80
|
});
|
|
81
81
|
|
|
@@ -90,13 +90,13 @@ describe("notes-redirect — maybeRedirectNotes", () => {
|
|
|
90
90
|
// Absent DB defaults to redirect-on — the migration-default direction.
|
|
91
91
|
// Operators flipping the opt-out flag have a hub-with-DB; the default
|
|
92
92
|
// doesn't depend on DB readiness.
|
|
93
|
-
expect(maybeRedirectNotes("/notes/foo", "?q=1", undefined)).toBe("/
|
|
93
|
+
expect(maybeRedirectNotes("/notes/foo", "?q=1", undefined)).toBe("/surface/notes/foo?q=1");
|
|
94
94
|
});
|
|
95
95
|
|
|
96
96
|
test("returns the target URL when the path matches and the flag is absent (default)", () => {
|
|
97
97
|
const db = openHubDb(hubDbPath(dir));
|
|
98
98
|
try {
|
|
99
|
-
expect(maybeRedirectNotes("/notes/foo", "", db)).toBe("/
|
|
99
|
+
expect(maybeRedirectNotes("/notes/foo", "", db)).toBe("/surface/notes/foo");
|
|
100
100
|
} finally {
|
|
101
101
|
db.close();
|
|
102
102
|
}
|
|
@@ -109,7 +109,7 @@ describe("notes-redirect — maybeRedirectNotes", () => {
|
|
|
109
109
|
try {
|
|
110
110
|
setNotesRedirectDisabled(db, true);
|
|
111
111
|
setNotesRedirectDisabled(db, false);
|
|
112
|
-
expect(maybeRedirectNotes("/notes/foo", "", db)).toBe("/
|
|
112
|
+
expect(maybeRedirectNotes("/notes/foo", "", db)).toBe("/surface/notes/foo");
|
|
113
113
|
} finally {
|
|
114
114
|
db.close();
|
|
115
115
|
}
|
|
@@ -144,18 +144,18 @@ describe("notes-redirect — logNotesRedirect (throttled)", () => {
|
|
|
144
144
|
|
|
145
145
|
test("logs once on the first hit", () => {
|
|
146
146
|
const lines: string[] = [];
|
|
147
|
-
logNotesRedirect("/notes/foo", "/
|
|
147
|
+
logNotesRedirect("/notes/foo", "/surface/notes/foo", {
|
|
148
148
|
now: () => 1_000_000,
|
|
149
149
|
log: (m) => lines.push(m),
|
|
150
150
|
});
|
|
151
|
-
expect(lines).toEqual(["[notes-migration] redirect /notes/foo → /
|
|
151
|
+
expect(lines).toEqual(["[notes-migration] redirect /notes/foo → /surface/notes/foo"]);
|
|
152
152
|
});
|
|
153
153
|
|
|
154
154
|
test("throttles repeated hits to the same path within the window", () => {
|
|
155
155
|
const lines: string[] = [];
|
|
156
156
|
// Five hits within a 10-second span — well inside the 60-second window.
|
|
157
157
|
for (let i = 0; i < 5; i++) {
|
|
158
|
-
logNotesRedirect("/notes/foo", "/
|
|
158
|
+
logNotesRedirect("/notes/foo", "/surface/notes/foo", {
|
|
159
159
|
now: () => 1_000_000 + i * 2_000,
|
|
160
160
|
log: (m) => lines.push(m),
|
|
161
161
|
});
|
|
@@ -165,12 +165,12 @@ describe("notes-redirect — logNotesRedirect (throttled)", () => {
|
|
|
165
165
|
|
|
166
166
|
test("re-logs the same path after the window expires", () => {
|
|
167
167
|
const lines: string[] = [];
|
|
168
|
-
logNotesRedirect("/notes/foo", "/
|
|
168
|
+
logNotesRedirect("/notes/foo", "/surface/notes/foo", {
|
|
169
169
|
now: () => 1_000_000,
|
|
170
170
|
log: (m) => lines.push(m),
|
|
171
171
|
});
|
|
172
172
|
// 60_001 ms later → window has rolled, log fires again.
|
|
173
|
-
logNotesRedirect("/notes/foo", "/
|
|
173
|
+
logNotesRedirect("/notes/foo", "/surface/notes/foo", {
|
|
174
174
|
now: () => 1_000_000 + 60_001,
|
|
175
175
|
log: (m) => lines.push(m),
|
|
176
176
|
});
|
|
@@ -179,11 +179,11 @@ describe("notes-redirect — logNotesRedirect (throttled)", () => {
|
|
|
179
179
|
|
|
180
180
|
test("logs distinct paths independently (per-path bucket)", () => {
|
|
181
181
|
const lines: string[] = [];
|
|
182
|
-
logNotesRedirect("/notes/foo", "/
|
|
182
|
+
logNotesRedirect("/notes/foo", "/surface/notes/foo", {
|
|
183
183
|
now: () => 1_000_000,
|
|
184
184
|
log: (m) => lines.push(m),
|
|
185
185
|
});
|
|
186
|
-
logNotesRedirect("/notes/bar", "/
|
|
186
|
+
logNotesRedirect("/notes/bar", "/surface/notes/bar", {
|
|
187
187
|
now: () => 1_000_000,
|
|
188
188
|
log: (m) => lines.push(m),
|
|
189
189
|
});
|