@stacksjs/types 0.72.7 → 0.72.9
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/logging.d.ts +65 -1
- package/dist/server.d.ts +5 -0
- package/package.json +2 -2
package/dist/logging.d.ts
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request-scoped fields carried alongside a log line.
|
|
3
|
+
*
|
|
4
|
+
* Populated automatically from the router's trace storage, and extendable by
|
|
5
|
+
* any caller through `withLogContext`.
|
|
6
|
+
*/
|
|
7
|
+
export declare interface LogContext {
|
|
8
|
+
requestId?: string
|
|
9
|
+
userId?: string | number
|
|
10
|
+
[key: string]: unknown
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* One log call, as a transport sees it.
|
|
14
|
+
*
|
|
15
|
+
* `message` is the formatted line, which is what a transport wants if it is
|
|
16
|
+
* writing text. `args` is the same call before formatting, which is what a
|
|
17
|
+
* transport wants if it is building structured output: an `Error` is still an
|
|
18
|
+
* `Error` there, and a context object is still an object rather than a
|
|
19
|
+
* pretty-printed blob inside a string.
|
|
20
|
+
*/
|
|
21
|
+
export declare interface LogRecord {
|
|
22
|
+
level: LogLevel
|
|
23
|
+
message: string
|
|
24
|
+
args: unknown[]
|
|
25
|
+
context?: LogContext
|
|
26
|
+
timestamp: string
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A destination for log records, alongside the console and the log file.
|
|
30
|
+
*
|
|
31
|
+
* This is the seam for shipping logs somewhere else: a hosted log service, an
|
|
32
|
+
* OpenTelemetry exporter, an in-memory sink in a test. Register one in
|
|
33
|
+
* `config/logging.ts` or at runtime with `registerTransport()`.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* // config/logging.ts
|
|
38
|
+
* export default {
|
|
39
|
+
* logsPath: 'storage/logs/console.log',
|
|
40
|
+
* deploymentsPath: 'storage/logs/deployments.log',
|
|
41
|
+
* transports: [
|
|
42
|
+
* {
|
|
43
|
+
* name: 'memory',
|
|
44
|
+
* level: 'warning',
|
|
45
|
+
* log: record => lines.push(record),
|
|
46
|
+
* },
|
|
47
|
+
* ],
|
|
48
|
+
* } satisfies LoggingConfig
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare interface LogTransport {
|
|
52
|
+
name: string
|
|
53
|
+
level?: LogLevel
|
|
54
|
+
log: (record: LogRecord) => void
|
|
55
|
+
flush?: () => Promise<void>
|
|
56
|
+
}
|
|
1
57
|
/**
|
|
2
58
|
* **Logging Options**
|
|
3
59
|
*
|
|
@@ -8,8 +64,16 @@
|
|
|
8
64
|
export declare interface LoggingOptions {
|
|
9
65
|
logsPath: string
|
|
10
66
|
deploymentsPath: string
|
|
11
|
-
level?:
|
|
67
|
+
level?: LogLevel
|
|
12
68
|
format?: 'json' | 'text'
|
|
13
69
|
writeToFile?: boolean
|
|
70
|
+
transports?: LogTransport[]
|
|
14
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* The severities the framework logs at.
|
|
74
|
+
*
|
|
75
|
+
* Note `success`, which is an outcome rather than a severity: it ranks with
|
|
76
|
+
* `info` when a transport filters by level.
|
|
77
|
+
*/
|
|
78
|
+
export type LogLevel = 'debug' | 'info' | 'success' | 'warning' | 'error';
|
|
15
79
|
export type LoggingConfig = Partial<LoggingOptions>;
|
package/dist/server.d.ts
CHANGED
|
@@ -18,6 +18,11 @@ export declare interface ApiProxyOptions {
|
|
|
18
18
|
export declare interface ServerConfig {
|
|
19
19
|
proxy?: ApiProxyOptions
|
|
20
20
|
redirects?: RedirectsOptions
|
|
21
|
+
security?: ServerSecurityOptions
|
|
22
|
+
}
|
|
23
|
+
/** Security headers the views server puts on rendered pages. */
|
|
24
|
+
export declare interface ServerSecurityOptions {
|
|
25
|
+
embeddable?: string[]
|
|
21
26
|
}
|
|
22
27
|
export declare interface ServerOptions {
|
|
23
28
|
type?:
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/types",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.72.
|
|
4
|
+
"version": "0.72.9",
|
|
5
5
|
"description": "The Stacks framework types.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"contributors": [
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@stacksjs/validation": "0.72.
|
|
74
|
+
"@stacksjs/validation": "0.72.9",
|
|
75
75
|
"better-dx": "^0.2.23",
|
|
76
76
|
"meilisearch": "^0.59.0"
|
|
77
77
|
},
|