@securitydept/client-angular 0.2.0 → 0.3.0-beta.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.
|
@@ -1,336 +1,197 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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 { RouterForNativeWebCreateOptions } from '@securitydept/client/web';
|
|
6
|
+
import { HttpResponse } from '@angular/common/http';
|
|
7
7
|
import { Observable } from 'rxjs';
|
|
8
|
+
import { rxResource, ToSignalOptions } from '@angular/core/rxjs-interop';
|
|
8
9
|
|
|
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 {
|
|
10
|
+
interface CreateAngularGuardWithPlannerHostOptions<TAuthRequirement extends AuthRequirement = AuthRequirement, TBehaviour extends Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>> = Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>>> {
|
|
20
11
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
12
|
+
* Explicit planner host. When omitted, the guard uses the nearest
|
|
13
|
+
* {@link REQUIREMENT_PLANNER_HOST} from the Securitydept injector, falling
|
|
14
|
+
* back to an empty host only when no provider exists.
|
|
23
15
|
*/
|
|
24
|
-
|
|
16
|
+
readonly plannerHost: RequirementPlannerHost<TBehaviour>;
|
|
17
|
+
readonly behaviour?: never;
|
|
25
18
|
}
|
|
19
|
+
interface CreateAngularGuardWithBehaviourOptions<TAuthRequirement extends AuthRequirement = AuthRequirement, TBehaviour extends Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>> = Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>>> {
|
|
20
|
+
readonly plannerHost?: never;
|
|
21
|
+
readonly behaviour?: RequirementPlannerHostBehaviour<TAuthRequirement, RouteBehaviourContextExtra, TBehaviour>;
|
|
22
|
+
}
|
|
23
|
+
/** Options shared by {@link createAngularCanActivate} and its child variant. */
|
|
24
|
+
type CreateAngularGuardOptions<TAuthRequirement extends AuthRequirement = AuthRequirement, TBehaviour extends Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>> = Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>>> = CreateAngularGuardWithPlannerHostOptions<TAuthRequirement, TBehaviour> | CreateAngularGuardWithBehaviourOptions<TAuthRequirement, TBehaviour>;
|
|
26
25
|
/**
|
|
27
|
-
*
|
|
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
|
-
* ```
|
|
26
|
+
* Create a `CanActivateFn` bridging the route chain to the requirement
|
|
27
|
+
* planner pipeline.
|
|
48
28
|
*/
|
|
49
|
-
declare function
|
|
29
|
+
declare function createAngularCanActivate<TAuthRequirement extends AuthRequirement = AuthRequirement, TBehaviour extends Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>> = Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>>>(options?: CreateAngularGuardOptions<TAuthRequirement, TBehaviour>): CanActivateFn;
|
|
50
30
|
/**
|
|
51
|
-
*
|
|
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
|
-
* ```
|
|
31
|
+
* Create a `CanActivateChildFn` bridging the child route chain to the
|
|
32
|
+
* requirement planner pipeline.
|
|
61
33
|
*/
|
|
62
|
-
declare function
|
|
34
|
+
declare function createAngularCanActivateChild<TAuthRequirement extends AuthRequirement = AuthRequirement, TBehaviour extends Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>> = Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>>>(options?: CreateAngularGuardOptions<TAuthRequirement, TBehaviour>): CanActivateChildFn;
|
|
35
|
+
|
|
63
36
|
/**
|
|
64
|
-
*
|
|
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.
|
|
37
|
+
* Resolved route `data` for a segment: static `routeConfig.data` merged with
|
|
38
|
+
* snapshot `data` (snapshot wins on key collision).
|
|
72
39
|
*/
|
|
73
|
-
declare
|
|
40
|
+
declare function routeDataFromSegment(segment: ActivatedRouteSnapshot): Record<string, unknown>;
|
|
74
41
|
/**
|
|
75
|
-
*
|
|
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
|
-
* }
|
|
42
|
+
* Project the `pathFromRoot` of an `ActivatedRouteSnapshot` into the SDK's
|
|
43
|
+
* `RouteTreeSegment[]` chain (root -> leaf).
|
|
103
44
|
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
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
|
-
* }
|
|
45
|
+
* Each segment carries its declared requirements and composition strategy;
|
|
46
|
+
* inherit/merge/replace folding is applied later by the
|
|
47
|
+
* `RouteCompositionRequirementPlanner`.
|
|
116
48
|
*
|
|
117
|
-
*
|
|
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
|
-
* ```
|
|
49
|
+
* Segments without a `routeConfig` (e.g. the root) get routeId `"__root__"`;
|
|
50
|
+
* empty-path segments get `"__index__"`.
|
|
137
51
|
*/
|
|
138
|
-
declare function
|
|
52
|
+
declare function projectAngularRouteSegments<TAuthRequirement extends AuthRequirement = AuthRequirement>(leafRoute: ActivatedRouteSnapshot): RouteTreeSegment<TAuthRequirement>[];
|
|
139
53
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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 {
|
|
54
|
+
interface SecureRouteSecurityOptions<TAuthRequirement extends AuthRequirement = AuthRequirement, TBehaviour extends Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>> = Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>>> {
|
|
55
|
+
/** Auth requirements declared on this route segment. */
|
|
56
|
+
requirements?: readonly TAuthRequirement[];
|
|
57
|
+
/** Composition strategy against the inherited chain (default: `merge`). */
|
|
58
|
+
composition?: RequirementsComposition;
|
|
176
59
|
/**
|
|
177
|
-
*
|
|
178
|
-
*
|
|
60
|
+
* Explicit planner host for the guards on a root route. When omitted, the
|
|
61
|
+
* guard resolves the nearest host from DI (or a self-managed default).
|
|
179
62
|
*/
|
|
180
|
-
|
|
63
|
+
plannerHost?: RequirementPlannerHost<TBehaviour>;
|
|
181
64
|
/**
|
|
182
|
-
*
|
|
65
|
+
* Behaviour to provide as a scoped {@link RequirementPlannerHost} at the
|
|
66
|
+
* root route. Mounted via `provideSecuritydept({ providers: [...] })`.
|
|
183
67
|
*/
|
|
184
|
-
|
|
68
|
+
behaviour?: RequirementPlannerHostBehaviour<TAuthRequirement, RouteBehaviourContextExtra, TBehaviour>;
|
|
185
69
|
}
|
|
70
|
+
/** Additional route config merged into the produced {@link Route}. */
|
|
71
|
+
type SecureRouteConfig = Omit<Route, "path">;
|
|
186
72
|
/**
|
|
187
|
-
*
|
|
188
|
-
*
|
|
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.
|
|
73
|
+
* Declare a secure route segment: writes requirement metadata into route
|
|
74
|
+
* `data` only. No guard is attached — a guarded ancestor (see
|
|
75
|
+
* {@link secureRouteRoot}) enforces the folded chain.
|
|
213
76
|
*/
|
|
214
|
-
declare function
|
|
77
|
+
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
78
|
/**
|
|
216
|
-
*
|
|
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.
|
|
79
|
+
* Declare a guarded root route: writes requirement metadata AND attaches
|
|
80
|
+
* `canActivate` + `canActivateChild` guards bound to the requirement planner.
|
|
228
81
|
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
82
|
+
* When `security.behaviour` is set, a scoped {@link RequirementPlannerHost}
|
|
83
|
+
* provider is mounted so descendant guards inherit it through DI.
|
|
231
84
|
*/
|
|
232
|
-
declare function
|
|
85
|
+
declare function secureRouteRoot<TAuthRequirement extends AuthRequirement = AuthRequirement, TBehaviour extends Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>> = Partial<RequirementBehaviourWithRouteContext<TAuthRequirement>>>(path: string, security: SecureRouteSecurityOptions<TAuthRequirement, TBehaviour>, routeOptions?: SecureRouteConfig): Route;
|
|
86
|
+
|
|
87
|
+
declare const SECURITYDEPT_INJECTOR: InjectionToken<SecuritydeptInjector>;
|
|
88
|
+
interface ProvideSecuritydeptOptions {
|
|
89
|
+
readonly providers?: readonly SecuritydeptProvider[];
|
|
90
|
+
readonly autoCreateDestroyRef?: boolean;
|
|
91
|
+
}
|
|
92
|
+
declare function provideSecuritydept(options?: ProvideSecuritydeptOptions): EnvironmentProviders;
|
|
93
|
+
|
|
233
94
|
/**
|
|
234
|
-
*
|
|
235
|
-
* child route declaration.
|
|
95
|
+
* Minimal navigation surface required from an Angular `Router`.
|
|
236
96
|
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
* - `merge` appends child requirements and replaces same-id parent entries
|
|
240
|
-
* - `replace` discards the parent chain and uses only the child's requirements
|
|
97
|
+
* The real `@angular/router` `Router` satisfies this shape, so adopters pass
|
|
98
|
+
* their injected `Router` directly.
|
|
241
99
|
*/
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
*
|
|
249
|
-
* @default "authRequirements"
|
|
250
|
-
*/
|
|
251
|
-
requirementsKey?: string;
|
|
100
|
+
interface AngularRouterNavigationLike {
|
|
101
|
+
url?: string;
|
|
102
|
+
navigateByUrl(url: string, options?: {
|
|
103
|
+
replaceUrl?: boolean;
|
|
104
|
+
state?: unknown;
|
|
105
|
+
}): Promise<boolean> | boolean;
|
|
252
106
|
}
|
|
253
|
-
/**
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
|
|
259
|
-
/** The pending requirement still awaiting resolution, if any. */
|
|
260
|
-
pendingRequirement: AuthRequirement | null;
|
|
107
|
+
/** Options for {@link createRouterForAngular}. */
|
|
108
|
+
interface CreateRouterForAngularOptions extends RouterForNativeWebCreateOptions {
|
|
109
|
+
/** The Angular `Router` (or a compatible navigation object). */
|
|
110
|
+
router: AngularRouterNavigationLike;
|
|
111
|
+
/** Override the current URL. Defaults to `router.url`. */
|
|
112
|
+
currentUrl?: string | null;
|
|
261
113
|
}
|
|
114
|
+
interface ResolvedRouterForAngularCreateOptions {
|
|
115
|
+
router: AngularRouterNavigationLike;
|
|
116
|
+
currentUrl: string | null;
|
|
117
|
+
}
|
|
118
|
+
declare const AngularRouterNavigationLikeSchema: arktype_internal_variants_object_ts.ObjectType<{
|
|
119
|
+
navigateByUrl: Function;
|
|
120
|
+
url?: string | undefined;
|
|
121
|
+
}, {}>;
|
|
262
122
|
/**
|
|
263
|
-
*
|
|
264
|
-
* the SDK's framework-agnostic `RouteMatchNode[]` contract.
|
|
265
|
-
*
|
|
266
|
-
* Inject this into `CanActivateFn` guards or class-based guards.
|
|
123
|
+
* Create a {@link RouterTrait} backed by an Angular `Router`.
|
|
267
124
|
*
|
|
268
125
|
* @example
|
|
269
126
|
* ```ts
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
* // Trigger auth flow for the pending requirement
|
|
275
|
-
* }
|
|
276
|
-
* return result.canActivate;
|
|
277
|
-
* };
|
|
127
|
+
* const routerTrait = createRouterForAngular({
|
|
128
|
+
* router: inject(Router),
|
|
129
|
+
* location: window.location,
|
|
130
|
+
* });
|
|
278
131
|
* ```
|
|
279
132
|
*/
|
|
280
|
-
declare
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
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>;
|
|
133
|
+
declare function createRouterForAngular(options: CreateRouterForAngularOptions & WithTraitInputValidator<Pick<EnvironmentValidators, "router">>): RouterTrait;
|
|
134
|
+
|
|
135
|
+
interface AngularHttpClientLike {
|
|
136
|
+
request(method: string, url: string, options: {
|
|
137
|
+
body?: unknown;
|
|
138
|
+
headers?: Record<string, string>;
|
|
139
|
+
observe: "response";
|
|
140
|
+
responseType: "text";
|
|
141
|
+
}): Observable<HttpResponse<string>>;
|
|
316
142
|
}
|
|
143
|
+
interface BaseTransportForAngularCreateOptions {
|
|
144
|
+
httpClient: AngularHttpClientLike;
|
|
145
|
+
baseUrl?: string | URL;
|
|
146
|
+
}
|
|
147
|
+
declare const BaseTransportForAngularCreateOptionsSchema: arktype_internal_variants_object_ts.ObjectType<{
|
|
148
|
+
httpClient: {
|
|
149
|
+
request: Function;
|
|
150
|
+
};
|
|
151
|
+
baseUrl: unknown;
|
|
152
|
+
}, {}>;
|
|
153
|
+
declare function createBaseTransportForAngular(options: BaseTransportForAngularCreateOptions & WithTraitInputValidator<TraitInputValidator>): BaseTransportTrait;
|
|
317
154
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
155
|
+
declare const ENVIRONMENT: InjectionToken<FoundationEnvironment>;
|
|
156
|
+
declare const ENVIRONMENT_PROVIDER: InjectionToken<SecuritydeptProvider>;
|
|
157
|
+
type EnvironmentCreatorOptions = {
|
|
158
|
+
providers?: readonly SecuritydeptProvider[];
|
|
159
|
+
};
|
|
160
|
+
type EnvironmentCreator<TOptions extends EnvironmentCreatorOptions, TEnvironment extends FoundationEnvironment> = (options: TOptions) => TEnvironment;
|
|
161
|
+
type CreateEnvironmentForAngularOptions<TBaseOptions extends EnvironmentCreatorOptions, TEnvironment extends FoundationEnvironment> = Omit<TBaseOptions, "providers" | "routerForAngularCreateOptions" | "transportForAngularCreateOptions" | "injectorForAngularProvider" | "createBaseEnvironment"> & {
|
|
162
|
+
createBaseEnvironment: EnvironmentCreator<TBaseOptions, TEnvironment>;
|
|
163
|
+
routerForAngularCreateOptions: CreateRouterForAngularOptions;
|
|
164
|
+
transportForAngularCreateOptions: BaseTransportForAngularCreateOptions;
|
|
165
|
+
injectorForAngularProvider?: Injector;
|
|
166
|
+
providers?: readonly SecuritydeptProvider[];
|
|
167
|
+
};
|
|
168
|
+
type ProvideEnvironmentOptions<TBaseOptions extends EnvironmentCreatorOptions, TEnvironment extends FoundationEnvironment> = Omit<CreateEnvironmentForAngularOptions<TBaseOptions, TEnvironment>, "routerForAngularCreateOptions" | "transportForAngularCreateOptions" | "injectorForAngularProvider" | "providers"> & ProvideSecuritydeptOptions & {
|
|
169
|
+
routerForAngularCreateOptions?: Partial<CreateRouterForAngularOptions>;
|
|
170
|
+
transportForAngularCreateOptions?: Partial<BaseTransportForAngularCreateOptions>;
|
|
171
|
+
};
|
|
172
|
+
declare function createEnvironmentForAngular<TBaseOptions extends EnvironmentCreatorOptions, TEnvironment extends FoundationEnvironment>(options: CreateEnvironmentForAngularOptions<TBaseOptions, TEnvironment>): TEnvironment;
|
|
173
|
+
declare function provideEnvironment<TBaseOptions extends EnvironmentCreatorOptions, TEnvironment extends FoundationEnvironment>(options: ProvideEnvironmentOptions<TBaseOptions, TEnvironment>): Provider[];
|
|
174
|
+
declare function provideEnvironmentProvider(provider: SecuritydeptProvider): Provider;
|
|
175
|
+
|
|
176
|
+
declare function toNgSignal<T>(source: InteropObservableTrait<T>): Signal<T | undefined>;
|
|
177
|
+
declare function toNgSignal<T>(source: InteropObservableTrait<T>, options: NoInfer<ToSignalOptions<T | undefined>> & {
|
|
178
|
+
initialValue?: undefined;
|
|
179
|
+
requireSync?: false;
|
|
180
|
+
}): Signal<T | undefined>;
|
|
181
|
+
declare function toNgSignal<T>(source: InteropObservableTrait<T>, options: NoInfer<ToSignalOptions<T | null>> & {
|
|
182
|
+
initialValue?: null;
|
|
183
|
+
requireSync?: false;
|
|
184
|
+
}): Signal<T | null>;
|
|
185
|
+
declare function toNgSignal<T>(source: InteropObservableTrait<T>, options: NoInfer<ToSignalOptions<T>> & {
|
|
186
|
+
initialValue?: undefined;
|
|
187
|
+
requireSync: true;
|
|
188
|
+
}): Signal<T>;
|
|
189
|
+
declare function toNgSignal<T, const U extends T>(source: InteropObservableTrait<T>, options: NoInfer<ToSignalOptions<T | U>> & {
|
|
190
|
+
initialValue: U;
|
|
191
|
+
requireSync?: false;
|
|
192
|
+
}): Signal<T | U>;
|
|
193
|
+
declare const toNgResource: typeof rxResource;
|
|
333
194
|
|
|
334
|
-
export {
|
|
335
|
-
export type {
|
|
195
|
+
export { AngularRouterNavigationLikeSchema, BaseTransportForAngularCreateOptionsSchema, ENVIRONMENT, ENVIRONMENT_PROVIDER, SECURITYDEPT_INJECTOR, createAngularCanActivate, createAngularCanActivateChild, createBaseTransportForAngular, createEnvironmentForAngular, createRouterForAngular, projectAngularRouteSegments, provideEnvironment, provideEnvironmentProvider, provideSecuritydept, routeDataFromSegment, secureRoute, secureRouteRoot, toNgResource, toNgSignal };
|
|
196
|
+
export type { AngularHttpClientLike, AngularRouterNavigationLike, BaseTransportForAngularCreateOptions, CreateAngularGuardOptions, CreateAngularGuardWithBehaviourOptions, CreateAngularGuardWithPlannerHostOptions, CreateEnvironmentForAngularOptions, CreateRouterForAngularOptions, EnvironmentCreator, EnvironmentCreatorOptions, ProvideEnvironmentOptions, ProvideSecuritydeptOptions, ResolvedRouterForAngularCreateOptions, SecureRouteConfig, SecureRouteSecurityOptions };
|
|
336
197
|
//# sourceMappingURL=securitydept-client-angular.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"securitydept-client-angular.d.ts","sources":["../../src/lib/
|
|
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;AAEhD;;;;AAIG;AACH,0BAAsB,sBAAsB;AAC5C;AACA;AAEK,UAAW,sCAAsC,0BAC7B,eAAe,GAAG,eAAe,qBACvC,OAAO,CACzB,oCAAoC,sBACjC,OAAO,CAAC,oCAAoC;AAEhD;AACA,yBAAqB,+BAA+B,mBAEnD,0BAA0B;AAG3B;AAED;KACY,yBAAyB,0BACX,eAAe,GAAG,eAAe,qBACvC,OAAO,CACzB,oCAAoC,sBACjC,OAAO,CAAC,oCAAoC,uBAE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