@ix-xs/node-comfort 1.2.0 → 2.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.
Files changed (75) hide show
  1. package/CHANGELOG.md +190 -0
  2. package/README.md +136 -549
  3. package/index.js +80 -35
  4. package/package.json +160 -33
  5. package/src/Arr.js +887 -419
  6. package/src/Async.js +585 -0
  7. package/src/Cache.js +329 -0
  8. package/src/Checker.js +971 -539
  9. package/src/Cli.js +1034 -0
  10. package/src/Color.js +415 -0
  11. package/src/Crypto.js +707 -0
  12. package/src/Emitter.js +289 -0
  13. package/src/Env.js +555 -0
  14. package/src/FS.js +1483 -894
  15. package/src/Func.js +670 -353
  16. package/src/Http.js +538 -0
  17. package/src/Id.js +384 -201
  18. package/src/Logger.js +739 -378
  19. package/src/Num.js +844 -361
  20. package/src/Obj.js +855 -372
  21. package/src/SQLite.js +1308 -1005
  22. package/src/Schema.js +1586 -0
  23. package/src/Str.js +983 -436
  24. package/src/Sys.js +511 -0
  25. package/src/Time.js +1260 -422
  26. package/src/Utils.js +321 -325
  27. package/src/errors.js +292 -0
  28. package/types/index.d.ts +693 -526
  29. package/types/src/Arr.d.ts +455 -145
  30. package/types/src/Arr.d.ts.map +1 -1
  31. package/types/src/Async.d.ts +321 -0
  32. package/types/src/Async.d.ts.map +1 -0
  33. package/types/src/Cache.d.ts +195 -0
  34. package/types/src/Cache.d.ts.map +1 -0
  35. package/types/src/Checker.d.ts +501 -235
  36. package/types/src/Checker.d.ts.map +1 -1
  37. package/types/src/Cli.d.ts +582 -0
  38. package/types/src/Cli.d.ts.map +1 -0
  39. package/types/src/Color.d.ts +294 -0
  40. package/types/src/Color.d.ts.map +1 -0
  41. package/types/src/Crypto.d.ts +534 -0
  42. package/types/src/Crypto.d.ts.map +1 -0
  43. package/types/src/Emitter.d.ts +170 -0
  44. package/types/src/Emitter.d.ts.map +1 -0
  45. package/types/src/Env.d.ts +382 -0
  46. package/types/src/Env.d.ts.map +1 -0
  47. package/types/src/FS.d.ts +686 -238
  48. package/types/src/FS.d.ts.map +1 -1
  49. package/types/src/Func.d.ts +380 -135
  50. package/types/src/Func.d.ts.map +1 -1
  51. package/types/src/Http.d.ts +374 -0
  52. package/types/src/Http.d.ts.map +1 -0
  53. package/types/src/Id.d.ts +149 -68
  54. package/types/src/Id.d.ts.map +1 -1
  55. package/types/src/Logger.d.ts +363 -46
  56. package/types/src/Logger.d.ts.map +1 -1
  57. package/types/src/Num.d.ts +473 -137
  58. package/types/src/Num.d.ts.map +1 -1
  59. package/types/src/Obj.d.ts +390 -104
  60. package/types/src/Obj.d.ts.map +1 -1
  61. package/types/src/SQLite.d.ts +646 -309
  62. package/types/src/SQLite.d.ts.map +1 -1
  63. package/types/src/Schema.d.ts +940 -0
  64. package/types/src/Schema.d.ts.map +1 -0
  65. package/types/src/Str.d.ts +569 -166
  66. package/types/src/Str.d.ts.map +1 -1
  67. package/types/src/Sys.d.ts +269 -0
  68. package/types/src/Sys.d.ts.map +1 -0
  69. package/types/src/Time.d.ts +663 -204
  70. package/types/src/Time.d.ts.map +1 -1
  71. package/types/src/Utils.d.ts +154 -102
  72. package/types/src/Utils.d.ts.map +1 -1
  73. package/types/src/errors.d.ts +292 -0
  74. package/types/src/errors.d.ts.map +1 -0
  75. package/types/index.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Time.d.ts","sourceRoot":"","sources":["../../src/Time.js"],"names":[],"mappings":";;;;IA2HE;;;;;;;;;OASG;IACH,2BAHW,MAAM,GACJ,UAAU,CAKtB;IAED;;;;;;;;;OASG;IACH,+BAHW,MAAM,GAAC,SAAS,GACd,UAAU,CAKtB;IAED;;;;OAIG;IACH,sBAFa;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAC,SAAS,CAAA;KAAE,CAI1D;IAED;;;;;;;;;;;;OAYG;IACH,8BAHW,MAAM,GAAC,MAAM,GACX,MAAM,GAAC,IAAI,CAkBvB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aAAa,CAyCzB"}
