@devshub198211/devguard 2.0.1
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/CHANGELOG.md +35 -0
- package/LICENSE +21 -0
- package/README.md +207 -0
- package/dist/ai.cjs +867 -0
- package/dist/ai.d.cts +169 -0
- package/dist/ai.d.ts +169 -0
- package/dist/ai.js +2 -0
- package/dist/api-contract-5kJEwFIh.d.cts +157 -0
- package/dist/api-contract-5kJEwFIh.d.ts +157 -0
- package/dist/auth.cjs +787 -0
- package/dist/auth.d.cts +245 -0
- package/dist/auth.d.ts +245 -0
- package/dist/auth.js +1 -0
- package/dist/chunk-3SMY53XX.js +747 -0
- package/dist/chunk-4WCL5IUZ.js +493 -0
- package/dist/chunk-6IXDDYYA.js +345 -0
- package/dist/chunk-D7GNA6TS.js +611 -0
- package/dist/chunk-KSFZPDFO.js +366 -0
- package/dist/chunk-MT3VUCLS.js +35 -0
- package/dist/cli.cjs +1162 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +270 -0
- package/dist/dx.cjs +747 -0
- package/dist/dx.d.cts +96 -0
- package/dist/dx.d.ts +96 -0
- package/dist/dx.js +2 -0
- package/dist/index.cjs +2655 -0
- package/dist/index.d.cts +38 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +6 -0
- package/dist/security.cjs +654 -0
- package/dist/security.d.cts +114 -0
- package/dist/security.d.ts +114 -0
- package/dist/security.js +1 -0
- package/package.json +96 -0
package/dist/dx.d.cts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
export { I as Infer, P as ParseResult, S as Schema, V as ValidationError, c, t as typedFetch, v as validateBody, a as validateQuery } from './api-contract-5kJEwFIh.cjs';
|
|
2
|
+
|
|
3
|
+
declare function parseDotenv(content: string): Record<string, string>;
|
|
4
|
+
declare function loadDotenvFile(filePath: string): Record<string, string>;
|
|
5
|
+
type FieldType = "string" | "number" | "integer" | "boolean" | "url" | "email" | "json" | "csv";
|
|
6
|
+
interface FieldSpec {
|
|
7
|
+
type: FieldType;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
default?: string;
|
|
10
|
+
min?: number;
|
|
11
|
+
max?: number;
|
|
12
|
+
minLength?: number;
|
|
13
|
+
maxLength?: number;
|
|
14
|
+
enum?: string[];
|
|
15
|
+
regex?: RegExp;
|
|
16
|
+
description?: string;
|
|
17
|
+
secret?: boolean;
|
|
18
|
+
example?: string;
|
|
19
|
+
}
|
|
20
|
+
type EnvSchema = Record<string, FieldSpec>;
|
|
21
|
+
type ParsedEnv<S extends EnvSchema> = {
|
|
22
|
+
[K in keyof S]: S[K]["type"] extends "number" | "integer" ? number : S[K]["type"] extends "boolean" ? boolean : S[K]["type"] extends "json" ? any : S[K]["type"] extends "csv" ? string[] : string;
|
|
23
|
+
};
|
|
24
|
+
declare function parseEnv<S extends EnvSchema>(schema: S, source?: Record<string, string | undefined>): ParsedEnv<S>;
|
|
25
|
+
/** Load .env file(s), merge with process.env, validate, return typed object */
|
|
26
|
+
declare function loadEnv<S extends EnvSchema>(schema: S, opts?: {
|
|
27
|
+
envFiles?: string[];
|
|
28
|
+
override?: boolean;
|
|
29
|
+
quiet?: boolean;
|
|
30
|
+
}): ParsedEnv<S>;
|
|
31
|
+
/** Generate a .env.example file from schema */
|
|
32
|
+
declare function generateExample(schema: EnvSchema): string;
|
|
33
|
+
|
|
34
|
+
type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "fatal";
|
|
35
|
+
type LogOutput = "json" | "pretty" | "silent";
|
|
36
|
+
interface LogRecord {
|
|
37
|
+
level: LogLevel;
|
|
38
|
+
levelNum: number;
|
|
39
|
+
msg: string;
|
|
40
|
+
time: string;
|
|
41
|
+
pid: number;
|
|
42
|
+
hostname: string;
|
|
43
|
+
traceId?: string;
|
|
44
|
+
spanId?: string;
|
|
45
|
+
service?: string;
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
}
|
|
48
|
+
interface OTLPConfig {
|
|
49
|
+
endpoint: string;
|
|
50
|
+
headers?: Record<string, string>;
|
|
51
|
+
batchSize?: number;
|
|
52
|
+
flushIntervalMs?: number;
|
|
53
|
+
}
|
|
54
|
+
interface LoggerOptions {
|
|
55
|
+
service?: string;
|
|
56
|
+
level?: LogLevel;
|
|
57
|
+
output?: LogOutput;
|
|
58
|
+
redact?: string[];
|
|
59
|
+
otlp?: OTLPConfig;
|
|
60
|
+
traceContext?: () => {
|
|
61
|
+
traceId?: string;
|
|
62
|
+
spanId?: string;
|
|
63
|
+
} | null;
|
|
64
|
+
destination?: NodeJS.WritableStream;
|
|
65
|
+
}
|
|
66
|
+
declare class Logger {
|
|
67
|
+
private opts;
|
|
68
|
+
private minLevel;
|
|
69
|
+
private redactSet;
|
|
70
|
+
private exporter;
|
|
71
|
+
private dest;
|
|
72
|
+
private bindings;
|
|
73
|
+
constructor(opts: LoggerOptions, bindings?: Record<string, any>);
|
|
74
|
+
private log;
|
|
75
|
+
trace(msg: string, data?: Record<string, any>): void;
|
|
76
|
+
debug(msg: string, data?: Record<string, any>): void;
|
|
77
|
+
info(msg: string, data?: Record<string, any>): void;
|
|
78
|
+
warn(msg: string, data?: Record<string, any>): void;
|
|
79
|
+
error(msg: string, data?: Record<string, any>): void;
|
|
80
|
+
fatal(msg: string, data?: Record<string, any>): void;
|
|
81
|
+
/** Create a child logger with additional bound fields */
|
|
82
|
+
child(bindings: Record<string, any>): Logger;
|
|
83
|
+
/** Attach trace context for automatic injection */
|
|
84
|
+
withTrace(ctx: {
|
|
85
|
+
traceId?: string;
|
|
86
|
+
spanId?: string;
|
|
87
|
+
}): Logger;
|
|
88
|
+
/** Flush OTLP buffer before process exit */
|
|
89
|
+
flush(): void;
|
|
90
|
+
destroy(): void;
|
|
91
|
+
/** Middleware: log all HTTP requests */
|
|
92
|
+
requestMiddleware(): (req: any, res: any, next: any) => void;
|
|
93
|
+
}
|
|
94
|
+
declare function createLogger(opts?: LoggerOptions): Logger;
|
|
95
|
+
|
|
96
|
+
export { type EnvSchema, type FieldSpec, type FieldType, type LogLevel, type LogOutput, type LogRecord, Logger, type LoggerOptions, type OTLPConfig, type ParsedEnv, createLogger, generateExample, loadDotenvFile, loadEnv, parseDotenv, parseEnv };
|
package/dist/dx.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
export { I as Infer, P as ParseResult, S as Schema, V as ValidationError, c, t as typedFetch, v as validateBody, a as validateQuery } from './api-contract-5kJEwFIh.js';
|
|
2
|
+
|
|
3
|
+
declare function parseDotenv(content: string): Record<string, string>;
|
|
4
|
+
declare function loadDotenvFile(filePath: string): Record<string, string>;
|
|
5
|
+
type FieldType = "string" | "number" | "integer" | "boolean" | "url" | "email" | "json" | "csv";
|
|
6
|
+
interface FieldSpec {
|
|
7
|
+
type: FieldType;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
default?: string;
|
|
10
|
+
min?: number;
|
|
11
|
+
max?: number;
|
|
12
|
+
minLength?: number;
|
|
13
|
+
maxLength?: number;
|
|
14
|
+
enum?: string[];
|
|
15
|
+
regex?: RegExp;
|
|
16
|
+
description?: string;
|
|
17
|
+
secret?: boolean;
|
|
18
|
+
example?: string;
|
|
19
|
+
}
|
|
20
|
+
type EnvSchema = Record<string, FieldSpec>;
|
|
21
|
+
type ParsedEnv<S extends EnvSchema> = {
|
|
22
|
+
[K in keyof S]: S[K]["type"] extends "number" | "integer" ? number : S[K]["type"] extends "boolean" ? boolean : S[K]["type"] extends "json" ? any : S[K]["type"] extends "csv" ? string[] : string;
|
|
23
|
+
};
|
|
24
|
+
declare function parseEnv<S extends EnvSchema>(schema: S, source?: Record<string, string | undefined>): ParsedEnv<S>;
|
|
25
|
+
/** Load .env file(s), merge with process.env, validate, return typed object */
|
|
26
|
+
declare function loadEnv<S extends EnvSchema>(schema: S, opts?: {
|
|
27
|
+
envFiles?: string[];
|
|
28
|
+
override?: boolean;
|
|
29
|
+
quiet?: boolean;
|
|
30
|
+
}): ParsedEnv<S>;
|
|
31
|
+
/** Generate a .env.example file from schema */
|
|
32
|
+
declare function generateExample(schema: EnvSchema): string;
|
|
33
|
+
|
|
34
|
+
type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "fatal";
|
|
35
|
+
type LogOutput = "json" | "pretty" | "silent";
|
|
36
|
+
interface LogRecord {
|
|
37
|
+
level: LogLevel;
|
|
38
|
+
levelNum: number;
|
|
39
|
+
msg: string;
|
|
40
|
+
time: string;
|
|
41
|
+
pid: number;
|
|
42
|
+
hostname: string;
|
|
43
|
+
traceId?: string;
|
|
44
|
+
spanId?: string;
|
|
45
|
+
service?: string;
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
}
|
|
48
|
+
interface OTLPConfig {
|
|
49
|
+
endpoint: string;
|
|
50
|
+
headers?: Record<string, string>;
|
|
51
|
+
batchSize?: number;
|
|
52
|
+
flushIntervalMs?: number;
|
|
53
|
+
}
|
|
54
|
+
interface LoggerOptions {
|
|
55
|
+
service?: string;
|
|
56
|
+
level?: LogLevel;
|
|
57
|
+
output?: LogOutput;
|
|
58
|
+
redact?: string[];
|
|
59
|
+
otlp?: OTLPConfig;
|
|
60
|
+
traceContext?: () => {
|
|
61
|
+
traceId?: string;
|
|
62
|
+
spanId?: string;
|
|
63
|
+
} | null;
|
|
64
|
+
destination?: NodeJS.WritableStream;
|
|
65
|
+
}
|
|
66
|
+
declare class Logger {
|
|
67
|
+
private opts;
|
|
68
|
+
private minLevel;
|
|
69
|
+
private redactSet;
|
|
70
|
+
private exporter;
|
|
71
|
+
private dest;
|
|
72
|
+
private bindings;
|
|
73
|
+
constructor(opts: LoggerOptions, bindings?: Record<string, any>);
|
|
74
|
+
private log;
|
|
75
|
+
trace(msg: string, data?: Record<string, any>): void;
|
|
76
|
+
debug(msg: string, data?: Record<string, any>): void;
|
|
77
|
+
info(msg: string, data?: Record<string, any>): void;
|
|
78
|
+
warn(msg: string, data?: Record<string, any>): void;
|
|
79
|
+
error(msg: string, data?: Record<string, any>): void;
|
|
80
|
+
fatal(msg: string, data?: Record<string, any>): void;
|
|
81
|
+
/** Create a child logger with additional bound fields */
|
|
82
|
+
child(bindings: Record<string, any>): Logger;
|
|
83
|
+
/** Attach trace context for automatic injection */
|
|
84
|
+
withTrace(ctx: {
|
|
85
|
+
traceId?: string;
|
|
86
|
+
spanId?: string;
|
|
87
|
+
}): Logger;
|
|
88
|
+
/** Flush OTLP buffer before process exit */
|
|
89
|
+
flush(): void;
|
|
90
|
+
destroy(): void;
|
|
91
|
+
/** Middleware: log all HTTP requests */
|
|
92
|
+
requestMiddleware(): (req: any, res: any, next: any) => void;
|
|
93
|
+
}
|
|
94
|
+
declare function createLogger(opts?: LoggerOptions): Logger;
|
|
95
|
+
|
|
96
|
+
export { type EnvSchema, type FieldSpec, type FieldType, type LogLevel, type LogOutput, type LogRecord, Logger, type LoggerOptions, type OTLPConfig, type ParsedEnv, createLogger, generateExample, loadDotenvFile, loadEnv, parseDotenv, parseEnv };
|
package/dist/dx.js
ADDED