@douglasneuroinformatics/libjs 2.6.0 → 2.8.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/dist/datetime.d.ts +1 -1
- package/dist/datetime.d.ts.map +1 -1
- package/dist/datetime.js +1 -1
- package/dist/exception.d.ts +5 -2
- package/dist/exception.d.ts.map +1 -1
- package/dist/exception.js +17 -4
- package/dist/http.d.ts +1 -1
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +1 -1
- package/dist/random.d.ts +1 -1
- package/dist/random.d.ts.map +1 -1
- package/dist/random.js +1 -1
- package/dist/range.d.ts +1 -1
- package/dist/range.d.ts.map +1 -1
- package/dist/range.js +1 -1
- package/dist/result.d.ts +1 -1
- package/dist/result.d.ts.map +1 -1
- package/dist/result.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/vendor/neverthrow.d.ts +12 -0
- package/dist/vendor/neverthrow.d.ts.map +1 -0
- package/dist/vendor/neverthrow.js +14 -0
- package/dist/zod.d.ts +1 -1
- package/dist/zod.d.ts.map +1 -1
- package/dist/zod.js +1 -1
- package/package.json +12 -3
package/dist/datetime.d.ts
CHANGED
package/dist/datetime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datetime.d.ts","sourceRoot":"","sources":["../src/datetime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"datetime.d.ts","sourceRoot":"","sources":["../src/datetime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAGrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,uFAAuF;AACvF,eAAO,MAAM,QAAQ,mEAMV,CAAC;AAEZ;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAEnD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAEnD;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE9C;AAED;;;;;;GAMG;AACH,wBAAsB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE1D;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC,QAAQ,EAAE,OAAO,mBAAmB,CAAC,QAAQ,CAAC,CAYzG"}
|
package/dist/datetime.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { err, ok } from 'neverthrow';
|
|
2
1
|
import { OutOfRangeException } from './exception.js';
|
|
2
|
+
import { err, ok } from './vendor/neverthrow.js';
|
|
3
3
|
/** A map that associates time units with their corresponding values in milliseconds */
|
|
4
4
|
export const TIME_MAP = new Map([
|
|
5
5
|
['day', 24 * 60 * 60 * 1000],
|
package/dist/exception.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { serializeError } from 'serialize-error';
|
|
2
2
|
import type { IsNever, RequiredKeysOf } from 'type-fest';
|
|
3
3
|
import type { z } from 'zod';
|
|
4
|
+
import { Result, ResultAsync } from './vendor/neverthrow.js';
|
|
4
5
|
import type { SingleKeyMap, ToAbstractConstructor } from './types.js';
|
|
5
6
|
type ExceptionName = `${string}Exception`;
|
|
6
7
|
type ExceptionOptions = {
|
|
@@ -32,7 +33,9 @@ interface ExceptionLike extends Error, ExceptionOptions {
|
|
|
32
33
|
toErr(): Result<never, this>;
|
|
33
34
|
toString(): string;
|
|
34
35
|
}
|
|
36
|
+
declare function parseStack(stack: string | undefined): string[];
|
|
35
37
|
declare function parseStack(error: Error): string[];
|
|
38
|
+
declare function errorToJSON(error: Error): string;
|
|
36
39
|
declare abstract class BaseException<TParams extends ExceptionParams, TOptions extends ExceptionOptions> extends Error implements ExceptionLike {
|
|
37
40
|
cause: TOptions['cause'];
|
|
38
41
|
details: TOptions['details'];
|
|
@@ -125,5 +128,5 @@ export declare const ValidationException: ExceptionType<{
|
|
|
125
128
|
[key: string]: unknown;
|
|
126
129
|
}>;
|
|
127
130
|
export type { ExceptionConstructor, ExceptionConstructorArgs, ExceptionLike, ExceptionName, ExceptionOptions, ExceptionParams, ExceptionStatic, ExceptionType };
|
|
128
|
-
export { BaseException, ExceptionBuilder, OutOfRangeException, parseStack, RuntimeException, ValueException };
|
|
131
|
+
export { BaseException, errorToJSON, ExceptionBuilder, OutOfRangeException, parseStack, RuntimeException, serializeError, ValueException };
|
|
129
132
|
//# sourceMappingURL=exception.d.ts.map
|
package/dist/exception.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exception.d.ts","sourceRoot":"","sources":["../src/exception.ts"],"names":[],"mappings":"AAMA,OAAO,
|
|
1
|
+
{"version":3,"file":"exception.d.ts","sourceRoot":"","sources":["../src/exception.ts"],"names":[],"mappings":"AAMA,OAAO,EAAe,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,OAAO,EAAiB,MAAM,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE5E,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEtE,KAAK,aAAa,GAAG,GAAG,MAAM,WAAW,CAAC;AAE1C,KAAK,gBAAgB,GAAG;IACtB,KAA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,CAAC,OAAO,EAAE,QAAQ,EAAE,cAAc,GAAG;SAAG,CAAC,IAAI,KAAK,GAAG,OAAO;KAAE,CAAC;CAIjH;AAED,QAAA,MAAQ,gBAAgB;;;;EAA2E,CAAC;AAEpG,QAAA,MAAQ,cAAc;;;;EAAyE,CAAC;AAEhG,QAAA,MAAQ,mBAAmB;;aAES,MAAM;aAAO,MAAM;eAAS,MAAM;;;;aAAzC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;;;;;;iBAApC,MAAM;iBAAO,MAAM;mBAAS,MAAM;;;;iBAAzC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE;eAKlB,MAAM;;iBALxB,MAAM;iBAAO,MAAM;mBAAS,MAAM;;;;iBAAzC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE;;EAQ9D,CAAC;AAEX,eAAO,MAAQ,mBAAmB;;;;aACL;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAA;KAAE;;;EAE1D,CAAC;AAEX,YAAY,EACV,oBAAoB,EACpB,wBAAwB,EACxB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,aAAa,EACd,CAAC;AAEF,OAAO,EACL,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,cAAc,EACf,CAAC"}
|
package/dist/exception.js
CHANGED
|
@@ -3,12 +3,25 @@
|
|
|
3
3
|
/* eslint-disable no-dupe-class-members */
|
|
4
4
|
import cleanStack from 'clean-stack';
|
|
5
5
|
import extractStack from 'extract-stack';
|
|
6
|
-
import {
|
|
6
|
+
import { isErrorLike, serializeError } from 'serialize-error';
|
|
7
7
|
import stringifyObject from 'stringify-object';
|
|
8
8
|
import { objectify } from './object.js';
|
|
9
9
|
import { indentLines } from './string.js';
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
import { err, errAsync, Result, ResultAsync } from './vendor/neverthrow.js';
|
|
11
|
+
function parseStack(errorOrStack) {
|
|
12
|
+
const stack = typeof errorOrStack === 'string' ? errorOrStack : errorOrStack?.stack;
|
|
13
|
+
return extractStack.lines(cleanStack(stack, { pretty: true }));
|
|
14
|
+
}
|
|
15
|
+
function errorToJSON(error) {
|
|
16
|
+
const serialize = (error) => {
|
|
17
|
+
const { cause, stack, ...serialized } = serializeError(error);
|
|
18
|
+
return {
|
|
19
|
+
...serialized,
|
|
20
|
+
cause: isErrorLike(cause) ? serialize(cause) : cause,
|
|
21
|
+
stack: parseStack(stack)
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
return JSON.stringify(serialize(error), null, 2);
|
|
12
25
|
}
|
|
13
26
|
class BaseException extends Error {
|
|
14
27
|
cause;
|
|
@@ -119,4 +132,4 @@ export const { ValidationException } = new ExceptionBuilder()
|
|
|
119
132
|
.setOptionsType()
|
|
120
133
|
.setParams({ message: 'Zod schema validation failed', name: 'ValidationException' })
|
|
121
134
|
.build();
|
|
122
|
-
export { BaseException, ExceptionBuilder, OutOfRangeException, parseStack, RuntimeException, ValueException };
|
|
135
|
+
export { BaseException, errorToJSON, ExceptionBuilder, OutOfRangeException, parseStack, RuntimeException, serializeError, ValueException };
|
package/dist/http.d.ts
CHANGED
package/dist/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAGA,OAAO,EAAM,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE;QACP,IAAI,EAAE,eAAe,CAAC;QACtB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,OAAO,EAAE;QACP,IAAI,EAAE,YAAY,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH,CAAC;AAEF,eAAO,MAAQ,cAAc;;cAdnB,eAAe;aAChB,MAAM;;cAML,YAAY;gBACV,MAAM;oBACF,MAAM;aACb,MAAM;;;;;EAUL,CAAC;AAEX,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,WAAW,CAAC,QAAQ,EAAE,OAAO,cAAc,CAAC,QAAQ,CAAC,CAyB/G;AAED,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,EAAE,QAAY,EAAE,OAAY,EAAE,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GAC3E,WAAW,CAAC,IAAI,EAAE,aAAa,CAAC,CAmBlC"}
|
package/dist/http.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ok, ResultAsync } from 'neverthrow';
|
|
2
1
|
import { sleep } from './datetime.js';
|
|
3
2
|
import { ExceptionBuilder, RuntimeException } from './exception.js';
|
|
4
3
|
import { asyncResultify } from './result.js';
|
|
4
|
+
import { ok, ResultAsync } from './vendor/neverthrow.js';
|
|
5
5
|
export const { FetchException } = new ExceptionBuilder()
|
|
6
6
|
.setOptionsType()
|
|
7
7
|
.setParams({
|
package/dist/random.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Result } from 'neverthrow';
|
|
2
1
|
import { ValueException } from './exception.js';
|
|
2
|
+
import type { Result } from './vendor/neverthrow.js';
|
|
3
3
|
/** Returns a random integer between `min` (inclusive) and `max` (not inclusive) */
|
|
4
4
|
export declare function randomInt(min: number, max: number): Result<number, typeof ValueException.Instance>;
|
|
5
5
|
/** Returns a random date between `start` and `end` (both inclusive) */
|
package/dist/random.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../src/random.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../src/random.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,mFAAmF;AACnF,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,cAAc,CAAC,QAAQ,CAAC,CAKlG;AAED,uEAAuE;AACvE,wBAAgB,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,OAAO,cAAc,CAAC,QAAQ,CAAC,CAO/F;AAED,4CAA4C;AAC5C,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,EAAE,OAAO,cAAc,CAAC,QAAQ,CAAC,CAKlF"}
|
package/dist/random.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ok } from 'neverthrow';
|
|
2
1
|
import { ValueException } from './exception.js';
|
|
2
|
+
import { ok } from './vendor/neverthrow.js';
|
|
3
3
|
/** Returns a random integer between `min` (inclusive) and `max` (not inclusive) */
|
|
4
4
|
export function randomInt(min, max) {
|
|
5
5
|
if (min >= max) {
|
package/dist/range.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Result } from 'neverthrow';
|
|
2
1
|
import { ValueException } from './exception.js';
|
|
2
|
+
import type { Result } from './vendor/neverthrow.js';
|
|
3
3
|
/** Return an array of integers between 0 (inclusive) and `end` (not inclusive) */
|
|
4
4
|
export declare function range(end: number): Result<readonly number[], typeof ValueException.Instance>;
|
|
5
5
|
/** Return an array of integers between `start` (inclusive) and `end` (not inclusive) */
|
package/dist/range.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../src/range.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../src/range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,kFAAkF;AAClF,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,SAAS,MAAM,EAAE,EAAE,OAAO,cAAc,CAAC,QAAQ,CAAC,CAAC;AAE9F,wFAAwF;AACxF,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,SAAS,MAAM,EAAE,EAAE,OAAO,cAAc,CAAC,QAAQ,CAAC,CAAC"}
|
package/dist/range.js
CHANGED
package/dist/result.d.ts
CHANGED
package/dist/result.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE7D,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAEvF"}
|
package/dist/result.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/array.ts","../src/datetime.ts","../src/exception.ts","../src/http.ts","../src/index.ts","../src/json.ts","../src/number.ts","../src/object.ts","../src/random.ts","../src/range.ts","../src/result.ts","../src/string.ts","../src/types.ts","../src/zod.ts"],"version":"5.6.3"}
|
|
1
|
+
{"root":["../src/array.ts","../src/datetime.ts","../src/exception.ts","../src/http.ts","../src/index.ts","../src/json.ts","../src/number.ts","../src/object.ts","../src/random.ts","../src/range.ts","../src/result.ts","../src/string.ts","../src/types.ts","../src/zod.ts","../src/vendor/neverthrow.ts"],"version":"5.6.3"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Err, Ok } from 'neverthrow';
|
|
2
|
+
declare module 'neverthrow' {
|
|
3
|
+
interface Err<T, E> {
|
|
4
|
+
unwrap(): T;
|
|
5
|
+
}
|
|
6
|
+
interface Ok<T, E> {
|
|
7
|
+
unwrap(): T;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export { Err, Ok };
|
|
11
|
+
export { err, errAsync, fromAsyncThrowable, fromPromise, fromSafePromise, fromThrowable, ok, okAsync, Result, ResultAsync, safeTry } from 'neverthrow';
|
|
12
|
+
//# sourceMappingURL=neverthrow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"neverthrow.d.ts","sourceRoot":"","sources":["../../src/vendor/neverthrow.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAU,MAAM,YAAY,CAAC;AAE7C,OAAO,QAAQ,YAAY,CAAC;IAC1B,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC;QAChB,MAAM,IAAI,CAAC,CAAC;KACb;IACD,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,CAAC,CAAC;KACb;CACF;AAYD,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AAEnB,OAAO,EACL,GAAG,EACH,QAAQ,EACR,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,aAAa,EACb,EAAE,EACF,OAAO,EACP,MAAM,EACN,WAAW,EACX,OAAO,EACR,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/only-throw-error */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
+
/* eslint-disable @typescript-eslint/consistent-type-definitions */
|
|
4
|
+
import { Err, Ok, Result } from 'neverthrow';
|
|
5
|
+
function unwrap() {
|
|
6
|
+
if (this.isErr()) {
|
|
7
|
+
throw this.error;
|
|
8
|
+
}
|
|
9
|
+
return this.value;
|
|
10
|
+
}
|
|
11
|
+
Err.prototype.unwrap = unwrap;
|
|
12
|
+
Ok.prototype.unwrap = unwrap;
|
|
13
|
+
export { Err, Ok };
|
|
14
|
+
export { err, errAsync, fromAsyncThrowable, fromPromise, fromSafePromise, fromThrowable, ok, okAsync, Result, ResultAsync, safeTry } from 'neverthrow';
|
package/dist/zod.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Result } from 'neverthrow';
|
|
2
1
|
import { z } from 'zod';
|
|
3
2
|
import { ValidationException } from './exception.js';
|
|
3
|
+
import type { Result } from './vendor/neverthrow.js';
|
|
4
4
|
/** Used to determine if object is of type `ZodType` independent of specific instances or library versions */
|
|
5
5
|
export declare function isZodType(arg: unknown): arg is z.ZodTypeAny;
|
|
6
6
|
export declare const $BooleanLike: z.ZodType<boolean, z.ZodTypeDef, any>;
|
package/dist/zod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../src/zod.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../src/zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAKrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,6GAA6G;AAC7G,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,CAAC,CAAC,UAAU,CAM3D;AAED,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,UAAU,EAAE,GAAG,CAShD,CAAC;AAEhB,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE,GAAG,CAK/C,CAAC;AAEf,eAAO,MAAM,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,UAAU,EAAE,GAAG,CAWtD,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,UAAU,EAAE,GAAG,CAOjE,CAAC;AAEL,wBAAgB,SAAS,CAAC,OAAO,SAAS,CAAC,CAAC,UAAU,EACpD,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,OAAO,GACf,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,mBAAmB,CAAC,QAAQ,CAAC,CAW/D"}
|
package/dist/zod.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ok } from 'neverthrow';
|
|
2
1
|
import { z } from 'zod';
|
|
3
2
|
import { ValidationException } from './exception.js';
|
|
4
3
|
import { isNumberLike, parseNumber } from './number.js';
|
|
5
4
|
import { isObject } from './object.js';
|
|
5
|
+
import { ok } from './vendor/neverthrow.js';
|
|
6
6
|
/** Used to determine if object is of type `ZodType` independent of specific instances or library versions */
|
|
7
7
|
export function isZodType(arg) {
|
|
8
8
|
let prototype = null;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douglasneuroinformatics/libjs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.8.0",
|
|
5
5
|
"packageManager": "pnpm@10.3.0",
|
|
6
6
|
"description": "A collection of utility functions and types for Node.js and the browser",
|
|
7
7
|
"author": "Joshua Unrau",
|
|
@@ -14,8 +14,16 @@
|
|
|
14
14
|
"bugs": {
|
|
15
15
|
"url": "https://github.com/DouglasNeuroInformatics/libjs/issues"
|
|
16
16
|
},
|
|
17
|
-
"
|
|
18
|
-
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./vendor/*": {
|
|
23
|
+
"types": "./dist/vendor/*.d.ts",
|
|
24
|
+
"import": "./dist/vendor/*.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
19
27
|
"files": [
|
|
20
28
|
"dist"
|
|
21
29
|
],
|
|
@@ -36,6 +44,7 @@
|
|
|
36
44
|
"dependencies": {
|
|
37
45
|
"clean-stack": "^5.2.0",
|
|
38
46
|
"extract-stack": "^3.0.0",
|
|
47
|
+
"serialize-error": "^12.0.0",
|
|
39
48
|
"stringify-object": "^5.0.0",
|
|
40
49
|
"type-fest": "^4.34.1"
|
|
41
50
|
},
|