@botiverse/porthole 0.2.1 → 0.2.3
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 +83 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +51 -0
- package/dist/conformance/entry.d.ts +19 -7
- package/dist/conformance/entry.js +39 -12
- package/dist/conformance/harness.js +8 -8
- package/dist/conformance/host-kit.d.ts +48 -13
- package/dist/conformance/host-kit.js +140 -28
- package/dist/conformance/index.d.ts +1 -1
- package/dist/conformance/index.js +1 -1
- package/dist/conformance/limits.js +15 -2
- package/dist/conformance/page.d.ts +6 -0
- package/dist/conformance/page.js +8 -0
- package/dist/conformance/served.d.ts +4 -4
- package/dist/conformance/served.js +26 -16
- package/dist/host/types.d.ts +6 -3
- package/dist/isolation/served.js +13 -2
- package/dist/node/index.d.ts +11 -3
- package/dist/node/index.js +70 -10
- package/dist/react/frame.d.ts +5 -2
- package/dist/server/host.d.ts +42 -8
- package/dist/server/host.js +35 -5
- package/dist/server/index.d.ts +4 -1
- package/dist/server/index.js +2 -0
- package/dist/server/pages.js +15 -1
- package/dist/server/proxy.js +2 -0
- package/dist/server/server.js +9 -2
- package/dist/server/types.d.ts +15 -6
- package/docs/ARCHITECTURE.md +277 -0
- package/docs/DECISIONS.md +1811 -0
- package/docs/DESIGN.md +1074 -0
- package/docs/OBJECTIVES.md +116 -0
- package/docs/PRINCIPLES.md +155 -0
- package/examples/app.mjs +234 -0
- package/examples/conformance/playwright.config.mjs +28 -0
- package/examples/conformance/porthole.spec.mjs +36 -0
- package/examples/node/server.mjs +75 -0
- package/examples/workers/migrations/0001_porthole_tickets.sql +2 -0
- package/examples/workers/worker.mjs +33 -0
- package/examples/workers/wrangler.jsonc +19 -0
- package/package.json +9 -3
- package/src/cli.ts +54 -0
- package/src/conformance/entry.ts +70 -19
- package/src/conformance/host-kit.ts +194 -45
- package/src/conformance/index.ts +4 -0
- package/src/conformance/limits.ts +21 -4
- package/src/conformance/page.ts +8 -0
- package/src/conformance/served.ts +34 -21
- package/src/host/types.ts +6 -3
- package/src/isolation/served.ts +12 -2
- package/src/node/index.ts +73 -10
- package/src/react/frame.tsx +5 -2
- package/src/server/host.ts +84 -14
- package/src/server/index.ts +6 -0
- package/src/server/pages.ts +15 -1
- package/src/server/proxy.ts +2 -0
- package/src/server/server.ts +11 -2
- package/src/server/types.ts +18 -7
package/src/server/types.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PortholeConfig } from "../config/schema.ts";
|
|
2
2
|
import type { FrameLocation, InstanceRef } from "../isolation/types.ts";
|
|
3
|
+
import type { Naming } from "./naming.ts";
|
|
3
4
|
|
|
4
5
|
export interface ContentDomain {
|
|
5
6
|
/**
|
|
@@ -17,13 +18,14 @@ export interface ContentDomain {
|
|
|
17
18
|
* names like `a-<id>`) must return one lowercase DNS label, the same for the same scope, a
|
|
18
19
|
* different one for a different scope, and never a `reserved` one.
|
|
19
20
|
*/
|
|
20
|
-
readonly name?:
|
|
21
|
+
readonly name?: Naming;
|
|
21
22
|
/**
|
|
22
|
-
* Labels
|
|
23
|
-
* (`f` for `<instance>.f.<domain>`,
|
|
24
|
-
* `p
|
|
25
|
-
* whether a label is reserved. Requests for them, and for
|
|
26
|
-
* host's routes), so a host routes them without wrapping
|
|
23
|
+
* Labels something else serves on this domain, so this server never names them and hands their
|
|
24
|
+
* requests back: another server's namespace (`f` for `<instance>.f.<domain>`, where that server
|
|
25
|
+
* answers), or the host's own (`p-*`: its previews). Each entry is a whole label, or a prefix
|
|
26
|
+
* ending in `*`; or a function that says whether a label is reserved. Requests for them, and for
|
|
27
|
+
* the names under them, get null (the host's routes), so a host routes them without wrapping
|
|
28
|
+
* `handle`. Labels nothing serves need no entry: they get this server's 404 (P070).
|
|
27
29
|
*/
|
|
28
30
|
readonly reserved?: readonly string[] | ((label: string) => boolean);
|
|
29
31
|
}
|
|
@@ -168,7 +170,16 @@ export interface ServerOptions {
|
|
|
168
170
|
* to the host's authorize route, on a host origin, which decides and sends it back with a
|
|
169
171
|
* one-time code (`enterBy`). Absent: a clean address without a cookie is refused, as before.
|
|
170
172
|
*/
|
|
171
|
-
readonly entry?: {
|
|
173
|
+
readonly entry?: {
|
|
174
|
+
readonly authorizeUrl: string;
|
|
175
|
+
/**
|
|
176
|
+
* Whether a clean address names anything (P070): asked before sending a browser away, with
|
|
177
|
+
* the address's label and pathname. False: this server's 404, never the authorize route. A
|
|
178
|
+
* naming that says a label's scope (`Naming.scopeOf`) already answers 404 for a label it never
|
|
179
|
+
* makes.
|
|
180
|
+
*/
|
|
181
|
+
readonly named?: (label: string, path: string, request: Request) => boolean | Promise<boolean>;
|
|
182
|
+
};
|
|
172
183
|
}
|
|
173
184
|
|
|
174
185
|
/** A redirect entry's state, as the host's authorize route reads it (`PortholeServer.entryState`). */
|