@carecard/validate 3.5.0 → 3.6.1
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/.agents/skills/carecard-workspace-standards/SKILL.md +4 -0
- package/.agents/skills/github-pr-create-update/SKILL.md +4 -0
- package/.agents/skills/github-pr-merge-cleanup/SKILL.md +4 -0
- package/.agents/skills/logged-in-user-profile-page/SKILL.md +4 -0
- package/.agents/skills/npm-package-flow/SKILL.md +4 -0
- package/.agents/skills/pkg-validate-validation-library/SKILL.md +4 -0
- package/.agents/skills/software-design-patterns-and-clean-code/SKILL.md +4 -0
- package/.codex/AGENTS.md +2 -0
- package/.github/workflows/ci.yml +1 -1
- package/lib/validateNewUserRoleRequest.js +6 -1
- package/lib/validateProperties.js +10 -4
- package/package.json +1 -1
- package/readme.md +30 -24
|
@@ -5,6 +5,10 @@ description: 'Follow the shared SO_CareCardCa/CareCard workspace coding, testing
|
|
|
5
5
|
|
|
6
6
|
# CareCard Workspace Standards
|
|
7
7
|
|
|
8
|
+
Non-negotiable TDD rule: Always write the failing test first, run it to confirm it fails for the intended reason, then implement the code and rerun the test until it passes. Test Driven Development is required for all coding work and must not be skipped. For documentation- or skill-only edits, add or update the relevant validation check before changing the prose.
|
|
9
|
+
|
|
10
|
+
Non-negotiable code organization rule: Functions with the same or equivalent behavior must use the same or clearly corresponding descriptive names across CareCard repositories, and equivalent functionality must live in files with the same names within each repository's established architecture. No backward compatibility names, aliases, or duplicate locations are allowed.
|
|
11
|
+
|
|
8
12
|
## Purpose
|
|
9
13
|
|
|
10
14
|
Use before modifying, testing, reviewing, or debugging any CareCard workspace repository or cross-repository contract.
|
|
@@ -5,6 +5,10 @@ description: 'Use only when the user explicitly asks for remote Git or GitHub PR
|
|
|
5
5
|
|
|
6
6
|
# Pull Request Create
|
|
7
7
|
|
|
8
|
+
Non-negotiable TDD rule: Always write the failing test first, run it to confirm it fails for the intended reason, then implement the code and rerun the test until it passes. Test Driven Development is required for all coding work and must not be skipped. For documentation- or skill-only edits, add or update the relevant validation check before changing the prose.
|
|
9
|
+
|
|
10
|
+
Non-negotiable code organization rule: Functions with the same or equivalent behavior must use the same or clearly corresponding descriptive names across CareCard repositories, and equivalent functionality must live in files with the same names within each repository's established architecture. No backward compatibility names, aliases, or duplicate locations are allowed.
|
|
11
|
+
|
|
8
12
|
## Purpose
|
|
9
13
|
|
|
10
14
|
After the user explicitly asks for remote Git or GitHub PR work, create,
|
|
@@ -5,6 +5,10 @@ description: 'Use only when the user explicitly asks for remote Git or GitHub PR
|
|
|
5
5
|
|
|
6
6
|
# Pull Request Merge Close
|
|
7
7
|
|
|
8
|
+
Non-negotiable TDD rule: Always write the failing test first, run it to confirm it fails for the intended reason, then implement the code and rerun the test until it passes. Test Driven Development is required for all coding work and must not be skipped. For documentation- or skill-only edits, add or update the relevant validation check before changing the prose.
|
|
9
|
+
|
|
10
|
+
Non-negotiable code organization rule: Functions with the same or equivalent behavior must use the same or clearly corresponding descriptive names across CareCard repositories, and equivalent functionality must live in files with the same names within each repository's established architecture. No backward compatibility names, aliases, or duplicate locations are allowed.
|
|
11
|
+
|
|
8
12
|
## Purpose
|
|
9
13
|
|
|
10
14
|
After the user explicitly asks for remote Git or GitHub PR work, push the
|
|
@@ -5,6 +5,10 @@ description: 'Use when changing shared validation behavior for app-dashboard log
|
|
|
5
5
|
|
|
6
6
|
# Logged-In User Profile Page
|
|
7
7
|
|
|
8
|
+
Non-negotiable TDD rule: Always write the failing test first, run it to confirm it fails for the intended reason, then implement the code and rerun the test until it passes. Test Driven Development is required for all coding work and must not be skipped. For documentation- or skill-only edits, add or update the relevant validation check before changing the prose.
|
|
9
|
+
|
|
10
|
+
Non-negotiable code organization rule: Functions with the same or equivalent behavior must use the same or clearly corresponding descriptive names across CareCard repositories, and equivalent functionality must live in files with the same names within each repository's established architecture. No backward compatibility names, aliases, or duplicate locations are allowed.
|
|
11
|
+
|
|
8
12
|
## Scope
|
|
9
13
|
|
|
10
14
|
Use this skill inside `pkg-validate` when dashboard profile/settings behavior
|
|
@@ -5,6 +5,10 @@ description: 'Use in pkg-* repositories when publishable package code changes re
|
|
|
5
5
|
|
|
6
6
|
# npm Package Flow
|
|
7
7
|
|
|
8
|
+
Non-negotiable TDD rule: Always write the failing test first, run it to confirm it fails for the intended reason, then implement the code and rerun the test until it passes. Test Driven Development is required for all coding work and must not be skipped. For documentation- or skill-only edits, add or update the relevant validation check before changing the prose.
|
|
9
|
+
|
|
10
|
+
Non-negotiable code organization rule: Functions with the same or equivalent behavior must use the same or clearly corresponding descriptive names across CareCard repositories, and equivalent functionality must live in files with the same names within each repository's established architecture. No backward compatibility names, aliases, or duplicate locations are allowed.
|
|
11
|
+
|
|
8
12
|
## Purpose
|
|
9
13
|
|
|
10
14
|
Use this skill in a `pkg-*` repository when package code changes need to be
|
|
@@ -5,6 +5,10 @@ description: 'Use when changing pkg-validate validators, sanitizers, whitelist b
|
|
|
5
5
|
|
|
6
6
|
# Package Validate
|
|
7
7
|
|
|
8
|
+
Non-negotiable TDD rule: Always write the failing test first, run it to confirm it fails for the intended reason, then implement the code and rerun the test until it passes. Test Driven Development is required for all coding work and must not be skipped. For documentation- or skill-only edits, add or update the relevant validation check before changing the prose.
|
|
9
|
+
|
|
10
|
+
Non-negotiable code organization rule: Functions with the same or equivalent behavior must use the same or clearly corresponding descriptive names across CareCard repositories, and equivalent functionality must live in files with the same names within each repository's established architecture. No backward compatibility names, aliases, or duplicate locations are allowed.
|
|
11
|
+
|
|
8
12
|
## Purpose
|
|
9
13
|
|
|
10
14
|
CareCard validation package for deterministic validators, sanitization, whitelist validation, nested paths, error mapping, exports, and tests.
|
|
@@ -5,6 +5,10 @@ description: 'Use every time before coding, refactoring, debugging, or reviewing
|
|
|
5
5
|
|
|
6
6
|
# Software Design Patterns And Clean Code
|
|
7
7
|
|
|
8
|
+
Non-negotiable TDD rule: Always write the failing test first, run it to confirm it fails for the intended reason, then implement the code and rerun the test until it passes. Test Driven Development is required for all coding work and must not be skipped. For documentation- or skill-only edits, add or update the relevant validation check before changing the prose.
|
|
9
|
+
|
|
10
|
+
Non-negotiable code organization rule: Functions with the same or equivalent behavior must use the same or clearly corresponding descriptive names across CareCard repositories, and equivalent functionality must live in files with the same names within each repository's established architecture. No backward compatibility names, aliases, or duplicate locations are allowed.
|
|
11
|
+
|
|
8
12
|
## Purpose
|
|
9
13
|
|
|
10
14
|
Use this skill with every coding, refactoring, debugging, or review task in
|
package/.codex/AGENTS.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Codex Instructions For pkg-validate
|
|
2
2
|
|
|
3
|
+
Non-negotiable code organization rule: Functions with the same or equivalent behavior must use the same or clearly corresponding descriptive names across CareCard repositories, and equivalent functionality must live in files with the same names within each repository's established architecture. No backward compatibility names, aliases, or duplicate locations are allowed.
|
|
4
|
+
|
|
3
5
|
These instructions apply to the `pkg-validate` repository. This file is self-contained:
|
|
4
6
|
it includes the workspace-level instructions that were previously read from
|
|
5
7
|
`/Users/pankajpriscilla/SO_CareCardCa/.codex/AGENTS.md`, followed by
|
package/.github/workflows/ci.yml
CHANGED
|
@@ -59,7 +59,12 @@ function shouldRequireScope(roleRequest, requireScope) {
|
|
|
59
59
|
if (requireScope === true) return true;
|
|
60
60
|
if (requireScope !== REQUIRE_SCOPE_WHEN_ROLE_OR_SCOPE_PRESENT) return false;
|
|
61
61
|
|
|
62
|
-
return
|
|
62
|
+
return (
|
|
63
|
+
roleRequest.role_name !== undefined ||
|
|
64
|
+
roleRequest.institution_id !== undefined ||
|
|
65
|
+
roleRequest.campus_id !== undefined ||
|
|
66
|
+
roleRequest.program_id !== undefined
|
|
67
|
+
);
|
|
63
68
|
}
|
|
64
69
|
|
|
65
70
|
function requireNewUserRoleRequestScope(roleRequest) {
|
|
@@ -167,10 +167,16 @@ function validateProperties(obj = {}) {
|
|
|
167
167
|
case 'campusId':
|
|
168
168
|
case 'program_id':
|
|
169
169
|
case 'programId':
|
|
170
|
-
case '
|
|
171
|
-
case '
|
|
172
|
-
case '
|
|
173
|
-
case '
|
|
170
|
+
case 'program_term_id':
|
|
171
|
+
case 'programTermId':
|
|
172
|
+
case 'template_id':
|
|
173
|
+
case 'templateId':
|
|
174
|
+
case 'program_template_id':
|
|
175
|
+
case 'programTemplateId':
|
|
176
|
+
case 'user_item_id':
|
|
177
|
+
case 'userItemId':
|
|
178
|
+
case 'user_item_status_id':
|
|
179
|
+
case 'userItemStatusId':
|
|
174
180
|
case 'requirement_item_id':
|
|
175
181
|
case 'requirementItemId':
|
|
176
182
|
case 'program_document_id':
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -9,6 +9,12 @@ invalid values from `validateProperties`, and throws CareCard `BAD_INPUT` errors
|
|
|
9
9
|
from `validateWhitelistProperties` when required or provided whitelist values do
|
|
10
10
|
not pass validation.
|
|
11
11
|
|
|
12
|
+
## Development Rule
|
|
13
|
+
|
|
14
|
+
Non-negotiable TDD rule: Always write the failing test first, run it to confirm it fails for the intended reason, then implement the code and rerun the test until it passes. Test Driven Development is required for all coding work and must not be skipped. For documentation- or skill-only edits, add or update the relevant validation check before changing the prose.
|
|
15
|
+
|
|
16
|
+
Non-negotiable code organization rule: Functions with the same or equivalent behavior must use the same or clearly corresponding descriptive names across CareCard repositories, and equivalent functionality must live in files with the same names within each repository's established architecture. No backward compatibility names, aliases, or duplicate locations are allowed.
|
|
17
|
+
|
|
12
18
|
## Installation
|
|
13
19
|
|
|
14
20
|
```sh
|
|
@@ -96,30 +102,30 @@ validateProperties(input);
|
|
|
96
102
|
Keys are matched exactly. Both snake_case and camelCase variants are listed
|
|
97
103
|
where the package supports both.
|
|
98
104
|
|
|
99
|
-
| Validator | Keys
|
|
100
|
-
| --------------------------------------------------------- |
|
|
101
|
-
| `isNameString` | `first_name`, `firstName`, `last_name`, `lastName`, `username`, `new_status`, `newStatus`, `description`, `comment`, `status`, `name`, `title`, `brand`, `short_description`, `shortDescription`, `college_name`, `collegeName`, `campus_name`, `campusName`, `role`, `role_id`, `roleId`, `campus`, `institution_name`, `institutionName`, `program_name`, `programName`, `role_name`, `roleName`, `document_name`, `documentName`, `document_required_for_role_name`, `documentRequiredForRoleName`, `reason`, `entity_type`, `entityType`, `action_type`, `actionType`, `city`, `state`, `country`, `type`
|
|
102
|
-
| `isStreetString` | `street`
|
|
103
|
-
| `isCharactersString` | `postal_code`, `postalCode`, `period`
|
|
104
|
-
| `isBoolValue` | `is_primary`, `isPrimary`, `active`, `document_optional`, `documentOptional`
|
|
105
|
-
| `isSafeSearchString` | `search_string`, `searchString`
|
|
106
|
-
| `isString6To16CharacterLong` and `isSimplePasswordString` | `password`, `new_password`, `newPassword`
|
|
107
|
-
| `isString6To16CharacterLong` and `isPasswordString` | `strong_password`, `strongPassword`
|
|
108
|
-
| `isEmailString` | `email`
|
|
109
|
-
| `isPhoneNumber` | `phone_number`, `phoneNumber`
|
|
110
|
-
| `isCountryCodeString` | `country_code`, `countryCode`
|
|
111
|
-
| `isUrlSafeString` | `token`, `email_confirm_token`, `emailConfirmToken`, `verification_token`, `verificationToken`
|
|
112
|
-
| `isValidUuidString` | `uuid`, `item_id`, `itemId`, `user_id`, `userId`, `address_id`, `addressId`, `image_id`, `imageId`, `order_id`, `orderId`, `category_id`, `categoryId`, `parent_id`, `parentId`, `college_id`, `collegeId`, `campus_id`, `campusId`, `program_id`, `programId`, `
|
|
113
|
-
| `isCcIdString` | `cc_id`, `ccId`
|
|
114
|
-
| `isValidIntegerString` | `offset_number`, `offsetNumber`, `number_of_orders`, `numberOfOrders`, `price`, `from`, `number`, `limit`, `offset`
|
|
115
|
-
| `isValidJsonString` on the raw value | `about`
|
|
116
|
-
| `isValidJsonString(JSON.stringify(value))` | `weight`, `dimensions`, `permission`, `scope_data`, `scopeData`, `meta_data`, `metaData`
|
|
117
|
-
| `isTextString` | `document_description`, `documentDescription`, `nick_name`, `nickName`, `requested_by_name`, `requestedByName`, `requested_by_email`, `requestedByEmail`, `requested_by_phone`, `requestedByPhone`, `approved_by_name`, `approvedByName`, `approved_by_email`, `approvedByEmail`, `approved_by_phone`, `approvedByPhone`
|
|
118
|
-
| `isValidArrayOfStrings` | `aliases`
|
|
119
|
-
| `isImageUrl` or `isValidUrl` | `image_url`, `imageUrl`, `website`, `file_url`, `fileUrl`
|
|
120
|
-
| `isValidDomainName` | `domain_name`, `domainName`, `domain`, `email_domain`, `emailDomain`, `email_domain_name`, `emailDomainName`
|
|
121
|
-
| `isValidTimestampzString` or `isValidTimestampString` | `expires_at`, `expiresAt`, `start_time`, `startTime`, `end_time`, `endTime`
|
|
122
|
-
| `isValidDateString` | `effective_start_date`, `effectiveStartDate`, `effective_end_date`, `effectiveEndDate`, `valid_until_date`, `validUntilDate`, `renew_date`, `renewDate`
|
|
105
|
+
| Validator | Keys |
|
|
106
|
+
| --------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
107
|
+
| `isNameString` | `first_name`, `firstName`, `last_name`, `lastName`, `username`, `new_status`, `newStatus`, `description`, `comment`, `status`, `name`, `title`, `brand`, `short_description`, `shortDescription`, `college_name`, `collegeName`, `campus_name`, `campusName`, `role`, `role_id`, `roleId`, `campus`, `institution_name`, `institutionName`, `program_name`, `programName`, `role_name`, `roleName`, `document_name`, `documentName`, `document_required_for_role_name`, `documentRequiredForRoleName`, `reason`, `entity_type`, `entityType`, `action_type`, `actionType`, `city`, `state`, `country`, `type` |
|
|
108
|
+
| `isStreetString` | `street` |
|
|
109
|
+
| `isCharactersString` | `postal_code`, `postalCode`, `period` |
|
|
110
|
+
| `isBoolValue` | `is_primary`, `isPrimary`, `active`, `document_optional`, `documentOptional` |
|
|
111
|
+
| `isSafeSearchString` | `search_string`, `searchString` |
|
|
112
|
+
| `isString6To16CharacterLong` and `isSimplePasswordString` | `password`, `new_password`, `newPassword` |
|
|
113
|
+
| `isString6To16CharacterLong` and `isPasswordString` | `strong_password`, `strongPassword` |
|
|
114
|
+
| `isEmailString` | `email` |
|
|
115
|
+
| `isPhoneNumber` | `phone_number`, `phoneNumber` |
|
|
116
|
+
| `isCountryCodeString` | `country_code`, `countryCode` |
|
|
117
|
+
| `isUrlSafeString` | `token`, `email_confirm_token`, `emailConfirmToken`, `verification_token`, `verificationToken` |
|
|
118
|
+
| `isValidUuidString` | `uuid`, `item_id`, `itemId`, `user_id`, `userId`, `address_id`, `addressId`, `image_id`, `imageId`, `order_id`, `orderId`, `category_id`, `categoryId`, `parent_id`, `parentId`, `college_id`, `collegeId`, `campus_id`, `campusId`, `program_id`, `programId`, `template_id`, `templateId`, `program_template_id`, `programTemplateId`, `user_item_id`, `userItemId`, `user_item_status_id`, `userItemStatusId`, `requirement_item_id`, `requirementItemId`, `program_document_id`, `programDocumentId`, `id`, `institution_id`, `institutionId`, `role_assignment_id`, `roleAssignmentId`, `user_role_id`, `userRoleId`, `phone_number_id`, `phoneNumberId`, `entity_id`, `entityId`, `changed_by`, `changedBy`, `request_id`, `requestId` |
|
|
119
|
+
| `isCcIdString` | `cc_id`, `ccId` |
|
|
120
|
+
| `isValidIntegerString` | `offset_number`, `offsetNumber`, `number_of_orders`, `numberOfOrders`, `price`, `from`, `number`, `limit`, `offset` |
|
|
121
|
+
| `isValidJsonString` on the raw value | `about` |
|
|
122
|
+
| `isValidJsonString(JSON.stringify(value))` | `weight`, `dimensions`, `permission`, `scope_data`, `scopeData`, `meta_data`, `metaData` |
|
|
123
|
+
| `isTextString` | `document_description`, `documentDescription`, `nick_name`, `nickName`, `requested_by_name`, `requestedByName`, `requested_by_email`, `requestedByEmail`, `requested_by_phone`, `requestedByPhone`, `approved_by_name`, `approvedByName`, `approved_by_email`, `approvedByEmail`, `approved_by_phone`, `approvedByPhone` |
|
|
124
|
+
| `isValidArrayOfStrings` | `aliases` |
|
|
125
|
+
| `isImageUrl` or `isValidUrl` | `image_url`, `imageUrl`, `website`, `file_url`, `fileUrl` |
|
|
126
|
+
| `isValidDomainName` | `domain_name`, `domainName`, `domain`, `email_domain`, `emailDomain`, `email_domain_name`, `emailDomainName` |
|
|
127
|
+
| `isValidTimestampzString` or `isValidTimestampString` | `expires_at`, `expiresAt`, `start_time`, `startTime`, `end_time`, `endTime` |
|
|
128
|
+
| `isValidDateString` | `effective_start_date`, `effectiveStartDate`, `effective_end_date`, `effectiveEndDate`, `valid_until_date`, `validUntilDate`, `renew_date`, `renewDate` |
|
|
123
129
|
|
|
124
130
|
## `validateWhitelistProperties(inputObject, requiredProperties, options)`
|
|
125
131
|
|