@zero-server/auth 0.9.6 → 0.9.8
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/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/auth/authorize.js +11 -11
- package/lib/auth/enrollment.js +5 -5
- package/lib/auth/jwt.js +9 -9
- package/lib/auth/oauth.js +1 -1
- package/lib/auth/session.js +5 -5
- package/lib/auth/trustedDevice.js +2 -2
- package/lib/auth/twoFactor.js +11 -11
- package/lib/auth/webauthn.js +6 -6
- package/lib/debug.js +10 -10
- package/package.json +3 -3
- package/types/body.d.ts +82 -14
- package/types/cli.d.ts +40 -2
- package/types/index.d.ts +19 -6
- package/types/middleware.d.ts +18 -72
- package/types/orm.d.ts +4 -13
- package/types/request.d.ts +3 -3
- package/types/webrtc.d.ts +501 -0
package/types/index.d.ts
CHANGED
|
@@ -11,6 +11,18 @@ export { RouterInstance, RouteChain, RouteEntry, RouteInfo, RouteOptions, RouteH
|
|
|
11
11
|
export { Request, RangeResult } from './request';
|
|
12
12
|
export { Response, SendFileOptions, CookieOptions, PushOptions } from './response';
|
|
13
13
|
export { SSEOptions, SSEStream } from './sse';
|
|
14
|
+
export {
|
|
15
|
+
createWebRTC, SignalingHub, Room as WebRTCRoom, Peer as WebRTCPeer,
|
|
16
|
+
parseSdp, stringifySdp, parseCandidate, stringifyCandidate,
|
|
17
|
+
stunBinding, encodeBindingRequest, decodeMessage,
|
|
18
|
+
encodeXorMappedAddress, decodeXorMappedAddress,
|
|
19
|
+
STUN_MAGIC_COOKIE, STUN_METHOD, STUN_CLASS, STUN_ATTR,
|
|
20
|
+
issueTurnCredentials, TurnServer, SfuAdapter,
|
|
21
|
+
signJoinToken, verifyJoinToken,
|
|
22
|
+
WebRTCOptions, RoomOptions as WebRTCRoomOptions, PeerInfo, SignalingMessage,
|
|
23
|
+
IceServerConfig, TurnCredentials, IssueTurnCredentialsOptions, ClusterAdapter as WebRTCClusterAdapter,
|
|
24
|
+
WebRTCError, SignalingError, IceError, TurnError, SdpError,
|
|
25
|
+
} from './webrtc';
|
|
14
26
|
export { LifecycleManager, LifecycleState, LIFECYCLE_STATE } from './lifecycle';
|
|
15
27
|
export { ClusterManager, ClusterOptions, cluster } from './cluster';
|
|
16
28
|
export {
|
|
@@ -85,8 +97,8 @@ export {
|
|
|
85
97
|
StoredProcedure, StoredProcedureOptions, ProcedureParam,
|
|
86
98
|
StoredFunction, StoredFunctionOptions,
|
|
87
99
|
TriggerManager, TriggerDefinition,
|
|
88
|
-
CLI, runCLI,
|
|
89
100
|
} from './orm';
|
|
101
|
+
export { CLI, runCLI } from './cli';
|
|
90
102
|
// Re-export validate from orm as schemaValidate to avoid collision with middleware validate
|
|
91
103
|
export { validate as schemaValidate } from './orm';
|
|
92
104
|
export {
|
|
@@ -149,7 +161,8 @@ import { Database, Model, Query } from './orm';
|
|
|
149
161
|
import { TYPES, validateFKAction, validateCheck } from './orm';
|
|
150
162
|
import { Migrator, QueryCache, Seeder, SeederRunner, Factory, Fake, defineMigration } from './orm';
|
|
151
163
|
import { QueryProfiler, ReplicaManager } from './orm';
|
|
152
|
-
import { TenantManager, AuditLog, PluginManager, StoredProcedure, StoredFunction, TriggerManager
|
|
164
|
+
import { TenantManager, AuditLog, PluginManager, StoredProcedure, StoredFunction, TriggerManager } from './orm';
|
|
165
|
+
import { CLI, runCLI } from './cli';
|
|
153
166
|
import { LifecycleManager, LIFECYCLE_STATE } from './lifecycle';
|
|
154
167
|
import { ClusterManager, cluster as clusterize } from './cluster';
|
|
155
168
|
import {
|
|
@@ -294,10 +307,10 @@ declare const zeroServer: {
|
|
|
294
307
|
LIFECYCLE_STATE: typeof LIFECYCLE_STATE;
|
|
295
308
|
ClusterManager: typeof ClusterManager;
|
|
296
309
|
cluster: typeof clusterize;
|
|
297
|
-
// Observability
|
|
310
|
+
// Observability - Structured Logging
|
|
298
311
|
Logger: typeof Logger;
|
|
299
312
|
structuredLogger: typeof structuredLogger;
|
|
300
|
-
// Observability
|
|
313
|
+
// Observability - Metrics
|
|
301
314
|
Counter: typeof Counter;
|
|
302
315
|
Gauge: typeof Gauge;
|
|
303
316
|
Histogram: typeof Histogram;
|
|
@@ -306,14 +319,14 @@ declare const zeroServer: {
|
|
|
306
319
|
createDefaultMetrics: typeof createDefaultMetrics;
|
|
307
320
|
metricsMiddleware: typeof metricsMiddleware;
|
|
308
321
|
metricsEndpoint: typeof metricsEndpointHandler;
|
|
309
|
-
// Observability
|
|
322
|
+
// Observability - Tracing
|
|
310
323
|
Span: typeof Span;
|
|
311
324
|
Tracer: typeof Tracer;
|
|
312
325
|
parseTraceparent: typeof parseTraceparent;
|
|
313
326
|
formatTraceparent: typeof formatTraceparent;
|
|
314
327
|
tracingMiddleware: typeof tracingMiddleware;
|
|
315
328
|
instrumentFetch: typeof instrumentFetch;
|
|
316
|
-
// Observability
|
|
329
|
+
// Observability - Health Checks
|
|
317
330
|
healthCheck: typeof healthCheck;
|
|
318
331
|
createHealthHandlers: typeof createHealthHandlers;
|
|
319
332
|
memoryCheck: typeof memoryCheck;
|
package/types/middleware.d.ts
CHANGED
|
@@ -21,77 +21,23 @@ export interface CorsOptions {
|
|
|
21
21
|
export function cors(options?: CorsOptions): MiddlewareFunction;
|
|
22
22
|
|
|
23
23
|
// --- Body Parsers ------------------------------------------------
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface JsonParserOptions extends BodyParserOptions {
|
|
43
|
-
/** JSON.parse reviver function. */
|
|
44
|
-
reviver?: (key: string, value: any) => any;
|
|
45
|
-
/** Reject non-object/array roots. Default: true. */
|
|
46
|
-
strict?: boolean;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface UrlencodedParserOptions extends BodyParserOptions {
|
|
50
|
-
/** Enable nested bracket parsing. Default: false. */
|
|
51
|
-
extended?: boolean;
|
|
52
|
-
/** Max number of parameters. Default: 1000. Prevents parameter flooding DoS. */
|
|
53
|
-
parameterLimit?: number;
|
|
54
|
-
/** Max nesting depth for bracket syntax. Default: 32. Prevents deep-nesting DoS. */
|
|
55
|
-
depth?: number;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface TextParserOptions extends BodyParserOptions {
|
|
59
|
-
/** Fallback character encoding when Content-Type has no charset. Default: 'utf8'. */
|
|
60
|
-
encoding?: BufferEncoding;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface MultipartOptions {
|
|
64
|
-
/** Upload directory (default: OS temp). */
|
|
65
|
-
dir?: string;
|
|
66
|
-
/** Maximum size per file in bytes. */
|
|
67
|
-
maxFileSize?: number;
|
|
68
|
-
/** Reject non-HTTPS requests with 403. */
|
|
69
|
-
requireSecure?: boolean;
|
|
70
|
-
/** Maximum number of non-file fields. Default: 1000. */
|
|
71
|
-
maxFields?: number;
|
|
72
|
-
/** Maximum number of uploaded files. Default: 10. */
|
|
73
|
-
maxFiles?: number;
|
|
74
|
-
/** Maximum size of a single field value in bytes. Default: 1 MB. */
|
|
75
|
-
maxFieldSize?: number;
|
|
76
|
-
/** Whitelist of allowed MIME types for uploaded files (e.g. ['image/png', 'image/jpeg']). */
|
|
77
|
-
allowedMimeTypes?: string[];
|
|
78
|
-
/** Maximum combined size of all uploaded files in bytes. */
|
|
79
|
-
maxTotalSize?: number;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export interface MultipartFile {
|
|
83
|
-
originalFilename: string;
|
|
84
|
-
storedName: string;
|
|
85
|
-
path: string;
|
|
86
|
-
contentType: string;
|
|
87
|
-
size: number;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export function json(options?: JsonParserOptions): MiddlewareFunction;
|
|
91
|
-
export function urlencoded(options?: UrlencodedParserOptions): MiddlewareFunction;
|
|
92
|
-
export function text(options?: TextParserOptions): MiddlewareFunction;
|
|
93
|
-
export function raw(options?: BodyParserOptions): MiddlewareFunction;
|
|
94
|
-
export function multipart(options?: MultipartOptions): MiddlewareFunction;
|
|
24
|
+
// Declarations live in `./body` so the standalone `@zero-server/body`
|
|
25
|
+
// package has its own self-contained type file. Re-exported here so
|
|
26
|
+
// callers using the aggregate middleware surface continue to work.
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
BodyParserOptions,
|
|
30
|
+
JsonParserOptions,
|
|
31
|
+
UrlencodedParserOptions,
|
|
32
|
+
TextParserOptions,
|
|
33
|
+
MultipartOptions,
|
|
34
|
+
MultipartFile,
|
|
35
|
+
json,
|
|
36
|
+
urlencoded,
|
|
37
|
+
text,
|
|
38
|
+
raw,
|
|
39
|
+
multipart,
|
|
40
|
+
} from './body';
|
|
95
41
|
|
|
96
42
|
// --- Rate Limiting -----------------------------------------------
|
|
97
43
|
|
|
@@ -136,7 +82,7 @@ export interface CompressOptions {
|
|
|
136
82
|
level?: number;
|
|
137
83
|
/** Force specific encoding(s). */
|
|
138
84
|
encoding?: string | string[];
|
|
139
|
-
/** Filter function
|
|
85
|
+
/** Filter function - return false to skip compression. */
|
|
140
86
|
filter?: (req: Request, res: Response) => boolean;
|
|
141
87
|
}
|
|
142
88
|
|
package/types/orm.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export interface SchemaColumnDef {
|
|
|
29
29
|
enum?: string[];
|
|
30
30
|
/** Allowed values (set type). */
|
|
31
31
|
values?: string[];
|
|
32
|
-
/** Mass-assignment protection
|
|
32
|
+
/** Mass-assignment protection - exclude from bulk writes. */
|
|
33
33
|
guarded?: boolean;
|
|
34
34
|
/** Precision for decimal types. */
|
|
35
35
|
precision?: number;
|
|
@@ -229,7 +229,7 @@ export class Query {
|
|
|
229
229
|
take(n: number): Query;
|
|
230
230
|
/** Alias for offset (LINQ naming). */
|
|
231
231
|
skip(n: number): Query;
|
|
232
|
-
/** Alias for exec
|
|
232
|
+
/** Alias for exec - explicitly convert to array. */
|
|
233
233
|
toArray(): Promise<Model[]>;
|
|
234
234
|
/** Shorthand for orderBy(field, 'desc'). */
|
|
235
235
|
orderByDesc(field: string): Query;
|
|
@@ -260,7 +260,7 @@ export class Query {
|
|
|
260
260
|
/** Inject a raw WHERE clause for SQL adapters (ignored by memory/mongo). */
|
|
261
261
|
whereRaw(sql: string, ...params: any[]): Query;
|
|
262
262
|
|
|
263
|
-
/** Thenable support
|
|
263
|
+
/** Thenable support - `await query`. */
|
|
264
264
|
then<TResult1 = Model[], TResult2 = never>(
|
|
265
265
|
onfulfilled?: ((value: Model[]) => TResult1 | PromiseLike<TResult1>) | null,
|
|
266
266
|
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null
|
|
@@ -1875,13 +1875,4 @@ export class TriggerManager {
|
|
|
1875
1875
|
get(name: string): TriggerDefinition | undefined;
|
|
1876
1876
|
}
|
|
1877
1877
|
|
|
1878
|
-
//
|
|
1879
|
-
|
|
1880
|
-
export class CLI {
|
|
1881
|
-
constructor(argv?: string[]);
|
|
1882
|
-
/** Run the CLI command. */
|
|
1883
|
-
run(): Promise<void>;
|
|
1884
|
-
}
|
|
1885
|
-
|
|
1886
|
-
/** Create and run the CLI. */
|
|
1887
|
-
export function runCLI(argv?: string[]): Promise<void>;
|
|
1878
|
+
// CLI declarations live in `./cli` (re-exported from `./index`).
|
package/types/request.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export interface Request {
|
|
|
31
31
|
readonly ips: string[];
|
|
32
32
|
/** `true` when the connection is over TLS (trust-proxy-aware). */
|
|
33
33
|
readonly secure: boolean;
|
|
34
|
-
/** Protocol string
|
|
34
|
+
/** Protocol string - `'https'` or `'http'` (trust-proxy-aware). */
|
|
35
35
|
readonly protocol: 'http' | 'https';
|
|
36
36
|
/** HTTP version string (e.g. '1.1', '2.0'). */
|
|
37
37
|
httpVersion: string;
|
|
@@ -49,7 +49,7 @@ export interface Request {
|
|
|
49
49
|
id?: string;
|
|
50
50
|
/** Whether the request timed out (populated by timeout middleware). */
|
|
51
51
|
timedOut?: boolean;
|
|
52
|
-
/** The original URL as received
|
|
52
|
+
/** The original URL as received - never rewritten by middleware. */
|
|
53
53
|
originalUrl: string;
|
|
54
54
|
/** The URL path on which the current router was mounted. */
|
|
55
55
|
baseUrl: string;
|
|
@@ -83,7 +83,7 @@ export interface Request {
|
|
|
83
83
|
subdomains(offset?: number): string[];
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
* Content negotiation
|
|
86
|
+
* Content negotiation - check which types the client accepts.
|
|
87
87
|
*/
|
|
88
88
|
accepts(...types: string[]): string | false;
|
|
89
89
|
|