This commit is contained in:
Xu Chang 2022-12-09 19:01:36 +08:00
parent 10f0dad7ef
commit d245a42d90
80 changed files with 154 additions and 131 deletions

View File

@ -15,7 +15,7 @@ var checkers = [
type: 'relation',
action: ['play', 'remove', 'disable', 'enable'],
entity: 'user',
relationFilter: function (userId) {
relationFilter: function () {
// 只有root才能进行操作
throw new types_1.OakUserUnpermittedException();
},
@ -62,6 +62,29 @@ var checkers = [
}
},
errMsg: '不能禁用root用户',
},
{
type: 'row',
action: 'select',
entity: 'user',
filter: function (operation, context) {
var systemId = context.getSystemId();
if (systemId) {
return {
id: {
$in: {
entity: 'userSystem',
data: {
userId: 1,
},
filter: {
systemId: systemId,
},
},
},
};
}
},
}
];
exports.default = checkers;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import './index.less';
declare const Empty: () => JSX.Element;
export default Empty;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import './index.less';
declare const Empty: () => JSX.Element;
export default Empty;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import './index.less';
interface QrCodeProps {
id?: string;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { AppType, WebConfig, WechatPublicConfig, WechatMpConfig } from '../../../general-app-domain/Application/Schema';
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebConfig } from '../../../../general-app-domain/Application/Schema';
export default function Web(props: {
config: WebConfig;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WechatMpConfig } from '../../../../general-app-domain/Application/Schema';
export default function WechatMp(props: {
config: WechatMpConfig;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WechatPublicConfig } from '../../../../general-app-domain/Application/Schema';
export default function WechatPublic(props: {
config: WechatPublicConfig;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { Config } from '../../../../types/Config';
export default function Account(props: {
account: Required<Config>['Account'];

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { Config } from '../../../../types/Config';
export default function Cos(props: {
cos: Required<Config>['Cos'];

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { Config } from '../../../../types/Config';
export default function Cos(props: {
live: Required<Config>['Live'];

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { Config } from '../../../../types/Config';
export default function Cos(props: {
map: Required<Config>['Map'];

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { Config } from '../../../types/Config';
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { UploadFile } from 'antd';
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from "oak-frontend-base";
import { EntityDict } from "../../../general-app-domain";
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'address', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../general-app-domain';
import './web.less';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { MessageProps } from 'oak-frontend-base/lib/types/Message';
export default function render(props: {
data: {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'userEntityGrant', true, {

View File

@ -0,0 +1,99 @@
import { String, Text } from "oak-domain/lib/types/DataType";
import { Q_DateValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand";
import { OneOf } from "oak-domain/lib/types/Polyfill";
import * as SubQuery from "../_SubQuery";
import { FormCreateData, FormUpdateData, Operation as OakOperation, MakeAction as OakMakeAction, EntityShape } from "oak-domain/lib/types/Entity";
import { GenericAction } from "oak-domain/lib/actions/action";
export declare type OpSchema = EntityShape & {
name: String<24>;
template: Text;
};
export declare type OpAttr = keyof OpSchema;
export declare type Schema = EntityShape & {
name: String<24>;
template: Text;
} & {
[A in ExpressionKey]?: any;
};
declare type AttrFilter = {
id: Q_StringValue | SubQuery.MessageTypeIdSubQuery;
$$createAt$$: Q_DateValue;
$$seq$$: Q_StringValue;
$$updateAt$$: Q_DateValue;
name: Q_StringValue;
template: Q_StringValue;
};
export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
export declare type Projection = {
"#id"?: NodeId;
[k: string]: any;
id: number;
$$createAt$$?: number;
$$updateAt$$?: number;
$$seq$$?: number;
name?: number;
template?: number;
} & Partial<ExprOp<OpAttr | string>>;
export declare type ExportProjection = {
"#id"?: NodeId;
[k: string]: any;
id?: string;
$$createAt$$?: string;
$$updateAt$$?: string;
$$seq$$?: string;
name?: string;
template?: string;
} & Partial<ExprOp<OpAttr | string>>;
declare type MessageTypeIdProjection = OneOf<{
id: number;
}>;
export declare type SortAttr = {
id: number;
} | {
$$createAt$$: number;
} | {
$$seq$$: number;
} | {
$$updateAt$$: number;
} | {
name: number;
} | {
template: number;
} | {
[k: string]: any;
} | OneOf<ExprOp<OpAttr | string>>;
export declare type SortNode = {
$attr: SortAttr;
$direction?: "asc" | "desc";
};
export declare type Sorter = SortNode[];
export declare type SelectOperation<P extends Object = Projection> = Omit<OakOperation<"select", P, Filter, Sorter>, "id">;
export declare type Selection<P extends Object = Projection> = Omit<SelectOperation<P>, "action">;
export declare type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
export declare type CreateOperationData = FormCreateData<OpSchema>;
export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
export declare type UpdateOperationData = FormUpdateData<OpSchema> & {
[k: string]: any;
};
export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
export declare type RemoveOperationData = {};
export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation | SelectOperation;
export declare type MessageTypeIdSubQuery = Selection<MessageTypeIdProjection>;
export declare type NativeAttr = OpAttr;
export declare type FullAttr = NativeAttr;
export declare type EntityDef = {
Schema: Schema;
OpSchema: OpSchema;
Action: OakMakeAction<GenericAction> | string;
Selection: Selection;
Operation: Operation;
Create: CreateOperation;
Update: UpdateOperation;
Remove: RemoveOperation;
CreateSingle: CreateSingleOperation;
CreateMulti: CreateMultipleOperation;
};
export {};

View File

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -0,0 +1,3 @@
import { StorageDesc } from "oak-domain/lib/types/Storage";
import { OpSchema } from "./Schema";
export declare const desc: StorageDesc<OpSchema>;

View File

@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.desc = void 0;
var action_1 = require("oak-domain/lib/actions/action");
exports.desc = {
attributes: {
name: {
type: "varchar",
params: {
length: 24
}
},
template: {
type: "text"
}
},
actionType: "crud",
actions: action_1.genericActions
};

View File

@ -0,0 +1 @@
{ "attr": { "name": "名称", "template": "模板" } }

3
lib/index.d.ts vendored
View File

@ -8,3 +8,6 @@ export { checkers, triggers, watchers, data, aspectDict, };
export * from './types/Exception';
export { composeFileUrl, decomposeFileUrl } from './utils/extraFile';
export * from './data/DEV-CONFIG';
export * from './context/BackendRuntimeContext';
export * from './context/FrontendRuntimeContext';
export * from './context/RuntimeContext';

View File

@ -18,3 +18,6 @@ var extraFile_1 = require("./utils/extraFile");
Object.defineProperty(exports, "composeFileUrl", { enumerable: true, get: function () { return extraFile_1.composeFileUrl; } });
Object.defineProperty(exports, "decomposeFileUrl", { enumerable: true, get: function () { return extraFile_1.decomposeFileUrl; } });
tslib_1.__exportStar(require("./data/DEV-CONFIG"), exports);
tslib_1.__exportStar(require("./context/BackendRuntimeContext"), exports);
tslib_1.__exportStar(require("./context/FrontendRuntimeContext"), exports);
tslib_1.__exportStar(require("./context/RuntimeContext"), exports);

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'address', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'address', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { AppType, WebConfig, WechatPublicConfig, WechatMpConfig } from '../../../../general-app-domain/Application/Schema';
import { EntityDict } from '../../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebConfig, WechatPublicConfig, WechatMpConfig } from '../../../general-app-domain/Application/Schema';
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'application', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'application', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from './../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'article', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'article', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'article', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import '@wangeditor/editor/dist/css/style.css';
import { EntityDict } from './../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'domain', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'system', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'domain', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'token', false, {

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'mobile', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'area', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { Config } from '../../../../types/Config';
import { EntityDict } from '../../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { Config } from '../../../types/Config';
import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'platform', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'platform', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../../general-app-domain';
import { Config } from '../../../../types/Config';
import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { Config } from '../../../types/Config';
import { WebComponentProps } from 'oak-frontend-base';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'system', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'system', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'token', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'user', true, {

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element;

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'userEntityGrant', true, {

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function Render(props: any): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'userEntityGrant', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'token', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'userEntityGrant', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', true, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', true, {

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element;

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element;

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'mobile', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../general-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'userEntityGrant', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,2 +1 @@
/// <reference types="react" />
export default function render(this: any): JSX.Element;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../general-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'user', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'token', false, {

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
export default function render(props: WebComponentProps<EntityDict, 'token', false, {

View File

@ -4,7 +4,6 @@ var tslib_1 = require("tslib");
var uuid_1 = require("oak-domain/lib/utils/uuid");
var assert_1 = require("oak-domain/lib/utils/assert");
var constants_1 = require("../constants");
var filter_1 = require("oak-domain/lib/store/filter");
var randomUser_1 = require("../utils/randomUser");
var NO_ANY_USER = true;
var triggers = [
@ -147,63 +146,5 @@ var triggers = [
});
}
},
{
name: '查询用户时默认加上systemId',
entity: 'user',
action: 'select',
when: 'before',
fn: function (_a, context) {
var operation = _a.operation;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var app, filter;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, context.getApplication()];
case 1:
app = _b.sent();
if (app) {
filter = operation.filter;
if (!filter) {
Object.assign(operation, {
filter: {
id: {
$in: {
entity: 'userSystem',
data: {
userId: 1,
},
filter: {
systemId: app.systemId,
}
}
}
},
});
}
else {
Object.assign(operation, {
filter: (0, filter_1.addFilterSegment)({
id: {
$in: {
entity: 'userSystem',
data: {
userId: 1,
},
filter: {
systemId: app.systemId,
}
}
}
}, filter),
});
}
return [2 /*return*/, 1];
}
return [2 /*return*/, 0];
}
});
});
}
}
];
exports.default = triggers;