@forgedevstack/harbor 1.0.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 (130) hide show
  1. package/CHANGELOG.md +126 -0
  2. package/README.md +927 -0
  3. package/dist/changelog/index.d.ts +3 -0
  4. package/dist/changelog/index.d.ts.map +1 -0
  5. package/dist/changelog/manager.d.ts +29 -0
  6. package/dist/changelog/manager.d.ts.map +1 -0
  7. package/dist/changelog/types.d.ts +41 -0
  8. package/dist/changelog/types.d.ts.map +1 -0
  9. package/dist/cli/index.d.ts +3 -0
  10. package/dist/cli/index.d.ts.map +1 -0
  11. package/dist/cli/index.js +43 -0
  12. package/dist/cli/index.js.map +1 -0
  13. package/dist/constants/config.const.d.ts +11 -0
  14. package/dist/constants/config.const.d.ts.map +1 -0
  15. package/dist/constants/defaults.const.d.ts +10 -0
  16. package/dist/constants/defaults.const.d.ts.map +1 -0
  17. package/dist/constants/http.const.d.ts +43 -0
  18. package/dist/constants/http.const.d.ts.map +1 -0
  19. package/dist/constants/index.d.ts +5 -0
  20. package/dist/constants/index.d.ts.map +1 -0
  21. package/dist/constants/validation.const.d.ts +35 -0
  22. package/dist/constants/validation.const.d.ts.map +1 -0
  23. package/dist/core/config.d.ts +6 -0
  24. package/dist/core/config.d.ts.map +1 -0
  25. package/dist/core/errorHandler.d.ts +25 -0
  26. package/dist/core/errorHandler.d.ts.map +1 -0
  27. package/dist/core/index.d.ts +6 -0
  28. package/dist/core/index.d.ts.map +1 -0
  29. package/dist/core/router.d.ts +68 -0
  30. package/dist/core/router.d.ts.map +1 -0
  31. package/dist/core/server.d.ts +4 -0
  32. package/dist/core/server.d.ts.map +1 -0
  33. package/dist/database/connection.d.ts +39 -0
  34. package/dist/database/connection.d.ts.map +1 -0
  35. package/dist/database/index.d.ts +28 -0
  36. package/dist/database/index.d.ts.map +1 -0
  37. package/dist/database/model.d.ts +118 -0
  38. package/dist/database/model.d.ts.map +1 -0
  39. package/dist/database/schema.d.ts +63 -0
  40. package/dist/database/schema.d.ts.map +1 -0
  41. package/dist/database/types.d.ts +270 -0
  42. package/dist/database/types.d.ts.map +1 -0
  43. package/dist/docker/index.d.ts +3 -0
  44. package/dist/docker/index.d.ts.map +1 -0
  45. package/dist/docker/index.js +2 -0
  46. package/dist/docker/index.js.map +1 -0
  47. package/dist/docker/manager.d.ts +21 -0
  48. package/dist/docker/manager.d.ts.map +1 -0
  49. package/dist/i18n/index.d.ts +38 -0
  50. package/dist/i18n/index.d.ts.map +1 -0
  51. package/dist/i18n/locales/en.d.ts +2 -0
  52. package/dist/i18n/locales/en.d.ts.map +1 -0
  53. package/dist/i18n/locales/he.d.ts +2 -0
  54. package/dist/i18n/locales/he.d.ts.map +1 -0
  55. package/dist/index.cjs.js +24 -0
  56. package/dist/index.cjs.js.map +1 -0
  57. package/dist/index.d.ts +21 -0
  58. package/dist/index.d.ts.map +1 -0
  59. package/dist/index.es.js +2094 -0
  60. package/dist/index.es.js.map +1 -0
  61. package/dist/logger-D7aJSi62.mjs +102 -0
  62. package/dist/logger-D7aJSi62.mjs.map +1 -0
  63. package/dist/logger-DEnWXtpk.js +3 -0
  64. package/dist/logger-DEnWXtpk.js.map +1 -0
  65. package/dist/manager-B1UKMjXW.js +4 -0
  66. package/dist/manager-B1UKMjXW.js.map +1 -0
  67. package/dist/manager-B6vqJgEn.mjs +152 -0
  68. package/dist/manager-B6vqJgEn.mjs.map +1 -0
  69. package/dist/portal.d.ts +13 -0
  70. package/dist/portal.d.ts.map +1 -0
  71. package/dist/types/config.types.d.ts +83 -0
  72. package/dist/types/config.types.d.ts.map +1 -0
  73. package/dist/types/docker.types.d.ts +92 -0
  74. package/dist/types/docker.types.d.ts.map +1 -0
  75. package/dist/types/index.d.ts +7 -0
  76. package/dist/types/index.d.ts.map +1 -0
  77. package/dist/types/logger.types.d.ts +35 -0
  78. package/dist/types/logger.types.d.ts.map +1 -0
  79. package/dist/types/route.types.d.ts +78 -0
  80. package/dist/types/route.types.d.ts.map +1 -0
  81. package/dist/types/server.types.d.ts +67 -0
  82. package/dist/types/server.types.d.ts.map +1 -0
  83. package/dist/types/validation.types.d.ts +64 -0
  84. package/dist/types/validation.types.d.ts.map +1 -0
  85. package/dist/utils/helpers.d.ts +7 -0
  86. package/dist/utils/helpers.d.ts.map +1 -0
  87. package/dist/utils/httpLogger.d.ts +52 -0
  88. package/dist/utils/httpLogger.d.ts.map +1 -0
  89. package/dist/utils/index.d.ts +6 -0
  90. package/dist/utils/index.d.ts.map +1 -0
  91. package/dist/utils/logger.d.ts +6 -0
  92. package/dist/utils/logger.d.ts.map +1 -0
  93. package/dist/utils/object.d.ts +6 -0
  94. package/dist/utils/object.d.ts.map +1 -0
  95. package/dist/validation/index.d.ts +5 -0
  96. package/dist/validation/index.d.ts.map +1 -0
  97. package/dist/validation/index.js +2 -0
  98. package/dist/validation/index.js.map +1 -0
  99. package/dist/validation/mongo.d.ts +13 -0
  100. package/dist/validation/mongo.d.ts.map +1 -0
  101. package/dist/validation/paramValidators.d.ts +18 -0
  102. package/dist/validation/paramValidators.d.ts.map +1 -0
  103. package/dist/validation/validators.d.ts +9 -0
  104. package/dist/validation/validators.d.ts.map +1 -0
  105. package/harbor.config.example.json +72 -0
  106. package/package.json +107 -0
  107. package/templates/default/.eslintrc.json +45 -0
  108. package/templates/default/README.md +97 -0
  109. package/templates/default/constants/config.ts +26 -0
  110. package/templates/default/constants/http.ts +32 -0
  111. package/templates/default/constants/index.ts +3 -0
  112. package/templates/default/controllers/index.ts +6 -0
  113. package/templates/default/controllers/user.controller.ts +77 -0
  114. package/templates/default/env.example +22 -0
  115. package/templates/default/harbor.version.json +7 -0
  116. package/templates/default/models/index.ts +6 -0
  117. package/templates/default/models/user.model.ts +68 -0
  118. package/templates/default/package.json +44 -0
  119. package/templates/default/routes/index.ts +12 -0
  120. package/templates/default/routes/user.routes.ts +21 -0
  121. package/templates/default/server.ts +45 -0
  122. package/templates/default/services/index.ts +6 -0
  123. package/templates/default/services/user.service.ts +84 -0
  124. package/templates/default/tsconfig.json +35 -0
  125. package/templates/default/types/index.ts +57 -0
  126. package/templates/default/utils/asyncHandler.ts +14 -0
  127. package/templates/default/utils/index.ts +5 -0
  128. package/templates/default/utils/logger.ts +52 -0
  129. package/templates/default/utils/response.ts +24 -0
  130. package/templates/default/utils/validation.ts +23 -0
