@dcsv-io/d2-auth-abstractions 0.1.1 → 0.1.2

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 (2) hide show
  1. package/README.md +18 -14
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -4,13 +4,17 @@ Copyright (c) DCSV. Licensed under the Apache License, Version 2.0.
4
4
 
5
5
  # @dcsv-io/d2-auth-abstractions
6
6
 
7
- > Parent: [`packages/typescript/`](../../README.md)
8
-
9
7
  Auth-related constants for TS consumers — `Scopes` tree, `AuthErrorCodes`,
10
8
  `AuthFailures` factories, `JwtClaimTypes`. Mirrors
11
9
  `DcsvIo.D2.Auth.Abstractions` + `DcsvIo.D2.Auth.Errors` consolidated
12
10
  (matches the .NET assembly placement).
13
11
 
12
+ ## Install
13
+
14
+ ```bash
15
+ pnpm add @dcsv-io/d2-auth-abstractions
16
+ ```
17
+
14
18
  ## Public API
15
19
 
16
20
  | Export | Source | Mirror |
@@ -34,11 +38,11 @@ transparently. Generated files (`*.g.ts`) are committed to git.
34
38
 
35
39
  - `JwtClaimTypes` — string-constant catalog (every claim's wire name).
36
40
  - `JwtPayload` — TS interface typed on every `standard` + `d2-custom`
37
- claim with stable per-field types; `inside-act` claims live nested
38
- inside `act` and are not surfaced as top-level fields. A trailing
39
- `raw: Readonly<Record<string, unknown>>` escape hatch carries the
40
- raw decoded claims for downstream consumers needing access to
41
- non-spec'd claims.
41
+ claim with stable per-field types; `inside-act` claims live nested
42
+ inside `act` and are not surfaced as top-level fields. A trailing
43
+ `raw: Readonly<Record<string, unknown>>` escape hatch carries the
44
+ raw decoded claims for downstream consumers needing access to
45
+ non-spec'd claims.
42
46
 
43
47
  The .NET side consumes the same spec for `JwtClaimTypes` constants;
44
48
  .NET reads claim values via `ClaimsPrincipal` so a typed payload is not
@@ -47,7 +51,7 @@ structurally impossible (single source).
47
51
 
48
52
  ## Header constants
49
53
 
50
- > Wire-protocol header catalogs live in the per-transport packages — see [`../../README.md` § Packages](../../README.md#packages) for the full per-transport catalog enumeration.
54
+ > Wire-protocol header catalogs live in the per-transport packages (`@dcsv-io/d2-headers-http`, `@dcsv-io/d2-headers-grpc`, `@dcsv-io/d2-headers-amqp`, `@dcsv-io/d2-headers-common`).
51
55
 
52
56
  ## Dependencies
53
57
 
@@ -86,19 +90,19 @@ if (result.errorCode === AuthErrorCodes.AUTH_JWT_EXPIRED) {
86
90
  Mirrors `DcsvIo.D2.Auth.Abstractions` + `DcsvIo.D2.Auth.Errors`:
87
91
 
88
92
  - `Scopes` tree — same dot-segmented spec names emitted as nested
89
- constants (e.g. `Scopes.auth.user.impersonate.consent`).
93
+ constants (e.g. `Scopes.auth.user.impersonate.consent`).
90
94
  - `AuthErrorCodes` — same string values (every constant is its own name).
91
95
  - `AuthFailures` — every factory returns `D2Result.fail(...)` with
92
- matching `errorCode` + `statusCode` + default `messageKey`.
96
+ matching `errorCode` + `statusCode` + default `messageKey`.
93
97
  - `JwtClaimTypes` — codegen-emitted from `contracts/jwt-claims/jwt-claims.spec.json`;
94
- same constant names + values on both sides.
98
+ same constant names + values on both sides.
95
99
  - `JwtPayload` — TS-only typed view emitted from the same spec; .NET reads
96
- claims via `ClaimsPrincipal` rather than a typed shape.
100
+ claims via `ClaimsPrincipal` rather than a typed shape.
97
101
 
98
102
  ## Edge cases
99
103
 
100
104
  - `getAuthErrorHttpStatus` returns 500 for unknown codes — defensive
101
- default, every shipped `AUTH_*` code IS in the table.
105
+ default, every shipped `AUTH_*` code IS in the table.
102
106
  - `Scopes` may include `_self` keys at branch nodes when an entry is
103
- both a leaf scope AND has children (rare; edge case for forward-compat).
107
+ both a leaf scope AND has children (rare; edge case for forward-compat).
104
108
  - Generated files (`*.g.ts`) are committed to git.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcsv-io/d2-auth-abstractions",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -14,10 +14,10 @@
14
14
  "dist"
15
15
  ],
16
16
  "dependencies": {
17
- "@dcsv-io/d2-i18n-abstractions": "0.1.1",
18
- "@dcsv-io/d2-i18n-keys": "0.1.1",
19
- "@dcsv-io/d2-error-category": "0.1.1",
20
- "@dcsv-io/d2-result": "0.1.1"
17
+ "@dcsv-io/d2-error-category": "0.1.2",
18
+ "@dcsv-io/d2-i18n-abstractions": "0.1.2",
19
+ "@dcsv-io/d2-i18n-keys": "0.1.2",
20
+ "@dcsv-io/d2-result": "0.1.2"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@vitest/coverage-v8": "4.0.18",