@design-edito/tools 0.1.8 → 0.1.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.
@@ -1,24 +1,25 @@
1
1
  import {
2
- Random
3
- } from "../../chunks/chunk-WLL3FNVL.js";
2
+ register
3
+ } from "../../chunks/chunk-UAND5PYN.js";
4
+ import {
5
+ Bem
6
+ } from "../../chunks/chunk-KIONYWA7.js";
4
7
  import {
5
8
  generateNiceColor,
6
9
  niceColors
7
10
  } from "../../chunks/chunk-EDVNAV3G.js";
8
- import {
9
- Bem
10
- } from "../../chunks/chunk-KIONYWA7.js";
11
11
  import {
12
12
  classNameRegex,
13
13
  isValidClassName
14
14
  } from "../../chunks/chunk-W5A2TON3.js";
15
- import {
16
- register
17
- } from "../../chunks/chunk-B27DVNRX.js";
15
+ import "../../chunks/chunk-SI3URYBN.js";
16
+ import "../../chunks/chunk-JJFS2I7N.js";
18
17
  import {
19
18
  Crossenv
20
19
  } from "../../chunks/chunk-GJOU3UAL.js";
21
- import "../../chunks/chunk-RLESUSTH.js";
20
+ import {
21
+ Random
22
+ } from "../../chunks/chunk-WLL3FNVL.js";
22
23
  import "../../chunks/chunk-QXAJXTXV.js";
23
24
  import "../../chunks/chunk-HC6ZOHCS.js";
24
25
 
@@ -1,30 +1,4 @@
1
- type AnyFunc = (...args: any[]) => any;
2
- type ParamsOfNullableFunc<F extends AnyFunc | undefined | null> = F extends AnyFunc ? Parameters<F> : [];
3
- type ReturnTypeOfNullableFunc<F extends AnyFunc | undefined | null> = F extends AnyFunc ? ReturnType<F> : undefined;
1
+ import { Register as RegisterNamespace } from './register';
4
2
  export declare namespace Errors {
5
- type Factory<Params extends any[] = any[], Details = any> = {
6
- message: string;
7
- makeDetails?: (...params: Params) => Details;
8
- };
9
- type Index<Params extends any[] = any[], Details = any> = {
10
- [code: string]: Factory<Params, Details>;
11
- };
12
- type Data<RS extends Index, C extends keyof RS> = {
13
- code: C;
14
- message: RS[C]['message'];
15
- details: ReturnTypeOfNullableFunc<RS[C]['makeDetails']>;
16
- };
17
- class CustomError<Idx extends Index, Code extends keyof Idx> extends Error {
18
- code: Data<Idx, Code>['code'];
19
- details: Data<Idx, Code>['details'];
20
- constructor(data: Data<Idx, Code>);
21
- }
22
- class Register<Idx extends Index> {
23
- index: Idx;
24
- constructor(index: Idx);
25
- getFactory<C extends keyof Idx>(code: C): Idx[C];
26
- getData<C extends keyof Idx>(code: C, ...params: ParamsOfNullableFunc<Idx[C]['makeDetails']>): Data<Idx, C>;
27
- getError<C extends keyof Idx>(code: C, ...params: ParamsOfNullableFunc<Idx[C]['makeDetails']>): CustomError<Idx, C>;
28
- }
3
+ export import Register = RegisterNamespace;
29
4
  }
30
- export {};
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  Errors
3
- } from "../../chunks/chunk-RLESUSTH.js";
3
+ } from "../../chunks/chunk-SI3URYBN.js";
4
+ import "../../chunks/chunk-JJFS2I7N.js";
4
5
  export {
5
6
  Errors
6
7
  };
