增加了cluster定义
This commit is contained in:
parent
f359b69956
commit
2db0117d56
|
|
@ -1,8 +1,9 @@
|
|||
/// <reference types="node" />
|
||||
import { EntityDict, RowStore, OperateOption, OperationResult, SelectOption, Context, TxnOption, OpRecord, AggregationResult } from "../types";
|
||||
import { EntityDict, RowStore, OperateOption, OperationResult, SelectOption, Context, TxnOption, OpRecord, AggregationResult, ClusterInfo } from "../types";
|
||||
import { IncomingHttpHeaders } from "http";
|
||||
export declare abstract class AsyncContext<ED extends EntityDict> implements Context {
|
||||
rowStore: AsyncRowStore<ED, this>;
|
||||
clusterInfo?: ClusterInfo;
|
||||
private uuid?;
|
||||
opRecords: OpRecord<ED>[];
|
||||
private scene?;
|
||||
|
|
@ -16,7 +17,7 @@ export declare abstract class AsyncContext<ED extends EntityDict> implements Con
|
|||
* 在返回结果前调用,对数据行进行一些预处理,比如将一些敏感的列隐藏
|
||||
*/
|
||||
abstract refineOpRecords(): Promise<void>;
|
||||
constructor(store: AsyncRowStore<ED, AsyncContext<ED>>, headers?: IncomingHttpHeaders);
|
||||
constructor(store: AsyncRowStore<ED, AsyncContext<ED>>, headers?: IncomingHttpHeaders, clusterInfo?: ClusterInfo);
|
||||
setHeaders(headers: IncomingHttpHeaders): void;
|
||||
getHeader(key: string): string | string[] | undefined;
|
||||
getScene(): string | undefined;
|
||||
|
|
|
|||
|
|
@ -5,14 +5,16 @@ const tslib_1 = require("tslib");
|
|||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
class AsyncContext {
|
||||
rowStore;
|
||||
clusterInfo;
|
||||
uuid;
|
||||
opRecords;
|
||||
scene;
|
||||
headers;
|
||||
message;
|
||||
events;
|
||||
constructor(store, headers) {
|
||||
constructor(store, headers, clusterInfo) {
|
||||
this.rowStore = store;
|
||||
this.clusterInfo = clusterInfo;
|
||||
this.opRecords = [];
|
||||
this.events = {
|
||||
commit: [],
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
export type ClusterInfo = {
|
||||
usingCluster: boolean;
|
||||
instanceId?: number;
|
||||
instanceCount?: number;
|
||||
};
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
|
|
@ -23,3 +23,4 @@ export * from './Style';
|
|||
export * from './EntityDesc';
|
||||
export * from './Environment';
|
||||
export * from './Locale';
|
||||
export * from './Cluster';
|
||||
|
|
|
|||
|
|
@ -26,3 +26,4 @@ tslib_1.__exportStar(require("./Style"), exports);
|
|||
tslib_1.__exportStar(require("./EntityDesc"), exports);
|
||||
tslib_1.__exportStar(require("./Environment"), exports);
|
||||
tslib_1.__exportStar(require("./Locale"), exports);
|
||||
tslib_1.__exportStar(require("./Cluster"), exports);
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
import chalk from 'chalk';
|
||||
import spawn from 'cross-spawn';
|
||||
import { resolve } from 'path';
|
||||
|
||||
// ts-node scripts/build-app-domain & npm link ./app-domain
|
||||
console.log(`${chalk.greenBright(`build base-app-domain`)}`);
|
||||
// ts-node scripts/build-app-domain & npm link ./app-domain
|
||||
console.log(`${chalk.greenBright(`build base-app-domain`)}`);
|
||||
|
||||
const result = spawn.sync(
|
||||
'ts-node',
|
||||
[require.resolve('./buildBaseEntityDict.ts')],
|
||||
{
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
}
|
||||
);
|
||||
// const result2 = spawn.sync('npm -v', [], { stdio: 'inherit', shell: true });
|
||||
|
||||
if (result.status === 0) {
|
||||
console.log(`${chalk.greenBright(`build 执行完成`)}`);
|
||||
} else {
|
||||
Error(`${chalk.redBright(`build 执行失败`)}`);
|
||||
process.exit(1);
|
||||
const result = spawn.sync(
|
||||
'ts-node',
|
||||
[resolve(process.cwd(), 'scripts', 'buildBaseEntityDict.ts')],
|
||||
{
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
}
|
||||
|
||||
);
|
||||
// const result2 = spawn.sync('npm -v', [], { stdio: 'inherit', shell: true });
|
||||
|
||||
if (result.status === 0) {
|
||||
console.log(`${chalk.greenBright(`build 执行完成`)}`);
|
||||
} else {
|
||||
Error(`${chalk.redBright(`build 执行失败`)}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
|
||||
import { EntityDict, RowStore, OperateOption, OperationResult, SelectOption, Context, TxnOption, OpRecord, AggregationResult } from "../types";
|
||||
import { EntityDict, RowStore, OperateOption, OperationResult, SelectOption, Context, TxnOption, OpRecord, AggregationResult, ClusterInfo } from "../types";
|
||||
import assert from "assert";
|
||||
import { IncomingHttpHeaders } from "http";
|
||||
|
||||
export abstract class AsyncContext<ED extends EntityDict> implements Context {
|
||||
rowStore: AsyncRowStore<ED, this>;
|
||||
clusterInfo?: ClusterInfo;
|
||||
private uuid?: string;
|
||||
opRecords: OpRecord<ED>[];
|
||||
private scene?: string;
|
||||
|
|
@ -20,8 +21,9 @@ export abstract class AsyncContext<ED extends EntityDict> implements Context {
|
|||
*/
|
||||
abstract refineOpRecords(): Promise<void>;
|
||||
|
||||
constructor(store: AsyncRowStore<ED, AsyncContext<ED>>, headers?: IncomingHttpHeaders) {
|
||||
constructor(store: AsyncRowStore<ED, AsyncContext<ED>>, headers?: IncomingHttpHeaders, clusterInfo?: ClusterInfo) {
|
||||
this.rowStore = store;
|
||||
this.clusterInfo = clusterInfo;
|
||||
this.opRecords = [];
|
||||
this.events = {
|
||||
commit: [],
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
export type ClusterInfo = {
|
||||
usingCluster: boolean;
|
||||
instanceId?: number;
|
||||
instanceCount?: number;
|
||||
};
|
||||
|
|
@ -23,3 +23,4 @@ export * from './Style';
|
|||
export * from './EntityDesc';
|
||||
export * from './Environment';
|
||||
export * from './Locale';
|
||||
export * from './Cluster';
|
||||
|
|
|
|||
Loading…
Reference in New Issue