@eliware/common 13.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/AGENTS.md CHANGED
@@ -2,27 +2,38 @@
2
2
 
3
3
  ## Project
4
4
 
5
+ See `README.md` for the repository purpose, owner, scope, and boundaries.
6
+
5
7
  ## Scope and boundaries
6
8
 
7
- Keep requirements in their authoritative specifications.
9
+ Keep repository requirements in `specs/directives.yaml`.
8
10
 
9
11
  ## Layout
10
12
 
13
+ Use `README.md` and `specs/README.md` to find maintained files.
14
+
11
15
  ## Development
12
16
 
17
+ Give each source and test module one cohesive purpose.
18
+
13
19
  ## Validation
14
20
 
15
21
  Use Node.js 26 or later and native ESM for maintained JavaScript modules.
16
- Run npm test for aggregate validation.
17
- Run npm run lint for lint checks.
18
- Run npm run audit for dependency checks.
19
- Run npm run format to format files.
20
- Run npm run format:check to check formatting.
22
+ Run `npm test` for aggregate validation.
23
+ Run `npm run lint` for lint checks.
24
+ Run `npm run audit` for dependency checks.
25
+ Run `npm run format` to format files.
26
+ Run `npm run format:check` to check formatting.
21
27
 
22
28
  ## Security
23
29
 
30
+ Keep credentials, secret values, private data, and runtime state out of Git.
31
+
24
32
  ## Changes
25
33
 
34
+ Describe each user-visible change in `RELEASE_NOTES.md`.
35
+ Keep release notes accurate.
36
+
26
37
  ## Library
27
38
 
28
39
  Run focused tests first during development.
@@ -32,3 +43,6 @@ Prevent repeated full-suite runs during development.
32
43
  Run the full `npm test` suite for final validation before a commit, milestone, or release.
33
44
 
34
45
  ## npm publication
46
+
47
+ Run `npm run pack` to check package contents.
48
+ Publish only after approved release steps.
package/README.md CHANGED
@@ -23,7 +23,8 @@ A shared ESM compatibility package for Eliware filesystem, path, logging, error,
23
23
 
24
24
  ## Features
25
25
 
26
- Import shared Eliware APIs and redaction tools from `@eliware/common`.
26
+ Eliware maintains this shared package for common Node.js APIs.
27
+ It re-exports filesystem, path, logger, error, signal, redaction, and Snowflake APIs.
27
28
 
28
29
  ## Requirements
29
30
 
@@ -63,7 +64,7 @@ Read the [API reference](docs/api.md).
63
64
 
64
65
  ## Packaging
65
66
 
66
- Use native ESM. Read the [package guide](docs/package.md).
67
+ Read the [package guide](docs/package.md).
67
68
 
68
69
  ## Examples
69
70
 
package/RELEASE_NOTES.md CHANGED
@@ -1,22 +1,43 @@
1
1
  # Release Notes
2
2
 
3
- ## 13.0.0 — 2026-10-19
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
+
22
+ ## 14.0.0 — 2026-10-21
4
23
 
5
24
  ### Added
6
25
 
7
26
  - Re-exported the complete runtime APIs and public types from the Eliware errors, log, path, redact, signals, and snowflake packages.
8
- - Added the `defaultEvents` errors export and TypeScript coverage for the public type exports.
27
+ - Added `createPathHelpers` with structured operation records and added type parity checks for dependency APIs.
9
28
 
10
29
  ### Changed
11
30
 
12
- - Upgraded the package and its Eliware runtime and test dependencies to major version 13.
13
- - Aligned package metadata, specifications, CI, npm publication, and Knit workflows with convention version 13.
14
- - Updated API, usage, and package documentation for the current exports, dependencies, and common tasks.
15
- - Simplified `AGENTS.md` and `README.md` to the content required by the conventions.
31
+ - Upgraded the package and its Eliware runtime and test dependencies to major version 14.
32
+ - Aligned package metadata, specifications, CI, npm publication, and Knit workflows with convention version 14.
33
+ - Expanded and corrected the API, setup, usage, package, and troubleshooting guides.
34
+ - Simplified `README.md` and `AGENTS.md` while keeping the content required by repository conventions.
35
+ - Removed invalid Log type aliases from Common and kept Common's valid public types available.
36
+ - Added a strict packed-consumer check for Common's retained public types.
16
37
 
