@cyberismo/backend 0.0.14 → 0.0.16
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.d.ts +21 -0
- package/dist/app.js +9 -3
- package/dist/app.js.map +1 -1
- package/dist/common/validationSchemas.d.ts +48 -0
- package/dist/domain/calculations/index.d.ts +15 -0
- package/dist/domain/calculations/index.js +1 -53
- package/dist/domain/calculations/index.js.map +1 -1
- package/dist/domain/calculations/schema.d.ts +16 -0
- package/dist/domain/calculations/schema.js +0 -7
- package/dist/domain/calculations/schema.js.map +1 -1
- package/dist/domain/calculations/service.d.ts +14 -0
- package/dist/domain/calculations/service.js +0 -5
- package/dist/domain/calculations/service.js.map +1 -1
- package/dist/domain/cardTypes/index.d.ts +15 -0
- package/dist/domain/cardTypes/schema.d.ts +17 -0
- package/dist/domain/cardTypes/service.d.ts +15 -0
- package/dist/domain/cards/index.d.ts +15 -0
- package/dist/domain/cards/index.js +24 -8
- package/dist/domain/cards/index.js.map +1 -1
- package/dist/domain/cards/lib.d.ts +29 -0
- package/dist/domain/cards/lib.js +74 -13
- package/dist/domain/cards/lib.js.map +1 -1
- package/dist/domain/cards/service.d.ts +61 -0
- package/dist/domain/cards/service.js +22 -18
- package/dist/domain/cards/service.js.map +1 -1
- package/dist/domain/fieldTypes/index.d.ts +15 -0
- package/dist/domain/fieldTypes/schema.d.ts +28 -0
- package/dist/domain/fieldTypes/service.d.ts +16 -0
- package/dist/domain/graphModels/index.d.ts +15 -0
- package/dist/domain/graphModels/schema.d.ts +16 -0
- package/dist/domain/graphModels/service.d.ts +14 -0
- package/dist/domain/graphViews/index.d.ts +15 -0
- package/dist/domain/graphViews/schema.d.ts +4 -0
- package/dist/domain/graphViews/service.d.ts +14 -0
- package/dist/domain/labels/index.d.ts +15 -0
- package/dist/domain/labels/index.js +33 -0
- package/dist/domain/labels/index.js.map +1 -0
- package/dist/domain/labels/service.d.ts +19 -0
- package/dist/domain/labels/service.js +21 -0
- package/dist/domain/labels/service.js.map +1 -0
- package/dist/domain/linkTypes/index.d.ts +15 -0
- package/dist/domain/linkTypes/schema.d.ts +16 -0
- package/dist/domain/linkTypes/service.d.ts +15 -0
- package/dist/domain/logicPrograms/index.d.ts +15 -0
- package/dist/domain/logicPrograms/service.d.ts +15 -0
- package/dist/domain/reports/index.d.ts +15 -0
- package/dist/domain/reports/schema.d.ts +16 -0
- package/dist/domain/reports/service.d.ts +14 -0
- package/dist/domain/resources/index.d.ts +15 -0
- package/dist/domain/resources/index.js +2 -20
- package/dist/domain/resources/index.js.map +1 -1
- package/dist/domain/resources/schema.d.ts +60 -0
- package/dist/domain/resources/schema.js +12 -1
- package/dist/domain/resources/schema.js.map +1 -1
- package/dist/domain/resources/service.d.ts +36 -0
- package/dist/domain/resources/service.js +14 -34
- package/dist/domain/resources/service.js.map +1 -1
- package/dist/domain/templates/index.d.ts +15 -0
- package/dist/domain/templates/index.js +1 -1
- package/dist/domain/templates/index.js.map +1 -1
- package/dist/domain/templates/schema.d.ts +22 -0
- package/dist/domain/templates/service.d.ts +16 -0
- package/dist/domain/tree/index.d.ts +15 -0
- package/dist/domain/tree/index.js +3 -2
- package/dist/domain/tree/index.js.map +1 -1
- package/dist/domain/tree/service.d.ts +22 -0
- package/dist/domain/tree/service.js +10 -2
- package/dist/domain/tree/service.js.map +1 -1
- package/dist/domain/workflows/index.d.ts +15 -0
- package/dist/domain/workflows/schema.d.ts +16 -0
- package/dist/domain/workflows/service.d.ts +14 -0
- package/dist/export.d.ts +42 -0
- package/dist/export.js +48 -152
- package/dist/export.js.map +1 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +1 -0
- package/dist/middleware/commandManager.d.ts +20 -0
- package/dist/middleware/tree.d.ts +9 -0
- package/dist/middleware/tree.js +13 -0
- package/dist/middleware/tree.js.map +1 -0
- package/dist/middleware/zvalidator.d.ts +9 -0
- package/dist/public/THIRD-PARTY.txt +164 -164
- package/dist/public/assets/{index-OjHhVGiV.js → index-D410yunq.js} +89249 -81256
- package/dist/public/assets/index-DnK7MBer.css +1 -0
- package/dist/public/index.html +2 -2
- package/dist/types.d.ts +29 -0
- package/dist/utils.d.ts +11 -0
- package/dist/utils.js +0 -32
- package/dist/utils.js.map +1 -1
- package/package.json +8 -8
- package/src/app.ts +11 -4
- package/src/domain/calculations/index.ts +1 -68
- package/src/domain/calculations/schema.ts +0 -9
- package/src/domain/calculations/service.ts +0 -11
- package/src/domain/cards/index.ts +33 -8
- package/src/domain/cards/lib.ts +95 -22
- package/src/domain/cards/service.ts +38 -37
- package/src/domain/labels/index.ts +36 -0
- package/src/domain/labels/service.ts +23 -0
- package/src/domain/resources/index.ts +3 -41
- package/src/domain/resources/schema.ts +13 -1
- package/src/domain/resources/service.ts +28 -67
- package/src/domain/templates/index.ts +1 -1
- package/src/domain/tree/index.ts +10 -3
- package/src/domain/tree/service.ts +15 -1
- package/src/export.ts +59 -192
- package/src/index.ts +7 -4
- package/src/middleware/tree.ts +17 -0
- package/src/types.ts +13 -0
- package/src/utils.ts +0 -39
- package/dist/public/assets/index-DA46eVkH.css +0 -1
package/src/export.ts
CHANGED
|
@@ -13,21 +13,22 @@
|
|
|
13
13
|
|
|
14
14
|
import path from 'node:path';
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import fs, { readFile } from 'node:fs/promises';
|
|
17
17
|
|
|
18
18
|
import { CommandManager } from '@cyberismo/data-handler';
|
|
19
19
|
import { createApp } from './app.js';
|
|
20
20
|
import { cp, writeFile } from 'node:fs/promises';
|
|
21
|
-
import {
|
|
22
|
-
runCbSafely,
|
|
23
|
-
runInParallel,
|
|
24
|
-
staticFrontendDirRelative,
|
|
25
|
-
} from './utils.js';
|
|
21
|
+
import { staticFrontendDirRelative } from './utils.js';
|
|
26
22
|
import type { QueryResult } from '@cyberismo/data-handler/types/queries';
|
|
27
|
-
import
|
|
28
|
-
import
|
|
23
|
+
import { toSSG } from 'hono/ssg';
|
|
24
|
+
import type { TreeOptions } from './types.js';
|
|
25
|
+
import {
|
|
26
|
+
findAllCards,
|
|
27
|
+
findRelevantAttachments,
|
|
28
|
+
} from './domain/cards/service.js';
|
|
29
29
|
|
|
30
30
|
let _cardQueryPromise: Promise<QueryResult<'card'>[]> | null = null;
|
|
31
|
+
const OVERHEAD_CALLS = 6; // estimated number of overhead calls during export in addition to card exports
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* DO NO USE DIRECTLY. This resets the callOnce map, allowing you to redo the export.
|
|
@@ -73,19 +74,29 @@ export async function getCardQueryResult(
|
|
|
73
74
|
* Export the site to a given directory.
|
|
74
75
|
* Note: Do not call this function in parallel.
|
|
75
76
|
* @param projectPath - Path to the project.
|
|
77
|
+
* @param options - Export options.
|
|
78
|
+
* @param options.recursive - Whether to export cards recursively.
|
|
79
|
+
* @param options.cardKey - Key of the card to export. If not provided, all cards will be exported.
|
|
76
80
|
* @param exportDir - Directory to export to.
|
|
77
81
|
* @param level - Log level for the operation.
|
|
78
82
|
* @param onProgress - Optional progress callback function.
|
|
83
|
+
* @returns An object containing any errors that occurred during export.
|
|
79
84
|
*/
|
|
80
85
|
export async function exportSite(
|
|
81
86
|
projectPath: string,
|
|
82
87
|
exportDir?: string,
|
|
88
|
+
options?: TreeOptions,
|
|
83
89
|
level?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal',
|
|
84
|
-
onProgress?: (current
|
|
85
|
-
) {
|
|
90
|
+
onProgress?: (current: number, total: number) => void,
|
|
91
|
+
): Promise<{ errors: string[] }> {
|
|
86
92
|
exportDir = exportDir || 'static';
|
|
93
|
+
const opts = {
|
|
94
|
+
recursive: false,
|
|
95
|
+
cardKey: undefined,
|
|
96
|
+
...options,
|
|
97
|
+
};
|
|
87
98
|
|
|
88
|
-
const app = createApp(projectPath);
|
|
99
|
+
const app = createApp(projectPath, opts);
|
|
89
100
|
|
|
90
101
|
// copy whole frontend to the same directory
|
|
91
102
|
await cp(staticFrontendDirRelative, exportDir, { recursive: true });
|
|
@@ -101,192 +112,48 @@ export async function exportSite(
|
|
|
101
112
|
const commands = await CommandManager.getInstance(projectPath, {
|
|
102
113
|
logLevel: level,
|
|
103
114
|
});
|
|
104
|
-
await toSsg(app, commands, exportDir, onProgress);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
async function getRoutes(app: Hono) {
|
|
108
|
-
const routes = new Set<string>();
|
|
109
|
-
for (const route of app.routes) {
|
|
110
|
-
if (route.method === 'GET') routes.add(route.path);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// handles both routes with and without dynamic parameters
|
|
114
|
-
const filteredRoutes = [];
|
|
115
|
-
for (const route of routes) {
|
|
116
|
-
if (!route.includes(':')) {
|
|
117
|
-
filteredRoutes.push(route);
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
const response = await createSsgRequest(app, route, true);
|
|
121
|
-
if (response.ok) {
|
|
122
|
-
const params = await response.json();
|
|
123
|
-
if (Array.isArray(params) && params.length > 0) {
|
|
124
|
-
for (const param of params) {
|
|
125
|
-
let newRoute = route;
|
|
126
|
-
for (const [key, value] of Object.entries(param)) {
|
|
127
|
-
newRoute = newRoute.replace(`:${key}`, `${value}`);
|
|
128
|
-
}
|
|
129
|
-
filteredRoutes.push(newRoute);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return filteredRoutes;
|
|
136
|
-
}
|
|
137
115
|
|
|
138
|
-
/**
|
|
139
|
-
* This is similar to hono's ssg function, but it only calls middlewares once
|
|
140
|
-
* @param app
|
|
141
|
-
* @param onProgress
|
|
142
|
-
*/
|
|
143
|
-
async function toSsg(
|
|
144
|
-
app: Hono,
|
|
145
|
-
commands: CommandManager,
|
|
146
|
-
dir: string,
|
|
147
|
-
onProgress?: (current?: number, total?: number) => void,
|
|
148
|
-
) {
|
|
149
116
|
reset();
|
|
150
117
|
await commands.project.calculationEngine.generate();
|
|
151
118
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
let
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
} else {
|
|
179
|
-
await done(new Error(`Failed to export route ${route}`));
|
|
119
|
+
// estimate total based on the number of cards to export
|
|
120
|
+
const cards = await findAllCards(commands, opts);
|
|
121
|
+
const attachments = await findRelevantAttachments(commands, opts);
|
|
122
|
+
let total = cards.length + attachments.length + OVERHEAD_CALLS;
|
|
123
|
+
|
|
124
|
+
// Actual export with progress reporting
|
|
125
|
+
let done = 0;
|
|
126
|
+
onProgress?.(done, total);
|
|
127
|
+
const errors: string[] = [];
|
|
128
|
+
await toSSG(app, fs, {
|
|
129
|
+
dir: exportDir,
|
|
130
|
+
concurrency: 5,
|
|
131
|
+
plugins: [
|
|
132
|
+
{
|
|
133
|
+
afterResponseHook: async (response) => {
|
|
134
|
+
if (![200, 201, 204].includes(response.status)) {
|
|
135
|
+
const error = await response.json();
|
|
136
|
+
if (
|
|
137
|
+
typeof error === 'object' &&
|
|
138
|
+
error != null &&
|
|
139
|
+
'error' in error &&
|
|
140
|
+
typeof error.error === 'string'
|
|
141
|
+
) {
|
|
142
|
+
errors.push(error.error);
|
|
143
|
+
}
|
|
144
|
+
return false; // ignore route
|
|
180
145
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
await runInParallel(promises, 5);
|
|
192
|
-
if (failed) {
|
|
193
|
-
const message = `Errors:\n${errors.map((e) => e.message).join('\n')}`;
|
|
194
|
-
throw new Error(message);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Get the file content and file ending for a given response and route.
|
|
200
|
-
* @param response - The response to get the file content and file ending for.
|
|
201
|
-
* @param route - The route to get the file content and file ending for.
|
|
202
|
-
* @returns The file content and file ending for the given response and route.
|
|
203
|
-
* If the route already has a file ending, it will be returned as an empty string.
|
|
204
|
-
*/
|
|
205
|
-
async function getFileContent(
|
|
206
|
-
response: Response,
|
|
207
|
-
route: string,
|
|
208
|
-
): Promise<{
|
|
209
|
-
content: ArrayBuffer;
|
|
210
|
-
fileEnding: string;
|
|
211
|
-
}> {
|
|
212
|
-
// Check if route already has an extension
|
|
213
|
-
const routeExtension = path.extname(route);
|
|
214
|
-
if (routeExtension) {
|
|
215
|
-
// Trust the existing extension in the route
|
|
216
|
-
const content = await response.arrayBuffer();
|
|
217
|
-
return {
|
|
218
|
-
content,
|
|
219
|
-
fileEnding: '',
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// No extension in route, fall back to content type detection
|
|
224
|
-
const contentType = response.headers.get('content-type');
|
|
225
|
-
if (!contentType) {
|
|
226
|
-
throw new Error('No content type');
|
|
227
|
-
}
|
|
228
|
-
const extension = mime.extension(contentType);
|
|
229
|
-
if (!extension) {
|
|
230
|
-
throw new Error('Unsupported content type');
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// Use ArrayBuffer for all content types
|
|
234
|
-
const content = await response.arrayBuffer();
|
|
235
|
-
return {
|
|
236
|
-
content,
|
|
237
|
-
fileEnding: `.${extension}`,
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
async function writeFileToDir(dir: string, response: Response, route: string) {
|
|
242
|
-
const { content, fileEnding } = await getFileContent(response, route);
|
|
243
|
-
|
|
244
|
-
let filePath = path.join(dir, route);
|
|
245
|
-
|
|
246
|
-
// if route does not have a file ending, add it based on the content type
|
|
247
|
-
if (!route.endsWith(fileEnding)) {
|
|
248
|
-
filePath += fileEnding;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
await mkdir(path.dirname(filePath), { recursive: true });
|
|
252
|
-
await writeFile(filePath, Buffer.from(content));
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// findroutes = if this request is used to find the routes in the app
|
|
256
|
-
function createSsgRequest(
|
|
257
|
-
app: Hono,
|
|
258
|
-
route: string,
|
|
259
|
-
findRoutes: boolean = true,
|
|
260
|
-
) {
|
|
261
|
-
return app.request(route, {
|
|
262
|
-
headers: new Headers({
|
|
263
|
-
'x-ssg': 'true',
|
|
264
|
-
'x-ssg-find': findRoutes ? 'true' : 'false',
|
|
265
|
-
}),
|
|
146
|
+
done++;
|
|
147
|
+
if (done > total) {
|
|
148
|
+
total = done; // adjust total if underestimated
|
|
149
|
+
}
|
|
150
|
+
onProgress?.(done, total);
|
|
151
|
+
return response;
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
],
|
|
266
155
|
});
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Check if the request is a static site generation request.
|
|
271
|
-
* @param c - The context of the request.
|
|
272
|
-
* @returns True if the request is a static site generation request.
|
|
273
|
-
*/
|
|
274
|
-
export function isSSGContext(c: Context) {
|
|
275
|
-
return c.req.header('x-ssg') === 'true';
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* This middleware is used to find the routes in the app.
|
|
280
|
-
* @param fn - The function to call to get the parameters for the route.
|
|
281
|
-
* @returns The middleware handler.
|
|
282
|
-
*/
|
|
283
|
-
export function ssgParams(
|
|
284
|
-
fn?: (c: Context) => Promise<unknown[]>,
|
|
285
|
-
): MiddlewareHandler {
|
|
286
|
-
return async (c, next) => {
|
|
287
|
-
if (c.req.header('x-ssg-find') === 'true') {
|
|
288
|
-
return fn ? c.json(await fn(c)) : c.json([]);
|
|
289
|
-
}
|
|
290
|
-
return next();
|
|
156
|
+
return {
|
|
157
|
+
errors,
|
|
291
158
|
};
|
|
292
159
|
}
|
package/src/index.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
12
12
|
*/
|
|
13
13
|
import { serve } from '@hono/node-server';
|
|
14
|
+
import type { Env, Schema } from 'hono';
|
|
14
15
|
import { Hono } from 'hono';
|
|
15
16
|
import { serveStatic } from '@hono/node-server/serve-static';
|
|
16
17
|
import path from 'node:path';
|
|
@@ -41,7 +42,7 @@ export async function previewSite(dir: string, findPort: boolean = true) {
|
|
|
41
42
|
if (findPort) {
|
|
42
43
|
port = await findFreePort(port, DEFAULT_MAX_PORT);
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
+
startApp(app, port);
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
/**
|
|
@@ -59,11 +60,13 @@ export async function startServer(
|
|
|
59
60
|
port = await findFreePort(port, DEFAULT_MAX_PORT);
|
|
60
61
|
}
|
|
61
62
|
const app = createApp(projectPath);
|
|
62
|
-
|
|
63
|
+
startApp(app, port);
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
function startApp<E extends Env, S extends Schema, P extends string>(
|
|
67
|
+
app: Hono<E, S, P>,
|
|
68
|
+
port: number,
|
|
69
|
+
) {
|
|
67
70
|
serve(
|
|
68
71
|
{
|
|
69
72
|
fetch: app.fetch,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Next } from 'hono';
|
|
2
|
+
import type { AppContext, TreeOptions } from '../types.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Injects tree options into the context for each request
|
|
6
|
+
* @param opts Options to inject
|
|
7
|
+
* @returns Middleware function
|
|
8
|
+
*/
|
|
9
|
+
const treeMiddleware =
|
|
10
|
+
(opts?: TreeOptions) => async (c: AppContext, next: Next) => {
|
|
11
|
+
if (opts) {
|
|
12
|
+
c.set('tree', { recursive: opts.recursive, cardKey: opts.cardKey });
|
|
13
|
+
}
|
|
14
|
+
await next();
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default treeMiddleware;
|
package/src/types.ts
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
import type { Context } from 'hono';
|
|
15
|
+
|
|
14
16
|
export interface ResourceFileContentResponse {
|
|
15
17
|
content: string;
|
|
16
18
|
}
|
|
@@ -18,3 +20,14 @@ export interface ResourceFileContentResponse {
|
|
|
18
20
|
export interface ResourceValidationResponse {
|
|
19
21
|
errors: string[];
|
|
20
22
|
}
|
|
23
|
+
|
|
24
|
+
export interface TreeOptions {
|
|
25
|
+
recursive?: boolean;
|
|
26
|
+
cardKey?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface AppVars {
|
|
30
|
+
tree?: TreeOptions;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type AppContext = Context<{ Variables: AppVars }>;
|
package/src/utils.ts
CHANGED
|
@@ -13,45 +13,6 @@
|
|
|
13
13
|
import path from 'node:path';
|
|
14
14
|
import { createServer } from 'node:net';
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* Runs promises in parallel, but only maxConcurrent at a time.
|
|
18
|
-
* @param promises - Array of promises to run in parallel
|
|
19
|
-
* @param maxConcurrent - Maximum number of promises to run at a time
|
|
20
|
-
* @returns - Promise that resolves when all promises have resolved
|
|
21
|
-
*/
|
|
22
|
-
export async function runInParallel(
|
|
23
|
-
promises: (() => Promise<unknown>)[],
|
|
24
|
-
maxConcurrent: number = 2,
|
|
25
|
-
) {
|
|
26
|
-
const waitingPromises: (() => Promise<unknown>)[] = [];
|
|
27
|
-
const wrappedPromises = promises.map((fn) => async () => {
|
|
28
|
-
await fn();
|
|
29
|
-
const next = waitingPromises.shift();
|
|
30
|
-
if (next) {
|
|
31
|
-
await next();
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const runningPromises = wrappedPromises.slice(0, maxConcurrent);
|
|
36
|
-
waitingPromises.push(...wrappedPromises.slice(maxConcurrent));
|
|
37
|
-
|
|
38
|
-
return Promise.all(runningPromises.map((p) => p()));
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Runs a callback and returns the result or undefined if it throws.
|
|
42
|
-
* @param cb - The callback to run.
|
|
43
|
-
* @returns The result of the callback or undefined if it throws.
|
|
44
|
-
*/
|
|
45
|
-
export async function runCbSafely<T>(
|
|
46
|
-
cb: () => Promise<T> | T,
|
|
47
|
-
): Promise<T | undefined> {
|
|
48
|
-
try {
|
|
49
|
-
return await cb();
|
|
50
|
-
} catch {
|
|
51
|
-
// All exceptions are ignored.
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
16
|
/**
|
|
56
17
|
* The relative path to the static frontend directory.
|
|
57
18
|
*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@media (max-width: 800px){.breadcrumbs{display:none}}[role=treeitem][aria-selected=false]:hover{.treenode{background-color:#dedede}}[role=treeitem][aria-selected=true]{outline:none}.resizeHandle{width:2px}.resizeHandle:hover,.resizeHandle:active{background-color:#0b6bcb}.cyberismo-svg-wrapper svg{max-height:100vh}.doc .MuiButton-root{margin-top:12px}.doc table.tableblock{border-collapse:collapse}.doc{color:#333;font-size:inherit;-ms-hyphens:auto;hyphens:auto;line-height:1.6;margin:0;padding:0}@media screen and (min-width: 1024px){.doc{-webkit-box-flex:1;-ms-flex:auto;flex:auto;font-size:.94444rem;margin:0;min-width:0}}.doc h1,.doc h2,.doc h3,.doc h4,.doc h5,.doc h6{color:#191919;font-weight:400;-ms-hyphens:none;hyphens:none;line-height:1.3;margin:1rem 0 0}.doc>h1.page:first-child{font-size:2rem;margin:1.5rem 0}@media screen and (min-width: 769px){.doc>h1.page:first-child{margin-top:2.5rem}}.doc>h1.page:first-child+aside.toc.embedded{margin-top:-.5rem}.doc>h2#name+.sectionbody{margin-top:1rem}#preamble+.sect1,.doc .sect1+.sect1{margin-top:2rem}.doc h1.sect0{background:#f0f0f0;font-size:1.8em;margin:1.5rem -1rem 0;padding:.5rem 1rem}.doc h2:not(.discrete){border-bottom:1px solid #e1e1e1;margin-left:-1rem;margin-right:-1rem;padding:.4rem 1rem .1rem}.doc h3:not(.discrete),.doc h4:not(.discrete){font-weight:600}.doc h1 .anchor,.doc h2 .anchor,.doc h3 .anchor,.doc h4 .anchor,.doc h5 .anchor,.doc h6 .anchor{position:absolute;text-decoration:none;width:1.75ex;margin-left:-1.5ex;visibility:hidden;font-size:.8em;font-weight:400;padding-top:.05em}.doc h1 .anchor:before,.doc h2 .anchor:before,.doc h3 .anchor:before,.doc h4 .anchor:before,.doc h5 .anchor:before,.doc h6 .anchor:before{content:"§"}.doc h1:hover .anchor,.doc h2:hover .anchor,.doc h3:hover .anchor,.doc h4:hover .anchor,.doc h5:hover .anchor,.doc h6:hover .anchor{visibility:visible}.doc dl,.doc p{margin:0}.doc a{color:#1565c0}.doc a:hover{color:#104d92}.doc a.bare{-ms-hyphens:none;hyphens:none}.doc a.unresolved{color:#d32f2f}.doc i.fa{-ms-hyphens:none;hyphens:none;font-style:normal}.doc .colist>table code,.doc p code,.doc thead code{color:#222;background:#fafafa;border-radius:.25em;font-size:.95em;padding:.125em .25em}.doc code,.doc pre{-ms-hyphens:none;hyphens:none}.doc pre{font-size:.88889rem;line-height:1.5;margin:0}.doc blockquote{margin:0}.doc .paragraph.lead>p{font-size:1rem}.doc .right{float:right}.doc .left{float:left}.doc .float-gap.right{margin:0 1rem 1rem 0}.doc .float-gap.left{margin:0 0 1rem 1rem}.doc .float-group:after{content:"";display:table;clear:both}.doc .text-left{text-align:left}.doc .text-center{text-align:center}.doc .text-right{text-align:right}.doc .text-justify{text-align:justify}.doc .stretch{width:100%}.doc .big{font-size:larger}.doc .small{font-size:smaller}.doc .underline{text-decoration:underline}.doc .line-through{text-decoration:line-through}.doc .dlist,.doc .exampleblock,.doc .hdlist,.doc .imageblock,.doc .listingblock,.doc .literalblock,.doc .olist,.doc .paragraph,.doc .partintro,.doc .quoteblock,.doc .sidebarblock,.doc .tabs,.doc .ulist,.doc .verseblock,.doc .videoblock,.doc details,.doc hr{margin:1rem 0 0}.doc .tablecontainer,.doc .tablecontainer+*,.doc :not(.tablecontainer)>table.tableblock,.doc :not(.tablecontainer)>table.tableblock+*,.doc>table.tableblock,.doc>table.tableblock+*{margin-top:1.5rem}.doc table.tableblock{font-size:.83333rem}.doc p.tableblock+p.tableblock{margin-top:.5rem}.doc table.tableblock pre{font-size:inherit}.doc td.tableblock>.content{word-wrap:anywhere}.doc td.tableblock>.content>:first-child{margin-top:0}.doc table.tableblock td{padding:.5rem}.doc table.tableblock th{padding:.5rem;background:#fbfcfe}.doc table.tableblock,.doc table.tableblock>*>tr>*{border:0 solid #e1e1e1}.doc table.grid-all>*>tr>*{border-width:1px}.doc table.grid-cols>*>tr>*{border-width:0 1px}.doc table.grid-rows>*>tr>*{border-width:1px 0}.doc table.grid-all>thead th,.doc table.grid-rows>thead th{border-bottom-width:2.5px}.doc table.frame-all{border-width:1px}.doc table.frame-ends{border-width:1px 0}.doc table.frame-sides{border-width:0 1px}.doc table.frame-none>colgroup+*>:first-child>*,.doc table.frame-sides>colgroup+*>:first-child>*{border-top-width:0}.doc table.frame-sides>:last-child>:last-child>*{border-bottom-width:0}.doc table.frame-ends>*>tr>:first-child,.doc table.frame-none>*>tr>:first-child{border-left-width:0}.doc table.frame-ends>*>tr>:last-child,.doc table.frame-none>*>tr>:last-child{border-right-width:0}.doc table.stripes-all>tbody>tr,.doc table.stripes-even>tbody>tr:nth-of-type(2n),.doc table.stripes-hover>tbody>tr:hover,.doc table.stripes-odd>tbody>tr:nth-of-type(odd){background:#fafafa}.doc table.tableblock>tfoot{background:-webkit-gradient(linear,left top,left bottom,from(#f0f0f0),to(#fff));background:linear-gradient(180deg,#f0f0f0 0,#fff)}.doc .halign-left{text-align:left}.doc .halign-right{text-align:right}.doc .halign-center{text-align:center}.doc .valign-top{vertical-align:top}.doc .valign-bottom{vertical-align:bottom}.doc .valign-middle{vertical-align:middle}.doc .admonitionblock{margin:1.4rem 0 0}.doc .admonitionblock p,.doc .admonitionblock td.content{font-size:.88889rem}.doc .admonitionblock td.content>.title+*,.doc .admonitionblock td.content>:not(.title):first-child{margin-top:0}.doc .admonitionblock td.content pre{font-size:.83333rem}.doc .admonitionblock>table{table-layout:fixed;position:relative;width:100%}.doc .admonitionblock td.content{padding:1rem 1rem .75rem;background:#fafafa;width:100%;word-wrap:anywhere}.doc .admonitionblock td.icon{font-size:.83333rem;left:0;line-height:1;padding:0;position:absolute;top:0;-webkit-transform:translate(-.5rem,-50%);transform:translate(-.5rem,-50%)}.doc .admonitionblock td.icon i{-webkit-box-align:center;-ms-flex-align:center;align-items:center;border-radius:.45rem;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-filter:initial;filter:none;height:1.25rem;padding:0 .5rem;vertical-align:initial;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.doc .admonitionblock td.icon i:after{content:attr(title);font-weight:600;font-style:normal;text-transform:uppercase}.doc .admonitionblock td.icon i.icon-caution{background-color:#a0439c;color:#fff}.doc .admonitionblock td.icon i.icon-important{background-color:#d32f2f;color:#fff}.doc .admonitionblock td.icon i.icon-note{background-color:#217ee7;color:#fff}.doc .admonitionblock td.icon i.icon-tip{background-color:#41af46;color:#fff}.doc .admonitionblock td.icon i.icon-warning{background-color:#e18114;color:#fff}.doc .imageblock,.doc .videoblock{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.doc .imageblock .content{-ms-flex-item-align:stretch;align-self:stretch;text-align:center}.doc .imageblock.text-left,.doc .videoblock.text-left{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.doc .imageblock.text-left .content{text-align:left}.doc .imageblock.text-right,.doc .videoblock.text-right{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.doc .imageblock.text-right .content{text-align:right}.doc .image>img,.doc .image>object,.doc .image>svg,.doc .imageblock img,.doc .imageblock object,.doc .imageblock svg{display:inline-block;max-height:75vh;max-width:100%;vertical-align:middle}.doc .image:not(.left):not(.right)>img{margin-top:-.2em}.doc .videoblock iframe,.doc .videoblock video{max-width:100%;vertical-align:middle}#preamble .abstract blockquote{background:#f0f0f0;border-left:5px solid #e1e1e1;color:#4a4a4a;font-size:.88889rem;padding:.75em 1em}.doc .quoteblock,.doc .verseblock{background:#fafafa;border-left:5px solid #5d5d5d;color:#5d5d5d}.doc .quoteblock{padding:.25rem 2rem 1.25rem}.doc .quoteblock .attribution{color:#8e8e8e;font-size:.83333rem;margin-top:.75rem}.doc .quoteblock blockquote{margin-top:1rem}.doc .quoteblock .paragraph{font-style:italic}.doc .quoteblock cite{padding-left:1em}.doc .verseblock{font-size:1.15em;padding:1rem 2rem}.doc .verseblock pre{font-family:inherit;font-size:inherit}.doc ol,.doc ul{margin:0;padding:0 0 0 2rem}.doc ol.none,.doc ol.unnumbered,.doc ol.unstyled,.doc ul.checklist,.doc ul.no-bullet,.doc ul.none,.doc ul.unstyled{list-style-type:none}.doc ol.unnumbered,.doc ul.no-bullet{padding-left:1.25rem}.doc ol.unstyled,.doc ul.unstyled{padding-left:0}.doc ul.circle{list-style-type:circle}.doc ul.disc{list-style-type:disc}.doc ul.square{list-style-type:square}.doc ul.circle ul:not([class]),.doc ul.disc ul:not([class]),.doc ul.square ul:not([class]){list-style:inherit}.doc ol.arabic{list-style-type:decimal}.doc ol.decimal{list-style-type:decimal-leading-zero}.doc ol.loweralpha{list-style-type:lower-alpha}.doc ol.upperalpha{list-style-type:upper-alpha}.doc ol.lowerroman{list-style-type:lower-roman}.doc ol.upperroman{list-style-type:upper-roman}.doc ol.lowergreek{list-style-type:lower-greek}.doc ul.checklist{padding-left:1.75rem}.doc ul.checklist p>i.fa-check-square-o:first-child,.doc ul.checklist p>i.fa-square-o:first-child{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:1.25rem;margin-left:-1.25rem}.doc ul.checklist i.fa-check-square-o:before{content:"✓"}.doc ul.checklist i.fa-square-o:before{content:"❏"}.doc .dlist .dlist,.doc .dlist .olist,.doc .dlist .ulist,.doc .olist .dlist,.doc .olist .olist,.doc .olist .ulist,.doc .olist li+li,.doc .ulist .dlist,.doc .ulist .olist,.doc .ulist .ulist,.doc .ulist li+li{margin-top:.5rem}.doc .admonitionblock .listingblock,.doc .olist .listingblock,.doc .ulist .listingblock{padding:0}.doc .admonitionblock .title,.doc .exampleblock .title,.doc .imageblock .title,.doc .listingblock .title,.doc .literalblock .title,.doc .openblock .title,.doc .videoblock .title,.doc table.tableblock caption{color:#5d5d5d;font-size:.88889rem;font-style:italic;font-weight:600;-ms-hyphens:none;hyphens:none;letter-spacing:.01em;padding-bottom:.075rem}.doc table.tableblock caption{text-align:left}.doc .olist .title,.doc .ulist .title{font-style:italic;font-weight:600;margin-bottom:.25rem}.doc .imageblock .title,.doc .videoblock .title{margin-top:.5rem;padding-bottom:0}.doc details{margin-left:1rem}.doc details>summary{display:block;position:relative;line-height:1.6;margin-bottom:.5rem}.doc details>summary::-webkit-details-marker{display:none}.doc details>summary:before{content:"";border:solid transparent;border-left:solid;border-width:.3em 0 .3em .5em;position:absolute;top:.5em;left:-1rem;-webkit-transform:translateX(15%);transform:translate(15%)}.doc details[open]>summary:before{border-color:currentColor transparent transparent;border-width:.5rem .3rem 0;-webkit-transform:translateY(15%);transform:translateY(15%)}.doc details>summary:after{content:"";width:1rem;height:1em;position:absolute;top:.3em;left:-1rem}.doc details.result{margin-top:.25rem}.doc details.result>summary{color:#5d5d5d;font-style:italic;margin-bottom:0}.doc details.result>.content{margin-left:-1rem}.doc .exampleblock>.content,.doc details.result>.content{background:#fff;border:.25rem solid #5d5d5d;border-radius:.5rem;padding:.75rem}.doc .exampleblock>.content:after,.doc details.result>.content:after{content:"";display:table;clear:both}.doc .exampleblock>.content>:first-child,.doc details>.content>:first-child{margin-top:0}.doc .sidebarblock{background:#e1e1e1;border-radius:.75rem;padding:.75rem 1.5rem}.doc .sidebarblock>.content>.title{font-size:1.25rem;font-weight:600;line-height:1.3;margin-bottom:.5rem;text-align:center}.doc .sidebarblock>.content>.title+*,.doc .sidebarblock>.content>:not(.title):first-child{margin-top:0}.doc .listingblock.wrap pre,.doc table.tableblock pre{white-space:pre-wrap}.doc .listingblock pre:not(.highlight),.doc .literalblock pre,.doc pre.highlight>code{background:#fafafa;-webkit-box-shadow:inset 0 0 1.75px #e1e1e1;box-shadow:inset 0 0 1.75px #e1e1e1;display:block;overflow-x:auto;padding:.875em}.doc .listingblock>.content{position:relative}.doc .source-toolbox{display:-webkit-box;display:-ms-flexbox;display:flex;visibility:hidden;position:absolute;top:.25rem;right:.5rem;color:gray;font-family:Roboto,sans-serif;font-size:.72222rem;line-height:1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;z-index:1}.doc .listingblock:hover .source-toolbox{visibility:visible}.doc .source-toolbox .source-lang{text-transform:uppercase;letter-spacing:.075em}.doc .source-toolbox>:not(:last-child):after{content:"|";letter-spacing:0;padding:0 1ch}.doc .source-toolbox .copy-button{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background:none;border:none;color:inherit;outline:none;padding:0;font-size:inherit;line-height:inherit;width:1em;height:1em}.doc .source-toolbox .copy-icon{-webkit-box-flex:0;-ms-flex:none;flex:none;width:inherit;height:inherit}.doc .source-toolbox img.copy-icon{-webkit-filter:invert(50.2%);filter:invert(50.2%)}.doc .source-toolbox svg.copy-icon{fill:currentColor}.doc .source-toolbox .copy-toast{-webkit-box-flex:0;-ms-flex:none;flex:none;position:relative;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-top:1em;background-color:#333;border-radius:.25em;padding:.5em;color:#fff;cursor:auto;opacity:0;-webkit-transition:opacity .5s ease .5s;transition:opacity .5s ease .5s}.doc .source-toolbox .copy-toast:after{content:"";position:absolute;top:0;width:1em;height:1em;border:.55em solid transparent;border-left-color:#333;-webkit-transform:rotate(-90deg) translateX(50%) translateY(50%);transform:rotate(-90deg) translate(50%) translateY(50%);-webkit-transform-origin:left;transform-origin:left}.doc .source-toolbox .copy-button.clicked .copy-toast{opacity:1;-webkit-transition:none;transition:none}.doc .language-console .hljs-meta{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.doc .dlist dt{font-style:italic}.doc .dlist dd{margin:0 0 0 1.5rem}.doc .dlist dd+dt,.doc .dlist dd>p:first-child{margin-top:.5rem}.doc td.hdlist1,.doc td.hdlist2{padding:.5rem 0 0;vertical-align:top}.doc tr:first-child>.hdlist1,.doc tr:first-child>.hdlist2{padding-top:0}.doc td.hdlist1{font-weight:600;padding-right:.25rem}.doc td.hdlist2{padding-left:.25rem}.doc .colist{font-size:.88889rem;margin:.25rem 0 -.25rem}.doc .colist>table>tbody>tr>:first-child,.doc .colist>table>tr>:first-child{padding:.25em .5rem 0;vertical-align:top}.doc .colist>table>tbody>tr>:last-child,.doc .colist>table>tr>:last-child{padding:.25rem 0}.doc .conum[data-value]{border:1px solid;border-radius:100%;display:inline-block;font-family:Roboto,sans-serif;font-size:.75rem;font-style:normal;line-height:1.2;text-align:center;width:1.25em;height:1.25em;letter-spacing:-.25ex;text-indent:-.25ex}.doc .conum[data-value]:after{content:attr(data-value)}.doc .conum[data-value]+b{display:none}.doc hr{border:solid #e1e1e1;border-width:2px 0 0;height:0}.doc b.button{white-space:nowrap}.doc b.button:before{content:"[";padding-right:.25em}.doc b.button:after{content:"]";padding-left:.25em}.doc kbd{display:inline-block;font-size:.66667rem;background:#fafafa;border:1px solid #c1c1c1;border-radius:.25em;-webkit-box-shadow:0 1px 0 #c1c1c1,0 0 0 .1em #fff inset;box-shadow:0 1px #c1c1c1,inset 0 0 0 .1em #fff;padding:.25em .5em;vertical-align:text-bottom;white-space:nowrap}.doc .keyseq,.doc kbd{line-height:1}.doc .keyseq{font-size:.88889rem}.doc .keyseq kbd{margin:0 .125em}.doc .keyseq kbd:first-child{margin-left:0}.doc .keyseq kbd:last-child{margin-right:0}.doc .menuseq,.doc .path{-ms-hyphens:none;hyphens:none}.doc .menuseq i.caret:before{content:"›";font-size:1.1em;font-weight:600;line-height:.90909}.doc :not(pre).nowrap{white-space:nowrap}.doc .nobreak{-ms-hyphens:none;hyphens:none;word-wrap:normal}.doc :not(pre).pre-wrap{white-space:pre-wrap}#footnotes{font-size:.85em;line-height:1.5;margin:2rem -.5rem 0}.doc td.tableblock>.content #footnotes{margin:2rem 0 0}#footnotes hr{border-top-width:1px;margin-top:0;width:20%}#footnotes .footnote{margin:.5em 0 0 1em}#footnotes .footnote+.footnote{margin-top:.25em}#footnotes .footnote>a:first-of-type{display:inline-block;margin-left:-2em;text-align:right;width:1.5em}.toc-menu{color:#5d5d5d}.toc.sidebar .toc-menu{margin-right:.75rem;position:sticky;top:6rem}.toc .toc-menu h3{color:#333;font-size:.88889rem;font-weight:600;line-height:1.3;margin:0 -.5px;padding-bottom:.25rem}.toc.sidebar .toc-menu h3{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;height:2.5rem;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}.toc .toc-menu ul{font-size:.83333rem;line-height:1.2;list-style:none;margin:0;padding:0}.toc.sidebar .toc-menu ul{max-height:calc(100vh - 8.5rem);overflow-y:auto;-ms-scroll-chaining:none;overscroll-behavior:none}@supports (scrollbar-width: none){.toc.sidebar .toc-menu ul{scrollbar-width:none}}.toc .toc-menu ul::-webkit-scrollbar{width:0;height:0}@media screen and (min-width: 1024px){.toc .toc-menu h3{font-size:.83333rem}.toc .toc-menu ul{font-size:.75rem}}.toc .toc-menu li{margin:0}.toc .toc-menu li[data-level="2"] a{padding-left:1.25rem}.toc .toc-menu li[data-level="3"] a{padding-left:2rem}.toc .toc-menu a{color:inherit;border-left:2px solid #e1e1e1;display:inline-block;padding:.25rem 0 .25rem .5rem;text-decoration:none}.sidebar.toc .toc-menu a{display:block;outline:none}.toc .toc-menu a:hover{color:#1565c0}.toc .toc-menu a.is-active{border-left-color:#2a7ee4;color:#2a7ee4}.sidebar.toc .toc-menu a:focus{background:#fafafa}.toc .toc-menu .is-hidden-toc{display:none!important}.contentSidebar{min-width:160px}.doc .videoblock .content{position:relative;width:100%;max-width:100%}.doc .videoblock .content:before{content:"";display:block;padding-top:56.25%}.doc .videoblock .content>iframe,.doc .videoblock .content>video{position:absolute;inset:0;width:100%!important;height:100%!important;border:0;background:#000;display:block}
|