@devcabs/folio-engine 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/dist/App.d.ts +7 -0
  2. package/dist/components/canvas/CanvasAddBar.d.ts +28 -0
  3. package/dist/components/canvas/CanvasAddModal.d.ts +38 -0
  4. package/dist/components/canvas/CanvasChart.d.ts +23 -0
  5. package/dist/components/canvas/CanvasDeleteConfirmModal.d.ts +21 -0
  6. package/dist/components/canvas/CanvasGallery.d.ts +20 -0
  7. package/dist/components/canvas/CanvasItemControls.d.ts +33 -0
  8. package/dist/components/canvas/CanvasPhoto.d.ts +28 -0
  9. package/dist/components/canvas/CanvasSection.d.ts +27 -0
  10. package/dist/components/canvas/CanvasSubsection.d.ts +23 -0
  11. package/dist/components/canvas/CanvasText.d.ts +23 -0
  12. package/dist/components/canvas/DocumentCanvas.d.ts +20 -0
  13. package/dist/components/canvas/HeroPhoto.d.ts +17 -0
  14. package/dist/components/canvas/NodeCanvas.d.ts +2 -0
  15. package/dist/components/canvas/index.d.ts +17 -0
  16. package/dist/components/chart/BarChart.d.ts +23 -0
  17. package/dist/components/chart/ChartCard.d.ts +33 -0
  18. package/dist/components/chart/ChartConfigDrawer.d.ts +16 -0
  19. package/dist/components/chart/ChartGhostWireframe.d.ts +16 -0
  20. package/dist/components/chart/ChartLegend.d.ts +14 -0
  21. package/dist/components/chart/ChartRouter.d.ts +8 -0
  22. package/dist/components/chart/ChartSortingControls.d.ts +15 -0
  23. package/dist/components/chart/ChartTableModal.d.ts +26 -0
  24. package/dist/components/chart/ChartTooltip.d.ts +12 -0
  25. package/dist/components/chart/DataPendingCard.d.ts +28 -0
  26. package/dist/components/chart/DonutChart.d.ts +16 -0
  27. package/dist/components/chart/HistogramChart.d.ts +23 -0
  28. package/dist/components/chart/LineChart.d.ts +22 -0
  29. package/dist/components/chart/RangePreviewMatrix.d.ts +19 -0
  30. package/dist/components/chart/ScatterPlot.d.ts +21 -0
  31. package/dist/components/chart/drawer/controls/BarVisualControls.d.ts +9 -0
  32. package/dist/components/chart/drawer/controls/ChartTitlesSection.d.ts +15 -0
  33. package/dist/components/chart/drawer/controls/DonutVisualControls.d.ts +7 -0
  34. package/dist/components/chart/drawer/controls/HistogramVisualControls.d.ts +13 -0
  35. package/dist/components/chart/drawer/controls/LineVisualControls.d.ts +14 -0
  36. package/dist/components/chart/drawer/controls/ScatterDataControls.d.ts +17 -0
  37. package/dist/components/chart/drawer/controls/ScatterVisualControls.d.ts +23 -0
  38. package/dist/components/chart/drawer/controls/SortingAndOrderControls.d.ts +18 -0
  39. package/dist/components/chart/drawer/controls/StandardDataControls.d.ts +31 -0
  40. package/dist/components/chart/drawer/hooks/useChartConfigForm.d.ts +156 -0
  41. package/dist/components/chart/drawer/hooks/useLiveMatrixSync.d.ts +21 -0
  42. package/dist/components/chart/drawer/hooks/useSheetVerification.d.ts +26 -0
  43. package/dist/components/chart/drawer/index.d.ts +17 -0
  44. package/dist/components/chart/drawer/panels/Step1Source.d.ts +18 -0
  45. package/dist/components/chart/drawer/panels/Step1SourceRange.d.ts +32 -0
  46. package/dist/components/chart/drawer/panels/Step2DataRange.d.ts +15 -0
  47. package/dist/components/chart/drawer/panels/Step3ChartSetup.d.ts +17 -0
  48. package/dist/components/chart/drawer/panels/Step4Review.d.ts +11 -0
  49. package/dist/components/chart/index.d.ts +22 -0
  50. package/dist/components/dev/DevActionAffordance.d.ts +4 -0
  51. package/dist/components/dev/DevExitConfirmModal.d.ts +14 -0
  52. package/dist/components/dev/DevLockBlockedModal.d.ts +3 -0
  53. package/dist/components/dev/DevModeBadge.d.ts +3 -0
  54. package/dist/components/dev/DevPinModal.d.ts +3 -0
  55. package/dist/components/dev/DevPublishModal.d.ts +9 -0
  56. package/dist/components/dev/UniversalEditModal.d.ts +40 -0
  57. package/dist/components/dev/index.d.ts +8 -0
  58. package/dist/components/feedback/EmptyState.d.ts +13 -0
  59. package/dist/components/feedback/PageNotFound.d.ts +15 -0
  60. package/dist/components/feedback/Toast.d.ts +25 -0
  61. package/dist/components/feedback/index.d.ts +2 -0
  62. package/dist/components/history/HistoryHubModal.d.ts +44 -0
  63. package/dist/components/history/index.d.ts +1 -0
  64. package/dist/components/layout/AppFooter.d.ts +10 -0
  65. package/dist/components/layout/AppHeader.d.ts +22 -0
  66. package/dist/components/layout/EditorialSection.d.ts +27 -0
  67. package/dist/components/layout/EditorialSidebar.d.ts +34 -0
  68. package/dist/components/layout/HeroSection.d.ts +2 -0
  69. package/dist/components/layout/HeroWelcome.d.ts +11 -0
  70. package/dist/components/layout/SearchField.d.ts +9 -0
  71. package/dist/components/layout/StatusPill.d.ts +2 -0
  72. package/dist/components/layout/index.d.ts +8 -0
  73. package/dist/components/roadmap/RoadmapNode.d.ts +30 -0
  74. package/dist/components/roadmap/RoadmapSection.d.ts +27 -0
  75. package/dist/components/roadmap/RoadmapTrack.d.ts +25 -0
  76. package/dist/components/roadmap/serpentine-generator.d.ts +60 -0
  77. package/dist/components/roadmap/use-roadmap-scroll.d.ts +19 -0
  78. package/dist/components/source/EditPhotoModal.d.ts +22 -0
  79. package/dist/components/source/LightboxPhotoStrip.d.ts +23 -0
  80. package/dist/components/source/LinkFolderModal.d.ts +24 -0
  81. package/dist/components/source/SourceCard.d.ts +31 -0
  82. package/dist/components/source/SourceFolderAttachment.d.ts +25 -0
  83. package/dist/components/source/SourceGallery.d.ts +26 -0
  84. package/dist/components/source/SourceImage.d.ts +26 -0
  85. package/dist/components/source/SourceLightbox.d.ts +28 -0
  86. package/dist/components/source/index.d.ts +9 -0
  87. package/dist/components/ui/AccordionSection.d.ts +21 -0
  88. package/dist/components/ui/Breadcrumb.d.ts +29 -0
  89. package/dist/components/ui/Button.d.ts +31 -0
  90. package/dist/components/ui/ColumnSelect.d.ts +17 -0
  91. package/dist/components/ui/ColumnTypeBadge.d.ts +6 -0
  92. package/dist/components/ui/DevHelpTooltip.d.ts +11 -0
  93. package/dist/components/ui/DraggableRows.d.ts +21 -0
  94. package/dist/components/ui/Drawer.d.ts +50 -0
  95. package/dist/components/ui/DrawerTier.d.ts +8 -0
  96. package/dist/components/ui/EditableText.d.ts +48 -0
  97. package/dist/components/ui/FAB.d.ts +24 -0
  98. package/dist/components/ui/Modal.d.ts +24 -0
  99. package/dist/components/ui/PageTitle.d.ts +33 -0
  100. package/dist/components/ui/ParametricShape.d.ts +57 -0
  101. package/dist/components/ui/RevolvingButton.d.ts +5 -0
  102. package/dist/components/ui/SectionTitle.d.ts +42 -0
  103. package/dist/components/ui/SeriesSelectToolbar.d.ts +10 -0
  104. package/dist/components/ui/StatusPill.d.ts +21 -0
  105. package/dist/components/ui/TieredSlider.d.ts +19 -0
  106. package/dist/components/ui/Toast.d.ts +1 -0
  107. package/dist/components/ui/ValueLabelToggle.d.ts +10 -0
  108. package/dist/components/ui/index.d.ts +21 -0
  109. package/dist/config/engine.config.d.ts +162 -0
  110. package/dist/context/DeveloperModeContext.d.ts +11 -0
  111. package/dist/context/UndoRedoContext.d.ts +20 -0
  112. package/dist/diagnostics/verifyEngineSetup.d.ts +30 -0
  113. package/dist/diagnostics-CpGr1hhi.js +126 -0
  114. package/dist/diagnostics-Dw5PzR78.cjs +5 -0
  115. package/dist/diagnostics.cjs +1 -0
  116. package/dist/diagnostics.d.ts +10 -0
  117. package/dist/diagnostics.js +14 -0
  118. package/dist/edge-1WCVZ0J7.cjs +1 -0
  119. package/dist/edge-CSjifIhA.js +2709 -0
  120. package/dist/edge-Dr41JdrQ.cjs +34 -0
  121. package/dist/edge-h_ge9f1E.js +512 -0
  122. package/dist/edge.cjs +1 -0
  123. package/dist/edge.d.ts +10 -0
  124. package/dist/edge.js +26 -0
  125. package/dist/folio.cjs +9 -0
  126. package/dist/folio.js +21895 -0
  127. package/dist/hooks/use-auto-toc.d.ts +31 -0
  128. package/dist/hooks/use-discrete-step-navigation.d.ts +26 -0
  129. package/dist/hooks/use-dynamic-section-numbers.d.ts +30 -0
  130. package/dist/hooks/use-hash-route.d.ts +36 -0
  131. package/dist/hooks/use-scroll.d.ts +22 -0
  132. package/dist/hooks/use-scrollspy.d.ts +19 -0
  133. package/dist/hooks/useChartTooltip.d.ts +25 -0
  134. package/dist/hooks/useContent.d.ts +36 -0
  135. package/dist/hooks/useDeveloperMode.d.ts +1 -0
  136. package/dist/hooks/useDocumentCanvas.d.ts +53 -0
  137. package/dist/hooks/useDrivePhotoSync.d.ts +15 -0
  138. package/dist/hooks/useImageLoader.d.ts +12 -0
  139. package/dist/hooks/useLightboxHistory.d.ts +14 -0
  140. package/dist/hooks/useNodeCanvas.d.ts +2 -0
  141. package/dist/hooks/useSheetChartData.d.ts +31 -0
  142. package/dist/hooks/useSourcePoint.d.ts +35 -0
  143. package/dist/hooks/useSwipeGesture.d.ts +30 -0
  144. package/dist/hooks/useUndoRedo.d.ts +9 -0
  145. package/dist/hooks/useUnsavedChangesPrompt.d.ts +18 -0
  146. package/dist/index.d.ts +53 -0
  147. package/dist/main.d.ts +1 -0
  148. package/dist/services/canvasLayoutService.d.ts +158 -0
  149. package/dist/services/chartSourceService.d.ts +128 -0
  150. package/dist/services/devLockService.d.ts +76 -0
  151. package/dist/services/draftService.d.ts +129 -0
  152. package/dist/services/drivePhotoSyncService.d.ts +60 -0
  153. package/dist/services/driveVerificationService.d.ts +41 -0
  154. package/dist/services/edgePreBakeService.d.ts +81 -0
  155. package/dist/services/historyService.d.ts +215 -0
  156. package/dist/services/historyStorage.d.ts +17 -0
  157. package/dist/services/mediaService.d.ts +25 -0
  158. package/dist/services/sheetsDataService.d.ts +59 -0
  159. package/dist/services/sheetsVerificationService.d.ts +87 -0
  160. package/dist/services/sourceService.d.ts +43 -0
  161. package/dist/services/undoRedoService.d.ts +63 -0
  162. package/dist/services/unsavedChangesService.d.ts +32 -0
  163. package/dist/style.css +1 -0
  164. package/dist/types/canvas.d.ts +115 -0
  165. package/dist/types/chart.d.ts +117 -0
  166. package/dist/types/developer.d.ts +144 -0
  167. package/dist/types/draft.d.ts +21 -0
  168. package/dist/types/edge.d.ts +232 -0
  169. package/dist/types/history.d.ts +81 -0
  170. package/dist/types/media.d.ts +16 -0
  171. package/dist/types/navigation.d.ts +19 -0
  172. package/dist/types/node.d.ts +51 -0
  173. package/dist/types/source.d.ts +88 -0
  174. package/dist/utils/canvasDefaults.d.ts +43 -0
  175. package/dist/utils/chartColors.d.ts +48 -0
  176. package/dist/utils/chartDimensions.d.ts +50 -0
  177. package/dist/utils/chartMath.d.ts +142 -0
  178. package/dist/utils/chartSanitizer.d.ts +84 -0
  179. package/dist/utils/contentDb.d.ts +86 -0
  180. package/dist/utils/devSecurity.d.ts +84 -0
  181. package/dist/utils/mediaUrl.d.ts +32 -0
  182. package/dist/utils/modalActions.d.ts +32 -0
  183. package/dist/utils/node-sections.d.ts +15 -0
  184. package/dist/utils/page-sections.d.ts +1 -0
  185. package/dist/utils/runtime-env.d.ts +21 -0
  186. package/dist/utils/scrollLock.d.ts +10 -0
  187. package/dist/utils/smooth-scroll.d.ts +24 -0
  188. package/dist/utils/source.d.ts +25 -0
  189. package/dist/utils/storage.d.ts +13 -0
  190. package/dist/utils/supabase-config.d.ts +29 -0
  191. package/dist/utils/supabase-write-guard.d.ts +15 -0
  192. package/package.json +68 -4
  193. package/README.md +0 -3
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Folio Engine - Hybrid Local-First Storage & Layout Synchronization Service
3
+ * Location: src/services/canvasLayoutService.ts
4
+ * Specification: docs/tasks/task8_2_storage_and_sync_service.md
5
+ * Aligned with: docs/00_WORKFLOW.md, docs/03_ARCHITECTURE.md, docs/07_CODING_STANDARDS.md
6
+ *
7
+ * Implements:
8
+ * 1. Synchronous Local-First Storage (`localStorage` under `folio_canvas_${nodeId}`).
9
+ * 2. Cross-Component Event Bus (`engine-canvas-change`).
10
+ * 3. Immutable tree operations with strict section auto-numbering.
11
+ * 4. Resilient schema recovery and optional cloud persistence bridge.
12
+ */
13
+ import type { CanvasElement, CanvasLeafElement, SectionElement, SubsectionElement, NodeCanvasDocument } from '../types/canvas';
14
+ export declare const getCanvasLiveStoragePrefix: (ns?: string) => string;
15
+ export declare const CANVAS_LIVE_STORAGE_PREFIX: string;
16
+ export declare const getCanvasDraftStoragePrefix: (ns?: string) => string;
17
+ export declare const CANVAS_DRAFT_STORAGE_PREFIX: string;
18
+ export declare const getCanvasLegacyStoragePrefix: (ns?: string) => string;
19
+ export declare const CANVAS_LEGACY_STORAGE_PREFIX: string;
20
+ export declare const CANVAS_STORAGE_PREFIX: string;
21
+ export declare const EVENT_LIVE_CANVAS_CHANGE = "engine-live-canvas-change";
22
+ export declare const EVENT_DRAFT_CANVAS_CHANGE = "engine-draft-canvas-change";
23
+ export declare const CANVAS_SCHEMA_VERSION = 2;
24
+ export declare const NODE_IDS: readonly ["access", "equity", "quality", "resiliency", "governance"];
25
+ export type NodeId = (typeof NODE_IDS)[number];
26
+ export interface SaveCanvasOptions {
27
+ silent?: boolean;
28
+ }
29
+ export interface CanvasChangeEventDetail {
30
+ nodeId: string;
31
+ document: NodeCanvasDocument;
32
+ }
33
+ export interface SaveResult {
34
+ ok: boolean;
35
+ error?: 'quota' | 'unknown';
36
+ document: NodeCanvasDocument;
37
+ }
38
+ export interface CanvasLayoutService {
39
+ getNodeCanvas(nodeId: string, isDevMode?: boolean): NodeCanvasDocument;
40
+ saveNodeCanvas(doc: NodeCanvasDocument, isDevMode?: boolean): SaveResult;
41
+ resetNodeCanvas(nodeId: string, isDevMode?: boolean): NodeCanvasDocument;
42
+ subscribeToCanvasChange(nodeId: string, callback: (doc: NodeCanvasDocument) => void, isDevMode?: boolean): () => void;
43
+ deployNodeCanvasToCloud(nodeId: string): Promise<{
44
+ success: boolean;
45
+ error?: string;
46
+ }>;
47
+ }
48
+ /**
49
+ * Derives the canonical live localStorage key for a specific node.
50
+ */
51
+ export declare function getCanvasStorageKey(nodeId: string): string;
52
+ /**
53
+ * Derives the draft localStorage key for a specific node.
54
+ */
55
+ export declare function getDraftCanvasStorageKey(nodeId: string): string;
56
+ /**
57
+ * Seamlessly migrates legacy folio_canvas_* and folio_content_overrides keys to folio_live_*.
58
+ * Guarantees zero data loss for existing tenant configurations upon system update.
59
+ */
60
+ export declare function migrateLegacyStorageKeys(): void;
61
+ /**
62
+ * Folds ContentDB overrides into a single NodeCanvasDocument.
63
+ */
64
+ export declare function foldCanvasOverridesIntoDocument(doc: NodeCanvasDocument, overrides: Record<string, string>): {
65
+ modified: boolean;
66
+ consumedKeys: string[];
67
+ };
68
+ /**
69
+ * One-time idempotent migration that merges non-empty ContentDB overrides into the Canvas AST.
70
+ * Deletes consumed ContentDB keys to prevent legacy overrides from lingering.
71
+ */
72
+ export declare function migrateCanvasOverridesIntoAst(channel: 'live' | 'draft'): void;
73
+ /**
74
+ * Enforces sequential section numbering ("01", "02", "03"...) immutably.
75
+ */
76
+ export declare function renumberSections(sections: SectionElement[]): SectionElement[];
77
+ /**
78
+ * Inserts a section into the document tree with automatic renumbering.
79
+ */
80
+ export declare function insertSection(doc: NodeCanvasDocument, section: SectionElement, targetIndex?: number): NodeCanvasDocument;
81
+ /**
82
+ * Inserts a subsection container within a targeted section.
83
+ */
84
+ export declare function insertSubsection(doc: NodeCanvasDocument, sectionId: string, subsection: SubsectionElement, targetIndex?: number): NodeCanvasDocument;
85
+ /**
86
+ * Inserts a leaf element (text, photo, or chart) into a section or nested subsection.
87
+ */
88
+ export declare function insertLeafElement(doc: NodeCanvasDocument, sectionId: string, element: CanvasLeafElement, targetIndex?: number, subsectionId?: string): NodeCanvasDocument;
89
+ /**
90
+ * Moves an item up or down within its current container hierarchy.
91
+ */
92
+ /**
93
+ * Moves an item up or down, seamlessly traversing section boundaries when reaching the top or bottom of a section.
94
+ */
95
+ export declare function moveCanvasItem(doc: NodeCanvasDocument, itemId: string, direction: 'up' | 'down', parentId?: string): NodeCanvasDocument;
96
+ /**
97
+ * Relocates any canvas element (section, subsection, or leaf) from anywhere in the document
98
+ * to a new container and target index (powers cross-section drag-and-drop).
99
+ */
100
+ export declare function relocateCanvasItem(doc: NodeCanvasDocument, sourceItemId: string, targetContainerId: string, targetIndex?: number): NodeCanvasDocument;
101
+ /**
102
+ * Removes an item and all its nested children from the canvas document tree.
103
+ */
104
+ export declare function removeCanvasItem(doc: NodeCanvasDocument, itemId: string, parentId?: string): NodeCanvasDocument;
105
+ /**
106
+ * Immutably updates attributes of any canvas element by ID.
107
+ */
108
+ export declare function updateCanvasItem<T extends CanvasElement>(doc: NodeCanvasDocument, itemId: string, updates: Partial<T>): NodeCanvasDocument;
109
+ export interface CanvasItemLocation {
110
+ item: CanvasElement;
111
+ kind: 'section' | 'subsection' | 'leaf';
112
+ index: number;
113
+ sectionId: string;
114
+ subsectionId?: string;
115
+ }
116
+ /**
117
+ * Finds any item within the canvas document and returns its structural location and container.
118
+ */
119
+ export declare function findCanvasItemLocation(doc: NodeCanvasDocument, itemId: string): CanvasItemLocation | null;
120
+ /**
121
+ * Synchronous retrieval of a node canvas document strictly from the live/published channel.
122
+ */
123
+ export declare function getLiveNodeCanvas(nodeId: string): NodeCanvasDocument;
124
+ /**
125
+ * Persists a canvas document strictly to the live/published channel.
126
+ */
127
+ export declare function saveLiveNodeCanvas(doc: NodeCanvasDocument, options?: SaveCanvasOptions): SaveResult;
128
+ /**
129
+ * Synchronous local-first retrieval of a node canvas document.
130
+ * Reads from draft sandbox if Developer Mode is active (isDevMode === true);
131
+ * otherwise strictly and unconditionally from the canonical live published channel.
132
+ */
133
+ export declare function getNodeCanvas(nodeId: string, isDevMode?: boolean): NodeCanvasDocument;
134
+ /**
135
+ * Persists canvas document to storage (draft or live) and broadcasts change via scoped CustomEvent.
136
+ */
137
+ export declare function saveNodeCanvas(doc: NodeCanvasDocument, isDevMode?: boolean, options?: SaveCanvasOptions): SaveResult;
138
+ /**
139
+ * Dispatches an aggregate canvas change event with nodeId: '*' to notify all node consumers at once.
140
+ */
141
+ export declare function dispatchAggregateCanvasChange(isDevMode?: boolean): void;
142
+ /**
143
+ * Resets storage for a node back to factory defaults and broadcasts change via scoped CustomEvent.
144
+ */
145
+ export declare function resetNodeCanvas(nodeId: string, isDevMode?: boolean): NodeCanvasDocument;
146
+ /**
147
+ * Subscribes a listener to canvas change events strictly scoped by channel.
148
+ * Public views (isDevMode === false) never receive uncommitted draft events.
149
+ */
150
+ export declare function subscribeToCanvasChange(nodeId: string, callback: (doc: NodeCanvasDocument) => void, isDevMode?: boolean): () => void;
151
+ /**
152
+ * Deploys the active canvas document to cloud storage (Supabase).
153
+ */
154
+ export declare function deployNodeCanvasToCloud(nodeId: string): Promise<{
155
+ success: boolean;
156
+ error?: string;
157
+ }>;
158
+ export declare const canvasLayoutService: CanvasLayoutService;
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Supabase Cloud Storage & Chart Source Persistence Service
3
+ * Folio Engine
4
+ * Document Reference: docs/tasks/task7_2_access_verification_sheets_api.md
5
+ *
6
+ * Implements:
7
+ * 1. PostgREST / Supabase persistence for live chart configurations.
8
+ * 2. Instant-paint client cache backed by localStorage.
9
+ * 3. Zero-leak data security enforcement (internal Google Sheet URLs are stripped
10
+ * for public consumers).
11
+ * 4. Fault-tolerant offline and fallback handling.
12
+ */
13
+ import type { SheetChartConfig } from '../types/chart';
14
+ import type { NodeCode } from '../types/node';
15
+ export declare const getChartSourcePrefix: (ns?: string) => string;
16
+ export declare const LOCAL_STORAGE_PREFIX: string;
17
+ export declare const getChartSourcesManifestKey: (ns?: string) => string;
18
+ export declare const LOCAL_STORAGE_ALL_KEY: string;
19
+ export declare const EVENT_CHART_SOURCE_CHANGE = "engine-chart-source-change";
20
+ /**
21
+ * Helper to dispatch window events for live reactivity across chart components.
22
+ */
23
+ export declare function notifyChartChange(chartId: string, config: SheetChartConfig): void;
24
+ /**
25
+ * Publicly safe version of SheetChartConfig with private Google Sheet URL omitted.
26
+ */
27
+ export type PublicChartConfig = Omit<SheetChartConfig, 'sheetUrl'>;
28
+ export interface ChartSourceDbRow {
29
+ chart_id: string;
30
+ node_id: string;
31
+ sheet_url: string;
32
+ tab_name?: string | null;
33
+ sheet_gid?: string | null;
34
+ range?: string | null;
35
+ default_type?: string | null;
36
+ title_override?: string | null;
37
+ subtitle_override?: string | null;
38
+ unit_override?: string | null;
39
+ visual_config?: Record<string, unknown> | null;
40
+ cached_dataset?: (string | number | null)[][] | null;
41
+ updated_at?: string | null;
42
+ updated_by?: string | null;
43
+ }
44
+ import { getSupabaseConfig } from '../utils/supabase-config';
45
+ export { getSupabaseConfig };
46
+ /**
47
+ * Maps database record to typed client model.
48
+ */
49
+ export declare function mapDbRowToChartConfig(row: ChartSourceDbRow): SheetChartConfig;
50
+ /**
51
+ * Maps client model to database record payload.
52
+ */
53
+ export declare function mapChartConfigToDbRow(config: SheetChartConfig): ChartSourceDbRow;
54
+ /**
55
+ * Strips internal Google Sheet URL for public/client presentations (Zero-Leak Security).
56
+ */
57
+ export declare function sanitizePublicChartConfig(config: SheetChartConfig): PublicChartConfig;
58
+ /**
59
+ * Loads a cached chart configuration from memory or local storage.
60
+ */
61
+ export declare function getCachedChartConfig(chartId: string): SheetChartConfig | null;
62
+ /**
63
+ * Saves a chart configuration to memory and local storage.
64
+ * Returns true if stored locally (or in memory in non-browser environments).
65
+ */
66
+ export declare function setCachedChartConfig(config: SheetChartConfig): boolean;
67
+ /**
68
+ * Asynchronously fetches a chart configuration from Supabase or local cache.
69
+ */
70
+ export declare function fetchChartConfig(chartId: string, options?: {
71
+ forceRefresh?: boolean;
72
+ }): Promise<SheetChartConfig | null>;
73
+ /**
74
+ * Fetches all chart configurations belonging to a specific node.
75
+ */
76
+ export declare function fetchChartConfigsByNode(nodeId: NodeCode, _options?: {
77
+ forceRefresh?: boolean;
78
+ }): Promise<SheetChartConfig[]>;
79
+ /**
80
+ * Detailed outcome of persisting chart configuration across local and cloud stores.
81
+ */
82
+ export interface SaveChartConfigResult {
83
+ /**
84
+ * Whether the configuration was persisted (at least locally).
85
+ */
86
+ success: boolean;
87
+ /**
88
+ * Whether the configuration was saved to local browser storage / memory cache.
89
+ */
90
+ savedLocally: boolean;
91
+ /**
92
+ * Whether the configuration was synced to Supabase cloud.
93
+ */
94
+ savedToCloud: boolean;
95
+ /**
96
+ * Diagnostic error explanation with specific cause.
97
+ */
98
+ error?: string;
99
+ /**
100
+ * Diagnostic error code (e.g. PGRST205, HTTP_404, AUTH_FORBIDDEN, NETWORK_ERROR, QUOTA_EXCEEDED).
101
+ */
102
+ errorCode?: string;
103
+ /**
104
+ * HTTP status code if rejected by remote server.
105
+ */
106
+ statusCode?: number;
107
+ /**
108
+ * Additional diagnostic details or server hints.
109
+ */
110
+ details?: string;
111
+ }
112
+ /**
113
+ * Persists chart configuration with granular diagnostics and variance reporting.
114
+ */
115
+ export declare function saveChartConfigDetailed(config: SheetChartConfig, token?: string): Promise<SaveChartConfigResult>;
116
+ /**
117
+ * Formats a high-variance, user-facing error message with diagnostic context.
118
+ */
119
+ export declare function formatSaveErrorMessage(result: SaveChartConfigResult | Error | unknown, action?: 'save' | 'deploy'): string;
120
+ /**
121
+ * Persists chart configuration to local cache and Supabase cloud.
122
+ * Maintained for backward compatibility.
123
+ */
124
+ export declare function saveChartConfig(config: SheetChartConfig, token?: string): Promise<boolean>;
125
+ /**
126
+ * Clears cached chart configurations.
127
+ */
128
+ export declare function resetChartSourceCache(chartId?: string): void;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * devLockService.ts
3
+ * Folio Engine: Developer Mode Database Session Lock & Race Prevention Service
4
+ * Task 9.1: docs/tasks/task9_1_dev_mode_database_session_lock.md
5
+ *
6
+ * Enforces strict single-coordinator exclusivity across the portal:
7
+ * 1. PostgREST / Supabase cloud persistence for live cross-device coordinator lock.
8
+ * 2. High-resilience localStorage multi-tab fallback with cross-tab storage events.
9
+ * 3. 30-second heartbeat renewal with 60-second crash recovery timeout.
10
+ * 4. Beacon-based immediate release on tab/window unload (navigator.sendBeacon / fetch keepalive).
11
+ */
12
+ import type { DevSessionLock, DevLockStatusResponse } from '../types/developer';
13
+ export declare const getDevLockStorageKey: (ns?: string) => string;
14
+ export declare const DEV_LOCK_STORAGE_KEY: string;
15
+ export declare const getDevSessionIdKey: (ns?: string) => string;
16
+ export declare const DEV_SESSION_ID_KEY: string;
17
+ export declare const HEARTBEAT_INTERVAL_MS = 30000;
18
+ export declare const LOCK_EXPIRATION_MS = 60000;
19
+ import { getSupabaseConfig, isTableAvailable, markTableMissing } from '../utils/supabase-config';
20
+ export { getSupabaseConfig, isTableAvailable, markTableMissing };
21
+ export declare const TAB_INSTANCE_ID: string;
22
+ export declare function getSessionBroadcastChannel(): BroadcastChannel | null;
23
+ /**
24
+ * Regenerates a unique browser tab session ID (used when a cloned tab is detected).
25
+ */
26
+ export declare function regenerateSessionId(): string;
27
+ /**
28
+ * Generates or retrieves a persistent browser tab session ID.
29
+ */
30
+ export declare function getSessionId(): string;
31
+ /**
32
+ * Reset memory session ID (primarily for test harness isolation).
33
+ */
34
+ export declare function resetSessionIdForTesting(newId?: string): void;
35
+ /**
36
+ * Evaluates whether an active lock has expired past the 60-second crash recovery window.
37
+ */
38
+ export declare function isLockExpired(lock: DevSessionLock, now?: number): boolean;
39
+ /**
40
+ * Read the local session lock state from persistent storage.
41
+ */
42
+ export declare function getLocalLock(): DevSessionLock | null;
43
+ /**
44
+ * Write the local session lock state to persistent storage.
45
+ */
46
+ export declare function setLocalLock(lock: DevSessionLock | null): void;
47
+ /**
48
+ * Query active lock status from Supabase cloud or local multi-tab cache.
49
+ */
50
+ export declare function checkDevLockStatus(sessionId: string): Promise<DevLockStatusResponse>;
51
+ /**
52
+ * Attempt to acquire the Developer Mode lock institutional-wide.
53
+ * Enforces atomic Compare-And-Swap (CAS) against Supabase cloud storage.
54
+ */
55
+ export declare function acquireDevLock(sessionId: string, coordinatorLabel?: string): Promise<{
56
+ success: boolean;
57
+ lock?: DevSessionLock;
58
+ error?: string;
59
+ }>;
60
+ /**
61
+ * Renews the liveness timestamp for the active session.
62
+ * Rejects renewal if another session has claimed the cloud row.
63
+ */
64
+ export declare function renewDevLockHeartbeat(sessionId: string): Promise<boolean>;
65
+ /**
66
+ * Releases the Developer Mode lock cleanly.
67
+ */
68
+ export declare function releaseDevLock(sessionId: string): Promise<boolean>;
69
+ /**
70
+ * Dispatches an instant release beacon when tab/window unloads (beforeunload/pagehide).
71
+ */
72
+ export declare function releaseDevLockBeacon(sessionId: string): void;
73
+ /**
74
+ * Subscribes to cross-tab lock changes via storage events.
75
+ */
76
+ export declare function subscribeToLockStorage(callback: (lock: DevSessionLock | null) => void): () => void;
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Folio Engine - Draft Isolation & Cloud DB-Draft Service
3
+ * Location: src/services/draftService.ts
4
+ * Specification: docs/tasks/task11_2g_db_draft_and_blob_storage_pipeline.md
5
+ * Aligned with: docs/00_WORKFLOW.md, docs/03_ARCHITECTURE.md, docs/07_CODING_STANDARDS.md
6
+ *
7
+ * Implements:
8
+ * 1. Zero-localStorage in-memory draft sandbox for 60 FPS editing.
9
+ * 2. Active draft lifecycle & dirty change tracking (hasUnpublishedChanges).
10
+ * 3. Cloud-backed draft synchronization with Supabase engine_drafts table.
11
+ * 4. 1500ms debounced auto-sync with status events (saved, saving, error, offline).
12
+ * 5. Safe draft discard and multi-device continuation.
13
+ */
14
+ import type { NodeCanvasDocument } from '../types/canvas';
15
+ import type { CloudDraftData, CloudDraftSyncStatus, DraftSyncStatusEventDetail } from '../types/draft';
16
+ export declare const getDraftCanvasPrefix: (ns?: string) => string;
17
+ export declare const DRAFT_CANVAS_PREFIX: string;
18
+ export declare const getDraftContentKey: (ns?: string) => string;
19
+ export declare const DRAFT_CONTENT_KEY: string;
20
+ export declare const getDraftActiveKey: (ns?: string) => string;
21
+ export declare const DRAFT_ACTIVE_KEY: string;
22
+ export declare const getDraftDirtyKey: (ns?: string) => string;
23
+ export declare const DRAFT_DIRTY_KEY: string;
24
+ export declare const EVENT_DRAFT_STATUS_CHANGE = "engine-draft-status-change";
25
+ export declare const EVENT_CLOUD_DRAFT_SYNC_STATUS = "engine-cloud-draft-sync-status";
26
+ export declare const AUTOSYNC_DEBOUNCE_MS = 1500;
27
+ export interface DraftActiveMetadata {
28
+ baseId: string | null;
29
+ startedAt?: string;
30
+ }
31
+ export interface DraftStalenessCheck {
32
+ isStale: boolean;
33
+ baseId: string | null;
34
+ currentActiveId: string;
35
+ }
36
+ /**
37
+ * Returns the legacy draft canvas storage key for a specific node.
38
+ */
39
+ export declare function getDraftCanvasKey(nodeId: string): string;
40
+ /**
41
+ * Retrieves in-memory draft canvas for a node.
42
+ */
43
+ export declare function getInMemoryDraftCanvas(nodeId: string): NodeCanvasDocument | null;
44
+ /**
45
+ * Sets in-memory draft canvas for a node.
46
+ */
47
+ export declare function setInMemoryDraftCanvas(nodeId: string, doc: NodeCanvasDocument): void;
48
+ /**
49
+ * Whether Developer Mode draft sandbox is currently active.
50
+ */
51
+ export declare function isDraftModeActive(): boolean;
52
+ /**
53
+ * Retrieves the base snapshot ID that the current draft was cloned from.
54
+ */
55
+ export declare function getDraftBaseId(): string | null;
56
+ /**
57
+ * Checks whether the current draft is stale compared to the live active published snapshot.
58
+ */
59
+ export declare function checkDraftStaleness(): DraftStalenessCheck;
60
+ /**
61
+ * Boolean convenience helper to check if draft is stale.
62
+ */
63
+ export declare function isDraftStale(): boolean;
64
+ /**
65
+ * Activates or deactivates the draft sandbox mode.
66
+ */
67
+ export declare function setDraftModeActive(active: boolean, baseId?: string | null): void;
68
+ /**
69
+ * Checks whether the current draft has uncommitted changes.
70
+ */
71
+ export declare function isDraftDirty(): boolean;
72
+ /**
73
+ * Sets the draft dirty flag and dispatches draft change event.
74
+ */
75
+ export declare function setDraftDirty(dirty: boolean): void;
76
+ /**
77
+ * Emits global CustomEvent to notify all components of draft sandbox mutations.
78
+ */
79
+ export declare function dispatchDraftChange(): void;
80
+ /**
81
+ * Subscribes to changes in draft mode status and dirty flag.
82
+ */
83
+ export declare function subscribeToDraftStatus(callback: (status: {
84
+ isActive: boolean;
85
+ isDirty: boolean;
86
+ }) => void): () => void;
87
+ /**
88
+ * Returns current cloud draft sync status.
89
+ */
90
+ export declare function getCloudDraftSyncStatus(): CloudDraftSyncStatus;
91
+ /**
92
+ * Subscribes to cloud draft sync status events.
93
+ */
94
+ export declare function subscribeToCloudDraftSync(callback: (detail: DraftSyncStatusEventDetail) => void): () => void;
95
+ /**
96
+ * Clears all in-memory draft canvas documents, flags, and any lingering storage keys.
97
+ */
98
+ export declare function clearDraftStorage(): void;
99
+ /**
100
+ * Checks whether any draft data currently exists in memory or persistent storage.
101
+ */
102
+ export declare function hasDraftKeys(): boolean;
103
+ /**
104
+ * Queries active draft from Supabase engine_drafts table.
105
+ */
106
+ export declare function fetchActiveCloudDraft(): Promise<CloudDraftData | null>;
107
+ /**
108
+ * Syncs the current in-memory draft state to Supabase engine_drafts.
109
+ */
110
+ export declare function syncDraftToCloud(): Promise<boolean>;
111
+ /**
112
+ * Triggers debounced background auto-sync to Supabase engine_drafts.
113
+ */
114
+ export declare function triggerDebouncedCloudDraftSync(): void;
115
+ /**
116
+ * Initializes a Developer Mode draft editing sandbox.
117
+ * Populates in-memory draft state from Supabase engine_drafts or live published baseline.
118
+ * Zero writes of canvas documents to localStorage.
119
+ */
120
+ export declare function initDraftSession(forceFresh?: boolean): Promise<void>;
121
+ /**
122
+ * Discards all uncommitted draft changes and reverts the workspace to the active live published state.
123
+ */
124
+ export declare function discardDraftSession(): Promise<void>;
125
+ /**
126
+ * Synchronizes draft storage to mirror the newly published live baseline.
127
+ * Resets the draft dirty state to clean (hasUnpublishedChanges = false).
128
+ */
129
+ export declare function syncDraftWithPublished(canvases: Record<string, NodeCanvasDocument>, _contentOverrides?: Record<string, string>, newBaseId?: string): void;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Drive Photo Synchronization & Differential Reconciliation Service
3
+ * Folio Engine
4
+ *
5
+ * Implements Subtask 6.1:
6
+ * - O(1) Map-based Differential Reconciliation of Google Drive photos with source gallery records
7
+ * - Identity preservation and coordinator custom-title retention
8
+ * - Natural numeric filename sorting (01_, 02_, ... 10_)
9
+ * - Machine filename auto-cleaning into editorial titles
10
+ * - Fallback high-res and thumbnail URL constructor
11
+ * - Google Drive REST API v3 Image Fetcher
12
+ */
13
+ import type { DrivePhotoFile, SyncedSourceItem, DriveReconciliationResult, SyncFolderPhotosResult } from '../types/source';
14
+ /**
15
+ * Strips machine prefixes, extensions, and sequence numbers from raw filenames
16
+ * converting them into clean editorial titles.
17
+ */
18
+ export declare function cleanDriveFileName(rawName: string): string;
19
+ /**
20
+ * Performs natural numeric comparison on filenames to ensure sequential ordering
21
+ * (e.g. "01_Photo.jpg", "02_Photo.jpg", "10_Photo.jpg").
22
+ */
23
+ export declare function compareNaturalFilenames(a: string, b: string): number;
24
+ /**
25
+ * Transforms Google Drive thumbnail link into permanent high-resolution endpoint (=s1600 or sz=w1600).
26
+ * Bypasses ephemeral /drive-storage/ URLs by strictly generating permanent Google Drive endpoints.
27
+ * Supports edge media proxy generation (/api/media/drive/:fileId?w=1600) when preferEdgeProxy is true.
28
+ */
29
+ export declare function formatHighResDriveUrl(thumbnailLink?: string, fileId?: string, preferEdgeProxy?: boolean): string;
30
+ /**
31
+ * Returns permanent thumbnail URL, bypassing ephemeral /drive-storage/ session links.
32
+ * Supports edge media proxy generation (/api/media/drive/:fileId?w=320) when preferEdgeProxy is true.
33
+ */
34
+ export declare function formatThumbnailDriveUrl(thumbnailLink?: string, fileId?: string, preferEdgeProxy?: boolean): string;
35
+ /**
36
+ * Pure O(1) Map Differential Reconciliation Engine.
37
+ * Reconciles incoming Google Drive photo files against existing synced source records.
38
+ *
39
+ * Invariants:
40
+ * 1. Preserves existing item instances, IDs, and custom titles (isCustomTitle: true).
41
+ * 2. Appends new images with clean titles and natural orderIndex.
42
+ * 3. Prunes images deleted from Google Drive.
43
+ * 4. Yields accurate differential stats and hasChanged boolean.
44
+ */
45
+ export declare function reconcileDrivePhotos(existingItems: SyncedSourceItem[], incomingFiles: DrivePhotoFile[], pointId: string): DriveReconciliationResult;
46
+ /**
47
+ * Queries Google Drive REST API v3 to list image files within a public folder root.
48
+ * Supports public shared drives, resource keys, subfolder scanning, and Google Workspace links.
49
+ */
50
+ export declare function fetchDriveFolderImages(folderUrlOrId: string): Promise<DrivePhotoFile[]>;
51
+ /**
52
+ * High-level orchestration function for syncing a node's Google Drive folder.
53
+ * Subtask 6.2: Service Orchestration Function.
54
+ *
55
+ * 1. Fetches image files from Google Drive REST API v3
56
+ * 2. Reconciles incoming files with existing synced items (O(1) Map diff)
57
+ * 3. Persists the reconciled photo manifest into BaaS / LocalStorage cache via upsertLiveSourceSource
58
+ * 4. Dispatches reactive update events and returns the reconciled items, diff stats, and updated source
59
+ */
60
+ export declare function syncFolderPhotos(pointId: string, folderUrl: string, existingPhotos?: SyncedSourceItem[], authToken?: string): Promise<SyncFolderPhotosResult>;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Drive Verification Service
3
+ * Folio Engine
4
+ * Automated Google Drive MOV Repository & Folder Verification
5
+ *
6
+ * Implements a hybrid verification engine:
7
+ * 1. Google Drive REST API v3: Directly verifies folder existence, public accessibility,
8
+ * and extracts official folder titles.
9
+ * 2. Graceful Fallback: Handles offline, quota, or network restrictions without blocking coordinators.
10
+ */
11
+ export interface DriveVerificationResult {
12
+ status: 'valid' | 'restricted' | 'not_a_folder' | 'unverified' | 'invalid_format';
13
+ folderId?: string;
14
+ folderTitle?: string;
15
+ mimeType?: string;
16
+ message?: string;
17
+ apiError?: {
18
+ statusCode?: number;
19
+ reason?: string;
20
+ rawMessage?: string;
21
+ };
22
+ }
23
+ /**
24
+ * Extracts canonical Google Drive folder ID from a URL.
25
+ */
26
+ export declare function extractDriveFolderId(url: string): string | null;
27
+ /**
28
+ * Extracts optional Google Drive resource key from URL query parameters.
29
+ */
30
+ export declare function extractResourceKey(url: string): string | null;
31
+ /**
32
+ * Automatically verifies a Google Drive folder URL:
33
+ * - Checks if the folder exists
34
+ * - Verifies that it is publicly accessible ("Anyone with the link can view")
35
+ * - Supports Google Workspace Shared Drives (supportsAllDrives=true)
36
+ * - Detects API Key / deployment referrer restrictions and falls back gracefully
37
+ * - Formats explicit diagnostic edge error details (HTTP codes, API messages, network issues)
38
+ * - Discovers the folder's official title
39
+ * - Verifies that it is actually a folder (not a lone file)
40
+ */
41
+ export declare function verifyDriveFolderUrl(url: string): Promise<DriveVerificationResult>;
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Folio Engine — Edge KV Pre-Baking Pipeline Service
3
+ * Location: src/services/edgePreBakeService.ts
4
+ * Specification: docs/tasks/task15_3_edge_kv_pre_baking_pipeline.md
5
+ *
6
+ * Implements:
7
+ * 1. Publish-time AST compiler for all 5 nodes.
8
+ * 2. Deterministic Google Drive URL rewriting to edge proxy endpoints (/api/media/drive/:fileId?w=800).
9
+ * 3. Pre-calculated multi-density responsive srcSet (400w, 800w, 1600w).
10
+ * 4. Bundles indicator chart datasets & source metadata directly into public payloads.
11
+ * 5. Atomic bulk deployment to Cloudflare KV REST API with resilient offline fallback.
12
+ */
13
+ import type { PublicNodePayload, PublicPortalManifestPayload, CachedIndicatorDataset, SyncedSourceMetadata } from '../types/edge';
14
+ import type { NodeCanvasDocument } from '../types/canvas';
15
+ import type { PublishedSnapshot } from '../types/history';
16
+ export declare const TRANSFORM_BREAKPOINTS: readonly [400, 800, 1600];
17
+ export declare const DEFAULT_SIZES_ATTRIBUTE = "(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 800px";
18
+ export declare const DEFAULT_PHOTO_ASPECT_RATIO = "16/9";
19
+ export interface CloudflareKVCredentials {
20
+ accountId?: string;
21
+ namespaceId?: string;
22
+ apiToken?: string;
23
+ }
24
+ export interface KVPairPayload {
25
+ key: string;
26
+ value: string;
27
+ expiration?: number;
28
+ expiration_ttl?: number;
29
+ metadata?: unknown;
30
+ }
31
+ export interface KVDeployResult {
32
+ success: boolean;
33
+ deployedCount: number;
34
+ warning?: string;
35
+ error?: string;
36
+ }
37
+ export interface PreBakeResult {
38
+ success: boolean;
39
+ snapshotId: string;
40
+ transformedNodes: string[];
41
+ totalKvKeys: number;
42
+ deployResult: KVDeployResult;
43
+ }
44
+ export interface PreBakeCompileOptions {
45
+ nodeIds?: string[];
46
+ chartDatasets?: Record<string, CachedIndicatorDataset>;
47
+ sourceMetadata?: Record<string, SyncedSourceMetadata>;
48
+ credentials?: CloudflareKVCredentials;
49
+ }
50
+ /**
51
+ * Recursively walks the Canvas AST and pre-bakes responsive edge proxy URLs for all photo elements.
52
+ * Preserves local assets, data URLs, and custom aspect ratios untouched.
53
+ */
54
+ export declare function transformCanvasAst(canvasDoc: NodeCanvasDocument): NodeCanvasDocument;
55
+ /**
56
+ * Gathers cached indicator datasets for a node document.
57
+ */
58
+ export declare function gatherIndicatorDatasets(nodeId: string, provided?: Record<string, CachedIndicatorDataset>): Record<string, CachedIndicatorDataset>;
59
+ /**
60
+ * Gathers synced source metadata for a node document.
61
+ */
62
+ export declare function gatherSourceMetadata(nodeId: string, provided?: Record<string, SyncedSourceMetadata>): Record<string, SyncedSourceMetadata>;
63
+ /**
64
+ * Compiles a single node's pre-baked PublicNodePayload ready for KV deployment.
65
+ */
66
+ export declare function compilePublicNodePayload(nodeId: string, snapshot: PublishedSnapshot, options?: PreBakeCompileOptions): PublicNodePayload;
67
+ /**
68
+ * Compiles the PublicPortalManifestPayload pointing to the active published snapshot.
69
+ */
70
+ export declare function compilePortalManifest(snapshot: PublishedSnapshot, nodeIds?: string[]): PublicPortalManifestPayload;
71
+ /**
72
+ * Dispatches bulk key-value pairs to Cloudflare KV REST API.
73
+ * In offline dev environments or when credentials are not configured,
74
+ * logs a friendly warning and returns cleanly without throwing.
75
+ */
76
+ export declare function deployPayloadsToCloudflareKV(payloads: KVPairPayload[], credentials?: CloudflareKVCredentials): Promise<KVDeployResult>;
77
+ /**
78
+ * Top-level Orchestrator: Pre-bakes all 5 nodes and manifest,
79
+ * deploying atomically to Cloudflare KV.
80
+ */
81
+ export declare function compileAndDeployToEdgeKV(snapshot: PublishedSnapshot, options?: PreBakeCompileOptions): Promise<PreBakeResult>;