@eliware/common 14.0.0 → 15.0.0
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/RELEASE_NOTES.md +19 -0
- package/docs/api.md +26 -14
- package/docs/package.md +1 -1
- package/package.json +8 -8
- package/specs/directives.yaml +1 -1
- package/src/errors.d.mts +9 -37
- package/src/index.d.ts +11 -5
- package/src/index.mjs +2 -1
- package/src/path.d.mts +12 -47
- package/src/log.d.mts +0 -29
- package/src/log.mjs +0 -4
- package/src/snowflake.d.mts +0 -22
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Release Notes
|
|
2
2
|
|
|
3
|
+
## 15.0.0 — 2026-10-21
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Upgrade all Eliware runtime and test dependencies to major version 15.
|
|
8
|
+
- Align package metadata and repository specifications with Convention 15.
|
|
9
|
+
- Export each dependency API from its package. Export `safeSerialize` and other Redact APIs directly from `@eliware/redact`.
|
|
10
|
+
- Restore Log types after `@eliware/log` fixed its public declarations. Remove the internal Log wrapper.
|
|
11
|
+
- Update the guides to describe the version 15 APIs and types.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- Check every runtime dependency export against the Common package entry point.
|
|
16
|
+
- Check all retained public types in a strict packed-package consumer.
|
|
17
|
+
|
|
18
|
+
### Breaking changes
|
|
19
|
+
|
|
20
|
+
- Require major version 15 of the Eliware runtime dependencies.
|
|
21
|
+
|
|
3
22
|
## 14.0.0 — 2026-10-21
|
|
4
23
|
|
|
5
24
|
### Added
|
package/docs/api.md
CHANGED
|
@@ -37,11 +37,10 @@ Read the [path package docs](https://github.com/eliware/path/tree/main/docs) for
|
|
|
37
37
|
|
|
38
38
|
## Logger APIs
|
|
39
39
|
|
|
40
|
-
| Export
|
|
41
|
-
|
|
|
42
|
-
| `log`
|
|
43
|
-
| `createLogger`
|
|
44
|
-
| `safeSerialize` | `safeSerialize(value, options?)` | Return JSON-safe data with redaction and limits. |
|
|
40
|
+
| Export | Call | Result |
|
|
41
|
+
| -------------- | ----------------------------------------------- | ------------------------------ |
|
|
42
|
+
| `log` | `log.debug/info/warn/error(message, metadata?)` | Use the shared default logger. |
|
|
43
|
+
| `createLogger` | `createLogger(options?)` | Create a logger instance. |
|
|
45
44
|
|
|
46
45
|
`createLogger` accepts `level`, `transports`, `format`, `timestamp`, and `keys` options.
|
|
47
46
|
Use `format: "text"` or `format: "json"`. The default level is `info`.
|
|
@@ -54,6 +53,16 @@ Read the [logger package docs](https://github.com/eliware/log/tree/main/docs) fo
|
|
|
54
53
|
|
|
55
54
|
## Redaction APIs
|
|
56
55
|
|
|
56
|
+
| Export | Call | Result |
|
|
57
|
+
| ---------------------- | ---------------------------------------------- | ----------------------------------------------- |
|
|
58
|
+
| `createPolicy` | `createPolicy(options?)` | Create a frozen redaction policy. |
|
|
59
|
+
| `defaultPolicy` | value | Provide the default sensitive names and marker. |
|
|
60
|
+
| `redactValue` | `redactValue(value, options?)` | Return a redacted copy of structured data. |
|
|
61
|
+
| `redactHeaders` | `redactHeaders(headers, options?)` | Return redacted header data. |
|
|
62
|
+
| `redactText` | `redactText(value, options?)` | Return text with secret values replaced. |
|
|
63
|
+
| `replaceLiteralSecret` | `replaceLiteralSecret(value, secret, marker?)` | Replace each exact secret occurrence. |
|
|
64
|
+
| `safeSerialize` | `safeSerialize(value, options?)` | Return bounded data for logs and diagnostics. |
|
|
65
|
+
|
|
57
66
|
`defaultPolicy` provides the default sensitive key names and marker.
|
|
58
67
|
Call `createPolicy(options?)` to make a frozen policy with custom key names or markers.
|
|
59
68
|
Call `redactValue(value, options?)` to return a redacted copy of an object or array.
|
|
@@ -65,13 +74,15 @@ Policy options include `keys`, `redactKeys`, `marker`, and `circularMarker`.
|
|
|
65
74
|
Structured values also support `maxDepth`, `maxKeys`, and `maxArray` limits.
|
|
66
75
|
Text also supports `secrets` and the `maxOutputLength` limit.
|
|
67
76
|
|
|
68
|
-
The default marker is `[REDACTED]`. The default text limit is 10,000 characters.
|
|
77
|
+
The default marker is `[REDACTED]`. The default text output limit is 10,000 characters.
|
|
78
|
+
Redact limits input text before it applies the redaction rules.
|
|
69
79
|
`redactText` detects authorization values, secret assignments, provider tokens, JWT-like strings, and key blocks.
|
|
70
80
|
|
|
71
81
|
`redactValue` returns a copy and does not change its input.
|
|
72
82
|
`redactHeaders` keeps the input shape for objects and pair arrays. It returns a lowercase object for entries objects.
|
|
83
|
+
For arrays, `maxKeys` limits non-sensitive index and property values. Redact marks sensitive properties without reading their values.
|
|
73
84
|
|
|
74
|
-
|
|
85
|
+
Common exports `safeSerialize` directly from `@eliware/redact`.
|
|
75
86
|
|
|
76
87
|
Read the [Redact API guide](https://github.com/eliware/redact/blob/main/docs/api.md) for full rules and limits.
|
|
77
88
|
|
|
@@ -122,13 +133,13 @@ Read the [signals API docs](https://github.com/eliware/signals/blob/main/docs/ap
|
|
|
122
133
|
|
|
123
134
|
Call `createSnowflakeGenerator(options?)` to make a generator. Each call returns a decimal string.
|
|
124
135
|
|
|
125
|
-
| Option | Type
|
|
126
|
-
| ----------- |
|
|
127
|
-
| `epoch` | `number` or `bigint`
|
|
128
|
-
| `workerId` | `number` or `bigint`
|
|
129
|
-
| `processId` | `number` or `bigint`
|
|
130
|
-
| `now` | function
|
|
131
|
-
| `logger` |
|
|
136
|
+
| Option | Type | Default | Purpose |
|
|
137
|
+
| ----------- | ---------------------------- | ------------------ | ------------------------------------------------- |
|
|
138
|
+
| `epoch` | `number` or `bigint` | `365662380000n` | Set the epoch in Unix milliseconds. |
|
|
139
|
+
| `workerId` | `number` or `bigint` | `0` | Set a worker value from 0 through 31. |
|
|
140
|
+
| `processId` | `number` or `bigint` | `process.pid % 32` | Set a process value from 0 through 31. |
|
|
141
|
+
| `now` | function | `Date.now` | Set a clock that returns Unix milliseconds. |
|
|
142
|
+
| `logger` | `LoggerWithConfiguredLevels` | None | Record generator events with a structured logger. |
|
|
132
143
|
|
|
133
144
|
Use one epoch for all generators in one application. Give each active generator a unique worker and process ID pair.
|
|
134
145
|
Keep each ID as a string. An ID uses a 42-bit timestamp, 5-bit worker value, 5-bit process value, and 12-bit sequence.
|
|
@@ -157,6 +168,7 @@ Read the [Snowflake usage guide](https://github.com/eliware/snowflake/blob/main/
|
|
|
157
168
|
The package exports these types:
|
|
158
169
|
|
|
159
170
|
- `Logger`
|
|
171
|
+
- `LoggerWithConfiguredLevels`, `RedactionOptions`, and `SafeSerializedValue`
|
|
160
172
|
- `PathLogger`, `PathHelpersOptions`, and `PathHelpers`
|
|
161
173
|
- `NodeSignal`, `SignalsLogger`, and `SignalsProcessLike`
|
|
162
174
|
- `ProcessEvent`, `ProcessListener`, and `ProcessLike`
|
package/docs/package.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eliware/common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A shared ESM compatibility package for Eliware filesystem, path, logging, error, and signal APIs.",
|
|
6
6
|
"keywords": [
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"node": ">=26"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@eliware/errors": "^
|
|
48
|
-
"@eliware/log": "^
|
|
49
|
-
"@eliware/path": "^
|
|
50
|
-
"@eliware/redact": "^
|
|
51
|
-
"@eliware/signals": "^
|
|
52
|
-
"@eliware/snowflake": "^
|
|
47
|
+
"@eliware/errors": "^15.0.0",
|
|
48
|
+
"@eliware/log": "^15.0.0",
|
|
49
|
+
"@eliware/path": "^15.0.0",
|
|
50
|
+
"@eliware/redact": "^15.0.0",
|
|
51
|
+
"@eliware/signals": "^15.0.0",
|
|
52
|
+
"@eliware/snowflake": "^15.0.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@eliware/test": "^
|
|
55
|
+
"@eliware/test": "^15.0.0",
|
|
56
56
|
"typescript": "^7.0.2"
|
|
57
57
|
},
|
|
58
58
|
"jest": {
|
package/specs/directives.yaml
CHANGED
package/src/errors.d.mts
CHANGED
|
@@ -1,37 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
debug(message: string): unknown;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type ProcessLike = {
|
|
14
|
-
on(event: ProcessEvent, listener: ProcessListener): unknown;
|
|
15
|
-
once?(event: ProcessEvent, listener: ProcessListener): unknown;
|
|
16
|
-
listeners?(event: ProcessEvent): ProcessListener[];
|
|
17
|
-
} & (
|
|
18
|
-
| { off(event: ProcessEvent, listener: ProcessListener): unknown }
|
|
19
|
-
| { removeListener(event: ProcessEvent, listener: ProcessListener): unknown }
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
export interface RegisterHandlersOptions {
|
|
23
|
-
processObj?: ProcessLike;
|
|
24
|
-
log?: Logger;
|
|
25
|
-
events?: ProcessEvent[];
|
|
26
|
-
once?: boolean;
|
|
27
|
-
signal?: AbortSignal;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface RegisteredHandlers {
|
|
31
|
-
readonly removed: boolean;
|
|
32
|
-
removeHandlers(): void;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export declare function registerHandlers(options?: RegisterHandlersOptions): RegisteredHandlers;
|
|
36
|
-
|
|
37
|
-
export default registerHandlers;
|
|
1
|
+
export { default, defaultEvents, registerHandlers } from "@eliware/errors";
|
|
2
|
+
export type {
|
|
3
|
+
Logger,
|
|
4
|
+
ProcessEvent,
|
|
5
|
+
ProcessLike,
|
|
6
|
+
ProcessListener,
|
|
7
|
+
RegisterHandlersOptions,
|
|
8
|
+
RegisteredHandlers,
|
|
9
|
+
} from "@eliware/errors";
|
package/src/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
export { fs };
|
|
3
|
-
export { createLogger, default as log
|
|
3
|
+
export { createLogger, default as log } from "@eliware/log";
|
|
4
|
+
export type {
|
|
5
|
+
LoggerWithConfiguredLevels,
|
|
6
|
+
RedactionOptions,
|
|
7
|
+
SafeSerializedValue,
|
|
8
|
+
} from "@eliware/log";
|
|
4
9
|
export {
|
|
5
10
|
path,
|
|
6
11
|
createPathHelpers,
|
|
@@ -11,14 +16,14 @@ export {
|
|
|
11
16
|
relativePath,
|
|
12
17
|
fileUrlToPath,
|
|
13
18
|
} from "./path.mjs";
|
|
14
|
-
export type { PathLogger, PathHelpersOptions, PathHelpers } from "
|
|
19
|
+
export type { PathLogger, PathHelpersOptions, PathHelpers } from "@eliware/path";
|
|
15
20
|
export {
|
|
16
21
|
createSnowflakeGenerator,
|
|
17
22
|
generate,
|
|
18
23
|
default as snowflake,
|
|
19
24
|
constants,
|
|
20
|
-
} from "
|
|
21
|
-
export type { SnowflakeGeneratorOptions, SnowflakeConstants } from "
|
|
25
|
+
} from "@eliware/snowflake";
|
|
26
|
+
export type { SnowflakeGeneratorOptions, SnowflakeConstants } from "@eliware/snowflake";
|
|
22
27
|
export {
|
|
23
28
|
createPolicy,
|
|
24
29
|
defaultPolicy,
|
|
@@ -26,6 +31,7 @@ export {
|
|
|
26
31
|
redactHeaders,
|
|
27
32
|
redactText,
|
|
28
33
|
replaceLiteralSecret,
|
|
34
|
+
safeSerialize,
|
|
29
35
|
} from "@eliware/redact";
|
|
30
36
|
export type {
|
|
31
37
|
RedactionPolicy,
|
|
@@ -43,7 +49,7 @@ export type {
|
|
|
43
49
|
ProcessLike,
|
|
44
50
|
RegisterHandlersOptions,
|
|
45
51
|
RegisteredHandlers,
|
|
46
|
-
} from "
|
|
52
|
+
} from "@eliware/errors";
|
|
47
53
|
export type {
|
|
48
54
|
NodeSignal,
|
|
49
55
|
ProcessLike as SignalsProcessLike,
|
package/src/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as fs } from "./fs.mjs";
|
|
2
|
-
export { default as log, createLogger
|
|
2
|
+
export { default as log, createLogger } from "@eliware/log";
|
|
3
3
|
export {
|
|
4
4
|
default as path,
|
|
5
5
|
createPathHelpers,
|
|
@@ -23,6 +23,7 @@ export {
|
|
|
23
23
|
redactHeaders,
|
|
24
24
|
redactText,
|
|
25
25
|
replaceLiteralSecret,
|
|
26
|
+
safeSerialize,
|
|
26
27
|
} from "@eliware/redact";
|
|
27
28
|
export { defaultEvents, default as registerHandlers } from "./errors.mjs";
|
|
28
29
|
export { default as registerSignals } from "./signals.mjs";
|
package/src/path.d.mts
CHANGED
|
@@ -1,47 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/** Converts a resolved path to a file URL string. */
|
|
14
|
-
export declare function pathUrl(metaOrDir: ImportMeta | string, ...segments: string[]): string;
|
|
15
|
-
|
|
16
|
-
/** Resolves path segments from the module directory. */
|
|
17
|
-
export declare function resolvePath(metaOrDir: ImportMeta | string, ...segments: string[]): string;
|
|
18
|
-
|
|
19
|
-
/** Returns a path relative to the module directory. */
|
|
20
|
-
export declare function relativePath(metaOrDir: ImportMeta | string, ...segments: string[]): string;
|
|
21
|
-
|
|
22
|
-
/** Converts a file URL string or URL object to a file path. */
|
|
23
|
-
export declare function fileUrlToPath(fileUrl: string | URL): string;
|
|
24
|
-
|
|
25
|
-
/** A logger that accepts structured Winston-style records. */
|
|
26
|
-
export type PathLogger = Pick<import("winston").Logger, "log">;
|
|
27
|
-
|
|
28
|
-
/** Options for path helpers with an injected logger. */
|
|
29
|
-
export interface PathHelpersOptions {
|
|
30
|
-
logger?: PathLogger;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/** Path helper functions that write structured records to the supplied logger. */
|
|
34
|
-
export interface PathHelpers {
|
|
35
|
-
getCurrentFilename(metaOrDir: ImportMeta | string): string;
|
|
36
|
-
getCurrentDirname(metaOrDir: ImportMeta | string, dirnameFn?: (path: string) => string): string;
|
|
37
|
-
path(metaOrDir: ImportMeta | string, ...segments: string[]): string;
|
|
38
|
-
pathUrl(metaOrDir: ImportMeta | string, ...segments: string[]): string;
|
|
39
|
-
resolvePath(metaOrDir: ImportMeta | string, ...segments: string[]): string;
|
|
40
|
-
relativePath(metaOrDir: ImportMeta | string, ...segments: string[]): string;
|
|
41
|
-
fileUrlToPath(fileUrl: string | URL): string;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** Creates path helpers that write safe operation records. */
|
|
45
|
-
export declare function createPathHelpers(options?: PathHelpersOptions): PathHelpers;
|
|
46
|
-
|
|
47
|
-
export default path;
|
|
1
|
+
export {
|
|
2
|
+
createPathHelpers,
|
|
3
|
+
default,
|
|
4
|
+
fileUrlToPath,
|
|
5
|
+
getCurrentDirname,
|
|
6
|
+
getCurrentFilename,
|
|
7
|
+
path,
|
|
8
|
+
pathUrl,
|
|
9
|
+
relativePath,
|
|
10
|
+
resolvePath,
|
|
11
|
+
} from "@eliware/path";
|
|
12
|
+
export type { PathHelpers, PathHelpersOptions, PathLogger } from "@eliware/path";
|
package/src/log.d.mts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
type SafeSerializedValue =
|
|
2
|
-
null | boolean | number | string | SafeSerializedValue[] | { [key: string]: SafeSerializedValue };
|
|
3
|
-
|
|
4
|
-
export declare function createLogger(options?: {
|
|
5
|
-
level?: string;
|
|
6
|
-
transports?: import("winston-transport")[];
|
|
7
|
-
format?: "text" | "json";
|
|
8
|
-
timestamp?: boolean;
|
|
9
|
-
keys?: string[];
|
|
10
|
-
}): import("winston").Logger & {
|
|
11
|
-
debug(message: unknown, meta?: unknown, ...args: unknown[]): import("winston").Logger;
|
|
12
|
-
info(message: unknown, meta?: unknown, ...args: unknown[]): import("winston").Logger;
|
|
13
|
-
warn(message: unknown, meta?: unknown, ...args: unknown[]): import("winston").Logger;
|
|
14
|
-
error(message: unknown, meta?: unknown, ...args: unknown[]): import("winston").Logger;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export declare function safeSerialize(
|
|
18
|
-
value: unknown,
|
|
19
|
-
options?: import("@eliware/redact").SerializationOptions,
|
|
20
|
-
): SafeSerializedValue;
|
|
21
|
-
|
|
22
|
-
export declare const log: import("winston").Logger & {
|
|
23
|
-
debug(message: unknown, meta?: unknown, ...args: unknown[]): import("winston").Logger;
|
|
24
|
-
info(message: unknown, meta?: unknown, ...args: unknown[]): import("winston").Logger;
|
|
25
|
-
warn(message: unknown, meta?: unknown, ...args: unknown[]): import("winston").Logger;
|
|
26
|
-
error(message: unknown, meta?: unknown, ...args: unknown[]): import("winston").Logger;
|
|
27
|
-
} & { [level: string]: unknown };
|
|
28
|
-
|
|
29
|
-
export default log;
|
package/src/log.mjs
DELETED
package/src/snowflake.d.mts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export interface SnowflakeGeneratorOptions {
|
|
2
|
-
epoch?: number | bigint;
|
|
3
|
-
workerId?: number | bigint;
|
|
4
|
-
processId?: number | bigint;
|
|
5
|
-
now?: () => number | bigint;
|
|
6
|
-
logger?: import("winston").Logger;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface SnowflakeConstants {
|
|
10
|
-
readonly epoch: bigint;
|
|
11
|
-
readonly sequenceBits: bigint;
|
|
12
|
-
readonly processBits: bigint;
|
|
13
|
-
readonly workerBits: bigint;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export declare function createSnowflakeGenerator(options?: SnowflakeGeneratorOptions): () => string;
|
|
17
|
-
|
|
18
|
-
export declare const generate: () => string;
|
|
19
|
-
export declare const snowflake: typeof generate;
|
|
20
|
-
export declare const constants: SnowflakeConstants;
|
|
21
|
-
|
|
22
|
-
export default generate;
|