@plitzi/sdk-server 0.38.16 → 0.38.18
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 +115 -0
- package/README.md +33 -18
- package/dist/adapters/cloudAdapters.js +2 -2
- package/dist/core/auth/csrf.d.ts +16 -11
- package/dist/core/auth/csrf.js +35 -17
- package/dist/core/configSeam.js +1 -1
- package/dist/core/http/stages/crossSiteWrites.d.ts +5 -4
- package/dist/core/http/stages/crossSiteWrites.js +6 -5
- package/dist/core/http/stages/images.js +1 -1
- package/dist/core/http/stages/livePages.d.ts +43 -0
- package/dist/core/http/stages/livePages.js +80 -0
- package/dist/core/server/baseServer.d.ts +6 -2
- package/dist/core/server/baseServer.js +1 -0
- package/dist/core/server/fleet/channel.js +1 -1
- package/dist/core/server/fleet/relay.js +1 -1
- package/dist/core/server/pageServer.js +11 -8
- package/dist/helpers/cache/keys.js +1 -1
- package/dist/helpers/flagOverrides.d.ts +2 -1
- package/dist/helpers/paintedCookie.js +2 -2
- package/dist/{modules → hosts}/authoringHost/index.d.ts +13 -5
- package/dist/{modules → hosts}/authoringHost/index.js +31 -26
- package/dist/{modules → hosts}/project/plugins.d.ts +2 -2
- package/dist/{modules → hosts}/project/plugins.js +5 -6
- package/dist/{modules → hosts}/project/serveProject.d.ts +2 -2
- package/dist/{modules → hosts}/project/serveProject.js +12 -15
- package/dist/{modules → hosts}/project/spaceFailure.js +3 -3
- package/dist/{modules → hosts}/project/watchSpace.js +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/layers.test.d.ts +1 -0
- package/dist/modules/actions/jobs/later.js +1 -1
- package/dist/modules/actions/runtime/credentials.js +1 -1
- package/dist/modules/actions/runtime/kvList.js +1 -1
- package/dist/modules/actions/runtime/runAction.js +1 -1
- package/dist/modules/connectors/resolver.js +1 -1
- package/dist/modules/functions/capabilities.js +1 -1
- package/dist/modules/functions/load.js +1 -1
- package/dist/modules/functions/manifest.js +2 -2
- package/dist/modules/functions/routes.js +1 -1
- package/dist/modules/functions/runner/messages.js +1 -1
- package/dist/modules/functions/scope.js +1 -1
- package/dist/modules/images/imageProxy.js +1 -1
- package/dist/modules/realtime/socket.js +1 -1
- package/dist/modules/rsc/publicFileResolver.js +1 -1
- package/dist/modules/rsc/resolveRscData.d.ts +2 -1
- package/dist/modules/rsc/resolveRscData.js +1 -1
- package/dist/modules/runtime/bundle.js +1 -1
- package/dist/modules/ssr/prepareRender.js +8 -7
- package/dist/modules/ssr/resolvePageSeo.js +1 -1
- package/dist/modules/ssr/views/template.ejs +18 -9
- package/dist/plugins/compile.js +1 -1
- package/dist/plugins/copy.js +1 -1
- package/dist/plugins/watch.d.ts +1 -1
- package/dist/plugins/watch.js +1 -1
- package/dist/project.d.ts +4 -4
- package/dist/project.js +1 -2
- package/dist/sqlite.js +1 -2
- package/package.json +30 -15
- package/dist/core/http/stages/devReload.d.ts +0 -29
- package/dist/core/http/stages/devReload.js +0 -57
- /package/dist/core/{createServer.devReload.test.d.ts → createServer.livePages.test.d.ts} +0 -0
- /package/dist/{modules → hosts}/authoringHost/index.test.d.ts +0 -0
- /package/dist/{modules → hosts}/project/serveProject.test.d.ts +0 -0
- /package/dist/{modules → hosts}/project/spaceFailure.d.ts +0 -0
- /package/dist/{modules → hosts}/project/watchSpace.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,120 @@
|
|
|
1
1
|
# @plitzi/sdk-server
|
|
2
2
|
|
|
3
|
+
## 0.38.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b3023c9: ## Security
|
|
8
|
+
|
|
9
|
+
- **A page of the same site on another origin is no longer this server's own** (`@plitzi/sdk-server`): the guard
|
|
10
|
+
against writes another page caused (`crossSiteWrites`, the sign-in's login-CSRF check and `createOriginGuardMiddleware`)
|
|
11
|
+
trusted `Sec-Fetch-Site: same-site` — and a site has no port and spans every sub-domain, so another port of the host
|
|
12
|
+
(where `createAuthoringHost` serves pages an agent wrote) or a sibling sub-domain (every space of a platform on one
|
|
13
|
+
domain) could write as if it were the server's own page. Now only `same-origin` (and `none`, a typed URL) is; `same-site`
|
|
14
|
+
is refused 403 `reason: 'foreign'` unless its origin is named (`crossSiteWrites.origins`, `identity.platformOrigins`),
|
|
15
|
+
and the `Origin` fallback compares host and port. In production an app and its spaces are already on different sites,
|
|
16
|
+
so a deployment that works there needs nothing; one that relied on a sibling sub-domain locally names it.
|
|
17
|
+
`createAuthoringHost`'s docs now say to serve on a host of its own — a cookie belongs to a host whatever its port.
|
|
18
|
+
|
|
19
|
+
## Server
|
|
20
|
+
- **An open page takes a new version of its space where it stands** (`@plitzi/sdk-server`, `@plitzi/plitzi-sdk`):
|
|
21
|
+
`server.updatePages(documents, { draft? })` hands the pages showing that space — or that draft — its new documents,
|
|
22
|
+
and each swaps them in place, its state, scroll and focus kept (`replaceSpace` on what the SDK's `render` returns;
|
|
23
|
+
`false`, and the page loads again, for a page with elements the server draws). The development loop of a project uses
|
|
24
|
+
it: a save to the space no longer reloads the open page. `createAuthoringHost`'s `put` over an id that pages show
|
|
25
|
+
hands them the new version and answers how many took it (`updated`), so a page an agent keeps improving is seen to
|
|
26
|
+
grow instead of reloading — no second iframe needed.
|
|
27
|
+
- **`devReload` is `livePages`** (`@plitzi/sdk-server`): the channel the open pages listen on now carries the space,
|
|
28
|
+
not only "load again", and a host that is not developing uses it too. Its address is `/__plitzi/live`; a draft's page
|
|
29
|
+
listens for its own changes alone (`?__pt=`). A plugin swapped where it is drawn stays a development server's
|
|
30
|
+
(`devMode`). `plitzi upgrade migrations --write` renames the option in a project's code (`livePagesOption`).
|
|
31
|
+
|
|
32
|
+
## Packages
|
|
33
|
+
- **`@plitzi/sdk-server` starts in half the time** (`@plitzi/sdk-shared`, `@plitzi/sdk-server`): importing it took
|
|
34
|
+
~310 ms, ~200 of them `date-fns` — 108 modules nothing on the server uses, brought by `@plitzi/sdk-shared/helpers` —
|
|
35
|
+
and loaded the browser's hooks and contexts of every folder of `@plitzi/sdk-shared` it read, `@plitzi/nexus/react`
|
|
36
|
+
with them. Now ~150 ms (`@plitzi/sdk-shared` 139 → 113 modules, `@plitzi/nexus` 53 → 31). What moved, each
|
|
37
|
+
rewritten by `plitzi upgrade migrations --write` (`movedExports`):
|
|
38
|
+
- the dates — `formatDate`, `formatDateUTC`, `formatFromNow`, `formatUTCToLocal`, `getDurationMs`, `isDate`,
|
|
39
|
+
`isValidFormat`, `parseDate`, `toUnixSeconds`, `SupportedLocale` — from `@plitzi/sdk-shared/helpers` to
|
|
40
|
+
`@plitzi/sdk-shared/dates`;
|
|
41
|
+
- React's bindings to an entry of their own beside each area, as `@plitzi/nexus/react` is: `useDisplayMode`,
|
|
42
|
+
`useElementSize` → `@plitzi/sdk-shared/style/react`; `SchemaContext` → `schema/react`; `PluginsContext` →
|
|
43
|
+
`plugins/react`; `DevToolsContext` → `devTools/react`; `useFlagResolution` → `flags/react` (`flagUserFrom` stays
|
|
44
|
+
in `flags`);
|
|
45
|
+
- `PROJECT_DATA_PREFIX` from `@plitzi/sdk-shared/server` to `@plitzi/sdk-shared/project/paths` — the project's
|
|
46
|
+
layout names, an entry a browser imports too (`@plitzi/sdk-shared/project` stays Node only and re-exports them).
|
|
47
|
+
The theme cookie's helpers (`themeFromCookies`…) are also `@plitzi/sdk-shared/theme/cookie`, still exported by
|
|
48
|
+
`@plitzi/sdk-shared/theme`.
|
|
49
|
+
|
|
50
|
+
`yarn check:server-footprint` (in CI after the build) holds what the server's root loads, package by package — Plitzi's
|
|
51
|
+
and every other — to a budget: a heavy library or a folder of hooks coming back fails with what came in.
|
|
52
|
+
|
|
53
|
+
## CLI
|
|
54
|
+
- **`plitzi upgrade migrations --write` writes a file import's new home when it has one** (`@plitzi/cli`): the
|
|
55
|
+
`folderImports` migration of 0.38.17 named every import of a package's FILE and wrote none. It now reads the installed
|
|
56
|
+
declarations with the project's own TypeScript and rewrites each `import` / `export … from` whose every name the folder
|
|
57
|
+
exports under one name — `import usePlitzi from '@plitzi/sdk-shared/hooks/usePlitzi'` →
|
|
58
|
+
`import { usePlitzi } from '@plitzi/sdk-shared/hooks'`, `type` modifiers and aliases kept. What has no one answer is
|
|
59
|
+
said with why (a namespace import, an `import()` or mock, a name the folder does not export, a project with no
|
|
60
|
+
TypeScript). The report says which places `--write` writes (`writable` in `--json`) instead of calling every one
|
|
61
|
+
"yours to change"; a migration now gives each place its own `edit` in place of a whole-file `rewrite`
|
|
62
|
+
(`docs/en/releases.md`).
|
|
63
|
+
- **`plitzi doctor` says an import of a path the installed package does not export** (`@plitzi/cli`):
|
|
64
|
+
`import-not-exported`, an error, at the importing file — what Node otherwise reports at start as an
|
|
65
|
+
`ERR_MODULE_NOT_FOUND` into the package's `dist`, which reads as a broken install rather than a changed API. For a
|
|
66
|
+
`@plitzi` package the fix names `plitzi upgrade migrations --write`; for any other, its `exports`. Asked only of a
|
|
67
|
+
package that is installed.
|
|
68
|
+
|
|
69
|
+
- Updated dependencies [b3023c9]
|
|
70
|
+
- @plitzi/plitzi-sdk@0.38.18
|
|
71
|
+
- @plitzi/sdk-shared@0.38.18
|
|
72
|
+
|
|
73
|
+
## 0.38.17
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- 4f8dc37: ## Packages
|
|
78
|
+
|
|
79
|
+
- **A library package is imported by its root and its folders, never by a file** (`@plitzi/sdk-shared`, `sdk-schema`,
|
|
80
|
+
`sdk-style`, `sdk-elements`, `sdk-interactions`, `sdk-auth`, `sdk-dev-tools`, `sdk-event-bridge`, `sdk-navigation`,
|
|
81
|
+
`sdk-plugins`, `sdk-variables`): each `exports` is now `"."` and `"./*"`, the latter a folder's `index`.
|
|
82
|
+
`@plitzi/sdk-shared/helpers/isRecord` becomes `import { isRecord } from '@plitzi/sdk-shared/helpers'`, and a default
|
|
83
|
+
export by the name its folder gives it — almost always its file's (`import usePlitzi from '…/hooks/usePlitzi'` →
|
|
84
|
+
`import { usePlitzi } from '@plitzi/sdk-shared/hooks'`). A file-level specifier now fails with `ERR_MODULE_NOT_FOUND`.
|
|
85
|
+
New entries where a folder barrel would have brought more than was asked for: `@plitzi/sdk-shared/project` and
|
|
86
|
+
`@plitzi/sdk-shared/plugins/bundle` (Node only), `@plitzi/sdk-interactions/declarations` (the global callbacks and
|
|
87
|
+
utility specs, without React), and `@plitzi/sdk-elements/elements/declarations`, which now also carries the
|
|
88
|
+
declarations' attribute types and the constants they are checked with. `RuleGroup` is exported by `@plitzi/sdk-shared`
|
|
89
|
+
with the document types that use it. `plitzi upgrade migrations` names every such import in a project, with the folder to
|
|
90
|
+
import it from instead.
|
|
91
|
+
- **`@plitzi/sdk-shared`'s root exports the document types, and only them** (`@plitzi/sdk-shared`): what the package
|
|
92
|
+
does is imported from its folder — `formatDate` from `@plitzi/sdk-shared/helpers`, `ThemeProvider` from
|
|
93
|
+
`@plitzi/sdk-shared/theme`, a GraphQL operation's types from `@plitzi/sdk-shared/network/graphql` — so a module that
|
|
94
|
+
imports a type from the root no longer loads every area of the package.
|
|
95
|
+
- **What one package alone used lives in that package** (`@plitzi/sdk-shared`, `@plitzi/sdk-elements`): the data
|
|
96
|
+
source hooks moved from `@plitzi/sdk-shared/dataSource/hooks` to `@plitzi/sdk-elements/dataSource`
|
|
97
|
+
(`useRegisterSource`, `useResolvedVariables`), and the Apollo links the builder's client is built with into the
|
|
98
|
+
builder.
|
|
99
|
+
- **The builder's panels are an entry of their own** (`@plitzi/sdk-style`, `@plitzi/sdk-variables`,
|
|
100
|
+
`@plitzi/sdk-elements`): the style inspector, the advanced style editor and `BuilderStyleContextProvider` are imported
|
|
101
|
+
from `@plitzi/sdk-style/builder`; the variables' lists and forms from `@plitzi/sdk-variables/builder`; the elements'
|
|
102
|
+
settings panels (`defaultElementsSettings`) from `@plitzi/sdk-elements/builder`. Each package's root keeps what a page
|
|
103
|
+
and a server use — `generateCache` no longer loads the inspector, on a server 227 modules down to 21.
|
|
104
|
+
|
|
105
|
+
## CLI
|
|
106
|
+
- **`plitzi upgrade`'s `renames` part is now `migrations`** (`@plitzi/cli`): what a version changed that a project's
|
|
107
|
+
own source must follow, one file per change in the CLI's `src/migrations/changes/` with the version it shipped in —
|
|
108
|
+
rewritten with `--write` when it has one right answer, said otherwise. The `--json` report carries `migrations` (each
|
|
109
|
+
with its `migration`, `since`, `file`, `line`, `what` and whether it was `written`) in place of `renames` and
|
|
110
|
+
`changes`. The changes of 0.38.0 (`canTemplate` → `canSnippet`, the `*Template` authoring names), 0.38.9 (a
|
|
111
|
+
`formControl` without `required` is optional) and 0.38.12 (`usePlitziServiceContext` → `usePlitzi`) are no longer
|
|
112
|
+
looked for: a project still on one of those versions makes them by hand.
|
|
113
|
+
|
|
114
|
+
- Updated dependencies [4f8dc37]
|
|
115
|
+
- @plitzi/plitzi-sdk@0.38.17
|
|
116
|
+
- @plitzi/sdk-shared@0.38.17
|
|
117
|
+
|
|
3
118
|
## 0.38.16
|
|
4
119
|
|
|
5
120
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -167,7 +167,7 @@ runtime, and its files into `public/` — a draft, or any published snapshot (`-
|
|
|
167
167
|
A project `npx @plitzi/cli create --mode server` writes runs this server through `serveProject`, from
|
|
168
168
|
`@plitzi/sdk-server/project` — its own entry, so a server that is not such a project never loads it. The project's
|
|
169
169
|
`src/main.ts` hands it what is the project's, and `serveProject` wires everything else from where the project keeps it
|
|
170
|
-
(the layout is `@plitzi/sdk-shared/project
|
|
170
|
+
(the layout is `@plitzi/sdk-shared/project`'s):
|
|
171
171
|
|
|
172
172
|
```ts
|
|
173
173
|
import { serveProject } from '@plitzi/sdk-server/project';
|
|
@@ -182,19 +182,19 @@ await serveProject({ space: authorProjectSpace, actions, connectors, serverOptio
|
|
|
182
182
|
|
|
183
183
|
`space` is called once the project's root and layout are checked: `authorProjectSpace` reads `src/space/index.ts`'s
|
|
184
184
|
`space` — `dist/space/index.js` when the server runs what `build` emitted (`projectModule` of
|
|
185
|
-
`@plitzi/sdk-shared/project
|
|
185
|
+
`@plitzi/sdk-shared/project`, the rule the runtime is found by too) — and authors it with `projectAuthoring()`. A
|
|
186
186
|
module that exports no `space` is refused saying what to export (`ProjectSpaceError`), and a space that does not author
|
|
187
187
|
with every problem (`SpaceRefusedError`): each printed as the report it is, and the process exits with 1.
|
|
188
188
|
|
|
189
189
|
The project is the working directory — where every script of its `package.json` runs it, and where a deployment runs
|
|
190
190
|
`node dist/main.js` — never worked out from where a file is: `serveProject` and `authorProjectSpace` refuse to start
|
|
191
|
-
anywhere else, naming what is missing (`package.json`, `src/`; `projectRoot` of `@plitzi/sdk-shared/project
|
|
191
|
+
anywhere else, naming what is missing (`package.json`, `src/`; `projectRoot` of `@plitzi/sdk-shared/project`, one
|
|
192
192
|
check for both). Its settings are in `process.env` before any module loads: the scripts start Node with
|
|
193
193
|
`--env-file-if-exists=.env`, and no file of the project reads `.env`. `start:dev`, which Node watches, preloads it
|
|
194
194
|
instead — `node --import @plitzi/sdk-server/env --watch-path=… src/main.ts` — since Node, handed an env file under
|
|
195
195
|
`--watch-path`, watches the folder it is in and restarts on every write there: the server's own `tmp/`, from boot.
|
|
196
196
|
|
|
197
|
-
Both hold the project to its layout before anything else (`assertProjectLayout` of `@plitzi/sdk-shared/project
|
|
197
|
+
Both hold the project to its layout before anything else (`assertProjectLayout` of `@plitzi/sdk-shared/project`,
|
|
198
198
|
what `plitzi doctor` says too): a part where the server would read nothing — a plugin folder with no `index.ts` (or
|
|
199
199
|
`index.tsx`), code in `src/plugin/`, `.env` in `src/`, a built plugin with no manifest — stops the boot with every error
|
|
200
200
|
at once (`ProjectLayoutError`, each with its fix; `findings` holds them as data), and what works and should not stay —
|
|
@@ -235,16 +235,18 @@ What it wires from the project:
|
|
|
235
235
|
records the name, the port, the URL this machine reaches it at (`https` with a certificate), its network addresses
|
|
236
236
|
and its `publicUrl` — for `plitzi page check`, `shot`, `verify` and `visual`. A signal closes it (`closeOnSignals`).
|
|
237
237
|
|
|
238
|
-
While developing — `NODE_ENV` other than `production` — `devMode` and `
|
|
238
|
+
While developing — `NODE_ENV` other than `production` — `devMode` and `livePages` are on, and:
|
|
239
239
|
|
|
240
240
|
- **A save to the space is authored again** by the project's `plitzi/author.ts`, in a process of its own (an import is
|
|
241
241
|
never read twice in one process), run with `--ipc`: it hands the documents back over the IPC channel, the server
|
|
242
|
-
swaps them in memory and every open page
|
|
243
|
-
|
|
242
|
+
swaps them in memory and hands them to every open page, which swaps the space where it stands — its state, scroll and
|
|
243
|
+
focus kept (`updatePages`); a page with elements the server draws loads again instead. What the script refuses it
|
|
244
|
+
prints, and the page keeps the last space that authored. A save to the server's own code — `main.ts`, `src/config/`,
|
|
244
245
|
`src/actions/`, `src/connectors/`, `src/functions/`, `src/runtime/` — is `start:dev`'s to restart on; of a plugin,
|
|
245
246
|
only its `declaration.ts` is the space's.
|
|
246
247
|
- **A plugin folder added** is registered and the open pages load again; one removed is turned off; a plugin's
|
|
247
|
-
`functions/` changed is loaded again in place. A plugin's component changed is
|
|
248
|
+
`functions/` changed is loaded again in place. A plugin's component changed is swapped where it is drawn (`livePages`
|
|
249
|
+
with `devMode`). A folder
|
|
248
250
|
it cannot build — no entry yet, a name that is no type — or a `functions/` with no `index.ts` is said in the
|
|
249
251
|
terminal as the layout check says it (`[plugins] …`, once until it changes), and the server goes on; the folder is
|
|
250
252
|
registered once it is whole.
|
|
@@ -263,7 +265,7 @@ what `serveProject` wires itself (see [Projects](#projects)).
|
|
|
263
265
|
| `httpVersion` | `1 \| 2 \| 3` | `2` with `tls`, else `1` | HTTP protocol version. Falls back to the nearest available lower version. |
|
|
264
266
|
| `tls` | `{ key, cert, minVersion? }` | — | TLS key and certificate. Required for versions 2 and 3; optional for version 1. |
|
|
265
267
|
| `devMode` | `boolean` | `false` | Enables development mode: appends `?dev` to esm.sh CDN URLs for React, and activates per-request timing metrics (see [Dev metrics](#dev-metrics)). Off, the process must run with `NODE_ENV=production` or React renders with its development build; the server says so once, at `error`. |
|
|
266
|
-
| `
|
|
268
|
+
| `livePages` | `boolean` | `false` | Every page this server renders listens for what changes under it: new documents for the space it shows, swapped where it stands with its state, scroll and focus kept (`server.updatePages(documents, { draft? })` — a draft's pages hear their own alone), or everything loaded again (`server.reloadPages()`); and it loads again when it reconnects to a server that restarted (a new process), so a change to the server's code reaches the open page. What `serveProject` uses while developing, and `createAuthoringHost` always. With `devMode` too, a plugin whose source changes is built again and swapped where it is drawn on every open page; a plugin whose declaration changed loads the page again. Not turned on by `devMode`: each open page holds a connection for it. |
|
|
267
269
|
| `assetVersion` | `string` | — | Cache-buster appended as `?v=<assetVersion>` to all default SDK asset URLs. Compute from file mtime or package version at startup. |
|
|
268
270
|
| `cacheTtlMs` | `number` | `300000` | TTL in milliseconds for the SSR render cache. Set to `0` to disable. |
|
|
269
271
|
| `flags` | `Record<string, boolean> \| ({ spaceId, environment }) => Record<string, boolean>` | — | This deployment's say over the spaces' feature flags: above what a space declares, below the SDK's `flags` prop and a tester's dev tools, and only for flags the space declares. A function answers per space. Server actions and RSC resolve with it too. See `docs/en/feature-flags.md` in the workspace. |
|
|
@@ -405,8 +407,9 @@ per page and needs it served with the quality of a project's, without trusting w
|
|
|
405
407
|
import { authorIsolated } from '@plitzi/sdk-authoring/node';
|
|
406
408
|
import { createAuthoringHost } from '@plitzi/sdk-server';
|
|
407
409
|
|
|
410
|
+
// The app is at https://localhost:8080; the pages at https://127.0.0.1:8091 — another HOST, not only another port.
|
|
408
411
|
const host = createAuthoringHost({ dir: 'state/pages', port: 8091, tls, frameAncestors: ['https://localhost:8080'] });
|
|
409
|
-
await host.server.listen(8091, '
|
|
412
|
+
await host.server.listen(8091, '127.0.0.1');
|
|
410
413
|
|
|
411
414
|
const result = await authorIsolated('tmp/pages/weather.ts'); // its own process: reads the module and its packages, nothing else
|
|
412
415
|
if (result.ok) {
|
|
@@ -419,14 +422,22 @@ if (result.ok) {
|
|
|
419
422
|
- **`authorIsolated`** authors the module in a process Node's permission model holds to reading the module's folder and
|
|
420
423
|
the packages it imports: no file written, no process or worker started, no variable of the caller's environment. A
|
|
421
424
|
module that runs too long is killed (`timeoutMs`), and what it answers is validated again in the caller, so one that
|
|
422
|
-
forges its answer gains nothing. Before Node 25 the permission model leaves the network open: serve the result on
|
|
423
|
-
|
|
425
|
+
forges its answer gains nothing. Before Node 25 the permission model leaves the network open: serve the result on a
|
|
426
|
+
host of its own, never the app's.
|
|
424
427
|
- **`createAuthoringHost`** serves each page as a draft of its one space, at the address `put` answers — the way a page
|
|
425
428
|
server tells many spaces apart on one host (a space is chosen by host or credential, never by path). The page
|
|
426
429
|
arrives with its whole space, navigation is the browser's, and a reload that lost the address finds it in the draft's
|
|
427
430
|
cookie. So a page here is data and its look: no server provider, action, function or channel of its own. Anything
|
|
428
431
|
but a page it holds answers `404`, saying where they are.
|
|
429
|
-
- **
|
|
432
|
+
- **Seen to grow:** `put` again under an id and the pages open at it take the new version where they stand — scroll,
|
|
433
|
+
focus and what the person was doing kept, no reload (`livePages`, on for the host) — and `updated` says how many did.
|
|
434
|
+
An agent that improves a page in steps shows each one as it is ready.
|
|
435
|
+
- **On a host of its own, never another port of the app's.** A cookie belongs to a host whatever its port, so a page
|
|
436
|
+
at `localhost:8091` reads the app's readable cookies at `localhost:8080` and its requests carry the app's session;
|
|
437
|
+
and another port, or a sibling sub-domain, is the same SITE, which the app's page server refuses writes from (it
|
|
438
|
+
trusts its own origin and the ones it names, never the site). Locally, `127.0.0.1` beside `localhost`; in production,
|
|
439
|
+
a domain of its own (`pages-example.net` beside `example.com`), as user content is served everywhere.
|
|
440
|
+
- **Checked like a project's page:** `plitzi page check "/?__pt=weather" --url https://127.0.0.1:8091 --space
|
|
430
441
|
tmp/pages/weather.ts` — the CLI's whole check (elements on screen, hydration, console, contrast) against that module.
|
|
431
442
|
|
|
432
443
|
## JSON adapters (offline mode)
|
|
@@ -1251,9 +1262,12 @@ After that it depends on what the flow does, because there are two different att
|
|
|
1251
1262
|
| **`/auth/exchange`** | Its own grant | It acts for a space and is already refused unless the origin is one that space declared — narrower than any list here. A space is embedded on somebody else's domain by design |
|
|
1252
1263
|
| **`/auth/refresh`, `/auth/logout`** | Nothing | Both authenticate with the refresh credential and must work when the access token has lapsed. Forging either gains an attacker nothing: renewing somebody's session hands the new credential to their own browser |
|
|
1253
1264
|
|
|
1254
|
-
**"A site this deployment recognises"** is decided by two headers a page cannot
|
|
1255
|
-
browser's own account of where the request came from
|
|
1256
|
-
this
|
|
1265
|
+
**"A site this deployment recognises"** is an ORIGIN — host and port, not just the site — decided by two headers a page cannot
|
|
1266
|
+
set: `Sec-Fetch-Site` — the browser's own account of where the request came from, where only `same-origin` (or `none`,
|
|
1267
|
+
a typed URL) is this server's own — and, where that is absent, `Origin`, matched exactly against this host or
|
|
1268
|
+
`identity.platformOrigins`, the hosts you already declared. **`same-site` is not trusted**: another port of this host,
|
|
1269
|
+
or a sibling sub-domain, is the same site, and is exactly where somebody else's code is served by design — an
|
|
1270
|
+
authoring host, every space of a platform on sub-domains of one domain. A sibling that is yours is named. **Neither header present means the caller
|
|
1257
1271
|
is not a browser**, and a client that is not a browser has no victim's session in it to forge with — which is what
|
|
1258
1272
|
lets every API client, mobile app and script sign in with nothing extra to send.
|
|
1259
1273
|
|
|
@@ -1293,13 +1307,14 @@ There is nothing to configure: the secret, the cookie scope and the origins all
|
|
|
1293
1307
|
|
|
1294
1308
|
Everything a page server answers past its self-gating flows — server actions (`/_action`), realtime publishes, a
|
|
1295
1309
|
space's `/fn/` routes, its runtime's endpoints, your own `data` stages, and the adapter-only `loginPath`, `logoutPath`
|
|
1296
|
-
and `exchangePath` — refuses a write that a browser says **another
|
|
1310
|
+
and `exchangePath` — refuses a write that a browser says **a page of another origin caused**, with `403` and `reason: 'foreign'`.
|
|
1297
1311
|
**Whether or not a session cookie came with it**: a server holding credentials of its own (a token for somebody's
|
|
1298
1312
|
calendar, an API key) or a tool nobody signs in to acts for whoever reaches it, and a plain `text/plain` POST from any
|
|
1299
1313
|
page open in the same browser reaches it without a preflight.
|
|
1300
1314
|
|
|
1301
1315
|
The same two headers decide, under the same rules: what passes is a safe method, anything with `Authorization`, a
|
|
1302
|
-
caller that is not a browser (a webhook, `curl`), a page of this
|
|
1316
|
+
caller that is not a browser (a webhook, `curl`), a page of this origin (`same-origin`, never merely `same-site`),
|
|
1317
|
+
and what you name:
|
|
1303
1318
|
|
|
1304
1319
|
```ts
|
|
1305
1320
|
createServer({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { serverLog } from "../helpers/serverLog.js";
|
|
2
|
-
import { isRecord } from "@plitzi/sdk-shared/helpers
|
|
3
|
-
import { schemaFromWire } from "@plitzi/sdk-shared/schema
|
|
2
|
+
import { isRecord } from "@plitzi/sdk-shared/helpers";
|
|
3
|
+
import { schemaFromWire } from "@plitzi/sdk-shared/schema";
|
|
4
4
|
//#region src/adapters/cloudAdapters.ts
|
|
5
5
|
/**
|
|
6
6
|
* A space fetched from Plitzi, for a server that is not Plitzi's.
|
package/dist/core/auth/csrf.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface CsrfConfig {
|
|
|
6
6
|
/** Naming and scope for the cookie, so it lands beside the session one. */
|
|
7
7
|
cookie?: SSRAuthCookie;
|
|
8
8
|
/**
|
|
9
|
-
* Origins that count as this deployment's own, beyond the request's own
|
|
9
|
+
* Origins that count as this deployment's own, beyond the request's own origin.
|
|
10
10
|
*
|
|
11
11
|
* What it decides is which cross-site page may hand out a session — see `foreign` below. `createAuth` fills it
|
|
12
12
|
* from `identity.platformOrigins`, so a deployment that already declared its hosts has said this too, and this
|
|
@@ -57,24 +57,29 @@ export declare const carrierOf: (req: {
|
|
|
57
57
|
body?: unknown;
|
|
58
58
|
}, method?: string | undefined) => CsrfCarrier;
|
|
59
59
|
/**
|
|
60
|
-
* Did
|
|
60
|
+
* Did a page of another ORIGIN cause this request — `allowed` naming the origins this deployment counts as its own?
|
|
61
61
|
*
|
|
62
62
|
* This is what protects signing in, where there is no session to bind a token to and no cookie to look for, and
|
|
63
63
|
* every write a page server answers, cookie or none (`crossSiteWritesStage`). It rests on two headers a page CANNOT
|
|
64
64
|
* set — the browser attaches both, and script may not override either:
|
|
65
65
|
*
|
|
66
66
|
* - **`Sec-Fetch-Site`** is the browser's own account of where the request came from, and is believed first.
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* derivable here.
|
|
67
|
+
* `same-origin`, and `none` (a typed URL, a bookmark), are this server's own; `same-site` and `cross-site` are a
|
|
68
|
+
* page of another origin, foreign unless its origin was named.
|
|
70
69
|
* - **`Origin`** is the fallback, for a browser too old to send the above — Safari only did from 16.4. Matched
|
|
71
|
-
* **exactly
|
|
70
|
+
* **exactly** — host and port; one port does not serve two schemes — against this host or an origin the deployment
|
|
71
|
+
* named.
|
|
72
72
|
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
73
|
+
* **`same-site` is not trusted, and was once.** A site is a registrable domain, with no port in it: another port of
|
|
74
|
+
* this host, or a sibling sub-domain, is the same site. Both are where somebody else's code is served by design —
|
|
75
|
+
* `createAuthoringHost` on a port of its own, every space of a platform on a sub-domain of one domain (two spaces at
|
|
76
|
+
* `*.plitzi.app` are one site until that domain is on the public suffix list) — and trusting the site let any of them
|
|
77
|
+
* write here as if they were this server's own pages. A sibling that IS this deployment's own is named, as it always
|
|
78
|
+
* had to be in production, where the app and its spaces are on different sites: `createAuth` fills the list from
|
|
79
|
+
* `identity.platformOrigins`, a page server from `crossSiteWrites.origins`.
|
|
80
|
+
*
|
|
81
|
+
* Nor is a domain boundary guessed: this once compared *registrable domains*, last-two-labels, and with no public
|
|
82
|
+
* suffix list every other `.co.uk` counted as the same site as a deployment at `acme.co.uk`.
|
|
78
83
|
*
|
|
79
84
|
* **Neither header means this is not a browser**, and a client that is not a browser cannot be made to forge
|
|
80
85
|
* anything: there is no victim's session sitting in it. That is what keeps every API client, mobile app and
|
package/dist/core/auth/csrf.js
CHANGED
|
@@ -41,7 +41,7 @@ var csrfFailureMessage = {
|
|
|
41
41
|
malformed: "CSRF token malformed",
|
|
42
42
|
expired: "CSRF token expired",
|
|
43
43
|
mismatch: "CSRF token does not match this session",
|
|
44
|
-
foreign: "A request from another
|
|
44
|
+
foreign: "A request from another origin may not act with this session"
|
|
45
45
|
};
|
|
46
46
|
/**
|
|
47
47
|
* The carrier, read off whatever request a host hands over — named field by field, never spread.
|
|
@@ -75,33 +75,51 @@ var readCookieHeader = (carrier, name) => {
|
|
|
75
75
|
if (index !== -1 && part.slice(0, index).trim() === name) return decodeURIComponent(part.slice(index + 1).trim());
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
|
-
/**
|
|
79
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Whether `origin` is the request's own: its host and port, as the `Host` header names them. When a proxy rewrote
|
|
80
|
+
* `Host` (it no longer names the hostname the request is answered as), the hostname alone is what is left to compare.
|
|
81
|
+
*/
|
|
82
|
+
var isOwnOrigin = (origin, carrier) => {
|
|
83
|
+
let url;
|
|
84
|
+
try {
|
|
85
|
+
url = new URL(origin);
|
|
86
|
+
} catch {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
const host = header(carrier, "host");
|
|
90
|
+
if (host === void 0) return url.hostname === carrier.hostname;
|
|
91
|
+
let own;
|
|
80
92
|
try {
|
|
81
|
-
|
|
93
|
+
own = new URL(`${url.protocol}//${host}`);
|
|
82
94
|
} catch {
|
|
83
|
-
return;
|
|
95
|
+
return false;
|
|
84
96
|
}
|
|
97
|
+
return own.hostname === carrier.hostname ? url.host === own.host : url.hostname === carrier.hostname;
|
|
85
98
|
};
|
|
86
99
|
/**
|
|
87
|
-
* Did
|
|
100
|
+
* Did a page of another ORIGIN cause this request — `allowed` naming the origins this deployment counts as its own?
|
|
88
101
|
*
|
|
89
102
|
* This is what protects signing in, where there is no session to bind a token to and no cookie to look for, and
|
|
90
103
|
* every write a page server answers, cookie or none (`crossSiteWritesStage`). It rests on two headers a page CANNOT
|
|
91
104
|
* set — the browser attaches both, and script may not override either:
|
|
92
105
|
*
|
|
93
106
|
* - **`Sec-Fetch-Site`** is the browser's own account of where the request came from, and is believed first.
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* derivable here.
|
|
107
|
+
* `same-origin`, and `none` (a typed URL, a bookmark), are this server's own; `same-site` and `cross-site` are a
|
|
108
|
+
* page of another origin, foreign unless its origin was named.
|
|
97
109
|
* - **`Origin`** is the fallback, for a browser too old to send the above — Safari only did from 16.4. Matched
|
|
98
|
-
* **exactly
|
|
110
|
+
* **exactly** — host and port; one port does not serve two schemes — against this host or an origin the deployment
|
|
111
|
+
* named.
|
|
112
|
+
*
|
|
113
|
+
* **`same-site` is not trusted, and was once.** A site is a registrable domain, with no port in it: another port of
|
|
114
|
+
* this host, or a sibling sub-domain, is the same site. Both are where somebody else's code is served by design —
|
|
115
|
+
* `createAuthoringHost` on a port of its own, every space of a platform on a sub-domain of one domain (two spaces at
|
|
116
|
+
* `*.plitzi.app` are one site until that domain is on the public suffix list) — and trusting the site let any of them
|
|
117
|
+
* write here as if they were this server's own pages. A sibling that IS this deployment's own is named, as it always
|
|
118
|
+
* had to be in production, where the app and its spaces are on different sites: `createAuth` fills the list from
|
|
119
|
+
* `identity.platformOrigins`, a page server from `crossSiteWrites.origins`.
|
|
99
120
|
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* every other `.co.uk` in the world counted as the same site and could sign a visitor in. Guessing where a
|
|
103
|
-
* domain boundary falls is not something to do in a security decision — a sibling sub-domain that needs to be
|
|
104
|
-
* trusted is one line in `allowedOrigins`, which `createAuth` already fills from `identity.platformOrigins`.
|
|
121
|
+
* Nor is a domain boundary guessed: this once compared *registrable domains*, last-two-labels, and with no public
|
|
122
|
+
* suffix list every other `.co.uk` counted as the same site as a deployment at `acme.co.uk`.
|
|
105
123
|
*
|
|
106
124
|
* **Neither header means this is not a browser**, and a client that is not a browser cannot be made to forge
|
|
107
125
|
* anything: there is no victim's session sitting in it. That is what keeps every API client, mobile app and
|
|
@@ -111,9 +129,9 @@ var crossSiteRequest = (carrier, allowed = () => false) => {
|
|
|
111
129
|
const site = header(carrier, "sec-fetch-site");
|
|
112
130
|
const origin = header(carrier, "origin");
|
|
113
131
|
const vouched = origin !== void 0 && allowed(origin);
|
|
114
|
-
if (site !== void 0) return site
|
|
132
|
+
if (site !== void 0) return site !== "same-origin" && site !== "none" && !vouched;
|
|
115
133
|
if (!origin) return false;
|
|
116
|
-
return
|
|
134
|
+
return !isOwnOrigin(origin, carrier) && !vouched;
|
|
117
135
|
};
|
|
118
136
|
var createCsrf = (config) => {
|
|
119
137
|
const { secret, cookie, allowedOrigins = [] } = config;
|
package/dist/core/configSeam.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { serverLog } from "../helpers/serverLog.js";
|
|
2
2
|
import { isActionDocument, validateActionDocument } from "@plitzi/sdk-shared/actions";
|
|
3
3
|
import { isConnectorManifestDraft, validateConnectorManifest } from "@plitzi/sdk-shared/connectors";
|
|
4
|
-
import { isRecord } from "@plitzi/sdk-shared/helpers
|
|
4
|
+
import { isRecord } from "@plitzi/sdk-shared/helpers";
|
|
5
5
|
//#region src/core/configSeam.ts
|
|
6
6
|
/**
|
|
7
7
|
* A guard that checks each object once: a deployment that caches what it reads hands back the same object on every
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseContext, Stage } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
* Whether this request is a write a page
|
|
3
|
+
* Whether this request is a write a page of another origin caused, and so is refused — answered here, 403
|
|
4
4
|
* `reason: 'foreign'`, when it is.
|
|
5
5
|
*
|
|
6
6
|
* Not only a write a session cookie could authenticate: a server holding credentials of its own (a token for somebody's
|
|
@@ -8,15 +8,16 @@ import { BaseContext, Stage } from '../types';
|
|
|
8
8
|
* page open in the same browser reaches it without a preflight. Passes:
|
|
9
9
|
*
|
|
10
10
|
* - a safe method;
|
|
11
|
-
* - `Authorization` — a page
|
|
11
|
+
* - `Authorization` — a page of another origin cannot set it without a preflight this server never allows;
|
|
12
12
|
* - a request that is not a browser's (no `Sec-Fetch-Site`, no `Origin`): a webhook, `curl`, another server;
|
|
13
|
-
* - a page of this
|
|
13
|
+
* - a page of this origin (`same-origin` — never merely `same-site`: another port of this host, or a sibling
|
|
14
|
+
* sub-domain, is where somebody else's pages are served), or of an origin in `crossSiteWrites.origins`;
|
|
14
15
|
* - a path in `crossSiteWrites.paths` — a form other sites post to by design.
|
|
15
16
|
*/
|
|
16
17
|
export declare const refusedCrossSite: (ctx: BaseContext) => boolean;
|
|
17
18
|
/**
|
|
18
19
|
* Every write the page server answers after it — server actions, realtime publishes, a space's `/fn/` routes and its
|
|
19
|
-
* runtime's endpoints, the deployment's own data stages — refused when another
|
|
20
|
+
* runtime's endpoints, the deployment's own data stages — refused when a page of another origin caused it (see
|
|
20
21
|
* {@link refusedCrossSite}). After the stages that gate themselves (`preAuth`: the `/auth` flows with their own CSRF,
|
|
21
22
|
* MCP and its OAuth, the preview's shared secret), before everything else.
|
|
22
23
|
*/
|
|
@@ -7,7 +7,7 @@ var SAFE_METHODS = /* @__PURE__ */ new Set([
|
|
|
7
7
|
"OPTIONS"
|
|
8
8
|
]);
|
|
9
9
|
/**
|
|
10
|
-
* Whether this request is a write a page
|
|
10
|
+
* Whether this request is a write a page of another origin caused, and so is refused — answered here, 403
|
|
11
11
|
* `reason: 'foreign'`, when it is.
|
|
12
12
|
*
|
|
13
13
|
* Not only a write a session cookie could authenticate: a server holding credentials of its own (a token for somebody's
|
|
@@ -15,9 +15,10 @@ var SAFE_METHODS = /* @__PURE__ */ new Set([
|
|
|
15
15
|
* page open in the same browser reaches it without a preflight. Passes:
|
|
16
16
|
*
|
|
17
17
|
* - a safe method;
|
|
18
|
-
* - `Authorization` — a page
|
|
18
|
+
* - `Authorization` — a page of another origin cannot set it without a preflight this server never allows;
|
|
19
19
|
* - a request that is not a browser's (no `Sec-Fetch-Site`, no `Origin`): a webhook, `curl`, another server;
|
|
20
|
-
* - a page of this
|
|
20
|
+
* - a page of this origin (`same-origin` — never merely `same-site`: another port of this host, or a sibling
|
|
21
|
+
* sub-domain, is where somebody else's pages are served), or of an origin in `crossSiteWrites.origins`;
|
|
21
22
|
* - a path in `crossSiteWrites.paths` — a form other sites post to by design.
|
|
22
23
|
*/
|
|
23
24
|
var refusedCrossSite = (ctx) => {
|
|
@@ -28,14 +29,14 @@ var refusedCrossSite = (ctx) => {
|
|
|
28
29
|
res.setStatus(403);
|
|
29
30
|
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
30
31
|
res.send(JSON.stringify({
|
|
31
|
-
error: `A page
|
|
32
|
+
error: `A page of another origin may not ${req.method} ${req.path} here: name its origin in the server's \`crossSiteWrites.origins\`, or the path in \`crossSiteWrites.paths\``,
|
|
32
33
|
reason: "foreign"
|
|
33
34
|
}));
|
|
34
35
|
return true;
|
|
35
36
|
};
|
|
36
37
|
/**
|
|
37
38
|
* Every write the page server answers after it — server actions, realtime publishes, a space's `/fn/` routes and its
|
|
38
|
-
* runtime's endpoints, the deployment's own data stages — refused when another
|
|
39
|
+
* runtime's endpoints, the deployment's own data stages — refused when a page of another origin caused it (see
|
|
39
40
|
* {@link refusedCrossSite}). After the stages that gate themselves (`preAuth`: the `/auth` flows with their own CSRF,
|
|
40
41
|
* MCP and its OAuth, the preview's shared secret), before everything else.
|
|
41
42
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { serverLog } from "../../../helpers/serverLog.js";
|
|
2
2
|
import { createImageProxy } from "../../../modules/images/imageProxy.js";
|
|
3
3
|
import { loadSharpTransform } from "../../../modules/images/transform.js";
|
|
4
|
+
import { IMAGE_PATH } from "@plitzi/sdk-shared/helpers";
|
|
4
5
|
import path from "node:path";
|
|
5
|
-
import { IMAGE_PATH } from "@plitzi/sdk-shared/helpers/images";
|
|
6
6
|
//#region src/core/http/stages/images.ts
|
|
7
7
|
/** Where pictures are resized, when this server resizes them: published to the SDK, which builds every `srcset` on it. */
|
|
8
8
|
var imagesPathOf = (config) => config.images && config.images.domains.length > 0 ? IMAGE_PATH : void 0;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Stage } from '../types';
|
|
2
|
+
import { OfflineDataRaw, PluginEntry } from '@plitzi/sdk-shared';
|
|
3
|
+
/** Where an open page listens for what the server has to tell it: its space changed, a plugin was built again. */
|
|
4
|
+
export declare const LIVE_PAGES_PATH = "/__plitzi/live";
|
|
5
|
+
/**
|
|
6
|
+
* The pages open on this server, told what changed under them without the server restarting.
|
|
7
|
+
*
|
|
8
|
+
* - **The space** (`updatePages`): every page showing it swaps it where it stands — its state, scroll and focus kept —
|
|
9
|
+
* or loads again when it cannot (`replaceSpace` of the SDK's `render`). The edit loop of a project that authors its
|
|
10
|
+
* space in code (`serveProject` re-authors and hands the new documents over), and a page an agent keeps rewriting
|
|
11
|
+
* (`createAuthoringHost`'s `update`). A page listens for the space it was drawn with: the host's own, or one draft
|
|
12
|
+
* (`?__pt=<id>`, named by the page in its listening address — never by the cookie, which one browser shares between
|
|
13
|
+
* every draft it has open).
|
|
14
|
+
* - **Everything** (`reloadPages`): every page loads again.
|
|
15
|
+
* - **A plugin built again** (`plugin`): every page imports the new bundle and swaps it where it is drawn.
|
|
16
|
+
*
|
|
17
|
+
* Only with `livePages` on: every open page keeps a connection for it, which a server whose space never changes under
|
|
18
|
+
* it — a published one, or a platform's — would pay for and get nothing from. The template listens only then too.
|
|
19
|
+
*
|
|
20
|
+
* Each connection is greeted with this process's `boot`, and a page that reconnects to a different one loads again: the
|
|
21
|
+
* server restarted — `start:dev` saw its code change (`main.ts`, its options, its actions, `src/functions/`) — and
|
|
22
|
+
* what is on screen was built by the one before. Without it the page kept the old plugin until somebody reloaded it,
|
|
23
|
+
* which reads as "my change did nothing".
|
|
24
|
+
*/
|
|
25
|
+
export declare const createLivePages: () => {
|
|
26
|
+
stage: Stage;
|
|
27
|
+
/** Every page open on this server loads again. */
|
|
28
|
+
reload: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* The pages showing the host's own space — or, with `draft`, that draft — swap it for `documents` where they stand;
|
|
31
|
+
* one that cannot loads again. How many pages were told.
|
|
32
|
+
*/
|
|
33
|
+
update: (documents: OfflineDataRaw, { draft }?: {
|
|
34
|
+
draft?: string;
|
|
35
|
+
}) => number;
|
|
36
|
+
/**
|
|
37
|
+
* A plugin built again: every open page imports its new bundle and swaps it where it is drawn (`keyName` is what
|
|
38
|
+
* the page registered it as), and points its stylesheet at the new one — without loading again.
|
|
39
|
+
*/
|
|
40
|
+
plugin: ({ keyName, js, css }: PluginEntry) => void;
|
|
41
|
+
/** The streams ended — the server is going away, and each page reconnects to whichever comes up next. */
|
|
42
|
+
close: () => void;
|
|
43
|
+
};
|