@selfhelp/shared 1.2.0 → 1.2.2
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 +231 -182
- package/README.md +292 -287
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/plugin-sdk/index.d.mts +26 -12
- package/dist/plugin-sdk/index.d.ts +26 -12
- package/dist/registry/index.d.mts +2 -2
- package/dist/registry/index.d.ts +2 -2
- package/dist/{styles.registry-C3bux91U.d.mts → styles.registry-DVGOrw1_.d.mts} +1 -0
- package/dist/{styles.registry-Cr961HQ0.d.ts → styles.registry-wVJpIkAh.d.ts} +1 -0
- package/package.json +93 -93
- package/src/plugin-sdk/registry.ts +22 -11
- package/src/types/styles/auth.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,182 +1,231 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- `
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
- `
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
`
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
the
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-FileCopyrightText: 2026 Humdek, University of Bern
|
|
3
|
+
SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
# Changelog
|
|
7
|
+
|
|
8
|
+
All notable changes to `@selfhelp/shared` will be documented in this file.
|
|
9
|
+
|
|
10
|
+
This project follows semantic versioning.
|
|
11
|
+
|
|
12
|
+
## [1.2.1] - 2026-05-28
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- `IPluginRegistry` in `@selfhelp/shared/plugin-sdk` is now back in
|
|
17
|
+
sync with the canonical `plugin-registry.schema.json` shipped by
|
|
18
|
+
`sh-selfhelp_backend`. The root version field is the schema's
|
|
19
|
+
`schemaVersion: '1.0'` again (the `registryVersion: number` rename
|
|
20
|
+
introduced in `1.0.4` mis-described the wire format). Added the two
|
|
21
|
+
other canonical root fields, `baseUrl` and `publisher`, as optional
|
|
22
|
+
so the type matches what `scripts/publish-to-registry.mjs` actually
|
|
23
|
+
emits. The pre-existing `name` / `homepage` / `trustKey` /
|
|
24
|
+
`channels` properties are kept as optional legacy helpers and
|
|
25
|
+
flagged in the JSDoc as not part of the canonical schema; they will
|
|
26
|
+
be removed in the next major release once the deeper drift in
|
|
27
|
+
`IPluginRegistryEntry` / `IPluginRegistryVersionEntry` is rewritten
|
|
28
|
+
to match the canonical schema.
|
|
29
|
+
- `npm run check:schemas` is green again — previously failed because
|
|
30
|
+
`schemaVersion` was missing from the TS mirror after the `1.0.4`
|
|
31
|
+
rename.
|
|
32
|
+
|
|
33
|
+
### Migration notes
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
// before (1.2.0, broken)
|
|
37
|
+
const registry: IPluginRegistry = {
|
|
38
|
+
registryVersion: 1,
|
|
39
|
+
name: 'my-registry',
|
|
40
|
+
plugins: [],
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// after (1.2.1, matches plugin-registry.schema.json)
|
|
44
|
+
const registry: IPluginRegistry = {
|
|
45
|
+
schemaVersion: '1.0',
|
|
46
|
+
publisher: { name: 'my-registry' },
|
|
47
|
+
plugins: [],
|
|
48
|
+
};
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
No runtime/installation behaviour changed — this only corrects the
|
|
52
|
+
shape of the published TS contract that plugin authors compile
|
|
53
|
+
against. The backend's `RegistryClient` already reads the canonical
|
|
54
|
+
wire format, so installed registries keep working.
|
|
55
|
+
|
|
56
|
+
## [1.2.0] - 2026-05-28
|
|
57
|
+
|
|
58
|
+
### Added
|
|
59
|
+
|
|
60
|
+
- Canonical plugin runtime-shim contract exported from
|
|
61
|
+
`@selfhelp/shared/plugin-sdk`. This is the single source of truth
|
|
62
|
+
every consumer (host import map, host `globalThis` stash, host
|
|
63
|
+
`/api/plugins/runtime-shim/*` BFF route, plugin Vite build, plugin
|
|
64
|
+
dev-runtime server) now reads from, so the three pieces cannot
|
|
65
|
+
drift apart again:
|
|
66
|
+
- `PLUGIN_RUNTIME_SHIM_SPECIFIERS` — readonly list of every bare
|
|
67
|
+
specifier the host shims to plugins. Includes the previously
|
|
68
|
+
missing `react/jsx-dev-runtime` (needed by Vite's React plugin in
|
|
69
|
+
dev mode) and `@mantine/notifications` (consumed by plugins that
|
|
70
|
+
show toast notifications), so dev-server bundles can resolve them
|
|
71
|
+
instead of bundling a second copy of React or Mantine.
|
|
72
|
+
- `PLUGIN_RUNTIME_SHIM_BASE_PATH` — `/api/plugins/runtime-shim/`
|
|
73
|
+
constant; the host frontend owns this route.
|
|
74
|
+
- `PLUGIN_RUNTIME_GLOBAL_KEY` — `__SELFHELP_RUNTIME__` constant.
|
|
75
|
+
- `PLUGIN_RUNTIME_IMPORT_MAP` — frozen `Record` derived from the
|
|
76
|
+
specifier list, ready to be `JSON.stringify`ed into the host's
|
|
77
|
+
`<script type="importmap">` tag.
|
|
78
|
+
- `buildPluginRuntimeShimPath(specifier)` — string builder for a
|
|
79
|
+
single specifier.
|
|
80
|
+
- `isPluginRuntimeShimSpecifier(value)` — runtime type guard.
|
|
81
|
+
- `TPluginRuntimeShimSpecifier` — string-literal type union of the
|
|
82
|
+
supported specifiers.
|
|
83
|
+
- The plugin SDK contract version bumps from `1.1` to `1.2` to
|
|
84
|
+
reflect the additive surface. Hosts on SDK `1.2+` still accept
|
|
85
|
+
plugins declaring `pluginApiVersion: "1.1"`, so existing plugins
|
|
86
|
+
remain compatible.
|
|
87
|
+
|
|
88
|
+
### Changed
|
|
89
|
+
|
|
90
|
+
- `PLUGIN_API_VERSION` constant: `1.1` → `1.2`. No behavioural
|
|
91
|
+
change for plugins that do not consume the runtime-shim contract
|
|
92
|
+
directly; this only signals which optional SDK surface the host
|
|
93
|
+
exposes.
|
|
94
|
+
|
|
95
|
+
## [1.1.0] - 2026-05-25
|
|
96
|
+
|
|
97
|
+
### Added
|
|
98
|
+
|
|
99
|
+
- Plugin SDK field-renderer contracts:
|
|
100
|
+
`IFieldRendererDefinition`, `IPluginFieldRendererProps`, and
|
|
101
|
+
`fieldRenderers` on `IPluginRegistration`, so plugins can contribute
|
|
102
|
+
custom CMS section-field editor controls for plugin-owned field types.
|
|
103
|
+
|
|
104
|
+
### Changed
|
|
105
|
+
|
|
106
|
+
- Bumped `PLUGIN_API_VERSION` from `1.0` to `1.1` to reflect the new
|
|
107
|
+
additive plugin SDK surface.
|
|
108
|
+
- Re-exported the new field-renderer types from `@selfhelp/shared/plugin-sdk`.
|
|
109
|
+
|
|
110
|
+
## [1.0.4] - 2026-05-22
|
|
111
|
+
|
|
112
|
+
### Added
|
|
113
|
+
|
|
114
|
+
- New `plugin-sdk` surface for the SelfHelp plugin ecosystem:
|
|
115
|
+
- `definePlugin()` / `defineMobilePlugin()` helpers for typed plugin
|
|
116
|
+
manifests.
|
|
117
|
+
- `definePluginRealtimeTopic()` topic helpers with template expansion.
|
|
118
|
+
- `usePluginRealtime()` React hook for Mercure topic subscription. The
|
|
119
|
+
hook accepts a `transportFactory` so frontend hosts can inject
|
|
120
|
+
`EventSource` and mobile hosts can inject `react-native-sse` without
|
|
121
|
+
forcing the SDK to depend on either runtime.
|
|
122
|
+
- TypeScript mirrors for `IPluginManifest`, `IPluginRegistry`, and
|
|
123
|
+
`IPluginLock` plus the `scripts/check-schema-parity.mjs` script that
|
|
124
|
+
verifies the JSON schemas stay in lockstep with the TS types.
|
|
125
|
+
- React is now declared as an **optional peer dependency**
|
|
126
|
+
(`react ^18 || ^19`). Non-React consumers can keep using the package
|
|
127
|
+
without installing React; the `usePluginRealtime` hook is only required
|
|
128
|
+
if you opt into realtime updates.
|
|
129
|
+
|
|
130
|
+
### Changed (breaking type contracts)
|
|
131
|
+
|
|
132
|
+
These changes broaden the schema-mirroring types so they actually match
|
|
133
|
+
the canonical JSON Schemas the backend publishes. Plugin authors
|
|
134
|
+
upgrading from `1.0.3` need to update any code that constructed these
|
|
135
|
+
shapes literally:
|
|
136
|
+
|
|
137
|
+
- `IPluginRegistry`
|
|
138
|
+
- Renamed `schemaVersion` (string `'1.0'`) to **`registryVersion`**
|
|
139
|
+
(`number`, currently `1`).
|
|
140
|
+
- Added required field `name: string`.
|
|
141
|
+
- Added optional `homepage`, `publishedAt`, `trustKey`, and `channels`
|
|
142
|
+
fields to align with `plugin-registry.schema.json`.
|
|
143
|
+
- `IPluginLock`
|
|
144
|
+
- Added required field **`lockfileVersion: number`** (currently `1`).
|
|
145
|
+
- Added required nested object **`sdk: { version: string; pluginApiVersion: string }`**
|
|
146
|
+
so lockfiles always advertise which SDK version they were generated
|
|
147
|
+
against.
|
|
148
|
+
- `plugins` is now `Record<string, IPluginLockEntry>` instead of an
|
|
149
|
+
array — keyed by plugin id, which matches the schema and removes
|
|
150
|
+
the need for clients to do an extra lookup.
|
|
151
|
+
- `installMode` is now optional at the top level (per-entry
|
|
152
|
+
`installMode` already exists inside each plugin entry).
|
|
153
|
+
- `IPluginManifest`
|
|
154
|
+
- `dataAccess` gained `ownedTables: string[]` and
|
|
155
|
+
`ownedDataTablePrefix?: string` so plugins can declare their owned
|
|
156
|
+
tables for the install-time validator and the purger.
|
|
157
|
+
|
|
158
|
+
### Migration notes for plugin authors
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
// before (1.0.3)
|
|
162
|
+
const registry: IPluginRegistry = {
|
|
163
|
+
schemaVersion: '1.0',
|
|
164
|
+
plugins: [],
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// after (1.0.4)
|
|
168
|
+
const registry: IPluginRegistry = {
|
|
169
|
+
registryVersion: 1,
|
|
170
|
+
name: 'my-registry',
|
|
171
|
+
plugins: [],
|
|
172
|
+
};
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
// before (1.0.3)
|
|
177
|
+
const lock: IPluginLock = {
|
|
178
|
+
generatedAt: '...',
|
|
179
|
+
plugins: [],
|
|
180
|
+
installMode: 'managed',
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
// after (1.0.4)
|
|
184
|
+
const lock: IPluginLock = {
|
|
185
|
+
lockfileVersion: 1,
|
|
186
|
+
generatedAt: '...',
|
|
187
|
+
sdk: { version: '1.0.4', pluginApiVersion: '1.0' },
|
|
188
|
+
plugins: {},
|
|
189
|
+
};
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Run `npm run check:schemas` (from `sh-selfhelp_shared`) to verify your
|
|
193
|
+
TypeScript matches the canonical JSON schemas after the upgrade.
|
|
194
|
+
|
|
195
|
+
## [1.0.3] - 2026-05-19
|
|
196
|
+
|
|
197
|
+
- Adjust types after the DB refactoring
|
|
198
|
+
|
|
199
|
+
## [1.0.0] - 2026-05-08
|
|
200
|
+
|
|
201
|
+
First stable release of `@selfhelp/shared`.
|
|
202
|
+
|
|
203
|
+
### Added
|
|
204
|
+
|
|
205
|
+
- Shared TypeScript contracts for pages, styles, auth models, and API payloads.
|
|
206
|
+
- A typed `STYLE_REGISTRY` for CMS-driven rendering.
|
|
207
|
+
- Common theme token exports and a shared Tailwind preset surface.
|
|
208
|
+
- Runtime helpers for:
|
|
209
|
+
- interpolation via `replaceCalcedValues()`
|
|
210
|
+
- condition evaluation via `evaluateCondition()`
|
|
211
|
+
- asset URL normalization via `resolveAssetUrl()`
|
|
212
|
+
- spacing parsing and page-data transformation utilities
|
|
213
|
+
- CMS class allow-listing, remapping, and classification helpers.
|
|
214
|
+
- Public npm packaging setup for reuse across multiple projects.
|
|
215
|
+
|
|
216
|
+
### Included in this release
|
|
217
|
+
|
|
218
|
+
- Root package exports for the main shared API.
|
|
219
|
+
- Subpath exports for:
|
|
220
|
+
- `@selfhelp/shared/registry`
|
|
221
|
+
- `@selfhelp/shared/theme`
|
|
222
|
+
- `@selfhelp/shared/tailwind`
|
|
223
|
+
- Generated CJS, ESM, and TypeScript declaration output in `dist/`.
|
|
224
|
+
- README publishing instructions and package documentation.
|
|
225
|
+
|
|
226
|
+
### Purpose of the 1.0.0 release
|
|
227
|
+
|
|
228
|
+
This release establishes `@selfhelp/shared` as the source of truth for shared
|
|
229
|
+
frontend and mobile contracts in the SelfHelp ecosystem. The goal of `1.0.0` is
|
|
230
|
+
to provide a stable base that other applications can install, build against, and
|
|
231
|
+
upgrade using normal npm versioning.
|