@forgecharts/sdk 1.1.23 → 1.1.28
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/__tests__/backwardCompatibility.test.d.ts +14 -0
- package/dist/__tests__/backwardCompatibility.test.d.ts.map +1 -0
- package/dist/__tests__/backwardCompatibility.test.js +159 -0
- package/dist/__tests__/backwardCompatibility.test.js.map +1 -0
- package/dist/__tests__/candleInvariant.test.d.ts +20 -0
- package/dist/__tests__/candleInvariant.test.d.ts.map +1 -0
- package/dist/__tests__/candleInvariant.test.js +415 -0
- package/dist/__tests__/candleInvariant.test.js.map +1 -0
- package/dist/__tests__/public-api-surface.d.ts +13 -0
- package/dist/__tests__/public-api-surface.d.ts.map +1 -0
- package/{src/__tests__/public-api-surface.ts → dist/__tests__/public-api-surface.js} +4 -42
- package/dist/__tests__/public-api-surface.js.map +1 -0
- package/dist/__tests__/timeframeBoundary.test.d.ts +17 -0
- package/dist/__tests__/timeframeBoundary.test.d.ts.map +1 -0
- package/dist/__tests__/timeframeBoundary.test.js +452 -0
- package/dist/__tests__/timeframeBoundary.test.js.map +1 -0
- package/dist/api/DrawingManager.d.ts +20 -0
- package/dist/api/DrawingManager.d.ts.map +1 -0
- package/dist/api/DrawingManager.js +190 -0
- package/dist/api/DrawingManager.js.map +1 -0
- package/dist/api/EventBus.d.ts +19 -0
- package/dist/api/EventBus.d.ts.map +1 -0
- package/dist/api/EventBus.js +44 -0
- package/dist/api/EventBus.js.map +1 -0
- package/dist/api/IndicatorDAG.d.ts +85 -0
- package/dist/api/IndicatorDAG.d.ts.map +1 -0
- package/dist/api/IndicatorDAG.js +316 -0
- package/dist/api/IndicatorDAG.js.map +1 -0
- package/dist/api/IndicatorRegistry.d.ts +22 -0
- package/dist/api/IndicatorRegistry.d.ts.map +1 -0
- package/dist/api/IndicatorRegistry.js +39 -0
- package/dist/api/IndicatorRegistry.js.map +1 -0
- package/dist/api/LayoutManager.d.ts +30 -0
- package/dist/api/LayoutManager.d.ts.map +1 -0
- package/dist/api/LayoutManager.js +51 -0
- package/dist/api/LayoutManager.js.map +1 -0
- package/dist/api/PaneManager.d.ts +42 -0
- package/dist/api/PaneManager.d.ts.map +1 -0
- package/dist/api/PaneManager.js +119 -0
- package/dist/api/PaneManager.js.map +1 -0
- package/dist/api/ReferenceAPI.d.ts +78 -0
- package/dist/api/ReferenceAPI.d.ts.map +1 -0
- package/dist/api/ReferenceAPI.js +153 -0
- package/dist/api/ReferenceAPI.js.map +1 -0
- package/dist/api/TChart.d.ts +345 -0
- package/dist/api/TChart.d.ts.map +1 -0
- package/dist/api/TChart.js +765 -0
- package/dist/api/TChart.js.map +1 -0
- package/{src/api/createChart.ts → dist/api/createChart.d.ts} +2 -7
- package/dist/api/createChart.d.ts.map +1 -0
- package/dist/api/createChart.js +42 -0
- package/dist/api/createChart.js.map +1 -0
- package/dist/api/drawing tools/fib gann menu/fibRetracement.d.ts +4 -0
- package/dist/api/drawing tools/fib gann menu/fibRetracement.d.ts.map +1 -0
- package/dist/api/drawing tools/fib gann menu/fibRetracement.js +22 -0
- package/dist/api/drawing tools/fib gann menu/fibRetracement.js.map +1 -0
- package/dist/api/drawing tools/lines menu/crossLine.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/crossLine.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/crossLine.js +16 -0
- package/dist/api/drawing tools/lines menu/crossLine.js.map +1 -0
- package/dist/api/drawing tools/lines menu/disjointChannel.d.ts +17 -0
- package/dist/api/drawing tools/lines menu/disjointChannel.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/disjointChannel.js +59 -0
- package/dist/api/drawing tools/lines menu/disjointChannel.js.map +1 -0
- package/dist/api/drawing tools/lines menu/extendedLine.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/extendedLine.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/extendedLine.js +17 -0
- package/dist/api/drawing tools/lines menu/extendedLine.js.map +1 -0
- package/dist/api/drawing tools/lines menu/flatTopBottom.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/flatTopBottom.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/flatTopBottom.js +41 -0
- package/dist/api/drawing tools/lines menu/flatTopBottom.js.map +1 -0
- package/dist/api/drawing tools/lines menu/horizontal.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/horizontal.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/horizontal.js +19 -0
- package/dist/api/drawing tools/lines menu/horizontal.js.map +1 -0
- package/dist/api/drawing tools/lines menu/horizontalRay.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/horizontalRay.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/horizontalRay.js +20 -0
- package/dist/api/drawing tools/lines menu/horizontalRay.js.map +1 -0
- package/dist/api/drawing tools/lines menu/infoLine.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/infoLine.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/infoLine.js +107 -0
- package/dist/api/drawing tools/lines menu/infoLine.js.map +1 -0
- package/dist/api/drawing tools/lines menu/insidePitchfork.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/insidePitchfork.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/insidePitchfork.js +31 -0
- package/dist/api/drawing tools/lines menu/insidePitchfork.js.map +1 -0
- package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.js +15 -0
- package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.js.map +1 -0
- package/dist/api/drawing tools/lines menu/parallelChannel.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/parallelChannel.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/parallelChannel.js +43 -0
- package/dist/api/drawing tools/lines menu/parallelChannel.js.map +1 -0
- package/dist/api/drawing tools/lines menu/pitchfork.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/pitchfork.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/pitchfork.js +12 -0
- package/dist/api/drawing tools/lines menu/pitchfork.js.map +1 -0
- package/dist/api/drawing tools/lines menu/ray.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/ray.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/ray.js +23 -0
- package/dist/api/drawing tools/lines menu/ray.js.map +1 -0
- package/dist/api/drawing tools/lines menu/regressionTrend.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/regressionTrend.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/regressionTrend.js +127 -0
- package/dist/api/drawing tools/lines menu/regressionTrend.js.map +1 -0
- package/dist/api/drawing tools/lines menu/schiffPitchfork.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/schiffPitchfork.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/schiffPitchfork.js +15 -0
- package/dist/api/drawing tools/lines menu/schiffPitchfork.js.map +1 -0
- package/dist/api/drawing tools/lines menu/trendAngle.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/trendAngle.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/trendAngle.js +51 -0
- package/dist/api/drawing tools/lines menu/trendAngle.js.map +1 -0
- package/dist/api/drawing tools/lines menu/trendline.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/trendline.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/trendline.js +11 -0
- package/dist/api/drawing tools/lines menu/trendline.js.map +1 -0
- package/dist/api/drawing tools/lines menu/vertical.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/vertical.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/vertical.js +11 -0
- package/dist/api/drawing tools/lines menu/vertical.js.map +1 -0
- package/dist/api/drawing tools/pointers menu/crosshair.d.ts +16 -0
- package/dist/api/drawing tools/pointers menu/crosshair.d.ts.map +1 -0
- package/{src/api/drawing tools/pointers menu/crosshair.ts → dist/api/drawing tools/pointers menu/crosshair.js } +6 -7
- package/dist/api/drawing tools/pointers menu/crosshair.js.map +1 -0
- package/dist/api/drawing tools/pointers menu/cursor.d.ts +15 -0
- package/dist/api/drawing tools/pointers menu/cursor.d.ts.map +1 -0
- package/{src/api/drawing tools/pointers menu/cursor.ts → dist/api/drawing tools/pointers menu/cursor.js } +7 -8
- package/dist/api/drawing tools/pointers menu/cursor.js.map +1 -0
- package/dist/api/drawing tools/pointers menu/demonstration.d.ts +30 -0
- package/dist/api/drawing tools/pointers menu/demonstration.d.ts.map +1 -0
- package/{src/api/drawing tools/pointers menu/demonstration.ts → dist/api/drawing tools/pointers menu/demonstration.js } +9 -14
- package/dist/api/drawing tools/pointers menu/demonstration.js.map +1 -0
- package/dist/api/drawing tools/pointers menu/dot.d.ts +23 -0
- package/dist/api/drawing tools/pointers menu/dot.d.ts.map +1 -0
- package/{src/api/drawing tools/pointers menu/dot.ts → dist/api/drawing tools/pointers menu/dot.js } +8 -11
- package/dist/api/drawing tools/pointers menu/dot.js.map +1 -0
- package/dist/api/drawing tools/shapes menu/rectangle.d.ts +4 -0
- package/dist/api/drawing tools/shapes menu/rectangle.d.ts.map +1 -0
- package/dist/api/drawing tools/shapes menu/rectangle.js +19 -0
- package/dist/api/drawing tools/shapes menu/rectangle.js.map +1 -0
- package/dist/api/drawing tools/shapes menu/text.d.ts +4 -0
- package/dist/api/drawing tools/shapes menu/text.d.ts.map +1 -0
- package/dist/api/drawing tools/shapes menu/text.js +25 -0
- package/dist/api/drawing tools/shapes menu/text.js.map +1 -0
- package/dist/api/drawingUtils.d.ts +22 -0
- package/dist/api/drawingUtils.d.ts.map +1 -0
- package/dist/api/drawingUtils.js +83 -0
- package/dist/api/drawingUtils.js.map +1 -0
- package/dist/core/CanvasLayer.d.ts +26 -0
- package/dist/core/CanvasLayer.d.ts.map +1 -0
- package/dist/core/CanvasLayer.js +56 -0
- package/dist/core/CanvasLayer.js.map +1 -0
- package/dist/core/Chart.d.ts +164 -0
- package/dist/core/Chart.d.ts.map +1 -0
- package/dist/core/Chart.js +839 -0
- package/dist/core/Chart.js.map +1 -0
- package/dist/core/CoordTransform.d.ts +168 -0
- package/dist/core/CoordTransform.d.ts.map +1 -0
- package/dist/core/CoordTransform.js +224 -0
- package/dist/core/CoordTransform.js.map +1 -0
- package/dist/core/Crosshair.d.ts +30 -0
- package/dist/core/Crosshair.d.ts.map +1 -0
- package/dist/core/Crosshair.js +186 -0
- package/dist/core/Crosshair.js.map +1 -0
- package/dist/core/IndicatorEngine.d.ts +51 -0
- package/dist/core/IndicatorEngine.d.ts.map +1 -0
- package/dist/core/IndicatorEngine.js +181 -0
- package/dist/core/IndicatorEngine.js.map +1 -0
- package/dist/core/InteractionManager.d.ts +197 -0
- package/dist/core/InteractionManager.d.ts.map +1 -0
- package/dist/core/InteractionManager.js +698 -0
- package/dist/core/InteractionManager.js.map +1 -0
- package/dist/core/PriceScale.d.ts +27 -0
- package/dist/core/PriceScale.d.ts.map +1 -0
- package/dist/core/PriceScale.js +113 -0
- package/dist/core/PriceScale.js.map +1 -0
- package/dist/core/Series.d.ts +40 -0
- package/dist/core/Series.d.ts.map +1 -0
- package/dist/core/Series.js +114 -0
- package/dist/core/Series.js.map +1 -0
- package/dist/core/TimeScale.d.ts +43 -0
- package/dist/core/TimeScale.d.ts.map +1 -0
- package/dist/core/TimeScale.js +150 -0
- package/dist/core/TimeScale.js.map +1 -0
- package/dist/datafeed/DatafeedConnector.d.ts +89 -0
- package/dist/datafeed/DatafeedConnector.d.ts.map +1 -0
- package/dist/datafeed/DatafeedConnector.js +268 -0
- package/dist/datafeed/DatafeedConnector.js.map +1 -0
- package/dist/engine/CandleEngine.d.ts +207 -0
- package/dist/engine/CandleEngine.d.ts.map +1 -0
- package/dist/engine/CandleEngine.js +318 -0
- package/dist/engine/CandleEngine.js.map +1 -0
- package/dist/engine/__tests__/CandleEngine.test.d.ts +2 -0
- package/dist/engine/__tests__/CandleEngine.test.d.ts.map +1 -0
- package/dist/engine/__tests__/CandleEngine.test.js +300 -0
- package/dist/engine/__tests__/CandleEngine.test.js.map +1 -0
- package/dist/engine/candleInvariants.d.ts +66 -0
- package/dist/engine/candleInvariants.d.ts.map +1 -0
- package/dist/engine/candleInvariants.js +134 -0
- package/dist/engine/candleInvariants.js.map +1 -0
- package/{src/engine/mergeUtils.ts → dist/engine/mergeUtils.d.ts} +15 -52
- package/dist/engine/mergeUtils.d.ts.map +1 -0
- package/dist/engine/mergeUtils.js +64 -0
- package/dist/engine/mergeUtils.js.map +1 -0
- package/dist/engine/timeframeUtils.d.ts +80 -0
- package/dist/engine/timeframeUtils.d.ts.map +1 -0
- package/{src/engine/timeframeUtils.ts → dist/engine/timeframeUtils.js} +30 -48
- package/dist/engine/timeframeUtils.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +29 -0
- package/dist/internal.d.ts.map +1 -0
- package/{src/internal.ts → dist/internal.js} +2 -11
- package/dist/internal.js.map +1 -0
- package/dist/licensing/ChartRuntimeResolver.d.ts +233 -0
- package/dist/licensing/ChartRuntimeResolver.d.ts.map +1 -0
- package/dist/licensing/ChartRuntimeResolver.js +310 -0
- package/dist/licensing/ChartRuntimeResolver.js.map +1 -0
- package/dist/licensing/LicenseManager.d.ts +55 -0
- package/dist/licensing/LicenseManager.d.ts.map +1 -0
- package/dist/licensing/LicenseManager.js +114 -0
- package/dist/licensing/LicenseManager.js.map +1 -0
- package/dist/licensing/__tests__/ChartRuntimeResolver.test.d.ts +13 -0
- package/dist/licensing/__tests__/ChartRuntimeResolver.test.d.ts.map +1 -0
- package/dist/licensing/__tests__/ChartRuntimeResolver.test.js +177 -0
- package/dist/licensing/__tests__/ChartRuntimeResolver.test.js.map +1 -0
- package/dist/licensing/__tests__/LicenseManager.test.d.ts +12 -0
- package/dist/licensing/__tests__/LicenseManager.test.d.ts.map +1 -0
- package/dist/licensing/__tests__/LicenseManager.test.js +153 -0
- package/dist/licensing/__tests__/LicenseManager.test.js.map +1 -0
- package/dist/licensing/licenseTypes.d.ts +18 -0
- package/dist/licensing/licenseTypes.d.ts.map +1 -0
- package/dist/licensing/licenseTypes.js +2 -0
- package/dist/licensing/licenseTypes.js.map +1 -0
- package/dist/pine/PineCompiler.d.ts +35 -0
- package/dist/pine/PineCompiler.d.ts.map +1 -0
- package/dist/pine/PineCompiler.js +44 -0
- package/dist/pine/PineCompiler.js.map +1 -0
- package/dist/pine/diagnostics.d.ts +20 -0
- package/dist/pine/diagnostics.d.ts.map +1 -0
- package/dist/pine/diagnostics.js +11 -0
- package/dist/pine/diagnostics.js.map +1 -0
- package/{src/pine/index.ts → dist/pine/index.d.ts} +4 -3
- package/dist/pine/index.d.ts.map +1 -0
- package/dist/pine/index.js +5 -0
- package/dist/pine/index.js.map +1 -0
- package/dist/pine/pine-ast.d.ts +142 -0
- package/dist/pine/pine-ast.d.ts.map +1 -0
- package/dist/pine/pine-ast.js +19 -0
- package/dist/pine/pine-ast.js.map +1 -0
- package/dist/pine/pine-lexer.d.ts +41 -0
- package/dist/pine/pine-lexer.d.ts.map +1 -0
- package/dist/pine/pine-lexer.js +249 -0
- package/dist/pine/pine-lexer.js.map +1 -0
- package/dist/pine/pine-parser.d.ts +51 -0
- package/dist/pine/pine-parser.d.ts.map +1 -0
- package/dist/pine/pine-parser.js +416 -0
- package/dist/pine/pine-parser.js.map +1 -0
- package/dist/pine/pine-transpiler.d.ts +33 -0
- package/dist/pine/pine-transpiler.d.ts.map +1 -0
- package/dist/pine/pine-transpiler.js +260 -0
- package/dist/pine/pine-transpiler.js.map +1 -0
- package/dist/pixi/LayerName.d.ts +18 -0
- package/dist/pixi/LayerName.d.ts.map +1 -0
- package/dist/pixi/LayerName.js +35 -0
- package/dist/pixi/LayerName.js.map +1 -0
- package/dist/pixi/PixiCandlestickRenderer.d.ts +23 -0
- package/dist/pixi/PixiCandlestickRenderer.d.ts.map +1 -0
- package/dist/pixi/PixiCandlestickRenderer.js +107 -0
- package/dist/pixi/PixiCandlestickRenderer.js.map +1 -0
- package/dist/pixi/PixiChart.d.ts +72 -0
- package/dist/pixi/PixiChart.d.ts.map +1 -0
- package/dist/pixi/PixiChart.js +367 -0
- package/dist/pixi/PixiChart.js.map +1 -0
- package/dist/pixi/PixiCrosshairRenderer.d.ts +29 -0
- package/dist/pixi/PixiCrosshairRenderer.d.ts.map +1 -0
- package/dist/pixi/PixiCrosshairRenderer.js +110 -0
- package/dist/pixi/PixiCrosshairRenderer.js.map +1 -0
- package/dist/pixi/PixiDrawingRenderer.d.ts +17 -0
- package/dist/pixi/PixiDrawingRenderer.d.ts.map +1 -0
- package/dist/pixi/PixiDrawingRenderer.js +111 -0
- package/dist/pixi/PixiDrawingRenderer.js.map +1 -0
- package/dist/pixi/PixiGridRenderer.d.ts +22 -0
- package/dist/pixi/PixiGridRenderer.d.ts.map +1 -0
- package/dist/pixi/PixiGridRenderer.js +114 -0
- package/dist/pixi/PixiGridRenderer.js.map +1 -0
- package/dist/pixi/PixiLayerManager.d.ts +56 -0
- package/dist/pixi/PixiLayerManager.d.ts.map +1 -0
- package/dist/pixi/PixiLayerManager.js +92 -0
- package/dist/pixi/PixiLayerManager.js.map +1 -0
- package/dist/react/canvas/ChartCanvas.d.ts +85 -0
- package/dist/react/canvas/ChartCanvas.d.ts.map +1 -0
- package/dist/react/canvas/ChartCanvas.js +604 -0
- package/dist/react/canvas/ChartCanvas.js.map +1 -0
- package/dist/react/canvas/ChartContextMenu.d.ts +18 -0
- package/dist/react/canvas/ChartContextMenu.d.ts.map +1 -0
- package/dist/react/canvas/ChartContextMenu.js +5 -0
- package/dist/react/canvas/ChartContextMenu.js.map +1 -0
- package/dist/react/canvas/ChartSettingsDialog.d.ts +25 -0
- package/dist/react/canvas/ChartSettingsDialog.d.ts.map +1 -0
- package/dist/react/canvas/ChartSettingsDialog.js +28 -0
- package/dist/react/canvas/ChartSettingsDialog.js.map +1 -0
- package/dist/react/canvas/IndicatorLabel.d.ts +21 -0
- package/dist/react/canvas/IndicatorLabel.d.ts.map +1 -0
- package/dist/react/canvas/IndicatorLabel.js +196 -0
- package/dist/react/canvas/IndicatorLabel.js.map +1 -0
- package/dist/react/canvas/IndicatorPane.d.ts +32 -0
- package/dist/react/canvas/IndicatorPane.d.ts.map +1 -0
- package/dist/react/canvas/IndicatorPane.js +395 -0
- package/dist/react/canvas/IndicatorPane.js.map +1 -0
- package/dist/react/canvas/PointerOverlay.d.ts +23 -0
- package/dist/react/canvas/PointerOverlay.d.ts.map +1 -0
- package/dist/react/canvas/PointerOverlay.js +61 -0
- package/dist/react/canvas/PointerOverlay.js.map +1 -0
- package/dist/react/canvas/toolbars/LeftToolbar.d.ts +19 -0
- package/dist/react/canvas/toolbars/LeftToolbar.d.ts.map +1 -0
- package/dist/react/canvas/toolbars/LeftToolbar.js +407 -0
- package/dist/react/canvas/toolbars/LeftToolbar.js.map +1 -0
- package/dist/react/hooks/useChartCapabilities.d.ts +21 -0
- package/dist/react/hooks/useChartCapabilities.d.ts.map +1 -0
- package/dist/react/hooks/useChartCapabilities.js +66 -0
- package/dist/react/hooks/useChartCapabilities.js.map +1 -0
- package/dist/react/index.d.ts +30 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +28 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/internal.d.ts +38 -0
- package/dist/react/internal.d.ts.map +1 -0
- package/dist/react/internal.js +44 -0
- package/dist/react/internal.js.map +1 -0
- package/dist/react/shell/ManagedAppShell.d.ts +91 -0
- package/dist/react/shell/ManagedAppShell.d.ts.map +1 -0
- package/dist/react/shell/ManagedAppShell.js +440 -0
- package/dist/react/shell/ManagedAppShell.js.map +1 -0
- package/dist/react/trading/TradingBridge.d.ts +86 -0
- package/dist/react/trading/TradingBridge.d.ts.map +1 -0
- package/dist/react/trading/TradingBridge.js +73 -0
- package/dist/react/trading/TradingBridge.js.map +1 -0
- package/dist/react/workspace/ChartWorkspace.d.ts +73 -0
- package/dist/react/workspace/ChartWorkspace.d.ts.map +1 -0
- package/dist/react/workspace/ChartWorkspace.js +42 -0
- package/dist/react/workspace/ChartWorkspace.js.map +1 -0
- package/dist/react/workspace/FloatingPanel.d.ts +18 -0
- package/dist/react/workspace/FloatingPanel.d.ts.map +1 -0
- package/dist/react/workspace/FloatingPanel.js +82 -0
- package/dist/react/workspace/FloatingPanel.js.map +1 -0
- package/dist/react/workspace/IndicatorsDialog.d.ts +8 -0
- package/dist/react/workspace/IndicatorsDialog.d.ts.map +1 -0
- package/dist/react/workspace/IndicatorsDialog.js +121 -0
- package/dist/react/workspace/IndicatorsDialog.js.map +1 -0
- package/dist/react/workspace/LayoutMenu.d.ts +33 -0
- package/dist/react/workspace/LayoutMenu.d.ts.map +1 -0
- package/dist/react/workspace/LayoutMenu.js +113 -0
- package/dist/react/workspace/LayoutMenu.js.map +1 -0
- package/dist/react/workspace/SymbolSearchDialog.d.ts +10 -0
- package/dist/react/workspace/SymbolSearchDialog.d.ts.map +1 -0
- package/dist/react/workspace/SymbolSearchDialog.js +245 -0
- package/dist/react/workspace/SymbolSearchDialog.js.map +1 -0
- package/dist/react/workspace/TabBar.d.ts +17 -0
- package/dist/react/workspace/TabBar.d.ts.map +1 -0
- package/dist/react/workspace/TabBar.js +29 -0
- package/dist/react/workspace/TabBar.js.map +1 -0
- package/dist/react/workspace/toolbars/BottomToolbar.d.ts +19 -0
- package/dist/react/workspace/toolbars/BottomToolbar.d.ts.map +1 -0
- package/dist/react/workspace/toolbars/BottomToolbar.js +236 -0
- package/dist/react/workspace/toolbars/BottomToolbar.js.map +1 -0
- package/dist/react/workspace/toolbars/RightToolbar.d.ts +8 -0
- package/dist/react/workspace/toolbars/RightToolbar.d.ts.map +1 -0
- package/dist/react/workspace/toolbars/RightToolbar.js +18 -0
- package/dist/react/workspace/toolbars/RightToolbar.js.map +1 -0
- package/dist/react/workspace/toolbars/TopToolbar.d.ts +41 -0
- package/dist/react/workspace/toolbars/TopToolbar.d.ts.map +1 -0
- package/dist/react/workspace/toolbars/TopToolbar.js +82 -0
- package/dist/react/workspace/toolbars/TopToolbar.js.map +1 -0
- package/dist/renderers/CandlestickRenderer.d.ts +13 -0
- package/dist/renderers/CandlestickRenderer.d.ts.map +1 -0
- package/dist/renderers/CandlestickRenderer.js +98 -0
- package/dist/renderers/CandlestickRenderer.js.map +1 -0
- package/dist/renderers/HistogramRenderer.d.ts +11 -0
- package/dist/renderers/HistogramRenderer.d.ts.map +1 -0
- package/dist/renderers/HistogramRenderer.js +50 -0
- package/dist/renderers/HistogramRenderer.js.map +1 -0
- package/dist/renderers/LineRenderer.d.ts +12 -0
- package/dist/renderers/LineRenderer.d.ts.map +1 -0
- package/dist/renderers/LineRenderer.js +64 -0
- package/dist/renderers/LineRenderer.js.map +1 -0
- package/dist/theme/colors.d.ts +4 -0
- package/dist/theme/colors.d.ts.map +1 -0
- package/dist/theme/colors.js +19 -0
- package/dist/theme/colors.js.map +1 -0
- package/dist/tools/barDivergenceCheck.d.ts +120 -0
- package/dist/tools/barDivergenceCheck.d.ts.map +1 -0
- package/dist/tools/barDivergenceCheck.js +200 -0
- package/dist/tools/barDivergenceCheck.js.map +1 -0
- package/dist/trading/TradingOverlayStore.d.ts +86 -0
- package/dist/trading/TradingOverlayStore.d.ts.map +1 -0
- package/dist/trading/TradingOverlayStore.js +139 -0
- package/dist/trading/TradingOverlayStore.js.map +1 -0
- package/dist/trading/UnmanagedIngestion.d.ts +91 -0
- package/dist/trading/UnmanagedIngestion.d.ts.map +1 -0
- package/dist/trading/UnmanagedIngestion.js +114 -0
- package/dist/trading/UnmanagedIngestion.js.map +1 -0
- package/dist/trading/__tests__/ManagedTradingController.test.d.ts +18 -0
- package/dist/trading/__tests__/ManagedTradingController.test.d.ts.map +1 -0
- package/dist/trading/__tests__/ManagedTradingController.test.js +271 -0
- package/dist/trading/__tests__/ManagedTradingController.test.js.map +1 -0
- package/dist/trading/__tests__/TradingOverlayStore.test.d.ts +16 -0
- package/dist/trading/__tests__/TradingOverlayStore.test.d.ts.map +1 -0
- package/dist/trading/__tests__/TradingOverlayStore.test.js +267 -0
- package/dist/trading/__tests__/TradingOverlayStore.test.js.map +1 -0
- package/dist/trading/__tests__/UnmanagedIngestion.test.d.ts +16 -0
- package/dist/trading/__tests__/UnmanagedIngestion.test.d.ts.map +1 -0
- package/dist/trading/__tests__/UnmanagedIngestion.test.js +170 -0
- package/dist/trading/__tests__/UnmanagedIngestion.test.js.map +1 -0
- package/dist/trading/managed/ManagedTradingController.d.ts +110 -0
- package/dist/trading/managed/ManagedTradingController.d.ts.map +1 -0
- package/dist/trading/managed/ManagedTradingController.js +247 -0
- package/dist/trading/managed/ManagedTradingController.js.map +1 -0
- package/dist/trading/managed/managedCapabilities.d.ts +45 -0
- package/dist/trading/managed/managedCapabilities.d.ts.map +1 -0
- package/dist/trading/managed/managedCapabilities.js +79 -0
- package/dist/trading/managed/managedCapabilities.js.map +1 -0
- package/dist/trading/managed/managedTypes.d.ts +122 -0
- package/dist/trading/managed/managedTypes.d.ts.map +1 -0
- package/dist/trading/managed/managedTypes.js +13 -0
- package/dist/trading/managed/managedTypes.js.map +1 -0
- package/dist/trading/tradingTypes.d.ts +89 -0
- package/dist/trading/tradingTypes.d.ts.map +1 -0
- package/dist/trading/tradingTypes.js +8 -0
- package/dist/trading/tradingTypes.js.map +1 -0
- package/dist/tscript/TScriptIndicator.d.ts +41 -0
- package/dist/tscript/TScriptIndicator.d.ts.map +1 -0
- package/dist/tscript/TScriptIndicator.js +47 -0
- package/dist/tscript/TScriptIndicator.js.map +1 -0
- package/dist/tscript/ast.d.ts +89 -0
- package/dist/tscript/ast.d.ts.map +1 -0
- package/dist/tscript/ast.js +22 -0
- package/dist/tscript/ast.js.map +1 -0
- package/dist/tscript/lexer.d.ts +36 -0
- package/dist/tscript/lexer.d.ts.map +1 -0
- package/dist/tscript/lexer.js +187 -0
- package/dist/tscript/lexer.js.map +1 -0
- package/dist/tscript/parser.d.ts +50 -0
- package/dist/tscript/parser.d.ts.map +1 -0
- package/dist/tscript/parser.js +318 -0
- package/dist/tscript/parser.js.map +1 -0
- package/dist/tscript/runtime.d.ts +123 -0
- package/dist/tscript/runtime.d.ts.map +1 -0
- package/dist/tscript/runtime.js +475 -0
- package/dist/tscript/runtime.js.map +1 -0
- package/dist/tscript/series.d.ts +49 -0
- package/dist/tscript/series.d.ts.map +1 -0
- package/dist/tscript/series.js +79 -0
- package/dist/tscript/series.js.map +1 -0
- package/dist/types/IChart.d.ts +48 -0
- package/dist/types/IChart.d.ts.map +1 -0
- package/dist/types/IChart.js +2 -0
- package/dist/types/IChart.js.map +1 -0
- package/{src/types/IRenderer.ts → dist/types/IRenderer.d.ts} +2 -8
- package/dist/types/IRenderer.d.ts.map +1 -0
- package/dist/types/IRenderer.js +2 -0
- package/dist/types/IRenderer.js.map +1 -0
- package/dist/types/ISeries.d.ts +26 -0
- package/dist/types/ISeries.d.ts.map +1 -0
- package/dist/types/ISeries.js +2 -0
- package/dist/types/ISeries.js.map +1 -0
- package/package.json +32 -4
- package/src/__tests__/backwardCompatibility.test.ts +0 -191
- package/src/__tests__/candleInvariant.test.ts +0 -500
- package/src/__tests__/timeframeBoundary.test.ts +0 -583
- package/src/api/DrawingManager.ts +0 -188
- package/src/api/EventBus.ts +0 -53
- package/src/api/IndicatorDAG.ts +0 -389
- package/src/api/IndicatorRegistry.ts +0 -47
- package/src/api/LayoutManager.ts +0 -72
- package/src/api/PaneManager.ts +0 -129
- package/src/api/ReferenceAPI.ts +0 -195
- package/src/api/TChart.ts +0 -881
- package/src/api/drawing tools/fib gann menu/fibRetracement.ts +0 -27
- package/src/api/drawing tools/lines menu/crossLine.ts +0 -21
- package/src/api/drawing tools/lines menu/disjointChannel.ts +0 -74
- package/src/api/drawing tools/lines menu/extendedLine.ts +0 -22
- package/src/api/drawing tools/lines menu/flatTopBottom.ts +0 -45
- package/src/api/drawing tools/lines menu/horizontal.ts +0 -24
- package/src/api/drawing tools/lines menu/horizontalRay.ts +0 -25
- package/src/api/drawing tools/lines menu/infoLine.ts +0 -127
- package/src/api/drawing tools/lines menu/insidePitchfork.ts +0 -21
- package/src/api/drawing tools/lines menu/modifiedSchiffPitchfork.ts +0 -18
- package/src/api/drawing tools/lines menu/parallelChannel.ts +0 -47
- package/src/api/drawing tools/lines menu/pitchfork.ts +0 -15
- package/src/api/drawing tools/lines menu/ray.ts +0 -28
- package/src/api/drawing tools/lines menu/regressionTrend.ts +0 -157
- package/src/api/drawing tools/lines menu/schiffPitchfork.ts +0 -18
- package/src/api/drawing tools/lines menu/trendAngle.ts +0 -64
- package/src/api/drawing tools/lines menu/trendline.ts +0 -16
- package/src/api/drawing tools/lines menu/vertical.ts +0 -16
- package/src/api/drawing tools/shapes menu/rectangle.ts +0 -24
- package/src/api/drawing tools/shapes menu/text.ts +0 -30
- package/src/api/drawingUtils.ts +0 -82
- package/src/core/CanvasLayer.ts +0 -77
- package/src/core/Chart.ts +0 -917
- package/src/core/CoordTransform.ts +0 -282
- package/src/core/Crosshair.ts +0 -207
- package/src/core/IndicatorEngine.ts +0 -216
- package/src/core/InteractionManager.ts +0 -899
- package/src/core/PriceScale.ts +0 -133
- package/src/core/Series.ts +0 -132
- package/src/core/TimeScale.ts +0 -175
- package/src/datafeed/DatafeedConnector.ts +0 -300
- package/src/engine/CandleEngine.ts +0 -458
- package/src/engine/__tests__/CandleEngine.test.ts +0 -402
- package/src/engine/candleInvariants.ts +0 -172
- package/src/index.ts +0 -190
- package/src/licensing/ChartRuntimeResolver.ts +0 -380
- package/src/licensing/LicenseManager.ts +0 -131
- package/src/licensing/__tests__/ChartRuntimeResolver.test.ts +0 -207
- package/src/licensing/__tests__/LicenseManager.test.ts +0 -180
- package/src/licensing/licenseTypes.ts +0 -19
- package/src/pine/PineCompiler.ts +0 -68
- package/src/pine/diagnostics.ts +0 -30
- package/src/pine/pine-ast.ts +0 -163
- package/src/pine/pine-lexer.ts +0 -265
- package/src/pine/pine-parser.ts +0 -439
- package/src/pine/pine-transpiler.ts +0 -301
- package/src/pixi/LayerName.ts +0 -35
- package/src/pixi/PixiCandlestickRenderer.ts +0 -125
- package/src/pixi/PixiChart.ts +0 -425
- package/src/pixi/PixiCrosshairRenderer.ts +0 -134
- package/src/pixi/PixiDrawingRenderer.ts +0 -121
- package/src/pixi/PixiGridRenderer.ts +0 -136
- package/src/pixi/PixiLayerManager.ts +0 -102
- package/src/renderers/CandlestickRenderer.ts +0 -130
- package/src/renderers/HistogramRenderer.ts +0 -63
- package/src/renderers/LineRenderer.ts +0 -77
- package/src/theme/colors.ts +0 -21
- package/src/tools/barDivergenceCheck.ts +0 -305
- package/src/trading/TradingOverlayStore.ts +0 -161
- package/src/trading/UnmanagedIngestion.ts +0 -156
- package/src/trading/__tests__/ManagedTradingController.test.ts +0 -338
- package/src/trading/__tests__/TradingOverlayStore.test.ts +0 -323
- package/src/trading/__tests__/UnmanagedIngestion.test.ts +0 -205
- package/src/trading/managed/ManagedTradingController.ts +0 -292
- package/src/trading/managed/managedCapabilities.ts +0 -98
- package/src/trading/managed/managedTypes.ts +0 -151
- package/src/trading/tradingTypes.ts +0 -135
- package/src/tscript/TScriptIndicator.ts +0 -54
- package/src/tscript/ast.ts +0 -105
- package/src/tscript/lexer.ts +0 -190
- package/src/tscript/parser.ts +0 -334
- package/src/tscript/runtime.ts +0 -525
- package/src/tscript/series.ts +0 -84
- package/src/types/IChart.ts +0 -56
- package/src/types/ISeries.ts +0 -30
- package/tsconfig.json +0 -22
- package/tsup.config.ts +0 -15
- package/vitest.config.ts +0 -25
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import type { LicenseFeatures, LicenseMode, LicensePayload } from './licenseTypes';
|
|
2
|
-
|
|
3
|
-
const DEFAULT_MODE: LicenseMode = 'unmanaged';
|
|
4
|
-
const DEFAULT_FEATURES: LicenseFeatures = {};
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* LicenseManager — single source of truth for chart mode and feature access.
|
|
8
|
-
*
|
|
9
|
-
* Usage:
|
|
10
|
-
* const lm = LicenseManager.getInstance();
|
|
11
|
-
* await lm.validateLicense('my-key');
|
|
12
|
-
* lm.getMode(); // 'managed' | 'unmanaged'
|
|
13
|
-
* lm.hasFeature('orderEntry');
|
|
14
|
-
*/
|
|
15
|
-
export class LicenseManager {
|
|
16
|
-
private static instance: LicenseManager | null = null;
|
|
17
|
-
|
|
18
|
-
private payload: LicensePayload | null = null;
|
|
19
|
-
private readonly subscribers: Set<() => void> = new Set();
|
|
20
|
-
|
|
21
|
-
private constructor() {}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Subscribe to license state changes (loadLicense, validateLicense, clear).
|
|
25
|
-
* Returns an unsubscribe function — call it to stop receiving notifications.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* const unsub = LicenseManager.getInstance().subscribe(() => {
|
|
29
|
-
* console.log('license changed', lm.getMode());
|
|
30
|
-
* });
|
|
31
|
-
* // later:
|
|
32
|
-
* unsub();
|
|
33
|
-
*/
|
|
34
|
-
subscribe(cb: () => void): () => void {
|
|
35
|
-
this.subscribers.add(cb);
|
|
36
|
-
return () => this.subscribers.delete(cb);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
private notify(): void {
|
|
40
|
-
this.subscribers.forEach((cb) => {
|
|
41
|
-
try { cb(); } catch { /* subscriber errors must not affect license state */ }
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
static getInstance(): LicenseManager {
|
|
46
|
-
if (!LicenseManager.instance) {
|
|
47
|
-
LicenseManager.instance = new LicenseManager();
|
|
48
|
-
}
|
|
49
|
-
return LicenseManager.instance;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Validate a license key against the licensing endpoint.
|
|
54
|
-
*
|
|
55
|
-
* @param key The raw license key entered by the user.
|
|
56
|
-
* @param verifyUrl Full URL of the forgecharts-admin verify endpoint,
|
|
57
|
-
* e.g. "http://licenses.example.com:4100/api/public/license/verify"
|
|
58
|
-
*/
|
|
59
|
-
async validateLicense(key: string, verifyUrl: string): Promise<LicensePayload> {
|
|
60
|
-
if (!key || !key.trim()) {
|
|
61
|
-
throw new Error('LicenseManager: license key must not be empty');
|
|
62
|
-
}
|
|
63
|
-
if (!verifyUrl) {
|
|
64
|
-
throw new Error('LicenseManager: verifyUrl is required');
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const res = await fetch(verifyUrl, {
|
|
68
|
-
method: 'POST',
|
|
69
|
-
headers: { 'Content-Type': 'application/json' },
|
|
70
|
-
body: JSON.stringify({ licenseKey: key.trim().toUpperCase() }),
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
if (!res.ok) {
|
|
74
|
-
throw new Error(`License server error: ${res.status} ${res.statusText}`);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const data = await res.json() as { valid: boolean; reason?: string; licenseKey?: string; mode?: string; plan?: string; expiresAt?: string | null; features?: Record<string, boolean> };
|
|
78
|
-
|
|
79
|
-
if (!data.valid) {
|
|
80
|
-
throw new Error(data.reason ?? 'License invalid');
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const payload: LicensePayload = {
|
|
84
|
-
licenseKey: data.licenseKey ?? key.trim().toUpperCase(),
|
|
85
|
-
mode: (data.mode ?? 'unmanaged') as LicensePayload['mode'],
|
|
86
|
-
...(data.plan != null && { plan: data.plan }),
|
|
87
|
-
...(data.expiresAt != null && { expires: data.expiresAt }),
|
|
88
|
-
...(data.features != null && { features: data.features as LicenseFeatures }),
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
this.payload = payload;
|
|
92
|
-
this.notify();
|
|
93
|
-
return payload;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/** Load a pre-validated payload (e.g. from cache / localStorage). */
|
|
97
|
-
loadLicense(payload: LicensePayload): void {
|
|
98
|
-
this.payload = payload;
|
|
99
|
-
this.notify();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/** Return the currently loaded payload, or null if none. */
|
|
103
|
-
getLicense(): LicensePayload | null {
|
|
104
|
-
return this.payload;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* The chart mode driven by the active license.
|
|
109
|
-
* Defaults to 'unmanaged' so no managed features appear without a valid
|
|
110
|
-
* managed license.
|
|
111
|
-
*/
|
|
112
|
-
getMode(): LicenseMode {
|
|
113
|
-
return this.payload?.mode ?? DEFAULT_MODE;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/** Return the feature flags for the active license. */
|
|
117
|
-
getFeatures(): LicenseFeatures {
|
|
118
|
-
return this.payload?.features ?? DEFAULT_FEATURES;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/** Check whether a specific feature is enabled on the active license. */
|
|
122
|
-
hasFeature(name: keyof LicenseFeatures): boolean {
|
|
123
|
-
return this.getFeatures()[name] === true;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/** Clear the current license state (returns to safe unmanaged defaults). */
|
|
127
|
-
clear(): void {
|
|
128
|
-
this.payload = null;
|
|
129
|
-
this.notify();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ChartRuntimeResolver — unit tests
|
|
3
|
-
*
|
|
4
|
-
* Covers:
|
|
5
|
-
* - No license → unmanaged, all managed UI hidden, overlays/indicators/drawings visible
|
|
6
|
-
* - Unmanaged license → same as no license for UI gating
|
|
7
|
-
* - Managed license → all managed UI visible, external ingestion blocked
|
|
8
|
-
* - Feature flags override defaults within a mode
|
|
9
|
-
* - getCapabilities() snapshot is consistent with individual methods
|
|
10
|
-
* - Module-level convenience functions alias correctly
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { describe, it, expect, beforeEach } from 'vitest';
|
|
14
|
-
import { LicenseManager } from '../LicenseManager';
|
|
15
|
-
import { ChartRuntimeResolver } from '../ChartRuntimeResolver';
|
|
16
|
-
import type { LicensePayload } from '../licenseTypes';
|
|
17
|
-
|
|
18
|
-
function setLicense(payload: LicensePayload | null) {
|
|
19
|
-
const lm = LicenseManager.getInstance();
|
|
20
|
-
if (payload === null) { lm.clear(); } else { lm.loadLicense(payload); }
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const UNMANAGED_PAYLOAD: LicensePayload = { licenseKey: 'u1', mode: 'unmanaged' };
|
|
24
|
-
const MANAGED_PAYLOAD: LicensePayload = { licenseKey: 'm1', mode: 'managed' };
|
|
25
|
-
|
|
26
|
-
describe('ChartRuntimeResolver — no license (safe defaults)', () => {
|
|
27
|
-
beforeEach(() => setLicense(null));
|
|
28
|
-
|
|
29
|
-
it('isUnmanagedMode() is true', () => {
|
|
30
|
-
expect(ChartRuntimeResolver.getInstance().isUnmanagedMode()).toBe(true);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('isManagedMode() is false', () => {
|
|
34
|
-
expect(ChartRuntimeResolver.getInstance().isManagedMode()).toBe(false);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('managed UI render flags are all false', () => {
|
|
38
|
-
const r = ChartRuntimeResolver.getInstance();
|
|
39
|
-
expect(r.canRenderOrderEntry()).toBe(false);
|
|
40
|
-
expect(r.canRenderBuySellButtons()).toBe(false);
|
|
41
|
-
expect(r.canRenderOrderTicket()).toBe(false);
|
|
42
|
-
expect(r.canRenderBracketControls()).toBe(false);
|
|
43
|
-
expect(r.canRenderOrderModificationControls()).toBe(false);
|
|
44
|
-
expect(r.canRenderManagedTradingControls()).toBe(false);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('canRenderExternalOverlayOnlyMode() is true', () => {
|
|
48
|
-
expect(ChartRuntimeResolver.getInstance().canRenderExternalOverlayOnlyMode()).toBe(true);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('always-on render flags remain true', () => {
|
|
52
|
-
const r = ChartRuntimeResolver.getInstance();
|
|
53
|
-
expect(r.canRenderCandles()).toBe(true);
|
|
54
|
-
expect(r.canRenderIndicators()).toBe(true);
|
|
55
|
-
expect(r.canRenderDrawings()).toBe(true);
|
|
56
|
-
expect(r.canRenderPositions()).toBe(true);
|
|
57
|
-
expect(r.canRenderFills()).toBe(true);
|
|
58
|
-
expect(r.canRenderOverlays()).toBe(true);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('external ingestion is allowed in unmanaged mode', () => {
|
|
62
|
-
expect(ChartRuntimeResolver.getInstance().canUseExternalIngestion()).toBe(true);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
describe('ChartRuntimeResolver — explicit unmanaged license', () => {
|
|
67
|
-
beforeEach(() => setLicense(UNMANAGED_PAYLOAD));
|
|
68
|
-
|
|
69
|
-
it('matches the no-license behaviour for all managed flags', () => {
|
|
70
|
-
const r = ChartRuntimeResolver.getInstance();
|
|
71
|
-
expect(r.canRenderOrderEntry()).toBe(false);
|
|
72
|
-
expect(r.canRenderManagedTradingControls()).toBe(false);
|
|
73
|
-
expect(r.canRenderExternalOverlayOnlyMode()).toBe(true);
|
|
74
|
-
expect(r.canRenderCandles()).toBe(true);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
describe('ChartRuntimeResolver — managed license (full features)', () => {
|
|
79
|
-
beforeEach(() => setLicense(MANAGED_PAYLOAD));
|
|
80
|
-
|
|
81
|
-
it('isManagedMode() is true', () => {
|
|
82
|
-
expect(ChartRuntimeResolver.getInstance().isManagedMode()).toBe(true);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('external ingestion is blocked in managed mode', () => {
|
|
86
|
-
expect(ChartRuntimeResolver.getInstance().canUseExternalIngestion()).toBe(false);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('managed UI render flags are all true (no feature restrictions)', () => {
|
|
90
|
-
const r = ChartRuntimeResolver.getInstance();
|
|
91
|
-
expect(r.canRenderOrderEntry()).toBe(true);
|
|
92
|
-
expect(r.canRenderBuySellButtons()).toBe(true);
|
|
93
|
-
expect(r.canRenderOrderTicket()).toBe(true);
|
|
94
|
-
expect(r.canRenderBracketControls()).toBe(true);
|
|
95
|
-
expect(r.canRenderOrderModificationControls()).toBe(true);
|
|
96
|
-
expect(r.canRenderManagedTradingControls()).toBe(true);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('canRenderExternalOverlayOnlyMode() is false', () => {
|
|
100
|
-
expect(ChartRuntimeResolver.getInstance().canRenderExternalOverlayOnlyMode()).toBe(false);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it('always-on flags still true in managed mode', () => {
|
|
104
|
-
const r = ChartRuntimeResolver.getInstance();
|
|
105
|
-
expect(r.canRenderCandles()).toBe(true);
|
|
106
|
-
expect(r.canRenderPositions()).toBe(true);
|
|
107
|
-
expect(r.canRenderFills()).toBe(true);
|
|
108
|
-
expect(r.canRenderDrawings()).toBe(true);
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
describe('ChartRuntimeResolver — feature flags restrict managed capabilities', () => {
|
|
113
|
-
it('orderEntry: false disables order entry render flags', () => {
|
|
114
|
-
setLicense({ licenseKey: 'mf', mode: 'managed', features: { orderEntry: false } });
|
|
115
|
-
const r = ChartRuntimeResolver.getInstance();
|
|
116
|
-
expect(r.canRenderOrderEntry()).toBe(false);
|
|
117
|
-
expect(r.canRenderBuySellButtons()).toBe(false);
|
|
118
|
-
expect(r.canRenderOrderTicket()).toBe(false);
|
|
119
|
-
// bracket/drag also depend on order entry
|
|
120
|
-
expect(r.canRenderBracketControls()).toBe(false);
|
|
121
|
-
expect(r.canRenderOrderModificationControls()).toBe(false);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it('bracketOrders: false hides bracket controls but not basic order entry', () => {
|
|
125
|
-
setLicense({
|
|
126
|
-
licenseKey: 'mb',
|
|
127
|
-
mode: 'managed',
|
|
128
|
-
features: { orderEntry: true, bracketOrders: false },
|
|
129
|
-
});
|
|
130
|
-
const r = ChartRuntimeResolver.getInstance();
|
|
131
|
-
expect(r.canRenderOrderEntry()).toBe(true);
|
|
132
|
-
expect(r.canRenderBracketControls()).toBe(false);
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it('draggableOrders: false hides modification controls', () => {
|
|
136
|
-
setLicense({
|
|
137
|
-
licenseKey: 'md',
|
|
138
|
-
mode: 'managed',
|
|
139
|
-
features: { orderEntry: true, draggableOrders: false },
|
|
140
|
-
});
|
|
141
|
-
const r = ChartRuntimeResolver.getInstance();
|
|
142
|
-
expect(r.canRenderOrderEntry()).toBe(true);
|
|
143
|
-
expect(r.canRenderOrderModificationControls()).toBe(false);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
it('indicators: false disables indicator rendering in both modes', () => {
|
|
147
|
-
setLicense({ licenseKey: 'ui', mode: 'unmanaged', features: { indicators: false } });
|
|
148
|
-
expect(ChartRuntimeResolver.getInstance().canRenderIndicators()).toBe(false);
|
|
149
|
-
|
|
150
|
-
setLicense({ licenseKey: 'mi', mode: 'managed', features: { indicators: false } });
|
|
151
|
-
expect(ChartRuntimeResolver.getInstance().canRenderIndicators()).toBe(false);
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
describe('ChartRuntimeResolver — getCapabilities() snapshot', () => {
|
|
156
|
-
it('snapshot is consistent with individual method values (unmanaged)', () => {
|
|
157
|
-
setLicense(UNMANAGED_PAYLOAD);
|
|
158
|
-
const r = ChartRuntimeResolver.getInstance();
|
|
159
|
-
const caps = r.getCapabilities();
|
|
160
|
-
|
|
161
|
-
expect(caps.mode).toBe('unmanaged');
|
|
162
|
-
expect(caps.renderOrderEntry).toBe(r.canRenderOrderEntry());
|
|
163
|
-
expect(caps.renderBuySellButtons).toBe(r.canRenderBuySellButtons());
|
|
164
|
-
expect(caps.renderBracketControls).toBe(r.canRenderBracketControls());
|
|
165
|
-
expect(caps.renderManagedTradingControls).toBe(r.canRenderManagedTradingControls());
|
|
166
|
-
expect(caps.renderExternalOverlayOnly).toBe(r.canRenderExternalOverlayOnlyMode());
|
|
167
|
-
expect(caps.renderCandles).toBe(true);
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
it('snapshot is consistent with individual method values (managed)', () => {
|
|
171
|
-
setLicense(MANAGED_PAYLOAD);
|
|
172
|
-
const r = ChartRuntimeResolver.getInstance();
|
|
173
|
-
const caps = r.getCapabilities();
|
|
174
|
-
|
|
175
|
-
expect(caps.mode).toBe('managed');
|
|
176
|
-
expect(caps.renderOrderEntry).toBe(r.canRenderOrderEntry());
|
|
177
|
-
expect(caps.renderBracketControls).toBe(r.canRenderBracketControls());
|
|
178
|
-
expect(caps.renderExternalOverlayOnly).toBe(false);
|
|
179
|
-
expect(caps.renderCandles).toBe(true);
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
describe('ChartRuntimeResolver — module-level convenience exports', () => {
|
|
184
|
-
it('module-level functions reflect the singleton state', async () => {
|
|
185
|
-
const {
|
|
186
|
-
isManagedMode, isUnmanagedMode,
|
|
187
|
-
canRenderOrderEntry, canRenderManagedTradingControls,
|
|
188
|
-
canRenderExternalOverlayOnlyMode, canRenderCandles,
|
|
189
|
-
getCapabilities,
|
|
190
|
-
} = await import('../ChartRuntimeResolver');
|
|
191
|
-
|
|
192
|
-
setLicense(null);
|
|
193
|
-
expect(isUnmanagedMode()).toBe(true);
|
|
194
|
-
expect(isManagedMode()).toBe(false);
|
|
195
|
-
expect(canRenderOrderEntry()).toBe(false);
|
|
196
|
-
expect(canRenderManagedTradingControls()).toBe(false);
|
|
197
|
-
expect(canRenderExternalOverlayOnlyMode()).toBe(true);
|
|
198
|
-
expect(canRenderCandles()).toBe(true);
|
|
199
|
-
expect(getCapabilities().mode).toBe('unmanaged');
|
|
200
|
-
|
|
201
|
-
setLicense(MANAGED_PAYLOAD);
|
|
202
|
-
expect(isManagedMode()).toBe(true);
|
|
203
|
-
expect(canRenderOrderEntry()).toBe(true);
|
|
204
|
-
expect(canRenderManagedTradingControls()).toBe(true);
|
|
205
|
-
expect(canRenderExternalOverlayOnlyMode()).toBe(false);
|
|
206
|
-
});
|
|
207
|
-
});
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LicenseManager — unit tests
|
|
3
|
-
*
|
|
4
|
-
* Covers:
|
|
5
|
-
* - Default mode is 'unmanaged' with no license installed
|
|
6
|
-
* - loadLicense drives mode and features correctly
|
|
7
|
-
* - validateLicense resolves a payload (placeholder logic)
|
|
8
|
-
* - clear() resets to safe unmanaged defaults
|
|
9
|
-
* - subscribe/unsubscribe fires on every mutation
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
13
|
-
import { LicenseManager } from '../LicenseManager';
|
|
14
|
-
import type { LicensePayload } from '../licenseTypes';
|
|
15
|
-
|
|
16
|
-
const FAKE_URL = 'http://localhost:4100/api/public/license/verify';
|
|
17
|
-
|
|
18
|
-
// Stub fetch so validateLicense tests don't need a real server
|
|
19
|
-
function stubFetch(response: object): void {
|
|
20
|
-
vi.stubGlobal('fetch', vi.fn().mockResolvedValue({
|
|
21
|
-
ok: true,
|
|
22
|
-
json: async () => response,
|
|
23
|
-
}));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Always work with a fresh singleton state between tests
|
|
27
|
-
function reset() {
|
|
28
|
-
LicenseManager.getInstance().clear();
|
|
29
|
-
vi.unstubAllGlobals();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
describe('LicenseManager — defaults', () => {
|
|
33
|
-
beforeEach(reset);
|
|
34
|
-
|
|
35
|
-
it('default mode is unmanaged when no license installed', () => {
|
|
36
|
-
expect(LicenseManager.getInstance().getMode()).toBe('unmanaged');
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('getLicense() returns null before any license is loaded', () => {
|
|
40
|
-
expect(LicenseManager.getInstance().getLicense()).toBeNull();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('getFeatures() returns an empty object by default', () => {
|
|
44
|
-
expect(LicenseManager.getInstance().getFeatures()).toEqual({});
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('hasFeature() returns false for any key when no license', () => {
|
|
48
|
-
const lm = LicenseManager.getInstance();
|
|
49
|
-
expect(lm.hasFeature('orderEntry')).toBe(false);
|
|
50
|
-
expect(lm.hasFeature('bracketOrders')).toBe(false);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
describe('LicenseManager — loadLicense', () => {
|
|
55
|
-
beforeEach(reset);
|
|
56
|
-
|
|
57
|
-
it('sets mode to managed when payload.mode is managed', () => {
|
|
58
|
-
const lm = LicenseManager.getInstance();
|
|
59
|
-
const payload: LicensePayload = { licenseKey: 'k1', mode: 'managed' };
|
|
60
|
-
lm.loadLicense(payload);
|
|
61
|
-
expect(lm.getMode()).toBe('managed');
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('sets mode to unmanaged when payload.mode is unmanaged', () => {
|
|
65
|
-
const lm = LicenseManager.getInstance();
|
|
66
|
-
const payload: LicensePayload = { licenseKey: 'k2', mode: 'unmanaged' };
|
|
67
|
-
lm.loadLicense(payload);
|
|
68
|
-
expect(lm.getMode()).toBe('unmanaged');
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('exposes feature flags from the payload', () => {
|
|
72
|
-
const lm = LicenseManager.getInstance();
|
|
73
|
-
lm.loadLicense({
|
|
74
|
-
licenseKey: 'k3',
|
|
75
|
-
mode: 'managed',
|
|
76
|
-
features: { orderEntry: true, bracketOrders: true, draggableOrders: false },
|
|
77
|
-
});
|
|
78
|
-
expect(lm.hasFeature('orderEntry')).toBe(true);
|
|
79
|
-
expect(lm.hasFeature('bracketOrders')).toBe(true);
|
|
80
|
-
expect(lm.hasFeature('draggableOrders')).toBe(false);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('getLicense() returns the loaded payload', () => {
|
|
84
|
-
const lm = LicenseManager.getInstance();
|
|
85
|
-
const payload: LicensePayload = { licenseKey: 'k4', mode: 'managed' };
|
|
86
|
-
lm.loadLicense(payload);
|
|
87
|
-
expect(lm.getLicense()).toEqual(payload);
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
describe('LicenseManager — validateLicense', () => {
|
|
92
|
-
beforeEach(reset);
|
|
93
|
-
|
|
94
|
-
it('resolves a LicensePayload for a non-empty key', async () => {
|
|
95
|
-
stubFetch({ valid: true, licenseKey: 'TEST-KEY-XYZ', mode: 'unmanaged', plan: 'default', expiresAt: null, features: {} });
|
|
96
|
-
const lm = LicenseManager.getInstance();
|
|
97
|
-
const payload = await lm.validateLicense('test-key-xyz', FAKE_URL);
|
|
98
|
-
expect(payload).toHaveProperty('licenseKey');
|
|
99
|
-
expect(payload).toHaveProperty('mode');
|
|
100
|
-
expect(lm.getLicense()).not.toBeNull();
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it('rejects when the key is empty', async () => {
|
|
104
|
-
const lm = LicenseManager.getInstance();
|
|
105
|
-
await expect(lm.validateLicense('', FAKE_URL)).rejects.toThrow();
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('rejects when the key is whitespace-only', async () => {
|
|
109
|
-
const lm = LicenseManager.getInstance();
|
|
110
|
-
await expect(lm.validateLicense(' ', FAKE_URL)).rejects.toThrow();
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
describe('LicenseManager — clear', () => {
|
|
115
|
-
beforeEach(reset);
|
|
116
|
-
|
|
117
|
-
it('resets mode to unmanaged after a managed license', () => {
|
|
118
|
-
const lm = LicenseManager.getInstance();
|
|
119
|
-
lm.loadLicense({ licenseKey: 'k', mode: 'managed' });
|
|
120
|
-
expect(lm.getMode()).toBe('managed');
|
|
121
|
-
lm.clear();
|
|
122
|
-
expect(lm.getMode()).toBe('unmanaged');
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it('nulls out getLicense() after clear', () => {
|
|
126
|
-
const lm = LicenseManager.getInstance();
|
|
127
|
-
lm.loadLicense({ licenseKey: 'k', mode: 'managed' });
|
|
128
|
-
lm.clear();
|
|
129
|
-
expect(lm.getLicense()).toBeNull();
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
describe('LicenseManager — subscribe / notify', () => {
|
|
134
|
-
beforeEach(reset);
|
|
135
|
-
|
|
136
|
-
it('subscriber is called when loadLicense is invoked', () => {
|
|
137
|
-
const lm = LicenseManager.getInstance();
|
|
138
|
-
const spy = vi.fn();
|
|
139
|
-
lm.subscribe(spy);
|
|
140
|
-
lm.loadLicense({ licenseKey: 'k', mode: 'unmanaged' });
|
|
141
|
-
expect(spy).toHaveBeenCalledTimes(1);
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
it('subscriber is called when clear() is invoked', () => {
|
|
145
|
-
const lm = LicenseManager.getInstance();
|
|
146
|
-
const spy = vi.fn();
|
|
147
|
-
lm.subscribe(spy);
|
|
148
|
-
lm.clear();
|
|
149
|
-
expect(spy).toHaveBeenCalledTimes(1);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it('subscriber is called when validateLicense resolves', async () => {
|
|
153
|
-
stubFetch({ valid: true, licenseKey: 'KEY', mode: 'unmanaged', plan: 'default', expiresAt: null, features: {} });
|
|
154
|
-
const lm = LicenseManager.getInstance();
|
|
155
|
-
const spy = vi.fn();
|
|
156
|
-
lm.subscribe(spy);
|
|
157
|
-
await lm.validateLicense('key', FAKE_URL);
|
|
158
|
-
expect(spy).toHaveBeenCalledTimes(1);
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it('unsubscribe stops future notifications', () => {
|
|
162
|
-
const lm = LicenseManager.getInstance();
|
|
163
|
-
const spy = vi.fn();
|
|
164
|
-
const unsub = lm.subscribe(spy);
|
|
165
|
-
unsub();
|
|
166
|
-
lm.loadLicense({ licenseKey: 'k', mode: 'unmanaged' });
|
|
167
|
-
expect(spy).not.toHaveBeenCalled();
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
it('multiple subscribers each fire independently', () => {
|
|
171
|
-
const lm = LicenseManager.getInstance();
|
|
172
|
-
const spyA = vi.fn();
|
|
173
|
-
const spyB = vi.fn();
|
|
174
|
-
lm.subscribe(spyA);
|
|
175
|
-
lm.subscribe(spyB);
|
|
176
|
-
lm.loadLicense({ licenseKey: 'k', mode: 'unmanaged' });
|
|
177
|
-
expect(spyA).toHaveBeenCalledTimes(1);
|
|
178
|
-
expect(spyB).toHaveBeenCalledTimes(1);
|
|
179
|
-
});
|
|
180
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export type LicenseMode = 'managed' | 'unmanaged';
|
|
2
|
-
|
|
3
|
-
export interface LicenseFeatures {
|
|
4
|
-
orderEntry?: boolean;
|
|
5
|
-
overlays?: boolean;
|
|
6
|
-
indicators?: boolean;
|
|
7
|
-
managedTrading?: boolean;
|
|
8
|
-
unmanagedIngestion?: boolean;
|
|
9
|
-
draggableOrders?: boolean;
|
|
10
|
-
bracketOrders?: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface LicensePayload {
|
|
14
|
-
licenseKey: string;
|
|
15
|
-
mode: LicenseMode;
|
|
16
|
-
plan?: string;
|
|
17
|
-
expires?: string;
|
|
18
|
-
features?: LicenseFeatures;
|
|
19
|
-
}
|
package/src/pine/PineCompiler.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PineCompiler — public entry point for the Pine Script compatibility layer.
|
|
3
|
-
*
|
|
4
|
-
* Pipeline:
|
|
5
|
-
* Pine source → PineLexer → PineToken[] → PineParser → PineProgram
|
|
6
|
-
* → PineTranspiler → TScript source → TScriptIndicator runtime
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { PineParser } from './pine-parser';
|
|
10
|
-
import { PineTranspiler } from './pine-transpiler';
|
|
11
|
-
import { DiagnosticBag } from './diagnostics';
|
|
12
|
-
import type { Diagnostic } from './diagnostics';
|
|
13
|
-
import { TScriptIndicator } from '../tscript/TScriptIndicator';
|
|
14
|
-
import type { OHLCV } from '@forgecharts/types';
|
|
15
|
-
import type { IndicatorPoint } from '../core/IndicatorEngine';
|
|
16
|
-
|
|
17
|
-
export type { Diagnostic };
|
|
18
|
-
export type { DiagnosticSeverity } from './diagnostics';
|
|
19
|
-
|
|
20
|
-
export interface PineCompileResult {
|
|
21
|
-
/** The transpiled TScript source string. */
|
|
22
|
-
readonly tscript: string;
|
|
23
|
-
readonly diagnostics: readonly Diagnostic[];
|
|
24
|
-
/** `true` when there are no error-severity diagnostics. */
|
|
25
|
-
readonly ok: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export class PineCompiler {
|
|
29
|
-
/**
|
|
30
|
-
* Compile Pine Script source to TScript.
|
|
31
|
-
* Parse errors throw a `SyntaxError`; semantic problems populate diagnostics.
|
|
32
|
-
*/
|
|
33
|
-
compile(pineSource: string): PineCompileResult {
|
|
34
|
-
const diag = new DiagnosticBag();
|
|
35
|
-
|
|
36
|
-
const parser = new PineParser(pineSource);
|
|
37
|
-
const program = parser.parse();
|
|
38
|
-
|
|
39
|
-
const transpiler = new PineTranspiler(diag);
|
|
40
|
-
const tscript = transpiler.transpile(program);
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
tscript,
|
|
44
|
-
diagnostics: diag.diagnostics,
|
|
45
|
-
ok: !diag.hasErrors(),
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Convenience: compile + run against a bar series.
|
|
51
|
-
* Returns the plot outputs and any diagnostics.
|
|
52
|
-
*/
|
|
53
|
-
static run(
|
|
54
|
-
pineSource: string,
|
|
55
|
-
bars: readonly OHLCV[],
|
|
56
|
-
): { plots: IndicatorPoint[][]; diagnostics: readonly Diagnostic[] } {
|
|
57
|
-
const compiler = new PineCompiler();
|
|
58
|
-
const result = compiler.compile(pineSource);
|
|
59
|
-
|
|
60
|
-
if (!result.ok) {
|
|
61
|
-
return { plots: [], diagnostics: result.diagnostics };
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const indicator = new TScriptIndicator(result.tscript);
|
|
65
|
-
const plots = indicator.run(bars);
|
|
66
|
-
return { plots, diagnostics: result.diagnostics };
|
|
67
|
-
}
|
|
68
|
-
}
|
package/src/pine/diagnostics.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/** Diagnostic emitted by the Pine compiler pipeline. */
|
|
2
|
-
export type DiagnosticSeverity = 'error' | 'warning' | 'info';
|
|
3
|
-
|
|
4
|
-
export interface Diagnostic {
|
|
5
|
-
readonly severity: DiagnosticSeverity;
|
|
6
|
-
readonly message: string;
|
|
7
|
-
readonly line: number;
|
|
8
|
-
readonly col: number;
|
|
9
|
-
/** Machine-readable code, e.g. 'PINE_UNSUPPORTED_FN' */
|
|
10
|
-
readonly code: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class DiagnosticBag {
|
|
14
|
-
private readonly _diags: Diagnostic[] = [];
|
|
15
|
-
|
|
16
|
-
add(
|
|
17
|
-
severity: DiagnosticSeverity,
|
|
18
|
-
message: string,
|
|
19
|
-
loc: { line: number; col: number },
|
|
20
|
-
code: string,
|
|
21
|
-
): void {
|
|
22
|
-
this._diags.push({ severity, message, line: loc.line, col: loc.col, code });
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
get diagnostics(): readonly Diagnostic[] { return this._diags; }
|
|
26
|
-
|
|
27
|
-
hasErrors(): boolean {
|
|
28
|
-
return this._diags.some(d => d.severity === 'error');
|
|
29
|
-
}
|
|
30
|
-
}
|