@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.
- package/dist/app.js +22 -8
- package/dist/app.js.map +1 -1
- package/dist/common/validationSchemas.js +39 -0
- package/dist/common/validationSchemas.js.map +1 -0
- package/dist/domain/calculations/index.js +50 -0
- package/dist/domain/calculations/index.js.map +1 -0
- package/dist/domain/calculations/schema.js +17 -0
- package/dist/domain/calculations/schema.js.map +1 -0
- package/dist/domain/calculations/service.js +16 -0
- package/dist/domain/calculations/service.js.map +1 -0
- package/dist/domain/cardTypes/index.js +86 -0
- package/dist/domain/cardTypes/index.js.map +1 -0
- package/dist/domain/cardTypes/schema.js +19 -0
- package/dist/domain/cardTypes/schema.js.map +1 -0
- package/dist/domain/cardTypes/service.js +20 -0
- package/dist/domain/cardTypes/service.js.map +1 -0
- package/dist/{routes/cards.js → domain/cards/index.js} +52 -223
- package/dist/domain/cards/index.js.map +1 -0
- package/dist/domain/cards/lib.js +80 -0
- package/dist/domain/cards/lib.js.map +1 -0
- package/dist/domain/cards/service.js +178 -0
- package/dist/domain/cards/service.js.map +1 -0
- package/dist/domain/fieldTypes/index.js +87 -0
- package/dist/domain/fieldTypes/index.js.map +1 -0
- package/dist/domain/fieldTypes/schema.js +30 -0
- package/dist/domain/fieldTypes/schema.js.map +1 -0
- package/dist/domain/fieldTypes/service.js +24 -0
- package/dist/domain/fieldTypes/service.js.map +1 -0
- package/dist/domain/graphModels/index.js +50 -0
- package/dist/domain/graphModels/index.js.map +1 -0
- package/dist/domain/graphModels/schema.js +18 -0
- package/dist/domain/graphModels/schema.js.map +1 -0
- package/dist/domain/graphModels/service.js +16 -0
- package/dist/domain/graphModels/service.js.map +1 -0
- package/dist/domain/graphViews/index.js +50 -0
- package/dist/domain/graphViews/index.js.map +1 -0
- package/dist/domain/graphViews/schema.js +6 -0
- package/dist/domain/graphViews/schema.js.map +1 -0
- package/dist/domain/graphViews/service.js +16 -0
- package/dist/domain/graphViews/service.js.map +1 -0
- package/dist/domain/linkTypes/index.js +76 -0
- package/dist/domain/linkTypes/index.js.map +1 -0
- package/dist/domain/linkTypes/schema.js +18 -0
- package/dist/domain/linkTypes/schema.js.map +1 -0
- package/dist/domain/linkTypes/service.js +24 -0
- package/dist/domain/linkTypes/service.js.map +1 -0
- package/dist/domain/logicPrograms/index.js +25 -0
- package/dist/domain/logicPrograms/index.js.map +1 -0
- package/dist/domain/logicPrograms/service.js +9 -0
- package/dist/domain/logicPrograms/service.js.map +1 -0
- package/dist/domain/reports/index.js +50 -0
- package/dist/domain/reports/index.js.map +1 -0
- package/dist/domain/reports/schema.js +18 -0
- package/dist/domain/reports/schema.js.map +1 -0
- package/dist/domain/reports/service.js +16 -0
- package/dist/domain/reports/service.js.map +1 -0
- package/dist/domain/resources/index.js +125 -0
- package/dist/domain/resources/index.js.map +1 -0
- package/dist/domain/resources/schema.js +9 -0
- package/dist/domain/resources/schema.js.map +1 -0
- package/dist/domain/resources/service.js +258 -0
- package/dist/domain/resources/service.js.map +1 -0
- package/dist/domain/templates/index.js +81 -0
- package/dist/domain/templates/index.js.map +1 -0
- package/dist/domain/templates/schema.js +18 -0
- package/dist/domain/templates/schema.js.map +1 -0
- package/dist/domain/templates/service.js +23 -0
- package/dist/domain/templates/service.js.map +1 -0
- package/dist/domain/tree/index.js +44 -0
- package/dist/domain/tree/index.js.map +1 -0
- package/dist/domain/tree/service.js +17 -0
- package/dist/domain/tree/service.js.map +1 -0
- package/dist/domain/workflows/index.js +50 -0
- package/dist/domain/workflows/index.js.map +1 -0
- package/dist/domain/workflows/schema.js +18 -0
- package/dist/domain/workflows/schema.js.map +1 -0
- package/dist/domain/workflows/service.js +16 -0
- package/dist/domain/workflows/service.js.map +1 -0
- package/dist/export.js +3 -3
- package/dist/export.js.map +1 -1
- package/dist/middleware/zvalidator.js +8 -0
- package/dist/middleware/zvalidator.js.map +1 -0
- package/dist/public/THIRD-PARTY.txt +2452 -296
- package/dist/public/assets/index-CXcBl8RN.js +161392 -0
- package/dist/public/cropped-favicon-180x180.png +0 -0
- package/dist/public/cropped-favicon-192x192.png +0 -0
- package/dist/public/cropped-favicon-270x270.png +0 -0
- package/dist/public/cropped-favicon-32x32.png +0 -0
- package/dist/public/index.html +8 -1
- package/dist/types.js +14 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.js +3 -1
- package/dist/utils.js.map +1 -1
- package/package.json +7 -3
- package/src/app.ts +22 -8
- package/src/common/validationSchemas.ts +46 -0
- package/src/domain/calculations/index.ts +54 -0
- package/src/domain/calculations/schema.ts +18 -0
- package/src/domain/calculations/service.ts +21 -0
- package/src/domain/cardTypes/index.ts +96 -0
- package/src/domain/cardTypes/schema.ts +19 -0
- package/src/domain/cardTypes/service.ts +28 -0
- package/src/{routes/cards.ts → domain/cards/index.ts} +82 -270
- package/src/domain/cards/lib.ts +103 -0
- package/src/domain/cards/service.ts +254 -0
- package/src/domain/fieldTypes/index.ts +97 -0
- package/src/domain/fieldTypes/schema.ts +30 -0
- package/src/domain/fieldTypes/service.ts +38 -0
- package/src/domain/graphModels/index.ts +54 -0
- package/src/domain/graphModels/schema.ts +18 -0
- package/src/domain/graphModels/service.ts +21 -0
- package/src/domain/graphViews/index.ts +53 -0
- package/src/domain/graphViews/schema.ts +6 -0
- package/src/domain/graphViews/service.ts +20 -0
- package/src/domain/linkTypes/index.ts +84 -0
- package/src/domain/linkTypes/schema.ts +19 -0
- package/src/domain/linkTypes/service.ts +34 -0
- package/src/domain/logicPrograms/index.ts +35 -0
- package/src/domain/logicPrograms/service.ts +25 -0
- package/src/domain/reports/index.ts +54 -0
- package/src/domain/reports/schema.ts +19 -0
- package/src/domain/reports/service.ts +21 -0
- package/src/domain/resources/index.ts +164 -0
- package/src/domain/resources/schema.ts +19 -0
- package/src/domain/resources/service.ts +436 -0
- package/src/domain/templates/index.ts +89 -0
- package/src/domain/templates/schema.ts +19 -0
- package/src/domain/templates/service.ts +29 -0
- package/src/domain/tree/index.ts +50 -0
- package/src/domain/tree/service.ts +22 -0
- package/src/domain/workflows/index.ts +54 -0
- package/src/domain/workflows/schema.ts +19 -0
- package/src/domain/workflows/service.ts +21 -0
- package/src/export.ts +9 -5
- package/src/middleware/commandManager.ts +1 -1
- package/src/middleware/zvalidator.ts +17 -0
- package/src/types.ts +20 -0
- package/src/utils.ts +4 -2
- package/dist/public/assets/index-D5kiRHuF.js +0 -111171
- package/dist/routes/cards.js.map +0 -1
- package/dist/routes/fieldTypes.js +0 -42
- package/dist/routes/fieldTypes.js.map +0 -1
- package/dist/routes/linkTypes.js +0 -42
- package/dist/routes/linkTypes.js.map +0 -1
- package/dist/routes/templates.js +0 -46
- package/dist/routes/templates.js.map +0 -1
- package/dist/routes/tree.js +0 -40
- package/dist/routes/tree.js.map +0 -1
- package/src/routes/fieldTypes.ts +0 -53
- package/src/routes/linkTypes.ts +0 -53
- package/src/routes/templates.ts +0 -52
- 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.
|
|
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.
|
|
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
|
-
|
|
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
|
|
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
|
/**
|