@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
package/src/plugin-sdk/lock.ts
CHANGED
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
/*
|
|
2
|
-
SPDX-FileCopyrightText: 2026 Humdek, University of Bern
|
|
3
|
-
SPDX-License-Identifier: MPL-2.0
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* TypeScript mirror of `selfhelp.plugins.lock.json`. This file lives at
|
|
7
|
-
* the project root of the backend deployment and is the deterministic
|
|
8
|
-
* source of truth for which plugin versions are installed, what migrations
|
|
9
|
-
* ran, which checksums are pinned, and what mobile packages each EAS
|
|
10
|
-
* profile bundles.
|
|
11
|
-
*
|
|
12
|
-
* The lock file is written atomically by the install/update command. It
|
|
13
|
-
* is NEVER edited by hand.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
export interface IPluginLockMigration {
|
|
17
|
-
/** Doctrine migration class name. */
|
|
18
|
-
className: string;
|
|
19
|
-
/** Migration file SHA-256 hash, recorded for tamper detection. */
|
|
20
|
-
sha256: string;
|
|
21
|
-
/** ISO datetime the migration was executed. */
|
|
22
|
-
executedAt: string;
|
|
23
|
-
/** Whether `down()` is declared safe by the plugin. */
|
|
24
|
-
safeDown: boolean;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface IPluginLockMobileEntry {
|
|
28
|
-
/** EAS profile name (e.g. `production-default`, `production-bern`). */
|
|
29
|
-
profile: string;
|
|
30
|
-
/** npm package + version that this profile bundles for the plugin. */
|
|
31
|
-
package: string;
|
|
32
|
-
version: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface IPluginLockEntry {
|
|
36
|
-
/** Plugin id. */
|
|
37
|
-
id: string;
|
|
38
|
-
/** Pinned plugin version (the manifest version that was installed). */
|
|
39
|
-
version: string;
|
|
40
|
-
/** SDK contract version the plugin targets. */
|
|
41
|
-
pluginApiVersion: string;
|
|
42
|
-
/** Trust level recorded at install time. */
|
|
43
|
-
trustLevel: 'official' | 'reviewed' | 'untrusted';
|
|
44
|
-
/** Capabilities granted at install time. */
|
|
45
|
-
capabilities: string[];
|
|
46
|
-
/** Source descriptor that produced the install. */
|
|
47
|
-
source: {
|
|
48
|
-
kind: 'public-registry' | 'private-registry' | 'git' | 'local';
|
|
49
|
-
url?: string;
|
|
50
|
-
gitSha?: string;
|
|
51
|
-
registryUrl?: string;
|
|
52
|
-
};
|
|
53
|
-
/** Backend Composer package + version, if any. */
|
|
54
|
-
backend?: {
|
|
55
|
-
package: string;
|
|
56
|
-
version: string;
|
|
57
|
-
bundleClass: string;
|
|
58
|
-
};
|
|
59
|
-
/** Frontend npm package + version, if any. */
|
|
60
|
-
frontend?: {
|
|
61
|
-
package: string;
|
|
62
|
-
version: string;
|
|
63
|
-
};
|
|
64
|
-
/** Per-EAS-profile mobile package pin. */
|
|
65
|
-
mobile?: IPluginLockMobileEntry[];
|
|
66
|
-
/** SHA-256 checksum of the published artifact. */
|
|
67
|
-
checksumSha256: string;
|
|
68
|
-
/** Optional Ed25519 signature, base64. */
|
|
69
|
-
signatureEd25519?: string;
|
|
70
|
-
/** Hashes of every migration this plugin has executed. */
|
|
71
|
-
migrations: IPluginLockMigration[];
|
|
72
|
-
/** Plugin-owned style names contributed at install time. */
|
|
73
|
-
ownedStyles: string[];
|
|
74
|
-
/** Plugin-owned API route names contributed at install time. */
|
|
75
|
-
ownedApiRoutes: string[];
|
|
76
|
-
/** Plugin-owned realtime topics contributed at install time. */
|
|
77
|
-
ownedRealtimeTopics: string[];
|
|
78
|
-
/** Plugin-owned lookup type codes (`plugin_owned`) contributed at install time. */
|
|
79
|
-
ownedLookupTypeCodes: string[];
|
|
80
|
-
/** Feature flags shipped with the plugin and their default state. */
|
|
81
|
-
featureFlags: { key: string; defaultEnabled: boolean }[];
|
|
82
|
-
/** Whether the plugin is currently enabled. */
|
|
83
|
-
enabled: boolean;
|
|
84
|
-
/** ISO datetime of the install/update event. */
|
|
85
|
-
installedAt: string;
|
|
86
|
-
/** ISO datetime of the last update. */
|
|
87
|
-
updatedAt: string;
|
|
88
|
-
/** Optional notes that the installer wants to surface. */
|
|
89
|
-
notes?: string;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Root document of `selfhelp.plugins.lock.json`.
|
|
94
|
-
*
|
|
95
|
-
* Mirrors `plugin-lock.schema.json`. The schema requires
|
|
96
|
-
* `lockfileVersion`, `generatedAt`, `sdk`, and `plugins`. The schema
|
|
97
|
-
* stores plugins as a keyed object (`{ [pluginId]: lockedPlugin }`),
|
|
98
|
-
* but for typed consumers we expose it as an array of entries plus the
|
|
99
|
-
* keyed object so both shapes are usable.
|
|
100
|
-
*/
|
|
101
|
-
export interface IPluginLock {
|
|
102
|
-
/** Lock-file schema generation. Bumped only on breaking changes. */
|
|
103
|
-
lockfileVersion: number;
|
|
104
|
-
/** ISO datetime the lock file was last written. */
|
|
105
|
-
generatedAt: string;
|
|
106
|
-
/** SDK contract pin captured at write time. */
|
|
107
|
-
sdk: {
|
|
108
|
-
/** SemVer of the `@selfhelp/shared` package that wrote this file. */
|
|
109
|
-
version: string;
|
|
110
|
-
/** Plugin API version the host honors at write time. */
|
|
111
|
-
pluginApiVersion: string;
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* Installed plugins keyed by plugin id. Each entry follows
|
|
115
|
-
* `IPluginLockEntry`. The schema stores this as an object, not an
|
|
116
|
-
* array, so iteration order is undefined.
|
|
117
|
-
*/
|
|
118
|
-
plugins: Record<string, IPluginLockEntry>;
|
|
119
|
-
/**
|
|
120
|
-
* Optional install mode hint, preserved for tooling that already
|
|
121
|
-
* read it from earlier lock-file revisions.
|
|
122
|
-
*/
|
|
123
|
-
installMode?: 'development' | 'managed' | 'trusted';
|
|
124
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
SPDX-FileCopyrightText: 2026 Humdek, University of Bern
|
|
3
|
+
SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* TypeScript mirror of `selfhelp.plugins.lock.json`. This file lives at
|
|
7
|
+
* the project root of the backend deployment and is the deterministic
|
|
8
|
+
* source of truth for which plugin versions are installed, what migrations
|
|
9
|
+
* ran, which checksums are pinned, and what mobile packages each EAS
|
|
10
|
+
* profile bundles.
|
|
11
|
+
*
|
|
12
|
+
* The lock file is written atomically by the install/update command. It
|
|
13
|
+
* is NEVER edited by hand.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export interface IPluginLockMigration {
|
|
17
|
+
/** Doctrine migration class name. */
|
|
18
|
+
className: string;
|
|
19
|
+
/** Migration file SHA-256 hash, recorded for tamper detection. */
|
|
20
|
+
sha256: string;
|
|
21
|
+
/** ISO datetime the migration was executed. */
|
|
22
|
+
executedAt: string;
|
|
23
|
+
/** Whether `down()` is declared safe by the plugin. */
|
|
24
|
+
safeDown: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface IPluginLockMobileEntry {
|
|
28
|
+
/** EAS profile name (e.g. `production-default`, `production-bern`). */
|
|
29
|
+
profile: string;
|
|
30
|
+
/** npm package + version that this profile bundles for the plugin. */
|
|
31
|
+
package: string;
|
|
32
|
+
version: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface IPluginLockEntry {
|
|
36
|
+
/** Plugin id. */
|
|
37
|
+
id: string;
|
|
38
|
+
/** Pinned plugin version (the manifest version that was installed). */
|
|
39
|
+
version: string;
|
|
40
|
+
/** SDK contract version the plugin targets. */
|
|
41
|
+
pluginApiVersion: string;
|
|
42
|
+
/** Trust level recorded at install time. */
|
|
43
|
+
trustLevel: 'official' | 'reviewed' | 'untrusted';
|
|
44
|
+
/** Capabilities granted at install time. */
|
|
45
|
+
capabilities: string[];
|
|
46
|
+
/** Source descriptor that produced the install. */
|
|
47
|
+
source: {
|
|
48
|
+
kind: 'public-registry' | 'private-registry' | 'git' | 'local';
|
|
49
|
+
url?: string;
|
|
50
|
+
gitSha?: string;
|
|
51
|
+
registryUrl?: string;
|
|
52
|
+
};
|
|
53
|
+
/** Backend Composer package + version, if any. */
|
|
54
|
+
backend?: {
|
|
55
|
+
package: string;
|
|
56
|
+
version: string;
|
|
57
|
+
bundleClass: string;
|
|
58
|
+
};
|
|
59
|
+
/** Frontend npm package + version, if any. */
|
|
60
|
+
frontend?: {
|
|
61
|
+
package: string;
|
|
62
|
+
version: string;
|
|
63
|
+
};
|
|
64
|
+
/** Per-EAS-profile mobile package pin. */
|
|
65
|
+
mobile?: IPluginLockMobileEntry[];
|
|
66
|
+
/** SHA-256 checksum of the published artifact. */
|
|
67
|
+
checksumSha256: string;
|
|
68
|
+
/** Optional Ed25519 signature, base64. */
|
|
69
|
+
signatureEd25519?: string;
|
|
70
|
+
/** Hashes of every migration this plugin has executed. */
|
|
71
|
+
migrations: IPluginLockMigration[];
|
|
72
|
+
/** Plugin-owned style names contributed at install time. */
|
|
73
|
+
ownedStyles: string[];
|
|
74
|
+
/** Plugin-owned API route names contributed at install time. */
|
|
75
|
+
ownedApiRoutes: string[];
|
|
76
|
+
/** Plugin-owned realtime topics contributed at install time. */
|
|
77
|
+
ownedRealtimeTopics: string[];
|
|
78
|
+
/** Plugin-owned lookup type codes (`plugin_owned`) contributed at install time. */
|
|
79
|
+
ownedLookupTypeCodes: string[];
|
|
80
|
+
/** Feature flags shipped with the plugin and their default state. */
|
|
81
|
+
featureFlags: { key: string; defaultEnabled: boolean }[];
|
|
82
|
+
/** Whether the plugin is currently enabled. */
|
|
83
|
+
enabled: boolean;
|
|
84
|
+
/** ISO datetime of the install/update event. */
|
|
85
|
+
installedAt: string;
|
|
86
|
+
/** ISO datetime of the last update. */
|
|
87
|
+
updatedAt: string;
|
|
88
|
+
/** Optional notes that the installer wants to surface. */
|
|
89
|
+
notes?: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Root document of `selfhelp.plugins.lock.json`.
|
|
94
|
+
*
|
|
95
|
+
* Mirrors `plugin-lock.schema.json`. The schema requires
|
|
96
|
+
* `lockfileVersion`, `generatedAt`, `sdk`, and `plugins`. The schema
|
|
97
|
+
* stores plugins as a keyed object (`{ [pluginId]: lockedPlugin }`),
|
|
98
|
+
* but for typed consumers we expose it as an array of entries plus the
|
|
99
|
+
* keyed object so both shapes are usable.
|
|
100
|
+
*/
|
|
101
|
+
export interface IPluginLock {
|
|
102
|
+
/** Lock-file schema generation. Bumped only on breaking changes. */
|
|
103
|
+
lockfileVersion: number;
|
|
104
|
+
/** ISO datetime the lock file was last written. */
|
|
105
|
+
generatedAt: string;
|
|
106
|
+
/** SDK contract pin captured at write time. */
|
|
107
|
+
sdk: {
|
|
108
|
+
/** SemVer of the `@selfhelp/shared` package that wrote this file. */
|
|
109
|
+
version: string;
|
|
110
|
+
/** Plugin API version the host honors at write time. */
|
|
111
|
+
pluginApiVersion: string;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Installed plugins keyed by plugin id. Each entry follows
|
|
115
|
+
* `IPluginLockEntry`. The schema stores this as an object, not an
|
|
116
|
+
* array, so iteration order is undefined.
|
|
117
|
+
*/
|
|
118
|
+
plugins: Record<string, IPluginLockEntry>;
|
|
119
|
+
/**
|
|
120
|
+
* Optional install mode hint, preserved for tooling that already
|
|
121
|
+
* read it from earlier lock-file revisions.
|
|
122
|
+
*/
|
|
123
|
+
installMode?: 'development' | 'managed' | 'trusted';
|
|
124
|
+
}
|