@@ -0,0 +1,33 @@
1
+ export declare namespace Register {
2
+ type RegisterEntry = {
3
+ message: string;
4
+ detailsMaker?: (...params: any[]) => any;
5
+ };
6
+ function from<Source extends {
7
+ [k: string]: RegisterEntry;
8
+ }>(source: Source): {
9
+ getMessage: <Code extends keyof Source>(code: Code) => Source[Code]["message"];
10
+ getDetailsMaker: <Code extends keyof Source>(code: Code) => Source[Code]["detailsMaker"] extends (...params: any[]) => any ? Source[Code]["detailsMaker"] : undefined;
11
+ getDetails: <Code extends keyof Source>(code: Code, ...params: (Source[Code]["detailsMaker"] extends (...params: any[]) => any ? Source[Code]["detailsMaker"] : undefined) extends (...params: infer P) => any ? P : []) => (Source[Code]["detailsMaker"] extends (...params: any[]) => any ? Source[Code]["detailsMaker"] : undefined) extends (...params: any[]) => infer R ? R : never;
12
+ getError: <Code extends keyof Source>(code: Code, ...params: (Source[Code]["detailsMaker"] extends (...params: any[]) => any ? Source[Code]["detailsMaker"] : undefined) extends (...params: infer P) => any ? P : []) => {
13
+ code: Code;
14
+ details: (Source[Code]["detailsMaker"] extends (...params: any[]) => any ? Source[Code]["detailsMaker"] : undefined) extends (...params: any[]) => infer R ? R : never;
15
+ name: string;
16
+ message: string;
17
+ stack?: string;
18
+ };
19
+ CustomError: {
20
+ new <Code extends keyof Source>(code: Code, ...params: (Source[Code]["detailsMaker"] extends (...params: any[]) => any ? Source[Code]["detailsMaker"] : undefined) extends (...params: infer P) => any ? P : []): {
21
+ code: Code;
22
+ details: (Source[Code]["detailsMaker"] extends (...params: any[]) => any ? Source[Code]["detailsMaker"] : undefined) extends (...params: any[]) => infer R ? R : never;
23
+ name: string;
24
+ message: string;
25
+ stack?: string;
26
+ };
27
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
28
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
29
+ stackTraceLimit: number;
30
+ };
31
+ source: Source;
32
+ };
33
+ }
@@ -0,0 +1,6 @@
1
+ import {
2
+ Register
3
+ } from "../../../chunks/chunk-JJFS2I7N.js";
4
+ export {
5
+ Register
6
+ };
@@ -1,27 +1,28 @@
1
+ import {
2
+ getPositionInsideParent
3
+ } from "../../chunks/chunk-VTPRO4NJ.js";
4
+ import {
5
+ getNodeAncestors
6
+ } from "../../chunks/chunk-SQZGZ3VT.js";
1
7
  import {
2
8
  Placeholders
3
9
  } from "../../chunks/chunk-VYW4IADX.js";
4
10
  import {
5
11
  insertNode
6
12
  } from "../../chunks/chunk-XA4HVHJ4.js";
13
+ import {
14
+ selectorToElement
15
+ } from "../../chunks/chunk-XVAGFNRL.js";
7
16
  import {
8
17
  stringToNodes
9
- } from "../../chunks/chunk-XPM2OFLI.js";
18
+ } from "../../chunks/chunk-BIVZM5DE.js";
10
19
  import {
11
20
  Sanitize
12
- } from "../../chunks/chunk-RASYEJ6T.js";
13
- import {
14
- selectorToElement
15
- } from "../../chunks/chunk-5FU3AIZ4.js";
16
- import "../../chunks/chunk-B27DVNRX.js";
21
+ } from "../../chunks/chunk-T4WHRHA3.js";
22
+ import "../../chunks/chunk-UAND5PYN.js";
23
+ import "../../chunks/chunk-SI3URYBN.js";
24
+ import "../../chunks/chunk-JJFS2I7N.js";
17
25
  import "../../chunks/chunk-GJOU3UAL.js";
18
- import {
19
- getNodeAncestors
20
- } from "../../chunks/chunk-SQZGZ3VT.js";
21
- import {
22
- getPositionInsideParent
23
- } from "../../chunks/chunk-VTPRO4NJ.js";
24
- import "../../chunks/chunk-RLESUSTH.js";
25
26
 
26
27
  // src/agnostic/html/index.ts
27
28
  var Html;
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  Sanitize
3
- } from "../../../chunks/chunk-RASYEJ6T.js";
4
- import "../../../chunks/chunk-B27DVNRX.js";
3
+ } from "../../../chunks/chunk-T4WHRHA3.js";
4
+ import "../../../chunks/chunk-UAND5PYN.js";
5
+ import "../../../chunks/chunk-SI3URYBN.js";
6
+ import "../../../chunks/chunk-JJFS2I7N.js";
5
7
  import "../../../chunks/chunk-GJOU3UAL.js";
