alepha 0.7.5 → 0.7.7
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/cache/redis.cjs +4 -8
- package/cache/redis.d.ts +28 -89
- package/cache/redis.js +1 -1
- package/cache.cjs +4 -8
- package/cache.d.ts +189 -265
- package/cache.js +1 -1
- package/core.cjs +4 -8
- package/core.d.ts +951 -929
- package/core.js +1 -1
- package/datetime.cjs +4 -8
- package/datetime.d.ts +151 -146
- package/datetime.js +1 -1
- package/lock/redis.cjs +7 -49
- package/lock/redis.d.ts +15 -12
- package/lock/redis.js +1 -47
- package/lock.cjs +4 -8
- package/lock.d.ts +117 -170
- package/lock.js +1 -1
- package/package.json +105 -39
- package/postgres.cjs +4 -8
- package/postgres.d.ts +1410 -4433
- package/postgres.js +1 -1
- package/queue/redis.cjs +8 -0
- package/queue/redis.d.ts +31 -0
- package/queue/redis.js +1 -0
- package/queue.cjs +4 -8
- package/queue.d.ts +162 -205
- package/queue.js +1 -1
- package/react/auth.cjs +4 -8
- package/react/auth.d.ts +161 -282
- package/react/auth.js +1 -1
- package/react/head.cjs +8 -0
- package/react/head.d.ts +86 -0
- package/react/head.js +1 -0
- package/react.cjs +4 -8
- package/react.d.ts +468 -559
- package/react.js +1 -1
- package/redis.cjs +4 -8
- package/redis.d.ts +59 -132
- package/redis.js +1 -1
- package/retry.cjs +4 -8
- package/retry.d.ts +34 -31
- package/retry.js +1 -1
- package/scheduler.cjs +4 -8
- package/scheduler.d.ts +124 -182
- package/scheduler.js +1 -1
- package/security.cjs +4 -8
- package/security.d.ts +459 -595
- package/security.js +1 -1
- package/server/cache.cjs +4 -8
- package/server/cache.d.ts +43 -40
- package/server/cache.js +1 -1
- package/server/cookies.cjs +4 -8
- package/server/cookies.d.ts +49 -41
- package/server/cookies.js +1 -1
- package/server/cors.cjs +8 -0
- package/server/cors.d.ts +25 -0
- package/server/cors.js +1 -0
- package/server/health.cjs +8 -0
- package/server/health.d.ts +42 -0
- package/server/health.js +1 -0
- package/server/links.cjs +8 -0
- package/server/links.d.ts +188 -0
- package/server/links.js +1 -0
- package/server/proxy.cjs +8 -0
- package/server/proxy.d.ts +41 -0
- package/server/proxy.js +1 -0
- package/server/static.cjs +4 -8
- package/server/static.d.ts +98 -95
- package/server/static.js +1 -1
- package/server/swagger.cjs +4 -8
- package/server/swagger.d.ts +96 -92
- package/server/swagger.js +1 -1
- package/server.cjs +4 -8
- package/server.d.ts +602 -1087
- package/server.js +1 -1
- package/testing.cjs +8 -0
- package/testing.d.ts +1 -0
- package/testing.js +1 -0
- package/topic/redis.cjs +8 -0
- package/topic/redis.d.ts +45 -0
- package/topic/redis.js +1 -0
- package/topic.cjs +4 -8
- package/topic.d.ts +161 -169
- package/topic.js +1 -1
- package/vite.cjs +4 -8
- package/vite.d.ts +89 -82
- package/vite.js +1 -1
- package/src/cache/redis.ts +0 -1
- package/src/cache.ts +0 -1
- package/src/core.ts +0 -1
- package/src/datetime.ts +0 -1
- package/src/lock/redis.ts +0 -1
- package/src/lock.ts +0 -1
- package/src/postgres.ts +0 -1
- package/src/queue/redis.ts +0 -1
- package/src/queue.ts +0 -1
- package/src/react/auth.ts +0 -1
- package/src/react.ts +0 -1
- package/src/redis.ts +0 -1
- package/src/retry.ts +0 -1
- package/src/scheduler.ts +0 -1
- package/src/security.ts +0 -1
- package/src/server/cache.ts +0 -1
- package/src/server/cookies.ts +0 -1
- package/src/server/static.ts +0 -1
- package/src/server/swagger.ts +0 -1
- package/src/server.ts +0 -1
- package/src/topic/redis.ts +0 -1
- package/src/topic.ts +0 -1
- package/src/vite.ts +0 -1
package/react/auth.d.ts
CHANGED
|
@@ -1,307 +1,185 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import * as
|
|
5
|
-
import {
|
|
6
|
-
import * as
|
|
7
|
-
import {
|
|
8
|
-
import { Configuration } from
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/** Symbol key applied to optional types */
|
|
13
|
-
declare const OptionalKind: unique symbol;
|
|
14
|
-
/** Symbol key applied to types */
|
|
15
|
-
declare const Hint: unique symbol;
|
|
16
|
-
/** Symbol key applied to types */
|
|
17
|
-
declare const Kind: unique symbol;
|
|
18
|
-
|
|
19
|
-
type TReadonly<T extends TSchema> = T & {
|
|
20
|
-
[ReadonlyKind]: 'Readonly';
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
type StringFormatOption = 'date-time' | 'time' | 'date' | 'email' | 'idn-email' | 'hostname' | 'idn-hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'iri' | 'uuid' | 'iri-reference' | 'uri-template' | 'json-pointer' | 'relative-json-pointer' | 'regex' | ({} & string);
|
|
24
|
-
type StringContentEncodingOption = '7bit' | '8bit' | 'binary' | 'quoted-printable' | 'base64' | ({} & string);
|
|
25
|
-
interface StringOptions extends SchemaOptions {
|
|
26
|
-
/** The maximum string length */
|
|
27
|
-
maxLength?: number;
|
|
28
|
-
/** The minimum string length */
|
|
29
|
-
minLength?: number;
|
|
30
|
-
/** A regular expression pattern this string should match */
|
|
31
|
-
pattern?: string;
|
|
32
|
-
/** A format this string should match */
|
|
33
|
-
format?: StringFormatOption;
|
|
34
|
-
/** The content encoding for this string */
|
|
35
|
-
contentEncoding?: StringContentEncodingOption;
|
|
36
|
-
/** The content media type for this string */
|
|
37
|
-
contentMediaType?: string;
|
|
38
|
-
}
|
|
39
|
-
interface TString extends TSchema, StringOptions {
|
|
40
|
-
[Kind]: 'String';
|
|
41
|
-
static: string;
|
|
42
|
-
type: 'string';
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
interface NumberOptions extends SchemaOptions {
|
|
46
|
-
exclusiveMaximum?: number;
|
|
47
|
-
exclusiveMinimum?: number;
|
|
48
|
-
maximum?: number;
|
|
49
|
-
minimum?: number;
|
|
50
|
-
multipleOf?: number;
|
|
51
|
-
}
|
|
52
|
-
interface TNumber extends TSchema, NumberOptions {
|
|
53
|
-
[Kind]: 'Number';
|
|
54
|
-
static: number;
|
|
55
|
-
type: 'number';
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
type TOptional<T extends TSchema> = T & {
|
|
59
|
-
[OptionalKind]: 'Optional';
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
/** Creates a static type from a TypeBox type */
|
|
63
|
-
type Static<Type extends TSchema, Params extends unknown[] = [], Result = (Type & {
|
|
64
|
-
params: Params;
|
|
65
|
-
})['static']> = Result;
|
|
66
|
-
|
|
67
|
-
type ReadonlyOptionalPropertyKeys<T extends TProperties> = {
|
|
68
|
-
[K in keyof T]: T[K] extends TReadonly<TSchema> ? (T[K] extends TOptional<T[K]> ? K : never) : never;
|
|
69
|
-
}[keyof T];
|
|
70
|
-
type ReadonlyPropertyKeys<T extends TProperties> = {
|
|
71
|
-
[K in keyof T]: T[K] extends TReadonly<TSchema> ? (T[K] extends TOptional<T[K]> ? never : K) : never;
|
|
72
|
-
}[keyof T];
|
|
73
|
-
type OptionalPropertyKeys<T extends TProperties> = {
|
|
74
|
-
[K in keyof T]: T[K] extends TOptional<TSchema> ? (T[K] extends TReadonly<T[K]> ? never : K) : never;
|
|
75
|
-
}[keyof T];
|
|
76
|
-
type RequiredPropertyKeys<T extends TProperties> = keyof Omit<T, ReadonlyOptionalPropertyKeys<T> | ReadonlyPropertyKeys<T> | OptionalPropertyKeys<T>>;
|
|
77
|
-
type ObjectStaticProperties<T extends TProperties, R extends Record<keyof any, unknown>> = Evaluate<(Readonly<Partial<Pick<R, ReadonlyOptionalPropertyKeys<T>>>> & Readonly<Pick<R, ReadonlyPropertyKeys<T>>> & Partial<Pick<R, OptionalPropertyKeys<T>>> & Required<Pick<R, RequiredPropertyKeys<T>>>)>;
|
|
78
|
-
type ObjectStatic<T extends TProperties, P extends unknown[]> = ObjectStaticProperties<T, {
|
|
79
|
-
[K in keyof T]: Static<T[K], P>;
|
|
80
|
-
}>;
|
|
81
|
-
type TPropertyKey = string | number;
|
|
82
|
-
type TProperties = Record<TPropertyKey, TSchema>;
|
|
83
|
-
type TAdditionalProperties = undefined | TSchema | boolean;
|
|
84
|
-
interface ObjectOptions extends SchemaOptions {
|
|
85
|
-
/** Additional property constraints for this object */
|
|
86
|
-
additionalProperties?: TAdditionalProperties;
|
|
87
|
-
/** The minimum number of properties allowed on this object */
|
|
88
|
-
minProperties?: number;
|
|
89
|
-
/** The maximum number of properties allowed on this object */
|
|
90
|
-
maxProperties?: number;
|
|
91
|
-
}
|
|
92
|
-
interface TObject<T extends TProperties = TProperties> extends TSchema, ObjectOptions {
|
|
93
|
-
[Kind]: 'Object';
|
|
94
|
-
static: ObjectStatic<T, this['params']>;
|
|
95
|
-
additionalProperties?: TAdditionalProperties;
|
|
96
|
-
type: 'object';
|
|
97
|
-
properties: T;
|
|
98
|
-
required?: string[];
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
type Evaluate<T> = T extends infer O ? {
|
|
102
|
-
[K in keyof O]: O[K];
|
|
103
|
-
} : never;
|
|
104
|
-
|
|
105
|
-
interface SchemaOptions {
|
|
106
|
-
$schema?: string;
|
|
107
|
-
/** Id for this schema */
|
|
108
|
-
$id?: string;
|
|
109
|
-
/** Title of this schema */
|
|
110
|
-
title?: string;
|
|
111
|
-
/** Description of this schema */
|
|
112
|
-
description?: string;
|
|
113
|
-
/** Default value for this schema */
|
|
114
|
-
default?: any;
|
|
115
|
-
/** Example values matching this schema */
|
|
116
|
-
examples?: any;
|
|
117
|
-
/** Optional annotation for readOnly */
|
|
118
|
-
readOnly?: boolean;
|
|
119
|
-
/** Optional annotation for writeOnly */
|
|
120
|
-
writeOnly?: boolean;
|
|
121
|
-
[prop: string]: any;
|
|
122
|
-
}
|
|
123
|
-
interface TKind {
|
|
124
|
-
[Kind]: string;
|
|
125
|
-
}
|
|
126
|
-
interface TSchema extends TKind, SchemaOptions {
|
|
127
|
-
[ReadonlyKind]?: string;
|
|
128
|
-
[OptionalKind]?: string;
|
|
129
|
-
[Hint]?: string;
|
|
130
|
-
params: unknown[];
|
|
131
|
-
static: unknown;
|
|
132
|
-
}
|
|
1
|
+
import * as _alepha_core1 from "@alepha/core";
|
|
2
|
+
import * as _alepha_core52 from "@alepha/core";
|
|
3
|
+
import { Alepha, Async, KIND, Module, OPTIONS } from "@alepha/core";
|
|
4
|
+
import * as _alepha_server_cookies7 from "@alepha/server-cookies";
|
|
5
|
+
import { Cookies, ServerCookiesProvider } from "@alepha/server-cookies";
|
|
6
|
+
import * as _alepha_server41 from "@alepha/server";
|
|
7
|
+
import { HttpClient } from "@alepha/server";
|
|
8
|
+
import { Configuration } from "openid-client";
|
|
9
|
+
import { HttpVirtualClient } from "@alepha/server-links";
|
|
10
|
+
import { UserAccountToken } from "@alepha/security";
|
|
11
|
+
import * as _sinclair_typebox2 from "@sinclair/typebox";
|
|
133
12
|
|
|
13
|
+
//#region src/descriptors/$auth.d.ts
|
|
134
14
|
declare const KEY = "AUTH";
|
|
135
15
|
type AccessToken = string;
|
|
136
16
|
interface AuthDescriptorOptions {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
17
|
+
name?: string;
|
|
18
|
+
fallback?: () => Async<AccessToken>;
|
|
19
|
+
oidc?: {
|
|
20
|
+
issuer: string;
|
|
21
|
+
clientId: string;
|
|
22
|
+
clientSecret?: string;
|
|
23
|
+
redirectUri?: string;
|
|
24
|
+
useIdToken?: boolean;
|
|
25
|
+
logoutUri?: string;
|
|
26
|
+
};
|
|
147
27
|
}
|
|
148
28
|
interface AuthDescriptor {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
29
|
+
[KIND]: typeof KEY;
|
|
30
|
+
[OPTIONS]: AuthDescriptorOptions;
|
|
31
|
+
jwks: () => string;
|
|
152
32
|
}
|
|
153
33
|
declare const $auth: {
|
|
154
|
-
|
|
155
|
-
|
|
34
|
+
(options: AuthDescriptorOptions): AuthDescriptor;
|
|
35
|
+
[KIND]: string;
|
|
156
36
|
};
|
|
157
|
-
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/providers/ReactAuthProvider.d.ts
|
|
158
39
|
declare class ReactAuthProvider {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
query: TObject<{
|
|
200
|
-
redirect: TOptional<TString>;
|
|
201
|
-
provider: TOptional<TString>;
|
|
202
|
-
}>;
|
|
203
|
-
}>;
|
|
204
|
-
/**
|
|
205
|
-
*
|
|
206
|
-
*/
|
|
207
|
-
readonly callback: _alepha_server.RouteDescriptor<{
|
|
208
|
-
query: TObject<{
|
|
209
|
-
provider: TOptional<TString>;
|
|
210
|
-
}>;
|
|
40
|
+
protected readonly log: _alepha_core1.Logger;
|
|
41
|
+
protected readonly alepha: Alepha;
|
|
42
|
+
protected readonly serverCookiesProvider: ServerCookiesProvider;
|
|
43
|
+
protected authProviders: AuthProvider[];
|
|
44
|
+
protected readonly authorizationCode: _alepha_server_cookies7.CookieDescriptor<_sinclair_typebox2.TObject<{
|
|
45
|
+
codeVerifier: _sinclair_typebox2.TOptional<_sinclair_typebox2.TString>;
|
|
46
|
+
redirectUri: _sinclair_typebox2.TOptional<_sinclair_typebox2.TString>;
|
|
47
|
+
}>>;
|
|
48
|
+
protected readonly tokens: _alepha_server_cookies7.CookieDescriptor<_sinclair_typebox2.TObject<{
|
|
49
|
+
provider: _sinclair_typebox2.TOptional<_sinclair_typebox2.TString>;
|
|
50
|
+
access_token: _sinclair_typebox2.TOptional<_sinclair_typebox2.TString>;
|
|
51
|
+
expires_in: _sinclair_typebox2.TOptional<_sinclair_typebox2.TNumber>;
|
|
52
|
+
refresh_token: _sinclair_typebox2.TOptional<_sinclair_typebox2.TString>;
|
|
53
|
+
id_token: _sinclair_typebox2.TOptional<_sinclair_typebox2.TString>;
|
|
54
|
+
scope: _sinclair_typebox2.TOptional<_sinclair_typebox2.TString>;
|
|
55
|
+
issued_at: _sinclair_typebox2.TOptional<_sinclair_typebox2.TNumber>;
|
|
56
|
+
}>>;
|
|
57
|
+
readonly user: _alepha_server_cookies7.CookieDescriptor<_sinclair_typebox2.TObject<{
|
|
58
|
+
id: _sinclair_typebox2.TString;
|
|
59
|
+
name: _sinclair_typebox2.TOptional<_sinclair_typebox2.TString>;
|
|
60
|
+
email: _sinclair_typebox2.TOptional<_sinclair_typebox2.TString>;
|
|
61
|
+
picture: _sinclair_typebox2.TOptional<_sinclair_typebox2.TString>;
|
|
62
|
+
}>>;
|
|
63
|
+
readonly onRender: _alepha_core1.HookDescriptor<"react:server:render:begin">;
|
|
64
|
+
protected readonly configure: _alepha_core1.HookDescriptor<"configure">;
|
|
65
|
+
protected getAccessTokenFromCookies(tokens: SessionTokens): Promise<string | undefined>;
|
|
66
|
+
/**
|
|
67
|
+
* Configure Fastify to forward Session Access Token to Header Authorization.
|
|
68
|
+
*/
|
|
69
|
+
protected readonly onRequest: _alepha_core1.HookDescriptor<"server:onRequest">;
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @param cookies
|
|
73
|
+
* @protected
|
|
74
|
+
*/
|
|
75
|
+
protected refresh(cookies: Cookies): Promise<SessionTokens | undefined>;
|
|
76
|
+
readonly login: _alepha_server41.RouteDescriptor<{
|
|
77
|
+
query: _sinclair_typebox2.TObject<{
|
|
78
|
+
redirect: _sinclair_typebox2.TOptional<_sinclair_typebox2.TString>;
|
|
79
|
+
provider: _sinclair_typebox2.TOptional<_sinclair_typebox2.TString>;
|
|
211
80
|
}>;
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
*/
|
|
217
|
-
protected userFromAccessToken(accessToken: string): {
|
|
218
|
-
id: any;
|
|
219
|
-
name: any;
|
|
220
|
-
email: any;
|
|
221
|
-
picture: any;
|
|
222
|
-
} | undefined;
|
|
223
|
-
readonly logout: _alepha_server.RouteDescriptor<{
|
|
224
|
-
query: TObject<{
|
|
225
|
-
redirect: TOptional<TString>;
|
|
226
|
-
provider: TOptional<TString>;
|
|
227
|
-
}>;
|
|
81
|
+
}>;
|
|
82
|
+
readonly callback: _alepha_server41.RouteDescriptor<{
|
|
83
|
+
query: _sinclair_typebox2.TObject<{
|
|
84
|
+
provider: _sinclair_typebox2.TOptional<_sinclair_typebox2.TString>;
|
|
228
85
|
}>;
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
86
|
+
}>;
|
|
87
|
+
/**
|
|
88
|
+
*
|
|
89
|
+
* @param accessToken
|
|
90
|
+
* @protected
|
|
91
|
+
*/
|
|
92
|
+
protected userFromAccessToken(accessToken: string): {
|
|
93
|
+
id: any;
|
|
94
|
+
name: any;
|
|
95
|
+
email: any;
|
|
96
|
+
picture: any;
|
|
97
|
+
} | undefined;
|
|
98
|
+
readonly logout: _alepha_server41.RouteDescriptor<{
|
|
99
|
+
query: _sinclair_typebox2.TObject<{
|
|
100
|
+
redirect: _sinclair_typebox2.TOptional<_sinclair_typebox2.TString>;
|
|
101
|
+
provider: _sinclair_typebox2.TOptional<_sinclair_typebox2.TString>;
|
|
241
102
|
}>;
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
access_token?: string;
|
|
251
|
-
expires_in?: number;
|
|
252
|
-
refresh_token?: string;
|
|
253
|
-
id_token?: string;
|
|
254
|
-
scope?: string;
|
|
255
|
-
issued_at?: number;
|
|
256
|
-
provider?: string;
|
|
257
|
-
}
|
|
258
|
-
interface AuthProvider {
|
|
103
|
+
}>;
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
* @param name
|
|
107
|
+
* @protected
|
|
108
|
+
*/
|
|
109
|
+
protected provider(name?: string): Promise<{
|
|
110
|
+
client: Configuration;
|
|
259
111
|
name: string;
|
|
260
112
|
redirectUri: string;
|
|
261
|
-
client: {
|
|
262
|
-
get: () => Promise<Configuration>;
|
|
263
|
-
};
|
|
264
113
|
fallback?: () => Async<AccessToken>;
|
|
265
114
|
useIdToken?: boolean;
|
|
266
115
|
logoutUri?: string;
|
|
116
|
+
}>;
|
|
117
|
+
/**
|
|
118
|
+
*
|
|
119
|
+
* @param file
|
|
120
|
+
* @protected
|
|
121
|
+
*/
|
|
122
|
+
protected isViteFile(file: string): boolean;
|
|
123
|
+
}
|
|
124
|
+
interface SessionTokens {
|
|
125
|
+
access_token?: string;
|
|
126
|
+
expires_in?: number;
|
|
127
|
+
refresh_token?: string;
|
|
128
|
+
id_token?: string;
|
|
129
|
+
scope?: string;
|
|
130
|
+
issued_at?: number;
|
|
131
|
+
provider?: string;
|
|
132
|
+
}
|
|
133
|
+
interface AuthProvider {
|
|
134
|
+
name: string;
|
|
135
|
+
redirectUri: string;
|
|
136
|
+
client: {
|
|
137
|
+
get: () => Promise<Configuration>;
|
|
138
|
+
};
|
|
139
|
+
fallback?: () => Async<AccessToken>;
|
|
140
|
+
useIdToken?: boolean;
|
|
141
|
+
logoutUri?: string;
|
|
267
142
|
}
|
|
268
143
|
interface ReactUser {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
144
|
+
id: string;
|
|
145
|
+
name?: string;
|
|
146
|
+
email?: string;
|
|
272
147
|
}
|
|
273
|
-
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/hooks/useAuth.d.ts
|
|
274
150
|
declare const useAuth: () => AuthHook;
|
|
275
151
|
interface AuthHook {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
152
|
+
user?: UserAccountToken;
|
|
153
|
+
logout: () => void;
|
|
154
|
+
login: (provider?: string) => void;
|
|
155
|
+
can: <T extends object>(name: keyof HttpVirtualClient<T>) => boolean;
|
|
280
156
|
}
|
|
281
|
-
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/services/ReactAuth.d.ts
|
|
282
159
|
declare class ReactAuth {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
|
|
160
|
+
protected readonly log: _alepha_core52.Logger;
|
|
161
|
+
protected readonly alepha: Alepha;
|
|
162
|
+
protected readonly client: HttpClient;
|
|
163
|
+
static path: {
|
|
164
|
+
login: string;
|
|
165
|
+
callback: string;
|
|
166
|
+
logout: string;
|
|
167
|
+
};
|
|
168
|
+
readonly onRender: _alepha_core52.HookDescriptor<"react:transition:begin">;
|
|
169
|
+
get user(): UserAccountToken | undefined;
|
|
170
|
+
protected getUserFromCookies(): UserAccountToken | undefined;
|
|
171
|
+
login(): void;
|
|
172
|
+
logout(): void;
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/index.d.ts
|
|
298
176
|
declare module "alepha/react" {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
177
|
+
interface PageReactContext {
|
|
178
|
+
user?: UserAccountToken;
|
|
179
|
+
}
|
|
180
|
+
interface ReactHydrationState {
|
|
181
|
+
user?: ReactUser;
|
|
182
|
+
}
|
|
305
183
|
}
|
|
306
184
|
/**
|
|
307
185
|
* Alepha React Authentication Module
|
|
@@ -312,8 +190,9 @@ declare module "alepha/react" {
|
|
|
312
190
|
* @module alepha.react.auth
|
|
313
191
|
*/
|
|
314
192
|
declare class AlephaReactAuth implements Module {
|
|
315
|
-
|
|
316
|
-
|
|
193
|
+
readonly name = "alepha.react.auth";
|
|
194
|
+
readonly $services: (alepha: Alepha) => void;
|
|
317
195
|
}
|
|
318
|
-
|
|
319
|
-
export { $auth,
|
|
196
|
+
//#endregion
|
|
197
|
+
export { $auth, AccessToken, AlephaReactAuth, AuthDescriptor, AuthDescriptorOptions, AuthHook, AuthProvider, ReactAuth, ReactAuthProvider, ReactUser, SessionTokens, useAuth };
|
|
198
|
+
//# sourceMappingURL=index.d.ts.map
|
package/react/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '@alepha/react-auth'
|
|
1
|
+
export * from '@alepha/react-auth'
|
package/react/head.cjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var m = require('@alepha/react-head');
|
|
3
|
+
Object.keys(m).forEach(function (k) {
|
|
4
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: function () { return m[k]; }
|
|
7
|
+
});
|
|
8
|
+
});
|
package/react/head.d.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { PageConfigSchema, PageReactContext, PageRoute, RouterState, TPropsDefault, TPropsParentDefault } from "@alepha/react";
|
|
2
|
+
import * as _alepha_core1 from "@alepha/core";
|
|
3
|
+
import { Alepha, Module } from "@alepha/core";
|
|
4
|
+
|
|
5
|
+
//#region src/interfaces/Head.d.ts
|
|
6
|
+
interface Head extends SimpleHead {
|
|
7
|
+
description?: string;
|
|
8
|
+
keywords?: string[];
|
|
9
|
+
author?: string;
|
|
10
|
+
robots?: string;
|
|
11
|
+
themeColor?: string;
|
|
12
|
+
viewport?: string | {
|
|
13
|
+
width?: string;
|
|
14
|
+
height?: string;
|
|
15
|
+
initialScale?: string;
|
|
16
|
+
maximumScale?: string;
|
|
17
|
+
userScalable?: "no" | "yes" | "0" | "1";
|
|
18
|
+
interactiveWidget?: "resizes-visual" | "resizes-content" | "overlays-content";
|
|
19
|
+
};
|
|
20
|
+
og?: {
|
|
21
|
+
title?: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
image?: string;
|
|
24
|
+
url?: string;
|
|
25
|
+
type?: string;
|
|
26
|
+
};
|
|
27
|
+
twitter?: {
|
|
28
|
+
card?: string;
|
|
29
|
+
title?: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
image?: string;
|
|
32
|
+
site?: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
interface SimpleHead {
|
|
36
|
+
title?: string;
|
|
37
|
+
titleSeparator?: string;
|
|
38
|
+
htmlAttributes?: Record<string, string>;
|
|
39
|
+
bodyAttributes?: Record<string, string>;
|
|
40
|
+
meta?: Array<{
|
|
41
|
+
name: string;
|
|
42
|
+
content: string;
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/hooks/useHead.d.ts
|
|
47
|
+
declare const useHead: (head?: Head | ((previous?: Head) => Head)) => void;
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/providers/HeadProvider.d.ts
|
|
50
|
+
declare class HeadProvider {
|
|
51
|
+
fillHead(state: RouterState, context: PageReactContext): void;
|
|
52
|
+
protected fillHeadByPage(page: PageRoute, context: PageReactContext, props: Record<string, any>): void;
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/providers/ServerHeadProvider.d.ts
|
|
56
|
+
declare class ServerHeadProvider {
|
|
57
|
+
protected readonly headProvider: HeadProvider;
|
|
58
|
+
protected readonly onServerRenderEnd: _alepha_core1.HookDescriptor<"react:server:render:end">;
|
|
59
|
+
renderHead(template: string, head: SimpleHead): string;
|
|
60
|
+
protected mergeAttributes(existing: string, attrs: Record<string, string>): string;
|
|
61
|
+
protected parseAttributes(attrStr: string): Record<string, string>;
|
|
62
|
+
protected escapeHtml(str: string): string;
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/index.d.ts
|
|
66
|
+
declare module "alepha/react" {
|
|
67
|
+
interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
|
|
68
|
+
head?: Head | ((props: TProps, previous?: Head) => Head);
|
|
69
|
+
}
|
|
70
|
+
interface PageReactContext {
|
|
71
|
+
head: Head;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Alepha React Head Module
|
|
76
|
+
*
|
|
77
|
+
* @see {@link ServerHeadProvider}
|
|
78
|
+
* @module alepha.react.head
|
|
79
|
+
*/
|
|
80
|
+
declare class AlephaReactHead implements Module {
|
|
81
|
+
readonly name = "alepha.react.head";
|
|
82
|
+
readonly $services: (alepha: Alepha) => Alepha;
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
export { AlephaReactHead, Head, ServerHeadProvider, SimpleHead, useHead };
|
|
86
|
+
//# sourceMappingURL=index.d.ts.map
|
package/react/head.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@alepha/react-head'
|
package/react.cjs
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.keys(react).forEach(function (k) {
|
|
2
|
+
var m = require('@alepha/react');
|
|
3
|
+
Object.keys(m).forEach(function (k) {
|
|
8
4
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
9
5
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
6
|
+
get: function () { return m[k]; }
|
|
11
7
|
});
|
|
12
|
-
});
|
|
8
|
+
});
|