@cyberismo/backend 0.0.8 → 0.0.9

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 (152) hide show
  1. package/dist/app.js +22 -8
  2. package/dist/app.js.map +1 -1
  3. package/dist/common/validationSchemas.js +39 -0
  4. package/dist/common/validationSchemas.js.map +1 -0
  5. package/dist/domain/calculations/index.js +50 -0
  6. package/dist/domain/calculations/index.js.map +1 -0
  7. package/dist/domain/calculations/schema.js +17 -0
  8. package/dist/domain/calculations/schema.js.map +1 -0
  9. package/dist/domain/calculations/service.js +16 -0
  10. package/dist/domain/calculations/service.js.map +1 -0
  11. package/dist/domain/cardTypes/index.js +86 -0
  12. package/dist/domain/cardTypes/index.js.map +1 -0
  13. package/dist/domain/cardTypes/schema.js +19 -0
  14. package/dist/domain/cardTypes/schema.js.map +1 -0
  15. package/dist/domain/cardTypes/service.js +20 -0
  16. package/dist/domain/cardTypes/service.js.map +1 -0
  17. package/dist/{routes/cards.js → domain/cards/index.js} +52 -223
  18. package/dist/domain/cards/index.js.map +1 -0
  19. package/dist/domain/cards/lib.js +80 -0
  20. package/dist/domain/cards/lib.js.map +1 -0
  21. package/dist/domain/cards/service.js +178 -0
  22. package/dist/domain/cards/service.js.map +1 -0
  23. package/dist/domain/fieldTypes/index.js +87 -0
  24. package/dist/domain/fieldTypes/index.js.map +1 -0
  25. package/dist/domain/fieldTypes/schema.js +30 -0
  26. package/dist/domain/fieldTypes/schema.js.map +1 -0
  27. package/dist/domain/fieldTypes/service.js +24 -0
  28. package/dist/domain/fieldTypes/service.js.map +1 -0
  29. package/dist/domain/graphModels/index.js +50 -0
  30. package/dist/domain/graphModels/index.js.map +1 -0
  31. package/dist/domain/graphModels/schema.js +18 -0
  32. package/dist/domain/graphModels/schema.js.map +1 -0
  33. package/dist/domain/graphModels/service.js +16 -0
  34. package/dist/domain/graphModels/service.js.map +1 -0
  35. package/dist/domain/graphViews/index.js +50 -0
  36. package/dist/domain/graphViews/index.js.map +1 -0
  37. package/dist/domain/graphViews/schema.js +6 -0
  38. package/dist/domain/graphViews/schema.js.map +1 -0
  39. package/dist/domain/graphViews/service.js +16 -0
  40. package/dist/domain/graphViews/service.js.map +1 -0
  41. package/dist/domain/linkTypes/index.js +76 -0
  42. package/dist/domain/linkTypes/index.js.map +1 -0
  43. package/dist/domain/linkTypes/schema.js +18 -0
  44. package/dist/domain/linkTypes/schema.js.map +1 -0
  45. package/dist/domain/linkTypes/service.js +24 -0
  46. package/dist/domain/linkTypes/service.js.map +1 -0
  47. package/dist/domain/logicPrograms/index.js +25 -0
  48. package/dist/domain/logicPrograms/index.js.map +1 -0
  49. package/dist/domain/logicPrograms/service.js +9 -0
  50. package/dist/domain/logicPrograms/service.js.map +1 -0
  51. package/dist/domain/reports/index.js +50 -0
  52. package/dist/domain/reports/index.js.map +1 -0
  53. package/dist/domain/reports/schema.js +18 -0
  54. package/dist/domain/reports/schema.js.map +1 -0
  55. package/dist/domain/reports/service.js +16 -0
  56. package/dist/domain/reports/service.js.map +1 -0
  57. package/dist/domain/resources/index.js +125 -0
  58. package/dist/domain/resources/index.js.map +1 -0
  59. package/dist/domain/resources/schema.js +9 -0
  60. package/dist/domain/resources/schema.js.map +1 -0
  61. package/dist/domain/resources/service.js +258 -0
  62. package/dist/domain/resources/service.js.map +1 -0
  63. package/dist/domain/templates/index.js +81 -0
  64. package/dist/domain/templates/index.js.map +1 -0
  65. package/dist/domain/templates/schema.js +18 -0
  66. package/dist/domain/templates/schema.js.map +1 -0
  67. package/dist/domain/templates/service.js +23 -0
  68. package/dist/domain/templates/service.js.map +1 -0
  69. package/dist/domain/tree/index.js +44 -0
  70. package/dist/domain/tree/index.js.map +1 -0
  71. package/dist/domain/tree/service.js +17 -0
  72. package/dist/domain/tree/service.js.map +1 -0
  73. package/dist/domain/workflows/index.js +50 -0
  74. package/dist/domain/workflows/index.js.map +1 -0
  75. package/dist/domain/workflows/schema.js +18 -0
  76. package/dist/domain/workflows/schema.js.map +1 -0
  77. package/dist/domain/workflows/service.js +16 -0
  78. package/dist/domain/workflows/service.js.map +1 -0
  79. package/dist/export.js +3 -3
  80. package/dist/export.js.map +1 -1
  81. package/dist/middleware/zvalidator.js +8 -0
  82. package/dist/middleware/zvalidator.js.map +1 -0
  83. package/dist/public/THIRD-PARTY.txt +2452 -296
  84. package/dist/public/assets/index-CXcBl8RN.js +161392 -0
  85. package/dist/public/cropped-favicon-180x180.png +0 -0
  86. package/dist/public/cropped-favicon-192x192.png +0 -0
  87. package/dist/public/cropped-favicon-270x270.png +0 -0
  88. package/dist/public/cropped-favicon-32x32.png +0 -0
  89. package/dist/public/index.html +8 -1
  90. package/dist/types.js +14 -0
  91. package/dist/types.js.map +1 -0
  92. package/dist/utils.js +3 -1
  93. package/dist/utils.js.map +1 -1
  94. package/package.json +7 -3
  95. package/src/app.ts +22 -8
  96. package/src/common/validationSchemas.ts +46 -0
  97. package/src/domain/calculations/index.ts +54 -0
  98. package/src/domain/calculations/schema.ts +18 -0
  99. package/src/domain/calculations/service.ts +21 -0
  100. package/src/domain/cardTypes/index.ts +96 -0
  101. package/src/domain/cardTypes/schema.ts +19 -0
  102. package/src/domain/cardTypes/service.ts +28 -0
  103. package/src/{routes/cards.ts → domain/cards/index.ts} +82 -270
  104. package/src/domain/cards/lib.ts +103 -0
  105. package/src/domain/cards/service.ts +254 -0
  106. package/src/domain/fieldTypes/index.ts +97 -0
  107. package/src/domain/fieldTypes/schema.ts +30 -0
  108. package/src/domain/fieldTypes/service.ts +38 -0
  109. package/src/domain/graphModels/index.ts +54 -0
  110. package/src/domain/graphModels/schema.ts +18 -0
  111. package/src/domain/graphModels/service.ts +21 -0
  112. package/src/domain/graphViews/index.ts +53 -0
  113. package/src/domain/graphViews/schema.ts +6 -0
  114. package/src/domain/graphViews/service.ts +20 -0
  115. package/src/domain/linkTypes/index.ts +84 -0
  116. package/src/domain/linkTypes/schema.ts +19 -0
  117. package/src/domain/linkTypes/service.ts +34 -0
  118. package/src/domain/logicPrograms/index.ts +35 -0
  119. package/src/domain/logicPrograms/service.ts +25 -0
  120. package/src/domain/reports/index.ts +54 -0
  121. package/src/domain/reports/schema.ts +19 -0
  122. package/src/domain/reports/service.ts +21 -0
  123. package/src/domain/resources/index.ts +164 -0
  124. package/src/domain/resources/schema.ts +19 -0
  125. package/src/domain/resources/service.ts +436 -0
  126. package/src/domain/templates/index.ts +89 -0
  127. package/src/domain/templates/schema.ts +19 -0
  128. package/src/domain/templates/service.ts +29 -0
  129. package/src/domain/tree/index.ts +50 -0
  130. package/src/domain/tree/service.ts +22 -0
  131. package/src/domain/workflows/index.ts +54 -0
  132. package/src/domain/workflows/schema.ts +19 -0
  133. package/src/domain/workflows/service.ts +21 -0
  134. package/src/export.ts +9 -5
  135. package/src/middleware/commandManager.ts +1 -1
  136. package/src/middleware/zvalidator.ts +17 -0
  137. package/src/types.ts +20 -0
  138. package/src/utils.ts +4 -2
  139. package/dist/public/assets/index-D5kiRHuF.js +0 -111171
  140. package/dist/routes/cards.js.map +0 -1
  141. package/dist/routes/fieldTypes.js +0 -42
  142. package/dist/routes/fieldTypes.js.map +0 -1
  143. package/dist/routes/linkTypes.js +0 -42
  144. package/dist/routes/linkTypes.js.map +0 -1
  145. package/dist/routes/templates.js +0 -46
  146. package/dist/routes/templates.js.map +0 -1
  147. package/dist/routes/tree.js +0 -40
  148. package/dist/routes/tree.js.map +0 -1
  149. package/src/routes/fieldTypes.ts +0 -53
  150. package/src/routes/linkTypes.ts +0 -53
  151. package/src/routes/templates.ts +0 -52
  152. package/src/routes/tree.ts +0 -45
