@selfhelp/shared 1.3.1 → 1.4.0
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 +55 -0
- package/dist/index.d.mts +649 -1
- package/dist/index.d.ts +649 -1
- package/dist/index.js +19 -0
- package/dist/index.mjs +17 -0
- package/dist/plugin-sdk/index.d.mts +118 -101
- package/dist/plugin-sdk/index.d.ts +118 -101
- package/dist/plugin-sdk/index.js +6 -1
- package/dist/plugin-sdk/index.mjs +5 -1
- package/package.json +2 -2
- package/src/plugin-sdk/index.ts +4 -2
- package/src/plugin-sdk/registry.ts +115 -79
- package/src/plugin-sdk/version.ts +1 -1
- package/src/types/__tests__/channel-parity.test.ts +74 -0
- package/src/types/__tests__/distribution.test.ts +168 -0
- package/src/types/api/__tests__/compatibility-error-parity.test.ts +107 -0
- package/src/types/api/__tests__/system.test.ts +287 -0
- package/src/types/api/index.ts +1 -0
- package/src/types/api/system.ts +293 -0
- package/src/types/distribution.ts +446 -0
- package/src/types/index.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -48,11 +48,13 @@ __export(index_exports, {
|
|
|
48
48
|
LITERAL_CLASSES: () => LITERAL_CLASSES,
|
|
49
49
|
PERMISSIONS: () => PERMISSIONS,
|
|
50
50
|
RADIUS_PX: () => RADIUS_PX,
|
|
51
|
+
RELEASE_CHANNELS: () => RELEASE_CHANNELS,
|
|
51
52
|
SIZE_VALUES: () => SIZE_VALUES,
|
|
52
53
|
SPACING_PX: () => SPACING_PX,
|
|
53
54
|
SPACING_TO_TAILWIND: () => SPACING_TO_TAILWIND,
|
|
54
55
|
SPACING_VALUES: () => SPACING_VALUES,
|
|
55
56
|
STYLE_REGISTRY: () => STYLE_REGISTRY,
|
|
57
|
+
SYSTEM_ENDPOINTS: () => SYSTEM_ENDPOINTS,
|
|
56
58
|
_resetPluginStyleRegistry: () => _resetPluginStyleRegistry,
|
|
57
59
|
buildConditionContext: () => buildConditionContext,
|
|
58
60
|
classifyClass: () => classifyClass,
|
|
@@ -135,6 +137,21 @@ var PERMISSIONS = {
|
|
|
135
137
|
ADMIN_AUDIT_VIEW: "admin.audit.view"
|
|
136
138
|
};
|
|
137
139
|
|
|
140
|
+
// src/types/api/system.ts
|
|
141
|
+
var SYSTEM_PREFIX = "/cms-api/v1/admin/system";
|
|
142
|
+
var SYSTEM_ENDPOINTS = {
|
|
143
|
+
VERSION: `${SYSTEM_PREFIX}/version`,
|
|
144
|
+
HEALTH: `${SYSTEM_PREFIX}/health`,
|
|
145
|
+
ADVISORIES: `${SYSTEM_PREFIX}/advisories`,
|
|
146
|
+
MAINTENANCE: `${SYSTEM_PREFIX}/maintenance`,
|
|
147
|
+
UPDATE_PREFLIGHT: `${SYSTEM_PREFIX}/update/preflight`,
|
|
148
|
+
UPDATE_REQUEST: `${SYSTEM_PREFIX}/update/request`,
|
|
149
|
+
UPDATE_STATUS: `${SYSTEM_PREFIX}/update/status`
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// src/types/distribution.ts
|
|
153
|
+
var RELEASE_CHANNELS = ["stable", "beta", "nightly", "test"];
|
|
154
|
+
|
|
138
155
|
// src/registry/styles.registry.ts
|
|
139
156
|
var BASE_STYLE_REGISTRY = {
|
|
140
157
|
// ===== auth =====
|
|
@@ -855,11 +872,13 @@ function transformPagesData(pages) {
|
|
|
855
872
|
LITERAL_CLASSES,
|
|
856
873
|
PERMISSIONS,
|
|
857
874
|
RADIUS_PX,
|
|
875
|
+
RELEASE_CHANNELS,
|
|
858
876
|
SIZE_VALUES,
|
|
859
877
|
SPACING_PX,
|
|
860
878
|
SPACING_TO_TAILWIND,
|
|
861
879
|
SPACING_VALUES,
|
|
862
880
|
STYLE_REGISTRY,
|
|
881
|
+
SYSTEM_ENDPOINTS,
|
|
863
882
|
_resetPluginStyleRegistry,
|
|
864
883
|
buildConditionContext,
|
|
865
884
|
classifyClass,
|
package/dist/index.mjs
CHANGED
|
@@ -50,6 +50,21 @@ var PERMISSIONS = {
|
|
|
50
50
|
ADMIN_AUDIT_VIEW: "admin.audit.view"
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
// src/types/api/system.ts
|
|
54
|
+
var SYSTEM_PREFIX = "/cms-api/v1/admin/system";
|
|
55
|
+
var SYSTEM_ENDPOINTS = {
|
|
56
|
+
VERSION: `${SYSTEM_PREFIX}/version`,
|
|
57
|
+
HEALTH: `${SYSTEM_PREFIX}/health`,
|
|
58
|
+
ADVISORIES: `${SYSTEM_PREFIX}/advisories`,
|
|
59
|
+
MAINTENANCE: `${SYSTEM_PREFIX}/maintenance`,
|
|
60
|
+
UPDATE_PREFLIGHT: `${SYSTEM_PREFIX}/update/preflight`,
|
|
61
|
+
UPDATE_REQUEST: `${SYSTEM_PREFIX}/update/request`,
|
|
62
|
+
UPDATE_STATUS: `${SYSTEM_PREFIX}/update/status`
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// src/types/distribution.ts
|
|
66
|
+
var RELEASE_CHANNELS = ["stable", "beta", "nightly", "test"];
|
|
67
|
+
|
|
53
68
|
// src/registry/styles.registry.ts
|
|
54
69
|
var BASE_STYLE_REGISTRY = {
|
|
55
70
|
// ===== auth =====
|
|
@@ -769,11 +784,13 @@ export {
|
|
|
769
784
|
LITERAL_CLASSES,
|
|
770
785
|
PERMISSIONS,
|
|
771
786
|
RADIUS_PX,
|
|
787
|
+
RELEASE_CHANNELS,
|
|
772
788
|
SIZE_VALUES,
|
|
773
789
|
SPACING_PX,
|
|
774
790
|
SPACING_TO_TAILWIND,
|
|
775
791
|
SPACING_VALUES,
|
|
776
792
|
STYLE_REGISTRY,
|
|
793
|
+
SYSTEM_ENDPOINTS,
|
|
777
794
|
_resetPluginStyleRegistry,
|
|
778
795
|
buildConditionContext,
|
|
779
796
|
classifyClass,
|
|
@@ -14,7 +14,7 @@ import '../common-B96dASgu.mjs';
|
|
|
14
14
|
*
|
|
15
15
|
* Independent from the npm `version` of `@selfhelp/shared`.
|
|
16
16
|
*/
|
|
17
|
-
declare const PLUGIN_API_VERSION: "1.
|
|
17
|
+
declare const PLUGIN_API_VERSION: "0.1.0";
|
|
18
18
|
interface ISemver {
|
|
19
19
|
major: number;
|
|
20
20
|
minor: number;
|
|
@@ -64,125 +64,142 @@ declare function assertPluginVersionSemantics(prevVersion: string | undefined, n
|
|
|
64
64
|
}): void;
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
|
-
* TypeScript mirror of `registry.json` served by a plugin
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* the
|
|
67
|
+
* TypeScript mirror of the UNIFIED `registry.json` served by a SelfHelp plugin
|
|
68
|
+
* registry.
|
|
69
|
+
*
|
|
70
|
+
* The registry is a single catalogue consumed by BOTH installers: the SelfHelp
|
|
71
|
+
* Manager (core/frontend/scheduler/worker Docker releases) and the CMS/backend
|
|
72
|
+
* (plugin releases). Every component array is a list of release REFS
|
|
73
|
+
* (`{id, version, channel, releaseUrl}`) pointing at standalone signed release
|
|
74
|
+
* documents; a plugin with several published versions appears as several refs, so
|
|
75
|
+
* the host can resolve the newest COMPATIBLE version per plugin.
|
|
76
|
+
*
|
|
77
|
+
* Mirrors the backend JSON Schemas in the sibling repo
|
|
78
|
+
* (`sh-selfhelp_backend/docs/plugins/plugin-registry.schema.json` +
|
|
79
|
+
* `config/schemas/registry/plugin-release.schema.json`) and the SelfHelp Manager
|
|
80
|
+
* Zod schema. Keep all three in sync (see AGENTS.md).
|
|
71
81
|
*/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Registry channels, kept in parity with the canonical `ReleaseChannel` set
|
|
84
|
+
* (`stable | beta | nightly | test`) used by the unified distribution registry
|
|
85
|
+
* wire schema, the SelfHelp Manager, and the backend. Exposed as a runtime tuple
|
|
86
|
+
* so the cross-repo parity test can assert the sets match.
|
|
87
|
+
*/
|
|
88
|
+
declare const PLUGIN_REGISTRY_CHANNELS: readonly ["stable", "beta", "nightly", "test"];
|
|
89
|
+
type TPluginRegistryChannel = (typeof PLUGIN_REGISTRY_CHANNELS)[number];
|
|
90
|
+
/**
|
|
91
|
+
* One published (component, version) entry in the unified index. Identical shape
|
|
92
|
+
* for plugins and the platform components (core/frontend/scheduler/worker) — the
|
|
93
|
+
* `releaseUrl` resolves (against the index `baseUrl`) to the signed release
|
|
94
|
+
* document validated by `plugin-release.schema.json` / `core-release.schema.json`.
|
|
95
|
+
*/
|
|
96
|
+
interface IRegistryReleaseRef {
|
|
97
|
+
/** Component id (e.g. `sh2-shp-survey-js`, `selfhelp-core`). */
|
|
98
|
+
id: string;
|
|
99
|
+
/** SemVer version of this release. */
|
|
75
100
|
version: string;
|
|
76
101
|
/** Channel this version was published to. */
|
|
77
102
|
channel: TPluginRegistryChannel;
|
|
78
|
-
/**
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
breaking?: boolean;
|
|
82
|
-
/** Whether the host installer should block this version. */
|
|
103
|
+
/** Absolute or `baseUrl`-relative URL of the signed release document. */
|
|
104
|
+
releaseUrl: string;
|
|
105
|
+
/** When true the host installer must not offer this version. */
|
|
83
106
|
blocked?: boolean;
|
|
84
|
-
|
|
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
|
-
/**
|
|
107
|
+
}
|
|
108
|
+
/** Ed25519 signature block carried by every signed release document. */
|
|
109
|
+
interface IRegistrySignatureBlock {
|
|
110
|
+
/** Base64 detached Ed25519 signature of the canonical payload. */
|
|
111
|
+
signature: string;
|
|
112
|
+
/** Publisher key identifier, resolved against the trusted-keys file. */
|
|
113
|
+
keyId: string;
|
|
114
|
+
/** Optional inline canonical payload (omitted when the verifier recomputes it). */
|
|
115
|
+
signedPayload?: string;
|
|
116
|
+
/** Optional SHA-256 of the canonical payload (`sha256:` prefix allowed). */
|
|
117
|
+
signedPayloadSha256?: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* A standalone signed plugin release document (the target of a `plugins[]` ref).
|
|
121
|
+
*
|
|
122
|
+
* Mirrors `plugin-release.schema.json`. The release expresses compatibility on
|
|
123
|
+
* two axes (`compatibility.core` + `compatibility.pluginApi`); the author-facing
|
|
124
|
+
* `plugin.json` manifest keeps `compatibility.selfhelp` + `pluginApiVersion`,
|
|
125
|
+
* which the publish tooling maps onto these ranges.
|
|
126
|
+
*/
|
|
127
|
+
interface IPluginRelease {
|
|
128
|
+
/** Discriminator — always `selfhelp-plugin-release`. */
|
|
129
|
+
kind: 'selfhelp-plugin-release';
|
|
130
|
+
/** Plugin id (matches the ref in the index). */
|
|
131
|
+
id: string;
|
|
132
|
+
/** SemVer version (matches the ref in the index). */
|
|
133
|
+
version: string;
|
|
134
|
+
/** Channel (matches the ref in the index). */
|
|
135
|
+
channel: TPluginRegistryChannel;
|
|
136
|
+
/** True when the manifest declared `security.trustLevel: "official"`. */
|
|
137
|
+
official: boolean;
|
|
138
|
+
/** Compatibility ranges the host must satisfy. */
|
|
110
139
|
compatibility: {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
reactNative?: string;
|
|
116
|
-
expoSdk?: string;
|
|
117
|
-
pluginApiVersion: string;
|
|
140
|
+
/** Semver range of SelfHelp core versions this plugin runs on. */
|
|
141
|
+
core: string;
|
|
142
|
+
/** Semver range of host plugin-API versions this plugin runs on. */
|
|
143
|
+
pluginApi: string;
|
|
118
144
|
};
|
|
119
|
-
/**
|
|
120
|
-
changelog?: string;
|
|
121
|
-
/** Mirror of `dependencies` from the manifest, for resolver-only consumption. */
|
|
145
|
+
/** Optional other-plugin requirements consumed by the resolver. */
|
|
122
146
|
dependencies?: {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
|
|
141
|
-
/** Optional public icon URL. */
|
|
142
|
-
iconUrl?: string;
|
|
143
|
-
/** Optional categories. */
|
|
144
|
-
categories?: string[];
|
|
147
|
+
plugins?: {
|
|
148
|
+
id: string;
|
|
149
|
+
range: string;
|
|
150
|
+
}[];
|
|
151
|
+
};
|
|
152
|
+
/** The install artifact + canonical manifest the host fetches. */
|
|
153
|
+
artifacts: {
|
|
154
|
+
/** URL of the full `plugin.json` snapshot. */
|
|
155
|
+
manifestUrl: string;
|
|
156
|
+
/** URL of the signed `.shplugin` archive the backend downloads. */
|
|
157
|
+
archiveUrl: string;
|
|
158
|
+
/** SHA-256 of the `.shplugin` (`sha256:` prefix allowed). */
|
|
159
|
+
sha256: string;
|
|
160
|
+
};
|
|
161
|
+
/** Ed25519 signature block. */
|
|
162
|
+
security: IRegistrySignatureBlock;
|
|
163
|
+
/** When true the host installer must not offer this version. */
|
|
164
|
+
blocked?: boolean;
|
|
145
165
|
}
|
|
146
166
|
/**
|
|
147
|
-
*
|
|
167
|
+
* Unified registry root document (`registry.json`).
|
|
148
168
|
*
|
|
149
|
-
* Mirrors `plugin-registry.schema.json` in the host repository.
|
|
150
|
-
*
|
|
151
|
-
* `
|
|
152
|
-
* but always emitted by `scripts/publish-to-registry.mjs`.
|
|
169
|
+
* Mirrors `plugin-registry.schema.json` in the host repository. Required:
|
|
170
|
+
* `schemaVersion`, `requiresManager`, `baseUrl`, and the five release-ref arrays
|
|
171
|
+
* `core` / `frontend` / `scheduler` / `worker` / `plugins`.
|
|
153
172
|
*/
|
|
154
173
|
interface IPluginRegistry {
|
|
155
|
-
/** Canonical registry schema version.
|
|
156
|
-
schemaVersion:
|
|
174
|
+
/** Canonical registry schema version. */
|
|
175
|
+
schemaVersion: string;
|
|
176
|
+
/** Semver range of SelfHelp Manager versions that can consume this registry. */
|
|
177
|
+
requiresManager: string;
|
|
157
178
|
/** ISO timestamp this registry was published. */
|
|
158
179
|
publishedAt?: string;
|
|
159
|
-
/**
|
|
160
|
-
|
|
161
|
-
* slash). Plugin publishers join this to relative
|
|
162
|
-
* `artifacts/<id>-<version>/...` paths to produce the absolute
|
|
163
|
-
* `runtime.entrypointUrl` / `runtime.stylesheetUrl` that gets
|
|
164
|
-
* signed and shipped in each plugin entry.
|
|
165
|
-
*/
|
|
166
|
-
baseUrl?: string;
|
|
180
|
+
/** Base URL used to resolve relative `releaseUrl` / artifact paths (with trailing slash). */
|
|
181
|
+
baseUrl: string;
|
|
167
182
|
/** Publisher metadata shown in the admin UI. */
|
|
168
183
|
publisher?: {
|
|
169
184
|
name: string;
|
|
170
185
|
url?: string;
|
|
171
186
|
};
|
|
172
|
-
/**
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
|
|
187
|
+
/** SelfHelp core Docker release refs (Manager-installed). */
|
|
188
|
+
core: IRegistryReleaseRef[];
|
|
189
|
+
/** SelfHelp frontend Docker release refs (Manager-installed). */
|
|
190
|
+
frontend: IRegistryReleaseRef[];
|
|
191
|
+
/** Scheduled-jobs-runner release refs (Manager-installed). */
|
|
192
|
+
scheduler: IRegistryReleaseRef[];
|
|
193
|
+
/** Messenger-worker release refs (Manager-installed). */
|
|
194
|
+
worker: IRegistryReleaseRef[];
|
|
195
|
+
/** Plugin release refs (CMS-installed) — multi-version, one ref per published version. */
|
|
196
|
+
plugins: IRegistryReleaseRef[];
|
|
197
|
+
/** Optional path to the security advisory feed. */
|
|
198
|
+
advisoriesUrl?: string;
|
|
199
|
+
/** Optional path to the cross-component compatibility feed. */
|
|
200
|
+
compatibilityUrl?: string;
|
|
201
|
+
/** Optional path to the public trusted-keys file. */
|
|
202
|
+
trustedKeysUrl?: string;
|
|
186
203
|
}
|
|
187
204
|
|
|
188
205
|
/**
|
|
@@ -820,4 +837,4 @@ declare function isPluginRuntimeShimSpecifier(value: unknown): value is TPluginR
|
|
|
820
837
|
*/
|
|
821
838
|
declare const PLUGIN_RUNTIME_IMPORT_MAP: Readonly<Record<TPluginRuntimeShimSpecifier, string>>;
|
|
822
839
|
|
|
823
|
-
export { type IAdminPageDefinition, type IFieldRendererDefinition, type IMenuItemDefinition, type IMobilePluginApi, type IMobilePluginRegistration, type IPluginApi, type IPluginFeatureFlag, type IPluginFieldRendererProps, type IPluginHealthCheck, type IPluginLock, type IPluginLockEntry, type IPluginLockMigration, type IPluginLockMobileEntry, type IPluginRealtimePublisher, type IPluginRealtimeTopic, type IPluginRegistration, type IPluginRegistry, type
|
|
840
|
+
export { type IAdminPageDefinition, type IFieldRendererDefinition, type IMenuItemDefinition, type IMobilePluginApi, type IMobilePluginRegistration, type IPluginApi, type IPluginFeatureFlag, type IPluginFieldRendererProps, type IPluginHealthCheck, type IPluginLock, type IPluginLockEntry, type IPluginLockMigration, type IPluginLockMobileEntry, type IPluginRealtimePublisher, type IPluginRealtimeTopic, type IPluginRegistration, type IPluginRegistry, type IPluginRelease, type IRealtimeTransport, type IRegistryReleaseRef, type IRegistrySignatureBlock, type IRichTextEditorAdapter, type IRichTextEditorAdapterOptions, type IRichTextEditorValue, type IStyleDefinition, type IUsePluginRealtimeOptions, type IUsePluginRealtimeResult, PLUGIN_API_VERSION, PLUGIN_REGISTRY_CHANNELS, PLUGIN_RUNTIME_GLOBAL_KEY, PLUGIN_RUNTIME_IMPORT_MAP, PLUGIN_RUNTIME_SHIM_BASE_PATH, PLUGIN_RUNTIME_SHIM_SPECIFIERS, type TPluginRegistryChannel, type TPluginRuntimeShimSpecifier, type TRealtimeTransportFactory, assertCmsCompatibility, assertPluginApiVersion, assertPluginVersionSemantics, buildPluginRuntimeShimPath, compareSemver, defineMobilePlugin, definePlugin, definePluginRealtimeTopic, isPluginApiCompatible, isPluginRuntimeShimSpecifier, parseSemver, satisfiesSemverRange, usePluginRealtime };
|
|
@@ -14,7 +14,7 @@ import '../common-B96dASgu.js';
|
|
|
14
14
|
*
|
|
15
15
|
* Independent from the npm `version` of `@selfhelp/shared`.
|
|
16
16
|
*/
|
|
17
|
-
declare const PLUGIN_API_VERSION: "1.
|
|
17
|
+
declare const PLUGIN_API_VERSION: "0.1.0";
|
|
18
18
|
interface ISemver {
|
|
19
19
|
major: number;
|
|
20
20
|
minor: number;
|
|
@@ -64,125 +64,142 @@ declare function assertPluginVersionSemantics(prevVersion: string | undefined, n
|
|
|
64
64
|
}): void;
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
|
-
* TypeScript mirror of `registry.json` served by a plugin
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* the
|
|
67
|
+
* TypeScript mirror of the UNIFIED `registry.json` served by a SelfHelp plugin
|
|
68
|
+
* registry.
|
|
69
|
+
*
|
|
70
|
+
* The registry is a single catalogue consumed by BOTH installers: the SelfHelp
|
|
71
|
+
* Manager (core/frontend/scheduler/worker Docker releases) and the CMS/backend
|
|
72
|
+
* (plugin releases). Every component array is a list of release REFS
|
|
73
|
+
* (`{id, version, channel, releaseUrl}`) pointing at standalone signed release
|
|
74
|
+
* documents; a plugin with several published versions appears as several refs, so
|
|
75
|
+
* the host can resolve the newest COMPATIBLE version per plugin.
|
|
76
|
+
*
|
|
77
|
+
* Mirrors the backend JSON Schemas in the sibling repo
|
|
78
|
+
* (`sh-selfhelp_backend/docs/plugins/plugin-registry.schema.json` +
|
|
79
|
+
* `config/schemas/registry/plugin-release.schema.json`) and the SelfHelp Manager
|
|
80
|
+
* Zod schema. Keep all three in sync (see AGENTS.md).
|
|
71
81
|
*/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Registry channels, kept in parity with the canonical `ReleaseChannel` set
|
|
84
|
+
* (`stable | beta | nightly | test`) used by the unified distribution registry
|
|
85
|
+
* wire schema, the SelfHelp Manager, and the backend. Exposed as a runtime tuple
|
|
86
|
+
* so the cross-repo parity test can assert the sets match.
|
|
87
|
+
*/
|
|
88
|
+
declare const PLUGIN_REGISTRY_CHANNELS: readonly ["stable", "beta", "nightly", "test"];
|
|
89
|
+
type TPluginRegistryChannel = (typeof PLUGIN_REGISTRY_CHANNELS)[number];
|
|
90
|
+
/**
|
|
91
|
+
* One published (component, version) entry in the unified index. Identical shape
|
|
92
|
+
* for plugins and the platform components (core/frontend/scheduler/worker) — the
|
|
93
|
+
* `releaseUrl` resolves (against the index `baseUrl`) to the signed release
|
|
94
|
+
* document validated by `plugin-release.schema.json` / `core-release.schema.json`.
|
|
95
|
+
*/
|
|
96
|
+
interface IRegistryReleaseRef {
|
|
97
|
+
/** Component id (e.g. `sh2-shp-survey-js`, `selfhelp-core`). */
|
|
98
|
+
id: string;
|
|
99
|
+
/** SemVer version of this release. */
|
|
75
100
|
version: string;
|
|
76
101
|
/** Channel this version was published to. */
|
|
77
102
|
channel: TPluginRegistryChannel;
|
|
78
|
-
/**
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
breaking?: boolean;
|
|
82
|
-
/** Whether the host installer should block this version. */
|
|
103
|
+
/** Absolute or `baseUrl`-relative URL of the signed release document. */
|
|
104
|
+
releaseUrl: string;
|
|
105
|
+
/** When true the host installer must not offer this version. */
|
|
83
106
|
blocked?: boolean;
|
|
84
|
-
|
|
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
|
-
/**
|
|
107
|
+
}
|
|
108
|
+
/** Ed25519 signature block carried by every signed release document. */
|
|
109
|
+
interface IRegistrySignatureBlock {
|
|
110
|
+
/** Base64 detached Ed25519 signature of the canonical payload. */
|
|
111
|
+
signature: string;
|
|
112
|
+
/** Publisher key identifier, resolved against the trusted-keys file. */
|
|
113
|
+
keyId: string;
|
|
114
|
+
/** Optional inline canonical payload (omitted when the verifier recomputes it). */
|
|
115
|
+
signedPayload?: string;
|
|
116
|
+
/** Optional SHA-256 of the canonical payload (`sha256:` prefix allowed). */
|
|
117
|
+
signedPayloadSha256?: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* A standalone signed plugin release document (the target of a `plugins[]` ref).
|
|
121
|
+
*
|
|
122
|
+
* Mirrors `plugin-release.schema.json`. The release expresses compatibility on
|
|
123
|
+
* two axes (`compatibility.core` + `compatibility.pluginApi`); the author-facing
|
|
124
|
+
* `plugin.json` manifest keeps `compatibility.selfhelp` + `pluginApiVersion`,
|
|
125
|
+
* which the publish tooling maps onto these ranges.
|
|
126
|
+
*/
|
|
127
|
+
interface IPluginRelease {
|
|
128
|
+
/** Discriminator — always `selfhelp-plugin-release`. */
|
|
129
|
+
kind: 'selfhelp-plugin-release';
|
|
130
|
+
/** Plugin id (matches the ref in the index). */
|
|
131
|
+
id: string;
|
|
132
|
+
/** SemVer version (matches the ref in the index). */
|
|
133
|
+
version: string;
|
|
134
|
+
/** Channel (matches the ref in the index). */
|
|
135
|
+
channel: TPluginRegistryChannel;
|
|
136
|
+
/** True when the manifest declared `security.trustLevel: "official"`. */
|
|
137
|
+
official: boolean;
|
|
138
|
+
/** Compatibility ranges the host must satisfy. */
|
|
110
139
|
compatibility: {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
reactNative?: string;
|
|
116
|
-
expoSdk?: string;
|
|
117
|
-
pluginApiVersion: string;
|
|
140
|
+
/** Semver range of SelfHelp core versions this plugin runs on. */
|
|
141
|
+
core: string;
|
|
142
|
+
/** Semver range of host plugin-API versions this plugin runs on. */
|
|
143
|
+
pluginApi: string;
|
|
118
144
|
};
|
|
119
|
-
/**
|
|
120
|
-
changelog?: string;
|
|
121
|
-
/** Mirror of `dependencies` from the manifest, for resolver-only consumption. */
|
|
145
|
+
/** Optional other-plugin requirements consumed by the resolver. */
|
|
122
146
|
dependencies?: {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
|
|
141
|
-
/** Optional public icon URL. */
|
|
142
|
-
iconUrl?: string;
|
|
143
|
-
/** Optional categories. */
|
|
144
|
-
categories?: string[];
|
|
147
|
+
plugins?: {
|
|
148
|
+
id: string;
|
|
149
|
+
range: string;
|
|
150
|
+
}[];
|
|
151
|
+
};
|
|
152
|
+
/** The install artifact + canonical manifest the host fetches. */
|
|
153
|
+
artifacts: {
|
|
154
|
+
/** URL of the full `plugin.json` snapshot. */
|
|
155
|
+
manifestUrl: string;
|
|
156
|
+
/** URL of the signed `.shplugin` archive the backend downloads. */
|
|
157
|
+
archiveUrl: string;
|
|
158
|
+
/** SHA-256 of the `.shplugin` (`sha256:` prefix allowed). */
|
|
159
|
+
sha256: string;
|
|
160
|
+
};
|
|
161
|
+
/** Ed25519 signature block. */
|
|
162
|
+
security: IRegistrySignatureBlock;
|
|
163
|
+
/** When true the host installer must not offer this version. */
|
|
164
|
+
blocked?: boolean;
|
|
145
165
|
}
|
|
146
166
|
/**
|
|
147
|
-
*
|
|
167
|
+
* Unified registry root document (`registry.json`).
|
|
148
168
|
*
|
|
149
|
-
* Mirrors `plugin-registry.schema.json` in the host repository.
|
|
150
|
-
*
|
|
151
|
-
* `
|
|
152
|
-
* but always emitted by `scripts/publish-to-registry.mjs`.
|
|
169
|
+
* Mirrors `plugin-registry.schema.json` in the host repository. Required:
|
|
170
|
+
* `schemaVersion`, `requiresManager`, `baseUrl`, and the five release-ref arrays
|
|
171
|
+
* `core` / `frontend` / `scheduler` / `worker` / `plugins`.
|
|
153
172
|
*/
|
|
154
173
|
interface IPluginRegistry {
|
|
155
|
-
/** Canonical registry schema version.
|
|
156
|
-
schemaVersion:
|
|
174
|
+
/** Canonical registry schema version. */
|
|
175
|
+
schemaVersion: string;
|
|
176
|
+
/** Semver range of SelfHelp Manager versions that can consume this registry. */
|
|
177
|
+
requiresManager: string;
|
|
157
178
|
/** ISO timestamp this registry was published. */
|
|
158
179
|
publishedAt?: string;
|
|
159
|
-
/**
|
|
160
|
-
|
|
161
|
-
* slash). Plugin publishers join this to relative
|
|
162
|
-
* `artifacts/<id>-<version>/...` paths to produce the absolute
|
|
163
|
-
* `runtime.entrypointUrl` / `runtime.stylesheetUrl` that gets
|
|
164
|
-
* signed and shipped in each plugin entry.
|
|
165
|
-
*/
|
|
166
|
-
baseUrl?: string;
|
|
180
|
+
/** Base URL used to resolve relative `releaseUrl` / artifact paths (with trailing slash). */
|
|
181
|
+
baseUrl: string;
|
|
167
182
|
/** Publisher metadata shown in the admin UI. */
|
|
168
183
|
publisher?: {
|
|
169
184
|
name: string;
|
|
170
185
|
url?: string;
|
|
171
186
|
};
|
|
172
|
-
/**
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
|
|
187
|
+
/** SelfHelp core Docker release refs (Manager-installed). */
|
|
188
|
+
core: IRegistryReleaseRef[];
|
|
189
|
+
/** SelfHelp frontend Docker release refs (Manager-installed). */
|
|
190
|
+
frontend: IRegistryReleaseRef[];
|
|
191
|
+
/** Scheduled-jobs-runner release refs (Manager-installed). */
|
|
192
|
+
scheduler: IRegistryReleaseRef[];
|
|
193
|
+
/** Messenger-worker release refs (Manager-installed). */
|
|
194
|
+
worker: IRegistryReleaseRef[];
|
|
195
|
+
/** Plugin release refs (CMS-installed) — multi-version, one ref per published version. */
|
|
196
|
+
plugins: IRegistryReleaseRef[];
|
|
197
|
+
/** Optional path to the security advisory feed. */
|
|
198
|
+
advisoriesUrl?: string;
|
|
199
|
+
/** Optional path to the cross-component compatibility feed. */
|
|
200
|
+
compatibilityUrl?: string;
|
|
201
|
+
/** Optional path to the public trusted-keys file. */
|
|
202
|
+
trustedKeysUrl?: string;
|
|
186
203
|
}
|
|
187
204
|
|
|
188
205
|
/**
|
|
@@ -820,4 +837,4 @@ declare function isPluginRuntimeShimSpecifier(value: unknown): value is TPluginR
|
|
|
820
837
|
*/
|
|
821
838
|
declare const PLUGIN_RUNTIME_IMPORT_MAP: Readonly<Record<TPluginRuntimeShimSpecifier, string>>;
|
|
822
839
|
|
|
823
|
-
export { type IAdminPageDefinition, type IFieldRendererDefinition, type IMenuItemDefinition, type IMobilePluginApi, type IMobilePluginRegistration, type IPluginApi, type IPluginFeatureFlag, type IPluginFieldRendererProps, type IPluginHealthCheck, type IPluginLock, type IPluginLockEntry, type IPluginLockMigration, type IPluginLockMobileEntry, type IPluginRealtimePublisher, type IPluginRealtimeTopic, type IPluginRegistration, type IPluginRegistry, type
|
|
840
|
+
export { type IAdminPageDefinition, type IFieldRendererDefinition, type IMenuItemDefinition, type IMobilePluginApi, type IMobilePluginRegistration, type IPluginApi, type IPluginFeatureFlag, type IPluginFieldRendererProps, type IPluginHealthCheck, type IPluginLock, type IPluginLockEntry, type IPluginLockMigration, type IPluginLockMobileEntry, type IPluginRealtimePublisher, type IPluginRealtimeTopic, type IPluginRegistration, type IPluginRegistry, type IPluginRelease, type IRealtimeTransport, type IRegistryReleaseRef, type IRegistrySignatureBlock, type IRichTextEditorAdapter, type IRichTextEditorAdapterOptions, type IRichTextEditorValue, type IStyleDefinition, type IUsePluginRealtimeOptions, type IUsePluginRealtimeResult, PLUGIN_API_VERSION, PLUGIN_REGISTRY_CHANNELS, PLUGIN_RUNTIME_GLOBAL_KEY, PLUGIN_RUNTIME_IMPORT_MAP, PLUGIN_RUNTIME_SHIM_BASE_PATH, PLUGIN_RUNTIME_SHIM_SPECIFIERS, type TPluginRegistryChannel, type TPluginRuntimeShimSpecifier, type TRealtimeTransportFactory, assertCmsCompatibility, assertPluginApiVersion, assertPluginVersionSemantics, buildPluginRuntimeShimPath, compareSemver, defineMobilePlugin, definePlugin, definePluginRealtimeTopic, isPluginApiCompatible, isPluginRuntimeShimSpecifier, parseSemver, satisfiesSemverRange, usePluginRealtime };
|
package/dist/plugin-sdk/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var plugin_sdk_exports = {};
|
|
22
22
|
__export(plugin_sdk_exports, {
|
|
23
23
|
PLUGIN_API_VERSION: () => PLUGIN_API_VERSION,
|
|
24
|
+
PLUGIN_REGISTRY_CHANNELS: () => PLUGIN_REGISTRY_CHANNELS,
|
|
24
25
|
PLUGIN_RUNTIME_GLOBAL_KEY: () => PLUGIN_RUNTIME_GLOBAL_KEY,
|
|
25
26
|
PLUGIN_RUNTIME_IMPORT_MAP: () => PLUGIN_RUNTIME_IMPORT_MAP,
|
|
26
27
|
PLUGIN_RUNTIME_SHIM_BASE_PATH: () => PLUGIN_RUNTIME_SHIM_BASE_PATH,
|
|
@@ -42,7 +43,7 @@ __export(plugin_sdk_exports, {
|
|
|
42
43
|
module.exports = __toCommonJS(plugin_sdk_exports);
|
|
43
44
|
|
|
44
45
|
// src/plugin-sdk/version.ts
|
|
45
|
-
var PLUGIN_API_VERSION = "1.
|
|
46
|
+
var PLUGIN_API_VERSION = "0.1.0";
|
|
46
47
|
var SEMVER_REGEX = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/;
|
|
47
48
|
function parseSemver(version) {
|
|
48
49
|
const match = SEMVER_REGEX.exec(version);
|
|
@@ -170,6 +171,9 @@ function assertPluginVersionSemantics(prevVersion, nextVersion, options) {
|
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
173
|
|
|
174
|
+
// src/plugin-sdk/registry.ts
|
|
175
|
+
var PLUGIN_REGISTRY_CHANNELS = ["stable", "beta", "nightly", "test"];
|
|
176
|
+
|
|
173
177
|
// src/registry/styles.registry.ts
|
|
174
178
|
var BASE_STYLE_REGISTRY = {
|
|
175
179
|
// ===== auth =====
|
|
@@ -511,6 +515,7 @@ var PLUGIN_RUNTIME_IMPORT_MAP = Object.freeze(
|
|
|
511
515
|
// Annotate the CommonJS export names for ESM import in node:
|
|
512
516
|
0 && (module.exports = {
|
|
513
517
|
PLUGIN_API_VERSION,
|
|
518
|
+
PLUGIN_REGISTRY_CHANNELS,
|
|
514
519
|
PLUGIN_RUNTIME_GLOBAL_KEY,
|
|
515
520
|
PLUGIN_RUNTIME_IMPORT_MAP,
|
|
516
521
|
PLUGIN_RUNTIME_SHIM_BASE_PATH,
|