tempest-express-sdk 0.21.0 → 0.23.0
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/README.md +2 -2
- package/dist/{chunk-E3CJPTYY.js → chunk-HC3TIN4M.js} +35 -5
- package/dist/chunk-HC3TIN4M.js.map +1 -0
- package/dist/cli.cjs +32 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +193 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +138 -36
- package/dist/index.d.ts +138 -36
- package/dist/index.js +159 -68
- package/dist/index.js.map +1 -1
- package/package.json +11 -5
- package/dist/chunk-E3CJPTYY.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { z, toDict } from './chunk-
|
|
2
|
-
export { PasswordUtils, VERSION, baseAppSettingsSchema, baseAppSettingsShape, baseResponseSchema, corsSettingsShape, databaseSettingsShape, loadSettings, serverSettingsShape, toDict, z } from './chunk-
|
|
1
|
+
import { z, looseBoolean, toDict } from './chunk-HC3TIN4M.js';
|
|
2
|
+
export { PasswordUtils, VERSION, baseAppSettingsSchema, baseAppSettingsShape, baseResponseSchema, centsField, corsSettingsShape, databaseSettingsShape, looseBoolean as envBoolean, hexColorField, latitudeField, loadSettings, longitudeField, looseBoolean, nonEmptyStrField, nonNegativeFloatField, nonNegativeIntField, percentField, portField, positiveFloatField, positiveIntField, priceField, ratingField, ratioField, serverSettingsShape, slugField, toDict, z } from './chunk-HC3TIN4M.js';
|
|
3
3
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
4
4
|
import { Model, column, sql, BaseRepository, RecordNotFound, detectDialect, NodeSqliteDriver, AsyncEngine } from 'tempest-db-js';
|
|
5
5
|
export { AsyncEngine, AsyncResult, AsyncSession, BaseRepository, Column, DeleteBuilder, InsertBuilder, Model, NoResultError, NodeSqliteDriver, PostgresDialect, RecordNotFound, SelectBuilder, SqliteDialect, SyncEngine, SyncSession, UpdateBuilder, and, belongsTo, column, columnsOf, createEngine, createSyncEngine, del, detectDialect, getDialect, hasMany, insert, join, loadRelations, not, or, parseDatabaseUrl, select, sql, update } from 'tempest-db-js';
|
|
@@ -14,6 +14,7 @@ import express2, { Router } from 'express';
|
|
|
14
14
|
import { ZodError } from 'zod';
|
|
15
15
|
import { OpenAPIRegistry, OpenApiGeneratorV31, OpenApiGeneratorV3 } from '@asteasolutions/zod-to-openapi';
|
|
16
16
|
export { OpenAPIRegistry } from '@asteasolutions/zod-to-openapi';
|
|
17
|
+
import { createRequire } from 'module';
|
|
17
18
|
import { getAbsoluteFSPath } from 'swagger-ui-dist';
|
|
18
19
|
import { reflectTable, renderOperation } from 'tempest-db-js/migrations';
|
|
19
20
|
|
|
@@ -286,7 +287,9 @@ var paginationFilterSchema = z.object({
|
|
|
286
287
|
page: z.coerce.number().int().min(1).default(1).openapi({ description: "The page number to retrieve (1-indexed)." }),
|
|
287
288
|
pageSize: z.coerce.number().int().min(1).default(20).openapi({ description: "The number of items per page." }),
|
|
288
289
|
orderBy: z.string().optional().openapi({ description: "Column to order by; defaults to repository default." }),
|
|
289
|
-
ascending:
|
|
290
|
+
ascending: looseBoolean(true).openapi({
|
|
291
|
+
description: "Whether to order results ascending."
|
|
292
|
+
})
|
|
290
293
|
});
|
|
291
294
|
var PAGINATION_KEYS = ["page", "pageSize", "orderBy", "ascending"];
|
|
292
295
|
function getConditions(filter, options = {}) {
|
|
@@ -316,7 +319,9 @@ var cursorPaginationFilterSchema = z.object({
|
|
|
316
319
|
cursor: z.string().optional().openapi({ description: "Opaque cursor; omit for the first page." }),
|
|
317
320
|
limit: z.coerce.number().int().min(1).max(500).default(20).openapi({ description: "Maximum number of items to return." }),
|
|
318
321
|
orderBy: z.string().default("createdAt").openapi({ description: "Column to sort by." }),
|
|
319
|
-
ascending:
|
|
322
|
+
ascending: looseBoolean(false).openapi({
|
|
323
|
+
description: "Whether to sort ascending (default newest first)."
|
|
324
|
+
})
|
|
320
325
|
});
|
|
321
326
|
function cursorPaginationSchema(item) {
|
|
322
327
|
return z.object({
|
|
@@ -343,29 +348,6 @@ function decodeCursor(cursor) {
|
|
|
343
348
|
return parsed;
|
|
344
349
|
}
|
|
345
350
|
|
|
346
|
-
// src/schemas/fields.ts
|
|
347
|
-
var positiveIntField = z.number().int().positive();
|
|
348
|
-
var nonNegativeIntField = z.number().int().min(0);
|
|
349
|
-
var centsField = z.number().int().min(0);
|
|
350
|
-
var portField = z.number().int().min(1).max(65535);
|
|
351
|
-
var ratingField = z.number().int().min(0).max(5);
|
|
352
|
-
var positiveFloatField = z.number().positive();
|
|
353
|
-
var nonNegativeFloatField = z.number().min(0);
|
|
354
|
-
var percentField = z.number().min(0).max(100);
|
|
355
|
-
var ratioField = z.number().min(0).max(1);
|
|
356
|
-
var latitudeField = z.number().min(-90).max(90);
|
|
357
|
-
var longitudeField = z.number().min(-180).max(180);
|
|
358
|
-
var nonEmptyStrField = z.string().transform((value) => value.trim()).pipe(z.string().min(1));
|
|
359
|
-
var slugField = z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, {
|
|
360
|
-
message: "Must be a lowercase hyphen-separated slug."
|
|
361
|
-
});
|
|
362
|
-
var hexColorField = z.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/, {
|
|
363
|
-
message: "Must be a #rgb or #rrggbb hex color."
|
|
364
|
-
});
|
|
365
|
-
var priceField = z.string().regex(/^\d+(?:\.\d{1,2})?$/, {
|
|
366
|
-
message: 'Must be a decimal money string, e.g. "19.90".'
|
|
367
|
-
});
|
|
368
|
-
|
|
369
351
|
// src/schemas/sync.ts
|
|
370
352
|
var syncFilterSchema = z.object({
|
|
371
353
|
since: z.coerce.date().optional().openapi({
|
|
@@ -375,7 +357,9 @@ var syncFilterSchema = z.object({
|
|
|
375
357
|
description: "Opaque cursor from the previous page; omit for the first."
|
|
376
358
|
}),
|
|
377
359
|
limit: z.coerce.number().int().min(1).max(1e3).default(100).openapi({ description: "Maximum number of items to return." }),
|
|
378
|
-
includeDeleted:
|
|
360
|
+
includeDeleted: looseBoolean(false).openapi({
|
|
361
|
+
description: "Whether soft-deleted rows are included in the delta."
|
|
362
|
+
})
|
|
379
363
|
});
|
|
380
364
|
function syncPaginationSchema(item) {
|
|
381
365
|
return z.object({
|
|
@@ -428,12 +412,6 @@ var logEntrySchema = z.object({
|
|
|
428
412
|
}).loose();
|
|
429
413
|
|
|
430
414
|
// src/settings/mixins.ts
|
|
431
|
-
function envBoolean(defaultValue) {
|
|
432
|
-
return z.union([z.boolean(), z.string()]).default(defaultValue).transform((value) => {
|
|
433
|
-
if (typeof value === "boolean") return value;
|
|
434
|
-
return ["true", "1", "yes", "on"].includes(value.trim().toLowerCase());
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
415
|
function envList(defaultValue = "") {
|
|
438
416
|
return z.string().default(defaultValue).transform(
|
|
439
417
|
(value) => value.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0)
|
|
@@ -441,7 +419,7 @@ function envList(defaultValue = "") {
|
|
|
441
419
|
}
|
|
442
420
|
var logSettingsShape = {
|
|
443
421
|
LOG_LEVEL: z.enum(["DEBUG", "INFO", "WARNING", "ERROR"]).default("INFO"),
|
|
444
|
-
LOG_JSON:
|
|
422
|
+
LOG_JSON: looseBoolean(true),
|
|
445
423
|
LOG_DIR: z.string().default("logs")
|
|
446
424
|
};
|
|
447
425
|
var redisSettingsShape = {
|
|
@@ -467,8 +445,8 @@ var emailSettingsShape = {
|
|
|
467
445
|
SMTP_USERNAME: z.string().optional(),
|
|
468
446
|
SMTP_PASSWORD: z.string().optional(),
|
|
469
447
|
SMTP_FROM_ADDR: z.string().default("noreply@example.com"),
|
|
470
|
-
SMTP_USE_TLS:
|
|
471
|
-
SMTP_USE_SSL:
|
|
448
|
+
SMTP_USE_TLS: looseBoolean(true),
|
|
449
|
+
SMTP_USE_SSL: looseBoolean(false),
|
|
472
450
|
SMTP_TIMEOUT_SECONDS: z.coerce.number().min(0).default(30)
|
|
473
451
|
};
|
|
474
452
|
var uploadSettingsShape = {
|
|
@@ -481,7 +459,7 @@ var minioSettingsShape = {
|
|
|
481
459
|
MINIO_ENDPOINT: z.string().default("localhost:9000"),
|
|
482
460
|
MINIO_ACCESS_KEY: z.string().default("minioadmin"),
|
|
483
461
|
MINIO_SECRET_KEY: z.string().default("minioadmin"),
|
|
484
|
-
MINIO_SECURE:
|
|
462
|
+
MINIO_SECURE: looseBoolean(false),
|
|
485
463
|
MINIO_REGION: z.string().default("us-east-1"),
|
|
486
464
|
MINIO_DEFAULT_BUCKET: z.string().default("uploads"),
|
|
487
465
|
MINIO_PUBLIC_ENDPOINT: z.string().optional(),
|
|
@@ -497,14 +475,14 @@ var webPushSettingsShape = {
|
|
|
497
475
|
};
|
|
498
476
|
var sessionSettingsShape = {
|
|
499
477
|
SESSION_TTL_SECONDS: z.coerce.number().int().min(1).default(86400),
|
|
500
|
-
SESSION_SLIDING:
|
|
478
|
+
SESSION_SLIDING: looseBoolean(true),
|
|
501
479
|
SESSION_COOKIE_NAME: z.string().default("tempest_session"),
|
|
502
480
|
SESSION_COOKIE_DOMAIN: z.string().optional(),
|
|
503
481
|
SESSION_COOKIE_PATH: z.string().default("/"),
|
|
504
|
-
SESSION_COOKIE_SECURE:
|
|
505
|
-
SESSION_COOKIE_HTTPONLY:
|
|
482
|
+
SESSION_COOKIE_SECURE: looseBoolean(true),
|
|
483
|
+
SESSION_COOKIE_HTTPONLY: looseBoolean(true),
|
|
506
484
|
SESSION_COOKIE_SAMESITE: z.enum(["lax", "strict", "none"]).default("lax"),
|
|
507
|
-
SESSION_ROTATE_ON_LOGIN:
|
|
485
|
+
SESSION_ROTATE_ON_LOGIN: looseBoolean(true)
|
|
508
486
|
};
|
|
509
487
|
var webSocketSettingsShape = {
|
|
510
488
|
WS_HEARTBEAT_SECONDS: z.coerce.number().int().min(1).default(30),
|
|
@@ -513,22 +491,22 @@ var webSocketSettingsShape = {
|
|
|
513
491
|
WS_MAX_MESSAGE_BYTES: z.coerce.number().int().min(1).default(64 * 1024)
|
|
514
492
|
};
|
|
515
493
|
var authSettingsShape = {
|
|
516
|
-
AUTH_AUTO_ACTIVATE:
|
|
517
|
-
AUTH_RETURN_TOKEN_IN_RESPONSE:
|
|
494
|
+
AUTH_AUTO_ACTIVATE: looseBoolean(false),
|
|
495
|
+
AUTH_RETURN_TOKEN_IN_RESPONSE: looseBoolean(false),
|
|
518
496
|
AUTH_ACTIVATION_TTL_SECONDS: z.coerce.number().int().min(1).default(86400 * 7),
|
|
519
497
|
AUTH_PASSWORD_RESET_TTL_SECONDS: z.coerce.number().int().min(1).default(3600),
|
|
520
498
|
AUTH_ACTIVATION_URL_TEMPLATE: z.string().default("http://localhost:3000/activate?token={token}"),
|
|
521
499
|
AUTH_PASSWORD_RESET_URL_TEMPLATE: z.string().default("http://localhost:3000/reset-password?token={token}"),
|
|
522
500
|
AUTH_PASSWORD_MIN_LENGTH: z.coerce.number().int().min(1).default(12),
|
|
523
|
-
AUTH_PASSWORD_REQUIRE_COMPLEXITY:
|
|
501
|
+
AUTH_PASSWORD_REQUIRE_COMPLEXITY: looseBoolean(false),
|
|
524
502
|
AUTH_DEFAULT_LOCALE: z.string().default("pt-BR"),
|
|
525
|
-
AUTH_MFA_ENABLED:
|
|
503
|
+
AUTH_MFA_ENABLED: looseBoolean(false),
|
|
526
504
|
AUTH_MFA_ISSUER: z.string().default("Tempest"),
|
|
527
505
|
AUTH_MFA_RECOVERY_CODES_COUNT: z.coerce.number().int().min(0).default(10),
|
|
528
506
|
AUTH_MFA_TOKEN_TTL_SECONDS: z.coerce.number().int().min(1).default(300),
|
|
529
507
|
AUTH_MFA_VERIFY_WINDOW: z.coerce.number().int().min(0).default(1),
|
|
530
508
|
AUTH_TOKEN_DELIVERY: z.enum(["bearer", "cookie", "both"]).default("bearer"),
|
|
531
|
-
AUTH_COOKIE_SECURE:
|
|
509
|
+
AUTH_COOKIE_SECURE: looseBoolean(true),
|
|
532
510
|
AUTH_COOKIE_SAMESITE: z.enum(["lax", "strict", "none"]).default("lax"),
|
|
533
511
|
AUTH_COOKIE_DOMAIN: z.string().optional(),
|
|
534
512
|
AUTH_ACCESS_COOKIE_NAME: z.string().default("access_token"),
|
|
@@ -7579,7 +7557,6 @@ var HTTPClient = class {
|
|
|
7579
7557
|
this.breakerRecord(host, true);
|
|
7580
7558
|
if (attempt < this.retryPolicy.maxRetries) {
|
|
7581
7559
|
await this.sleep(this.retryPolicy.sleepFor(attempt));
|
|
7582
|
-
continue;
|
|
7583
7560
|
}
|
|
7584
7561
|
}
|
|
7585
7562
|
}
|
|
@@ -10138,64 +10115,178 @@ function generateOpenApiDocument(registry, options) {
|
|
|
10138
10115
|
const document = new Generator(registry.definitions).generateDocument(config);
|
|
10139
10116
|
return document;
|
|
10140
10117
|
}
|
|
10118
|
+
var DEFAULT_DOCS_FAVICON = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PHJlY3Qgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIiByeD0iNyIgZmlsbD0iIzRjNmVmNSIvPjxwYXRoIGQ9Ik0xNy45IDQuNSA4LjYgMTguNGg1LjJMMTMgMjcuNWw5LjQtMTMuOWgtNS4zeiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==";
|
|
10119
|
+
var REDOC_CDN_URL = "https://cdn.jsdelivr.net/npm/redoc@2/bundles/redoc.standalone.js";
|
|
10120
|
+
var REDOC_BUNDLE_SPECIFIER = "redoc/bundles/redoc.standalone.js";
|
|
10121
|
+
function escapeHtml(value) {
|
|
10122
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
10123
|
+
}
|
|
10124
|
+
function scriptLiteral(value) {
|
|
10125
|
+
return JSON.stringify(value).replace(/</g, "\\u003c");
|
|
10126
|
+
}
|
|
10127
|
+
function faviconTag(favicon) {
|
|
10128
|
+
if (favicon === false) return "";
|
|
10129
|
+
return `
|
|
10130
|
+
<link rel="icon" href="${escapeHtml(favicon)}" />`;
|
|
10131
|
+
}
|
|
10141
10132
|
function mountOpenApiJson(app, path, document) {
|
|
10142
10133
|
app.get(path, (_req, res) => {
|
|
10143
10134
|
res.json(document);
|
|
10144
10135
|
});
|
|
10145
10136
|
}
|
|
10146
|
-
|
|
10137
|
+
var SWAGGER_UI_DEFAULTS = Object.freeze({
|
|
10138
|
+
deepLinking: true,
|
|
10139
|
+
persistAuthorization: true,
|
|
10140
|
+
layout: "BaseLayout"
|
|
10141
|
+
});
|
|
10142
|
+
function assertSerializableUiOptions(options, trail = []) {
|
|
10143
|
+
if (typeof options === "function") {
|
|
10144
|
+
throw new Error(
|
|
10145
|
+
[
|
|
10146
|
+
`mountSwaggerUi: \`ui.${trail.join(".")}\` is a function, and the options are`,
|
|
10147
|
+
"serialized as JSON into the page, so it would be dropped silently. Swagger UI",
|
|
10148
|
+
"options that take a callback have to be wired in the browser."
|
|
10149
|
+
].join(" ")
|
|
10150
|
+
);
|
|
10151
|
+
}
|
|
10152
|
+
if (Array.isArray(options)) {
|
|
10153
|
+
options.forEach(
|
|
10154
|
+
(entry, index) => assertSerializableUiOptions(entry, [...trail, String(index)])
|
|
10155
|
+
);
|
|
10156
|
+
return;
|
|
10157
|
+
}
|
|
10158
|
+
if (typeof options === "object" && options !== null) {
|
|
10159
|
+
for (const [key, value] of Object.entries(options)) {
|
|
10160
|
+
assertSerializableUiOptions(value, [...trail, key]);
|
|
10161
|
+
}
|
|
10162
|
+
}
|
|
10163
|
+
}
|
|
10164
|
+
function swaggerHtml(options) {
|
|
10165
|
+
const { specUrl, title, assetsBase, favicon, ui } = options;
|
|
10166
|
+
const merged = {
|
|
10167
|
+
url: specUrl,
|
|
10168
|
+
dom_id: "#swagger-ui",
|
|
10169
|
+
...SWAGGER_UI_DEFAULTS,
|
|
10170
|
+
...ui
|
|
10171
|
+
};
|
|
10172
|
+
const standalone = merged.layout === "StandaloneLayout";
|
|
10173
|
+
const presetScript = standalone ? `
|
|
10174
|
+
<script src="${escapeHtml(assetsBase)}/swagger-ui-standalone-preset.js"></script>` : "";
|
|
10175
|
+
const presets = standalone ? "[SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset]" : "[SwaggerUIBundle.presets.apis]";
|
|
10147
10176
|
return `<!doctype html>
|
|
10148
10177
|
<html lang="en">
|
|
10149
10178
|
<head>
|
|
10150
10179
|
<meta charset="utf-8" />
|
|
10151
10180
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
10152
|
-
<title>${title}</title
|
|
10153
|
-
<link rel="stylesheet" href="${assetsBase}/swagger-ui.css" />
|
|
10181
|
+
<title>${escapeHtml(title)}</title>${faviconTag(favicon)}
|
|
10182
|
+
<link rel="stylesheet" href="${escapeHtml(assetsBase)}/swagger-ui.css" />
|
|
10154
10183
|
</head>
|
|
10155
10184
|
<body>
|
|
10156
10185
|
<div id="swagger-ui"></div>
|
|
10157
|
-
<script src="${assetsBase}/swagger-ui-bundle.js"></script
|
|
10158
|
-
<script src="${assetsBase}/swagger-ui-standalone-preset.js"></script>
|
|
10186
|
+
<script src="${escapeHtml(assetsBase)}/swagger-ui-bundle.js"></script>${presetScript}
|
|
10159
10187
|
<script>
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],
|
|
10164
|
-
layout: "StandaloneLayout",
|
|
10165
|
-
});
|
|
10188
|
+
var options = ${scriptLiteral(merged)};
|
|
10189
|
+
options.presets = ${presets};
|
|
10190
|
+
window.ui = SwaggerUIBundle(options);
|
|
10166
10191
|
</script>
|
|
10167
10192
|
</body>
|
|
10168
10193
|
</html>`;
|
|
10169
10194
|
}
|
|
10170
10195
|
function mountSwaggerUi(app, path, specUrl, options = {}) {
|
|
10171
10196
|
const title = options.title ?? "API docs";
|
|
10197
|
+
const favicon = options.favicon ?? DEFAULT_DOCS_FAVICON;
|
|
10198
|
+
const ui = options.ui ?? {};
|
|
10199
|
+
assertSerializableUiOptions(ui);
|
|
10172
10200
|
const assetsPath = `${path.replace(/\/$/, "")}/assets`;
|
|
10173
10201
|
app.use(assetsPath, express2.static(getAbsoluteFSPath()));
|
|
10174
10202
|
const handler = (_req, res) => {
|
|
10175
|
-
res.type("html").send(swaggerHtml(specUrl, title, assetsPath));
|
|
10203
|
+
res.type("html").send(swaggerHtml({ specUrl, title, assetsBase: assetsPath, favicon, ui }));
|
|
10176
10204
|
};
|
|
10177
10205
|
app.get(path, handler);
|
|
10178
10206
|
}
|
|
10179
|
-
function
|
|
10207
|
+
function resolveRedocBundle() {
|
|
10208
|
+
try {
|
|
10209
|
+
const requireFrom = createRequire(join(process.cwd(), "package.json"));
|
|
10210
|
+
return requireFrom.resolve(REDOC_BUNDLE_SPECIFIER);
|
|
10211
|
+
} catch {
|
|
10212
|
+
return null;
|
|
10213
|
+
}
|
|
10214
|
+
}
|
|
10215
|
+
function redocHtml(specUrl, title, scriptUrl, favicon) {
|
|
10180
10216
|
return `<!doctype html>
|
|
10181
10217
|
<html lang="en">
|
|
10182
10218
|
<head>
|
|
10183
10219
|
<meta charset="utf-8" />
|
|
10184
10220
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
10185
|
-
<title>${title}</title
|
|
10186
|
-
<style>
|
|
10221
|
+
<title>${escapeHtml(title)}</title>${faviconTag(favicon)}
|
|
10222
|
+
<style>
|
|
10223
|
+
body { margin: 0; padding: 0; }
|
|
10224
|
+
#redoc-load-error {
|
|
10225
|
+
display: none;
|
|
10226
|
+
font: 14px/1.6 system-ui, sans-serif;
|
|
10227
|
+
margin: 3rem auto;
|
|
10228
|
+
max-width: 40rem;
|
|
10229
|
+
padding: 0 1rem;
|
|
10230
|
+
}
|
|
10231
|
+
#redoc-load-error code {
|
|
10232
|
+
background: #f1f3f5;
|
|
10233
|
+
border-radius: 3px;
|
|
10234
|
+
padding: 0.1rem 0.3rem;
|
|
10235
|
+
}
|
|
10236
|
+
</style>
|
|
10187
10237
|
</head>
|
|
10188
10238
|
<body>
|
|
10189
|
-
<redoc
|
|
10190
|
-
|
|
10239
|
+
<div id="redoc-load-error">
|
|
10240
|
+
<h1>The API reference could not load</h1>
|
|
10241
|
+
<p>
|
|
10242
|
+
The Redoc renderer was requested from
|
|
10243
|
+
<code id="redoc-script-url"></code> and did not load. The OpenAPI
|
|
10244
|
+
document itself is fine \u2014 it is served at
|
|
10245
|
+
<code id="redoc-spec-url"></code>.
|
|
10246
|
+
</p>
|
|
10247
|
+
<p>
|
|
10248
|
+
On a closed network, install the renderer next to the service
|
|
10249
|
+
(<code>npm install redoc</code>) so it is served locally, or point
|
|
10250
|
+
<code>scriptUrl</code> at a copy you host.
|
|
10251
|
+
</p>
|
|
10252
|
+
</div>
|
|
10253
|
+
<redoc spec-url="${escapeHtml(specUrl)}"></redoc>
|
|
10254
|
+
<script>
|
|
10255
|
+
window.__redocLoadFailed = function () {
|
|
10256
|
+
document.getElementById("redoc-script-url").textContent = ${scriptLiteral(scriptUrl)};
|
|
10257
|
+
document.getElementById("redoc-spec-url").textContent = ${scriptLiteral(specUrl)};
|
|
10258
|
+
document.getElementById("redoc-load-error").style.display = "block";
|
|
10259
|
+
var element = document.querySelector("redoc");
|
|
10260
|
+
if (element) element.style.display = "none";
|
|
10261
|
+
};
|
|
10262
|
+
</script>
|
|
10263
|
+
<script src="${escapeHtml(scriptUrl)}" onerror="window.__redocLoadFailed()"></script>
|
|
10191
10264
|
</body>
|
|
10192
10265
|
</html>`;
|
|
10193
10266
|
}
|
|
10194
10267
|
function mountRedoc(app, path, specUrl, options = {}) {
|
|
10195
10268
|
const title = options.title ?? "API reference";
|
|
10196
|
-
const
|
|
10269
|
+
const favicon = options.favicon ?? DEFAULT_DOCS_FAVICON;
|
|
10270
|
+
const source = options.bundle ?? "auto";
|
|
10271
|
+
const assetsPath = `${path.replace(/\/$/, "")}/assets`;
|
|
10272
|
+
const bundleRoute = `${assetsPath}/redoc.standalone.js`;
|
|
10273
|
+
let scriptUrl = options.scriptUrl;
|
|
10274
|
+
if (scriptUrl === void 0 && source !== "cdn") {
|
|
10275
|
+
const bundlePath = options.bundlePath ?? resolveRedocBundle();
|
|
10276
|
+
if (bundlePath !== null && bundlePath !== void 0) {
|
|
10277
|
+
app.get(bundleRoute, (_req, res) => {
|
|
10278
|
+
res.sendFile(bundlePath);
|
|
10279
|
+
});
|
|
10280
|
+
scriptUrl = bundleRoute;
|
|
10281
|
+
} else if (source === "local") {
|
|
10282
|
+
throw new Error(
|
|
10283
|
+
'mountRedoc: bundle "local" requires the `redoc` package. Install it (`npm install redoc`) or pass `bundlePath` with an absolute path to a Redoc standalone bundle.'
|
|
10284
|
+
);
|
|
10285
|
+
}
|
|
10286
|
+
}
|
|
10287
|
+
const resolvedScriptUrl = scriptUrl ?? REDOC_CDN_URL;
|
|
10197
10288
|
app.get(path, (_req, res) => {
|
|
10198
|
-
res.type("html").send(redocHtml(specUrl, title,
|
|
10289
|
+
res.type("html").send(redocHtml(specUrl, title, resolvedScriptUrl, favicon));
|
|
10199
10290
|
});
|
|
10200
10291
|
}
|
|
10201
10292
|
function makeHealthRouter(options = {}) {
|
|
@@ -11224,6 +11315,6 @@ async function withTestDatabase(models, fn) {
|
|
|
11224
11315
|
}
|
|
11225
11316
|
}
|
|
11226
11317
|
|
|
11227
|
-
export { ActivationService, AdminSite, AppException, AttemptThrottle, AuditAction, BaseAuditLogModel, BaseController, BaseModel, BaseOAuthClient, BaseOutboxModel, BaseService, BaseUserModel, BaseUserRefreshTokenModel, BaseUserTokenModel, CEP_PATTERN, CNPJ_PATTERN, CPF_PATTERN, CSRF_COOKIE_NAME, CSRF_HEADER_NAME, CircuitOpenError, CompositeFeatureFlagBackend, ConflictException, DEFAULT_LOCALE, EmailProvider, EmailUtils, EnvFeatureFlagBackend, EventStream, ExpiredTokenException, FeatureFlags, ForbiddenException, GitHubOAuthClient, GoogleOAuthClient, GracefulShutdown, HTTPClient, HTTP_500_LOG_FILE, HTTP_500_MARKER, HttpMetrics, IDEMPOTENCY_HEADER, InvalidTokenException, JSONLogger, JWTUtils, LEVEL_LOG_FILES, LocalUploadStorage, MemoryBroker, MemoryCacheManager, MemoryFeatureFlagBackend, MemoryIdempotencyStore, MemoryRateLimitStore, MemorySessionStore, MemoryThrottleBackend, MessageCatalog, MessagingHub, MetricsUtils, MfaService, NotFoundException, OAuthError, OIDCProvider, OutboxRelay, OutboxStatus, PHONE_BR_PATTERN, PasswordResetService, REQUEST_ID_HEADER, RabbitBroker, RedisCacheManager, RedisIdempotencyStore, RedisRateLimitStore, RedisSSEBroker, RedisSessionStore, Region, RetryPolicy, S3UploadStorage, SSEBroker, ServerSentEvent, SessionService, TOTPHelper, TaskManager, TelegramProvider, TenantScopedRepository, TooManyRequestsException, TwilioSmsProvider, UF, UnauthorizedException, UserAuthService, UserTokenPurpose, ValidationException, WebPushDispatcher, WebPushError, WebPushGoneError, WebSocketHub, WebhookSignatureVerifier, WhatsAppProvider, activationSchema, addLogSink, attachWebSocketHub, authResponseSchema, authSettingsShape, backupDatabase, bearerToken, bodySizeLimitMiddleware, broadcastText, buildContentDisposition, buildPaginationLinkHeader, cached2 as cached,
|
|
11318
|
+
export { ActivationService, AdminSite, AppException, AttemptThrottle, AuditAction, BaseAuditLogModel, BaseController, BaseModel, BaseOAuthClient, BaseOutboxModel, BaseService, BaseUserModel, BaseUserRefreshTokenModel, BaseUserTokenModel, CEP_PATTERN, CNPJ_PATTERN, CPF_PATTERN, CSRF_COOKIE_NAME, CSRF_HEADER_NAME, CircuitOpenError, CompositeFeatureFlagBackend, ConflictException, DEFAULT_DOCS_FAVICON, DEFAULT_LOCALE, EmailProvider, EmailUtils, EnvFeatureFlagBackend, EventStream, ExpiredTokenException, FeatureFlags, ForbiddenException, GitHubOAuthClient, GoogleOAuthClient, GracefulShutdown, HTTPClient, HTTP_500_LOG_FILE, HTTP_500_MARKER, HttpMetrics, IDEMPOTENCY_HEADER, InvalidTokenException, JSONLogger, JWTUtils, LEVEL_LOG_FILES, LocalUploadStorage, MemoryBroker, MemoryCacheManager, MemoryFeatureFlagBackend, MemoryIdempotencyStore, MemoryRateLimitStore, MemorySessionStore, MemoryThrottleBackend, MessageCatalog, MessagingHub, MetricsUtils, MfaService, NotFoundException, OAuthError, OIDCProvider, OutboxRelay, OutboxStatus, PHONE_BR_PATTERN, PasswordResetService, REDOC_CDN_URL, REQUEST_ID_HEADER, RabbitBroker, RedisCacheManager, RedisIdempotencyStore, RedisRateLimitStore, RedisSSEBroker, RedisSessionStore, Region, RetryPolicy, S3UploadStorage, SSEBroker, ServerSentEvent, SessionService, TOTPHelper, TaskManager, TelegramProvider, TenantScopedRepository, TooManyRequestsException, TwilioSmsProvider, UF, UnauthorizedException, UserAuthService, UserTokenPurpose, ValidationException, WebPushDispatcher, WebPushError, WebPushGoneError, WebSocketHub, WebhookSignatureVerifier, WhatsAppProvider, activationSchema, addLogSink, attachWebSocketHub, authResponseSchema, authSettingsShape, backupDatabase, bearerToken, bodySizeLimitMiddleware, broadcastText, buildContentDisposition, buildPaginationLinkHeader, cached2 as cached, cepField, citiesByUf, cnpjField, coerceFlag, configureFileLogging, configureLogging, cpfField, cpfOrCnpjField, createApp, createOpenApiRegistry, createTestDatabase, createdByColumn, csrfMiddleware, cursorPaginationFilterSchema, cursorPaginationSchema, decodeCursor, defaultMessageCatalog, defineEnum, deletedAtColumn, diffSnapshots, emailSettingsShape, encodeCursor, envList, generateCsrfToken, generateOAuthState, generateOpaqueToken, generateOpenApiDocument, getAuth, getClientIp, getConditions, getPaginationConditions, getRequestId, getState, hashOpaqueToken, idempotencyMiddleware, inboundMessageSchema, isValidCep, isValidCity, isValidCnpj, isValidCpf, isValidCpfCnpj, isValidPhoneBr, isValidUf, jwtSettingsShape, keyByHeader, keyByIp, keyByJwtClaim, keyByJwtSubject, listStates, logEntrySchema, logSettingsShape, loginSchema, makeAdminRouter, makeAppExceptionHandler, makeAuthRouter, makeFlagGuard, makeHealthRouter, makeJwtAuthMiddleware, makeLogsRouter, makeMetricsRouter, makeSessionMiddleware, makeToolSpecRouter, makeTwilioWebhookRouter, makeUnhandledExceptionHandler, makeWhatsAppWebhookRouter, mfaChallengeSchema, mfaCodeSchema, mfaEnrollResponseSchema, minioSettingsShape, modifyDict, mountOpenApiJson, mountRedoc, mountSwaggerUi, normalizeCep, normalizeCnpj, normalizeCpf, normalizeCpfCnpj, normalizePhoneBr, normalizeUf, notFoundHandler, onlyDigits, paginationFilterSchema, paginationSchema, parseAcceptLanguage, parseCookies, passwordResetConfirmSchema, passwordResetRequestSchema, phoneBrField, prometheusMiddleware, rabbitmqSettingsShape, rateLimitMiddleware, redisSettingsShape, refreshSchema, registerExceptionHandlers, renderAuthResultPage, renderPasswordResetFormPage, requestIdMiddleware, requestTracingMiddleware, requireRoles, resolveDownloadPath, resolveRedocBundle, runServer, runWithRequestContext, sendBytesDownload, sendFileDownload, sessionCookie, sessionSettingsShape, setRequestId, signupSchema, snapshot, sseResponse, statesByRegion, syncFilterSchema, syncPaginationSchema, tableNameFor, toUtc, tokenFromUrl, tokenPairSchema, tokenSettingsShape, ufField, updatedByColumn, uploadSettingsShape, userPublicSchema, utcnow, validateTwilioSignature, verifyOpaqueToken, webPushKeysSchema, webPushPayloadSchema, webPushSettingsShape, webPushSubscriptionSchema, webSocketSettingsShape, withTestDatabase, wrapWithSlowQueryLog, wsEnvelopeSchema };
|
|
11228
11319
|
//# sourceMappingURL=index.js.map
|
|
11229
11320
|
//# sourceMappingURL=index.js.map
|