@dcsv-io/d2-auth-context-abstractions 0.1.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.
Files changed (43) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +98 -0
  3. package/dist/IAuthContext.g.d.ts +128 -0
  4. package/dist/IAuthContext.g.d.ts.map +1 -0
  5. package/dist/IAuthContext.g.js +13 -0
  6. package/dist/IAuthContext.g.js.map +1 -0
  7. package/dist/enums/actor-kind.g.d.ts +10 -0
  8. package/dist/enums/actor-kind.g.d.ts.map +1 -0
  9. package/dist/enums/actor-kind.g.js +17 -0
  10. package/dist/enums/actor-kind.g.js.map +1 -0
  11. package/dist/enums/call-path-kind.g.d.ts +16 -0
  12. package/dist/enums/call-path-kind.g.d.ts.map +1 -0
  13. package/dist/enums/call-path-kind.g.js +23 -0
  14. package/dist/enums/call-path-kind.g.js.map +1 -0
  15. package/dist/enums/impersonation-kind.g.d.ts +10 -0
  16. package/dist/enums/impersonation-kind.g.d.ts.map +1 -0
  17. package/dist/enums/impersonation-kind.g.js +17 -0
  18. package/dist/enums/impersonation-kind.g.js.map +1 -0
  19. package/dist/enums/org-type.g.d.ts +19 -0
  20. package/dist/enums/org-type.g.d.ts.map +1 -0
  21. package/dist/enums/org-type.g.js +26 -0
  22. package/dist/enums/org-type.g.js.map +1 -0
  23. package/dist/enums/request-origin.g.d.ts +19 -0
  24. package/dist/enums/request-origin.g.d.ts.map +1 -0
  25. package/dist/enums/request-origin.g.js +26 -0
  26. package/dist/enums/request-origin.g.js.map +1 -0
  27. package/dist/enums/role.g.d.ts +16 -0
  28. package/dist/enums/role.g.d.ts.map +1 -0
  29. package/dist/enums/role.g.js +23 -0
  30. package/dist/enums/role.g.js.map +1 -0
  31. package/dist/index.d.ts +11 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +13 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/types/actor-entry.g.d.ts +23 -0
  36. package/dist/types/actor-entry.g.d.ts.map +1 -0
  37. package/dist/types/actor-entry.g.js +9 -0
  38. package/dist/types/actor-entry.g.js.map +1 -0
  39. package/dist/types/call-path-entry.g.d.ts +13 -0
  40. package/dist/types/call-path-entry.g.d.ts.map +1 -0
  41. package/dist/types/call-path-entry.g.js +9 -0
  42. package/dist/types/call-path-entry.g.js.map +1 -0
  43. package/package.json +34 -0
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+  Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright (c) DCSV
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,98 @@
1
+ <!--
2
+ Copyright (c) DCSV. Licensed under the Apache License, Version 2.0.
3
+ -->
4
+
5
+ # @dcsv-io/d2-auth-context-abstractions
6
+
7
+ > Parent: [`packages/typescript/`](../../README.md)
8
+
9
+ `IAuthContext` interface + supporting enums/types. Emitted from
10
+ `contracts/auth-context/IAuthContext.spec.json` (generated sources committed).
11
+ Mirrors `DcsvIo.D2.AuthContext.Abstractions` (.NET).
12
+
13
+ ## Public API
14
+
15
+ Generated artifacts (committed to git):
16
+
17
+ | Export | Source |
18
+ | ------------------------------------------------------ | -------------------------------------------------------- |
19
+ | `IAuthContext` | `IAuthContext.g.ts` |
20
+ | `IAuthContextRedactPaths` | `IAuthContext.g.ts` (PII paths from spec `redact: true`) |
21
+ | `OrgType` / `Role` / `ImpersonationKind` / `ActorKind` | `enums/*.g.ts` |
22
+ | `ActorEntry` | `types/actor-entry.g.ts` |
23
+
24
+ ## Codegen workflow
25
+
26
+ `prebuild` runs the `auth-context-emit.ts` script before `tsc -b`, so
27
+ `pnpm -r build` regenerates transparently. Force-regen via:
28
+
29
+ ```bash
30
+ pnpm --filter ts-codegen codegen --force
31
+ ```
32
+
33
+ ## Dependencies
34
+
35
+ None at the package level (interfaces only). The codegen runner
36
+ (codegen tooling when present) is a build-time dependency, not a runtime one.
37
+
38
+ ## Usage example
39
+
40
+ ```ts
41
+ import type { IAuthContext } from "@dcsv-io/d2-auth-context-abstractions";
42
+ import {
43
+ OrgType,
44
+ IAuthContextRedactPaths,
45
+ } from "@dcsv-io/d2-auth-context-abstractions";
46
+ import { setupLogger } from "@dcsv-io/d2-logging";
47
+
48
+ const log = setupLogger({
49
+ serviceName: "edge",
50
+ redactPaths: [IAuthContextRedactPaths],
51
+ });
52
+
53
+ function describe(ctx: IAuthContext): string {
54
+ return `${ctx.userId ?? "anon"} on ${ctx.orgId ?? "no-org"} (${
55
+ ctx.orgType ?? OrgType.Customer
56
+ })`;
57
+ }
58
+ ```
59
+
60
+ ## Parity with .NET
61
+
62
+ Mirrors `DcsvIo.D2.AuthContext.Abstractions`:
63
+
64
+ - `IAuthContext` — same property set, camelCased per TS conventions.
65
+ - `OrgType` / `Role` / `ImpersonationKind` / `ActorKind` — same wire
66
+ values (string-literal unions).
67
+ - `ActorEntry` — same field shape.
68
+
69
+ The .NET-side codegen lives in `DcsvIo.D2.Context.SourceGen` (Roslyn
70
+ incremental generator); the TS-side catalogs are committed generated sources.
71
+ Both consume the same `IAuthContext.spec.json`.
72
+
73
+ ## Nullability convention
74
+
75
+ Spec-emitted property types use `T | null` rather than the more idiomatic
76
+ TS `T?` / `T | undefined`. This mirrors the .NET side, where
77
+ `Nullable<T>` carries an explicit `null` value; serializing the context
78
+ envelope across the language boundary preserves the `null` literal so
79
+ both sides round-trip the same shape. Optional-chaining and nullish-
80
+ coalescing handle either `null` or `undefined` at consumer call sites,
81
+ so this convention is opaque to most callers — only matters when you're
82
+ constructing or destructuring an `IAuthContext` literal directly.
83
+
84
+ New domain code outside the codegen-emitted surface should use the
85
+ default TS convention (`T?` / `T | undefined`) per the wider TS
86
+ codebase's nullability rule. The spec's `?` suffix on a type entry
87
+ (e.g. `"string?"` in `IAuthContext.spec.json`) is what triggers the
88
+ `| null` emission.
89
+
90
+ ## Edge cases
91
+
92
+ - `IAuthContextRedactPaths` is empty when no spec entry carries
93
+ `redact: true`. Hand-register additional paths via
94
+ `markRedactedFields()` from `@dcsv-io/d2-logging` if needed.
95
+ - Generated files (`*.g.ts`) are committed to git so consumers don't
96
+ pay a generate-on-first-build penalty.
97
+ - `pnpm exec eslint` ignores generated files — formatting drift is
98
+ irrelevant for spec-derived output.
@@ -0,0 +1,128 @@
1
+ import type { OrgType } from "./enums/org-type.g.js";
2
+ import type { Role } from "./enums/role.g.js";
3
+ import type { ImpersonationKind } from "./enums/impersonation-kind.g.js";
4
+ import type { ActorEntry } from "./types/actor-entry.g.js";
5
+ export type { ActorEntry, ImpersonationKind, OrgType, Role };
6
+ /**
7
+ * Identity and authorization context derived from the bearer token (JWT) on the current request or message. Read-only contract consumed by handlers, repos, and any code that needs to reason about who is acting and what they're allowed to do. Populated by transport-specific middleware via MutableRequestContext (which implements IRequestContext, transitively IAuthContext). Cross-user access is granted via impersonation (Consent or Force flavor — see ImpersonationKind).
8
+ */
9
+ export interface IAuthContext {
10
+ /**
11
+ * Whether the request is authenticated. Trinary semantics: null = pre-auth (middleware hasn't determined yet), false = explicitly unauthenticated, true = authenticated. Never treat null as false.
12
+ */
13
+ readonly isAuthenticated?: boolean;
14
+ /**
15
+ * Standard JWT audience claim — the service identifier(s) this token was minted for. Per RFC 7519 §4.1.3, aud may be a single string OR a JSON array; both wire shapes are accepted and surfaced as an IReadOnlyList<string> here. Audience validation is a transport-layer concern (auth middleware), not a per-handler check; this property is exposed for handler-level audit / introspection only.
16
+ */
17
+ readonly audience: readonly string[];
18
+ /**
19
+ * User's own session record identifier in d2-auth. NOT the impersonation session id — see ImpersonationSessionId for that. Links the runtime context back to a specific session for forced-sign-out / session-revocation flows.
20
+ */
21
+ readonly sessionId?: string;
22
+ /**
23
+ * When the token was minted (standard JWT iat claim, Unix seconds). Useful for short-lived service tokens to align cache TTLs with token validity.
24
+ */
25
+ readonly tokenIssuedAt?: string;
26
+ /**
27
+ * When the token expires (standard JWT exp claim, Unix seconds). Cache decisions can min(handler-cache-ttl, token-remaining-ttl) to avoid serving stale auth-derived data.
28
+ */
29
+ readonly tokenExpiresAt?: string;
30
+ /**
31
+ * RFC 8693 §4.1 actor chain, flattened. Wire format is recursive (act.act.act); we flatten to a list ordered outermost-first. Per RFC 8693 §4.1: the OUTERMOST entry (index 0) is the CURRENT actor (immediate caller); the MOST DEEPLY NESTED (last index) is the EARLIEST actor (originator) — 'the least recent actor is the most deeply nested.' Empty for end-user-direct tokens. Service entries indicate token-exchange delegation; Impersonation entries indicate user-on-behalf-of-user with sub-flavor on the entry's ImpersonationKind field. The auth lib's exchange endpoint MUST preserve nested act on re-exchange so OriginatingClientId remains recoverable through multi-hop chains.
32
+ */
33
+ readonly actorChain: readonly ActorEntry[];
34
+ /**
35
+ * Authentication Methods Reference (RFC 8176 standard claim). Space-separated or JSON-array string of authentication method identifiers used to authenticate the subject (e.g. 'pwd', 'otp', 'mfa', 'webauthn'). Input to risk-scoring and audit — 'password-only vs MFA vs OAuth2-with-WebAuthn' matters for sensitive-action gating. Null when the token was minted without AMR (e.g. service-identity client_credentials flows).
36
+ */
37
+ readonly authMethod?: string;
38
+ /**
39
+ * Unix-seconds timestamp of the last step-up authentication completion (Category 2 — past UTC instant). Handlers gating sensitive actions (e.g. billing.payment.charge) enforce 'step-up within last N minutes' by comparing this value against the current instant. Edge auth populates from the session record at JWT mint. Domain consumers MUST convert to NodaTime.Instant at the consumption boundary before any temporal arithmetic: dto.Value.ToInstant(). Wire form is DateTimeOffset? for JSON-serialization interop with the cross-language source-gen pipeline.
40
+ */
41
+ readonly lastStepUpAt?: string;
42
+ /**
43
+ * Raw JWT sub claim. The principal whose authority is being exercised. For user tokens: a Guid string (parsed into UserId). For pure service-identity tokens (RFC 6749 §4.4 client_credentials): the OAuth client_id of the calling service (UserId stays null in that case). For impersonation tokens: the impersonated user's id.
44
+ */
45
+ readonly subject?: string;
46
+ /**
47
+ * User identifier — JWT sub claim parsed as Guid. Null when sub is non-Guid (pure service-identity tokens — see Subject + IsServiceIdentity). During impersonation this is the impersonated user's id (the impersonator's id is recorded inside the act chain — see ImpersonatedBy).
48
+ */
49
+ readonly userId?: string;
50
+ /**
51
+ * Login handle — unique, lowercase username.
52
+ */
53
+ readonly username?: string;
54
+ /**
55
+ * Per RFC 8693 §4.3 / RFC 9068 §2.2 — the OAuth client_id of the client that requested THIS specific token from the authorization server. Updates on every token exchange (so for a multi-hop chain, this is the client that triggered the most recent exchange, NOT the originating client). Useful for audit ('this token was minted at the request of X').
56
+ */
57
+ readonly requestedByClientId?: string;
58
+ /**
59
+ * The service that immediately called this handler — the OUTERMOST Service entry in the act chain (per RFC 8693 §4.1: 'the outermost act claim represents the current actor'). Null when the user is calling directly with no service intermediary, AND when the chain contains only Impersonation entries with no Service hops yet.
60
+ */
61
+ readonly immediateCallerClientId?: string;
62
+ /**
63
+ * The service that started the entire call chain — the MOST DEEPLY NESTED Service entry in the act chain (per RFC 8693 §4.1: 'the least recent actor is the most deeply nested'). For pure service-identity tokens with no act chain, falls back to Subject. THIS IS THE PRIMARY AUDIT IDENTIFIER for end-to-end traceability across multi-hop sync + async chains.
64
+ */
65
+ readonly originatingClientId?: string;
66
+ /**
67
+ * True when the token represents a service identity acting for itself (RFC 6749 §4.4 client_credentials): UserId is null AND no impersonation in chain. False when there's a user (with or without service delegation in the chain). Null pre-auth. Use this to fork on 'is the caller a service or a human-acting party'.
68
+ */
69
+ readonly isServiceIdentity?: boolean;
70
+ /**
71
+ * Operating organization identifier. The JWT carries one org context — during impersonation it's the impersonated user's org (the agent's own org is recorded inside the act chain for audit and for authz rules keyed on the agent's home org).
72
+ */
73
+ readonly orgId?: string;
74
+ /**
75
+ * Operating organization display name.
76
+ */
77
+ readonly orgName?: string;
78
+ /**
79
+ * Operating organization type.
80
+ */
81
+ readonly orgType?: OrgType;
82
+ /**
83
+ * User's role in the operating organization.
84
+ */
85
+ readonly orgRole?: Role;
86
+ /**
87
+ * True when ActorChain contains any Impersonation entry. Trinary: null = pre-auth (middleware hasn't determined yet).
88
+ */
89
+ readonly isImpersonating?: boolean;
90
+ /**
91
+ * When IsImpersonating: distinguishes Consent (OTP-authorized, available to staff+admin) vs Force (silent, admin-only). Sourced from the outermost impersonation actor's act.d2_kind claim.
92
+ */
93
+ readonly impersonationKind?: ImpersonationKind;
94
+ /**
95
+ * When IsImpersonating: user id of the agent (impersonator). Derived from outermost impersonation actor's act.sub claim.
96
+ */
97
+ readonly impersonatedBy?: string;
98
+ /**
99
+ * When IsImpersonating: the impersonation session id (separate from the user's own SessionId). Derived from outermost impersonation actor's act.d2_session_id claim.
100
+ */
101
+ readonly impersonationSessionId?: string;
102
+ /**
103
+ * When IsImpersonating: the agent's (impersonator's) own org id. Derived from outermost impersonation actor's act.d2_org_id claim. Distinct from the top-level OrgId, which is the impersonated user's org. Used for audit ('Alice from Customer Support impersonated Bob') and for authz rules that key on the agent's home org.
104
+ */
105
+ readonly impersonatorOrgId?: string;
106
+ /**
107
+ * When IsImpersonating: the agent's own org display name. Derived from outermost impersonation actor's act.d2_org_name claim.
108
+ */
109
+ readonly impersonatorOrgName?: string;
110
+ /**
111
+ * When IsImpersonating: the agent's own org type. Derived from outermost impersonation actor's act.d2_org_type claim. Use IsImpersonatorStaff() / IsImpersonatorAdmin() extension methods for common checks.
112
+ */
113
+ readonly impersonatorOrgType?: OrgType;
114
+ /**
115
+ * When IsImpersonating: the agent's role in their own org. Derived from outermost impersonation actor's act.d2_org_role claim.
116
+ */
117
+ readonly impersonatorOrgRole?: Role;
118
+ /**
119
+ * OAuth scope set granted to this token. Per RFC 6749 §3.3 the wire format is space-separated string; the parser also accepts JSON arrays defensively. Use HasScope / HasAnyScope / HasAllScopes extension methods on IAuthContext for checks. During impersonation, Edge mints with impersonation-blocked scopes stripped at mint time (defense-in-depth — RequiredScopes check fails naturally for blocked actions).
120
+ */
121
+ readonly scopes: ReadonlySet<string>;
122
+ }
123
+ /**
124
+ * PII-bearing paths on IAuthContext. Consumed by setupLogger() to
125
+ * feed Pino's `redact: { paths }` config.
126
+ */
127
+ export declare const IAuthContextRedactPaths: readonly string[];
128
+ //# sourceMappingURL=IAuthContext.g.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAuthContext.g.d.ts","sourceRoot":"","sources":["../src/IAuthContext.g.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,YAAY;IAE3B;;OAEG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC;;OAEG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,SAAS,UAAU,EAAE,CAAC;IAC3C;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAC1C;;OAEG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC;;OAEG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAC/C;;OAEG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC;;OAEG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC;;OAEG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IACvC;;OAEG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,IAAI,CAAC;IAEpC;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACtC;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EACpD,CAAC"}
@@ -0,0 +1,13 @@
1
+ // -----------------------------------------------------------------------
2
+ // <auto-generated>
3
+ // Generated by the D2 TypeScript catalog codegen — see emitter tests for coverage.
4
+ // Source spec: contracts/auth-context/IAuthContext.spec.json
5
+ // Manual edits will be lost on rebuild.
6
+ // </auto-generated>
7
+ // -----------------------------------------------------------------------
8
+ /**
9
+ * PII-bearing paths on IAuthContext. Consumed by setupLogger() to
10
+ * feed Pino's `redact: { paths }` config.
11
+ */
12
+ export const IAuthContextRedactPaths = [];
13
+ //# sourceMappingURL=IAuthContext.g.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAuthContext.g.js","sourceRoot":"","sources":["../src/IAuthContext.g.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,mBAAmB;AACnB,qFAAqF;AACrF,+DAA+D;AAC/D,0CAA0C;AAC1C,oBAAoB;AACpB,0EAA0E;AAqI1E;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAsB,EACzD,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare const ActorKind: {
2
+ readonly Service: "Service";
3
+ readonly Impersonation: "Impersonation";
4
+ };
5
+ export type ActorKind = (typeof ActorKind)[keyof typeof ActorKind];
6
+ /** Service identity (RFC 6749 §4.4). */
7
+ export declare const ActorKind_Service: ActorKind;
8
+ /** User impersonation (Consent or Force per ImpersonationKind). */
9
+ export declare const ActorKind_Impersonation: ActorKind;
10
+ //# sourceMappingURL=actor-kind.g.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actor-kind.g.d.ts","sourceRoot":"","sources":["../../src/enums/actor-kind.g.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,SAAS;;;CAGZ,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEnE,wCAAwC;AACxC,eAAO,MAAM,iBAAiB,EAAE,SAA6B,CAAC;AAC9D,mEAAmE;AACnE,eAAO,MAAM,uBAAuB,EAAE,SAAmC,CAAC"}
@@ -0,0 +1,17 @@
1
+ // -----------------------------------------------------------------------
2
+ // <auto-generated>
3
+ // Generated by the D2 TypeScript catalog codegen — see emitter tests for coverage.
4
+ // Source spec: contracts/auth-context/IAuthContext.spec.json
5
+ // Manual edits will be lost on rebuild.
6
+ // </auto-generated>
7
+ // -----------------------------------------------------------------------
8
+ /* eslint-disable */
9
+ export const ActorKind = {
10
+ Service: "Service",
11
+ Impersonation: "Impersonation",
12
+ };
13
+ /** Service identity (RFC 6749 §4.4). */
14
+ export const ActorKind_Service = ActorKind.Service;
15
+ /** User impersonation (Consent or Force per ImpersonationKind). */
16
+ export const ActorKind_Impersonation = ActorKind.Impersonation;
17
+ //# sourceMappingURL=actor-kind.g.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actor-kind.g.js","sourceRoot":"","sources":["../../src/enums/actor-kind.g.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,mBAAmB;AACnB,qFAAqF;AACrF,+DAA+D;AAC/D,0CAA0C;AAC1C,oBAAoB;AACpB,0EAA0E;AAE1E,oBAAoB;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,eAAe;CACtB,CAAC;AAIX,wCAAwC;AACxC,MAAM,CAAC,MAAM,iBAAiB,GAAc,SAAS,CAAC,OAAO,CAAC;AAC9D,mEAAmE;AACnE,MAAM,CAAC,MAAM,uBAAuB,GAAc,SAAS,CAAC,aAAa,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare const CallPathKind: {
2
+ readonly Edge: "Edge";
3
+ readonly WorkloadHop: "WorkloadHop";
4
+ readonly ModuleHop: "ModuleHop";
5
+ readonly System: "System";
6
+ };
7
+ export type CallPathKind = (typeof CallPathKind)[keyof typeof CallPathKind];
8
+ /** The Edge HTTP inbound boundary (the originating hop). */
9
+ export declare const CallPathKind_Edge: CallPathKind;
10
+ /** A cross-process workload hop reached over authenticated mutual TLS. */
11
+ export declare const CallPathKind_WorkloadHop: CallPathKind;
12
+ /** An in-process module hop (the in-host leaf). */
13
+ export declare const CallPathKind_ModuleHop: CallPathKind;
14
+ /** An in-host system worker (a background service). */
15
+ export declare const CallPathKind_System: CallPathKind;
16
+ //# sourceMappingURL=call-path-kind.g.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-path-kind.g.d.ts","sourceRoot":"","sources":["../../src/enums/call-path-kind.g.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE5E,4DAA4D;AAC5D,eAAO,MAAM,iBAAiB,EAAE,YAAgC,CAAC;AACjE,0EAA0E;AAC1E,eAAO,MAAM,wBAAwB,EAAE,YAAuC,CAAC;AAC/E,mDAAmD;AACnD,eAAO,MAAM,sBAAsB,EAAE,YAAqC,CAAC;AAC3E,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,EAAE,YAAkC,CAAC"}
@@ -0,0 +1,23 @@
1
+ // -----------------------------------------------------------------------
2
+ // <auto-generated>
3
+ // Generated by the D2 TypeScript catalog codegen — see emitter tests for coverage.
4
+ // Source spec: contracts/auth-context/IAuthContext.spec.json
5
+ // Manual edits will be lost on rebuild.
6
+ // </auto-generated>
7
+ // -----------------------------------------------------------------------
8
+ /* eslint-disable */
9
+ export const CallPathKind = {
10
+ Edge: "Edge",
11
+ WorkloadHop: "WorkloadHop",
12
+ ModuleHop: "ModuleHop",
13
+ System: "System",
14
+ };
15
+ /** The Edge HTTP inbound boundary (the originating hop). */
16
+ export const CallPathKind_Edge = CallPathKind.Edge;
17
+ /** A cross-process workload hop reached over authenticated mutual TLS. */
18
+ export const CallPathKind_WorkloadHop = CallPathKind.WorkloadHop;
19
+ /** An in-process module hop (the in-host leaf). */
20
+ export const CallPathKind_ModuleHop = CallPathKind.ModuleHop;
21
+ /** An in-host system worker (a background service). */
22
+ export const CallPathKind_System = CallPathKind.System;
23
+ //# sourceMappingURL=call-path-kind.g.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-path-kind.g.js","sourceRoot":"","sources":["../../src/enums/call-path-kind.g.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,mBAAmB;AACnB,qFAAqF;AACrF,+DAA+D;AAC/D,0CAA0C;AAC1C,oBAAoB;AACpB,0EAA0E;AAE1E,oBAAoB;AAEpB,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,aAAa;IAC1B,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;CACR,CAAC;AAIX,4DAA4D;AAC5D,MAAM,CAAC,MAAM,iBAAiB,GAAiB,YAAY,CAAC,IAAI,CAAC;AACjE,0EAA0E;AAC1E,MAAM,CAAC,MAAM,wBAAwB,GAAiB,YAAY,CAAC,WAAW,CAAC;AAC/E,mDAAmD;AACnD,MAAM,CAAC,MAAM,sBAAsB,GAAiB,YAAY,CAAC,SAAS,CAAC;AAC3E,uDAAuD;AACvD,MAAM,CAAC,MAAM,mBAAmB,GAAiB,YAAY,CAAC,MAAM,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare const ImpersonationKind: {
2
+ readonly Consent: "Consent";
3
+ readonly Force: "Force";
4
+ };
5
+ export type ImpersonationKind = (typeof ImpersonationKind)[keyof typeof ImpersonationKind];
6
+ /** Consent-based impersonation (OTP-authorized). */
7
+ export declare const ImpersonationKind_Consent: ImpersonationKind;
8
+ /** Force impersonation (admin-only, silent). */
9
+ export declare const ImpersonationKind_Force: ImpersonationKind;
10
+ //# sourceMappingURL=impersonation-kind.g.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impersonation-kind.g.d.ts","sourceRoot":"","sources":["../../src/enums/impersonation-kind.g.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAE3F,oDAAoD;AACpD,eAAO,MAAM,yBAAyB,EAAE,iBAA6C,CAAC;AACtF,gDAAgD;AAChD,eAAO,MAAM,uBAAuB,EAAE,iBAA2C,CAAC"}
@@ -0,0 +1,17 @@
1
+ // -----------------------------------------------------------------------
2
+ // <auto-generated>
3
+ // Generated by the D2 TypeScript catalog codegen — see emitter tests for coverage.
4
+ // Source spec: contracts/auth-context/IAuthContext.spec.json
5
+ // Manual edits will be lost on rebuild.
6
+ // </auto-generated>
7
+ // -----------------------------------------------------------------------
8
+ /* eslint-disable */
9
+ export const ImpersonationKind = {
10
+ Consent: "Consent",
11
+ Force: "Force",
12
+ };
13
+ /** Consent-based impersonation (OTP-authorized). */
14
+ export const ImpersonationKind_Consent = ImpersonationKind.Consent;
15
+ /** Force impersonation (admin-only, silent). */
16
+ export const ImpersonationKind_Force = ImpersonationKind.Force;
17
+ //# sourceMappingURL=impersonation-kind.g.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impersonation-kind.g.js","sourceRoot":"","sources":["../../src/enums/impersonation-kind.g.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,mBAAmB;AACnB,qFAAqF;AACrF,+DAA+D;AAC/D,0CAA0C;AAC1C,oBAAoB;AACpB,0EAA0E;AAE1E,oBAAoB;AAEpB,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;CACN,CAAC;AAIX,oDAAoD;AACpD,MAAM,CAAC,MAAM,yBAAyB,GAAsB,iBAAiB,CAAC,OAAO,CAAC;AACtF,gDAAgD;AAChD,MAAM,CAAC,MAAM,uBAAuB,GAAsB,iBAAiB,CAAC,KAAK,CAAC"}
@@ -0,0 +1,19 @@
1
+ export declare const OrgType: {
2
+ readonly Admin: "Admin";
3
+ readonly Support: "Support";
4
+ readonly Customer: "Customer";
5
+ readonly ThirdParty: "ThirdParty";
6
+ readonly Affiliate: "Affiliate";
7
+ };
8
+ export type OrgType = (typeof OrgType)[keyof typeof OrgType];
9
+ /** Administrative organization. */
10
+ export declare const OrgType_Admin: OrgType;
11
+ /** Support organization. */
12
+ export declare const OrgType_Support: OrgType;
13
+ /** Customer organization. */
14
+ export declare const OrgType_Customer: OrgType;
15
+ /** Third-party organization. */
16
+ export declare const OrgType_ThirdParty: OrgType;
17
+ /** Affiliate organization. */
18
+ export declare const OrgType_Affiliate: OrgType;
19
+ //# sourceMappingURL=org-type.g.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"org-type.g.d.ts","sourceRoot":"","sources":["../../src/enums/org-type.g.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,OAAO;;;;;;CAMV,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;AAE7D,mCAAmC;AACnC,eAAO,MAAM,aAAa,EAAE,OAAuB,CAAC;AACpD,4BAA4B;AAC5B,eAAO,MAAM,eAAe,EAAE,OAAyB,CAAC;AACxD,6BAA6B;AAC7B,eAAO,MAAM,gBAAgB,EAAE,OAA0B,CAAC;AAC1D,gCAAgC;AAChC,eAAO,MAAM,kBAAkB,EAAE,OAA4B,CAAC;AAC9D,8BAA8B;AAC9B,eAAO,MAAM,iBAAiB,EAAE,OAA2B,CAAC"}
@@ -0,0 +1,26 @@
1
+ // -----------------------------------------------------------------------
2
+ // <auto-generated>
3
+ // Generated by the D2 TypeScript catalog codegen — see emitter tests for coverage.
4
+ // Source spec: contracts/auth-context/IAuthContext.spec.json
5
+ // Manual edits will be lost on rebuild.
6
+ // </auto-generated>
7
+ // -----------------------------------------------------------------------
8
+ /* eslint-disable */
9
+ export const OrgType = {
10
+ Admin: "Admin",
11
+ Support: "Support",
12
+ Customer: "Customer",
13
+ ThirdParty: "ThirdParty",
14
+ Affiliate: "Affiliate",
15
+ };
16
+ /** Administrative organization. */
17
+ export const OrgType_Admin = OrgType.Admin;
18
+ /** Support organization. */
19
+ export const OrgType_Support = OrgType.Support;
20
+ /** Customer organization. */
21
+ export const OrgType_Customer = OrgType.Customer;
22
+ /** Third-party organization. */
23
+ export const OrgType_ThirdParty = OrgType.ThirdParty;
24
+ /** Affiliate organization. */
25
+ export const OrgType_Affiliate = OrgType.Affiliate;
26
+ //# sourceMappingURL=org-type.g.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"org-type.g.js","sourceRoot":"","sources":["../../src/enums/org-type.g.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,mBAAmB;AACnB,qFAAqF;AACrF,+DAA+D;AAC/D,0CAA0C;AAC1C,oBAAoB;AACpB,0EAA0E;AAE1E,oBAAoB;AAEpB,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,YAAY;IACxB,SAAS,EAAE,WAAW;CACd,CAAC;AAIX,mCAAmC;AACnC,MAAM,CAAC,MAAM,aAAa,GAAY,OAAO,CAAC,KAAK,CAAC;AACpD,4BAA4B;AAC5B,MAAM,CAAC,MAAM,eAAe,GAAY,OAAO,CAAC,OAAO,CAAC;AACxD,6BAA6B;AAC7B,MAAM,CAAC,MAAM,gBAAgB,GAAY,OAAO,CAAC,QAAQ,CAAC;AAC1D,gCAAgC;AAChC,MAAM,CAAC,MAAM,kBAAkB,GAAY,OAAO,CAAC,UAAU,CAAC;AAC9D,8BAA8B;AAC9B,MAAM,CAAC,MAAM,iBAAiB,GAAY,OAAO,CAAC,SAAS,CAAC"}
@@ -0,0 +1,19 @@
1
+ export declare const RequestOrigin: {
2
+ readonly Unestablished: "Unestablished";
3
+ readonly EdgeInbound: "EdgeInbound";
4
+ readonly CrossProcessHop: "CrossProcessHop";
5
+ readonly InProcessModule: "InProcessModule";
6
+ readonly System: "System";
7
+ };
8
+ export type RequestOrigin = (typeof RequestOrigin)[keyof typeof RequestOrigin];
9
+ /** No boundary positively established the origin (the fail-closed default). */
10
+ export declare const RequestOrigin_Unestablished: RequestOrigin;
11
+ /** The Edge HTTP inbound boundary — start of the call-path. */
12
+ export declare const RequestOrigin_EdgeInbound: RequestOrigin;
13
+ /** A cross-process gRPC hop authenticated by the mutual-TLS client cert. */
14
+ export declare const RequestOrigin_CrossProcessHop: RequestOrigin;
15
+ /** An in-process module call (the in-host leaf). */
16
+ export declare const RequestOrigin_InProcessModule: RequestOrigin;
17
+ /** An in-host system worker (a background service). */
18
+ export declare const RequestOrigin_System: RequestOrigin;
19
+ //# sourceMappingURL=request-origin.g.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-origin.g.d.ts","sourceRoot":"","sources":["../../src/enums/request-origin.g.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE/E,+EAA+E;AAC/E,eAAO,MAAM,2BAA2B,EAAE,aAA2C,CAAC;AACtF,+DAA+D;AAC/D,eAAO,MAAM,yBAAyB,EAAE,aAAyC,CAAC;AAClF,4EAA4E;AAC5E,eAAO,MAAM,6BAA6B,EAAE,aAA6C,CAAC;AAC1F,oDAAoD;AACpD,eAAO,MAAM,6BAA6B,EAAE,aAA6C,CAAC;AAC1F,uDAAuD;AACvD,eAAO,MAAM,oBAAoB,EAAE,aAAoC,CAAC"}
@@ -0,0 +1,26 @@
1
+ // -----------------------------------------------------------------------
2
+ // <auto-generated>
3
+ // Generated by the D2 TypeScript catalog codegen — see emitter tests for coverage.
4
+ // Source spec: contracts/auth-context/IAuthContext.spec.json
5
+ // Manual edits will be lost on rebuild.
6
+ // </auto-generated>
7
+ // -----------------------------------------------------------------------
8
+ /* eslint-disable */
9
+ export const RequestOrigin = {
10
+ Unestablished: "Unestablished",
11
+ EdgeInbound: "EdgeInbound",
12
+ CrossProcessHop: "CrossProcessHop",
13
+ InProcessModule: "InProcessModule",
14
+ System: "System",
15
+ };
16
+ /** No boundary positively established the origin (the fail-closed default). */
17
+ export const RequestOrigin_Unestablished = RequestOrigin.Unestablished;
18
+ /** The Edge HTTP inbound boundary — start of the call-path. */
19
+ export const RequestOrigin_EdgeInbound = RequestOrigin.EdgeInbound;
20
+ /** A cross-process gRPC hop authenticated by the mutual-TLS client cert. */
21
+ export const RequestOrigin_CrossProcessHop = RequestOrigin.CrossProcessHop;
22
+ /** An in-process module call (the in-host leaf). */
23
+ export const RequestOrigin_InProcessModule = RequestOrigin.InProcessModule;
24
+ /** An in-host system worker (a background service). */
25
+ export const RequestOrigin_System = RequestOrigin.System;
26
+ //# sourceMappingURL=request-origin.g.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-origin.g.js","sourceRoot":"","sources":["../../src/enums/request-origin.g.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,mBAAmB;AACnB,qFAAqF;AACrF,+DAA+D;AAC/D,0CAA0C;AAC1C,oBAAoB;AACpB,0EAA0E;AAE1E,oBAAoB;AAEpB,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,aAAa,EAAE,eAAe;IAC9B,WAAW,EAAE,aAAa;IAC1B,eAAe,EAAE,iBAAiB;IAClC,eAAe,EAAE,iBAAiB;IAClC,MAAM,EAAE,QAAQ;CACR,CAAC;AAIX,+EAA+E;AAC/E,MAAM,CAAC,MAAM,2BAA2B,GAAkB,aAAa,CAAC,aAAa,CAAC;AACtF,+DAA+D;AAC/D,MAAM,CAAC,MAAM,yBAAyB,GAAkB,aAAa,CAAC,WAAW,CAAC;AAClF,4EAA4E;AAC5E,MAAM,CAAC,MAAM,6BAA6B,GAAkB,aAAa,CAAC,eAAe,CAAC;AAC1F,oDAAoD;AACpD,MAAM,CAAC,MAAM,6BAA6B,GAAkB,aAAa,CAAC,eAAe,CAAC;AAC1F,uDAAuD;AACvD,MAAM,CAAC,MAAM,oBAAoB,GAAkB,aAAa,CAAC,MAAM,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare const Role: {
2
+ readonly Auditor: "Auditor";
3
+ readonly Agent: "Agent";
4
+ readonly Officer: "Officer";
5
+ readonly Owner: "Owner";
6
+ };
7
+ export type Role = (typeof Role)[keyof typeof Role];
8
+ /** Auditor — read-heavy compliance role. */
9
+ export declare const Role_Auditor: Role;
10
+ /** Agent — standard operational role. */
11
+ export declare const Role_Agent: Role;
12
+ /** Officer — org-management role. */
13
+ export declare const Role_Officer: Role;
14
+ /** Owner — full control. */
15
+ export declare const Role_Owner: Role;
16
+ //# sourceMappingURL=role.g.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role.g.d.ts","sourceRoot":"","sources":["../../src/enums/role.g.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,IAAI;;;;;CAKP,CAAC;AAEX,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,OAAO,IAAI,CAAC,CAAC;AAEpD,4CAA4C;AAC5C,eAAO,MAAM,YAAY,EAAE,IAAmB,CAAC;AAC/C,yCAAyC;AACzC,eAAO,MAAM,UAAU,EAAE,IAAiB,CAAC;AAC3C,qCAAqC;AACrC,eAAO,MAAM,YAAY,EAAE,IAAmB,CAAC;AAC/C,4BAA4B;AAC5B,eAAO,MAAM,UAAU,EAAE,IAAiB,CAAC"}
@@ -0,0 +1,23 @@
1
+ // -----------------------------------------------------------------------
2
+ // <auto-generated>
3
+ // Generated by the D2 TypeScript catalog codegen — see emitter tests for coverage.
4
+ // Source spec: contracts/auth-context/IAuthContext.spec.json
5
+ // Manual edits will be lost on rebuild.
6
+ // </auto-generated>
7
+ // -----------------------------------------------------------------------
8
+ /* eslint-disable */
9
+ export const Role = {
10
+ Auditor: "Auditor",
11
+ Agent: "Agent",
12
+ Officer: "Officer",
13
+ Owner: "Owner",
14
+ };
15
+ /** Auditor — read-heavy compliance role. */
16
+ export const Role_Auditor = Role.Auditor;
17
+ /** Agent — standard operational role. */
18
+ export const Role_Agent = Role.Agent;
19
+ /** Officer — org-management role. */
20
+ export const Role_Officer = Role.Officer;
21
+ /** Owner — full control. */
22
+ export const Role_Owner = Role.Owner;
23
+ //# sourceMappingURL=role.g.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role.g.js","sourceRoot":"","sources":["../../src/enums/role.g.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,mBAAmB;AACnB,qFAAqF;AACrF,+DAA+D;AAC/D,0CAA0C;AAC1C,oBAAoB;AACpB,0EAA0E;AAE1E,oBAAoB;AAEpB,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;CACN,CAAC;AAIX,4CAA4C;AAC5C,MAAM,CAAC,MAAM,YAAY,GAAS,IAAI,CAAC,OAAO,CAAC;AAC/C,yCAAyC;AACzC,MAAM,CAAC,MAAM,UAAU,GAAS,IAAI,CAAC,KAAK,CAAC;AAC3C,qCAAqC;AACrC,MAAM,CAAC,MAAM,YAAY,GAAS,IAAI,CAAC,OAAO,CAAC;AAC/C,4BAA4B;AAC5B,MAAM,CAAC,MAAM,UAAU,GAAS,IAAI,CAAC,KAAK,CAAC"}
@@ -0,0 +1,11 @@
1
+ export * from "./IAuthContext.g.js";
2
+ export * from "./types/actor-entry.g.js";
3
+ export * from "./types/call-path-entry.g.js";
4
+ export { OrgType } from "./enums/org-type.g.js";
5
+ export type { OrgType as OrgTypeT } from "./enums/org-type.g.js";
6
+ export { Role } from "./enums/role.g.js";
7
+ export { ImpersonationKind } from "./enums/impersonation-kind.g.js";
8
+ export { ActorKind } from "./enums/actor-kind.g.js";
9
+ export { RequestOrigin } from "./enums/request-origin.g.js";
10
+ export { CallPathKind } from "./enums/call-path-kind.g.js";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,YAAY,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ // -----------------------------------------------------------------------
2
+ // Copyright (c) DCSV. Licensed under the Apache License, Version 2.0.
3
+ // -----------------------------------------------------------------------
4
+ export * from "./IAuthContext.g.js";
5
+ export * from "./types/actor-entry.g.js";
6
+ export * from "./types/call-path-entry.g.js";
7
+ export { OrgType } from "./enums/org-type.g.js";
8
+ export { Role } from "./enums/role.g.js";
9
+ export { ImpersonationKind } from "./enums/impersonation-kind.g.js";
10
+ export { ActorKind } from "./enums/actor-kind.g.js";
11
+ export { RequestOrigin } from "./enums/request-origin.g.js";
12
+ export { CallPathKind } from "./enums/call-path-kind.g.js";
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,sEAAsE;AACtE,0EAA0E;AAE1E,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { ActorKind } from "../enums/actor-kind.g.js";
2
+ import type { ImpersonationKind } from "../enums/impersonation-kind.g.js";
3
+ import type { OrgType } from "../enums/org-type.g.js";
4
+ import type { Role } from "../enums/role.g.js";
5
+ /**
6
+ * One link in the RFC 8693 actor chain. Mirrors .NET ActorEntry record.
7
+ * Optional fields use the `?:` shorthand; absent links arrive as
8
+ * `undefined`, never `null` (TypeScript uses `undefined` as the only
9
+ * absent sentinel).
10
+ */
11
+ export interface ActorEntry {
12
+ readonly kind: ActorKind;
13
+ readonly subject: string;
14
+ readonly clientId?: string;
15
+ readonly impersonationKind?: ImpersonationKind;
16
+ readonly sessionId?: string;
17
+ readonly orgId?: string;
18
+ readonly orgName?: string;
19
+ readonly orgType?: OrgType;
20
+ readonly orgRole?: Role;
21
+ readonly act?: ActorEntry;
22
+ }
23
+ //# sourceMappingURL=actor-entry.g.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actor-entry.g.d.ts","sourceRoot":"","sources":["../../src/types/actor-entry.g.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAC/C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC;CAC3B"}
@@ -0,0 +1,9 @@
1
+ // -----------------------------------------------------------------------
2
+ // <auto-generated>
3
+ // Generated by the D2 TypeScript catalog codegen — see emitter tests for coverage.
4
+ // Source spec: contracts/auth-context/IAuthContext.spec.json
5
+ // Manual edits will be lost on rebuild.
6
+ // </auto-generated>
7
+ // -----------------------------------------------------------------------
8
+ export {};
9
+ //# sourceMappingURL=actor-entry.g.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actor-entry.g.js","sourceRoot":"","sources":["../../src/types/actor-entry.g.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,mBAAmB;AACnB,qFAAqF;AACrF,+DAA+D;AAC/D,0CAA0C;AAC1C,oBAAoB;AACpB,0EAA0E"}
@@ -0,0 +1,13 @@
1
+ import type { CallPathKind } from "../enums/call-path-kind.g.js";
2
+ /**
3
+ * One hop in the propagated call-path. Mirrors .NET CallPathEntry record.
4
+ * Operational telemetry only — authority never reads the call-path. The
5
+ * timestamp is the wire DateTimeOffset ISO string (matching .NET's `O`
6
+ * round-trip format).
7
+ */
8
+ export interface CallPathEntry {
9
+ readonly id: string;
10
+ readonly kind: CallPathKind;
11
+ readonly timestamp: string;
12
+ }
13
+ //# sourceMappingURL=call-path-entry.g.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-path-entry.g.d.ts","sourceRoot":"","sources":["../../src/types/call-path-entry.g.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B"}
@@ -0,0 +1,9 @@
1
+ // -----------------------------------------------------------------------
2
+ // <auto-generated>
3
+ // Generated by the D2 TypeScript catalog codegen — see emitter tests for coverage.
4
+ // Source spec: contracts/auth-context/IAuthContext.spec.json
5
+ // Manual edits will be lost on rebuild.
6
+ // </auto-generated>
7
+ // -----------------------------------------------------------------------
8
+ export {};
9
+ //# sourceMappingURL=call-path-entry.g.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-path-entry.g.js","sourceRoot":"","sources":["../../src/types/call-path-entry.g.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,mBAAmB;AACnB,qFAAqF;AACrF,+DAA+D;AAC/D,0CAA0C;AAC1C,oBAAoB;AACpB,0EAA0E"}
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@dcsv-io/d2-auth-context-abstractions",
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ },
12
+ "./enums/*": {
13
+ "types": "./dist/enums/*.d.ts",
14
+ "import": "./dist/enums/*.js"
15
+ },
16
+ "./types/*": {
17
+ "types": "./dist/types/*.d.ts",
18
+ "import": "./dist/types/*.js"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "devDependencies": {
25
+ "typescript": "5.9.3",
26
+ "vitest": "4.0.18"
27
+ },
28
+ "scripts": {
29
+ "prebuild": "node ../../scripts/run-ts-codegen.mjs src/auth-context-emit.ts",
30
+ "build": "tsc -b",
31
+ "test": "vitest run",
32
+ "type-check:test": "tsc -p tsconfig.test.json"
33
+ }
34
+ }