@securitydept/client-angular 0.3.0-beta.2 → 0.3.0-beta.5

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.
@@ -1,336 +1,193 @@
1
- import * as i0 from '@angular/core';
2
- import { InjectionToken, EnvironmentProviders, WritableSignal } from '@angular/core';
3
- import { PlannerHost, AuthGuardClientOption, CandidateSelector, ScopedRequirementsClientSet, AuthRequirement, RequirementsClientSetComposition, RouteMatchNode } from '@securitydept/client/auth-coordination';
4
- export { resolveEffectiveClientSet } from '@securitydept/client/auth-coordination';
5
- import { ActivatedRouteSnapshot } from '@angular/router';
6
- import { ReadableSignalTrait } from '@securitydept/client';
1
+ import { CanActivateFn, CanActivateChildFn, ActivatedRouteSnapshot, Route } from '@angular/router';
2
+ import { AuthRequirement, RequirementBehaviourWithRouteContext, RequirementPlannerHost, RequirementPlannerHostBehaviour, RouteBehaviourContextExtra, RouteTreeSegment, RequirementsComposition, SecuritydeptProvider, SecuritydeptInjector, WithTraitInputValidator, EnvironmentValidators, RouterTrait, TraitInputValidator, BaseTransportTrait, FoundationEnvironment, InteropObservableTrait } from '@securitydept/client';
3
+ import { InjectionToken, EnvironmentProviders, Injector, Provider, Signal } from '@angular/core';
4
+ import * as arktype_internal_variants_object_ts from 'arktype/internal/variants/object.ts';
5
+ import { HttpResponse } from '@angular/common/http';
7
6
  import { Observable } from 'rxjs';
7
+ import { rxResource, ToSignalOptions } from '@angular/core/rxjs-interop';
8
8
 
