@revealui/core 0.9.0 → 0.10.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.
Files changed (45) hide show
  1. package/README.md +8 -0
  2. package/dist/client/admin/components/AdminDashboard.d.ts +7 -1
  3. package/dist/client/admin/components/AdminDashboard.d.ts.map +1 -1
  4. package/dist/client/admin/components/AdminDashboard.js +11 -11
  5. package/dist/client/admin/components/CollectionList.d.ts +2 -1
  6. package/dist/client/admin/components/CollectionList.d.ts.map +1 -1
  7. package/dist/client/admin/components/CollectionList.js +5 -5
  8. package/dist/client/admin/components/DocumentForm.d.ts +2 -1
  9. package/dist/client/admin/components/DocumentForm.d.ts.map +1 -1
  10. package/dist/client/admin/components/DocumentForm.js +16 -16
  11. package/dist/client/admin/components/GlobalForm.d.ts +2 -1
  12. package/dist/client/admin/components/GlobalForm.d.ts.map +1 -1
  13. package/dist/client/admin/components/GlobalForm.js +3 -3
  14. package/dist/client/admin/context/ServerFunctionContext.d.ts +1 -1
  15. package/dist/client/admin/context/ServerFunctionContext.d.ts.map +1 -1
  16. package/dist/client/admin/layout.d.ts +1 -1
  17. package/dist/client/admin/layout.d.ts.map +1 -1
  18. package/dist/client/admin/layout.js +5 -1
  19. package/dist/client/admin/page.d.ts +2 -2
  20. package/dist/client/admin/page.d.ts.map +1 -1
  21. package/dist/client/admin/page.js +10 -3
  22. package/dist/client/richtext/RichTextEditor.d.ts +1 -1
  23. package/dist/client/richtext/RichTextEditor.d.ts.map +1 -1
  24. package/dist/client/richtext/plugins/CollaborationPlugin.d.ts +1 -1
  25. package/dist/client/richtext/plugins/CollaborationPlugin.d.ts.map +1 -1
  26. package/dist/client/richtext/plugins/ToolbarPlugin.d.ts +1 -1
  27. package/dist/client/richtext/plugins/ToolbarPlugin.d.ts.map +1 -1
  28. package/dist/nextjs/withRevealUI.d.ts +7 -2
  29. package/dist/nextjs/withRevealUI.d.ts.map +1 -1
  30. package/dist/nextjs/withRevealUI.js +9 -99
  31. package/dist/revforge-license.d.ts +4 -2
  32. package/dist/revforge-license.d.ts.map +1 -1
  33. package/dist/revforge-license.js +21 -3
  34. package/dist/richtext/exports/server/rsc.d.ts +3 -3
  35. package/dist/richtext/exports/server/rsc.d.ts.map +1 -1
  36. package/dist/storage/_sigv4.d.ts +76 -0
  37. package/dist/storage/_sigv4.d.ts.map +1 -0
  38. package/dist/storage/_sigv4.js +134 -0
  39. package/dist/storage/_xml.d.ts +26 -0
  40. package/dist/storage/_xml.d.ts.map +1 -0
  41. package/dist/storage/_xml.js +75 -0
  42. package/dist/storage/r2.d.ts +14 -2
  43. package/dist/storage/r2.d.ts.map +1 -1
  44. package/dist/storage/r2.js +107 -44
  45. package/package.json +22 -23
@@ -42,7 +42,7 @@ export interface RichTextEditorProps {
42
42
  }
43
43
  export { FloatingToolbarPlugin } from './plugins/FloatingToolbarPlugin.js';
44
44
  export { ToolbarPlugin } from './plugins/ToolbarPlugin.js';