@@ -0,0 +1,3 @@
1
+ export { ChangelogManager, createChangelogManager, generateChangelog } from './manager';
2
+ export type { ChangelogEntry, ChangelogConfig, VersionTag } from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/changelog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACxF,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { ChangelogEntry, ChangelogConfig, ChangeItem, ChangeType, ReleaseNotes } from './types';
2
+
3
+ export declare function createChangelogManager(config?: Partial<ChangelogConfig>): {
4
+ load: () => void;
5
+ save: () => void;
6
+ addChange(type: ChangeType, description: string, options?: {
7
+ scope?: string;
8
+ issue?: string;
9
+ }): void;
10
+ release(version: string): ChangelogEntry;
11
+ getEntries(): ChangelogEntry[];
12
+ getUnreleased(): ChangeItem[];
13
+ getLatestVersion(): string | null;
14
+ getReleaseNotes(version: string): ReleaseNotes | null;
15
+ };
16
+ export declare function generateChangelog(entries: ChangelogEntry[], config?: Partial<ChangelogConfig>): string;
17
+ export declare class ChangelogManager {
18
+ private manager;
19
+ constructor(config?: Partial<ChangelogConfig>);
20
+ load: () => void;
21
+ save: () => void;
22
+ addChange: (...args: Parameters<typeof this.manager.addChange>) => void;
23
+ release: (version: string) => ChangelogEntry;
24
+ getEntries: () => ChangelogEntry[];
25
+ getUnreleased: () => ChangeItem[];
26
+ getLatestVersion: () => string | null;
27
+ getReleaseNotes: (version: string) => ReleaseNotes | null;
28
+ }
29
+ //# sourceMappingURL=manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/changelog/manager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAWrG,wBAAgB,sBAAsB,CAAC,MAAM,GAAE,OAAO,CAAC,eAAe,CAAM;gBAKzD,IAAI;gBA6DJ,IAAI;oBAuFH,UAAU,eAAe,MAAM,YAAY;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;qBASnF,MAAM,GAAG,cAAc;kBAe1B,cAAc,EAAE;qBAIb,UAAU,EAAE;wBAIT,MAAM,GAAG,IAAI;6BAIR,MAAM,GAAG,YAAY,GAAG,IAAI;EAmBxD;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,MAAM,CActG;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,OAAO,CAA4C;gBAE/C,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC;IAI7C,IAAI,aAA6B;IACjC,IAAI,aAA6B;IACjC,SAAS,GAAI,GAAG,MAAM,UAAU,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,UAAqC;IACpG,OAAO,GAAI,SAAS,MAAM,oBAAmC;IAC7D,UAAU,yBAAmC;IAC7C,aAAa,qBAAsC;IACnD,gBAAgB,sBAAyC;IACzD,eAAe,GAAI,SAAS,MAAM,yBAA2C;CAC9E"}
@@ -0,0 +1,41 @@
1
+ export interface ChangelogEntry {
2
+ version: string;
3
+ date: Date;
4
+ changes: ChangeItem[];
5
+ breaking?: ChangeItem[];
6
+ }
7
+ export interface ChangeItem {
8
+ type: ChangeType;
9
+ description: string;
10
+ scope?: string;
11
+ issue?: string;
12
+ pr?: string;
13
+ }
14
+ export type ChangeType = 'added' | 'changed' | 'deprecated' | 'removed' | 'fixed' | 'security';
15
+ export interface ChangelogConfig {
16
+ filePath: string;
17
+ format: 'markdown' | 'json';
18
+ includeUnreleased: boolean;
19
+ compareUrl?: string;
20
+ issueUrl?: string;
21
+ prUrl?: string;
22
+ }
23
+ export interface VersionTag {
24
+ version: string;
25
+ commit: string;
26
+ date: Date;
27
+ message?: string;
28
+ }
29
+ export interface ReleaseNotes {
30
+ version: string;
31
+ date: Date;
32
+ summary?: string;
33
+ added: string[];
34
+ changed: string[];
35
+ deprecated: string[];
36
+ removed: string[];
37
+ fixed: string[];
38
+ security: string[];
39
+ breaking: string[];
40
+ }
41
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/changelog/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,UAAU,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,UAAU,GAClB,OAAO,GACP,SAAS,GACT,YAAY,GACZ,SAAS,GACT,OAAO,GACP,UAAU,CAAC;AAEf,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC;IAC5B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env node
2
+ "use strict";const n=require("path"),o=require("fs"),b=require("../logger-DEnWXtpk.js"),v=b.createLogger("cli"),f=[{name:"create",description:"Create a new Harbor project with full boilerplate",action:j},{name:"init",description:"Initialize Harbor config in existing project",action:S},{name:"generate",description:"Generate server file from config",action:x},{name:"docs",description:"Generate API documentation",action:w},{name:"version",description:"Show Harbor version",action:P},{name:"help",description:"Show help information",action:d}];async function y(){const t=process.argv.slice(2),e=t[0]??"help",l=t.slice(1),r=f.find(s=>s.name===e);r||(console.error(`Unknown command: ${e}`),d(),process.exit(1));try{await r.action(l)}catch(s){v.error("Command failed",s),process.exit(1)}}function u(t,e,l={}){o.existsSync(e)||o.mkdirSync(e,{recursive:!0});const r=o.readdirSync(t);for(const s of r){const c=n.join(t,s),a=n.join(e,s);if(o.statSync(c).isDirectory())u(c,a,l);else{let i=o.readFileSync(c,"utf-8");for(const[m,h]of Object.entries(l))i=i.replace(new RegExp(`\\{\\{${m}\\}\\}`,"g"),h);const p=s==="env.example"?n.join(n.dirname(a),".env.example"):a;o.writeFileSync(p,i,"utf-8")}}}async function j(t){const e=t[0];e||(console.error("Please provide a project name: harbor create <project-name>"),process.exit(1));const l=n.resolve(process.cwd(),e);o.existsSync(l)&&(console.error(`Directory "${e}" already exists`),process.exit(1)),console.log(`
3
+ 🚢 Creating Harbor project: ${e}
4
+ `);let r=n.resolve(__dirname,"../../templates/default");o.existsSync(r)||(r=n.resolve(__dirname,"../../../templates/default")),o.existsSync(r)||(console.error("Templates not found. Please reinstall Harbor."),process.exit(1));const s={PROJECT_NAME:e,PROJECT_DESCRIPTION:"A Node.js backend built with Harbor",CREATED_AT:new Date().toISOString()};console.log("📁 Copying project files..."),u(r,l,s);const c={server:{port:3e3,host:"localhost",cors:{enabled:!0,origin:"*"}},database:{type:"mongodb",uri:"",name:e.toLowerCase().replace(/[^a-z0-9]/g,"_")},routes:{prefix:"/api",timeout:3e4},errors:{404:{message:"Not Found",json:!0},500:{message:"Internal Server Error",json:!0,log:!0}},logger:{enabled:!0,level:"info",format:"text"}};o.writeFileSync(n.join(l,"harbor.config.json"),JSON.stringify(c,null,2),"utf-8"),console.log(`✅ Project created successfully!
5
+ `),console.log(`📂 Project structure:
6
+ `),console.log(` ${e}/`),console.log(" ├── server.ts # Application entry point"),console.log(" ├── routes/ # Route definitions"),console.log(" ├── controllers/ # Request handlers"),console.log(" ├── services/ # Business logic"),console.log(" ├── models/ # Database models"),console.log(" ├── types/ # TypeScript definitions"),console.log(" ├── utils/ # Utility functions"),console.log(" ├── constants/ # App constants & config"),console.log(" ├── package.json"),console.log(" ├── tsconfig.json"),console.log(" ├── .eslintrc.json"),console.log(" └── harbor.config.json"),console.log(`
7
+ 🚀 Next steps:
8
+ `),console.log(` cd ${e}`),console.log(" npm install"),console.log(" cp .env.example .env"),console.log(` npm run dev
9
+ `),console.log(`📚 Documentation: https://github.com/yaghobieh/Harbor
10
+ `)}function S(t){const e=process.cwd(),l=t.includes("--template")||t.includes("-t"),r=e.split("/").pop()||"my-app";if(l){console.log(`
11
+ 🚢 Initializing with template...
12
+ `);let i=n.resolve(__dirname,"../../templates/default");o.existsSync(i)||(i=n.resolve(__dirname,"../../../templates/default")),o.existsSync(i)||(console.error("Templates not found. Please reinstall Harbor."),process.exit(1));const p={PROJECT_NAME:r,PROJECT_DESCRIPTION:"A Node.js backend built with Harbor"};console.log("📁 Copying project files..."),u(i,e,p);const m={server:{port:3e3,host:"localhost",cors:{enabled:!0,origin:"*"}},database:{type:"mongodb",uri:"",name:r.toLowerCase().replace(/[^a-z0-9]/g,"_")},routes:{prefix:"/api",timeout:3e4},errors:{404:{message:"Not Found",json:!0},500:{message:"Internal Server Error",json:!0,log:!0}},logger:{enabled:!0,level:"info",format:"text"}};o.writeFileSync(n.join(e,"harbor.config.json"),JSON.stringify(m,null,2),"utf-8"),console.log(`✅ Project initialized with template!
13
+ `),console.log(`🚀 Next steps:
14
+ `),console.log(" npm install"),console.log(" cp .env.example .env"),console.log(` npm run dev
15
+ `);return}const s=n.resolve(e,"harbor.config.json");if(o.existsSync(s)){console.log("harbor.config.json already exists");return}const c={server:{port:3e3,host:"localhost",cors:{enabled:!0,origin:"*"},bodyParser:{json:!0,urlencoded:!0,limit:"10mb"}},routes:{prefix:"/api",timeout:3e4},validation:{adapter:"mongoose",strictMode:!0,sanitize:!0},errors:{404:{message:"Not Found",json:!0},500:{message:"Internal Server Error",json:!0,log:!0}},logger:{enabled:!0,level:"info",format:"text",output:"console"}};o.writeFileSync(s,JSON.stringify(c,null,2),"utf-8"),console.log("Created harbor.config.json");const a=n.resolve(e,"src");o.existsSync(a)||o.mkdirSync(a,{recursive:!0});const g=n.resolve(a,"server.ts");o.existsSync(g)||(o.writeFileSync(g,`import { createServer, GET, POST } from 'harbor';
16
+
17
+ const server = createServer({
18
+ port: 3000,
19
+ });
20
+
21
+ // Health check
22
+ server.get('/health', GET(async () => ({
23
+ status: 'ok',
24
+ timestamp: new Date().toISOString()
25
+ })));
26
+
27
+ // Start the server
28
+ server.listen(3000, () => {
29
+ console.log('Server running at http://localhost:3000');
30
+ });
31
+ `,"utf-8"),console.log("Created src/server.ts")),console.log(`
32
+ Harbor project initialized!`),console.log("Run: npm install harbor"),console.log("Then: npm run dev"),console.log(`
33
+ Tip: Use --template flag for full boilerplate`)}function x(){console.log("Generating server from config..."),console.log("This feature is coming soon!")}function w(){console.log("Generating API documentation..."),console.log("This feature is coming soon!")}function P(){console.log("Harbor v1.2.0")}function d(){console.log(`
34
+ 🚢 Harbor - The pipeline for Node.js backends
35
+ `),console.log(`Usage: harbor <command> [options]
36
+ `),console.log(`Commands:
37
+ `);for(const t of f)console.log(` ${t.name.padEnd(12)} ${t.description}`);console.log(`
38
+ Options:
39
+ `),console.log(" --template, -t Use full boilerplate template (for init command)"),console.log(`
40
+ Examples:
41
+ `),console.log(" harbor create my-app Create new project with boilerplate"),console.log(" harbor init Initialize config in existing project"),console.log(" harbor init --template Initialize with full boilerplate"),console.log(" harbor docs Generate API documentation"),console.log(" harbor version Show version"),console.log(`
42
+ Documentation: https://github.com/yaghobieh/Harbor`)}y();
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { resolve, join, dirname } from 'path';\nimport { existsSync, writeFileSync, mkdirSync, readFileSync, readdirSync, statSync } from 'fs';\nimport { createLogger } from '../utils/logger';\n\nconst logger = createLogger('cli');\n\ninterface CliCommand {\n name: string;\n description: string;\n action: (args: string[]) => Promise<void> | void;\n}\n\nconst commands: CliCommand[] = [\n {\n name: 'create',\n description: 'Create a new Harbor project with full boilerplate',\n action: createProject,\n },\n {\n name: 'init',\n description: 'Initialize Harbor config in existing project',\n action: initProject,\n },\n {\n name: 'generate',\n description: 'Generate server file from config',\n action: generateServer,\n },\n {\n name: 'docs',\n description: 'Generate API documentation',\n action: generateDocs,\n },\n {\n name: 'version',\n description: 'Show Harbor version',\n action: showVersion,\n },\n {\n name: 'help',\n description: 'Show help information',\n action: showHelp,\n },\n];\n\nasync function main(): Promise<void> {\n const args = process.argv.slice(2);\n const commandName = args[0] ?? 'help';\n const commandArgs = args.slice(1);\n\n const command = commands.find((c) => c.name === commandName);\n\n if (!command) {\n console.error(`Unknown command: ${commandName}`);\n showHelp();\n process.exit(1);\n }\n\n try {\n await command.action(commandArgs);\n } catch (error) {\n logger.error('Command failed', error as Error);\n process.exit(1);\n }\n}\n\n/**\n * Copy directory recursively\n */\nfunction copyDirectory(src: string, dest: string, replacements: Record<string, string> = {}): void {\n if (!existsSync(dest)) {\n mkdirSync(dest, { recursive: true });\n }\n\n const entries = readdirSync(src);\n\n for (const entry of entries) {\n const srcPath = join(src, entry);\n const destPath = join(dest, entry);\n const stats = statSync(srcPath);\n\n if (stats.isDirectory()) {\n copyDirectory(srcPath, destPath, replacements);\n } else {\n // Read file content\n let content = readFileSync(srcPath, 'utf-8');\n\n // Apply replacements for template variables\n for (const [key, value] of Object.entries(replacements)) {\n content = content.replace(new RegExp(`\\\\{\\\\{${key}\\\\}\\\\}`, 'g'), value);\n }\n\n // Handle env.example -> .env.example rename\n const finalDestPath = entry === 'env.example' \n ? join(dirname(destPath), '.env.example')\n : destPath;\n\n writeFileSync(finalDestPath, content, 'utf-8');\n }\n }\n}\n\n/**\n * Create a new project with full boilerplate\n */\nasync function createProject(args: string[]): Promise<void> {\n const projectName = args[0];\n\n if (!projectName) {\n console.error('Please provide a project name: harbor create <project-name>');\n process.exit(1);\n }\n\n const projectPath = resolve(process.cwd(), projectName);\n\n if (existsSync(projectPath)) {\n console.error(`Directory \"${projectName}\" already exists`);\n process.exit(1);\n }\n\n console.log(`\\n🚢 Creating Harbor project: ${projectName}\\n`);\n\n // Find templates directory\n // When installed from npm, templates are in the package root\n // When running locally, they're in the project root\n let templatesPath = resolve(__dirname, '../../templates/default');\n \n if (!existsSync(templatesPath)) {\n // Try relative to src for development\n templatesPath = resolve(__dirname, '../../../templates/default');\n }\n\n if (!existsSync(templatesPath)) {\n console.error('Templates not found. Please reinstall Harbor.');\n process.exit(1);\n }\n\n // Template replacements\n const replacements: Record<string, string> = {\n PROJECT_NAME: projectName,\n PROJECT_DESCRIPTION: `A Node.js backend built with Harbor`,\n CREATED_AT: new Date().toISOString(),\n };\n\n // Copy template files\n console.log('📁 Copying project files...');\n copyDirectory(templatesPath, projectPath, replacements);\n\n // Create harbor.config.json\n const harborConfig = {\n server: {\n port: 3000,\n host: 'localhost',\n cors: {\n enabled: true,\n origin: '*',\n },\n },\n database: {\n type: 'mongodb',\n uri: '',\n name: projectName.toLowerCase().replace(/[^a-z0-9]/g, '_'),\n },\n routes: {\n prefix: '/api',\n timeout: 30000,\n },\n errors: {\n 404: { message: 'Not Found', json: true },\n 500: { message: 'Internal Server Error', json: true, log: true },\n },\n logger: {\n enabled: true,\n level: 'info',\n format: 'text',\n },\n };\n\n writeFileSync(\n join(projectPath, 'harbor.config.json'),\n JSON.stringify(harborConfig, null, 2),\n 'utf-8'\n );\n\n console.log('✅ Project created successfully!\\n');\n console.log('📂 Project structure:\\n');\n console.log(` ${projectName}/`);\n console.log(' ├── server.ts # Application entry point');\n console.log(' ├── routes/ # Route definitions');\n console.log(' ├── controllers/ # Request handlers');\n console.log(' ├── services/ # Business logic');\n console.log(' ├── models/ # Database models');\n console.log(' ├── types/ # TypeScript definitions');\n console.log(' ├── utils/ # Utility functions');\n console.log(' ├── constants/ # App constants & config');\n console.log(' ├── package.json');\n console.log(' ├── tsconfig.json');\n console.log(' ├── .eslintrc.json');\n console.log(' └── harbor.config.json');\n\n console.log('\\n🚀 Next steps:\\n');\n console.log(` cd ${projectName}`);\n console.log(' npm install');\n console.log(' cp .env.example .env');\n console.log(' npm run dev\\n');\n\n console.log('📚 Documentation: https://github.com/yaghobieh/Harbor\\n');\n}\n\nfunction initProject(args: string[]): void {\n const cwd = process.cwd();\n const useTemplate = args.includes('--template') || args.includes('-t');\n const projectName = cwd.split('/').pop() || 'my-app';\n \n if (useTemplate) {\n console.log('\\n🚢 Initializing with template...\\n');\n \n // Find templates directory\n let templatesPath = resolve(__dirname, '../../templates/default');\n if (!existsSync(templatesPath)) {\n templatesPath = resolve(__dirname, '../../../templates/default');\n }\n\n if (!existsSync(templatesPath)) {\n console.error('Templates not found. Please reinstall Harbor.');\n process.exit(1);\n }\n\n // Template replacements\n const replacements: Record<string, string> = {\n PROJECT_NAME: projectName,\n PROJECT_DESCRIPTION: `A Node.js backend built with Harbor`,\n };\n\n // Copy template files\n console.log('📁 Copying project files...');\n copyDirectory(templatesPath, cwd, replacements);\n\n // Create harbor.config.json\n const harborConfig = {\n server: {\n port: 3000,\n host: 'localhost',\n cors: { enabled: true, origin: '*' },\n },\n database: {\n type: 'mongodb',\n uri: '',\n name: projectName.toLowerCase().replace(/[^a-z0-9]/g, '_'),\n },\n routes: { prefix: '/api', timeout: 30000 },\n errors: {\n 404: { message: 'Not Found', json: true },\n 500: { message: 'Internal Server Error', json: true, log: true },\n },\n logger: { enabled: true, level: 'info', format: 'text' },\n };\n\n writeFileSync(\n join(cwd, 'harbor.config.json'),\n JSON.stringify(harborConfig, null, 2),\n 'utf-8'\n );\n\n console.log('✅ Project initialized with template!\\n');\n console.log('🚀 Next steps:\\n');\n console.log(' npm install');\n console.log(' cp .env.example .env');\n console.log(' npm run dev\\n');\n return;\n }\n\n // Simple init without template\n const configPath = resolve(cwd, 'harbor.config.json');\n if (existsSync(configPath)) {\n console.log('harbor.config.json already exists');\n return;\n }\n\n const defaultConfig = {\n server: {\n port: 3000,\n host: 'localhost',\n cors: {\n enabled: true,\n origin: '*',\n },\n bodyParser: {\n json: true,\n urlencoded: true,\n limit: '10mb',\n },\n },\n routes: {\n prefix: '/api',\n timeout: 30000,\n },\n validation: {\n adapter: 'mongoose',\n strictMode: true,\n sanitize: true,\n },\n errors: {\n 404: {\n message: 'Not Found',\n json: true,\n },\n 500: {\n message: 'Internal Server Error',\n json: true,\n log: true,\n },\n },\n logger: {\n enabled: true,\n level: 'info',\n format: 'text',\n output: 'console',\n },\n };\n\n writeFileSync(configPath, JSON.stringify(defaultConfig, null, 2), 'utf-8');\n console.log('Created harbor.config.json');\n\n const serverDir = resolve(cwd, 'src');\n if (!existsSync(serverDir)) {\n mkdirSync(serverDir, { recursive: true });\n }\n\n const serverPath = resolve(serverDir, 'server.ts');\n if (!existsSync(serverPath)) {\n const serverTemplate = `import { createServer, GET, POST } from 'harbor';\n\nconst server = createServer({\n port: 3000,\n});\n\n// Health check\nserver.get('/health', GET(async () => ({ \n status: 'ok', \n timestamp: new Date().toISOString() \n})));\n\n// Start the server\nserver.listen(3000, () => {\n console.log('Server running at http://localhost:3000');\n});\n`;\n\n writeFileSync(serverPath, serverTemplate, 'utf-8');\n console.log('Created src/server.ts');\n }\n\n console.log('\\nHarbor project initialized!');\n console.log('Run: npm install harbor');\n console.log('Then: npm run dev');\n console.log('\\nTip: Use --template flag for full boilerplate');\n}\n\nfunction generateServer(): void {\n console.log('Generating server from config...');\n console.log('This feature is coming soon!');\n}\n\nfunction generateDocs(): void {\n console.log('Generating API documentation...');\n console.log('This feature is coming soon!');\n}\n\nfunction showVersion(): void {\n console.log('Harbor v1.2.0');\n}\n\nfunction showHelp(): void {\n console.log('\\n🚢 Harbor - The pipeline for Node.js backends\\n');\n console.log('Usage: harbor <command> [options]\\n');\n console.log('Commands:\\n');\n\n for (const command of commands) {\n console.log(` ${command.name.padEnd(12)} ${command.description}`);\n }\n\n console.log('\\nOptions:\\n');\n console.log(' --template, -t Use full boilerplate template (for init command)');\n\n console.log('\\nExamples:\\n');\n console.log(' harbor create my-app Create new project with boilerplate');\n console.log(' harbor init Initialize config in existing project');\n console.log(' harbor init --template Initialize with full boilerplate');\n console.log(' harbor docs Generate API documentation');\n console.log(' harbor version Show version');\n console.log('\\nDocumentation: https://github.com/yaghobieh/Harbor');\n}\n\nmain();\n"],"names":["logger","createLogger","commands","createProject","initProject","generateServer","generateDocs","showVersion","showHelp","main","args","commandName","commandArgs","command","c","error","copyDirectory","src","dest","replacements","existsSync","mkdirSync","entries","readdirSync","entry","srcPath","join","destPath","statSync","content","readFileSync","key","value","finalDestPath","dirname","writeFileSync","projectName","projectPath","resolve","templatesPath","harborConfig","cwd","useTemplate","configPath","defaultConfig","serverDir","serverPath"],"mappings":";wFAMMA,EAASC,EAAAA,aAAa,KAAK,EAQ3BC,EAAyB,CAC7B,CACE,KAAM,SACN,YAAa,oDACb,OAAQC,CAAA,EAEV,CACE,KAAM,OACN,YAAa,+CACb,OAAQC,CAAA,EAEV,CACE,KAAM,WACN,YAAa,mCACb,OAAQC,CAAA,EAEV,CACE,KAAM,OACN,YAAa,6BACb,OAAQC,CAAA,EAEV,CACE,KAAM,UACN,YAAa,sBACb,OAAQC,CAAA,EAEV,CACE,KAAM,OACN,YAAa,wBACb,OAAQC,CAAA,CAEZ,EAEA,eAAeC,GAAsB,CACnC,MAAMC,EAAO,QAAQ,KAAK,MAAM,CAAC,EAC3BC,EAAcD,EAAK,CAAC,GAAK,OACzBE,EAAcF,EAAK,MAAM,CAAC,EAE1BG,EAAUX,EAAS,KAAMY,GAAMA,EAAE,OAASH,CAAW,EAEtDE,IACH,QAAQ,MAAM,oBAAoBF,CAAW,EAAE,EAC/CH,EAAA,EACA,QAAQ,KAAK,CAAC,GAGhB,GAAI,CACF,MAAMK,EAAQ,OAAOD,CAAW,CAClC,OAASG,EAAO,CACdf,EAAO,MAAM,iBAAkBe,CAAc,EAC7C,QAAQ,KAAK,CAAC,CAChB,CACF,CAKA,SAASC,EAAcC,EAAaC,EAAcC,EAAuC,CAAA,EAAU,CAC5FC,EAAAA,WAAWF,CAAI,GAClB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B,QAAQ,IAAI,kCAAkC,EAC9C,QAAQ,IAAI,8BAA8B,CAC5C,CAEA,SAASC,GAAqB,CAC5B,QAAQ,IAAI,iCAAiC,EAC7C,QAAQ,IAAI,8BAA8B,CAC5C,CAEA,SAASC,GAAoB,CAC3B,QAAQ,IAAI,eAAe,CAC7B,CAEA,SAASC,GAAiB,CACxB,QAAQ,IAAI;AAAA;AAAA,CAAmD,EAC/D,QAAQ,IAAI;AAAA,CAAqC,EACjD,QAAQ,IAAI;AAAA,CAAa,EAEzB,UAAWK,KAAWX,EACpB,QAAQ,IAAI,KAAKW,EAAQ,KAAK,OAAO,EAAE,CAAC,IAAIA,EAAQ,WAAW,EAAE,EAGnE,QAAQ,IAAI;AAAA;AAAA,CAAc,EAC1B,QAAQ,IAAI,uEAAuE,EAEnF,QAAQ,IAAI;AAAA;AAAA,CAAe,EAC3B,QAAQ,IAAI,gEAAgE,EAC5E,QAAQ,IAAI,kEAAkE,EAC9E,QAAQ,IAAI,6DAA6D,EACzE,QAAQ,IAAI,uDAAuD,EACnE,QAAQ,IAAI,yCAAyC,EACrD,QAAQ,IAAI;AAAA,mDAAsD,CACpE,CAEAJ,EAAA"}
@@ -0,0 +1,11 @@
1
+ export declare const CONFIG_FILE_NAME = "harbor.config.json";
2
+ export declare const CONFIG_SEARCH_PATHS: readonly ["./harbor.config.json", "./config/harbor.config.json", "./.harbor/config.json"];
3
+ export declare const ENV_PREFIX = "HARBOR_";
4
+ export declare const ENV_KEYS: {
5
+ readonly PORT: "HARBOR_PORT";
6
+ readonly HOST: "HARBOR_HOST";
7
+ readonly LOG_LEVEL: "HARBOR_LOG_LEVEL";
8
+ readonly CONFIG_PATH: "HARBOR_CONFIG_PATH";
9
+ readonly NODE_ENV: "NODE_ENV";
10
+ };
11
+ //# sourceMappingURL=config.const.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.const.d.ts","sourceRoot":"","sources":["../../src/constants/config.const.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,uBAAuB,CAAC;AAErD,eAAO,MAAM,mBAAmB,2FAItB,CAAC;AAEX,eAAO,MAAM,UAAU,YAAY,CAAC;AAEpC,eAAO,MAAM,QAAQ;;;;;;CAMX,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { HarborConfig } from '../types';
2
+
3
+ export declare const DEFAULT_PORT = 3000;
4
+ export declare const DEFAULT_HOST = "localhost";
5
+ export declare const DEFAULT_TIMEOUT = 30000;
6
+ export declare const DEFAULT_BODY_LIMIT = "10mb";
7
+ export declare const DEFAULT_CONFIG: HarborConfig;
8
+ export declare const GRACEFUL_SHUTDOWN_TIMEOUT = 10000;
9
+ export declare const HEALTH_CHECK_INTERVAL = 30000;
10
+ //# sourceMappingURL=defaults.const.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.const.d.ts","sourceRoot":"","sources":["../../src/constants/defaults.const.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,YAAY,OAAO,CAAC;AACjC,eAAO,MAAM,YAAY,cAAc,CAAC;AACxC,eAAO,MAAM,eAAe,QAAQ,CAAC;AACrC,eAAO,MAAM,kBAAkB,SAAS,CAAC;AAEzC,eAAO,MAAM,cAAc,EAAE,YAiE5B,CAAC;AAEF,eAAO,MAAM,yBAAyB,QAAQ,CAAC;AAE/C,eAAO,MAAM,qBAAqB,QAAQ,CAAC"}
@@ -0,0 +1,43 @@
1
+ export declare const HTTP_METHODS: {
2
+ readonly GET: "GET";
3
+ readonly POST: "POST";
4
+ readonly PUT: "PUT";
5
+ readonly PATCH: "PATCH";
6
+ readonly DELETE: "DELETE";
7
+ readonly OPTIONS: "OPTIONS";
8
+ readonly HEAD: "HEAD";
9
+ };
10
+ export declare const HTTP_STATUS: {
11
+ readonly OK: 200;
12
+ readonly CREATED: 201;
13
+ readonly NO_CONTENT: 204;
14
+ readonly BAD_REQUEST: 400;
15
+ readonly UNAUTHORIZED: 401;
16
+ readonly FORBIDDEN: 403;
17
+ readonly NOT_FOUND: 404;
18
+ readonly METHOD_NOT_ALLOWED: 405;
19
+ readonly CONFLICT: 409;
20
+ readonly UNPROCESSABLE_ENTITY: 422;
21
+ readonly TOO_MANY_REQUESTS: 429;
22
+ readonly INTERNAL_SERVER_ERROR: 500;
23
+ readonly BAD_GATEWAY: 502;
24
+ readonly SERVICE_UNAVAILABLE: 503;
25
+ readonly GATEWAY_TIMEOUT: 504;
26
+ };
27
+ export declare const HTTP_STATUS_MESSAGES: Record<number, string>;
28
+ export declare const CONTENT_TYPES: {
29
+ readonly JSON: "application/json";
30
+ readonly HTML: "text/html";
31
+ readonly TEXT: "text/plain";
32
+ readonly FORM: "application/x-www-form-urlencoded";
33
+ readonly MULTIPART: "multipart/form-data";
34
+ };
35
+ export declare const HEADERS: {
36
+ readonly CONTENT_TYPE: "Content-Type";
37
+ readonly AUTHORIZATION: "Authorization";
38
+ readonly ACCEPT: "Accept";
39
+ readonly CACHE_CONTROL: "Cache-Control";
40
+ readonly X_REQUEST_ID: "X-Request-ID";
41
+ readonly X_RESPONSE_TIME: "X-Response-Time";
42
+ };
43
+ //# sourceMappingURL=http.const.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.const.d.ts","sourceRoot":"","sources":["../../src/constants/http.const.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;;;CAQf,CAAC;AAEX,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;CAgBd,CAAC;AAEX,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAgBvD,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAC;AAEX,eAAO,MAAM,OAAO;;;;;;;CAOV,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './config.const';
2
+ export * from './http.const';
3
+ export * from './validation.const';
4
+ export * from './defaults.const';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,35 @@
1
+ export declare const MONGO_FIELD_TYPES: {
2
+ readonly STRING: "String";
3
+ readonly NUMBER: "Number";
4
+ readonly BOOLEAN: "Boolean";
5
+ readonly DATE: "Date";
6
+ readonly OBJECT_ID: "ObjectId";
7
+ readonly ARRAY: "Array";
8
+ readonly OBJECT: "Object";
9
+ readonly BUFFER: "Buffer";
10
+ readonly MIXED: "Mixed";
11
+ };
12
+ export declare const VALIDATION_MESSAGES: {
13
+ readonly REQUIRED: "{field} is required";
14
+ readonly TYPE_MISMATCH: "{field} must be of type {type}";
15
+ readonly MIN_VALUE: "{field} must be at least {min}";
16
+ readonly MAX_VALUE: "{field} must be at most {max}";
17
+ readonly MIN_LENGTH: "{field} must be at least {min} characters";
18
+ readonly MAX_LENGTH: "{field} must be at most {max} characters";
19
+ readonly PATTERN: "{field} does not match the required pattern";
20
+ readonly ENUM: "{field} must be one of: {values}";
21
+ readonly INVALID_OBJECT_ID: "{field} is not a valid ObjectId";
22
+ readonly INVALID_EMAIL: "{field} is not a valid email address";
23
+ readonly INVALID_URL: "{field} is not a valid URL";
24
+ readonly INVALID_DATE: "{field} is not a valid date";
25
+ };
26
+ export declare const REGEX_PATTERNS: {
27
+ readonly EMAIL: RegExp;
28
+ readonly URL: RegExp;
29
+ readonly OBJECT_ID: RegExp;
30
+ readonly UUID: RegExp;
31
+ readonly PHONE: RegExp;
32
+ readonly ALPHANUMERIC: RegExp;
33
+ readonly SLUG: RegExp;
34
+ };
35
+ //# sourceMappingURL=validation.const.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.const.d.ts","sourceRoot":"","sources":["../../src/constants/validation.const.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB;;;;;;;;;;CAUpB,CAAC;AAEX,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;CAatB,CAAC;AAEX,eAAO,MAAM,cAAc;;;;;;;;CAQjB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { HarborConfig } from '../types';
2
+
3
+ export declare function loadConfig(configPath?: string): HarborConfig;
4
+ export declare function defineConfig(config: Partial<HarborConfig>): HarborConfig;
5
+ export declare function getConfigValue<T>(config: HarborConfig, path: string): T | undefined;
6
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAO7C,wBAAgB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,YAAY,CAsB5D;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAKxE;AA8ED,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAYnF"}
@@ -0,0 +1,25 @@
1
+ import { ErrorRequestHandler, RequestHandler } from 'express';
2
+ import { HarborConfig } from '../types';
3
+
4
+ export declare class HarborError extends Error {
5
+ statusCode: number;
6
+ code?: string;
7
+ details?: unknown;
8
+ isOperational: boolean;
9
+ constructor(message: string, statusCode?: number, options?: {
10
+ code?: string;
11
+ details?: unknown;
12
+ isOperational?: boolean;
13
+ });
14
+ static badRequest(message?: string, details?: unknown): HarborError;
15
+ static unauthorized(message?: string): HarborError;
16
+ static forbidden(message?: string): HarborError;
17
+ static notFound(message?: string): HarborError;
18
+ static conflict(message?: string, details?: unknown): HarborError;
19
+ static internal(message?: string): HarborError;
20
+ static tooManyRequests(message?: string): HarborError;
21
+ toJSON(): Record<string, unknown>;
22
+ }
23
+ export declare function createErrorHandler(config: HarborConfig): ErrorRequestHandler;
24
+ export declare function notFoundHandler(config: HarborConfig): RequestHandler;
25
+ //# sourceMappingURL=errorHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../src/core/errorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAmC,MAAM,SAAS,CAAC;AACpG,OAAO,KAAK,EAAE,YAAY,EAA8B,MAAM,UAAU,CAAC;AAMzE,qBAAa,WAAY,SAAQ,KAAK;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;gBAG5B,OAAO,EAAE,MAAM,EACf,UAAU,GAAE,MAA0C,EACtD,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB;IAYH,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,WAAW;IAQnE,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW;IAQlD,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW;IAQ/C,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW;IAQ9C,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,WAAW;IAQjE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW;IAQ9C,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW;IAQrD,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAWlC;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,mBAAmB,CA4B5E;AA2BD,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,cAAc,CA4BpE"}
@@ -0,0 +1,6 @@
1
+ export { createServer } from './server';
2
+ export { createRouter, RouteBuilder, GET, POST, PUT, PATCH, DELETE, route, } from './router';
3
+ export type { RouteHandlerFn, SimpleRouteOptions } from './router';
4
+ export { loadConfig, defineConfig } from './config';
5
+ export { createErrorHandler, HarborError } from './errorHandler';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EACL,YAAY,EACZ,YAAY,EAEZ,GAAG,EACH,IAAI,EACJ,GAAG,EACH,KAAK,EACL,MAAM,EACN,KAAK,GACN,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { Router, RequestHandler } from 'express';
2
+ import { RouteDefinition, RouteOptions, HarborRequest, HarborResponse, HttpMethod, HarborConfig, PreFunction, PostFunction, RouteHandler, ValidationSchema } from '../types';
3
+
4
+ interface RouterOptions {
5
+ prefix?: string;
6
+ routes?: RouteDefinition[];
7
+ middleware?: RequestHandler[];
8
+ }
9
+ export declare function createRouter(options: RouterOptions, config: HarborConfig): Router;
10
+ export type RouteHandlerFn = (req: HarborRequest, res: HarborResponse) => unknown | Promise<unknown>;
11
+ export interface SimpleRouteOptions {
12
+ pre?: PreFunction[];
13
+ post?: PostFunction[];
14
+ validation?: {
15
+ params?: ValidationSchema;
16
+ query?: ValidationSchema;
17
+ body?: ValidationSchema;
18
+ headers?: ValidationSchema;
19
+ };
20
+ timeout?: number;
21
+ }
22
+ /**
23
+ * Define a GET route
24
+ */
25
+ export declare function GET(path: string, handler: RouteHandlerFn, options?: SimpleRouteOptions): RouteDefinition;
26
+ /**
27
+ * Define a POST route
28
+ */
29
+ export declare function POST(path: string, handler: RouteHandlerFn, options?: SimpleRouteOptions): RouteDefinition;
30
+ /**
31
+ * Define a PUT route
32
+ */
33
+ export declare function PUT(path: string, handler: RouteHandlerFn, options?: SimpleRouteOptions): RouteDefinition;
34
+ /**
35
+ * Define a PATCH route
36
+ */
37
+ export declare function PATCH(path: string, handler: RouteHandlerFn, options?: SimpleRouteOptions): RouteDefinition;
38
+ /**
39
+ * Define a DELETE route
40
+ */
41
+ export declare function DELETE(path: string, handler: RouteHandlerFn, options?: SimpleRouteOptions): RouteDefinition;
42
+ /**
43
+ * Create a route definition
44
+ */
45
+ export declare function route(method: HttpMethod, path: string, handler: RouteHandlerFn, options?: SimpleRouteOptions): RouteDefinition;
46
+ export declare class RouteBuilder {
47
+ private _route;
48
+ private _options;
49
+ static create(): RouteBuilder;
50
+ path(path: string): this;
51
+ method(method: HttpMethod): this;
52
+ get(path: string): this;
53
+ post(path: string): this;
54
+ put(path: string): this;
55
+ patch(path: string): this;
56
+ delete(path: string): this;
57
+ handler(handler: RouteHandler): RouteDefinition;
58
+ pre(...fns: PreFunction[]): this;
59
+ postFn(...fns: PostFunction[]): this;
60
+ validate(validation: RouteOptions['validation']): this;
61
+ timeout(ms: number): this;
62
+ rateLimit(config: RouteOptions['rateLimit']): this;
63
+ auth(config: RouteOptions['auth']): this;
64
+ cache(config: RouteOptions['cache']): this;
65
+ build(): RouteDefinition;
66
+ }
67
+ export {};
68
+ //# sourceMappingURL=router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.d.ts","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AY,CAAC,GAAG,IAAI;IAKtD,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAKzB,SAAS,CAAC,MAAM,EAAE,YAAY,CAAC,WAAW,CAAC,GAAG,IAAI;IAKlD,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,IAAI;IAKxC,KAAK,CAAC,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG,IAAI;IAM1C,KAAK,IAAI,eAAe;CAYzB"}
@@ -0,0 +1,4 @@
1
+ import { HarborServer, CreateServerOptions } from '../types';
2
+
3
+ export declare function createServer(options?: CreateServerOptions): HarborServer;
4
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/core/server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EAEZ,mBAAmB,EAKpB,MAAM,UAAU,CAAC;AASlB,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,YAAY,CAuI5E"}
@@ -0,0 +1,39 @@
1
+ import { EventEmitter } from 'events';
2
+ import { ConnectionOptions, ConnectionState } from './types';
3
+
4
+ type EventCallback = (...args: unknown[]) => void;
5
+ declare class HarborConnection extends EventEmitter {
6
+ private _state;
7
+ private _options;
8
+ private _connectionUri;
9
+ private _mongoClient;
10
+ private _db;
11
+ private _models;
12
+ get readyState(): number;
13
+ get host(): string | undefined;
14
+ get port(): number | undefined;
15
+ get name(): string | undefined;
16
+ get db(): unknown;
17
+ get client(): unknown;
18
+ get models(): Map<string, unknown>;
19
+ get uri(): string;
20
+ connect(uri: string, options?: ConnectionOptions): Promise<this>;
21
+ disconnect(): Promise<void>;
22
+ close(): Promise<void>;
23
+ ping(): Promise<boolean>;
24
+ collection(name: string): unknown;
25
+ createCollection(name: string, options?: Record<string, unknown>): Promise<unknown>;
26
+ dropCollection(name: string): Promise<boolean>;
27
+ listCollections(): Promise<string[]>;
28
+ dropDatabase(): Promise<boolean>;
29
+ startSession(): Promise<unknown>;
30
+ withTransaction<T>(fn: (session: unknown) => Promise<T>, options?: Record<string, unknown>): Promise<T>;
31
+ on(event: 'connected' | 'disconnected' | 'error' | 'connecting' | 'disconnecting' | 'open' | 'close', listener: EventCallback): this;
32
+ once(event: 'connected' | 'disconnected' | 'error' | 'connecting' | 'disconnecting' | 'open' | 'close', listener: EventCallback): this;
33
+ }
34
+ export declare const connection: HarborConnection;
35
+ export declare function connect(uri: string, options?: ConnectionOptions): Promise<HarborConnection>;
36
+ export declare function disconnect(): Promise<void>;
37
+ export { HarborConnection };
38
+ export type { ConnectionOptions, ConnectionState };
39
+ //# sourceMappingURL=connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/database/connection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAGlE,KAAK,aAAa,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;AAElD,cAAM,gBAAiB,SAAQ,YAAY;IACzC,OAAO,CAAC,MAAM,CAGZ;IACF,OAAO,CAAC,QAAQ,CAAyB;IACzC,OAAO,CAAC,cAAc,CAAc;IACpC,OAAO,CAAC,YAAY,CAAiB;IACrC,OAAO,CAAC,GAAG,CAAiB;IAC5B,OAAO,CAAC,OAAO,CAAmC;IAElD,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,IAAI,IAAI,IAAI,MAAM,GAAG,SAAS,CAE7B;IAED,IAAI,IAAI,IAAI,MAAM,GAAG,SAAS,CAE7B;IAED,IAAI,IAAI,IAAI,MAAM,GAAG,SAAS,CAE7B;IAED,IAAI,EAAE,IAAI,OAAO,CAEhB;IAED,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,IAAI,MAAM,IAAI,GAAG,CAAC,M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GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAEjG;AAGD,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAEhD;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { ObjectId } from 'mongodb';
2
+ import { connect, disconnect } from './connection';
3
+ import { Schema } from './schema';
4
+ import { Model, model } from './model';
5
+ export { Schema } from './schema';
6
+ export { Model, model, Query, HarborDocument } from './model';
7
+ export { connection, connect, disconnect, HarborConnection, } from './connection';
8
+ export type { SchemaType, SchemaFieldDefinition, SchemaDefinition, SchemaOptions, QueryOptions, PopulateOptions, UpdateResult, DeleteResult, IndexDefinition, IndexOptions, AggregateOptions, ConnectionOptions, ConnectionState, Document, BulkWriteOperation, BulkWriteResult, HookType, QueryHookType, } from './types';
9
+ export declare const Types: {
10
+ ObjectId: typeof ObjectId;
11
+ };
12
+ declare const harbor: {
13
+ connection: import('./connection').HarborConnection;
14
+ connect: typeof connect;
15
+ disconnect: typeof disconnect;
16
+ Schema: typeof Schema;
17
+ Model: typeof Model;
18
+ model: typeof model;
19
+ Types: {
20
+ ObjectId: typeof ObjectId;
21
+ };
22
+ readonly models: {
23
+ [k: string]: Model<any>;
24
+ };
25
+ version: string;
26
+ };
27
+ export default harbor;
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/database/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EACL,UAAU,EACV,OAAO,EACP,UAAU,EACV,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,UAAU,EACV,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,QAAQ,EACR,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,eAAO,MAAM,KAAK;;CAEjB,CAAC;AAGF,OAAO,EAAc,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEvC,QAAA,MAAM,MAAM;;;;;;;;;;;;;;CAqBX,CAAC;AAEF,eAAe,MAAM,CAAC"}