@supacloud/app 0.2.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context.d.ts +41 -0
- package/dist/decorators.d.ts +119 -5
- package/dist/forms.d.ts +122 -0
- package/dist/forward_ref.d.ts +16 -0
- package/dist/http_client.d.ts +53 -0
- package/dist/http_context.d.ts +16 -0
- package/dist/http_headers.d.ts +19 -0
- package/dist/http_params.d.ts +23 -0
- package/dist/index.d.ts +43 -5
- package/dist/index.js +2650 -15
- package/dist/inject.d.ts +81 -0
- package/dist/input_transform.d.ts +18 -0
- package/dist/interceptor.d.ts +33 -0
- package/dist/location.d.ts +15 -0
- package/dist/pipe.d.ts +45 -0
- package/dist/platform.d.ts +33 -0
- package/dist/provider.d.ts +32 -2
- package/dist/resource.d.ts +40 -0
- package/dist/route_match.d.ts +14 -0
- package/dist/route_pipeline.d.ts +74 -0
- package/dist/route_provider.d.ts +39 -0
- package/dist/signal.d.ts +48 -0
- package/dist/testing.d.ts +43 -0
- package/dist/title_strategy.d.ts +18 -0
- package/dist/token.d.ts +3 -0
- package/dist/transfer_state.d.ts +52 -0
- package/dist/url_tree.d.ts +31 -0
- package/package.json +1 -1
package/dist/context.d.ts
CHANGED
|
@@ -17,3 +17,44 @@ export declare const JOB_CONTEXT: InjectionToken<unknown>;
|
|
|
17
17
|
* passed to `createApplication({ deps: { dbClient } })`.
|
|
18
18
|
*/
|
|
19
19
|
export declare const DB_CLIENT: InjectionToken<unknown>;
|
|
20
|
+
/**
|
|
21
|
+
* Built-in multi-provider token for application startup lifecycle hooks.
|
|
22
|
+
* Modeled after Angular's APP_INITIALIZER.
|
|
23
|
+
* Initializer providers can return void or a Promise<void>; the application startup sequence
|
|
24
|
+
* executes all registered initializers before accepting traffic.
|
|
25
|
+
*/
|
|
26
|
+
export declare const APP_INITIALIZER: InjectionToken<() => void | Promise<void>>;
|
|
27
|
+
/**
|
|
28
|
+
* Built-in multi-provider token for environment initialization hooks.
|
|
29
|
+
* Modeled directly after Angular 14+ ENVIRONMENT_INITIALIZER.
|
|
30
|
+
*/
|
|
31
|
+
export declare const ENVIRONMENT_INITIALIZER: InjectionToken<() => void | Promise<void>>;
|
|
32
|
+
/**
|
|
33
|
+
* Lifecycle interface for services that need to perform teardown logic when the application shuts down.
|
|
34
|
+
* Modeled after Angular's OnDestroy.
|
|
35
|
+
*/
|
|
36
|
+
export interface OnDestroy {
|
|
37
|
+
onDestroy(): void | Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Mechanism to register teardown callbacks for an active context or service.
|
|
41
|
+
* Modeled directly after Angular's DestroyRef.
|
|
42
|
+
*/
|
|
43
|
+
export interface DestroyRef {
|
|
44
|
+
readonly signal?: AbortSignal;
|
|
45
|
+
onDestroy(callback: () => void | Promise<void>): () => void;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Built-in token for registering teardown callbacks.
|
|
49
|
+
* Modeled after Angular's DestroyRef.
|
|
50
|
+
*/
|
|
51
|
+
export declare const DESTROY_REF: InjectionToken<DestroyRef>;
|
|
52
|
+
/**
|
|
53
|
+
* Creates a default DestroyRef instance for tracking teardown hooks.
|
|
54
|
+
*/
|
|
55
|
+
export declare function createDestroyRef(): DestroyRef & {
|
|
56
|
+
readonly destroyed: boolean;
|
|
57
|
+
readonly signal: AbortSignal;
|
|
58
|
+
destroy(): Promise<void>;
|
|
59
|
+
_teardowns: Array<() => void | Promise<void>>;
|
|
60
|
+
};
|
package/dist/decorators.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Provider, Token, Type } from "./provider";
|
|
2
|
+
import type { EnvironmentProviders } from "./provider";
|
|
2
3
|
import type { Scope } from "./scope";
|
|
3
4
|
/**
|
|
4
5
|
* Decorator metadata keys. Metadata is attached as static properties on the
|
|
@@ -12,25 +13,53 @@ export declare const QUERY_METADATA = "supacloud:query";
|
|
|
12
13
|
export declare const CONTROLLER_METADATA = "supacloud:controller";
|
|
13
14
|
export declare const ROUTES_METADATA = "supacloud:routes";
|
|
14
15
|
export declare const INJECT_PARAMS_METADATA = "supacloud:inject-params";
|
|
16
|
+
export declare const OPTIONAL_PARAMS_METADATA = "supacloud:optional-params";
|
|
17
|
+
export declare const SELF_PARAMS_METADATA = "supacloud:self-params";
|
|
18
|
+
export declare const SKIP_SELF_PARAMS_METADATA = "supacloud:skip-self-params";
|
|
19
|
+
export declare const HOST_PARAMS_METADATA = "supacloud:host-params";
|
|
20
|
+
export declare const GUARDS_METADATA = "supacloud:guards";
|
|
21
|
+
export declare const CAN_DEACTIVATE_METADATA = "supacloud:guards:can-deactivate";
|
|
22
|
+
export declare const RESOLVE_METADATA = "supacloud:resolvers";
|
|
23
|
+
export declare const TITLE_METADATA = "supacloud:route:title";
|
|
24
|
+
export declare const DATA_METADATA = "supacloud:route:data";
|
|
25
|
+
export declare const ROUTE_PARAMS_METADATA = "supacloud:route-params";
|
|
26
|
+
export interface RouteParamBinding {
|
|
27
|
+
index: number;
|
|
28
|
+
type: "param" | "query" | "body" | "headers";
|
|
29
|
+
name?: string;
|
|
30
|
+
transform?: "number" | "boolean" | "string";
|
|
31
|
+
default?: unknown;
|
|
32
|
+
}
|
|
33
|
+
export interface ParamOptions {
|
|
34
|
+
name?: string;
|
|
35
|
+
transform?: "number" | "boolean" | "string";
|
|
36
|
+
default?: unknown;
|
|
37
|
+
}
|
|
15
38
|
export interface InjectableOptions {
|
|
16
39
|
scope?: Scope;
|
|
40
|
+
/** Automatically provide this service in root scope without manual module declaration (Angular-style). */
|
|
41
|
+
providedIn?: "root";
|
|
17
42
|
/** Explicit constructor dependency tokens, in parameter order. */
|
|
18
43
|
deps?: Token[];
|
|
19
44
|
}
|
|
20
45
|
export interface InjectableMeta {
|
|
21
46
|
scope: Scope;
|
|
47
|
+
providedIn?: "root";
|
|
22
48
|
deps: Token[];
|
|
23
49
|
}
|
|
24
50
|
export interface ModuleOptions {
|
|
25
51
|
name: string;
|
|
52
|
+
/** Tags for architectural boundary governance (e.g. ['scope:case', 'type:feature']). */
|
|
53
|
+
tags?: string[];
|
|
26
54
|
imports?: Array<Type<unknown>>;
|
|
27
|
-
providers?: Provider
|
|
55
|
+
providers?: Array<Provider | EnvironmentProviders>;
|
|
28
56
|
controllers?: Array<Type<unknown>>;
|
|
29
57
|
commands?: Array<Type<unknown>>;
|
|
30
58
|
queries?: Array<Type<unknown>>;
|
|
31
59
|
exports?: Token[];
|
|
32
60
|
}
|
|
33
|
-
export interface ModuleMeta extends Required<Omit<ModuleOptions, "exports">> {
|
|
61
|
+
export interface ModuleMeta extends Required<Omit<ModuleOptions, "exports" | "tags">> {
|
|
62
|
+
tags?: string[];
|
|
34
63
|
exports: Token[];
|
|
35
64
|
}
|
|
36
65
|
export interface CommandOptions {
|
|
@@ -43,10 +72,13 @@ export interface CommandOptions {
|
|
|
43
72
|
audit?: string;
|
|
44
73
|
/** Idempotency strategy, e.g. "required". */
|
|
45
74
|
idempotency?: "required" | "none";
|
|
75
|
+
/** Automatically discover and register without manual module declaration. */
|
|
76
|
+
standalone?: boolean;
|
|
46
77
|
}
|
|
47
78
|
export type CommandMeta = Omit<CommandOptions, "transaction" | "idempotency"> & {
|
|
48
79
|
transaction: "required" | "none";
|
|
49
80
|
idempotency: "required" | "none";
|
|
81
|
+
standalone?: boolean;
|
|
50
82
|
};
|
|
51
83
|
export interface QueryOptions {
|
|
52
84
|
name: string;
|
|
@@ -54,8 +86,17 @@ export interface QueryOptions {
|
|
|
54
86
|
export type QueryMeta = QueryOptions;
|
|
55
87
|
export interface ControllerMeta {
|
|
56
88
|
path: string;
|
|
89
|
+
standalone?: boolean;
|
|
90
|
+
}
|
|
91
|
+
export interface ControllerOptions {
|
|
92
|
+
path?: string;
|
|
93
|
+
standalone?: boolean;
|
|
57
94
|
}
|
|
58
|
-
export type
|
|
95
|
+
export type CanActivateFn<TContext = any> = (ctx: TContext) => boolean | Promise<boolean> | any;
|
|
96
|
+
export type CanMatchFn<TContext = any> = (ctx: TContext) => boolean | Promise<boolean> | any;
|
|
97
|
+
export type CanDeactivateFn<T = any, TContext = any> = (component: T, ctx: TContext) => boolean | Promise<boolean> | any;
|
|
98
|
+
export type ResolveFn<T = any, TContext = any> = (ctx: TContext) => T | Promise<T>;
|
|
99
|
+
export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
|
|
59
100
|
export interface RouteOptions {
|
|
60
101
|
/** TypeBox schema (or compatible) for the request body. */
|
|
61
102
|
body?: unknown;
|
|
@@ -67,6 +108,22 @@ export interface RouteOptions {
|
|
|
67
108
|
response?: unknown;
|
|
68
109
|
/** Command class whose governance metadata must be enforced for this route. */
|
|
69
110
|
command?: Type<unknown>;
|
|
111
|
+
/** Angular-style functional route guards executed before handler. */
|
|
112
|
+
guards?: Array<CanActivateFn | string>;
|
|
113
|
+
/** Angular-style route matching guard determining whether route can match. */
|
|
114
|
+
canMatch?: Array<CanMatchFn | string>;
|
|
115
|
+
/** Angular-style route deactivation guard executed before leaving/cleaning up route. */
|
|
116
|
+
canDeactivate?: Array<CanDeactivateFn | string>;
|
|
117
|
+
/** Angular-style route resolvers executed before handler to preload dependencies. */
|
|
118
|
+
resolvers?: Record<string, ResolveFn | string>;
|
|
119
|
+
/** Angular-style route redirect target path. */
|
|
120
|
+
redirectTo?: string;
|
|
121
|
+
/** Angular-style route path matching strategy. */
|
|
122
|
+
pathMatch?: "full" | "prefix";
|
|
123
|
+
/** Route title or label (modeled after Angular Route.title). */
|
|
124
|
+
title?: string;
|
|
125
|
+
/** Static route metadata dictionary (modeled after Angular Route.data). */
|
|
126
|
+
data?: Record<string, unknown>;
|
|
70
127
|
}
|
|
71
128
|
export interface RouteDefinition extends RouteOptions {
|
|
72
129
|
method: HttpMethod;
|
|
@@ -83,17 +140,74 @@ export declare function getInjectableMeta(target: object): InjectableMeta | unde
|
|
|
83
140
|
*/
|
|
84
141
|
export declare function Inject(token: Token): ParameterDecorator;
|
|
85
142
|
export declare function getInjectParams(target: object): Record<number, Token>;
|
|
143
|
+
/**
|
|
144
|
+
* Parameter decorator marking a constructor parameter as optional.
|
|
145
|
+
* Modeled after Angular's @Optional(); if unresolved, the parameter receives undefined.
|
|
146
|
+
*/
|
|
147
|
+
export declare function Optional(): ParameterDecorator;
|
|
148
|
+
export declare function getOptionalParams(target: object): number[];
|
|
149
|
+
/**
|
|
150
|
+
* Parameter decorator asserting that dependency must be provided in the current module/scope.
|
|
151
|
+
* Modeled after Angular's @Self(); fails at compile time if resolved from imported modules or fallback.
|
|
152
|
+
*/
|
|
153
|
+
export declare function Self(): ParameterDecorator;
|
|
154
|
+
export declare function getSelfParams(target: object): number[];
|
|
155
|
+
/**
|
|
156
|
+
* Parameter decorator asserting that dependency must NOT be resolved from the current module itself.
|
|
157
|
+
* Modeled after Angular's @SkipSelf(); searches parent/imported scopes.
|
|
158
|
+
*/
|
|
159
|
+
export declare function SkipSelf(): ParameterDecorator;
|
|
160
|
+
export declare function getSkipSelfParams(target: object): number[];
|
|
161
|
+
/**
|
|
162
|
+
* Parameter decorator specifying host resolution boundary.
|
|
163
|
+
* Modeled after Angular's @Host().
|
|
164
|
+
*/
|
|
165
|
+
export declare function Host(): ParameterDecorator;
|
|
166
|
+
export declare function getHostParams(target: object): number[];
|
|
167
|
+
/**
|
|
168
|
+
* Class and method decorator attaching functional route guards.
|
|
169
|
+
* Modeled after Angular Router guards.
|
|
170
|
+
*/
|
|
171
|
+
export declare function UseGuards(...guards: Array<CanActivateFn | string>): ClassDecorator & MethodDecorator;
|
|
172
|
+
export declare function getGuards(target: object, propertyKey?: string | symbol): Array<CanActivateFn | string>;
|
|
86
173
|
export declare function Module(options: ModuleOptions): ClassDecorator;
|
|
87
174
|
export declare function getModuleMeta(target: object): ModuleMeta | undefined;
|
|
88
175
|
export declare function Command(options: CommandOptions): ClassDecorator;
|
|
89
176
|
export declare function getCommandMeta(target: object): CommandMeta | undefined;
|
|
90
|
-
export declare function
|
|
177
|
+
export declare function Param(nameOrOptions?: string | ParamOptions, options?: ParamOptions): ParameterDecorator;
|
|
178
|
+
export declare function Body(): ParameterDecorator;
|
|
179
|
+
export declare function Headers(name?: string): ParameterDecorator;
|
|
180
|
+
export declare function Query(optionsOrName?: QueryOptions | ParamOptions | string, options?: ParamOptions): ClassDecorator & ParameterDecorator;
|
|
181
|
+
export declare function getRouteParams(target: object, propertyKey: string | symbol): RouteParamBinding[];
|
|
91
182
|
export declare function getQueryMeta(target: object): QueryMeta | undefined;
|
|
92
|
-
export declare function Controller(
|
|
183
|
+
export declare function Controller(pathOrOptions?: string | ControllerOptions): ClassDecorator;
|
|
93
184
|
export declare function getControllerMeta(target: object): ControllerMeta | undefined;
|
|
94
185
|
export declare const Get: (path: string, options?: RouteOptions) => MethodDecorator;
|
|
95
186
|
export declare const Post: (path: string, options?: RouteOptions) => MethodDecorator;
|
|
96
187
|
export declare const Put: (path: string, options?: RouteOptions) => MethodDecorator;
|
|
97
188
|
export declare const Patch: (path: string, options?: RouteOptions) => MethodDecorator;
|
|
98
189
|
export declare const Delete: (path: string, options?: RouteOptions) => MethodDecorator;
|
|
190
|
+
export declare const Head: (path: string, options?: RouteOptions) => MethodDecorator;
|
|
191
|
+
export declare const Options: (path: string, options?: RouteOptions) => MethodDecorator;
|
|
192
|
+
/**
|
|
193
|
+
* Sets a route title. Modeled after Angular Route.title.
|
|
194
|
+
*/
|
|
195
|
+
export declare function Title(title: string): MethodDecorator;
|
|
196
|
+
/**
|
|
197
|
+
* Attaches arbitrary static metadata to a route. Modeled after Angular Route.data.
|
|
198
|
+
*/
|
|
199
|
+
export declare function Data(data: Record<string, unknown>): MethodDecorator;
|
|
200
|
+
/**
|
|
201
|
+
* Attaches CanDeactivateFn guards to a route method. Modeled after Angular Route.canDeactivate.
|
|
202
|
+
*/
|
|
203
|
+
export declare function CanDeactivate(...guards: Array<CanDeactivateFn | string>): MethodDecorator;
|
|
204
|
+
/**
|
|
205
|
+
* Attaches route pre-activation resolvers to a route method. Modeled after Angular Route.resolve.
|
|
206
|
+
* Resolvers run before the route handler, allowing prefetching and validation without controller boilerplate.
|
|
207
|
+
*/
|
|
208
|
+
export declare function Resolve(resolvers: Record<string, ResolveFn | string>): MethodDecorator;
|
|
209
|
+
/**
|
|
210
|
+
* Executes a dictionary of route resolvers concurrently.
|
|
211
|
+
*/
|
|
212
|
+
export declare function executeResolvers<TContext = any>(resolvers: Record<string, ResolveFn | string>, ctx: TContext): Promise<Record<string, unknown>>;
|
|
99
213
|
export declare function getRoutes(target: object): RouteDefinition[];
|
package/dist/forms.d.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular-style Reactive Forms & Validation Suite (@angular/forms).
|
|
3
|
+
* Zero-dependency, type-safe, reactive form model and validator collection.
|
|
4
|
+
*/
|
|
5
|
+
export type FormControlStatus = "VALID" | "INVALID" | "PENDING" | "DISABLED";
|
|
6
|
+
export type ValidationErrors = Record<string, unknown>;
|
|
7
|
+
export type ValidatorFn = (control: AbstractControl) => ValidationErrors | null;
|
|
8
|
+
export type AsyncValidatorFn = (control: AbstractControl) => Promise<ValidationErrors | null>;
|
|
9
|
+
export interface AbstractControlOptions {
|
|
10
|
+
validators?: ValidatorFn | ValidatorFn[] | null;
|
|
11
|
+
asyncValidators?: AsyncValidatorFn | AsyncValidatorFn[] | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Base class for all Angular-style form controls: FormControl, FormGroup, FormArray.
|
|
15
|
+
*/
|
|
16
|
+
export declare abstract class AbstractControl<TValue = any> {
|
|
17
|
+
private _value;
|
|
18
|
+
private _status;
|
|
19
|
+
private _errors;
|
|
20
|
+
private _pristine;
|
|
21
|
+
private _touched;
|
|
22
|
+
private _parent;
|
|
23
|
+
protected _validator: ValidatorFn | null;
|
|
24
|
+
protected _asyncValidator: AsyncValidatorFn | null;
|
|
25
|
+
constructor(validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null);
|
|
26
|
+
get value(): TValue;
|
|
27
|
+
protected setRawValue(val: TValue): void;
|
|
28
|
+
get status(): FormControlStatus;
|
|
29
|
+
get valid(): boolean;
|
|
30
|
+
get invalid(): boolean;
|
|
31
|
+
get pending(): boolean;
|
|
32
|
+
get disabled(): boolean;
|
|
33
|
+
get enabled(): boolean;
|
|
34
|
+
get errors(): ValidationErrors | null;
|
|
35
|
+
get pristine(): boolean;
|
|
36
|
+
get dirty(): boolean;
|
|
37
|
+
get touched(): boolean;
|
|
38
|
+
get untouched(): boolean;
|
|
39
|
+
get parent(): FormGroup | FormArray | null;
|
|
40
|
+
setParent(parent: FormGroup | FormArray | null): void;
|
|
41
|
+
markAsTouched(): void;
|
|
42
|
+
markAsUntouched(): void;
|
|
43
|
+
markAsDirty(): void;
|
|
44
|
+
markAsPristine(): void;
|
|
45
|
+
disable(): void;
|
|
46
|
+
enable(): void;
|
|
47
|
+
setErrors(errors: ValidationErrors | null): void;
|
|
48
|
+
hasError(errorCode: string, path?: string | (string | number)[]): boolean;
|
|
49
|
+
getError(errorCode: string, path?: string | (string | number)[]): unknown;
|
|
50
|
+
abstract setValue(value: any): void;
|
|
51
|
+
abstract patchValue(value: any): void;
|
|
52
|
+
abstract reset(value?: any): void;
|
|
53
|
+
get(_path: string | (string | number)[]): AbstractControl | null;
|
|
54
|
+
updateValueAndValidity(): void;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Tracks the value and validity status of an individual form control.
|
|
58
|
+
*/
|
|
59
|
+
export declare class FormControl<T = any> extends AbstractControl<T> {
|
|
60
|
+
constructor(formState?: T | {
|
|
61
|
+
value: T;
|
|
62
|
+
disabled?: boolean;
|
|
63
|
+
}, validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null);
|
|
64
|
+
setValue(value: any): void;
|
|
65
|
+
patchValue(value: any): void;
|
|
66
|
+
reset(formState?: any): void;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Tracks the value and validity status of a group of named AbstractControl instances.
|
|
70
|
+
*/
|
|
71
|
+
export declare class FormGroup<TControls extends Record<string, AbstractControl> = Record<string, AbstractControl>> extends AbstractControl<{
|
|
72
|
+
[K in keyof TControls]: TControls[K]["value"];
|
|
73
|
+
}> {
|
|
74
|
+
readonly controls: TControls;
|
|
75
|
+
constructor(controls: TControls, validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null);
|
|
76
|
+
get value(): {
|
|
77
|
+
[K in keyof TControls]: TControls[K]["value"];
|
|
78
|
+
};
|
|
79
|
+
get(path: string | (string | number)[]): AbstractControl | null;
|
|
80
|
+
addControl(name: string, control: AbstractControl): void;
|
|
81
|
+
removeControl(name: string): void;
|
|
82
|
+
setControl(name: string, control: AbstractControl): void;
|
|
83
|
+
contains(name: string): boolean;
|
|
84
|
+
setValue(value: any): void;
|
|
85
|
+
patchValue(value: any): void;
|
|
86
|
+
reset(): void;
|
|
87
|
+
updateValueAndValidity(): void;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Tracks the value and validity status of an array of AbstractControl instances.
|
|
91
|
+
*/
|
|
92
|
+
export declare class FormArray<TControl extends AbstractControl = AbstractControl> extends AbstractControl<Array<TControl["value"]>> {
|
|
93
|
+
readonly controls: TControl[];
|
|
94
|
+
constructor(controls?: TControl[], validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null);
|
|
95
|
+
get length(): number;
|
|
96
|
+
at(index: number): TControl | null;
|
|
97
|
+
push(control: TControl): void;
|
|
98
|
+
insert(index: number, control: TControl): void;
|
|
99
|
+
removeAt(index: number): void;
|
|
100
|
+
clear(): void;
|
|
101
|
+
get value(): Array<TControl["value"]>;
|
|
102
|
+
setValue(value: any): void;
|
|
103
|
+
patchValue(value: any): void;
|
|
104
|
+
reset(): void;
|
|
105
|
+
updateValueAndValidity(): void;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Standard Angular-inspired Validators collection (@angular/forms).
|
|
109
|
+
*/
|
|
110
|
+
export declare class Validators {
|
|
111
|
+
static nullValidator(_control: AbstractControl): null;
|
|
112
|
+
static required(control: AbstractControl): ValidationErrors | null;
|
|
113
|
+
static requiredTrue(control: AbstractControl): ValidationErrors | null;
|
|
114
|
+
static min(min: number): ValidatorFn;
|
|
115
|
+
static max(max: number): ValidatorFn;
|
|
116
|
+
static minLength(minLength: number): ValidatorFn;
|
|
117
|
+
static maxLength(maxLength: number): ValidatorFn;
|
|
118
|
+
static email(control: AbstractControl): ValidationErrors | null;
|
|
119
|
+
static pattern(pattern: string | RegExp): ValidatorFn;
|
|
120
|
+
static compose(validators: (ValidatorFn | null | undefined)[] | null): ValidatorFn | null;
|
|
121
|
+
static composeAsync(validators: (AsyncValidatorFn | null | undefined)[] | null): AsyncValidatorFn | null;
|
|
122
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allows referring to references which are not yet defined.
|
|
3
|
+
* Modeled directly after Angular's `forwardRef`.
|
|
4
|
+
*
|
|
5
|
+
* Example:
|
|
6
|
+
* ```ts
|
|
7
|
+
* @Inject(forwardRef(() => DependentService))
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
export interface ForwardRefFn<T = unknown> {
|
|
11
|
+
(): T;
|
|
12
|
+
__forward_ref__?: typeof forwardRef;
|
|
13
|
+
}
|
|
14
|
+
export declare function forwardRef<T>(fn: () => T): ForwardRefFn<T>;
|
|
15
|
+
export declare function resolveForwardRef<T>(type: T): T;
|
|
16
|
+
export declare function isForwardRef(fn: unknown): fn is ForwardRefFn;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { HttpContext } from "./http_context";
|
|
2
|
+
import { HttpHeaders } from "./http_headers";
|
|
3
|
+
import { HttpParams } from "./http_params";
|
|
4
|
+
import { type HttpInterceptorFn } from "./interceptor";
|
|
5
|
+
import { InjectionToken } from "./token";
|
|
6
|
+
import { type EnvironmentProviders, type Provider } from "./provider";
|
|
7
|
+
export interface HttpClientConfig {
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
fetch?: typeof fetch;
|
|
10
|
+
}
|
|
11
|
+
export declare const HTTP_CLIENT_CONFIG: InjectionToken<HttpClientConfig>;
|
|
12
|
+
export declare const HTTP_INTERCEPTORS: InjectionToken<HttpInterceptorFn[]>;
|
|
13
|
+
export declare class HttpErrorResponse extends Error {
|
|
14
|
+
readonly status: number;
|
|
15
|
+
readonly statusText: string;
|
|
16
|
+
readonly url: string | null;
|
|
17
|
+
readonly error: unknown;
|
|
18
|
+
constructor(init: {
|
|
19
|
+
error?: unknown;
|
|
20
|
+
status?: number;
|
|
21
|
+
statusText?: string;
|
|
22
|
+
url?: string;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export interface HttpRequestOptions {
|
|
26
|
+
headers?: HttpHeaders | Record<string, string | string[]>;
|
|
27
|
+
params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
|
|
28
|
+
body?: unknown;
|
|
29
|
+
context?: HttpContext;
|
|
30
|
+
observe?: "body" | "response";
|
|
31
|
+
responseType?: "json" | "text" | "blob";
|
|
32
|
+
signal?: AbortSignal;
|
|
33
|
+
}
|
|
34
|
+
export type HttpClientFeatureKind = "Fetch" | "Interceptors" | "ParentRequests";
|
|
35
|
+
export interface HttpClientFeature {
|
|
36
|
+
kind: HttpClientFeatureKind;
|
|
37
|
+
providers: Provider[];
|
|
38
|
+
}
|
|
39
|
+
export declare function withFetch(customFetch?: typeof fetch): HttpClientFeature;
|
|
40
|
+
export declare function withInterceptors(...interceptors: (HttpInterceptorFn | HttpInterceptorFn[])[]): HttpClientFeature;
|
|
41
|
+
export declare function withRequestsMadeViaParent(): HttpClientFeature;
|
|
42
|
+
export declare function provideHttpClient(...features: HttpClientFeature[]): EnvironmentProviders;
|
|
43
|
+
export declare class HttpClient {
|
|
44
|
+
private config;
|
|
45
|
+
private interceptors;
|
|
46
|
+
constructor(config?: HttpClientConfig, interceptors?: HttpInterceptorFn[]);
|
|
47
|
+
get<T = unknown>(url: string, options?: HttpRequestOptions): Promise<T>;
|
|
48
|
+
post<T = unknown>(url: string, body?: unknown, options?: HttpRequestOptions): Promise<T>;
|
|
49
|
+
put<T = unknown>(url: string, body?: unknown, options?: HttpRequestOptions): Promise<T>;
|
|
50
|
+
delete<T = unknown>(url: string, options?: HttpRequestOptions): Promise<T>;
|
|
51
|
+
patch<T = unknown>(url: string, body?: unknown, options?: HttpRequestOptions): Promise<T>;
|
|
52
|
+
request<T = unknown>(method: string, url: string, options?: HttpRequestOptions): Promise<T>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular-inspired typed HTTP context token and context bag.
|
|
3
|
+
* Modeled after Angular's @angular/common/http HttpContext and HttpContextToken API.
|
|
4
|
+
*/
|
|
5
|
+
export declare class HttpContextToken<T> {
|
|
6
|
+
readonly defaultValue: () => T;
|
|
7
|
+
constructor(defaultValue: () => T);
|
|
8
|
+
}
|
|
9
|
+
export declare class HttpContext {
|
|
10
|
+
private readonly map;
|
|
11
|
+
set<T>(token: HttpContextToken<T>, value: T): this;
|
|
12
|
+
get<T>(token: HttpContextToken<T>): T;
|
|
13
|
+
delete(token: HttpContextToken<unknown>): this;
|
|
14
|
+
has(token: HttpContextToken<unknown>): boolean;
|
|
15
|
+
keys(): IterableIterator<HttpContextToken<unknown>>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular-inspired immutable HttpHeaders builder.
|
|
3
|
+
* Modeled after Angular's @angular/common/http HttpHeaders API.
|
|
4
|
+
* Header names are treated case-insensitively.
|
|
5
|
+
*/
|
|
6
|
+
export declare class HttpHeaders {
|
|
7
|
+
private readonly headersMap;
|
|
8
|
+
private readonly originalNames;
|
|
9
|
+
constructor(headers?: Record<string, string | string[]> | HttpHeaders);
|
|
10
|
+
private clone;
|
|
11
|
+
has(name: string): boolean;
|
|
12
|
+
get(name: string): string | null;
|
|
13
|
+
getAll(name: string): string[] | null;
|
|
14
|
+
keys(): string[];
|
|
15
|
+
set(name: string, value: string | string[]): HttpHeaders;
|
|
16
|
+
append(name: string, value: string | string[]): HttpHeaders;
|
|
17
|
+
delete(name: string): HttpHeaders;
|
|
18
|
+
toObject(): Record<string, string>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular-inspired immutable HttpParams query parameter builder.
|
|
3
|
+
* Modeled after Angular's @angular/common/http HttpParams API.
|
|
4
|
+
*/
|
|
5
|
+
export interface HttpParamsOptions {
|
|
6
|
+
/** String in standard query string format (e.g. 'a=1&b=2') */
|
|
7
|
+
fromString?: string;
|
|
8
|
+
/** Object mapping parameter names to primitive values or arrays */
|
|
9
|
+
fromObject?: Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
|
|
10
|
+
}
|
|
11
|
+
export declare class HttpParams {
|
|
12
|
+
private readonly map;
|
|
13
|
+
constructor(options?: HttpParamsOptions);
|
|
14
|
+
private clone;
|
|
15
|
+
has(param: string): boolean;
|
|
16
|
+
get(param: string): string | null;
|
|
17
|
+
getAll(param: string): string[] | null;
|
|
18
|
+
keys(): string[];
|
|
19
|
+
set(param: string, value: string | number | boolean): HttpParams;
|
|
20
|
+
append(param: string, value: string | number | boolean): HttpParams;
|
|
21
|
+
delete(param: string, value?: string | number | boolean): HttpParams;
|
|
22
|
+
toString(): string;
|
|
23
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,47 @@ export { SCOPES, DEFAULT_SCOPE, SCOPE_LIFETIME_RANK, isScopeViolation } from "./
|
|
|
2
2
|
export type { Scope } from "./scope";
|
|
3
3
|
export { InjectionToken } from "./token";
|
|
4
4
|
export type { InjectionTokenOptions } from "./token";
|
|
5
|
-
export { isClassProvider, isExistingProvider, isFactoryProvider, isValueProvider, } from "./provider";
|
|
6
|
-
export type { ClassProvider, ExistingProvider, FactoryProvider, Provider, Token, Type, ValueProvider, } from "./provider";
|
|
7
|
-
export { Command, Controller, Delete, Get, Inject, Injectable, Module, Patch, Post, Put, Query, getCommandMeta, getControllerMeta, getInjectParams, getInjectableMeta, getModuleMeta, getQueryMeta, getRoutes, COMMAND_METADATA, CONTROLLER_METADATA, INJECTABLE_METADATA, INJECT_PARAMS_METADATA, MODULE_METADATA, QUERY_METADATA, ROUTES_METADATA, } from "./decorators";
|
|
8
|
-
export type { CommandMeta, CommandOptions, ControllerMeta, HttpMethod, InjectableMeta, InjectableOptions, ModuleMeta, ModuleOptions, QueryMeta, QueryOptions, RouteDefinition, RouteOptions, } from "./decorators";
|
|
5
|
+
export { flattenProviders, isEnvironmentProviders, isClassProvider, isExistingProvider, isFactoryProvider, isValueProvider, makeEnvironmentProviders, provideAppInitializer, provideEnvironmentInitializer, provideToken, } from "./provider";
|
|
6
|
+
export type { ClassProvider, EnvironmentProviders, ExistingProvider, FactoryProvider, Provider, Token, Type, ValueProvider, } from "./provider";
|
|
7
|
+
export { Body, CanDeactivate, Command, Controller, Data, Delete, Get, Head, Headers, Host, Inject, Injectable, Module, Optional, Options, Param, Patch, Post, Put, Query, Resolve, Self, SkipSelf, Title, UseGuards, executeResolvers, getCommandMeta, getControllerMeta, getGuards, getHostParams, getInjectParams, getOptionalParams, getRouteParams, getSelfParams, getSkipSelfParams, getInjectableMeta, getModuleMeta, getQueryMeta, getRoutes, COMMAND_METADATA, CONTROLLER_METADATA, GUARDS_METADATA, CAN_DEACTIVATE_METADATA, HOST_PARAMS_METADATA, INJECTABLE_METADATA, INJECT_PARAMS_METADATA, RESOLVE_METADATA, OPTIONAL_PARAMS_METADATA, ROUTE_PARAMS_METADATA, SELF_PARAMS_METADATA, SKIP_SELF_PARAMS_METADATA, MODULE_METADATA, QUERY_METADATA, ROUTES_METADATA, } from "./decorators";
|
|
8
|
+
export type { CanActivateFn, CanDeactivateFn, CanMatchFn, CommandMeta, CommandOptions, ControllerMeta, ControllerOptions, HttpMethod, InjectableMeta, InjectableOptions, ModuleMeta, ModuleOptions, ParamOptions, QueryMeta, QueryOptions, ResolveFn, RouteDefinition, RouteOptions, RouteParamBinding, } from "./decorators";
|
|
9
9
|
export { defineModule } from "./module";
|
|
10
|
-
export { DB_CLIENT, JOB_CONTEXT, REQUEST_CONTEXT } from "./context";
|
|
10
|
+
export { APP_INITIALIZER, DB_CLIENT, DESTROY_REF, ENVIRONMENT_INITIALIZER, JOB_CONTEXT, REQUEST_CONTEXT, createDestroyRef, } from "./context";
|
|
11
|
+
export type { DestroyRef, OnDestroy } from "./context";
|
|
12
|
+
export { INJECTOR, assertInInjectionContext, createChildInjector, createEnvironmentInjector, getActiveInjector, inject, injectAll, injectDestroySignal, runInInjectionContext, } from "./inject";
|
|
13
|
+
export type { EnvironmentInjector, InjectFlags, InjectorLike } from "./inject";
|
|
14
|
+
export { forwardRef, isForwardRef, resolveForwardRef } from "./forward_ref";
|
|
15
|
+
export type { ForwardRefFn } from "./forward_ref";
|
|
16
|
+
export { matchRoute } from "./route_match";
|
|
17
|
+
export type { RouteMatchResult } from "./route_match";
|
|
18
|
+
export { createBearerAuthInterceptor, createHeaderInterceptor, createRetryInterceptor, createTimeoutInterceptor, withInterceptors, } from "./interceptor";
|
|
19
|
+
export type { HttpInterceptorFn, HttpRequestPayload } from "./interceptor";
|
|
20
|
+
export { computed, effect, linkedSignal, signal, untracked, } from "./signal";
|
|
21
|
+
export type { LinkedSignalOptions, Signal, WritableSignal } from "./signal";
|
|
22
|
+
export { resource } from "./resource";
|
|
23
|
+
export type { ResourceLoaderParams, ResourceOptions, ResourceRef, ResourceStatus, } from "./resource";
|
|
24
|
+
export { RedirectCommand, executeRoutePipeline, isRedirectCommand, } from "./route_pipeline";
|
|
25
|
+
export type { NavigationExtras, RoutePipelineContext, RoutePipelineDefinition, RoutePipelineOptions, RoutePipelineResult, RouterEvent, RouterEventType, } from "./route_pipeline";
|
|
26
|
+
export { TestBed } from "./testing";
|
|
27
|
+
export type { TestModuleMetadata } from "./testing";
|
|
28
|
+
export { APP_BASE_HREF, ROUTER_CONFIGURATION, ROUTE_CONFIG, provideRouter, withComponentInputBinding, withRouterConfig, withTitleStrategy, } from "./route_provider";
|
|
29
|
+
export type { RouterConfigOptions, RouterFeature } from "./route_provider";
|
|
30
|
+
export { DefaultTitleStrategy, TITLE_STRATEGY, TitleStrategy, } from "./title_strategy";
|
|
31
|
+
export { joinWithSlash, normalizePath, stripTrailingSlash, } from "./location";
|
|
32
|
+
export { TransferState, TRANSFER_STATE, makeStateKey, } from "./transfer_state";
|
|
33
|
+
export type { StateKey } from "./transfer_state";
|
|
34
|
+
export { DOCUMENT, PLATFORM_BROWSER_ID, PLATFORM_EDGE_ID, PLATFORM_ID, PLATFORM_SERVER_ID, detectPlatform, isPlatformBrowser, isPlatformEdge, isPlatformServer, } from "./platform";
|
|
35
|
+
export type { PlatformId } from "./platform";
|
|
36
|
+
export { HttpParams } from "./http_params";
|
|
37
|
+
export type { HttpParamsOptions } from "./http_params";
|
|
38
|
+
export { HttpHeaders } from "./http_headers";
|
|
39
|
+
export { HttpContext, HttpContextToken } from "./http_context";
|
|
40
|
+
export { HTTP_CLIENT_CONFIG, HTTP_INTERCEPTORS, HttpClient, HttpErrorResponse, provideHttpClient, withFetch, withRequestsMadeViaParent, } from "./http_client";
|
|
41
|
+
export type { HttpClientConfig, HttpClientFeature, HttpClientFeatureKind, HttpRequestOptions, } from "./http_client";
|
|
42
|
+
export { DefaultUrlSerializer, UrlSegmentGroup, UrlSerializer, UrlTree, } from "./url_tree";
|
|
43
|
+
export type { UrlSegment } from "./url_tree";
|
|
44
|
+
export { AbstractControl, FormArray, FormControl, FormGroup, Validators, } from "./forms";
|
|
45
|
+
export type { AbstractControlOptions, AsyncValidatorFn, FormControlStatus, ValidationErrors, ValidatorFn, } from "./forms";
|
|
46
|
+
export { booleanAttribute, numberAttribute, } from "./input_transform";
|
|
47
|
+
export { DatePipe, JsonPipe, LowerCasePipe, Pipe, TrimPipe, UpperCasePipe, getPipeMetadata, } from "./pipe";
|
|
48
|
+
export type { PipeMetadata, PipeTransform, } from "./pipe";
|