1
0
mirror of synced 2026-03-24 20:10:04 +08:00

feat(data-source): 数据源中新增app属性,http数据源新增钩子

This commit is contained in:
roymondchen
2023-08-29 17:12:34 +08:00
parent 0865cf4952
commit c5a1c2db76
4 changed files with 29 additions and 0 deletions

View File

@@ -17,6 +17,7 @@
*/
import EventEmitter from 'events';
import type Core from '@tmagic/core';
import type { CodeBlockContent, DataSchema } from '@tmagic/schema';
import type { DataSourceOptions } from '@data-source/types';
@@ -34,12 +35,15 @@ export default class DataSource extends EventEmitter {
public data: Record<string, any> = {};
public app: Core;
private fields: DataSchema[] = [];
private methods: CodeBlockContent[] = [];
constructor(options: DataSourceOptions) {
super();
this.app = options.app;
this.id = options.schema.id;
this.setFields(options.schema.fields);
this.setMethods(options.schema.methods || []);