@forestadmin/datasource-toolkit
Advanced tools
Comparing version 1.43.0 to 1.44.0
@@ -9,8 +9,14 @@ import { Caller } from './interfaces/caller'; | ||
}; | ||
protected _nativeQueryConnections: { | ||
[connectionName: string]: unknown; | ||
}; | ||
get collections(): T[]; | ||
get nativeQueryConnections(): Record<string, unknown>; | ||
get schema(): DataSourceSchema; | ||
getCollection(name: string): T; | ||
addCollection(collection: T): void; | ||
addNativeQueryConnection(connectionName: string, definition: unknown): void; | ||
renderChart(caller: Caller, name: string): Promise<Chart>; | ||
executeNativeQuery(connectionName: string, query: string, contextVariables: Record<string, unknown>): Promise<unknown>; | ||
} | ||
//# sourceMappingURL=base-datasource.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
const errors_1 = require("./errors"); | ||
@@ -7,2 +8,3 @@ class BaseDataSource { | ||
this._collections = {}; | ||
this._nativeQueryConnections = {}; | ||
} | ||
@@ -12,2 +14,5 @@ get collections() { | ||
} | ||
get nativeQueryConnections() { | ||
return this._nativeQueryConnections; | ||
} | ||
get schema() { | ||
@@ -31,7 +36,16 @@ return { charts: [] }; | ||
} | ||
addNativeQueryConnection(connectionName, definition) { | ||
if (this._nativeQueryConnections[connectionName] !== undefined) { | ||
throw new Error(`NativeQueryConnection '${connectionName}' is already defined in datasource`); | ||
} | ||
this._nativeQueryConnections[connectionName] = definition; | ||
} | ||
renderChart(caller, name) { | ||
throw new Error(`No chart named '${name}' exists on this datasource.`); | ||
} | ||
async executeNativeQuery(connectionName, query, contextVariables) { | ||
throw new Error(`Native Query is not supported on this datasource`); | ||
} | ||
} | ||
exports.default = BaseDataSource; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZS1kYXRhc291cmNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2Jhc2UtZGF0YXNvdXJjZS50cyJdLCJ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FBRSxDQUNoQixDQUFDO1NBQ0g7UUFFRCxPQUFPLFVBQVUsQ0FBQztJQUNwQixDQUFDO0lBRUQsYUFBYSxDQUFDLFVBQWE7UUFDekIsSUFBSSxJQUFJLENBQUMsWUFBWSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsS0FBSyxTQUFTLEVBQUU7WUFDcEQsTUFBTSxJQUFJLEtBQUssQ0FBQyxlQUFlLFVBQVUsQ0FBQyxJQUFJLGlDQUFpQyxDQUFDLENBQUM7U0FDbEY7UUFFRCxJQUFJLENBQUMsWUFBWSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsR0FBRyxVQUFVLENBQUM7SUFDbEQsQ0FBQztJQUVELHdCQUF3QixDQUFDLGNBQXNCLEVBQUUsVUFBbUI7UUFDbEUsSUFBSSxJQUFJLENBQUMsdUJBQXVCLENBQUMsY0FBYyxDQUFDLEtBQUssU0FBUyxFQUFFO1lBQzlELE1BQU0sSUFBSSxLQUFLLENBQUMsMEJBQTBCLGNBQWMsb0NBQW9DLENBQUMsQ0FBQztTQUMvRjtRQUVELElBQUksQ0FBQyx1QkFBdUIsQ0FBQyxjQUFjLENBQUMsR0FBRyxVQUFVLENBQUM7SUFDNUQsQ0FBQztJQUVELFdBQVcsQ0FBQyxNQUFjLEVBQUUsSUFBWTtRQUN0QyxNQUFNLElBQUksS0FBSyxDQUFDLG1CQUFtQixJQUFJLDhCQUE4QixDQUFDLENBQUM7SUFDekUsQ0FBQztJQUVELEtBQUssQ0FBQyxrQkFBa0IsQ0FDdEIsY0FBc0IsRUFDdEIsS0FBYSxFQUNiLGdCQUF5QztRQUV6QyxNQUFNLElBQUksS0FBSyxDQUFDLGtEQUFrRCxDQUFDLENBQUM7SUFDdEUsQ0FBQztDQUNGO0FBM0RELGlDQTJEQyJ9 |
@@ -13,2 +13,3 @@ import { Caller } from '../interfaces/caller'; | ||
get schema(): DataSourceSchema; | ||
get nativeQueryConnections(): Record<string, unknown>; | ||
get collections(): CollectionDecorator[]; | ||
@@ -18,4 +19,5 @@ constructor(childDataSource: DataSource, CollectionDecoratorCtor: CollectionDecoratorConstructor<CollectionDecorator>); | ||
renderChart(caller: Caller, name: string): Promise<Chart>; | ||
executeNativeQuery(connectionName: string, query: string, contextVariables: Record<string, unknown>): Promise<unknown>; | ||
} | ||
export {}; | ||
//# sourceMappingURL=datasource-decorator.d.ts.map |
@@ -7,2 +7,5 @@ "use strict"; | ||
} | ||
get nativeQueryConnections() { | ||
return this.childDataSource.nativeQueryConnections; | ||
} | ||
get collections() { | ||
@@ -26,4 +29,7 @@ return this.childDataSource.collections.map(({ name }) => this.getCollection(name)); | ||
} | ||
async executeNativeQuery(connectionName, query, contextVariables) { | ||
return this.childDataSource.executeNativeQuery(connectionName, query, contextVariables); | ||
} | ||
} | ||
exports.default = DataSourceDecorator; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0YXNvdXJjZS1kZWNvcmF0b3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvZGVjb3JhdG9ycy9kYXRhc291cmNlLWRlY29yYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQVNBLE1BQXFCLG1CQUFtQjtJQU90QyxJQUFJLE1BQU07UUFDUixPQUFPLElBQUksQ0FBQyxlQUFlLENBQUMsTUFBTSxDQUFDO0lBQ3JDLENBQUM7SUFFRCxJQUFJLFdBQVc7UUFDYixPQUFPLElBQUksQ0FBQyxlQUFlLENBQUMsV0FBVyxDQUFDLEdBQUcsQ0FBQyxDQUFDLEVBQUUsSUFBSSxFQUFFLEVBQUUsRUFBRSxDQUFDLElBQUksQ0FBQyxhQUFhLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQztJQUN0RixDQUFDO0lBRUQsWUFDRSxlQUEyQixFQUMzQix1QkFBNEU7UUFaN0QsZUFBVSxHQUE2QyxJQUFJLE9BQU8sRUFBRSx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BSSxDQUFDLENBQUM7SUFDeEQsQ0FBQztJQUVELEtBQUssQ0FBQyxrQkFBa0IsQ0FDdEIsY0FBc0IsRUFDdEIsS0FBYSxFQUNiLGdCQUF5QztRQUV6QyxPQUFPLElBQUksQ0FBQyxlQUFlLENBQUMsa0JBQWtCLENBQUMsY0FBYyxFQUFFLEtBQUssRUFBRSxnQkFBZ0IsQ0FBQyxDQUFDO0lBQzFGLENBQUM7Q0FDRjtBQWhERCxzQ0FnREMifQ== |
@@ -12,5 +12,7 @@ import { ActionFormElement, ActionResult } from './action'; | ||
get collections(): C[]; | ||
get nativeQueryConnections(): Record<string, unknown>; | ||
get schema(): DataSourceSchema; | ||
getCollection(name: string): C; | ||
renderChart(caller: Caller, name: string): Promise<Chart>; | ||
executeNativeQuery(connectionName: string, query: string, contextVariables: Record<string, unknown>): Promise<unknown>; | ||
} | ||
@@ -17,0 +19,0 @@ export type GetFormMetas = { |
{ | ||
"name": "@forestadmin/datasource-toolkit", | ||
"version": "1.43.0", | ||
"version": "1.44.0", | ||
"main": "dist/src/index.js", | ||
@@ -5,0 +5,0 @@ "license": "GPL-3.0", |
289697
3233