@hed-hog/finance 0.0.350 → 0.0.353

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 (112) hide show
  1. package/dist/dto/create-financial-title.dto.d.ts +6 -0
  2. package/dist/dto/create-financial-title.dto.d.ts.map +1 -1
  3. package/dist/dto/create-financial-title.dto.js +27 -1
  4. package/dist/dto/create-financial-title.dto.js.map +1 -1
  5. package/dist/finance-data.controller.d.ts +12 -0
  6. package/dist/finance-data.controller.d.ts.map +1 -1
  7. package/dist/finance-installments.controller.d.ts +120 -0
  8. package/dist/finance-installments.controller.d.ts.map +1 -1
  9. package/dist/finance-realtime.controller.d.ts +7 -0
  10. package/dist/finance-realtime.controller.d.ts.map +1 -0
  11. package/dist/finance-realtime.controller.js +34 -0
  12. package/dist/finance-realtime.controller.js.map +1 -0
  13. package/dist/finance-realtime.service.d.ts +36 -0
  14. package/dist/finance-realtime.service.d.ts.map +1 -0
  15. package/dist/finance-realtime.service.js +59 -0
  16. package/dist/finance-realtime.service.js.map +1 -0
  17. package/dist/finance-statements.controller.d.ts +6 -0
  18. package/dist/finance-statements.controller.d.ts.map +1 -1
  19. package/dist/finance.module.d.ts.map +1 -1
  20. package/dist/finance.module.js +28 -0
  21. package/dist/finance.module.js.map +1 -1
  22. package/dist/finance.service.d.ts +142 -1
  23. package/dist/finance.service.d.ts.map +1 -1
  24. package/dist/finance.service.js +134 -19
  25. package/dist/finance.service.js.map +1 -1
  26. package/dist/mcp-tools/finance-audit-logs.mcp-tools.d.ts +8 -0
  27. package/dist/mcp-tools/finance-audit-logs.mcp-tools.d.ts.map +1 -0
  28. package/dist/mcp-tools/finance-audit-logs.mcp-tools.js +60 -0
  29. package/dist/mcp-tools/finance-audit-logs.mcp-tools.js.map +1 -0
  30. package/dist/mcp-tools/finance-bank-accounts.mcp-tools.d.ts +16 -0
  31. package/dist/mcp-tools/finance-bank-accounts.mcp-tools.d.ts.map +1 -0
  32. package/dist/mcp-tools/finance-bank-accounts.mcp-tools.js +121 -0
  33. package/dist/mcp-tools/finance-bank-accounts.mcp-tools.js.map +1 -0
  34. package/dist/mcp-tools/finance-categories.mcp-tools.d.ts +20 -0
  35. package/dist/mcp-tools/finance-categories.mcp-tools.d.ts.map +1 -0
  36. package/dist/mcp-tools/finance-categories.mcp-tools.js +135 -0
  37. package/dist/mcp-tools/finance-categories.mcp-tools.js.map +1 -0
  38. package/dist/mcp-tools/finance-collections.mcp-tools.d.ts +16 -0
  39. package/dist/mcp-tools/finance-collections.mcp-tools.d.ts.map +1 -0
  40. package/dist/mcp-tools/finance-collections.mcp-tools.js +91 -0
  41. package/dist/mcp-tools/finance-collections.mcp-tools.js.map +1 -0
  42. package/dist/mcp-tools/finance-cost-centers.mcp-tools.d.ts +16 -0
  43. package/dist/mcp-tools/finance-cost-centers.mcp-tools.d.ts.map +1 -0
  44. package/dist/mcp-tools/finance-cost-centers.mcp-tools.js +114 -0
  45. package/dist/mcp-tools/finance-cost-centers.mcp-tools.js.map +1 -0
  46. package/dist/mcp-tools/finance-currencies.mcp-tools.d.ts +16 -0
  47. package/dist/mcp-tools/finance-currencies.mcp-tools.d.ts.map +1 -0
  48. package/dist/mcp-tools/finance-currencies.mcp-tools.js +120 -0
  49. package/dist/mcp-tools/finance-currencies.mcp-tools.js.map +1 -0
  50. package/dist/mcp-tools/finance-data.mcp-tools.d.ts +15 -0
  51. package/dist/mcp-tools/finance-data.mcp-tools.d.ts.map +1 -0
  52. package/dist/mcp-tools/finance-data.mcp-tools.js +80 -0
  53. package/dist/mcp-tools/finance-data.mcp-tools.js.map +1 -0
  54. package/dist/mcp-tools/finance-installments.mcp-tools.d.ts +93 -0
  55. package/dist/mcp-tools/finance-installments.mcp-tools.d.ts.map +1 -0
  56. package/dist/mcp-tools/finance-installments.mcp-tools.js +646 -0
  57. package/dist/mcp-tools/finance-installments.mcp-tools.js.map +1 -0
  58. package/dist/mcp-tools/finance-period-close.mcp-tools.d.ts +9 -0
  59. package/dist/mcp-tools/finance-period-close.mcp-tools.d.ts.map +1 -0
  60. package/dist/mcp-tools/finance-period-close.mcp-tools.js +79 -0
  61. package/dist/mcp-tools/finance-period-close.mcp-tools.js.map +1 -0
  62. package/dist/mcp-tools/finance-reports.mcp-tools.d.ts +10 -0
  63. package/dist/mcp-tools/finance-reports.mcp-tools.d.ts.map +1 -0
  64. package/dist/mcp-tools/finance-reports.mcp-tools.js +89 -0
  65. package/dist/mcp-tools/finance-reports.mcp-tools.js.map +1 -0
  66. package/dist/mcp-tools/finance-statements.mcp-tools.d.ts +34 -0
  67. package/dist/mcp-tools/finance-statements.mcp-tools.d.ts.map +1 -0
  68. package/dist/mcp-tools/finance-statements.mcp-tools.js +253 -0
  69. package/dist/mcp-tools/finance-statements.mcp-tools.js.map +1 -0
  70. package/dist/mcp-tools/finance-transfers.mcp-tools.d.ts +9 -0
  71. package/dist/mcp-tools/finance-transfers.mcp-tools.d.ts.map +1 -0
  72. package/dist/mcp-tools/finance-transfers.mcp-tools.js +79 -0
  73. package/dist/mcp-tools/finance-transfers.mcp-tools.js.map +1 -0
  74. package/hedhog/data/route.yaml +659 -1
  75. package/hedhog/frontend/app/_components/finance-title-actions-menu.tsx.ejs +9 -3
  76. package/hedhog/frontend/app/_lib/http-error.ts.ejs +105 -0
  77. package/hedhog/frontend/app/_lib/use-finance-realtime-refresh.ts.ejs +62 -0
  78. package/hedhog/frontend/app/accounts-payable/approvals/page.tsx.ejs +3 -0
  79. package/hedhog/frontend/app/accounts-payable/installments/[id]/page.tsx.ejs +5 -5
  80. package/hedhog/frontend/app/accounts-payable/installments/page.tsx.ejs +776 -344
  81. package/hedhog/frontend/app/accounts-receivable/collections-default/page.tsx.ejs +7 -13
  82. package/hedhog/frontend/app/accounts-receivable/installments/[id]/page.tsx.ejs +5 -5
  83. package/hedhog/frontend/app/accounts-receivable/installments/page.tsx.ejs +802 -355
  84. package/hedhog/frontend/app/administration/categories/page.tsx.ejs +9 -3
  85. package/hedhog/frontend/app/administration/cost-centers/page.tsx.ejs +9 -3
  86. package/hedhog/frontend/app/administration/currencies/page.tsx.ejs +9 -3
  87. package/hedhog/frontend/app/administration/period-close/page.tsx.ejs +9 -3
  88. package/hedhog/frontend/app/cash-and-banks/bank-accounts/page.tsx.ejs +7 -3
  89. package/hedhog/frontend/app/cash-and-banks/bank-reconciliation/page.tsx.ejs +3 -3
  90. package/hedhog/frontend/app/cash-and-banks/statements/page.tsx.ejs +28 -7
  91. package/hedhog/frontend/app/cash-and-banks/transfers/page.tsx.ejs +12 -3
  92. package/hedhog/frontend/messages/en.json +63 -3
  93. package/hedhog/frontend/messages/pt.json +63 -3
  94. package/hedhog/table/financial_title.yaml +10 -0
  95. package/package.json +5 -5
  96. package/src/dto/create-financial-title.dto.ts +23 -0
  97. package/src/finance-realtime.controller.ts +12 -0
  98. package/src/finance-realtime.service.ts +106 -0
  99. package/src/finance.module.ts +28 -0
  100. package/src/finance.service.ts +184 -45
  101. package/src/mcp-tools/finance-audit-logs.mcp-tools.ts +38 -0
  102. package/src/mcp-tools/finance-bank-accounts.mcp-tools.ts +76 -0
  103. package/src/mcp-tools/finance-categories.mcp-tools.ts +86 -0
  104. package/src/mcp-tools/finance-collections.mcp-tools.ts +50 -0
  105. package/src/mcp-tools/finance-cost-centers.mcp-tools.ts +69 -0
  106. package/src/mcp-tools/finance-currencies.mcp-tools.ts +75 -0
  107. package/src/mcp-tools/finance-data.mcp-tools.ts +43 -0
  108. package/src/mcp-tools/finance-installments.mcp-tools.ts +560 -0
  109. package/src/mcp-tools/finance-period-close.mcp-tools.ts +53 -0
  110. package/src/mcp-tools/finance-reports.mcp-tools.ts +59 -0
  111. package/src/mcp-tools/finance-statements.mcp-tools.ts +202 -0
  112. package/src/mcp-tools/finance-transfers.mcp-tools.ts +53 -0
