@carecard/validate 3.30.0 → 3.31.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/index.d.ts CHANGED
@@ -84,7 +84,7 @@ export interface ValidateWhitelistPropertiesFunction {
84
84
 
85
85
  export const validateWhitelistProperties: ValidateWhitelistPropertiesFunction;
86
86
 
87
- export type UserRoleRequestRole = 'student' | 'intern' | 'volunteer';
87
+ export type UserRoleRequestRole = 'student' | 'intern' | 'volunteer' | 'applicant';
88
88
  export type UserRoleRequestScopeRequirement =
89
89
  boolean | typeof REQUIRE_SCOPE_WHEN_ROLE_OR_SCOPE_PRESENT;
90
90
 
@@ -120,7 +120,7 @@ export interface ValidateNewUserRoleRequestPayload extends Record<string, unknow
120
120
 
121
121
  /**
122
122
  * Normalizes and validates an institutions.new_user_role_request payload.
123
- * Only student, intern, and volunteer are accepted. When scope is required,
123
+ * Only student, intern, volunteer, and applicant are accepted. When scope is required,
124
124
  * both institution_id and campus_id must be provided.
125
125
  */
126
126
  export function validateNewUserRoleRequestObject(
package/lib/validate.js CHANGED
@@ -229,7 +229,7 @@ const isUserRoleRequestStatusString = inputString => {
229
229
  };
230
230
 
231
231
  const isUserRoleRequestRoleString = inputString => {
232
- const roles = ['student', 'intern', 'volunteer'];
232
+ const roles = ['student', 'intern', 'volunteer', 'applicant'];
233
233
  return typeof inputString === 'string' && roles.includes(inputString.trim().toLowerCase());
234
234
  };
235
235
 
@@ -45,7 +45,7 @@ function normalizeNewUserRoleRequestRole(roleRequest) {
45
45
  if (!isUserRoleRequestRoleString(roleRequest.role_name)) {
46
46
  throwBadInputError({
47
47
  userMessage: 'Invalid property: role.role',
48
- details: { role: 'Role requests are limited to student, intern, or volunteer' },
48
+ details: { role: 'Role requests are limited to student, intern, volunteer, or applicant' },
49
49
  });
50
50
  }
51
51
  roleRequest.role_name = roleRequest.role_name.trim().toLowerCase();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carecard/validate",
3
- "version": "3.30.0",
3
+ "version": "3.31.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/CareCard-ca/pkg-validate.git"
@@ -47,7 +47,7 @@
47
47
  "typescript": "6.0.3"
48
48
  },
49
49
  "dependencies": {
50
- "@carecard/common-util": "3.30.0"
50
+ "@carecard/common-util": "3.31.0"
51
51
  },
52
52
  "nyc": {
53
53
  "all": true,
package/readme.md CHANGED
@@ -477,3 +477,10 @@ A correct implementation may be completely rewritten or refactored without requi
477
477
  Any test that fails solely because the implementation changed while the externally observable behavior remained correct is incorrectly designed and must be rewritten or removed.
478
478
 
479
479
  This requirement is mandatory for all new tests and must be applied whenever existing tests are modified.
480
+
481
+ ### Institution request roles
482
+
483
+ `isUserRoleRequestRoleString`, `validateNewUserRoleRequest`, and the exported
484
+ `UserRoleRequestRole` type accept student, intern, volunteer, and applicant.
485
+ Institution and campus remain required. Provider-specific eligibility is owned
486
+ by ms-institutions; accepting applicant here does not grant assignment authority.