9
- /**
10
- * DI token for the shared {@link PlannerHost}.
11
- *
12
- * Provide at the app level via {@link provideAuthPlannerHost}.
13
- * Guards use {@link injectPlannerHost} to look up the nearest instance.
14
- */
15
- declare const AUTH_PLANNER_HOST: InjectionToken<PlannerHost>;
16
- /**
17
- * Options for {@link provideAuthPlannerHost}.
18
- */
19
- interface ProvideAuthPlannerHostOptions {
9
+ interface CreateAngularGuardWithPlannerHostOptions<TAuthRequirement extends AuthRequirement = AuthRequirement, TBehaviour extends Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>> = Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>>> {
20
10
  /**
21
- * Custom candidate selection strategy.
22
- * @see {@link CandidateSelector}
11
+ * Explicit planner host. When omitted, the guard uses the nearest
12
+ * {@link REQUIREMENT_PLANNER_HOST} from the Securitydept injector, falling
13
+ * back to an empty host only when no provider exists.
23
14
  */
24
- selectCandidate?: CandidateSelector;
15
+ readonly plannerHost: RequirementPlannerHost<TBehaviour>;
16
+ readonly behaviour?: never;
25
17
  }
18
+ interface CreateAngularGuardWithBehaviourOptions<TAuthRequirement extends AuthRequirement = AuthRequirement, TBehaviour extends Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>> = Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>>> {
19
+ readonly plannerHost?: never;
20
+ readonly behaviour?: RequirementPlannerHostBehaviour<TAuthRequirement, RouteBehaviourContextExtra, TBehaviour>;
21
+ }
22
+ /** Options shared by {@link createAngularCanActivate} and its child variant. */
23
+ type CreateAngularGuardOptions<TAuthRequirement extends AuthRequirement = AuthRequirement, TBehaviour extends Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>> = Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>>> = CreateAngularGuardWithPlannerHostOptions<TAuthRequirement, TBehaviour> | CreateAngularGuardWithBehaviourOptions<TAuthRequirement, TBehaviour>;
26
24
  /**
27
- * Provide an {@link AUTH_PLANNER_HOST} at the current injector level.
28
- *
29
- * Use in app config, route providers, or NgModule providers to establish
30
- * a planner-host scope. Child routes inherit the nearest parent's planner.
31
- *
32
- * @example
33
- * ```ts
34
- * // app.config.ts — app-level planner (default sequential strategy)
35
- * export const appConfig: ApplicationConfig = {
36
- * providers: [provideAuthPlannerHost()],
37
- * };
38
- *
39
- * // Feature route — override with custom async chooser strategy
40
- * {
41
- * path: "admin",
42
- * providers: [provideAuthPlannerHost({
43
- * selectCandidate: async (candidates) => showAdminChooser(candidates),
44
- * })],
45
- * children: [...]
46
- * }
47
- * ```
25
+ * Create a `CanActivateFn` bridging the route chain to the requirement
26
+ * planner pipeline.
48
27
  */
49
- declare function provideAuthPlannerHost(options?: ProvideAuthPlannerHostOptions): EnvironmentProviders;
28
+ declare function createAngularCanActivate<TAuthRequirement extends AuthRequirement = AuthRequirement, TBehaviour extends Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>> = Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>>>(options?: CreateAngularGuardOptions<TAuthRequirement, TBehaviour>): CanActivateFn;
50
29
  /**
51
- * Inject the nearest {@link PlannerHost} from the DI hierarchy.
52
- *
53
- * Throws an explicit error if no planner-host is provided, preventing
54
- * silent fallback behavior.
55
- *
56
- * @example
57
- * ```ts
58
- * const plannerHost = injectPlannerHost();
59
- * const result = await plannerHost.evaluate(candidates);
60
- * ```
30
+ * Create a `CanActivateChildFn` bridging the child route chain to the
31
+ * requirement planner pipeline.
61
32
  */
62
- declare function injectPlannerHost(): PlannerHost;
33
+ declare function createAngularCanActivateChild<TAuthRequirement extends AuthRequirement = AuthRequirement, TBehaviour extends Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>> = Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>>>(options?: CreateAngularGuardOptions<TAuthRequirement, TBehaviour>): CanActivateChildFn;
34
+
63
35
  /**
64
- * DI token for the effective requirements client set at the current scope.
65
- *
66
- * The value is always the **resolved** options after composing all ancestor
67
- * scopes — it is NOT the raw `ScopedRequirementsClientSet` declaration.
68
- *
69
- * Provide via {@link provideRouteScopedRequirements}.
70
- * Guards inject this token to get the effective scope requirements and then
71
- * merge their own declared candidates on top.
36
+ * Resolved route `data` for a segment: static `routeConfig.data` merged with
37
+ * snapshot `data` (snapshot wins on key collision).
72
38
  */
73
- declare const AUTH_REQUIREMENTS_CLIENT_SET: InjectionToken<readonly AuthGuardClientOption[]>;
39
+ declare function routeDataFromSegment(segment: ActivatedRouteSnapshot): Record<string, unknown>;
74
40
  /**
75
- * Provide a {@link ScopedRequirementsClientSet} at the current route/module scope.
76
- *
77
- * Internally, the provider resolves the effective client set by composing the
78
- * declared `scopedSet` with the parent scope's already-resolved options
79
- * (injected via `skipSelf: true`). The token value stored in DI is the
80
- * resolved `readonly AuthGuardClientOption[]`, not the raw declaration.
81
- *
82
- * This mirrors the React `AuthRequirementsClientSetProvider` semantics:
83
- * each level stores its resolved effective options, so children inherit
84
- * the composed result without re-resolving the full ancestor chain.
85
- *
86
- * The `scopedSet` argument may also be a **factory function** — it will be
87
- * called inside Angular's `useFactory` context, so `inject()` is valid.
88
- * Use this when the requirement options need DI-resolved services (e.g. a
89
- * token-set registry or a redirect service).
90
- *
91
- * @example
92
- * ```ts
93
- * // routes.ts — static declaration (no DI needed)
94
- * {
95
- * path: "",
96
- * providers: [
97
- * provideRouteScopedRequirements({
98
- * composition: RequirementsClientSetComposition.Replace,
99
- * options: [sessionClientOption],
100
- * }),
101
- * ],
102
- * }
41
+ * Project the `pathFromRoot` of an `ActivatedRouteSnapshot` into the SDK's
42
+ * `RouteTreeSegment[]` chain (root -> leaf).
103
43
  *
104
- * // Feature route merges OIDC on top of the parent's session requirement
105
- * {
106
- * path: "confluence",
107
- * providers: [
108
- * provideRouteScopedRequirements({
109
- * composition: RequirementsClientSetComposition.Merge,
110
- * options: [confluenceOidcClientOption],
111
- * }),
112
- * ],
113
- * // Route-level DI scope only. Angular Router adopters should prefer
114
- * // secureRouteRoot()/secureRoute() over direct guard wiring.
115
- * }
44
+ * Each segment carries its declared requirements and composition strategy;
45
+ * inherit/merge/replace folding is applied later by the
46
+ * `RouteCompositionRequirementPlanner`.
116
47
  *
117
- * // Factory form — use when options depend on injected services
118
- * {
119
- * path: "protected",
120
- * providers: [
121
- * provideRouteScopedRequirements(() => {
122
- * const registry = inject(TokenSetAuthRegistry);
123
- * const authService = inject(AuthService);
124
- * return {
125
- * composition: RequirementsClientSetComposition.Replace,
126
- * options: [{
127
- * requirementId: "oidc",
128
- * requirementKind: "frontend_oidc",
129
- * checkAuthenticated: () => registry.require(clientKey).isAuthenticated(),
130
- * onUnauthenticated: () => { authService.redirectToLogin(clientKey).subscribe(); return false; },
131
- * }],
132
- * };
133
- * }),
134
- * ],
135
- * }
136
- * ```
48
+ * Segments without a `routeConfig` (e.g. the root) get routeId `"__root__"`;
49
+ * empty-path segments get `"__index__"`.
137
50
  */
138
- declare function provideRouteScopedRequirements(scopedSet: ScopedRequirementsClientSet | (() => ScopedRequirementsClientSet)): EnvironmentProviders;
51
+ declare function projectAngularRouteSegments<TAuthRequirement extends AuthRequirement = AuthRequirement>(leafRoute: ActivatedRouteSnapshot): RouteTreeSegment<TAuthRequirement>[];
139
52
 
140
- /**
141
- * Default key for auth requirements in Angular route `data`.
142
- *
143
- * Semantic alias for {@link DEFAULT_ROUTE_REQUIREMENTS_KEY} (defined in
144
- * `router.ts`). Both hold the same value (`"authRequirements"`).
145
- * Use either name — they are interchangeable.
146
- *
147
- * Set this key in `Route.data` to declare auth requirements for a route segment:
148
- * ```ts
149
- * { path: "dashboard", data: withRouteRequirements([{ id: "session", kind: "session" }]) }
150
- * ```
151
- *
152
- * The key is also read by {@link AuthRouteAdapter} when projecting snapshots.
153
- *
154
- * @see {@link withRouteRequirements}
155
- * @see {@link extractFullRouteRequirements}
156
- */
157
- declare const ROUTE_REQUIREMENTS_DATA_KEY = "authRequirements";
158
- /**
159
- * Default key for the route-level composition strategy in Angular route `data`.
160
- *
161
- * Used together with {@link ROUTE_REQUIREMENTS_DATA_KEY}. The default
162
- * composition is `merge` when the key is omitted.
163
- */
164
- declare const ROUTE_REQUIREMENTS_COMPOSITION_DATA_KEY = "authRequirementsComposition";
165
- /**
166
- * Route-level auth requirement declaration stored in Angular route `data`.
167
- */
168
- interface RouteRequirementsDeclaration {
169
- requirements: readonly AuthRequirement[];
170
- composition: RequirementsClientSetComposition;
171
- }
172
- /**
173
- * Options for {@link withRouteRequirements}.
174
- */
175
- interface WithRouteRequirementsOptions {
53
+ interface SecureRouteSecurityOptions<TAuthRequirement extends AuthRequirement = AuthRequirement, TBehaviour extends Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>> = Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>>> {
54
+ /** Auth requirements declared on this route segment. */
55
+ requirements?: readonly TAuthRequirement[];
56
+ /** Composition strategy against the inherited chain (default: `merge`). */
57
+ composition?: RequirementsComposition;
176
58
  /**
177
- * How this route segment composes with its parent route chain.
178
- * @default RequirementsClientSetComposition.Merge
59
+ * Explicit planner host for the guards on a root route. When omitted, the
60
+ * guard resolves the nearest host from DI (or a self-managed default).
179
61
  */
180
- composition?: RequirementsClientSetComposition;
62
+ plannerHost?: RequirementPlannerHost<TBehaviour>;
181
63
  /**
182
- * Additional route data properties to merge into the returned object.
64
+ * Behaviour to provide as a scoped {@link RequirementPlannerHost} at the
65
+ * root route. Mounted via `provideSecuritydept({ providers: [...] })`.
183
66
  */
184
- extra?: Record<string, unknown>;
67
+ behaviour?: RequirementPlannerHostBehaviour<TAuthRequirement, RouteBehaviourContextExtra, TBehaviour>;
185
68
  }
69
+ /** Additional route config merged into the produced {@link Route}. */
70
+ type SecureRouteConfig = Omit<Route, "path">;
186
71
  /**
187
- * Build an Angular route `data` object declaring auth requirements for a
188
- * single route segment.
189
- *
190
- * Use this as the `data` field in an Angular `Route` config. Nested routes
191
- * can declare their own requirements; a full-route aggregation guard will
192
- * walk the entire `pathFromRoot` chain to collect all requirements in one pass.
193
- *
194
- * @example
195
- * ```ts
196
- * // Parent route declares base requirement
197
- * {
198
- * path: "app",
199
- * data: withRouteRequirements([{ id: "session", kind: "session" }]),
200
- * children: [
201
- * // Child route adds an additional requirement
202
- * {
203
- * path: "admin",
204
- * data: withRouteRequirements([{ id: "admin-oidc", kind: "backend_oidc" }]),
205
- * canActivate: [createTokenSetRouteAggregationGuard(...)],
206
- * },
207
- * ],
208
- * }
209
- * ```
210
- *
211
- * @param requirements - One or more auth requirements for this route segment.
212
- * @param extra - Optional additional data properties to merge.
72
+ * Declare a secure route segment: writes requirement metadata into route
73
+ * `data` only. No guard is attached — a guarded ancestor (see
74
+ * {@link secureRouteRoot}) enforces the folded chain.
213
75
  */
214
- declare function withRouteRequirements(requirements: AuthRequirement[], optionsOrExtra?: WithRouteRequirementsOptions | Record<string, unknown>, maybeExtra?: Record<string, unknown>): Record<string, unknown>;
76
+ declare function secureRoute<TAuthRequirement extends AuthRequirement = AuthRequirement, TBehaviour extends Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>> = Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>>>(path: string, security: SecureRouteSecurityOptions<TAuthRequirement, TBehaviour>, routeOptions?: SecureRouteConfig): Route;
215
77
  /**
216
- * Extract and flatten auth requirements from a complete Angular route chain.
217
- *
218
- * Walks all segments from root to leaf (from `leafRoute.pathFromRoot`)
219
- * and concatenates the declared {@link AuthRequirement} arrays in order.
220
- * Requirements from ancestor routes appear before requirements from
221
- * descendant routes. Duplicate `id` values are NOT de-duplicated here —
222
- * the caller (guard / enforcement layer) is responsible for deduplication
223
- * or merge logic.
224
- *
225
- * This is the extraction counter-part to {@link withRouteRequirements}.
226
- * A full-route aggregation guard calls this once and hands the complete
227
- * flat array to the planner / enforcement layer.
78
+ * Declare a guarded root route: writes requirement metadata AND attaches
79
+ * `canActivate` + `canActivateChild` guards bound to the requirement planner.
228
80
  *
229
- * @param leafRoute - The leaf `ActivatedRouteSnapshot` from the guard call.
230
- * @param requirementsKey - Override the route data key (default: `"authRequirements"`).
81
+ * When `security.behaviour` is set, a scoped {@link RequirementPlannerHost}
82
+ * provider is mounted so descendant guards inherit it through DI.
231
83
  */
232
- declare function extractFullRouteRequirements(leafRoute: ActivatedRouteSnapshot, requirementsKey?: string, compositionKey?: string): AuthRequirement[];
84
+ declare function secureRouteRoot<TAuthRequirement extends AuthRequirement = AuthRequirement, TBehaviour extends Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>> = Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>>>(path: string, security: SecureRouteSecurityOptions<TAuthRequirement, TBehaviour>, routeOptions?: SecureRouteConfig): Route;
85
+
86
+ declare const SECURITYDEPT_INJECTOR: InjectionToken<SecuritydeptInjector>;
87
+ interface ProvideSecuritydeptOptions {
88
+ readonly providers?: readonly SecuritydeptProvider[];
89
+ readonly autoCreateDestroyRef?: boolean;
90
+ }
91
+ declare function provideSecuritydept(options?: ProvideSecuritydeptOptions): EnvironmentProviders;
92
+
233
93
  /**
234
- * Resolve the effective auth requirements by composing the parent chain with a
235
- * child route declaration.
94
+ * Minimal navigation surface required from an Angular `Router`.
236
95
  *
237
- * Composition semantics mirror `resolveEffectiveClientSet()`:
238
- * - `inherit` keeps the parent requirements unchanged
239
- * - `merge` appends child requirements and replaces same-id parent entries
240
- * - `replace` discards the parent chain and uses only the child's requirements
96
+ * The real `@angular/router` `Router` satisfies this shape, so adopters pass
97
+ * their injected `Router` directly.
241
98
  */
242
- declare function resolveEffectiveRequirements(parentRequirements: readonly AuthRequirement[], child: RouteRequirementsDeclaration): AuthRequirement[];
243
-
244
- /** Options for {@link AuthRouteAdapter} projection methods. */
245
- interface AuthRouteAdapterOptions {
246
- /**
247
- * Key used to read auth requirements from route `data`.
248
- *
249
- * @default "authRequirements"
250
- */
251
- requirementsKey?: string;
99
+ interface AngularRouterNavigationLike {
100
+ url?: string;
101
+ navigateByUrl(url: string, options?: {
102
+ replaceUrl?: boolean;
103
+ state?: unknown;
104
+ }): Promise<boolean> | boolean;
252
105
  }
253
- /** Default key for auth requirements in Angular route `data`. */
254
- declare const DEFAULT_ROUTE_REQUIREMENTS_KEY = "authRequirements";
255
- /** Result from {@link AuthRouteAdapter.check}. */
256
- interface RouteGuardResult {
257
- /** Whether all requirements are settled (route can activate). */
258
- canActivate: boolean;
259
- /** The pending requirement still awaiting resolution, if any. */
260
- pendingRequirement: AuthRequirement | null;
106
+ /** Options for {@link createRouterForAngular}. */
107
+ interface CreateRouterForAngularOptions {
108
+ /** The Angular `Router` (or a compatible navigation object). */
109
+ router: AngularRouterNavigationLike;
110
+ /** Override the current URL. Defaults to `router.url`. */
111
+ currentUrl?: string | null;
261
112
  }
113
+ interface ResolvedRouterForAngularCreateOptions {
114
+ router: AngularRouterNavigationLike;
115
+ currentUrl: string | null;
116
+ }
117
+ declare const AngularRouterNavigationLikeSchema: arktype_internal_variants_object_ts.ObjectType<{
118
+ navigateByUrl: Function;
119
+ url?: string | undefined;
120
+ }, {}>;
262
121
  /**
263
- * Angular service that bridges Angular Router's `ActivatedRouteSnapshot` to
264
- * the SDK's framework-agnostic `RouteMatchNode[]` contract.
265
- *
266
- * Inject this into `CanActivateFn` guards or class-based guards.
122
+ * Create a {@link RouterTrait} backed by an Angular `Router`.
267
123
  *
268
124
  * @example
269
125
  * ```ts
270
- * export const authGuard: CanActivateFn = (route) => {
271
- * const adapter = inject(AuthRouteAdapter);
272
- * const result = adapter.check(route, orchestrator);
273
- * if (!result.canActivate && result.pendingRequirement) {
274
- * // Trigger auth flow for the pending requirement
275
- * }
276
- * return result.canActivate;
277
- * };
126
+ * const routerTrait = createRouterForAngular({ router: inject(Router) });
278
127
  * ```
279
128
  */
280
- declare class AuthRouteAdapter {
281
- /**
282
- * Project the `pathFromRoot` of an `ActivatedRouteSnapshot` into the SDK's
283
- * `RouteMatchNode[]` chain.
284
- *
285
- * Route segments without a `routeConfig` (e.g. the root segment) are
286
- * assigned routeId `"__root__"`. Segments with a config use the `path`
287
- * as their routeId (or `"__index__"` for empty-path segments).
288
- */
289
- projectRouteMatch(leafRoute: ActivatedRouteSnapshot, options?: AuthRouteAdapterOptions): RouteMatchNode[];
290
- /**
291
- * Project an explicit array of `ActivatedRouteSnapshot` segments into the
292
- * SDK's `RouteMatchNode[]` chain.
293
- *
294
- * Use when you already have a flattened chain (e.g. from
295
- * `ActivatedRoute.pathFromRoot`).
296
- */
297
- projectRouteSegments(segments: readonly ActivatedRouteSnapshot[], options?: AuthRouteAdapterOptions): RouteMatchNode[];
298
- /**
299
- * Project the route snapshot and check whether all requirements are settled.
300
- *
301
- * @param leafRoute - The leaf `ActivatedRouteSnapshot` from the guard call.
302
- * @param orchestrator - The SDK orchestrator managing the requirement plan.
303
- * @param options - Optional projection options.
304
- */
305
- check(leafRoute: ActivatedRouteSnapshot, orchestrator: {
306
- activateMatchedRoutes(chain: readonly RouteMatchNode[]): void;
307
- snapshot(): {
308
- settled: boolean;
309
- pendingRequirement: AuthRequirement | null;
310
- };
311
- }, options?: AuthRouteAdapterOptions): RouteGuardResult;
312
- private segmentToNode;
313
- private resolveRouteId;
314
- static ɵfac: i0.ɵɵFactoryDeclaration<AuthRouteAdapter, never>;
315
- static ɵprov: i0.ɵɵInjectableDeclaration<AuthRouteAdapter>;
129
+ declare function createRouterForAngular(options: CreateRouterForAngularOptions & WithTraitInputValidator<Pick<EnvironmentValidators, "router">>): RouterTrait;
130
+
131
+ interface AngularHttpClientLike {
132
+ request(method: string, url: string, options: {
133
+ body?: unknown;
134
+ headers?: Record<string, string>;
135
+ observe: "response";
136
+ responseType: "text";
137
+ }): Observable<HttpResponse<string>>;
316
138
  }
139
+ interface BaseTransportForAngularCreateOptions {
140
+ httpClient: AngularHttpClientLike;
141
+ baseUrl?: string | URL;
142
+ }
143
+ declare const BaseTransportForAngularCreateOptionsSchema: arktype_internal_variants_object_ts.ObjectType<{
144
+ httpClient: {
145
+ request: Function;
146
+ };
147
+ baseUrl: unknown;
148
+ }, {}>;
149
+ declare function createBaseTransportForAngular(options: BaseTransportForAngularCreateOptions & WithTraitInputValidator<TraitInputValidator>): BaseTransportTrait;
317
150
 
318
- /**
319
- * Bridge an SDK `ReadableSignalTrait` to an Angular writable signal.
320
- *
321
- * Immediately syncs the current value, then subscribes to future changes.
322
- *
323
- * @returns Cleanup function that unsubscribes from the SDK signal.
324
- */
325
- declare function bridgeToAngularSignal<T>(source: ReadableSignalTrait<T>, target: WritableSignal<T>): () => void;
326
- /**
327
- * Bridge an SDK `ReadableSignalTrait` to an RxJS Observable.
328
- *
329
- * The observable emits the current value immediately on subscribe, then
330
- * emits whenever the SDK signal value changes. Completes on unsubscribe.
331
- */
332
- declare function signalToObservable<T>(source: ReadableSignalTrait<T>): Observable<T>;
151
+ declare const ENVIRONMENT: InjectionToken<FoundationEnvironment>;
152
+ declare const ENVIRONMENT_PROVIDER: InjectionToken<SecuritydeptProvider>;
153
+ type EnvironmentCreatorOptions = {
154
+ providers?: readonly SecuritydeptProvider[];
155
+ };
156
+ type EnvironmentCreator<TOptions extends EnvironmentCreatorOptions, TEnvironment extends FoundationEnvironment> = (options: TOptions) => TEnvironment;
157
+ type CreateEnvironmentForAngularOptions<TBaseOptions extends EnvironmentCreatorOptions, TEnvironment extends FoundationEnvironment> = Omit<TBaseOptions, "providers" | "routerForAngularCreateOptions" | "transportForAngularCreateOptions" | "injectorForAngularProvider" | "createBaseEnvironment"> & {
158
+ createBaseEnvironment: EnvironmentCreator<TBaseOptions, TEnvironment>;
159
+ routerForAngularCreateOptions: CreateRouterForAngularOptions;
160
+ transportForAngularCreateOptions: BaseTransportForAngularCreateOptions;
161
+ injectorForAngularProvider?: Injector;
162
+ providers?: readonly SecuritydeptProvider[];
163
+ };
164
+ type ProvideEnvironmentOptions<TBaseOptions extends EnvironmentCreatorOptions, TEnvironment extends FoundationEnvironment> = Omit<CreateEnvironmentForAngularOptions<TBaseOptions, TEnvironment>, "routerForAngularCreateOptions" | "transportForAngularCreateOptions" | "injectorForAngularProvider" | "providers"> & ProvideSecuritydeptOptions & {
165
+ routerForAngularCreateOptions?: Partial<CreateRouterForAngularOptions>;
166
+ transportForAngularCreateOptions?: Partial<BaseTransportForAngularCreateOptions>;
167
+ };
168
+ declare function createEnvironmentForAngular<TBaseOptions extends EnvironmentCreatorOptions, TEnvironment extends FoundationEnvironment>(options: CreateEnvironmentForAngularOptions<TBaseOptions, TEnvironment>): TEnvironment;
169
+ declare function provideEnvironment<TBaseOptions extends EnvironmentCreatorOptions, TEnvironment extends FoundationEnvironment>(options: ProvideEnvironmentOptions<TBaseOptions, TEnvironment>): Provider[];
170
+ declare function provideEnvironmentProvider(provider: SecuritydeptProvider): Provider;
171
+
172
+ declare function toNgSignal<T>(source: InteropObservableTrait<T>): Signal<T | undefined>;
173
+ declare function toNgSignal<T>(source: InteropObservableTrait<T>, options: NoInfer<ToSignalOptions<T | undefined>> & {
174
+ initialValue?: undefined;
175
+ requireSync?: false;
176
+ }): Signal<T | undefined>;
177
+ declare function toNgSignal<T>(source: InteropObservableTrait<T>, options: NoInfer<ToSignalOptions<T | null>> & {
178
+ initialValue?: null;
179
+ requireSync?: false;
180
+ }): Signal<T | null>;
181
+ declare function toNgSignal<T>(source: InteropObservableTrait<T>, options: NoInfer<ToSignalOptions<T>> & {
182
+ initialValue?: undefined;
183
+ requireSync: true;
184
+ }): Signal<T>;
185
+ declare function toNgSignal<T, const U extends T>(source: InteropObservableTrait<T>, options: NoInfer<ToSignalOptions<T | U>> & {
186
+ initialValue: U;
187
+ requireSync?: false;
188
+ }): Signal<T | U>;
189
+ declare const toNgResource: typeof rxResource;
333
190
 
334
- export { AUTH_PLANNER_HOST, AUTH_REQUIREMENTS_CLIENT_SET, AuthRouteAdapter, DEFAULT_ROUTE_REQUIREMENTS_KEY, ROUTE_REQUIREMENTS_COMPOSITION_DATA_KEY, ROUTE_REQUIREMENTS_DATA_KEY, bridgeToAngularSignal, extractFullRouteRequirements, injectPlannerHost, provideAuthPlannerHost, provideRouteScopedRequirements, resolveEffectiveRequirements, signalToObservable, withRouteRequirements };
335
- export type { AuthRouteAdapterOptions, ProvideAuthPlannerHostOptions, RouteGuardResult, RouteRequirementsDeclaration, WithRouteRequirementsOptions };
191
+ export { AngularRouterNavigationLikeSchema, BaseTransportForAngularCreateOptionsSchema, ENVIRONMENT, ENVIRONMENT_PROVIDER, SECURITYDEPT_INJECTOR, createAngularCanActivate, createAngularCanActivateChild, createBaseTransportForAngular, createEnvironmentForAngular, createRouterForAngular, projectAngularRouteSegments, provideEnvironment, provideEnvironmentProvider, provideSecuritydept, routeDataFromSegment, secureRoute, secureRouteRoot, toNgResource, toNgSignal };
192
+ export type { AngularHttpClientLike, AngularRouterNavigationLike, BaseTransportForAngularCreateOptions, CreateAngularGuardOptions, CreateAngularGuardWithBehaviourOptions, CreateAngularGuardWithPlannerHostOptions, CreateEnvironmentForAngularOptions, CreateRouterForAngularOptions, EnvironmentCreator, EnvironmentCreatorOptions, ProvideEnvironmentOptions, ProvideSecuritydeptOptions, ResolvedRouterForAngularCreateOptions, SecureRouteConfig, SecureRouteSecurityOptions };
336
193
  //# sourceMappingURL=securitydept-client-angular.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"securitydept-client-angular.d.ts","sources":["../../src/lib/planner-host.ts","../../src/lib/route-requirements.ts","../../src/lib/router.ts","../../src/lib/signal-bridge.ts"],"mappings":";;;;;;;;AAwCA;;;;;AAKG;AACH,cAAa,iBAAiB,EAAA,cAAA,CAAA,WAAA;AAI9B;;AAEG;UACc,6BAA6B;AAC7C;;;AAGG;sBACe,iBAAiB;AACnC;AAED;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACH,iBAAgB,sBAAsB,WAC3B,6BAA6B,GACrC,oBAAoB;AAUvB;;;;;;;;;;;AAWG;AACH,iBAAgB,iBAAiB,IAAI,WAAW;AAgBhD;;;;;;;;;AASG;AACH,cAAa,4BAA4B,EAAA,cAAA,UAAA,qBAAA;AAIzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DG;AACH,iBAAgB,8BAA8B,YAClC,2BAA2B,UAAU,2BAA2B,IACzE,oBAAoB;;ACpKvB;;;;;;;;;;;;;;;;AAgBG;AACH,cAAa,2BAA2B;AAExC;;;;;AAKG;AACH,cAAa,uCAAuC;AAGpD;;AAEG;UACc,4BAA4B;AAC5C,2BAAuB,eAAe;iBACzB,gCAAgC;AAC7C;AAED;;AAEG;UACc,4BAA4B;AAC5C;;;AAGG;kBACW,gCAAgC;AAE9C;;AAEG;YACK,MAAM;AACd;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;AACH,iBAAgB,qBAAqB,eACtB,eAAe,qBACZ,4BAA4B,GAAG,MAAM,gCACzC,MAAM,oBACjB,MAAM;AAgBT;;;;;;;;;;;;;;;;AAgBG;AACH,iBAAgB,4BAA4B,YAChC,sBAAsB,sDAG/B,eAAe;AAmBlB;;;;;;;;AAQG;AACH,iBAAgB,4BAA4B,8BACd,eAAe,WACrC,4BAA4B,GACjC,eAAe;;ACvKlB;UACiB,uBAAuB;AACvC;;;;AAIG;;AAEH;AAED;AACA,cAAa,8BAA8B;AAM3C;UACiB,gBAAgB;;;;AAIhC,wBAAoB,eAAe;AACnC;AAMD;;;;;;;;;;;;;;;;;AAiBG;AACH,cACa,gBAAgB;AAC5B;;;;;;;AAOG;iCAES,sBAAsB,YACvB,uBAAuB,GAC/B,cAAc;AAMjB;;;;;;AAMG;AACH,4CACoB,sBAAsB,cAC/B,uBAAuB,GAC/B,cAAc;AAKjB;;;;;;AAMG;AACH,qBACY,sBAAsB;8CAEM,cAAc;AACpD;;AAEC,gCAAoB,eAAe;;AAEpC,iBACS,uBAAuB,GAC/B,gBAAgB;AAUnB;AAaA;yCAzEY,gBAAgB;6CAAhB,gBAAgB;AA+E5B;;ACzID;;;;;;AAMG;AACH,iBAAgB,qBAAqB,YAC5B,mBAAmB,aACnB,cAAc;AAQvB;;;;;AAKG;AACH,iBAAgB,kBAAkB,YACzB,mBAAmB,MACzB,UAAU;;;;","names":[]}
1
+ {"version":3,"file":"securitydept-client-angular.d.ts","sources":["../../src/lib/auth-coordination/route-guard.ts","../../src/lib/auth-coordination/route-metadata.ts","../../src/lib/auth-coordination/secure-routes.ts","../../src/lib/injection.ts","../../src/lib/router.ts","../../src/lib/transport.ts","../../src/lib/environment.ts","../../src/lib/interop.ts"],"mappings":";;;;;;;;AAmDM,UAAW,wCAAwC,0BAC/B,eAAe,GAAG,eAAe,qBACvC,OAAO,CACzB,oCAAoC,sBACjC,OAAO,CAAC,oCAAoC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