package/dist/app.js CHANGED
@@ -15,14 +15,22 @@ import { staticFrontendDirRelative } from './utils.js';
15
15
  import { cors } from 'hono/cors';
16
16
  import { serveStatic } from '@hono/node-server/serve-static';
17
17
  import { attachCommandManager } from './middleware/commandManager.js';
18
- import cardsRouter from './routes/cards.js';
19
- import fieldTypesRouter from './routes/fieldTypes.js';
20
- import linkTypesRouter from './routes/linkTypes.js';
21
- import templatesRouter from './routes/templates.js';
22
- import treeRouter from './routes/tree.js';
18
+ import calculationsRouter from './domain/calculations/index.js';
19
+ import cardsRouter from './domain/cards/index.js';
20
+ import cardTypesRouter from './domain/cardTypes/index.js';
21
+ import fieldTypesRouter from './domain/fieldTypes/index.js';
22
+ import graphModelsRouter from './domain/graphModels/index.js';
23
+ import graphViewsRouter from './domain/graphViews/index.js';
24
+ import linkTypesRouter from './domain/linkTypes/index.js';
25
+ import reportsRouter from './domain/reports/index.js';
26
+ import templatesRouter from './domain/templates/index.js';
27
+ import treeRouter from './domain/tree/index.js';
28
+ import workflowsRouter from './domain/workflows/index.js';
23
29
  import { readFile } from 'node:fs/promises';
