lifecycleion 0.0.8 → 0.0.10
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/README.md +45 -36
- package/dist/lib/domain-utils/domain-utils.cjs +1154 -0
- package/dist/lib/domain-utils/domain-utils.cjs.map +1 -0
- package/dist/lib/domain-utils/domain-utils.d.cts +210 -0
- package/dist/lib/domain-utils/domain-utils.d.ts +210 -0
- package/dist/lib/domain-utils/domain-utils.js +1112 -0
- package/dist/lib/domain-utils/domain-utils.js.map +1 -0
- package/dist/lib/http-client/index.cjs +5254 -0
- package/dist/lib/http-client/index.cjs.map +1 -0
- package/dist/lib/http-client/index.d.cts +372 -0
- package/dist/lib/http-client/index.d.ts +372 -0
- package/dist/lib/http-client/index.js +5207 -0
- package/dist/lib/http-client/index.js.map +1 -0
- package/dist/lib/http-client-mock/index.cjs +525 -0
- package/dist/lib/http-client-mock/index.cjs.map +1 -0
- package/dist/lib/http-client-mock/index.d.cts +129 -0
- package/dist/lib/http-client-mock/index.d.ts +129 -0
- package/dist/lib/http-client-mock/index.js +488 -0
- package/dist/lib/http-client-mock/index.js.map +1 -0
- package/dist/lib/http-client-node/index.cjs +1112 -0
- package/dist/lib/http-client-node/index.cjs.map +1 -0
- package/dist/lib/http-client-node/index.d.cts +43 -0
- package/dist/lib/http-client-node/index.d.ts +43 -0
- package/dist/lib/http-client-node/index.js +1075 -0
- package/dist/lib/http-client-node/index.js.map +1 -0
- package/dist/lib/http-client-xhr/index.cjs +323 -0
- package/dist/lib/http-client-xhr/index.cjs.map +1 -0
- package/dist/lib/http-client-xhr/index.d.cts +23 -0
- package/dist/lib/http-client-xhr/index.d.ts +23 -0
- package/dist/lib/http-client-xhr/index.js +286 -0
- package/dist/lib/http-client-xhr/index.js.map +1 -0
- package/dist/lib/lifecycle-manager/index.cjs +118 -61
- package/dist/lib/lifecycle-manager/index.cjs.map +1 -1
- package/dist/lib/lifecycle-manager/index.js +118 -61
- package/dist/lib/lifecycle-manager/index.js.map +1 -1
- package/dist/lib/lru-cache/index.cjs +274 -0
- package/dist/lib/lru-cache/index.cjs.map +1 -0
- package/dist/lib/lru-cache/index.d.cts +84 -0
- package/dist/lib/lru-cache/index.d.ts +84 -0
- package/dist/lib/lru-cache/index.js +249 -0
- package/dist/lib/lru-cache/index.js.map +1 -0
- package/dist/lib/retry-utils/index.d.cts +3 -23
- package/dist/lib/retry-utils/index.d.ts +3 -23
- package/dist/types-CUPvmYQ8.d.cts +868 -0
- package/dist/types-D_MywcG0.d.cts +23 -0
- package/dist/types-D_MywcG0.d.ts +23 -0
- package/dist/types-Hw2PUTIT.d.ts +868 -0
- package/package.json +45 -3
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Lifecycleion v0.0.
|
|
1
|
+
# Lifecycleion v0.0.10
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/js/lifecycleion)
|
|
4
4
|
|
|
@@ -23,6 +23,7 @@ Lifecycleion provides battle-tested, production-ready utilities that handle the
|
|
|
23
23
|
|
|
24
24
|
### Key Features
|
|
25
25
|
|
|
26
|
+
- 🌐 **HTTP Client** - Fluent request builder with Fetch, Node.js native, XHR, and Mock adapters, interceptors, observers, retries, cookies, and redirect control
|
|
26
27
|
- 🚀 **Lifecycle Management** - Orchestrate startup, shutdown, and runtime control of application components with dependency resolution
|
|
27
28
|
- 🪵 **Flexible Logger** - Sink-based logger with log levels, redaction, and service scoping
|
|
28
29
|
- 🔄 **Retry Utilities** - Fixed and exponential backoff strategies with cancellation support
|
|
@@ -56,10 +57,15 @@ import { RetryRunner } from 'lifecycleion/retry-utils';
|
|
|
56
57
|
const logger = createLogger({ service: 'my-app' });
|
|
57
58
|
|
|
58
59
|
// Set up retry logic
|
|
59
|
-
const runner = new RetryRunner(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
const runner = new RetryRunner(
|
|
61
|
+
{ strategy: 'fixed', maxRetryAttempts: 3, delayMS: 1000 },
|
|
62
|
+
async (reportResult) => {
|
|
63
|
+
// Your operation here
|
|
64
|
+
reportResult('success');
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
await runner.run(true);
|
|
63
69
|
|
|
64
70
|
// Manage component lifecycle
|
|
65
71
|
class MyComponent extends BaseComponent {
|
|
@@ -81,37 +87,40 @@ await manager.startAllComponents();
|
|
|
81
87
|
|
|
82
88
|
Each library has comprehensive documentation in the [docs](./docs) folder. Click on any library name in the table below to view detailed usage examples, API references, and best practices.
|
|
83
89
|
|
|
84
|
-
| Library | Import Path
|
|
85
|
-
| ------------------------------------------------------------------ |
|
|
86
|
-
| [arrays](./docs/arrays.md) | `lifecycleion/arrays`
|
|
87
|
-
| [ascii-tables](./docs/ascii-tables.md) | `lifecycleion/ascii-tables`
|
|
88
|
-
| [clamp](./docs/clamp.md) | `lifecycleion/clamp`
|
|
89
|
-
| [constants](./docs/constants.md) | `lifecycleion/constants`
|
|
90
|
-
| [curly-brackets](./docs/curly-brackets.md) | `lifecycleion/curly-brackets`
|
|
91
|
-
| [deep-clone](./docs/deep-clone.md) | `lifecycleion/deep-clone`
|
|
92
|
-
| [dev-mode](./docs/dev-mode.md) | `lifecycleion/dev-mode`
|
|
93
|
-
| [
|
|
94
|
-
| [
|
|
95
|
-
| [
|
|
96
|
-
| [
|
|
97
|
-
| [
|
|
98
|
-
| [is-
|
|
99
|
-
| [is-
|
|
100
|
-
| [is-
|
|
101
|
-
| [
|
|
102
|
-
| [
|
|
103
|
-
| [
|
|
104
|
-
| [
|
|
105
|
-
| [
|
|
106
|
-
| [
|
|
107
|
-
| [
|
|
108
|
-
| [
|
|
109
|
-
| [
|
|
110
|
-
| [
|
|
111
|
-
| [
|
|
112
|
-
| [
|
|
113
|
-
| [
|
|
114
|
-
| [
|
|
90
|
+
| Library | Import Path | Description |
|
|
91
|
+
| ------------------------------------------------------------------ | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
92
|
+
| [arrays](./docs/arrays.md) | `lifecycleion/arrays` | Array utility functions for filtering, comparison, deduplication, and string manipulation |
|
|
93
|
+
| [ascii-tables](./docs/ascii-tables.md) | `lifecycleion/ascii-tables` | Key-value and multi-column ASCII tables with word wrapping, nesting, and emoji support |
|
|
94
|
+
| [clamp](./docs/clamp.md) | `lifecycleion/clamp` | Number clamping utilities with safe handling for non-finite values and nullish inputs |
|
|
95
|
+
| [constants](./docs/constants.md) | `lifecycleion/constants` | Common string constants including whitespace helpers and Python-style character sets |
|
|
96
|
+
| [curly-brackets](./docs/curly-brackets.md) | `lifecycleion/curly-brackets` | String templating with `{{placeholders}}`, fallbacks, escaping, and compiled templates |
|
|
97
|
+
| [deep-clone](./docs/deep-clone.md) | `lifecycleion/deep-clone` | Deep clone utility with circular reference detection for objects, arrays, Maps, Sets, and more |
|
|
98
|
+
| [dev-mode](./docs/dev-mode.md) | `lifecycleion/dev-mode` | Runtime-settable dev/production mode flag with auto-detection from CLI args or NODE_ENV |
|
|
99
|
+
| [domain-utils](./docs/domain-utils.md) | `lifecycleion/domain-utils` | Hardened helpers for normalizing and matching domains and origins for CORS and routing, with IDNA/TR46, IPv6, and wildcard semantics |
|
|
100
|
+
| [error-to-string](./docs/error-to-string.md) | `lifecycleion/error-to-string` | Format errors into readable ASCII tables with support for nested info and sensitive field masking |
|
|
101
|
+
| [event-emitter](./docs/event-emitter.md) | `lifecycleion/event-emitter` | Lightweight event emitter with protected and public variants, type safety, and memory management |
|
|
102
|
+
| [http-client](./docs/http-client.md) | `lifecycleion/http-client` (+ `-node`, `-xhr`, `-mock`) | Fluent HTTP client with Fetch, Node.js native, XHR, and Mock adapters, interceptors, observers, retries, cookies, and redirect control |
|
|
103
|
+
| [id-helpers](./docs/id-helpers.md) | `lifecycleion/id-helpers` | Unified ID generation and validation for ObjectID, UUID v4, UUID v7, and ULID |
|
|
104
|
+
| [is-boolean](./docs/is-boolean.md) | `lifecycleion/is-boolean` | Type guard to check if a value is a boolean |
|
|
105
|
+
| [is-function](./docs/is-function.md) | `lifecycleion/is-function` | Check whether a value is a function |
|
|
106
|
+
| [is-number](./docs/is-number.md) | `lifecycleion/is-number` | Type guards to check whether a value is a valid number, with and without finite enforcement |
|
|
107
|
+
| [is-plain-object](./docs/is-plain-object.md) | `lifecycleion/is-plain-object` | Type guard to check if a value is a plain object (not null, not an array) |
|
|
108
|
+
| [is-promise](./docs/is-promise.md) | `lifecycleion/is-promise` | Thenable/promise detection following the Promises/A+ specification |
|
|
109
|
+
| [json-helpers](./docs/json-helpers.md) | `lifecycleion/json-helpers` | JSON formatting utilities |
|
|
110
|
+
| [lru-cache](./docs/lru-cache.md) | `lifecycleion/lru-cache` | TTL-aware LRU cache with entry-count and size-based eviction, custom size calculators, and per-entry TTL overrides |
|
|
111
|
+
| [lifecycle-manager](./docs/lifecycle-manager.md) | `lifecycleion/lifecycle-manager` | Lifecycle orchestration for managing startup, shutdown, and runtime control of application components |
|
|
112
|
+
| [logger](./docs/logger.md) | `lifecycleion/logger` | Flexible sink-based logger with log levels, redaction, template strings, and service scoping |
|
|
113
|
+
| [padding-utils](./docs/padding-utils.md) | `lifecycleion/padding-utils` | String padding utilities for left, right, and center alignment with a configurable pad character |
|
|
114
|
+
| [process-signal-manager](./docs/process-signal-manager.md) | `lifecycleion/process-signal-manager` | Unified handler for process signals (SIGINT, SIGTERM, SIGHUP, etc.) and keyboard shortcuts with graceful shutdown and hot-reload support |
|
|
115
|
+
| [promise-protected-resolver](./docs/promise-protected-resolver.md) | `lifecycleion/promise-protected-resolver` | Promise wrapper with `resolveOnce` and `rejectOnce` that guarantee a promise is only settled once |
|
|
116
|
+
| [retry-utils](./docs/retry-utils.md) | `lifecycleion/retry-utils` | Retry logic with fixed and exponential backoff via `RetryPolicy` (low-level) and `RetryRunner` (high-level with events and cancellation) |
|
|
117
|
+
| [safe-handle-callback](./docs/safe-handle-callback.md) | `lifecycleion/safe-handle-callback` | Safely execute sync or async callbacks with automatic error reporting via the standard `reportError` event API |
|
|
118
|
+
| [serialize-error](./docs/serialize-error.md) | `lifecycleion/serialize-error` | Convert any `Error` into a plain JSON-serializable object and back again for IPC, RPCs, and database storage |
|
|
119
|
+
| [single-event-observer](./docs/single-event-observer.md) | `lifecycleion/single-event-observer` | Lightweight type-safe observer pattern for a single event type, with public and protected notify variants |
|
|
120
|
+
| [sleep](./docs/sleep.md) | `lifecycleion/sleep` | Pause async execution for a given number of milliseconds |
|
|
121
|
+
| [strings](./docs/strings.md) | `lifecycleion/strings` | String type guard, case conversion (PascalCase, camelCase, CONSTANT_CASE), grapheme splitting, character filtering, and chopping helpers |
|
|
122
|
+
| [tmp-dir](./docs/tmp-dir.md) | `lifecycleion/tmp-dir` | Create and automatically clean up uniquely-named temporary directories with configurable prefix, postfix, and unsafe cleanup support |
|
|
123
|
+
| [unix-time-helpers](./docs/unix-time-helpers.md) | `lifecycleion/unix-time-helpers` | Unix timestamp utilities for seconds, milliseconds, high-resolution timing, and unit conversion |
|
|
115
124
|
|
|
116
125
|
## Change Log
|
|
117
126
|
|