@getcommunity/gc-validators 0.0.122 → 0.0.123

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/README.md CHANGED
@@ -1,6 +1,257 @@
1
+ ---
2
+ name: "Get Community Validators"
3
+ description: "A validation library for Get Community defining and validating data structures used throughout the application."
4
+ category: "Web Development"
5
+ repository: "https://github.com/getcommunity/gc-validators"
6
+ author: "Joey Grable"
7
+ authorUrl: "https://github.com/joeygrable94"
8
+ tags:
9
+ [
10
+ "Get Community",
11
+ "homebuilder digital marketing",
12
+ "website development",
13
+ "validation library",
14
+ "TypeScript",
15
+ "NodeJS",
16
+ "ValiBot"
17
+ ]
18
+ lastUpdated: "2025-10"
19
+ ---
20
+
1
21
  # 🪨 GC Validators
2
22
 
3
- ## Example Permission Constants Usage
23
+ [@getcommunity/gc-validators](https://github.com/getcommunity/gc-validators)
24
+
25
+ ## Project Overview
26
+
27
+ The Get Community Validators package provides a set of validation rules and utilities for ensuring data integrity and consistency across the Get Community application. It defines and validates data structures used throughout the application, ensuring that all data conforms to expected formats and business rules.
28
+
29
+ ## Tech Stack
30
+
31
+ Main technologies and tools used:
32
+
33
+ - TypeScript
34
+ - NodeJS
35
+ - ValiBot
36
+ - Pnpm
37
+ - NPM
38
+
39
+ ## Project Structure
40
+
41
+ ```plaintext
42
+ gc-validators/
43
+ ├── scripts/
44
+ ├── src/
45
+ │ ├── constants/
46
+ │ ├── schemas/
47
+ │ ├── types/
48
+ │ │ ├── components/
49
+ │ │ │ ├── blocks/
50
+ │ │ │ ├── brand/
51
+ │ │ │ ├── forms/
52
+ │ │ │ ├── shared/
53
+ │ │ │ ├── slideshow/
54
+ │ │ │ ├── utm/
55
+ │ │ │ └── index.ts
56
+ │ │ ├── core/
57
+ │ │ ├── documents/
58
+ │ │ ├── singles/
59
+ │ │ └── index.ts
60
+ │ ├── utilities/
61
+ │ ├── validators/
62
+ │ └── index.ts
63
+ ├── .vscode/
64
+ ├── .env
65
+ ├── .gitignore
66
+ ├── .npmignore
67
+ ├── .npmrc
68
+ ├── .pre-commit-config.yaml
69
+ ├── .prettierignore
70
+ ├── .prettierrc.mjs
71
+ ├── tsconfig.json
72
+ ├── tsup.config.ts
73
+ ├── pnpm-lock.yaml
74
+ └── package.json
75
+ ```
76
+
77
+ ## Development Guidelines
78
+
79
+ ### Code Style
80
+
81
+ - Use consistent code formatting tools
82
+ - Use Prettier for code formatting
83
+ - Use ESLint for linting
84
+ - Use pre-commit hooks for code quality checks
85
+ - Follow language-specific best practices
86
+ - Keep code clean and readable
87
+
88
+ ### Naming Conventions
89
+
90
+ - File naming: (snake-case)
91
+ - all lowercase with hyphens
92
+ - append file type as suffix
93
+ - e.g., `entity-schema.tsx`, `pagination-constants.ts`
94
+ - Variable naming: (PascalCase, or UPPER_SNAKE_CASE)
95
+ - types should be in PascalCase (e.g., `ClientDocument`, `BlogPostDocument`)
96
+ - global constants should be in UPPER_SNAKE_CASE (e.g., `LIMIT_SHORT_STRING_MAX_LENGTH`)
97
+ - Function naming: (camelCase)
98
+ - use camelCase for function names (e.g., `datePlusDays`, `hasPermission`)
99
+ - Class and Schema naming: (PascalCase)
100
+ - use PascalCase for classes and schemas (e.g., `PermissionCheck`, `RolesWithPermissions`)
101
+ - prefix entity action schemas with "S" and the CRUD operation (e.g., `SUpdateClientDocument`, `SCreateContentPillarDocument`)
102
+
103
+ ### Git Workflow
104
+
105
+ #### Branching Strategy
106
+
107
+ - `production` branch is used for production releases
108
+ - `main` branch is used for staged production
109
+ - `dev` branch is used for development
110
+ - `test` branch is used for testing
111
+ - `upgrade` branch is used for upgrading dependencies
112
+ - `feat-*` branches are used for new features
113
+ - `bugfix-*` branches are used for bug fixes
114
+
115
+ #### Commit message format
116
+
117
+ - Get Community follows the [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) specification for commit messages.
118
+
119
+ #### Pull Request process
120
+
121
+ - All pull requests should be reviewed by at least one other team member and approved by by a code manager before merging.
122
+ - Ensure that all tests pass before merging.
123
+ - Use descriptive titles and provide context in the PR description.
124
+
125
+ ## Environment Setup
126
+
127
+ Each submodule contains an .env.example file that outlines the necessary environment variables. Copy this file to .env and fill in the appropriate values. Many of the env variable are managed in a secure vault and can be retrieved from the project manager.
128
+
129
+ ### Development Requirements
130
+
131
+ - Node.js version: >=22.x (LTS)
132
+ - Package manager: pnpm
133
+ - Other dependencies: Git
134
+
135
+ ### Installation Steps
136
+
137
+ ```bash
138
+ # 1. Clone the library
139
+ git clone [repository-url]
140
+
141
+ # 2. Install dependencies
142
+ pnpm install
143
+
144
+ # 3. Build the library
145
+ pnpm build
146
+ ```
147
+
148
+ ## Core Feature Implementation (TO DO)
149
+
150
+ ### Feature Module 1
151
+
152
+ Describe the implementation approach and key code examples for main features.
153
+
154
+ ```javascript
155
+ // Example code
156
+ function exampleFunction() {
157
+ // Implementation logic
158
+ }
159
+ ```
160
+
161
+ ## Testing Strategy
162
+
163
+ ### Unit Testing
164
+
165
+ - Testing framework:
166
+ - Test coverage requirements:
167
+ - Test file organization:
168
+
169
+ ### Integration Testing
170
+
171
+ - Test scenarios:
172
+ - Testing tools:
173
+
174
+ ### End-to-End Testing
175
+
176
+ - Test workflow:
177
+ - Automation tools:
178
+
179
+ ## Deployment Guide
180
+
181
+ ### Build Process
182
+
183
+ ```bash
184
+ # Build command
185
+ pnpm build
186
+ ```
187
+
188
+ ### Deployment Steps
189
+
190
+ 1. Prepare production environment
191
+ 2. Configure environment variables
192
+ 3. Execute deployment scripts
193
+ 4. Verify deployment results
194
+
195
+ ### Environment Variables
196
+
197
+ ```env
198
+ # Example environment variables
199
+ ```
200
+
201
+ ## Performance Optimization
202
+
203
+ ### Frontend Optimization
204
+
205
+ - Code splitting
206
+ - Lazy loading
207
+ - Caching strategies
208
+
209
+ ### Backend Optimization
210
+
211
+ - Database query optimization
212
+ - Caching mechanisms
213
+ - Load balancing
214
+
215
+ ## Security Considerations
216
+
217
+ ### Data Security
218
+
219
+ - Input validation
220
+ - SQL injection protection
221
+ - XSS protection
222
+
223
+ ### Authentication & Authorization
224
+
225
+ - User authentication flow
226
+ - Permission control
227
+ - Token management
228
+
229
+ ## Monitoring and Logging
230
+
231
+ ### Application Monitoring
232
+
233
+ - Performance metrics
234
+ - Error tracking
235
+ - User behavior analytics
236
+
237
+ ### Log Management
238
+
239
+ - Log levels
240
+ - Log format
241
+ - Log storage
242
+
243
+ ## Reference Resources
244
+
245
+ - [Official Documentation Link]
246
+ - [Related Tutorials]
247
+ - [Community Resources]
248
+ - [Best Practices Guide]
249
+
250
+ ---
251
+
252
+ ## Examples
253
+
254
+ ### Permission Constants Usage
4
255
 
5
256
  ```ts
6
257
  const userDoc: UserDocument = {
package/dist/index.cjs CHANGED
@@ -46,6 +46,8 @@ var LIMIT_MIN_QUERY = 1;
46
46
  var LIMIT_MAX_QUERY = 2038;
47
47
  var LIMIT_MIN_FRAGMENT = 1;
48
48
  var LIMIT_MAX_FRAGMENT = 2038;
49
+ var LIMIT_MIN_UTM_KEY = 1;
50
+ var LIMIT_MAX_UTM_KEY = 255;
49
51
  var LIMIT_MIN_UTM_SOURCE = 1;
50
52
  var LIMIT_MAX_UTM_SOURCE = 2026;
51
53
  var LIMIT_MIN_UTM_MEDIUM = 1;
@@ -183,6 +185,13 @@ var ROLE_PERMISSIONS = {
183
185
  update: false,
184
186
  delete: false
185
187
  },
188
+ "media-content-type": {
189
+ list: false,
190
+ create: false,
191
+ read: false,
192
+ update: false,
193
+ delete: false
194
+ },
186
195
  "user-account": {
187
196
  list: false,
188
197
  create: false,
@@ -268,6 +277,13 @@ var ROLE_PERMISSIONS = {
268
277
  update: false,
269
278
  delete: false
270
279
  },
280
+ "media-content-type": {
281
+ list: false,
282
+ create: false,
283
+ read: false,
284
+ update: false,
285
+ delete: false
286
+ },
271
287
  "user-account": {
272
288
  list: false,
273
289
  create: false,
@@ -354,6 +370,13 @@ var ROLE_PERMISSIONS = {
354
370
  update: false,
355
371
  delete: false
356
372
  },
373
+ "media-content-type": {
374
+ list: true,
375
+ create: false,
376
+ read: true,
377
+ update: false,
378
+ delete: false
379
+ },
357
380
  "user-account": {
358
381
  list: true,
359
382
  create: false,
@@ -449,6 +472,13 @@ var ROLE_PERMISSIONS = {
449
472
  update: true,
450
473
  delete: true
451
474
  },
475
+ "media-content-type": {
476
+ list: true,
477
+ create: true,
478
+ read: true,
479
+ update: true,
480
+ delete: true
481
+ },
452
482
  "user-account": {
453
483
  list: true,
454
484
  create: false,
@@ -535,6 +565,13 @@ var ROLE_PERMISSIONS = {
535
565
  update: false,
536
566
  delete: false
537
567
  },
568
+ "media-content-type": {
569
+ list: true,
570
+ create: false,
571
+ read: true,
572
+ update: false,
573
+ delete: false
574
+ },
538
575
  "user-account": {
539
576
  list: true,
540
577
  create: false,
@@ -1236,6 +1273,20 @@ var IsValidConfirmed = v6__namespace.boolean();
1236
1273
  var IsValidOrUndefinedConfirmed = v6__namespace.optional(IsValidConfirmed);
1237
1274
  var IsValidBlocked = v6__namespace.boolean();
1238
1275
  var IsValidOrUndefinedBlocked = v6__namespace.optional(IsValidBlocked);
1276
+ var IsValidUrlUtmKey = v6__namespace.pipe(
1277
+ v6__namespace.string(),
1278
+ v6__namespace.trim(),
1279
+ v6__namespace.minLength(
1280
+ LIMIT_MIN_UTM_KEY,
1281
+ `the utm_key is too short, it must be at least ${LIMIT_MIN_UTM_KEY} characters`
1282
+ ),
1283
+ v6__namespace.maxLength(
1284
+ LIMIT_MAX_UTM_KEY,
1285
+ `the utm_key is too long, it must be ${LIMIT_MAX_UTM_KEY} characters or less`
1286
+ ),
1287
+ v6__namespace.regex(REGEX_UTM_VALUE, `utm_key ${ERROR_MESSAGE_REGEX_UTM_VALUE}`)
1288
+ );
1289
+ var IsValidOrUndefinedUrlUtmKey = v6__namespace.optional(IsValidUrlUtmKey);
1239
1290
  var IsValidUrlUtmSource = v6__namespace.pipe(
1240
1291
  v6__namespace.string(),
1241
1292
  v6__namespace.trim(),
@@ -1782,9 +1833,41 @@ var SUpdateLeadRequest = v6__namespace.object({
1782
1833
  documentId: IsValidReferenceDocumentId,
1783
1834
  data: SUpdateLeadDocument
1784
1835
  });
1836
+ var QuerySortMediaContentType = v6__namespace.optional(
1837
+ v6__namespace.object({
1838
+ key: v6__namespace.picklist(["id", "title", "slug", "utm_key", "createdAt", "updatedAt"]),
1839
+ order: v6__namespace.picklist(["ASC", "DESC"])
1840
+ })
1841
+ );
1842
+ var QueryStrapiSearchMediaContentType = v6__namespace.object({
1843
+ page: v6__namespace.optional(v6__namespace.pipe(v6__namespace.number(), v6__namespace.minValue(1))),
1844
+ size: v6__namespace.optional(
1845
+ v6__namespace.pipe(v6__namespace.number(), v6__namespace.minValue(1), v6__namespace.maxValue(LIMIT_PAGINATION_MAX_SIZE))
1846
+ ),
1847
+ title: IsValidOrUndefinedShortString,
1848
+ slug: IsValidOrUndefinedShortString,
1849
+ utm_key: IsValidOrUndefinedUrlUtmKey,
1850
+ sort: QuerySortMediaContentType
1851
+ });
1852
+ var SCreateMediaContentTypeDocument = v6__namespace.object({
1853
+ title: IsValidShortString,
1854
+ slug: IsValidSlug,
1855
+ utm_key: IsValidOrUndefinedUrlUtmKey,
1856
+ description: IsValidOrUndefinedLongString
1857
+ });
1858
+ var SUpdateMediaContentTypeDocument = v6__namespace.object({
1859
+ title: IsValidOrUndefinedShortString,
1860
+ slug: IsValidOrUndefinedSlug,
1861
+ utm_key: IsValidOrUndefinedUrlUtmKey,
1862
+ description: IsValidOrUndefinedLongString
1863
+ });
1864
+ var SUpdateMediaContentTypeDocumentRequest = v6__namespace.object({
1865
+ documentId: IsValidReferenceDocumentId,
1866
+ data: SUpdateMediaContentTypeDocument
1867
+ });
1785
1868
  var QuerySortMediaPlatforms = v6__namespace.optional(
1786
1869
  v6__namespace.object({
1787
- key: v6__namespace.picklist(["id", "title", "slug", "utm_source", "createdAt", "updatedAt"]),
1870
+ key: v6__namespace.picklist(["id", "title", "slug", "utm_key", "createdAt", "updatedAt"]),
1788
1871
  order: v6__namespace.picklist(["ASC", "DESC"])
1789
1872
  })
1790
1873
  );
@@ -1795,19 +1878,19 @@ var QueryStrapiSearchMediaPlatforms = v6__namespace.object({
1795
1878
  ),
1796
1879
  title: IsValidOrUndefinedShortString,
1797
1880
  slug: IsValidOrUndefinedShortString,
1798
- utm_source: IsValidOrUndefinedUrlUtmSource,
1881
+ utm_key: IsValidUrlUtmKey,
1799
1882
  sort: QuerySortMediaPlatforms
1800
1883
  });
1801
1884
  var SCreateMediaPlatformDocument = v6__namespace.object({
1802
1885
  title: IsValidShortString,
1803
1886
  slug: IsValidSlug,
1804
- utm_source: IsValidOrUndefinedUrlUtmSource,
1887
+ utm_key: IsValidUrlUtmKey,
1805
1888
  description: IsValidOrUndefinedLongString
1806
1889
  });
1807
1890
  var SUpdateMediaPlatformDocument = v6__namespace.object({
1808
1891
  title: IsValidOrUndefinedShortString,
1809
1892
  slug: IsValidOrUndefinedSlug,
1810
- utm_source: IsValidOrUndefinedUrlUtmSource,
1893
+ utm_key: IsValidUrlUtmKey,
1811
1894
  description: IsValidOrUndefinedLongString
1812
1895
  });
1813
1896
  var SUpdateMediaPlatformDocumentRequest = v6__namespace.object({
@@ -2710,6 +2793,7 @@ exports.IsValidOrUndefinedUrlUtmCampaign = IsValidOrUndefinedUrlUtmCampaign;
2710
2793
  exports.IsValidOrUndefinedUrlUtmContent = IsValidOrUndefinedUrlUtmContent;
2711
2794
  exports.IsValidOrUndefinedUrlUtmCreativeFormat = IsValidOrUndefinedUrlUtmCreativeFormat;
2712
2795
  exports.IsValidOrUndefinedUrlUtmId = IsValidOrUndefinedUrlUtmId;
2796
+ exports.IsValidOrUndefinedUrlUtmKey = IsValidOrUndefinedUrlUtmKey;
2713
2797
  exports.IsValidOrUndefinedUrlUtmMedium = IsValidOrUndefinedUrlUtmMedium;
2714
2798
  exports.IsValidOrUndefinedUrlUtmSource = IsValidOrUndefinedUrlUtmSource;
2715
2799
  exports.IsValidOrUndefinedUrlUtmTerm = IsValidOrUndefinedUrlUtmTerm;
@@ -2745,6 +2829,7 @@ exports.IsValidUrlUtmCampaign = IsValidUrlUtmCampaign;
2745
2829
  exports.IsValidUrlUtmContent = IsValidUrlUtmContent;
2746
2830
  exports.IsValidUrlUtmCreativeFormat = IsValidUrlUtmCreativeFormat;
2747
2831
  exports.IsValidUrlUtmId = IsValidUrlUtmId;
2832
+ exports.IsValidUrlUtmKey = IsValidUrlUtmKey;
2748
2833
  exports.IsValidUrlUtmMedium = IsValidUrlUtmMedium;
2749
2834
  exports.IsValidUrlUtmSource = IsValidUrlUtmSource;
2750
2835
  exports.IsValidUrlUtmTerm = IsValidUrlUtmTerm;
@@ -2794,6 +2879,7 @@ exports.LIMIT_MAX_UTM_CAMPAIGN = LIMIT_MAX_UTM_CAMPAIGN;
2794
2879
  exports.LIMIT_MAX_UTM_CONTENT = LIMIT_MAX_UTM_CONTENT;
2795
2880
  exports.LIMIT_MAX_UTM_CREATIVE_FORMAT = LIMIT_MAX_UTM_CREATIVE_FORMAT;
2796
2881
  exports.LIMIT_MAX_UTM_ID = LIMIT_MAX_UTM_ID;
2882
+ exports.LIMIT_MAX_UTM_KEY = LIMIT_MAX_UTM_KEY;
2797
2883
  exports.LIMIT_MAX_UTM_MEDIUM = LIMIT_MAX_UTM_MEDIUM;
2798
2884
  exports.LIMIT_MAX_UTM_SOURCE = LIMIT_MAX_UTM_SOURCE;
2799
2885
  exports.LIMIT_MAX_UTM_TERM = LIMIT_MAX_UTM_TERM;
@@ -2811,6 +2897,7 @@ exports.LIMIT_MIN_UTM_CAMPAIGN = LIMIT_MIN_UTM_CAMPAIGN;
2811
2897
  exports.LIMIT_MIN_UTM_CONTENT = LIMIT_MIN_UTM_CONTENT;
2812
2898
  exports.LIMIT_MIN_UTM_CREATIVE_FORMAT = LIMIT_MIN_UTM_CREATIVE_FORMAT;
2813
2899
  exports.LIMIT_MIN_UTM_ID = LIMIT_MIN_UTM_ID;
2900
+ exports.LIMIT_MIN_UTM_KEY = LIMIT_MIN_UTM_KEY;
2814
2901
  exports.LIMIT_MIN_UTM_MEDIUM = LIMIT_MIN_UTM_MEDIUM;
2815
2902
  exports.LIMIT_MIN_UTM_SOURCE = LIMIT_MIN_UTM_SOURCE;
2816
2903
  exports.LIMIT_MIN_UTM_TERM = LIMIT_MIN_UTM_TERM;
@@ -2848,6 +2935,7 @@ exports.QuerySortClientUsers = QuerySortClientUsers;
2848
2935
  exports.QuerySortClients = QuerySortClients;
2849
2936
  exports.QuerySortContentPillars = QuerySortContentPillars;
2850
2937
  exports.QuerySortEntities = QuerySortEntities;
2938
+ exports.QuerySortMediaContentType = QuerySortMediaContentType;
2851
2939
  exports.QuerySortMediaPlatforms = QuerySortMediaPlatforms;
2852
2940
  exports.QuerySortTeamMembers = QuerySortTeamMembers;
2853
2941
  exports.QuerySortUrlRedirects = QuerySortUrlRedirects;
@@ -2871,6 +2959,7 @@ exports.QueryStrapiSearchClientReports = QueryStrapiSearchClientReports;
2871
2959
  exports.QueryStrapiSearchClientStyleguide = QueryStrapiSearchClientStyleguide;
2872
2960
  exports.QueryStrapiSearchClients = QueryStrapiSearchClients;
2873
2961
  exports.QueryStrapiSearchContentPillars = QueryStrapiSearchContentPillars;
2962
+ exports.QueryStrapiSearchMediaContentType = QueryStrapiSearchMediaContentType;
2874
2963
  exports.QueryStrapiSearchMediaPlatforms = QueryStrapiSearchMediaPlatforms;
2875
2964
  exports.QueryStrapiSearchTeamMembers = QueryStrapiSearchTeamMembers;
2876
2965
  exports.QueryStrapiSearchUtmTrackingLinks = QueryStrapiSearchUtmTrackingLinks;
@@ -2900,6 +2989,7 @@ exports.SCreateClientStyleguideDocument = SCreateClientStyleguideDocument;
2900
2989
  exports.SCreateClientUserDocument = SCreateClientUserDocument;
2901
2990
  exports.SCreateContentPillarDocument = SCreateContentPillarDocument;
2902
2991
  exports.SCreateLeadDocument = SCreateLeadDocument;
2992
+ exports.SCreateMediaContentTypeDocument = SCreateMediaContentTypeDocument;
2903
2993
  exports.SCreateMediaPlatformDocument = SCreateMediaPlatformDocument;
2904
2994
  exports.SCreateMultipleStrapiMediaUploadDocument = SCreateMultipleStrapiMediaUploadDocument;
2905
2995
  exports.SCreateNewsletterSignup = SCreateNewsletterSignup;
@@ -2952,6 +3042,8 @@ exports.SUpdateContentPillarDocument = SUpdateContentPillarDocument;
2952
3042
  exports.SUpdateContentPillarDocumentRequest = SUpdateContentPillarDocumentRequest;
2953
3043
  exports.SUpdateLeadDocument = SUpdateLeadDocument;
2954
3044
  exports.SUpdateLeadRequest = SUpdateLeadRequest;
3045
+ exports.SUpdateMediaContentTypeDocument = SUpdateMediaContentTypeDocument;
3046
+ exports.SUpdateMediaContentTypeDocumentRequest = SUpdateMediaContentTypeDocumentRequest;
2955
3047
  exports.SUpdateMediaPlatformDocument = SUpdateMediaPlatformDocument;
2956
3048
  exports.SUpdateMediaPlatformDocumentRequest = SUpdateMediaPlatformDocumentRequest;
2957
3049
  exports.SUpdateNewsletterSignupDocument = SUpdateNewsletterSignupDocument;