@selfhelp/shared 1.0.0 → 1.0.3

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
@@ -4,6 +4,10 @@ All notable changes to `@selfhelp/shared` will be documented in this file.
4
4
 
5
5
  This project follows semantic versioning.
6
6
 
7
+ ## [1.0.2] - 2026-05-19
8
+
9
+ - Adjust types after the DB refactoring
10
+
7
11
  ## [1.0.0] - 2026-05-08
8
12
 
9
13
  First stable release of `@selfhelp/shared`.
package/dist/index.d.mts CHANGED
@@ -55,8 +55,8 @@ interface IPageItem extends IBasePageInfo {
55
55
  acl_insert?: 0 | 1;
56
56
  acl_update?: 0 | 1;
57
57
  acl_delete?: 0 | 1;
58
- id_type?: number;
59
- id_pageAccessTypes?: number;
58
+ id_page_types?: number;
59
+ id_page_access_types?: number;
60
60
  title?: string | null;
61
61
  description?: string | null;
62
62
  children?: IPageItem[];
@@ -550,15 +550,20 @@ declare function spacingToClasses(spacing: ISpacingValue, spacingToTailwind: Rec
550
550
  /**
551
551
  * Backend → frontend page-shape transformer.
552
552
  *
553
- * The Symfony repositories project pages with snake_case keys
554
- * (`nav_position`, `footer_position`, `id_pages`, `parent`) for legacy
555
- * reasons. Both the web and the mobile app prefer camelCase
556
- * (`navPosition`, `footerPosition`) at the type-system level. This
557
- * helper bridges the two so consumers don't have to know about the
558
- * snake-case wire format.
553
+ * The Symfony backend projects pages with canonical `snake_case` keys
554
+ * (`nav_position`, `footer_position`, `id_pages`, `id_parent_page`,
555
+ * `id_page_types`, `id_page_access_types`). The web and mobile apps
556
+ * prefer camelCase (`navPosition`, `footerPosition`) at the type-system
557
+ * level. This helper bridges the two so consumers don't have to know
558
+ * about the snake-case wire format.
559
559
  *
560
560
  * It is the single source of truth for the conversion. Web frontend
561
561
  * and mobile both import it from `@selfhelp/shared`.
562
+ *
563
+ * NOTE: Pre-release breaking-change cutover (`db_naming_cutover_*`)
564
+ * removed all legacy aliases (`parent`, `id_type`,
565
+ * `id_pageAccessTypes`). The backend is the single source of canonical
566
+ * keys; the transformer no longer accepts the legacy shapes.
562
567
  */
563
568
 
564
569
  interface IRawPage {
@@ -566,7 +571,7 @@ interface IRawPage {
566
571
  id_pages?: number;
567
572
  keyword?: string;
568
573
  url?: string | null;
569
- parent?: number | null;
574
+ id_parent_page?: number | null;
570
575
  parent_page_id?: number | null;
571
576
  is_headless?: number | boolean | null;
572
577
  nav_position?: number | null;
@@ -582,8 +587,8 @@ interface IRawPage {
582
587
  acl_insert?: 0 | 1;
583
588
  acl_update?: 0 | 1;
584
589
  acl_delete?: 0 | 1;
585
- id_type?: number;
586
- id_pageAccessTypes?: number;
590
+ id_page_types?: number;
591
+ id_page_access_types?: number;
587
592
  children?: IRawPage[];
588
593
  [key: string]: unknown;
589
594
  }
package/dist/index.d.ts CHANGED
@@ -55,8 +55,8 @@ interface IPageItem extends IBasePageInfo {
55
55
  acl_insert?: 0 | 1;
56
56
  acl_update?: 0 | 1;
57
57
  acl_delete?: 0 | 1;
58
- id_type?: number;
59
- id_pageAccessTypes?: number;
58
+ id_page_types?: number;
59
+ id_page_access_types?: number;
60
60
  title?: string | null;
61
61
  description?: string | null;
62
62
  children?: IPageItem[];
@@ -550,15 +550,20 @@ declare function spacingToClasses(spacing: ISpacingValue, spacingToTailwind: Rec
550
550
  /**
551
551
  * Backend → frontend page-shape transformer.
552
552
  *
553
- * The Symfony repositories project pages with snake_case keys
554
- * (`nav_position`, `footer_position`, `id_pages`, `parent`) for legacy
555
- * reasons. Both the web and the mobile app prefer camelCase
556
- * (`navPosition`, `footerPosition`) at the type-system level. This
557
- * helper bridges the two so consumers don't have to know about the
558
- * snake-case wire format.
553
+ * The Symfony backend projects pages with canonical `snake_case` keys
554
+ * (`nav_position`, `footer_position`, `id_pages`, `id_parent_page`,
555
+ * `id_page_types`, `id_page_access_types`). The web and mobile apps
556
+ * prefer camelCase (`navPosition`, `footerPosition`) at the type-system
557
+ * level. This helper bridges the two so consumers don't have to know
558
+ * about the snake-case wire format.
559
559
  *
560
560
  * It is the single source of truth for the conversion. Web frontend
561
561
  * and mobile both import it from `@selfhelp/shared`.
562
+ *
563
+ * NOTE: Pre-release breaking-change cutover (`db_naming_cutover_*`)
564
+ * removed all legacy aliases (`parent`, `id_type`,
565
+ * `id_pageAccessTypes`). The backend is the single source of canonical
566
+ * keys; the transformer no longer accepts the legacy shapes.
562
567
  */
563
568
 
564
569
  interface IRawPage {
@@ -566,7 +571,7 @@ interface IRawPage {
566
571
  id_pages?: number;
567
572
  keyword?: string;
568
573
  url?: string | null;
569
- parent?: number | null;
574
+ id_parent_page?: number | null;
570
575
  parent_page_id?: number | null;
571
576
  is_headless?: number | boolean | null;
572
577
  nav_position?: number | null;
@@ -582,8 +587,8 @@ interface IRawPage {
582
587
  acl_insert?: 0 | 1;
583
588
  acl_update?: 0 | 1;
584
589
  acl_delete?: 0 | 1;
585
- id_type?: number;
586
- id_pageAccessTypes?: number;
590
+ id_page_types?: number;
591
+ id_page_access_types?: number;
587
592
  children?: IRawPage[];
588
593
  [key: string]: unknown;
589
594
  }
package/dist/index.js CHANGED
@@ -723,11 +723,12 @@ function toBool(value) {
723
723
  }
724
724
  function transformPageData(apiPage) {
725
725
  const id = apiPage.id ?? apiPage.id_pages ?? 0;
726
+ const parentPageId = apiPage.parent_page_id ?? apiPage.id_parent_page ?? null;
726
727
  return {
727
728
  id,
728
729
  keyword: apiPage.keyword ?? "",
729
730
  url: apiPage.url ?? null,
730
- parent_page_id: apiPage.parent_page_id ?? apiPage.parent ?? null,
731
+ parent_page_id: parentPageId,
731
732
  is_headless: toBool(apiPage.is_headless),
732
733
  navPosition: apiPage.navPosition !== void 0 ? apiPage.navPosition : apiPage.nav_position ?? null,
733
734
  footerPosition: apiPage.footerPosition !== void 0 ? apiPage.footerPosition : apiPage.footer_position ?? null,
@@ -741,8 +742,8 @@ function transformPageData(apiPage) {
741
742
  acl_insert: apiPage.acl_insert,
742
743
  acl_update: apiPage.acl_update,
743
744
  acl_delete: apiPage.acl_delete,
744
- id_type: apiPage.id_type,
745
- id_pageAccessTypes: apiPage.id_pageAccessTypes
745
+ id_page_types: apiPage.id_page_types,
746
+ id_page_access_types: apiPage.id_page_access_types
746
747
  };
747
748
  }
748
749
  function transformPagesData(pages) {
package/dist/index.mjs CHANGED
@@ -646,11 +646,12 @@ function toBool(value) {
646
646
  }
647
647
  function transformPageData(apiPage) {
648
648
  const id = apiPage.id ?? apiPage.id_pages ?? 0;
649
+ const parentPageId = apiPage.parent_page_id ?? apiPage.id_parent_page ?? null;
649
650
  return {
650
651
  id,
651
652
  keyword: apiPage.keyword ?? "",
652
653
  url: apiPage.url ?? null,
653
- parent_page_id: apiPage.parent_page_id ?? apiPage.parent ?? null,
654
+ parent_page_id: parentPageId,
654
655
  is_headless: toBool(apiPage.is_headless),
655
656
  navPosition: apiPage.navPosition !== void 0 ? apiPage.navPosition : apiPage.nav_position ?? null,
656
657
  footerPosition: apiPage.footerPosition !== void 0 ? apiPage.footerPosition : apiPage.footer_position ?? null,
@@ -664,8 +665,8 @@ function transformPageData(apiPage) {
664
665
  acl_insert: apiPage.acl_insert,
665
666
  acl_update: apiPage.acl_update,
666
667
  acl_delete: apiPage.acl_delete,
667
- id_type: apiPage.id_type,
668
- id_pageAccessTypes: apiPage.id_pageAccessTypes
668
+ id_page_types: apiPage.id_page_types,
669
+ id_page_access_types: apiPage.id_page_access_types
669
670
  };
670
671
  }
671
672
  function transformPagesData(pages) {
package/package.json CHANGED
@@ -1,7 +1,15 @@
1
1
  {
2
2
  "name": "@selfhelp/shared",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
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
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/humdek-unibe-ch/sh-selfhelp_shared.git"
8
+ },
9
+ "homepage": "https://github.com/humdek-unibe-ch/sh-selfhelp_shared#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/humdek-unibe-ch/sh-selfhelp_shared/issues"
12
+ },
5
13
  "main": "dist/index.js",
6
14
  "module": "dist/index.mjs",
7
15
  "types": "dist/index.d.ts",
@@ -58,8 +58,8 @@ export interface IPageItem extends IBasePageInfo {
58
58
  acl_insert?: 0 | 1;
59
59
  acl_update?: 0 | 1;
60
60
  acl_delete?: 0 | 1;
61
- id_type?: number;
62
- id_pageAccessTypes?: number;
61
+ id_page_types?: number;
62
+ id_page_access_types?: number;
63
63
  title?: string | null;
64
64
  description?: string | null;
65
65
  children?: IPageItem[];
@@ -5,15 +5,20 @@ SPDX-License-Identifier: MPL-2.0
5
5
  /**
6
6
  * Backend → frontend page-shape transformer.
7
7
  *
8
- * The Symfony repositories project pages with snake_case keys
9
- * (`nav_position`, `footer_position`, `id_pages`, `parent`) for legacy
10
- * reasons. Both the web and the mobile app prefer camelCase
11
- * (`navPosition`, `footerPosition`) at the type-system level. This
12
- * helper bridges the two so consumers don't have to know about the
13
- * snake-case wire format.
8
+ * The Symfony backend projects pages with canonical `snake_case` keys
9
+ * (`nav_position`, `footer_position`, `id_pages`, `id_parent_page`,
10
+ * `id_page_types`, `id_page_access_types`). The web and mobile apps
11
+ * prefer camelCase (`navPosition`, `footerPosition`) at the type-system
12
+ * level. This helper bridges the two so consumers don't have to know
13
+ * about the snake-case wire format.
14
14
  *
15
15
  * It is the single source of truth for the conversion. Web frontend
16
16
  * and mobile both import it from `@selfhelp/shared`.
17
+ *
18
+ * NOTE: Pre-release breaking-change cutover (`db_naming_cutover_*`)
19
+ * removed all legacy aliases (`parent`, `id_type`,
20
+ * `id_pageAccessTypes`). The backend is the single source of canonical
21
+ * keys; the transformer no longer accepts the legacy shapes.
17
22
  */
18
23
 
19
24
  import type { IPageItem } from '../types/pages';
@@ -23,7 +28,7 @@ interface IRawPage {
23
28
  id_pages?: number;
24
29
  keyword?: string;
25
30
  url?: string | null;
26
- parent?: number | null;
31
+ id_parent_page?: number | null;
27
32
  parent_page_id?: number | null;
28
33
  is_headless?: number | boolean | null;
29
34
  nav_position?: number | null;
@@ -39,8 +44,8 @@ interface IRawPage {
39
44
  acl_insert?: 0 | 1;
40
45
  acl_update?: 0 | 1;
41
46
  acl_delete?: 0 | 1;
42
- id_type?: number;
43
- id_pageAccessTypes?: number;
47
+ id_page_types?: number;
48
+ id_page_access_types?: number;
44
49
  children?: IRawPage[];
45
50
  [key: string]: unknown;
46
51
  }
@@ -55,11 +60,12 @@ function toBool(value: unknown): boolean {
55
60
 
56
61
  export function transformPageData(apiPage: IRawPage): IPageItem {
57
62
  const id = apiPage.id ?? apiPage.id_pages ?? 0;
63
+ const parentPageId = apiPage.parent_page_id ?? apiPage.id_parent_page ?? null;
58
64
  return {
59
65
  id,
60
66
  keyword: apiPage.keyword ?? '',
61
67
  url: apiPage.url ?? null,
62
- parent_page_id: apiPage.parent_page_id ?? apiPage.parent ?? null,
68
+ parent_page_id: parentPageId,
63
69
  is_headless: toBool(apiPage.is_headless),
64
70
  navPosition:
65
71
  apiPage.navPosition !== undefined ? apiPage.navPosition : (apiPage.nav_position ?? null),
@@ -78,8 +84,8 @@ export function transformPageData(apiPage: IRawPage): IPageItem {
78
84
  acl_insert: apiPage.acl_insert,
79
85
  acl_update: apiPage.acl_update,
80
86
  acl_delete: apiPage.acl_delete,
81
- id_type: apiPage.id_type,
82
- id_pageAccessTypes: apiPage.id_pageAccessTypes,
87
+ id_page_types: apiPage.id_page_types,
88
+ id_page_access_types: apiPage.id_page_access_types,
83
89
  };
84
90
  }
85
91