@churchapps/helpers 1.2.3 → 1.2.5

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 (53) hide show
  1. package/.eslintrc.json +28 -28
  2. package/.github/FUNDING.yml +1 -1
  3. package/.prettierrc +11 -11
  4. package/.yarnrc.yml +5 -5
  5. package/LICENSE +21 -21
  6. package/README.md +15 -15
  7. package/dist/ApiHelper.d.ts.map +1 -1
  8. package/dist/ApiHelper.js +4 -10
  9. package/dist/ApiHelper.js.map +1 -1
  10. package/dist/ArrayHelper.js +2 -1
  11. package/dist/ArrayHelper.js.map +1 -1
  12. package/dist/CommonEnvironmentHelper.d.ts +1 -1
  13. package/dist/CommonEnvironmentHelper.d.ts.map +1 -1
  14. package/dist/CommonEnvironmentHelper.js +5 -5
  15. package/dist/CommonEnvironmentHelper.js.map +1 -1
  16. package/dist/DateHelper.d.ts.map +1 -1
  17. package/dist/DateHelper.js +2 -0
  18. package/dist/DateHelper.js.map +1 -1
  19. package/dist/PersonHelper.js +2 -2
  20. package/dist/PersonHelper.js.map +1 -1
  21. package/dist/UserHelper.d.ts.map +1 -1
  22. package/dist/UserHelper.js +6 -2
  23. package/dist/UserHelper.js.map +1 -1
  24. package/package.json +50 -49
  25. package/scripts/build-cjs.js +32 -32
  26. package/src/ApiHelper.ts +169 -176
  27. package/src/AppearanceHelper.ts +69 -69
  28. package/src/ArrayHelper.ts +157 -157
  29. package/src/CommonEnvironmentHelper.ts +104 -104
  30. package/src/CurrencyHelper.ts +10 -10
  31. package/src/DateHelper.ts +154 -153
  32. package/src/DonationHelper.ts +26 -26
  33. package/src/ErrorHelper.ts +39 -39
  34. package/src/EventHelper.ts +49 -49
  35. package/src/FileHelper.ts +55 -55
  36. package/src/PersonHelper.ts +82 -82
  37. package/src/UniqueIdHelper.ts +36 -36
  38. package/src/UserHelper.ts +62 -59
  39. package/src/index.ts +15 -15
  40. package/src/interfaces/Access.ts +138 -138
  41. package/src/interfaces/Attendance.ts +45 -45
  42. package/src/interfaces/Content.ts +84 -84
  43. package/src/interfaces/Doing.ts +93 -93
  44. package/src/interfaces/Donation.ts +190 -190
  45. package/src/interfaces/Error.ts +17 -17
  46. package/src/interfaces/Membership.ts +184 -184
  47. package/src/interfaces/Messaging.ts +96 -96
  48. package/src/interfaces/Permissions.ts +92 -92
  49. package/src/interfaces/Reporting.ts +41 -41
  50. package/src/interfaces/UserContextInterface.ts +13 -13
  51. package/src/interfaces/index.ts +13 -13
  52. package/tsconfig.json +36 -36
  53. package/CLAUDE.md +0 -98
