@taicode/common-base 1.5.0 → 1.5.1

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.
@@ -61,20 +61,20 @@ type SystemErrorType = keyof SystemErrorTypes extends never ? string : Extract<k
61
61
  type UserErrorContext<T extends string> = T extends keyof UserErrorTypes ? UserErrorTypes[T] & ErrorContext : ErrorContext;
62
62
  type SystemErrorContext<T extends string> = T extends keyof SystemErrorTypes ? SystemErrorTypes[T] & ErrorContext : ErrorContext;
63
63
  /** 用户可见的错误 */
64
- export declare class UserError<T extends string = UserErrorType> extends Error {
64
+ export declare class UserError<T extends UserErrorType = UserErrorType> extends Error {
65
65
  type: T;
66
66
  message: string;
67
67
  context?: UserErrorContext<T> | undefined;
68
68
  constructor(type: T, message?: string, context?: UserErrorContext<T> | undefined);
69
- static is<T extends string = UserErrorType>(error: unknown): error is UserError<T>;
69
+ static is<T extends UserErrorType = UserErrorType>(error: unknown): error is UserError<T>;
70
70
  }
71
71
  /** 系统错误 */
72
- export declare class SystemError<T extends string = SystemErrorType> extends Error {
72
+ export declare class SystemError<T extends SystemErrorType = SystemErrorType> extends Error {
73
73
  type: T;
74
74
  message: string;
75
75
  context?: SystemErrorContext<T> | undefined;
76
76
  constructor(type: T, message?: string, context?: SystemErrorContext<T> | undefined);
77
- static is<T extends string = SystemErrorType>(error: unknown): error is SystemError<T>;
77
+ static is<T extends SystemErrorType = SystemErrorType>(error: unknown): error is SystemError<T>;
78
78
  }
79
79
  export declare class UnknownError extends Error {
80
80
  context?: ErrorContext | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../source/error/error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,UAAU,YAAY;IACpB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAID,MAAM,WAAW,cAAc;CAA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,SAAQ,KAAK;IACxD,IAAI,EAAE,CAAC;IAAS,OAAO,EAAE,MAAM;IAAc,OAAO,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC;gBAA1E,IAAI,EAAE,CAAC,EAAS,OAAO,GAAE,MAAW,EAAS,OAAO,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,YAAA;IAK7F,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,CAAC;CAG1F;AAED,WAAW;AACX,qBAAa,WAAW,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,CAAE,SAAQ,KAAK;IAC9D,IAAI,EAAE,CAAC;IAAS,OAAO,EAAE,MAAM;IAAc,OAAO,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC;gBAA5E,IAAI,EAAE,CAAC,EAAS,OAAO,GAAE,MAAW,EAAS,OAAO,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,YAAA;IAK/F,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAAC,CAAC,CAAC;CAGhG;AAED,qBAAa,YAAa,SAAQ,KAAK;IACD,OAAO,CAAC,EAAE,YAAY;gBAA9C,OAAO,EAAE,MAAM,EAAS,OAAO,CAAC,EAAE,YAAY,YAAA;IAK1D,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY;CAGjD"}
@@ -1,2 +1,19 @@
1
+ declare module './error' {
2
+ interface UserErrorTypes {
3
+ VALIDATION_ERROR: unknown;
4
+ TEST_ERROR: unknown;
5
+ USER_ERROR: unknown;
6
+ REQUIRED_FIELD: unknown;
7
+ INVALID_FORMAT: unknown;
8
+ OUT_OF_RANGE: unknown;
9
+ }
10
+ interface SystemErrorTypes {
11
+ DATABASE_ERROR: unknown;
12
+ NETWORK_ERROR: unknown;
13
+ FILE_ERROR: unknown;
14
+ TEST_ERROR: unknown;
15
+ SYSTEM_ERROR: unknown;
16
+ }
17
+ }
1
18
  export {};
2
19
  //# sourceMappingURL=error.test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error.test.d.ts","sourceRoot":"","sources":["../../source/error/error.test.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"error.test.d.ts","sourceRoot":"","sources":["../../source/error/error.test.ts"],"names":[],"mappings":"AAGA,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAU,cAAc;QACtB,gBAAgB,EAAE,OAAO,CAAA;QACzB,UAAU,EAAE,OAAO,CAAA;QACnB,UAAU,EAAE,OAAO,CAAA;QACnB,cAAc,EAAE,OAAO,CAAA;QACvB,cAAc,EAAE,OAAO,CAAA;QACvB,YAAY,EAAE,OAAO,CAAA;KACtB;IAED,UAAU,gBAAgB;QACxB,cAAc,EAAE,OAAO,CAAA;QACvB,aAAa,EAAE,OAAO,CAAA;QACtB,UAAU,EAAE,OAAO,CAAA;QACnB,UAAU,EAAE,OAAO,CAAA;QACnB,YAAY,EAAE,OAAO,CAAA;KACtB;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taicode/common-base",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "author": "Alain",
5
5
  "license": "ISC",
6
6
  "description": "",
@@ -21,6 +21,7 @@
21
21
  "scripts": {
22
22
  "test": "vitest run",
23
23
  "build": "tsc -p tsconfig.json",
24
+ "prepublishOnly": "npm run build",
24
25
  "dev": "tsc -p tsconfig.json --watch"
25
26
  },
26
27
  "files": [