@sssb/kit 0.7.0 → 0.9.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/dist/release.json +1 -1
- package/package.json +3 -1
- package/src/adapters/edge-headers.ts +171 -0
- package/src/adapters/fake/simulator-admin.ts +7 -3
- package/src/adapters/fake/storage.ts +60 -8
- package/src/adapters/origin-form.ts +24 -0
- package/src/adapters/real/auth.ts +3 -2
- package/src/adapters/real/clerk-authorized-parties.ts +43 -0
- package/src/adapters/real/clerk-proxy.ts +9 -1
- package/src/adapters/real/index.ts +16 -0
- package/src/adapters/real/optional-ports.ts +3 -2
- package/src/adapters/real/s3-storage.ts +66 -5
- package/src/adapters/real/sign-in-form.tsx +206 -23
- package/src/adapters/real/storage-settings.ts +7 -4
- package/src/adapters/real/storage.ts +9 -7
- package/src/authz/route-policy.ts +7 -4
- package/src/components/auth/second-factor-step.tsx +254 -0
- package/src/components/simulator/actors-app.tsx +1 -1
- package/src/components/simulator/errors-app.tsx +4 -1
- package/src/components/simulator/inbound-app.tsx +1 -1
- package/src/components/simulator/jobs-app.tsx +3 -3
- package/src/components/simulator/mail-app.tsx +1 -1
- package/src/components/simulator/mail-link.ts +27 -0
- package/src/components/simulator/simulator-host.tsx +556 -82
- package/src/components/simulator/simulator-panel.tsx +1 -1
- package/src/db/inbound-email.ts +7 -5
- package/src/db/migrations/0018_organizations_write.ts +87 -0
- package/src/db/migrations/index.ts +2 -0
- package/src/db/org-lookup.ts +4 -4
- package/src/db/rls-coverage.ts +140 -24
- package/src/db/rls-proofs.ts +147 -0
- package/src/demo-static/world.ts +2 -2
- package/src/guide.md +6 -0
- package/src/i18n/messages/en.json +20 -1
- package/src/i18n/messages/es.json +20 -1
- package/src/ports/storage.ts +50 -9
- package/src/server-lib/invite.ts +5 -1
- package/src/server-lib/simulator-api.ts +320 -3
- package/src/service-auth/secret-env.ts +19 -0
- package/src/service-auth/standard-webhooks.ts +358 -0
- package/src/service-auth/webhook.ts +39 -12
|
@@ -32,7 +32,7 @@ export interface ScheduleRowLike {
|
|
|
32
32
|
orgSlug: string
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
/** The simulated world-clock control surface, wired by the host (
|
|
35
|
+
/** The simulated world-clock control surface, wired by the host (the server host / the static twin). */
|
|
36
36
|
export interface WorldClockLike {
|
|
37
37
|
/** Current offset ahead of real time, in ms (0 = real time). */
|
|
38
38
|
offsetMs: number
|
|
@@ -47,8 +47,8 @@ export interface WorldClockLike {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
-
* The dev ticker, wired by the
|
|
51
|
-
* never a production build, the demo, e2e or the static twin, which has no server). `running`..`lastError` are the
|
|
50
|
+
* The dev ticker, wired by the server host only, and only when the app's own ticker route answers for it (a simulated
|
|
51
|
+
* `next dev`; never a production build, the demo, e2e or the static twin, which has no server). `running`..`lastError` are the
|
|
52
52
|
* ticker's own status (@sssb/tools/ticker); `elsewhere` is a ticker this panel did not start, live on the same world.
|
|
53
53
|
*/
|
|
54
54
|
export interface DevTickerLike {
|
|
@@ -85,7 +85,7 @@ function ClearMailControl({ onClear }: { onClear: () => void }) {
|
|
|
85
85
|
/**
|
|
86
86
|
* Router-agnostic Mail tab (ADR-0006 twin lives in @sssb/kit/demo-static): a per-person inbox over the
|
|
87
87
|
* fake email adapter's catch store, plus an "all mail" scope, styled like a small mail client.
|
|
88
|
-
* Data and callbacks only — the
|
|
88
|
+
* Data and callbacks only — the host (`./simulator-host`) owns fetching, scope
|
|
89
89
|
* persistence, and deciding what a link is allowed to do.
|
|
90
90
|
*/
|
|
91
91
|
export function MailApp({
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { sameOriginPath } from '../../core/same-origin-path'
|
|
2
|
+
|
|
3
|
+
/** What the Simulator does with a link in a caught email: follow `path`, or say why not. */
|
|
4
|
+
export type MailLinkTarget = { path: string } | { refused: 'origin'; origin: string } | { refused: 'unusable' }
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Same origin only (design invariant), and never silently. A path is followed; so is an absolute URL on this origin,
|
|
8
|
+
* since a real email (the invite accept link) carries one. Both go through `sameOriginPath`, which refuses what a
|
|
9
|
+
* browser would read as another origin (`/\host`, a tab inside), so a prefix check is not the gate. A
|
|
10
|
+
* protocol-relative `//host` link is resolved against this page and judged by its host like any absolute URL; one
|
|
11
|
+
* with no origin at all (`mailto:`) is unusable here.
|
|
12
|
+
*/
|
|
13
|
+
export function mailLinkTarget(href: string, pageHref: string): MailLinkTarget {
|
|
14
|
+
const path = sameOriginPath(href)
|
|
15
|
+
if (path) return { path }
|
|
16
|
+
let url: URL
|
|
17
|
+
try {
|
|
18
|
+
url = href.startsWith('//') ? new URL(href, pageHref) : new URL(href)
|
|
19
|
+
} catch {
|
|
20
|
+
return { refused: 'unusable' }
|
|
21
|
+
}
|
|
22
|
+
const origin = new URL(pageHref).origin
|
|
23
|
+
const local = url.origin === origin ? sameOriginPath(url.pathname + url.search + url.hash) : null
|
|
24
|
+
if (local) return { path: local }
|
|
25
|
+
if (url.origin === origin || url.origin === 'null') return { refused: 'unusable' }
|
|
26
|
+
return { refused: 'origin', origin: url.origin }
|
|
27
|
+
}
|