@carecard/jwt-read 3.1.28 → 3.2.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.
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: npm-package-flow
3
+ description: 'Use in pkg-* repositories when publishable package code changes require a version bump, GitHub development/main squash-merge flow, npm publication, and uncommitted consumer package updates in ms-* and app-dashboard.'
4
+ ---
5
+
6
+ # npm Package Flow
7
+
8
+ ## Purpose
9
+
10
+ Use this skill in a `pkg-*` repository when package code changes need to be
11
+ published to npm and propagated to CareCard consumers.
12
+
13
+ The package name is the `name` field in the repository `package.json`.
14
+
15
+ ## Publishable vs Non-Publishable Changes
16
+
17
+ Publishable package changes include runtime source changes, public exports,
18
+ TypeScript declarations, package metadata that affects consumers, security
19
+ behavior, or dependency behavior that changes the package contract.
20
+
21
+ The following are not publishable package changes by themselves:
22
+
23
+ - Skills or `.agents` guidance.
24
+ - Documentation and README updates.
25
+ - Tests, fixtures, mocks, snapshots, or validation-only changes.
26
+ - Formatting-only changes and comments.
27
+
28
+ For non-publishable changes, do not bump the package version, publish to npm,
29
+ or update `ms-*` and `app-dashboard` package versions.
30
+
31
+ ## Required Flow For Publishable Changes
32
+
33
+ Run this workflow only when the user explicitly asks for package publication,
34
+ remote GitHub merge work, or the full package-flow completion. Remote Git and
35
+ GitHub operations must not be inferred.
36
+
37
+ 1. Finish package code, tests, documentation, and skill updates inside the
38
+ current `pkg-*` repository.
39
+ 2. Bump the package version in `package.json` and `package-lock.json` according
40
+ to the user request or the package change scope.
41
+ 3. Run the package's required tests, lint, type checks, and every direct Husky
42
+ script. Fix failures before continuing.
43
+ 4. Commit the package changes to the current branch.
44
+ 5. Push the current branch, create or reuse the PR into `development`,
45
+ squash-merge it with administrator privileges, and delete the merged branch.
46
+ 6. Create a new merge branch from the updated `development` branch and use that
47
+ branch to open a PR into `main`.
48
+ 7. Squash-merge the merge branch into `main` with administrator privileges and
49
+ delete the merge branch. This `main` merge publishes the package.
50
+ 8. Confirm publication with `npm view <package-name>@<version> version`.
51
+ 9. Check out a fresh local branch with the same name as the deleted working
52
+ branch from the updated `development` branch.
53
+ 10. Update the new `@carecard/...` package version in `app-dashboard` and in
54
+ only the `ms-*` repositories that already declare the package, plus any
55
+ explicitly intended new consumers.
56
+ 11. Run `npm install` and relevant validation in each updated consumer.
57
+ 12. Do not commit the `ms-*` or `app-dashboard` consumer updates unless the user
58
+ explicitly asks.
59
+
60
+ ## Consumer Update Rules
61
+
62
+ - Discover existing consumers by checking each target repository `package.json`
63
+ for the published package name.
64
+ - Install exact package versions, for example
65
+ `npm install <package-name>@<version> --save-exact`.
66
+ - Keep consumer updates local and uncommitted unless the user gives a separate
67
+ commit or PR instruction.
68
+ - If a consumer should become a new dependency, require explicit user intent for
69
+ that repository.
70
+
71
+ ## Reporting
72
+
73
+ Report the package name, published version, development PR, main PR, npm
74
+ publication check, consumer repositories updated, validation commands run, and
75
+ any consumer updates intentionally left uncommitted.
@@ -0,0 +1,5 @@
1
+ interface:
2
+ display_name: 'npm Package Flow'
3
+ short_description: 'Use in pkg-* repositories when publishable @carecard package code changes need npm publication and consumer updates.'
4
+ brand_color: '#0F766E'
5
+ default_prompt: 'Use $npm-package-flow when this task matches the skill scope.'
@@ -106,6 +106,11 @@ depend on those folders being present.
106
106
  - Request attachment behavior for authenticated JWT objects and visitor tokens.
