@maestro-js/custom-errors 1.0.0-alpha.18 → 1.0.0-alpha.2

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/index.d.ts CHANGED
@@ -22,47 +22,16 @@ declare const httpStatusCodeNames: {
22
22
  readonly internalServerError: 500;
23
23
  };
24
24
  declare function getHttpStatusCode(error: unknown): number | null;
25
- declare const MovedPermanentlyError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "movedPermanently">;
26
- declare const FoundError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "found">;
27
- declare const RedirectError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "redirect">;
28
- declare const NotModifiedError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "notModified">;
29
- declare const BadRequestError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "badRequest">;
30
- declare const UnauthorizedError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "unauthorized">;
31
- declare const PaymentRequiredError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "paymentRequired">;
32
- declare const ForbiddenError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "forbidden">;
33
- declare const NotFoundError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "notFound">;
34
- declare const ConflictError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "conflict">;
35
- declare const UnprocessableContentError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "unprocessableContent">;
36
- declare const ValidationError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "validationError">;
37
- declare const LockedError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "locked">;
38
- declare const TooManyRequestsError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "tooManyRequests">;
39
- declare const InternalServerError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "internalServerError">;
40
-
41
25
  declare const CustomErrors: {
42
26
  create: typeof makeCustomError;
43
27
  getHttpStatusCode: typeof getHttpStatusCode;
44
- MovedPermanentlyError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "movedPermanently">;
45
- FoundError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "found">;
46
- RedirectError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "redirect">;
47
- NotModifiedError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "notModified">;
48
- BadRequestError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "badRequest">;
49
- UnauthorizedError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "unauthorized">;
50
- PaymentRequiredError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "paymentRequired">;
51
- ForbiddenError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "forbidden">;
52
- NotFoundError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "notFound">;
53
- ConflictError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "conflict">;
54
- UnprocessableContentError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "unprocessableContent">;
55
- ValidationError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "validationError">;
56
- LockedError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "locked">;
57
- TooManyRequestsError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "tooManyRequests">;
58
- InternalServerError: CustomErrors.CustomErrorConstructor<string | undefined, {}, "internalServerError">;
59
28
  };
