去掉了getRandomValue,否则mocha搞不过去
This commit is contained in:
parent
db9b9fc5f3
commit
dcb2589ccd
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extension": ["ts"],
|
"extension": ["ts"],
|
||||||
"spec": "test/test*.ts",
|
"spec": "test/**/*.ts",
|
||||||
"require": "ts-node/register"
|
"require": "ts-node/register"
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { DeduceCreateSingleOperation, DeduceRemoveOperation, DeduceUpdateOperation, OperationResult, OperateParams, OpRecord, EntityDict, SelectRowShape } from "oak-domain/lib/types/Entity";
|
import { DeduceCreateSingleOperation, DeduceRemoveOperation, DeduceUpdateOperation, OperationResult, OperateParams, OpRecord, EntityDict, SelectionResult } from "oak-domain/lib/types/Entity";
|
||||||
import { CascadeStore } from 'oak-domain/lib/store/CascadeStore';
|
import { CascadeStore } from 'oak-domain/lib/store/CascadeStore';
|
||||||
import { StorageSchema } from 'oak-domain/lib/types/Storage';
|
import { StorageSchema } from 'oak-domain/lib/types/Storage';
|
||||||
import { Context } from "oak-domain/lib/types/Context";
|
import { Context } from "oak-domain/lib/types/Context";
|
||||||
|
|
@ -60,9 +60,7 @@ export default class TreeStore<ED extends EntityDict, Cxt extends Context<ED>> e
|
||||||
operate<T extends keyof ED>(entity: T, operation: ED[T]['Operation'], context: Cxt, params?: OperateParams): Promise<OperationResult>;
|
operate<T extends keyof ED>(entity: T, operation: ED[T]['Operation'], context: Cxt, params?: OperateParams): Promise<OperationResult>;
|
||||||
protected formProjection<T extends keyof ED>(entity: T, row: Partial<ED[T]['OpSchema']>, data: ED[T]['Selection']['data'], result: object, nodeDict: NodeDict, context: Cxt): Promise<void>;
|
protected formProjection<T extends keyof ED>(entity: T, row: Partial<ED[T]['OpSchema']>, data: ED[T]['Selection']['data'], result: object, nodeDict: NodeDict, context: Cxt): Promise<void>;
|
||||||
private formResult;
|
private formResult;
|
||||||
select<T extends keyof ED, S extends ED[T]['Selection']>(entity: T, selection: S, context: Cxt, params?: Object): Promise<{
|
select<T extends keyof ED, S extends ED[T]['Selection']>(entity: T, selection: S, context: Cxt, params?: Object): Promise<SelectionResult<ED[T]['Schema'], S['data']>>;
|
||||||
result: SelectRowShape<ED[T]["Schema"], ED[T]["Selection"]["data"]>[];
|
|
||||||
}>;
|
|
||||||
count<T extends keyof ED>(entity: T, selection: Omit<ED[T]['Selection'], "action" | "data" | "sorter">, context: Cxt, params?: Object): Promise<number>;
|
count<T extends keyof ED>(entity: T, selection: Omit<ED[T]['Selection'], "action" | "data" | "sorter">, context: Cxt, params?: Object): Promise<number>;
|
||||||
private addToTxnNode;
|
private addToTxnNode;
|
||||||
getStat(): {
|
getStat(): {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ const RowStore_1 = require("oak-domain/lib/types/RowStore");
|
||||||
const Demand_2 = require("oak-domain/lib/types/Demand");
|
const Demand_2 = require("oak-domain/lib/types/Demand");
|
||||||
const relation_1 = require("oak-domain/lib/store/relation");
|
const relation_1 = require("oak-domain/lib/store/relation");
|
||||||
const Expression_1 = require("oak-domain/lib/types/Expression");
|
const Expression_1 = require("oak-domain/lib/types/Expression");
|
||||||
const uuid_1 = require("uuid");
|
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
function obscurePass(row, attr, params) {
|
function obscurePass(row, attr, params) {
|
||||||
|
|
@ -934,7 +933,7 @@ class TreeStore extends CascadeStore_1.CascadeStore {
|
||||||
return this.stat;
|
return this.stat;
|
||||||
}
|
}
|
||||||
async begin() {
|
async begin() {
|
||||||
const uuid = (0, uuid_1.v4)({ random: await getRandomValues(16) });
|
const uuid = `${Math.random()}`;
|
||||||
(0, assert_1.default)(!this.activeTxnDict.hasOwnProperty(uuid));
|
(0, assert_1.default)(!this.activeTxnDict.hasOwnProperty(uuid));
|
||||||
(0, lodash_1.assign)(this.activeTxnDict, {
|
(0, lodash_1.assign)(this.activeTxnDict, {
|
||||||
[uuid]: {
|
[uuid]: {
|
||||||
|
|
|
||||||
14
package.json
14
package.json
|
|
@ -5,15 +5,15 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"luxon": "^2.3.0",
|
"luxon": "^2.3.0",
|
||||||
"uuid": "^8.3.2"
|
"uuid": "^8.3.2",
|
||||||
|
"oak-domain": "file:../oak-domain"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"make-domain": "ts-node test/build-app-domain",
|
"make:domain": "ts-node test/build-app-domain",
|
||||||
"test": "mocha",
|
"test": "cross-env TS_NODE_PROJECT='tsconfig.mocha.json' mocha",
|
||||||
"build": "tsc",
|
"build": "tsc"
|
||||||
"postinstall": "npm link oak-domain"
|
|
||||||
},
|
},
|
||||||
"main": "src/index",
|
"main": "src/index",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/cli": "^7.12.13",
|
"@babel/cli": "^7.12.13",
|
||||||
"@babel/core": "^7.12.13",
|
"@babel/core": "^7.12.13",
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
"@types/fs-extra": "^9.0.13",
|
"@types/fs-extra": "^9.0.13",
|
||||||
"@types/lodash": "^4.14.168",
|
"@types/lodash": "^4.14.168",
|
||||||
"@types/mocha": "^8.2.0",
|
"@types/mocha": "^8.2.0",
|
||||||
"@types/node": "^14.14.25",
|
"@types/node": "^14.18.16",
|
||||||
"@types/react": "^17.0.2",
|
"@types/react": "^17.0.2",
|
||||||
"@types/uuid": "^8.3.0",
|
"@types/uuid": "^8.3.0",
|
||||||
"assert": "^2.0.0",
|
"assert": "^2.0.0",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { assign, cloneDeep, get, keys, last, set, unset } from 'lodash';
|
import { assign, cloneDeep, get, keys, last, set, unset } from 'lodash';
|
||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { DeduceCreateSingleOperation, DeduceFilter, DeduceSelection, EntityShape, DeduceRemoveOperation, DeduceUpdateOperation, DeduceSorter, DeduceSorterAttr, OperationResult, OperateParams, OpRecord, DeduceCreateOperationData, DeduceUpdateOperationData, UpdateOpResult, RemoveOpResult, SelectOpResult, EntityDict, SelectRowShape } from "oak-domain/lib/types/Entity";
|
import { DeduceCreateSingleOperation, DeduceFilter, DeduceSelection, EntityShape, DeduceRemoveOperation, DeduceUpdateOperation, DeduceSorter, DeduceSorterAttr, OperationResult, OperateParams, OpRecord, DeduceCreateOperationData, DeduceUpdateOperationData, UpdateOpResult, RemoveOpResult, SelectOpResult, EntityDict, SelectRowShape, SelectionResult } from "oak-domain/lib/types/Entity";
|
||||||
import { ExpressionKey, EXPRESSION_PREFIX, NodeId, RefAttr } from 'oak-domain/lib/types/Demand';
|
import { ExpressionKey, EXPRESSION_PREFIX, NodeId, RefAttr } from 'oak-domain/lib/types/Demand';
|
||||||
import { CascadeStore } from 'oak-domain/lib/store/CascadeStore';
|
import { CascadeStore } from 'oak-domain/lib/store/CascadeStore';
|
||||||
import { StorageSchema } from 'oak-domain/lib/types/Storage';
|
import { StorageSchema } from 'oak-domain/lib/types/Storage';
|
||||||
|
|
@ -1079,7 +1079,7 @@ export default class TreeStore<ED extends EntityDict, Cxt extends Context<ED>> e
|
||||||
entity: T,
|
entity: T,
|
||||||
selection: S,
|
selection: S,
|
||||||
context: Cxt,
|
context: Cxt,
|
||||||
params?: Object) {
|
params?: Object) : Promise<SelectionResult<ED[T]['Schema'], S['data']>> {
|
||||||
let autoCommit = false;
|
let autoCommit = false;
|
||||||
let result;
|
let result;
|
||||||
if (!context.getCurrentTxnId()) {
|
if (!context.getCurrentTxnId()) {
|
||||||
|
|
@ -1136,7 +1136,7 @@ export default class TreeStore<ED extends EntityDict, Cxt extends Context<ED>> e
|
||||||
}
|
}
|
||||||
|
|
||||||
async begin() {
|
async begin() {
|
||||||
const uuid = v4({ random: await getRandomValues(16) })
|
const uuid = `${Math.random()}`;
|
||||||
assert(!this.activeTxnDict.hasOwnProperty(uuid));
|
assert(!this.activeTxnDict.hasOwnProperty(uuid));
|
||||||
assign(this.activeTxnDict, {
|
assign(this.activeTxnDict, {
|
||||||
[uuid]: {
|
[uuid]: {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { unset } from 'lodash';
|
|
||||||
import { analyzeEntities, buildSchema } from 'oak-domain/src/compiler/schemalBuilder';
|
import { analyzeEntities, buildSchema } from 'oak-domain/src/compiler/schemalBuilder';
|
||||||
|
|
||||||
process.env.NODE_ENV = 'development';
|
process.env.NODE_ENV = 'development';
|
||||||
analyzeEntities(`${__dirname}/../../oak-general-business/src/entities`);
|
|
||||||
|
analyzeEntities(`${__dirname}/entities`);
|
||||||
buildSchema(`${__dirname}/app-domain/`);
|
buildSchema(`${__dirname}/app-domain/`);
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { String, Int, Datetime, Image, Boolean, Text } from 'oak-domain/lib/types/DataType';
|
||||||
|
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||||
|
import { Schema as Area } from './Area';
|
||||||
|
|
||||||
|
export interface Schema extends EntityShape {
|
||||||
|
detail: String<32>;
|
||||||
|
area: Area;
|
||||||
|
phone: String<12>;
|
||||||
|
name: String<32>;
|
||||||
|
default: Boolean;
|
||||||
|
remark: Text;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
import { String, Int, Datetime, Image, Boolean, Text } from 'oak-domain/lib/types/DataType';
|
||||||
|
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||||
|
import { Schema as System } from './System';
|
||||||
|
import { Schema as ExtraFile } from './ExtraFile';
|
||||||
|
|
||||||
|
export type WechatMpConfig = {
|
||||||
|
type: 'wechatMp';
|
||||||
|
appId: string;
|
||||||
|
appSecret: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type WebConfig = {
|
||||||
|
type: 'web';
|
||||||
|
domain: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type WechatPublicCofig = {
|
||||||
|
type: 'wechatPublic';
|
||||||
|
appId: string;
|
||||||
|
appSecret: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface Schema extends EntityShape {
|
||||||
|
name: String<32>;
|
||||||
|
description: Text;
|
||||||
|
type: 'web' | 'wechatPublic' | 'wechatMp';
|
||||||
|
system: System;
|
||||||
|
dd: Array<ExtraFile>;
|
||||||
|
config: WebConfig | WechatMpConfig| WechatPublicCofig;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { String, Geo } from 'oak-domain/lib/types/DataType';
|
||||||
|
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||||
|
|
||||||
|
export interface Schema extends EntityShape {
|
||||||
|
name: String<32>;
|
||||||
|
level: 'province' | 'city' | 'district' | 'street' | 'country';
|
||||||
|
depth: 0 | 1 | 2 | 3 | 4;
|
||||||
|
parent?: Schema;
|
||||||
|
code: String<12>;
|
||||||
|
center: Geo;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { String, Int, Text, Image } from 'oak-domain/lib/types/DataType';
|
||||||
|
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||||
|
|
||||||
|
export interface Schema extends EntityShape {
|
||||||
|
origin: 'qiniu';
|
||||||
|
type: 'image' | 'pdf' | 'video' | 'audio' | 'file';
|
||||||
|
bucket: String<16>;
|
||||||
|
objectId: String<64>;
|
||||||
|
tag1: String<16>;
|
||||||
|
tag2: String<16>;
|
||||||
|
filename: String<64>;
|
||||||
|
md5: Text;
|
||||||
|
entity: String<32>;
|
||||||
|
entityId: String<64>;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
import { String, Int, Text, Image } from 'oak-domain/lib/types/DataType';
|
||||||
|
import { Schema as User } from './User';
|
||||||
|
import { Schema as Token } from './Token';
|
||||||
|
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||||
|
|
||||||
|
export interface Schema extends EntityShape {
|
||||||
|
mobile: String<16>;
|
||||||
|
user: User;
|
||||||
|
tokens: Array<Token>;
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||||
|
import { String } from 'oak-domain/lib/types/DataType';
|
||||||
|
|
||||||
|
export interface Schema extends EntityShape {
|
||||||
|
name: String<64>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Relation = 'owner';
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
import { String, Int, Datetime, Image, Boolean, Text } from 'oak-domain/lib/types/DataType';
|
||||||
|
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||||
|
|
||||||
|
export interface Schema extends EntityShape {
|
||||||
|
name: String<32>;
|
||||||
|
description: Text;
|
||||||
|
config: Object;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Relation = 'owner';
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
import { String, Int, Datetime, Image, Boolean } from 'oak-domain/lib/types/DataType';
|
||||||
|
import { Schema as User } from './User';
|
||||||
|
import { Schema as Application } from './Application';
|
||||||
|
import { AbleAction, makeAbleActionDef } from 'oak-domain/lib/actions/action';
|
||||||
|
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||||
|
// https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoSync.html
|
||||||
|
export type WechatMpEnv = {
|
||||||
|
type: 'wechatMp',
|
||||||
|
brand: string; // 设备品牌
|
||||||
|
model: string; // 设备型号
|
||||||
|
pixelRatio: number; // 设备像素比
|
||||||
|
screenWidth: number; // 屏幕宽度
|
||||||
|
screenHeight: number; // 屏幕高度
|
||||||
|
windowWidth: number; // 窗口宽度
|
||||||
|
windowHeight: number; // 窗口高度
|
||||||
|
statusBarHeight: number; // 状态栏高度
|
||||||
|
language: string; // 语言
|
||||||
|
version: string; // 微信版本号
|
||||||
|
system: string; // 操作系统及版本
|
||||||
|
platform: string; // 平台
|
||||||
|
fontSizeSetting: number; // 字体大小
|
||||||
|
SDKVersion: string; // 基础库版本
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export type WebEnv = {
|
||||||
|
type: 'web',
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Environment = WechatMpEnv | WebEnv;
|
||||||
|
|
||||||
|
export interface Schema extends EntityShape {
|
||||||
|
application: Application;
|
||||||
|
entity: String<32>;
|
||||||
|
entityId: String<64>;
|
||||||
|
user?: User;
|
||||||
|
player?: User;
|
||||||
|
env: Environment;
|
||||||
|
};
|
||||||
|
|
||||||
|
type Action = AbleAction;
|
||||||
|
|
||||||
|
const AbleActionDef = makeAbleActionDef('enabled');
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
import { String, Int, Text, Image, Datetime } from 'oak-domain/lib/types/DataType';
|
||||||
|
import { ActionDef } from 'oak-domain/lib/types/Action';
|
||||||
|
import { Index } from 'oak-domain/lib/types/Storage';
|
||||||
|
import { Schema as ExtraFile } from './ExtraFile';
|
||||||
|
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||||
|
|
||||||
|
export interface Schema extends EntityShape {
|
||||||
|
name?: String<16>;
|
||||||
|
nickname?: String<64>;
|
||||||
|
password?: Text;
|
||||||
|
birth?: Datetime;
|
||||||
|
gender?: 'male' | 'female';
|
||||||
|
avatar?: Image;
|
||||||
|
idCardType?: 'ID-Card' | 'passport' | 'Mainland-passport';
|
||||||
|
idNumber?: String<32>;
|
||||||
|
ref?: Schema;
|
||||||
|
files: Array<ExtraFile>;
|
||||||
|
};
|
||||||
|
|
||||||
|
type IdAction = 'verify' | 'accept' | 'reject';
|
||||||
|
type IdState = 'unverified' | 'verified' | 'verifying';
|
||||||
|
const IdActionDef: ActionDef<IdAction, IdState> = {
|
||||||
|
stm: {
|
||||||
|
verify: ['unverified', 'verifying'],
|
||||||
|
accept: [['unverified', 'verifying'], 'verified'],
|
||||||
|
reject: [['verifying', 'verified'], 'unverified'],
|
||||||
|
},
|
||||||
|
is: 'unverified',
|
||||||
|
};
|
||||||
|
|
||||||
|
type UserAction = 'activate' | 'disable' | 'enable' | 'mergeTo' | 'mergeFrom';
|
||||||
|
type UserState = 'shadow' | 'normal' | 'disabled' | 'merged';
|
||||||
|
const UserActionDef: ActionDef<UserAction, UserState> = {
|
||||||
|
stm: {
|
||||||
|
activate: ['shadow', 'normal'],
|
||||||
|
disable: [['normal', 'shadow'], 'disabled'],
|
||||||
|
enable: ['disabled', 'normal'],
|
||||||
|
mergeTo: [['normal', 'shadow'], 'merged'],
|
||||||
|
mergeFrom: ['normal', 'normal'],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
type Action = UserAction | IdAction;
|
||||||
|
|
||||||
|
const indexes: Index<Schema>[] = [
|
||||||
|
{
|
||||||
|
name: 'index_test2',
|
||||||
|
attributes: [
|
||||||
|
{
|
||||||
|
name: 'birth',
|
||||||
|
direction: 'ASC',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'index_test',
|
||||||
|
attributes: [
|
||||||
|
{
|
||||||
|
name: 'name',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'nickname',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
config: {
|
||||||
|
type: 'fulltext',
|
||||||
|
parser: 'ngram',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
import { String, Int, Datetime, Image, Boolean } from 'oak-domain/lib/types/DataType';
|
||||||
|
import { Schema as User } from './User';
|
||||||
|
import { Schema as Application } from './Application';
|
||||||
|
import { Schema as Token } from './Token';
|
||||||
|
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
||||||
|
|
||||||
|
export interface Schema extends EntityShape {
|
||||||
|
origin: 'mp' | 'public';
|
||||||
|
openId?: String<32>;
|
||||||
|
unionId?: String<32>;
|
||||||
|
accessToken?: String<32>;
|
||||||
|
sessionKey?: String<64>;
|
||||||
|
subscribed?: Boolean;
|
||||||
|
subscribedAt?: Datetime;
|
||||||
|
unsubscribedAt?: Datetime;
|
||||||
|
user?: User;
|
||||||
|
application: Application;
|
||||||
|
tokens: Array<Token>;
|
||||||
|
};
|
||||||
68
test/test.ts
68
test/test.ts
|
|
@ -4,7 +4,7 @@ import TreeStore from '../src/store';
|
||||||
import { EntityDict } from './app-domain/EntityDict';
|
import { EntityDict } from './app-domain/EntityDict';
|
||||||
import { storageSchema } from './app-domain/Storage';
|
import { storageSchema } from './app-domain/Storage';
|
||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { CreateSingleOperation } from './app-domain/System/Schema';
|
import { CreateSingleOperation, CreateOperationData } from './app-domain/System/Schema';
|
||||||
import { UniversalContext } from 'oak-domain/lib/store/UniversalContext';
|
import { UniversalContext } from 'oak-domain/lib/store/UniversalContext';
|
||||||
|
|
||||||
describe('基础测试', function () {
|
describe('基础测试', function () {
|
||||||
|
|
@ -20,6 +20,10 @@ describe('基础测试', function () {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
description: 'ttttt',
|
description: 'ttttt',
|
||||||
type: 'web',
|
type: 'web',
|
||||||
|
config: {
|
||||||
|
type: 'web',
|
||||||
|
domain: 'http://www.tt.com',
|
||||||
|
},
|
||||||
system: {
|
system: {
|
||||||
action: 'create',
|
action: 'create',
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -34,6 +38,10 @@ describe('基础测试', function () {
|
||||||
name: 'test2',
|
name: 'test2',
|
||||||
description: 'ttttt2',
|
description: 'ttttt2',
|
||||||
type: 'web',
|
type: 'web',
|
||||||
|
config: {
|
||||||
|
type: 'web',
|
||||||
|
domain: 'http://www.tt.com',
|
||||||
|
},
|
||||||
system: {
|
system: {
|
||||||
action: 'create',
|
action: 'create',
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -159,6 +167,10 @@ describe('基础测试', function () {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
description: 'ttttt',
|
description: 'ttttt',
|
||||||
type: 'web',
|
type: 'web',
|
||||||
|
config: {
|
||||||
|
type: 'web',
|
||||||
|
domain: 'http://www.tt.com',
|
||||||
|
},
|
||||||
system: {
|
system: {
|
||||||
action: 'create',
|
action: 'create',
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -173,6 +185,10 @@ describe('基础测试', function () {
|
||||||
name: 'test2',
|
name: 'test2',
|
||||||
description: 'ttttt2',
|
description: 'ttttt2',
|
||||||
type: 'web',
|
type: 'web',
|
||||||
|
config: {
|
||||||
|
type: 'web',
|
||||||
|
domain: 'http://www.tt.com',
|
||||||
|
},
|
||||||
system: {
|
system: {
|
||||||
action: 'create',
|
action: 'create',
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -237,6 +253,10 @@ describe('基础测试', function () {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
description: 'ttttt',
|
description: 'ttttt',
|
||||||
type: 'web',
|
type: 'web',
|
||||||
|
config: {
|
||||||
|
type: 'web',
|
||||||
|
domain: 'http://www.tt.com',
|
||||||
|
},
|
||||||
system: {
|
system: {
|
||||||
action: 'create',
|
action: 'create',
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -251,6 +271,10 @@ describe('基础测试', function () {
|
||||||
name: 'test2',
|
name: 'test2',
|
||||||
description: 'ttttt2',
|
description: 'ttttt2',
|
||||||
type: 'web',
|
type: 'web',
|
||||||
|
config: {
|
||||||
|
type: 'web',
|
||||||
|
domain: 'http://www.tt.com',
|
||||||
|
},
|
||||||
system: {
|
system: {
|
||||||
action: 'create',
|
action: 'create',
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -355,6 +379,10 @@ describe('基础测试', function () {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
description: 'ttttt',
|
description: 'ttttt',
|
||||||
type: 'web',
|
type: 'web',
|
||||||
|
config: {
|
||||||
|
type: 'web',
|
||||||
|
domain: 'http://www.tt.com',
|
||||||
|
},
|
||||||
system: {
|
system: {
|
||||||
action: 'create',
|
action: 'create',
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -369,6 +397,10 @@ describe('基础测试', function () {
|
||||||
name: 'test2',
|
name: 'test2',
|
||||||
description: 'ttttt2',
|
description: 'ttttt2',
|
||||||
type: 'web',
|
type: 'web',
|
||||||
|
config: {
|
||||||
|
type: 'web',
|
||||||
|
domain: 'http://www.tt.com',
|
||||||
|
},
|
||||||
system: {
|
system: {
|
||||||
action: 'create',
|
action: 'create',
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -455,7 +487,7 @@ describe('基础测试', function () {
|
||||||
name: 'test2',
|
name: 'test2',
|
||||||
description: 'aaaaa',
|
description: 'aaaaa',
|
||||||
config: {},
|
config: {},
|
||||||
application$system: {
|
application$system: [{
|
||||||
action: 'create',
|
action: 'create',
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
|
|
@ -463,16 +495,24 @@ describe('基础测试', function () {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
description: 'ttttt',
|
description: 'ttttt',
|
||||||
type: 'web',
|
type: 'web',
|
||||||
|
config: {
|
||||||
|
type: 'web',
|
||||||
|
domain: 'http://www.tt.com',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
||||||
id: 'aaa2',
|
id: 'aaa2',
|
||||||
name: 'test2',
|
name: 'test2',
|
||||||
description: 'ttttt2',
|
description: 'ttttt2',
|
||||||
type: 'weChatMp',
|
type: 'wechatMp',
|
||||||
|
config: {
|
||||||
|
type: 'web',
|
||||||
|
domain: 'http://www.tt.com',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}]
|
||||||
}
|
}
|
||||||
}, context);
|
}, context);
|
||||||
|
|
||||||
|
|
@ -482,6 +522,7 @@ describe('基础测试', function () {
|
||||||
id: 1,
|
id: 1,
|
||||||
name: 1,
|
name: 1,
|
||||||
application$system: {
|
application$system: {
|
||||||
|
$entity: 'application',
|
||||||
data: {
|
data: {
|
||||||
id: 1,
|
id: 1,
|
||||||
name: 1,
|
name: 1,
|
||||||
|
|
@ -505,7 +546,7 @@ describe('基础测试', function () {
|
||||||
},
|
},
|
||||||
}, context);
|
}, context);
|
||||||
// console.log(systems);
|
// console.log(systems);
|
||||||
assert(systems.result.length === 1);
|
assert(systems.result.length === 1);
|
||||||
const [ system ] = systems.result;
|
const [ system ] = systems.result;
|
||||||
const { application$system: applications } = system;
|
const { application$system: applications } = system;
|
||||||
assert(applications!.length === 2);
|
assert(applications!.length === 2);
|
||||||
|
|
@ -528,7 +569,7 @@ describe('基础测试', function () {
|
||||||
name: 'test2',
|
name: 'test2',
|
||||||
description: 'aaaaa',
|
description: 'aaaaa',
|
||||||
config: {},
|
config: {},
|
||||||
application$system: {
|
application$system: [{
|
||||||
action: 'create',
|
action: 'create',
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
|
|
@ -536,16 +577,24 @@ describe('基础测试', function () {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
description: 'ttttt',
|
description: 'ttttt',
|
||||||
type: 'web',
|
type: 'web',
|
||||||
|
config: {
|
||||||
|
type: 'web',
|
||||||
|
domain: 'http://www.tt.com',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
||||||
id: 'aaa2',
|
id: 'aaa2',
|
||||||
name: 'test2',
|
name: 'test2',
|
||||||
description: 'ttttt2',
|
description: 'ttttt2',
|
||||||
type: 'weChatMp',
|
type: 'wechatMp',
|
||||||
|
config: {
|
||||||
|
type: 'web',
|
||||||
|
domain: 'http://www.tt.com',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}] as CreateOperationData['application$system']
|
||||||
}
|
}
|
||||||
}, context);
|
}, context);
|
||||||
|
|
||||||
|
|
@ -555,6 +604,7 @@ describe('基础测试', function () {
|
||||||
id: 1,
|
id: 1,
|
||||||
name: 1,
|
name: 1,
|
||||||
application$system: {
|
application$system: {
|
||||||
|
$entity: 'application',
|
||||||
data: {
|
data: {
|
||||||
id: 1,
|
id: 1,
|
||||||
name: 1,
|
name: 1,
|
||||||
|
|
@ -577,6 +627,7 @@ describe('基础测试', function () {
|
||||||
id: 1,
|
id: 1,
|
||||||
name: 1,
|
name: 1,
|
||||||
application$system: {
|
application$system: {
|
||||||
|
$entity: 'application',
|
||||||
data: {
|
data: {
|
||||||
id: 1,
|
id: 1,
|
||||||
name: 1,
|
name: 1,
|
||||||
|
|
@ -592,6 +643,7 @@ describe('基础测试', function () {
|
||||||
id: 1,
|
id: 1,
|
||||||
name: 1,
|
name: 1,
|
||||||
application$system: {
|
application$system: {
|
||||||
|
$entity: 'application',
|
||||||
data: {
|
data: {
|
||||||
id: 1,
|
id: 1,
|
||||||
name: 1,
|
name: 1,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
"lib": [
|
"lib": [
|
||||||
"dom",
|
"dom",
|
||||||
"dom.iterable",
|
"dom.iterable",
|
||||||
"esnext"
|
"esnext",
|
||||||
],
|
],
|
||||||
// "lib": [], /* Specify library files to be included in the compilation. */
|
// "lib": [], /* Specify library files to be included in the compilation. */
|
||||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"jsx": "preserve",
|
||||||
|
/* Basic Options */
|
||||||
|
// "incremental": true, /* Enable incremental compilation */
|
||||||
|
"target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
||||||
|
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||||
|
"lib": [
|
||||||
|
"dom",
|
||||||
|
"dom.iterable",
|
||||||
|
"esnext",
|
||||||
|
],
|
||||||
|
// "lib": [], /* Specify library files to be included in the compilation. */
|
||||||
|
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||||
|
// "checkJs": true, /* Report errors in .js files. */
|
||||||
|
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||||
|
"declaration": true, /* Generates corresponding '.d.ts' file. */
|
||||||
|
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
||||||
|
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
||||||
|
// "outFile": "./", /* Concatenate and emit output to single file. */
|
||||||
|
"outDir": "test-lib", /* Redirect output structure to the directory. */
|
||||||
|
// "rootDir": "test", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||||
|
// "composite": true, /* Enable project compilation */
|
||||||
|
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
||||||
|
// "removeComments": true, /* Do not emit comments to output. */
|
||||||
|
// "noEmit": true, /* Do not emit outputs. */
|
||||||
|
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||||
|
"downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
||||||
|
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||||
|
/* Strict Type-Checking Options */
|
||||||
|
"strict": true, /* Enable all strict type-checking options. */
|
||||||
|
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||||
|
// "strictNullChecks": true, /* Enable strict null checks. */
|
||||||
|
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||||
|
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
||||||
|
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
||||||
|
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
||||||
|
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
||||||
|
/* Additional Checks */
|
||||||
|
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
||||||
|
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||||
|
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||||
|
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||||
|
/* Module Resolution Options */
|
||||||
|
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||||
|
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||||
|
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||||
|
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||||
|
"typeRoots": [
|
||||||
|
"./src/typings"
|
||||||
|
], /* List of folders to include type definitions from. */
|
||||||
|
// "types": [], /* Type declaration files to be included in compilation. */
|
||||||
|
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||||
|
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||||
|
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||||
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||||
|
/* Source Map Options */
|
||||||
|
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||||
|
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||||
|
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
||||||
|
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
||||||
|
/* Experimental Options */
|
||||||
|
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||||
|
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||||
|
/* Advanced Options */
|
||||||
|
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"test/**/*"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue