@selfhelp/shared 1.25.0 → 1.27.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 CHANGED
@@ -10,6 +10,32 @@ All notable changes to `@selfhelp/shared` will be documented in this file.
10
10
  This project follows semantic versioning.
11
11
 
12
12
 
13
+ ## v1.27.0
14
+
15
+ Minor: role-scope permission names (pairs with core `0.1.48`, frontend `0.1.75`).
16
+ Breaking rename of client permission constants; no backward compatibility (pre-release).
17
+
18
+ - **Removed** `PERMISSIONS.ADMIN_CMS_PREFERENCES_UPDATE` (`admin.cms_preferences.update`):
19
+ core 0.1.48 removes the permission (it guarded no route).
20
+ - **Removed** `PERMISSIONS.ADMIN_SETTINGS` (`admin.settings`) and
21
+ `PERMISSIONS.ADMIN_AUDIT_VIEW` (`admin.audit.view`).
22
+ - **Added** `ADMIN_LANGUAGE_READ` / `ADMIN_LANGUAGE_UPDATE`
23
+ (`admin.language.read` / `admin.language.update`), `ADMIN_AUDIT_READ`
24
+ (`admin.audit.read`), and `ADMIN_SECTION_READ` (`admin.section.read`).
25
+ - No mobile-preview constant (shared never had one).
26
+
27
+ ## v1.26.0
28
+
29
+ Minor: access cleanup contracts for page ACL and plugin public routes (pairs with
30
+ core `0.1.47`, frontend `0.1.74`).
31
+
32
+ - **Page ACL is one right.** `IPageItem` and `transformPageData` keep only
33
+ `acl_select`. The leftover `acl_insert` / `acl_update` / `acl_delete` fields
34
+ are removed (F03).
35
+ - **Plugin route `public`.** `IPluginManifestApiRoute` gains optional
36
+ `public?: boolean`. A route needs a permission **or** `public: true`, never
37
+ both and never neither (F09 / C3).
38
+
13
39
  ## v1.25.0
14
40
 
15
41
  Minor: Entry List with Form is its own form (pairs with core `0.1.45`, frontend
package/dist/index.d.mts CHANGED
@@ -52,10 +52,8 @@ interface IPageAccessTypeInfo {
52
52
  interface IPageItem extends IBasePageInfo {
53
53
  id_users?: number;
54
54
  id_pages?: number;
55
+ /** Page ACL: members of a group with this right can see the page and use its forms. */
55
56
  acl_select?: 0 | 1;
56
- acl_insert?: 0 | 1;
57
- acl_update?: 0 | 1;
58
- acl_delete?: 0 | 1;
59
57
  id_page_types?: number;
60
58
  id_page_access_types?: number;
61
59
  title?: string | null;
@@ -267,14 +265,15 @@ declare const PERMISSIONS: {
267
265
  readonly ADMIN_SCHEDULED_JOB_EXECUTE: "admin.scheduled_job.execute";
268
266
  readonly ADMIN_SCHEDULED_JOB_DELETE: "admin.scheduled_job.delete";
269
267
  readonly ADMIN_SCHEDULED_JOB_MANAGE: "admin.scheduled_job.manage";
268
+ readonly ADMIN_SECTION_READ: "admin.section.read";
270
269
  readonly ADMIN_SECTION_DELETE: "admin.section.delete";
271
- readonly ADMIN_SETTINGS: "admin.settings";
270
+ readonly ADMIN_LANGUAGE_READ: "admin.language.read";
271
+ readonly ADMIN_LANGUAGE_UPDATE: "admin.language.update";
272
272
  readonly ADMIN_CMS_PREFERENCES_READ: "admin.cms_preferences.read";
273
- readonly ADMIN_CMS_PREFERENCES_UPDATE: "admin.cms_preferences.update";
274
273
  readonly ADMIN_CACHE_READ: "admin.cache.read";
275
274
  readonly ADMIN_CACHE_CLEAR: "admin.cache.clear";
276
275
  readonly ADMIN_CACHE_MANAGE: "admin.cache.manage";
277
- readonly ADMIN_AUDIT_VIEW: "admin.audit.view";
276
+ readonly ADMIN_AUDIT_READ: "admin.audit.read";
278
277
  };
279
278
  type TPermission = (typeof PERMISSIONS)[keyof typeof PERMISSIONS];
280
279
 
@@ -3023,9 +3022,6 @@ interface IRawPage {
3023
3022
  mobile_icon?: string | null;
3024
3023
  id_users?: number;
3025
3024
  acl_select?: 0 | 1;
3026
- acl_insert?: 0 | 1;
3027
- acl_update?: 0 | 1;
3028
- acl_delete?: 0 | 1;
3029
3025
  id_page_types?: number;
3030
3026
  id_page_access_types?: number;
3031
3027
  children?: IRawPage[];
package/dist/index.d.ts CHANGED
@@ -52,10 +52,8 @@ interface IPageAccessTypeInfo {
52
52
  interface IPageItem extends IBasePageInfo {
53
53
  id_users?: number;
54
54
  id_pages?: number;
55
+ /** Page ACL: members of a group with this right can see the page and use its forms. */
55
56
  acl_select?: 0 | 1;
56
- acl_insert?: 0 | 1;
57
- acl_update?: 0 | 1;
58
- acl_delete?: 0 | 1;
59
57
  id_page_types?: number;
60
58
  id_page_access_types?: number;
61
59
  title?: string | null;
@@ -267,14 +265,15 @@ declare const PERMISSIONS: {
267
265
  readonly ADMIN_SCHEDULED_JOB_EXECUTE: "admin.scheduled_job.execute";
268
266
  readonly ADMIN_SCHEDULED_JOB_DELETE: "admin.scheduled_job.delete";
269
267
  readonly ADMIN_SCHEDULED_JOB_MANAGE: "admin.scheduled_job.manage";
268
+ readonly ADMIN_SECTION_READ: "admin.section.read";
270
269
  readonly ADMIN_SECTION_DELETE: "admin.section.delete";
271
- readonly ADMIN_SETTINGS: "admin.settings";
270
+ readonly ADMIN_LANGUAGE_READ: "admin.language.read";
271
+ readonly ADMIN_LANGUAGE_UPDATE: "admin.language.update";
272
272
  readonly ADMIN_CMS_PREFERENCES_READ: "admin.cms_preferences.read";
273
- readonly ADMIN_CMS_PREFERENCES_UPDATE: "admin.cms_preferences.update";
274
273
  readonly ADMIN_CACHE_READ: "admin.cache.read";
275
274
  readonly ADMIN_CACHE_CLEAR: "admin.cache.clear";
276
275
  readonly ADMIN_CACHE_MANAGE: "admin.cache.manage";
277
- readonly ADMIN_AUDIT_VIEW: "admin.audit.view";
276
+ readonly ADMIN_AUDIT_READ: "admin.audit.read";
278
277
  };
279
278
  type TPermission = (typeof PERMISSIONS)[keyof typeof PERMISSIONS];
280
279
 
@@ -3023,9 +3022,6 @@ interface IRawPage {
3023
3022
  mobile_icon?: string | null;
3024
3023
  id_users?: number;
3025
3024
  acl_select?: 0 | 1;
3026
- acl_insert?: 0 | 1;
3027
- acl_update?: 0 | 1;
3028
- acl_delete?: 0 | 1;
3029
3025
  id_page_types?: number;
3030
3026
  id_page_access_types?: number;
3031
3027
  children?: IRawPage[];
package/dist/index.js CHANGED
@@ -288,14 +288,15 @@ var PERMISSIONS = {
288
288
  ADMIN_SCHEDULED_JOB_EXECUTE: "admin.scheduled_job.execute",
289
289
  ADMIN_SCHEDULED_JOB_DELETE: "admin.scheduled_job.delete",
290
290
  ADMIN_SCHEDULED_JOB_MANAGE: "admin.scheduled_job.manage",
291
+ ADMIN_SECTION_READ: "admin.section.read",
291
292
  ADMIN_SECTION_DELETE: "admin.section.delete",
292
- ADMIN_SETTINGS: "admin.settings",
293
+ ADMIN_LANGUAGE_READ: "admin.language.read",
294
+ ADMIN_LANGUAGE_UPDATE: "admin.language.update",
293
295
  ADMIN_CMS_PREFERENCES_READ: "admin.cms_preferences.read",
294
- ADMIN_CMS_PREFERENCES_UPDATE: "admin.cms_preferences.update",
295
296
  ADMIN_CACHE_READ: "admin.cache.read",
296
297
  ADMIN_CACHE_CLEAR: "admin.cache.clear",
297
298
  ADMIN_CACHE_MANAGE: "admin.cache.manage",
298
- ADMIN_AUDIT_VIEW: "admin.audit.view"
299
+ ADMIN_AUDIT_READ: "admin.audit.read"
299
300
  };
300
301
 
301
302
  // src/types/cms-app.ts
@@ -3310,9 +3311,6 @@ function transformPageData(apiPage) {
3310
3311
  id_users: apiPage.id_users,
3311
3312
  id_pages: apiPage.id_pages ?? id,
3312
3313
  acl_select: apiPage.acl_select,
3313
- acl_insert: apiPage.acl_insert,
3314
- acl_update: apiPage.acl_update,
3315
- acl_delete: apiPage.acl_delete,
3316
3314
  id_page_types: apiPage.id_page_types,
3317
3315
  id_page_access_types: apiPage.id_page_access_types
3318
3316
  };
package/dist/index.mjs CHANGED
@@ -44,14 +44,15 @@ var PERMISSIONS = {
44
44
  ADMIN_SCHEDULED_JOB_EXECUTE: "admin.scheduled_job.execute",
45
45
  ADMIN_SCHEDULED_JOB_DELETE: "admin.scheduled_job.delete",
46
46
  ADMIN_SCHEDULED_JOB_MANAGE: "admin.scheduled_job.manage",
47
+ ADMIN_SECTION_READ: "admin.section.read",
47
48
  ADMIN_SECTION_DELETE: "admin.section.delete",
48
- ADMIN_SETTINGS: "admin.settings",
49
+ ADMIN_LANGUAGE_READ: "admin.language.read",
50
+ ADMIN_LANGUAGE_UPDATE: "admin.language.update",
49
51
  ADMIN_CMS_PREFERENCES_READ: "admin.cms_preferences.read",
50
- ADMIN_CMS_PREFERENCES_UPDATE: "admin.cms_preferences.update",
51
52
  ADMIN_CACHE_READ: "admin.cache.read",
52
53
  ADMIN_CACHE_CLEAR: "admin.cache.clear",
53
54
  ADMIN_CACHE_MANAGE: "admin.cache.manage",
54
- ADMIN_AUDIT_VIEW: "admin.audit.view"
55
+ ADMIN_AUDIT_READ: "admin.audit.read"
55
56
  };
56
57
 
57
58
  // src/types/cms-app.ts
@@ -3066,9 +3067,6 @@ function transformPageData(apiPage) {
3066
3067
  id_users: apiPage.id_users,
3067
3068
  id_pages: apiPage.id_pages ?? id,
3068
3069
  acl_select: apiPage.acl_select,
3069
- acl_insert: apiPage.acl_insert,
3070
- acl_update: apiPage.acl_update,
3071
- acl_delete: apiPage.acl_delete,
3072
3070
  id_page_types: apiPage.id_page_types,
3073
3071
  id_page_access_types: apiPage.id_page_access_types
3074
3072
  };
@@ -153,6 +153,13 @@ interface IPluginManifestApiRoute {
153
153
  methods: ('GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE')[];
154
154
  /** Permission key required. */
155
155
  permission?: string;
156
+ /**
157
+ * When true, the route is open without a permission check (stored as
158
+ * `api_routes.is_public`). A plugin route needs at least one permission
159
+ * **or** `public: true`. Having neither is refused at install, update and
160
+ * sync. Having both is refused too: a public route checks no permission.
161
+ */
162
+ public?: boolean;
156
163
  }
157
164
  interface IPluginManifestScheduledJob {
158
165
  /** Job type key. */
@@ -153,6 +153,13 @@ interface IPluginManifestApiRoute {
153
153
  methods: ('GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE')[];
154
154
  /** Permission key required. */
155
155
  permission?: string;
156
+ /**
157
+ * When true, the route is open without a permission check (stored as
158
+ * `api_routes.is_public`). A plugin route needs at least one permission
159
+ * **or** `public: true`. Having neither is refused at install, update and
160
+ * sync. Having both is refused too: a public route checks no permission.
161
+ */
162
+ public?: boolean;
156
163
  }
157
164
  interface IPluginManifestScheduledJob {
158
165
  /** Job type key. */
@@ -1,4 +1,4 @@
1
- export { I as IPluginManifest, a as IPluginManifestAdminPage, b as IPluginManifestApiRoute, c as IPluginManifestAsset, d as IPluginManifestCapability, e as IPluginManifestCompatibility, f as IPluginManifestConflict, g as IPluginManifestDataAccess, h as IPluginManifestDependency, i as IPluginManifestExternalHost, j as IPluginManifestFeatureFlag, k as IPluginManifestHealth, l as IPluginManifestLookupExtension, m as IPluginManifestMobile, n as IPluginManifestPermission, o as IPluginManifestRealtimeTopic, p as IPluginManifestScheduledJob, q as IPluginManifestSecurity, r as IPluginManifestStyle, s as IPluginManifestTrustLevel } from '../manifest-8YXAk-4o.mjs';
1
+ export { I as IPluginManifest, a as IPluginManifestAdminPage, b as IPluginManifestApiRoute, c as IPluginManifestAsset, d as IPluginManifestCapability, e as IPluginManifestCompatibility, f as IPluginManifestConflict, g as IPluginManifestDataAccess, h as IPluginManifestDependency, i as IPluginManifestExternalHost, j as IPluginManifestFeatureFlag, k as IPluginManifestHealth, l as IPluginManifestLookupExtension, m as IPluginManifestMobile, n as IPluginManifestPermission, o as IPluginManifestRealtimeTopic, p as IPluginManifestScheduledJob, q as IPluginManifestSecurity, r as IPluginManifestStyle, s as IPluginManifestTrustLevel } from '../manifest-BNnCN1Qo.mjs';
2
2
  import { I as IStyleRegistryEntry } from '../styles.registry-DnIJqEzM.mjs';
3
3
  import '../common-qaDIAYS3.mjs';
4
4
 
@@ -1,4 +1,4 @@
1
- export { I as IPluginManifest, a as IPluginManifestAdminPage, b as IPluginManifestApiRoute, c as IPluginManifestAsset, d as IPluginManifestCapability, e as IPluginManifestCompatibility, f as IPluginManifestConflict, g as IPluginManifestDataAccess, h as IPluginManifestDependency, i as IPluginManifestExternalHost, j as IPluginManifestFeatureFlag, k as IPluginManifestHealth, l as IPluginManifestLookupExtension, m as IPluginManifestMobile, n as IPluginManifestPermission, o as IPluginManifestRealtimeTopic, p as IPluginManifestScheduledJob, q as IPluginManifestSecurity, r as IPluginManifestStyle, s as IPluginManifestTrustLevel } from '../manifest-8YXAk-4o.js';
1
+ export { I as IPluginManifest, a as IPluginManifestAdminPage, b as IPluginManifestApiRoute, c as IPluginManifestAsset, d as IPluginManifestCapability, e as IPluginManifestCompatibility, f as IPluginManifestConflict, g as IPluginManifestDataAccess, h as IPluginManifestDependency, i as IPluginManifestExternalHost, j as IPluginManifestFeatureFlag, k as IPluginManifestHealth, l as IPluginManifestLookupExtension, m as IPluginManifestMobile, n as IPluginManifestPermission, o as IPluginManifestRealtimeTopic, p as IPluginManifestScheduledJob, q as IPluginManifestSecurity, r as IPluginManifestStyle, s as IPluginManifestTrustLevel } from '../manifest-BNnCN1Qo.js';
2
2
  import { I as IStyleRegistryEntry } from '../styles.registry-C2ACy7H0.js';
3
3
  import '../common-qaDIAYS3.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { I as IPluginManifest } from '../manifest-8YXAk-4o.mjs';
1
+ import { I as IPluginManifest } from '../manifest-BNnCN1Qo.mjs';
2
2
 
3
3
  /**
4
4
  * `@selfhelp/shared/testing` — the plugin certification kit.
@@ -1,4 +1,4 @@
1
- import { I as IPluginManifest } from '../manifest-8YXAk-4o.js';
1
+ import { I as IPluginManifest } from '../manifest-BNnCN1Qo.js';
2
2
 
3
3
  /**
4
4
  * `@selfhelp/shared/testing` — the plugin certification kit.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selfhelp/shared",
3
- "version": "1.25.0",
3
+ "version": "1.27.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",
@@ -0,0 +1,30 @@
1
+ /*
2
+ SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
+ SPDX-License-Identifier: MPL-2.0
4
+ */
5
+ import { describe, expect, expectTypeOf, it } from 'vitest';
6
+ import type { IPluginManifestApiRoute } from '../manifest';
7
+
8
+ describe('IPluginManifestApiRoute', () => {
9
+ it('accepts public: true on a route item (C3)', () => {
10
+ const route: IPluginManifestApiRoute = {
11
+ name: 'surveyjs_public_published',
12
+ path: '/cms-api/v1/plugins/sh2-shp-survey-js/surveys/{id}/published',
13
+ methods: ['GET'],
14
+ public: true,
15
+ };
16
+ expect(route.public).toBe(true);
17
+ expectTypeOf(route.public).toEqualTypeOf<boolean | undefined>();
18
+ });
19
+
20
+ it('keeps permission-only routes valid without public', () => {
21
+ const route: IPluginManifestApiRoute = {
22
+ name: 'surveyjs_admin_list',
23
+ path: '/cms-api/v1/plugins/sh2-shp-survey-js/surveys',
24
+ methods: ['GET'],
25
+ permission: 'surveyjs.surveys.manage',
26
+ };
27
+ expect(route.permission).toBe('surveyjs.surveys.manage');
28
+ expect(route.public).toBeUndefined();
29
+ });
30
+ });
@@ -191,6 +191,13 @@ export interface IPluginManifestApiRoute {
191
191
  methods: ('GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE')[];
192
192
  /** Permission key required. */
193
193
  permission?: string;
194
+ /**
195
+ * When true, the route is open without a permission check (stored as
196
+ * `api_routes.is_public`). A plugin route needs at least one permission
197
+ * **or** `public: true`. Having neither is refused at install, update and
198
+ * sync. Having both is refused too: a public route checks no permission.
199
+ */
200
+ public?: boolean;
194
201
  }
195
202
 
196
203
  export interface IPluginManifestScheduledJob {
package/src/types/auth.ts CHANGED
@@ -104,14 +104,15 @@ export const PERMISSIONS = {
104
104
  ADMIN_SCHEDULED_JOB_EXECUTE: 'admin.scheduled_job.execute',
105
105
  ADMIN_SCHEDULED_JOB_DELETE: 'admin.scheduled_job.delete',
106
106
  ADMIN_SCHEDULED_JOB_MANAGE: 'admin.scheduled_job.manage',
107
+ ADMIN_SECTION_READ: 'admin.section.read',
107
108
  ADMIN_SECTION_DELETE: 'admin.section.delete',
108
- ADMIN_SETTINGS: 'admin.settings',
109
+ ADMIN_LANGUAGE_READ: 'admin.language.read',
110
+ ADMIN_LANGUAGE_UPDATE: 'admin.language.update',
109
111
  ADMIN_CMS_PREFERENCES_READ: 'admin.cms_preferences.read',
110
- ADMIN_CMS_PREFERENCES_UPDATE: 'admin.cms_preferences.update',
111
112
  ADMIN_CACHE_READ: 'admin.cache.read',
112
113
  ADMIN_CACHE_CLEAR: 'admin.cache.clear',
113
114
  ADMIN_CACHE_MANAGE: 'admin.cache.manage',
114
- ADMIN_AUDIT_VIEW: 'admin.audit.view',
115
+ ADMIN_AUDIT_READ: 'admin.audit.read',
115
116
  } as const;
116
117
 
117
118
  export type TPermission = (typeof PERMISSIONS)[keyof typeof PERMISSIONS];
@@ -52,10 +52,8 @@ export interface IPageAccessTypeInfo {
52
52
  export interface IPageItem extends IBasePageInfo {
53
53
  id_users?: number;
54
54
  id_pages?: number;
55
+ /** Page ACL: members of a group with this right can see the page and use its forms. */
55
56
  acl_select?: 0 | 1;
56
- acl_insert?: 0 | 1;
57
- acl_update?: 0 | 1;
58
- acl_delete?: 0 | 1;
59
57
  id_page_types?: number;
60
58
  id_page_access_types?: number;
61
59
  title?: string | null;
@@ -61,6 +61,16 @@ describe('transformPageData', () => {
61
61
  expect(result.keyword).toBe('');
62
62
  expect(result.children).toEqual([]);
63
63
  });
64
+
65
+ it('passes through acl_select only (page ACL is one right)', () => {
66
+ const result = transformPageData({
67
+ id: 1,
68
+ keyword: 'seen',
69
+ acl_select: 1,
70
+ });
71
+ expect(result.acl_select).toBe(1);
72
+ expect(Object.keys(result).filter((k) => k.startsWith('acl_'))).toEqual(['acl_select']);
73
+ });
64
74
  });
65
75
 
66
76
  describe('transformPagesData', () => {
@@ -26,9 +26,6 @@ interface IRawPage {
26
26
  mobile_icon?: string | null;
27
27
  id_users?: number;
28
28
  acl_select?: 0 | 1;
29
- acl_insert?: 0 | 1;
30
- acl_update?: 0 | 1;
31
- acl_delete?: 0 | 1;
32
29
  id_page_types?: number;
33
30
  id_page_access_types?: number;
34
31
  children?: IRawPage[];
@@ -62,9 +59,6 @@ export function transformPageData(apiPage: IRawPage): IPageItem {
62
59
  id_users: apiPage.id_users,
63
60
  id_pages: apiPage.id_pages ?? id,
64
61
  acl_select: apiPage.acl_select,
65
- acl_insert: apiPage.acl_insert,
66
- acl_update: apiPage.acl_update,
67
- acl_delete: apiPage.acl_delete,
68
62
  id_page_types: apiPage.id_page_types,
69
63
  id_page_access_types: apiPage.id_page_access_types,
70
64
  };