60
29
  declare namespace CustomErrors {
61
30
  type CustomError<AdditionalAttributes extends Record<string, any> = {}, StatusCode extends number | HttpStatusCodeName | null | undefined = undefined> = Error & AdditionalAttributes & {
62
31
  httpStatusCode: StatusCode;
63
32
  };
64
33
  type CustomErrorConstructor<Input = undefined, AdditionalAttributes extends Record<string, any> = {}, StatusCode extends number | HttpStatusCodeName | null | undefined = undefined> = (undefined extends Input ? {
65
- new (input?: Input): CustomError<AdditionalAttributes, StatusCode>;
34
+ new (): CustomError<AdditionalAttributes, StatusCode>;
66
35
  } : {
67
36
  new (input: Input): CustomError<AdditionalAttributes, StatusCode>;
68
37
  }) & {
@@ -71,4 +40,4 @@ declare namespace CustomErrors {
71
40
  type HttpStatusCodeName = keyof typeof httpStatusCodeNames;
72
41
  }
73
42
 
74
- export { BadRequestError, ConflictError, CustomErrors, ForbiddenError, FoundError, InternalServerError, LockedError, MovedPermanentlyError, NotFoundError, NotModifiedError, PaymentRequiredError, RedirectError, TooManyRequestsError, UnauthorizedError, UnprocessableContentError, ValidationError };
43
+ export { CustomErrors };
package/dist/index.js CHANGED
@@ -58,115 +58,10 @@ function getHttpStatusCode(error) {
58
58
  return null;
59
59
  }
60
60
  }
61
- var MovedPermanentlyError = makeCustomError({
62
- name: "MovedPermanentlyError",
63
- message: (input) => input ?? "Moved Permanently",
64
- httpStatusCode: "movedPermanently"
65
- });
66
- var FoundError = makeCustomError({
67
- name: "FoundError",
68
- message: (input) => input ?? "Found",
69
- httpStatusCode: "found"
70
- });
71
- var RedirectError = makeCustomError({
72
- name: "RedirectError",
73
- message: (input) => input ?? "Redirect",
74
- httpStatusCode: "redirect"
75
- });
76
- var NotModifiedError = makeCustomError({
77
- name: "NotModifiedError",
78
- message: (input) => input ?? "Not Modified",
79
- httpStatusCode: "notModified"
80
- });
81
- var BadRequestError = makeCustomError({
82
- name: "BadRequestError",
83
- message: (input) => input ?? "Bad Request",
84
- httpStatusCode: "badRequest"
85
- });
86
- var UnauthorizedError = makeCustomError({
87
- name: "UnauthorizedError",
88
- message: (input) => input ?? "Unauthorized",
89
- httpStatusCode: "unauthorized"
90
- });
91
- var PaymentRequiredError = makeCustomError({
92
- name: "PaymentRequiredError",
93
- message: (input) => input ?? "Payment Required",
94
- httpStatusCode: "paymentRequired"
95
- });
96
- var ForbiddenError = makeCustomError({
97
- name: "ForbiddenError",
98
- message: (input) => input ?? "Forbidden",
99
- httpStatusCode: "forbidden"
100
- });
101
- var NotFoundError = makeCustomError({
102
- name: "NotFoundError",
103
- message: (input) => input ?? "Not Found",
104
- httpStatusCode: "notFound"
105
- });
106
- var ConflictError = makeCustomError({
107
- name: "ConflictError",
108
- message: (input) => input ?? "Conflict",
109
- httpStatusCode: "conflict"
110
- });
111
- var UnprocessableContentError = makeCustomError({
112
- name: "UnprocessableContentError",
113
- message: (input) => input ?? "Unprocessable Content",
114
- httpStatusCode: "unprocessableContent"
115
- });
116
- var ValidationError = makeCustomError({
117
- name: "ValidationError",
118
- message: (input) => input ?? "Validation Error",
119
- httpStatusCode: "validationError"
120
- });
121
- var LockedError = makeCustomError({
122
- name: "LockedError",
123
- message: (input) => input ?? "Locked",
124
- httpStatusCode: "locked"
125
- });
126
- var TooManyRequestsError = makeCustomError({
127
- name: "TooManyRequestsError",
128
- message: (input) => input ?? "Too Many Requests",
129
- httpStatusCode: "tooManyRequests"
130
- });
131
- var InternalServerError = makeCustomError({
132
- name: "InternalServerError",
133
- message: (input) => input ?? "Internal Server Error",
134
- httpStatusCode: "internalServerError"
135
- });
136
61
  var CustomErrors = {
137
62
  create: makeCustomError,
138
- getHttpStatusCode,
139
- MovedPermanentlyError,
140
- FoundError,
141
- RedirectError,
142
- NotModifiedError,
143
- BadRequestError,
144
- UnauthorizedError,
145
- PaymentRequiredError,
146
- ForbiddenError,
147
- NotFoundError,
148
- ConflictError,
149
- UnprocessableContentError,
150
- ValidationError,
151
- LockedError,
152
- TooManyRequestsError,
153
- InternalServerError
63
+ getHttpStatusCode
154
64
  };
155
65
  export {
156
- BadRequestError,
157
- ConflictError,
158
- CustomErrors,
159
- ForbiddenError,
160
- FoundError,
161
- InternalServerError,
162
- LockedError,
163
- MovedPermanentlyError,
164
- NotFoundError,
165
- NotModifiedError,
166
- PaymentRequiredError,
167
- RedirectError,
168
- TooManyRequestsError,
169
- UnauthorizedError,
170
- UnprocessableContentError,
171
- ValidationError
66
+ CustomErrors
172
67
  };
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "devDependencies": {
11
11
  "@types/node": "^22.19.11"
12
12
  },
13
- "version": "1.0.0-alpha.18",
13
+ "version": "1.0.0-alpha.2",
14
14
  "publishConfig": {
15
15
  "access": "restricted"
16
16
  },