@selfhelp/shared 1.2.5 → 1.3.1
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 +341 -326
- package/LICENSE +381 -381
- package/README.md +57 -57
- package/dist/index.d.mts +25 -1
- package/dist/index.d.ts +25 -1
- package/dist/index.js +2 -0
- package/dist/index.mjs +2 -0
- package/package.json +102 -102
- package/src/api/__tests__/endpoints.test.ts +45 -0
- package/src/api/endpoints.ts +2 -0
- package/src/api/index.ts +5 -5
- package/src/assets/__tests__/resolveAssetUrl.test.ts +61 -61
- package/src/assets/index.ts +5 -5
- package/src/assets/resolveAssetUrl.ts +44 -44
- package/src/cms-classes/__tests__/classify.test.ts +63 -63
- package/src/cms-classes/allow-list.ts +158 -158
- package/src/cms-classes/classify.ts +90 -90
- package/src/cms-classes/index.ts +7 -7
- package/src/cms-classes/remap.ts +44 -44
- package/src/condition/__tests__/evaluate.test.ts +54 -54
- package/src/condition/evaluate.ts +121 -121
- package/src/condition/index.ts +5 -5
- package/src/index.ts +25 -25
- package/src/interpolation/__tests__/replaceCalcedValues.test.ts +41 -41
- package/src/interpolation/index.ts +5 -5
- package/src/interpolation/replaceCalcedValues.ts +27 -27
- package/src/plugin-sdk/define.ts +89 -89
- package/src/plugin-sdk/index.ts +103 -103
- package/src/plugin-sdk/lock.ts +124 -124
- package/src/plugin-sdk/manifest.ts +307 -307
- package/src/plugin-sdk/realtime.ts +277 -277
- package/src/plugin-sdk/registry.ts +105 -105
- package/src/plugin-sdk/runtime-shim.ts +140 -140
- package/src/plugin-sdk/types.ts +315 -315
- package/src/plugin-sdk/version.ts +209 -209
- package/src/registry/__tests__/registry.test.ts +135 -135
- package/src/registry/index.ts +94 -94
- package/src/registry/styles.registry.ts +295 -295
- package/src/testing/__tests__/testing-kit.test.ts +228 -228
- package/src/testing/index.ts +483 -483
- package/src/theme/index.ts +6 -6
- package/src/theme/tailwind.ts +73 -73
- package/src/theme/tokens.ts +177 -177
- package/src/types/api/auth.ts +22 -0
- package/src/types/api/envelope.ts +34 -34
- package/src/types/api/forms.ts +76 -76
- package/src/types/api/index.ts +9 -9
- package/src/types/api/language.ts +12 -12
- package/src/types/api/page.ts +9 -9
- package/src/types/index.ts +17 -17
- package/src/types/mantine/common.ts +142 -142
- package/src/types/pages.ts +107 -107
- package/src/types/styles/auth.ts +184 -184
- package/src/types/styles/base.ts +72 -72
- package/src/types/styles/composite.ts +131 -131
- package/src/types/styles/forms.ts +439 -439
- package/src/types/styles/interactive.ts +165 -165
- package/src/types/styles/layout.ts +184 -184
- package/src/types/styles/media.ts +68 -68
- package/src/types/styles/typography.ts +118 -118
- package/src/types/styles/unknown.ts +220 -220
- package/src/utils/__tests__/transformPageData.test.ts +69 -69
- package/src/utils/spacing.ts +64 -64
- package/src/utils/transformPageData.ts +99 -99
|
@@ -1,307 +1,307 @@
|
|
|
1
|
-
/*
|
|
2
|
-
SPDX-FileCopyrightText: 2026 Humdek, University of Bern
|
|
3
|
-
SPDX-License-Identifier: MPL-2.0
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* TypeScript mirror of `plugin.json` (the schema lives in
|
|
7
|
-
* `sh-selfhelp_backend/docs/plugins/plugin-manifest.schema.json`). When
|
|
8
|
-
* the JSON Schema changes, update these types and bump the
|
|
9
|
-
* `@selfhelp/shared` minor version.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
export type IPluginManifestTrustLevel = 'official' | 'reviewed' | 'untrusted';
|
|
13
|
-
|
|
14
|
-
/** Every privileged capability is deny-by-default. */
|
|
15
|
-
export type IPluginManifestCapability =
|
|
16
|
-
| 'backendBundle'
|
|
17
|
-
| 'databaseMigrations'
|
|
18
|
-
| 'readUsers'
|
|
19
|
-
| 'writeUsers'
|
|
20
|
-
| 'deleteUsers'
|
|
21
|
-
| 'readDataTables'
|
|
22
|
-
| 'writeDataTables'
|
|
23
|
-
| 'deleteDataTables'
|
|
24
|
-
| 'externalNetworkAccess'
|
|
25
|
-
| 'scheduledJobs'
|
|
26
|
-
| 'publicCallbacks'
|
|
27
|
-
| 'adminPages'
|
|
28
|
-
| 'frontendStyles'
|
|
29
|
-
| 'mobileStyles'
|
|
30
|
-
| 'realtimePublish'
|
|
31
|
-
| 'fileUploads'
|
|
32
|
-
| 'secretAccess'
|
|
33
|
-
| 'lookupExtend'
|
|
34
|
-
| 'lookupOwnGroup';
|
|
35
|
-
|
|
36
|
-
export interface IPluginManifestCompatibility {
|
|
37
|
-
/** SemVer range for the SelfHelp CMS version (e.g. `^2.0`). */
|
|
38
|
-
selfhelp: string;
|
|
39
|
-
/** SemVer range for PHP runtime. */
|
|
40
|
-
php?: string;
|
|
41
|
-
/** SemVer range for Node runtime. */
|
|
42
|
-
node?: string;
|
|
43
|
-
/** SemVer range for React (web). */
|
|
44
|
-
react?: string;
|
|
45
|
-
/** SemVer range for React Native (mobile). */
|
|
46
|
-
reactNative?: string;
|
|
47
|
-
/** SemVer range for Expo SDK. */
|
|
48
|
-
expoSdk?: string;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface IPluginManifestDependency {
|
|
52
|
-
/** Plugin id this plugin requires. */
|
|
53
|
-
pluginId: string;
|
|
54
|
-
/** Required SemVer range. */
|
|
55
|
-
version: string;
|
|
56
|
-
/** Optional / required dependency. */
|
|
57
|
-
required: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* When `required: false`, the plugin still works without the dep
|
|
60
|
-
* but enables additional features when present.
|
|
61
|
-
*/
|
|
62
|
-
featureFlag?: string;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface IPluginManifestConflict {
|
|
66
|
-
pluginId: string;
|
|
67
|
-
/** SemVer range that conflicts. */
|
|
68
|
-
version: string;
|
|
69
|
-
reason: string;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface IPluginManifestExternalHost {
|
|
73
|
-
/** Wildcards allowed, e.g. `cdn.example.com` or `*.example.com`. */
|
|
74
|
-
host: string;
|
|
75
|
-
/** What is loaded — `script`, `style`, `font`, `image`, `iframe`, `fetch`. */
|
|
76
|
-
type: 'script' | 'style' | 'font' | 'image' | 'iframe' | 'fetch';
|
|
77
|
-
/** Reason for the external host (shown in admin UI). */
|
|
78
|
-
reason: string;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface IPluginManifestSecurity {
|
|
82
|
-
trustLevel: IPluginManifestTrustLevel;
|
|
83
|
-
capabilities: IPluginManifestCapability[];
|
|
84
|
-
/** CSP rules the installer must add (only for `trustLevel !== 'untrusted'`). */
|
|
85
|
-
cspRules?: {
|
|
86
|
-
/** Maps a CSP directive to extra sources. */
|
|
87
|
-
[directive: string]: string[];
|
|
88
|
-
};
|
|
89
|
-
/** External hosts the plugin will load assets/data from. */
|
|
90
|
-
externalHosts?: IPluginManifestExternalHost[];
|
|
91
|
-
/** Path to file containing checksum/signature, optional. */
|
|
92
|
-
signaturePath?: string;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export interface IPluginManifestDataAccess {
|
|
96
|
-
/**
|
|
97
|
-
* Dedicated tables the plugin owns (created by its migrations). Must be
|
|
98
|
-
* `lowercase_snake_case` (schema pattern `^[a-z][a-z0-9_]*$`).
|
|
99
|
-
*/
|
|
100
|
-
ownedTables?: string[];
|
|
101
|
-
/**
|
|
102
|
-
* Prefix for CMS `data_tables` rows the plugin creates at runtime. Must be
|
|
103
|
-
* `lowercase_snake_case` ending in `_` (schema pattern `^[a-z][a-z0-9_]*_$`).
|
|
104
|
-
*/
|
|
105
|
-
ownedDataTablePrefix?: string;
|
|
106
|
-
/**
|
|
107
|
-
* Tables the plugin reads. May be `dataTable:*` for any plugin-owned
|
|
108
|
-
* data table, `lookup:<typeCode>` for lookup reads, `dataTable:my`
|
|
109
|
-
* for tables created by this plugin.
|
|
110
|
-
*/
|
|
111
|
-
read?: string[];
|
|
112
|
-
/** Tables the plugin writes. */
|
|
113
|
-
write?: string[];
|
|
114
|
-
/** Tables the plugin deletes (rare; requires capability). */
|
|
115
|
-
delete?: string[];
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export interface IPluginManifestRealtimeTopic {
|
|
119
|
-
/** Topic key, scoped to this plugin. Example: `survey-response`. */
|
|
120
|
-
key: string;
|
|
121
|
-
/** Human description shown in admin UI. */
|
|
122
|
-
description: string;
|
|
123
|
-
/** Permission required to subscribe; resolved via `PluginRealtimePermissionResolver`. */
|
|
124
|
-
requiredPermission?: string;
|
|
125
|
-
/** JSON Schema path of the topic payload. */
|
|
126
|
-
payloadSchemaPath?: string;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export interface IPluginManifestFeatureFlag {
|
|
130
|
-
key: string;
|
|
131
|
-
description: string;
|
|
132
|
-
/** Default state when no `plugin_feature_flags` row exists. */
|
|
133
|
-
defaultEnabled: boolean;
|
|
134
|
-
/** Optional capability gate; flag cannot be turned on without it. */
|
|
135
|
-
capability?: IPluginManifestCapability;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export interface IPluginManifestLookupExtension {
|
|
139
|
-
/** Lookup type code, e.g. `survey_question_type`. */
|
|
140
|
-
typeCode: string;
|
|
141
|
-
/** Whether the plugin OWNS the type code or only extends it. */
|
|
142
|
-
ownership: 'plugin_extendable' | 'plugin_owned';
|
|
143
|
-
entries: {
|
|
144
|
-
code: string;
|
|
145
|
-
value: string;
|
|
146
|
-
description?: string;
|
|
147
|
-
}[];
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export interface IPluginManifestPermission {
|
|
151
|
-
/** Permission key, namespaced like `surveyjs.surveys.manage`. */
|
|
152
|
-
key: string;
|
|
153
|
-
description: string;
|
|
154
|
-
/** Optional default role keys the permission is granted to. */
|
|
155
|
-
defaultRoles?: string[];
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export interface IPluginManifestStyle {
|
|
159
|
-
/** Style name (used as `style_name` discriminator). */
|
|
160
|
-
name: string;
|
|
161
|
-
description: string;
|
|
162
|
-
canHaveChildren: boolean;
|
|
163
|
-
/** Optional capability requirement (e.g. `frontendStyles`). */
|
|
164
|
-
capability?: IPluginManifestCapability;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export interface IPluginManifestAdminPage {
|
|
168
|
-
/** Slug under `/admin/plugins-host/{pluginId}/`. */
|
|
169
|
-
slug: string;
|
|
170
|
-
/** Menu label. */
|
|
171
|
-
label: string;
|
|
172
|
-
/** Required permission key. */
|
|
173
|
-
permission: string;
|
|
174
|
-
/** Optional menu icon (Tabler icon name). */
|
|
175
|
-
icon?: string;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export interface IPluginManifestApiRoute {
|
|
179
|
-
/** Symfony route name (must be namespaced with the plugin id). */
|
|
180
|
-
name: string;
|
|
181
|
-
/** HTTP path under `/cms-api/v1/plugins/{pluginId}/...`. */
|
|
182
|
-
path: string;
|
|
183
|
-
methods: ('GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE')[];
|
|
184
|
-
/** Permission key required. */
|
|
185
|
-
permission?: string;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export interface IPluginManifestScheduledJob {
|
|
189
|
-
/** Job type key. */
|
|
190
|
-
type: string;
|
|
191
|
-
description: string;
|
|
192
|
-
/** Capability gate (always requires `scheduledJobs`). */
|
|
193
|
-
capability: 'scheduledJobs';
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export interface IPluginManifestAsset {
|
|
197
|
-
/** Source path within the plugin package. */
|
|
198
|
-
src: string;
|
|
199
|
-
/** Destination path under `/assets/plugins/{pluginId}/...`. */
|
|
200
|
-
dest: string;
|
|
201
|
-
/** Asset type. */
|
|
202
|
-
type: 'script' | 'style' | 'font' | 'image' | 'other';
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
export interface IPluginManifestHealth {
|
|
206
|
-
/** Optional health-check endpoint name. */
|
|
207
|
-
endpoint?: string;
|
|
208
|
-
/** Health-check service id (resolved through Symfony). */
|
|
209
|
-
serviceId?: string;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
export interface IPluginManifestMobile {
|
|
213
|
-
/** npm package name of the mobile component bundle. */
|
|
214
|
-
package: string;
|
|
215
|
-
/** Required SemVer range. */
|
|
216
|
-
version: string;
|
|
217
|
-
/** Whether the mobile package only renders payloads (readonly). */
|
|
218
|
-
readonly: boolean;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Full `plugin.json` shape.
|
|
223
|
-
*/
|
|
224
|
-
export interface IPluginManifest {
|
|
225
|
-
/** Plugin identifier, e.g. `sh2-shp-survey-js`. */
|
|
226
|
-
id: string;
|
|
227
|
-
/** Human-readable display name. */
|
|
228
|
-
name: string;
|
|
229
|
-
/** Short description. */
|
|
230
|
-
description?: string;
|
|
231
|
-
/** Plugin SemVer version. */
|
|
232
|
-
version: string;
|
|
233
|
-
/** Author / vendor. */
|
|
234
|
-
author?: { name: string; email?: string; url?: string };
|
|
235
|
-
/** SPDX license id. */
|
|
236
|
-
license?: string;
|
|
237
|
-
/** Plugin homepage / repo URL. */
|
|
238
|
-
homepage?: string;
|
|
239
|
-
/** SDK contract version the plugin targets (e.g. `1.0`). */
|
|
240
|
-
pluginApiVersion: string;
|
|
241
|
-
|
|
242
|
-
/** Compatibility with the host stack. */
|
|
243
|
-
compatibility: IPluginManifestCompatibility;
|
|
244
|
-
|
|
245
|
-
/** Required + optional plugin dependencies. */
|
|
246
|
-
dependencies?: IPluginManifestDependency[];
|
|
247
|
-
|
|
248
|
-
/** Plugin conflicts. */
|
|
249
|
-
conflicts?: IPluginManifestConflict[];
|
|
250
|
-
|
|
251
|
-
/** Composer package (only for `trustLevel !== 'untrusted'`). */
|
|
252
|
-
backend?: {
|
|
253
|
-
package: string;
|
|
254
|
-
bundleClass: string;
|
|
255
|
-
migrationsNamespace?: string;
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
/** npm package for frontend. */
|
|
259
|
-
frontend?: {
|
|
260
|
-
package: string;
|
|
261
|
-
version: string;
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
/** Optional mobile package. */
|
|
265
|
-
mobile?: IPluginManifestMobile;
|
|
266
|
-
|
|
267
|
-
/** Required security declarations. */
|
|
268
|
-
security: IPluginManifestSecurity;
|
|
269
|
-
|
|
270
|
-
/** Permissions the plugin contributes. */
|
|
271
|
-
permissions?: IPluginManifestPermission[];
|
|
272
|
-
|
|
273
|
-
/** Manifest-declared data access. */
|
|
274
|
-
dataAccess?: IPluginManifestDataAccess;
|
|
275
|
-
|
|
276
|
-
/** Realtime topics. */
|
|
277
|
-
realtimeTopics?: IPluginManifestRealtimeTopic[];
|
|
278
|
-
|
|
279
|
-
/** Feature flags. */
|
|
280
|
-
featureFlags?: IPluginManifestFeatureFlag[];
|
|
281
|
-
|
|
282
|
-
/** Lookup contributions. */
|
|
283
|
-
lookups?: {
|
|
284
|
-
extends?: IPluginManifestLookupExtension[];
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
/** Styles contributed to the registry. */
|
|
288
|
-
styles?: IPluginManifestStyle[];
|
|
289
|
-
|
|
290
|
-
/** Admin pages mounted under `/admin/plugins-host/{pluginId}/`. */
|
|
291
|
-
adminPages?: IPluginManifestAdminPage[];
|
|
292
|
-
|
|
293
|
-
/** Plugin-owned API routes. */
|
|
294
|
-
apiRoutes?: IPluginManifestApiRoute[];
|
|
295
|
-
|
|
296
|
-
/** Scheduled jobs. */
|
|
297
|
-
scheduledJobs?: IPluginManifestScheduledJob[];
|
|
298
|
-
|
|
299
|
-
/** Vendored assets. */
|
|
300
|
-
assets?: IPluginManifestAsset[];
|
|
301
|
-
|
|
302
|
-
/** Health-check declaration. */
|
|
303
|
-
health?: IPluginManifestHealth;
|
|
304
|
-
|
|
305
|
-
/** Optional metadata / labels. */
|
|
306
|
-
labels?: Record<string, string>;
|
|
307
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
SPDX-FileCopyrightText: 2026 Humdek, University of Bern
|
|
3
|
+
SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* TypeScript mirror of `plugin.json` (the schema lives in
|
|
7
|
+
* `sh-selfhelp_backend/docs/plugins/plugin-manifest.schema.json`). When
|
|
8
|
+
* the JSON Schema changes, update these types and bump the
|
|
9
|
+
* `@selfhelp/shared` minor version.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export type IPluginManifestTrustLevel = 'official' | 'reviewed' | 'untrusted';
|
|
13
|
+
|
|
14
|
+
/** Every privileged capability is deny-by-default. */
|
|
15
|
+
export type IPluginManifestCapability =
|
|
16
|
+
| 'backendBundle'
|
|
17
|
+
| 'databaseMigrations'
|
|
18
|
+
| 'readUsers'
|
|
19
|
+
| 'writeUsers'
|
|
20
|
+
| 'deleteUsers'
|
|
21
|
+
| 'readDataTables'
|
|
22
|
+
| 'writeDataTables'
|
|
23
|
+
| 'deleteDataTables'
|
|
24
|
+
| 'externalNetworkAccess'
|
|
25
|
+
| 'scheduledJobs'
|
|
26
|
+
| 'publicCallbacks'
|
|
27
|
+
| 'adminPages'
|
|
28
|
+
| 'frontendStyles'
|
|
29
|
+
| 'mobileStyles'
|
|
30
|
+
| 'realtimePublish'
|
|
31
|
+
| 'fileUploads'
|
|
32
|
+
| 'secretAccess'
|
|
33
|
+
| 'lookupExtend'
|
|
34
|
+
| 'lookupOwnGroup';
|
|
35
|
+
|
|
36
|
+
export interface IPluginManifestCompatibility {
|
|
37
|
+
/** SemVer range for the SelfHelp CMS version (e.g. `^2.0`). */
|
|
38
|
+
selfhelp: string;
|
|
39
|
+
/** SemVer range for PHP runtime. */
|
|
40
|
+
php?: string;
|
|
41
|
+
/** SemVer range for Node runtime. */
|
|
42
|
+
node?: string;
|
|
43
|
+
/** SemVer range for React (web). */
|
|
44
|
+
react?: string;
|
|
45
|
+
/** SemVer range for React Native (mobile). */
|
|
46
|
+
reactNative?: string;
|
|
47
|
+
/** SemVer range for Expo SDK. */
|
|
48
|
+
expoSdk?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface IPluginManifestDependency {
|
|
52
|
+
/** Plugin id this plugin requires. */
|
|
53
|
+
pluginId: string;
|
|
54
|
+
/** Required SemVer range. */
|
|
55
|
+
version: string;
|
|
56
|
+
/** Optional / required dependency. */
|
|
57
|
+
required: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* When `required: false`, the plugin still works without the dep
|
|
60
|
+
* but enables additional features when present.
|
|
61
|
+
*/
|
|
62
|
+
featureFlag?: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface IPluginManifestConflict {
|
|
66
|
+
pluginId: string;
|
|
67
|
+
/** SemVer range that conflicts. */
|
|
68
|
+
version: string;
|
|
69
|
+
reason: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface IPluginManifestExternalHost {
|
|
73
|
+
/** Wildcards allowed, e.g. `cdn.example.com` or `*.example.com`. */
|
|
74
|
+
host: string;
|
|
75
|
+
/** What is loaded — `script`, `style`, `font`, `image`, `iframe`, `fetch`. */
|
|
76
|
+
type: 'script' | 'style' | 'font' | 'image' | 'iframe' | 'fetch';
|
|
77
|
+
/** Reason for the external host (shown in admin UI). */
|
|
78
|
+
reason: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface IPluginManifestSecurity {
|
|
82
|
+
trustLevel: IPluginManifestTrustLevel;
|
|
83
|
+
capabilities: IPluginManifestCapability[];
|
|
84
|
+
/** CSP rules the installer must add (only for `trustLevel !== 'untrusted'`). */
|
|
85
|
+
cspRules?: {
|
|
86
|
+
/** Maps a CSP directive to extra sources. */
|
|
87
|
+
[directive: string]: string[];
|
|
88
|
+
};
|
|
89
|
+
/** External hosts the plugin will load assets/data from. */
|
|
90
|
+
externalHosts?: IPluginManifestExternalHost[];
|
|
91
|
+
/** Path to file containing checksum/signature, optional. */
|
|
92
|
+
signaturePath?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface IPluginManifestDataAccess {
|
|
96
|
+
/**
|
|
97
|
+
* Dedicated tables the plugin owns (created by its migrations). Must be
|
|
98
|
+
* `lowercase_snake_case` (schema pattern `^[a-z][a-z0-9_]*$`).
|
|
99
|
+
*/
|
|
100
|
+
ownedTables?: string[];
|
|
101
|
+
/**
|
|
102
|
+
* Prefix for CMS `data_tables` rows the plugin creates at runtime. Must be
|
|
103
|
+
* `lowercase_snake_case` ending in `_` (schema pattern `^[a-z][a-z0-9_]*_$`).
|
|
104
|
+
*/
|
|
105
|
+
ownedDataTablePrefix?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Tables the plugin reads. May be `dataTable:*` for any plugin-owned
|
|
108
|
+
* data table, `lookup:<typeCode>` for lookup reads, `dataTable:my`
|
|
109
|
+
* for tables created by this plugin.
|
|
110
|
+
*/
|
|
111
|
+
read?: string[];
|
|
112
|
+
/** Tables the plugin writes. */
|
|
113
|
+
write?: string[];
|
|
114
|
+
/** Tables the plugin deletes (rare; requires capability). */
|
|
115
|
+
delete?: string[];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface IPluginManifestRealtimeTopic {
|
|
119
|
+
/** Topic key, scoped to this plugin. Example: `survey-response`. */
|
|
120
|
+
key: string;
|
|
121
|
+
/** Human description shown in admin UI. */
|
|
122
|
+
description: string;
|
|
123
|
+
/** Permission required to subscribe; resolved via `PluginRealtimePermissionResolver`. */
|
|
124
|
+
requiredPermission?: string;
|
|
125
|
+
/** JSON Schema path of the topic payload. */
|
|
126
|
+
payloadSchemaPath?: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface IPluginManifestFeatureFlag {
|
|
130
|
+
key: string;
|
|
131
|
+
description: string;
|
|
132
|
+
/** Default state when no `plugin_feature_flags` row exists. */
|
|
133
|
+
defaultEnabled: boolean;
|
|
134
|
+
/** Optional capability gate; flag cannot be turned on without it. */
|
|
135
|
+
capability?: IPluginManifestCapability;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface IPluginManifestLookupExtension {
|
|
139
|
+
/** Lookup type code, e.g. `survey_question_type`. */
|
|
140
|
+
typeCode: string;
|
|
141
|
+
/** Whether the plugin OWNS the type code or only extends it. */
|
|
142
|
+
ownership: 'plugin_extendable' | 'plugin_owned';
|
|
143
|
+
entries: {
|
|
144
|
+
code: string;
|
|
145
|
+
value: string;
|
|
146
|
+
description?: string;
|
|
147
|
+
}[];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface IPluginManifestPermission {
|
|
151
|
+
/** Permission key, namespaced like `surveyjs.surveys.manage`. */
|
|
152
|
+
key: string;
|
|
153
|
+
description: string;
|
|
154
|
+
/** Optional default role keys the permission is granted to. */
|
|
155
|
+
defaultRoles?: string[];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface IPluginManifestStyle {
|
|
159
|
+
/** Style name (used as `style_name` discriminator). */
|
|
160
|
+
name: string;
|
|
161
|
+
description: string;
|
|
162
|
+
canHaveChildren: boolean;
|
|
163
|
+
/** Optional capability requirement (e.g. `frontendStyles`). */
|
|
164
|
+
capability?: IPluginManifestCapability;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface IPluginManifestAdminPage {
|
|
168
|
+
/** Slug under `/admin/plugins-host/{pluginId}/`. */
|
|
169
|
+
slug: string;
|
|
170
|
+
/** Menu label. */
|
|
171
|
+
label: string;
|
|
172
|
+
/** Required permission key. */
|
|
173
|
+
permission: string;
|
|
174
|
+
/** Optional menu icon (Tabler icon name). */
|
|
175
|
+
icon?: string;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface IPluginManifestApiRoute {
|
|
179
|
+
/** Symfony route name (must be namespaced with the plugin id). */
|
|
180
|
+
name: string;
|
|
181
|
+
/** HTTP path under `/cms-api/v1/plugins/{pluginId}/...`. */
|
|
182
|
+
path: string;
|
|
183
|
+
methods: ('GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE')[];
|
|
184
|
+
/** Permission key required. */
|
|
185
|
+
permission?: string;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export interface IPluginManifestScheduledJob {
|
|
189
|
+
/** Job type key. */
|
|
190
|
+
type: string;
|
|
191
|
+
description: string;
|
|
192
|
+
/** Capability gate (always requires `scheduledJobs`). */
|
|
193
|
+
capability: 'scheduledJobs';
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface IPluginManifestAsset {
|
|
197
|
+
/** Source path within the plugin package. */
|
|
198
|
+
src: string;
|
|
199
|
+
/** Destination path under `/assets/plugins/{pluginId}/...`. */
|
|
200
|
+
dest: string;
|
|
201
|
+
/** Asset type. */
|
|
202
|
+
type: 'script' | 'style' | 'font' | 'image' | 'other';
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface IPluginManifestHealth {
|
|
206
|
+
/** Optional health-check endpoint name. */
|
|
207
|
+
endpoint?: string;
|
|
208
|
+
/** Health-check service id (resolved through Symfony). */
|
|
209
|
+
serviceId?: string;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface IPluginManifestMobile {
|
|
213
|
+
/** npm package name of the mobile component bundle. */
|
|
214
|
+
package: string;
|
|
215
|
+
/** Required SemVer range. */
|
|
216
|
+
version: string;
|
|
217
|
+
/** Whether the mobile package only renders payloads (readonly). */
|
|
218
|
+
readonly: boolean;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Full `plugin.json` shape.
|
|
223
|
+
*/
|
|
224
|
+
export interface IPluginManifest {
|
|
225
|
+
/** Plugin identifier, e.g. `sh2-shp-survey-js`. */
|
|
226
|
+
id: string;
|
|
227
|
+
/** Human-readable display name. */
|
|
228
|
+
name: string;
|
|
229
|
+
/** Short description. */
|
|
230
|
+
description?: string;
|
|
231
|
+
/** Plugin SemVer version. */
|
|
232
|
+
version: string;
|
|
233
|
+
/** Author / vendor. */
|
|
234
|
+
author?: { name: string; email?: string; url?: string };
|
|
235
|
+
/** SPDX license id. */
|
|
236
|
+
license?: string;
|
|
237
|
+
/** Plugin homepage / repo URL. */
|
|
238
|
+
homepage?: string;
|
|
239
|
+
/** SDK contract version the plugin targets (e.g. `1.0`). */
|
|
240
|
+
pluginApiVersion: string;
|
|
241
|
+
|
|
242
|
+
/** Compatibility with the host stack. */
|
|
243
|
+
compatibility: IPluginManifestCompatibility;
|
|
244
|
+
|
|
245
|
+
/** Required + optional plugin dependencies. */
|
|
246
|
+
dependencies?: IPluginManifestDependency[];
|
|
247
|
+
|
|
248
|
+
/** Plugin conflicts. */
|
|
249
|
+
conflicts?: IPluginManifestConflict[];
|
|
250
|
+
|
|
251
|
+
/** Composer package (only for `trustLevel !== 'untrusted'`). */
|
|
252
|
+
backend?: {
|
|
253
|
+
package: string;
|
|
254
|
+
bundleClass: string;
|
|
255
|
+
migrationsNamespace?: string;
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
/** npm package for frontend. */
|
|
259
|
+
frontend?: {
|
|
260
|
+
package: string;
|
|
261
|
+
version: string;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
/** Optional mobile package. */
|
|
265
|
+
mobile?: IPluginManifestMobile;
|
|
266
|
+
|
|
267
|
+
/** Required security declarations. */
|
|
268
|
+
security: IPluginManifestSecurity;
|
|
269
|
+
|
|
270
|
+
/** Permissions the plugin contributes. */
|
|
271
|
+
permissions?: IPluginManifestPermission[];
|
|
272
|
+
|
|
273
|
+
/** Manifest-declared data access. */
|
|
274
|
+
dataAccess?: IPluginManifestDataAccess;
|
|
275
|
+
|
|
276
|
+
/** Realtime topics. */
|
|
277
|
+
realtimeTopics?: IPluginManifestRealtimeTopic[];
|
|
278
|
+
|
|
279
|
+
/** Feature flags. */
|
|
280
|
+
featureFlags?: IPluginManifestFeatureFlag[];
|
|
281
|
+
|
|
282
|
+
/** Lookup contributions. */
|
|
283
|
+
lookups?: {
|
|
284
|
+
extends?: IPluginManifestLookupExtension[];
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
/** Styles contributed to the registry. */
|
|
288
|
+
styles?: IPluginManifestStyle[];
|
|
289
|
+
|
|
290
|
+
/** Admin pages mounted under `/admin/plugins-host/{pluginId}/`. */
|
|
291
|
+
adminPages?: IPluginManifestAdminPage[];
|
|
292
|
+
|
|
293
|
+
/** Plugin-owned API routes. */
|
|
294
|
+
apiRoutes?: IPluginManifestApiRoute[];
|
|
295
|
+
|
|
296
|
+
/** Scheduled jobs. */
|
|
297
|
+
scheduledJobs?: IPluginManifestScheduledJob[];
|
|
298
|
+
|
|
299
|
+
/** Vendored assets. */
|
|
300
|
+
assets?: IPluginManifestAsset[];
|
|
301
|
+
|
|
302
|
+
/** Health-check declaration. */
|
|
303
|
+
health?: IPluginManifestHealth;
|
|
304
|
+
|
|
305
|
+
/** Optional metadata / labels. */
|
|
306
|
+
labels?: Record<string, string>;
|
|
307
|
+
}
|