@selfhelp/shared 1.7.0 → 1.8.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 +60 -0
- package/dist/index.d.mts +49 -13
- package/dist/index.d.ts +49 -13
- package/dist/index.js +5 -5
- package/dist/index.mjs +5 -5
- package/dist/plugin-sdk/index.d.mts +1 -1
- package/dist/plugin-sdk/index.d.ts +1 -1
- package/dist/plugin-sdk/index.js +8 -8
- package/dist/plugin-sdk/index.mjs +8 -8
- package/dist/registry/index.d.mts +2 -2
- package/dist/registry/index.d.ts +2 -2
- package/dist/registry/index.js +5 -5
- package/dist/registry/index.mjs +5 -5
- package/dist/{styles.registry-D49K8F5z.d.ts → styles.registry-ClluRYkN.d.ts} +17 -17
- package/dist/{styles.registry-B147FVHY.d.mts → styles.registry-nl8uzvMN.d.mts} +17 -17
- package/package.json +7 -4
- package/src/condition/evaluate.ts +1 -1
- package/src/plugin-sdk/realtime.ts +3 -3
- package/src/registry/styles.registry.ts +5 -5
- package/src/testing/index.ts +2 -2
- package/src/types/__tests__/channel-parity.test.ts +1 -1
- package/src/types/__tests__/distribution.test.ts +1 -1
- package/src/types/api/__tests__/compatibility-error-parity.test.ts +1 -1
- package/src/types/api/__tests__/system.test.ts +22 -22
- package/src/types/api/system.ts +15 -8
- package/src/types/distribution.ts +31 -0
- package/src/types/styles/auth.ts +2 -2
- package/src/types/styles/base.ts +1 -1
- package/src/types/styles/composite.ts +3 -3
- package/src/types/styles/error.ts +2 -2
- package/src/types/styles/forms.ts +1 -1
- package/src/utils/spacing.ts +4 -1
|
@@ -77,7 +77,7 @@ interface IValidateStyle extends IStyleWithSpacing {
|
|
|
77
77
|
redirect_text?: IContentField<string>;
|
|
78
78
|
}
|
|
79
79
|
interface IResetPasswordStyle extends IStyleWithSpacing {
|
|
80
|
-
style_name: '
|
|
80
|
+
style_name: 'reset-password';
|
|
81
81
|
label_pw_reset?: IContentField<string>;
|
|
82
82
|
type?: IContentField<string>;
|
|
83
83
|
alert_success?: IContentField<string>;
|
|
@@ -98,7 +98,7 @@ interface IResetPasswordStyle extends IStyleWithSpacing {
|
|
|
98
98
|
reset_error_pw_mismatch?: IContentField<string>;
|
|
99
99
|
}
|
|
100
100
|
interface ITwoFactorAuthStyle extends IStyleWithSpacing {
|
|
101
|
-
style_name: '
|
|
101
|
+
style_name: 'two-factor-auth';
|
|
102
102
|
label_code?: IContentField<string>;
|
|
103
103
|
label_submit?: IContentField<string>;
|
|
104
104
|
alert_fail?: IContentField<string>;
|
|
@@ -1034,7 +1034,7 @@ interface IShowUserInputEntry {
|
|
|
1034
1034
|
[key: string]: unknown;
|
|
1035
1035
|
}
|
|
1036
1036
|
interface IShowUserInputStyle extends IBaseStyle {
|
|
1037
|
-
style_name: '
|
|
1037
|
+
style_name: 'show-user-input';
|
|
1038
1038
|
own_entries_only?: IContentField<string>;
|
|
1039
1039
|
show_timestamp?: IContentField<string>;
|
|
1040
1040
|
dt_sortable?: IContentField<string>;
|
|
@@ -1137,14 +1137,14 @@ interface IListItemStyle extends IStyleWithSpacing {
|
|
|
1137
1137
|
use_mantine_style?: IContentField<string>;
|
|
1138
1138
|
}
|
|
1139
1139
|
interface IEntryListStyle extends IBaseStyle {
|
|
1140
|
-
style_name: '
|
|
1140
|
+
style_name: 'entry-list';
|
|
1141
1141
|
line_clamp?: IContentField<TMantineLineClamp>;
|
|
1142
1142
|
}
|
|
1143
1143
|
interface IEntryRecordStyle extends IBaseStyle {
|
|
1144
|
-
style_name: '
|
|
1144
|
+
style_name: 'entry-record';
|
|
1145
1145
|
}
|
|
1146
1146
|
interface IEntryRecordDeleteStyle extends IBaseStyle {
|
|
1147
|
-
style_name: '
|
|
1147
|
+
style_name: 'entry-record-delete';
|
|
1148
1148
|
}
|
|
1149
1149
|
interface ILoopStyle extends IBaseStyle {
|
|
1150
1150
|
style_name: 'loop';
|
|
@@ -1217,7 +1217,7 @@ interface IContentField<T> {
|
|
|
1217
1217
|
* - `condition` is a JSON-Logic expression evaluated client-side for
|
|
1218
1218
|
* visibility (mirrors backend `ConditionService`).
|
|
1219
1219
|
* - `data_config` is an optional JSON config string used by data-bound
|
|
1220
|
-
* styles (
|
|
1220
|
+
* styles (entry-list, form-record, …).
|
|
1221
1221
|
*/
|
|
1222
1222
|
interface IBaseStyle {
|
|
1223
1223
|
id: number;
|
|
@@ -1332,13 +1332,13 @@ declare const BASE_STYLE_REGISTRY: {
|
|
|
1332
1332
|
readonly frontendOnly: true;
|
|
1333
1333
|
readonly canHaveChildren: true;
|
|
1334
1334
|
};
|
|
1335
|
-
readonly
|
|
1335
|
+
readonly 'reset-password': {
|
|
1336
1336
|
readonly description: "Reset password form";
|
|
1337
1337
|
readonly category: "auth";
|
|
1338
1338
|
readonly frontendOnly: true;
|
|
1339
1339
|
readonly canHaveChildren: false;
|
|
1340
1340
|
};
|
|
1341
|
-
readonly
|
|
1341
|
+
readonly 'two-factor-auth': {
|
|
1342
1342
|
readonly description: "Two-factor auth code form";
|
|
1343
1343
|
readonly category: "auth";
|
|
1344
1344
|
readonly frontendOnly: true;
|
|
@@ -1782,19 +1782,19 @@ declare const BASE_STYLE_REGISTRY: {
|
|
|
1782
1782
|
readonly frontendOnly: true;
|
|
1783
1783
|
readonly canHaveChildren: true;
|
|
1784
1784
|
};
|
|
1785
|
-
readonly
|
|
1785
|
+
readonly 'entry-list': {
|
|
1786
1786
|
readonly description: "Data-driven list of entries (form-log table)";
|
|
1787
1787
|
readonly category: "composite";
|
|
1788
1788
|
readonly frontendOnly: true;
|
|
1789
1789
|
readonly canHaveChildren: true;
|
|
1790
1790
|
};
|
|
1791
|
-
readonly
|
|
1791
|
+
readonly 'entry-record': {
|
|
1792
1792
|
readonly description: "Single-record container";
|
|
1793
1793
|
readonly category: "composite";
|
|
1794
1794
|
readonly frontendOnly: true;
|
|
1795
1795
|
readonly canHaveChildren: true;
|
|
1796
1796
|
};
|
|
1797
|
-
readonly
|
|
1797
|
+
readonly 'entry-record-delete': {
|
|
1798
1798
|
readonly description: "Inline delete confirmation for an entry";
|
|
1799
1799
|
readonly category: "composite";
|
|
1800
1800
|
readonly frontendOnly: true;
|
|
@@ -1832,13 +1832,13 @@ declare const STYLE_REGISTRY: {
|
|
|
1832
1832
|
readonly frontendOnly: true;
|
|
1833
1833
|
readonly canHaveChildren: true;
|
|
1834
1834
|
};
|
|
1835
|
-
readonly
|
|
1835
|
+
readonly 'reset-password': {
|
|
1836
1836
|
readonly description: "Reset password form";
|
|
1837
1837
|
readonly category: "auth";
|
|
1838
1838
|
readonly frontendOnly: true;
|
|
1839
1839
|
readonly canHaveChildren: false;
|
|
1840
1840
|
};
|
|
1841
|
-
readonly
|
|
1841
|
+
readonly 'two-factor-auth': {
|
|
1842
1842
|
readonly description: "Two-factor auth code form";
|
|
1843
1843
|
readonly category: "auth";
|
|
1844
1844
|
readonly frontendOnly: true;
|
|
@@ -2282,19 +2282,19 @@ declare const STYLE_REGISTRY: {
|
|
|
2282
2282
|
readonly frontendOnly: true;
|
|
2283
2283
|
readonly canHaveChildren: true;
|
|
2284
2284
|
};
|
|
2285
|
-
readonly
|
|
2285
|
+
readonly 'entry-list': {
|
|
2286
2286
|
readonly description: "Data-driven list of entries (form-log table)";
|
|
2287
2287
|
readonly category: "composite";
|
|
2288
2288
|
readonly frontendOnly: true;
|
|
2289
2289
|
readonly canHaveChildren: true;
|
|
2290
2290
|
};
|
|
2291
|
-
readonly
|
|
2291
|
+
readonly 'entry-record': {
|
|
2292
2292
|
readonly description: "Single-record container";
|
|
2293
2293
|
readonly category: "composite";
|
|
2294
2294
|
readonly frontendOnly: true;
|
|
2295
2295
|
readonly canHaveChildren: true;
|
|
2296
2296
|
};
|
|
2297
|
-
readonly
|
|
2297
|
+
readonly 'entry-record-delete': {
|
|
2298
2298
|
readonly description: "Inline delete confirmation for an entry";
|
|
2299
2299
|
readonly category: "composite";
|
|
2300
2300
|
readonly frontendOnly: true;
|
|
@@ -77,7 +77,7 @@ interface IValidateStyle extends IStyleWithSpacing {
|
|
|
77
77
|
redirect_text?: IContentField<string>;
|
|
78
78
|
}
|
|
79
79
|
interface IResetPasswordStyle extends IStyleWithSpacing {
|
|
80
|
-
style_name: '
|
|
80
|
+
style_name: 'reset-password';
|
|
81
81
|
label_pw_reset?: IContentField<string>;
|
|
82
82
|
type?: IContentField<string>;
|
|
83
83
|
alert_success?: IContentField<string>;
|
|
@@ -98,7 +98,7 @@ interface IResetPasswordStyle extends IStyleWithSpacing {
|
|
|
98
98
|
reset_error_pw_mismatch?: IContentField<string>;
|
|
99
99
|
}
|
|
100
100
|
interface ITwoFactorAuthStyle extends IStyleWithSpacing {
|
|
101
|
-
style_name: '
|
|
101
|
+
style_name: 'two-factor-auth';
|
|
102
102
|
label_code?: IContentField<string>;
|
|
103
103
|
label_submit?: IContentField<string>;
|
|
104
104
|
alert_fail?: IContentField<string>;
|
|
@@ -1034,7 +1034,7 @@ interface IShowUserInputEntry {
|
|
|
1034
1034
|
[key: string]: unknown;
|
|
1035
1035
|
}
|
|
1036
1036
|
interface IShowUserInputStyle extends IBaseStyle {
|
|
1037
|
-
style_name: '
|
|
1037
|
+
style_name: 'show-user-input';
|
|
1038
1038
|
own_entries_only?: IContentField<string>;
|
|
1039
1039
|
show_timestamp?: IContentField<string>;
|
|
1040
1040
|
dt_sortable?: IContentField<string>;
|
|
@@ -1137,14 +1137,14 @@ interface IListItemStyle extends IStyleWithSpacing {
|
|
|
1137
1137
|
use_mantine_style?: IContentField<string>;
|
|
1138
1138
|
}
|
|
1139
1139
|
interface IEntryListStyle extends IBaseStyle {
|
|
1140
|
-
style_name: '
|
|
1140
|
+
style_name: 'entry-list';
|
|
1141
1141
|
line_clamp?: IContentField<TMantineLineClamp>;
|
|
1142
1142
|
}
|
|
1143
1143
|
interface IEntryRecordStyle extends IBaseStyle {
|
|
1144
|
-
style_name: '
|
|
1144
|
+
style_name: 'entry-record';
|
|
1145
1145
|
}
|
|
1146
1146
|
interface IEntryRecordDeleteStyle extends IBaseStyle {
|
|
1147
|
-
style_name: '
|
|
1147
|
+
style_name: 'entry-record-delete';
|
|
1148
1148
|
}
|
|
1149
1149
|
interface ILoopStyle extends IBaseStyle {
|
|
1150
1150
|
style_name: 'loop';
|
|
@@ -1217,7 +1217,7 @@ interface IContentField<T> {
|
|
|
1217
1217
|
* - `condition` is a JSON-Logic expression evaluated client-side for
|
|
1218
1218
|
* visibility (mirrors backend `ConditionService`).
|
|
1219
1219
|
* - `data_config` is an optional JSON config string used by data-bound
|
|
1220
|
-
* styles (
|
|
1220
|
+
* styles (entry-list, form-record, …).
|
|
1221
1221
|
*/
|
|
1222
1222
|
interface IBaseStyle {
|
|
1223
1223
|
id: number;
|
|
@@ -1332,13 +1332,13 @@ declare const BASE_STYLE_REGISTRY: {
|
|
|
1332
1332
|
readonly frontendOnly: true;
|
|
1333
1333
|
readonly canHaveChildren: true;
|
|
1334
1334
|
};
|
|
1335
|
-
readonly
|
|
1335
|
+
readonly 'reset-password': {
|
|
1336
1336
|
readonly description: "Reset password form";
|
|
1337
1337
|
readonly category: "auth";
|
|
1338
1338
|
readonly frontendOnly: true;
|
|
1339
1339
|
readonly canHaveChildren: false;
|
|
1340
1340
|
};
|
|
1341
|
-
readonly
|
|
1341
|
+
readonly 'two-factor-auth': {
|
|
1342
1342
|
readonly description: "Two-factor auth code form";
|
|
1343
1343
|
readonly category: "auth";
|
|
1344
1344
|
readonly frontendOnly: true;
|
|
@@ -1782,19 +1782,19 @@ declare const BASE_STYLE_REGISTRY: {
|
|
|
1782
1782
|
readonly frontendOnly: true;
|
|
1783
1783
|
readonly canHaveChildren: true;
|
|
1784
1784
|
};
|
|
1785
|
-
readonly
|
|
1785
|
+
readonly 'entry-list': {
|
|
1786
1786
|
readonly description: "Data-driven list of entries (form-log table)";
|
|
1787
1787
|
readonly category: "composite";
|
|
1788
1788
|
readonly frontendOnly: true;
|
|
1789
1789
|
readonly canHaveChildren: true;
|
|
1790
1790
|
};
|
|
1791
|
-
readonly
|
|
1791
|
+
readonly 'entry-record': {
|
|
1792
1792
|
readonly description: "Single-record container";
|
|
1793
1793
|
readonly category: "composite";
|
|
1794
1794
|
readonly frontendOnly: true;
|
|
1795
1795
|
readonly canHaveChildren: true;
|
|
1796
1796
|
};
|
|
1797
|
-
readonly
|
|
1797
|
+
readonly 'entry-record-delete': {
|
|
1798
1798
|
readonly description: "Inline delete confirmation for an entry";
|
|
1799
1799
|
readonly category: "composite";
|
|
1800
1800
|
readonly frontendOnly: true;
|
|
@@ -1832,13 +1832,13 @@ declare const STYLE_REGISTRY: {
|
|
|
1832
1832
|
readonly frontendOnly: true;
|
|
1833
1833
|
readonly canHaveChildren: true;
|
|
1834
1834
|
};
|
|
1835
|
-
readonly
|
|
1835
|
+
readonly 'reset-password': {
|
|
1836
1836
|
readonly description: "Reset password form";
|
|
1837
1837
|
readonly category: "auth";
|
|
1838
1838
|
readonly frontendOnly: true;
|
|
1839
1839
|
readonly canHaveChildren: false;
|
|
1840
1840
|
};
|
|
1841
|
-
readonly
|
|
1841
|
+
readonly 'two-factor-auth': {
|
|
1842
1842
|
readonly description: "Two-factor auth code form";
|
|
1843
1843
|
readonly category: "auth";
|
|
1844
1844
|
readonly frontendOnly: true;
|
|
@@ -2282,19 +2282,19 @@ declare const STYLE_REGISTRY: {
|
|
|
2282
2282
|
readonly frontendOnly: true;
|
|
2283
2283
|
readonly canHaveChildren: true;
|
|
2284
2284
|
};
|
|
2285
|
-
readonly
|
|
2285
|
+
readonly 'entry-list': {
|
|
2286
2286
|
readonly description: "Data-driven list of entries (form-log table)";
|
|
2287
2287
|
readonly category: "composite";
|
|
2288
2288
|
readonly frontendOnly: true;
|
|
2289
2289
|
readonly canHaveChildren: true;
|
|
2290
2290
|
};
|
|
2291
|
-
readonly
|
|
2291
|
+
readonly 'entry-record': {
|
|
2292
2292
|
readonly description: "Single-record container";
|
|
2293
2293
|
readonly category: "composite";
|
|
2294
2294
|
readonly frontendOnly: true;
|
|
2295
2295
|
readonly canHaveChildren: true;
|
|
2296
2296
|
};
|
|
2297
|
-
readonly
|
|
2297
|
+
readonly 'entry-record-delete': {
|
|
2298
2298
|
readonly description: "Inline delete confirmation for an entry";
|
|
2299
2299
|
readonly category: "composite";
|
|
2300
2300
|
readonly frontendOnly: true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selfhelp/shared",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
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",
|
|
@@ -54,7 +54,8 @@
|
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "tsup src/index.ts src/registry/index.ts src/theme/index.ts src/theme/tailwind.ts src/plugin-sdk/index.ts src/testing/index.ts --format cjs,esm --dts --clean --no-splitting",
|
|
56
56
|
"dev": "tsup src/index.ts src/registry/index.ts src/theme/index.ts src/theme/tailwind.ts src/plugin-sdk/index.ts src/testing/index.ts --format cjs,esm --dts --watch --no-splitting",
|
|
57
|
-
"lint": "eslint .
|
|
57
|
+
"lint": "eslint .",
|
|
58
|
+
"lint:fix": "eslint . --fix",
|
|
58
59
|
"typecheck": "tsc --noEmit",
|
|
59
60
|
"test": "vitest run --passWithNoTests",
|
|
60
61
|
"test:coverage": "vitest run --coverage",
|
|
@@ -78,17 +79,19 @@
|
|
|
78
79
|
}
|
|
79
80
|
},
|
|
80
81
|
"devDependencies": {
|
|
82
|
+
"@eslint/js": "^9.18.0",
|
|
81
83
|
"@types/json-logic-js": "^2.0.8",
|
|
82
84
|
"@types/node": "^22.10.0",
|
|
83
85
|
"@types/react": "^19.2.15",
|
|
84
|
-
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
85
|
-
"@typescript-eslint/parser": "^8.0.0",
|
|
86
86
|
"@vitest/coverage-istanbul": "^2.1.9",
|
|
87
87
|
"eslint": "^9.18.0",
|
|
88
|
+
"eslint-plugin-unused-imports": "^4.1.4",
|
|
89
|
+
"globals": "^14.0.0",
|
|
88
90
|
"license-check-and-add": "^4.0.5",
|
|
89
91
|
"react": "^19.2.6",
|
|
90
92
|
"tsup": "^8.3.5",
|
|
91
93
|
"typescript": "^5.6.0",
|
|
94
|
+
"typescript-eslint": "^8.18.0",
|
|
92
95
|
"vitest": "^2.1.0"
|
|
93
96
|
},
|
|
94
97
|
"publishConfig": {
|
|
@@ -100,7 +100,7 @@ export function evaluateCondition(
|
|
|
100
100
|
// jsonLogic typings are loose; the result of any boolean rule is
|
|
101
101
|
// a boolean, but rules like {var: 'x'} can return raw values, so
|
|
102
102
|
// we coerce.
|
|
103
|
-
const raw = jsonLogic.apply(parsed as jsonLogic.RulesLogic, context
|
|
103
|
+
const raw: unknown = jsonLogic.apply(parsed as jsonLogic.RulesLogic, context);
|
|
104
104
|
const visible = Boolean(raw);
|
|
105
105
|
return options.withDebug
|
|
106
106
|
? { visible, debug: { condition: trimmed, result: visible, variables: { ...context } } }
|
|
@@ -167,7 +167,7 @@ export function usePluginRealtime<TPayload = unknown>(
|
|
|
167
167
|
useEffect(() => {
|
|
168
168
|
if (!enabled) {
|
|
169
169
|
setIsOnline(false);
|
|
170
|
-
return;
|
|
170
|
+
return undefined;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
const factory = transportFactory ?? (isEventSourceAvailable() ? defaultTransportFactory : null);
|
|
@@ -176,7 +176,7 @@ export function usePluginRealtime<TPayload = unknown>(
|
|
|
176
176
|
// `react-native-sse`). Stay quiet — the plan forbids polling
|
|
177
177
|
// here; the consumer must render an offline banner instead.
|
|
178
178
|
setIsOnline(false);
|
|
179
|
-
return;
|
|
179
|
+
return undefined;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
let cancelled = false;
|
|
@@ -190,7 +190,7 @@ export function usePluginRealtime<TPayload = unknown>(
|
|
|
190
190
|
} catch (err) {
|
|
191
191
|
setError(err instanceof Error ? err : new Error(String(err)));
|
|
192
192
|
setIsOnline(false);
|
|
193
|
-
return;
|
|
193
|
+
return undefined;
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
const eventName = `plugin/${pluginId}/${expandedTopic}`;
|
|
@@ -81,8 +81,8 @@ export const BASE_STYLE_REGISTRY = {
|
|
|
81
81
|
login: { description: 'User login form', category: 'auth', frontendOnly: true, canHaveChildren: false },
|
|
82
82
|
register: { description: 'User registration form', category: 'auth', frontendOnly: true, canHaveChildren: false },
|
|
83
83
|
validate: { description: 'Email/account validation flow', category: 'auth', frontendOnly: true, canHaveChildren: true },
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
'reset-password': { description: 'Reset password form', category: 'auth', frontendOnly: true, canHaveChildren: false },
|
|
85
|
+
'two-factor-auth': { description: 'Two-factor auth code form', category: 'auth', frontendOnly: true, canHaveChildren: false },
|
|
86
86
|
profile: { description: 'User profile management', category: 'auth', frontendOnly: true, canHaveChildren: false },
|
|
87
87
|
|
|
88
88
|
// ===== layout =====
|
|
@@ -168,9 +168,9 @@ export const BASE_STYLE_REGISTRY = {
|
|
|
168
168
|
timeline: { description: 'Mantine Timeline', category: 'composite', frontendOnly: true, canHaveChildren: true },
|
|
169
169
|
list: { description: 'Mantine List', category: 'composite', frontendOnly: true, canHaveChildren: true },
|
|
170
170
|
'list-item': { description: 'Mantine List.Item', category: 'composite', frontendOnly: true, canHaveChildren: true },
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
'entry-list': { description: 'Data-driven list of entries (form-log table)', category: 'composite', frontendOnly: true, canHaveChildren: true },
|
|
172
|
+
'entry-record': { description: 'Single-record container', category: 'composite', frontendOnly: true, canHaveChildren: true },
|
|
173
|
+
'entry-record-delete': { description: 'Inline delete confirmation for an entry', category: 'composite', frontendOnly: true, canHaveChildren: false },
|
|
174
174
|
loop: { description: 'Loop / repeater over backend-provided rows', category: 'composite', frontendOnly: true, canHaveChildren: true },
|
|
175
175
|
} as const satisfies Record<string, IStyleRegistryEntry>;
|
|
176
176
|
|
package/src/testing/index.ts
CHANGED
|
@@ -468,12 +468,12 @@ export interface ILockFileSeed {
|
|
|
468
468
|
export function seedFromLockFile(lockJson: unknown): ILockFileSeed {
|
|
469
469
|
const plugins: ILockFilePluginEntry[] = [];
|
|
470
470
|
if (lockJson && typeof lockJson === 'object' && 'plugins' in lockJson) {
|
|
471
|
-
const raw =
|
|
471
|
+
const raw = lockJson.plugins;
|
|
472
472
|
if (raw && typeof raw === 'object') {
|
|
473
473
|
for (const [pluginId, entry] of Object.entries(raw as Record<string, unknown>)) {
|
|
474
474
|
const version =
|
|
475
475
|
entry && typeof entry === 'object' && 'version' in entry
|
|
476
|
-
? String(
|
|
476
|
+
? String(entry.version)
|
|
477
477
|
: '0.0.0';
|
|
478
478
|
plugins.push({ pluginId, version });
|
|
479
479
|
}
|
|
@@ -67,7 +67,7 @@ describe('release-channel enum parity', () => {
|
|
|
67
67
|
const matches = [...src.matchAll(/channel:\s*\{\s*enum:\s*(\[[^\]]*\])/g)];
|
|
68
68
|
expect(matches.length).toBeGreaterThan(0);
|
|
69
69
|
for (const m of matches) {
|
|
70
|
-
const arr = JSON.parse(m[1]
|
|
70
|
+
const arr = JSON.parse(m[1].replace(/'/g, '"')) as string[];
|
|
71
71
|
expect([...arr].sort()).toEqual([...CANONICAL].sort());
|
|
72
72
|
}
|
|
73
73
|
});
|
|
@@ -53,7 +53,7 @@ const SPEC: Record<string, { required: string[]; optional?: string[]; kind?: str
|
|
|
53
53
|
},
|
|
54
54
|
'instance-manifest.json': {
|
|
55
55
|
required: ['manifestVersion', 'instanceId', 'displayName', 'domain', 'mode', 'createdAt', 'updatedAt', 'registry', 'versions', 'images', 'routing', 'installedPlugins'],
|
|
56
|
-
optional: ['resources'],
|
|
56
|
+
optional: ['resources', 'backupSchedule', 'envOverrides'],
|
|
57
57
|
},
|
|
58
58
|
'instance-lock.json': {
|
|
59
59
|
required: ['lockfileVersion', 'generatedAt', 'registry', 'core', 'services', 'plugins'],
|
|
@@ -50,7 +50,7 @@ function interfaceFields(source: string, name: string): string[] {
|
|
|
50
50
|
const line = rawLine.trim();
|
|
51
51
|
if (line === '' || line.startsWith('//') || line.startsWith('*') || line.startsWith('/*')) continue;
|
|
52
52
|
const m = /^([A-Za-z_][A-Za-z0-9_]*)\??\s*:/.exec(line);
|
|
53
|
-
if (m) fields.push(m[1]
|
|
53
|
+
if (m) fields.push(m[1]);
|
|
54
54
|
}
|
|
55
55
|
return fields;
|
|
56
56
|
}
|
|
@@ -4,27 +4,27 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { describe, expect, it } from 'vitest';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
IFrontendUpdatePreflight,
|
|
10
|
-
IFrontendUpdateReleases,
|
|
11
|
-
IFrontendUpdateRequest,
|
|
12
|
-
IFrontendUpdateRequestResponse,
|
|
13
|
-
IMaintenanceSetRequest,
|
|
14
|
-
ISystemAdvisories,
|
|
15
|
-
ISystemAdvisoriesResponse,
|
|
16
|
-
ISystemAdvisory,
|
|
17
|
-
ISystemHealth,
|
|
18
|
-
ISystemMaintenance,
|
|
19
|
-
ISystemVersion,
|
|
20
|
-
IUpdatePreflight,
|
|
21
|
-
IUpdateRequest,
|
|
22
|
-
IUpdateRequestResponse,
|
|
23
|
-
IUpdateStatus,
|
|
24
|
-
IUpdateStatusResponse,
|
|
25
|
-
TSystemAdvisorySeverity,
|
|
26
|
-
TUpdateKind,
|
|
27
|
-
TUpdateOperationStatus,
|
|
7
|
+
import {
|
|
8
|
+
SYSTEM_ENDPOINTS,
|
|
9
|
+
type IFrontendUpdatePreflight,
|
|
10
|
+
type IFrontendUpdateReleases,
|
|
11
|
+
type IFrontendUpdateRequest,
|
|
12
|
+
type IFrontendUpdateRequestResponse,
|
|
13
|
+
type IMaintenanceSetRequest,
|
|
14
|
+
type ISystemAdvisories,
|
|
15
|
+
type ISystemAdvisoriesResponse,
|
|
16
|
+
type ISystemAdvisory,
|
|
17
|
+
type ISystemHealth,
|
|
18
|
+
type ISystemMaintenance,
|
|
19
|
+
type ISystemVersion,
|
|
20
|
+
type IUpdatePreflight,
|
|
21
|
+
type IUpdateRequest,
|
|
22
|
+
type IUpdateRequestResponse,
|
|
23
|
+
type IUpdateStatus,
|
|
24
|
+
type IUpdateStatusResponse,
|
|
25
|
+
type TSystemAdvisorySeverity,
|
|
26
|
+
type TUpdateKind,
|
|
27
|
+
type TUpdateOperationStatus,
|
|
28
28
|
} from '../system';
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -226,7 +226,7 @@ describe('system maintenance contracts', () => {
|
|
|
226
226
|
rollback: { automatic_before_migrations: true, automatic_after_destructive_migrations: false },
|
|
227
227
|
};
|
|
228
228
|
|
|
229
|
-
const check = blocked.checks[0]
|
|
229
|
+
const check = blocked.checks[0];
|
|
230
230
|
expect(blocked.status).toBe('blocked');
|
|
231
231
|
expect(check.component).toBe('plugin');
|
|
232
232
|
expect(check.component_id).toBe('sh2-shp-survey-js');
|
package/src/types/api/system.ts
CHANGED
|
@@ -178,9 +178,11 @@ export interface IUpdatePreflightCheck {
|
|
|
178
178
|
message: string;
|
|
179
179
|
/**
|
|
180
180
|
* Standardized compatibility-error fields. Version/compatibility checks
|
|
181
|
-
* (
|
|
182
|
-
*
|
|
183
|
-
*
|
|
181
|
+
* (`plugin_compatibility` for a core update blocked by an installed plugin;
|
|
182
|
+
* `frontend_compatibility` for a frontend-only update the running core
|
|
183
|
+
* forbids or that needs a different core) populate these so the
|
|
184
|
+
* admin/operator sees exactly which component blocks which target and the
|
|
185
|
+
* range it requires. Absent on non-compatibility checks.
|
|
184
186
|
*/
|
|
185
187
|
component?: string;
|
|
186
188
|
component_id?: string;
|
|
@@ -385,11 +387,16 @@ export type IFrontendUpdateReleases = IUpdateReleases;
|
|
|
385
387
|
export type IFrontendUpdateReleasesResponse = IUpdateReleasesResponse;
|
|
386
388
|
|
|
387
389
|
/**
|
|
388
|
-
* GET /admin/system/update/frontend/preflight —
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
* the
|
|
390
|
+
* GET /admin/system/update/frontend/preflight — compatibility verdict for a
|
|
391
|
+
* frontend-only target. Reuses {@link IUpdatePreflight}; the frontend is
|
|
392
|
+
* stateless so `database.destructive`/`requires_backup` are always false. The
|
|
393
|
+
* frontend ⇄ core compatibility rule IS evaluated here (as a
|
|
394
|
+
* `frontend_compatibility` check) against the same signed registry metadata the
|
|
395
|
+
* SelfHelp Manager resolves, so the CMS verdict matches the manager's instead of
|
|
396
|
+
* always reporting "OK"; the manager still re-verifies signatures + image
|
|
397
|
+
* digests at execution and remains the final authority (it also enforces the
|
|
398
|
+
* running core's range from the instance lock when the core release has left the
|
|
399
|
+
* registry). Aliased for call-site clarity.
|
|
393
400
|
*/
|
|
394
401
|
export type IFrontendUpdatePreflight = IUpdatePreflight;
|
|
395
402
|
export type IFrontendUpdatePreflightResponse = IUpdatePreflightResponse;
|
|
@@ -121,6 +121,29 @@ export interface InstanceResourceConfig {
|
|
|
121
121
|
logMaxFiles?: number;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
/**
|
|
125
|
+
* GFS (grandfather-father-son) retention numbers for SCHEDULED backups.
|
|
126
|
+
* Mirrors the manager's authoritative `BackupRetentionPolicy`
|
|
127
|
+
* (sh-manager/packages/schemas/src/types.ts).
|
|
128
|
+
*/
|
|
129
|
+
export interface BackupRetentionPolicy {
|
|
130
|
+
daily: number;
|
|
131
|
+
weekly: number;
|
|
132
|
+
monthly: number;
|
|
133
|
+
maxAgeDays: number;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Per-instance nightly backup schedule stored in the instance manifest.
|
|
138
|
+
* Mirrors the manager's authoritative `BackupSchedulePolicy`.
|
|
139
|
+
*/
|
|
140
|
+
export interface BackupSchedulePolicy {
|
|
141
|
+
enabled: boolean;
|
|
142
|
+
/** Daily run time as `HH:MM` in the manager server's local time. */
|
|
143
|
+
time: string;
|
|
144
|
+
retention: BackupRetentionPolicy;
|
|
145
|
+
}
|
|
146
|
+
|
|
124
147
|
export interface InstanceManifest {
|
|
125
148
|
manifestVersion: number;
|
|
126
149
|
instanceId: string;
|
|
@@ -139,6 +162,14 @@ export interface InstanceManifest {
|
|
|
139
162
|
routing: InstanceRouting;
|
|
140
163
|
installedPlugins: InstalledPlugin[];
|
|
141
164
|
resources?: InstanceResourceConfig;
|
|
165
|
+
/** Optional scheduled-backup policy; absent = no scheduled backups. */
|
|
166
|
+
backupSchedule?: BackupSchedulePolicy;
|
|
167
|
+
/**
|
|
168
|
+
* Operator-set non-secret environment overrides merged on top of the
|
|
169
|
+
* generated `.env`. Manager-controlled structural keys and secrets are
|
|
170
|
+
* never stored here. Mirrors the manager's authoritative manifest contract.
|
|
171
|
+
*/
|
|
172
|
+
envOverrides?: Record<string, string>;
|
|
142
173
|
}
|
|
143
174
|
|
|
144
175
|
// ---------------------------------------------------------------------------
|
package/src/types/styles/auth.ts
CHANGED
|
@@ -85,7 +85,7 @@ export interface IValidateStyle extends IStyleWithSpacing {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
export interface IResetPasswordStyle extends IStyleWithSpacing {
|
|
88
|
-
style_name: '
|
|
88
|
+
style_name: 'reset-password';
|
|
89
89
|
label_pw_reset?: IContentField<string>;
|
|
90
90
|
type?: IContentField<string>;
|
|
91
91
|
alert_success?: IContentField<string>;
|
|
@@ -107,7 +107,7 @@ export interface IResetPasswordStyle extends IStyleWithSpacing {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
export interface ITwoFactorAuthStyle extends IStyleWithSpacing {
|
|
110
|
-
style_name: '
|
|
110
|
+
style_name: 'two-factor-auth';
|
|
111
111
|
label_code?: IContentField<string>;
|
|
112
112
|
label_submit?: IContentField<string>;
|
|
113
113
|
alert_fail?: IContentField<string>;
|
package/src/types/styles/base.ts
CHANGED
|
@@ -36,7 +36,7 @@ export interface IContentField<T> {
|
|
|
36
36
|
* - `condition` is a JSON-Logic expression evaluated client-side for
|
|
37
37
|
* visibility (mirrors backend `ConditionService`).
|
|
38
38
|
* - `data_config` is an optional JSON config string used by data-bound
|
|
39
|
-
* styles (
|
|
39
|
+
* styles (entry-list, form-record, …).
|
|
40
40
|
*/
|
|
41
41
|
export interface IBaseStyle {
|
|
42
42
|
id: number;
|
|
@@ -113,16 +113,16 @@ export interface IListItemStyle extends IStyleWithSpacing {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
export interface IEntryListStyle extends IBaseStyle {
|
|
116
|
-
style_name: '
|
|
116
|
+
style_name: 'entry-list';
|
|
117
117
|
line_clamp?: IContentField<TMantineLineClamp>;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
export interface IEntryRecordStyle extends IBaseStyle {
|
|
121
|
-
style_name: '
|
|
121
|
+
style_name: 'entry-record';
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
export interface IEntryRecordDeleteStyle extends IBaseStyle {
|
|
125
|
-
style_name: '
|
|
125
|
+
style_name: 'entry-record-delete';
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
export interface ILoopStyle extends IBaseStyle {
|
|
@@ -5,7 +5,7 @@ SPDX-License-Identifier: MPL-2.0
|
|
|
5
5
|
import type { IContentField, IStyleWithSpacing } from './base';
|
|
6
6
|
|
|
7
7
|
export interface INoAccessStyle extends IStyleWithSpacing {
|
|
8
|
-
style_name: '
|
|
8
|
+
style_name: 'no-access';
|
|
9
9
|
title?: IContentField<string>;
|
|
10
10
|
message?: IContentField<string>;
|
|
11
11
|
button_label?: IContentField<string>;
|
|
@@ -19,7 +19,7 @@ export interface INoAccessStyle extends IStyleWithSpacing {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export interface INotFoundStyle extends IStyleWithSpacing {
|
|
22
|
-
style_name: '
|
|
22
|
+
style_name: 'not-found';
|
|
23
23
|
title?: IContentField<string>;
|
|
24
24
|
message?: IContentField<string>;
|
|
25
25
|
button_label?: IContentField<string>;
|
|
@@ -446,7 +446,7 @@ export interface IShowUserInputEntry {
|
|
|
446
446
|
}
|
|
447
447
|
|
|
448
448
|
export interface IShowUserInputStyle extends IBaseStyle {
|
|
449
|
-
style_name: '
|
|
449
|
+
style_name: 'show-user-input';
|
|
450
450
|
own_entries_only?: IContentField<string>;
|
|
451
451
|
show_timestamp?: IContentField<string>;
|
|
452
452
|
dt_sortable?: IContentField<string>;
|
package/src/utils/spacing.ts
CHANGED
|
@@ -55,7 +55,10 @@ export function spacingToClasses(
|
|
|
55
55
|
spacingToTailwind: Record<string, string>
|
|
56
56
|
): string[] {
|
|
57
57
|
const classes: string[] = [];
|
|
58
|
-
|
|
58
|
+
// `Object.entries` widens the value of an index-signature-free interface to
|
|
59
|
+
// `any`; restate the real `ISpacingValue` value type so the computed lookup
|
|
60
|
+
// below stays type-safe. Runtime behaviour is unchanged.
|
|
61
|
+
for (const [key, raw] of Object.entries(spacing) as Array<[string, string | undefined]>) {
|
|
59
62
|
if (!raw) continue;
|
|
60
63
|
const tail = spacingToTailwind[raw] ?? raw;
|
|
61
64
|
classes.push(`${key}-${tail}`);
|