@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
@@ -4,7 +4,14 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Cyberismo App</title>
7
- <script type="module" crossorigin src="/assets/index-D5kiRHuF.js"></script>
7
+ <link rel="icon" href="/cropped-favicon-32x32.png" sizes="32x32" />
8
+ <link rel="icon" href="/cropped-favicon-192x192.png" sizes="192x192" />
9
+ <link rel="apple-touch-icon" href="/cropped-favicon-180x180.png" />
10
+ <meta
11
+ name="msapplication-TileImage"
12
+ content="/cropped-favicon-270x270.png"
13
+ />
14
+ <script type="module" crossorigin src="/assets/index-CXcBl8RN.js"></script>
8
15
  <link rel="stylesheet" crossorigin href="/assets/index-BngW8o1w.css">
9
16
  </head>
10
17
  <body>
package/dist/types.js ADDED
@@ -0,0 +1,14 @@
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 {};
14
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE"}
package/dist/utils.js CHANGED
@@ -40,7 +40,9 @@ export async function runCbSafely(cb) {
40
40
  try {
41
41
  return await cb();
42
42
  }
43
- catch { }
43
+ catch {
44
+ // All exceptions are ignored.
45
+ }
44
46
  }
45
47
  /**
46
48
  * The relative path to the static frontend directory.
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;EAWE;AACF,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,QAAoC,EACpC,gBAAwB,CAAC;IAEzB,MAAM,eAAe,GAA+B,EAAE,CA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QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;gBAC/D,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,yCAAyC,CAAC,CAAC;YAClE,CAAC;iBAAM,CAAC;gBACN,MAAM,GAAG,CAAC;YACZ,CAAC;QACH,CAAC;IACH,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;QAC9B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;YACvB,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACzB,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;QACH,UAAU,CAAC,GAAG,EAAE;YACd,MAAM,CAAC,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC,CAAC;QAC7D,CAAC,EAAE,IAAI,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyberismo/backend",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "Express backend for Cyberismo",
5
5
  "main": "dist/index.js",
6
6
  "keywords": [],
@@ -9,10 +9,12 @@
9
9
  "dependencies": {
10
10
  "@asciidoctor/core": "^3.0.4",
11
11
  "@hono/node-server": "^1.14.1",
12
+ "@hono/zod-validator": "^0.7.2",
12
13
  "dotenv": "^16.5.0",
13
14
  "hono": "^4.7.5",
14
15
  "mime-types": "^3.0.1",
15
- "@cyberismo/data-handler": "0.0.8"
16
+ "zod": "^4.0.17",
17
+ "@cyberismo/data-handler": "0.0.9"
16
18
  },
17
19
  "devDependencies": {
18
20
  "@types/mime-types": "^3.0.0",
@@ -31,8 +33,10 @@
31
33
  "start": "tsx src/main.ts",
32
34
  "start-e2e": "node dist/main.js",
33
35
  "dev": "tsx watch src/main.ts",
36
+ "debug": "tsx --inspect-brk src/main.ts",
34
37
  "export": "pnpm build && node dist/main.js --export",
35
38
  "build": "tsc -p tsconfig.build.json && shx rm -rf ./dist/public && shx cp -r ../app/dist ./dist/public",
36
- "test": "vitest run"
39
+ "test": "vitest run",
40
+ "lint": "eslint ."
37
41
  }
38
42
  }
package/src/app.ts 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
  /**
28
36
  * Create the Hono app for the backend
@@ -44,11 +52,19 @@ export function createApp(projectPath?: string) {
44
52
  app.use(attachCommandManager(projectPath));
45
53
 
46
54
  // Wire up routes
55
+ app.route('/api/calculations', calculationsRouter);
47
56
  app.route('/api/cards', cardsRouter);
57
+ app.route('/api/cardTypes', cardTypesRouter);
48
58
  app.route('/api/fieldTypes', fieldTypesRouter);
59
+ app.route('/api/graphModels', graphModelsRouter);
60
+ app.route('/api/graphViews', graphViewsRouter);
49
61
  app.route('/api/linkTypes', linkTypesRouter);
62
+ app.route('/api/reports', reportsRouter);
50
63
  app.route('/api/templates', templatesRouter);
51
64
  app.route('/api/tree', treeRouter);
65
+ app.route('/api/workflows', workflowsRouter);
66
+ app.route('/api/resources', resourcesRouter);
67
+ app.route('/api/logicPrograms', logicProgramsRouter);
52
68
 
53
69
  // serve index.html for all other routes
54
70
  app.notFound(async (c) => {
@@ -67,9 +83,7 @@ export function createApp(projectPath?: string) {
67
83
  }
68
84
  return c.json(
69
85
  {
70
- error: isSSGContext(c)
71
- ? err.message || 'Internal Server Error'
72
- : 'Internal Server Error',
86
+ error: err.message || 'Internal Server Error',
73
87
  },
74
88
  500,
75
89
  );
@@ -0,0 +1,46 @@
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
+
16
+ export const resourceTypes = [
17
+ 'calculations',
18
+ 'cardTypes',
19
+ 'fieldTypes',
20
+ 'graphModels',
21
+ 'graphViews',
22
+ 'linkTypes',
23
+ 'reports',
24
+ 'templates',
25
+ 'workflows',
26
+ ] as const;
27
+
28
+ export const identifierSchema = z
29
+ .string()
30
+ .refine((value) => Validate.isValidIdentifierName(value), {
31
+ message: 'Invalid identifier',
32
+ });
33
+
34
+ export const resourceParamsSchema = z.object({
35
+ prefix: z.string(),
36
+ type: z.enum(resourceTypes),
37
+ identifier: identifierSchema,
38
+ });
39
+
40
+ export type ResourceParams = z.infer<typeof resourceParamsSchema>;
41
+
42
+ export const resourceParamsWithCard = resourceParamsSchema.extend({
43
+ type: z.enum([...resourceTypes, 'cards']),
44
+ });
45
+
46
+ export type ResourceParamsWithCard = z.infer<typeof resourceParamsWithCard>;
@@ -0,0 +1,54 @@
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
+
14
+ import { Hono } from 'hono';
15
+ import * as calculationService from './service.js';
16
+ import { createCalculationSchema } from './schema.js';
17
+ import { zValidator } from '../../middleware/zvalidator.js';
18
+
19
+ const router = new Hono();
20
+
21
+ /**
22
+ * @swagger
23
+ * /api/calculations:
24
+ * post:
25
+ * summary: Create a new calculation
26
+ * description: Creates a new calculation file with the specified fileName
27
+ * requestBody:
28
+ * required: true
29
+ * content:
30
+ * application/json:
31
+ * schema:
32
+ * type: object
33
+ * properties:
34
+ * fileName:
35
+ * type: string
36
+ * required:
37
+ * - fileName
38
+ * responses:
39
+ * 200:
40
+ * description: Calculation created successfully
41
+ * 400:
42
+ * description: Invalid request body
43
+ * 500:
44
+ * description: Server error
45
+ */
46
+ router.post('/', zValidator('json', createCalculationSchema), async (c) => {
47
+ const commands = c.get('commands');
48
+ const { fileName } = c.req.valid('json');
49
+
50
+ await calculationService.createCalculation(commands, fileName);
51
+ return c.json({ message: 'Calculation created successfully' });
52
+ });
53
+
54
+ export default router;
@@ -0,0 +1,18 @@
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
+
14
+ import { z } from 'zod';
15
+
16
+ export const createCalculationSchema = z.object({
17
+ fileName: z.string().min(1),
18
+ });
@@ -0,0 +1,21 @@
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
+
14
+ import type { CommandManager } from '@cyberismo/data-handler';
15
+
16
+ export async function createCalculation(
17
+ commands: CommandManager,
18
+ fileName: string,
19
+ ) {
20
+ await commands.createCmd.createCalculation(fileName);
21
+ }
@@ -0,0 +1,96 @@
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
+
14
+ import { Hono } from 'hono';
15
+ import * as cardTypeService from './service.js';
16
+ import { createCardTypeSchema } from './schema.js';
17
+ import { zValidator } from '../../middleware/zvalidator.js';
18
+
19
+ const router = new Hono();
20
+
21
+ /**
22
+ * @swagger
23
+ * /api/cardTypes:
24
+ * get:
25
+ * summary: Returns a list of all card types in the defined project.
26
+ * description: List of card types includes all card types in the project with all their details
27
+ * responses:
28
+ * 200:
29
+ * description: Object containing the project card types.
30
+ * 400:
31
+ * description: Error in reading project details.
32
+ * 500:
33
+ * description: project_path not set or other internal error
34
+ */
35
+ router.get('/', async (c) => {
36
+ const commands = c.get('commands');
37
+
38
+ try {
39
+ const cardTypes = await cardTypeService.getCardTypes(commands);
40
+ return c.json(cardTypes);
41
+ } catch (error) {
42
+ return c.json(
43
+ {
44
+ error: `${error instanceof Error ? error.message : 'Unknown error'} from path ${c.get('projectPath')}`,
45
+ },
46
+ 500,
47
+ );
48
+ }
49
+ });
50
+
51
+ /**
52
+ * @swagger
53
+ * /api/cardTypes:
54
+ * post:
55
+ * summary: Create a new card type
56
+ * description: Creates a new card type with the specified workflow
57
+ * requestBody:
58
+ * required: true
59
+ * content:
60
+ * application/json:
61
+ * schema:
62
+ * type: object
63
+ * properties:
64
+ * cardTypeName:
65
+ * type: string
66
+ * workflowName:
67
+ * type: string
68
+ * required:
69
+ * - cardTypeName
70
+ * - workflowName
71
+ * responses:
72
+ * 200:
73
+ * description: Card type created successfully
74
+ * 400:
75
+ * description: Invalid request body
76
+ * 500:
77
+ * description: Server error
78
+ */
79
+ router.post('/', zValidator('json', createCardTypeSchema), async (c) => {
80
+ const commands = c.get('commands');
81
+ const { identifier, workflowName } = c.req.valid('json');
82
+
83
+ try {
84
+ await cardTypeService.createCardType(commands, identifier, workflowName);
85
+ return c.json({ message: 'Card type created successfully' });
86
+ } catch (error) {
87
+ return c.json(
88
+ {
89
+ error: `${error instanceof Error ? error.message : 'Unknown error'}`,
90
+ },
91
+ 500,
92
+ );
93
+ }
94
+ });
95
+
96
+ export default router;
@@ -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
+
16
+ export const createCardTypeSchema = z.object({
17
+ identifier: identifierSchema,
18
+ workflowName: z.string(),
19
+ });
@@ -0,0 +1,28 @@
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
+
14
+ import type { CommandManager } from '@cyberismo/data-handler';
15
+
16
+ export async function getCardTypes(commands: CommandManager) {
17
+ const cardTypesWithDetails =
18
+ await commands.showCmd.showCardTypesWithDetails();
19
+ return cardTypesWithDetails;
20
+ }
21
+
22
+ export async function createCardType(
23
+ commands: CommandManager,
24
+ cardTypeName: string,
25
+ workflowName: string,
26
+ ) {
27
+ await commands.createCmd.createCardType(cardTypeName, workflowName);
28
+ }