@venizia/ignis-docs 0.0.8-0 → 0.0.8-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.
- package/dist/mcp-server/helpers/docs.helper.d.ts.map +1 -1
- package/dist/mcp-server/helpers/docs.helper.js +1 -1
- package/dist/mcp-server/helpers/docs.helper.js.map +1 -1
- package/dist/mcp-server/tools/base.tool.d.ts +1 -1
- package/dist/mcp-server/tools/docs/search-documents.tool.d.ts +1 -1
- package/dist/mcp-server/tools/docs/search-documents.tool.js +1 -1
- package/dist/mcp-server/tools/docs/search-documents.tool.js.map +1 -1
- package/dist/mcp-server/tools/github/list-project-files.tool.d.ts +1 -1
- package/dist/mcp-server/tools/github/list-project-files.tool.js +1 -1
- package/dist/mcp-server/tools/github/list-project-files.tool.js.map +1 -1
- package/dist/mcp-server/tools/github/search-code.tool.d.ts +1 -1
- package/dist/mcp-server/tools/github/search-code.tool.js +1 -1
- package/dist/mcp-server/tools/github/search-code.tool.js.map +1 -1
- package/package.json +9 -9
- package/wiki/extensions/helpers/kafka/consumer.md +6 -5
- package/wiki/extensions/helpers/kafka/examples.md +1 -1
- package/wiki/extensions/helpers/kafka/index.md +16 -12
- package/wiki/extensions/helpers/kafka/producer.md +4 -3
- package/wiki/guides/core-concepts/persistent/datasources.md +10 -11
- package/wiki/guides/core-concepts/persistent/index.md +6 -6
- package/wiki/guides/core-concepts/persistent/models.md +7 -5
- package/wiki/guides/core-concepts/persistent/repositories.md +11 -3
- package/wiki/guides/core-concepts/persistent/transactions.md +2 -1
- package/wiki/guides/core-concepts/rest-controllers.md +2 -2
- package/wiki/guides/core-concepts/services.md +0 -1
- package/wiki/guides/get-started/5-minute-quickstart.md +11 -10
- package/wiki/guides/tutorials/building-a-crud-api.md +43 -37
- package/wiki/guides/tutorials/complete-installation.md +64 -44
- package/wiki/guides/tutorials/ecommerce-api.md +21 -12
- package/wiki/guides/tutorials/realtime-chat.md +4 -5
- package/wiki/references/base/repositories/advanced.md +111 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.helper.d.ts","sourceRoot":"","sources":["../../../mcp-server/helpers/docs.helper.ts"],"names":[],"mappings":"AAQA,UAAU,IAAI;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAc;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAA2B;WAElC,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"docs.helper.d.ts","sourceRoot":"","sources":["../../../mcp-server/helpers/docs.helper.ts"],"names":[],"mappings":"AAQA,UAAU,IAAI;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAc;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAA2B;WAElC,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAkDpC,MAAM,CAAC,UAAU,IAAI,IAAI;IAMzB,OAAO,CAAC,MAAM,CAAC,eAAe;WAYjB,eAAe,CAAC,IAAI,EAAE,cAAc;;;;;;;WAqBpC,kBAAkB,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;WAYhE,iBAAiB,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;WAgB7C,cAAc,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;WASnC,mBAAmB,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;CAiCtD"}
|
|
@@ -50,7 +50,7 @@ class DocsHelper {
|
|
|
50
50
|
}
|
|
51
51
|
catch (error) {
|
|
52
52
|
logger_helper_1.Logger.error('Failed to load documentation:', error);
|
|
53
|
-
throw new Error(`Documentation loading failed: ${error instanceof Error ? error.message : 'Unknown error'}
|
|
53
|
+
throw new Error(`Documentation loading failed: ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error });
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
static clearCache() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.helper.js","sourceRoot":"","sources":["../../../mcp-server/helpers/docs.helper.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA2B;AAC3B,sDAA2B;AAC3B,8DAAiC;AACjC,gEAAkC;AAClC,0DAA6B;AAC7B,sCAA8C;AAC9C,mDAAyC;AAezC,MAAa,UAAU;aACN,UAAK,GAAW,EAAE,CAAC;aACnB,UAAK,GAAsB,IAAI,CAAC;IAE/C,MAAM,CAAC,KAAK,CAAC,IAAI;QACf,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;QAED,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,MAAM,IAAA,mBAAE,EAAC,SAAS,EAAE;gBAChC,GAAG,EAAE,cAAK,CAAC,IAAI;gBACf,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC;aAC1C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gBACzB,IAAI,EAAE,KAAK,CAAC,IAAI;aACjB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,sBAAM,CAAC,KAAK,CAAC,8BAA8B,IAAI,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;YAC9D,OAAO;gBACL,EAAE,EAAE,GAAG,CAAC,EAAE;gBACV,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM;gBAC1D,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM;aAC9B,CAAC;QACJ,CAAC;IACH,CAAC;;AAlKH,gCAmKC"}
|
|
@@ -8,6 +8,6 @@ export declare abstract class BaseTool<TInputSchema extends z.ZodType, TOutputSc
|
|
|
8
8
|
abstract readonly outputSchema: TOutputSchema;
|
|
9
9
|
abstract execute(opts: z.infer<TInputSchema>): Promise<z.infer<TOutputSchema>>;
|
|
10
10
|
/** Converts this tool instance to a Mastra-compatible tool object. */
|
|
11
|
-
abstract getTool(): Tool<z.
|
|
11
|
+
abstract getTool(): Tool<z.input<TInputSchema>, z.infer<TOutputSchema>>;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=base.tool.d.ts.map
|
|
@@ -32,7 +32,7 @@ export declare class SearchDocsTool extends BaseTool<typeof InputSchema, typeof
|
|
|
32
32
|
execute(opts: z.infer<typeof InputSchema>): Promise<z.infer<typeof OutputSchema>>;
|
|
33
33
|
getTool(): import("@mastra/core/tools", { with: { "resolution-mode": "import" } }).Tool<{
|
|
34
34
|
query: string;
|
|
35
|
-
limit
|
|
35
|
+
limit?: number | undefined;
|
|
36
36
|
}, {
|
|
37
37
|
results: {
|
|
38
38
|
id: string;
|
|
@@ -107,7 +107,7 @@ class SearchDocsTool extends base_tool_1.BaseTool {
|
|
|
107
107
|
description: this.description,
|
|
108
108
|
inputSchema: this.inputSchema,
|
|
109
109
|
outputSchema: this.outputSchema,
|
|
110
|
-
execute: async (input) => this.execute(input),
|
|
110
|
+
execute: async (input) => this.execute(InputSchema.parse(input)),
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-documents.tool.js","sourceRoot":"","sources":["../../../../mcp-server/tools/docs/search-documents.tool.ts"],"names":[],"mappings":";;;AAAA,8CAAgD;AAChD,6BAAwB;AACxB,4CAAwC;AACxC,gDAAiD;AACjD,kDAAkD;AAElD,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BxB,CAAC;AAEF,MAAM,iBAAiB,GAAG;;;;YAId,mBAAU,CAAC,MAAM,CAAC,cAAc;;;;;;;;;CAS3C,CAAC;AAEF,MAAM,iBAAiB,GAAG;;;;;aAKb,mBAAU,CAAC,MAAM,CAAC,QAAQ;aAC1B,mBAAU,CAAC,MAAM,CAAC,YAAY;;;;;;CAM1C,CAAC;AAEF,MAAM,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,EAAE,EAAE,OAAC;SACF,MAAM,EAAE;SACR,QAAQ,CACP,oGAAoG,CACrG;IACH,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6DAA6D,CAAC;IACzF,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4DAA4D,CAAC;IAC3F,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uDAAuD,CAAC;IACrF,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;CACrF,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3B,KAAK,EAAE,OAAC,CAAC,MAA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AO,CAAC,mBAAU,CAAC,MAAM,CAAC,YAAY,CAAC;SACvC,QAAQ,CAAC,iBAAiB,CAAC;CAC/B,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5B,OAAO,EAAE,OAAC;SACP,KAAK,CAAC,kBAAkB,CAAC;SACzB,QAAQ,CAAC,gEAAgE,CAAC;CAC9E,CAAC,CAAC;AAEH,MAAa,cAAe,SAAQ,oBAAiD;IAArF;;QACW,OAAE,GAAG,iBAAiB,CAAC;QACvB,gBAAW,GAAG,gBAAgB,CAAC;QAC/B,gBAAW,GAAG,WAAW,CAAC;QAC1B,iBAAY,GAAG,YAAY,CAAC;IAmBvC,CAAC;IAjBC,KAAK,CAAC,OAAO,CAAC,IAAiC;QAC7C,MAAM,OAAO,GAAG,MAAM,oBAAU,CAAC,eAAe,CAAC;YAC/C,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC,CAAC;QACH,OAAO,EAAE,OAAO,EAAE,CAAC;IACrB,CAAC;IAED,OAAO;QACL,OAAO,IAAA,kBAAU,EAAC;YAChB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,OAAO,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC/D,CAAC,CAAC;IACL,CAAC;CACF;AAvBD,wCAuBC"}
|
|
@@ -23,7 +23,7 @@ export declare class ListProjectFilesTool extends BaseTool<typeof InputSchema, t
|
|
|
23
23
|
}, z.core.$strip>;
|
|
24
24
|
execute(opts: z.infer<typeof InputSchema>): Promise<z.infer<typeof OutputSchema>>;
|
|
25
25
|
getTool(): import("@mastra/core/tools", { with: { "resolution-mode": "import" } }).Tool<{
|
|
26
|
-
directoryPath
|
|
26
|
+
directoryPath?: string | undefined;
|
|
27
27
|
}, {
|
|
28
28
|
directoryPath: string;
|
|
29
29
|
files: string[];
|
|
@@ -81,7 +81,7 @@ class ListProjectFilesTool extends base_tool_1.BaseTool {
|
|
|
81
81
|
description: this.description,
|
|
82
82
|
inputSchema: this.inputSchema,
|
|
83
83
|
outputSchema: this.outputSchema,
|
|
84
|
-
execute: async (input) => this.execute(input),
|
|
84
|
+
execute: async (input) => this.execute(InputSchema.parse(input)),
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-project-files.tool.js","sourceRoot":"","sources":["../../../../mcp-server/tools/github/list-project-files.tool.ts"],"names":[],"mappings":";;;AAAA,8CAAgD;AAChD,6BAAwB;AACxB,4CAAwC;AACxC,kDAAoD;AAEpD,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBxB,CAAC;AAEF,MAAM,0BAA0B,GAAG;;;;;;;;CAQlC,CAAC;AAEF,MAAM,WAAW,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3B,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,0BAA0B,CAAC;CAC5E,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5B,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE;IACzB,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,sDAAsD,CAAC;IAC3F,WAAW,EAAE,OAAC;SACX,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,CAAC,8DAA8D,CAAC;IAC3E,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,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AAC,oBAAoB,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QAEvF,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;YACxB,OAAO;gBACL,aAAa,EAAE,IAAI,CAAC,aAAa;gBACjC,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,EAAE;gBACf,KAAK,EAAE,QAAQ,CAAC,KAAK;aACtB,CAAC;QACJ,CAAC;QAED,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEnF,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAExF,OAAO;YACL,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,KAAK;YACL,WAAW;SACZ,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,IAAA,kBAAU,EAAC;YAChB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,OAAO,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC/D,CAAC,CAAC;IACL,CAAC;CACF;AAtCD,oDAsCC"}
|
|
@@ -38,7 +38,7 @@ export declare class SearchCodeTool extends BaseTool<typeof InputSchema, typeof
|
|
|
38
38
|
execute(opts: z.infer<typeof InputSchema>): Promise<z.infer<typeof OutputSchema>>;
|
|
39
39
|
getTool(): import("@mastra/core/tools", { with: { "resolution-mode": "import" } }).Tool<{
|
|
40
40
|
query: string;
|
|
41
|
-
limit
|
|
41
|
+
limit?: number | undefined;
|
|
42
42
|
}, {
|
|
43
43
|
query: string;
|
|
44
44
|
totalCount: number;
|
|
@@ -174,7 +174,7 @@ class SearchCodeTool extends base_tool_1.BaseTool {
|
|
|
174
174
|
description: this.description,
|
|
175
175
|
inputSchema: this.inputSchema,
|
|
176
176
|
outputSchema: this.outputSchema,
|
|
177
|
-
execute: async (input) => this.execute(input),
|
|
177
|
+
execute: async (input) => this.execute(InputSchema.parse(input)),
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-code.tool.js","sourceRoot":"","sources":["../../../../mcp-server/tools/github/search-code.tool.ts"],"names":[],"mappings":";;;AAAA,gDAAiD;AACjD,8CAAgD;AAChD,6BAAwB;AACxB,4CAAwC;AACxC,kDAA8C;AAE9C,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BxB,CAAC;AAEF,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBzB,CAAC;AAEF,MAAM,iBAAiB,GAAG;yCACe,mBAAU,CAAC,UAAU,CAAC,QAAQ,cAAc,mBAAU,CAAC,UAAU,CAAC,YAAY;;;;;QAK/G,mBAAU,CAAC,UAAU,CAAC,QAAQ;CACrC,CAAC;AAEF,MAAM,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+DAA+D,CAAC;IAC9F,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;IAC/D,YAAY,EAAE,OAAC;SACZ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,wDAAwD,CAAC;IACrE,GAAG,EAAE,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;IACL,CAAC;CACF;AA7FD,wCA6FC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/ignis-docs",
|
|
3
|
-
"version": "0.0.8-
|
|
3
|
+
"version": "0.0.8-1",
|
|
4
4
|
"description": "Interactive documentation site and MCP (Model Context Protocol) server for the Ignis Framework. Includes a VitePress-powered documentation site with guides, API references, and best practices. Ships an MCP server (CLI: ignis-docs-mcp) with 11 tools for AI assistants to search docs, browse source code, verify dependencies, and access real-time framework knowledge. Built with Mastra MCP SDK and Fuse.js fuzzy search.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -115,11 +115,11 @@
|
|
|
115
115
|
"prepublishOnly": "bun run mcp:rebuild"
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
|
-
"@mastra/core": "^1.
|
|
119
|
-
"@mastra/mcp": "^1.
|
|
118
|
+
"@mastra/core": "^1.18.0",
|
|
119
|
+
"@mastra/mcp": "^1.3.2",
|
|
120
120
|
"cytoscape": "^3.33.1",
|
|
121
121
|
"cytoscape-cose-bilkent": "^4.1.0",
|
|
122
|
-
"dayjs": "^1.11.
|
|
122
|
+
"dayjs": "^1.11.20",
|
|
123
123
|
"debug": "^4.4.3",
|
|
124
124
|
"fast-glob": "^3.3.3",
|
|
125
125
|
"fuse.js": "^7.1.0",
|
|
@@ -128,15 +128,15 @@
|
|
|
128
128
|
},
|
|
129
129
|
"devDependencies": {
|
|
130
130
|
"@braintree/sanitize-url": "^7.1.2",
|
|
131
|
-
"@types/bun": "^1.3.
|
|
132
|
-
"@venizia/dev-configs": "^0.0.
|
|
133
|
-
"eslint": "^
|
|
131
|
+
"@types/bun": "^1.3.11",
|
|
132
|
+
"@venizia/dev-configs": "^0.0.7-1",
|
|
133
|
+
"eslint": "^10.1.0",
|
|
134
134
|
"prettier": "^3.8.1",
|
|
135
135
|
"tsc-alias": "^1.8.16",
|
|
136
136
|
"tsx": "^4.20.6",
|
|
137
|
-
"typescript": "^
|
|
137
|
+
"typescript": "^6.0.2",
|
|
138
138
|
"vitepress": "^1.6.4",
|
|
139
139
|
"vitepress-plugin-mermaid": "^2.0.17",
|
|
140
|
-
"vue": "^3.5.
|
|
140
|
+
"vue": "^3.5.31"
|
|
141
141
|
}
|
|
142
142
|
}
|
|
@@ -21,9 +21,10 @@ class KafkaConsumerHelper<
|
|
|
21
21
|
| `start(opts)` | `(opts: IKafkaConsumeStartOptions): Promise<void>` | Start consuming (creates stream, wires callbacks) |
|
|
22
22
|
| `startLagMonitoring(opts)` | `(opts: { topics: string[]; interval?: number }): void` | Start periodic lag monitoring |
|
|
23
23
|
| `stopLagMonitoring()` | `(): void` | Stop lag monitoring |
|
|
24
|
-
| `isHealthy()` | `(): boolean` | `true` when broker connected |
|
|
24
|
+
| `isHealthy()` | `(): boolean` | `true` when at least one broker connected |
|
|
25
25
|
| `isReady()` | `(): boolean` | `isHealthy()` **and** `consumer.isActive()` |
|
|
26
26
|
| `getHealthStatus()` | `(): TKafkaHealthStatus` | `'connected'` \| `'disconnected'` \| `'unknown'` |
|
|
27
|
+
| `getConnectedBrokerCount()` | `(): number` | Number of currently connected brokers |
|
|
27
28
|
| `close(opts?)` | `(opts?: { isForce?: boolean }): Promise<void>` | Stop lag, close stream, close consumer |
|
|
28
29
|
|
|
29
30
|
## IKafkaConsumerOptions
|
|
@@ -41,8 +42,8 @@ interface IKafkaConsumerOptions<KeyType, ValueType, HeaderKeyType, HeaderValueTy
|
|
|
41
42
|
| `identifier` | `string` | `'kafka-consumer'` | Scoped logging identifier |
|
|
42
43
|
| `deserializers` | `Partial<Deserializers<K,V,HK,HV>>` | -- | Key/value/header deserializers |
|
|
43
44
|
| `autocommit` | `boolean \| number` | `false` | Auto-commit offsets. `true` = default interval, `number` = custom ms |
|
|
44
|
-
| `sessionTimeout` | `number` | `
|
|
45
|
-
| `heartbeatInterval` | `number` | `
|
|
45
|
+
| `sessionTimeout` | `number` | `60000` | Session timeout -- consumer removed from group if no heartbeat |
|
|
46
|
+
| `heartbeatInterval` | `number` | `10000` | Heartbeat interval -- must be less than `sessionTimeout` |
|
|
46
47
|
| `rebalanceTimeout` | `number` | `sessionTimeout` | Max time for rebalance. Defaults to the value of `sessionTimeout` |
|
|
47
48
|
| `highWaterMark` | `number` | `1024` | Stream buffer size (messages) |
|
|
48
49
|
| `minBytes` | `number` | `1` | Min bytes per fetch response |
|
|
@@ -141,8 +142,8 @@ await helper.start({ topics: ['orders'] });
|
|
|
141
142
|
helper.startLagMonitoring({ topics: ['orders'], interval: 10_000 });
|
|
142
143
|
|
|
143
144
|
// Health check
|
|
144
|
-
helper.isHealthy(); // true when broker connected
|
|
145
|
-
helper.isReady(); // true when broker connected AND consumer is active
|
|
145
|
+
helper.isHealthy(); // true when at least one broker connected
|
|
146
|
+
helper.isReady(); // true when at least one broker connected AND consumer is active
|
|
146
147
|
|
|
147
148
|
// Shutdown
|
|
148
149
|
await helper.close();
|
|
@@ -318,7 +318,7 @@ export class OrderEventService {
|
|
|
318
318
|
| `Failed to deserialize a message` | Mismatch between serializer and deserializer | Ensure matching serde. For old data, use a new consumer group or recreate topic |
|
|
319
319
|
| `JSON.stringify cannot serialize BigInt` | `message.offset` and `message.timestamp` are `bigint` | Use custom replacer: `(_k, v) => typeof v === 'bigint' ? v.toString() : v` |
|
|
320
320
|
| Consumer idle (no messages) | More consumers than partitions | Ensure `numPartitions >= numConsumers` |
|
|
321
|
-
| `isHealthy()` returns `false` |
|
|
321
|
+
| `isHealthy()` returns `false` | All brokers disconnected (a single idle disconnect won't trigger this) | Check broker addresses, SASL config, network connectivity. Use `getConnectedBrokerCount()` for details |
|
|
322
322
|
| `isReady()` returns `false` (consumer) | Consumer not active -- `start()` not called or stream closed | Call `await helper.start({ topics })` before checking readiness |
|
|
323
323
|
| Graceful shutdown timeout | In-flight requests taking too long | Increase `shutdownTimeout` or use `close({ isForce: true })` |
|
|
324
324
|
|
|
@@ -16,9 +16,9 @@ The Kafka module provides four helper classes built on a shared `BaseKafkaHelper
|
|
|
16
16
|
All helpers (except schema registry) extend `BaseKafkaHelper` which provides:
|
|
17
17
|
|
|
18
18
|
- **Scoped logging** via `BaseHelper` (Winston with daily rotation)
|
|
19
|
-
- **Health tracking** -- `isHealthy()`, `isReady()`, `getHealthStatus()`
|
|
19
|
+
- **Health tracking** -- per-broker connection tracking via `isHealthy()`, `isReady()`, `getHealthStatus()`, `getConnectedBrokerCount()`
|
|
20
20
|
- **Broker event callbacks** -- `onBrokerConnect`, `onBrokerDisconnect`
|
|
21
|
-
- **Broker failure tracking** -- automatic `configureBrokerFailed()` sets status to `'disconnected'`
|
|
21
|
+
- **Broker failure tracking** -- automatic `configureBrokerFailed()` sets status to `'disconnected'` only when all brokers are gone
|
|
22
22
|
- **Graceful shutdown** -- timeout-based with force fallback
|
|
23
23
|
- **Sensible defaults** via `KafkaDefaults` constants
|
|
24
24
|
- **Factory pattern** via `newInstance()` static method
|
|
@@ -115,21 +115,25 @@ All Kafka helpers (except schema registry) extend `BaseKafkaHelper<TClient>`, wh
|
|
|
115
115
|
```typescript
|
|
116
116
|
abstract class BaseKafkaHelper<TClient extends Base<BaseOptions>> extends BaseHelper {
|
|
117
117
|
// Health
|
|
118
|
-
isHealthy(): boolean;
|
|
119
|
-
isReady(): boolean;
|
|
120
|
-
getHealthStatus(): TKafkaHealthStatus;
|
|
118
|
+
isHealthy(): boolean; // true when at least one broker is connected
|
|
119
|
+
isReady(): boolean; // healthStatus === 'connected' (consumer overrides: + isActive())
|
|
120
|
+
getHealthStatus(): TKafkaHealthStatus; // 'connected' | 'disconnected' | 'unknown'
|
|
121
|
+
getConnectedBrokerCount(): number; // number of currently connected brokers
|
|
121
122
|
|
|
122
123
|
// Shutdown (used by subclasses)
|
|
123
124
|
protected closeClient(): Promise<void>;
|
|
124
125
|
protected gracefulCloseClient(): Promise<void>; // races closeClient vs shutdownTimeout
|
|
126
|
+
protected resetHealthState(): void; // clears broker tracking + sets 'disconnected'
|
|
125
127
|
}
|
|
126
128
|
```
|
|
127
129
|
|
|
130
|
+
Health tracking uses a **per-broker connection set** (`host:port` keys). A single idle broker disconnect does not make the client unhealthy -- only when **all** brokers are disconnected does `isHealthy()` return `false`.
|
|
131
|
+
|
|
128
132
|
Health status transitions automatically via broker events:
|
|
129
|
-
- `client:broker:connect` -> `'connected'`
|
|
130
|
-
- `client:broker:disconnect` -> `'disconnected'`
|
|
131
|
-
- `client:broker:failed` -> `'disconnected'`
|
|
132
|
-
- `close()` -> `'disconnected'`
|
|
133
|
+
- `client:broker:connect` -> adds broker, sets `healthStatus` to `'connected'`
|
|
134
|
+
- `client:broker:disconnect` -> removes broker, sets `healthStatus` to `'disconnected'` only when all brokers are gone
|
|
135
|
+
- `client:broker:failed` -> removes broker, sets `healthStatus` to `'disconnected'` only when all brokers are gone
|
|
136
|
+
- `close()` -> clears all brokers, sets `healthStatus` to `'disconnected'`
|
|
133
137
|
|
|
134
138
|
## Connection Options
|
|
135
139
|
|
|
@@ -400,8 +404,8 @@ import { KafkaDefaults } from '@venizia/ignis-helpers/kafka';
|
|
|
400
404
|
| `STRICT` | `true` | Producer | Fail on unknown topics |
|
|
401
405
|
| `AUTOCREATE_TOPICS` | `false` | Producer | Auto-create topics on produce |
|
|
402
406
|
| `AUTOCOMMIT` | `false` | Consumer | Auto-commit offsets |
|
|
403
|
-
| `SESSION_TIMEOUT` | `
|
|
404
|
-
| `HEARTBEAT_INTERVAL` | `
|
|
407
|
+
| `SESSION_TIMEOUT` | `60000` | Consumer | Session timeout in ms |
|
|
408
|
+
| `HEARTBEAT_INTERVAL` | `10000` | Consumer | Heartbeat interval in ms |
|
|
405
409
|
| `HIGH_WATER_MARK` | `1024` | Consumer | Stream buffer size (messages) |
|
|
406
410
|
| `MIN_BYTES` | `1` | Consumer | Min bytes per fetch |
|
|
407
411
|
| `METADATA_MAX_AGE` | `300000` | Consumer | Metadata cache TTL in ms |
|
|
@@ -570,7 +574,7 @@ const consumer = KafkaConsumerHelper.newInstance({
|
|
|
570
574
|
|
|
571
575
|
```typescript
|
|
572
576
|
// All three -- identical API
|
|
573
|
-
helper.isHealthy(); // true when broker connected
|
|
577
|
+
helper.isHealthy(); // true when at least one broker connected
|
|
574
578
|
helper.isReady(); // Admin/Producer: same as isHealthy()
|
|
575
579
|
// Consumer: isHealthy() + consumer.isActive()
|
|
576
580
|
helper.getHealthStatus(); // 'connected' | 'disconnected' | 'unknown'
|
|
@@ -18,9 +18,10 @@ class KafkaProducerHelper<
|
|
|
18
18
|
| `newInstance(opts)` | `static newInstance<K,V,HK,HV>(opts): KafkaProducerHelper<K,V,HK,HV>` | Factory method |
|
|
19
19
|
| `getProducer()` | `(): Producer<K,V,HK,HV>` | Access the underlying `Producer` |
|
|
20
20
|
| `runInTransaction(cb)` | `<R>(cb: TKafkaTransactionCallback<R,K,V,HK,HV>): Promise<R>` | Execute callback within a Kafka transaction |
|
|
21
|
-
| `isHealthy()` | `(): boolean` | `true` when broker connected |
|
|
21
|
+
| `isHealthy()` | `(): boolean` | `true` when at least one broker connected |
|
|
22
22
|
| `isReady()` | `(): boolean` | Same as `isHealthy()` |
|
|
23
23
|
| `getHealthStatus()` | `(): TKafkaHealthStatus` | `'connected'` \| `'disconnected'` \| `'unknown'` |
|
|
24
|
+
| `getConnectedBrokerCount()` | `(): number` | Number of currently connected brokers |
|
|
24
25
|
| `close(opts?)` | `(opts?: { isForce?: boolean }): Promise<void>` | Close the producer (default: graceful) |
|
|
25
26
|
|
|
26
27
|
## IKafkaProducerOptions
|
|
@@ -64,7 +65,7 @@ const helper = KafkaProducerHelper.newInstance({
|
|
|
64
65
|
});
|
|
65
66
|
|
|
66
67
|
// Health check
|
|
67
|
-
helper.isHealthy(); // true when connected
|
|
68
|
+
helper.isHealthy(); // true when at least one broker connected
|
|
68
69
|
helper.getHealthStatus(); // 'connected' | 'disconnected' | 'unknown'
|
|
69
70
|
|
|
70
71
|
// Send messages via the underlying producer
|
|
@@ -153,7 +154,7 @@ If the callback throws, the transaction is automatically aborted and the error r
|
|
|
153
154
|
2. **Force fallback**: If graceful times out, automatically force-closes
|
|
154
155
|
3. **Force** (`{ isForce: true }`): Immediately calls `close(true)` without timeout protection
|
|
155
156
|
|
|
156
|
-
After `close()`, `healthStatus` is set to `'disconnected'`.
|
|
157
|
+
After `close()`, all broker tracking is cleared and `healthStatus` is set to `'disconnected'`.
|
|
157
158
|
|
|
158
159
|
```typescript
|
|
159
160
|
// Graceful (recommended)
|
|
@@ -12,7 +12,6 @@ A DataSource manages database connections and supports **schema auto-discovery**
|
|
|
12
12
|
import {
|
|
13
13
|
BaseDataSource,
|
|
14
14
|
datasource,
|
|
15
|
-
TNodePostgresConnector,
|
|
16
15
|
ValueOrPromise,
|
|
17
16
|
} from '@venizia/ignis';
|
|
18
17
|
import { drizzle } from 'drizzle-orm/node-postgres';
|
|
@@ -32,11 +31,11 @@ export class PostgresDataSource extends BaseDataSource<IDSConfigs> {
|
|
|
32
31
|
super({
|
|
33
32
|
name: PostgresDataSource.name,
|
|
34
33
|
config: {
|
|
35
|
-
host: process.env.
|
|
36
|
-
port: +(process.env.
|
|
37
|
-
database: process.env.
|
|
38
|
-
user: process.env.
|
|
39
|
-
password: process.env.
|
|
34
|
+
host: process.env.APP_ENV_POSTGRES_HOST ?? 'localhost',
|
|
35
|
+
port: +(process.env.APP_ENV_POSTGRES_PORT ?? 5432),
|
|
36
|
+
database: process.env.APP_ENV_POSTGRES_DATABASE ?? 'mydb',
|
|
37
|
+
user: process.env.APP_ENV_POSTGRES_USERNAME ?? 'postgres',
|
|
38
|
+
password: process.env.APP_ENV_POSTGRES_PASSWORD ?? '',
|
|
40
39
|
},
|
|
41
40
|
// No schema needed - auto-discovered from @repository bindings!
|
|
42
41
|
});
|
|
@@ -148,11 +147,11 @@ export class PostgresDataSource extends BaseDataSource<IDSConfigs> {
|
|
|
148
147
|
super({
|
|
149
148
|
name: PostgresDataSource.name,
|
|
150
149
|
config: {
|
|
151
|
-
host: process.env.
|
|
152
|
-
port: +(process.env.
|
|
153
|
-
database: process.env.
|
|
154
|
-
user: process.env.
|
|
155
|
-
password: process.env.
|
|
150
|
+
host: process.env.APP_ENV_POSTGRES_HOST ?? 'localhost',
|
|
151
|
+
port: +(process.env.APP_ENV_POSTGRES_PORT ?? 5432),
|
|
152
|
+
database: process.env.APP_ENV_POSTGRES_DATABASE ?? 'mydb',
|
|
153
|
+
user: process.env.APP_ENV_POSTGRES_USERNAME ?? 'postgres',
|
|
154
|
+
password: process.env.APP_ENV_POSTGRES_PASSWORD ?? '',
|
|
156
155
|
},
|
|
157
156
|
});
|
|
158
157
|
}
|
|
@@ -46,16 +46,16 @@ export class User extends BaseEntity<typeof User.schema> {
|
|
|
46
46
|
|
|
47
47
|
// 2. Create a DataSource
|
|
48
48
|
@datasource({ driver: 'node-postgres' })
|
|
49
|
-
export class PostgresDataSource extends BaseDataSource<
|
|
49
|
+
export class PostgresDataSource extends BaseDataSource<IDSConfigs> {
|
|
50
50
|
constructor() {
|
|
51
51
|
super({
|
|
52
52
|
name: PostgresDataSource.name,
|
|
53
53
|
config: {
|
|
54
|
-
host: process.env.
|
|
55
|
-
port: +(process.env.
|
|
56
|
-
database: process.env.
|
|
57
|
-
user: process.env.
|
|
58
|
-
password: process.env.
|
|
54
|
+
host: process.env.APP_ENV_POSTGRES_HOST ?? 'localhost',
|
|
55
|
+
port: +(process.env.APP_ENV_POSTGRES_PORT ?? 5432),
|
|
56
|
+
database: process.env.APP_ENV_POSTGRES_DATABASE ?? 'mydb',
|
|
57
|
+
user: process.env.APP_ENV_POSTGRES_USERNAME ?? 'postgres',
|
|
58
|
+
password: process.env.APP_ENV_POSTGRES_PASSWORD ?? '',
|
|
59
59
|
},
|
|
60
60
|
});
|
|
61
61
|
}
|
|
@@ -6,15 +6,17 @@ Models define your data structure using Drizzle ORM schemas. A model is a single
|
|
|
6
6
|
|
|
7
7
|
```typescript
|
|
8
8
|
// src/models/entities/user.model.ts
|
|
9
|
-
import { BaseEntity,
|
|
10
|
-
import { pgTable } from 'drizzle-orm/pg-core';
|
|
9
|
+
import { BaseEntity, generateIdColumnDefs, generateTzColumnDefs, model } from '@venizia/ignis';
|
|
10
|
+
import { pgTable, text } from 'drizzle-orm/pg-core';
|
|
11
11
|
|
|
12
12
|
@model({ type: 'entity' })
|
|
13
13
|
export class User extends BaseEntity<typeof User.schema> {
|
|
14
14
|
// Define schema as static property
|
|
15
15
|
static override schema = pgTable('User', {
|
|
16
16
|
...generateIdColumnDefs({ id: { dataType: 'string' } }),
|
|
17
|
-
...
|
|
17
|
+
...generateTzColumnDefs(),
|
|
18
|
+
name: text('name').notNull(),
|
|
19
|
+
email: text('email').notNull(),
|
|
18
20
|
});
|
|
19
21
|
|
|
20
22
|
// Relations (empty array if none)
|
|
@@ -126,7 +128,8 @@ static override schema = pgTable('User', {
|
|
|
126
128
|
```typescript
|
|
127
129
|
static override schema = pgTable('User', {
|
|
128
130
|
...generateIdColumnDefs({ id: { dataType: 'string' } }), // id (text with UUID default)
|
|
129
|
-
...
|
|
131
|
+
...generateTzColumnDefs(), // createdAt, modifiedAt
|
|
132
|
+
...generateUserAuditColumnDefs(), // createdBy, modifiedBy
|
|
130
133
|
// ... your fields
|
|
131
134
|
});
|
|
132
135
|
```
|
|
@@ -139,7 +142,6 @@ static override schema = pgTable('User', {
|
|
|
139
142
|
| `generateTzColumnDefs()` | `createdAt`, `modifiedAt` | Track timestamps |
|
|
140
143
|
| `generateUserAuditColumnDefs()` | `createdBy`, `modifiedBy` | Track who created/updated |
|
|
141
144
|
| `generateDataTypeColumnDefs()` | `dataType`, `tValue`, `nValue`, etc. | Configuration tables |
|
|
142
|
-
| `extraUserColumns()` | Combines audit + status + type | Full-featured entities |
|
|
143
145
|
|
|
144
146
|
:::note User Audit Options
|
|
145
147
|
The `generateUserAuditColumnDefs` enricher supports an `allowAnonymous` option (default: `true`). Set to `false` to require authenticated user context and throw errors for anonymous operations:
|
|
@@ -159,10 +159,18 @@ All repository operations accept an `options` parameter with these fields:
|
|
|
159
159
|
| `shouldSkipDefaultFilter` | `boolean` | Bypass the model's default filter (e.g., soft delete) |
|
|
160
160
|
|
|
161
161
|
```typescript
|
|
162
|
-
// Create without returning data (faster
|
|
162
|
+
// Create without returning data (faster)
|
|
163
163
|
await repo.create({
|
|
164
|
-
data:
|
|
165
|
-
options: { shouldReturn: false }
|
|
164
|
+
data: { code: 'SETTING', group: 'SYSTEM' },
|
|
165
|
+
options: { shouldReturn: false },
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
// Bulk create multiple records
|
|
169
|
+
await repo.createAll({
|
|
170
|
+
data: [
|
|
171
|
+
{ code: 'SETTING_A', group: 'SYSTEM' },
|
|
172
|
+
{ code: 'SETTING_B', group: 'SYSTEM' },
|
|
173
|
+
],
|
|
166
174
|
});
|
|
167
175
|
|
|
168
176
|
// Query with pagination range
|
|
@@ -62,7 +62,8 @@ Ignis supports standard PostgreSQL isolation levels:
|
|
|
62
62
|
| `REPEATABLE READ` | Queries see a snapshot as of the start of the transaction. | Reports, consistent reads across multiple queries. |
|
|
63
63
|
| `SERIALIZABLE` | Strictest level. Emulates serial execution. | Financial transactions, critical data integrity. |
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
> [!NOTE]
|
|
66
|
+
> Ignis only supports these three levels. `READ UNCOMMITTED` is **not** accepted — PostgreSQL treats it as `READ COMMITTED` anyway, so Ignis omits it to avoid confusion.
|
|
66
67
|
|
|
67
68
|
## Best Practices
|
|
68
69
|
|
|
@@ -218,7 +218,7 @@ this.bindRoute({
|
|
|
218
218
|
For standard CRUD (Create, Read, Update, Delete) operations, `Ignis` provides a `ControllerFactory` that can generate a full-featured controller for any given entity. This significantly reduces boilerplate code.
|
|
219
219
|
|
|
220
220
|
```typescript
|
|
221
|
-
// src/controllers/configuration.controller.ts (Example from @examples/vert)
|
|
221
|
+
// src/controllers/configuration/configuration.controller.ts (Example from @examples/vert)
|
|
222
222
|
import { Configuration } from '@/models';
|
|
223
223
|
import { ConfigurationRepository } from '@/repositories';
|
|
224
224
|
import {
|
|
@@ -236,7 +236,7 @@ const _Controller = ControllerFactory.defineCrudController({
|
|
|
236
236
|
controller: {
|
|
237
237
|
name: 'ConfigurationController',
|
|
238
238
|
basePath: BASE_PATH,
|
|
239
|
-
isStrict: true,
|
|
239
|
+
isStrict: { path: true, requestSchema: true },
|
|
240
240
|
},
|
|
241
241
|
entity: () => Configuration, // Provide a resolver for your entity class
|
|
242
242
|
});
|
|
@@ -19,7 +19,6 @@ To create a service, extend the `BaseService` class and inject the repositories
|
|
|
19
19
|
|
|
20
20
|
```typescript
|
|
21
21
|
import { BaseService, inject } from '@venizia/ignis';
|
|
22
|
-
import { getError } from '@venizia/ignis-helpers';
|
|
23
22
|
import { ConfigurationRepository } from '../repositories';
|
|
24
23
|
import { UserRepository } from '../repositories';
|
|
25
24
|
import { LoggingService } from './logging.service'; // Example of another service
|
|
@@ -11,8 +11,8 @@ Build your first Ignis API endpoint in 5 minutes. No database, no complex setup
|
|
|
11
11
|
```bash
|
|
12
12
|
mkdir my-app && cd my-app
|
|
13
13
|
bun init -y
|
|
14
|
-
bun add hono @hono/zod-openapi @scalar/hono-api-reference @venizia/ignis
|
|
15
|
-
bun add -d typescript @types/bun @venizia/dev-configs
|
|
14
|
+
bun add hono @hono/zod-openapi @scalar/hono-api-reference @venizia/ignis @venizia/ignis-helpers
|
|
15
|
+
bun add -d typescript @types/bun @venizia/dev-configs eslint prettier tsc-alias
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Step 2: Configure Development Tools (30 seconds)
|
|
@@ -99,11 +99,9 @@ class HelloController extends BaseRestController {
|
|
|
99
99
|
super({ scope: "HelloController", path: "/hello" });
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
//
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
// Extra binding routes with functional way, use `bindRoute` or `defineRoute`
|
|
106
|
-
}
|
|
102
|
+
// Override binding() to register custom routes via bindRoute() or defineRoute().
|
|
103
|
+
// For decorator-based routes (@get, @post), this can be empty.
|
|
104
|
+
override binding() {}
|
|
107
105
|
|
|
108
106
|
@get({
|
|
109
107
|
configs: {
|
|
@@ -152,9 +150,11 @@ const app = new App({
|
|
|
152
150
|
host: "0.0.0.0",
|
|
153
151
|
port: 3000,
|
|
154
152
|
path: { base: "/api", isStrict: false },
|
|
153
|
+
debug: { shouldShowRoutes: true }, // Prints all registered routes on startup
|
|
155
154
|
},
|
|
156
155
|
});
|
|
157
156
|
|
|
157
|
+
// start() runs the full lifecycle: preConfigure → register resources → setupMiddlewares → HTTP server
|
|
158
158
|
app.start();
|
|
159
159
|
```
|
|
160
160
|
|
|
@@ -177,10 +177,11 @@ Update `package.json` to add build scripts:
|
|
|
177
177
|
"server:prod": "NODE_ENV=production bun run dist/index.js"
|
|
178
178
|
},
|
|
179
179
|
"dependencies": {
|
|
180
|
-
"hono": "^4.
|
|
180
|
+
"hono": "^4.12.1",
|
|
181
181
|
"@hono/zod-openapi": "latest",
|
|
182
182
|
"@scalar/hono-api-reference": "latest",
|
|
183
|
-
"@venizia/ignis": "latest"
|
|
183
|
+
"@venizia/ignis": "latest",
|
|
184
|
+
"@venizia/ignis-helpers": "latest"
|
|
184
185
|
},
|
|
185
186
|
"devDependencies": {
|
|
186
187
|
"typescript": "^5.5.3",
|
|
@@ -240,7 +241,7 @@ Open `http://localhost:3000/doc/explorer` to see interactive Swagger UI document
|
|
|
240
241
|
| `BaseRestController` | Provides lifecycle hooks, route binding, and OpenAPI integration for REST controllers |
|
|
241
242
|
| `BaseApplication` | Manages dependency injection, middleware, and server startup |
|
|
242
243
|
| `SwaggerComponent` | Generates interactive API docs at `/doc/explorer` |
|
|
243
|
-
| `app.start()` |
|
|
244
|
+
| `app.start()` | Runs the full lifecycle (preConfigure → register resources → middlewares) then starts HTTP server on port 3000 |
|
|
244
245
|
|
|
245
246
|
### Why Development Configs?
|
|
246
247
|
|
|
@@ -74,10 +74,10 @@ HTTP Request (GET /api/todos/:id)
|
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
76
|
# Add database packages
|
|
77
|
-
bun add drizzle-orm drizzle-zod pg
|
|
77
|
+
bun add drizzle-orm drizzle-zod pg
|
|
78
78
|
|
|
79
79
|
# Add dev dependencies for migrations
|
|
80
|
-
bun add -d drizzle-kit @types/pg
|
|
80
|
+
bun add -d drizzle-kit @types/pg
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
## Step 2: Define the Model
|
|
@@ -182,7 +182,6 @@ Create `src/datasources/postgres.datasource.ts`:
|
|
|
182
182
|
import {
|
|
183
183
|
BaseDataSource,
|
|
184
184
|
datasource,
|
|
185
|
-
TNodePostgresConnector,
|
|
186
185
|
ValueOrPromise,
|
|
187
186
|
} from '@venizia/ignis';
|
|
188
187
|
import { drizzle } from 'drizzle-orm/node-postgres';
|
|
@@ -205,7 +204,7 @@ interface IDSConfigs {
|
|
|
205
204
|
* 3. Drizzle is initialized with the auto-discovered schema
|
|
206
205
|
*/
|
|
207
206
|
@datasource({ driver: 'node-postgres' })
|
|
208
|
-
export class PostgresDataSource extends BaseDataSource<
|
|
207
|
+
export class PostgresDataSource extends BaseDataSource<IDSConfigs> {
|
|
209
208
|
constructor() {
|
|
210
209
|
super({
|
|
211
210
|
name: PostgresDataSource.name,
|
|
@@ -243,7 +242,7 @@ export class PostgresDataSource extends BaseDataSource<TNodePostgresConnector, I
|
|
|
243
242
|
- Schema is auto-discovered from `@repository` decorators - no manual registration needed
|
|
244
243
|
- Uses `getSchema()` for lazy schema resolution (resolves when all models are loaded)
|
|
245
244
|
- Uses environment variables for connection config
|
|
246
|
-
- Implements connection
|
|
245
|
+
- Implements `configure()` for connection setup and `getConnectionString()` for URL generation
|
|
247
246
|
|
|
248
247
|
> **Deep Dive:** See [DataSources Reference](/references/base/datasources) for advanced configuration and multiple database support.
|
|
249
248
|
|
|
@@ -306,24 +305,18 @@ Dependency Injection (DI) is a design pattern where objects receive their depend
|
|
|
306
305
|
|
|
307
306
|
`ControllerFactory` generates a full CRUD controller with automatic validation and OpenAPI docs.
|
|
308
307
|
|
|
309
|
-
Create `src/controllers/todo.
|
|
308
|
+
Create `src/controllers/todo/definitions.ts`:
|
|
310
309
|
|
|
311
310
|
```typescript
|
|
312
|
-
// src/controllers/todo.
|
|
311
|
+
// src/controllers/todo/definitions.ts
|
|
313
312
|
import { Todo } from '@/models/todo.model';
|
|
314
313
|
import { TodoRepository } from '@/repositories/todo.repository';
|
|
315
|
-
import {
|
|
316
|
-
BindingKeys,
|
|
317
|
-
BindingNamespaces,
|
|
318
|
-
controller,
|
|
319
|
-
ControllerFactory,
|
|
320
|
-
inject,
|
|
321
|
-
} from '@venizia/ignis';
|
|
314
|
+
import { ControllerFactory } from '@venizia/ignis';
|
|
322
315
|
|
|
323
|
-
const BASE_PATH = '/todos';
|
|
316
|
+
export const BASE_PATH = '/todos';
|
|
324
317
|
|
|
325
|
-
//
|
|
326
|
-
const _Controller = ControllerFactory.defineCrudController({
|
|
318
|
+
// The factory generates a controller class with all CRUD routes
|
|
319
|
+
export const _Controller = ControllerFactory.defineCrudController({
|
|
327
320
|
repository: { name: TodoRepository.name },
|
|
328
321
|
controller: {
|
|
329
322
|
name: 'TodoController',
|
|
@@ -331,8 +324,17 @@ const _Controller = ControllerFactory.defineCrudController({
|
|
|
331
324
|
},
|
|
332
325
|
entity: () => Todo, // The entity is used to generate OpenAPI schemas
|
|
333
326
|
});
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Create `src/controllers/todo/todo.controller.ts`:
|
|
334
330
|
|
|
335
|
-
|
|
331
|
+
```typescript
|
|
332
|
+
// src/controllers/todo/todo.controller.ts
|
|
333
|
+
import { TodoRepository } from '@/repositories/todo.repository';
|
|
334
|
+
import { BindingKeys, BindingNamespaces, controller, inject } from '@venizia/ignis';
|
|
335
|
+
import { BASE_PATH, _Controller } from './definitions';
|
|
336
|
+
|
|
337
|
+
// Extend the generated controller to inject the repository
|
|
336
338
|
@controller({ path: BASE_PATH })
|
|
337
339
|
export class TodoController extends _Controller {
|
|
338
340
|
constructor(
|
|
@@ -349,6 +351,12 @@ export class TodoController extends _Controller {
|
|
|
349
351
|
}
|
|
350
352
|
```
|
|
351
353
|
|
|
354
|
+
Create `src/controllers/todo/index.ts`:
|
|
355
|
+
|
|
356
|
+
```typescript
|
|
357
|
+
export * from './todo.controller';
|
|
358
|
+
```
|
|
359
|
+
|
|
352
360
|
**Auto-generated Endpoints:**
|
|
353
361
|
| Method | Path | Description |
|
|
354
362
|
|--------|------|-------------|
|
|
@@ -371,13 +379,13 @@ Update `src/application.ts` to register all components:
|
|
|
371
379
|
```typescript
|
|
372
380
|
// src/application.ts
|
|
373
381
|
import { BaseApplication, IApplicationConfigs, IApplicationInfo, SwaggerComponent, ValueOrPromise } from '@venizia/ignis';
|
|
374
|
-
import { HelloController } from './controllers/hello
|
|
382
|
+
import { HelloController } from './controllers/hello';
|
|
375
383
|
import packageJson from '../package.json';
|
|
376
384
|
|
|
377
385
|
// Import our new components
|
|
378
386
|
import { PostgresDataSource } from './datasources/postgres.datasource';
|
|
379
387
|
import { TodoRepository } from './repositories/todo.repository';
|
|
380
|
-
import { TodoController } from './controllers/todo
|
|
388
|
+
import { TodoController } from './controllers/todo';
|
|
381
389
|
|
|
382
390
|
export const appConfigs: IApplicationConfigs = {
|
|
383
391
|
host: process.env.HOST ?? '0.0.0.0',
|
|
@@ -413,6 +421,9 @@ export class Application extends BaseApplication {
|
|
|
413
421
|
}
|
|
414
422
|
```
|
|
415
423
|
|
|
424
|
+
> [!IMPORTANT] Registration Order
|
|
425
|
+
> Register in this order: **DataSources → Repositories → Services → Controllers**. DataSources must exist before Repositories that reference them. The framework resolves dependencies during initialization, so registering out of order will cause "Binding not found" errors.
|
|
426
|
+
|
|
416
427
|
## Step 7: Run Database Migration
|
|
417
428
|
|
|
418
429
|
### Understanding Database Migrations
|
|
@@ -462,32 +473,27 @@ Add these scripts to your `package.json`:
|
|
|
462
473
|
|
|
463
474
|
```json
|
|
464
475
|
"scripts": {
|
|
465
|
-
"
|
|
466
|
-
"generate
|
|
476
|
+
"db:push": "NODE_ENV=development drizzle-kit push --config=src/migration.ts",
|
|
477
|
+
"db:generate": "NODE_ENV=development drizzle-kit generate --config=src/migration.ts",
|
|
478
|
+
"db:migrate": "NODE_ENV=development drizzle-kit migrate --config=src/migration.ts"
|
|
467
479
|
}
|
|
468
480
|
```
|
|
469
481
|
|
|
470
482
|
### Run the Migration
|
|
471
483
|
|
|
484
|
+
For development, use `push` — it reads your schema and applies changes directly to the database:
|
|
485
|
+
|
|
472
486
|
```bash
|
|
473
|
-
bun run
|
|
487
|
+
bun run db:push
|
|
474
488
|
```
|
|
475
489
|
|
|
476
490
|
**What happens when you run this:**
|
|
477
491
|
|
|
478
492
|
1. **Reads** `src/models/todo.model.ts` to see what your schema looks like
|
|
479
|
-
2. **
|
|
480
|
-
3. **
|
|
481
|
-
4. **Executes** the SQL to create the table
|
|
482
|
-
5. **Saves** migration files to `./migration/` folder (for version control)
|
|
493
|
+
2. **Compares** it against the current database state
|
|
494
|
+
3. **Generates and executes** the SQL to create/update tables
|
|
483
495
|
|
|
484
|
-
**
|
|
485
|
-
```
|
|
486
|
-
Reading schema...
|
|
487
|
-
Generating migration...
|
|
488
|
-
Executing migration...
|
|
489
|
-
✓ Done!
|
|
490
|
-
```
|
|
496
|
+
> **Production workflow:** Use `db:generate` to create versioned migration files, then `db:migrate` to apply them. This gives you version control and rollback capability. `push` is simpler but skips the migration file step.
|
|
491
497
|
|
|
492
498
|
**Verify it worked:**
|
|
493
499
|
```bash
|
|
@@ -574,7 +580,7 @@ sudo service postgresql start # Linux
|
|
|
574
580
|
|
|
575
581
|
**Fix:**
|
|
576
582
|
```bash
|
|
577
|
-
bun run
|
|
583
|
+
bun run db:push
|
|
578
584
|
```
|
|
579
585
|
|
|
580
586
|
**Verify the table exists:**
|
|
@@ -629,9 +635,9 @@ Now that you've built the Todo API, try building a **User** feature on your own!
|
|
|
629
635
|
|:----:|------|
|
|
630
636
|
| 1 | Create `src/models/user.model.ts` |
|
|
631
637
|
| 2 | Create `src/repositories/user.repository.ts` (auto-registers User with PostgresDataSource) |
|
|
632
|
-
| 3 | Create `src/controllers/user.controller.ts
|
|
638
|
+
| 3 | Create `src/controllers/user/` (definitions.ts, user.controller.ts, index.ts) |
|
|
633
639
|
| 4 | Register repository and controller in `application.ts` |
|
|
634
|
-
| 5 |
|
|
640
|
+
| 5 | Push schema: `bun run db:push` |
|
|
635
641
|
| 6 | Test with curl |
|
|
636
642
|
|
|
637
643
|
**Hint:** Follow the exact same pattern as `Todo`. The only changes are the model name and fields!
|
|
@@ -19,15 +19,15 @@ bun init -y
|
|
|
19
19
|
### Production Dependencies
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
bun add hono @hono/zod-openapi @scalar/hono-api-reference @venizia/ignis
|
|
22
|
+
bun add hono @hono/zod-openapi @scalar/hono-api-reference @venizia/ignis @venizia/ignis-helpers
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
**What each package does:**
|
|
26
26
|
- `hono` - High-performance web framework
|
|
27
27
|
- `@hono/zod-openapi` - OpenAPI schema generation with Zod validation
|
|
28
28
|
- `@scalar/hono-api-reference` - Interactive API documentation UI
|
|
29
|
-
- `@venizia/ignis` - Core Ignis framework
|
|
30
|
-
-
|
|
29
|
+
- `@venizia/ignis` - Core Ignis framework (application, controllers, repositories, DI)
|
|
30
|
+
- `@venizia/ignis-helpers` - Utilities (HTTP constants, logger, environment helpers)
|
|
31
31
|
|
|
32
32
|
### Development Dependencies
|
|
33
33
|
|
|
@@ -121,7 +121,7 @@ This setup might seem verbose compared to minimal frameworks. The trade-off: ~50
|
|
|
121
121
|
### Create Project Structure
|
|
122
122
|
|
|
123
123
|
```bash
|
|
124
|
-
mkdir -p src/{common,components,configurations,controllers,datasources,helpers,models/{entities,requests,responses},repositories,services,utilities}
|
|
124
|
+
mkdir -p src/{common,components,configurations,controllers/hello,datasources,helpers,models/{entities,requests,responses},repositories,services,utilities}
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
Your structure will look like:
|
|
@@ -137,7 +137,10 @@ src/
|
|
|
137
137
|
│ └── index.ts # App configuration files
|
|
138
138
|
├── controllers/
|
|
139
139
|
│ ├── index.ts # Export all controllers
|
|
140
|
-
│ └── hello
|
|
140
|
+
│ └── hello/
|
|
141
|
+
│ ├── definitions.ts # Route configs, schemas, constants
|
|
142
|
+
│ ├── hello.controller.ts
|
|
143
|
+
│ └── index.ts # Barrel export
|
|
141
144
|
├── datasources/
|
|
142
145
|
│ └── index.ts # Database connections
|
|
143
146
|
├── helpers/
|
|
@@ -155,6 +158,8 @@ src/
|
|
|
155
158
|
└── index.ts # Utility functions
|
|
156
159
|
```
|
|
157
160
|
|
|
161
|
+
Each controller gets its own folder: `definitions.ts` for route configs and Zod schemas, the controller file itself, and an `index.ts` barrel export. This keeps things organized as controllers grow with custom routes, validations, and transformations.
|
|
162
|
+
|
|
158
163
|
> **Note:** For this guide, we only use `controllers/`. Other folders will be used in the [CRUD Tutorial](./building-a-crud-api.md) when you add database support.
|
|
159
164
|
|
|
160
165
|
### Create Application Class
|
|
@@ -163,7 +168,7 @@ Create `src/application.ts` - this is where you configure and register all your
|
|
|
163
168
|
|
|
164
169
|
```typescript
|
|
165
170
|
import { BaseApplication, IApplicationConfigs, IApplicationInfo, SwaggerComponent, ValueOrPromise } from '@venizia/ignis';
|
|
166
|
-
import { HelloController } from './controllers
|
|
171
|
+
import { HelloController } from './controllers';
|
|
167
172
|
import packageJson from '../package.json';
|
|
168
173
|
|
|
169
174
|
// Define application configurations
|
|
@@ -255,22 +260,39 @@ export class Application extends BaseApplication {
|
|
|
255
260
|
|
|
256
261
|
### Create Controller
|
|
257
262
|
|
|
258
|
-
|
|
263
|
+
Each controller lives in its own folder with separate files for definitions, logic, and exports.
|
|
264
|
+
|
|
265
|
+
Create `src/controllers/hello/definitions.ts` — route configs and schemas:
|
|
259
266
|
|
|
260
267
|
```typescript
|
|
261
|
-
import {
|
|
262
|
-
BaseRestController,
|
|
263
|
-
controller,
|
|
264
|
-
api,
|
|
265
|
-
jsonContent,
|
|
266
|
-
} from '@venizia/ignis';
|
|
268
|
+
import { jsonContent } from '@venizia/ignis';
|
|
267
269
|
import { HTTP } from '@venizia/ignis-helpers';
|
|
268
270
|
import { z } from '@hono/zod-openapi';
|
|
269
|
-
import { Context } from 'hono';
|
|
270
271
|
|
|
271
|
-
const BASE_PATH = '/hello';
|
|
272
|
+
export const BASE_PATH = '/hello';
|
|
273
|
+
|
|
274
|
+
export const helloRouteConfigs = {
|
|
275
|
+
sayHello: {
|
|
276
|
+
method: HTTP.Methods.GET,
|
|
277
|
+
path: '/',
|
|
278
|
+
responses: {
|
|
279
|
+
[HTTP.ResultCodes.RS_2.Ok]: jsonContent({
|
|
280
|
+
description: 'A simple hello message',
|
|
281
|
+
schema: z.object({ message: z.string() }),
|
|
282
|
+
}),
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
} as const;
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Create `src/controllers/hello/hello.controller.ts` — the controller class:
|
|
289
|
+
|
|
290
|
+
```typescript
|
|
291
|
+
import { BaseRestController, controller, api } from '@venizia/ignis';
|
|
292
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
293
|
+
import { Context } from 'hono';
|
|
294
|
+
import { BASE_PATH, helloRouteConfigs } from './definitions';
|
|
272
295
|
|
|
273
|
-
// The @controller decorator registers this class as a controller
|
|
274
296
|
// All routes in this controller will be under /api/hello (remember path.base: '/api')
|
|
275
297
|
@controller({ path: BASE_PATH })
|
|
276
298
|
export class HelloController extends BaseRestController {
|
|
@@ -278,47 +300,38 @@ export class HelloController extends BaseRestController {
|
|
|
278
300
|
super({ scope: HelloController.name, path: BASE_PATH });
|
|
279
301
|
}
|
|
280
302
|
|
|
281
|
-
//
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
// this.bindRoute({ configs: { method: 'get', path: '/programmatic', responses: {...} } }).to({ handler: this.myHandler });
|
|
285
|
-
|
|
286
|
-
// Option 2: Use @api decorator on methods (shown below) - recommended
|
|
287
|
-
}
|
|
303
|
+
// Override binding() to register custom routes via bindRoute() or defineRoute().
|
|
304
|
+
// For decorator-based routes (@api, @get, @post), this can be empty.
|
|
305
|
+
override binding() {}
|
|
288
306
|
|
|
289
|
-
|
|
290
|
-
@api({
|
|
291
|
-
configs: {
|
|
292
|
-
method: HTTP.Methods.GET,
|
|
293
|
-
path: '/',
|
|
294
|
-
// This 'responses' config does two things:
|
|
295
|
-
// 1. Generates OpenAPI/Swagger documentation automatically
|
|
296
|
-
// 2. Validates that your handler returns the correct shape
|
|
297
|
-
responses: {
|
|
298
|
-
[HTTP.ResultCodes.RS_2.Ok]: jsonContent({
|
|
299
|
-
description: 'A simple hello message',
|
|
300
|
-
schema: z.object({ message: z.string() }),
|
|
301
|
-
}),
|
|
302
|
-
},
|
|
303
|
-
},
|
|
304
|
-
})
|
|
307
|
+
@api({ configs: helloRouteConfigs.sayHello })
|
|
305
308
|
sayHello(c: Context) {
|
|
306
309
|
return c.json({ message: 'Hello, World!' }, HTTP.ResultCodes.RS_2.Ok);
|
|
307
310
|
}
|
|
308
|
-
|
|
309
|
-
// For authenticated endpoints, add 'authenticate':
|
|
310
|
-
// @api({ configs: { method: HTTP.Methods.GET, path: '/secure', authenticate: { strategies: [Authentication.STRATEGY_JWT] } } })
|
|
311
311
|
}
|
|
312
312
|
```
|
|
313
313
|
|
|
314
|
+
Create `src/controllers/hello/index.ts` — barrel export:
|
|
315
|
+
|
|
316
|
+
```typescript
|
|
317
|
+
export * from './hello.controller';
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Create `src/controllers/index.ts` — export all controllers:
|
|
321
|
+
|
|
322
|
+
```typescript
|
|
323
|
+
export * from './hello';
|
|
324
|
+
```
|
|
325
|
+
|
|
314
326
|
**Controller Patterns:**
|
|
315
327
|
|
|
316
328
|
| Pattern | Description |
|
|
317
329
|
|---------|-------------|
|
|
318
|
-
|
|
|
330
|
+
| `definitions.ts` | Route configs, Zod schemas, and constants — keeps controller file clean |
|
|
331
|
+
| `@controller` | Registers the class as a controller with a base path |
|
|
319
332
|
| `@api` | Defines a route with `method` specified in configs |
|
|
320
333
|
| `@get`, `@post`, etc. | Shorthand decorators that auto-set the HTTP method (recommended) |
|
|
321
|
-
| `binding()` |
|
|
334
|
+
| `binding()` | Override for programmatic routes via `bindRoute()` / `defineRoute()`. Empty for decorator-based routes |
|
|
322
335
|
| Zod schemas | Provide automatic validation and OpenAPI docs |
|
|
323
336
|
|
|
324
337
|
> **Deep Dive:** See [Controllers Reference](../core-concepts/rest-controllers.md) for advanced routing patterns and validation.
|
|
@@ -341,6 +354,10 @@ const main = async () => {
|
|
|
341
354
|
|
|
342
355
|
const applicationName = process.env.APP_ENV_APPLICATION_NAME?.toUpperCase() ?? 'My-App';
|
|
343
356
|
logger.info('[main] Getting ready to start up %s Application...', applicationName);
|
|
357
|
+
|
|
358
|
+
// start() runs the full lifecycle automatically:
|
|
359
|
+
// staticConfigure → preConfigure → registerDataSources → registerComponents
|
|
360
|
+
// → registerControllers → postConfigure → setupMiddlewares → HTTP server
|
|
344
361
|
await application.start();
|
|
345
362
|
return application;
|
|
346
363
|
};
|
|
@@ -348,6 +365,9 @@ const main = async () => {
|
|
|
348
365
|
export default main();
|
|
349
366
|
```
|
|
350
367
|
|
|
368
|
+
> [!TIP]
|
|
369
|
+
> `start()` runs the full lifecycle internally. You only need the explicit `init()` → `boot()` → `start()` sequence when using **auto-discovery** (glob-based booters) to discover controllers/repositories from the filesystem. For manual registration (as shown here), `start()` alone is sufficient.
|
|
370
|
+
|
|
351
371
|
## 5. Run Your Application
|
|
352
372
|
|
|
353
373
|
Add common application scripts to your `package.json`:
|
|
@@ -28,7 +28,7 @@ cd ecommerce-api
|
|
|
28
28
|
bun init -y
|
|
29
29
|
|
|
30
30
|
# Install dependencies
|
|
31
|
-
bun add hono @hono/zod-openapi @venizia/ignis
|
|
31
|
+
bun add hono @hono/zod-openapi @venizia/ignis @venizia/ignis-helpers
|
|
32
32
|
bun add drizzle-orm drizzle-zod pg stripe
|
|
33
33
|
bun add -d typescript @types/bun @venizia/dev-configs drizzle-kit @types/pg
|
|
34
34
|
```
|
|
@@ -57,9 +57,19 @@ ecommerce-api/
|
|
|
57
57
|
│ │ ├── order.service.ts
|
|
58
58
|
│ │ └── payment.service.ts
|
|
59
59
|
│ ├── controllers/
|
|
60
|
-
│ │ ├── product
|
|
61
|
-
│ │ ├──
|
|
62
|
-
│ │
|
|
60
|
+
│ │ ├── product/
|
|
61
|
+
│ │ │ ├── definitions.ts
|
|
62
|
+
│ │ │ ├── product.controller.ts
|
|
63
|
+
│ │ │ └── index.ts
|
|
64
|
+
│ │ ├── cart/
|
|
65
|
+
│ │ │ ├── definitions.ts
|
|
66
|
+
│ │ │ ├── cart.controller.ts
|
|
67
|
+
│ │ │ └── index.ts
|
|
68
|
+
│ │ ├── order/
|
|
69
|
+
│ │ │ ├── definitions.ts
|
|
70
|
+
│ │ │ ├── order.controller.ts
|
|
71
|
+
│ │ │ └── index.ts
|
|
72
|
+
│ │ └── index.ts
|
|
63
73
|
│ └── datasources/
|
|
64
74
|
│ └── postgres.datasource.ts
|
|
65
75
|
└── package.json
|
|
@@ -314,7 +324,6 @@ export * from './order.model';
|
|
|
314
324
|
import {
|
|
315
325
|
BaseDataSource,
|
|
316
326
|
datasource,
|
|
317
|
-
TNodePostgresConnector,
|
|
318
327
|
ValueOrPromise,
|
|
319
328
|
} from '@venizia/ignis';
|
|
320
329
|
import { drizzle } from 'drizzle-orm/node-postgres';
|
|
@@ -329,7 +338,7 @@ interface IDSConfigs {
|
|
|
329
338
|
}
|
|
330
339
|
|
|
331
340
|
@datasource({ driver: 'node-postgres' })
|
|
332
|
-
export class PostgresDataSource extends BaseDataSource<
|
|
341
|
+
export class PostgresDataSource extends BaseDataSource<IDSConfigs> {
|
|
333
342
|
constructor() {
|
|
334
343
|
super({
|
|
335
344
|
name: PostgresDataSource.name,
|
|
@@ -915,7 +924,7 @@ export class PaymentService extends BaseService {
|
|
|
915
924
|
### Product Controller
|
|
916
925
|
|
|
917
926
|
```typescript
|
|
918
|
-
// src/controllers/product.controller.ts
|
|
927
|
+
// src/controllers/product/product.controller.ts
|
|
919
928
|
import { z } from '@hono/zod-openapi';
|
|
920
929
|
import {
|
|
921
930
|
BaseRestController,
|
|
@@ -1003,7 +1012,7 @@ export class ProductController extends BaseRestController {
|
|
|
1003
1012
|
### Cart Controller
|
|
1004
1013
|
|
|
1005
1014
|
```typescript
|
|
1006
|
-
// src/controllers/cart.controller.ts
|
|
1015
|
+
// src/controllers/cart/cart.controller.ts
|
|
1007
1016
|
import { z } from '@hono/zod-openapi';
|
|
1008
1017
|
import {
|
|
1009
1018
|
BaseRestController,
|
|
@@ -1142,7 +1151,7 @@ export class CartController extends BaseRestController {
|
|
|
1142
1151
|
### Order Controller
|
|
1143
1152
|
|
|
1144
1153
|
```typescript
|
|
1145
|
-
// src/controllers/order.controller.ts
|
|
1154
|
+
// src/controllers/order/order.controller.ts
|
|
1146
1155
|
import { z } from '@hono/zod-openapi';
|
|
1147
1156
|
import {
|
|
1148
1157
|
BaseRestController,
|
|
@@ -1265,9 +1274,9 @@ export class OrderController extends BaseRestController {
|
|
|
1265
1274
|
import { BaseApplication, IApplicationInfo } from '@venizia/ignis';
|
|
1266
1275
|
import { HealthCheckComponent, SwaggerComponent } from '@venizia/ignis';
|
|
1267
1276
|
|
|
1268
|
-
import { ProductController } from './controllers/product
|
|
1269
|
-
import { CartController } from './controllers/cart
|
|
1270
|
-
import { OrderController } from './controllers/order
|
|
1277
|
+
import { ProductController } from './controllers/product';
|
|
1278
|
+
import { CartController } from './controllers/cart';
|
|
1279
|
+
import { OrderController } from './controllers/order';
|
|
1271
1280
|
|
|
1272
1281
|
import { ProductService } from './services/product.service';
|
|
1273
1282
|
import { CartService } from './services/cart.service';
|
|
@@ -25,7 +25,7 @@ cd chat-api
|
|
|
25
25
|
bun init -y
|
|
26
26
|
|
|
27
27
|
# Install dependencies
|
|
28
|
-
bun add hono @hono/zod-openapi @venizia/ignis
|
|
28
|
+
bun add hono @hono/zod-openapi @venizia/ignis @venizia/ignis-helpers
|
|
29
29
|
bun add drizzle-orm drizzle-zod pg
|
|
30
30
|
bun add -d typescript @types/bun @venizia/dev-configs drizzle-kit @types/pg
|
|
31
31
|
|
|
@@ -241,7 +241,6 @@ export * from './message.model';
|
|
|
241
241
|
import {
|
|
242
242
|
BaseDataSource,
|
|
243
243
|
datasource,
|
|
244
|
-
TNodePostgresConnector,
|
|
245
244
|
ValueOrPromise,
|
|
246
245
|
} from '@venizia/ignis';
|
|
247
246
|
import { drizzle } from 'drizzle-orm/node-postgres';
|
|
@@ -256,7 +255,7 @@ interface IDSConfigs {
|
|
|
256
255
|
}
|
|
257
256
|
|
|
258
257
|
@datasource({ driver: 'node-postgres' })
|
|
259
|
-
export class PostgresDataSource extends BaseDataSource<
|
|
258
|
+
export class PostgresDataSource extends BaseDataSource<IDSConfigs> {
|
|
260
259
|
constructor() {
|
|
261
260
|
super({
|
|
262
261
|
name: PostgresDataSource.name,
|
|
@@ -953,7 +952,7 @@ import {
|
|
|
953
952
|
SocketIOServerHelper,
|
|
954
953
|
} from '@venizia/ignis-helpers';
|
|
955
954
|
import { ChatService } from './services/chat.service';
|
|
956
|
-
import { ChatController } from './controllers/chat
|
|
955
|
+
import { ChatController } from './controllers/chat';
|
|
957
956
|
import { UserRepository } from './repositories/user.repository';
|
|
958
957
|
import { RoomRepository, RoomMemberRepository } from './repositories/room.repository';
|
|
959
958
|
import { MessageRepository, DirectMessageRepository } from './repositories/message.repository';
|
|
@@ -1124,7 +1123,7 @@ Client connects → 'authenticate' event → authenticateFn() → 'authenticated
|
|
|
1124
1123
|
## 7. REST API for Chat History
|
|
1125
1124
|
|
|
1126
1125
|
```typescript
|
|
1127
|
-
// src/controllers/chat.controller.ts
|
|
1126
|
+
// src/controllers/chat/chat.controller.ts
|
|
1128
1127
|
import { z } from '@hono/zod-openapi';
|
|
1129
1128
|
import {
|
|
1130
1129
|
BaseRestController,
|
|
@@ -101,6 +101,114 @@ async function transferFunds(fromId: string, toId: string, amount: number) {
|
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
|
|
104
|
+
## Row-Level Locking
|
|
105
|
+
|
|
106
|
+
Acquire pessimistic locks on selected rows within a transaction using PostgreSQL's `SELECT ... FOR UPDATE/SHARE` syntax.
|
|
107
|
+
|
|
108
|
+
### Basic Usage
|
|
109
|
+
|
|
110
|
+
Pass `lock` in options alongside a `transaction`:
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
const tx = await repo.beginTransaction();
|
|
114
|
+
|
|
115
|
+
try {
|
|
116
|
+
// Lock the row — other transactions will wait
|
|
117
|
+
const item = await repo.findOne({
|
|
118
|
+
filter: { where: { id: '123' } },
|
|
119
|
+
options: {
|
|
120
|
+
transaction: tx,
|
|
121
|
+
lock: { strength: 'update' },
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// Safe to modify — no concurrent changes possible
|
|
126
|
+
await repo.updateById({
|
|
127
|
+
id: '123',
|
|
128
|
+
data: { quantity: item.quantity - 1 },
|
|
129
|
+
options: { transaction: tx },
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
await tx.commit();
|
|
133
|
+
} catch (error) {
|
|
134
|
+
await tx.rollback();
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Lock Strengths
|
|
140
|
+
|
|
141
|
+
Use the `LockStrengths` constant class or string literals:
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
import { LockStrengths } from '@venizia/ignis';
|
|
145
|
+
|
|
146
|
+
// Using constant
|
|
147
|
+
lock: { strength: LockStrengths.UPDATE }
|
|
148
|
+
|
|
149
|
+
// Using string literal
|
|
150
|
+
lock: { strength: 'update' }
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
| Strength | SQL | Use Case |
|
|
154
|
+
|----------|-----|----------|
|
|
155
|
+
| `update` | `FOR UPDATE` | Exclusive lock for writes |
|
|
156
|
+
| `no key update` | `FOR NO KEY UPDATE` | Exclusive lock, allows concurrent `FOR KEY SHARE` |
|
|
157
|
+
| `share` | `FOR SHARE` | Shared read lock, prevents writes |
|
|
158
|
+
| `key share` | `FOR KEY SHARE` | Weakest lock, only prevents key changes |
|
|
159
|
+
|
|
160
|
+
### Wait Behavior
|
|
161
|
+
|
|
162
|
+
Control what happens when rows are already locked:
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
// Skip locked rows (queue-style worker pattern)
|
|
166
|
+
const items = await repo.find({
|
|
167
|
+
filter: { where: { status: 'pending' }, limit: 10 },
|
|
168
|
+
options: {
|
|
169
|
+
transaction: tx,
|
|
170
|
+
lock: { strength: 'update', config: { skipLocked: true } },
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// Fail immediately instead of waiting
|
|
175
|
+
const item = await repo.findOne({
|
|
176
|
+
filter: { where: { id: '123' } },
|
|
177
|
+
options: {
|
|
178
|
+
transaction: tx,
|
|
179
|
+
lock: { strength: 'update', config: { noWait: true } },
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
| Config | SQL | Behavior |
|
|
185
|
+
|--------|-----|----------|
|
|
186
|
+
| *(none)* | `FOR UPDATE` | Wait until lock is released |
|
|
187
|
+
| `{ noWait: true }` | `FOR UPDATE NOWAIT` | Throw error immediately if locked |
|
|
188
|
+
| `{ skipLocked: true }` | `FOR UPDATE SKIP LOCKED` | Silently skip locked rows |
|
|
189
|
+
|
|
190
|
+
### Constraints
|
|
191
|
+
|
|
192
|
+
> [!WARNING]
|
|
193
|
+
> Row-level locking requires a **transaction** and is **incompatible with `include`/`fields`** in the filter (these use the Drizzle Query API which does not support `.for()`).
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
// Error — no transaction
|
|
197
|
+
await repo.findOne({
|
|
198
|
+
filter: { where: { id: '123' } },
|
|
199
|
+
options: { lock: { strength: 'update' } },
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// Error — include uses Query API
|
|
203
|
+
await repo.findOne({
|
|
204
|
+
filter: { where: { id: '123' }, include: [{ relation: 'posts' }] },
|
|
205
|
+
options: { transaction: tx, lock: { strength: 'update' } },
|
|
206
|
+
});
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**Supported methods:** `find`, `findOne`, `findById`
|
|
210
|
+
|
|
211
|
+
|
|
104
212
|
## Hidden Properties
|
|
105
213
|
|
|
106
214
|
Automatically exclude sensitive fields from query results.
|
|
@@ -599,6 +707,7 @@ All repository operations accept an `options` parameter with these fields:
|
|
|
599
707
|
| `transaction` | `ITransaction` | - | Transaction context for the operation |
|
|
600
708
|
| `log` | `{ use: boolean; level?: TLogLevel }` | - | Enable operation logging |
|
|
601
709
|
| `shouldSkipDefaultFilter` | `boolean` | `false` | Bypass the default filter from model settings |
|
|
710
|
+
| `lock` | `TLockOptions` | - | Row-level locking (requires transaction, Core API only) |
|
|
602
711
|
|
|
603
712
|
Write operations additionally support:
|
|
604
713
|
|
|
@@ -618,6 +727,8 @@ Write operations additionally support:
|
|
|
618
727
|
| Commit | `await tx.commit()` |
|
|
619
728
|
| Rollback | `await tx.rollback()` |
|
|
620
729
|
| Bypass default filter | `options: { shouldSkipDefaultFilter: true }` |
|
|
730
|
+
| Lock rows for update | `options: { transaction: tx, lock: { strength: 'update' } }` |
|
|
731
|
+
| Lock + skip locked | `options: { transaction: tx, lock: { strength: 'update', config: { skipLocked: true } } }` |
|
|
621
732
|
| Enable logging | `options: { log: { use: true, level: 'debug' } }` |
|
|
622
733
|
| Force delete all | `options: { force: true }` |
|
|
623
734
|
| Skip returning data | `options: { shouldReturn: false }` |
|