@@ -1,124 +1,176 @@
1
1
  /**
2
- * Waits for a given number of milliseconds.
3
- *
4
- * @example
5
- * await nodeComfort.wait(500); // waits 500 ms
6
- *
7
- * @param {number} ms - Delay in milliseconds.
8
- * @returns {Promise<void>} A promise that resolves after the delay.
2
+ * Options for `wait()`.
9
3
  */
10
- export function wait(ms: number): Promise<void>;
4
+ export type WaitOptions = {
5
+ /**
6
+ * Cancels the wait; the promise rejects with an `AbortError`.
7
+ */
8
+ signal?: AbortSignal | undefined;
9
+ /**
10
+ * Let the process exit even if the timer is still pending.
11
+ */
12
+ unref?: boolean | undefined;
13
+ };
11
14
  /**
12
- * Polls a predicate at a given interval and emits events when it matches or times out.
13
- *
14
- * The predicate is evaluated every `options.interval` milliseconds (default: 50 ms).
15
- * Be careful with the default interval: 50 ms is very frequent polling and can be
16
- * unnecessarily CPU‑intensive if your predicate or trigger handlers are heavy.
17
- * When `options.max` is `null`, the predicate can match indefinitely (infinite triggers),
18
- * so you should choose an interval that makes sense for your use‑case.
19
- *
20
- * A `when(...)` task is one‑shot: once it has been stopped (manually or via `max`/`timeout`),
21
- * calling `.start()` again on the same task will not restart it.
22
- *
23
- * @param {boolean|Promise<boolean>|(() => boolean|Promise<boolean>)} predicate
24
- * Condition to evaluate at each tick, or a function returning it.
25
- * @param {*} [payload={}]
26
- * Value passed to listeners when events are emitted (e.g. an object or message).
27
- * @param {object} [options]
28
- * @param {number} [options.interval=50]
29
- * Polling interval in milliseconds. Increase this value if your predicate is
30
- * expensive or you expect many triggers without a `max` limit.
31
- * @param {number|null} [options.timeout=null]
32
- * Maximum time in milliseconds before emitting a "timeout" event and stopping.
33
- * If `null`, no timeout is applied.
34
- * @param {number|null} [options.max=null]
35
- * Maximum number of successful predicate evaluations ("trigger" events) before
36
- * automatically stopping. If `null`, triggers are infinite until `stop()` is called.
37
- *
38
- * @example
39
- * // Basic usage: infinite triggers every 50 ms (default interval) – use with caution.
40
- * const task = nodeComfort.when(() => true, { message: "Ok" });
41
- *
42
- * task
43
- * .on("trigger", (payload) => {
44
- * console.log(payload.message);
45
- * // task.stop(); // stop when you’re done
46
- * })
47
- * .start();
48
- *
49
- * @example
50
- * // Safer usage: limit triggers and/or lower polling frequency.
51
- * nodeComfort.when(() => true, { message: "Ok" }, { max: 1, interval: 500 })
52
- * .on("trigger", (payload) => {
53
- * console.log(payload.message);
54
- * })
55
- * .on("timeout", (payload) => {
56
- * console.log("Timed out", payload);
57
- * })
58
- * .start();
59
- *
60
- * @returns {{
61
- * start: () => any,
62
- * stop: () => any,
63
- * on: <E extends "error"|"trigger"|"timeout">(event: E, handler: E extends "error"
64
- * ? (error: unknown) => void|Promise<void>
65
- * : (payload: any) => void|Promise<void>) => any
66
- * }} A small task controller with `start`, `stop` and `on`.
15
+ * Options for `when()`.
67
16
  */
