nextly 0.0.1 → 0.0.2-alpha.1
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/LICENSE +22 -0
- package/README.md +122 -0
- package/dist/_dts-chunks/collections-handler.d-DjgO74Wt.d.ts +20540 -0
- package/dist/_dts-chunks/config.d-DNwsDnjs.d.ts +2589 -0
- package/dist/_dts-chunks/define-component.d-BUgTHmt3.d.ts +1149 -0
- package/dist/_dts-chunks/image-processor.d-OO1PmMrv.d.ts +335 -0
- package/dist/_dts-chunks/index.d-axCAzZ7m.d.ts +17842 -0
- package/dist/_dts-chunks/media.d-DjDOZo4B.d.ts +117 -0
- package/dist/_dts-chunks/on-error.d-CHIKWNxd.d.ts +38 -0
- package/dist/_dts-chunks/storage.d-BUhQ2we_.d.ts +404 -0
- package/dist/actions/index.d.ts +239 -0
- package/dist/actions/index.mjs +281 -0
- package/dist/api/auth-state.d.ts +5 -0
- package/dist/api/auth-state.mjs +131 -0
- package/dist/api/collections-schema-detail.d.ts +56 -0
- package/dist/api/collections-schema-detail.mjs +244 -0
- package/dist/api/collections-schema-export.d.ts +56 -0
- package/dist/api/collections-schema-export.mjs +129 -0
- package/dist/api/collections-schema.d.ts +59 -0
- package/dist/api/collections-schema.mjs +207 -0
- package/dist/api/components-detail.d.ts +50 -0
- package/dist/api/components-detail.mjs +132 -0
- package/dist/api/components.d.ts +69 -0
- package/dist/api/components.mjs +144 -0
- package/dist/api/email-providers-default.d.ts +40 -0
- package/dist/api/email-providers-default.mjs +75 -0
- package/dist/api/email-providers-detail.d.ts +81 -0
- package/dist/api/email-providers-detail.mjs +109 -0
- package/dist/api/email-providers-test.d.ts +43 -0
- package/dist/api/email-providers-test.mjs +114 -0
- package/dist/api/email-providers.d.ts +69 -0
- package/dist/api/email-providers.mjs +110 -0
- package/dist/api/email-send-template.d.ts +41 -0
- package/dist/api/email-send-template.mjs +58 -0
- package/dist/api/email-send.d.ts +42 -0
- package/dist/api/email-send.mjs +58 -0
- package/dist/api/email-templates-detail.d.ts +74 -0
- package/dist/api/email-templates-detail.mjs +112 -0
- package/dist/api/email-templates-layout.d.ts +55 -0
- package/dist/api/email-templates-layout.mjs +92 -0
- package/dist/api/email-templates-preview.d.ts +48 -0
- package/dist/api/email-templates-preview.mjs +93 -0
- package/dist/api/email-templates.d.ts +61 -0
- package/dist/api/email-templates.mjs +118 -0
- package/dist/api/health.d.ts +68 -0
- package/dist/api/health.mjs +67 -0
- package/dist/api/index.d.ts +54 -0
- package/dist/api/index.mjs +16 -0
- package/dist/api/media-bulk.d.ts +74 -0
- package/dist/api/media-bulk.mjs +196 -0
- package/dist/api/media-folders.d.ts +112 -0
- package/dist/api/media-folders.mjs +187 -0
- package/dist/api/media-handlers.d.ts +102 -0
- package/dist/api/media-handlers.mjs +437 -0
- package/dist/api/media.d.ts +117 -0
- package/dist/api/media.mjs +242 -0
- package/dist/api/singles-detail.d.ts +87 -0
- package/dist/api/singles-detail.mjs +170 -0
- package/dist/api/singles-schema-detail.d.ts +54 -0
- package/dist/api/singles-schema-detail.mjs +182 -0
- package/dist/api/singles.d.ts +34 -0
- package/dist/api/singles.mjs +94 -0
- package/dist/api/storage-upload-url.d.ts +48 -0
- package/dist/api/storage-upload-url.mjs +202 -0
- package/dist/api/uploads.d.ts +109 -0
- package/dist/api/uploads.mjs +359 -0
- package/dist/auth/index.d.ts +425 -0
- package/dist/auth/index.mjs +199 -0
- package/dist/boot-apply-PQSYLDIN.mjs +7 -0
- package/dist/chunk-2OALJTK6.mjs +489 -0
- package/dist/chunk-2Q2SX2CS.mjs +365 -0
- package/dist/chunk-2TFX4ND3.mjs +13 -0
- package/dist/chunk-2TWPDSYD.mjs +87 -0
- package/dist/chunk-2W3DVD7S.mjs +647 -0
- package/dist/chunk-2ZFKXPQM.mjs +88 -0
- package/dist/chunk-3FA7FKAV.mjs +832 -0
- package/dist/chunk-3NZ2KMBL.mjs +58 -0
- package/dist/chunk-4MJLT6PZ.mjs +0 -0
- package/dist/chunk-56WO4WX7.mjs +0 -0
- package/dist/chunk-5APFUGAD.mjs +89 -0
- package/dist/chunk-5HMZ644B.mjs +108 -0
- package/dist/chunk-67GXH6PR.mjs +32 -0
- package/dist/chunk-6JNEPWRW.mjs +14368 -0
- package/dist/chunk-6NFHQIJD.mjs +45 -0
- package/dist/chunk-7P6ASYW6.mjs +9 -0
- package/dist/chunk-A3WPLSDT.mjs +1364 -0
- package/dist/chunk-AGJ6F2T3.mjs +144 -0
- package/dist/chunk-AK6Z23OX.mjs +1464 -0
- package/dist/chunk-APKKRD2G.mjs +102 -0
- package/dist/chunk-B2GV2BWH.mjs +73 -0
- package/dist/chunk-D5HQBNUB.mjs +74 -0
- package/dist/chunk-DNNG377Z.mjs +204 -0
- package/dist/chunk-DP3G27G5.mjs +135 -0
- package/dist/chunk-DV6WVX2Q.mjs +0 -0
- package/dist/chunk-DXGGXIUZ.mjs +57 -0
- package/dist/chunk-EGXBZCGC.mjs +943 -0
- package/dist/chunk-ERCNLX3V.mjs +176 -0
- package/dist/chunk-FQULBZ53.mjs +850 -0
- package/dist/chunk-G2AA4QLC.mjs +262 -0
- package/dist/chunk-GDBJ5JCU.mjs +488 -0
- package/dist/chunk-GJNSJU4S.mjs +19 -0
- package/dist/chunk-GZ6DCQKC.mjs +69 -0
- package/dist/chunk-H26B4FYG.mjs +167 -0
- package/dist/chunk-I4JMR3UR.mjs +21 -0
- package/dist/chunk-INV7QKLG.mjs +508 -0
- package/dist/chunk-IUDOC7N7.mjs +46 -0
- package/dist/chunk-IZWPRDC3.mjs +206 -0
- package/dist/chunk-KIMNCZGV.mjs +15 -0
- package/dist/chunk-L6HW2DA7.mjs +15 -0
- package/dist/chunk-LAZXX4HR.mjs +100 -0
- package/dist/chunk-LDKCUMHK.mjs +95 -0
- package/dist/chunk-LRXMECUA.mjs +0 -0
- package/dist/chunk-M52VMPGA.mjs +119 -0
- package/dist/chunk-MGUWEEI6.mjs +160 -0
- package/dist/chunk-NRUWQ5Z7.mjs +419 -0
- package/dist/chunk-NSEFNNU4.mjs +25360 -0
- package/dist/chunk-NTHVDFGO.mjs +138 -0
- package/dist/chunk-O3QHXMOX.mjs +3166 -0
- package/dist/chunk-P7NH2OSC.mjs +2605 -0
- package/dist/chunk-PKMABBB5.mjs +184 -0
- package/dist/chunk-PWS6XGJK.mjs +76 -0
- package/dist/chunk-R6JJQHFC.mjs +20 -0
- package/dist/chunk-RJLLGGPG.mjs +0 -0
- package/dist/chunk-SBACDPNX.mjs +689 -0
- package/dist/chunk-TO5AFLVQ.mjs +124 -0
- package/dist/chunk-TS7GHTG2.mjs +5436 -0
- package/dist/chunk-UJ2IMJ4W.mjs +133 -0
- package/dist/chunk-UOP63Q54.mjs +102 -0
- package/dist/chunk-UUOFWCM6.mjs +78 -0
- package/dist/chunk-V4EQTOA4.mjs +893 -0
- package/dist/chunk-VJ66NCL4.mjs +193 -0
- package/dist/chunk-VQJQHVEV.mjs +29 -0
- package/dist/chunk-VTJADRO3.mjs +141 -0
- package/dist/chunk-VWF3JO32.mjs +0 -0
- package/dist/chunk-W4MGXIRR.mjs +27 -0
- package/dist/chunk-W5KKPZT5.mjs +1204 -0
- package/dist/chunk-WD34YQ6T.mjs +381 -0
- package/dist/chunk-WZBYMYVW.mjs +14 -0
- package/dist/chunk-X23WKS3Z.mjs +50 -0
- package/dist/chunk-X7TXCYYN.mjs +6496 -0
- package/dist/chunk-XGI4EMS3.mjs +140 -0
- package/dist/chunk-XZKLBMN6.mjs +1153 -0
- package/dist/chunk-YB7INWPY.mjs +0 -0
- package/dist/chunk-YV4Y7SDL.mjs +83 -0
- package/dist/chunk-YZNBLFIW.mjs +1688 -0
- package/dist/chunk-YZZCTONM.mjs +263 -0
- package/dist/chunk-ZE6A3FYH.mjs +289 -0
- package/dist/cli/nextly.mjs +68 -0
- package/dist/cli/utils/index.d.ts +449 -0
- package/dist/cli/utils/index.mjs +49 -0
- package/dist/component-schema-service-5577KVW6.mjs +11 -0
- package/dist/config-loader-23YEMC3Z.mjs +23 -0
- package/dist/config.d.ts +44 -0
- package/dist/config.mjs +109 -0
- package/dist/container-ORGFGYSZ.mjs +9 -0
- package/dist/database/index.d.ts +12 -0
- package/dist/database/index.mjs +40 -0
- package/dist/database/seeders/index.d.ts +93 -0
- package/dist/database/seeders/index.mjs +47 -0
- package/dist/db-sync-demote-LJGKLB3S.mjs +117 -0
- package/dist/db-sync-promote-B26VSYQF.mjs +113 -0
- package/dist/dev-reload-broadcaster-B73IQ53V.mjs +25 -0
- package/dist/dist-M2NOU37V.mjs +19 -0
- package/dist/drizzle-kit-lazy-D2M2PXR2.mjs +13 -0
- package/dist/dynamic-collection-schema-service-IEXTPIZ7.mjs +8 -0
- package/dist/errors/index.d.ts +159 -0
- package/dist/errors/index.mjs +10 -0
- package/dist/factory-IWMBKUJM.mjs +15 -0
- package/dist/first-run-QIVKWJIF.mjs +63 -0
- package/dist/fresh-push-NR67DC3R.mjs +8 -0
- package/dist/index.d.ts +4175 -0
- package/dist/index.mjs +1336 -0
- package/dist/local-plugin-PTET4NAT.mjs +7 -0
- package/dist/logger-NU46DXNY.mjs +15 -0
- package/dist/logger-YE4TC7ZN.mjs +9 -0
- package/dist/migration-journal-EP532Y4L.mjs +139 -0
- package/dist/migrations/mysql/0000_eager_sentry.sql +174 -0
- package/dist/migrations/mysql/0001_soft_giant_girl.sql +27 -0
- package/dist/migrations/mysql/0002_media_table.sql +24 -0
- package/dist/migrations/mysql/0003_dynamic_singles.sql +37 -0
- package/dist/migrations/mysql/0004_dynamic_components.sql +35 -0
- package/dist/migrations/mysql/0005_user_management_tables.sql +92 -0
- package/dist/migrations/mysql/0006_api_keys.sql +36 -0
- package/dist/migrations/mysql/0007_general_settings.sql +20 -0
- package/dist/migrations/mysql/0008_site_settings_logo_url.sql +9 -0
- package/dist/migrations/mysql/0009_activity_log.sql +30 -0
- package/dist/migrations/mysql/0010_site_settings_sidebar.sql +13 -0
- package/dist/migrations/mysql/0011_missing_tables_and_columns.sql +54 -0
- package/dist/migrations/mysql/0012_image_sizes_and_focal_point.sql +30 -0
- package/dist/migrations/mysql/0012_media_folders.sql +43 -0
- package/dist/migrations/mysql/0013_user_brute_force_protection.sql +31 -0
- package/dist/migrations/mysql/0014_email_template_attachments.sql +12 -0
- package/dist/migrations/mysql/0015_media_uploaded_by_nullable.sql +15 -0
- package/dist/migrations/mysql/20260429_000000_000_initial_journal.sql +22 -0
- package/dist/migrations/mysql/20260501_000000_journal_batch.sql +17 -0
- package/dist/migrations/mysql/20260501_000001_audit_log.sql +24 -0
- package/dist/migrations/mysql/20260504_000000_nextly_meta.sql +21 -0
- package/dist/migrations/mysql/meta/0000_snapshot.json +1005 -0
- package/dist/migrations/mysql/meta/0001_snapshot.json +1099 -0
- package/dist/migrations/mysql/meta/_journal.json +41 -0
- package/dist/migrations/postgresql/0000_misty_king_bedlam.sql +169 -0
- package/dist/migrations/postgresql/0001_perpetual_captain_marvel.sql +8 -0
- package/dist/migrations/postgresql/0002_sad_spectrum.sql +16 -0
- package/dist/migrations/postgresql/0003_hesitant_ultron.sql +17 -0
- package/dist/migrations/postgresql/0004_media_table.sql +24 -0
- package/dist/migrations/postgresql/0005_media_folders.sql +36 -0
- package/dist/migrations/postgresql/0006_dynamic_collections_update.sql +50 -0
- package/dist/migrations/postgresql/0007_dynamic_singles.sql +38 -0
- package/dist/migrations/postgresql/0008_dynamic_components.sql +37 -0
- package/dist/migrations/postgresql/0009_user_management_tables.sql +95 -0
- package/dist/migrations/postgresql/0010_api_keys.sql +34 -0
- package/dist/migrations/postgresql/0011_general_settings.sql +20 -0
- package/dist/migrations/postgresql/0012_site_settings_logo_url.sql +9 -0
- package/dist/migrations/postgresql/0013_activity_log.sql +29 -0
- package/dist/migrations/postgresql/0014_image_sizes_and_focal_point.sql +33 -0
- package/dist/migrations/postgresql/0014_site_settings_sidebar.sql +13 -0
- package/dist/migrations/postgresql/0015_user_brute_force_protection.sql +29 -0
- package/dist/migrations/postgresql/0016_email_template_attachments.sql +12 -0
- package/dist/migrations/postgresql/0017_media_uploaded_by_nullable.sql +15 -0
- package/dist/migrations/postgresql/20260429_000000_000_initial_journal.sql +24 -0
- package/dist/migrations/postgresql/20260501_000000_journal_batch.sql +17 -0
- package/dist/migrations/postgresql/20260501_000001_audit_log.sql +24 -0
- package/dist/migrations/postgresql/20260504_000000_nextly_meta.sql +22 -0
- package/dist/migrations/postgresql/meta/0000_snapshot.json +1286 -0
- package/dist/migrations/postgresql/meta/0001_snapshot.json +1407 -0
- package/dist/migrations/postgresql/meta/0002_snapshot.json +1552 -0
- package/dist/migrations/postgresql/meta/0003_snapshot.json +1695 -0
- package/dist/migrations/postgresql/meta/0010_snapshot.json +2345 -0
- package/dist/migrations/postgresql/meta/_journal.json +90 -0
- package/dist/migrations/sqlite/0000_api_keys.sql +34 -0
- package/dist/migrations/sqlite/0001_general_settings.sql +20 -0
- package/dist/migrations/sqlite/0002_site_settings_logo_url.sql +9 -0
- package/dist/migrations/sqlite/0003_activity_log.sql +29 -0
- package/dist/migrations/sqlite/0004_image_sizes_and_focal_point.sql +29 -0
- package/dist/migrations/sqlite/0004_site_settings_sidebar.sql +11 -0
- package/dist/migrations/sqlite/0005_user_brute_force_protection.sql +29 -0
- package/dist/migrations/sqlite/0006_email_template_attachments.sql +12 -0
- package/dist/migrations/sqlite/0007_media_uploaded_by_nullable.sql +111 -0
- package/dist/migrations/sqlite/20260429_000000_000_initial_journal.sql +24 -0
- package/dist/migrations/sqlite/20260501_000000_journal_batch.sql +19 -0
- package/dist/migrations/sqlite/20260501_000001_audit_log.sql +24 -0
- package/dist/migrations/sqlite/20260504_000000_nextly_meta.sql +21 -0
- package/dist/migrations/sqlite/20260505_000000_user_management_tables.sql +77 -0
- package/dist/next.d.ts +57 -0
- package/dist/next.mjs +55 -0
- package/dist/observability/index.d.ts +87 -0
- package/dist/observability/index.mjs +57 -0
- package/dist/permissions-3DZZQZMI.mjs +39 -0
- package/dist/pipeline-YOML7SWF.mjs +29 -0
- package/dist/preview-ZZTR3QGS.mjs +9 -0
- package/dist/program-PW6UB2ZC.mjs +5934 -0
- package/dist/reconcile-single-tables-7ENVXJGB.mjs +7 -0
- package/dist/register-SF6E6FVU.mjs +49 -0
- package/dist/reload-config-HWQ4G5MM.mjs +23 -0
- package/dist/resolve-single-table-name-JSOMUB3R.mjs +7 -0
- package/dist/routeHandler-UNMMJIBM.mjs +77 -0
- package/dist/runtime-schema-generator-NRA6A6Z6.mjs +8 -0
- package/dist/runtime.d.ts +120 -0
- package/dist/runtime.mjs +73 -0
- package/dist/schema-hash-FMMG6VPJ.mjs +13 -0
- package/dist/schema-registry-EQ36FZDP.mjs +7 -0
- package/dist/scripts/load-env.mjs +42 -0
- package/dist/storage/index.d.ts +566 -0
- package/dist/storage/index.mjs +45 -0
- package/dist/super-admin-G5ZK5F4T.mjs +39 -0
- package/dist/system-table-service-WGSRVEGT.mjs +17 -0
- package/dist/users-7KELGRYJ.mjs +38 -0
- package/package.json +308 -9
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// src/cli/utils/logger.ts
|
|
2
|
+
import pc from "picocolors";
|
|
3
|
+
var symbols = {
|
|
4
|
+
success: pc.green("\u2713"),
|
|
5
|
+
error: pc.red("\u2717"),
|
|
6
|
+
warning: pc.yellow("\u26A0"),
|
|
7
|
+
info: pc.blue("\u2139"),
|
|
8
|
+
debug: pc.gray("\u22EF"),
|
|
9
|
+
arrow: pc.cyan("\u2192"),
|
|
10
|
+
bullet: pc.gray("\u2022")
|
|
11
|
+
};
|
|
12
|
+
function createLogger(options = {}) {
|
|
13
|
+
let currentOptions = { ...options };
|
|
14
|
+
const shouldLog = (level) => {
|
|
15
|
+
if (currentOptions.quiet && level !== "error") {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if (level === "debug" && !currentOptions.verbose) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
};
|
|
23
|
+
const format = (message) => {
|
|
24
|
+
if (currentOptions.noColor) {
|
|
25
|
+
return message.replace(/\x1B\[[0-9;]*m/g, "");
|
|
26
|
+
}
|
|
27
|
+
return message;
|
|
28
|
+
};
|
|
29
|
+
const log = (level, prefix, message, ...args) => {
|
|
30
|
+
if (!shouldLog(level)) return;
|
|
31
|
+
const formattedMessage = format(`${prefix} ${message}`);
|
|
32
|
+
if (level === "error") {
|
|
33
|
+
console.error(formattedMessage, ...args);
|
|
34
|
+
} else {
|
|
35
|
+
console.log(formattedMessage, ...args);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
debug: (message, ...args) => {
|
|
40
|
+
log("debug", symbols.debug, pc.gray(message), ...args);
|
|
41
|
+
},
|
|
42
|
+
info: (message, ...args) => {
|
|
43
|
+
log("info", symbols.info, message, ...args);
|
|
44
|
+
},
|
|
45
|
+
warn: (message, ...args) => {
|
|
46
|
+
log("warn", symbols.warning, pc.yellow(message), ...args);
|
|
47
|
+
},
|
|
48
|
+
error: (message, ...args) => {
|
|
49
|
+
log("error", symbols.error, pc.red(message), ...args);
|
|
50
|
+
},
|
|
51
|
+
success: (message, ...args) => {
|
|
52
|
+
log("success", symbols.success, pc.green(message), ...args);
|
|
53
|
+
},
|
|
54
|
+
newline: () => {
|
|
55
|
+
if (!currentOptions.quiet) {
|
|
56
|
+
console.log();
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
divider: (char = "\u2500") => {
|
|
60
|
+
if (!currentOptions.quiet) {
|
|
61
|
+
console.log(pc.gray(char.repeat(50)));
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
header: (message) => {
|
|
65
|
+
if (!currentOptions.quiet) {
|
|
66
|
+
console.log();
|
|
67
|
+
console.log(pc.bold(pc.cyan(message)));
|
|
68
|
+
console.log(pc.gray("\u2500".repeat(message.length)));
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
item: (message, indent = 0) => {
|
|
72
|
+
if (!currentOptions.quiet) {
|
|
73
|
+
const padding = " ".repeat(indent);
|
|
74
|
+
console.log(`${padding}${symbols.bullet} ${message}`);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
keyValue: (key, value) => {
|
|
78
|
+
if (!currentOptions.quiet) {
|
|
79
|
+
const valueStr = typeof value === "boolean" ? value ? pc.green("true") : pc.red("false") : String(value);
|
|
80
|
+
console.log(` ${pc.gray(key + ":")} ${valueStr}`);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
table: (headers, rows) => {
|
|
84
|
+
if (currentOptions.quiet) return;
|
|
85
|
+
const widths = headers.map((h, i) => {
|
|
86
|
+
const maxRowWidth = Math.max(
|
|
87
|
+
...rows.map((r) => String(r[i] ?? "").length)
|
|
88
|
+
);
|
|
89
|
+
return Math.max(h.length, maxRowWidth);
|
|
90
|
+
});
|
|
91
|
+
const headerLine = headers.map((h, i) => pc.bold(h.padEnd(widths[i]))).join(" ");
|
|
92
|
+
console.log(` ${headerLine}`);
|
|
93
|
+
const separator = widths.map((w) => "\u2500".repeat(w)).join("\u2500\u2500");
|
|
94
|
+
console.log(` ${pc.gray(separator)}`);
|
|
95
|
+
for (const row of rows) {
|
|
96
|
+
const rowLine = row.map((cell, i) => String(cell ?? "").padEnd(widths[i])).join(" ");
|
|
97
|
+
console.log(` ${rowLine}`);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
spinner: (message) => {
|
|
101
|
+
if (currentOptions.quiet) {
|
|
102
|
+
return { stop: () => {
|
|
103
|
+
} };
|
|
104
|
+
}
|
|
105
|
+
const frames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
106
|
+
let frameIndex = 0;
|
|
107
|
+
let stopped = false;
|
|
108
|
+
const interval = setInterval(() => {
|
|
109
|
+
if (stopped) return;
|
|
110
|
+
process.stdout.write(`\r${pc.cyan(frames[frameIndex])} ${message}`);
|
|
111
|
+
frameIndex = (frameIndex + 1) % frames.length;
|
|
112
|
+
}, 80);
|
|
113
|
+
return {
|
|
114
|
+
stop: (success = true) => {
|
|
115
|
+
stopped = true;
|
|
116
|
+
clearInterval(interval);
|
|
117
|
+
const icon = success ? symbols.success : symbols.error;
|
|
118
|
+
const color = success ? pc.green : pc.red;
|
|
119
|
+
process.stdout.write(`\r${icon} ${color(message)}
|
|
120
|
+
`);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
setOptions: (newOptions) => {
|
|
125
|
+
currentOptions = { ...currentOptions, ...newOptions };
|
|
126
|
+
},
|
|
127
|
+
getOptions: () => ({ ...currentOptions })
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
var logger = createLogger();
|
|
131
|
+
function formatDuration(ms) {
|
|
132
|
+
if (ms < 1e3) {
|
|
133
|
+
return `${ms}ms`;
|
|
134
|
+
}
|
|
135
|
+
if (ms < 6e4) {
|
|
136
|
+
return `${(ms / 1e3).toFixed(1)}s`;
|
|
137
|
+
}
|
|
138
|
+
const minutes = Math.floor(ms / 6e4);
|
|
139
|
+
const seconds = Math.round(ms % 6e4 / 1e3);
|
|
140
|
+
return `${minutes}m ${seconds}s`;
|
|
141
|
+
}
|
|
142
|
+
function formatBytes(bytes) {
|
|
143
|
+
if (bytes === 0) return "0 B";
|
|
144
|
+
const k = 1024;
|
|
145
|
+
const sizes = ["B", "KB", "MB", "GB"];
|
|
146
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
147
|
+
return `${(bytes / Math.pow(k, i)).toFixed(2)} ${sizes[i]}`;
|
|
148
|
+
}
|
|
149
|
+
function formatCount(count, singular, plural) {
|
|
150
|
+
const word = count === 1 ? singular : plural ?? `${singular}s`;
|
|
151
|
+
return `${count} ${word}`;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export {
|
|
155
|
+
createLogger,
|
|
156
|
+
logger,
|
|
157
|
+
formatDuration,
|
|
158
|
+
formatBytes,
|
|
159
|
+
formatCount
|
|
160
|
+
};
|
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
// src/database/errors.ts
|
|
2
|
+
var DbError = class extends Error {
|
|
3
|
+
kind;
|
|
4
|
+
dialect;
|
|
5
|
+
code;
|
|
6
|
+
meta;
|
|
7
|
+
cause;
|
|
8
|
+
constructor(args) {
|
|
9
|
+
super(args.message);
|
|
10
|
+
this.name = "DbError";
|
|
11
|
+
this.kind = args.kind;
|
|
12
|
+
this.dialect = args.dialect;
|
|
13
|
+
this.code = args.code;
|
|
14
|
+
this.meta = args.meta;
|
|
15
|
+
this.cause = args.cause;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
function isDbError(err) {
|
|
19
|
+
if (!err || typeof err !== "object") return false;
|
|
20
|
+
const obj = err;
|
|
21
|
+
return obj.name === "DbError" && typeof obj.kind === "string";
|
|
22
|
+
}
|
|
23
|
+
function toDbError(dialect, error, meta) {
|
|
24
|
+
if (isDbError(error)) return error;
|
|
25
|
+
const code = safeCode(error);
|
|
26
|
+
const rawMsg = error != null && typeof error === "object" && "message" in error ? error.message : void 0;
|
|
27
|
+
const message = typeof rawMsg === "string" ? rawMsg : "Database error";
|
|
28
|
+
let kind = "internal";
|
|
29
|
+
switch (dialect) {
|
|
30
|
+
case "postgresql":
|
|
31
|
+
kind = mapPostgresCodeToKind(code);
|
|
32
|
+
break;
|
|
33
|
+
case "mysql":
|
|
34
|
+
kind = mapMySqlCodeToKind(code);
|
|
35
|
+
break;
|
|
36
|
+
case "sqlite":
|
|
37
|
+
kind = mapSqliteCodeToKind(code);
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
if ((dialect === "mysql" || dialect === "sqlite") && (kind === "constraint" || kind === "internal") && isLikelyUniqueViolationMessage(dialect, message)) {
|
|
41
|
+
kind = "unique-violation";
|
|
42
|
+
}
|
|
43
|
+
if (kind === "internal" && code) {
|
|
44
|
+
const c = code.toUpperCase();
|
|
45
|
+
if (c === "ECONNRESET" || c.includes("PROTOCOL_CONNECTION_LOST"))
|
|
46
|
+
kind = "connection-lost";
|
|
47
|
+
else if (c === "ETIMEDOUT") kind = "timeout";
|
|
48
|
+
}
|
|
49
|
+
return new DbError({ message, kind, dialect, code, meta, cause: error });
|
|
50
|
+
}
|
|
51
|
+
function safeCode(error) {
|
|
52
|
+
if (!error || typeof error !== "object") return void 0;
|
|
53
|
+
const e = error;
|
|
54
|
+
let c = e.code ?? e.sqlState ?? e.state ?? e.errno ?? void 0;
|
|
55
|
+
if (!c && typeof e.originalError?.code === "string") c = e.originalError.code;
|
|
56
|
+
if (!c && typeof e.cause?.code === "string") c = e.cause.code;
|
|
57
|
+
if (!c && typeof e.severity === "string" && typeof e.code === "string")
|
|
58
|
+
c = e.code;
|
|
59
|
+
if (typeof c === "number") return String(c);
|
|
60
|
+
if (typeof c === "string" && c.length > 0) return c;
|
|
61
|
+
return void 0;
|
|
62
|
+
}
|
|
63
|
+
function mapPostgresCodeToKind(code) {
|
|
64
|
+
if (!code) return "internal";
|
|
65
|
+
const c = code.toUpperCase();
|
|
66
|
+
if (c === "40P01") return "deadlock";
|
|
67
|
+
if (c === "40001") return "serialization-failure";
|
|
68
|
+
if (c === "57014") return "timeout";
|
|
69
|
+
if (c === "23505") return "unique-violation";
|
|
70
|
+
if (c === "23503") return "fk-violation";
|
|
71
|
+
if (c === "23502") return "not-null-violation";
|
|
72
|
+
if (c === "42601") return "syntax";
|
|
73
|
+
if (c.startsWith("08") || c === "57P01") return "connection-lost";
|
|
74
|
+
if (c.startsWith("23")) return "constraint";
|
|
75
|
+
return "internal";
|
|
76
|
+
}
|
|
77
|
+
function mapMySqlCodeToKind(code) {
|
|
78
|
+
if (!code) return "internal";
|
|
79
|
+
const c = code.toUpperCase();
|
|
80
|
+
if (c === "1213" || c === "ER_LOCK_DEADLOCK") return "deadlock";
|
|
81
|
+
if (c === "1205" || c === "ER_LOCK_WAIT_TIMEOUT") return "timeout";
|
|
82
|
+
if (c === "1062" || c === "ER_DUP_ENTRY") return "unique-violation";
|
|
83
|
+
if (c === "23000") return "constraint";
|
|
84
|
+
if (c === "1064" || c === "ER_PARSE_ERROR") return "syntax";
|
|
85
|
+
if (c === "1452" || c === "ER_NO_REFERENCED_ROW_2") return "fk-violation";
|
|
86
|
+
if (c === "1451" || c === "ER_ROW_IS_REFERENCED_2") return "fk-violation";
|
|
87
|
+
if (c === "ECONNRESET" || c.includes("PROTOCOL_CONNECTION_LOST"))
|
|
88
|
+
return "connection-lost";
|
|
89
|
+
if (c === "ETIMEDOUT") return "timeout";
|
|
90
|
+
return "internal";
|
|
91
|
+
}
|
|
92
|
+
function mapSqliteCodeToKind(code) {
|
|
93
|
+
if (!code) return "internal";
|
|
94
|
+
const c = code.toUpperCase();
|
|
95
|
+
if (c === "SQLITE_BUSY" || c === "SQLITE_LOCKED") return "deadlock";
|
|
96
|
+
if (c === "SQLITE_CONSTRAINT_UNIQUE") return "unique-violation";
|
|
97
|
+
if (c === "SQLITE_CONSTRAINT_PRIMARYKEY") return "unique-violation";
|
|
98
|
+
if (c === "SQLITE_CONSTRAINT_FOREIGNKEY") return "fk-violation";
|
|
99
|
+
if (c === "SQLITE_CONSTRAINT_NOTNULL") return "not-null-violation";
|
|
100
|
+
if (c === "SQLITE_INTERRUPT") return "timeout";
|
|
101
|
+
if (c === "SQLITE_ERROR") return "syntax";
|
|
102
|
+
if (c.startsWith("SQLITE_CONSTRAINT")) return "constraint";
|
|
103
|
+
return "internal";
|
|
104
|
+
}
|
|
105
|
+
function isLikelyUniqueViolationMessage(dialect, message) {
|
|
106
|
+
const m = message.toLowerCase();
|
|
107
|
+
if (dialect === "mysql") {
|
|
108
|
+
return m.includes("duplicate entry") || m.includes("duplicate key");
|
|
109
|
+
}
|
|
110
|
+
if (dialect === "sqlite") {
|
|
111
|
+
return m.includes("unique constraint failed");
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// src/errors/error-codes.ts
|
|
117
|
+
var NEXTLY_ERROR_STATUS = {
|
|
118
|
+
VALIDATION_ERROR: 400,
|
|
119
|
+
INVALID_INPUT: 400,
|
|
120
|
+
AUTH_REQUIRED: 401,
|
|
121
|
+
AUTH_INVALID_CREDENTIALS: 401,
|
|
122
|
+
TOKEN_EXPIRED: 401,
|
|
123
|
+
FORBIDDEN: 403,
|
|
124
|
+
NOT_FOUND: 404,
|
|
125
|
+
CONFLICT: 409,
|
|
126
|
+
DUPLICATE: 409,
|
|
127
|
+
RATE_LIMITED: 429,
|
|
128
|
+
PAYLOAD_TOO_LARGE: 413,
|
|
129
|
+
UNSUPPORTED_MEDIA_TYPE: 415,
|
|
130
|
+
INTERNAL_ERROR: 500,
|
|
131
|
+
DATABASE_ERROR: 500,
|
|
132
|
+
EXTERNAL_SERVICE_ERROR: 502,
|
|
133
|
+
SERVICE_UNAVAILABLE: 503
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// src/errors/nextly-error.ts
|
|
137
|
+
var DB_ERROR_MAPPING = {
|
|
138
|
+
"unique-violation": {
|
|
139
|
+
code: "DUPLICATE",
|
|
140
|
+
statusCode: 409,
|
|
141
|
+
publicMessage: "Resource already exists."
|
|
142
|
+
},
|
|
143
|
+
"fk-violation": {
|
|
144
|
+
code: "VALIDATION_ERROR",
|
|
145
|
+
statusCode: 400,
|
|
146
|
+
publicMessage: "Referenced record does not exist."
|
|
147
|
+
},
|
|
148
|
+
"not-null-violation": {
|
|
149
|
+
code: "VALIDATION_ERROR",
|
|
150
|
+
statusCode: 400,
|
|
151
|
+
publicMessage: "A required field is missing."
|
|
152
|
+
},
|
|
153
|
+
constraint: {
|
|
154
|
+
code: "VALIDATION_ERROR",
|
|
155
|
+
statusCode: 400,
|
|
156
|
+
publicMessage: "The provided data violates a constraint."
|
|
157
|
+
},
|
|
158
|
+
deadlock: {
|
|
159
|
+
code: "CONFLICT",
|
|
160
|
+
statusCode: 409,
|
|
161
|
+
publicMessage: "The operation could not be completed. Please retry."
|
|
162
|
+
},
|
|
163
|
+
"serialization-failure": {
|
|
164
|
+
code: "CONFLICT",
|
|
165
|
+
statusCode: 409,
|
|
166
|
+
publicMessage: "The operation could not be completed. Please retry."
|
|
167
|
+
},
|
|
168
|
+
timeout: {
|
|
169
|
+
code: "DATABASE_ERROR",
|
|
170
|
+
statusCode: 500,
|
|
171
|
+
publicMessage: "The operation timed out. Please try again."
|
|
172
|
+
},
|
|
173
|
+
"connection-lost": {
|
|
174
|
+
code: "DATABASE_ERROR",
|
|
175
|
+
statusCode: 500,
|
|
176
|
+
publicMessage: "A temporary database error occurred. Please try again."
|
|
177
|
+
},
|
|
178
|
+
syntax: {
|
|
179
|
+
code: "INTERNAL_ERROR",
|
|
180
|
+
statusCode: 500,
|
|
181
|
+
publicMessage: "An unexpected error occurred."
|
|
182
|
+
},
|
|
183
|
+
internal: {
|
|
184
|
+
code: "INTERNAL_ERROR",
|
|
185
|
+
statusCode: 500,
|
|
186
|
+
publicMessage: "An unexpected error occurred."
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
var NEXTLY_ERROR_BRAND = Symbol.for(
|
|
190
|
+
"nextly/NextlyError"
|
|
191
|
+
);
|
|
192
|
+
function hasBrand(value) {
|
|
193
|
+
if (value === null || typeof value !== "object" && typeof value !== "function") {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
return value[NEXTLY_ERROR_BRAND] === true;
|
|
197
|
+
}
|
|
198
|
+
var NextlyError = class _NextlyError extends Error {
|
|
199
|
+
code;
|
|
200
|
+
statusCode;
|
|
201
|
+
publicMessage;
|
|
202
|
+
publicData;
|
|
203
|
+
messageKey;
|
|
204
|
+
logMessage;
|
|
205
|
+
logContext;
|
|
206
|
+
cause;
|
|
207
|
+
timestamp;
|
|
208
|
+
constructor(opts) {
|
|
209
|
+
super(opts.publicMessage);
|
|
210
|
+
this.name = "NextlyError";
|
|
211
|
+
this.code = opts.code;
|
|
212
|
+
this.publicMessage = opts.publicMessage;
|
|
213
|
+
this.publicData = opts.publicData;
|
|
214
|
+
this.messageKey = opts.messageKey;
|
|
215
|
+
this.logMessage = opts.logMessage;
|
|
216
|
+
this.logContext = opts.logContext;
|
|
217
|
+
this.cause = opts.cause;
|
|
218
|
+
this.timestamp = /* @__PURE__ */ new Date();
|
|
219
|
+
this.statusCode = _NextlyError.resolveStatusCode(opts);
|
|
220
|
+
Error.captureStackTrace?.(this, _NextlyError);
|
|
221
|
+
}
|
|
222
|
+
static {
|
|
223
|
+
_NextlyError.prototype[NEXTLY_ERROR_BRAND] = true;
|
|
224
|
+
}
|
|
225
|
+
static resolveStatusCode(opts) {
|
|
226
|
+
if (typeof opts.statusCode === "number") return opts.statusCode;
|
|
227
|
+
if (opts.code in NEXTLY_ERROR_STATUS) {
|
|
228
|
+
return NEXTLY_ERROR_STATUS[opts.code];
|
|
229
|
+
}
|
|
230
|
+
return 500;
|
|
231
|
+
}
|
|
232
|
+
/** HTTP-safe JSON. Strips logMessage / logContext / cause / stack. */
|
|
233
|
+
toResponseJSON(requestId) {
|
|
234
|
+
const json = {
|
|
235
|
+
code: String(this.code),
|
|
236
|
+
message: this.publicMessage,
|
|
237
|
+
requestId
|
|
238
|
+
};
|
|
239
|
+
if (this.messageKey) json.messageKey = this.messageKey;
|
|
240
|
+
if (this.publicData !== void 0) json.data = this.publicData;
|
|
241
|
+
return json;
|
|
242
|
+
}
|
|
243
|
+
/** Operator-facing JSON for log lines. Includes everything. */
|
|
244
|
+
toLogJSON(requestId) {
|
|
245
|
+
return {
|
|
246
|
+
code: this.code,
|
|
247
|
+
statusCode: this.statusCode,
|
|
248
|
+
publicMessage: this.publicMessage,
|
|
249
|
+
messageKey: this.messageKey,
|
|
250
|
+
logMessage: this.logMessage,
|
|
251
|
+
logContext: this.logContext,
|
|
252
|
+
cause: this.cause ? {
|
|
253
|
+
name: this.cause.name,
|
|
254
|
+
message: this.cause.message,
|
|
255
|
+
stack: this.cause.stack
|
|
256
|
+
} : void 0,
|
|
257
|
+
timestamp: this.timestamp.toISOString(),
|
|
258
|
+
requestId
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
// ────────────────────────────────────────────────────────────────────
|
|
262
|
+
// Static factories — the recommended throw site for every common case.
|
|
263
|
+
// Public messages here follow the §13.8 rubric: complete sentence,
|
|
264
|
+
// generic, no identifiers, no value echoing, no policy hints.
|
|
265
|
+
// ────────────────────────────────────────────────────────────────────
|
|
266
|
+
static invalidCredentials(opts) {
|
|
267
|
+
return new _NextlyError({
|
|
268
|
+
code: "AUTH_INVALID_CREDENTIALS",
|
|
269
|
+
publicMessage: "Invalid email or password.",
|
|
270
|
+
logMessage: "Login failed",
|
|
271
|
+
logContext: opts?.logContext
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
static authRequired(opts) {
|
|
275
|
+
return new _NextlyError({
|
|
276
|
+
code: "AUTH_REQUIRED",
|
|
277
|
+
publicMessage: "Authentication required.",
|
|
278
|
+
logContext: opts?.logContext
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
static notFound(opts) {
|
|
282
|
+
return new _NextlyError({
|
|
283
|
+
code: "NOT_FOUND",
|
|
284
|
+
publicMessage: "Not found.",
|
|
285
|
+
logContext: opts?.logContext
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
static forbidden(opts) {
|
|
289
|
+
return new _NextlyError({
|
|
290
|
+
code: "FORBIDDEN",
|
|
291
|
+
publicMessage: "You don't have permission to perform this action.",
|
|
292
|
+
logContext: opts?.logContext
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
static validation(opts) {
|
|
296
|
+
return new _NextlyError({
|
|
297
|
+
code: "VALIDATION_ERROR",
|
|
298
|
+
publicMessage: "Validation failed.",
|
|
299
|
+
publicData: { errors: opts.errors },
|
|
300
|
+
logContext: opts.logContext
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
static conflict(opts) {
|
|
304
|
+
return new _NextlyError({
|
|
305
|
+
code: "CONFLICT",
|
|
306
|
+
publicMessage: "The resource has changed since you last loaded it. Please refresh and try again.",
|
|
307
|
+
logContext: { reason: opts?.reason, ...opts?.logContext }
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
static duplicate(opts) {
|
|
311
|
+
return new _NextlyError({
|
|
312
|
+
code: "DUPLICATE",
|
|
313
|
+
publicMessage: "Resource already exists.",
|
|
314
|
+
logContext: opts?.logContext
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
static rateLimited(opts) {
|
|
318
|
+
return new _NextlyError({
|
|
319
|
+
code: "RATE_LIMITED",
|
|
320
|
+
publicMessage: "Too many requests. Please try again later.",
|
|
321
|
+
publicData: opts?.retryAfterSeconds !== void 0 ? { retryAfterSeconds: opts.retryAfterSeconds } : void 0,
|
|
322
|
+
logContext: opts?.logContext
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
static internal(opts) {
|
|
326
|
+
return new _NextlyError({
|
|
327
|
+
code: "INTERNAL_ERROR",
|
|
328
|
+
publicMessage: "An unexpected error occurred.",
|
|
329
|
+
cause: opts?.cause,
|
|
330
|
+
logContext: opts?.logContext
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
// Accepts an optional `logMessage` override so callers (e.g. the health
|
|
334
|
+
// route) can record a specific operator narrative ("Health check failed")
|
|
335
|
+
// while the public message stays canonical per spec §13.8.5.
|
|
336
|
+
static serviceUnavailable(opts) {
|
|
337
|
+
return new _NextlyError({
|
|
338
|
+
code: "SERVICE_UNAVAILABLE",
|
|
339
|
+
publicMessage: "Service unavailable. Please try again later.",
|
|
340
|
+
logMessage: opts?.logMessage,
|
|
341
|
+
cause: opts?.cause,
|
|
342
|
+
logContext: opts?.logContext
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Convert a DbError (or arbitrary unknown thrown by the DB layer) to a
|
|
347
|
+
* NextlyError with a generic public message and rich logContext. Used by
|
|
348
|
+
* `withDbErrors` for auto-conversion (Pattern A) and by services that
|
|
349
|
+
* catch DB errors at boundaries (Pattern B). Spec §8.2 mapping table.
|
|
350
|
+
*
|
|
351
|
+
* Never leaks DB driver text, constraint names, or table names into
|
|
352
|
+
* `publicMessage`. All DB context goes into `logContext`. The original
|
|
353
|
+
* DbError is preserved as `cause`.
|
|
354
|
+
*/
|
|
355
|
+
static fromDatabaseError(error) {
|
|
356
|
+
if (isDbError(error)) {
|
|
357
|
+
const mapping = DB_ERROR_MAPPING[error.kind];
|
|
358
|
+
const logContext = {
|
|
359
|
+
dbKind: error.kind,
|
|
360
|
+
dialect: error.dialect
|
|
361
|
+
};
|
|
362
|
+
if (error.code !== void 0) logContext.dbCode = error.code;
|
|
363
|
+
if (error.meta !== void 0) logContext.meta = error.meta;
|
|
364
|
+
return new _NextlyError({
|
|
365
|
+
code: mapping.code,
|
|
366
|
+
statusCode: mapping.statusCode,
|
|
367
|
+
publicMessage: mapping.publicMessage,
|
|
368
|
+
logMessage: "Database error",
|
|
369
|
+
logContext,
|
|
370
|
+
cause: error
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
return new _NextlyError({
|
|
374
|
+
code: "INTERNAL_ERROR",
|
|
375
|
+
statusCode: 500,
|
|
376
|
+
publicMessage: "An unexpected error occurred.",
|
|
377
|
+
logMessage: "Non-DbError passed to fromDatabaseError",
|
|
378
|
+
cause: error instanceof Error ? error : void 0,
|
|
379
|
+
logContext: error instanceof Error ? void 0 : { value: String(error) }
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
// ────────────────────────────────────────────────────────────────────
|
|
383
|
+
// Type guards. Structural rather than `instanceof` so they survive
|
|
384
|
+
// package-boundary mismatches (one consumer's NextlyError is a
|
|
385
|
+
// different module instance from another's).
|
|
386
|
+
// ────────────────────────────────────────────────────────────────────
|
|
387
|
+
static is(err) {
|
|
388
|
+
return hasBrand(err);
|
|
389
|
+
}
|
|
390
|
+
static isCode(err, code) {
|
|
391
|
+
return hasBrand(err) && err.code === code;
|
|
392
|
+
}
|
|
393
|
+
static isNotFound(err) {
|
|
394
|
+
return _NextlyError.isCode(err, "NOT_FOUND");
|
|
395
|
+
}
|
|
396
|
+
static isValidation(err) {
|
|
397
|
+
return _NextlyError.isCode(err, "VALIDATION_ERROR");
|
|
398
|
+
}
|
|
399
|
+
static isAuthRequired(err) {
|
|
400
|
+
return _NextlyError.isCode(err, "AUTH_REQUIRED");
|
|
401
|
+
}
|
|
402
|
+
static isForbidden(err) {
|
|
403
|
+
return _NextlyError.isCode(err, "FORBIDDEN");
|
|
404
|
+
}
|
|
405
|
+
static isConflict(err) {
|
|
406
|
+
return _NextlyError.isCode(err, "CONFLICT");
|
|
407
|
+
}
|
|
408
|
+
static isRateLimited(err) {
|
|
409
|
+
return _NextlyError.isCode(err, "RATE_LIMITED");
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
export {
|
|
414
|
+
DbError,
|
|
415
|
+
isDbError,
|
|
416
|
+
toDbError,
|
|
417
|
+
NEXTLY_ERROR_STATUS,
|
|
418
|
+
NextlyError
|
|
419
|
+
};
|