@revealui/core 0.5.6 → 0.6.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/dist/api/compression.d.ts +3 -4
- package/dist/api/compression.d.ts.map +1 -1
- package/dist/api/compression.js +1 -2
- package/dist/api/rate-limit.d.ts +10 -11
- package/dist/api/rate-limit.d.ts.map +1 -1
- package/dist/api/rate-limit.js +2 -3
- package/dist/api/response-cache.d.ts +8 -9
- package/dist/api/response-cache.d.ts.map +1 -1
- package/dist/api/response-cache.js +2 -3
- package/dist/client/admin/layout.d.ts.map +1 -1
- package/dist/client/admin/layout.js +1 -3
- package/dist/generated/types/admin.d.ts +2 -2
- package/dist/generated/types/admin.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/license-encryption.d.ts +11 -2
- package/dist/license-encryption.d.ts.map +1 -1
- package/dist/license-encryption.js +77 -22
- package/dist/license.d.ts +68 -5
- package/dist/license.d.ts.map +1 -1
- package/dist/license.js +157 -15
- package/dist/nextjs/index.d.ts +0 -1
- package/dist/nextjs/index.d.ts.map +1 -1
- package/dist/nextjs/index.js +7 -2
- package/dist/nextjs/withRevealUI.d.ts +29 -1
- package/dist/nextjs/withRevealUI.d.ts.map +1 -1
- package/dist/observability/logger.d.ts +0 -4
- package/dist/observability/logger.d.ts.map +1 -1
- package/dist/observability/logger.js +2 -29
- package/dist/revealui.d.ts +0 -5
- package/dist/revealui.d.ts.map +1 -1
- package/dist/revealui.js +0 -10
- package/dist/richtext/exports/server/rsc.d.ts +2 -17
- package/dist/richtext/exports/server/rsc.d.ts.map +1 -1
- package/dist/richtext/exports/server/rsc.js +9 -54
- package/dist/utils/api-wrapper.d.ts +4 -6
- package/dist/utils/api-wrapper.d.ts.map +1 -1
- package/dist/utils/api-wrapper.js +6 -9
- package/package.json +56 -17
|
@@ -109,32 +109,5 @@ export function logSystemEvent(event, context) {
|
|
|
109
109
|
event,
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
*/
|
|
115
|
-
export function sanitizeLogData(data) {
|
|
116
|
-
const sensitiveKeys = [
|
|
117
|
-
'password',
|
|
118
|
-
'token',
|
|
119
|
-
'secret',
|
|
120
|
-
'apiKey',
|
|
121
|
-
'accessToken',
|
|
122
|
-
'refreshToken',
|
|
123
|
-
'creditCard',
|
|
124
|
-
'ssn',
|
|
125
|
-
];
|
|
126
|
-
const sanitized = {};
|
|
127
|
-
for (const [key, value] of Object.entries(data)) {
|
|
128
|
-
const lowerKey = key.toLowerCase();
|
|
129
|
-
if (sensitiveKeys.some((sensitive) => lowerKey.includes(sensitive.toLowerCase()))) {
|
|
130
|
-
sanitized[key] = '[REDACTED]';
|
|
131
|
-
}
|
|
132
|
-
else if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
133
|
-
sanitized[key] = sanitizeLogData(value);
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
sanitized[key] = value;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return sanitized;
|
|
140
|
-
}
|
|
112
|
+
// Log redaction lives in @revealui/security — import `redactLogContext`
|
|
113
|
+
// (recursive walker) or `redactLogField` (single key/value) from there.
|
package/dist/revealui.d.ts
CHANGED
|
@@ -18,11 +18,6 @@ export declare function beforeChangeTraverseFields(args: RevealUITraverseFieldsA
|
|
|
18
18
|
export declare function beforeValidateTraverseFields(args: RevealUITraverseFieldsArgs): Promise<RevealUITraverseFieldsResult>;
|
|
19
19
|
import type { RevealUIDependencyCheckArgs } from './types/index.js';
|
|
20
20
|
export declare function checkDependencies(args: RevealUIDependencyCheckArgs): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated Use deepMerge from '@revealui/core/config/utils' or '@revealui/core' instead
|
|
23
|
-
* This function is kept for backward compatibility but will be removed in a future version.
|
|
24
|
-
*/
|
|
25
|
-
export declare function deepMergeSimple<T extends Record<string, unknown>>(target: T, source: Partial<T>): T;
|
|
26
21
|
import type { JSONSchema4TypeName } from 'json-schema';
|
|
27
22
|
import type React from 'react';
|
|
28
23
|
import type { RevealUIBlock, RevealUIEnhancedField, RevealUIField, RevealUIRichTextAdapter } from './types/index.js';
|
package/dist/revealui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revealui.d.ts","sourceRoot":"","sources":["../src/revealui.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EACL,YAAY,EACZ,aAAa,EACb,MAAM,EACN,KAAK,cAAc,GACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE,OAAO,EACL,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAG9E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAIzD,OAAO,KAAK,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAEjG,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,0BAA0B,GAC/B,OAAO,CAAC,4BAA4B,CAAC,CAIvC;AAED,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,0BAA0B,GAC/B,OAAO,CAAC,4BAA4B,CAAC,CAIvC;AAED,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,0BAA0B,GAC/B,OAAO,CAAC,4BAA4B,CAAC,CAIvC;AAED,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,0BAA0B,GAC/B,OAAO,CAAC,4BAA4B,CAAC,C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,CAAC,YAAY,CAAC;AAC1C,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAG/B,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,mBAAmB,EAC7B,UAAU,EAAE,OAAO,GAClB,mBAAmB,GAAG,mBAAmB,EAAE,GAAG,SAAS,CAGzD"}
|
package/dist/revealui.js
CHANGED
|
@@ -75,16 +75,6 @@ export function checkDependencies(args) {
|
|
|
75
75
|
// No dependencies found or all dependencies are valid
|
|
76
76
|
return true;
|
|
77
77
|
}
|
|
78
|
-
// Deep merge utility - re-exported from config/utils for convenience
|
|
79
|
-
import { deepMerge as coreDeepMerge } from './config/utils.js';
|
|
80
|
-
/**
|
|
81
|
-
* @deprecated Use deepMerge from '@revealui/core/config/utils' or '@revealui/core' instead
|
|
82
|
-
* This function is kept for backward compatibility but will be removed in a future version.
|
|
83
|
-
*/
|
|
84
|
-
export function deepMergeSimple(target, source) {
|
|
85
|
-
// Use the canonical deepMerge implementation from config/utils
|
|
86
|
-
return coreDeepMerge(target, source);
|
|
87
|
-
}
|
|
88
78
|
// JSON Schema utility
|
|
89
79
|
export function withNullableJSONSchemaType(typeName, isRequired) {
|
|
90
80
|
// Return the type name, or an array including null if not required
|
|
@@ -4,26 +4,11 @@
|
|
|
4
4
|
* Provides server-side rendering components for Lexical content.
|
|
5
5
|
* Converts Lexical JSON state to React elements without requiring a browser.
|
|
6
6
|
*/
|
|
7
|
+
import { isSafeUrl, sanitizeUrl } from '@revealui/security';
|
|
7
8
|
import type { SerializedEditorState, SerializedLexicalNode } from 'lexical';
|
|
8
9
|
import { type JSX } from 'react';
|
|
9
10
|
export type { SerializedEditorState };
|
|
10
|
-
|
|
11
|
-
* Check whether a URL is safe to render in an href attribute.
|
|
12
|
-
*
|
|
13
|
-
* Blocks javascript:, vbscript:, data: (except data:image/ for images),
|
|
14
|
-
* and other dangerous protocols. Handles case-insensitive matching and
|
|
15
|
-
* leading whitespace tricks.
|
|
16
|
-
*
|
|
17
|
-
* @param url - The URL to validate
|
|
18
|
-
* @param context - Whether this URL is for a link href or image src
|
|
19
|
-
* @returns true if the URL is safe to render
|
|
20
|
-
*/
|
|
21
|
-
export declare function isSafeUrl(url: string, context?: 'link' | 'image'): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Sanitize a URL for use in an href or src attribute.
|
|
24
|
-
* Returns '#' if the URL is not safe.
|
|
25
|
-
*/
|
|
26
|
-
export declare function sanitizeUrl(url: string, context?: 'link' | 'image'): string;
|
|
11
|
+
export { isSafeUrl, sanitizeUrl };
|
|
27
12
|
interface SerializedElementNode extends SerializedLexicalNode {
|
|
28
13
|
type: string;
|
|
29
14
|
children?: SerializedLexicalNode[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../../../../src/richtext/exports/server/rsc.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAY,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAG3C,YAAY,EAAE,qBAAqB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../../../../src/richtext/exports/server/rsc.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAY,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAG3C,YAAY,EAAE,qBAAqB,EAAE,CAAC;AAKtC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;AAyBlC,UAAU,qBAAsB,SAAQ,qBAAqB;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACnC,SA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,qBAAqB,GAAG,IAAI,GAAG,SAAS,GAC7C,OAAO,CAAC,MAAM,CAAC,CA2CjB;AAMD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,wBAAwB,kDAYhF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,yBAAyB,kDAYlF;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,qBAAqB,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,KAAK,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;IAC/E,UAAU,CAAC,EAAE,CACX,IAAI,EAAE,kBAAkB,EACxB,QAAQ,EAAE,GAAG,CAAC,OAAO,GAAG,IAAI,EAC5B,KAAK,EAAE,MAAM,KACV,GAAG,CAAC,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,CACZ,IAAI,EAAE;QACJ,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,EACD,KAAK,EAAE,MAAM,KACV,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;CACzB;AAED,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,SAAS,EACT,WAAW,EACX,UAAU,EACV,WAAW,GACZ,EAAE,oBAAoB,kDAgBtB;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -1,61 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment } from 'react';
|
|
3
|
-
// ============================================
|
|
4
|
-
// URL SANITIZATION
|
|
5
|
-
// ============================================
|
|
6
|
-
/**
|
|
7
|
-
* Protocols that are safe to render in href/src attributes.
|
|
8
|
-
* Anything not matching these will be replaced with '#'.
|
|
9
|
-
*/
|
|
10
|
-
const SAFE_LINK_PROTOCOLS = /^(?:https?:|mailto:|tel:|#|\/)/i;
|
|
11
|
-
/**
|
|
12
|
-
* Data URIs that are safe for image src attributes (base64 images only).
|
|
13
|
-
* data:text/html and similar are blocked.
|
|
14
|
-
*/
|
|
15
|
-
const SAFE_IMAGE_DATA_URI = /^data:image\//i;
|
|
16
2
|
/**
|
|
17
|
-
*
|
|
3
|
+
* RevealUI Rich Text Editor - React Server Components
|
|
18
4
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* leading whitespace tricks.
|
|
22
|
-
*
|
|
23
|
-
* @param url - The URL to validate
|
|
24
|
-
* @param context - Whether this URL is for a link href or image src
|
|
25
|
-
* @returns true if the URL is safe to render
|
|
26
|
-
*/
|
|
27
|
-
export function isSafeUrl(url, context = 'link') {
|
|
28
|
-
// Trim whitespace (catches " javascript:" trick)
|
|
29
|
-
const trimmed = url.trim();
|
|
30
|
-
if (trimmed === '' || trimmed === '#') {
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
// For image context, allow data:image/ URIs (base64 images)
|
|
34
|
-
if (context === 'image' && SAFE_IMAGE_DATA_URI.test(trimmed)) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
// Block all data: URIs for links (and non-image data: for images)
|
|
38
|
-
if (/^data:/i.test(trimmed)) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
// Block javascript: and vbscript: protocols (case-insensitive)
|
|
42
|
-
if (/^(?:javascript|vbscript):/i.test(trimmed)) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
// Relative paths, anchors, and safe protocols are allowed
|
|
46
|
-
if (SAFE_LINK_PROTOCOLS.test(trimmed) || !trimmed.includes(':')) {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
// Unknown protocol - block it
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Sanitize a URL for use in an href or src attribute.
|
|
54
|
-
* Returns '#' if the URL is not safe.
|
|
5
|
+
* Provides server-side rendering components for Lexical content.
|
|
6
|
+
* Converts Lexical JSON state to React elements without requiring a browser.
|
|
55
7
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
8
|
+
import { isSafeUrl, sanitizeUrl } from '@revealui/security';
|
|
9
|
+
import { Fragment } from 'react';
|
|
10
|
+
// URL sanitization is owned by @revealui/security (single source of truth
|
|
11
|
+
// for every untrusted-string sink across the Suite). Re-exported here so
|
|
12
|
+
// existing consumers keep working.
|
|
13
|
+
export { isSafeUrl, sanitizeUrl };
|
|
59
14
|
// ============================================
|
|
60
15
|
// TEXT FORMAT CONSTANTS
|
|
61
16
|
// ============================================
|
|
@@ -4,12 +4,10 @@
|
|
|
4
4
|
* Wraps Next.js API routes to automatically set up request context,
|
|
5
5
|
* error handling, and logging.
|
|
6
6
|
*/
|
|
7
|
-
import type { NextRequest } from 'next/server';
|
|
8
|
-
import { NextResponse } from 'next/server';
|
|
9
7
|
/**
|
|
10
8
|
* API route handler function
|
|
11
9
|
*/
|
|
12
|
-
export type ApiHandler
|
|
10
|
+
export type ApiHandler = (request: Request) => Promise<Response>;
|
|
13
11
|
/**
|
|
14
12
|
* Wrap an API route handler with request context, logging, and error handling
|
|
15
13
|
*
|
|
@@ -27,18 +25,18 @@ export type ApiHandler<T = unknown> = (request: NextRequest) => Promise<Response
|
|
|
27
25
|
* ```typescript
|
|
28
26
|
* // app/api/users/route.ts
|
|
29
27
|
* import { withRequestContext } from '@revealui/core/utils/api-wrapper'
|
|
30
|
-
*
|
|
28
|
+
* // Uses standard Web API Request/Response
|
|
31
29
|
*
|
|
32
30
|
* export const GET = withRequestContext(async (request) => {
|
|
33
31
|
* // Request ID automatically available in logs
|
|
34
32
|
* logger.info('Fetching users') // Includes requestId automatically
|
|
35
33
|
*
|
|
36
34
|
* const users = await db.query.users.findMany()
|
|
37
|
-
* return
|
|
35
|
+
* return Response.json(users)
|
|
38
36
|
* })
|
|
39
37
|
* ```
|
|
40
38
|
*/
|
|
41
|
-
export declare function withRequestContext
|
|
39
|
+
export declare function withRequestContext(handler: ApiHandler): ApiHandler;
|
|
42
40
|
/**
|
|
43
41
|
* Server action wrapper for request context
|
|
44
42
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-wrapper.d.ts","sourceRoot":"","sources":["../../src/utils/api-wrapper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"api-wrapper.d.ts","sourceRoot":"","sources":["../../src/utils/api-wrapper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU,CAsElE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,SAAS,OAAO,EAAE,EAAE,OAAO,EACtE,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,GAC3C,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAkCtC"}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* Wraps Next.js API routes to automatically set up request context,
|
|
5
5
|
* error handling, and logging.
|
|
6
6
|
*/
|
|
7
|
-
import { NextResponse } from 'next/server';
|
|
8
7
|
import { handleApiError } from './errors.js';
|
|
9
8
|
import { logger } from './logger.js';
|
|
10
9
|
import { createRequestContext, getRequestDuration, runInRequestContext, } from './request-context.js';
|
|
@@ -25,14 +24,14 @@ import { createRequestContext, getRequestDuration, runInRequestContext, } from '
|
|
|
25
24
|
* ```typescript
|
|
26
25
|
* // app/api/users/route.ts
|
|
27
26
|
* import { withRequestContext } from '@revealui/core/utils/api-wrapper'
|
|
28
|
-
*
|
|
27
|
+
* // Uses standard Web API Request/Response
|
|
29
28
|
*
|
|
30
29
|
* export const GET = withRequestContext(async (request) => {
|
|
31
30
|
* // Request ID automatically available in logs
|
|
32
31
|
* logger.info('Fetching users') // Includes requestId automatically
|
|
33
32
|
*
|
|
34
33
|
* const users = await db.query.users.findMany()
|
|
35
|
-
* return
|
|
34
|
+
* return Response.json(users)
|
|
36
35
|
* })
|
|
37
36
|
* ```
|
|
38
37
|
*/
|
|
@@ -41,7 +40,7 @@ export function withRequestContext(handler) {
|
|
|
41
40
|
// Create request context from headers
|
|
42
41
|
const context = createRequestContext({
|
|
43
42
|
headers: Object.fromEntries(request.headers.entries()),
|
|
44
|
-
path: request.
|
|
43
|
+
path: new URL(request.url).pathname,
|
|
45
44
|
method: request.method,
|
|
46
45
|
ip: request.headers.get('x-forwarded-for') || request.headers.get('x-real-ip') || undefined,
|
|
47
46
|
});
|
|
@@ -64,10 +63,8 @@ export function withRequestContext(handler) {
|
|
|
64
63
|
duration,
|
|
65
64
|
});
|
|
66
65
|
// Add request ID to response headers
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
response.headers.set('x-request-duration', duration?.toString() || '0');
|
|
70
|
-
}
|
|
66
|
+
response.headers.set('x-request-id', context.requestId);
|
|
67
|
+
response.headers.set('x-request-duration', duration?.toString() || '0');
|
|
71
68
|
return response;
|
|
72
69
|
}
|
|
73
70
|
catch (error) {
|
|
@@ -84,7 +81,7 @@ export function withRequestContext(handler) {
|
|
|
84
81
|
method: context.method,
|
|
85
82
|
path: context.path,
|
|
86
83
|
});
|
|
87
|
-
const errorResponse =
|
|
84
|
+
const errorResponse = Response.json({
|
|
88
85
|
error: {
|
|
89
86
|
message: apiError.message,
|
|
90
87
|
code: apiError.code,
|
package/package.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revealui/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Runtime engine, REST API, auth, rich text, admin UI, and plugins for RevealUI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@electric-sql/pglite": "^0.4.
|
|
8
|
-
"@lexical/clipboard": "^0.
|
|
9
|
-
"@lexical/code": "^0.
|
|
10
|
-
"@lexical/html": "^0.
|
|
11
|
-
"@lexical/link": "^0.
|
|
12
|
-
"@lexical/list": "^0.
|
|
13
|
-
"@lexical/react": "^0.
|
|
14
|
-
"@lexical/rich-text": "^0.
|
|
15
|
-
"@lexical/selection": "^0.
|
|
16
|
-
"@lexical/table": "^0.
|
|
17
|
-
"@lexical/utils": "^0.
|
|
18
|
-
"@lexical/yjs": "^0.
|
|
7
|
+
"@electric-sql/pglite": "^0.4.4",
|
|
8
|
+
"@lexical/clipboard": "^0.43.0",
|
|
9
|
+
"@lexical/code": "^0.43.0",
|
|
10
|
+
"@lexical/html": "^0.43.0",
|
|
11
|
+
"@lexical/link": "^0.43.0",
|
|
12
|
+
"@lexical/list": "^0.43.0",
|
|
13
|
+
"@lexical/react": "^0.43.0",
|
|
14
|
+
"@lexical/rich-text": "^0.43.0",
|
|
15
|
+
"@lexical/selection": "^0.43.0",
|
|
16
|
+
"@lexical/table": "^0.43.0",
|
|
17
|
+
"@lexical/utils": "^0.43.0",
|
|
18
|
+
"@lexical/yjs": "^0.43.0",
|
|
19
19
|
"@vercel/blob": "^2.3.3",
|
|
20
20
|
"bcryptjs": "^3.0.3",
|
|
21
21
|
"dataloader": "^2.2.3",
|
|
22
22
|
"jose": "^6.2.2",
|
|
23
|
-
"lexical": "^0.
|
|
23
|
+
"lexical": "^0.43.0",
|
|
24
24
|
"pg": "^8.20.0",
|
|
25
25
|
"yjs": "^13.6.30",
|
|
26
26
|
"zod": "^4.3.6",
|
|
27
27
|
"@revealui/cache": "0.1.4",
|
|
28
|
-
"@revealui/contracts": "1.
|
|
28
|
+
"@revealui/contracts": "1.4.0",
|
|
29
29
|
"@revealui/resilience": "0.2.4",
|
|
30
|
-
"@revealui/security": "0.
|
|
30
|
+
"@revealui/security": "0.3.0",
|
|
31
31
|
"@revealui/utils": "0.3.4"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
@@ -113,6 +113,10 @@
|
|
|
113
113
|
"types": "./dist/database/ssl-config.d.ts",
|
|
114
114
|
"import": "./dist/database/ssl-config.js"
|
|
115
115
|
},
|
|
116
|
+
"./database/type-adapter": {
|
|
117
|
+
"types": "./dist/database/type-adapter.d.ts",
|
|
118
|
+
"import": "./dist/database/type-adapter.js"
|
|
119
|
+
},
|
|
116
120
|
"./storage": {
|
|
117
121
|
"types": "./dist/storage/index.d.ts",
|
|
118
122
|
"import": "./dist/storage/index.js"
|
|
@@ -169,10 +173,38 @@
|
|
|
169
173
|
"types": "./dist/api/rest.d.ts",
|
|
170
174
|
"import": "./dist/api/rest.js"
|
|
171
175
|
},
|
|
176
|
+
"./api/compression": {
|
|
177
|
+
"types": "./dist/api/compression.d.ts",
|
|
178
|
+
"import": "./dist/api/compression.js"
|
|
179
|
+
},
|
|
180
|
+
"./api/payload-optimization": {
|
|
181
|
+
"types": "./dist/api/payload-optimization.d.ts",
|
|
182
|
+
"import": "./dist/api/payload-optimization.js"
|
|
183
|
+
},
|
|
184
|
+
"./api/rate-limit": {
|
|
185
|
+
"types": "./dist/api/rate-limit.d.ts",
|
|
186
|
+
"import": "./dist/api/rate-limit.js"
|
|
187
|
+
},
|
|
188
|
+
"./api/response-cache": {
|
|
189
|
+
"types": "./dist/api/response-cache.d.ts",
|
|
190
|
+
"import": "./dist/api/response-cache.js"
|
|
191
|
+
},
|
|
172
192
|
"./client": {
|
|
173
193
|
"types": "./dist/client/index.d.ts",
|
|
174
194
|
"import": "./dist/client/index.js"
|
|
175
195
|
},
|
|
196
|
+
"./client/ui": {
|
|
197
|
+
"types": "./dist/client/ui/index.d.ts",
|
|
198
|
+
"import": "./dist/client/ui/index.js"
|
|
199
|
+
},
|
|
200
|
+
"./client/admin": {
|
|
201
|
+
"types": "./dist/client/admin/index.d.ts",
|
|
202
|
+
"import": "./dist/client/admin/index.js"
|
|
203
|
+
},
|
|
204
|
+
"./client/richtext": {
|
|
205
|
+
"types": "./dist/client/richtext/index.d.ts",
|
|
206
|
+
"import": "./dist/client/richtext/index.js"
|
|
207
|
+
},
|
|
176
208
|
"./types/interfaces/app": {
|
|
177
209
|
"types": "./dist/types/interfaces/app.d.ts",
|
|
178
210
|
"import": "./dist/types/interfaces/app.js"
|
|
@@ -241,6 +273,10 @@
|
|
|
241
273
|
"types": "./dist/monitoring/process-registry.d.ts",
|
|
242
274
|
"import": "./dist/monitoring/process-registry.js"
|
|
243
275
|
},
|
|
276
|
+
"./monitoring/query-monitor": {
|
|
277
|
+
"types": "./dist/monitoring/query-monitor.d.ts",
|
|
278
|
+
"import": "./dist/monitoring/query-monitor.js"
|
|
279
|
+
},
|
|
244
280
|
"./utils/error-responses": {
|
|
245
281
|
"types": "./dist/utils/error-responses.d.ts",
|
|
246
282
|
"import": "./dist/utils/error-responses.js"
|
|
@@ -261,6 +297,10 @@
|
|
|
261
297
|
"types": "./dist/caching/index.d.ts",
|
|
262
298
|
"import": "./dist/caching/index.js"
|
|
263
299
|
},
|
|
300
|
+
"./cache/query-cache": {
|
|
301
|
+
"types": "./dist/cache/query-cache.d.ts",
|
|
302
|
+
"import": "./dist/cache/query-cache.js"
|
|
303
|
+
},
|
|
264
304
|
"./optimization/code-splitting": {
|
|
265
305
|
"types": "./dist/optimization/code-splitting.d.ts",
|
|
266
306
|
"import": "./dist/optimization/code-splitting.js"
|
|
@@ -279,7 +319,6 @@
|
|
|
279
319
|
],
|
|
280
320
|
"main": "./dist/index.js",
|
|
281
321
|
"peerDependencies": {
|
|
282
|
-
"next": "^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
283
322
|
"react": "^18.0.0 || ^19.0.0",
|
|
284
323
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
285
324
|
},
|