@spine-event-engine/auth 2.0.0-snapshot.10

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 (57) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +71 -0
  3. package/REFERENCE.md +94 -0
  4. package/dist/gateway/dynamic-subscription-creator.d.ts +52 -0
  5. package/dist/gateway/dynamic-subscription-creator.d.ts.map +1 -0
  6. package/dist/gateway/dynamic-subscription-creator.js +71 -0
  7. package/dist/gateway/dynamic-subscription-creator.js.map +1 -0
  8. package/dist/gateway/dynamic-unary-forwarder.d.ts +130 -0
  9. package/dist/gateway/dynamic-unary-forwarder.d.ts.map +1 -0
  10. package/dist/gateway/dynamic-unary-forwarder.js +185 -0
  11. package/dist/gateway/dynamic-unary-forwarder.js.map +1 -0
  12. package/dist/gateway/index.d.ts +164 -0
  13. package/dist/gateway/index.d.ts.map +1 -0
  14. package/dist/gateway/index.js +195 -0
  15. package/dist/gateway/index.js.map +1 -0
  16. package/dist/index.d.ts +433 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +56 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/native/index.d.ts +182 -0
  21. package/dist/native/index.d.ts.map +1 -0
  22. package/dist/native/index.js +463 -0
  23. package/dist/native/index.js.map +1 -0
  24. package/dist/oidc/contracts.d.ts +334 -0
  25. package/dist/oidc/contracts.d.ts.map +1 -0
  26. package/dist/oidc/contracts.js +15 -0
  27. package/dist/oidc/contracts.js.map +1 -0
  28. package/dist/oidc/index.d.ts +41 -0
  29. package/dist/oidc/index.d.ts.map +1 -0
  30. package/dist/oidc/index.js +825 -0
  31. package/dist/oidc/index.js.map +1 -0
  32. package/dist/providers/index.d.ts +154 -0
  33. package/dist/providers/index.d.ts.map +1 -0
  34. package/dist/providers/index.js +574 -0
  35. package/dist/providers/index.js.map +1 -0
  36. package/dist/request/index.d.ts +10 -0
  37. package/dist/request/index.d.ts.map +1 -0
  38. package/dist/request/index.js +81 -0
  39. package/dist/request/index.js.map +1 -0
  40. package/dist/sessions/cookies.d.ts +104 -0
  41. package/dist/sessions/cookies.d.ts.map +1 -0
  42. package/dist/sessions/cookies.js +295 -0
  43. package/dist/sessions/cookies.js.map +1 -0
  44. package/dist/sessions/opaque.d.ts +163 -0
  45. package/dist/sessions/opaque.d.ts.map +1 -0
  46. package/dist/sessions/opaque.js +268 -0
  47. package/dist/sessions/opaque.js.map +1 -0
  48. package/dist/sessions/signed.d.ts +245 -0
  49. package/dist/sessions/signed.d.ts.map +1 -0
  50. package/dist/sessions/signed.js +534 -0
  51. package/dist/sessions/signed.js.map +1 -0
  52. package/dist/subscriptions/index.d.ts +463 -0
  53. package/dist/subscriptions/index.d.ts.map +1 -0
  54. package/dist/subscriptions/index.js +814 -0
  55. package/dist/subscriptions/index.js.map +1 -0
  56. package/dist/tsconfig.tsbuildinfo +1 -0
  57. package/package.json +36 -0
