@securitydept/client-angular 0.3.0-beta.3 → 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,357 +1,193 @@
1
- import * as i0 from '@angular/core';
2
- import { InjectionToken, Provider, EnvironmentProviders, WritableSignal } from '@angular/core';
3
- import { PageClientEnvironment } from '@securitydept/client/web';
4
- import { PlannerHost, AuthGuardClientOption, CandidateSelector, ScopedRequirementsClientSet, AuthRequirement, RequirementsClientSetComposition, RouteMatchNode } from '@securitydept/client/auth-coordination';
5
- export { resolveEffectiveClientSet } from '@securitydept/client/auth-coordination';
6
- import { ActivatedRouteSnapshot } from '@angular/router';
7
- 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';
8
6
  import { Observable } from 'rxjs';
7
+ import { rxResource, ToSignalOptions } from '@angular/core/rxjs-interop';
9
8
 
10
- type PageClientEnvironmentValue = PageClientEnvironment;
11
- interface PageClientEnvironmentService {
12
- resolvePageEnvironment(): Promise<PageClientEnvironmentValue>;
13
- }
14
- type PageClientEnvironmentResolver = () => PageClientEnvironmentValue | Promise<PageClientEnvironmentValue>;
15
- type PageClientEnvironmentSource = PageClientEnvironmentValue | PageClientEnvironmentService | PageClientEnvironmentResolver;
16
- declare const PAGE_CLIENT_ENVIRONMENT: InjectionToken<PageClientEnvironmentSource | undefined>;
17
- interface ProvidePageClientEnvironmentOptions {
9
+ interface CreateAngularGuardWithPlannerHostOptions<TAuthRequirement extends AuthRequirement = AuthRequirement, TBehaviour extends Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>> = Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>>> {
18
10
  /**
19
- * Stable host-owned page environment source used by Angular page-only helpers.
20
- *
21
- * Accepts an already-materialized page environment object, a provider-scoped
22
- * `ClientEnvironmentService`, or an inject-safe stable resolver returning the
23
- * page capability synchronously or asynchronously.
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.
24
14
  */
25
- environment: PageClientEnvironmentSource;
15
+ readonly plannerHost: RequirementPlannerHost<TBehaviour>;
16
+ readonly behaviour?: never;
26
17
  }
27
- declare function providePageClientEnvironment(options: ProvidePageClientEnvironmentOptions): Provider;
28
- declare function resolvePageClientEnvironmentSource(source: PageClientEnvironmentSource | undefined, onMissing: () => never): Promise<PageClientEnvironmentValue>;
29
-
30
- /**
31
- * DI token for the shared {@link PlannerHost}.
32
- *
33
- * Provide at the app level via {@link provideAuthPlannerHost}.
34
- * Guards use {@link injectPlannerHost} to look up the nearest instance.
35
- */
36
- declare const AUTH_PLANNER_HOST: InjectionToken<PlannerHost>;
37
- /**
38
- * Options for {@link provideAuthPlannerHost}.
39
- */
40
- interface ProvideAuthPlannerHostOptions {
41
- /**
42
- * Custom candidate selection strategy.
43
- * @see {@link CandidateSelector}
44
- */
45
- selectCandidate?: CandidateSelector;
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>;
46
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>;
47
24
  /**
48
- * Provide an {@link AUTH_PLANNER_HOST} at the current injector level.
49
- *
50
- * Use in app config, route providers, or NgModule providers to establish
51
- * a planner-host scope. Child routes inherit the nearest parent's planner.
52
- *
53
- * @example
54
- * ```ts
55
- * // app.config.ts — app-level planner (default sequential strategy)
56
- * export const appConfig: ApplicationConfig = {
57
- * providers: [provideAuthPlannerHost()],
58
- * };
59
- *
60
- * // Feature route — override with custom async chooser strategy
61
- * {
62
- * path: "admin",
63
- * providers: [provideAuthPlannerHost({
64
- * selectCandidate: async (candidates) => showAdminChooser(candidates),
65
- * })],
66
- * children: [...]
67
- * }
68
- * ```
25
+ * Create a `CanActivateFn` bridging the route chain to the requirement
26
+ * planner pipeline.
69
27
  */
70
- 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;
71
29
  /**
72
- * Inject the nearest {@link PlannerHost} from the DI hierarchy.
73
- *
74
- * Throws an explicit error if no planner-host is provided, preventing
75
- * silent fallback behavior.
76
- *
77
- * @example
78
- * ```ts
79
- * const plannerHost = injectPlannerHost();
80
- * const result = await plannerHost.evaluate(candidates);
81
- * ```
30
+ * Create a `CanActivateChildFn` bridging the child route chain to the
31
+ * requirement planner pipeline.
82
32
  */
83
- 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
+
84
35
  /**
85
- * DI token for the effective requirements client set at the current scope.
86
- *
87
- * The value is always the **resolved** options after composing all ancestor
88
- * scopes — it is NOT the raw `ScopedRequirementsClientSet` declaration.
89
- *
90
- * Provide via {@link provideRouteScopedRequirements}.
91
- * Guards inject this token to get the effective scope requirements and then
92
- * 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).
93
38
  */
94
- declare const AUTH_REQUIREMENTS_CLIENT_SET: InjectionToken<readonly AuthGuardClientOption[]>;
39
+ declare function routeDataFromSegment(segment: ActivatedRouteSnapshot): Record<string, unknown>;
95
40
  /**
96
- * Provide a {@link ScopedRequirementsClientSet} at the current route/module scope.
97
- *
98
- * Internally, the provider resolves the effective client set by composing the
99
- * declared `scopedSet` with the parent scope's already-resolved options
100
- * (injected via `skipSelf: true`). The token value stored in DI is the
101
- * resolved `readonly AuthGuardClientOption[]`, not the raw declaration.
102
- *
103
- * This mirrors the React `AuthRequirementsClientSetProvider` semantics:
104
- * each level stores its resolved effective options, so children inherit
105
- * the composed result without re-resolving the full ancestor chain.
41
+ * Project the `pathFromRoot` of an `ActivatedRouteSnapshot` into the SDK's
42
+ * `RouteTreeSegment[]` chain (root -> leaf).
106
43
  *
107
- * The `scopedSet` argument may also be a **factory function** — it will be
108
- * called inside Angular's `useFactory` context, so `inject()` is valid.
109
- * Use this when the requirement options need DI-resolved services (e.g. a
110
- * token-set registry or a redirect service).
44
+ * Each segment carries its declared requirements and composition strategy;
45
+ * inherit/merge/replace folding is applied later by the
46
+ * `RouteCompositionRequirementPlanner`.
111
47
  *
112
- * @example
113
- * ```ts
114
- * // routes.ts — static declaration (no DI needed)
115
- * {
116
- * path: "",
117
- * providers: [
118
- * provideRouteScopedRequirements({
119
- * composition: RequirementsClientSetComposition.Replace,
120
- * options: [sessionClientOption],
121
- * }),
122
- * ],
123
- * }
124
- *
125
- * // Feature route merges OIDC on top of the parent's session requirement
126
- * {
127
- * path: "confluence",
128
- * providers: [
129
- * provideRouteScopedRequirements({
130
- * composition: RequirementsClientSetComposition.Merge,
131
- * options: [confluenceOidcClientOption],
132
- * }),
133
- * ],
134
- * // Route-level DI scope only. Angular Router adopters should prefer
135
- * // secureRouteRoot()/secureRoute() over direct guard wiring.
136
- * }
137
- *
138
- * // Factory form — use when options depend on injected services
139
- * {
140
- * path: "protected",
141
- * providers: [
142
- * provideRouteScopedRequirements(() => {
143
- * const registry = inject(TokenSetAuthRegistry);
144
- * const authService = inject(AuthService);
145
- * return {
146
- * composition: RequirementsClientSetComposition.Replace,
147
- * options: [{
148
- * requirementId: "oidc",
149
- * requirementKind: "frontend_oidc",
150
- * checkAuthenticated: () => registry.require(clientKey).isAuthenticated(),
151
- * onUnauthenticated: () => { authService.redirectToLogin(clientKey).subscribe(); return false; },
152
- * }],
153
- * };
154
- * }),
155
- * ],
156
- * }
157
- * ```
48
+ * Segments without a `routeConfig` (e.g. the root) get routeId `"__root__"`;
49
+ * empty-path segments get `"__index__"`.
158
50
  */
159
- declare function provideRouteScopedRequirements(scopedSet: ScopedRequirementsClientSet | (() => ScopedRequirementsClientSet)): EnvironmentProviders;
51
+ declare function projectAngularRouteSegments<TAuthRequirement extends AuthRequirement = AuthRequirement>(leafRoute: ActivatedRouteSnapshot): RouteTreeSegment<TAuthRequirement>[];
160
52
 
161
- /**
162
- * Default key for auth requirements in Angular route `data`.
163
- *
164
- * Semantic alias for {@link DEFAULT_ROUTE_REQUIREMENTS_KEY} (defined in
165
- * `router.ts`). Both hold the same value (`"authRequirements"`).
166
- * Use either name — they are interchangeable.
167
- *
168
- * Set this key in `Route.data` to declare auth requirements for a route segment:
169
- * ```ts
170
- * { path: "dashboard", data: withRouteRequirements([{ id: "session", kind: "session" }]) }
171
- * ```
172
- *
173
- * The key is also read by {@link AuthRouteAdapter} when projecting snapshots.
174
- *
175
- * @see {@link withRouteRequirements}
176
- * @see {@link extractFullRouteRequirements}
177
- */
178
- declare const ROUTE_REQUIREMENTS_DATA_KEY = "authRequirements";
179
- /**
180
- * Default key for the route-level composition strategy in Angular route `data`.
181
- *
182
- * Used together with {@link ROUTE_REQUIREMENTS_DATA_KEY}. The default
183
- * composition is `merge` when the key is omitted.
184
- */
185
- declare const ROUTE_REQUIREMENTS_COMPOSITION_DATA_KEY = "authRequirementsComposition";
186
- /**
187
- * Route-level auth requirement declaration stored in Angular route `data`.
188
- */
189
- interface RouteRequirementsDeclaration {
190
- requirements: readonly AuthRequirement[];
191
- composition: RequirementsClientSetComposition;
192
- }
193
- /**
194
- * Options for {@link withRouteRequirements}.
195
- */
196
- 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;
197
58
  /**
198
- * How this route segment composes with its parent route chain.
199
- * @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).
200
61
  */
201
- composition?: RequirementsClientSetComposition;
62
+ plannerHost?: RequirementPlannerHost<TBehaviour>;
202
63
  /**
203
- * 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: [...] })`.
204
66
  */
205
- extra?: Record<string, unknown>;
67
+ behaviour?: RequirementPlannerHostBehaviour<TAuthRequirement, RouteBehaviourContextExtra, TBehaviour>;
206
68
  }
69
+ /** Additional route config merged into the produced {@link Route}. */
70
+ type SecureRouteConfig = Omit<Route, "path">;
207
71
  /**
208
- * Build an Angular route `data` object declaring auth requirements for a
209
- * single route segment.
210
- *
211
- * Use this as the `data` field in an Angular `Route` config. Nested routes
212
- * can declare their own requirements; a full-route aggregation guard will
213
- * walk the entire `pathFromRoot` chain to collect all requirements in one pass.
214
- *
215
- * @example
216
- * ```ts
217
- * // Parent route declares base requirement
218
- * {
219
- * path: "app",
220
- * data: withRouteRequirements([{ id: "session", kind: "session" }]),
221
- * children: [
222
- * // Child route adds an additional requirement
223
- * {
224
- * path: "admin",
225
- * data: withRouteRequirements([{ id: "admin-oidc", kind: "backend_oidc" }]),
226
- * canActivate: [createTokenSetRouteAggregationGuard(...)],
227
- * },
228
- * ],
229
- * }
230
- * ```
231
- *
232
- * @param requirements - One or more auth requirements for this route segment.
233
- * @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.
234
75
  */
235
- 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;
236
77
  /**
237
- * Extract and flatten auth requirements from a complete Angular route chain.
238
- *
239
- * Walks all segments from root to leaf (from `leafRoute.pathFromRoot`)
240
- * and concatenates the declared {@link AuthRequirement} arrays in order.
241
- * Requirements from ancestor routes appear before requirements from
242
- * descendant routes. Duplicate `id` values are NOT de-duplicated here —
243
- * the caller (guard / enforcement layer) is responsible for deduplication
244
- * or merge logic.
245
- *
246
- * This is the extraction counter-part to {@link withRouteRequirements}.
247
- * A full-route aggregation guard calls this once and hands the complete
248
- * 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.
249
80
  *
250
- * @param leafRoute - The leaf `ActivatedRouteSnapshot` from the guard call.
251
- * @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.
252
83
  */
253
- 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
+
254
93
  /**
255
- * Resolve the effective auth requirements by composing the parent chain with a
256
- * child route declaration.
94
+ * Minimal navigation surface required from an Angular `Router`.
257
95
  *
258
- * Composition semantics mirror `resolveEffectiveClientSet()`:
259
- * - `inherit` keeps the parent requirements unchanged
260
- * - `merge` appends child requirements and replaces same-id parent entries
261
- * - `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.
262
98
  */
263
- declare function resolveEffectiveRequirements(parentRequirements: readonly AuthRequirement[], child: RouteRequirementsDeclaration): AuthRequirement[];
264
-
265
- /** Options for {@link AuthRouteAdapter} projection methods. */
266
- interface AuthRouteAdapterOptions {
267
- /**
268
- * Key used to read auth requirements from route `data`.
269
- *
270
- * @default "authRequirements"
271
- */
272
- requirementsKey?: string;
99
+ interface AngularRouterNavigationLike {
100
+ url?: string;
101
+ navigateByUrl(url: string, options?: {
102
+ replaceUrl?: boolean;
103
+ state?: unknown;
104
+ }): Promise<boolean> | boolean;
105
+ }
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;
273
112
  }
274
- /** Default key for auth requirements in Angular route `data`. */
275
- declare const DEFAULT_ROUTE_REQUIREMENTS_KEY = "authRequirements";
276
- /** Result from {@link AuthRouteAdapter.check}. */
277
- interface RouteGuardResult {
278
- /** Whether all requirements are settled (route can activate). */
279
- canActivate: boolean;
280
- /** The pending requirement still awaiting resolution, if any. */
281
- pendingRequirement: AuthRequirement | null;
113
+ interface ResolvedRouterForAngularCreateOptions {
114
+ router: AngularRouterNavigationLike;
115
+ currentUrl: string | null;
282
116
  }
117
+ declare const AngularRouterNavigationLikeSchema: arktype_internal_variants_object_ts.ObjectType<{
118
+ navigateByUrl: Function;
119
+ url?: string | undefined;
120
+ }, {}>;
283
121
  /**
284
- * Angular service that bridges Angular Router's `ActivatedRouteSnapshot` to
285
- * the SDK's framework-agnostic `RouteMatchNode[]` contract.
286
- *
287
- * Inject this into `CanActivateFn` guards or class-based guards.
122
+ * Create a {@link RouterTrait} backed by an Angular `Router`.
288
123
  *
289
124
  * @example
290
125
  * ```ts
291
- * export const authGuard: CanActivateFn = (route) => {
292
- * const adapter = inject(AuthRouteAdapter);
293
- * const result = adapter.check(route, orchestrator);
294
- * if (!result.canActivate && result.pendingRequirement) {
295
- * // Trigger auth flow for the pending requirement
296
- * }
297
- * return result.canActivate;
298
- * };
126
+ * const routerTrait = createRouterForAngular({ router: inject(Router) });
299
127
  * ```
300
128
  */
301
- declare class AuthRouteAdapter {
302
- /**
303
- * Project the `pathFromRoot` of an `ActivatedRouteSnapshot` into the SDK's
304
- * `RouteMatchNode[]` chain.
305
- *
306
- * Route segments without a `routeConfig` (e.g. the root segment) are
307
- * assigned routeId `"__root__"`. Segments with a config use the `path`
308
- * as their routeId (or `"__index__"` for empty-path segments).
309
- */
310
- projectRouteMatch(leafRoute: ActivatedRouteSnapshot, options?: AuthRouteAdapterOptions): RouteMatchNode[];
311
- /**
312
- * Project an explicit array of `ActivatedRouteSnapshot` segments into the
313
- * SDK's `RouteMatchNode[]` chain.
314
- *
315
- * Use when you already have a flattened chain (e.g. from
316
- * `ActivatedRoute.pathFromRoot`).
317
- */
318
- projectRouteSegments(segments: readonly ActivatedRouteSnapshot[], options?: AuthRouteAdapterOptions): RouteMatchNode[];
319
- /**
320
- * Project the route snapshot and check whether all requirements are settled.
321
- *
322
- * @param leafRoute - The leaf `ActivatedRouteSnapshot` from the guard call.
323
- * @param orchestrator - The SDK orchestrator managing the requirement plan.
324
- * @param options - Optional projection options.
325
- */
326
- check(leafRoute: ActivatedRouteSnapshot, orchestrator: {
327
- activateMatchedRoutes(chain: readonly RouteMatchNode[]): void;
328
- snapshot(): {
329
- settled: boolean;
330
- pendingRequirement: AuthRequirement | null;
331
- };
332
- }, options?: AuthRouteAdapterOptions): RouteGuardResult;
333
- private segmentToNode;
334
- private resolveRouteId;
335
- static ɵfac: i0.ɵɵFactoryDeclaration<AuthRouteAdapter, never>;
336
- 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>>;
337
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;
338
150
 
339
- /**
340
- * Bridge an SDK `ReadableSignalTrait` to an Angular writable signal.
341
- *
342
- * Immediately syncs the current value, then subscribes to future changes.
343
- *
344
- * @returns Cleanup function that unsubscribes from the SDK signal.
345
- */
346
- declare function bridgeToAngularSignal<T>(source: ReadableSignalTrait<T>, target: WritableSignal<T>): () => void;
347
- /**
348
- * Bridge an SDK `ReadableSignalTrait` to an RxJS Observable.
349
- *
350
- * The observable emits the current value immediately on subscribe, then
351
- * emits whenever the SDK signal value changes. Completes on unsubscribe.
352
- */
353
- 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;
354
190
 
355
- export { AUTH_PLANNER_HOST, AUTH_REQUIREMENTS_CLIENT_SET, AuthRouteAdapter, DEFAULT_ROUTE_REQUIREMENTS_KEY, PAGE_CLIENT_ENVIRONMENT, ROUTE_REQUIREMENTS_COMPOSITION_DATA_KEY, ROUTE_REQUIREMENTS_DATA_KEY, bridgeToAngularSignal, extractFullRouteRequirements, injectPlannerHost, provideAuthPlannerHost, providePageClientEnvironment, provideRouteScopedRequirements, resolveEffectiveRequirements, resolvePageClientEnvironmentSource, signalToObservable, withRouteRequirements };
356
- export type { AuthRouteAdapterOptions, PageClientEnvironmentResolver, PageClientEnvironmentService, PageClientEnvironmentSource, PageClientEnvironmentValue, ProvideAuthPlannerHostOptions, ProvidePageClientEnvironmentOptions, 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 };
357
193
  //# sourceMappingURL=securitydept-client-angular.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"securitydept-client-angular.d.ts","sources":["../../src/lib/page-environment.ts","../../src/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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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