107
107
  - Request attachment behavior for compact scoped authorization-context JWTs
108
108
  from `X-Authorization-Context` as `req.userAuthorization`.
109
+ - Shared header defaults for scoped authorization context:
110
+ `DEFAULT_USER_AUTHORIZATION_HEADER_NAME` and
111
+ `DEFAULT_USER_AUTHORIZATION_MAX_TOKEN_LENGTH`. Token issuers and consuming
112
+ services should import these constants instead of duplicating the header name
113
+ or 2048-character limit.
109
114
  - Server-auth request attachment behavior that normalizes introspected claims
110
115
  into `req.jwt.payload` with `authMode: "server-auth"` and
111
116
  `auth_mode: "server-auth"`.
package/index.d.ts CHANGED
@@ -4,6 +4,9 @@
4
4
 
5
5
  import { NextFunction, Request, Response } from 'express';
6
6
 
7
+ export const DEFAULT_USER_AUTHORIZATION_HEADER_NAME: 'X-Authorization-Context';
8
+ export const DEFAULT_USER_AUTHORIZATION_MAX_TOKEN_LENGTH: 2048;
9
+
7
10
  /**
8
11
  * Represents the standard JWT header structure.
9
12
  */
package/index.js CHANGED
@@ -2,6 +2,8 @@ const jwtLib = require('./lib/jwtLib');
2
2
  const jwtRoles = require('./lib/jwtRoles');
3
3
 
4
4
  module.exports = {
5
+ DEFAULT_USER_AUTHORIZATION_HEADER_NAME: jwtLib.DEFAULT_USER_AUTHORIZATION_HEADER_NAME,
6
+ DEFAULT_USER_AUTHORIZATION_MAX_TOKEN_LENGTH: jwtLib.DEFAULT_USER_AUTHORIZATION_MAX_TOKEN_LENGTH,
5
7
  jwtVerify: jwtLib.verifyJwt,
6
8
  jwtVerifyWebToken: jwtLib.verifyWebToken,
7
9
  jwtVerifyNoThrow: jwtLib.verifyJwtNoThrow,
package/lib/jwtLib.js CHANGED
@@ -752,6 +752,8 @@ function _extractWebTokenNoThrow(jwtRaw) {
752
752
  }
753
753
 
754
754
  module.exports = {
755
+ DEFAULT_USER_AUTHORIZATION_HEADER_NAME,
756
+ DEFAULT_USER_AUTHORIZATION_MAX_TOKEN_LENGTH,
755
757
  _validateJwt,
756
758
  _validateJwtNoThrow,
757
759
  _isJwtSignatureValid,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carecard/jwt-read",
3
- "version": "3.1.28",
3
+ "version": "3.2.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/CareCard-ca/pkg-jwt-read.git"
@@ -41,8 +41,8 @@
41
41
  "typescript": "6.0.3"
42
42
  },
43
43
  "dependencies": {
44
- "@carecard/auth-util": "3.1.16",
45
- "@carecard/common-util": "3.1.15",
46
- "@carecard/validate": "3.1.27"
44
+ "@carecard/auth-util": "3.2.0",
45
+ "@carecard/common-util": "3.2.0",
46
+ "@carecard/validate": "3.3.0"
47
47
  }
48
48
  }
package/readme.md CHANGED
@@ -141,6 +141,9 @@ database context and role checks.
141
141
  Use `jwtVerifyUserAuthorization` when a route needs to verify only the compact
142
142
  authorization-context token carried in `X-Authorization-Context`. The token is
143
143
  read as a raw JWT header value, not as `Bearer <token>`.
144
+ The exported `DEFAULT_USER_AUTHORIZATION_MAX_TOKEN_LENGTH` is `2048`; token
145
+ issuers and consumers should use that shared constant instead of duplicating a
146
+ local limit.
144
147
 
145
148
  ```javascript
146
149
  const { jwtVerifyUserAuthorization } = require('@carecard/jwt-read');