@@ -1,92 +1,92 @@
1
- export class Permissions {
2
- static attendanceApi = {
3
- attendance: {
4
- view: { api: "AttendanceApi", contentType: "Attendance", action: "View" },
5
- viewSummary: {
6
- api: "AttendanceApi",
7
- contentType: "Attendance",
8
- action: "View Summary"
9
- },
10
- edit: { api: "AttendanceApi", contentType: "Attendance", action: "Edit" }
11
- },
12
- services: {
13
- edit: { api: "AttendanceApi", contentType: "Services", action: "Edit" }
14
- }
15
- };
16
-
17
- static membershipApi = {
18
- roles: {
19
- view: { api: "MembershipApi", contentType: "Roles", action: "View" },
20
- edit: { api: "MembershipApi", contentType: "Roles", action: "Edit" }
21
- },
22
- settings: {
23
- edit: { api: "MembershipApi", contentType: "Settings", action: "Edit" }
24
- },
25
- server: {
26
- admin: { api: "MembershipApi", contentType: "Server", action: "Admin" }
27
- },
28
- forms: {
29
- admin: { api: "MembershipApi", contentType: "Forms", action: "Admin" },
30
- edit: { api: "MembershipApi", contentType: "Forms", action: "Edit" }
31
- },
32
- groups: {
33
- edit: { api: "MembershipApi", contentType: "Groups", action: "Edit" }
34
- },
35
- people: {
36
- view: { api: "MembershipApi", contentType: "People", action: "View" },
37
- viewMembers: {
38
- api: "MembershipApi",
39
- contentType: "People",
40
- action: "View Members"
41
- },
42
- edit: { api: "MembershipApi", contentType: "People", action: "Edit" }
43
- },
44
- plans: {
45
- edit: { api: "MembershipApi", contentType: "Plans", action: "Edit" }
46
- },
47
- groupMembers: {
48
- edit: {
49
- api: "MembershipApi",
50
- contentType: "Group Members",
51
- action: "Edit"
52
- },
53
- view: {
54
- api: "MembershipApi",
55
- contentType: "Group Members",
56
- action: "View"
57
- }
58
- }
59
- };
60
-
61
- static givingApi = {
62
- donations: {
63
- viewSummary: {
64
- api: "GivingApi",
65
- contentType: "Donations",
66
- action: "View Summary"
67
- },
68
- view: { api: "GivingApi", contentType: "Donations", action: "View" },
69
- edit: { api: "GivingApi", contentType: "Donations", action: "Edit" }
70
- },
71
- settings: {
72
- view: { api: "GivingApi", contentType: "Settings", action: "View" },
73
- edit: { api: "GivingApi", contentType: "Settings", action: "Edit" }
74
- }
75
- };
76
-
77
- static contentApi = {
78
- chat: {
79
- host: { api: "ContentApi", contentType: "Chat", action: "Host" }
80
- },
81
- content: {
82
- edit: { api: "ContentApi", contentType: "Content", action: "Edit" }
83
- },
84
- streamingServices: {
85
- edit: {
86
- api: "ContentApi",
87
- contentType: "StreamingServices",
88
- action: "Edit"
89
- }
90
- }
91
- };
92
- }
1
+ export class Permissions {
2
+ static attendanceApi = {
3
+ attendance: {
4
+ view: { api: "AttendanceApi", contentType: "Attendance", action: "View" },
5
+ viewSummary: {
6
+ api: "AttendanceApi",
7
+ contentType: "Attendance",
8
+ action: "View Summary"
9
+ },
10
+ edit: { api: "AttendanceApi", contentType: "Attendance", action: "Edit" }
11
+ },
12
+ services: {
13
+ edit: { api: "AttendanceApi", contentType: "Services", action: "Edit" }
14
+ }
15
+ };
16
+
17
+ static membershipApi = {
18
+ roles: {
19
+ view: { api: "MembershipApi", contentType: "Roles", action: "View" },
20
+ edit: { api: "MembershipApi", contentType: "Roles", action: "Edit" }
21
+ },
22
+ settings: {
23
+ edit: { api: "MembershipApi", contentType: "Settings", action: "Edit" }
24
+ },
25
+ server: {
26
+ admin: { api: "MembershipApi", contentType: "Server", action: "Admin" }
27
+ },
28
+ forms: {
29
+ admin: { api: "MembershipApi", contentType: "Forms", action: "Admin" },
30
+ edit: { api: "MembershipApi", contentType: "Forms", action: "Edit" }
31
+ },
32
+ groups: {
33
+ edit: { api: "MembershipApi", contentType: "Groups", action: "Edit" }
34
+ },
35
+ people: {
36
+ view: { api: "MembershipApi", contentType: "People", action: "View" },
37
+ viewMembers: {
38
+ api: "MembershipApi",
39
+ contentType: "People",
40
+ action: "View Members"
41
+ },
42
+ edit: { api: "MembershipApi", contentType: "People", action: "Edit" }
43
+ },
44
+ plans: {
45
+ edit: { api: "MembershipApi", contentType: "Plans", action: "Edit" }
46
+ },
47
+ groupMembers: {
48
+ edit: {
49
+ api: "MembershipApi",
50
+ contentType: "Group Members",
51
+ action: "Edit"
52
+ },
53
+ view: {
54
+ api: "MembershipApi",
55
+ contentType: "Group Members",
56
+ action: "View"
57
+ }
58
+ }
59
+ };
60
+
61
+ static givingApi = {
62
+ donations: {
63
+ viewSummary: {
64
+ api: "GivingApi",
65
+ contentType: "Donations",
66
+ action: "View Summary"
67
+ },
68
+ view: { api: "GivingApi", contentType: "Donations", action: "View" },
69
+ edit: { api: "GivingApi", contentType: "Donations", action: "Edit" }
70
+ },
71
+ settings: {
72
+ view: { api: "GivingApi", contentType: "Settings", action: "View" },
73
+ edit: { api: "GivingApi", contentType: "Settings", action: "Edit" }
74
+ }
75
+ };
76
+
77
+ static contentApi = {
78
+ chat: {
79
+ host: { api: "ContentApi", contentType: "Chat", action: "Host" }
80
+ },
81
+ content: {
82
+ edit: { api: "ContentApi", contentType: "Content", action: "Edit" }
83
+ },
84
+ streamingServices: {
85
+ edit: {
86
+ api: "ContentApi",
87
+ contentType: "StreamingServices",
88
+ action: "Edit"
89
+ }
90
+ }
91
+ };
92
+ }
@@ -1,41 +1,41 @@
1
- export interface ReportResultInterface {
2
- displayName: string;
3
- description: string;
4
- table: any[];
5
- outputs: ReportOutputInterface[];
6
- }
7
- export interface ReportInterface {
8
- keyName: string;
9
- displayName: string;
10
- description: string;
11
- parameters: ParameterInterface[];
12
- permissions: ReportPermissionGroupInterface[];
13
- }
14
- export interface ParameterInterface {
15
- keyName: string;
16
- displayName?: string;
17
- source: string;
18
- sourceKey: string;
19
- options: { value: string; text: string }[];
20
- value?: string;
21
- requiredParentIds?: string[];
22
- defaultValue: string;
23
- }
24
- export interface ReportOutputInterface {
25
- outputType: string;
26
- columns: ColumnInterface[];
27
- groupings?: number[];
28
- }
29
- export interface ColumnInterface {
30
- header: string;
31
- value: string;
32
- formatter: string;
33
- }
34
- export interface ReportPermissionGroupInterface {
35
- requireOne: ReportPermissionInterface[];
36
- }
37
- export interface ReportPermissionInterface {
38
- api: string;
39
- contentType: string;
40
- action: string;
41
- }
1
+ export interface ReportResultInterface {
2
+ displayName: string;
3
+ description: string;
4
+ table: any[];
5
+ outputs: ReportOutputInterface[];
6
+ }
7
+ export interface ReportInterface {
8
+ keyName: string;
9
+ displayName: string;
10
+ description: string;
11
+ parameters: ParameterInterface[];
12
+ permissions: ReportPermissionGroupInterface[];
13
+ }
14
+ export interface ParameterInterface {
15
+ keyName: string;
16
+ displayName?: string;
17
+ source: string;
18
+ sourceKey: string;
19
+ options: { value: string; text: string }[];
20
+ value?: string;
21
+ requiredParentIds?: string[];
22
+ defaultValue: string;
23
+ }
24
+ export interface ReportOutputInterface {
25
+ outputType: string;
26
+ columns: ColumnInterface[];
27
+ groupings?: number[];
28
+ }
29
+ export interface ColumnInterface {
30
+ header: string;
31
+ value: string;
32
+ formatter: string;
33
+ }
34
+ export interface ReportPermissionGroupInterface {
35
+ requireOne: ReportPermissionInterface[];
36
+ }
37
+ export interface ReportPermissionInterface {
38
+ api: string;
39
+ contentType: string;
40
+ action: string;
41
+ }
@@ -1,13 +1,13 @@
1
- import { LoginUserChurchInterface, UserInterface } from "./Access";
2
- import { PersonInterface } from "./Membership";
3
-
4
- export interface UserContextInterface {
5
- user: UserInterface;
6
- setUser: (user: UserInterface) => void;
7
- person: PersonInterface;
8
- setPerson: (person: PersonInterface) => void;
9
- userChurch: LoginUserChurchInterface;
10
- setUserChurch: (userChurch: LoginUserChurchInterface) => void;
11
- userChurches: LoginUserChurchInterface[];
12
- setUserChurches: (userChurches: LoginUserChurchInterface[]) => void;
13
- }
1
+ import { LoginUserChurchInterface, UserInterface } from "./Access";
2
+ import { PersonInterface } from "./Membership";
3
+
4
+ export interface UserContextInterface {
5
+ user: UserInterface;
6
+ setUser: (user: UserInterface) => void;
7
+ person: PersonInterface;
8
+ setPerson: (person: PersonInterface) => void;
9
+ userChurch: LoginUserChurchInterface;
10
+ setUserChurch: (userChurch: LoginUserChurchInterface) => void;
11
+ userChurches: LoginUserChurchInterface[];
12
+ setUserChurches: (userChurches: LoginUserChurchInterface[]) => void;
13
+ }
@@ -1,13 +1,13 @@
1
- export * from "./Error";
2
- export * from "./UserContextInterface";
3
- export * from "./Permissions";
4
-
5
- // API interfaces
6
- export * from "./Access";
7
- export * from "./Attendance";
8
- export * from "./Content";
9
- export * from "./Doing";
10
- export * from "./Donation";
11
- export * from "./Membership";
12
- export * from "./Messaging";
13
- export * from "./Reporting";
1
+ export * from "./Error";
2
+ export * from "./UserContextInterface";
3
+ export * from "./Permissions";
4
+
5
+ // API interfaces
6
+ export * from "./Access";
7
+ export * from "./Attendance";
8
+ export * from "./Content";
9
+ export * from "./Doing";
10
+ export * from "./Donation";
11
+ export * from "./Membership";
12
+ export * from "./Messaging";
13
+ export * from "./Reporting";
package/tsconfig.json CHANGED
@@ -1,36 +1,36 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "typeRoots": [
5
- "./types",
6
- "node_modules/@types"
7
- ],
8
- "lib": [
9
- "dom",
10
- "dom.iterable",
11
- "ES2022"
12
- ],
13
- "allowJs": true,
14
- "skipLibCheck": true,
15
- "esModuleInterop": true,
16
- "allowSyntheticDefaultImports": true,
17
- "strict": false,
18
- "forceConsistentCasingInFileNames": true,
19
- "module": "commonjs",
20
- "moduleResolution": "node",
21
- "resolveJsonModule": true,
22
- "isolatedModules": true,
23
- "jsx": "react-jsx",
24
- "sourceMap": true,
25
- "allowUnreachableCode": false,
26
- "allowUnusedLabels": false,
27
- "declaration": true,
28
- "declarationMap": true,
29
- "noImplicitReturns": true,
30
- "pretty": true,
31
- "paths": {},
32
- "outDir": "dist"
33
- },
34
- "include": ["src/**/*"],
35
- "exclude": ["node_modules", "dist"]
36
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "typeRoots": [
5
+ "./types",
6
+ "node_modules/@types"
7
+ ],
8
+ "lib": [
9
+ "dom",
10
+ "dom.iterable",
11
+ "ES2022"
12
+ ],
13
+ "allowJs": true,
14
+ "skipLibCheck": true,
15
+ "esModuleInterop": true,
16
+ "allowSyntheticDefaultImports": true,
17
+ "strict": false,
18
+ "forceConsistentCasingInFileNames": true,
19
+ "module": "commonjs",
20
+ "moduleResolution": "node",
21
+ "resolveJsonModule": true,
22
+ "isolatedModules": true,
23
+ "jsx": "react-jsx",
24
+ "sourceMap": true,
25
+ "allowUnreachableCode": false,
26
+ "allowUnusedLabels": false,
27
+ "declaration": true,
28
+ "declarationMap": true,
29
+ "noImplicitReturns": true,
30
+ "pretty": true,
31
+ "paths": {},
32
+ "outDir": "dist"
33
+ },
34
+ "include": ["src/**/*"],
35
+ "exclude": ["node_modules", "dist"]
36
+ }
package/CLAUDE.md DELETED
@@ -1,98 +0,0 @@
1
- # CLAUDE.md
2
-
3
- This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
-
5
- ## Project Overview
6
-
7
- This is the `@churchapps/helpers` package - a foundational TypeScript library providing framework-agnostic utilities, interfaces, and helper classes for ChurchApps church management applications. It serves as the core dependency for other ChurchApps packages (ApiHelper, AppHelper, MobileHelper).
8
-
9
- ## Development Commands
10
-
11
- **This project uses Yarn exclusively. npm is disabled to prevent script execution vulnerabilities.**
12
-
13
- ```bash
14
- yarn clean # Remove dist folder
15
- yarn tsc # TypeScript compilation only
16
- yarn build # Full build (clean + tsc)
17
- yarn lint # ESLint check
18
- yarn lint:fix # ESLint with auto-fix
19
- yarn format # Prettier formatting
20
- ```
21
-
22
- ## Local Development Workflow
23
-
24
- ```bash
25
- # After making changes:
26
- yarn build
27
- yarn link
28
-
29
- # In consuming project:
30
- yarn link @churchapps/helpers
31
-
32
- # After further changes, repeat build + link cycle
33
- ```
34
-
35
- ## Publishing
36
-
37
- ```bash
38
- # 1. Update version in package.json
39
- # 2. Build and publish:
40
- yarn build
41
- yarn publish --access=public
42
- ```
43
-
44
- ## Security Notes
45
-
46
- - Script execution is disabled by default in `.yarnrc.yml`
47
- - Only whitelisted packages can run install scripts
48
- - npm is disabled via `.npmrc` with `engine-strict=true`
49
-
50
- ## Architecture
51
-
52
- ### Core Structure
53
-
54
- The package follows a static utility class pattern with comprehensive TypeScript interfaces:
55
-
56
- - **Helper Classes**: Static utility classes (`ApiHelper`, `DateHelper`, `ArrayHelper`, etc.)
57
- - **Interfaces**: Church management domain models organized by feature area
58
- - **Zero Runtime Dependencies**: Framework-agnostic with minimal external deps
59
-
60
- ### Key Helper Categories
61
-
62
- 1. **ApiHelper**: Multi-API HTTP client with JWT auth for ChurchApps microservices
63
- 2. **Data Helpers**: Array manipulation, date/time processing, currency formatting
64
- 3. **User Management**: Multi-church user sessions, permissions, person data
65
- 4. **Business Logic**: Donation processing, file uploads, appearance theming
66
- 5. **System Utilities**: Error handling, environment config, unique ID generation
67
-
68
- ### Interface Organization
69
-
70
- Interfaces in `src/interfaces/` are grouped by domain:
71
- - **Access**: Authentication, users, churches, roles, permissions
72
- - **Membership**: People, groups, households, forms, campus management
73
- - **Content**: Sermons, playlists, streaming, events
74
- - **Donation**: Financial transactions, Stripe integration
75
- - **Attendance**: Service tracking
76
- - **Messaging**: Communication interfaces
77
- - **Reporting**: Data analysis interfaces
78
-
79
- ### TypeScript Configuration
80
-
81
- - Target: ES2020 with CommonJS modules
82
- - Declaration files generated (`.d.ts`)
83
- - Strict mode disabled for flexibility
84
- - Supports React JSX and DOM types
85
-
86
- ### Key Dependencies
87
-
88
- - `date-fns` & `dayjs`: Date manipulation
89
- - `rrule`: Recurring event rules
90
- - `react-ga4`: Analytics (peer dependency pattern)
91
-
92
- ## Important Patterns
93
-
94
- - **Multi-tenancy**: Most entities include `churchId` for church-scoped data
95
- - **Optional Properties**: Extensive use for flexible partial updates
96
- - **Static Methods**: All helpers use static methods for stateless operations
97
- - **Error Resilience**: Comprehensive error handling with graceful degradation
98
- - **Environment Flexibility**: Works across React, Next.js, React Native platforms