@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.
Files changed (64) hide show
  1. package/CHANGELOG.md +341 -326
  2. package/LICENSE +381 -381
  3. package/README.md +57 -57
  4. package/dist/index.d.mts +25 -1
  5. package/dist/index.d.ts +25 -1
  6. package/dist/index.js +2 -0
  7. package/dist/index.mjs +2 -0
  8. package/package.json +102 -102
  9. package/src/api/__tests__/endpoints.test.ts +45 -0
  10. package/src/api/endpoints.ts +2 -0
  11. package/src/api/index.ts +5 -5
  12. package/src/assets/__tests__/resolveAssetUrl.test.ts +61 -61
  13. package/src/assets/index.ts +5 -5
  14. package/src/assets/resolveAssetUrl.ts +44 -44
  15. package/src/cms-classes/__tests__/classify.test.ts +63 -63
  16. package/src/cms-classes/allow-list.ts +158 -158
  17. package/src/cms-classes/classify.ts +90 -90
  18. package/src/cms-classes/index.ts +7 -7
  19. package/src/cms-classes/remap.ts +44 -44
  20. package/src/condition/__tests__/evaluate.test.ts +54 -54
  21. package/src/condition/evaluate.ts +121 -121
  22. package/src/condition/index.ts +5 -5
  23. package/src/index.ts +25 -25
  24. package/src/interpolation/__tests__/replaceCalcedValues.test.ts +41 -41
  25. package/src/interpolation/index.ts +5 -5
  26. package/src/interpolation/replaceCalcedValues.ts +27 -27
  27. package/src/plugin-sdk/define.ts +89 -89
  28. package/src/plugin-sdk/index.ts +103 -103
  29. package/src/plugin-sdk/lock.ts +124 -124
  30. package/src/plugin-sdk/manifest.ts +307 -307
  31. package/src/plugin-sdk/realtime.ts +277 -277
  32. package/src/plugin-sdk/registry.ts +105 -105
  33. package/src/plugin-sdk/runtime-shim.ts +140 -140
  34. package/src/plugin-sdk/types.ts +315 -315
  35. package/src/plugin-sdk/version.ts +209 -209
  36. package/src/registry/__tests__/registry.test.ts +135 -135
  37. package/src/registry/index.ts +94 -94
  38. package/src/registry/styles.registry.ts +295 -295
  39. package/src/testing/__tests__/testing-kit.test.ts +228 -228
  40. package/src/testing/index.ts +483 -483
  41. package/src/theme/index.ts +6 -6
  42. package/src/theme/tailwind.ts +73 -73
  43. package/src/theme/tokens.ts +177 -177
  44. package/src/types/api/auth.ts +22 -0
  45. package/src/types/api/envelope.ts +34 -34
  46. package/src/types/api/forms.ts +76 -76
  47. package/src/types/api/index.ts +9 -9
  48. package/src/types/api/language.ts +12 -12
  49. package/src/types/api/page.ts +9 -9
  50. package/src/types/index.ts +17 -17
  51. package/src/types/mantine/common.ts +142 -142
  52. package/src/types/pages.ts +107 -107
  53. package/src/types/styles/auth.ts +184 -184
  54. package/src/types/styles/base.ts +72 -72
  55. package/src/types/styles/composite.ts +131 -131
  56. package/src/types/styles/forms.ts +439 -439
  57. package/src/types/styles/interactive.ts +165 -165
  58. package/src/types/styles/layout.ts +184 -184
  59. package/src/types/styles/media.ts +68 -68
  60. package/src/types/styles/typography.ts +118 -118
  61. package/src/types/styles/unknown.ts +220 -220
  62. package/src/utils/__tests__/transformPageData.test.ts +69 -69
  63. package/src/utils/spacing.ts +64 -64
  64. package/src/utils/transformPageData.ts +99 -99
@@ -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
+ }