startx 0.1.5 → 0.2.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 (67) hide show
  1. package/.editorconfig +20 -20
  2. package/.github/workflows/publish.yml +48 -0
  3. package/LICENSE +21 -21
  4. package/configs/eslint-config/plugins.d.ts +1 -1
  5. package/configs/eslint-config/src/rules/no-argument-spread.ts +96 -96
  6. package/configs/eslint-config/src/rules/no-internal-package-import.ts +40 -40
  7. package/configs/eslint-config/src/rules/no-interpolation-in-regular-string.ts +32 -32
  8. package/configs/eslint-config/src/rules/no-skipped-tests.ts +61 -61
  9. package/configs/eslint-config/src/rules/no-top-level-relative-imports-in-backend-module.ts +27 -27
  10. package/configs/eslint-config/src/rules/no-type-unsafe-event-emitter.ts +33 -33
  11. package/configs/eslint-config/src/rules/no-uncaught-json-parse.test.ts +21 -21
  12. package/configs/eslint-config/src/rules/no-untyped-config-class-field.ts +26 -26
  13. package/configs/eslint-config/src/rules/no-unused-param-catch-clause.ts +33 -33
  14. package/configs/eslint-config/src/rules/no-useless-catch-throw.test.ts +34 -34
  15. package/configs/eslint-config/src/rules/no-useless-catch-throw.ts +47 -47
  16. package/configs/eslint-config/src/utils/json.ts +21 -21
  17. package/package.json +34 -35
  18. package/packages/@repo/constants/src/api.ts +1 -1
  19. package/packages/@repo/constants/src/time.ts +23 -23
  20. package/packages/@repo/db/src/schema/index.ts +1 -1
  21. package/packages/@repo/lib/src/error-handlers-module/index.ts +11 -11
  22. package/packages/cli/dist/index.mjs +2 -2
  23. package/packages/cli/tsdown.config.ts +1 -0
  24. package/packages/ui/src/components/custom/grid-component.tsx +23 -23
  25. package/packages/ui/src/components/custom/hover-tool.tsx +38 -38
  26. package/packages/ui/src/components/custom/image-picker.tsx +109 -109
  27. package/packages/ui/src/components/custom/no-content.tsx +37 -37
  28. package/packages/ui/src/components/custom/page-container.tsx +24 -24
  29. package/packages/ui/src/components/custom/simple-popover.tsx +29 -29
  30. package/packages/ui/src/components/custom/switch-component.tsx +20 -20
  31. package/packages/ui/src/components/custom/theme-provider.tsx +74 -74
  32. package/packages/ui/src/components/hooks/event/use-click.tsx +39 -39
  33. package/packages/ui/src/components/hooks/time/useDebounce.tsx +21 -21
  34. package/packages/ui/src/components/hooks/time/useInterval.tsx +35 -35
  35. package/packages/ui/src/components/hooks/time/useTimeout.tsx +19 -19
  36. package/packages/ui/src/components/hooks/time/useTimer.tsx +51 -51
  37. package/packages/ui/src/components/hooks/use-media-query.tsx +19 -19
  38. package/packages/ui/src/components/hooks/use-persistent-storage.tsx +52 -52
  39. package/packages/ui/src/components/hooks/use-window-dimension.tsx +30 -30
  40. package/packages/ui/src/components/sonner.tsx +1 -1
  41. package/packages/ui/src/components/ui/button.tsx +96 -96
  42. package/packages/ui/src/components/ui/dropdown-menu.tsx +226 -226
  43. package/packages/ui/src/components/ui/label.tsx +24 -24
  44. package/packages/ui/src/components/ui/popover.tsx +42 -42
  45. package/packages/ui/src/components/ui/select.tsx +170 -170
  46. package/packages/ui/src/components/ui/separator.tsx +28 -28
  47. package/packages/ui/src/components/ui/sheet.tsx +130 -130
  48. package/packages/ui/src/components/ui/skeleton.tsx +13 -13
  49. package/packages/ui/src/components/ui/spinner.tsx +16 -16
  50. package/packages/ui/src/components/ui/switch.tsx +28 -28
  51. package/packages/ui/src/components/ui/tabs.tsx +54 -54
  52. package/packages/ui/src/components/ui/tooltip.tsx +30 -30
  53. package/packages/ui/src/components/util/n-formattor.ts +22 -22
  54. package/packages/ui/src/components/util/storage.ts +37 -37
  55. package/packages/ui/src/globals.css +87 -87
  56. package/configs/vitest-config/dist/base.mjs +0 -1
  57. package/configs/vitest-config/dist/frontend.mjs +0 -1
  58. package/configs/vitest-config/dist/node.mjs +0 -1
  59. package/packages/@repo/redis/dist/index.d.mts +0 -3
  60. package/packages/@repo/redis/dist/index.mjs +0 -5
  61. package/packages/@repo/redis/dist/lib/redis-client.d.mts +0 -7
  62. package/packages/@repo/redis/dist/lib/redis-client.mjs +0 -25
  63. package/packages/@repo/redis/dist/lib/redis-client.mjs.map +0 -1
  64. package/packages/@repo/redis/dist/lib/redis-module.d.mts +0 -5
  65. package/packages/@repo/redis/dist/lib/redis-module.mjs +0 -6
  66. package/packages/@repo/redis/dist/lib/redis-module.mjs.map +0 -1
  67. /package/{apps/core-server/.env.example → .env.example} +0 -0
