@pexis/core 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/AGENTS.md +53 -10
  2. package/API.md +6 -5
  3. package/README.md +1 -1
  4. package/api.json +5951 -0
  5. package/dist/app.d.ts +77 -3
  6. package/dist/app.js +207 -31
  7. package/dist/app.js.map +1 -1
  8. package/dist/components.d.ts +54 -4
  9. package/dist/components.js +34 -3
  10. package/dist/components.js.map +1 -1
  11. package/dist/context.d.ts +27 -2
  12. package/dist/context.js +18 -2
  13. package/dist/context.js.map +1 -1
  14. package/dist/cors.d.ts +14 -0
  15. package/dist/cors.js +8 -0
  16. package/dist/cors.js.map +1 -1
  17. package/dist/csrf.d.ts +9 -0
  18. package/dist/csrf.js +9 -0
  19. package/dist/csrf.js.map +1 -1
  20. package/dist/form.d.ts +21 -3
  21. package/dist/form.js +38 -4
  22. package/dist/form.js.map +1 -1
  23. package/dist/host.d.ts +6 -1
  24. package/dist/host.js +6 -1
  25. package/dist/host.js.map +1 -1
  26. package/dist/html.d.ts +46 -5
  27. package/dist/html.js +112 -5
  28. package/dist/html.js.map +1 -1
  29. package/dist/index.d.ts +2 -2
  30. package/dist/index.js.map +1 -1
  31. package/dist/jsx-runtime.d.ts +32 -0
  32. package/dist/jsx-runtime.js +16 -0
  33. package/dist/jsx-runtime.js.map +1 -1
  34. package/dist/page.d.ts +74 -1
  35. package/dist/page.js +48 -5
  36. package/dist/page.js.map +1 -1
  37. package/dist/rate-limit.d.ts +46 -0
  38. package/dist/rate-limit.js +19 -0
  39. package/dist/rate-limit.js.map +1 -1
  40. package/dist/registry.d.ts +126 -3
  41. package/dist/registry.js +53 -1
  42. package/dist/registry.js.map +1 -1
  43. package/dist/schema.d.ts +129 -3
  44. package/dist/schema.js +80 -7
  45. package/dist/schema.js.map +1 -1
  46. package/dist/security.d.ts +38 -2
  47. package/dist/security.js +44 -9
  48. package/dist/security.js.map +1 -1
  49. package/dist/styles.d.ts +37 -2
  50. package/dist/styles.js +32 -2
  51. package/dist/styles.js.map +1 -1
  52. package/dist/types.d.ts +163 -19
  53. package/dist/urls.d.ts +8 -1
  54. package/dist/urls.js +8 -1
  55. package/dist/urls.js.map +1 -1
  56. package/package.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"security.js","sourceRoot":"","sources":["../src/security.ts"],"names":[],"mappings":"AAGA,gFAAgF;AAChF,iEAAiE;AAEjE,MAAM,CAAC,MAAM,sBAAsB,GAAG,SAAS,CAAC;AAEhD,MAAM,OAAO,SAAU,SAAQ,KAAK;IACzB,MAAM,CAAkB;IACjC,YAAY,MAAuB,EAAE,OAAe;QAClD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,4FAA4F;AAC5F,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAgB,EAAE,GAAW;IAC9D,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACvD,IAAI,QAAQ,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,GAAG;QAAE,MAAM,IAAI,SAAS,CAAC,GAAG,EAAE,mCAAmC,GAAG,SAAS,CAAC,CAAC;IAC3H,IAAI,CAAC,OAAO,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;IACxC,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,SAAS,CAAC;QACR,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QAC5C,IAAI,IAAI;YAAE,MAAM;QAChB,KAAK,IAAI,KAAK,CAAC,UAAU,CAAC;QAC1B,IAAI,KAAK,G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IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;SACxB,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,GAAG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;SAClE,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,oCAAoC;AACpC,MAAM,UAAU,uBAAuB,CAAC,OAAgB,EAAE,MAAc,EAAE,GAAkB;IAC1F,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAC;IACjD,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,iCAAiC,CAAC,CAAC;IAClE,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;IAC7C,IAAI,GAAG;QAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;IACrD,8EAA8E;IAC9E,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC;QAAE,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,kBAAkB,CAAC,CAAC;AAClG,CAAC"}
