@selfhelp/shared 1.0.4 → 1.0.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
CHANGED
|
@@ -4,6 +4,91 @@ All notable changes to `@selfhelp/shared` will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
This project follows semantic versioning.
|
|
6
6
|
|
|
7
|
+
## [1.0.4] - 2026-05-22
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- New `plugin-sdk` surface for the SelfHelp plugin ecosystem:
|
|
12
|
+
- `definePlugin()` / `defineMobilePlugin()` helpers for typed plugin
|
|
13
|
+
manifests.
|
|
14
|
+
- `definePluginRealtimeTopic()` topic helpers with template expansion.
|
|
15
|
+
- `usePluginRealtime()` React hook for Mercure topic subscription. The
|
|
16
|
+
hook accepts a `transportFactory` so frontend hosts can inject
|
|
17
|
+
`EventSource` and mobile hosts can inject `react-native-sse` without
|
|
18
|
+
forcing the SDK to depend on either runtime.
|
|
19
|
+
- TypeScript mirrors for `IPluginManifest`, `IPluginRegistry`, and
|
|
20
|
+
`IPluginLock` plus the `scripts/check-schema-parity.mjs` script that
|
|
21
|
+
verifies the JSON schemas stay in lockstep with the TS types.
|
|
22
|
+
- React is now declared as an **optional peer dependency**
|
|
23
|
+
(`react ^18 || ^19`). Non-React consumers can keep using the package
|
|
24
|
+
without installing React; the `usePluginRealtime` hook is only required
|
|
25
|
+
if you opt into realtime updates.
|
|
26
|
+
|
|
27
|
+
### Changed (breaking type contracts)
|
|
28
|
+
|
|
29
|
+
These changes broaden the schema-mirroring types so they actually match
|
|
30
|
+
the canonical JSON Schemas the backend publishes. Plugin authors
|
|
31
|
+
upgrading from `1.0.3` need to update any code that constructed these
|
|
32
|
+
shapes literally:
|
|
33
|
+
|
|
34
|
+
- `IPluginRegistry`
|
|
35
|
+
- Renamed `schemaVersion` (string `'1.0'`) to **`registryVersion`**
|
|
36
|
+
(`number`, currently `1`).
|
|
37
|
+
- Added required field `name: string`.
|
|
38
|
+
- Added optional `homepage`, `publishedAt`, `trustKey`, and `channels`
|
|
39
|
+
fields to align with `plugin-registry.schema.json`.
|
|
40
|
+
- `IPluginLock`
|
|
41
|
+
- Added required field **`lockfileVersion: number`** (currently `1`).
|
|
42
|
+
- Added required nested object **`sdk: { version: string; pluginApiVersion: string }`**
|
|
43
|
+
so lockfiles always advertise which SDK version they were generated
|
|
44
|
+
against.
|
|
45
|
+
- `plugins` is now `Record<string, IPluginLockEntry>` instead of an
|
|
46
|
+
array — keyed by plugin id, which matches the schema and removes
|
|
47
|
+
the need for clients to do an extra lookup.
|
|
48
|
+
- `installMode` is now optional at the top level (per-entry
|
|
49
|
+
`installMode` already exists inside each plugin entry).
|
|
50
|
+
- `IPluginManifest`
|
|
51
|
+
- `dataAccess` gained `ownedTables: string[]` and
|
|
52
|
+
`ownedDataTablePrefix?: string` so plugins can declare their owned
|
|
53
|
+
tables for the install-time validator and the purger.
|
|
54
|
+
|
|
55
|
+
### Migration notes for plugin authors
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
// before (1.0.3)
|
|
59
|
+
const registry: IPluginRegistry = {
|
|
60
|
+
schemaVersion: '1.0',
|
|
61
|
+
plugins: [],
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// after (1.0.4)
|
|
65
|
+
const registry: IPluginRegistry = {
|
|
66
|
+
registryVersion: 1,
|
|
67
|
+
name: 'my-registry',
|
|
68
|
+
plugins: [],
|
|
69
|
+
};
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
// before (1.0.3)
|
|
74
|
+
const lock: IPluginLock = {
|
|
75
|
+
generatedAt: '...',
|
|
76
|
+
plugins: [],
|
|
77
|
+
installMode: 'managed',
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// after (1.0.4)
|
|
81
|
+
const lock: IPluginLock = {
|
|
82
|
+
lockfileVersion: 1,
|
|
83
|
+
generatedAt: '...',
|
|
84
|
+
sdk: { version: '1.0.4', pluginApiVersion: '1.0' },
|
|
85
|
+
plugins: {},
|
|
86
|
+
};
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Run `npm run check:schemas` (from `sh-selfhelp_shared`) to verify your
|
|
90
|
+
TypeScript matches the canonical JSON schemas after the upgrade.
|
|
91
|
+
|
|
7
92
|
## [1.0.3] - 2026-05-19
|
|
8
93
|
|
|
9
94
|
- Adjust types after the DB refactoring
|
|
@@ -70,7 +70,7 @@ declare function assertPluginVersionSemantics(prevVersion: string | undefined, n
|
|
|
70
70
|
*/
|
|
71
71
|
type IPluginManifestTrustLevel = 'official' | 'reviewed' | 'untrusted';
|
|
72
72
|
/** Every privileged capability is deny-by-default. */
|
|
73
|
-
type IPluginManifestCapability = 'backendBundle' | 'databaseMigrations' | 'readUsers' | 'writeUsers' | 'deleteUsers' | 'readDataTables' | 'writeDataTables' | 'deleteDataTables' | 'externalNetworkAccess' | 'scheduledJobs' | 'publicCallbacks' | 'adminPages' | 'frontendStyles' | 'mobileStyles' | 'realtimePublish' | 'fileUploads' | 'secretAccess';
|
|
73
|
+
type IPluginManifestCapability = 'backendBundle' | 'databaseMigrations' | 'readUsers' | 'writeUsers' | 'deleteUsers' | 'readDataTables' | 'writeDataTables' | 'deleteDataTables' | 'externalNetworkAccess' | 'scheduledJobs' | 'publicCallbacks' | 'adminPages' | 'frontendStyles' | 'mobileStyles' | 'realtimePublish' | 'fileUploads' | 'secretAccess' | 'lookupExtend' | 'lookupOwnGroup';
|
|
74
74
|
interface IPluginManifestCompatibility {
|
|
75
75
|
/** SemVer range for the SelfHelp CMS version (e.g. `^2.0`). */
|
|
76
76
|
selfhelp: string;
|
|
@@ -70,7 +70,7 @@ declare function assertPluginVersionSemantics(prevVersion: string | undefined, n
|
|
|
70
70
|
*/
|
|
71
71
|
type IPluginManifestTrustLevel = 'official' | 'reviewed' | 'untrusted';
|
|
72
72
|
/** Every privileged capability is deny-by-default. */
|
|
73
|
-
type IPluginManifestCapability = 'backendBundle' | 'databaseMigrations' | 'readUsers' | 'writeUsers' | 'deleteUsers' | 'readDataTables' | 'writeDataTables' | 'deleteDataTables' | 'externalNetworkAccess' | 'scheduledJobs' | 'publicCallbacks' | 'adminPages' | 'frontendStyles' | 'mobileStyles' | 'realtimePublish' | 'fileUploads' | 'secretAccess';
|
|
73
|
+
type IPluginManifestCapability = 'backendBundle' | 'databaseMigrations' | 'readUsers' | 'writeUsers' | 'deleteUsers' | 'readDataTables' | 'writeDataTables' | 'deleteDataTables' | 'externalNetworkAccess' | 'scheduledJobs' | 'publicCallbacks' | 'adminPages' | 'frontendStyles' | 'mobileStyles' | 'realtimePublish' | 'fileUploads' | 'secretAccess' | 'lookupExtend' | 'lookupOwnGroup';
|
|
74
74
|
interface IPluginManifestCompatibility {
|
|
75
75
|
/** SemVer range for the SelfHelp CMS version (e.g. `^2.0`). */
|
|
76
76
|
selfhelp: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selfhelp/shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Shared TypeScript package for SelfHelp web frontend and mobile app: style registry, types, API contracts, Mantine theme tokens, condition + interpolation engines, CMS class allow-list.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,7 +29,9 @@ export type IPluginManifestCapability =
|
|
|
29
29
|
| 'mobileStyles'
|
|
30
30
|
| 'realtimePublish'
|
|
31
31
|
| 'fileUploads'
|
|
32
|
-
| 'secretAccess'
|
|
32
|
+
| 'secretAccess'
|
|
33
|
+
| 'lookupExtend'
|
|
34
|
+
| 'lookupOwnGroup';
|
|
33
35
|
|
|
34
36
|
export interface IPluginManifestCompatibility {
|
|
35
37
|
/** SemVer range for the SelfHelp CMS version (e.g. `^2.0`). */
|