@cyberismo/backend 0.0.8 → 0.0.10

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 +102 -0
  6. package/dist/domain/calculations/index.js.map +1 -0
  7. package/dist/domain/calculations/schema.js +24 -0
  8. package/dist/domain/calculations/schema.js.map +1 -0
  9. package/dist/domain/calculations/service.js +21 -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 +128 -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-jhDO7xT5.js +161493 -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 +121 -0
  98. package/src/domain/calculations/schema.ts +27 -0
  99. package/src/domain/calculations/service.ts +32 -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 +166 -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
@@ -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
+
14
+ import { z } from 'zod';
15
+ import { identifierSchema } from '../../common/validationSchemas.js';
16
+
17
+ export const createWorkflowSchema = z.object({
18
+ identifier: identifierSchema,
19
+ });
@@ -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 createWorkflow(
17
+ commands: CommandManager,
18
+ workflowName: string,
19
+ ) {
20
+ await commands.createCmd.createWorkflow(workflowName, '');
21
+ }
package/src/export.ts CHANGED
@@ -23,8 +23,8 @@ import {
23
23
  runInParallel,
24
24
  staticFrontendDirRelative,
25
25
  } from './utils.js';
26
- import { QueryResult } from '@cyberismo/data-handler/types/queries';
27
- import { Context, Hono, MiddlewareHandler } from 'hono';
26
+ import type { QueryResult } from '@cyberismo/data-handler/types/queries';
27
+ import type { Context, Hono, MiddlewareHandler } from 'hono';
28
28
  import mime from 'mime-types';
29
29
 
30
30
  let _cardQueryPromise: Promise<QueryResult<'card'>[]> | null = null;
@@ -51,7 +51,11 @@ export async function getCardQueryResult(
51
51
  if (!_cardQueryPromise) {
52
52
  const commands = await CommandManager.getInstance(projectPath);
53
53
  // fetch all cards
54
- _cardQueryPromise = commands.calculateCmd.runQuery('card', {});
54
+ _cardQueryPromise = commands.project.calculationEngine.runQuery(
55
+ 'card',
56
+ 'exportedSite',
57
+ {},
58
+ );
55
59
  }
56
60
  return _cardQueryPromise.then((results) => {
57
61
  if (!cardKey) {
@@ -143,7 +147,7 @@ async function toSsg(
143
147
  onProgress?: (current?: number, total?: number) => void,
144
148
  ) {
145
149
  reset();
146
- await commands.calculateCmd.generate();
150
+ await commands.project.calculationEngine.generate();
147
151
 
148
152
  const promises = [];
149
153
 
@@ -152,7 +156,7 @@ async function toSsg(
152
156
 
153
157
  let processedFiles = 0;
154
158
  let failed = false;
155
- let errors: Error[] = [];
159
+ const errors: Error[] = [];
156
160
  const done = async (error?: Error) => {
157
161
  if (error) {
158
162
  failed = true;
@@ -10,7 +10,7 @@
10
10
  License along with this program. If not, see <https://www.gnu.org/licenses/>.
11
11
  */
12
12
 
13
- import { Context, MiddlewareHandler } from 'hono';
13
+ import type { Context, MiddlewareHandler } from 'hono';
14
14
  import { CommandManager } from '@cyberismo/data-handler';
15
15
 
16
16
  // Extend Hono Context type to include our custom properties
@@ -0,0 +1,17 @@
1
+ import { zValidator as zv } from '@hono/zod-validator';
2
+ import type { ZodType } from 'zod';
3
+ import type { ValidationTargets } from 'hono';
4
+ import { z } from 'zod';
5
+
6
+ export const zValidator = <
7
+ T extends ZodType,
8
+ Target extends keyof ValidationTargets,
9
+ >(
10
+ target: Target,
11
+ schema: T,
12
+ ) =>
13
+ zv(target, schema, (result, c) => {
14
+ if (!result.success) {
15
+ return c.json({ error: z.prettifyError(result.error) }, 400);
16
+ }
17
+ });
package/src/types.ts ADDED
@@ -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
+
14
+ export interface ResourceFileContentResponse {
15
+ content: string;
16
+ }
17
+
18
+ export interface ResourceValidationResponse {
19
+ errors: string[];
20
+ }
package/src/utils.ts CHANGED
@@ -19,7 +19,7 @@ import { createServer } from 'node:net';
19
19
  * @param maxConcurrent - Maximum number of promises to run at a time
20
20
  * @returns - Promise that resolves when all promises have resolved
21
21
  */
22
- export async function runInParallel<T>(
22
+ export async function runInParallel(
23
23
  promises: (() => Promise<unknown>)[],
24
24
  maxConcurrent: number = 2,
25
25
  ) {
@@ -47,7 +47,9 @@ export async function runCbSafely<T>(
47
47
  ): Promise<T | undefined> {
48
48
  try {
49
49
  return await cb();
50
- } catch {}
50
+ } catch {
51
+ // All exceptions are ignored.
52
+ }
51
53
  }
52
54
 
53
55
  /**