feat: Passwordless cross-device authentication

- Arkitektur: docs/auth/passwordless-architecture.md
- Backend: iom/quixzoom-auth-service/ (FastAPI + Redis)
- Webb: quixzoom-market-pages/se/login/ (QR-kod + polling)
- App: iom/quixzoom-app/src/features/auth/ (push + deep links)

Flöde: QR-kod → app-godkännande → webb-inloggad
This commit is contained in:
Bernt
2026-07-07 07:11:50 +00:00
parent 4aa984ad74
commit 6989a98d75
61843 changed files with 5491611 additions and 872231 deletions
@@ -0,0 +1,21 @@
import { ChartConfiguration } from 'chart.js/auto';
import { ChartJSNodeCanvasBase, MimeType } from './chartJSNodeCanvasBase';
export declare class AnimatedChartJSNodeCanvas extends ChartJSNodeCanvasBase {
/**
* Render to a data url array.
* @see https://github.com/Automattic/node-canvas#canvastodataurl
*
* @param configuration The Chart JS configuration for the chart to render.
* @param mimeType A string indicating the image format. Valid options are `image/png`, `image/jpeg` (if node-canvas was built with JPEG support), `raw` (unencoded ARGB32 data in native-endian byte order, top-to-bottom), `application/pdf` (for PDF canvases) and image/svg+xml (for SVG canvases). Defaults to `image/png` for image canvases, or the corresponding type for PDF or SVG canvas.
*/
renderToDataURL(configuration: ChartConfiguration, mimeType?: MimeType): Promise<ReadonlyArray<string>>;
/**
* Render to a buffer.
* @see https://github.com/Automattic/node-canvas#canvastobuffer
*
* @param configuration The Chart JS configuration for the chart to render.
* @param mimeType A string indicating the image format. Valid options are `image/png`, `image/jpeg` (if node-canvas was built with JPEG support) or `raw` (unencoded ARGB32 data in native-endian byte order, top-to-bottom). Defaults to `image/png` for image canvases, or the corresponding type for PDF or SVG canvas.
*/
renderToBuffer(configuration: ChartConfiguration, mimeType?: MimeType): Promise<ReadonlyArray<Buffer>>;
private renderChart;
}
@@ -0,0 +1,98 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AnimatedChartJSNodeCanvas = void 0;
const chartJSNodeCanvasBase_1 = require("./chartJSNodeCanvasBase");
const animationFrameProvider = {
cancelAnimationFrame: (handle) => clearImmediate(handle),
requestAnimationFrame: (callback) => setImmediate(() => callback(Date.now())),
};
class AnimatedChartJSNodeCanvas extends chartJSNodeCanvasBase_1.ChartJSNodeCanvasBase {
/**
* Render to a data url array.
* @see https://github.com/Automattic/node-canvas#canvastodataurl
*
* @param configuration The Chart JS configuration for the chart to render.
* @param mimeType A string indicating the image format. Valid options are `image/png`, `image/jpeg` (if node-canvas was built with JPEG support), `raw` (unencoded ARGB32 data in native-endian byte order, top-to-bottom), `application/pdf` (for PDF canvases) and image/svg+xml (for SVG canvases). Defaults to `image/png` for image canvases, or the corresponding type for PDF or SVG canvas.
*/
renderToDataURL(configuration, mimeType = 'image/png') {
const frames = [];
return new Promise((resolve, _reject) => {
this.renderChart(configuration, (chart) => {
const canvas = chart.canvas;
if (!canvas) {
throw new Error('Canvas is null');
}
const dataUrl = canvas.toDataURL(mimeType);
frames.push(dataUrl);
}, (chart) => {
resolve(frames);
chart.destroy();
});
});
}
/**
* Render to a buffer.
* @see https://github.com/Automattic/node-canvas#canvastobuffer
*
* @param configuration The Chart JS configuration for the chart to render.
* @param mimeType A string indicating the image format. Valid options are `image/png`, `image/jpeg` (if node-canvas was built with JPEG support) or `raw` (unencoded ARGB32 data in native-endian byte order, top-to-bottom). Defaults to `image/png` for image canvases, or the corresponding type for PDF or SVG canvas.
*/
renderToBuffer(configuration, mimeType = 'image/png') {
return new Promise((resolve, _reject) => {
const frames = [];
this.renderChart(configuration, (chart) => {
const canvas = chart.canvas;
if (!canvas) {
throw new Error('Canvas is null');
}
const buffer = canvas.toBuffer(mimeType);
frames.push(buffer);
}, (chart) => {
resolve(frames);
chart.destroy();
});
});
}
renderChart(configuration, onProgress, onComplete) {
const canvas = this._createCanvas(this._width, this._height, this._type);
canvas.style = canvas.style || {};
const options = Object.assign({}, configuration.options);
options.responsive = false;
const animation = options.animation || {};
if (!animation.duration) {
animation.duration = 1000;
}
const baseOnProgress = animation.onProgress;
animation.onProgress = (event) => {
const currentStep = event.currentStep; // type docs wrong?
const initial = !!event.initial ? event.initial : false; // added around 3.2.x
const progress = currentStep / event.numSteps;
if (baseOnProgress) {
//baseOnComplete(event.chart);
baseOnProgress.call(animation, event);
}
onProgress(event.chart, progress, initial);
};
const baseOnComplete = animation.onProgress;
animation.onComplete = (event) => {
const initial = !!event.initial ? event.initial : false; // added around 3.2.x
if (baseOnComplete) {
//baseOnComplete(event.chart);
baseOnComplete.call(animation, event);
}
onComplete(event.chart, initial);
};
const plugins = configuration.plugins || [];
const configuredChartConfig = Object.assign(Object.assign({}, configuration), { options, plugins });
global.window = global.window || {};
global.window.requestAnimationFrame = animationFrameProvider.requestAnimationFrame;
global.window.cancelAnimationFrame = animationFrameProvider.cancelAnimationFrame;
const context = canvas.getContext('2d');
global.Image = this._image; // Some plugins use this API
const chart = new this._chartJs(context, configuredChartConfig);
delete global.Image;
return chart;
}
}
exports.AnimatedChartJSNodeCanvas = AnimatedChartJSNodeCanvas;
//# sourceMappingURL=animatedChartJSNodeCanvas.js.map
@@ -0,0 +1 @@
{"version":3,"file":"animatedChartJSNodeCanvas.js","sourceRoot":"","sources":["../src/animatedChartJSNodeCanvas.ts"],"names":[],"mappings":";;;AAEA,mEAAkF;AAElF,MAAM,sBAAsB,GAA2B;IACtD,oBAAoB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAa,CAAC;IAC/D,qBAAqB,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAQ;CACpF,CAAC;AAKF,MAAa,yBAA0B,SAAQ,6CAAqB;IAEnE;;;;;;OAMG;IACI,eAAe,CAAC,aAAiC,EAAE,WAAqB,WAAW;QAEzF,MAAM,MAAM,GAAkB,EAAE,CAAC;QACjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;YACvC,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,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CAAC,KAAK,CAAC,CAAE,qBAAqB;YACjG,IAAI,cAAc,EAAE,CAAC;gBACpB,8BAA8B;gBAC9B,cAAc,CAAC,IAAI,CAAC,SAAgB,EAAE,KAAK,CAAC,CAAC;YAC9C,CAAC;YACD,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAClC,CAAC,CAAC;QACF,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,EAAE,CAAC;QAC5C,MAAM,qBAAqB,mCAAQ,aAAa,KAAE,OAAO,EAAE,OAAO,GAAE,CAAC;QACrE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;QACpC,MAAM,CAAC,MAAM,CAAC,qBAAqB,GAAG,sBAAsB,CAAC,qBAAqB,CAAC;QACnF,MAAM,CAAC,MAAM,CAAC,oBAAoB,GAAG,sBAAsB,CAAC,oBAAoB,CAAC;QACjF,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACvC,MAAc,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,4BAA4B;QACjE,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAE,OAAe,EAAE,qBAAqB,CAAC,CAAC;QACzE,OAAQ,MAAc,CAAC,KAAK,CAAC;QAC7B,OAAO,KAAK,CAAC;IACd,CAAC;CACD;AAlGD,8DAkGC"}
@@ -0,0 +1,9 @@
import { Chart as ChartJS, Plugin as ChartJSPlugin } from 'chart.js/auto';
export declare class BackgroundColourPlugin implements ChartJSPlugin {
private readonly _width;
private readonly _height;
private readonly _fillStyle;
readonly id: string;
constructor(_width: number, _height: number, _fillStyle: string);
beforeDraw(chart: ChartJS): boolean | void;
}
@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BackgroundColourPlugin = void 0;
class BackgroundColourPlugin {
constructor(_width, _height, _fillStyle) {
this._width = _width;
this._height = _height;
this._fillStyle = _fillStyle;
this.id = 'chartjs-plugin-chartjs-node-canvas-background-colour';
}
beforeDraw(chart) {
const ctx = chart.ctx;
ctx.save();
ctx.globalCompositeOperation = 'destination-over';
ctx.fillStyle = this._fillStyle;
ctx.fillRect(0, 0, this._width, this._height);
ctx.restore();
}
}
exports.BackgroundColourPlugin = BackgroundColourPlugin;
//# sourceMappingURL=backgroundColourPlugin.js.map
@@ -0,0 +1 @@
{"version":3,"file":"backgroundColourPlugin.js","sourceRoot":"","sources":["../src/backgroundColourPlugin.ts"],"names":[],"mappings":";;;AAGA,MAAa,sBAAsB;IAGlC,YACkB,MAAc,EACd,OAAe,EACf,UAAkB;QAFlB,WAAM,GAAN,MAAM,CAAQ;QACd,YAAO,GAAP,OAAO,CAAQ;QACf,eAAU,GAAV,UAAU,CAAQ;QALpB,OAAE,GAAW,sDAAsD,CAAC;IAMhF,CAAC;IAEE,UAAU,CAAC,KAAc;QAE/B,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;QACtB,GAAG,CAAC,IAAI,EAAE,CAAC;QACX,GAAG,CAAC,wBAAwB,GAAG,kBAAkB,CAAC;QAClD,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC;QAChC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9C,GAAG,CAAC,OAAO,EAAE,CAAC;IACf,CAAC;CACD;AAlBD,wDAkBC"}
@@ -0,0 +1,46 @@
import { Readable } from 'stream';
import { ChartConfiguration } from 'chart.js/auto';
import { ChartJSNodeCanvasBase, MimeType } from './chartJSNodeCanvasBase';
export declare class ChartJSNodeCanvas extends ChartJSNodeCanvasBase {
/**
* Render to a data url.
* @see https://github.com/Automattic/node-canvas#canvastodataurl
*
* @param configuration The Chart JS configuration for the chart to render.
* @param mimeType The image format, `image/png` or `image/jpeg`.
*/
renderToDataURL(configuration: ChartConfiguration, mimeType?: MimeType): Promise<string>;
/**
* Render to a data url synchronously.
* @see https://github.com/Automattic/node-canvas#canvastodataurl
*
* @param configuration The Chart JS configuration for the chart to render.
* @param mimeType The image format, `image/png` or `image/jpeg`.
*/
renderToDataURLSync(configuration: ChartConfiguration, mimeType?: MimeType): string;
/**
* Render to a buffer.
* @see https://github.com/Automattic/node-canvas#canvastobuffer
*
* @param configuration The Chart JS configuration for the chart to render.
* @param mimeType A string indicating the image format. Valid options are `image/png`, `image/jpeg` (if node-canvas was built with JPEG support) or `raw` (unencoded ARGB32 data in native-endian byte order, top-to-bottom). Defaults to `image/png` for image canvases, or the corresponding type for PDF or SVG canvas.
*/
renderToBuffer(configuration: ChartConfiguration, mimeType?: MimeType): Promise<Buffer>;
/**
* Render to a buffer synchronously.
* @see https://github.com/Automattic/node-canvas#canvastobuffer
*
* @param configuration The Chart JS configuration for the chart to render.
* @param mimeType A string indicating the image format. Valid options are `image/png`, `image/jpeg` (if node-canvas was built with JPEG support), `raw` (unencoded ARGB32 data in native-endian byte order, top-to-bottom), `application/pdf` (for PDF canvases) and image/svg+xml (for SVG canvases). Defaults to `image/png` for image canvases, or the corresponding type for PDF or SVG canvas.
*/
renderToBufferSync(configuration: ChartConfiguration, mimeType?: MimeType | 'application/pdf' | 'image/svg+xml'): Buffer;
/**
* Render to a stream.
* @see https://github.com/Automattic/node-canvas#canvascreatepngstream
*
* @param configuration The Chart JS configuration for the chart to render.
* @param mimeType A string indicating the image format. Valid options are `image/png`, `image/jpeg` (if node-canvas was built with JPEG support), `application/pdf` (for PDF canvases) and image/svg+xml (for SVG canvases). Defaults to `image/png` for image canvases, or the corresponding type for PDF or SVG canvas.
*/
renderToStream(configuration: ChartConfiguration, mimeType?: MimeType | 'application/pdf'): Readable;
private renderChart;
}
@@ -0,0 +1,129 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChartJSNodeCanvas = void 0;
const chartJSNodeCanvasBase_1 = require("./chartJSNodeCanvasBase");
class ChartJSNodeCanvas extends chartJSNodeCanvasBase_1.ChartJSNodeCanvasBase {
/**
* Render to a data url.
* @see https://github.com/Automattic/node-canvas#canvastodataurl
*
* @param configuration The Chart JS configuration for the chart to render.
* @param mimeType The image format, `image/png` or `image/jpeg`.
*/
renderToDataURL(configuration, mimeType = 'image/png') {
const chart = this.renderChart(configuration);
return new Promise((resolve, reject) => {
if (!chart.canvas) {
return reject(new Error('Canvas is null'));
}
const canvas = chart.canvas;
canvas.toDataURL(mimeType, (error, png) => {
chart.destroy();
if (error) {
return reject(error);
}
return resolve(png);
});
});
}
/**
* Render to a data url synchronously.
* @see https://github.com/Automattic/node-canvas#canvastodataurl
*
* @param configuration The Chart JS configuration for the chart to render.
* @param mimeType The image format, `image/png` or `image/jpeg`.
*/
renderToDataURLSync(configuration, mimeType = 'image/png') {
const chart = this.renderChart(configuration);
if (!chart.canvas) {
throw new Error('Canvas is null');
}
const canvas = chart.canvas;
const dataUrl = canvas.toDataURL(mimeType);
// Use this to destroy any chart instances that are created.
// This will clean up any references stored to the chart object within Chart.js, along with any associated event listeners attached by Chart.js.
// This must be called before the canvas is reused for a new chart.
chart.destroy();
return dataUrl;
}
/**
* Render to a buffer.
* @see https://github.com/Automattic/node-canvas#canvastobuffer
*
* @param configuration The Chart JS configuration for the chart to render.
* @param mimeType A string indicating the image format. Valid options are `image/png`, `image/jpeg` (if node-canvas was built with JPEG support) or `raw` (unencoded ARGB32 data in native-endian byte order, top-to-bottom). Defaults to `image/png` for image canvases, or the corresponding type for PDF or SVG canvas.
*/
renderToBuffer(configuration, mimeType = 'image/png') {
const chart = this.renderChart(configuration);
return new Promise((resolve, reject) => {
if (!chart.canvas) {
throw new Error('Canvas is null');
}
const canvas = chart.canvas;
canvas.toBuffer((error, buffer) => {
chart.destroy();
if (error) {
return reject(error);
}
return resolve(buffer);
}, mimeType);
});
}
/**
* Render to a buffer synchronously.
* @see https://github.com/Automattic/node-canvas#canvastobuffer
*
* @param configuration The Chart JS configuration for the chart to render.
* @param mimeType A string indicating the image format. Valid options are `image/png`, `image/jpeg` (if node-canvas was built with JPEG support), `raw` (unencoded ARGB32 data in native-endian byte order, top-to-bottom), `application/pdf` (for PDF canvases) and image/svg+xml (for SVG canvases). Defaults to `image/png` for image canvases, or the corresponding type for PDF or SVG canvas.
*/
renderToBufferSync(configuration, mimeType = 'image/png') {
const chart = this.renderChart(configuration);
if (!chart.canvas) {
throw new Error('Canvas is null');
}
const canvas = chart.canvas;
const buffer = canvas.toBuffer(mimeType);
chart.destroy();
return buffer;
}
/**
* Render to a stream.
* @see https://github.com/Automattic/node-canvas#canvascreatepngstream
*
* @param configuration The Chart JS configuration for the chart to render.
* @param mimeType A string indicating the image format. Valid options are `image/png`, `image/jpeg` (if node-canvas was built with JPEG support), `application/pdf` (for PDF canvases) and image/svg+xml (for SVG canvases). Defaults to `image/png` for image canvases, or the corresponding type for PDF or SVG canvas.
*/
renderToStream(configuration, mimeType = 'image/png') {
const chart = this.renderChart(configuration);
if (!chart.canvas) {
throw new Error('Canvas is null');
}
const canvas = chart.canvas;
setImmediate(() => chart.destroy());
switch (mimeType) {
case 'image/png':
return canvas.createPNGStream();
case 'image/jpeg':
return canvas.createJPEGStream();
case 'application/pdf':
return canvas.createPDFStream();
default:
throw new Error(`Un-handled mimeType: ${mimeType}`);
}
}
renderChart(configuration) {
const canvas = this._createCanvas(this._width, this._height, this._type);
canvas.style = canvas.style || {};
configuration.options = configuration.options || {};
configuration.options.responsive = false;
// Disable animation (otherwise charts will throw exceptions)
configuration.options.animation = false;
const context = canvas.getContext('2d');
global.Image = this._image; // Some plugins use this API
const chart = new this._chartJs(context, configuration);
delete global.Image;
return chart;
}
}
exports.ChartJSNodeCanvas = ChartJSNodeCanvas;
//# sourceMappingURL=chartJSNodeCanvas.js.map
@@ -0,0 +1 @@
{"version":3,"file":"chartJSNodeCanvas.js","sourceRoot":"","sources":["../src/chartJSNodeCanvas.ts"],"names":[],"mappings":";;;AAGA,mEAAkF;AAElF,MAAa,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Readable } from 'stream';
import { Chart as ChartJS, ChartComponentLike } from 'chart.js/auto';
import { createCanvas, registerFont, Image } from 'canvas';
export type ChartJSNodeCanvasPlugins = {
/**
* Global plugins, see https://www.chartjs.org/docs/latest/developers/plugins.html.
*/
readonly modern?: ReadonlyArray<string | ChartComponentLike>;
/**
* This will work for plugins that `require` ChartJS themselves.
*/
readonly requireChartJSLegacy?: ReadonlyArray<string>;
/**
* This should work for any plugin that expects a global Chart variable.
*/
readonly globalVariableLegacy?: ReadonlyArray<string>;
/**
* This will work with plugins that just return a plugin object and do no specific loading themselves.
*/
readonly requireLegacy?: ReadonlyArray<string>;
};
export type ChartCallback = (chartJS: typeof ChartJS) => void | Promise<void>;
export type CanvasType = 'pdf' | 'svg';
export type MimeType = 'image/png' | 'image/jpeg';
export type Canvas = HTMLCanvasElement & {
toBuffer(callback: (err: Error | null, result: Buffer) => void, mimeType?: string, config?: any): void;
toBuffer(mimeType?: string, config?: any): Buffer;
createPNGStream(config?: any): Readable;
createJPEGStream(config?: any): Readable;
createPDFStream(config?: any): Readable;
};
export interface ChartJSNodeCanvasOptions {
/**
* The width of the charts to render, in pixels.
*/
readonly width: number;
/**
* The height of the charts to render, in pixels.
*/
readonly height: number;
/**
* Optional callback which is called once with a new ChartJS global reference as the only parameter.
*/
readonly chartCallback?: ChartCallback;
/**
* Optional canvas type ('PDF' or 'SVG'), see the [canvas pdf doc](https://github.com/Automattic/node-canvas#pdf-output-support).
*/
readonly type?: CanvasType;
/**
* Optional plugins to register.
*/
readonly plugins?: ChartJSNodeCanvasPlugins;
/**
* Optional background color for the chart, otherwise it will be transparent. Note, this will apply to all charts. See the [fillStyle](https://www.w3schools.com/tags/canvas_fillstyle.asp) canvas API used for possible values.
*/
readonly backgroundColour?: string;
}
export declare abstract class ChartJSNodeCanvasBase {
protected readonly _width: number;
protected readonly _height: number;
protected readonly _chartJs: typeof ChartJS;
protected readonly _createCanvas: typeof createCanvas;
protected readonly _registerFont: typeof registerFont;
protected readonly _image: typeof Image;
protected readonly _type?: CanvasType;
/**
* Create a new instance of CanvasRenderService.
*
* @param options Configuration for this instance
*/
constructor(options: ChartJSNodeCanvasOptions);
/**
* Use to register the font with Canvas to use a font file that is not installed as a system font, this must be done before the Canvas is created.
*
* @param path The path to the font file.
* @param options The font options.
* @example
* registerFont('comicsans.ttf', { family: 'Comic Sans' });
*/
registerFont(path: string, options: {
readonly family: string;
readonly weight?: string;
readonly style?: string;
}): void;
protected initialize(options: ChartJSNodeCanvasOptions): typeof ChartJS;
}
@@ -0,0 +1,90 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChartJSNodeCanvasBase = void 0;
const path_1 = require("path");
const freshRequire_1 = require("./freshRequire");
const backgroundColourPlugin_1 = require("./backgroundColourPlugin");
class ChartJSNodeCanvasBase {
/**
* Create a new instance of CanvasRenderService.
*
* @param options Configuration for this instance
*/
constructor(options) {
if (options === null || typeof (options) !== 'object') {
throw new Error('An options parameter object is required');
}
if (!options.width || typeof (options.width) !== 'number') {
throw new Error('A width option is required');
}
if (!options.height || typeof (options.height) !== 'number') {
throw new Error('A height option is required');
}
this._width = options.width;
this._height = options.height;
const canvas = (0, freshRequire_1.freshRequire)('canvas');
this._createCanvas = canvas.createCanvas;
this._registerFont = canvas.registerFont;
this._image = canvas.Image;
this._type = options.type && options.type.toLowerCase();
this._chartJs = this.initialize(options);
}
/**
* Use to register the font with Canvas to use a font file that is not installed as a system font, this must be done before the Canvas is created.
*
* @param path The path to the font file.
* @param options The font options.
* @example
* registerFont('comicsans.ttf', { family: 'Comic Sans' });
*/
registerFont(path, options) {
this._registerFont(path, options);
}
initialize(options) {
var _a, _b, _c, _d;
const chartJs = require('chart.js/auto');
if ((_a = options.plugins) === null || _a === void 0 ? void 0 : _a.requireChartJSLegacy) {
for (const plugin of options.plugins.requireChartJSLegacy) {
require(plugin);
delete require.cache[require.resolve(plugin)];
}
}
if ((_b = options.plugins) === null || _b === void 0 ? void 0 : _b.globalVariableLegacy) {
global.Chart = chartJs;
for (const plugin of options.plugins.globalVariableLegacy) {
(0, freshRequire_1.freshRequire)(plugin);
}
delete global.Chart;
}
if ((_c = options.plugins) === null || _c === void 0 ? void 0 : _c.modern) {
for (const plugin of options.plugins.modern) {
if (typeof plugin === 'string') {
chartJs.register((0, freshRequire_1.freshRequire)(plugin));
}
else {
chartJs.register(plugin);
}
}
}
if ((_d = options.plugins) === null || _d === void 0 ? void 0 : _d.requireLegacy) {
for (const plugin of options.plugins.requireLegacy) {
chartJs.register((0, freshRequire_1.freshRequire)(plugin));
}
}
if (options.chartCallback) {
options.chartCallback(chartJs);
}
if (options.backgroundColour) {
chartJs.register(new backgroundColourPlugin_1.BackgroundColourPlugin(options.width, options.height, options.backgroundColour));
}
const chartJsPath = (0, path_1.join)('node_modules', 'chart.js');
for (const key of Object.keys(require.cache)) {
if (key.includes(chartJsPath)) {
delete require.cache[key];
}
}
return chartJs;
}
}
exports.ChartJSNodeCanvasBase = ChartJSNodeCanvasBase;
//# sourceMappingURL=chartJSNodeCanvasBase.js.map
@@ -0,0 +1 @@
{"version":3,"file":"chartJSNodeCanvasBase.js","sourceRoot":"","sources":["../src/chartJSNodeCanvasBase.ts"],"names":[],"mappings":";;;AAIA,+BAAwC;AACxC,iDAA8C;AAC9C,qEAAkE;AA4DlE,MAAsB,qBAAqB;IAU1C;;;;OAIG;IACH,YAAY,OAAiC;QAE5C,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC5D,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC3D,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAC/C,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,OAAO,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AAE,CAAC;YAC9C,IAAI,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;gBAC/B,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC3B,CAAC;QACF,CAAC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;CACD;AAtGD,sDAsGC"}
+1
View File
@@ -0,0 +1 @@
export {};
+71
View File
@@ -0,0 +1,71 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const _1 = require("./");
const path_1 = tslib_1.__importDefault(require("path"));
const fs_1 = require("fs");
async function main() {
const width = 400;
const height = 400;
const configuration = {
type: 'bar',
data: {
labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(255, 159, 64, 0.2)'
],
borderColor: [
'rgba(255,99,132,1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
],
borderWidth: 1
}]
},
options: {},
plugins: [{
id: 'background-colour',
beforeDraw: (chart) => {
const ctx = chart.ctx;
ctx.save();
ctx.fillStyle = 'white';
ctx.fillRect(0, 0, width, height);
ctx.restore();
}
}]
};
const chartCallback = (ChartJS) => {
ChartJS.defaults.responsive = true;
ChartJS.defaults.maintainAspectRatio = false;
};
console.log('here');
const chartJSNodeCanvas = new _1.ChartJSNodeCanvas({ width, height, chartCallback });
const buffer = await chartJSNodeCanvas.renderToBuffer(configuration);
await fs_1.promises.writeFile('./resources/example.png', buffer, 'base64');
const k = Object.keys(require.cache).find(key => key.includes(path_1.default.join('node_modules', 'chart.js')));
console.log('keys', k);
// const animatedChartJSNodeCanvas = new AnimatedChartJSNodeCanvas({ width, height, chartCallback });
// const buffers = await animatedChartJSNodeCanvas.renderToBuffer(configuration);
// const { Gif } = await import('make-a-gif');
// const gif = new Gif(width, height, 1);
// const totalDuration = 1000;
// const duration = totalDuration / buffers.length;
// await gif.setFrames(buffers.map(buffer => ({ src: new Uint8Array(buffer), duration })));
// // const data = await chartJSNodeCanvas.renderToDataURL(configuration);
// // console.log(data.length);
// const image = await gif.encode();
// await fs.writeFile('./resources/example.gif', image);
}
main();
//# sourceMappingURL=example.js.map
@@ -0,0 +1 @@
{"version":3,"file":"example.js","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":";;;AAAA,yBAAsD;AAGtD,wDAAwB;AACxB,2BAAoC;AAEpC,KAAK,UAAU,IAAI;IAElB,MAAM,KAAK,GAAG,GAAG,CAAC;IAClB,MAAM,MAAM,GAAG,GAAG,CAAC;IACnB,MAAM,aAAa,GAAuB;QACzC,IAAI,EAAE,KAAK;QACX,IAAI,EAAE;YACL,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;YAC9D,QAAQ,EAAE,CAAC;oBACV,KAAK,EAAE,YAAY;oBACnB,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;oBAC1B,eAAe,EAAE;wBAChB,yBAAyB;wBACzB,yBAAyB;wBACzB,yBAAyB;wBACzB,yBAAyB;wBACzB,0BAA0B;wBAC1B,yBAAyB;qBACzB;oBACD,WAAW,EAAE;wBACZ,oBAAoB;wBACpB,uBAAuB;wBACvB,uBAAuB;wBACvB,uBAAuB;wBACvB,wBAAwB;wBACxB,uBAAuB;qBACvB;oBACD,WAAW,EAAE,CAAC;iBACd,CAAC;SACF;QACD,OAAO,EAAE,EACR;QACD,OAAO,EAAE,CAAC;gBACT,EAAE,EAAE,mBAAmB;gB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IACpC,wDAAwD;AACzD,CAAC;AACD,IAAI,EAAE,CAAC"}
@@ -0,0 +1 @@
export {};
+21
View File
@@ -0,0 +1,21 @@
"use strict";
// ES Module version of fresh-require
// export const freshImport = async (modulePath: string): Promise<any> => {
// // For ES modules, we need to construct the full URL
// const moduleUrl = new URL(modulePath, import.meta.url).href;
Object.defineProperty(exports, "__esModule", { value: true });
// // Clear module from import cache if possible
// // Note: ES modules caching works differently than CommonJS
// try {
// // Force a new module instance by appending a cache-busting query parameter
// const timestamp = Date.now();
// const urlWithCacheBuster = `${moduleUrl}?cache=${timestamp}`;
// // Dynamic import with cache buster
// const module = await import(/* @vite-ignore */ urlWithCacheBuster);
// return module;
// } catch (error) {
// console.error(`Error importing module ${modulePath}:`, error);
// throw error;
// }
// };
//# sourceMappingURL=freshImport.js.map
@@ -0,0 +1 @@
{"version":3,"file":"freshImport.js","sourceRoot":"","sources":["../src/freshImport.ts"],"names":[],"mappings":";AAAA,qCAAqC;AACrC,2EAA2E;AAC3E,wDAAwD;AACxD,gEAAgE;;AAEhE,iDAAiD;AACjD,+DAA+D;AAC/D,SAAS;AACT,iFAAiF;AACjF,mCAAmC;AACnC,mEAAmE;AAEnE,yCAAyC;AACzC,yEAAyE;AACzE,oBAAoB;AACpB,qBAAqB;AACrB,oEAAoE;AACpE,kBAAkB;AAClB,KAAK;AACL,KAAK"}
@@ -0,0 +1 @@
export declare const freshRequire: (id: string) => any;
+14
View File
@@ -0,0 +1,14 @@
"use strict";
// https://github.com/hughsk/fresh-require
Object.defineProperty(exports, "__esModule", { value: true });
exports.freshRequire = void 0;
const freshRequire = (file) => {
const resolvedFile = require.resolve(file);
const temp = require.cache[resolvedFile];
delete require.cache[resolvedFile];
const modified = require(resolvedFile);
require.cache[resolvedFile] = temp;
return modified;
};
exports.freshRequire = freshRequire;
//# sourceMappingURL=freshRequire.js.map
@@ -0,0 +1 @@
{"version":3,"file":"freshRequire.js","sourceRoot":"","sources":["../src/freshRequire.ts"],"names":[],"mappings":";AAAA,0CAA0C;;;AAEnC,MAAM,YAAY,GAA2C,CAAC,IAAI,EAAE,EAAE;IAE5E,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACzC,OAAO,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACvC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;IACnC,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AARW,QAAA,YAAY,gBAQvB"}
+3
View File
@@ -0,0 +1,3 @@
export * from './animatedChartJSNodeCanvas';
export * from './chartJSNodeCanvas';
export * from './chartJSNodeCanvasBase';
+7
View File
@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./animatedChartJSNodeCanvas"), exports);
tslib_1.__exportStar(require("./chartJSNodeCanvas"), exports);
tslib_1.__exportStar(require("./chartJSNodeCanvasBase"), exports);
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,sEAA4C;AAC5C,8DAAoC;AACpC,kEAAwC"}