@rizom/brain 0.2.0-alpha.6 → 0.2.0-alpha.60

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 (40) hide show
  1. package/README.md +1 -1
  2. package/dist/brain.js +4762 -26509
  3. package/dist/deploy.d.ts +17 -26
  4. package/dist/deploy.js +25 -25
  5. package/dist/deploy.js.map +4 -4
  6. package/dist/entities.d.ts +561 -0
  7. package/dist/entities.js +172 -0
  8. package/dist/entities.js.map +242 -0
  9. package/dist/index.d.ts +65 -0
  10. package/dist/index.js +5 -0
  11. package/dist/index.js.map +11 -0
  12. package/dist/interfaces.d.ts +923 -0
  13. package/dist/interfaces.js +172 -0
  14. package/dist/interfaces.js.map +209 -0
  15. package/dist/plugins.d.ts +1195 -0
  16. package/dist/plugins.js +178 -0
  17. package/dist/plugins.js.map +294 -0
  18. package/dist/seed-content/relay/README.md +28 -371
  19. package/dist/seed-content/relay/anchor-profile/anchor-profile.md +8 -11
  20. package/dist/seed-content/relay/brain-character/brain-character.md +5 -4
  21. package/dist/seed-content/relay/site-content/about/about.md +20 -0
  22. package/dist/seed-content/relay/site-content/home/diagram.md +184 -0
  23. package/dist/seed-content/relay/site-info/site-info.md +11 -1
  24. package/dist/services.d.ts +601 -0
  25. package/dist/services.js +172 -0
  26. package/dist/services.js.map +242 -0
  27. package/dist/site.d.ts +56 -157
  28. package/dist/site.js +323 -463
  29. package/dist/site.js.map +131 -249
  30. package/dist/templates.d.ts +302 -0
  31. package/dist/templates.js +172 -0
  32. package/dist/templates.js.map +206 -0
  33. package/dist/themes.d.ts +5 -44
  34. package/dist/themes.js +91 -8
  35. package/dist/themes.js.map +2 -2
  36. package/package.json +35 -4
  37. package/templates/deploy/scripts/provision-server.ts +109 -0
  38. package/templates/deploy/scripts/update-dns.ts +65 -0
  39. package/templates/deploy/scripts/write-ssh-key.ts +17 -0
  40. package/tsconfig.instance.json +31 -0
package/dist/site.d.ts CHANGED
@@ -1,174 +1,73 @@
1
- /**
2
- * ⚠️ TEMPORARY HAND-WRITTEN PUBLIC API SURFACE ⚠️
3
- *
4
- * This file is the **public API contract** for `@rizom/brain/site`.
5
- *
6
- * It is hand-maintained as a stopgap because both auto-bundlers we
7
- * tried (`dts-bundle-generator` and `rollup-plugin-dts`) choke on the
8
- * size and edge cases of the internal `@brains/*` workspace type
9
- * graph. See `docs/plans/external-plugin-api.md` for
10
- * the longer story.
11
- *
12
- * **Sync rules:**
13
- * - When the runtime shape of `SitePackage`, `personalSitePlugin`,
14
- * `professionalSitePlugin`, `PersonalLayout`, `ProfessionalLayout`,
15
- * or the route exports changes, this file MUST be updated in the
16
- * same commit.
17
- * - `Plugin` and `RouteDefinitionInput` are deliberately opaque
18
- * pass-throughs — consumers receive them, hand them back, and
19
- * never introspect. Do NOT expand them to mirror internal shapes.
20
- * - `EntityDisplayEntry` is the exception: consumers _construct_ it
21
- * in their `SitePackage`, so its fields must mirror the canonical
22
- * `EntityDisplayEntry` in `@brains/plugins` exactly. Likewise,
23
- * `Plugin["type"]` must mirror the `PluginType` union in
24
- * `@brains/plugins`. Update both here whenever those change.
25
- * - The runtime side (`../entries/site.ts`) re-exports the real
26
- * implementations from `@brains/*`. The .js bundle produced by
27
- * `scripts/build.ts` is what consumers actually execute. This
28
- * .d.ts file is what their tsc sees. They live in separate
29
- * directories so TypeScript doesn't shadow one with the other.
30
- *
31
- * **Replacement plan:** when the type graph stabilizes (post-v0.1.0)
32
- * and a robust .d.ts bundling story exists (api-extractor with
33
- * curated entry points, or first-party tooling), this file is
34
- * deleted and the build script generates it from `site.ts` instead.
35
- *
36
- * Tracked in `docs/plans/external-plugin-api.md` Phase 1.
37
- */
1
+ import { ComponentType } from 'preact';
38
2
 
