@revealui/core 0.12.0 → 0.12.2
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 -3
- package/dist/api/rest.js +4 -4
- package/dist/client/admin/utils/csrf.d.ts +9 -6
- package/dist/client/admin/utils/csrf.d.ts.map +1 -1
- package/dist/client/admin/utils/csrf.js +9 -6
- package/dist/collections/operations/fieldValidation.d.ts +5 -16
- package/dist/collections/operations/fieldValidation.d.ts.map +1 -1
- package/dist/collections/operations/fieldValidation.js +5 -20
- package/dist/collections/operations/update.d.ts.map +1 -1
- package/dist/collections/operations/update.js +4 -2
- package/dist/database/safe-parse.js +3 -3
- package/dist/database/universal-postgres.d.ts.map +1 -1
- package/dist/database/universal-postgres.js +10 -13
- package/dist/deployment-mode.d.ts +44 -0
- package/dist/deployment-mode.d.ts.map +1 -0
- package/dist/deployment-mode.js +58 -0
- package/dist/error-handling/error-boundary.d.ts +16 -2
- package/dist/error-handling/error-boundary.d.ts.map +1 -1
- package/dist/error-handling/error-boundary.js +18 -3
- package/dist/error-handling/error-reporter.d.ts +1 -1
- package/dist/error-handling/error-reporter.d.ts.map +1 -1
- package/dist/error-handling/error-reporter.js +6 -2
- package/dist/error-handling/index.d.ts +1 -1
- package/dist/error-handling/index.d.ts.map +1 -1
- package/dist/error-handling/index.js +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/instance/logger.d.ts +18 -7
- package/dist/instance/logger.d.ts.map +1 -1
- package/dist/instance/logger.js +66 -17
- package/dist/license/mint-client.d.ts +72 -0
- package/dist/license/mint-client.d.ts.map +1 -0
- package/dist/license/mint-client.js +175 -0
- package/dist/license.d.ts +6 -0
- package/dist/license.d.ts.map +1 -1
- package/dist/license.js +15 -1
- package/dist/observability/index.d.ts +5 -2
- package/dist/observability/index.d.ts.map +1 -1
- package/dist/observability/index.js +5 -2
- package/dist/observability/logger.d.ts +5 -3
- package/dist/observability/logger.d.ts.map +1 -1
- package/dist/observability/logger.js +5 -3
- package/dist/relationships/analyzer.js +2 -2
- package/dist/storage/object-storage.d.ts.map +1 -1
- package/dist/storage/object-storage.js +3 -3
- package/dist/utils/errors.d.ts +16 -4
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +14 -2
- package/dist/utils/json-parsing.d.ts.map +1 -1
- package/dist/utils/json-parsing.js +4 -2
- package/dist/utils/logger-client.d.ts +6 -27
- package/dist/utils/logger-client.d.ts.map +1 -1
- package/dist/utils/logger-client.js +5 -51
- package/dist/utils/logger-server.d.ts +16 -20
- package/dist/utils/logger-server.d.ts.map +1 -1
- package/dist/utils/logger-server.js +40 -53
- package/dist/utils/logger.d.ts +7 -9
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +6 -8
- package/package.json +154 -76
- package/dist/caching/index.d.ts +0 -6
- package/dist/caching/index.d.ts.map +0 -1
- package/dist/caching/index.js +0 -5
- package/dist/observability/tracing.d.ts +0 -149
- package/dist/observability/tracing.d.ts.map +0 -1
- package/dist/observability/tracing.js +0 -380
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Part of the [RevealUI monorepo](https://github.com/RevealUIStudio/revealui) -
|
|
|
27
27
|
- **Plugins** - Extensible plugin system (form builder, nested docs, redirects)
|
|
28
28
|
- **Feature Gating** - Tier-based licensing (free, pro, max, enterprise) with JWT license keys
|
|
29
29
|
- **Database** - PostgreSQL adapters (NeonDB + PGlite for testing), connection pooling, SSL/TLS
|
|
30
|
-
- **Storage** - Pluggable storage interface (Cloudflare R2
|
|
30
|
+
- **Storage** - Pluggable storage interface (Cloudflare R2 sole non-mock backend; mock adapter for tests)
|
|
31
31
|
|
|
32
32
|
## Installation
|
|
33
33
|
|
|
@@ -145,7 +145,7 @@ if (isFeatureEnabled('ai')) {
|
|
|
145
145
|
| `@revealui/core/database` | Database adapters |
|
|
146
146
|
| `@revealui/core/database/ssl-config` | SSL/TLS config |
|
|
147
147
|
| `@revealui/core/database/type-adapter` | Type adapter utilities |
|
|
148
|
-
| `@revealui/core/storage` | Storage adapters (R2 +
|
|
148
|
+
| `@revealui/core/storage` | Storage adapters (R2 + mock for tests) |
|
|
149
149
|
| `@revealui/core/plugins` | Plugin system |
|
|
150
150
|
| `@revealui/core/features` | Feature flags |
|
|
151
151
|
| `@revealui/core/license` | License validation |
|
|
@@ -160,7 +160,6 @@ if (isFeatureEnabled('ai')) {
|
|
|
160
160
|
| `@revealui/core/observability/alerts` | Alerts |
|
|
161
161
|
| `@revealui/core/error-handling` | Error boundaries, retry, circuit breaker, fallback UI |
|
|
162
162
|
| `@revealui/core/error-handling/error-reporter` | Error reporting |
|
|
163
|
-
| `@revealui/core/caching` | Caching utilities |
|
|
164
163
|
| `@revealui/core/cache/query-cache` | Query cache |
|
|
165
164
|
| `@revealui/core/jobs` | Background jobs |
|
|
166
165
|
| `@revealui/core/translations` | i18n translations |
|
package/dist/api/rest.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* WARNING: This module is server-only.
|
|
7
7
|
* Do NOT import in client-side code or edge runtime.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { logger } from '../observability/logger.js';
|
|
10
10
|
function parseQueryParams(searchParams) {
|
|
11
11
|
const options = {};
|
|
12
12
|
// Parse depth
|
|
@@ -284,7 +284,7 @@ async function handleCollectionOperation(method, collection, id, revealui, reque
|
|
|
284
284
|
const message = error instanceof Error ? error.message : 'Internal server error';
|
|
285
285
|
const status = 'status' in error ? error.status : 500;
|
|
286
286
|
// Log error with context for debugging
|
|
287
|
-
|
|
287
|
+
logger.error('RevealUI Collection API Error:', {
|
|
288
288
|
collection,
|
|
289
289
|
method: request.method,
|
|
290
290
|
error: error instanceof Error
|
|
@@ -346,7 +346,7 @@ async function handleGlobalOperation(method, global, revealui, request, options)
|
|
|
346
346
|
const message = error instanceof Error ? error.message : 'Internal server error';
|
|
347
347
|
const status = 'status' in error ? error.status : 500;
|
|
348
348
|
// Log error with context for debugging
|
|
349
|
-
|
|
349
|
+
logger.error('RevealUI Global API Error:', {
|
|
350
350
|
global,
|
|
351
351
|
method: request.method,
|
|
352
352
|
error: error instanceof Error
|
|
@@ -423,7 +423,7 @@ export async function handleRESTRequest(request, config, revealui) {
|
|
|
423
423
|
// Extract error message safely
|
|
424
424
|
const message = error instanceof Error ? error.message : 'Internal server error';
|
|
425
425
|
// Log error with context for debugging
|
|
426
|
-
|
|
426
|
+
logger.error('RevealUI REST API Error:', {
|
|
427
427
|
message,
|
|
428
428
|
path: url.pathname,
|
|
429
429
|
method: request.method,
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CSRF helpers for
|
|
2
|
+
* CSRF helpers for browser clients (admin, auth hooks, agent stream).
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for reading the JS-readable `revealui-csrf` cookie
|
|
5
|
+
* (fleet-redundancy P2-C). Consumers: this package's admin APIClient,
|
|
6
|
+
* `@revealui/auth/react` (re-export), `@revealui/ai` useAgentStream.
|
|
3
7
|
*
|
|
4
8
|
* The admin proxy and the api server's csrfMiddleware require any unsafe
|
|
5
|
-
* request carrying a `revealui-session` cookie to echo
|
|
6
|
-
* `
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* re-login or session rotation).
|
|
9
|
+
* request carrying a `revealui-session` cookie to echo this cookie as an
|
|
10
|
+
* `X-CSRF-Token` header. Re-read immediately before each request because
|
|
11
|
+
* the proxy re-issues the cookie when it no longer validates against the
|
|
12
|
+
* current session (e.g. after re-login or session rotation).
|
|
10
13
|
*/
|
|
11
14
|
/**
|
|
12
15
|
* Read the `revealui-csrf` cookie value. Returns `undefined` outside the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csrf.d.ts","sourceRoot":"","sources":["../../../../src/client/admin/utils/csrf.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"csrf.d.ts","sourceRoot":"","sources":["../../../../src/client/admin/utils/csrf.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;GAGG;AACH,wBAAgB,aAAa,IAAI,MAAM,GAAG,SAAS,CAgBlD;AAED;;;;;;;GAOG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,QAAQ,CAAC,CAOrD"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CSRF helpers for
|
|
2
|
+
* CSRF helpers for browser clients (admin, auth hooks, agent stream).
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for reading the JS-readable `revealui-csrf` cookie
|
|
5
|
+
* (fleet-redundancy P2-C). Consumers: this package's admin APIClient,
|
|
6
|
+
* `@revealui/auth/react` (re-export), `@revealui/ai` useAgentStream.
|
|
3
7
|
*
|
|
4
8
|
* The admin proxy and the api server's csrfMiddleware require any unsafe
|
|
5
|
-
* request carrying a `revealui-session` cookie to echo
|
|
6
|
-
* `
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* re-login or session rotation).
|
|
9
|
+
* request carrying a `revealui-session` cookie to echo this cookie as an
|
|
10
|
+
* `X-CSRF-Token` header. Re-read immediately before each request because
|
|
11
|
+
* the proxy re-issues the cookie when it no longer validates against the
|
|
12
|
+
* current session (e.g. after re-login or session rotation).
|
|
10
13
|
*/
|
|
11
14
|
/**
|
|
12
15
|
* Read the `revealui-csrf` cookie value. Returns `undefined` outside the
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*
|
|
8
8
|
* A field's `validate(value, { value, data, siblingData, operation, req })`
|
|
9
9
|
* returns `true` when the value is valid, or a non-empty string error message
|
|
10
|
-
* when it is not. On the first failure the engine throws
|
|
11
|
-
* (HTTP 400) carrying that message, so the write is rejected at ingress.
|
|
10
|
+
* when it is not. On the first failure the engine throws the canonical ValidationError
|
|
11
|
+
* (HTTP 400, `instanceof`) carrying that message, so the write is rejected at ingress.
|
|
12
12
|
*
|
|
13
13
|
* Enforcement note: this is one of the engine's ingress checks and runs for
|
|
14
14
|
* EVERY collection written through create()/update(). For public page/post
|
|
@@ -17,20 +17,9 @@
|
|
|
17
17
|
* render-side sanitizeUrl. See docs/specs/2026-07-02-cms-render-path-hardening.md.
|
|
18
18
|
*/
|
|
19
19
|
import type { RevealCollectionConfig, RevealRequest } from '../../types/index.js';
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* Carries `status`/`statusCode` 400 so transports surface it as a client error
|
|
24
|
-
* with the validator's message intact (core `rest.ts` reads `status`; the
|
|
25
|
-
* server error middleware can branch on `name === 'ValidationError'`), rather
|
|
26
|
-
* than the generic 500 that a bare Error would produce.
|
|
27
|
-
*/
|
|
28
|
-
export declare class ValidationError extends Error {
|
|
29
|
-
readonly status = 400;
|
|
30
|
-
readonly statusCode = 400;
|
|
31
|
-
readonly field?: string;
|
|
32
|
-
constructor(message: string, field?: string);
|
|
33
|
-
}
|
|
20
|
+
import { ValidationError } from '../../utils/errors.js';
|
|
21
|
+
/** Re-export canonical domain ValidationError for collection call sites/tests. */
|
|
22
|
+
export { ValidationError };
|
|
34
23
|
/**
|
|
35
24
|
* Executes every field's `validate` predicate for the fields present in `data`.
|
|
36
25
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldValidation.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/fieldValidation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"fieldValidation.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/fieldValidation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,kFAAkF;AAClF,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,sBAAsB,EAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,SAAS,EAAE,QAAQ,GAAG,QAAQ,EAC9B,GAAG,CAAC,EAAE,aAAa,GAClB,OAAO,CAAC,IAAI,CAAC,CAoCf"}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*
|
|
8
8
|
* A field's `validate(value, { value, data, siblingData, operation, req })`
|
|
9
9
|
* returns `true` when the value is valid, or a non-empty string error message
|
|
10
|
-
* when it is not. On the first failure the engine throws
|
|
11
|
-
* (HTTP 400) carrying that message, so the write is rejected at ingress.
|
|
10
|
+
* when it is not. On the first failure the engine throws the canonical ValidationError
|
|
11
|
+
* (HTTP 400, `instanceof`) carrying that message, so the write is rejected at ingress.
|
|
12
12
|
*
|
|
13
13
|
* Enforcement note: this is one of the engine's ingress checks and runs for
|
|
14
14
|
* EVERY collection written through create()/update(). For public page/post
|
|
@@ -16,25 +16,10 @@
|
|
|
16
16
|
* (validateContent/validateBlocks, wired into the pages/posts write routes) and
|
|
17
17
|
* render-side sanitizeUrl. See docs/specs/2026-07-02-cms-render-path-hardening.md.
|
|
18
18
|
*/
|
|
19
|
+
import { ValidationError } from '../../utils/errors.js';
|
|
19
20
|
import { flattenFields } from '../../utils/type-guards.js';
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
*
|
|
23
|
-
* Carries `status`/`statusCode` 400 so transports surface it as a client error
|
|
24
|
-
* with the validator's message intact (core `rest.ts` reads `status`; the
|
|
25
|
-
* server error middleware can branch on `name === 'ValidationError'`), rather
|
|
26
|
-
* than the generic 500 that a bare Error would produce.
|
|
27
|
-
*/
|
|
28
|
-
export class ValidationError extends Error {
|
|
29
|
-
status = 400;
|
|
30
|
-
statusCode = 400;
|
|
31
|
-
field;
|
|
32
|
-
constructor(message, field) {
|
|
33
|
-
super(message);
|
|
34
|
-
this.name = 'ValidationError';
|
|
35
|
-
this.field = field;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
21
|
+
/** Re-export canonical domain ValidationError for collection call sites/tests. */
|
|
22
|
+
export { ValidationError };
|
|
38
23
|
/**
|
|
39
24
|
* Executes every field's `validate` predicate for the fields present in `data`.
|
|
40
25
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/update.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,EACtB,cAAc,EAGd,mBAAmB,EAEpB,MAAM,sBAAsB,CAAC;AAoF9B,wBAAsB,MAAM,CAC1B,MAAM,EAAE,sBAAsB,EAC9B,EAAE,EAAE,wBAAwB,GAAG,IAAI,EACnC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/update.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,EACtB,cAAc,EAGd,mBAAmB,EAEpB,MAAM,sBAAsB,CAAC;AAoF9B,wBAAsB,MAAM,CAC1B,MAAM,EAAE,sBAAsB,EAC9B,EAAE,EAAE,wBAAwB,GAAG,IAAI,EACnC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,cAAc,CAAC,CAqOzB"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Updates an existing document with access control, validation, password hashing, and JSON field handling.
|
|
5
5
|
*/
|
|
6
6
|
import bcrypt from 'bcryptjs';
|
|
7
|
-
import {
|
|
7
|
+
import { logger } from '../../observability/logger.js';
|
|
8
8
|
import { collectJsonFields, serializeValueForDatabase } from '../../utils/json-parsing.js';
|
|
9
9
|
import { flattenFields, isJsonFieldType } from '../../utils/type-guards.js';
|
|
10
10
|
import { runBeforeFieldHooks } from './fieldHooks.js';
|
|
@@ -195,7 +195,9 @@ export async function update(config, db, options) {
|
|
|
195
195
|
}
|
|
196
196
|
catch (error) {
|
|
197
197
|
// Log JSON parse error for debugging
|
|
198
|
-
|
|
198
|
+
logger.warn(`[CollectionOperations] Failed to parse _json for ${tableName}.id=${id}`, {
|
|
199
|
+
error: error instanceof Error ? { message: error.message, name: error.name } : error,
|
|
200
|
+
});
|
|
199
201
|
existingJson = {};
|
|
200
202
|
}
|
|
201
203
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* All RevealUI tables have `id` as a non-nullable primary key, so filtering these
|
|
7
7
|
* out prevents crashes from unexpected driver behavior or schema migrations.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { logger } from '../observability/logger.js';
|
|
10
10
|
/**
|
|
11
11
|
* Validate that a raw database row is a valid RevealDocument.
|
|
12
12
|
*
|
|
@@ -19,12 +19,12 @@ import { defaultLogger } from '../instance/logger.js';
|
|
|
19
19
|
*/
|
|
20
20
|
export function safeParseRevealDocument(row) {
|
|
21
21
|
if (row === null || typeof row !== 'object') {
|
|
22
|
-
|
|
22
|
+
logger.warn('Database row is not an object - skipping', { row });
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
25
25
|
const r = row;
|
|
26
26
|
if (typeof r.id !== 'string' && typeof r.id !== 'number') {
|
|
27
|
-
|
|
27
|
+
logger.warn('Database row missing required id field - skipping', {
|
|
28
28
|
keys: Object.keys(r),
|
|
29
29
|
});
|
|
30
30
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"universal-postgres.d.ts","sourceRoot":"","sources":["../../src/database/universal-postgres.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"universal-postgres.d.ts","sourceRoot":"","sources":["../../src/database/universal-postgres.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,eAAe,EAA4C,MAAM,mBAAmB,CAAC;AAInG,MAAM,WAAW,8BAA8B;IAC7C;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;IAC5C;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,IAAI,EAAE,IAAI,CAAC;IACzB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC,CAAC;CACvD;AAmGD;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,GAAE,8BAAmC,GAC1C,eAAe,CAilBjB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,eAAe,UAAQ,GAAG,IAAI,CAa/D;AAGD,eAAe,wBAAwB,CAAC"}
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
* WARNING: This module uses Node.js-specific database drivers.
|
|
12
12
|
* Do NOT import in client-side code or edge runtime.
|
|
13
13
|
*/
|
|
14
|
-
import { defaultLogger } from '../instance/logger.js';
|
|
15
14
|
import { logger } from '../observability/logger.js';
|
|
16
15
|
import { safeParseRevealDocuments } from './safe-parse.js';
|
|
17
16
|
import { getSSLConfig } from './ssl-config.js';
|
|
@@ -122,7 +121,7 @@ export function universalPostgresAdapter(config = {}) {
|
|
|
122
121
|
await client.query('ROLLBACK');
|
|
123
122
|
}
|
|
124
123
|
catch (rollbackErr) {
|
|
125
|
-
|
|
124
|
+
logger.error(`${providerLabel} transaction rollback failed after error`, rollbackErr instanceof Error ? rollbackErr : new Error(String(rollbackErr)));
|
|
126
125
|
}
|
|
127
126
|
throw error;
|
|
128
127
|
}
|
|
@@ -203,7 +202,7 @@ export function universalPostgresAdapter(config = {}) {
|
|
|
203
202
|
}
|
|
204
203
|
}
|
|
205
204
|
catch (error) {
|
|
206
|
-
|
|
205
|
+
logger.error('Neon database query error', error instanceof Error ? error : new Error(String(error)));
|
|
207
206
|
throw error;
|
|
208
207
|
}
|
|
209
208
|
};
|
|
@@ -262,7 +261,7 @@ export function universalPostgresAdapter(config = {}) {
|
|
|
262
261
|
}
|
|
263
262
|
}
|
|
264
263
|
catch (error) {
|
|
265
|
-
|
|
264
|
+
logger.error('Supabase database query error', error instanceof Error ? error : new Error(String(error)));
|
|
266
265
|
throw error;
|
|
267
266
|
}
|
|
268
267
|
};
|
|
@@ -329,7 +328,7 @@ export function universalPostgresAdapter(config = {}) {
|
|
|
329
328
|
}
|
|
330
329
|
}
|
|
331
330
|
catch (error) {
|
|
332
|
-
|
|
331
|
+
logger.error('PostgreSQL query error', error instanceof Error ? error : new Error(String(error)));
|
|
333
332
|
throw error;
|
|
334
333
|
}
|
|
335
334
|
};
|
|
@@ -361,7 +360,7 @@ export function universalPostgresAdapter(config = {}) {
|
|
|
361
360
|
pendingCreations.length = 0;
|
|
362
361
|
}
|
|
363
362
|
catch (error) {
|
|
364
|
-
|
|
363
|
+
logger.error('Failed to create tables', error instanceof Error ? error : new Error(String(error)));
|
|
365
364
|
throw error;
|
|
366
365
|
}
|
|
367
366
|
}
|
|
@@ -370,7 +369,7 @@ export function universalPostgresAdapter(config = {}) {
|
|
|
370
369
|
await queryFn('SELECT 1', []);
|
|
371
370
|
}
|
|
372
371
|
catch (error) {
|
|
373
|
-
|
|
372
|
+
logger.error(`Failed to connect to ${provider} database`, error instanceof Error ? error : new Error(String(error)));
|
|
374
373
|
throw error;
|
|
375
374
|
}
|
|
376
375
|
},
|
|
@@ -404,7 +403,7 @@ export function universalPostgresAdapter(config = {}) {
|
|
|
404
403
|
}
|
|
405
404
|
catch (error) {
|
|
406
405
|
logger.error('[PGlite] Table creation failed', error instanceof Error ? error : new Error(String(error)));
|
|
407
|
-
|
|
406
|
+
logger.error('Failed to create tables before query', error instanceof Error ? error : new Error(String(error)));
|
|
408
407
|
throw error;
|
|
409
408
|
}
|
|
410
409
|
}
|
|
@@ -424,7 +423,7 @@ export function universalPostgresAdapter(config = {}) {
|
|
|
424
423
|
pendingCreations.length = 0;
|
|
425
424
|
}
|
|
426
425
|
catch (error) {
|
|
427
|
-
|
|
426
|
+
logger.error('Failed to create tables before transaction', error instanceof Error ? error : new Error(String(error)));
|
|
428
427
|
throw error;
|
|
429
428
|
}
|
|
430
429
|
}
|
|
@@ -512,8 +511,7 @@ export function universalPostgresAdapter(config = {}) {
|
|
|
512
511
|
// Remove from created set on failure so it can be retried
|
|
513
512
|
workerCreatedTables.delete(tableName);
|
|
514
513
|
logger.error('[PGlite] Worker FAILED to create table', error instanceof Error ? error : new Error(String(error)), { workerId: getWorkerID(), tableName });
|
|
515
|
-
|
|
516
|
-
defaultLogger.error('SQL:', createTableSQL);
|
|
514
|
+
logger.error(`Failed to create table ${tableName}`, error instanceof Error ? error : new Error(String(error)), { sql: createTableSQL });
|
|
517
515
|
throw error;
|
|
518
516
|
}
|
|
519
517
|
})();
|
|
@@ -593,8 +591,7 @@ export function universalPostgresAdapter(config = {}) {
|
|
|
593
591
|
catch (error) {
|
|
594
592
|
// Remove from created set on failure so it can be retried
|
|
595
593
|
workerCreatedTables.delete(tableName);
|
|
596
|
-
|
|
597
|
-
defaultLogger.error('SQL:', createTableSQL);
|
|
594
|
+
logger.error(`Failed to create global table ${tableName}`, error instanceof Error ? error : new Error(String(error)), { sql: createTableSQL });
|
|
598
595
|
throw error;
|
|
599
596
|
}
|
|
600
597
|
})();
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deployment mode detection (GAP-260 P4-1).
|
|
3
|
+
*
|
|
4
|
+
* Hosted SaaS vs self-hosted Forge must not be inferred only from the presence
|
|
5
|
+
* of the license signing private key. That coupling bricks admin when the key
|
|
6
|
+
* is removed for signer isolation (private key leaves admin / lives only in
|
|
7
|
+
* license-signer).
|
|
8
|
+
*
|
|
9
|
+
* Preference order:
|
|
10
|
+
* 1. Explicit `REVEALUI_DEPLOYMENT_MODE=hosted|forge` (case-insensitive trim)
|
|
11
|
+
* 2. Fallback (overlap window): private key present → hosted, else forge
|
|
12
|
+
*
|
|
13
|
+
* Sign-capable surfaces still require the private key at mint time; this module
|
|
14
|
+
* only answers "which product posture is this process".
|
|
15
|
+
*/
|
|
16
|
+
export type DeploymentMode = 'forge' | 'hosted';
|
|
17
|
+
export type DeploymentModeEnv = Record<string, string | undefined>;
|
|
18
|
+
export interface DetectDeploymentModeOptions {
|
|
19
|
+
/**
|
|
20
|
+
* When true, empty-string env values count as "present" (Vercel Sensitive
|
|
21
|
+
* pull semantics). When false (default), empty string is treated as missing.
|
|
22
|
+
*/
|
|
23
|
+
lenient?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Resolve deployment mode from env.
|
|
27
|
+
*
|
|
28
|
+
* Explicit MODE always wins when set to `hosted` or `forge`. Any other
|
|
29
|
+
* non-empty MODE value is ignored (falls through to key-presence) so a typo
|
|
30
|
+
* does not hard-brick boot during the dual-run window; production boot
|
|
31
|
+
* validators may still warn separately.
|
|
32
|
+
*/
|
|
33
|
+
export declare function detectDeploymentMode(env: DeploymentModeEnv, { lenient }?: DetectDeploymentModeOptions): DeploymentMode;
|
|
34
|
+
/** Convenience: true when the process is in hosted SaaS posture. */
|
|
35
|
+
export declare function isHostedDeployment(env?: DeploymentModeEnv, options?: DetectDeploymentModeOptions): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Consistency check for CI / pre-deploy: forge mode must not also carry the
|
|
38
|
+
* signing private key (confused deputy). Hosted without private key is allowed
|
|
39
|
+
* (signer isolation target).
|
|
40
|
+
*
|
|
41
|
+
* Returns an error message or null when OK.
|
|
42
|
+
*/
|
|
43
|
+
export declare function deploymentModeKeyConsistencyError(env: DeploymentModeEnv, { lenient }?: DetectDeploymentModeOptions): string | null;
|
|
44
|
+
//# sourceMappingURL=deployment-mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment-mode.d.ts","sourceRoot":"","sources":["../src/deployment-mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEhD,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAEnE,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAOD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,iBAAiB,EACtB,EAAE,OAAe,EAAE,GAAE,2BAAgC,GACpD,cAAc,CAMhB;AAED,oEAAoE;AACpE,wBAAgB,kBAAkB,CAChC,GAAG,GAAE,iBAAoD,EACzD,OAAO,CAAC,EAAE,2BAA2B,GACpC,OAAO,CAET;AAED;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,iBAAiB,EACtB,EAAE,OAAe,EAAE,GAAE,2BAAgC,GACpD,MAAM,GAAG,IAAI,CAYf"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deployment mode detection (GAP-260 P4-1).
|
|
3
|
+
*
|
|
4
|
+
* Hosted SaaS vs self-hosted Forge must not be inferred only from the presence
|
|
5
|
+
* of the license signing private key. That coupling bricks admin when the key
|
|
6
|
+
* is removed for signer isolation (private key leaves admin / lives only in
|
|
7
|
+
* license-signer).
|
|
8
|
+
*
|
|
9
|
+
* Preference order:
|
|
10
|
+
* 1. Explicit `REVEALUI_DEPLOYMENT_MODE=hosted|forge` (case-insensitive trim)
|
|
11
|
+
* 2. Fallback (overlap window): private key present → hosted, else forge
|
|
12
|
+
*
|
|
13
|
+
* Sign-capable surfaces still require the private key at mint time; this module
|
|
14
|
+
* only answers "which product posture is this process".
|
|
15
|
+
*/
|
|
16
|
+
function isPresent(env, key, lenient) {
|
|
17
|
+
if (lenient)
|
|
18
|
+
return env[key] !== undefined;
|
|
19
|
+
return Boolean(env[key]);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Resolve deployment mode from env.
|
|
23
|
+
*
|
|
24
|
+
* Explicit MODE always wins when set to `hosted` or `forge`. Any other
|
|
25
|
+
* non-empty MODE value is ignored (falls through to key-presence) so a typo
|
|
26
|
+
* does not hard-brick boot during the dual-run window; production boot
|
|
27
|
+
* validators may still warn separately.
|
|
28
|
+
*/
|
|
29
|
+
export function detectDeploymentMode(env, { lenient = false } = {}) {
|
|
30
|
+
const raw = (env.REVEALUI_DEPLOYMENT_MODE ?? '').trim().toLowerCase();
|
|
31
|
+
if (raw === 'hosted' || raw === 'forge') {
|
|
32
|
+
return raw;
|
|
33
|
+
}
|
|
34
|
+
return isPresent(env, 'REVEALUI_LICENSE_PRIVATE_KEY', lenient) ? 'hosted' : 'forge';
|
|
35
|
+
}
|
|
36
|
+
/** Convenience: true when the process is in hosted SaaS posture. */
|
|
37
|
+
export function isHostedDeployment(env = process.env, options) {
|
|
38
|
+
return detectDeploymentMode(env, options) === 'hosted';
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Consistency check for CI / pre-deploy: forge mode must not also carry the
|
|
42
|
+
* signing private key (confused deputy). Hosted without private key is allowed
|
|
43
|
+
* (signer isolation target).
|
|
44
|
+
*
|
|
45
|
+
* Returns an error message or null when OK.
|
|
46
|
+
*/
|
|
47
|
+
export function deploymentModeKeyConsistencyError(env, { lenient = false } = {}) {
|
|
48
|
+
const raw = (env.REVEALUI_DEPLOYMENT_MODE ?? '').trim().toLowerCase();
|
|
49
|
+
if (raw !== 'hosted' && raw !== 'forge')
|
|
50
|
+
return null;
|
|
51
|
+
const hasPriv = isPresent(env, 'REVEALUI_LICENSE_PRIVATE_KEY', lenient);
|
|
52
|
+
if (raw === 'forge' && hasPriv) {
|
|
53
|
+
return ('REVEALUI_DEPLOYMENT_MODE=forge but REVEALUI_LICENSE_PRIVATE_KEY is set. ' +
|
|
54
|
+
'Forge kits must not hold the studio signing key. Remove the private key ' +
|
|
55
|
+
'or set MODE=hosted.');
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
@@ -64,10 +64,22 @@ export declare class NetworkError extends Error {
|
|
|
64
64
|
statusCode?: number | undefined;
|
|
65
65
|
constructor(message: string, statusCode?: number | undefined);
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Client-side form / UI validation error (field-map payload).
|
|
69
|
+
*
|
|
70
|
+
* Not the same class as domain `ValidationError` in `utils/errors.ts`.
|
|
71
|
+
* Renamed from ValidationError (P2-A fleet-redundancy) so `instanceof` and
|
|
72
|
+
* `name` no longer collide with API/field-ingress errors.
|
|
73
|
+
*/
|
|
74
|
+
export declare class ClientValidationError extends Error {
|
|
68
75
|
fields?: Record<string, string> | undefined;
|
|
69
76
|
constructor(message: string, fields?: Record<string, string> | undefined);
|
|
70
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* @deprecated Use {@link ClientValidationError}. Alias kept for one minor.
|
|
80
|
+
*/
|
|
81
|
+
export declare const ValidationError: typeof ClientValidationError;
|
|
82
|
+
export type ValidationError = ClientValidationError;
|
|
71
83
|
export declare class AuthenticationError extends Error {
|
|
72
84
|
constructor(message: string);
|
|
73
85
|
}
|
|
@@ -79,7 +91,9 @@ export declare class NotFoundError extends Error {
|
|
|
79
91
|
* Error classification
|
|
80
92
|
*/
|
|
81
93
|
export declare function isNetworkError(error: unknown): error is NetworkError;
|
|
82
|
-
export declare function
|
|
94
|
+
export declare function isClientValidationError(error: unknown): error is ClientValidationError;
|
|
95
|
+
/** @deprecated Prefer {@link isClientValidationError}; still instanceof-only (no name check). */
|
|
96
|
+
export declare function isValidationError(error: unknown): error is ClientValidationError;
|
|
83
97
|
export declare function isAuthenticationError(error: unknown): error is AuthenticationError;
|
|
84
98
|
export declare function isNotFoundError(error: unknown): error is NotFoundError;
|
|
85
99
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-boundary.d.ts","sourceRoot":"","sources":["../../src/error-handling/error-boundary.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzD,MAAM,WAAW,SAAS;IACxB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,SAAS,KAAK,SAAS,CAAC,CAAC;IAC5E,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,SAAS,KAAK,IAAI,CAAC;IACxD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;CAC7B;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;gBACtE,KAAK,EAAE,kBAAkB;IASrC,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAO1E,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;IAgB3D,kBAAkB,CAAC,SAAS,EAAE,kBAAkB,GAAG,IAAI;IAevD,KAAK,QAAO,IAAI,CAUd;IAEF,MAAM,IAAI,SAAS;CA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Ac,SAAQ,KAAK;IAG7B,QAAQ,CAAC,EAAE,MAAM;gBADxB,OAAO,EAAE,MAAM,EACR,QAAQ,CAAC,EAAE,MAAM,YAAA;CAK3B;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB,CAEtF;AAED,iGAAiG;AACjG,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB,CAEhF;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAKlF;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAItE;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AAEnE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,aAAa,CAO5D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAStD"}
|
|
@@ -227,14 +227,25 @@ export class NetworkError extends Error {
|
|
|
227
227
|
this.name = 'NetworkError';
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
|
|
230
|
+
/**
|
|
231
|
+
* Client-side form / UI validation error (field-map payload).
|
|
232
|
+
*
|
|
233
|
+
* Not the same class as domain `ValidationError` in `utils/errors.ts`.
|
|
234
|
+
* Renamed from ValidationError (P2-A fleet-redundancy) so `instanceof` and
|
|
235
|
+
* `name` no longer collide with API/field-ingress errors.
|
|
236
|
+
*/
|
|
237
|
+
export class ClientValidationError extends Error {
|
|
231
238
|
fields;
|
|
232
239
|
constructor(message, fields) {
|
|
233
240
|
super(message);
|
|
234
241
|
this.fields = fields;
|
|
235
|
-
this.name = '
|
|
242
|
+
this.name = 'ClientValidationError';
|
|
236
243
|
}
|
|
237
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* @deprecated Use {@link ClientValidationError}. Alias kept for one minor.
|
|
247
|
+
*/
|
|
248
|
+
export const ValidationError = ClientValidationError;
|
|
238
249
|
export class AuthenticationError extends Error {
|
|
239
250
|
constructor(message) {
|
|
240
251
|
super(message);
|
|
@@ -255,8 +266,12 @@ export class NotFoundError extends Error {
|
|
|
255
266
|
export function isNetworkError(error) {
|
|
256
267
|
return error instanceof NetworkError || (error instanceof Error && error.name === 'NetworkError');
|
|
257
268
|
}
|
|
269
|
+
export function isClientValidationError(error) {
|
|
270
|
+
return error instanceof ClientValidationError;
|
|
271
|
+
}
|
|
272
|
+
/** @deprecated Prefer {@link isClientValidationError}; still instanceof-only (no name check). */
|
|
258
273
|
export function isValidationError(error) {
|
|
259
|
-
return (error
|
|
274
|
+
return isClientValidationError(error);
|
|
260
275
|
}
|
|
261
276
|
export function isAuthenticationError(error) {
|
|
262
277
|
return (error instanceof AuthenticationError ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-reporter.d.ts","sourceRoot":"","sources":["../../src/error-handling/error-reporter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"error-reporter.d.ts","sourceRoot":"","sources":["../../src/error-handling/error-reporter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAyB,KAAK,SAAS,EAAgB,MAAM,qBAAqB,CAAC;AAE1F,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC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,KAAK,WAAW,GAAG,IAAI,CAAC;CAC1D,GAAG,IAAI,CAgEP;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAQhF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAQ9D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,GAChB,IAAI,CAaN;AAED;;GAEG;AACH,eAAO,MAAM,YAAY;IACvB;;OAEG;8BACuB,KAAK,KAAG,OAAO;IAMzC;;OAEG;2BACoB,KAAK,KAAG,OAAO;IAItC;;OAEG;6BACsB,KAAK,KAAG,OAAO;IAIxC;;OAEG;+BACwB,MAAM,EAAE,KAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC;CAKlE,CAAC"}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Integrates with error tracking services (Sentry, Bugsnag, etc.)
|
|
5
5
|
*/
|
|
6
6
|
import { logger } from '../observability/logger.js';
|
|
7
|
+
import { ValidationError as DomainValidationError } from '../utils/errors.js';
|
|
8
|
+
import { ClientValidationError, NetworkError } from './error-boundary.js';
|
|
7
9
|
/**
|
|
8
10
|
* Error reporting system
|
|
9
11
|
*/
|
|
@@ -189,10 +191,12 @@ export class ErrorReportingSystem {
|
|
|
189
191
|
if (error.name === 'TypeError' || error.name === 'ReferenceError') {
|
|
190
192
|
return 'error';
|
|
191
193
|
}
|
|
192
|
-
|
|
194
|
+
// instanceof only — name checks false-positive across dual ValidationError
|
|
195
|
+
// classes (P2-A fleet-redundancy).
|
|
196
|
+
if (error instanceof NetworkError) {
|
|
193
197
|
return 'warning';
|
|
194
198
|
}
|
|
195
|
-
if (error
|
|
199
|
+
if (error instanceof ClientValidationError || error instanceof DomainValidationError) {
|
|
196
200
|
return 'warning';
|
|
197
201
|
}
|
|
198
202
|
return 'error';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
export type { CircuitBreakerConfig, CircuitBreakerStats, CircuitState, RetryConfig, RetryOptions, } from '@revealui/resilience';
|
|
7
7
|
export { AdaptiveCircuitBreaker, Bulkhead, CircuitBreak, CircuitBreaker, CircuitBreakerOpenError, CircuitBreakerRegistry, calculateDelay, circuitBreakerRegistry, createCircuitBreakerMiddleware, createResilientFunction, createRetryMiddleware, ExponentialBackoff, fetchWithCircuitBreaker, fetchWithRetry, globalRetryConfig, ResilientOperation, Retryable, RetryableOperation, RetryPolicies, RetryPolicyBuilder, retry, retryBatch, retryIf, retryUntil, retryWithFallback, sleep, withCircuitBreaker, } from '@revealui/resilience';
|
|
8
8
|
export type { ErrorBoundaryProps, ErrorBoundaryState, ErrorBoundaryWithRetryProps, ErrorInfo, ErrorSeverity, } from './error-boundary';
|
|
9
|
-
export { AuthenticationError, ErrorBoundary, ErrorBoundaryWithRetry, getErrorSeverity, isAuthenticationError, isNetworkError, isNotFoundError, isValidationError, NetworkError, NotFoundError, shouldRetryError, useErrorHandler, ValidationError, withErrorBoundary, } from './error-boundary';
|
|
9
|
+
export { AuthenticationError, ClientValidationError, ErrorBoundary, ErrorBoundaryWithRetry, getErrorSeverity, isAuthenticationError, isClientValidationError, isNetworkError, isNotFoundError, isValidationError, NetworkError, NotFoundError, shouldRetryError, useErrorHandler, ValidationError, withErrorBoundary, } from './error-boundary';
|
|
10
10
|
export type { Breadcrumb, ErrorContext, ErrorLevel, ErrorReport, ErrorReporter, UserContext, } from './error-reporter';
|
|
11
11
|
export { ConsoleErrorReporter, ErrorFilters, ErrorReportingSystem, errorReporter, HTTPErrorReporter, initializeErrorReporting, LoggingErrorReporter, trackAction, trackAPICall, trackNavigation, } from './error-reporter';
|
|
12
12
|
export type { ErrorFallbackProps } from './fallback-components';
|