@valon-technologies/gestalt 0.0.1-alpha.18 → 0.0.1-alpha.19

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/src/api.ts CHANGED
@@ -6,6 +6,26 @@ export interface Subject {
6
6
  kind: string;
7
7
  displayName: string;
8
8
  authSource: string;
9
+ email: string;
10
+ }
11
+
12
+ /**
13
+ * Subject payload authored by provider-side hooks.
14
+ */
15
+ export interface SubjectInput {
16
+ id: string;
17
+ kind: string;
18
+ displayName: string;
19
+ authSource: string;
20
+ email?: string | undefined;
21
+ }
22
+
23
+ /**
24
+ * Provider-owned external identity attached to an incoming provider request.
25
+ */
26
+ export interface ExternalIdentity {
27
+ type: string;
28
+ id: string;
9
29
  }
10
30
 
11
31
  /**
@@ -40,6 +60,9 @@ export interface Request {
40
60
  token: string;
41
61
  connectionParams: Record<string, string>;
42
62
  subject: Subject;
63
+ agentSubject: Subject;
64
+ externalIdentity: ExternalIdentity;
65
+ agentExternalIdentity: ExternalIdentity;
43
66
  credential: Credential;
44
67
  access: Access;
45
68
  host: Host;
@@ -115,6 +138,9 @@ export function request(
115
138
  invocationToken = "",
116
139
  idempotencyKey = "",
117
140
  host: Partial<Host> = {},
141
+ agentSubject: Partial<Subject> = {},
142
+ externalIdentity: Partial<ExternalIdentity> = {},
143
+ agentExternalIdentity: Partial<ExternalIdentity> = {},
118
144
  ): Request {
119
145
  return {
120
146
  token,
@@ -126,6 +152,22 @@ export function request(
126
152
  kind: subject.kind ?? "",
127
153
  displayName: subject.displayName ?? "",
128
154
  authSource: subject.authSource ?? "",
155
+ email: subject.email ?? "",
156
+ },
157
+ agentSubject: {
158
+ id: agentSubject.id ?? "",
159
+ kind: agentSubject.kind ?? "",
160
+ displayName: agentSubject.displayName ?? "",
161
+ authSource: agentSubject.authSource ?? "",
162
+ email: agentSubject.email ?? "",
163
+ },
164
+ externalIdentity: {
165
+ type: externalIdentity.type ?? "",
166
+ id: externalIdentity.id ?? "",
167
+ },
168
+ agentExternalIdentity: {
169
+ type: agentExternalIdentity.type ?? "",
170
+ id: agentExternalIdentity.id ?? "",
129
171
  },
130
172
  credential: {
131
173
  mode: credential.mode ?? "",
package/src/auth.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { RuntimeProvider, type RuntimeProviderOptions } from "./provider.ts";
1
+ import { ProviderBase, type ProviderBaseOptions } from "./provider.ts";
2
2
  import type { MaybePromise } from "./api.ts";
3
3
 
4
4
  /**
@@ -52,7 +52,7 @@ export interface AuthenticationSessionSettings {
52
52
  /**
53
53
  * Runtime hooks required to implement a Gestalt authentication provider.
54
54
  */
55
- export interface AuthenticationProviderOptions extends RuntimeProviderOptions {
55
+ export interface AuthenticationProviderOptions extends ProviderBaseOptions {
56
56
  beginLogin: (
57
57
  request: BeginLoginRequest,
58
58
  ) => MaybePromise<BeginLoginResponse>;
@@ -68,7 +68,7 @@ export interface AuthenticationProviderOptions extends RuntimeProviderOptions {
68
68
  /**
69
69
  * Authentication provider implementation consumed by the Gestalt runtime.
70
70
  */
71
- export class AuthenticationProvider extends RuntimeProvider {
71
+ export class AuthenticationProvider extends ProviderBase {
72
72
  readonly kind = "authentication" as const;
73
73
 
74
74
  private readonly beginLoginHandler: AuthenticationProviderOptions["beginLogin"];