6
- import "../../../chunks/chunk-RLESUSTH.js";
7
8
  export {
8
9
  Sanitize
9
10
  };
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  selectorToElement
3
- } from "../../../chunks/chunk-5FU3AIZ4.js";
4
- import "../../../chunks/chunk-B27DVNRX.js";
3
+ } from "../../../chunks/chunk-XVAGFNRL.js";
4
+ import "../../../chunks/chunk-UAND5PYN.js";
5
+ import "../../../chunks/chunk-SI3URYBN.js";
6
+ import "../../../chunks/chunk-JJFS2I7N.js";
5
7
  import "../../../chunks/chunk-GJOU3UAL.js";
6
- import "../../../chunks/chunk-RLESUSTH.js";
7
8
  export {
8
9
  selectorToElement
9
10
  };
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  stringToNodes
3
- } from "../../../chunks/chunk-XPM2OFLI.js";
4
- import "../../../chunks/chunk-RASYEJ6T.js";
5
- import "../../../chunks/chunk-B27DVNRX.js";
3
+ } from "../../../chunks/chunk-BIVZM5DE.js";
4
+ import "../../../chunks/chunk-T4WHRHA3.js";
5
+ import "../../../chunks/chunk-UAND5PYN.js";
6
+ import "../../../chunks/chunk-SI3URYBN.js";
7
+ import "../../../chunks/chunk-JJFS2I7N.js";
6
8
  import "../../../chunks/chunk-GJOU3UAL.js";
7
- import "../../../chunks/chunk-RLESUSTH.js";
8
9
  export {
9
10
  stringToNodes
10
11
  };
@@ -1,3 +1,6 @@
1
+ import {
2
+ Assert
3
+ } from "../../chunks/chunk-W7YBGJ4H.js";
1
4
  import {
2
5
  getCurrentDownlink
3
6
  } from "../../chunks/chunk-7AWTHZLY.js";
@@ -5,17 +8,14 @@ import {
5
8
  Logs
6
9
  } from "../../chunks/chunk-HEJV6JIO.js";
7
10
  import {
8
- Assert
9
- } from "../../chunks/chunk-W7YBGJ4H.js";
10
- import {
11
- Cast
12
- } from "../../chunks/chunk-4QQBKBYH.js";
11
+ Crossenv
12
+ } from "../../chunks/chunk-GJOU3UAL.js";
13
13
  import {
14
14
  Random
15
15
  } from "../../chunks/chunk-WLL3FNVL.js";
16
16
  import {
17
- Crossenv
18
- } from "../../chunks/chunk-GJOU3UAL.js";
17
+ Cast
18
+ } from "../../chunks/chunk-4QQBKBYH.js";
19
19
  import {
20
20
  isConstructorFunction
21
21
  } from "../../chunks/chunk-RCO57B6F.js";
