重定义了Importation
This commit is contained in:
parent
9034ba076a
commit
aa889f1abc
|
|
@ -1,4 +1,5 @@
|
|||
import { EntityDict } from "./Entity";
|
||||
import { GenericAction } from '../actions/action';
|
||||
export declare type Action = string;
|
||||
export declare type State = string;
|
||||
export declare type ActionDef<A extends Action, S extends State> = {
|
||||
|
|
@ -12,3 +13,10 @@ export declare type ActionDictOfEntityDict<E extends EntityDict> = {
|
|||
[A in keyof E[T]['OpSchema']]?: ActionDef<string, string>;
|
||||
};
|
||||
};
|
||||
export declare type CascadeActionItem = {
|
||||
cascadePath: string;
|
||||
relation: string[];
|
||||
};
|
||||
export declare type CascadeActionAuth<A extends Action = ''> = {
|
||||
[K in A | GenericAction]?: CascadeActionItem | (CascadeActionItem | CascadeActionItem[])[];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -179,19 +179,4 @@ export declare type Configuration = {
|
|||
actionType?: ActionType;
|
||||
static?: boolean;
|
||||
};
|
||||
export declare type Exportation<ED extends EntityDict, T extends keyof ED, K extends string> = {
|
||||
name: string;
|
||||
id: string;
|
||||
entity: T;
|
||||
projection: ED[T]['Selection']['data'];
|
||||
headers: K[];
|
||||
fn: (data: ED[T]['Schema']) => Partial<Record<K, string | number | boolean | null>>;
|
||||
};
|
||||
export declare type Importation<ED extends EntityDict, T extends keyof ED, K extends string> = {
|
||||
name: string;
|
||||
id: string;
|
||||
entity: T;
|
||||
headers: K[];
|
||||
fn: (data: Partial<Record<K, string | number | boolean>>) => ED[T]['CreateSingle']['data'];
|
||||
};
|
||||
export {};
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@ export declare class OakException extends Error {
|
|||
}
|
||||
export declare class OakDataException extends OakException {
|
||||
}
|
||||
export declare class OakImportDataParseException extends OakException {
|
||||
line: number;
|
||||
header?: string;
|
||||
constructor(message: string, line: number, header?: string);
|
||||
}
|
||||
export declare class OakOperExistedException extends OakDataException {
|
||||
}
|
||||
export declare class OakRowUnexistedException extends OakDataException {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.makeException = exports.OakDeadlock = exports.OakCongruentRowExists = exports.OakRowLockedException = exports.OakUnloggedInException = exports.OakUserUnpermittedException = exports.OakInputIllegalException = exports.OakRowInconsistencyException = exports.OakUserException = exports.OakExternalException = exports.OakRowUnexistedException = exports.OakOperExistedException = exports.OakDataException = exports.OakException = void 0;
|
||||
exports.makeException = exports.OakDeadlock = exports.OakCongruentRowExists = exports.OakRowLockedException = exports.OakUnloggedInException = exports.OakUserUnpermittedException = exports.OakInputIllegalException = exports.OakRowInconsistencyException = exports.OakUserException = exports.OakExternalException = exports.OakRowUnexistedException = exports.OakOperExistedException = exports.OakImportDataParseException = exports.OakDataException = exports.OakException = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var OakException = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(OakException, _super);
|
||||
|
|
@ -36,6 +36,18 @@ var OakDataException = /** @class */ (function (_super) {
|
|||
return OakDataException;
|
||||
}(OakException));
|
||||
exports.OakDataException = OakDataException;
|
||||
var OakImportDataParseException = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(OakImportDataParseException, _super);
|
||||
// message必传,描述具体错误的数据内容
|
||||
function OakImportDataParseException(message, line, header) {
|
||||
var _this = _super.call(this, message) || this;
|
||||
_this.line = line;
|
||||
_this.header = header;
|
||||
return _this;
|
||||
}
|
||||
return OakImportDataParseException;
|
||||
}(OakException));
|
||||
exports.OakImportDataParseException = OakImportDataParseException;
|
||||
var OakOperExistedException = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(OakOperExistedException, _super);
|
||||
function OakOperExistedException() {
|
||||
|
|
@ -245,6 +257,9 @@ function makeException(data) {
|
|||
case 'OakDeadlock': {
|
||||
return new OakDeadlock(data.message);
|
||||
}
|
||||
case 'OakImportDataParseException': {
|
||||
return new OakImportDataParseException(data.message, data.line, data.header);
|
||||
}
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
import { AsyncContext } from "../store/AsyncRowStore";
|
||||
import { EntityDict } from "./Entity";
|
||||
export declare type Exportation<ED extends EntityDict, T extends keyof ED, K extends string> = {
|
||||
name: string;
|
||||
id: string;
|
||||
entity: T;
|
||||
projection: ED[T]['Selection']['data'];
|
||||
headers: K[];
|
||||
fn: (data: ED[T]['Schema']) => Partial<Record<K, string | number | boolean | null>>;
|
||||
};
|
||||
export declare type Importation<ED extends EntityDict, T extends keyof ED, K extends string> = {
|
||||
name: string;
|
||||
id: string;
|
||||
entity: T;
|
||||
headers: K[];
|
||||
fn: (data: Partial<Record<K, string | number | boolean>>[], context: AsyncContext<ED>, option?: Record<string, any>) => Promise<ED[T]['CreateMulti']['data']>;
|
||||
};
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
|
|
@ -17,3 +17,4 @@ export * from './Watcher';
|
|||
export * from './AppLoader';
|
||||
export * from './Connector';
|
||||
export * from './Timer';
|
||||
export * from './Port';
|
||||
|
|
|
|||
|
|
@ -20,3 +20,4 @@ tslib_1.__exportStar(require("./Watcher"), exports);
|
|||
tslib_1.__exportStar(require("./AppLoader"), exports);
|
||||
tslib_1.__exportStar(require("./Connector"), exports);
|
||||
tslib_1.__exportStar(require("./Timer"), exports);
|
||||
tslib_1.__exportStar(require("./Port"), exports);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { EntityDict } from "./Entity";
|
||||
import { GenericAction } from '../actions/action';
|
||||
|
||||
export type Action = string;
|
||||
export type State = string;
|
||||
|
|
@ -14,4 +15,13 @@ export type ActionDictOfEntityDict<E extends EntityDict> = {
|
|||
[T in keyof E]?: {
|
||||
[A in keyof E[T]['OpSchema']]?: ActionDef<string, string>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
export type CascadeActionItem = {
|
||||
cascadePath: string;
|
||||
relation: string[];
|
||||
}
|
||||
|
||||
export type CascadeActionAuth<A extends Action = ''> = {
|
||||
[K in A | GenericAction]?: CascadeActionItem | (CascadeActionItem | CascadeActionItem[])[];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -259,20 +259,3 @@ export type Configuration = {
|
|||
actionType?: ActionType;
|
||||
static?: boolean; // 标识是维表(变动较小,相对独立)
|
||||
};
|
||||
|
||||
export type Exportation<ED extends EntityDict, T extends keyof ED, K extends string> = {
|
||||
name: string;
|
||||
id: string;
|
||||
entity: T;
|
||||
projection: ED[T]['Selection']['data'];
|
||||
headers: K[];
|
||||
fn: (data: ED[T]['Schema']) => Partial<Record<K, string | number | boolean | null>>;
|
||||
};
|
||||
|
||||
export type Importation<ED extends EntityDict, T extends keyof ED, K extends string> = {
|
||||
name: string;
|
||||
id: string;
|
||||
entity: T;
|
||||
headers: K[];
|
||||
fn: (data: Partial<Record<K, string | number | boolean>>) => ED[T]['CreateSingle']['data'];
|
||||
};
|
||||
|
|
@ -26,6 +26,18 @@ export class OakDataException extends OakException {
|
|||
// 表示由数据层发现的异常
|
||||
}
|
||||
|
||||
export class OakImportDataParseException extends OakException {
|
||||
line: number;
|
||||
header?: string;
|
||||
|
||||
// message必传,描述具体错误的数据内容
|
||||
constructor(message: string, line: number, header?: string) {
|
||||
super(message);
|
||||
this.line = line;
|
||||
this.header = header;
|
||||
}
|
||||
}
|
||||
|
||||
export class OakOperExistedException extends OakDataException {
|
||||
// 进行操作时发现同样id的Oper对象已经存在
|
||||
}
|
||||
|
|
@ -220,6 +232,9 @@ export function makeException(data: {
|
|||
case 'OakDeadlock': {
|
||||
return new OakDeadlock(data.message);
|
||||
}
|
||||
case 'OakImportDataParseException': {
|
||||
return new OakImportDataParseException(data.message!, data.line, data.header);
|
||||
}
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
import { AsyncContext } from "../store/AsyncRowStore";
|
||||
import { SyncContext } from "../store/SyncRowStore";
|
||||
import { EntityDict } from "./Entity";
|
||||
|
||||
export type Exportation<ED extends EntityDict, T extends keyof ED, K extends string> = {
|
||||
name: string;
|
||||
id: string;
|
||||
entity: T;
|
||||
projection: ED[T]['Selection']['data'];
|
||||
headers: K[];
|
||||
fn: (data: ED[T]['Schema']) => Partial<Record<K, string | number | boolean | null>>;
|
||||
};
|
||||
|
||||
export type Importation<ED extends EntityDict, T extends keyof ED, K extends string> = {
|
||||
name: string;
|
||||
id: string;
|
||||
entity: T;
|
||||
headers: K[];
|
||||
fn: (data: Partial<Record<K, string | number | boolean>>[], context: AsyncContext<ED>, option?: Record<string, any> ) => Promise<ED[T]['CreateMulti']['data']>;
|
||||
};
|
||||
|
|
@ -16,4 +16,5 @@ export * from './Exception';
|
|||
export * from './Watcher';
|
||||
export * from './AppLoader';
|
||||
export * from './Connector';
|
||||
export * from './Timer';
|
||||
export * from './Timer';
|
||||
export * from './Port';
|
||||
Loading…
Reference in New Issue