17
38
  ### Breaking changes
18
39
 
19
- - Require major version 13 of the Eliware runtime dependencies.
40
+ - Require major version 14 of the Eliware runtime dependencies.
20
41
 
21
42
  ## 12.0.1 — 2026-10-12
22
43
 
package/docs/api.md CHANGED
@@ -18,6 +18,7 @@ Read the [Node.js file system API](https://nodejs.org/api/fs.html) for functions
18
18
  | Export | Call | Result |
19
19
  | -------------------- | ------------------------------------------ | -------------------------------------------------- |
20
20
  | `path` | `path(metaOrDir, ...segments)` | Add segments to a module directory. |
21
+ | `createPathHelpers` | `createPathHelpers(options?)` | Create path helpers that log each operation. |
21
22
  | `pathUrl` | `pathUrl(metaOrDir, ...segments)` | Return a file URL string. |
22
23
  | `getCurrentDirname` | `getCurrentDirname(metaOrDir, dirnameFn?)` | Return the module directory. |
23
24
  | `getCurrentFilename` | `getCurrentFilename(metaOrDir)` | Return the module filename or input string. |
@@ -26,16 +27,20 @@ Read the [Node.js file system API](https://nodejs.org/api/fs.html) for functions
26
27
  | `fileUrlToPath` | `fileUrlToPath(fileUrl)` | Convert a file URL string or `URL` to a file path. |
27
28
 
28
29
  Pass `import.meta` or a directory string as `metaOrDir`. Pass `dirnameFn` only with `import.meta`.
30
+
31
+ Call `createPathHelpers()` to use the default logger. Pass `options.logger` to set the logger.
32
+ The helpers write debug records after operations. They write error records before they throw an error.
33
+ The default logger uses the `info` level, so it filters debug records. Set its level to `debug` to receive operation records.
34
+
29
35
  The default export from `@eliware/path` is named `path` here.
30
36
  Read the [path package docs](https://github.com/eliware/path/tree/main/docs) for details.
31
37
 
32
38
  ## Logger APIs
33
39
 
34
- | Export | Call | Result |
35
- | --------------- | ----------------------------------------------- | ------------------------------------------------ |
36
- | `log` | `log.debug/info/warn/error(message, metadata?)` | Use the shared default logger. |
37
- | `createLogger` | `createLogger(options?)` | Create a logger instance. |
38
- | `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. |
39
44
 
40
45
  `createLogger` accepts `level`, `transports`, `format`, `timestamp`, and `keys` options.
41
46
  Use `format: "text"` or `format: "json"`. The default level is `info`.
@@ -48,6 +53,16 @@ Read the [logger package docs](https://github.com/eliware/log/tree/main/docs) fo
48
53
 
49
54
  ## Redaction APIs
50
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
+
51
66
  `defaultPolicy` provides the default sensitive key names and marker.
52
67
  Call `createPolicy(options?)` to make a frozen policy with custom key names or markers.
53
68
  Call `redactValue(value, options?)` to return a redacted copy of an object or array.
@@ -59,13 +74,15 @@ Policy options include `keys`, `redactKeys`, `marker`, and `circularMarker`.
59
74
  Structured values also support `maxDepth`, `maxKeys`, and `maxArray` limits.
60
75
  Text also supports `secrets` and the `maxOutputLength` limit.
61
76
 
62
- 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.
63
79
  `redactText` detects authorization values, secret assignments, provider tokens, JWT-like strings, and key blocks.
64
80
 
65
81
  `redactValue` returns a copy and does not change its input.
66
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.
67
84
 
68
- The `safeSerialize` export in Logger APIs matches the `safeSerialize` export from `@eliware/redact`.
85
+ Common exports `safeSerialize` directly from `@eliware/redact`.
69
86
 
70
87
  Read the [Redact API guide](https://github.com/eliware/redact/blob/main/docs/api.md) for full rules and limits.
71
88
 
@@ -116,21 +133,31 @@ Read the [signals API docs](https://github.com/eliware/signals/blob/main/docs/ap
116
133
 
117
134
  Call `createSnowflakeGenerator(options?)` to make a generator. Each call returns a decimal string.
118
135
 
119
- | Option | Type | Default | Purpose |
120
- | ----------- | -------------------- | ------------------ | ------------------------------------------- |
121
- | `epoch` | `number` or `bigint` | `365662380000n` | Set the epoch in Unix milliseconds. |
122
- | `workerId` | `number` or `bigint` | `0` | Set a worker value from 0 through 31. |
123
- | `processId` | `number` or `bigint` | `process.pid % 32` | Set a process value from 0 through 31. |
124
- | `now` | function | `Date.now` | Set a clock that returns Unix milliseconds. |
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. |
125
143
 
126
144
  Use one epoch for all generators in one application. Give each active generator a unique worker and process ID pair.
127
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.
128
146
 
129
147
  Each generator can create 4096 IDs for each millisecond. It throws `RangeError` when time or sequence limits fail.
148
+
130
149
  Pass a safe integer or `bigint` to `epoch`, `workerId`, and `processId`.
150
+ Set `epoch` from zero through `(1n << 42n) - 1n`. Set `workerId` and `processId` from 0 through 31.
131
151
 
132
152
  Pass a clock that returns Unix milliseconds as a safe integer or `bigint`.
133
- The generator uses its last timestamp when the clock moves to an earlier time.
153
+ Set the first clock value at or after the epoch.
154
+ After the first ID, the generator uses its last timestamp when the clock moves to an earlier time.
155
+
156
+ The generator increments its sequence during a clock rollback. It throws `RangeError` when one generator creates more than 4096 IDs in one millisecond.
157
+
158
+ Pass a logger with `error`, `warn`, `info`, and `debug` methods to record generator events. The generator writes no records when you omit the logger.
159
+ The records do not include generated IDs, credentials, tokens, or error messages.
160
+
134
161
  The exports `generate`, `snowflake`, and the default export from `@eliware/snowflake` use one shared generator.
135
162
  The `constants` export provides `epoch`, `sequenceBits`, `processBits`, and `workerBits` values as `bigint`.
136
163
 
@@ -141,7 +168,8 @@ Read the [Snowflake usage guide](https://github.com/eliware/snowflake/blob/main/
141
168
  The package exports these types:
142
169
 
143
170
  - `Logger`
144
- - `LoggerWithConfiguredLevels`, `SafeSerializedValue`, and `RedactionOptions`
171
+ - `LoggerWithConfiguredLevels`, `RedactionOptions`, and `SafeSerializedValue`
172
+ - `PathLogger`, `PathHelpersOptions`, and `PathHelpers`
145
173
  - `NodeSignal`, `SignalsLogger`, and `SignalsProcessLike`
146
174
  - `ProcessEvent`, `ProcessListener`, and `ProcessLike`
147
175
  - `RegisterHandlersOptions` and `RegisteredHandlers`
package/docs/package.md CHANGED
@@ -14,7 +14,7 @@ The package does not provide a CommonJS entry point.
14
14
 
15
15
  ## Runtime dependencies
16
16
 
17
- The package uses major version 13 of these Eliware packages:
17
+ The package uses major version 15 of these Eliware packages:
18
18
 
19
19
  - `@eliware/errors`
20
20
  - `@eliware/log`
package/docs/usage.md CHANGED
@@ -86,6 +86,18 @@ const localFile = fileUrlToPath(url);
86
86
  Pass a directory string when code does not have `import.meta`.
87
87
  Read the [API reference](api.md) for each path helper.
88
88
 
89
+ Use `createPathHelpers` when your app must record path operations with a custom logger.
90
+
91
+ ```js
92
+ import { createPathHelpers } from "@eliware/common";
93
+
94
+ const records = [];
95
+ const helpers = createPathHelpers({ logger: { log: (record) => records.push(record) } });
96
+ const file = helpers.path(import.meta, "data", "input.json");
97
+ ```
98
+
99
+ The helper writes a debug record after it completes a path operation.
100
+
89
101
  ## Use logger APIs
90
102
 
91
103
  Use the default `log` object or create a logger with `createLogger(options)`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eliware/common",
3
- "version": "13.0.0",
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": "^13.0.0",
48
- "@eliware/log": "^13.0.0",
49
- "@eliware/path": "^13.0.0",
50
- "@eliware/redact": "^13.0.0",
51
- "@eliware/signals": "^13.0.0",
52
- "@eliware/snowflake": "^13.0.0"
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": "^13.0.0",
55
+ "@eliware/test": "^15.0.0",
56
56
  "typescript": "^7.0.2"
57
57
  },
58
58
  "jest": {
@@ -1,4 +1,4 @@
1
- version: "13.0"
1
+ version: "15.0"
2
2
  description: Defines requirements for the Eliware shared package.
3
3
  directives:
4
4
  - id: E-199.0
@@ -0,0 +1,9 @@
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,6 @@
1
1
  import * as fs from "fs";
2
2
  export { fs };
3
- export { createLogger, default as log, safeSerialize } from "@eliware/log";
3
+ export { createLogger, default as log } from "@eliware/log";
4
4
  export type {
5
5
  LoggerWithConfiguredLevels,
6
6
  RedactionOptions,
@@ -8,13 +8,15 @@ export type {
8
8
  } from "@eliware/log";
9
9
  export {
10
10
  path,
11
+ createPathHelpers,
11
12
  pathUrl,
12
13
  getCurrentDirname,
13
14
  getCurrentFilename,
14
15
  resolvePath,
15
16
  relativePath,
16
17
  fileUrlToPath,
17
- } from "@eliware/path";
18
+ } from "./path.mjs";
19
+ export type { PathLogger, PathHelpersOptions, PathHelpers } from "@eliware/path";
18
20
  export {
19
21
  createSnowflakeGenerator,
20
22
  generate,
@@ -29,6 +31,7 @@ export {
29
31
  redactHeaders,
30
32
  redactText,
31
33
  replaceLiteralSecret,
34
+ safeSerialize,
32
35
  } from "@eliware/redact";
33
36
  export type {
34
37
  RedactionPolicy,
@@ -36,8 +39,8 @@ export type {
36
39
  StructuredRedactionOptions,
37
40
  TextRedactionOptions,
38
41
  } from "@eliware/redact";
39
- export { default as registerHandlers } from "@eliware/errors";
40
- export { defaultEvents } from "@eliware/errors";
42
+ export { default as registerHandlers } from "./errors.mjs";
43
+ export { defaultEvents } from "./errors.mjs";
41
44
  export { default as registerSignals } from "@eliware/signals";
42
45
  export type {
43
46
  Logger,
package/src/index.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  export { default as fs } from "./fs.mjs";
2
- export { default as log, createLogger, safeSerialize } from "./log.mjs";
2
+ export { default as log, createLogger } from "@eliware/log";
3
3
  export {
4
4
  default as path,
5
+ createPathHelpers,
5
6
  pathUrl,
6
7
  getCurrentDirname,
7
8
  getCurrentFilename,
@@ -22,6 +23,7 @@ export {
22
23
  redactHeaders,
23
24
  redactText,
24
25
  replaceLiteralSecret,
26
+ safeSerialize,
25
27
  } from "@eliware/redact";
26
28
  export { defaultEvents, default as registerHandlers } from "./errors.mjs";
27
29
  export { default as registerSignals } from "./signals.mjs";
package/src/path.d.mts ADDED
@@ -0,0 +1,12 @@
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/path.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  path,
3
+ createPathHelpers,
3
4
  pathUrl,
4
5
  getCurrentDirname,
5
6
  getCurrentFilename,
@@ -10,6 +11,7 @@ import {
10
11
 
11
12
  export {
12
13
  path,
14
+ createPathHelpers,
13
15
  pathUrl,
14
16
  getCurrentDirname,
15
17
  getCurrentFilename,
package/src/log.mjs DELETED
@@ -1,4 +0,0 @@
1
- import { createLogger, log, safeSerialize } from "@eliware/log";
2
-
3
- export default log;
4
- export { createLogger, log, safeSerialize };