45
- export declare function RichTextEditor({ editorConfig, initialValue, onChange, onSerializedChange, placeholder, className, editable, autoFocus, onError, namespace, collaborative, documentId, providerFactory, shouldBootstrap, username, cursorColor, clientType, agentModel, }: RichTextEditorProps): import("react/jsx-runtime").JSX.Element;
45
+ export declare function RichTextEditor({ editorConfig, initialValue, onChange, onSerializedChange, placeholder, className, editable, autoFocus, onError, namespace, collaborative, documentId, providerFactory, shouldBootstrap, username, cursorColor, clientType, agentModel, }: RichTextEditorProps): import("react").JSX.Element;
46
46
  export declare const richTextEditorStyles = "\n.revealui-rich-text-editor {\n border: 1px solid #e2e8f0;\n border-radius: 8px;\n overflow: hidden;\n font-family: system-ui, -apple-system, sans-serif;\n}\n\n.editor-toolbar {\n display: flex;\n gap: 4px;\n padding: 8px;\n border-bottom: 1px solid #e2e8f0;\n background: #f8fafc;\n}\n\n.editor-toolbar--floating {\n border-bottom: none;\n border: 1px solid #e2e8f0;\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n background: white;\n padding: 6px;\n transition: opacity 0.2s ease;\n}\n\n.toolbar-btn {\n padding: 6px 10px;\n border: 1px solid #e2e8f0;\n border-radius: 4px;\n background: white;\n cursor: pointer;\n font-size: 14px;\n transition: all 0.15s ease;\n}\n\n.toolbar-btn:hover {\n background: #f1f5f9;\n}\n\n.toolbar-btn.active {\n background: #3b82f6;\n color: white;\n border-color: #3b82f6;\n}\n\n.editor-container {\n position: relative;\n min-height: 150px;\n}\n\n.editor-input {\n padding: 16px;\n outline: none;\n min-height: 150px;\n}\n\n.editor-placeholder {\n position: absolute;\n top: 16px;\n left: 16px;\n color: #94a3b8;\n pointer-events: none;\n user-select: none;\n}\n\n.editor-paragraph {\n margin: 0 0 8px 0;\n}\n\n.editor-heading-h1 { font-size: 2em; font-weight: bold; margin: 0 0 12px 0; }\n.editor-heading-h2 { font-size: 1.5em; font-weight: bold; margin: 0 0 10px 0; }\n.editor-heading-h3 { font-size: 1.25em; font-weight: bold; margin: 0 0 8px 0; }\n.editor-heading-h4 { font-size: 1em; font-weight: bold; margin: 0 0 8px 0; }\n.editor-heading-h5 { font-size: 0.875em; font-weight: bold; margin: 0 0 8px 0; }\n.editor-heading-h6 { font-size: 0.75em; font-weight: bold; margin: 0 0 8px 0; }\n\n.editor-quote {\n border-left: 4px solid #e2e8f0;\n padding-left: 16px;\n margin: 0 0 8px 0;\n color: #64748b;\n}\n\n.editor-list-ol { list-style: decimal; padding-left: 24px; margin: 0 0 8px 0; }\n.editor-list-ul { list-style: disc; padding-left: 24px; margin: 0 0 8px 0; }\n.editor-listitem { margin: 4px 0; }\n\n.editor-link { color: #3b82f6; text-decoration: underline; }\n\n.editor-text-bold { font-weight: bold; }\n.editor-text-italic { font-style: italic; }\n.editor-text-underline { text-decoration: underline; }\n.editor-text-strikethrough { text-decoration: line-through; }\n.editor-text-code {\n background: #f1f5f9;\n padding: 2px 4px;\n border-radius: 4px;\n font-family: monospace;\n}\n.editor-text-subscript { vertical-align: sub; font-size: smaller; }\n.editor-text-superscript { vertical-align: super; font-size: smaller; }\n\n.editor-code {\n background: #1e293b;\n color: #e2e8f0;\n padding: 16px;\n border-radius: 4px;\n font-family: monospace;\n overflow-x: auto;\n margin: 8px 0;\n}\n\n.collab-cursors-container {\n position: relative;\n pointer-events: none;\n}\n\n.cursor-agent {\n animation: cursor-agent-pulse 2s ease-in-out infinite;\n}\n\n@keyframes cursor-agent-pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.6; }\n}\n\n.cursor-inactive {\n opacity: 0.2;\n transition: opacity 1s ease-out;\n}\n";
47
47
  export default RichTextEditor;
48
48
  //# sourceMappingURL=RichTextEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextEditor.d.ts","sourceRoot":"","sources":["../../../src/client/richtext/RichTextEditor.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,KAAK,EACV,WAAW,EAEX,aAAa,EAEb,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,KAAK,EACV,cAAc,IAAI,oBAAoB,EAEvC,MAAM,yBAAyB,CAAC;AAWjC,MAAM,WAAW,mBAAmB;IAClC,gDAAgD;IAChD,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,8CAA8C;IAC9C,YAAY,CAAC,EAAE,qBAAqB,GAAG,MAAM,GAAG,IAAI,CAAC;IACrD,oCAAoC;IACpC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IAC/D,8CAA8C;IAC9C,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC3D,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB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E,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,QAAQ,CAAC;IACxE,+DAA+D;IAC/D,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC/B,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA+ID,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AA2B3D,wBAAgB,cAAc,CAAC,EAC7B,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,WAA+B,EAC/B,SAAc,EACd,QAAe,EACf,SAAiB,EACjB,OAAO,EACP,SAA4B,EAC5B,aAAqB,EACrB,UAAU,EACV,eAAe,EACf,eAAuB,EACvB,QAAQ,EACR,WAAW,EACX,UAAU,EACV,UAAU,GACX,EAAE,mBAAmB,+BA+GrB;AAMD,eAAO,MAAM,oBAAoB,0+FAmIhC,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -9,5 +9,5 @@ export interface CollaborationPluginProps {
9
9
  clientType?: 'human' | 'agent';
10
10
  agentModel?: string;
11
11
  }
