@plitzi/sdk-kernel 0.39.3 → 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 +24 -0
- package/README.md +1 -1
- package/dist/build/index.mjs +1 -1
- package/dist/chunks/{channel-DnVf7PJB.mjs → channel-b11VTzOp.mjs} +1 -1
- package/dist/chunks/{csrf-BLWcaYOV.mjs → csrf-DMP4dVjc.mjs} +18 -4
- package/dist/chunks/isRecord-jspv0BWl.mjs +4 -0
- package/dist/chunks/{link-C9wyDS9H.mjs → link-BbsYAg_x.mjs} +2 -2
- package/dist/chunks/{serverLog-BKaKjjc4.mjs → serverLog-BWNOjPMV.mjs} +71 -3
- package/dist/chunks/{stage-y6deE9LJ.mjs → stage-C62Zvzw_.mjs} +229 -12
- package/dist/chunks/{supervisor-Dh34v1vq.mjs → supervisor-BodaVb-s.mjs} +2 -2
- package/dist/data/isRecord.d.ts +2 -0
- package/dist/deployment/index.mjs +1 -1
- package/dist/engine/page.d.ts +1 -1
- package/dist/files/index.mjs +1 -1
- package/dist/http/index.mjs +47 -28
- package/dist/http/probes.d.ts +2 -0
- package/dist/identity/csrf.d.ts +16 -1
- package/dist/identity/index.d.ts +1 -1
- package/dist/identity/index.mjs +2 -2
- package/dist/identity/requestIdentity.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/log/index.mjs +1 -3
- package/dist/log/serverLog.d.ts +5 -1
- package/dist/outbound/index.mjs +66 -6
- package/dist/outbound/outboundGuard.d.ts +15 -4
- package/dist/pubsub/index.mjs +1 -1
- package/dist/stats/index.d.ts +3 -2
- package/dist/stats/index.mjs +3 -3
- package/dist/stats/metrics.d.ts +16 -0
- package/dist/stats/stage.d.ts +13 -7
- package/dist/stats/types.d.ts +14 -1
- package/dist/testing/index.mjs +1 -1
- package/dist/trace/index.d.ts +27 -0
- package/dist/trace/index.mjs +43 -0
- package/dist/types/adapters.d.ts +39 -2
- package/dist/types/config.d.ts +1 -1
- package/dist/types/log.d.ts +4 -0
- package/dist/types/pipeline.d.ts +14 -0
- package/package.json +4 -4
- package/dist/chunks/tail-D-USrZIR.mjs +0 -55
package/dist/types/adapters.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SSRChangePage, SSRChangeQuery, SSRCredential, SSRGrant, SSRRequest, SSRResponseHelpers, SSRSession, SSRTemplateProps, SSRWriteContext } from './pipeline';
|
|
2
|
-
import { BadgeLinks, ActionEntry, ActionRunReport, ActionTaskDescriptor, AnalyticsConfig, ConnectorEntry, DataDraft, DataSaveResult, Environment, FunctionsDraft, FunctionsSaveResult, OfflineDataRaw, PluginSource, SSRRscData, SSRUser, Schema, SessionScope, Style } from '@plitzi/sdk-shared';
|
|
2
|
+
import { BadgeLinks, ActionEntry, ActionRunReport, ActionTaskDescriptor, AnalyticsConfig, ConnectorEntry, DataDraft, DataSaveResult, Environment, FunctionsDraft, FunctionsSaveResult, OfflineDataRaw, PluginSource, SSRRscData, SSRUser, Schema, SessionScope, SpaceDomainRelease, SpaceReleaseOutcome, SpaceReleases, Style } from '@plitzi/sdk-shared';
|
|
3
3
|
import { ActivityReader, SpaceActivityPage, SpaceActivityQuery } from '@plitzi/sdk-shared/activity';
|
|
4
4
|
import { FlagOverrides } from '@plitzi/sdk-shared/flags';
|
|
5
5
|
import { TSpaceEntitlements } from '@plitzi/sdk-shared/network';
|
|
@@ -28,7 +28,11 @@ export type SSRSpaceDeployment = {
|
|
|
28
28
|
/** What this host's pages are held to, for a deployment that lets each domain say: absent, the server's own. */
|
|
29
29
|
security?: SSRDeploymentSecurity;
|
|
30
30
|
environment?: Environment;
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
|
+
* The Site passwords that open this host, any one of them (the basic-auth stage): a domain's own, or — a version's
|
|
33
|
+
* preview — every one its space's addresses ask. None, or empty, and the host is open.
|
|
34
|
+
*/
|
|
35
|
+
credentials?: SSRCredential[];
|
|
32
36
|
spaceId?: number | null;
|
|
33
37
|
revision?: number;
|
|
34
38
|
/**
|
|
@@ -48,6 +52,11 @@ export type SSRSpaceDeployment = {
|
|
|
48
52
|
* which is why it says so here.
|
|
49
53
|
*/
|
|
50
54
|
authoring?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* This address is never for search — a snapshot's preview, made for people to look at before any domain serves it:
|
|
57
|
+
* every page answered on it says `X-Robots-Tag: noindex, nofollow`, whatever the plan or the page's own robots say.
|
|
58
|
+
*/
|
|
59
|
+
noindex?: boolean;
|
|
51
60
|
/**
|
|
52
61
|
* The origins of the credential that chose this space — set only when one did rather than the host (`renderGrant`):
|
|
53
62
|
* a page of one of them renders the space itself and is answered its document across origins.
|
|
@@ -188,6 +197,12 @@ export type SSRAdapters = {
|
|
|
188
197
|
} | {
|
|
189
198
|
notRun: string;
|
|
190
199
|
}>;
|
|
200
|
+
/**
|
|
201
|
+
* The space's own render credential (its public key), which a browser rendering a draft of it presents: the
|
|
202
|
+
* renderer's address names no space, and a draft is served only where its space is named. Absent, a look's picture
|
|
203
|
+
* is taken without it — which works only when the renderer's address is the space's own host.
|
|
204
|
+
*/
|
|
205
|
+
getRenderCredential?: (spaceId: number) => Promise<string | undefined>;
|
|
191
206
|
/** The space's own data: the draft's JSON files its server providers read (`/data/<file>`), and which copy they are.
|
|
192
207
|
* When omitted, the MCP offers no data resource and refuses the data ops. */
|
|
193
208
|
getData?: (spaceId: number) => Promise<DataDraft | undefined>;
|
|
@@ -208,6 +223,28 @@ export type SSRAdapters = {
|
|
|
208
223
|
* to `query.wait` seconds when nothing has yet. `reader` is who asks, so their own writes can be left out; `signal`
|
|
209
224
|
* ends the wait when the client goes. When omitted, the MCP offers no `plitzi_activity`. */
|
|
210
225
|
getActivity?: (spaceId: number, query: SpaceActivityQuery, reader: ActivityReader, signal?: AbortSignal) => Promise<SpaceActivityPage>;
|
|
226
|
+
/**
|
|
227
|
+
* A space's releases: every domain with what it serves, one domain's history, a publish and a rollback —
|
|
228
|
+
* each held to the deployment's own rules (who may publish, the plan, the revision's tests), a refusal answered as
|
|
229
|
+
* data in its words. When omitted, the MCP offers no `plitzi_releases`, `plitzi_publish` nor `plitzi_rollback`.
|
|
230
|
+
*/
|
|
231
|
+
releases?: {
|
|
232
|
+
domains: (spaceId: number) => Promise<SpaceDomainRelease[]>;
|
|
233
|
+
history: (spaceId: number, domain: string) => Promise<SpaceReleases>;
|
|
234
|
+
publish: (spaceId: number, asked: {
|
|
235
|
+
domain: string;
|
|
236
|
+
environment: Environment;
|
|
237
|
+
revision?: number;
|
|
238
|
+
deploy?: boolean;
|
|
239
|
+
}, write: SSRWriteContext) => Promise<SpaceReleaseOutcome>;
|
|
240
|
+
rollback: (spaceId: number, asked: {
|
|
241
|
+
domain: string;
|
|
242
|
+
to?: {
|
|
243
|
+
environment: Environment;
|
|
244
|
+
revision: number;
|
|
245
|
+
};
|
|
246
|
+
}, write: SSRWriteContext) => Promise<SpaceReleaseOutcome>;
|
|
247
|
+
};
|
|
211
248
|
/**
|
|
212
249
|
* Who this request carries, if anyone. The adapter reads the credential and resolves it; the cookie it arrived in
|
|
213
250
|
* was written by the server, from {@link SSRAuthCookie}.
|
package/dist/types/config.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { SSRMiddleware, ServerEnvironment } from './pipeline';
|
|
|
4
4
|
import { StatsConfig } from '../stats/types';
|
|
5
5
|
import { ServerFlags } from '@plitzi/sdk-shared/flags';
|
|
6
6
|
/**
|
|
7
|
-
* What every Plitzi server process is configured with (
|
|
7
|
+
* What every Plitzi server process is configured with (docs/en/server-packages.md, D12): its transport, its log, its health, the headers
|
|
8
8
|
* it answers with, what it may reach, and the adapters it asks. A page server's configuration and the actions engine's
|
|
9
9
|
* are both this and their own.
|
|
10
10
|
*/
|
package/dist/types/log.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ type ServerLogEventBase = {
|
|
|
8
8
|
error?: string;
|
|
9
9
|
/** ISO-8601 timestamp of when the event was emitted. */
|
|
10
10
|
timestamp: string;
|
|
11
|
+
/** The W3C trace the work was part of (`sdk-kernel/trace`): one id for every line of one run, on every process. */
|
|
12
|
+
traceId?: string;
|
|
11
13
|
};
|
|
12
14
|
/** What every log event carries, whatever layer it came from. */
|
|
13
15
|
/**
|
|
@@ -112,6 +114,8 @@ export type ServerMessageLogEvent = {
|
|
|
112
114
|
ok: boolean;
|
|
113
115
|
error?: string;
|
|
114
116
|
timestamp: string;
|
|
117
|
+
/** The trace it was said in, as every other event's. */
|
|
118
|
+
traceId?: string;
|
|
115
119
|
};
|
|
116
120
|
export type ServerLogEvent = ServerRequestLogEvent | McpToolLogEvent | McpResourceLogEvent | ActionRunLogEvent | ActionRejectLogEvent | ServerMessageLogEvent;
|
|
117
121
|
/** The sink a consumer provides to receive every {@link ServerLogEvent} (see `SSRServerConfig.logger`). */
|
package/dist/types/pipeline.d.ts
CHANGED
|
@@ -68,6 +68,11 @@ export type SSRCredential = {
|
|
|
68
68
|
export type SSRTemplateProps = {
|
|
69
69
|
/** The render's script nonce, written on each of the template's own scripts (`SSRServerConfig.scriptPolicy`). */
|
|
70
70
|
nonce?: string;
|
|
71
|
+
/**
|
|
72
|
+
* What the page's elements asked to run as it is parsed, before it paints, by name (`SSRRenderResult.prePaint`): each
|
|
73
|
+
* a script of the template's own, under its nonce.
|
|
74
|
+
*/
|
|
75
|
+
prePaint?: Record<string, string>;
|
|
71
76
|
/**
|
|
72
77
|
* The page's script policy, said on `<html data-plitzi-script-policy>`: what every copy of the SDK's shared code a page
|
|
73
78
|
* loads — the builder's, a plugin's own — reads to hold itself to it (`startMarkupPolicies`).
|
|
@@ -76,6 +81,8 @@ export type SSRTemplateProps = {
|
|
|
76
81
|
title?: string;
|
|
77
82
|
/** Meta description for the document, and the share-preview text derived from it. */
|
|
78
83
|
description?: string;
|
|
84
|
+
/** The page's JSON-LD, each object as the text of its `<script type="application/ld+json">`, escaped for the tag. */
|
|
85
|
+
structuredData?: string[];
|
|
79
86
|
/**
|
|
80
87
|
* The head's tags besides the title and the JSON-LD — description, robots, Open Graph and card, the canonical
|
|
81
88
|
* address, the icon, the browser's colour, the language — as `pageHeadTags` decides them. The server's own.
|
|
@@ -85,6 +92,13 @@ export type SSRTemplateProps = {
|
|
|
85
92
|
cssPath?: string;
|
|
86
93
|
/** Font Awesome's rules, after `cssPath`; its fonts are files beside it, fetched only for a style the page uses. */
|
|
87
94
|
iconsCssPath?: string;
|
|
95
|
+
/**
|
|
96
|
+
* The space's own icon faces — the glyphs it names, cut from the whole font (`/_plitzi/icons/`) — declared after
|
|
97
|
+
* `iconsCssPath`'s, so a glyph in their range is fetched from them and any other from the whole font.
|
|
98
|
+
*/
|
|
99
|
+
iconFaces?: string;
|
|
100
|
+
/** What the page's writes to the deployment's own APIs echo the CSRF token with (`@plitzi/sdk-shared/csrf`), as JSON. */
|
|
101
|
+
csrfHint?: string;
|
|
88
102
|
/**
|
|
89
103
|
* Where the page fetches the space from, when it travels beside the document rather than in its payload: the
|
|
90
104
|
* page preloads it, and the bootstrap reads it before hydrating.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-kernel",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.6",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"description": "What every Plitzi server process is built on: the HTTP pipeline, health and shutdown, the host → deployment resolution, and verifying who a request is.",
|
|
6
6
|
"files": [
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"build:prod": "vite build"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@plitzi/sdk-shared": "0.39.
|
|
40
|
+
"@plitzi/sdk-shared": "0.39.6",
|
|
41
41
|
"jsonwebtoken": "^9.0.3",
|
|
42
42
|
"undici": "^8.12.4",
|
|
43
|
-
"ws": "^8.
|
|
43
|
+
"ws": "^8.23.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"esbuild": "^0.28.2",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"eslint-plugin-import": "^2.32.0",
|
|
64
64
|
"mysql2": "^3.24.6",
|
|
65
65
|
"typescript": "^6.0.3",
|
|
66
|
-
"vite": "^8.3.
|
|
66
|
+
"vite": "^8.3.8",
|
|
67
67
|
"vite-plugin-dts": "^5.1.2",
|
|
68
68
|
"vitest": "^5.1.0"
|
|
69
69
|
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// src/log/tail.ts
|
|
2
|
-
/** How many lines a process keeps: a busy minute of a page server, an hour of a quiet worker. */
|
|
3
|
-
var LOG_TAIL_SIZE = 1e3;
|
|
4
|
-
var RANK = {
|
|
5
|
-
error: 1,
|
|
6
|
-
warn: 2,
|
|
7
|
-
info: 3,
|
|
8
|
-
debug: 4
|
|
9
|
-
};
|
|
10
|
-
var lines = [];
|
|
11
|
-
var seq = 0;
|
|
12
|
-
/** Keeps a line said by the deployment's own logger (`kind: 'app'`) beside the kernel's. */
|
|
13
|
-
var keepLogLine = (level, text, kind = "app") => {
|
|
14
|
-
seq += 1;
|
|
15
|
-
lines.push({
|
|
16
|
-
seq,
|
|
17
|
-
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
18
|
-
level,
|
|
19
|
-
kind,
|
|
20
|
-
text
|
|
21
|
-
});
|
|
22
|
-
if (lines.length > 1e3) lines.splice(0, lines.length - LOG_TAIL_SIZE);
|
|
23
|
-
};
|
|
24
|
-
/** Keeps an event, rendered, at its own level. */
|
|
25
|
-
var keepLogEvent = (event, level, text) => {
|
|
26
|
-
keepLogLine(level, text, event.kind);
|
|
27
|
-
};
|
|
28
|
-
/** What a reader asked for, oldest first, and the newest line's number — what it asks `since` next. */
|
|
29
|
-
var readLogTail = ({ since = 0, level = "debug", limit = LOG_TAIL_SIZE, q } = {}) => {
|
|
30
|
-
const needle = q?.trim().toLowerCase();
|
|
31
|
-
return {
|
|
32
|
-
lines: lines.filter((line) => line.seq > since && RANK[line.level] <= RANK[level] && (!needle || line.text.toLowerCase().includes(needle))).slice(-Math.min(Math.max(1, limit), LOG_TAIL_SIZE)),
|
|
33
|
-
last: seq,
|
|
34
|
-
kept: lines.length
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
var LEVELS = [
|
|
38
|
-
"error",
|
|
39
|
-
"warn",
|
|
40
|
-
"info",
|
|
41
|
-
"debug"
|
|
42
|
-
];
|
|
43
|
-
/** A log query from a request's query string, every value checked: what it cannot read is left at its default. */
|
|
44
|
-
var logQueryOf = (query) => {
|
|
45
|
-
const since = Number(query.since);
|
|
46
|
-
const limit = Number(query.limit);
|
|
47
|
-
const level = LEVELS.find((each) => each === query.level);
|
|
48
|
-
return {
|
|
49
|
-
...Number.isInteger(since) && since > 0 ? { since } : {},
|
|
50
|
-
...Number.isInteger(limit) && limit > 0 ? { limit } : {},
|
|
51
|
-
...level ? { level } : {},
|
|
52
|
-
...query.q ? { q: query.q.slice(0, 200) } : {}
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
export { readLogTail as a, logQueryOf as i, keepLogEvent as n, keepLogLine as r, LOG_TAIL_SIZE as t };
|