24
30
  import path from 'node:path';
25
31
  import { isSSGContext } from './export.js';
32
+ import resourcesRouter from './domain/resources/index.js';
33
+ import logicProgramsRouter from './domain/logicPrograms/index.js';
26
34
  /**
27
35
  * Create the Hono app for the backend
28
36
  * @param projectPath - Path to the project
@@ -36,11 +44,19 @@ export function createApp(projectPath) {
36
44
  // Attach CommandManager to all requests
37
45
  app.use(attachCommandManager(projectPath));
38
46
  // Wire up routes
47
+ app.route('/api/calculations', calculationsRouter);
39
48
  app.route('/api/cards', cardsRouter);
49
+ app.route('/api/cardTypes', cardTypesRouter);
40
50
  app.route('/api/fieldTypes', fieldTypesRouter);
51
+ app.route('/api/graphModels', graphModelsRouter);
52
+ app.route('/api/graphViews', graphViewsRouter);
41
53
  app.route('/api/linkTypes', linkTypesRouter);
54
+ app.route('/api/reports', reportsRouter);
42
55
  app.route('/api/templates', templatesRouter);
43
56
  app.route('/api/tree', treeRouter);
57
+ app.route('/api/workflows', workflowsRouter);
58
+ app.route('/api/resources', resourcesRouter);
59
+ app.route('/api/logicPrograms', logicProgramsRouter);
44
60
  // serve index.html for all other routes
45
61
  app.notFound(async (c) => {
46
62
  if (c.req.path.startsWith('/api')) {
@@ -55,9 +71,7 @@ export function createApp(projectPath) {
55
71
  console.error(err.stack);
56
72
  }
57
73
  return c.json({
58
- error: isSSGContext(c)
59
- ? err.message || 'Internal Server Error'
60
- : 'Internal Server Error',
74
+ error: err.message || 'Internal Server Error',
61
75
  }, 500);
62
76
  });
63
77
  return app;
package/dist/app.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AACF,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAC5C,OAAO,gBAAgB,MAAM,wBAAwB,CAAC;AACtD,OAAO,eAAe,MAAM,uBAAuB,CAAC;AACpD,OAAO,eAAe,MAAM,uBAAuB,CAAC;AACpD,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,WAAoB;IAC5C,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IAEvB,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAExB,GAAG,CAAC,GAAG,CACL,GAAG,EACH,WAAW,CAAC;QACV,IAAI,EAAE,yBAAyB;KAChC,CAAC,CACH,CAAC;IAEF,wCAAwC;IACxC,GAAG,CAAC,GAAG,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC,CAAC;IAE3C,iBAAiB;IACjB,GAAG,CAAC,KAAK,CAAC,YAAY,EAAE,W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AM,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC,CACvD,CAAC;QACF,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IACH,iBAAiB;IACjB,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QACrB,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;YACrB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,CAAC,CAAC,IAAI,CACX;YACE,KAAK,EAAE,GAAG,CAAC,OAAO,IAAI,uBAAuB;SAC9C,EACD,GAAG,CACJ,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ Cyberismo
3
+ Copyright © Cyberismo Ltd and contributors 2025
4
+ This program is free software: you can redistribute it and/or modify it under
5
+ the terms of the GNU Affero General Public License version 3 as published by
6
+ the Free Software Foundation.
7
+ This program is distributed in the hope that it will be useful, but WITHOUT
8
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9
+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
10
+ details. You should have received a copy of the GNU Affero General Public
11
+ License along with this program. If not, see <https://www.gnu.org/licenses/>.
12
+ */
13
+ import { z } from 'zod';
14
+ import { Validate } from '@cyberismo/data-handler';
15
+ export const resourceTypes = [
16
+ 'calculations',
17
+ 'cardTypes',
18
+ 'fieldTypes',
19
+ 'graphModels',
20
+ 'graphViews',
21
+ 'linkTypes',
22
+ 'reports',
23
+ 'templates',
24
+ 'workflows',
25
+ ];
26
+ export const identifierSchema = z
27
+ .string()
28
+ .refine((value) => Validate.isValidIdentifierName(value), {
29
+ message: 'Invalid identifier',
30
+ });
31
+ export const resourceParamsSchema = z.object({
32
+ prefix: z.string(),
33
+ type: z.enum(resourceTypes),
34
+ identifier: identifierSchema,
35
+ });
36
+ export const resourceParamsWithCard = resourceParamsSchema.extend({
37
+ type: z.enum([...resourceTypes, 'cards']),
38
+ });
39
+ //# sourceMappingURL=validationSchemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validationSchemas.js","sourceRoot":"","sources":["../../src/common/validationSchemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AACF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,cAAc;IACd,WAAW;IACX,YAAY;IACZ,aAAa;IACb,YAAY;IACZ,WAAW;IACX,SAAS;IACT,WAAW;IACX,WAAW;CACH,CAAC;AAEX,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,EAAE;KACR,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE;IACxD,OAAO,EAAE,oBAAoB;CAC9B,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC;IAC3B,UAAU,EAAE,gBAAgB;CAC7B,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC,MAAM,CAAC;IAChE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,aAAa,EAAE,OAAO,CAAC,CAAC;CAC1C,CAAC,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ Cyberismo
3
+ Copyright © Cyberismo Ltd and contributors 2025
4
+ This program is free software: you can redistribute it and/or modify it under
5
+ the terms of the GNU Affero General Public License version 3 as published by
6
+ the Free Software Foundation.
7
+ This program is distributed in the hope that it will be useful, but WITHOUT
8
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9
+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
10
+ details. You should have received a copy of the GNU Affero General Public
11
+ License along with this program. If not, see <https://www.gnu.org/licenses/>.
12
+ */
13
+ import { Hono } from 'hono';
14
+ import * as calculationService from './service.js';
15
+ import { createCalculationSchema } from './schema.js';
16
+ import { zValidator } from '../../middleware/zvalidator.js';
17
+ const router = new Hono();
18
+ /**
19
+ * @swagger
20
+ * /api/calculations:
21
+ * post:
22
+ * summary: Create a new calculation
23
+ * description: Creates a new calculation file with the specified fileName
24
+ * requestBody:
25
+ * required: true
26
+ * content:
27
+ * application/json:
28
+ * schema:
29
+ * type: object
30
+ * properties:
31
+ * fileName:
32
+ * type: string
33
+ * required:
34
+ * - fileName
35
+ * responses:
36
+ * 200:
37
+ * description: Calculation created successfully
38
+ * 400:
39
+ * description: Invalid request body
40
+ * 500:
41
+ * description: Server error
42
+ */
43
+ router.post('/', zValidator('json', createCalculationSchema), async (c) => {
44
+ const commands = c.get('commands');
45
+ const { fileName } = c.req.valid('json');
46
+ await calculationService.createCalculation(commands, fileName);
47
+ return c.json({ message: 'Calculation created successfully' });
48
+ });
49
+ export default router;
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/calculations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,kBAAkB,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D,MAAM,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;AAE1B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,MAAM,EAAE,uBAAuB,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACxE,MAAM,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACnC,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAEzC,MAAM,kBAAkB,CAAC,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/D,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,kCAAkC,EAAE,CAAC,CAAC;AACjE,CAAC,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ Cyberismo
3
+ Copyright © Cyberismo Ltd and contributors 2025
4
+ This program is free software: you can redistribute it and/or modify it under
5
+ the terms of the GNU Affero General Public License version 3 as published by
6
+ the Free Software Foundation.
7
+ This program is distributed in the hope that it will be useful, but WITHOUT
8
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9
+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
10
+ details. You should have received a copy of the GNU Affero General Public
11
+ License along with this program. If not, see <https://www.gnu.org/licenses/>.
12
+ */
13
+ import { z } from 'zod';
14
+ export const createCalculationSchema = z.object({
15
+ fileName: z.string().min(1),
16
+ });
17
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/domain/calculations/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5B,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ Cyberismo
3
+ Copyright © Cyberismo Ltd and contributors 2025
4
+ This program is free software: you can redistribute it and/or modify it under
5
+ the terms of the GNU Affero General Public License version 3 as published by
6
+ the Free Software Foundation.
7
+ This program is distributed in the hope that it will be useful, but WITHOUT
8
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9
+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
10
+ details. You should have received a copy of the GNU Affero General Public
11
+ License along with this program. If not, see <https://www.gnu.org/licenses/>.
12
+ */
13
+ export async function createCalculation(commands, fileName) {
14
+ await commands.createCmd.createCalculation(fileName);
15
+ }
16
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/domain/calculations/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAIF,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,QAAwB,EACxB,QAAgB;IAEhB,MAAM,QAAQ,CAAC,SAAS,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AACvD,CAAC"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ Cyberismo
3
+ Copyright © Cyberismo Ltd and contributors 2025
4
+ This program is free software: you can redistribute it and/or modify it under
5
+ the terms of the GNU Affero General Public License version 3 as published by
6
+ the Free Software Foundation.
7
+ This program is distributed in the hope that it will be useful, but WITHOUT
8
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9
+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
10
+ details. You should have received a copy of the GNU Affero General Public
11
+ License along with this program. If not, see <https://www.gnu.org/licenses/>.
12
+ */
13
+ import { Hono } from 'hono';
14
+ import * as cardTypeService from './service.js';
15
+ import { createCardTypeSchema } from './schema.js';
16
+ import { zValidator } from '../../middleware/zvalidator.js';
17
+ const router = new Hono();
18
+ /**
19
+ * @swagger
20
+ * /api/cardTypes:
21
+ * get:
22
+ * summary: Returns a list of all card types in the defined project.
23
+ * description: List of card types includes all card types in the project with all their details
24
+ * responses:
25
+ * 200:
26
+ * description: Object containing the project card types.
27
+ * 400:
28
+ * description: Error in reading project details.
29
+ * 500:
30
+ * description: project_path not set or other internal error
31
+ */
32
+ router.get('/', async (c) => {
33
+ const commands = c.get('commands');
34
+ try {
35
+ const cardTypes = await cardTypeService.getCardTypes(commands);
36
+ return c.json(cardTypes);
37
+ }
38
+ catch (error) {
39
+ return c.json({
40
+ error: `${error instanceof Error ? error.message : 'Unknown error'} from path ${c.get('projectPath')}`,
41
+ }, 500);
42
+ }
43
+ });
44
+ /**
45
+ * @swagger
46
+ * /api/cardTypes:
47
+ * post:
48
+ * summary: Create a new card type
49
+ * description: Creates a new card type with the specified workflow
50
+ * requestBody:
51
+ * required: true
52
+ * content:
53
+ * application/json:
54
+ * schema:
55
+ * type: object
56
+ * properties:
57
+ * cardTypeName:
58
+ * type: string
59
+ * workflowName:
60
+ * type: string
61
+ * required:
62
+ * - cardTypeName
63
+ * - workflowName
64
+ * responses:
65
+ * 200:
66
+ * description: Card type created successfully
67
+ * 400:
68
+ * description: Invalid request body
69
+ * 500:
70
+ * description: Server error
71
+ */
72
+ router.post('/', zValidator('json', createCardTypeSchema), async (c) => {
73
+ const commands = c.get('commands');
74
+ const { identifier, workflowName } = c.req.valid('json');
75
+ try {
76
+ await cardTypeService.createCardType(commands, identifier, workflowName);
77
+ return c.json({ message: 'Card type created successfully' });
78
+ }
79
+ catch (error) {
80
+ return c.json({
81
+ error: `${error instanceof Error ? error.message : 'Unknown error'}`,
82
+ }, 500);
83
+ }
84
+ });
85
+ export default router;
86
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/cardTypes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAEF,OAAO,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AAU,EAAE,YAAY,CAAC,CAAC;QACzE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,gCAAgC,EAAE,CAAC,CAAC;IAC/D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,CAAC,IAAI,CACX;YACE,KAAK,EAAE,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE;SACrE,EACD,GAAG,CACJ,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ Cyberismo
3
+ Copyright © Cyberismo Ltd and contributors 2025
4
+ This program is free software: you can redistribute it and/or modify it under
5
+ the terms of the GNU Affero General Public License version 3 as published by
6
+ the Free Software Foundation.
7
+ This program is distributed in the hope that it will be useful, but WITHOUT
8
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9
+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
10
+ details. You should have received a copy of the GNU Affero General Public
11
+ License along with this program. If not, see <https://www.gnu.org/licenses/>.
12
+ */
13
+ import { z } from 'zod';
14
+ import { identifierSchema } from '../../common/validationSchemas.js';
15
+ export const createCardTypeSchema = z.object({
16
+ identifier: identifierSchema,
17
+ workflowName: z.string(),
18
+ });
19
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/domain/cardTypes/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AACF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,UAAU,EAAE,gBAAgB;IAC5B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;CACzB,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ Cyberismo
3
+ Copyright © Cyberismo Ltd and contributors 2025
4
+ This program is free software: you can redistribute it and/or modify it under
5
+ the terms of the GNU Affero General Public License version 3 as published by
6
+ the Free Software Foundation.
7
+ This program is distributed in the hope that it will be useful, but WITHOUT
8
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9
+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
10
+ details. You should have received a copy of the GNU Affero General Public
11
+ License along with this program. If not, see <https://www.gnu.org/licenses/>.
12
+ */
13
+ export async function getCardTypes(commands) {
14
+ const cardTypesWithDetails = await commands.showCmd.showCardTypesWithDetails();
15
+ return cardTypesWithDetails;
16
+ }
17
+ export async function createCardType(commands, cardTypeName, workflowName) {
18
+ await commands.createCmd.createCardType(cardTypeName, workflowName);
19
+ }
20
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/domain/cardTypes/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AAIF,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAwB;IACzD,MAAM,oBAAoB,GACxB,MAAM,QAAQ,CAAC,OAAO,CAAC,wBAAwB,EAAE,CAAC;IACpD,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAwB,EACxB,YAAoB,EACpB,YAAoB;IAEpB,MAAM,QAAQ,CAAC,SAAS,CAAC,cAAc,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AACtE,CAAC"}