@@ -1,22 +1,15 @@
1
- import { Errors } from '../../errors';
2
1
  export declare namespace Outcome {
3
- type Success<Payload = unknown> = {
2
+ type Success<Payload extends any = any> = {
4
3
  success: true;
5
- returned: Payload;
4
+ payload: Payload;
6
5
  };
7
- type Failure<Payload = unknown, ErrorsIndex extends Errors.Index = {
8
- [key: string]: any;
9
- }> = {
6
+ type Failure<Code extends string = string, Msg extends string = string, Details extends any = any> = {
10
7
  success: false;
11
- returned: Payload;
12
- errorCode: keyof ErrorsIndex;
8
+ code: Code;
9
+ message: Msg;
10
+ details?: Details;
13
11
  };
14
- type Outcome<SuccesPayload = unknown, FailurePayload = SuccesPayload, ErrorsIndex extends Errors.Index = {
15
- [key: string]: any;
16
- }> = Success<SuccesPayload> | Failure<FailurePayload, ErrorsIndex>;
17
- function makeSuccess<S = any>(returned: S): Success<S>;
18
- function makeFailure<FailurePayload = any, ErrorsIndex extends Errors.Index = {
19
- [key: string]: any;
20
- }>(returned: FailurePayload, code: keyof ErrorsIndex): Failure<FailurePayload, ErrorsIndex>;
21
- type Outcomer<SuccesPayload, FailurePayload, Params extends any[]> = (...params: Params) => Outcome<SuccesPayload, FailurePayload> | Promise<Outcome<SuccesPayload, FailurePayload>>;
12
+ type Outcome<Payload extends any = any, Code extends string = string, Msg extends string = string, Details extends any = any> = Success<Payload> | Failure<Code, Msg, Details>;
13
+ function makeSuccess<Payload extends any>(payload: Payload): Success<Payload>;
14
+ function makeFailure<Code extends string = string, Msg extends string = string, Details extends any | undefined = undefined>(code: Code, message: Msg, details?: Details): Failure<Code, Msg, Details>;
22
15
  }
@@ -1,18 +1,19 @@
1
1
  // src/agnostic/misc/outcome/index.ts
2
2
  var Outcome;
3
3
  ((Outcome2) => {
4
- function makeSuccess(returned) {
4
+ function makeSuccess(payload) {
5
5
  return {
6
6
  success: true,
7
- returned
7
+ payload
8
8
  };
9
9
  }
10
10
  Outcome2.makeSuccess = makeSuccess;
11
- function makeFailure(returned, code) {
11
+ function makeFailure(code, message, details) {
12
12
  return {
13
13
  success: false,
14
- returned,
15
- errorCode: code
14
+ code,
15
+ message,
16
+ details
16
17
  };
17
18
  }
18
19
  Outcome2.makeFailure = makeFailure;
@@ -1,9 +1,6 @@
1
1
  import {
2
2
  absoluteModulo
3
3
  } from "../../chunks/chunk-DNIOWD7K.js";
4
- import {
5
- interpolate
6
- } from "../../chunks/chunk-EW46EXFB.js";
7
4
  import {
8
5
  clamp
9
6
  } from "../../chunks/chunk-OSAXBA7G.js";
@@ -14,6 +11,9 @@ import {
14
11
  import {
15
12
  round
16
13
  } from "../../chunks/chunk-32IRF4OP.js";
14
+ import {
15
+ interpolate
16
+ } from "../../chunks/chunk-EW46EXFB.js";
17
17
 
18
18
  // src/agnostic/numbers/index.ts
19
19
  var Numbers;
@@ -1,3 +1,6 @@
1
+ import {
2
+ flattenGetters
3
+ } from "../../chunks/chunk-PO3V3I57.js";
1
4
  import {
2
5
  isNonNullObject,
3
6
  isObject
@@ -12,9 +15,6 @@ import {
12
15
  Enums
13
16
  } from "../../chunks/chunk-WOAYU6LB.js";
14
17
  import "../../chunks/chunk-E6MSDKON.js";
15
- import {
16
- flattenGetters
17
- } from "../../chunks/chunk-PO3V3I57.js";
18
18
  import "../../chunks/chunk-4QQBKBYH.js";
19
19
  import "../../chunks/chunk-QXAJXTXV.js";
20
20
  import "../../chunks/chunk-HC6ZOHCS.js";
@@ -1,10 +1,10 @@
1
- import {
2
- memoize
3
- } from "../../chunks/chunk-JWBDZPQG.js";
4
1
  import {
5
2
  debounce,
6
3
  throttle
7
4
  } from "../../chunks/chunk-VZDUZTW6.js";
5
+ import {
6
+ memoize
7
+ } from "../../chunks/chunk-JWBDZPQG.js";
8
8
 
9
9
  // src/agnostic/optim/index.ts
10
10
  var Optim;
@@ -1,20 +1,20 @@
1
1
  import {
2
- normalizeIndent
3
- } from "../../chunks/chunk-JQXNEJAP.js";
4
- import {
5
- replaceAll
6
- } from "../../chunks/chunk-MF56TTC5.js";
7
- import {
8
- toAlphanum
9
- } from "../../chunks/chunk-COVPTTAD.js";
2
+ CharCodes
3
+ } from "../../chunks/chunk-34U4HX4V.js";
10
4
  import {
11
5
  matches,
12
6
  matchesEvery,
13
7
  matchesSome
14
8
  } from "../../chunks/chunk-LQFKUNVQ.js";
15
9
  import {
16
- CharCodes
17
- } from "../../chunks/chunk-34U4HX4V.js";
10
+ normalizeIndent
11
+ } from "../../chunks/chunk-JQXNEJAP.js";
12
+ import {
13
+ toAlphanum
14
+ } from "../../chunks/chunk-COVPTTAD.js";
15
+ import {
16
+ replaceAll
17
+ } from "../../chunks/chunk-MF56TTC5.js";
18
18
 
19
19
  // src/agnostic/strings/index.ts
20
20
  var Strings;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Sanitize
3
- } from "./chunk-RASYEJ6T.js";
3
+ } from "./chunk-T4WHRHA3.js";
4
4
  import {
5
5
  register
6
- } from "./chunk-B27DVNRX.js";
6
+ } from "./chunk-UAND5PYN.js";
7
7
  import {
8
8
  Crossenv
9
9
  } from "./chunk-GJOU3UAL.js";
@@ -0,0 +1,45 @@
1
+ // src/agnostic/errors/register/index.ts
2
+ var Register;
3
+ ((Register2) => {
4
+ function from(source) {
5
+ function getMessage(code) {
6
+ const message = source[code].message;
7
+ return message;
8
+ }
9
+ function getDetailsMaker(code) {
10
+ const maker = source[code].detailsMaker;
11
+ return maker;
12
+ }
13
+ function getDetails(code, ...params) {
14
+ const maker = getDetailsMaker(code);
15
+ const details = maker?.(...params);
16
+ return details;
17
+ }
18
+ class CustomError extends Error {
19
+ code;
20
+ details;
21
+ constructor(code, ...params) {
22
+ super(getMessage(code));
23
+ const details = getDetails(code, ...params);
24
+ this.code = code;
25
+ this.details = details;
26
+ }
27
+ }
28
+ function getError(code, ...params) {
29
+ return new CustomError(code, ...params);
30
+ }
31
+ return {
32
+ getMessage,
33
+ getDetailsMaker,
34
+ getDetails,
35
+ getError,
36
+ CustomError,
37
+ source
38
+ };
39
+ }
40
+ Register2.from = from;
41
+ })(Register || (Register = {}));
42
+
43
+ export {
44
+ Register
45
+ };
@@ -0,0 +1,13 @@
1
+ import {
2
+ Register
3
+ } from "./chunk-JJFS2I7N.js";
4
+
5
+ // src/agnostic/errors/index.ts
6
+ var Errors;
7
+ ((Errors2) => {
8
+ Errors2.Register = Register;
9
+ })(Errors || (Errors = {}));
10
+
11
+ export {
12
+ Errors
13
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  register
3
- } from "./chunk-B27DVNRX.js";
3
+ } from "./chunk-UAND5PYN.js";
4
4
  import {
5
5
  Crossenv
6
6
  } from "./chunk-GJOU3UAL.js";
@@ -1,18 +1,18 @@
1
+ import {
2
+ Errors
3
+ } from "./chunk-SI3URYBN.js";
1
4
  import {
2
5
  Crossenv
3
6
  } from "./chunk-GJOU3UAL.js";
4
- import {
5
- Errors
6
- } from "./chunk-RLESUSTH.js";
7
7
 
8
8
  // src/shared/errors/index.ts
9
- var register = new Errors.Register({
9
+ var register = Errors.Register.from({
10
10
  ["no-window-document-on-runtime" /* NO_DOCUMENT */]: {
11
11
  message: `Runtime '${Crossenv.detectRuntime()}' does not provide a Document object, cannot complete.`
12
12
  },
13
13
  ["no-window-document-on-runtime-please-provide" /* NO_DOCUMENT_PLEASE_PROVIDE */]: {
14
14
  message: `Please provide a Document object since none are found on runtime '${Crossenv.detectRuntime()}'`,
15
- makeDetails: (tips) => tips
15
+ detailsMaker: (tips) => tips
16
16
  }
17
17
  });
18
18
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  register
3
- } from "./chunk-B27DVNRX.js";
3
+ } from "./chunk-UAND5PYN.js";
4
4
  import {
5
5
  Crossenv
6
6
  } from "./chunk-GJOU3UAL.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  isInDirectory
3
3
  } from "../../chunks/chunk-NRITRUZW.js";
4
- import {
5
- readWrite
6
- } from "../../chunks/chunk-7DBNMU6N.js";
7
4
  import {
8
5
  Subpaths
9
6
  } from "../../chunks/chunk-HGCG2J77.js";
7
+ import {
8
+ readWrite
9
+ } from "../../chunks/chunk-7DBNMU6N.js";
10
10
  import "../../chunks/chunk-LQFKUNVQ.js";
11
11
 
12
12
  // src/node/files/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design-edito/tools",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "",
5
5
  "author": "Maxime Fabas",
6
6
  "license": "ISC",
@@ -1,14 +1,157 @@
1
- import { Errors } from '~/agnostic/errors';
2
1
  export declare enum Codes {
3
2
  NO_DOCUMENT = "no-window-document-on-runtime",
4
3
  NO_DOCUMENT_PLEASE_PROVIDE = "no-window-document-on-runtime-please-provide"
5
4
  }
6
- export declare const register: Errors.Register<{
7
- "no-window-document-on-runtime": {
5
+ export declare const register: {
6
+ getMessage: <Code extends Codes>(code: Code) => {
7
+ "no-window-document-on-runtime": {
8
+ message: string;
9
+ };
10
+ "no-window-document-on-runtime-please-provide": {
11
+ message: string;
12
+ detailsMaker: (tips?: string) => string | undefined;
13
+ };
14
+ }[Code]["message"];
15
+ getDetailsMaker: <Code extends Codes>(code: Code) => {
16
+ "no-window-document-on-runtime": {
17
+ message: string;
18
+ };
19
+ "no-window-document-on-runtime-please-provide": {
20
+ message: string;
21
+ detailsMaker: (tips?: string) => string | undefined;
22
+ };
23
+ }[Code]["detailsMaker"] extends (...params: any[]) => any ? {
24
+ "no-window-document-on-runtime": {
25
+ message: string;
26
+ };
27
+ "no-window-document-on-runtime-please-provide": {
28
+ message: string;
29
+ detailsMaker: (tips?: string) => string | undefined;
30
+ };
31
+ }[Code]["detailsMaker"] : undefined;
32
+ getDetails: <Code extends Codes>(code: Code, ...params: ({
33
+ "no-window-document-on-runtime": {
34
+ message: string;
35
+ };
36
+ "no-window-document-on-runtime-please-provide": {
37
+ message: string;
38
+ detailsMaker: (tips?: string) => string | undefined;
39
+ };
40
+ }[Code]["detailsMaker"] extends (...params: any[]) => any ? {
41
+ "no-window-document-on-runtime": {
42
+ message: string;
43
+ };
44
+ "no-window-document-on-runtime-please-provide": {
45
+ message: string;
46
+ detailsMaker: (tips?: string) => string | undefined;
47
+ };
48
+ }[Code]["detailsMaker"] : undefined) extends (...params: infer P) => any ? P : []) => ({
49
+ "no-window-document-on-runtime": {
50
+ message: string;
51
+ };
52
+ "no-window-document-on-runtime-please-provide": {
53
+ message: string;
54
+ detailsMaker: (tips?: string) => string | undefined;
55
+ };
56
+ }[Code]["detailsMaker"] extends (...params: any[]) => any ? {
57
+ "no-window-document-on-runtime": {
58
+ message: string;
59
+ };
60
+ "no-window-document-on-runtime-please-provide": {
61
+ message: string;
62
+ detailsMaker: (tips?: string) => string | undefined;
63
+ };
64
+ }[Code]["detailsMaker"] : undefined) extends (...params: any[]) => infer R ? R : never;
65
+ getError: <Code extends Codes>(code: Code, ...params: ({
66
+ "no-window-document-on-runtime": {
67
+ message: string;
68
+ };
69
+ "no-window-document-on-runtime-please-provide": {
70
+ message: string;
71
+ detailsMaker: (tips?: string) => string | undefined;
72
+ };
73
+ }[Code]["detailsMaker"] extends (...params: any[]) => any ? {
74
+ "no-window-document-on-runtime": {
75
+ message: string;
76
+ };
77
+ "no-window-document-on-runtime-please-provide": {
78
+ message: string;
79
+ detailsMaker: (tips?: string) => string | undefined;
80
+ };
81
+ }[Code]["detailsMaker"] : undefined) extends (...params: infer P) => any ? P : []) => {
82
+ code: Code;
83
+ details: ({
84
+ "no-window-document-on-runtime": {
85
+ message: string;
86
+ };
87
+ "no-window-document-on-runtime-please-provide": {
88
+ message: string;
89
+ detailsMaker: (tips?: string) => string | undefined;
90
+ };
91
+ }[Code]["detailsMaker"] extends (...params: any[]) => any ? {
92
+ "no-window-document-on-runtime": {
93
+ message: string;
94
+ };
95
+ "no-window-document-on-runtime-please-provide": {
96
+ message: string;
97
+ detailsMaker: (tips?: string) => string | undefined;
98
+ };
99
+ }[Code]["detailsMaker"] : undefined) extends (...params: any[]) => infer R ? R : never;
100
+ name: string;
8
101
  message: string;
102
+ stack?: string;
9
103
  };
10
- "no-window-document-on-runtime-please-provide": {
11
- message: string;
12
- makeDetails: (tips?: string) => string | undefined;
104
+ CustomError: {
105
+ new <Code extends Codes>(code: Code, ...params: ({
106
+ "no-window-document-on-runtime": {
107
+ message: string;
108
+ };
109
+ "no-window-document-on-runtime-please-provide": {
110
+ message: string;
111
+ detailsMaker: (tips?: string) => string | undefined;
112
+ };
113
+ }[Code]["detailsMaker"] extends (...params: any[]) => any ? {
114
+ "no-window-document-on-runtime": {
115
+ message: string;
116
+ };
117
+ "no-window-document-on-runtime-please-provide": {
118
+ message: string;
119
+ detailsMaker: (tips?: string) => string | undefined;
120
+ };
121
+ }[Code]["detailsMaker"] : undefined) extends (...params: infer P) => any ? P : []): {
122
+ code: Code;
123
+ details: ({
124
+ "no-window-document-on-runtime": {
125
+ message: string;
126
+ };
127
+ "no-window-document-on-runtime-please-provide": {
128
+ message: string;
129
+ detailsMaker: (tips?: string) => string | undefined;
130
+ };
131
+ }[Code]["detailsMaker"] extends (...params: any[]) => any ? {
132
+ "no-window-document-on-runtime": {
133
+ message: string;
134
+ };
135
+ "no-window-document-on-runtime-please-provide": {
136
+ message: string;
137
+ detailsMaker: (tips?: string) => string | undefined;
138
+ };
139
+ }[Code]["detailsMaker"] : undefined) extends (...params: any[]) => infer R ? R : never;
140
+ name: string;
141
+ message: string;
142
+ stack?: string;
143
+ };
144
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
145
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
146
+ stackTraceLimit: number;
147
+ };
148
+ source: {
149
+ "no-window-document-on-runtime": {
150
+ message: string;
151
+ };
152
+ "no-window-document-on-runtime-please-provide": {
153
+ message: string;
154
+ detailsMaker: (tips?: string) => string | undefined;
155
+ };
13
156
  };
14
- }>;
157
+ };
@@ -1,41 +0,0 @@
1
- // src/agnostic/errors/index.ts
2
- var Errors;
3
- ((Errors2) => {
4
- class CustomError extends Error {
5
- code;
6
- details;
7
- constructor(data) {
8
- const { code, message, details } = data;
9
- super(message);
10
- this.code = code;
11
- this.details = details;
12
- }
13
- }
14
- Errors2.CustomError = CustomError;
15
- class Register {
16
- index;
17
- constructor(index) {
18
- this.index = index;
19
- }
20
- getFactory(code) {
21
- return this.index[code];
22
- }
23
- getData(code, ...params) {
24
- const core = this.getFactory(code);
25
- const { message, makeDetails } = core;
26
- return {
27
- code,
28
- message,
29
- details: makeDetails?.(...params)
30
- };
31
- }
32
- getError(code, ...params) {
33
- return new CustomError(this.getData(code, ...params));
34
- }
35
- }
36
- Errors2.Register = Register;
37
- })(Errors || (Errors = {}));
38
-
39
- export {
40
- Errors
41
- };