package/dist/styles.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Context } from './types.js';
2
+ /** Scoped styles from css``: used as a class, and sent only with pages that use them. */
2
3
  export interface StyleSheet {
3
4
  /** Type-level brand only; the runtime check uses a symbol. */
4
5
  readonly ' pexisStyle': true;
@@ -6,22 +7,56 @@ export interface StyleSheet {
6
7
  readonly className: string;
7
8
  /** The scoped, minified CSS. */
8
9
  readonly text: string;
10
+ /** The class name, so the sheet can be used where a class string is expected. */
9
11
  toString(): string;
10
12
  }
13
+ /** Site-wide styles from globalCss``, for createApp({ styles }). */
11
14
  export interface GlobalStyle {
15
+ /** Type-level brand only. */
12
16
  readonly ' pexisGlobalStyle': true;
17
+ /** The minified CSS. */
13
18
  readonly text: string;
14
19
  }
20
+ /**
21
+ * Whether a value is a scoped style sheet from css``.
22
+ *
23
+ * @category plugins
24
+ * @param v Anything.
25
+ */
15
26
  export declare function isStyleSheet(v: unknown): v is StyleSheet;
16
27
  /**
17
28
  * Removes comments and line indentation. Deliberately conservative: it never
18
29
  * touches spaces inside a line, so CSS strings such as content: "a; b" keep
19
30
  * their exact text. Compression on the wire does the rest.
31
+ *
32
+ * @category plugins
33
+ * @param input CSS.
20
34
  */
21
35
  export declare function minifyCss(input: string): string;
22
- /** Scoped component styles. Use the result as a class: class={card} or class={[card, other]}. */
36
+ /**
37
+ * Scoped component styles. Use the result as a class: class={card} or
38
+ * class={[card, other]}. Only pages that render it receive its CSS.
39
+ *
40
+ * @param strings The CSS's literal parts.
41
+ * @param values Values placed into the CSS as text.
42
+ * @example
43
+ * ```tsx
44
+ * const card = css`padding: 1rem; border: 1px solid #ddd;`;
45
+ * export const Card = ({ children }) => <div class={card}>{children}</div>;
46
+ * ```
47
+ */
23
48
  export declare function css(strings: TemplateStringsArray, ...values: unknown[]): StyleSheet;
24
- /** Site-wide styles, included on every page: pass to createApp({ styles }). */
49
+ /**
50
+ * Site-wide styles, included on every page: pass to createApp({ styles }).
51
+ *
52
+ * @param strings The CSS's literal parts.
53
+ * @param values Values placed into the CSS as text.
54
+ * @example
55
+ * ```ts
56
+ * const base = globalCss`body { font: 16px/1.5 system-ui, sans-serif; margin: 0; }`;
57
+ * createApp({ origin, styles: [base] });
58
+ * ```
59
+ */
25
60
  export declare function globalCss(strings: TemplateStringsArray, ...values: unknown[]): GlobalStyle;
26
61
  /** Records that a sheet was used while rendering the current request. */
27
62
  export declare function trackStyle(sheet: StyleSheet): void;
package/dist/styles.js CHANGED
@@ -18,6 +18,12 @@ const USED = Symbol.for('pexis.used-styles');
18
18
  // globalThis so two copies of the core in one process still agree.
19
19
  const REGISTRY = Symbol.for('pexis.style-registry');
20
20
  const registry = (globalThis[REGISTRY] ??= new Map());
21
+ /**
22
+ * Whether a value is a scoped style sheet from css``.
23
+ *
24
+ * @category plugins
25
+ * @param v Anything.
26
+ */
21
27
  export function isStyleSheet(v) {
22
28
  return typeof v === 'object' && v !== null && STYLE in v;
23
29
  }
@@ -53,6 +59,9 @@ function interpolate(strings, values) {
53
59
  * Removes comments and line indentation. Deliberately conservative: it never
54
60
  * touches spaces inside a line, so CSS strings such as content: "a; b" keep
55
61
  * their exact text. Compression on the wire does the rest.
62
+ *
63
+ * @category plugins
64
+ * @param input CSS.
56
65
  */
57
66
  export function minifyCss(input) {
58
67
  return withoutComments(input)
@@ -81,7 +90,18 @@ function withoutComments(input) {
81
90
  }
82
91
  // Keeps CSS from closing its <style> element.
83
92
  const safeForStyleTag = (text) => text.replace(/<\/(style)/gi, '<\\/$1');
84
- /** Scoped component styles. Use the result as a class: class={card} or class={[card, other]}. */
93
+ /**
94
+ * Scoped component styles. Use the result as a class: class={card} or
95
+ * class={[card, other]}. Only pages that render it receive its CSS.
96
+ *
97
+ * @param strings The CSS's literal parts.
98
+ * @param values Values placed into the CSS as text.
99
+ * @example
100
+ * ```tsx
101
+ * const card = css`padding: 1rem; border: 1px solid #ddd;`;
102
+ * export const Card = ({ children }) => <div class={card}>{children}</div>;
103
+ * ```
104
+ */
85
105
  export function css(strings, ...values) {
86
106
  const body = minifyCss(interpolate(strings, values));
87
107
  const className = `px-${hash(body)}`;
@@ -93,7 +113,17 @@ export function css(strings, ...values) {
93
113
  registry.set(className, sheet);
94
114
  return sheet;
95
115
  }
96
- /** Site-wide styles, included on every page: pass to createApp({ styles }). */
116
+ /**
117
+ * Site-wide styles, included on every page: pass to createApp({ styles }).
118
+ *
119
+ * @param strings The CSS's literal parts.
120
+ * @param values Values placed into the CSS as text.
121
+ * @example
122
+ * ```ts
123
+ * const base = globalCss`body { font: 16px/1.5 system-ui, sans-serif; margin: 0; }`;
124
+ * createApp({ origin, styles: [base] });
125
+ * ```
126
+ */
97
127
  export function globalCss(strings, ...values) {
98
128
  return { text: safeForStyleTag(minifyCss(interpolate(strings, values))) };
99
129
  }
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,sBAAsB;AACtB,qBAAqB;AACrB,uBAAuB;AACvB,OAAO;AACP,kFAAkF;AAClF,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,yEAAyE;AACzE,8DAA8D;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AACxC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAiB7C,8EAA8E;AAC9E,8EAA8E;AAC9E,mEAAmE;AACnE,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AACpD,MAAM,QAAQ,GAA4B,CAAE,UAAuD,CAAC,QAAQ,CAAC,KAAK,IAAI,GAAG,EAAE,CAAC,CAAC;AAE7H,MAAM,UAAU,YAAY,CAAC,CAAU;IACrC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,KAAK,IAAI,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,IAAI,CAAC,IAAY;IACxB,iEAAiE;IACjE,IAAI,CAAC,GAAG,UAAU,CAAC;IACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACxB,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,CAAC,CAAC,KAAK,CAA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AAC;IAC1F,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACjF,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,UAAU,CAAC,KAAK,CAAC,CAAC;QAClB,OAAO,KAAK,CAAC,SAAS,CAAC;IACzB,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjF,MAAM,IAAI,KAAK,CAAC,kEAAkE,OAAO,KAAK,GAAG,CAAC,CAAC;AACrG,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { Markup } from './html.js';
2
2
  import type { Action } from './registry.js';
3
3
  import type { Fields, Infer } from './schema.js';
4
+ /** The app's settings that plugins and the checks read, from createApp(). */
4
5
  export interface AppConfig {
5
6
  /** Public origin, for example https://example.com. Used for canonical URLs, the sitemap and the checks. */
6
7
  readonly origin: string;
@@ -8,10 +9,16 @@ export interface AppConfig {
8
9
  readonly lang: string;
9
10
  /** Severity overrides and extra rules for the build checks. */
10
11
  readonly checks: {
12
+ /** A severity per rule id, or "off". */
11
13
  readonly overrides?: Readonly<Record<string, 'error' | 'warning' | 'off'>>;
14
+ /** The app's own check rules, run with the built-in ones. */
12
15
  readonly rules?: readonly CheckRuleLike[];
13
16
  };
14
17
  }
18
+ /**
19
+ * What `ctx.route` holds: the page, action or plugin route the request
20
+ * matched, the built-in tool list, or nothing.
21
+ */
15
22
  export type RouteMatch = {
16
23
  kind: 'page';
17
24
  page: Page;
@@ -40,10 +47,15 @@ export type RouteMatch = {
40
47
  * declare module '@pexis/core' { interface Context { db: Database } }
41
48
  */
42
49
  export interface Context {
50
+ /** The incoming request. */
43
51
  readonly request: Request;
52
+ /** The request's URL, parsed. */
44
53
  readonly url: URL;
54
+ /** The route's parameters: for "/menu/:dish", `{ dish }`. */
45
55
  params: Record<string, string>;
56
+ /** What the request matched. */
46
57
  route: RouteMatch;
58
+ /** The app's settings: origin, language, checks. */
47
59
  readonly app: AppConfig;
48
60
  /**
49
61
  * Random per-request value for the Content Security Policy. Pexis adds it to
@@ -71,7 +83,9 @@ export interface Context {
71
83
  * type cannot be set here. Redirects use redirect(), not a 3xx status.
72
84
  */
73
85
  readonly response: {
86
+ /** The page's status, such as 410. */
74
87
  status?: number;
88
+ /** Headers added to the response. */
75
89
  readonly headers: Headers;
76
90
  };
77
91
  /**
@@ -83,14 +97,16 @@ export interface Context {
83
97
  /**
84
98
  * Set when an agent acts for a person with a token (see AgentIdentity),
85
99
  * so a permission can tell: permission: (ctx) => !ctx.agent && isStaff(ctx.user).
86
- * Experimental.
100
+ *
101
+ * @experimental
87
102
  */
88
103
  readonly agent?: AgentIdentity;
89
104
  /**
90
105
  * The result of checking an Authorization: Bearer token, set by an
91
106
  * authorization plugin (@pexis/auth/server) only on the routes it protects,
92
107
  * such as /pexis/mcp. Undefined when the request carried no bearer token.
93
- * Experimental.
108
+ *
109
+ * @experimental
94
110
  */
95
111
  bearer?: BearerCheck;
96
112
  /**
@@ -98,19 +114,27 @@ export interface Context {
98
114
  * permission check (as the person making this request, never with more
99
115
  * rights), validation and an action event, but no rate limit, since this
100
116
  * request was already counted. For one team's code to use another team's
101
- * action without reaching into its files. Experimental.
102
- *
103
- * const found = await ctx.call(checkDish, { dish: 'soup' });
104
- * if (!found.ok) return invalid({ dish: found.message });
117
+ * action without reaching into its files.
105
118
  *
106
119
  * A call cannot carry more risk than the request it runs in: a page or a
107
120
  * GET request calls only read actions, an action calls only actions of
108
121
  * the same risk or lower, and an action that needs approval only from one
109
122
  * that needs it too. Breaking these throws, since it is a mistake in code.
123
+ *
124
+ * @experimental
125
+ * @example
126
+ * ```ts
127
+ * const found = await ctx.call(checkDish, { dish: 'soup' });
128
+ * if (!found.ok) return invalid({ dish: found.message });
129
+ * ```
110
130
  */
111
131
  call<F extends Fields>(action: Action<F>, input: Infer<F>): Promise<CallResult>;
112
132
  }
113
- /** A bearer token, checked. Experimental. */
133
+ /**
134
+ * A bearer token, checked.
135
+ *
136
+ * @experimental
137
+ */
114
138
  export type BearerCheck = {
115
139
  readonly ok: true;
116
140
  readonly agent: AgentIdentity;
@@ -120,26 +144,41 @@ export type BearerCheck = {
120
144
  };
121
145
  /**
122
146
  * A write an agent made for a person, with how to reverse it. Given only to
123
- * the one recorder an app installs (api.recordAgentWrites). Experimental.
147
+ * the one recorder an app installs (api.recordAgentWrites).
148
+ *
149
+ * @experimental
124
150
  */
125
151
  export interface AgentWrite {
152
+ /** The action the agent ran. */
126
153
  action: string;
154
+ /** That action's title, for people. */
127
155
  actionTitle: string;
156
+ /** The action that reverses it. */
128
157
  undoAction: string;
158
+ /** The undo action's title, for people. */
129
159
  undoTitle: string;
130
160
  /** The undo action's input, already validated; null when it could not be built, so this one cannot be undone. */
131
161
  undoInput: Record<string, unknown> | null;
162
+ /** The person the agent acted for. */
132
163
  userId: string;
164
+ /** The agent's OAuth client id. */
133
165
  clientId: string;
166
+ /** The grant the agent's token came from. */
134
167
  grantId: string;
135
168
  /** ms since the epoch. */
136
169
  at: number;
170
+ /** When the undo is no longer offered, in ms since the epoch. */
137
171
  expiresAt: number;
138
172
  /** The write's own result message. Untrusted text. */
139
173
  message: string;
140
174
  }
141
- /** Keeps agent writes so the person can undo them; see @pexis/approvals. Experimental. */
175
+ /**
176
+ * Keeps agent writes so the person can undo them; see @pexis/approvals.
177
+ *
178
+ * @experimental
179
+ */
142
180
  export interface AgentWriteRecorder {
181
+ /** Keeps one write. */
143
182
  record(write: AgentWrite): void | Promise<void>;
144
183
  /** An undo action succeeded for a person, from any path: matching writes are undone. */
145
184
  undone(match: {
@@ -148,11 +187,19 @@ export interface AgentWriteRecorder {
148
187
  undoInput: Record<string, unknown>;
149
188
  }): void | Promise<void>;
150
189
  }
151
- /** What ctx.call returns: the same answer an agent gets as JSON. Experimental. */
190
+ /**
191
+ * What ctx.call returns: the same answer an agent gets as JSON.
192
+ *
193
+ * @experimental
194
+ */
152
195
  export type CallResult = {
153
196
  readonly ok: true;
154
197
  readonly message: string;
155
198
  readonly data: unknown;
199
+ readonly link?: {
200
+ readonly href: string;
201
+ readonly text: string;
202
+ };
156
203
  } | {
157
204
  readonly ok: false;
158
205
  readonly outcome: 'invalid';
@@ -165,22 +212,28 @@ export type CallResult = {
165
212
  };
166
213
  /** What the adapter knows about the connection a request came in on. */
167
214
  export interface Connection {
215
+ /** The client's network address: the socket's, or from a proxy header the adapter was told to trust. */
168
216
  clientAddress?: string;
169
217
  /**
170
218
  * Set only by plugin code through api.fetch, never by an adapter: the
171
219
  * request is an agent acting for a person with a token it was granted
172
- * (such as an MCP client signed in through OAuth). Experimental.
220
+ * (such as an MCP client signed in through OAuth).
221
+ *
222
+ * @experimental
173
223
  */
174
224
  agent?: AgentIdentity;
175
225
  }
176
226
  /**
177
227
  * An agent acting for a signed-in person. The core refuses agent requests to
178
228
  * actions that need the person's approval or are for people only, and to
179
- * actions outside the granted scopes. Experimental.
229
+ * actions outside the granted scopes.
230
+ *
231
+ * @experimental
180
232
  */
181
233
  export interface AgentIdentity {
182
234
  /** The person the agent acts for, as the app's sign-in knows them. */
183
235
  readonly user: {
236
+ /** The person's user id. */
184
237
  readonly id: string;
185
238
  };
186
239
  /** Who the agent is, such as the client's metadata URL. */
@@ -193,6 +246,8 @@ export interface AgentIdentity {
193
246
  /**
194
247
  * Maps a request path to the path routing should use, plus context fields,
195
248
  * before routing. Return null to leave the request alone.
249
+ *
250
+ * @category plugins
196
251
  */
197
252
  export type Rewrite = (url: URL) => {
198
253
  pathname: string;
@@ -206,8 +261,11 @@ type Segments<P extends string> = P extends `${infer Head}/${infer Rest}` ? Segm
206
261
  export type PathParams<P extends string> = {
207
262
  [K in Segments<P>]: string;
208
263
  };
264
+ /** A page's head: what search engines, link previews and agents read first. */
209
265
  export interface HeadData {
266
+ /** The page title, for `<title>`. Required and non-empty. */
210
267
  title: string;
268
+ /** The meta description. Required and non-empty. */
211
269
  description: string;
212
270
  /** Absolute URL. Defaults to the app origin plus the request path. */
213
271
  canonical?: string;
@@ -216,41 +274,56 @@ export interface HeadData {
216
274
  /** Extra markup for <head>. */
217
275
  extra?: Markup;
218
276
  }
277
+ /** The context a page's load, head and render receive, with its own route parameters typed. */
219
278
  export type PageContext<P extends string> = Context & {
220
279
  params: PathParams<P>;
221
280
  };
281
+ /** What notFound() returns: answer 404 with the not-found page. */
222
282
  export interface NotFound {
283
+ /** Marks the object as a signal. */
223
284
  readonly pexisSignal: 'not-found';
224
285
  }
286
+ /** What redirect() returns: send the visitor elsewhere. */
225
287
  export interface Redirect {
288
+ /** Marks the object as a signal. */
226
289
  readonly pexisSignal: 'redirect';
290
+ /** Where to send the visitor: a path on this site, or an absolute URL when `external`. */
227
291
  readonly location: string;
292
+ /** The redirect status. */
228
293
  readonly status: 301 | 302 | 303 | 307 | 308;
229
294
  /** Allow a target on another site. Off by default, so user input cannot cause an open redirect. */
230
295
  readonly external: boolean;
231
296
  }
297
+ /** What a page's load() may return to stop rendering: notFound() or redirect(). */
232
298
  export type Signal = NotFound | Redirect;
233
299
  /** A page shown when no page matches (notFound) or a request fails (serverError). */
234
300
  export interface ErrorPage {
301
+ /** The error page's head. */
235
302
  head: HeadData;
236
303
  /** Keep it simple: it is shown when something already went wrong, so it should not load data. */
237
304
  render: (props: {
238
305
  ctx: Context;
239
306
  }) => Markup | null | undefined;
240
307
  }
308
+ /** A layout from defineLayout(): wraps every page's body. */
241
309
  export interface Layout {
310
+ /** Marks the object as a layout. */
242
311
  readonly kind: 'layout';
312
+ /** Renders the shell around a page; must include `<main>` with `children` inside it. */
243
313
  render(props: {
244
314
  children: Markup;
245
315
  ctx: Context;
246
316
  }): Markup | null | undefined;
247
317
  }
318
+ /** What definePage() takes. */
248
319
  export interface PageDefinition<P extends string, D> {
249
320
  /** URLPattern pathname syntax: "/", "/menu", "/menu/:dish", "/docs/*". */
250
321
  path: P;
251
322
  /** Load data for the page. Return notFound() or redirect(url) to stop. */
252
323
  load?: (ctx: PageContext<P>) => D | Signal | Promise<D | Signal>;
324
+ /** The page's title and description, fixed or built from the loaded data. */
253
325
  head: HeadData | ((data: D, ctx: PageContext<P>) => HeadData);
326
+ /** Renders the page's body, inside the layout's `<main>`. */
254
327
  render: (props: {
255
328
  data: D;
256
329
  ctx: PageContext<P>;
@@ -268,31 +341,67 @@ export interface PageDefinition<P extends string, D> {
268
341
  * Sends the head and the start of the layout as soon as load() finishes,
269
342
  * while async components in the page are still working. Put slow data in
270
343
  * async components to benefit. Once streaming has started the status is
271
- * 200: an error after that is shown in the page and logged. Experimental.
344
+ * 200: an error after that is shown in the page and logged.
345
+ *
346
+ * @experimental
272
347
  */
273
348
  stream?: boolean;
274
349
  }
350
+ /** A page, as definePage() returns it. */
275
351
  export interface Page {
352
+ /** Marks the object as a page. */
276
353
  readonly kind: 'page';
354
+ /** The page's path pattern. */
277
355
  readonly path: string;
356
+ /** Whether the path has parameters (":name" or "*"). */
278
357
  readonly hasParams: boolean;
358
+ /** Whether the page is indexed: in the sitemap and the checks. */
279
359
  readonly index: boolean;
360
+ /** The page's own language, if it sets one. */
280
361
  readonly lang: string | undefined;
362
+ /** The page's own layout: undefined for the app's, null for none. */
281
363
  readonly layout: Layout | null | undefined;
364
+ /** The parameter values of every public URL, for paths with parameters. */
282
365
  readonly entries: (() => Record<string, string>[] | Promise<Record<string, string>[]>) | undefined;
366
+ /** Loads the page's data. */
283
367
  readonly load: ((ctx: Context) => unknown) | undefined;
368
+ /** The page's head. */
284
369
  readonly head: HeadData | ((data: unknown, ctx: Context) => HeadData);
370
+ /** Renders the page's body. */
285
371
  readonly render: (props: {
286
372
  data: unknown;
287
373
  ctx: Context;
288
374
  params: Record<string, string>;
289
375
  }) => Markup | null | undefined;
376
+ /** Whether the page streams. */
290
377
  readonly stream: boolean;
291
378
  }
379
+ /**
380
+ * Runs around every request: answer it yourself, or call `next()` for the
381
+ * rest of the app and change what comes back.
382
+ *
383
+ * @category plugins
384
+ */
292
385
  export type Middleware = (ctx: Context, next: () => Promise<Response>) => Promise<Response>;
386
+ /**
387
+ * Answers a plugin route added with api.route().
388
+ *
389
+ * @category plugins
390
+ */
293
391
  export type RouteHandler = (ctx: Context) => Response | Promise<Response>;
392
+ /**
393
+ * Adds markup to a page's `<head>` or the end of its `<body>`, or nothing (null) for this request.
394
+ *
395
+ * @category plugins
396
+ */
294
397
  export type HeadContribution = (ctx: Context) => Markup | null | undefined;
398
+ /**
399
+ * What api.onAction listeners receive for each action call: field names, never values.
400
+ *
401
+ * @category plugins
402
+ */
295
403
  export interface ActionEvent {
404
+ /** The action's name. */
296
405
  action: string;
297
406
  /** ISO timestamp. */
298
407
  at: string;
@@ -300,35 +409,65 @@ export interface ActionEvent {
300
409
  via: 'json' | 'form' | 'call';
301
410
  /** refused: turned away before running (rate limit, wrong method, a body too large or malformed, people only). */
302
411
  outcome: 'done' | 'invalid' | 'forbidden' | 'failed' | 'refused';
412
+ /** The HTTP status the call was answered with. */
303
413
  status: number;
414
+ /** How long the call took, in milliseconds. */
304
415
  durationMs: number;
305
416
  /** Names of the input fields that were sent. Values are never recorded. */
306
417
  fields: string[];
418
+ /** The caller's User-Agent header, if any. */
307
419
  userAgent: string | null;
308
420
  }
309
421
  /**
310
422
  * A build check rule, in the shape @pexis/checks runs. The core only stores
311
423
  * them; see @pexis/checks for the full type.
424
+ *
425
+ * @category plugins
312
426
  */
313
427
  export interface CheckRuleLike {
428
+ /** The rule's id, such as "myplugin/rule-name". */
314
429
  id: string;
430
+ /** Whether it checks each page or the site as a whole. */
315
431
  scope: 'page' | 'site';
432
+ /** The rule's category, such as "a11y" or "seo". */
316
433
  category: string;
434
+ /** How a finding is reported by default. */
317
435
  severity: 'error' | 'warning';
436
+ /** The check itself; see @pexis/checks. */
318
437
  check: (ctx: never) => unknown;
319
438
  }
320
- /** A page in the admin, added by a plugin. Rendered without scripts. */
439
+ /**
440
+ * A page in the admin, added by a plugin. Rendered without scripts.
441
+ *
442
+ * @category plugins
443
+ */
321
444
  export interface AdminPanel {
322
445
  /** URL segment under the admin, such as "tables". */
323
446
  path: string;
324
447
  /** Shown in the admin's navigation and as the page heading. */
325
448
  title: string;
449
+ /** Renders the panel's content, read-only and without scripts. */
326
450
  render(ctx: Context): Markup | Promise<Markup>;
327
451
  }
452
+ /**
453
+ * What a plugin's setup() receives: everything a plugin can add to the app
454
+ * or read from it.
455
+ *
456
+ * @category plugins
457
+ */
328
458
  export interface PluginApi {
459
+ /** The app's settings. */
329
460
  readonly config: AppConfig;
330
- /** Add middleware. Plugin middleware runs before the app's, in plugin order. */
331
- use(middleware: Middleware): void;
461
+ /**
462
+ * Add middleware. Plugin middleware runs before the app's, in plugin order.
463
+ * Middleware that answers some paths itself, with no page or route behind
464
+ * them (an admin under /pexis/admin, Markdown copies at /page.md), says which
465
+ * with `answers`, so app.matches() hands those requests to the app when it
466
+ * is mounted inside another server.
467
+ */
468
+ use(middleware: Middleware, options?: {
469
+ answers?: (url: URL, method: string) => boolean;
470
+ }): void;
332
471
  /** The app's request body limit, in bytes, for plugin routes that read a body. */
333
472
  readonly maxBodyBytes: number;
334
473
  /** Keeps browsers from prefetching paths under this prefix (with navigation.prefetch on), such as "/auth/", where a visit has an effect. */
@@ -347,10 +486,14 @@ export interface PluginApi {
347
486
  onAction(listener: (event: ActionEvent) => void): void;
348
487
  /**
349
488
  * Installs the one recorder of agent writes that declare an undo. Only one
350
- * per app, since records carry values. Experimental.
489
+ * per app, since records carry values.
490
+ *
491
+ * @experimental
351
492
  */
352
493
  recordAgentWrites(recorder: AgentWriteRecorder): void;
494
+ /** The app's pages, plugins' included. */
353
495
  pages(): readonly Page[];
496
+ /** The app's actions, plugins' included. */
354
497
  actions(): readonly Action[];
355
498
  /** Whether a plugin with this name is installed. Reliable at request time, when every plugin is set up. */
356
499
  hasPlugin(name: string): boolean;
@@ -386,13 +529,14 @@ export interface PluginApi {
386
529
  * so the inner request is rate-limited as the same client.
387
530
  */
388
531
  fetch(request: Request, connection?: Connection): Promise<Response>;
389
- /** Render a page's HTML response directly, skipping middleware. Null if no page matches. */
390
- renderPage(path: string, ctx: Context): Promise<Response | null>;
391
532
  }
533
+ /** A plugin, from definePlugin(): adds features to an app through the plugin API. */
392
534
  export interface Plugin {
535
+ /** A unique name: lowercase letters, digits and hyphens. */
393
536
  readonly name: string;
394
537
  /** Names of plugins that must come before this one. */
395
538
  readonly requires?: readonly string[];
539
+ /** Runs once, when the app is created, in the order plugins are listed. */
396
540
  setup(api: PluginApi): void;
397
541
  }
398
542
  export {};
package/dist/urls.d.ts CHANGED
@@ -1,10 +1,17 @@
1
1
  /** Attributes whose value is a URL the browser may navigate to or load. */
2
2
  export declare const URL_ATTRIBUTES: Set<string>;
3
- /** What a blocked URL is replaced with: harmless, and easy to find in the page. */
3
+ /**
4
+ * What a blocked URL is replaced with: harmless, and easy to find in the page.
5
+ *
6
+ * @category plugins
7
+ */
4
8
  export declare const BLOCKED_URL = "about:blank#blocked";
5
9
  /**
6
10
  * True for javascript: URLs, including disguised ones. Browsers ignore
7
11
  * leading spaces and control characters and remove tabs and newlines
8
12
  * anywhere in the scheme, so "java\tscript:" still runs; normalize first.
13
+ *
14
+ * @category plugins
15
+ * @param value A URL, as written in an attribute.
9
16
  */
10
17
  export declare function isScriptUrl(value: string): boolean;
package/dist/urls.js CHANGED
@@ -2,12 +2,19 @@
2
2
  // html`` template, so both ways of writing markup block the same things.
3
3
  /** Attributes whose value is a URL the browser may navigate to or load. */
4
4
  export const URL_ATTRIBUTES = new Set(['href', 'src', 'action', 'formaction', 'xlink:href', 'poster', 'cite', 'background', 'ping']);
5
- /** What a blocked URL is replaced with: harmless, and easy to find in the page. */
5
+ /**
6
+ * What a blocked URL is replaced with: harmless, and easy to find in the page.
7
+ *
8
+ * @category plugins
9
+ */
6
10
  export const BLOCKED_URL = 'about:blank#blocked';
7
11
  /**
8
12
  * True for javascript: URLs, including disguised ones. Browsers ignore
9
13
  * leading spaces and control characters and remove tabs and newlines
10
14
  * anywhere in the scheme, so "java\tscript:" still runs; normalize first.
15
+ *
16
+ * @category plugins
17
+ * @param value A URL, as written in an attribute.
11
18
  */
12
19
  export function isScriptUrl(value) {
13
20
  const normalized = value.replace(/^[\u0000-\u0020]+/, '').replace(/[\t\n\r]/g, '');
package/dist/urls.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"urls.js","sourceRoot":"","sources":["../src/urls.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,yEAAyE;AAEzE,2EAA2E;AAC3E,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;AAErI,mFAAmF;AACnF,MAAM,CAAC,MAAM,WAAW,GAAG,qBAAqB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACnF,OAAO,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAC1C,CAAC"}
1
+ {"version":3,"file":"urls.js","sourceRoot":"","sources":["../src/urls.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,yEAAyE;AAEzE,2EAA2E;AAC3E,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;AAErI;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,qBAAqB,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACnF,OAAO,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAC1C,CAAC"}