12
- export declare function CollaborationPlugin({ id, providerFactory, shouldBootstrap, username, cursorColor, clientType, agentModel, }: CollaborationPluginProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function CollaborationPlugin({ id, providerFactory, shouldBootstrap, username, cursorColor, clientType, agentModel, }: CollaborationPluginProps): import("react").JSX.Element;
13
13
  //# sourceMappingURL=CollaborationPlugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CollaborationPlugin.d.ts","sourceRoot":"","sources":["../../../../src/client/richtext/plugins/CollaborationPlugin.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/B,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,QAAQ,CAAC;IACvE,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,mBAAmB,CAAC,EAClC,EAAE,EACF,eAAe,EACf,eAAe,EACf,QAAQ,EACR,WAAW,EACX,UAAoB,EACpB,UAAU,GACX,EAAE,wBAAwB,2CAiB1B"}
1
+ {"version":3,"file":"CollaborationPlugin.d.ts","sourceRoot":"","sources":["../../../../src/client/richtext/plugins/CollaborationPlugin.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/B,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,QAAQ,CAAC;IACvE,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,mBAAmB,CAAC,EAClC,EAAE,EACF,eAAe,EACf,eAAe,EACf,QAAQ,EACR,WAAW,EACX,UAAoB,EACpB,UAAU,GACX,EAAE,wBAAwB,+BAiB1B"}
@@ -3,6 +3,6 @@ export interface ToolbarPluginProps {
3
3
  features: RichTextFeature[];
4
4
  variant?: 'fixed' | 'inline' | 'floating';
5
5
  }
6
- export declare function ToolbarPlugin({ features, variant }: ToolbarPluginProps): import("react/jsx-runtime").JSX.Element | null;
6
+ export declare function ToolbarPlugin({ features, variant }: ToolbarPluginProps): import("react").JSX.Element | null;
7
7
  export default ToolbarPlugin;
8
8
  //# sourceMappingURL=ToolbarPlugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarPlugin.d.ts","sourceRoot":"","sources":["../../../../src/client/richtext/plugins/ToolbarPlugin.tsx"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAsClE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;CAC3C;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,OAAiB,EAAE,EAAE,kBAAkB,kDA4ZhF;AAED,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"ToolbarPlugin.d.ts","sourceRoot":"","sources":["../../../../src/client/richtext/plugins/ToolbarPlugin.tsx"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAsClE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;CAC3C;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,OAAiB,EAAE,EAAE,kBAAkB,sCA4ZhF;AAED,eAAe,aAAa,CAAC"}
@@ -40,8 +40,13 @@ export interface WithRevealUIOptions {
40
40
  * Next.js configuration wrapper for RevealUI
41
41
  * Provides webpack aliases, environment variables, and build configuration
42
42
  *
43
- * Sets up `@revealui/config` alias to import the RevealUI config file.
44
- * The alias works with both Webpack (Next.js < 15) and Turbopack (Next.js 16+).
43
+ * MUST NOT alias the `@revealui/config` package specifier: that is a real
44
+ * workspace package (type-safe env config). Aliasing it to the app's
45
+ * revealui.config.ts shadows the package in every server bundle, so
46
+ * `config.reveal` / `config.database` reads resolve against the CMS instance
47
+ * config and come back undefined at runtime (prod admin passkey/MFA 500s,
48
+ * 2026-06-10). Apps load their CMS config via relative imports or their own
49
+ * `@reveal-config` alias instead.
45
50
  */
46
51
  export declare function withRevealUI(nextConfig?: NextConfig, options?: WithRevealUIOptions): NextConfig;
47
52
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"withRevealUI.d.ts","sourceRoot":"","sources":["../../src/nextjs/withRevealUI.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,UAAU,UAAU;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,OAAO,CAAC,EAAE,CACR,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,KAC9E,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,SAAS,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;IACtD,OAAO,CAAC,EAAE,MAAM,OAAO,CACrB,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,KAAK,CAAC;YAAE,GAAG,EAAE,MA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CACrB,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,KAAK,CAAC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC,CAC1E,CAAC;IACF,MAAM,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;KAAE,CAAC;IAC7D,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAOD,MAAM,WAAW,mBAAmB;IAClC,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,uBAAuB;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC1B,UAAU,GAAE,UAAe,EAC3B,OAAO,GAAE,mBAAwB,GAChC,UAAU,CA2FZ"}
@@ -1,4 +1,3 @@
1
- import fs from 'node:fs';
2
1
  import path from 'node:path';
3
2
  import { fileURLToPath } from 'node:url';
4
3
  // Get __dirname equivalent for ESM
@@ -9,39 +8,16 @@ const __dirname = path.dirname(__filename);
9
8
  * Next.js configuration wrapper for RevealUI
10
9
  * Provides webpack aliases, environment variables, and build configuration
11
10
  *
12
- * Sets up `@revealui/config` alias to import the RevealUI config file.
13
- * The alias works with both Webpack (Next.js < 15) and Turbopack (Next.js 16+).
11
+ * MUST NOT alias the `@revealui/config` package specifier: that is a real
12
+ * workspace package (type-safe env config). Aliasing it to the app's
13
+ * revealui.config.ts shadows the package in every server bundle, so
14
+ * `config.reveal` / `config.database` reads resolve against the CMS instance
15
+ * config and come back undefined at runtime (prod admin passkey/MFA 500s,
16
+ * 2026-06-10). Apps load their CMS config via relative imports or their own
17
+ * `@reveal-config` alias instead.
14
18
  */
15
19
  export function withRevealUI(nextConfig = {}, options = {}) {
16
20
  const { configPath = './revealui.config.ts', admin = true, adminRoute = '/admin', apiRoute = '/api', } = options;
17
- /**
18
- * Resolve config file path with validation
19
- * Attempts multiple extensions (.ts, .js, .mjs) if base path doesn't exist
20
- */
21
- const resolveConfigPath = (baseDir) => {
22
- const basePath = path.isAbsolute(configPath) ? configPath : path.resolve(baseDir, configPath);
23
- // Try exact path first
24
- if (fs.existsSync(basePath)) {
25
- return basePath;
26
- }
27
- // Try with extensions if no extension provided
28
- const extensions = ['.ts', '', '.mjs'];
29
- const baseWithoutExt = path.parse(basePath);
30
- for (const ext of extensions) {
31
- const candidate = path.format({
32
- ...baseWithoutExt,
33
- base: undefined,
34
- ext: ext,
35
- });
36
- if (fs.existsSync(candidate)) {
37
- return candidate;
38
- }
39
- }
40
- // If not found, throw helpful error
41
- throw new Error(`RevealUI config file not found: ${basePath}\n` +
42
- `Searched for: ${basePath}, ${extensions.map((ext) => path.format({ ...baseWithoutExt, base: undefined, ext })).join(', ')}\n` +
43
- `Please ensure the config file exists or provide a valid configPath option.`);
44
- };
45
21
  return {
46
22
  ...nextConfig,
47
23
  // Environment variables for RevealUI
@@ -61,34 +37,6 @@ export function withRevealUI(nextConfig = {}, options = {}) {
61
37
  if (nextConfig.webpack) {
62
38
  config = nextConfig.webpack(config, context);
63
39
  }
64
- // Resolve config path at execution time (when webpack runs)
65
- // This ensures we're using the correct cwd for the Next.js project
66
- const projectRoot = context.dir || process.cwd();
67
- let resolvedConfigPath;
68
- try {
69
- resolvedConfigPath = resolveConfigPath(projectRoot);
70
- }
71
- catch (error) {
72
- // In development, warn but don't fail - allow for dynamic config creation
73
- if (dev) {
74
- // Lazy import logger to avoid ESM resolution issues at module load time
75
- import('../instance/logger.js')
76
- .then(({ defaultLogger }) => {
77
- defaultLogger.warn(error instanceof Error ? error.message : String(error));
78
- })
79
- .catch(() => {
80
- // Logger failed to load - silently continue (already falling back to default config path)
81
- });
82
- // Use fallback path
83
- resolvedConfigPath = path.isAbsolute(configPath)
84
- ? configPath
85
- : path.resolve(projectRoot, configPath);
86
- }
87
- else {
88
- // In production, fail fast
89
- throw error;
90
- }
91
- }
92
40
  // Add RevealUI-specific webpack aliases
93
41
  const resolve = (config.resolve || {});
94
42
  config.resolve = resolve;
@@ -96,9 +44,6 @@ export function withRevealUI(nextConfig = {}, options = {}) {
96
44
  ...resolve.alias,
97
45
  // RevealUI core aliases - resolve to source index file
98
46
  '@revealui/core': path.resolve(__dirname, '../index'),
99
- // Config alias - resolves to the actual config file path in the Next.js project
100
- // Use absolute path for reliable resolution
101
- '@revealui/config': resolvedConfigPath,
102
47
  };
103
48
  // Also ensure it's in resolve.modules if needed (for some edge cases)
104
49
  if (!resolve.modules) {
@@ -106,43 +51,8 @@ export function withRevealUI(nextConfig = {}, options = {}) {
106
51
  }
107
52
  return config;
108
53
  },
109
- // Turbopack configuration (Next.js 16+)
110
- // IMPORTANT: Turbopack's resolveAlias must be resolved at config evaluation time
111
- // Turbopack should read tsconfig.json paths, but we also set it explicitly here for reliability
112
- // If next.config.mjs already set @revealui/config, we respect it (it uses __dirname which is reliable).
113
- turbopack: {
114
- ...nextConfig.turbopack,
115
- resolveAlias: {
116
- // Start with existing aliases from next.config.mjs (which includes @revealui/config)
117
- ...nextConfig.turbopack?.resolveAlias,
118
- // RevealUI core aliases - use relative path for Turbopack compatibility
119
- // Don't set @revealui/core here - let next.config.mjs handle it via the @revealui alias
120
- // Ensure @revealui/config is set (next.config.mjs should have it, but ensure it's there)
121
- // Use the existing one if present (prefer relative path for Turbopack)
122
- // Otherwise resolve it to relative path from project root
123
- '@revealui/config': nextConfig.turbopack?.resolveAlias?.['@revealui/config'] ||
124
- (() => {
125
- // Prefer relative path for Turbopack (matches tsconfig.json format)
126
- if (!path.isAbsolute(configPath)) {
127
- return configPath;
128
- }
129
- // If absolute, convert to relative from project root
130
- try {
131
- const projectRoot = process.cwd();
132
- const resolved = resolveConfigPath(projectRoot);
133
- if (fs.existsSync(resolved)) {
134
- // Return relative path from project root
135
- return path.relative(projectRoot, resolved);
136
- }
137
- }
138
- catch {
139
- // Fall through to fallback
140
- }
141
- // Fallback: use configPath as-is (should be relative)
142
- return configPath;
143
- })(),
144
- },
145
- },
54
+ // Turbopack config passes through verbatim via the `...nextConfig` spread —
55
+ // withRevealUI injects no resolveAlias entries (see the docstring constraint).
146
56
  // Headers for RevealUI
147
57
  async headers() {
148
58
  const existingHeaders = nextConfig.headers ? await nextConfig.headers() : [];
@@ -50,8 +50,10 @@ export interface IssueRevForgeLicenseResult {
50
50
  * Issue a signed RevForge license JWT for a paying customer.
51
51
  *
52
52
  * @throws Error on invalid slug, invalid tier, mutually-exclusive flag combos,
53
- * or non-positive numeric overrides. The error message names the offending
54
- * field so callers can surface it directly to the operator.
53
+ * non-positive numeric overrides, or a private/public pair that is not a
54
+ * matching Ed25519 keypair. The error message names the offending field (or, for
55
+ * the keypair case, carries the `REVFORGE_LICENSE_KEYPAIR_MISMATCH` prefix) so
56
+ * callers can surface it directly to the operator.
55
57
  */
56
58
  export declare function issueRevForgeLicense(opts: IssueRevForgeLicenseOptions, keys: {
57
59
  privateKey: string;
@@ -1 +1 @@
1
- {"version":3,"file":"revforge-license.d.ts","sourceRoot":"","sources":["../src/revforge-license.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAEvE,eAAO,MAAM,YAAY,QAAyB,CAAC;AAEnD,eAAO,MAAM,oBAAoB,uCAAwC,CAAC;AAC1E,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,MAAM,WAAW,2BAA2B;IAC1C,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,IAAI,EAAE,YAAY,CAAC;IACnB,6FAA6F;IAC7F,aAAa,CAAC,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;IACb,qCAAqC;IACrC,IAAI,EAAE,YAAY,CAAC;IACnB,6FAA6F;IAC7F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6FAA6F;IAC7F,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,0BAA0B;IACzC,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,IAAI,EAAE,YAAY,CAAC;IACnB,0DAA0D;IAC1D,SAAS,EAAE,OAAO,CAAC;IACnB,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,oFAAoF;IACpF,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC,CAAC;CACtD;AAED;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,2BAA2B,EACjC,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC9C,OAAO,CAAC,0BAA0B,CAAC,CAuFrC"}
@@ -10,15 +10,17 @@
10
10
  * descriptive metadata. The CLI wrapper (scripts/setup/issue-revforge-license.ts)
11
11
  * handles argv parsing and reading keys from the environment.
12
12
  */
13
- import { generateLicenseKey } from './license.js';
13
+ import { generateLicenseKey, validateLicenseKey } from './license.js';
14
14
  export const SLUG_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
15
15
  export const VALID_REVFORGE_TIERS = ['pro', 'max', 'enterprise'];
16
16
  /**
17
17
  * Issue a signed RevForge license JWT for a paying customer.
18
18
  *
19
19
  * @throws Error on invalid slug, invalid tier, mutually-exclusive flag combos,
20
- * or non-positive numeric overrides. The error message names the offending
21
- * field so callers can surface it directly to the operator.
20
+ * non-positive numeric overrides, or a private/public pair that is not a
21
+ * matching Ed25519 keypair. The error message names the offending field (or, for
22
+ * the keypair case, carries the `REVFORGE_LICENSE_KEYPAIR_MISMATCH` prefix) so
23
+ * callers can surface it directly to the operator.
22
24
  */
23
25
  export async function issueRevForgeLicense(opts, keys) {
24
26
  if (!SLUG_PATTERN.test(opts.slug)) {
@@ -61,6 +63,22 @@ export async function issueRevForgeLicense(opts, keys) {
61
63
  : 365 * 24 * 60 * 60;
62
64
  const issuedAtMs = Date.now();
63
65
  const licenseKey = await generateLicenseKey(payload, keys.privateKey, expiresInSeconds, keys.publicKey);
66
+ // Pair-match guard: prove the supplied public key can verify the JWT we just
67
+ // signed with the supplied private key. If it cannot, the two are not a
68
+ // matching Ed25519 keypair, and issuing anyway would hand back a license whose
69
+ // baked REVEALUI_LICENSE_PUBLIC_KEY crash-loops the kit at boot with
70
+ // "LICENSE VALIDATION FAILED" (apps/server validateLicenseAtStartup). Reusing
71
+ // the runtime verifier (validateLicenseKey) guarantees this check agrees
72
+ // exactly with the deployment-time check, so a mismatched pair can never reach
73
+ // a stamped customer kit.
74
+ const keypairSelfCheck = await validateLicenseKey(licenseKey, keys.publicKey);
75
+ if (keypairSelfCheck === null) {
76
+ throw new Error('REVFORGE_LICENSE_KEYPAIR_MISMATCH: the supplied public key cannot verify a ' +
77
+ 'license JWT signed by the supplied private key, so they are not a matching ' +
78
+ 'Ed25519 keypair. A kit issued with this pair would crash at boot with ' +
79
+ 'LICENSE VALIDATION FAILED. Source REVEALUI_LICENSE_PRIVATE_KEY and ' +
80
+ 'REVEALUI_LICENSE_PUBLIC_KEY from the same keypair in revvault and retry.');
81
+ }
64
82
  const expiresAt = expiresInSeconds === null ? null : new Date(issuedAtMs + expiresInSeconds * 1000).toISOString();
65
83
  return {
66
84
  licenseKey,
@@ -93,11 +93,11 @@ export declare function $generateHtmlFromNodes(data: SerializedEditorState | nul
93
93
  /**
94
94
  * Server component for rendering Lexical content in table cells
95
95
  */
96
- export declare function RscEntryLexicalCell({ data, className }: RscEntryLexicalCellProps): import("react/jsx-runtime").JSX.Element | null;
96
+ export declare function RscEntryLexicalCell({ data, className }: RscEntryLexicalCellProps): JSX.Element | null;
97
97
  /**
98
98
  * Server component for rendering Lexical content in form fields
99
99
  */
100
- export declare function RscEntryLexicalField({ data, className }: RscEntryLexicalFieldProps): import("react/jsx-runtime").JSX.Element | null;
100
+ export declare function RscEntryLexicalField({ data, className }: RscEntryLexicalFieldProps): JSX.Element | null;
101
101
  /**
102
102
  * Generic RSC component for rendering Lexical content
103
103
  */
@@ -114,6 +114,6 @@ export interface RichTextContentProps {
114
114
  caption?: string;
115
115
  }, index: number) => JSX.Element | null;
116
116
  }
117
- export declare function RichTextContent({ data, className, renderBlock, renderLink, renderImage, }: RichTextContentProps): import("react/jsx-runtime").JSX.Element | null;
117
+ export declare function RichTextContent({ data, className, renderBlock, renderLink, renderImage, }: RichTextContentProps): JSX.Element | null;
118
118
  export default RichTextContent;
119
119
  //# sourceMappingURL=rsc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../../../../src/richtext/exports/server/rsc.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AACrE,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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E,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,sBAgBtB;AAED,eAAe,eAAe,CAAC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * AWS Signature Version 4 signer for the Cloudflare R2 (S3-compatible) API.
3
+ *
4
+ * Replaces the request signing that @aws-sdk/client-s3 used to do for us.
5
+ * Uses only node:crypto — no external dependencies, no regex.
6
+ *
7
+ * The core (`computeSigV4`) is verified byte-for-byte against the official AWS
8
+ * SigV4 test-suite `get-vanilla` vector in __tests__/_sigv4.test.ts.
9
+ *
10
+ * Server-only. Do NOT import from client-side code or edge runtime.
11
+ */
12
+ /** Hex SHA-256 of the empty string — the payload hash for body-less requests. */
13
+ export declare const EMPTY_SHA256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
14
+ /** Hex SHA-256 of arbitrary bytes (request payload hashing). */
15
+ export declare function sha256Hex(data: string | Uint8Array): string;
16
+ /**
17
+ * RFC 3986 percent-encoding per the AWS SigV4 spec. `encodeSlash` is false for
18
+ * path segments (slashes are separators) and true for query keys/values.
19
+ */
20
+ export declare function awsUriEncode(input: string, encodeSlash: boolean): string;
21
+ /** Inputs to the verified SigV4 core. All path/header values must be final. */
22
+ export interface CanonicalInput {
23
+ method: string;
24
+ /** Already AWS-URI-encoded path (slashes preserved). */
25
+ canonicalPath: string;
26
+ /** Raw (unencoded) query pairs; encoded + sorted by the signer. */
27
+ query: [string, string][];
28
+ /** Exact header set to sign (any case; lowercased + trimmed internally). */
29
+ headersToSign: Record<string, string>;
30
+ payloadHash: string;
31
+ amzDate: string;
32
+ region: string;
33
+ service: string;
34
+ accessKeyId: string;
35
+ secretAccessKey: string;
36
+ }
37
+ export interface SigV4Result {
38
+ signature: string;
39
+ signedHeaders: string;
40
+ scope: string;
41
+ canonicalQuery: string;
42
+ }
43
+ /**
44
+ * The verified SigV4 computation: canonical request → string-to-sign → signing
45
+ * key → signature. Verified against AWS's official `get-vanilla` test vector.
46
+ */
47
+ export declare function computeSigV4(input: CanonicalInput): SigV4Result;
48
+ /** Inputs for an R2/S3 request signature. */
49
+ export interface SignS3Input {
50
+ method: 'GET' | 'PUT' | 'DELETE';
51
+ accountId: string;
52
+ bucket: string;
53
+ /** Object key; omit for bucket-level operations (e.g. ListObjectsV2). */
54
+ key?: string;
55
+ /** Query params; `undefined` values are dropped before signing. */
56
+ query?: Record<string, string | undefined>;
57
+ region: string;
58
+ accessKeyId: string;
59
+ secretAccessKey: string;
60
+ /** Hex SHA-256 of the body, or EMPTY_SHA256 for body-less requests. */
61
+ payloadHash: string;
62
+ /** Extra headers to send + sign (content-type, cache-control, x-amz-meta-*). */
63
+ extraHeaders?: Record<string, string>;
64
+ now: Date;
65
+ }
66
+ export interface SignedS3Request {
67
+ url: string;
68
+ headers: Record<string, string>;
69
+ }
70
+ /**
71
+ * Build a signed R2 request: a path-style URL + AWS4-HMAC-SHA256 Authorization
72
+ * header. The `host` header is signed but not returned — fetch/undici sets it
73
+ * from the URL (same value), and `Host` is a forbidden header to set manually.
74
+ */
75
+ export declare function signS3Request(input: SignS3Input): SignedS3Request;
76
+ //# sourceMappingURL=_sigv4.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_sigv4.d.ts","sourceRoot":"","sources":["../../src/storage/_sigv4.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH,iFAAiF;AACjF,eAAO,MAAM,YAAY,qEAAqE,CAAC;AAE/F,gEAAgE;AAChE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAE3D;AAQD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,WA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AG,EAAE,IAAI,CAAC;CACX;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,eAAe,CAmDjE"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * AWS Signature Version 4 signer for the Cloudflare R2 (S3-compatible) API.
3
+ *
4
+ * Replaces the request signing that @aws-sdk/client-s3 used to do for us.
5
+ * Uses only node:crypto — no external dependencies, no regex.
6
+ *
7
+ * The core (`computeSigV4`) is verified byte-for-byte against the official AWS
8
+ * SigV4 test-suite `get-vanilla` vector in __tests__/_sigv4.test.ts.
9
+ *
10
+ * Server-only. Do NOT import from client-side code or edge runtime.
11
+ */
12
+ import { createHash, createHmac } from 'node:crypto';
13
+ const ALGORITHM = 'AWS4-HMAC-SHA256';
14
+ const S3_SERVICE = 's3';
15
+ /** Hex SHA-256 of the empty string — the payload hash for body-less requests. */
16
+ export const EMPTY_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855';
17
+ /** Hex SHA-256 of arbitrary bytes (request payload hashing). */
18
+ export function sha256Hex(data) {
19
+ return createHash('sha256').update(data).digest('hex');
20
+ }
21
+ function hmac(key, data) {
22
+ return createHmac('sha256', key).update(data, 'utf8').digest();
23
+ }
24
+ const UNRESERVED = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~';
25
+ /**
26
+ * RFC 3986 percent-encoding per the AWS SigV4 spec. `encodeSlash` is false for
27
+ * path segments (slashes are separators) and true for query keys/values.
28
+ */
29
+ export function awsUriEncode(input, encodeSlash) {
30
+ let out = '';
31
+ for (const byte of new TextEncoder().encode(input)) {
32
+ const ch = String.fromCharCode(byte);
33
+ if (UNRESERVED.includes(ch)) {
34
+ out += ch;
35
+ }
36
+ else if (ch === '/' && !encodeSlash) {
37
+ out += '/';
38
+ }
39
+ else {
40
+ out += `%${byte.toString(16).toUpperCase().padStart(2, '0')}`;
41
+ }
42
+ }
43
+ return out;
44
+ }
45
+ function toAmzDate(now) {
46
+ const iso = now.toISOString(); // e.g. 2026-05-18T10:00:00.000Z
47
+ const amzDate = `${iso.slice(0, 4)}${iso.slice(5, 7)}${iso.slice(8, 10)}T${iso.slice(11, 13)}${iso.slice(14, 16)}${iso.slice(17, 19)}Z`;
48
+ return { amzDate, dateStamp: amzDate.slice(0, 8) };
49
+ }
50
+ /**
51
+ * The verified SigV4 computation: canonical request → string-to-sign → signing
52
+ * key → signature. Verified against AWS's official `get-vanilla` test vector.
53
+ */
54
+ export function computeSigV4(input) {
55
+ const lowered = new Map();
56
+ for (const [name, value] of Object.entries(input.headersToSign)) {
57
+ lowered.set(name.toLowerCase(), value.trim());
58
+ }
59
+ const names = [...lowered.keys()].sort();
60
+ const canonicalHeaders = names.map((n) => `${n}:${lowered.get(n)}\n`).join('');
61
+ const signedHeaders = names.join(';');
62
+ const canonicalQuery = [...input.query]
63
+ .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
64
+ .map(([k, v]) => `${awsUriEncode(k, true)}=${awsUriEncode(v, true)}`)
65
+ .join('&');
66
+ const canonicalRequest = [
67
+ input.method,
68
+ input.canonicalPath,
69
+ canonicalQuery,
70
+ canonicalHeaders,
71
+ signedHeaders,
72
+ input.payloadHash,
73
+ ].join('\n');
74
+ const dateStamp = input.amzDate.slice(0, 8);
75
+ const scope = `${dateStamp}/${input.region}/${input.service}/aws4_request`;
76
+ const stringToSign = [ALGORITHM, input.amzDate, scope, sha256Hex(canonicalRequest)].join('\n');
77
+ const kDate = hmac(`AWS4${input.secretAccessKey}`, dateStamp);
78
+ const kRegion = hmac(kDate, input.region);
79
+ const kService = hmac(kRegion, input.service);
80
+ const kSigning = hmac(kService, 'aws4_request');
81
+ const signature = createHmac('sha256', kSigning).update(stringToSign, 'utf8').digest('hex');
82
+ return { signature, signedHeaders, scope, canonicalQuery };
83
+ }
84
+ /**
85
+ * Build a signed R2 request: a path-style URL + AWS4-HMAC-SHA256 Authorization
86
+ * header. The `host` header is signed but not returned — fetch/undici sets it
87
+ * from the URL (same value), and `Host` is a forbidden header to set manually.
88
+ */
89
+ export function signS3Request(input) {
90
+ const host = `${input.accountId}.r2.cloudflarestorage.com`;
91
+ const { amzDate } = toAmzDate(input.now);
92
+ const encodedKey = (input.key ?? '')
93
+ .split('/')
94
+ .map((segment) => awsUriEncode(segment, false))
95
+ .join('/');
96
+ const canonicalPath = input.key !== undefined
97
+ ? `/${awsUriEncode(input.bucket, false)}/${encodedKey}`
98
+ : `/${awsUriEncode(input.bucket, false)}`;
99
+ const query = [];
100
+ for (const [k, v] of Object.entries(input.query ?? {})) {
101
+ if (v !== undefined)
102
+ query.push([k, v]);
103
+ }
104
+ const headersToSign = {
105
+ host,
106
+ 'x-amz-date': amzDate,
107
+ 'x-amz-content-sha256': input.payloadHash,
108
+ };
109
+ for (const [k, v] of Object.entries(input.extraHeaders ?? {})) {
110
+ headersToSign[k.toLowerCase()] = v;
111
+ }
112
+ const { signature, signedHeaders, scope, canonicalQuery } = computeSigV4({
113
+ method: input.method,
114
+ canonicalPath,
115
+ query,
116
+ headersToSign,
117
+ payloadHash: input.payloadHash,
118
+ amzDate,
119
+ region: input.region,
120
+ service: S3_SERVICE,
121
+ accessKeyId: input.accessKeyId,
122
+ secretAccessKey: input.secretAccessKey,
123
+ });
124
+ const headers = {
125
+ 'x-amz-date': amzDate,
126
+ 'x-amz-content-sha256': input.payloadHash,
127
+ authorization: `${ALGORITHM} Credential=${input.accessKeyId}/${scope}, SignedHeaders=${signedHeaders}, Signature=${signature}`,
128
+ };
129
+ for (const [k, v] of Object.entries(input.extraHeaders ?? {})) {
130
+ headers[k.toLowerCase()] = v;
131
+ }
132
+ const url = `https://${host}${canonicalPath}${canonicalQuery ? `?${canonicalQuery}` : ''}`;
133
+ return { url, headers };
134
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Minimal, dependency-free readers for the two S3/R2 XML responses we consume:
3
+ * ListObjectsV2 results and `<Error>` bodies. Replaces the XML codec that
4
+ * @aws-sdk/client-s3 used to run for us.
5
+ *
6
+ * No regex (M2): a tag's text can never contain a raw `<` (XML escapes it to
7
+ * `&lt;`), so `indexOf`-based tag scanning is unambiguous.
8
+ */
9
+ export interface ListedObject {
10
+ key: string;
11
+ size: number;
12
+ lastModified: Date;
13
+ }
14
+ export interface ParsedList {
15
+ objects: ListedObject[];
16
+ isTruncated: boolean;
17
+ nextContinuationToken?: string;
18
+ }
19
+ /** Parse an S3 ListObjectsV2 XML response into the fields the R2 provider needs. */
20
+ export declare function parseListObjectsV2(xml: string): ParsedList;
21
+ /** Extract `<Code>`/`<Message>` from an S3 `<Error>` response for diagnostics. */
22
+ export declare function s3ErrorFields(xml: string): {
23
+ code?: string;
24
+ message?: string;
25
+ };
26
+ //# sourceMappingURL=_xml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_xml.d.ts","sourceRoot":"","sources":["../../src/storage/_xml.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA6BH,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,oFAAoF;AACpF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CA6B1D;AAED,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAK9E"}