@@ -1,33 +1,33 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
-
3
- export const NoTypeUnsafeEventEmitterRule = ESLintUtils.RuleCreator.withoutDocs({
4
- name: 'no-type-unsafe-event-emitter',
5
- meta: {
6
- type: 'problem',
7
- docs: {
8
- description: 'Disallow extending from `EventEmitter`, which is not type-safe.',
9
- },
10
- messages: {
11
- noExtendsEventEmitter: 'Extend from the type-safe `TypedEmitter` class instead.',
12
- },
13
- schema: [],
14
- },
15
- defaultOptions: [],
16
- create(context) {
17
- return {
18
- ClassDeclaration(node) {
19
- if (
20
- node.superClass &&
21
- node.superClass.type === 'Identifier' &&
22
- node.superClass.name === 'EventEmitter' &&
23
- node.id?.name !== 'TypedEmitter'
24
- ) {
25
- context.report({
26
- node: node.superClass,
27
- messageId: 'noExtendsEventEmitter',
28
- });
29
- }
30
- },
31
- };
32
- },
33
- });
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
2
+
3
+ export const NoTypeUnsafeEventEmitterRule = ESLintUtils.RuleCreator.withoutDocs({
4
+ name: 'no-type-unsafe-event-emitter',
5
+ meta: {
6
+ type: 'problem',
7
+ docs: {
8
+ description: 'Disallow extending from `EventEmitter`, which is not type-safe.',
9
+ },
10
+ messages: {
11
+ noExtendsEventEmitter: 'Extend from the type-safe `TypedEmitter` class instead.',
12
+ },
13
+ schema: [],
14
+ },
15
+ defaultOptions: [],
16
+ create(context) {
17
+ return {
18
+ ClassDeclaration(node) {
19
+ if (
20
+ node.superClass &&
21
+ node.superClass.type === 'Identifier' &&
22
+ node.superClass.name === 'EventEmitter' &&
23
+ node.id?.name !== 'TypedEmitter'
24
+ ) {
25
+ context.report({
26
+ node: node.superClass,
27
+ messageId: 'noExtendsEventEmitter',
28
+ });
29
+ }
30
+ },
31
+ };
32
+ },
33
+ });
@@ -1,21 +1,21 @@
1
- import { RuleTester } from "@typescript-eslint/rule-tester";
2
- import { NoUncaughtJsonParseRule } from "./no-uncaught-json-parse.js";
3
-
4
- const ruleTester = new RuleTester();
5
-
6
- ruleTester.run("no-uncaught-json-parse", NoUncaughtJsonParseRule, {
7
- valid: [
8
- {
9
- code: "try { JSON.parse(foo) } catch (e) {}",
10
- },
11
- {
12
- code: "JSON.parse(JSON.stringify(foo))",
13
- },
14
- ],
15
- invalid: [
16
- {
17
- code: "JSON.parse(foo)",
18
- errors: [{ messageId: "noUncaughtJsonParse" }],
19
- },
20
- ],
21
- });
1
+ import { RuleTester } from "@typescript-eslint/rule-tester";
2
+ import { NoUncaughtJsonParseRule } from "./no-uncaught-json-parse.js";
3
+
4
+ const ruleTester = new RuleTester();
5
+
6
+ ruleTester.run("no-uncaught-json-parse", NoUncaughtJsonParseRule, {
7
+ valid: [
8
+ {
9
+ code: "try { JSON.parse(foo) } catch (e) {}",
10
+ },
11
+ {
12
+ code: "JSON.parse(JSON.stringify(foo))",
13
+ },
14
+ ],
15
+ invalid: [
16
+ {
17
+ code: "JSON.parse(foo)",
18
+ errors: [{ messageId: "noUncaughtJsonParse" }],
19
+ },
20
+ ],
21
+ });
@@ -1,26 +1,26 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
-
3
- export const NoUntypedConfigClassFieldRule = ESLintUtils.RuleCreator.withoutDocs({
4
- name: "no-untyped-config-class-field",
5
- meta: {
6
- type: 'problem',
7
- docs: {
8
- description: 'Enforce explicit typing of config class fields',
9
- },
10
- messages: {
11
- noUntypedConfigClassField:
12
- 'Class field must have an explicit type annotation, e.g. `field: type = value`.',
13
- },
14
- schema: [],
15
- },
16
- defaultOptions: [],
17
- create(context) {
18
- return {
19
- PropertyDefinition(node) {
20
- if (!node.typeAnnotation) {
21
- context.report({ node: node.key, messageId: 'noUntypedConfigClassField' });
22
- }
23
- },
24
- };
25
- },
26
- });
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
2
+
3
+ export const NoUntypedConfigClassFieldRule = ESLintUtils.RuleCreator.withoutDocs({
4
+ name: "no-untyped-config-class-field",
5
+ meta: {
6
+ type: 'problem',
7
+ docs: {
8
+ description: 'Enforce explicit typing of config class fields',
9
+ },
10
+ messages: {
11
+ noUntypedConfigClassField:
12
+ 'Class field must have an explicit type annotation, e.g. `field: type = value`.',
13
+ },
14
+ schema: [],
15
+ },
16
+ defaultOptions: [],
17
+ create(context) {
18
+ return {
19
+ PropertyDefinition(node) {
20
+ if (!node.typeAnnotation) {
21
+ context.report({ node: node.key, messageId: 'noUntypedConfigClassField' });
22
+ }
23
+ },
24
+ };
25
+ },
26
+ });
@@ -1,33 +1,33 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
-
3
- export const NoUnusedParamInCatchClauseRule = ESLintUtils.RuleCreator.withoutDocs({
4
- name: "no-unused-param-catch-clause",
5
- meta: {
6
- type: 'problem',
7
- docs: {
8
- description: 'Unused param in catch clause must be omitted.',
9
- },
10
- messages: {
11
- removeUnusedParam: 'Remove unused param in catch clause',
12
- },
13
- fixable: 'code',
14
- schema: [],
15
- },
16
- defaultOptions: [],
17
- create(context) {
18
- return {
19
- CatchClause(node) {
20
- if (node.param?.type === 'Identifier' && node.param.name.startsWith('_')) {
21
- const start = node.range[0] + 'catch '.length;
22
- const end = node.param.range[1] + '()'.length;
23
-
24
- context.report({
25
- messageId: 'removeUnusedParam',
26
- node,
27
- fix: (fixer) => fixer.removeRange([start, end]),
28
- });
29
- }
30
- },
31
- };
32
- },
33
- });
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
2
+
3
+ export const NoUnusedParamInCatchClauseRule = ESLintUtils.RuleCreator.withoutDocs({
4
+ name: "no-unused-param-catch-clause",
5
+ meta: {
6
+ type: 'problem',
7
+ docs: {
8
+ description: 'Unused param in catch clause must be omitted.',
9
+ },
10
+ messages: {
11
+ removeUnusedParam: 'Remove unused param in catch clause',
12
+ },
13
+ fixable: 'code',
14
+ schema: [],
15
+ },
16
+ defaultOptions: [],
17
+ create(context) {
18
+ return {
19
+ CatchClause(node) {
20
+ if (node.param?.type === 'Identifier' && node.param.name.startsWith('_')) {
21
+ const start = node.range[0] + 'catch '.length;
22
+ const end = node.param.range[1] + '()'.length;
23
+
24
+ context.report({
25
+ messageId: 'removeUnusedParam',
26
+ node,
27
+ fix: (fixer) => fixer.removeRange([start, end]),
28
+ });
29
+ }
30
+ },
31
+ };
32
+ },
33
+ });
@@ -1,34 +1,34 @@
1
- import { RuleTester } from "@typescript-eslint/rule-tester";
2
- import { NoUselessCatchThrowRule } from "./no-useless-catch-throw.js";
3
-
4
- const ruleTester = new RuleTester();
5
-
6
- ruleTester.run("no-useless-catch-throw", NoUselessCatchThrowRule, {
7
- valid: [
8
- {
9
- code: "try { foo(); } catch (e) { console.error(e); }",
10
- },
11
- {
12
- code: 'try { foo(); } catch (e) { throw new Error("Custom error"); }',
13
- },
14
- ],
15
- invalid: [
16
- {
17
- code: `
18
- try {
19
- // Some comment
20
- if (foo) {
21
- bar();
22
- }
23
- } catch (e) {
24
- throw e;
25
- }`,
26
- errors: [{ messageId: "noUselessCatchThrow" }],
27
- output: `
28
- // Some comment
29
- if (foo) {
30
- bar();
31
- }`,
32
- },
33
- ],
34
- });
1
+ import { RuleTester } from "@typescript-eslint/rule-tester";
2
+ import { NoUselessCatchThrowRule } from "./no-useless-catch-throw.js";
3
+
4
+ const ruleTester = new RuleTester();
5
+
6
+ ruleTester.run("no-useless-catch-throw", NoUselessCatchThrowRule, {
7
+ valid: [
8
+ {
9
+ code: "try { foo(); } catch (e) { console.error(e); }",
10
+ },
11
+ {
12
+ code: 'try { foo(); } catch (e) { throw new Error("Custom error"); }',
13
+ },
14
+ ],
15
+ invalid: [
16
+ {
17
+ code: `
18
+ try {
19
+ // Some comment
20
+ if (foo) {
21
+ bar();
22
+ }
23
+ } catch (e) {
24
+ throw e;
25
+ }`,
26
+ errors: [{ messageId: "noUselessCatchThrow" }],
27
+ output: `
28
+ // Some comment
29
+ if (foo) {
30
+ bar();
31
+ }`,
32
+ },
33
+ ],
34
+ });
@@ -1,47 +1,47 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
-
3
- export const NoUselessCatchThrowRule = ESLintUtils.RuleCreator.withoutDocs({
4
- name: 'no-useless-catch-throw',
5
- meta: {
6
- type: 'problem',
7
- docs: {
8
- description: 'Disallow `try-catch` blocks where the `catch` only contains a `throw error`.',
9
- },
10
- messages: {
11
- noUselessCatchThrow: 'Remove useless `catch` block.',
12
- },
13
- fixable: 'code',
14
- schema: [],
15
- },
16
- defaultOptions: [],
17
- create(context) {
18
- return {
19
- CatchClause(node) {
20
- if (
21
- node.body.body.length === 1 &&
22
- node.body.body[0].type === 'ThrowStatement' &&
23
- node.body.body[0].argument.type === 'Identifier' &&
24
- node.param?.type === 'Identifier' &&
25
- node.body.body[0].argument.name === node.param.name
26
- ) {
27
- context.report({
28
- node,
29
- messageId: 'noUselessCatchThrow',
30
- fix(fixer) {
31
- const tryStatement = node.parent;
32
- const tryBlock = tryStatement.block;
33
- const sourceCode = context.sourceCode;
34
- const tryBlockText = sourceCode.getText(tryBlock);
35
- const tryBlockTextWithoutBraces = tryBlockText.slice(1, -1).trim();
36
- const indentedTryBlockText = tryBlockTextWithoutBraces
37
- .split('\n')
38
- .map((line) => line.replace(/\t/, ''))
39
- .join('\n');
40
- return fixer.replaceText(tryStatement, indentedTryBlockText);
41
- },
42
- });
43
- }
44
- },
45
- };
46
- },
47
- });
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
2
+
3
+ export const NoUselessCatchThrowRule = ESLintUtils.RuleCreator.withoutDocs({
4
+ name: 'no-useless-catch-throw',
5
+ meta: {
6
+ type: 'problem',
7
+ docs: {
8
+ description: 'Disallow `try-catch` blocks where the `catch` only contains a `throw error`.',
9
+ },
10
+ messages: {
11
+ noUselessCatchThrow: 'Remove useless `catch` block.',
12
+ },
13
+ fixable: 'code',
14
+ schema: [],
15
+ },
16
+ defaultOptions: [],
17
+ create(context) {
18
+ return {
19
+ CatchClause(node) {
20
+ if (
21
+ node.body.body.length === 1 &&
22
+ node.body.body[0].type === 'ThrowStatement' &&
23
+ node.body.body[0].argument.type === 'Identifier' &&
24
+ node.param?.type === 'Identifier' &&
25
+ node.body.body[0].argument.name === node.param.name
26
+ ) {
27
+ context.report({
28
+ node,
29
+ messageId: 'noUselessCatchThrow',
30
+ fix(fixer) {
31
+ const tryStatement = node.parent;
32
+ const tryBlock = tryStatement.block;
33
+ const sourceCode = context.sourceCode;
34
+ const tryBlockText = sourceCode.getText(tryBlock);
35
+ const tryBlockTextWithoutBraces = tryBlockText.slice(1, -1).trim();
36
+ const indentedTryBlockText = tryBlockTextWithoutBraces
37
+ .split('\n')
38
+ .map((line) => line.replace(/\t/, ''))
39
+ .join('\n');
40
+ return fixer.replaceText(tryStatement, indentedTryBlockText);
41
+ },
42
+ });
43
+ }
44
+ },
45
+ };
46
+ },
47
+ });
@@ -1,21 +1,21 @@
1
- import type { TSESTree } from '@typescript-eslint/utils';
2
-
3
- export const isJsonParseCall = (node: TSESTree.CallExpression) =>
4
- node.callee.type === 'MemberExpression' &&
5
- node.callee.object.type === 'Identifier' &&
6
- node.callee.object.name === 'JSON' &&
7
- node.callee.property.type === 'Identifier' &&
8
- node.callee.property.name === 'parse';
9
-
10
- export const isJsonStringifyCall = (node: TSESTree.CallExpression) => {
11
- const parseArg = node.arguments?.[0];
12
- return (
13
- parseArg !== undefined &&
14
- parseArg.type === 'CallExpression' &&
15
- parseArg.callee.type === 'MemberExpression' &&
16
- parseArg.callee.object.type === 'Identifier' &&
17
- parseArg.callee.object.name === 'JSON' &&
18
- parseArg.callee.property.type === 'Identifier' &&
19
- parseArg.callee.property.name === 'stringify'
20
- );
21
- };
1
+ import type { TSESTree } from '@typescript-eslint/utils';
2
+
3
+ export const isJsonParseCall = (node: TSESTree.CallExpression) =>
4
+ node.callee.type === 'MemberExpression' &&
5
+ node.callee.object.type === 'Identifier' &&
6
+ node.callee.object.name === 'JSON' &&
7
+ node.callee.property.type === 'Identifier' &&
8
+ node.callee.property.name === 'parse';
9
+
10
+ export const isJsonStringifyCall = (node: TSESTree.CallExpression) => {
11
+ const parseArg = node.arguments?.[0];
12
+ return (
13
+ parseArg !== undefined &&
14
+ parseArg.type === 'CallExpression' &&
15
+ parseArg.callee.type === 'MemberExpression' &&
16
+ parseArg.callee.object.type === 'Identifier' &&
17
+ parseArg.callee.object.name === 'JSON' &&
18
+ parseArg.callee.property.type === 'Identifier' &&
19
+ parseArg.callee.property.name === 'stringify'
20
+ );
21
+ };
package/package.json CHANGED
@@ -1,36 +1,35 @@
1
1
  {
2
- "name": "startx",
3
- "version": "0.1.5",
4
- "repository": {
5
- "type": "git",
6
- "url": "git+https://github.com/avinashid/startx.git"
7
- },
8
- "bin": {
9
- "startx": "./packages/cli/dist/index.mjs"
10
- },
11
- "scripts": {
12
- "dev": "turbo dev",
13
- "build": "turbo build",
14
- "start": "turbo start",
15
- "startx": "node ./packages/cli/dist/index.mjs",
16
- "backend": "turbo dev --filter=core-server -- ",
17
- "cli": "turbo dev --filter=cli -- ",
18
- "lint": "turbo lint",
19
- "typecheck": "turbo typecheck",
20
- "clean": "turbo clean",
21
- "test": "turbo test",
22
- "format": "turbo format"
23
- },
24
- "engines": {
25
- "node": ">=22"
26
- },
27
- "keywords": [
28
- "startx",
29
- "turborepo",
30
- "scaffold",
31
- "express"
32
- ],
33
- "author": "avinashid",
34
- "license": "MIT",
35
- "packageManager": "pnpm@10.28.2"
36
- }
2
+ "name": "startx",
3
+ "version": "0.2.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/avinashid/startx.git"
7
+ },
8
+ "bin": {
9
+ "startx": "./packages/cli/dist/index.mjs"
10
+ },
11
+ "engines": {
12
+ "node": ">=22"
13
+ },
14
+ "keywords": [
15
+ "startx",
16
+ "turborepo",
17
+ "scaffold",
18
+ "express"
19
+ ],
20
+ "author": "avinashid",
21
+ "license": "MIT",
22
+ "scripts": {
23
+ "dev": "turbo dev",
24
+ "build": "turbo build",
25
+ "start": "turbo start",
26
+ "startx": "node ./packages/cli/dist/index.mjs",
27
+ "backend": "turbo dev --filter=core-server -- ",
28
+ "cli": "turbo dev --filter=cli -- ",
29
+ "lint": "turbo lint",
30
+ "typecheck": "turbo typecheck",
31
+ "clean": "turbo clean",
32
+ "test": "turbo test",
33
+ "format": "turbo format"
34
+ }
35
+ }
@@ -1 +1 @@
1
- export const BASE_API_URL = '';
1
+ export const BASE_API_URL = '';
@@ -1,23 +1,23 @@
1
- /**
2
- * Convert time from any time unit to any other unit
3
- */
4
- export const Time = {
5
- milliseconds: {
6
- toMinutes: 1 / (60 * 1000),
7
- toSeconds: 1 / 1000,
8
- },
9
- seconds: {
10
- toMilliseconds: 1000,
11
- },
12
- minutes: {
13
- toMilliseconds: 60 * 1000,
14
- },
15
- hours: {
16
- toMilliseconds: 60 * 60 * 1000,
17
- toSeconds: 60 * 60,
18
- },
19
- days: {
20
- toSeconds: 24 * 60 * 60,
21
- toMilliseconds: 24 * 60 * 60 * 1000,
22
- },
23
- };
1
+ /**
2
+ * Convert time from any time unit to any other unit
3
+ */
4
+ export const Time = {
5
+ milliseconds: {
6
+ toMinutes: 1 / (60 * 1000),
7
+ toSeconds: 1 / 1000,
8
+ },
9
+ seconds: {
10
+ toMilliseconds: 1000,
11
+ },
12
+ minutes: {
13
+ toMilliseconds: 60 * 1000,
14
+ },
15
+ hours: {
16
+ toMilliseconds: 60 * 60 * 1000,
17
+ toSeconds: 60 * 60,
18
+ },
19
+ days: {
20
+ toSeconds: 24 * 60 * 60,
21
+ toMilliseconds: 24 * 60 * 60 * 1000,
22
+ },
23
+ };
@@ -1 +1 @@
1
- export * from "./common.js";
1
+ export * from "./common.js";
@@ -1,11 +1,11 @@
1
- /**
2
- * @description Custom error class that extends the built-in Error class for error responses
3
- */
4
- export class ErrorResponse extends Error {
5
- constructor(public message: string, public statusCode: number) {
6
- super(message); // Call the parent constructor with the message
7
-
8
- // Set the prototype chain explicitly for older environments (optional)
9
- Object.setPrototypeOf(this, ErrorResponse.prototype);
10
- }
11
- }
1
+ /**
2
+ * @description Custom error class that extends the built-in Error class for error responses
3
+ */
4
+ export class ErrorResponse extends Error {
5
+ constructor(public message: string, public statusCode: number) {
6
+ super(message); // Call the parent constructor with the message
7
+
8
+ // Set the prototype chain explicitly for older environments (optional)
9
+ Object.setPrototypeOf(this, ErrorResponse.prototype);
10
+ }
11
+ }