68
- export function when(predicate: boolean | Promise<boolean> | (() => boolean | Promise<boolean>), payload?: any, options?: {
17
+ export type WhenOptions = {
18
+ /**
19
+ * Milliseconds between two checks. Defaults to `50`.
20
+ */
69
21
  interval?: number | undefined;
22
+ /**
23
+ * Give up after this many milliseconds and emit `"timeout"`.
24
+ */
70
25
  timeout?: number | null | undefined;
26
+ /**
27
+ * Stop after this many triggers.
28
+ */
71
29
  max?: number | null | undefined;
72
- }): {
73
- start: () => any;
74
- stop: () => any;
75
- on: <E extends "error" | "trigger" | "timeout">(event: E, handler: E extends "error" ? (error: unknown) => void | Promise<void> : (payload: any) => void | Promise<void>) => any;
76
30
  };
77
31
  /**
78
- * Installs process-level safety nets for errors, exits and signals.
79
- *
80
- * By default, it:
81
- * - logs uncaught exceptions and unhandled rejections,
82
- * - logs process exit codes,
83
- * - logs SIGINT/SIGTERM/SIGQUIT and exits with code 0.
84
- *
85
- * You can override each handler with `.on(event, handler)`.
32
+ * The task returned by `when()`. Every method returns the task, so calls chain.
33
+ */
34
+ export type WhenTask = {
35
+ /**
36
+ * Starts checking. A stopped task can't be restarted.
37
+ */
38
+ start: () => WhenTask;
39
+ /**
40
+ * Stops checking and clears the timers.
41
+ */
42
+ stop: () => WhenTask;
43
+ /**
44
+ * Listens to `"trigger"` (the condition is true), `"error"` (it threw) or `"timeout"`.
45
+ */
46
+ on: <E extends "trigger" | "error" | "timeout">(event: E, handler: E extends "error" ? (error: unknown) => void : (payload: any) => void) => WhenTask;
47
+ };
48
+ /**
49
+ * Events you can customize on `dontCrash()`.
50
+ */
51
+ export type DontCrashEvent = "error" | "exit" | "sig" | "beforeExit";
52
+ /**
53
+ * Returned by `dontCrash()`.
54
+ */
55
+ export type DontCrashController = {
56
+ /**
57
+ * Replaces the handler for an event. Call it without a handler to restore the default one.
58
+ */
59
+ on: <E extends DontCrashEvent>(event: E, handler?: E extends "error" ? (error: unknown) => void : E extends "sig" ? (signal: NodeJS.Signals) => void : (code: number) => void) => DontCrashController;
60
+ /**
61
+ * Removes everything `dontCrash()` installed.
62
+ */
63
+ dispose: () => void;
64
+ };
65
+ /**
66
+ * Options for `wait()`.
67
+ * @typedef {object} WaitOptions
68
+ * @property {AbortSignal} [signal] Cancels the wait; the promise rejects with an `AbortError`.
69
+ * @property {boolean} [unref] Let the process exit even if the timer is still pending.
70
+ */
71
+ /**
72
+ * Options for `when()`.
73
+ * @typedef {object} WhenOptions
74
+ * @property {number} [interval] Milliseconds between two checks. Defaults to `50`.
75
+ * @property {number | null} [timeout] Give up after this many milliseconds and emit `"timeout"`.
76
+ * @property {number | null} [max] Stop after this many triggers.
77
+ */
78
+ /**
79
+ * The task returned by `when()`. Every method returns the task, so calls chain.
80
+ * @typedef {object} WhenTask
81
+ * @property {() => WhenTask} start Starts checking. A stopped task can't be restarted.
82
+ * @property {() => WhenTask} stop Stops checking and clears the timers.
83
+ * @property {<E extends "trigger" | "error" | "timeout">(event: E, handler: E extends "error" ? (error: unknown) => void : (payload: any) => void) => WhenTask} on Listens to `"trigger"` (the condition is true), `"error"` (it threw) or `"timeout"`.
84
+ */
85
+ /**
86
+ * Events you can customize on `dontCrash()`.
87
+ * @typedef {"error" | "exit" | "sig" | "beforeExit"} DontCrashEvent
88
+ */
89
+ /**
90
+ * Returned by `dontCrash()`.
91
+ * @typedef {object} DontCrashController
92
+ * @property {<E extends DontCrashEvent>(event: E, handler?: E extends "error" ? (error: unknown) => void : E extends "sig" ? (signal: NodeJS.Signals) => void : (code: number) => void) => DontCrashController} on Replaces the handler for an event. Call it without a handler to restore the default one.
93
+ * @property {() => void} dispose Removes everything `dontCrash()` installed.
94
+ */
95
+ /**
96
+ * Resolves after a delay, given in milliseconds or as a duration string.
86
97
  *
87
98
  * @example
88
- * // Use defaults:
89
- * nodeComfort.dontCrash();
99
+ * await nc.wait(500);
100
+ * await nc.wait("2s");
101
+ * await nc.wait("1m", { signal: controller.signal });
102
+ *
103
+ * @param {number | string} duration Milliseconds, or a string like `"250ms"`, `"2s"`, `"1m30s"`.
104
+ * @param {WaitOptions} [options]
105
+ * @returns {Promise<void>}
106
+ * @throws {AbortError} If the signal is aborted.
107
+ * @throws {TypeError} If the duration can't be parsed.
108
+ */
109
+ export function wait(duration: number | string, options?: WaitOptions): Promise<void>;
110
+ /**
111
+ * Checks a condition at a regular interval and tells you when it's true.
112
+ * Call `.start()` once your listeners are in place. If you just want to
113
+ * await a condition, `nc.async.poll()` is simpler.
90
114
  *
91
115
  * @example
92
- * // Custom error handler:
93
- * nodeComfort.dontCrash().on("error", (err) => {
94
- * console.error("Global error:", err);
95
- * process.exit(1);
96
- * });
116
+ * nc.when(() => queue.length > 0, { reason: "jobs waiting" }, { interval: 500, max: 1, timeout: 10_000 })
117
+ * .on("trigger", (payload) => nc.info(payload.reason))
118
+ * .on("timeout", () => nc.warn("Nothing happened in 10s"))
119
+ * .start();
97
120
  *
98
- * @returns {{
99
- * on: <E extends "error"|"exit"|"sig"|"beforeExit">(event: E, handler?: (
100
- * E extends "error" ? (error: Error|unknown) => void|Promise<void> :
101
- * E extends "exit" ? (code: number) => void|Promise<void> :
102
- * E extends "sig" ? (signal: "SIGINT"|"SIGTERM"|"SIGQUIT") => void|Promise<void> :
103
- * (code: number) => void|Promise<void>
104
- * )) => any
105
- * }} A small controller to configure global handlers.
121
+ * @param {boolean | PromiseLike<boolean> | (() => unknown)} predicate The condition, or a function (sync or async) that returns it.
122
+ * @param {any} [payload={}] Passed to the `"trigger"` and `"timeout"` listeners.
123
+ * @param {WhenOptions} [options]
124
+ * @returns {WhenTask}
106
125
  */
107
- export function dontCrash(): {
108
- on: <E extends "error" | "exit" | "sig" | "beforeExit">(event: E, handler?: (E extends "error" ? (error: Error | unknown) => void | Promise<void> : E extends "exit" ? (code: number) => void | Promise<void> : E extends "sig" ? (signal: "SIGINT" | "SIGTERM" | "SIGQUIT") => void | Promise<void> : (code: number) => void | Promise<void>)) => any;
109
- };
126
+ export function when(predicate: boolean | PromiseLike<boolean> | (() => unknown), payload?: any, options?: WhenOptions): WhenTask;
110
127
  /**
111
- * Safely stringifies a value to pretty-printed JSON (4 spaces indent).
128
+ * Keeps the process alive when something goes wrong. Uncaught exceptions and
129
+ * unhandled rejections are logged instead of crashing, and `SIGINT`/`SIGTERM`
130
+ * are logged before a clean exit. Customize any of it with `.on()`.
112
131
  *
113
- * @param {*} value - Value to stringify.
114
- * @returns {string} JSON string representation.
132
+ * Only its own handlers are ever removed; listeners added by your code or by
133
+ * other libraries are left alone.
134
+ *
135
+ * @example
136
+ * nc.dontCrash()
137
+ * .on("error", (error) => sentry.captureException(error))
138
+ * .on("sig", async () => {
139
+ * await server.close();
140
+ * process.exit(0);
141
+ * });
142
+ *
143
+ * @returns {DontCrashController}
115
144
  */
116
- export function JSONString(value: any): string;
145
+ export function dontCrash(): DontCrashController;
117
146
  /**
118
- * Parses a JSON string.
147
+ * `JSON.stringify` that never throws. Circular references become
148
+ * `"[Circular]"`, bigints become strings, Maps become objects and Sets become
149
+ * arrays.
119
150
  *
120
- * @param {string} value - JSON string to parse.
121
- * @returns {*} Parsed value.
151
+ * @example
152
+ * nc.JSONString({ a: 1 }); // '{\n "a": 1\n}'
153
+ * nc.JSONString({ id: 10n, tags: new Set(["x"]) }, 0); // '{"id":"10","tags":["x"]}'
154
+ *
155
+ * @param {unknown} value
156
+ * @param {number} [spaces=4] Indentation. Use `0` for a single line.
157
+ * @returns {string} The JSON text, or `"undefined"` for values JSON can't represent.
158
+ */
159
+ export function JSONString(value: unknown, spaces?: number): string;
160
+ /**
161
+ * `JSON.parse` with an optional fallback. With a fallback, invalid input
162
+ * returns it instead of throwing.
163
+ *
164
+ * @example
165
+ * nc.JSONParse('{"a":1}'); // { a: 1 }
166
+ * nc.JSONParse("oops", null); // null
167
+ * nc.JSONParse("oops"); // throws SyntaxError
168
+ *
169
+ * @template [T=any]
170
+ * @param {string} text
171
+ * @param {T} [fallback] Returned when `text` isn't valid JSON.
172
+ * @returns {T}
173
+ * @throws {SyntaxError} If `text` is invalid and there's no fallback.
122
174
  */
123
- export function JSONParse(value: string): any;
175
+ export function JSONParse<T = any>(text: string, fallback?: T, ...args: any[]): T;
124
176
  //# sourceMappingURL=Utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../src/Utils.js"],"names":[],"mappings":"AAME;;;;;;;;GAQG;AACH,yBAHW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAIzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,gCA7CW,OAAO,GAAC,OAAO,CAAC,OAAO,CAAC,GAAC,CAAC,MAAM,OAAO,GAAC,OAAO,CAAC,OAAO,CAAC,CAAC,YAEzD,GAAC,YAGT;IAAyB,QAAQ;IAGH,OAAO;IAGP,GAAG;CAIjC,GAsBU;IACR,KAAK,EAAE,MAAM,GAAG,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,CAAC;IAChB,EAAE,EAAE,CAAC,CAAC,SAAS,OAAO,GAAC,SAAS,GAAC,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,SAAS,OAAO,GA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E,GAAG,KAAK,IAAI,KAAK,QAAQ;;;;;6BAKlJ,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,YAAY;;;;;;;;QAMtC,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,SAAS,OAAO,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,CAAC,SAAS,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,KAAK,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,KAAK,mBAAmB;;;;aACjM,MAAM,IAAI;;AAhCxB;;;;;GAKG;AAEH;;;;;;GAMG;AAEH;;;;;;GAMG;AAEH;;;GAGG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;;;GAaG;AACH,+BANW,MAAM,GAAG,MAAM,YACf,WAAW,GACT,OAAO,CAAC,IAAI,CAAC,CAqBzB;AAED;;;;;;;;;;;;;;;GAeG;AACH,gCALW,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,YAChD,GAAG,YACH,WAAW,GACT,QAAQ,CAuEpB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,6BAFa,mBAAmB,CAoE/B;AAKD;;;;;;;;;;;;GAYG;AACH,kCAJW,OAAO,WACP,MAAM,GACJ,MAAM,CAmBlB;AAED;;;;;;;;;;;;;;GAcG;AACH,0BANc,CAAC,cACJ,MAAM,aACN,CAAC,mBACC,CAAC,CAUb"}
@@ -0,0 +1,292 @@
1
+ /**
2
+ * Options shared by every error constructor.
3
+ */
4
+ export type NodeComfortErrorOptions = {
5
+ /**
6
+ * Machine-readable code, like `"ETIMEDOUT"`.
7
+ */
8
+ code?: string | undefined;
9
+ /**
10
+ * The error that caused this one, kept as `error.cause`.
11
+ */
12
+ cause?: unknown;
13
+ };
14
+ /**
15
+ * One problem found while validating data.
16
+ */
17
+ export type ValidationIssue = {
18
+ /**
19
+ * Where the problem is, like `["user", "emails", 0]`. Empty for the root value.
20
+ */
21
+ path: Array<string | number>;
22
+ /**
23
+ * What went wrong: `"invalid_type"`, `"too_small"`, `"invalid_string"`, `"custom"`...
24
+ */
25
+ code: string;
26
+ /**
27
+ * A message you can show to users.
28
+ */
29
+ message: string;
30
+ /**
31
+ * The expected type, for type errors.
32
+ */
33
+ expected?: string | undefined;
34
+ /**
35
+ * The received type, for type errors.
36
+ */
37
+ received?: string | undefined;
38
+ };
39
+ /**
40
+ * The errors node-comfort throws. They all extend `NodeComfortError` (itself
41
+ * a regular `Error`) and carry a stable `code`, so you can branch on the
42
+ * kind of failure without parsing messages.
43
+ *
44
+ * @example
45
+ * try {
46
+ * await nc.http.get("https://api.example.com/users/42");
47
+ * } catch (error) {
48
+ * if (error instanceof nc.errors.HttpError && error.status === 404) return null;
49
+ * throw error;
50
+ * }
51
+ */
52
+ /**
53
+ * Options shared by every error constructor.
54
+ * @typedef {object} NodeComfortErrorOptions
55
+ * @property {string} [code] Machine-readable code, like `"ETIMEDOUT"`.
56
+ * @property {unknown} [cause] The error that caused this one, kept as `error.cause`.
57
+ */
58
+ /**
59
+ * Base class of every node-comfort error. `name` is the class name and
60
+ * `code` a stable identifier.
61
+ *
62
+ * @example
63
+ * if (error instanceof nc.errors.NodeComfortError) logger.warn(error.code);
64
+ */
65
+ export class NodeComfortError extends Error {
66
+ /**
67
+ * @param {string} message
68
+ * @param {NodeComfortErrorOptions} [options]
69
+ */
70
+ constructor(message: string, options?: NodeComfortErrorOptions);
71
+ /** Stable, machine-readable code. */
72
+ code: string;
73
+ }
74
+ /**
75
+ * Thrown by `nc.assert()` and `nc.assertType()`.
76
+ *
77
+ * @example
78
+ * nc.assert(user, "User is required");
79
+ */
80
+ export class AssertionError extends NodeComfortError {
81
+ /**
82
+ * @param {string} [message="Assertion failed"]
83
+ * @param {NodeComfortErrorOptions} [options]
84
+ */
85
+ constructor(message?: string, options?: NodeComfortErrorOptions);
86
+ }
87
+ /**
88
+ * Thrown when something takes too long: `func.timeout`, `async.poll`, HTTP
89
+ * requests, `emitter.waitFor`...
90
+ *
91
+ * @example
92
+ * try {
93
+ * await nc.func.timeout(slowTask(), 1000);
94
+ * } catch (error) {
95
+ * if (error instanceof nc.errors.TimeoutError) console.log(`Gave up after ${error.timeout}ms`);
96
+ * }
97
+ */
98
+ export class TimeoutError extends NodeComfortError {
99
+ /**
100
+ * @param {string} [message="Operation timed out"]
101
+ * @param {NodeComfortErrorOptions & { timeout?: number }} [options] Can include the time limit in milliseconds.
102
+ */
103
+ constructor(message?: string, options?: NodeComfortErrorOptions & {
104
+ timeout?: number;
105
+ });
106
+ /** The time limit in milliseconds, when known. */
107
+ timeout: number | undefined;
108
+ }
109
+ /**
110
+ * Thrown when an operation is cancelled with an `AbortSignal`. Its name is
111
+ * `"AbortError"`, like native abort errors, so existing checks keep working.
112
+ */
113
+ export class AbortError extends NodeComfortError {
114
+ /**
115
+ * @param {string} [message="The operation was aborted"]
116
+ * @param {NodeComfortErrorOptions} [options] Usually `{ cause: signal.reason }`.
117
+ */
118
+ constructor(message?: string, options?: NodeComfortErrorOptions);
119
+ }
120
+ /**
121
+ * One problem found while validating data.
122
+ * @typedef {object} ValidationIssue
123
+ * @property {Array<string|number>} path Where the problem is, like `["user", "emails", 0]`. Empty for the root value.
124
+ * @property {string} code What went wrong: `"invalid_type"`, `"too_small"`, `"invalid_string"`, `"custom"`...
125
+ * @property {string} message A message you can show to users.
126
+ * @property {string} [expected] The expected type, for type errors.
127
+ * @property {string} [received] The received type, for type errors.
128
+ */
129
+ /**
130
+ * Thrown when data doesn't match a schema or when environment variables are
131
+ * invalid. `issues` lists every problem, not just the first one.
132
+ *
133
+ * @example
134
+ * try {
135
+ * User.parse(body);
136
+ * } catch (error) {
137
+ * if (error instanceof nc.errors.ValidationError) return res.status(400).json(error.flatten());
138
+ * throw error;
139
+ * }
140
+ */
141
+ export class ValidationError extends NodeComfortError {
142
+ /**
143
+ * Turns issues into a readable message, one line per issue.
144
+ *
145
+ * @param {ValidationIssue[]} issues
146
+ * @returns {string}
147
+ */
148
+ static format(issues: ValidationIssue[]): string;
149
+ /**
150
+ * @param {ValidationIssue[]} issues
151
+ * @param {NodeComfortErrorOptions & { message?: string }} [options]
152
+ */
153
+ constructor(issues: ValidationIssue[], options?: NodeComfortErrorOptions & {
154
+ message?: string;
155
+ });
156
+ /** Every problem found, in order. */
157
+ issues: ValidationIssue[];
158
+ /**
159
+ * Groups messages by path, which is handy for forms.
160
+ *
161
+ * @example
162
+ * error.flatten(); // { email: ["Invalid email address"], age: ["Must be at least 18"] }
163
+ *
164
+ * @returns {Record<string, string[]>} Messages by dotted path (`""` for the root).
165
+ */
166
+ flatten(): Record<string, string[]>;
167
+ }
168
+ /**
169
+ * Thrown by `nc.http` when the response status isn't 2xx (unless you pass
170
+ * `throwHttpErrors: false`), and for network failures (`status` 0).
171
+ *
172
+ * @example
173
+ * try {
174
+ * await nc.http.get(url);
175
+ * } catch (error) {
176
+ * if (error instanceof nc.errors.HttpError) console.log(error.status, error.data);
177
+ * }
178
+ */
179
+ export class HttpError extends NodeComfortError {
180
+ /**
181
+ * @param {string} message
182
+ * @param {NodeComfortErrorOptions & { status?: number, statusText?: string, url?: string, method?: string, headers?: Record<string, string>, data?: unknown }} [options]
183
+ */
184
+ constructor(message: string, options?: NodeComfortErrorOptions & {
185
+ status?: number;
186
+ statusText?: string;
187
+ url?: string;
188
+ method?: string;
189
+ headers?: Record<string, string>;
190
+ data?: unknown;
191
+ });
192
+ /** HTTP status, like `404`. `0` when no response came back. */
193
+ status: number;
194
+ /** HTTP status text, like `"Not Found"`. */
195
+ statusText: string;
196
+ /** The requested URL. */
197
+ url: string;
198
+ /** The HTTP method, like `"GET"`. */
199
+ method: string;
200
+ /** Response headers, with lower-cased names. */
201
+ headers: Record<string, string>;
202
+ /** The response body: parsed JSON when possible, text otherwise. */
203
+ data: unknown;
204
+ }
205
+ /**
206
+ * Thrown by `nc.crypto.verifyJWT()`. The `code` tells you why:
207
+ * `ERR_JWT_MALFORMED`, `ERR_JWT_ALGORITHM`, `ERR_JWT_SIGNATURE`,
208
+ * `ERR_JWT_EXPIRED`, `ERR_JWT_NOT_BEFORE` or `ERR_JWT_CLAIM`.
209
+ *
210
+ * @example
211
+ * try {
212
+ * return nc.crypto.verifyJWT(token, secret);
213
+ * } catch (error) {
214
+ * if (error.code === "ERR_JWT_EXPIRED") return refreshSession();
215
+ * throw error;
216
+ * }
217
+ */
218
+ export class JWTError extends NodeComfortError {
219
+ /**
220
+ * @param {string} message
221
+ * @param {NodeComfortErrorOptions & { expiredAt?: Date }} [options]
222
+ */
223
+ constructor(message: string, options?: NodeComfortErrorOptions & {
224
+ expiredAt?: Date;
225
+ });
226
+ /** When the token expired. Only set for `ERR_JWT_EXPIRED`. */
227
+ expiredAt: Date | undefined;
228
+ }
229
+ /**
230
+ * Thrown by `nc.sys.run()` and `nc.sys.exec()` when a command fails, is
231
+ * killed or times out. Its output is kept on the error.
232
+ *
233
+ * @example
234
+ * try {
235
+ * await nc.sys.run("git", ["push"]);
236
+ * } catch (error) {
237
+ * console.error(error.exitCode, error.stderr);
238
+ * }
239
+ */
240
+ export class ProcessError extends NodeComfortError {
241
+ /**
242
+ * @param {string} message
243
+ * @param {NodeComfortErrorOptions & { command?: string, exitCode?: number | null, signal?: string | null, stdout?: string, stderr?: string, timedOut?: boolean }} [options]
244
+ */
245
+ constructor(message: string, options?: NodeComfortErrorOptions & {
246
+ command?: string;
247
+ exitCode?: number | null;
248
+ signal?: string | null;
249
+ stdout?: string;
250
+ stderr?: string;
251
+ timedOut?: boolean;
252
+ });
253
+ /** The command that ran. */
254
+ command: string;
255
+ /** Exit code, or `null` if a signal killed the process. */
256
+ exitCode: number | null;
257
+ /** The signal that killed the process, like `"SIGTERM"`. */
258
+ signal: string | null;
259
+ /** Everything written to stdout. */
260
+ stdout: string;
261
+ /** Everything written to stderr. */
262
+ stderr: string;
263
+ /** `true` if the process was killed for exceeding its `timeout`. */
264
+ timedOut: boolean;
265
+ }
266
+ /**
267
+ * Thrown by `nc.SQLite` when a statement fails. Check `sqliteCode` to handle
268
+ * specific cases like a duplicate value.
269
+ *
270
+ * @example
271
+ * try {
272
+ * db.insert("users", { email });
273
+ * } catch (error) {
274
+ * if (error.sqliteCode === "SQLITE_CONSTRAINT_UNIQUE") return "Email already taken";
275
+ * throw error;
276
+ * }
277
+ */
278
+ export class SQLiteError extends NodeComfortError {
279
+ /**
280
+ * @param {string} message
281
+ * @param {NodeComfortErrorOptions & { sql?: string, sqliteCode?: string }} [options]
282
+ */
283
+ constructor(message: string, options?: NodeComfortErrorOptions & {
284
+ sql?: string;
285
+ sqliteCode?: string;
286
+ });
287
+ /** The SQL that failed, when there is one. */
288
+ sql: string | undefined;
289
+ /** SQLite's error code, like `"SQLITE_CONSTRAINT_UNIQUE"`, when known. */
290
+ sqliteCode: string | undefined;
291
+ }
292
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.js"],"names":[],"mappings":";;;;;;;;;;;YAoBc,OAAO;;;;;;;;;UAgFP,KAAK,CAAC,MAAM,GAAC,MAAM,CAAC;;;;UACpB,MAAM;;;;aACN,MAAM;;;;;;;;;;AApGpB;;;;;;;;;;;;GAYG;AAEH;;;;;GAKG;AAEH;;;;;;GAMG;AACH;IACE;;;OAGG;IACH,qBAHW,MAAM,YACN,uBAAuB,EAQjC;IAFC,qCAAqC;IACrC,aAA8C;CAEjD;AAED;;;;;GAKG;AACH;IACE;;;OAGG;IACH,sBAHW,MAAM,YACN,uBAAuB,EAIjC;CACF;AAED;;;;;;;;;;GAUG;AACH;IACE;;;OAGG;IACH,sBAHW,MAAM,YACN,uBAAuB,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,EAMxD;IAFC,kDAAkD;IAClD,4BAA8B;CAEjC;AAED;;;GAGG;AACH;IACE;;;OAGG;IACH,sBAHW,MA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