@plitzi/sdk-shared 0.38.4 → 0.38.5
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 +329 -0
- package/dist/actions/functions.d.ts +10 -0
- package/dist/actions/functions.mjs +10 -10
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.mjs +6 -6
- package/dist/helpers/twigWrapper/inspectTemplate.mjs +14 -7
- package/dist/helpers/twigWrapper/processTwig/processTwig.d.ts +4 -3
- package/dist/helpers/twigWrapper/processTwig/processTwig.mjs +32 -22
- package/dist/history/types.d.ts +4 -4
- package/dist/index.mjs +38 -37
- package/dist/network/graphql/builder/Mutations/Space/data/SpaceSaveDataMutation.d.ts +10 -0
- package/dist/network/graphql/builder/Mutations/Space/data/SpaceSaveDataMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/index.d.ts +2 -0
- package/dist/network/graphql/builder/Mutations/index.mjs +124 -122
- package/dist/network/graphql/builder/Queries/InitQuery.d.ts +1 -3
- package/dist/network/graphql/builder/Queries/InitQuery.mjs +1 -1
- package/dist/network/graphql/builder/Queries/Space/SpaceDataQuery.d.ts +6 -0
- package/dist/network/graphql/builder/Queries/Space/SpaceDataQuery.mjs +4 -0
- package/dist/network/graphql/builder/Queries/index.d.ts +2 -0
- package/dist/network/graphql/builder/Queries/index.mjs +22 -20
- package/dist/network/spaceEvents.d.ts +2 -2
- package/dist/plugins/bundle.d.ts +26 -0
- package/dist/plugins/bundle.mjs +62 -0
- package/dist/plugins/declaration.d.ts +12 -0
- package/dist/plugins/declaration.mjs +9 -0
- package/dist/queries/queryCache.d.ts +7 -0
- package/dist/queries/queryCache.mjs +14 -7
- package/dist/queries/useQuery.d.ts +2 -0
- package/dist/queries/useQuery.mjs +5 -2
- package/dist/schema/anchor.d.ts +11 -0
- package/dist/schema/anchor.mjs +6 -2
- package/dist/schema/index.mjs +6 -6
- package/dist/schema/markdownHeadings.d.ts +13 -0
- package/dist/schema/markdownHeadings.mjs +24 -0
- package/dist/schema/motion.mjs +1 -1
- package/dist/schema/pageElements.d.ts +12 -0
- package/dist/schema/pageElements.mjs +41 -0
- package/dist/server/index.mjs +4 -4
- package/dist/server/rsc/projectData.d.ts +6 -0
- package/dist/server/rsc/projectData.mjs +4 -0
- package/dist/server/rsc/refreshRsc.d.ts +18 -5
- package/dist/server/rsc/refreshRsc.mjs +80 -20
- package/dist/server/rsc/useRscSync.mjs +26 -15
- package/dist/server/usePluginRoute.d.ts +18 -0
- package/dist/server/usePluginRoute.mjs +14 -0
- package/dist/source/export.d.ts +13 -0
- package/dist/store/index.d.ts +45 -45
- package/dist/style/cssLayers.d.ts +18 -0
- package/dist/style/cssLayers.mjs +14 -0
- package/dist/style/index.d.ts +1 -0
- package/dist/style/index.mjs +11 -10
- package/dist/style/useDisplayMode.d.ts +11 -0
- package/dist/style/useDisplayMode.mjs +18 -0
- package/dist/types/ActionTypes.d.ts +3 -3
- package/dist/types/ComponentTypes.d.ts +13 -0
- package/dist/types/DataTypes.d.ts +36 -0
- package/dist/types/InteractionTypes.d.ts +16 -2
- package/dist/types/SchemaTypes.d.ts +3 -1
- package/dist/types/SchemaTypes.mjs +2 -1
- package/dist/types/ServerTypes.d.ts +58 -7
- package/dist/types/StoreTypes.d.ts +19 -6
- package/dist/types/index.d.ts +1 -2
- package/package.json +46 -28
- package/setupTests.ts +16 -13
- package/dist/types/AITypes.d.ts +0 -80
- package/dist/types/McpTypes/index.d.ts +0 -56
- package/dist/types/McpTypes/index.mjs +0 -0
- /package/dist/types/{AITypes.mjs → DataTypes.mjs} +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cascade layers the SDK's stylesheets are written in, lowest first — declared once by `plitzi-sdk.css` and the
|
|
3
|
+
* builder's canvas, and again by the runtime stylesheet for a page that loads neither.
|
|
4
|
+
*
|
|
5
|
+
* A plugin's own stylesheet sits BELOW the space's: what the space writes about an element — its classes, `customCss`
|
|
6
|
+
* — wins over the defaults the element's author shipped, whatever their specificity, as it does for a built-in
|
|
7
|
+
* element. Above, a space's `customCss` hiding a marker inside a map lost to the plugin's `.marker { display: flex }`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PLUGIN_CSS_LAYER = "plitzi-sdk-plugin";
|
|
10
|
+
export declare const RUNTIME_CSS_LAYER = "plitzi-sdk-runtime";
|
|
11
|
+
/**
|
|
12
|
+
* A plugin's stylesheet, as it ships: everything in it in {@link PLUGIN_CSS_LAYER}. Written by whatever builds a
|
|
13
|
+
* plugin — a server compiling one, `plitzi pack plugin` — so every way the file later reaches a page (a `<link>` in the
|
|
14
|
+
* server's HTML, the SDK's assets, the builder's canvas) puts it in its place with no work of its own.
|
|
15
|
+
*
|
|
16
|
+
* Idempotent: a stylesheet already wrapped is returned as it is.
|
|
17
|
+
*/
|
|
18
|
+
export declare const inPluginLayer: (css: string, layer?: string) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/style/cssLayers.ts
|
|
2
|
+
var e = "plitzi-sdk-plugin", t = "plitzi-sdk-runtime", n = /^\s*(@charset\s[^;]*;|@import\s[^;]*;|\/\*[\s\S]*?\*\/)/, r = (e, t) => {
|
|
3
|
+
let n = /^@import\s+(url\([^)]*\)|"[^"]*"|'[^']*')([^;]*);$/.exec(e.trim());
|
|
4
|
+
return !n || /\blayer\b/.test(n[2]) ? e : `@import ${n[1]} layer(${t})${n[2]};`;
|
|
5
|
+
}, i = (t, i = e) => {
|
|
6
|
+
let a = t, o = "";
|
|
7
|
+
for (let e = n.exec(a); e; e = n.exec(a)) {
|
|
8
|
+
let t = e[1];
|
|
9
|
+
o += t.startsWith("@import") ? r(t, i) : t, a = a.slice(e[0].length);
|
|
10
|
+
}
|
|
11
|
+
return a.trimStart().startsWith(`@layer ${i}`) ? t : a.trim() ? `${o}@layer ${i}{${a}}` : o;
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { e as PLUGIN_CSS_LAYER, t as RUNTIME_CSS_LAYER, i as inPluginLayer };
|
package/dist/style/index.d.ts
CHANGED
package/dist/style/index.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import e, { EMPTY_STYLE_SCHEMA as t, StyleBindingsAllowed as n, baseDefaultValue as r, inheritableAttributesBase as i } from "./styleConstants.mjs";
|
|
2
2
|
import { DISPLAY_MODE_MIN_WIDTH as a, displayModeAt as o, displayModeWidthRem as s } from "./breakpoints.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
3
|
+
import { PLUGIN_CSS_LAYER as c, RUNTIME_CSS_LAYER as l, inPluginLayer as u } from "./cssLayers.mjs";
|
|
4
|
+
import { DISPLAY_MODES as d, isDisplayMode as f } from "./displayModes.mjs";
|
|
5
|
+
import { fontLinkAssets as p } from "./fontAssets.mjs";
|
|
6
|
+
import { SYSTEM_FONTS as m, availableFonts as h, familiesInCss as g, fontFamilyStack as _, fontUrlResolver as v, fontsToHead as y, googleCss2Url as b, googleTextSubsetUrl as x, isSafeFontUrl as S, primaryFamily as C } from "./fonts.mjs";
|
|
7
|
+
import { FontValidationError as w, parseSpaceFont as T } from "./fontValidation.mjs";
|
|
8
|
+
import { fallbackForFamily as E, fontsFromCss as D } from "./fontsFromCss.mjs";
|
|
9
|
+
import { LAYOUT_GRIDS as O, layoutGridCss as k, layoutGridLook as A } from "./layoutGrid.mjs";
|
|
10
|
+
import { RUNTIME_STYLE_ID as j, markStyleCache as M, styleCacheFromDocument as N, styleCacheTravelsInDocument as P } from "./runtimeStyle.mjs";
|
|
11
|
+
import { mergeSnippetStyle as F, sameSelector as I, selectorsOf as L } from "./snippetStyle.mjs";
|
|
12
|
+
import { CURRENT_PAGE_SELECTOR as R, HIDDEN_CLASS as z, STYLE_STATES as B, STYLE_STATE_LABELS as V, inCascadeOrder as H, isKnownState as U, isStartingState as W, stateSuffix as G } from "./styleStates.mjs";
|
|
13
|
+
export { R as CURRENT_PAGE_SELECTOR, d as DISPLAY_MODES, a as DISPLAY_MODE_MIN_WIDTH, t as EMPTY_STYLE_SCHEMA, w as FontValidationError, z as HIDDEN_CLASS, O as LAYOUT_GRIDS, c as PLUGIN_CSS_LAYER, l as RUNTIME_CSS_LAYER, j as RUNTIME_STYLE_ID, B as STYLE_STATES, V as STYLE_STATE_LABELS, m as SYSTEM_FONTS, n as StyleBindingsAllowed, h as availableFonts, r as baseDefaultValue, o as displayModeAt, s as displayModeWidthRem, E as fallbackForFamily, g as familiesInCss, _ as fontFamilyStack, p as fontLinkAssets, v as fontUrlResolver, D as fontsFromCss, y as fontsToHead, b as googleCss2Url, x as googleTextSubsetUrl, H as inCascadeOrder, u as inPluginLayer, i as inheritableAttributesBase, f as isDisplayMode, U as isKnownState, S as isSafeFontUrl, W as isStartingState, k as layoutGridCss, A as layoutGridLook, M as markStyleCache, F as mergeSnippetStyle, T as parseSpaceFont, C as primaryFamily, I as sameSelector, L as selectorsOf, G as stateSuffix, N as styleCacheFromDocument, P as styleCacheTravelsInDocument, e as styleConstants };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DisplayMode } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Which of the space's breakpoints the page is showing — `desktop`, `tablet` or `mobile` — kept current as the window
|
|
4
|
+
* or the builder's canvas is resized. For a plugin that decides by layout (a dock only where there is room for one)
|
|
5
|
+
* with the space's own widths, rather than a number of its own that drifts from them. `compact`, in the space's
|
|
6
|
+
* styles, is `tablet` and `mobile` together.
|
|
7
|
+
*
|
|
8
|
+
* It listens to two media queries and nothing else — no resize handler, no store.
|
|
9
|
+
*/
|
|
10
|
+
declare const useDisplayMode: () => DisplayMode;
|
|
11
|
+
export default useDisplayMode;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { displayModeWidthRem as e } from "./breakpoints.mjs";
|
|
2
|
+
import { useSyncExternalStore as t } from "react";
|
|
3
|
+
//#region src/style/useDisplayMode.ts
|
|
4
|
+
var n = {
|
|
5
|
+
mobile: `(max-width: ${e("tablet")})`,
|
|
6
|
+
tablet: `(max-width: ${e("desktop")})`
|
|
7
|
+
}, r = (e) => typeof window > "u" || typeof window.matchMedia != "function" ? void 0 : window.matchMedia(e), i = () => r(n.mobile)?.matches ? "mobile" : r(n.tablet)?.matches ? "tablet" : "desktop", a = (e) => {
|
|
8
|
+
let t = [r(n.mobile), r(n.tablet)].filter((e) => e !== void 0);
|
|
9
|
+
return t.forEach((t) => {
|
|
10
|
+
t.addEventListener("change", e);
|
|
11
|
+
}), () => {
|
|
12
|
+
t.forEach((t) => {
|
|
13
|
+
t.removeEventListener("change", e);
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
}, o = () => "desktop", s = () => t(a, i, o);
|
|
17
|
+
//#endregion
|
|
18
|
+
export { s as default };
|
|
@@ -209,10 +209,10 @@ export type ActionTaskDescriptor = {
|
|
|
209
209
|
title: string;
|
|
210
210
|
description?: string;
|
|
211
211
|
/**
|
|
212
|
-
* Whose step it is: the deployment's (`http.request`, `kv.get`…)
|
|
213
|
-
*
|
|
212
|
+
* Whose step it is: the deployment's (`http.request`, `kv.get`…), one of the space's own functions, or the server half
|
|
213
|
+
* of a plugin the space uses (`<type>.<action>`). A run treats them alike; the editor lists them apart.
|
|
214
214
|
*/
|
|
215
|
-
origin: 'deployment' | 'space';
|
|
215
|
+
origin: 'deployment' | 'space' | 'plugin';
|
|
216
216
|
params: Record<string, unknown>;
|
|
217
217
|
};
|
|
218
218
|
/**
|
|
@@ -20,6 +20,19 @@ export type ComponentPlugin<T = unknown> = ComponentPluginFC<T> & {
|
|
|
20
20
|
version?: string;
|
|
21
21
|
initialItems?: string[];
|
|
22
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* What a plugin says about itself apart from its code — its definition, its sub-plugins' — as data a page can carry.
|
|
25
|
+
*
|
|
26
|
+
* A page is sent with the plugins it draws and only the declarations of the rest: the space knows every type it has
|
|
27
|
+
* (an element's defaults, a sub-plugin's name) from the start, and a plugin's code is fetched when a page that draws
|
|
28
|
+
* it is opened.
|
|
29
|
+
*/
|
|
30
|
+
export type PluginDeclaration = {
|
|
31
|
+
content?: ComponentDefinition;
|
|
32
|
+
version?: string;
|
|
33
|
+
initialItems?: string[];
|
|
34
|
+
plugins?: Record<string, PluginDeclaration>;
|
|
35
|
+
};
|
|
23
36
|
export type ComponentPluginWithHOC<T = unknown> = ComponentPluginFC<T & {
|
|
24
37
|
internalProps: InternalPropsSTG1;
|
|
25
38
|
}> & {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A space's own data, as everything outside the page server sees it — the builder, the CLI, the MCP and the platform
|
|
3
|
+
* that keeps it: JSON files a provider of the space reads on the server (`/data/<file>`), never served. What a project
|
|
4
|
+
* keeps in `src/data/`.
|
|
5
|
+
*/
|
|
6
|
+
/** One reason the data was not saved, by the file it is about — what an editor marks. */
|
|
7
|
+
export type DataProblem = {
|
|
8
|
+
file: string;
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
/** The draft's data: its files, and which copy of them this is. */
|
|
12
|
+
export type DataDraft = {
|
|
13
|
+
/** `{ "products.json": "[…]", "shop/hours.json": "{…}" }`. */
|
|
14
|
+
files: Record<string, string>;
|
|
15
|
+
/** Hand it back as `base` when saving: data that moved on since is refused rather than overwritten. */
|
|
16
|
+
version: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Why nothing was saved: `version`, the data moved on since the copy this save started from; `storage`, the space has no
|
|
20
|
+
* private bucket to keep it in (the error says how to add one); `size`, it weighs more than a render reads.
|
|
21
|
+
*/
|
|
22
|
+
export type DataRefusal = {
|
|
23
|
+
status: number;
|
|
24
|
+
error: string;
|
|
25
|
+
limit: 'version' | 'storage' | 'size';
|
|
26
|
+
};
|
|
27
|
+
export type DataSaveResult = {
|
|
28
|
+
ok: true;
|
|
29
|
+
version: string;
|
|
30
|
+
} | {
|
|
31
|
+
ok: false;
|
|
32
|
+
problems: DataProblem[];
|
|
33
|
+
} | {
|
|
34
|
+
ok: false;
|
|
35
|
+
refusal: DataRefusal;
|
|
36
|
+
};
|
|
@@ -19,7 +19,7 @@ export type InteractionNode = {
|
|
|
19
19
|
endTime: number;
|
|
20
20
|
whenParams?: Record<string, RuleValue>;
|
|
21
21
|
};
|
|
22
|
-
export type InteractionParamType = 'boolean' | 'select' | 'text' | 'textarea' | 'codemirror-text' | 'codemirror-json' | 'elements';
|
|
22
|
+
export type InteractionParamType = 'boolean' | 'select' | 'text' | 'number' | 'textarea' | 'codemirror-text' | 'codemirror-json' | 'elements';
|
|
23
23
|
export type InteractionCallbackParamValues<T extends Record<string, unknown> = Record<string, unknown>> = T;
|
|
24
24
|
export type InteractionCallbackParam<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
25
25
|
canBind?: boolean;
|
|
@@ -33,6 +33,11 @@ export type InteractionCallbackParam<T extends Record<string, unknown> = Record<
|
|
|
33
33
|
} & ({
|
|
34
34
|
type: 'text';
|
|
35
35
|
defaultValue?: string | number;
|
|
36
|
+
}
|
|
37
|
+
/** Written as text — a number or a template — and handed to the callback as a number. */
|
|
38
|
+
| {
|
|
39
|
+
type: 'number';
|
|
40
|
+
defaultValue?: number;
|
|
36
41
|
} | {
|
|
37
42
|
type: 'textarea';
|
|
38
43
|
defaultValue?: string | number;
|
|
@@ -74,7 +79,11 @@ export type InteractionCallbackParam<T extends Record<string, unknown> = Record<
|
|
|
74
79
|
value: string;
|
|
75
80
|
}[]);
|
|
76
81
|
});
|
|
77
|
-
|
|
82
|
+
/**
|
|
83
|
+
* What a field a step or a trigger hands its flow looks like — a sample, shown where a flow is written, never sent: `0`
|
|
84
|
+
* for a count, `false` for a flag, `[]` for a list, as well as the text `''`.
|
|
85
|
+
*/
|
|
86
|
+
export type InteractionCallbackPreview = string | number | boolean | null | unknown[] | Record<string, unknown>;
|
|
78
87
|
export type InteractionCallbackPreviews = Record<string, InteractionCallbackPreview>;
|
|
79
88
|
/**
|
|
80
89
|
* What a callback learns about the flow running it.
|
|
@@ -86,6 +95,11 @@ export type InteractionCallbackPreviews = Record<string, InteractionCallbackPrev
|
|
|
86
95
|
export type InteractionCallbackContext = {
|
|
87
96
|
/** Id of the element this flow fired on. Absent for a flow with no host element. */
|
|
88
97
|
hostElementId?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Aborted when the flow running this step is superseded — its trigger fired again under `whileRunning: 'latest'`. A
|
|
100
|
+
* step waiting on something it can stop (a request, a server run) stops it; the flow starts no further step.
|
|
101
|
+
*/
|
|
102
|
+
signal?: AbortSignal;
|
|
89
103
|
};
|
|
90
104
|
export type InteractionCallback<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
91
105
|
elementId?: string;
|
|
@@ -53,8 +53,10 @@ export type ElementBinding = {
|
|
|
53
53
|
* - `skip` (the default): the new firing is ignored — what keeps a double click from submitting twice.
|
|
54
54
|
* - `parallel`: every firing runs its own flow, at the same time.
|
|
55
55
|
* - `queue`: every firing runs, one after another, in the order they came — none lost, none overlapping.
|
|
56
|
+
* - `latest`: every firing runs, and the run before it stops — it starts no further step, and the step it is waiting
|
|
57
|
+
* on stops if it can (a server action, a request). A search as you type: only the last question is answered.
|
|
56
58
|
*/
|
|
57
|
-
export type WhileRunning = 'skip' | 'parallel' | 'queue';
|
|
59
|
+
export type WhileRunning = 'skip' | 'parallel' | 'queue' | 'latest';
|
|
58
60
|
export declare const WHILE_RUNNING_MODES: readonly WhileRunning[];
|
|
59
61
|
export type ElementInteraction<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
60
62
|
id: string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ActionEmailConfig, ActionEntry, ActionJobQueue, ActionLimits, ActionRejectReason, ActionRunSummary, ActionRejectRecord, ActionRunRecord, ActionRunReport, ActionRunStatus, ActionTaskDescriptor, ActionTriggerType } from './ActionTypes';
|
|
2
2
|
import { Environment } from './CommonTypes';
|
|
3
|
+
import { PluginDeclaration } from './ComponentTypes';
|
|
3
4
|
import { ConnectorEntry } from './ConnectorTypes';
|
|
5
|
+
import { DataDraft, DataSaveResult } from './DataTypes';
|
|
4
6
|
import { FunctionsDraft, FunctionsSaveResult } from './FunctionTypes';
|
|
5
7
|
import { SSRRealtimeConfig } from './RealtimeTypes';
|
|
6
8
|
import { Schema } from './SchemaTypes';
|
|
@@ -119,6 +121,11 @@ export type PluginEntry = {
|
|
|
119
121
|
* against, and the mismatch throws away the whole tree it happens in.
|
|
120
122
|
*/
|
|
121
123
|
ssr?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* What the plugin declares, when this page draws none of its types: its code and stylesheet are left out of the
|
|
126
|
+
* document and loaded when a page that draws it is opened. Absent, the page loads it up front.
|
|
127
|
+
*/
|
|
128
|
+
deferred?: PluginDeclaration;
|
|
122
129
|
};
|
|
123
130
|
export type SSRTemplateProps = {
|
|
124
131
|
title?: string;
|
|
@@ -126,6 +133,13 @@ export type SSRTemplateProps = {
|
|
|
126
133
|
description?: string;
|
|
127
134
|
jsPath?: string;
|
|
128
135
|
cssPath?: string;
|
|
136
|
+
/** Font Awesome's rules, after `cssPath`; its fonts are files beside it, fetched only for a style the page uses. */
|
|
137
|
+
iconsCssPath?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Where the page fetches the space from, when it travels beside the document rather than in its payload: the
|
|
140
|
+
* page preloads it, and the bootstrap reads it before hydrating.
|
|
141
|
+
*/
|
|
142
|
+
spaceDocumentPath?: string;
|
|
129
143
|
builderJsPath?: string;
|
|
130
144
|
builderCssPath?: string;
|
|
131
145
|
plugins?: PluginEntry[];
|
|
@@ -348,10 +362,6 @@ export type SSRAdapters = {
|
|
|
348
362
|
/** Which space, environment and revision a request resolves to. Optional here for the same reason as
|
|
349
363
|
* `getOfflineData`: MCP resolves its space from the request token (`getGrant`), never from the host. */
|
|
350
364
|
getSpaceDeployment?: (req: SSRRequest) => Promise<SSRSpaceDeployment>;
|
|
351
|
-
/** Persist a space mutated by the mcp-ai `apply` tool — store it as given; derived caches (notably `style.cache`)
|
|
352
|
-
* arrive already compiled. When omitted, mcp-ai runs read/preview/validate only and `apply` reports
|
|
353
|
-
* `persisted: false`. */
|
|
354
|
-
saveOfflineData?: (spaceId: number, environment: string, data: OfflineDataRaw) => Promise<void>;
|
|
355
365
|
/** Resolve the grant the MCP request operates under, from the verified `Authorization` bearer. The consumer
|
|
356
366
|
* owns the JWT secret and the authorization model, so it decides here; the MCP service stays stateless.
|
|
357
367
|
* Returns undefined when the token is missing or invalid. Required for the `mcp` service to serve any
|
|
@@ -399,6 +409,12 @@ export type SSRAdapters = {
|
|
|
399
409
|
saveFunctions?: (spaceId: number, files: Record<string, string>, base: string, write: SSRWriteContext) => Promise<FunctionsSaveResult>;
|
|
400
410
|
/** Run one task of the draft's functions in the sandbox for the person behind the agent — the builder's Try. */
|
|
401
411
|
tryFunction?: (spaceId: number, task: string, params: Record<string, unknown>, write: SSRWriteContext) => Promise<ActionRunReport>;
|
|
412
|
+
/** The space's own data: the draft's JSON files its server providers read (`/data/<file>`), and which copy they are.
|
|
413
|
+
* When omitted, the MCP offers no data resource and refuses the data ops. */
|
|
414
|
+
getData?: (spaceId: number) => Promise<DataDraft | undefined>;
|
|
415
|
+
/** Save the draft's data, whole: every file JSON at a plain path. `base` is the version the agent read, and data that
|
|
416
|
+
* moved on since is refused rather than overwritten. */
|
|
417
|
+
saveData?: (spaceId: number, files: Record<string, string>, base: string, write: SSRWriteContext) => Promise<DataSaveResult>;
|
|
402
418
|
/** Persist the element schema mutated by the MCP `apply` tool. When omitted, `apply` reports `persisted: false`. */
|
|
403
419
|
saveSchema?: (spaceId: number, environment: Environment, schema: Schema, write: SSRWriteContext) => Promise<void>;
|
|
404
420
|
/** Persist the style document mutated by the MCP `apply` tool — store it as given. `style.cache` arrives already
|
|
@@ -523,6 +539,11 @@ export interface SSRRscContext {
|
|
|
523
539
|
* against the page it matched and skips it — so a feature that is off puts nothing in the payload.
|
|
524
540
|
*/
|
|
525
541
|
flagOverrides?: FlagOverrides;
|
|
542
|
+
/**
|
|
543
|
+
* Aborted when whoever asked stops waiting — a browser that hung up, a refresh superseded by a newer one, a STOP — so
|
|
544
|
+
* what it asked for stops being worked on, here and in the runs it started.
|
|
545
|
+
*/
|
|
546
|
+
signal?: AbortSignal;
|
|
526
547
|
}
|
|
527
548
|
/**
|
|
528
549
|
* Which published version of a space is asking.
|
|
@@ -554,6 +575,14 @@ export type ActionLookupsConfig = {
|
|
|
554
575
|
getConnector?: (spaceId: number, connectorId: string, at?: SpaceRevision) => Promise<unknown>;
|
|
555
576
|
/** The space's own functions as of that revision — `SpaceFunctions` in `@plitzi/sdk-server/functions`. */
|
|
556
577
|
getFunctions?: (spaceId: number, at?: SpaceRevision) => Promise<unknown>;
|
|
578
|
+
/** The server halves of the plugins the space uses, by plugin type — a `SpaceFunctions` each. */
|
|
579
|
+
getPluginFunctions?: (spaceId: number, at?: SpaceRevision) => Promise<unknown>;
|
|
580
|
+
/**
|
|
581
|
+
* The space's own data as of that revision — what a project keeps in `src/data/`, kept privately and frozen with each
|
|
582
|
+
* publish — as its files' text by path (`products.json`). A provider resolved on the server whose `query` is
|
|
583
|
+
* `/data/<file>` reads it, as `dataDir` reads a folder; no browser is answered it.
|
|
584
|
+
*/
|
|
585
|
+
getData?: (spaceId: number, at?: SpaceRevision) => Promise<unknown>;
|
|
557
586
|
/** The feature flags the space declares as of that revision — what a flow reads as `{{ flags.<name> }}`. */
|
|
558
587
|
getFlags?: (spaceId: number, at?: SpaceRevision) => Promise<Schema['flags']>;
|
|
559
588
|
};
|
|
@@ -903,7 +932,15 @@ export type SSRServerConfig = {
|
|
|
903
932
|
minVersion?: 'TLSv1' | 'TLSv1.1' | 'TLSv1.2' | 'TLSv1.3';
|
|
904
933
|
};
|
|
905
934
|
environment?: ServerEnvironment;
|
|
935
|
+
/** Served to anyone who asks, as it is: pictures, a favicon, what a page fetches in the browser. */
|
|
906
936
|
publicDir?: string;
|
|
937
|
+
/**
|
|
938
|
+
* The project's own data, never served as files: a provider resolved on the server (`runtime: 'server'`) whose
|
|
939
|
+
* `query` is `/data/<file>` reads `<dataDir>/<file>`, and the page arrives with it. Nobody downloads the folder; what
|
|
940
|
+
* a provider reads goes into the page it renders, though — data a page must not carry is a server action's to read,
|
|
941
|
+
* answering only what is shown.
|
|
942
|
+
*/
|
|
943
|
+
dataDir?: string;
|
|
907
944
|
static?: Record<string, string>;
|
|
908
945
|
devMode?: boolean;
|
|
909
946
|
/**
|
|
@@ -976,12 +1013,13 @@ export type SSRServerConfig = {
|
|
|
976
1013
|
/** Write endpoint for server-driven providers. Absent means the server serves reads only. */
|
|
977
1014
|
action?: SSRActionConfig;
|
|
978
1015
|
/**
|
|
979
|
-
*
|
|
980
|
-
*
|
|
981
|
-
*
|
|
1016
|
+
* The server's code: its own (`native`), the server halves of the plugins it ships (`plugins`, by plugin type), the
|
|
1017
|
+
* runner the spaces' code runs on, and the ceilings. Built by `@plitzi/sdk-server/functions` (`loadFunctions`), and
|
|
1018
|
+
* checked as the server starts.
|
|
982
1019
|
*/
|
|
983
1020
|
functions?: {
|
|
984
1021
|
native?: unknown[];
|
|
1022
|
+
plugins?: Record<string, unknown>;
|
|
985
1023
|
runner?: unknown;
|
|
986
1024
|
limits?: Record<string, number>;
|
|
987
1025
|
};
|
|
@@ -1131,6 +1169,12 @@ export type SSRContext = {
|
|
|
1131
1169
|
* refresh is done, and handed on only to a page whose debugging is authorized.
|
|
1132
1170
|
*/
|
|
1133
1171
|
actionRuns?: ActionRunSummary[];
|
|
1172
|
+
/**
|
|
1173
|
+
* What a refresh of server data asked for beside the page's own address (`/_rsc?location=…&q=…`): a provider's
|
|
1174
|
+
* `input`, a page window. What the provider asks for this time, so it wins over the `input` the element was saved
|
|
1175
|
+
* with — the query string of the page does not.
|
|
1176
|
+
*/
|
|
1177
|
+
rscParams?: Record<string, string>;
|
|
1134
1178
|
};
|
|
1135
1179
|
export type SSRServer = {
|
|
1136
1180
|
listen: (port: number, host?: string) => void;
|
|
@@ -1142,6 +1186,13 @@ export type SSRServer = {
|
|
|
1142
1186
|
* calls once it wrote the new documents, instead of restarting the server. Nothing otherwise.
|
|
1143
1187
|
*/
|
|
1144
1188
|
reloadPages: () => void;
|
|
1189
|
+
/**
|
|
1190
|
+
* The server halves of the plugins this server ships (`functions.plugins`), replaced while it runs: what a development
|
|
1191
|
+
* server does when a plugin's `functions/` change. `definition` is what `loadFunctions` loads; none takes it away.
|
|
1192
|
+
*/
|
|
1193
|
+
readonly functions: {
|
|
1194
|
+
setPlugin: (plugin: string, definition: unknown) => void;
|
|
1195
|
+
};
|
|
1145
1196
|
};
|
|
1146
1197
|
/** A key/value store with per-entry expiry, backing the OAuth layer's short-lived protocol state (registered
|
|
1147
1198
|
* clients, authorization codes, refresh grants). Values are opaque strings the SDK serialises itself. A
|
|
@@ -101,6 +101,12 @@ export type CommonState = {
|
|
|
101
101
|
href: string;
|
|
102
102
|
currentPageId: string;
|
|
103
103
|
navigate: (url: string, isExternal?: boolean) => void;
|
|
104
|
+
/**
|
|
105
|
+
* Where a navigation is going while it waits for the destination's server data — `''` when none is. A link to a
|
|
106
|
+
* page resolved on the server asks for that page's data before it goes, and the page on screen stays until then:
|
|
107
|
+
* this is what a loading bar for it reads.
|
|
108
|
+
*/
|
|
109
|
+
pendingLocation?: string;
|
|
104
110
|
};
|
|
105
111
|
};
|
|
106
112
|
/** Not document state and not server data: the surface the schema is being rendered on. `previewMode` and
|
|
@@ -209,6 +215,19 @@ export type RscState = {
|
|
|
209
215
|
* compare this against where the visitor actually is, and a mismatch means "not mine yet" rather than "gone".
|
|
210
216
|
*/
|
|
211
217
|
location?: string;
|
|
218
|
+
/**
|
|
219
|
+
* The elements a refresh in flight is asking about for the page on screen, by id — `*` for the whole payload.
|
|
220
|
+
*
|
|
221
|
+
* What makes a server provider's `isLoading` true while it is asked again (`performQuery`, `refreshSeconds`, a page
|
|
222
|
+
* of a pager), as a browser provider's is while it refetches. A navigation's prefetch is for another page, and
|
|
223
|
+
* marks nothing on this one.
|
|
224
|
+
*/
|
|
225
|
+
refreshing?: Record<string, boolean>;
|
|
226
|
+
/**
|
|
227
|
+
* Names this SDK root, so the refreshes asked through any store under it — each element writes through a scoped store
|
|
228
|
+
* of its own — are known to each other: one request per question, the newest question winning.
|
|
229
|
+
*/
|
|
230
|
+
instance?: string;
|
|
212
231
|
};
|
|
213
232
|
export type BuilderState = CommonState & {
|
|
214
233
|
collaboration: {
|
|
@@ -233,12 +252,6 @@ export type BuilderState = CommonState & {
|
|
|
233
252
|
queryParams: QueryParams;
|
|
234
253
|
hostname: string;
|
|
235
254
|
};
|
|
236
|
-
/**
|
|
237
|
-
* The builder's OWN feature flags — Plitzi's, not the space's: which parts of the editor this person is shown, as the
|
|
238
|
-
* platform resolved them for them when the editor opened (`PlatformFlags` in the builder's first query). Never
|
|
239
|
-
* authored, never published.
|
|
240
|
-
*/
|
|
241
|
-
platformFlags?: Record<string, boolean>;
|
|
242
255
|
displayMode: DisplayMode;
|
|
243
256
|
selector?: string;
|
|
244
257
|
styleSelector?: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './NavigationTypes';
|
|
|
11
11
|
export * from './CollectionTypes';
|
|
12
12
|
export * from './ConnectorTypes';
|
|
13
13
|
export * from './ActionTypes';
|
|
14
|
+
export * from './DataTypes';
|
|
14
15
|
export * from './FunctionTypes';
|
|
15
16
|
export * from './RealtimeTypes';
|
|
16
17
|
export * from './ComponentTypes';
|
|
@@ -23,6 +24,4 @@ export * from './SpaceTypes';
|
|
|
23
24
|
export * from './DevToolsTypes';
|
|
24
25
|
export * from './StoreTypes';
|
|
25
26
|
export * from './ThemeTypes';
|
|
26
|
-
export * from './McpTypes';
|
|
27
27
|
export * from './ServerTypes';
|
|
28
|
-
export * from './AITypes';
|