@@ -0,0 +1,86 @@
1
+ import { McpContext, McpTool } from '@hed-hog/core';
2
+ import { Injectable } from '@nestjs/common';
3
+ import { FinanceService } from '../finance.service';
4
+
5
+ @Injectable()
6
+ export class FinanceCategoriesMcpTools {
7
+ constructor(private readonly financeService: FinanceService) {}
8
+
9
+ @McpTool({
10
+ name: 'finance.categories.list',
11
+ description: 'Lists finance categories.',
12
+ inputSchema: { type: 'object', properties: {} },
13
+ readOnly: true,
14
+ })
15
+ async list(_args: Record<string, any>, _context: McpContext): Promise<any> {
16
+ return this.financeService.listFinanceCategories();
17
+ }
18
+
19
+ @McpTool({
20
+ name: 'finance.categories.create',
21
+ description: 'Creates a finance category.',
22
+ inputSchema: {
23
+ type: 'object',
24
+ properties: {
25
+ name: { type: 'string', description: 'Category name' },
26
+ kind: { type: 'string', description: 'Category kind' },
27
+ parent_id: { type: 'number', description: 'Parent category ID' },
28
+ },
29
+ required: ['name', 'kind'],
30
+ },
31
+ })
32
+ async create(args: Record<string, any>, _context: McpContext): Promise<any> {
33
+ return this.financeService.createFinanceCategory(args as any);
34
+ }
35
+
36
+ @McpTool({
37
+ name: 'finance.categories.update',
38
+ description: 'Updates a finance category.',
39
+ inputSchema: {
40
+ type: 'object',
41
+ properties: {
42
+ id: { type: 'number', description: 'Category ID' },
43
+ name: { type: 'string', description: 'Category name' },
44
+ kind: { type: 'string', description: 'Category kind' },
45
+ },
46
+ required: ['id'],
47
+ },
48
+ })
49
+ async update(args: { id: number; [key: string]: any }, _context: McpContext): Promise<any> {
50
+ const { id, ...data } = args;
51
+ return this.financeService.updateFinanceCategory(id, data as any);
52
+ }
53
+
54
+ @McpTool({
55
+ name: 'finance.categories.move',
56
+ description: 'Moves/reorders a finance category.',
57
+ inputSchema: {
58
+ type: 'object',
59
+ properties: {
60
+ id: { type: 'number', description: 'Category ID' },
61
+ parent_id: { type: 'number', description: 'New parent ID' },
62
+ order: { type: 'number', description: 'Order index in siblings' },
63
+ },
64
+ required: ['id'],
65
+ },
66
+ })
67
+ async move(args: { id: number; [key: string]: any }, _context: McpContext): Promise<any> {
68
+ const { id, ...data } = args;
69
+ return this.financeService.moveFinanceCategory(id, data as any);
70
+ }
71
+
72
+ @McpTool({
73
+ name: 'finance.categories.delete',
74
+ description: 'Deletes a finance category.',
75
+ inputSchema: {
76
+ type: 'object',
77
+ properties: {
78
+ id: { type: 'number', description: 'Category ID' },
79
+ },
80
+ required: ['id'],
81
+ },
82
+ })
83
+ async delete(args: { id: number }, _context: McpContext): Promise<any> {
84
+ return this.financeService.deleteFinanceCategory(args.id);
85
+ }
86
+ }
@@ -0,0 +1,50 @@
1
+ import { McpContext, McpTool } from '@hed-hog/core';
2
+ import { Injectable } from '@nestjs/common';
3
+ import { FinanceService } from '../finance.service';
4
+
5
+ @Injectable()
6
+ export class FinanceCollectionsMcpTools {
7
+ constructor(private readonly financeService: FinanceService) {}
8
+
9
+ @McpTool({
10
+ name: 'finance.collections-default.get',
11
+ description: 'Returns default collections settings for accounts receivable.',
12
+ inputSchema: { type: 'object', properties: {} },
13
+ readOnly: true,
14
+ })
15
+ async getDefault(_args: Record<string, any>, _context: McpContext): Promise<any> {
16
+ return this.financeService.getAccountsReceivableCollectionsDefault();
17
+ }
18
+
19
+ @McpTool({
20
+ name: 'finance.collections-default.send',
21
+ description: 'Sends a collection action to a person.',
22
+ inputSchema: {
23
+ type: 'object',
24
+ properties: {
25
+ personId: { type: 'number', description: 'Person ID' },
26
+ },
27
+ required: ['personId'],
28
+ },
29
+ })
30
+ async send(args: { personId: number; [key: string]: any }, context: McpContext): Promise<any> {
31
+ const { personId, ...data } = args;
32
+ return this.financeService.sendCollection(personId, data as any, context.userId);
33
+ }
34
+
35
+ @McpTool({
36
+ name: 'finance.collections-default.register-agreement',
37
+ description: 'Registers a collection agreement for a person.',
38
+ inputSchema: {
39
+ type: 'object',
40
+ properties: {
41
+ personId: { type: 'number', description: 'Person ID' },
42
+ },
43
+ required: ['personId'],
44
+ },
45
+ })
46
+ async registerAgreement(args: { personId: number; [key: string]: any }, context: McpContext): Promise<any> {
47
+ const { personId, ...data } = args;
48
+ return this.financeService.registerCollectionAgreement(personId, data as any, context.userId);
49
+ }
50
+ }
@@ -0,0 +1,69 @@
1
+ import { McpContext, McpTool } from '@hed-hog/core';
2
+ import { Injectable } from '@nestjs/common';
3
+ import { FinanceService } from '../finance.service';
4
+
5
+ @Injectable()
6
+ export class FinanceCostCentersMcpTools {
7
+ constructor(private readonly financeService: FinanceService) {}
8
+
9
+ @McpTool({
10
+ name: 'finance.cost-centers.list',
11
+ description: 'Lists cost centers.',
12
+ inputSchema: { type: 'object', properties: {} },
13
+ readOnly: true,
14
+ })
15
+ async list(_args: Record<string, any>, _context: McpContext): Promise<any> {
16
+ return this.financeService.listCostCenters();
17
+ }
18
+
19
+ @McpTool({
20
+ name: 'finance.cost-centers.create',
21
+ description: 'Creates a cost center.',
22
+ inputSchema: {
23
+ type: 'object',
24
+ properties: {
25
+ name: { type: 'string', description: 'Name' },
26
+ code: { type: 'string', description: 'Code' },
27
+ description: { type: 'string', description: 'Description' },
28
+ },
29
+ required: ['name'],
30
+ },
31
+ })
32
+ async create(args: Record<string, any>, _context: McpContext): Promise<any> {
33
+ return this.financeService.createCostCenter(args as any);
34
+ }
35
+
36
+ @McpTool({
37
+ name: 'finance.cost-centers.update',
38
+ description: 'Updates a cost center.',
39
+ inputSchema: {
40
+ type: 'object',
41
+ properties: {
42
+ id: { type: 'number', description: 'Cost center ID' },
43
+ name: { type: 'string', description: 'Name' },
44
+ code: { type: 'string', description: 'Code' },
45
+ description: { type: 'string', description: 'Description' },
46
+ },
47
+ required: ['id'],
48
+ },
49
+ })
50
+ async update(args: { id: number; [key: string]: any }, _context: McpContext): Promise<any> {
51
+ const { id, ...data } = args;
52
+ return this.financeService.updateCostCenter(id, data as any);
53
+ }
54
+
55
+ @McpTool({
56
+ name: 'finance.cost-centers.delete',
57
+ description: 'Deletes a cost center.',
58
+ inputSchema: {
59
+ type: 'object',
60
+ properties: {
61
+ id: { type: 'number', description: 'Cost center ID' },
62
+ },
63
+ required: ['id'],
64
+ },
65
+ })
66
+ async delete(args: { id: number }, _context: McpContext): Promise<any> {
67
+ return this.financeService.deleteCostCenter(args.id);
68
+ }
69
+ }
@@ -0,0 +1,75 @@
1
+ import { McpContext, McpTool } from '@hed-hog/core';
2
+ import { Injectable } from '@nestjs/common';
3
+ import { FinanceService } from '../finance.service';
4
+
5
+ @Injectable()
6
+ export class FinanceCurrenciesMcpTools {
7
+ constructor(private readonly financeService: FinanceService) {}
8
+
9
+ @McpTool({
10
+ name: 'finance.currencies.list',
11
+ description: 'Lists currencies with pagination.',
12
+ inputSchema: {
13
+ type: 'object',
14
+ properties: {
15
+ page: { type: 'number', description: 'Page number (default: 1)' },
16
+ pageSize: { type: 'number', description: 'Items per page (default: 20)' },
17
+ },
18
+ },
19
+ readOnly: true,
20
+ })
21
+ async list(args: Record<string, any>, _context: McpContext): Promise<any> {
22
+ return this.financeService.listCurrencies(args as any);
23
+ }
24
+
25
+ @McpTool({
26
+ name: 'finance.currencies.create',
27
+ description: 'Creates a currency.',
28
+ inputSchema: {
29
+ type: 'object',
30
+ properties: {
31
+ code: { type: 'string', description: 'Currency code' },
32
+ name: { type: 'string', description: 'Currency name' },
33
+ symbol: { type: 'string', description: 'Currency symbol' },
34
+ },
35
+ required: ['code', 'name'],
36
+ },
37
+ })
38
+ async create(args: Record<string, any>, _context: McpContext): Promise<any> {
39
+ return this.financeService.createCurrency(args as any);
40
+ }
41
+
42
+ @McpTool({
43
+ name: 'finance.currencies.update',
44
+ description: 'Updates a currency.',
45
+ inputSchema: {
46
+ type: 'object',
47
+ properties: {
48
+ id: { type: 'number', description: 'Currency ID' },
49
+ code: { type: 'string', description: 'Currency code' },
50
+ name: { type: 'string', description: 'Currency name' },
51
+ symbol: { type: 'string', description: 'Currency symbol' },
52
+ },
53
+ required: ['id'],
54
+ },
55
+ })
56
+ async update(args: { id: number; [key: string]: any }, _context: McpContext): Promise<any> {
57
+ const { id, ...data } = args;
58
+ return this.financeService.updateCurrency(id, data as any);
59
+ }
60
+
61
+ @McpTool({
62
+ name: 'finance.currencies.delete',
63
+ description: 'Deletes a currency.',
64
+ inputSchema: {
65
+ type: 'object',
66
+ properties: {
67
+ id: { type: 'number', description: 'Currency ID' },
68
+ },
69
+ required: ['id'],
70
+ },
71
+ })
72
+ async delete(args: { id: number }, _context: McpContext): Promise<any> {
73
+ return this.financeService.deleteCurrency(args.id);
74
+ }
75
+ }
@@ -0,0 +1,43 @@
1
+ import { McpContext, McpTool } from '@hed-hog/core';
2
+ import { Injectable } from '@nestjs/common';
3
+ import { FinanceService } from '../finance.service';
4
+
5
+ @Injectable()
6
+ export class FinanceDataMcpTools {
7
+ constructor(private readonly financeService: FinanceService) {}
8
+
9
+ @McpTool({
10
+ name: 'finance.data.get',
11
+ description: 'Returns financial data for horizon and scenario.',
12
+ inputSchema: {
13
+ type: 'object',
14
+ properties: {
15
+ horizonte: { type: 'string', description: 'Forecast horizon in days' },
16
+ cenario: { type: 'string', description: 'Scenario name' },
17
+ },
18
+ },
19
+ readOnly: true,
20
+ })
21
+ async get(args: { horizonte?: string; cenario?: string }, _context: McpContext): Promise<any> {
22
+ return this.financeService.getData({
23
+ horizonteDias: args.horizonte,
24
+ cenario: args.cenario,
25
+ });
26
+ }
27
+
28
+ @McpTool({
29
+ name: 'finance.scenarios.update',
30
+ description: 'Updates scenario settings.',
31
+ inputSchema: {
32
+ type: 'object',
33
+ properties: {
34
+ cenario: { type: 'string', description: 'Scenario slug/name' },
35
+ },
36
+ required: ['cenario'],
37
+ },
38
+ })
39
+ async updateScenario(args: { cenario: string; [key: string]: any }, _context: McpContext): Promise<any> {
40
+ const { cenario, ...data } = args;
41
+ return this.financeService.updateScenarioSettings(cenario, data as any);
42
+ }
43
+ }