@plitzi/sdk-server 0.39.4 → 0.39.6
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 +21 -0
- package/README.md +1 -1
- package/dist/adapters/cloudAdapters.d.ts +7 -0
- package/dist/adapters/space/index.d.ts +2 -0
- package/dist/adapters/space/resolvers.d.ts +14 -3
- package/dist/adapters/space/snapshotPreview.d.ts +45 -0
- package/dist/adapters/space/types.d.ts +4 -1
- package/dist/cache.js +1 -1
- package/dist/chunks/{buildBody-BSC0UbjP.js → buildBody-Bm398uxH.js} +600 -63
- package/dist/chunks/{core-w7FIMpgv.js → core-CoKORAOg.js} +149 -23
- package/dist/chunks/{createServer-BQ0KE0Qu.js → createServer-BSmQqzwb.js} +31 -607
- package/dist/chunks/{platform-C0AVlwpB.js → platform-BTssQQXp.js} +1 -1
- package/dist/chunks/sdkAssets-CXGoc_WE.js +60 -0
- package/dist/chunks/{token-CBUubxtm.js → token-XEz1n4jp.js} +1 -1
- package/dist/chunks/views/template.ejs +5 -0
- package/dist/core/services/robotsTxt.d.ts +3 -1
- package/dist/deploy/aws/s3.d.ts +51 -0
- package/dist/deploy/aws/sigv4.d.ts +33 -0
- package/dist/deploy/contentType.d.ts +2 -0
- package/dist/deploy/fingerprint.d.ts +18 -0
- package/dist/deploy/folder.d.ts +6 -0
- package/dist/deploy/ftp.d.ts +27 -0
- package/dist/deploy/sdkFiles.d.ts +11 -0
- package/dist/deploy/spaShell.d.ts +35 -0
- package/dist/deploy/staticSite.d.ts +44 -0
- package/dist/deploy/types.d.ts +58 -0
- package/dist/deploy/zip.d.ts +8 -0
- package/dist/deploy.d.ts +24 -0
- package/dist/deploy.js +938 -0
- package/dist/handlers.js +1 -1
- package/dist/helpers/ownVersion.d.ts +1 -0
- package/dist/index.js +3 -3
- package/dist/oauth.js +1 -1
- package/dist/platform.js +1 -1
- package/dist/project.js +3 -3
- package/dist/spaces.d.ts +2 -2
- package/dist/spaces.js +1 -1
- package/dist/ssr.d.ts +1 -1
- package/dist/ssr.js +1 -1
- package/package.json +15 -13
- package/skills/plitzi-authoring/reference/authoring-errors.md +8 -4
- package/skills/plitzi-authoring/reference/efficiency.md +2 -1
- package/skills/plitzi-authoring/reference/layouts.md +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @plitzi/sdk-server
|
|
2
2
|
|
|
3
|
+
## 0.39.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @plitzi/plitzi-sdk@0.39.6
|
|
8
|
+
- @plitzi/sdk-actions@0.39.6
|
|
9
|
+
- @plitzi/sdk-kernel@0.39.6
|
|
10
|
+
- @plitzi/sdk-shared@0.39.6
|
|
11
|
+
|
|
12
|
+
## 0.39.5
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 4427674: Released with every `@plitzi` package at this version. What changed in each, and what to do when you upgrade, is in
|
|
17
|
+
`@plitzi/cli`'s `CHANGELOG.md`: one copy of the notes, not one per package.
|
|
18
|
+
- Updated dependencies [4427674]
|
|
19
|
+
- @plitzi/plitzi-sdk@0.39.5
|
|
20
|
+
- @plitzi/sdk-actions@0.39.5
|
|
21
|
+
- @plitzi/sdk-kernel@0.39.5
|
|
22
|
+
- @plitzi/sdk-shared@0.39.5
|
|
23
|
+
|
|
3
24
|
## 0.39.4
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1664,7 +1664,7 @@ server's, which is what keeps a session established on the API side visible to t
|
|
|
1664
1664
|
|
|
1665
1665
|
## Basic auth
|
|
1666
1666
|
|
|
1667
|
-
Per-space HTTP Basic authentication is handled automatically via `ctx.spaceDeployment.
|
|
1667
|
+
Per-space HTTP Basic authentication is handled automatically via `ctx.spaceDeployment.credentials`: a list of `{ provider: 'ssr', data: { user, pass } }`, any one of which opens the host (a domain's own password; a version's preview every one its space's addresses ask). Return it from your `getSpaceDeployment` adapter — `verifiedDomain` and `wildcardSubdomain` turn a row's `credential` into it, and `snapshotPreview`'s `find` returns the list. None, or an empty list, and the host is open; a password without both a user and a password keeps it closed. Successful authentications are cached in-memory for 5 minutes.
|
|
1668
1668
|
|
|
1669
1669
|
Credential comparison uses `crypto.timingSafeEqual` to prevent timing attacks. Invalid credentials always receive a `WWW-Authenticate` challenge and `401 Unauthorized`.
|
|
1670
1670
|
|
|
@@ -45,6 +45,13 @@ export type CloudAdaptersConfig = {
|
|
|
45
45
|
* answer changes. Publishing from the builder is then all it takes to release.
|
|
46
46
|
*/
|
|
47
47
|
revision?: number;
|
|
48
|
+
/**
|
|
49
|
+
* The domain this server answers on, when it is a target of the space (a server of your own): in latest
|
|
50
|
+
* mode, the revision served is the one that domain is published at — a publish or a rollback in the builder moves it
|
|
51
|
+
* — rather than the environment's newest. Plitzi also keeps what this server says it runs, to say when it should be
|
|
52
|
+
* built again.
|
|
53
|
+
*/
|
|
54
|
+
domain?: string;
|
|
48
55
|
/**
|
|
49
56
|
* How often Plitzi is ASKED anything, in seconds. Default a minute. Ignored in both directions at the edges:
|
|
50
57
|
*
|
|
@@ -89,5 +89,7 @@ export declare const createSpaceAdapters: (config: SpaceAdaptersConfig) => {
|
|
|
89
89
|
export type SpaceAdapters = ReturnType<typeof createSpaceAdapters>;
|
|
90
90
|
export { authoringPreview, fixedSpace, presentsCredential, renderGrant, verifiedDomain, wildcardSubdomain } from './resolvers';
|
|
91
91
|
export { createMemoryCache, refuse } from './types';
|
|
92
|
+
export { parsePreviewLabel, PREVIEW_KEY_LENGTH, previewLabel, snapshotPreview } from './snapshotPreview';
|
|
92
93
|
export type { AuthoringPreviewOptions, DeploymentRow, RenderGrantOptions, WildcardSubdomainOptions } from './resolvers';
|
|
93
94
|
export type { SpaceCache, SpaceRefusal, SpaceResolution, SpaceResolver } from './types';
|
|
95
|
+
export type { PreviewAddress, SnapshotPreviewOptions } from './snapshotPreview';
|
|
@@ -16,6 +16,7 @@ export interface DeploymentRow {
|
|
|
16
16
|
spaceId: number;
|
|
17
17
|
environment?: Environment;
|
|
18
18
|
revision?: number | null;
|
|
19
|
+
/** The password on the domain, when its owner put one on it. */
|
|
19
20
|
credential?: SSRCredential;
|
|
20
21
|
/** `false` refuses the request outright. A domain that is not proven is not a domain this space answers on. */
|
|
21
22
|
verified?: boolean;
|
|
@@ -32,12 +33,15 @@ export interface WildcardSubdomainOptions {
|
|
|
32
33
|
suffix: string;
|
|
33
34
|
/**
|
|
34
35
|
* The slug IS the sub-domain. Return nothing for a slug that names no space. A space's own script policy goes in
|
|
35
|
-
* `security`; the rest of it is the domain's, and this one is the deployment's own.
|
|
36
|
+
* `security`; the rest of it is the domain's, and this one is the deployment's own. Its `credential` is who may see
|
|
37
|
+
* the address — a password its owner put on it, asked by the basic-auth stage as on any domain of its own — when the
|
|
38
|
+
* deployment keeps one for it.
|
|
36
39
|
*/
|
|
37
40
|
find: (slug: string) => Promise<{
|
|
38
41
|
spaceId: number;
|
|
39
42
|
environment?: Environment;
|
|
40
43
|
security?: Pick<SSRDeploymentSecurity, 'scriptPolicy'>;
|
|
44
|
+
credential?: SSRCredential;
|
|
41
45
|
} | undefined>;
|
|
42
46
|
}
|
|
43
47
|
/**
|
|
@@ -90,6 +94,13 @@ export interface RenderGrantOptions {
|
|
|
90
94
|
spaceId: number;
|
|
91
95
|
environment?: Environment;
|
|
92
96
|
} | undefined>;
|
|
97
|
+
/**
|
|
98
|
+
* The revision a site published as files serves, asked when the page names none: the page's own domain (the
|
|
99
|
+
* request's `Origin`) is a target of the space, pointed at a revision of the environment the page names — so a
|
|
100
|
+
* publish to it is a pointer move, as on a domain the page server answers. Nothing, and the
|
|
101
|
+
* environment's latest is served.
|
|
102
|
+
*/
|
|
103
|
+
served?: (spaceId: number, originHost: string, environment: Environment) => Promise<number | undefined>;
|
|
93
104
|
}
|
|
94
105
|
/**
|
|
95
106
|
* A page that renders the space itself — a site published as files, an embed, the desktop app — asking for it with the
|
|
@@ -99,8 +110,8 @@ export interface RenderGrantOptions {
|
|
|
99
110
|
* credential in `Authorization`, which a page's `fetch` sends: one in the address (`?access-token`) is a page opened
|
|
100
111
|
* by a tool — a screenshot, a journey — and stays what it was. The grant is checked with the page's `Origin` and the
|
|
101
112
|
* host it was presented on, as every browser credential is; it names the space, and the request the environment and
|
|
102
|
-
* revision —
|
|
113
|
+
* revision — when it names none, the one its page's domain is published at (`served`), or the live one.
|
|
103
114
|
*/
|
|
104
|
-
export declare const renderGrant: ({ resolveGrant, find }: RenderGrantOptions) => SpaceResolver;
|
|
115
|
+
export declare const renderGrant: ({ resolveGrant, find, served }: RenderGrantOptions) => SpaceResolver;
|
|
105
116
|
/** A space this server always serves, whatever the host — a single-space deployment, or the last word in a chain. */
|
|
106
117
|
export declare const fixedSpace: (resolution: SpaceResolution) => SpaceResolver;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { SpaceResolver } from './types';
|
|
2
|
+
import { SSRCredential, SSRDeploymentSecurity } from '@plitzi/sdk-kernel/types';
|
|
3
|
+
import { Environment } from '@plitzi/sdk-shared';
|
|
4
|
+
/** How long a key is, in the label: the characters of [a-z0-9] the deployment's `keyOf` answers. */
|
|
5
|
+
export declare const PREVIEW_KEY_LENGTH = 12;
|
|
6
|
+
/** One snapshot of one space: what a preview address names. */
|
|
7
|
+
export interface PreviewAddress {
|
|
8
|
+
spaceId: number;
|
|
9
|
+
environment: Environment;
|
|
10
|
+
revision: number;
|
|
11
|
+
}
|
|
12
|
+
export interface SnapshotPreviewOptions {
|
|
13
|
+
/** The domain the previews hang off, with or without a leading dot — usually the spaces' own (`plitzi.app`). */
|
|
14
|
+
suffix: string;
|
|
15
|
+
/**
|
|
16
|
+
* The snapshot's key: `PREVIEW_KEY_LENGTH` characters of [a-z0-9], the same every time for the same snapshot, and
|
|
17
|
+
* impossible to work out without the deployment's secret.
|
|
18
|
+
*/
|
|
19
|
+
keyOf: (address: PreviewAddress) => string;
|
|
20
|
+
/**
|
|
21
|
+
* The space, when it is one the deployment serves; nothing for one it does not, and the address is a 404. Its
|
|
22
|
+
* `credentials` are who may see its versions: every Site password its addresses ask, any one opening the preview — a
|
|
23
|
+
* preview is the site as it was, and the site is behind them. None, and the preview is open as its site is.
|
|
24
|
+
*/
|
|
25
|
+
find: (spaceId: number) => Promise<{
|
|
26
|
+
spaceId: number;
|
|
27
|
+
security?: Pick<SSRDeploymentSecurity, 'scriptPolicy'>;
|
|
28
|
+
credentials?: SSRCredential[];
|
|
29
|
+
} | undefined>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The label of a snapshot's preview address, for a deployment that serves them with {@link snapshotPreview}: the
|
|
33
|
+
* snapshot, the space's id and its key — and `name` before them, cut to what the label leaves room for (or left out).
|
|
34
|
+
*/
|
|
35
|
+
export declare const previewLabel: (name: string, address: PreviewAddress, key: string) => string;
|
|
36
|
+
/** The snapshot a label names, when it is a preview label at all. */
|
|
37
|
+
export declare const parsePreviewLabel: (label: string) => (PreviewAddress & {
|
|
38
|
+
key: string;
|
|
39
|
+
}) | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Serves a snapshot at its preview address. Put it before `wildcardSubdomain`, whose sub-domains it shares: a label that
|
|
42
|
+
* is not a preview's goes on to it, and one that is a preview's with the wrong key ends the chain as a 404 — the same
|
|
43
|
+
* answer as a space that does not exist, so an address says nothing about which spaces do.
|
|
44
|
+
*/
|
|
45
|
+
export declare const snapshotPreview: ({ suffix, keyOf, find }: SnapshotPreviewOptions) => SpaceResolver;
|
|
@@ -12,7 +12,8 @@ export interface SpaceResolution {
|
|
|
12
12
|
environment?: Environment;
|
|
13
13
|
/** Defaults to `0` — the live snapshot. */
|
|
14
14
|
revision?: number;
|
|
15
|
-
|
|
15
|
+
/** The Site passwords that open it, any one of them (`SSRSpaceDeployment.credentials`); none, and it is open. */
|
|
16
|
+
credentials?: SSRCredential[];
|
|
16
17
|
/**
|
|
17
18
|
* What the host's pages are held to, as the row that resolved it says (`SSRSpaceDeployment.security`): kept with the
|
|
18
19
|
* resolution, so no request asks for it again. Absent, the server's own.
|
|
@@ -23,6 +24,8 @@ export interface SpaceResolution {
|
|
|
23
24
|
* `authoringPreview` sets it; nothing infers it, because only the resolver can tell the two apart.
|
|
24
25
|
*/
|
|
25
26
|
authoring?: boolean;
|
|
27
|
+
/** Never for search, whatever the space's plan or pages say — see `SSRSpaceDeployment.noindex`. */
|
|
28
|
+
noindex?: boolean;
|
|
26
29
|
/** The origins of the credential that chose the space, when one did — `renderGrant` sets it. */
|
|
27
30
|
grantOrigins?: string[];
|
|
28
31
|
/** What the draft is at, when the deployment can say — see `SSRSpaceDeployment.draftVersion`. Usually set by `decorate`. */
|
package/dist/cache.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { dt as DEFAULT_IGNORED_QUERY_PARAMS, L as createCacheInvalidator, t as createRedisPageStore } from "./chunks/core-CoKORAOg.js";
|