@fabrika/proxy-core 0.9.0-dev.1 → 0.9.0-dev.3
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/package.json +9 -8
- package/types/src/authorize.d.ts +233 -0
- package/types/src/cache.d.ts +50 -0
- package/types/src/constants.d.ts +41 -0
- package/types/src/credentials.d.ts +10 -0
- package/types/src/handoff.d.ts +15 -0
- package/types/src/headers.d.ts +112 -0
- package/types/src/iam.d.ts +115 -0
- package/types/src/index.d.ts +16 -0
- package/types/src/log.d.ts +29 -0
- package/types/src/manifest.d.ts +8722 -0
- package/types/src/oauth-resource.d.ts +52 -0
- package/types/src/oauth.d.ts +12 -0
- package/types/src/service.d.ts +47 -0
- package/types/src/verifier.d.ts +22 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging, constrained so that secret material cannot reach it.
|
|
3
|
+
*
|
|
4
|
+
* The rule is structural rather than aspirational: a log field is a `string | number | boolean |
|
|
5
|
+
* null`, call sites pass only decision metadata, and the two values that CAN carry a credential —
|
|
6
|
+
* a request path (share-link tokens ride in the path) and a URL — go through `redactPath` /
|
|
7
|
+
* `redactUrl` first. Nothing in this package ever passes a header, a cookie, a token or a caught
|
|
8
|
+
* error object to a logger.
|
|
9
|
+
*/
|
|
10
|
+
export type LogValue = string | number | boolean | null;
|
|
11
|
+
export type LogFields = Record<string, LogValue>;
|
|
12
|
+
export interface ProxyLogger {
|
|
13
|
+
info(message: string, fields?: LogFields): void;
|
|
14
|
+
warn(message: string, fields?: LogFields): void;
|
|
15
|
+
error(message: string, fields?: LogFields): void;
|
|
16
|
+
}
|
|
17
|
+
/** Emits one JSON object per line — what Zerops' log collector expects. */
|
|
18
|
+
export declare const consoleLogger: ProxyLogger;
|
|
19
|
+
/** A logger that discards everything — the default, so a library consumer opts IN to output. */
|
|
20
|
+
export declare const silentLogger: ProxyLogger;
|
|
21
|
+
/**
|
|
22
|
+
* Make a path safe to log. Two hazards, both real:
|
|
23
|
+
* - a query string can carry a declared `query` credential (`?pxt=<token>`) — dropped entirely;
|
|
24
|
+
* - a path SEGMENT can be a share-link `px_` credential — replaced with `px_***`.
|
|
25
|
+
* Anything else is preserved, because an unloggable path is an undebuggable proxy.
|
|
26
|
+
*/
|
|
27
|
+
export declare function redactPath(pathname: string): string;
|
|
28
|
+
/** Origin + redacted path. Never the query string. */
|
|
29
|
+
export declare function redactUrl(url: URL): string;
|