39
- import type { ComponentType } from "preact";
3
+ /** Curated public site authoring surface for @rizom/brain/site. */
40
4
 
41
5
  /**
42
6
  * Opaque plugin marker. Consumers receive plugin instances via
43
- * `personalSitePlugin(config)` / `professionalSitePlugin(config)` and
44
- * pass them along to brain.yaml / brain definitions; they do not
45
- * introspect the shape themselves.
7
+ * `personalSitePlugin(config)` / `professionalSitePlugin(config)` and pass
8
+ * them along to brain definitions; they do not introspect the shape.
46
9
  */
47
- export interface Plugin {
48
- readonly id: string;
49
- readonly version: string;
50
- readonly type: "core" | "entity" | "service" | "interface";
51
- readonly packageName: string;
10
+ interface Plugin {
11
+ readonly id: string;
12
+ readonly version: string;
13
+ readonly type: "core" | "entity" | "service" | "interface";
14
+ readonly packageName: string;
52
15
  }
53
-
54
16
  /**
55
17
  * Opaque route definition. Consumers receive route exports from
56
- * `@rizom/brain/site` and place them on the `SitePackage.routes`
57
- * field verbatim — they do not construct or modify the shape.
18
+ * `@rizom/brain/site` and place them on `SitePackage.routes` verbatim.
58
19
  */
59
- export interface RouteDefinitionInput {
60
- readonly path: string;
61
- readonly [key: string]: unknown;
20
+ interface RouteDefinitionInput {
21
+ readonly path: string;
22
+ readonly [key: string]: unknown;
62
23
  }
63
-
64
24
  /**
65
- * Per-entity-type display metadata. Used by the dynamic route
66
- * generator to produce auto-generated list/detail pages for
67
- * registered entity plugins.
25
+ * Per-entity-type display metadata used by generated list/detail routes.
68
26
  */
69
- export interface EntityDisplayEntry {
70
- /** Human-readable singular label, e.g. "Post" */
71
- label: string;
72
- /** Plural name override (defaults to `${label}s`) */
73
- pluralName?: string;
74
- /** Layout name override (defaults to "default") */
75
- layout?: string;
76
- /** Enable pagination for list pages */
77
- paginate?: boolean;
78
- /** Items per page (default: 10) */
79
- pageSize?: number;
80
- navigation?: {
81
- /** Whether to show this entity in navigation */
82
- show?: boolean;
83
- /** Which navigation slot to render in */
84
- slot?: "primary" | "secondary";
85
- /** Sort priority within the slot (lower comes first) */
86
- priority?: number;
87
- };
27
+ interface EntityDisplayEntry {
28
+ /** Human-readable singular label, e.g. "Post". */
29
+ label: string;
30
+ /** Plural name override; defaults to `${label}s`. */
31
+ pluralName?: string;
32
+ /** Layout name override; defaults to "default". */
33
+ layout?: string;
34
+ /** Enable pagination for list pages. */
35
+ paginate?: boolean;
36
+ /** Items per page; defaults to 10. */
37
+ pageSize?: number;
38
+ navigation?: {
39
+ /** Whether to show this entity in navigation. */
40
+ show?: boolean;
41
+ /** Which navigation slot to render in. */
42
+ slot?: "primary" | "secondary";
43
+ /** Sort priority within the slot; lower comes first. */
44
+ priority?: number;
45
+ };
88
46
  }
89
-
90
47
  /**
91
- * A site package bundles everything the site-builder needs for site
92
- * structure: layout components, hand-written routes, the site plugin
93
- * factory, and per-entity display metadata.
94
- *
95
- * Themes are resolved separately by the framework.
96
- *
97
- * @example
98
- * ```ts
99
- * import {
100
- * personalSitePlugin,
101
- * PersonalLayout,
102
- * routes,
103
- * } from "@rizom/brain/site";
104
- * import type { Plugin, SitePackage } from "@rizom/brain/site";
105
- *
106
- * const site: SitePackage = {
107
- * layouts: { default: PersonalLayout },
108
- * routes,
109
- * plugin: (config) => personalSitePlugin(config ?? {}),
110
- * entityDisplay: {
111
- * post: { label: "Post" },
112
- * },
113
- * };
114
- *
115
- * export default site;
116
- * ```
48
+ * A site package bundles layout components, hand-written routes, the site
49
+ * plugin factory, and per-entity display metadata. Themes are resolved
50
+ * separately by the framework.
117
51
  */
118
- export interface SitePackage {
119
- /** Layout components keyed by name — at minimum "default" is required */
120
- layouts: Record<string, unknown>;
121
- /** Hand-written route definitions */
122
- routes: RouteDefinitionInput[];
123
- /** Site plugin factory */
124
- plugin: (config?: Record<string, unknown>) => Plugin;
125
- /** Per-entity display metadata */
126
- entityDisplay: Record<string, EntityDisplayEntry>;
127
- /** Static assets to write to the output directory */
128
- staticAssets?: Record<string, string>;
52
+ interface SitePackage<TPluginConfig = Record<string, unknown>> {
53
+ /** Layout components keyed by name — at minimum "default" is required. */
54
+ layouts: Record<string, unknown>;
55
+ /** Hand-written route definitions. */
56
+ routes: RouteDefinitionInput[];
57
+ /** Site plugin factory. */
58
+ plugin: (config?: TPluginConfig) => Plugin;
59
+ /** Per-entity display metadata. */
60
+ entityDisplay: Record<string, EntityDisplayEntry>;
61
+ /** Static assets to write to the output directory. */
62
+ staticAssets?: Record<string, string>;
129
63
  }
64
+ declare const PersonalLayout: ComponentType<Record<string, unknown>>;
65
+ declare function personalSitePlugin(config?: Record<string, unknown>): Plugin;
66
+ declare const routes: RouteDefinitionInput[];
67
+ declare const personalRoutes: RouteDefinitionInput[];
68
+ declare const ProfessionalLayout: ComponentType<Record<string, unknown>>;
69
+ declare function professionalSitePlugin(config?: Record<string, unknown>): Plugin;
70
+ declare const professionalRoutes: RouteDefinitionInput[];
130
71
 
131
- /**
132
- * Personal site layout a Preact component used as the default
133
- * layout in a `SitePackage.layouts` map. Renders a clean
134
- * blog-focused page structure with header, content, and footer.
135
- */
136
- export const PersonalLayout: ComponentType<Record<string, unknown>>;
137
-
138
- /**
139
- * Personal site plugin factory. Registers templates, datasources,
140
- * and schema extensions needed by the personal layout. Pass the
141
- * returned plugin via `SitePackage.plugin`.
142
- */
143
- export function personalSitePlugin(config?: Record<string, unknown>): Plugin;
144
-
145
- /**
146
- * Hand-written route definitions for the personal layout
147
- * (homepage, about, etc.). Place verbatim on `SitePackage.routes`.
148
- */
149
- export const routes: RouteDefinitionInput[];
150
-
151
- /**
152
- * Alias for the personal site routes. Prefer this in new code when you
153
- * want to be explicit about which layout family you are pairing.
154
- */
155
- export const personalRoutes: RouteDefinitionInput[];
156
-
157
- /**
158
- * Professional site layout — a Preact component used as the default
159
- * layout in a `SitePackage.layouts` map for professional/editorial sites.
160
- */
161
- export const ProfessionalLayout: ComponentType<Record<string, unknown>>;
162
-
163
- /**
164
- * Professional site plugin factory. Registers templates, datasources,
165
- * and schema extensions needed by the professional layout.
166
- */
167
- export function professionalSitePlugin(
168
- config?: Record<string, unknown>,
169
- ): Plugin;
170
-
171
- /**
172
- * Hand-written route definitions for the professional layout.
173
- */
174
- export const professionalRoutes: RouteDefinitionInput[];
72
+ export { PersonalLayout, ProfessionalLayout, personalRoutes, personalSitePlugin, professionalRoutes, professionalSitePlugin, routes };
73
+ export type { EntityDisplayEntry, Plugin, RouteDefinitionInput, SitePackage };