@@ -0,0 +1,433 @@
1
+ import type { Message } from "@bufbuild/protobuf";
2
+ import type { TypeRegistryLookup } from "@spine-event-engine/core";
3
+ import type { ActorContext, Command, Language, TenantId, UserId, ZoneId } from "@spine-event-engine/proto";
4
+ import { type Query, type Subscription, type Target, type Topic } from "@spine-event-engine/proto/client";
5
+ import type { Timestamp } from "@bufbuild/protobuf/wkt";
6
+ /**
7
+ * Allowlisted RPC facts exposed to authorization policy and diagnostics.
8
+ */
9
+ export interface TransportRequestContext {
10
+ /**
11
+ * Identifies the receiving RPC service.
12
+ */
13
+ readonly service: string;
14
+ /**
15
+ * Identifies the invoked RPC method.
16
+ */
17
+ readonly method: string;
18
+ /**
19
+ * Identifies the browser origin when the transport provides it.
20
+ */
21
+ readonly origin?: string;
22
+ /**
23
+ * Correlates this request with transport diagnostics.
24
+ */
25
+ readonly requestId?: string;
26
+ /**
27
+ * Correlates this request with its initiating operation.
28
+ */
29
+ readonly correlationId?: string;
30
+ /**
31
+ * Identifies the peer address when the transport provides it.
32
+ */
33
+ readonly peerAddress?: string;
34
+ /**
35
+ * Identifies the calling user agent when the transport provides it.
36
+ */
37
+ readonly userAgent?: string;
38
+ }
39
+ /**
40
+ * Raw transport facts from which the safe transport view is constructed.
41
+ */
42
+ export interface TransportFactsInput extends Omit<TransportRequestContext, "requestId" | "correlationId"> {
43
+ /**
44
+ * Supplies raw request headers from which allowlisted values are selected.
45
+ */
46
+ readonly headers?: Readonly<Record<string, string | undefined>>;
47
+ }
48
+ /**
49
+ * Command facts available to authorization policy.
50
+ */
51
+ export interface IncomingCommand {
52
+ /**
53
+ * Identifies this request as a command.
54
+ */
55
+ readonly kind: "command";
56
+ /**
57
+ * Carries the received command envelope.
58
+ */
59
+ readonly command: Command;
60
+ /**
61
+ * Carries the unpacked command message when its type is known.
62
+ */
63
+ readonly message: Message | undefined;
64
+ /**
65
+ * Identifies the packed command message type.
66
+ */
67
+ readonly messageType: string;
68
+ /**
69
+ * Carries the context requested by the caller.
70
+ */
71
+ readonly requestedContext: ActorContext;
72
+ /**
73
+ * Carries allowlisted transport facts.
74
+ */
75
+ readonly transport: TransportRequestContext;
76
+ }
77
+ /**
78
+ * Query facts available to authorization policy.
79
+ */
80
+ export interface IncomingQuery {
81
+ /**
82
+ * Identifies this request as a query.
83
+ */
84
+ readonly kind: "query";
85
+ /**
86
+ * Carries the received query.
87
+ */
88
+ readonly query: Query;
89
+ /**
90
+ * Carries the query target.
91
+ */
92
+ readonly target: Target;
93
+ /**
94
+ * Carries the context requested by the caller.
95
+ */
96
+ readonly requestedContext: ActorContext;
97
+ /**
98
+ * Carries allowlisted transport facts.
99
+ */
100
+ readonly transport: TransportRequestContext;
101
+ }
102
+ /**
103
+ * Subscription-creation facts available to authorization policy.
104
+ */
105
+ export interface IncomingSubscription {
106
+ /**
107
+ * Identifies this request as subscription creation.
108
+ */
109
+ readonly kind: "subscribe";
110
+ /**
111
+ * Carries the requested topic.
112
+ */
113
+ readonly topic: Topic;
114
+ /**
115
+ * Carries the topic target.
116
+ */
117
+ readonly target: Target;
118
+ /**
119
+ * Carries the context requested by the caller.
120
+ */
121
+ readonly requestedContext: ActorContext;
122
+ /**
123
+ * Carries allowlisted transport facts.
124
+ */
125
+ readonly transport: TransportRequestContext;
126
+ }
127
+ /**
128
+ * Subscription-activation facts available to authorization policy.
129
+ */
130
+ export interface IncomingSubscriptionActivation {
131
+ /**
132
+ * Identifies this request as subscription activation.
133
+ */
134
+ readonly kind: "activate";
135
+ /**
136
+ * Carries the public subscription handle.
137
+ */
138
+ readonly subscription: Subscription;
139
+ /**
140
+ * Carries the context requested by the caller.
141
+ */
142
+ readonly requestedContext: ActorContext;
143
+ /**
144
+ * Carries allowlisted transport facts.
145
+ */
146
+ readonly transport: TransportRequestContext;
147
+ }
148
+ /**
149
+ * Subscription-cancellation facts available to authorization policy.
150
+ */
151
+ export interface IncomingSubscriptionCancellation {
152
+ /**
153
+ * Identifies this request as subscription cancellation.
154
+ */
155
+ readonly kind: "cancel";
156
+ /**
157
+ * Carries the public subscription handle.
158
+ */
159
+ readonly subscription: Subscription;
160
+ /**
161
+ * Carries the context requested by the caller.
162
+ */
163
+ readonly requestedContext: ActorContext;
164
+ /**
165
+ * Carries allowlisted transport facts.
166
+ */
167
+ readonly transport: TransportRequestContext;
168
+ }
169
+ /**
170
+ * Exhaustive request model used at the authorization boundary.
171
+ */
172
+ export type IncomingRequest = IncomingCommand | IncomingQuery | IncomingSubscription | IncomingSubscriptionActivation | IncomingSubscriptionCancellation;
173
+ /**
174
+ * Identity established by an application-specific authenticator.
175
+ */
176
+ export interface AuthenticatedPrincipal {
177
+ /**
178
+ * Identifies the authenticated application principal.
179
+ */
180
+ readonly id: string;
181
+ /**
182
+ * Carries application-defined identity attributes.
183
+ */
184
+ readonly attributes?: Readonly<Record<string, string>>;
185
+ }
186
+ /**
187
+ * Credential material supplied directly to an authenticator or session resolver.
188
+ */
189
+ export interface RequestCredential {
190
+ /**
191
+ * Identifies how the credential was presented.
192
+ */
193
+ readonly kind: "bearer" | "cookie";
194
+ /**
195
+ * Carries the opaque credential material.
196
+ */
197
+ readonly value: string;
198
+ }
199
+ /**
200
+ * Cookie credential issued by an application-session strategy.
201
+ */
202
+ export interface CookieCredential extends RequestCredential {
203
+ /**
204
+ * Identifies this credential as a cookie.
205
+ */
206
+ readonly kind: "cookie";
207
+ }
208
+ /**
209
+ * Bearer credential issued by a signed application-session strategy.
210
+ */
211
+ export interface BearerCredential extends RequestCredential {
212
+ /**
213
+ * Identifies this credential as a bearer token.
214
+ */
215
+ readonly kind: "bearer";
216
+ }
217
+ /**
218
+ * Session validated by an application-selected session strategy.
219
+ */
220
+ export interface ResolvedSession {
221
+ /**
222
+ * Identifies the authenticated session principal.
223
+ */
224
+ readonly principal: AuthenticatedPrincipal;
225
+ /**
226
+ * Specifies when the resolved session expires.
227
+ */
228
+ readonly expiresAt: Timestamp;
229
+ }
230
+ /**
231
+ * Provider-neutral authentication boundary. Credentials do not reach policy request facts.
232
+ */
233
+ export interface Authenticator {
234
+ /**
235
+ * Validates a presented credential.
236
+ * @param credential Supplies the credential to authenticate.
237
+ * @returns Returns the authenticated principal or `undefined` when rejected.
238
+ */
239
+ authenticate(credential: RequestCredential): Promise<AuthenticatedPrincipal | undefined>;
240
+ }
241
+ /**
242
+ * Application-session validation boundary.
243
+ */
244
+ export interface SessionResolver {
245
+ /**
246
+ * Resolves a presented credential into a valid session.
247
+ * @param credential Supplies the credential to resolve.
248
+ * @returns Returns the resolved session or `undefined` when it is invalid.
249
+ */
250
+ resolve(credential: RequestCredential): Promise<ResolvedSession | undefined>;
251
+ }
252
+ /**
253
+ * Authorization policy boundary evaluated separately for every incoming request.
254
+ */
255
+ export interface AuthorizationPolicy {
256
+ /**
257
+ * Checks whether a principal may make one incoming request.
258
+ * @param principal Supplies the authenticated principal.
259
+ * @param request Supplies the request being authorized.
260
+ * @returns Returns whether the request is allowed.
261
+ */
262
+ authorize(principal: AuthenticatedPrincipal, request: IncomingRequest): Promise<boolean>;
263
+ }
264
+ /**
265
+ * Gateway-owned trusted context supplied after authentication and authorization.
266
+ */
267
+ export interface AuthorizedRequestContext {
268
+ /**
269
+ * Identifies the resolved application actor.
270
+ */
271
+ readonly actor: UserId;
272
+ /**
273
+ * Identifies the resolved tenant when the application is multi-tenant.
274
+ */
275
+ readonly tenant?: TenantId;
276
+ /**
277
+ * Records the trusted resolution time.
278
+ */
279
+ readonly timestamp: Timestamp;
280
+ /**
281
+ * Identifies the actor's time zone when resolved.
282
+ */
283
+ readonly zoneId?: ZoneId;
284
+ /**
285
+ * Identifies the actor's language when resolved.
286
+ */
287
+ readonly language?: Language;
288
+ }
289
+ /**
290
+ * Application-owned actor and tenant resolution boundary.
291
+ */
292
+ export interface ContextResolver {
293
+ /**
294
+ * Resolves a trusted context for one authorized request.
295
+ * @param principal Supplies the authenticated principal.
296
+ * @param request Supplies the authorized request.
297
+ * @param clock Supplies the trusted timestamp source.
298
+ * @returns Returns the resolved actor context.
299
+ */
300
+ resolve(principal: AuthenticatedPrincipal, request: IncomingRequest, clock: Clock): Promise<AuthorizedRequestContext>;
301
+ /**
302
+ * Resolves a context when only the principal is available.
303
+ * @param principal Supplies the authenticated principal.
304
+ * @param clock Supplies the trusted timestamp source.
305
+ * @returns Returns the resolved actor context.
306
+ */
307
+ resolveContext(principal: AuthenticatedPrincipal, clock: Clock): Promise<AuthorizedRequestContext>;
308
+ }
309
+ /**
310
+ * Clock boundary for trusted timestamps and deterministic gateway tests.
311
+ */
312
+ export interface Clock {
313
+ /**
314
+ * Returns the current trusted timestamp.
315
+ * @returns Returns the current timestamp.
316
+ */
317
+ now(): Timestamp;
318
+ }
319
+ /**
320
+ * Envelope-decoding boundary used by the later gateway pipeline.
321
+ */
322
+ export interface RequestDecoder {
323
+ /**
324
+ * Decodes one transport request.
325
+ * @param input Supplies the wire request input.
326
+ * @returns Returns decoded request facts or `undefined` for invalid input.
327
+ */
328
+ decode(input: IncomingRequestInput): IncomingRequest | undefined;
329
+ }
330
+ /**
331
+ * Wire envelope shape decoded by the gateway's later forwarding pipeline.
332
+ */
333
+ export type IncomingRequestInput = CommandRequestInput | {
334
+ /**
335
+ * Identifies this input as a query.
336
+ */
337
+ readonly kind: "query";
338
+ /**
339
+ * Carries the serialized query bytes.
340
+ */
341
+ readonly value: Uint8Array;
342
+ /**
343
+ * Carries allowlisted transport facts.
344
+ */
345
+ readonly transport: TransportRequestContext;
346
+ } | {
347
+ /**
348
+ * Identifies this input as subscription creation.
349
+ */
350
+ readonly kind: "subscribe";
351
+ /**
352
+ * Carries the serialized topic bytes.
353
+ */
354
+ readonly value: Uint8Array;
355
+ /**
356
+ * Carries allowlisted transport facts.
357
+ */
358
+ readonly transport: TransportRequestContext;
359
+ } | {
360
+ /**
361
+ * Identifies this input as subscription activation.
362
+ */
363
+ readonly kind: "activate";
364
+ /**
365
+ * Carries the serialized subscription bytes.
366
+ */
367
+ readonly value: Uint8Array;
368
+ /**
369
+ * Carries allowlisted transport facts.
370
+ */
371
+ readonly transport: TransportRequestContext;
372
+ } | {
373
+ /**
374
+ * Identifies this input as subscription cancellation.
375
+ */
376
+ readonly kind: "cancel";
377
+ /**
378
+ * Carries the serialized subscription bytes.
379
+ */
380
+ readonly value: Uint8Array;
381
+ /**
382
+ * Carries allowlisted transport facts.
383
+ */
384
+ readonly transport: TransportRequestContext;
385
+ };
386
+ /**
387
+ * Wire command envelope with an optional registry for content-aware policy.
388
+ */
389
+ export interface CommandRequestInput {
390
+ /**
391
+ * Identifies this input as a command.
392
+ */
393
+ readonly kind: "command";
394
+ /**
395
+ * Carries the serialized command bytes.
396
+ */
397
+ readonly value: Uint8Array;
398
+ /**
399
+ * Carries allowlisted transport facts.
400
+ */
401
+ readonly transport: TransportRequestContext;
402
+ /**
403
+ * Supplies message types used to unpack the command when available.
404
+ */
405
+ readonly registry?: TypeRegistryLookup;
406
+ }
407
+ interface TransportFactsApi {
408
+ from(input: TransportFactsInput): TransportRequestContext;
409
+ }
410
+ /**
411
+ * Builds the allowlisted transport facts used by authorization and diagnostics.
412
+ */
413
+ export declare const TransportFacts: Readonly<TransportFactsApi>;
414
+ export { IncomingRequests } from "./request/index.js";
415
+ export { UnaryGateway } from "./gateway/index.js";
416
+ export { OpaqueSessionCookies } from "./sessions/cookies.js";
417
+ export { OpaqueSessions } from "./sessions/opaque.js";
418
+ export { SignedSessions } from "./sessions/signed.js";
419
+ export { OidcFlow } from "./oidc/index.js";
420
+ export { createGitHubProvider, createGoogleProvider, createOidcProvider, discoverOidcProvider, } from "./providers/index.js";
421
+ export { InMemorySubscriptionBindings, SubscriptionGateway } from "./subscriptions/index.js";
422
+ export { createNativeGatewayServices, NativeSubscriptionCreator, SubscriptionUpdateRelay, } from "./native/index.js";
423
+ export type { UnaryForwarder, GatewayAdmission, UnaryGatewayCollaborators, UnaryGatewayOptions, UnaryGatewayRejection, UnaryGatewayRequest, UnaryGatewayResult, } from "./gateway/index.js";
424
+ export type { SubscriptionCreator, SubscriptionCoordinator, SubscriptionGatewayLimits, SubscriptionGatewayCollaborators, SubscriptionGatewayOptions, SubscriptionGatewayRequest, SubscriptionGatewayResult, SubscriptionBindings, SubscriptionAbortSignal, SubscriptionBindingTransition, SubscriptionTopicWire, PublicSubscriptionWire, BackendSubscriptionEnvelope, OnSubscriptionDefinition, SubscriptionUpdateSink, SubscriptionUpdateWire, } from "./subscriptions/index.js";
425
+ export type { NativeGatewayRequestContext, NativeGatewayServices, NativeGatewayServicesOptions, SubscriptionRelayLimits, } from "./native/index.js";
426
+ export type { OpaqueCredentialExtraction, OpaqueCredentialRejection, OpaqueSessionCookiesOptions, OpaqueSessionHeaders, } from "./sessions/cookies.js";
427
+ export type { OpaqueSessionClock, OpaqueSessionCreateResult, OpaqueSessionLogoutResult, OpaqueSessionRandom, OpaqueSessionRotateResult, OpaqueSessionsOptions, } from "./sessions/opaque.js";
428
+ export type { SignedSessionClock, SignedSessionIssueResult, SignedSessionLogoutResult, SignedSessionRandom, SignedSessionRotationResult, SignedSessionSigningKey, SignedSessionVerificationKey, SignedSessionsOptions, SignedTokenRevocation, } from "./sessions/signed.js";
429
+ export type { ApplicationSessionIssue, ApplicationSessionIssuer, ExternalIdentity, IdentityMapping, OidcAuthorizationCodeExchange, OidcFlowCallbackInput, OidcFlowCallbackResult, OidcFlowClock, OidcFlowExchangeInput, OidcFlowExchangeResult, OidcFlowOptions, OidcFlowRandom, OidcFlowStartInput, OidcFlowStartResult, OidcVerifiedIdentityProvider, ResolvedApplicationIdentity, } from "./oidc/contracts.js";
430
+ export type { ConfiguredOidcProvider, GitHubProviderOptions, OidcClientAuthentication, OidcProviderOptions, ProviderFetch, } from "./providers/index.js";
431
+ export { DynamicUnaryForwarder, type DynamicUnaryClient, type DynamicUnaryOptions, } from "./gateway/dynamic-unary-forwarder.js";
432
+ export { DynamicSubscriptionCreator } from "./gateway/dynamic-subscription-creator.js";
433
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EACV,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,MAAM,EACP,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,KAAK,EACX,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IAGtC;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,QAAQ,CA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AAsC,CAAC;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,56 @@
1
+ /*
2
+ * Copyright 2026, CodeMatters. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5
+ * in compliance with the License. You may obtain a copy of the License at
6
+ *
7
+ * https://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
10
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11
+ * or implied. See the License for the specific language governing permissions and limitations under
12
+ * the License.
13
+ */
14
+ import {} from "@spine-event-engine/proto/client";
15
+ /**
16
+ * Builds the allowlisted transport facts used by authorization and diagnostics.
17
+ */
18
+ export const TransportFacts = Object.freeze({
19
+ // prettier-ignore
20
+ /**
21
+ * Builds allowlisted facts while omitting credentials and unknown headers.
22
+ * @param input Supplies raw transport facts and optional headers.
23
+ * @returns Returns the safe transport context.
24
+ */
25
+ from(input) {
26
+ const headers = Object.fromEntries(Object.entries(input.headers ?? {})
27
+ .filter((entry) => entry[1] !== undefined)
28
+ .map(([name, value]) => [name.toLowerCase(), value]));
29
+ return TransportFactsValues.compact({
30
+ service: input.service,
31
+ method: input.method,
32
+ origin: input.origin,
33
+ requestId: headers["x-request-id"],
34
+ correlationId: headers["x-correlation-id"],
35
+ peerAddress: input.peerAddress,
36
+ userAgent: input.userAgent,
37
+ });
38
+ },
39
+ });
40
+ export { IncomingRequests } from "./request/index.js";
41
+ const TransportFactsValues = Object.freeze({
42
+ compact(context) {
43
+ return Object.fromEntries(Object.entries(context).filter(([, value]) => value !== undefined));
44
+ },
45
+ });
46
+ export { UnaryGateway } from "./gateway/index.js";
47
+ export { OpaqueSessionCookies } from "./sessions/cookies.js";
48
+ export { OpaqueSessions } from "./sessions/opaque.js";
49
+ export { SignedSessions } from "./sessions/signed.js";
50
+ export { OidcFlow } from "./oidc/index.js";
51
+ export { createGitHubProvider, createGoogleProvider, createOidcProvider, discoverOidcProvider, } from "./providers/index.js";
52
+ export { InMemorySubscriptionBindings, SubscriptionGateway } from "./subscriptions/index.js";
53
+ export { createNativeGatewayServices, NativeSubscriptionCreator, SubscriptionUpdateRelay, } from "./native/index.js";
54
+ export { DynamicUnaryForwarder, } from "./gateway/dynamic-unary-forwarder.js";
55
+ export { DynamicSubscriptionCreator } from "./gateway/dynamic-subscription-creator.js";
56
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAYH,OAAO,EAKN,MAAM,kCAAkC,CAAC;AA8hB1C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAgC,MAAM,CAAC,MAAM,CAAC;IACvE,kBAAkB;IAElB;;;;OAIG;IACH,IAAI,CAAC,KAA0B;QAC7B,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAChC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC;aAChC,MAAM,CAAC,CAAC,KAAK,EAA6B,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;aACpE,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,CAAC,CACvD,CAAC;QACF,OAAO,oBAAoB,CAAC,OAAO,CAAC;YAClC,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,SAAS,EAAE,OAAO,CAAC,cAAc,CAAC;YAClC,aAAa,EAAE,OAAO,CAAC,kBAAkB,CAAC;YAC1C,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,SAAS,EAAE,K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