编译lib

This commit is contained in:
Wang Kejun 2022-08-19 02:06:52 +08:00
parent d5e29e6502
commit c91c4f4cc2
783 changed files with 31704 additions and 2 deletions

52
lib/RuntimeContext.d.ts vendored Normal file
View File

@ -0,0 +1,52 @@
import { SelectRowShape } from 'oak-domain/lib/types';
import { UniversalContext } from 'oak-domain/lib/store/UniversalContext';
import { EntityDict } from './general-app-domain';
import { RowStore } from 'oak-domain/lib/types';
declare type AppType = SelectRowShape<EntityDict['application']['Schema'], {
id: 1;
name: 1;
config: 1;
type: 1;
systemId: 1;
system: {
id: 1;
name: 1;
config: 1;
};
}>;
export declare abstract class GeneralRuntimeContext<ED extends EntityDict> extends UniversalContext<ED> {
private applicationId?;
private application?;
private token?;
private rwLockApplication;
constructor(store: RowStore<ED, GeneralRuntimeContext<ED>>, applicationId?: string);
getApplicationId(): string | undefined;
getSystemId(): Promise<string | undefined>;
setToken(token?: string): void;
getApplication(): Promise<SelectRowShape<import("./general-app-domain/Application/Schema").Schema, {
id: 1;
name: 1;
config: 1;
type: 1;
systemId: 1;
system: {
id: 1;
name: 1;
config: 1;
};
}> | undefined>;
setApplication(app: AppType): void;
getToken(): Promise<SelectRowShape<ED["token"]["Schema"], {
id: 1;
userId: 1;
playerId: 1;
}> | undefined>;
getTokenValue(): string | undefined;
toString(): Promise<string>;
protected static fromString(strCxt: string): {
applicationId: any;
scene: any;
token: any;
};
}
export {};

149
lib/RuntimeContext.js Normal file
View File

@ -0,0 +1,149 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GeneralRuntimeContext = void 0;
var tslib_1 = require("tslib");
var UniversalContext_1 = require("oak-domain/lib/store/UniversalContext");
var concurrent_1 = require("oak-domain/lib/utils/concurrent");
var assert_1 = require("oak-domain/lib/utils/assert");
var GeneralRuntimeContext = /** @class */ (function (_super) {
tslib_1.__extends(GeneralRuntimeContext, _super);
function GeneralRuntimeContext(store, applicationId) {
var _this = _super.call(this, store) || this;
_this.rwLockApplication = new concurrent_1.RWLock();
_this.applicationId = applicationId;
if (!applicationId) {
_this.rwLockApplication.acquire('X');
}
return _this;
}
GeneralRuntimeContext.prototype.getApplicationId = function () {
return this.applicationId;
};
GeneralRuntimeContext.prototype.getSystemId = function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var app;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getApplication()];
case 1:
app = _a.sent();
return [2 /*return*/, app === null || app === void 0 ? void 0 : app.systemId];
}
});
});
};
GeneralRuntimeContext.prototype.setToken = function (token) {
this.token = token;
};
GeneralRuntimeContext.prototype.getApplication = function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var result, _a, application;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.rwLockApplication.acquire('X')];
case 1:
_b.sent();
if (!this.application) return [3 /*break*/, 2];
result = this.application;
return [3 /*break*/, 4];
case 2:
if (!this.applicationId) return [3 /*break*/, 4];
return [4 /*yield*/, this.rowStore.select('application', {
data: {
id: 1,
name: 1,
config: 1,
type: 1,
systemId: 1,
system: {
id: 1,
name: 1,
config: 1,
},
},
filter: {
id: this.applicationId,
},
}, this)];
case 3:
_a = tslib_1.__read.apply(void 0, [(_b.sent()).result, 1]), application = _a[0];
result = application;
this.application = application;
_b.label = 4;
case 4:
this.rwLockApplication.release();
return [2 /*return*/, result];
}
});
});
};
GeneralRuntimeContext.prototype.setApplication = function (app) {
(0, assert_1.assert)(!this.application);
this.application = app;
this.applicationId = app.id;
this.rwLockApplication.release();
};
GeneralRuntimeContext.prototype.getToken = function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var tokenValue, _a, token;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
tokenValue = this.token;
if (!tokenValue) return [3 /*break*/, 2];
return [4 /*yield*/, this.rowStore.select('token', {
data: {
id: 1,
userId: 1,
playerId: 1,
},
filter: {
id: tokenValue,
ableState: 'enabled',
}
}, this)];
case 1:
_a = tslib_1.__read.apply(void 0, [(_b.sent()).result, 1]), token = _a[0];
return [2 /*return*/, token];
case 2: return [2 /*return*/];
}
});
});
};
GeneralRuntimeContext.prototype.getTokenValue = function () {
return this.token;
};
GeneralRuntimeContext.prototype.toString = function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var data, scene;
return tslib_1.__generator(this, function (_a) {
data = {
applicationId: this.getApplicationId(),
};
if (this.token) {
Object.assign(data, {
token: this.token,
});
}
scene = this.getScene();
if (scene) {
Object.assign(data, {
scene: scene,
});
}
return [2 /*return*/, JSON.stringify(data)];
});
});
};
GeneralRuntimeContext.fromString = function (strCxt) {
var _a = JSON.parse(strCxt), applicationId = _a.applicationId, scene = _a.scene, token = _a.token;
return {
applicationId: applicationId,
scene: scene,
token: token,
};
};
return GeneralRuntimeContext;
}(UniversalContext_1.UniversalContext));
exports.GeneralRuntimeContext = GeneralRuntimeContext;
;

41
lib/aspects/AspectDict.d.ts vendored Normal file
View File

@ -0,0 +1,41 @@
import { WebEnv, WechatMpEnv } from "../general-app-domain/Token/Schema";
import { AppType } from '../general-app-domain/Application/Schema';
import { EntityDict } from "../general-app-domain";
import { QiniuUploadInfo } from "oak-frontend-base/lib/types/Upload";
import { GeneralRuntimeContext } from "../RuntimeContext";
declare type GeneralAspectDict<ED extends EntityDict, Cxt extends GeneralRuntimeContext<ED>> = {
loginByMobile: (params: {
captcha?: string;
password?: string;
mobile: string;
env: WebEnv | WechatMpEnv;
}, context: Cxt) => Promise<string>;
loginWechat: ({ code, env, }: {
code: string;
env: WebEnv;
}, context: Cxt) => Promise<string>;
loginWechatMp: ({ code, env, }: {
code: string;
env: WechatMpEnv;
}, context: Cxt) => Promise<string>;
syncUserInfoWechatMp: ({ nickname, avatarUrl, encryptedData, iv, signature, }: {
nickname: string;
avatarUrl: string;
encryptedData: string;
iv: string;
signature: string;
}, context: Cxt) => Promise<void>;
getUploadInfo: (params: {
origin: string;
fileName: string;
}, context: Cxt) => Promise<QiniuUploadInfo>;
sendCaptcha: (params: {
mobile: string;
env: WechatMpEnv | WebEnv;
}) => Promise<string>;
getApplication: (params: {
type: AppType;
}, context: Cxt) => Promise<string>;
};
export declare type AspectDict<ED extends EntityDict, Cxt extends GeneralRuntimeContext<ED>> = GeneralAspectDict<ED, Cxt>;
export {};

View File

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

2
lib/aspects/application.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
import { getApplication } from './application.dev';
export { getApplication, };

6
lib/aspects/application.dev.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
import { EntityDict } from "../general-app-domain";
import { AppType } from "../general-app-domain/Application/Schema";
import { GeneralRuntimeContext } from "../RuntimeContext";
export declare function getApplication<ED extends EntityDict, Cxt extends GeneralRuntimeContext<ED>>(params: {
type: AppType;
}, context: Cxt): Promise<string>;

View File

@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getApplication = void 0;
var tslib_1 = require("tslib");
var __1 = require("..");
function getApplication(params, context) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var type, APP_ID, appId, _a, application;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
type = params.type;
APP_ID = {
web: __1.DEV_WEB_APPLICATION_ID,
wechatMp: __1.DEV_WECHATMP_APPLICATION_ID,
wechatPublic: __1.DEV_WECHATPUPLIC_APPLICATION_ID,
};
appId = APP_ID[type];
return [4 /*yield*/, context.rowStore.select('application', {
data: {
id: 1,
name: 1,
config: 1,
type: 1,
systemId: 1,
system: {
id: 1,
name: 1,
config: 1,
}
},
filter: {
id: appId
}
}, context)];
case 1:
_a = tslib_1.__read.apply(void 0, [(_b.sent()).result, 1]), application = _a[0];
return [2 /*return*/, application.id];
}
});
});
}
exports.getApplication = getApplication;

View File

@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getApplication = void 0;
var application_dev_1 = require("./application.dev");
Object.defineProperty(exports, "getApplication", { enumerable: true, get: function () { return application_dev_1.getApplication; } });
console.error('不应该走到这里');

7
lib/aspects/extraFile.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
import { GeneralRuntimeContext } from '../RuntimeContext';
import { EntityDict } from '../general-app-domain';
import { QiniuUploadInfo } from 'oak-frontend-base/lib/types/Upload';
export declare function getUploadInfo<ED extends EntityDict, Cxt extends GeneralRuntimeContext<ED>>(params: {
origin: string;
fileName: string;
}, context: Cxt): Promise<QiniuUploadInfo>;

50
lib/aspects/extraFile.js Normal file
View File

@ -0,0 +1,50 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getUploadInfo = void 0;
var tslib_1 = require("tslib");
var qiniu_1 = tslib_1.__importDefault(require("../utils/externalUpload/qiniu"));
var ExternalUploadClazz = {
qiniu: qiniu_1.default,
};
function getUploadInfo(params, context) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var rowStore, application, _a, type, config, systemId, origin, fileName, _b, system, systemConfig, originConfig, instance, uploadInfo, err_1;
return tslib_1.__generator(this, function (_c) {
switch (_c.label) {
case 0:
rowStore = context.rowStore;
return [4 /*yield*/, context.getApplication()];
case 1:
application = _c.sent();
_a = application, type = _a.type, config = _a.config, systemId = _a.systemId;
origin = params.origin, fileName = params.fileName;
return [4 /*yield*/, rowStore.select('system', {
data: {
id: 1,
config: 1
},
filter: {
id: systemId
}
}, context)];
case 2:
_b = tslib_1.__read.apply(void 0, [(_c.sent()).result, 1]), system = _b[0];
_c.label = 3;
case 3:
_c.trys.push([3, 5, , 6]);
systemConfig = system.config;
originConfig = systemConfig.Cos[origin];
instance = new ExternalUploadClazz[origin](originConfig);
return [4 /*yield*/, instance.getUploadInfo(fileName)];
case 4:
uploadInfo = _c.sent();
return [2 /*return*/, uploadInfo];
case 5:
err_1 = _c.sent();
throw err_1;
case 6: return [2 /*return*/];
}
});
});
}
exports.getUploadInfo = getUploadInfo;

12
lib/aspects/index.d.ts vendored Normal file
View File

@ -0,0 +1,12 @@
import { loginByMobile, loginWechat, loginWechatMp, syncUserInfoWechatMp, sendCaptcha } from './token';
import { getUploadInfo } from './extraFile';
import { getApplication } from './application';
export declare const aspectDict: {
loginByMobile: typeof loginByMobile;
loginWechat: typeof loginWechat;
loginWechatMp: typeof loginWechatMp;
syncUserInfoWechatMp: typeof syncUserInfoWechatMp;
getUploadInfo: typeof getUploadInfo;
sendCaptcha: typeof sendCaptcha;
getApplication: typeof getApplication;
};

17
lib/aspects/index.js Normal file
View File

@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.aspectDict = void 0;
var token_1 = require("./token");
var extraFile_1 = require("./extraFile");
var application_1 = require("./application");
// import commonAspectDict from 'oak-common-aspect';
exports.aspectDict = {
loginByMobile: token_1.loginByMobile,
loginWechat: token_1.loginWechat,
loginWechatMp: token_1.loginWechatMp,
syncUserInfoWechatMp: token_1.syncUserInfoWechatMp,
getUploadInfo: extraFile_1.getUploadInfo,
sendCaptcha: token_1.sendCaptcha,
getApplication: application_1.getApplication,
};
// export type AspectDict<ED extends EntityDict & BaseEntityDict> = TokenAD<ED> & CrudAD<ED>;

45
lib/aspects/token.d.ts vendored Normal file
View File

@ -0,0 +1,45 @@
import { GeneralRuntimeContext } from '../RuntimeContext';
import { EntityDict } from '../general-app-domain';
import { WechatMpConfig } from '../general-app-domain/Application/Schema';
import { WebEnv, WechatMpEnv } from '../general-app-domain/Token/Schema';
export declare function loginByMobile<ED extends EntityDict, Cxt extends GeneralRuntimeContext<ED>>(params: {
captcha?: string;
password?: string;
mobile: string;
env: WebEnv | WechatMpEnv;
}, context: Cxt): Promise<string>;
/**
*
* @param param0
* @param context
*/
export declare function loginWechat<ED extends EntityDict, Cxt extends GeneralRuntimeContext<ED>>({ code, env }: {
code: string;
env: WebEnv;
}, context: Cxt): Promise<string>;
/**
*
* @param param0
* @param context
* @returns
*/
export declare function loginWechatMp<ED extends EntityDict, Cxt extends GeneralRuntimeContext<ED>>({ code, env }: {
code: string;
env: WechatMpEnv;
}, context: Cxt): Promise<string>;
/**
* wx.getUserProfile拿到的用户信息
* @param param0
* @param context
*/
export declare function syncUserInfoWechatMp<ED extends EntityDict, Cxt extends GeneralRuntimeContext<ED>>({ nickname, avatarUrl, encryptedData, iv, signature }: {
nickname: string;
avatarUrl: string;
encryptedData: string;
iv: string;
signature: string;
}, context: Cxt): Promise<void>;
export declare function sendCaptcha<ED extends EntityDict, Cxt extends GeneralRuntimeContext<ED>>({ mobile, env }: {
mobile: string;
env: WechatMpConfig | WebEnv;
}, context: Cxt): Promise<string>;

1075
lib/aspects/token.js Normal file

File diff suppressed because it is too large Load Diff

21
lib/aspects/wechatQrCode.d.ts vendored Normal file
View File

@ -0,0 +1,21 @@
import { EntityDict } from "../general-app-domain";
import { WechatQrCodeProps } from '../general-app-domain/WechatQrCode/Schema';
import { GeneralRuntimeContext } from "../RuntimeContext";
export declare function createWechatQrCode<ED extends EntityDict, T extends keyof ED, Cxt extends GeneralRuntimeContext<ED>>(options: {
entity: T;
entityId: string;
applicationId: string;
tag?: string;
lifetimeLength?: number;
permanent?: boolean;
props: WechatQrCodeProps;
}, context: Cxt): Promise<Omit<Omit<import("../general-app-domain/WechatQrCode/Schema").OpSchema, "applicationId" | "entity" | "entityId">, import("oak-domain/lib/types").InstinctiveAttributes> & {
id: string;
} & {
applicationId: string;
application?: import("../general-app-domain/Application/Schema").UpdateOperation | undefined;
} & {
[K: string]: any;
} & {
[k: string]: any;
}>;

116
lib/aspects/wechatQrCode.js Normal file
View File

@ -0,0 +1,116 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createWechatQrCode = void 0;
var tslib_1 = require("tslib");
var assert_1 = require("oak-domain/lib/utils/assert");
function createWechatQrCode(options, context) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var entity, entityId, applicationId, tag, lifetimeLength, permanent, props, _a, appType, config, qrCodePrefix, id, data, data, id, data, id, data;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
entity = options.entity, entityId = options.entityId, applicationId = options.applicationId, tag = options.tag, lifetimeLength = options.lifetimeLength, permanent = options.permanent, props = options.props;
return [4 /*yield*/, context.getApplication()];
case 1:
_a = (_b.sent()), appType = _a.type, config = _a.config;
if (!(appType === 'wechatMp')) return [3 /*break*/, 7];
qrCodePrefix = config.qrCodePrefix;
return [4 /*yield*/, generateNewId()];
case 2:
id = _b.sent();
if (!qrCodePrefix) return [3 /*break*/, 4];
data = {
id: id,
type: 'wechatMpDomainUrl',
tag: tag,
entity: entity,
entityId: entityId,
applicationId: applicationId,
allowShare: true,
permanent: true,
url: "".concat(qrCodePrefix, "/id"),
expired: false,
props: props,
};
return [4 /*yield*/, context.rowStore.operate('wechatQrCode', {
action: 'create',
data: data,
}, context)];
case 3:
_b.sent();
return [2 /*return*/, data];
case 4:
data = {
id: id,
type: 'wechatMpWxaCode',
tag: tag,
entity: entity,
entityId: entityId,
applicationId: applicationId,
allowShare: true,
permanent: false,
expired: false,
props: props,
};
return [4 /*yield*/, context.rowStore.operate('wechatQrCode', {
action: 'create',
data: data,
}, context)];
case 5:
_b.sent();
return [2 /*return*/, data];
case 6: return [3 /*break*/, 13];
case 7:
if (!(appType === 'wechatPublic')) return [3 /*break*/, 10];
return [4 /*yield*/, generateNewId()];
case 8:
id = _b.sent();
data = {
id: id,
type: 'wechatPublic',
tag: tag,
entity: entity,
entityId: entityId,
applicationId: applicationId,
allowShare: true,
permanent: false,
expired: false,
props: props,
};
return [4 /*yield*/, context.rowStore.operate('wechatQrCode', {
action: 'create',
data: data,
}, context)];
case 9:
_b.sent();
return [2 /*return*/, data];
case 10:
(0, assert_1.assert)(appType === 'web');
return [4 /*yield*/, generateNewId()];
case 11:
id = _b.sent();
data = {
id: id,
type: 'webForWechatPublic',
tag: tag,
entity: entity,
entityId: entityId,
applicationId: applicationId,
allowShare: true,
permanent: false,
expired: false,
props: props,
};
return [4 /*yield*/, context.rowStore.operate('wechatQrCode', {
action: 'create',
data: data,
}, context)];
case 12:
_b.sent();
return [2 /*return*/, data];
case 13: return [2 /*return*/];
}
});
});
}
exports.createWechatQrCode = createWechatQrCode;

5
lib/checkers/address.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
import { Checker } from "oak-domain/lib/types";
import { EntityDict } from '../general-app-domain';
import { GeneralRuntimeContext } from '../RuntimeContext';
declare const checkers: Checker<EntityDict, 'address', GeneralRuntimeContext<EntityDict>>[];
export default checkers;

39
lib/checkers/address.js Normal file
View File

@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var validator_1 = require("oak-domain/lib/utils/validator");
var types_1 = require("oak-domain/lib/types");
var validator_2 = require("oak-domain/lib/utils/validator");
var checkers = [
{
type: 'data',
action: 'create',
entity: 'address',
checker: function (_a) {
var operation = _a.operation;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var action, data;
return tslib_1.__generator(this, function (_b) {
action = operation.action, data = operation.data;
if (data instanceof Array) {
data.forEach(function (ele) {
var a = 'name';
(0, validator_2.checkAttributesNotNull)(ele, ['name', 'detail', 'phone', 'areaId']);
if (!(0, validator_1.isMobile)(ele.phone)) {
throw new types_1.OakInputIllegalException(['phone'], '手机号非法');
}
});
}
else {
(0, validator_2.checkAttributesNotNull)(data, ['name', 'detail', 'phone', 'areaId']);
if (!(0, validator_1.isMobile)(data.phone)) {
throw new types_1.OakInputIllegalException(['phone'], '手机号非法');
}
}
return [2 /*return*/, 0];
});
});
},
}
];
exports.default = checkers;

2
lib/checkers/index.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare const checkers: (import("oak-domain/lib/types").Checker<import("../general-app-domain").EntityDict, "address", import("..").GeneralRuntimeContext<import("../general-app-domain").EntityDict>> | import("oak-domain/lib/types").Checker<import("../general-app-domain").EntityDict, "token", import("..").GeneralRuntimeContext<import("../general-app-domain").EntityDict>> | import("oak-domain/lib/types").Checker<import("../general-app-domain").EntityDict, "user", import("..").GeneralRuntimeContext<import("../general-app-domain").EntityDict>> | import("oak-domain/lib/types").Checker<import("../general-app-domain").EntityDict, "userEntityGrant", import("..").GeneralRuntimeContext<import("../general-app-domain").EntityDict>> | import("oak-domain/lib/types").Checker<import("../general-app-domain").EntityDict, "wechatQrCode", import("..").GeneralRuntimeContext<import("../general-app-domain").EntityDict>>)[];
export default checkers;

12
lib/checkers/index.js Normal file
View File

@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var address_1 = tslib_1.__importDefault(require("./address"));
var token_1 = tslib_1.__importDefault(require("./token"));
var user_1 = tslib_1.__importDefault(require("./user"));
var userEntityGrant_1 = tslib_1.__importDefault(require("./userEntityGrant"));
var wechatQrCode_1 = tslib_1.__importDefault(require("./wechatQrCode"));
var check_1 = require("../utils/check");
var checkers = tslib_1.__spreadArray(tslib_1.__spreadArray(tslib_1.__spreadArray(tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(address_1.default), false), tslib_1.__read(token_1.default), false), tslib_1.__read(user_1.default), false), tslib_1.__read(userEntityGrant_1.default), false), tslib_1.__read(wechatQrCode_1.default), false);
(0, check_1.processCheckers)(checkers);
exports.default = checkers;

5
lib/checkers/token.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
import { Checker } from "oak-domain/lib/types";
import { EntityDict } from '../general-app-domain';
import { GeneralRuntimeContext } from '../RuntimeContext';
declare const checkers: Checker<EntityDict, 'token', GeneralRuntimeContext<EntityDict>>[];
export default checkers;

54
lib/checkers/token.js Normal file
View File

@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var checkers = [
{
type: 'data',
action: 'select',
entity: 'token',
checker: function (_a, context) {
var operation = _a.operation;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
return tslib_1.__generator(this, function (_b) {
/* const scene = context.getScene();
const { filter } = operation;
if (scene === 'token:me') {
if (!filter || !filter.id) {
const token = await context.getToken();
if (!token) {
throw new OakUnloggedInException();
}
const { id } = token;
assign(operation, {
filter: combineFilters([filter, { id }]),
});
return 1;
}
return 0;
}
if (scene === undefined || ['app:onLaunch', 'token:me', 'token:login'].includes(scene)) {
return 0;
}
// 对获取token的权限进行精细化控制除了root
if (filter && filter.id === await context.getTokenValue()) {
return 0;
}
const isRoot = await checkIsRoot(context);
if (!isRoot) {
// 不是root只能访问自己的token
if (!filter) {
throw new OakUserUnpermittedException();
}
assign(operation, {
filter: addFilterSegment(filter, {
id: await context.getTokenValue(),
})
});
} */
return [2 /*return*/, 0];
});
});
},
}
];
exports.default = checkers;

5
lib/checkers/user.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
import { Checker } from "oak-domain/lib/types";
import { EntityDict } from '../general-app-domain';
import { GeneralRuntimeContext } from '../RuntimeContext';
declare const checkers: Checker<EntityDict, 'user', GeneralRuntimeContext<EntityDict>>[];
export default checkers;

83
lib/checkers/user.js Normal file
View File

@ -0,0 +1,83 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var actionDef_1 = require("oak-domain/lib/store/actionDef");
var types_1 = require("oak-domain/lib/types");
var checkers = [
{
type: 'data',
action: 'remove',
entity: 'user',
checker: function (_a, context) {
var operation = _a.operation;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var filter;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
filter = operation.filter;
return [4 /*yield*/, (0, actionDef_1.checkFilterContains)('user', context.rowStore.getSchema(), {
idState: 'shadow',
}, context, filter)];
case 1:
_b.sent();
return [2 /*return*/, 0];
}
});
});
},
},
{
type: 'user',
action: 'play',
entity: 'user',
checker: function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
// 只有root才能play
throw new types_1.OakUserUnpermittedException();
});
}); },
},
{
type: 'data',
action: 'play',
entity: 'user',
checker: function (_a, context) {
var operation = _a.operation;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var token, userId;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, context.getToken()];
case 1:
token = _b.sent();
userId = token.userId;
if (userId === operation.filter.id) {
throw new types_1.OakRowInconsistencyException();
}
return [2 /*return*/, 0];
}
});
});
},
},
{
type: 'data',
action: 'grant',
entity: 'user',
checker: function (_a) {
var operation = _a.operation;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var data;
return tslib_1.__generator(this, function (_b) {
data = operation.data;
if (Object.keys(data).filter(function (ele) { return !ele.includes('$'); }).length > 0) {
throw new types_1.OakInputIllegalException(Object.keys(data), '授权不允许传入其它属性');
}
return [2 /*return*/, 0];
});
});
}
}
];
exports.default = checkers;

5
lib/checkers/userEntityGrant.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
import { Checker } from 'oak-domain/lib/types';
import { EntityDict } from '../general-app-domain';
import { GeneralRuntimeContext } from '../RuntimeContext';
declare const checkers: Checker<EntityDict, 'userEntityGrant', GeneralRuntimeContext<EntityDict>>[];
export default checkers;

View File

@ -0,0 +1,57 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var types_1 = require("oak-domain/lib/types");
var validator_1 = require("oak-domain/lib/utils/validator");
var checkers = [
{
type: 'data',
action: 'create',
entity: 'userEntityGrant',
checker: function (_a, context) {
var operation = _a.operation;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var data;
return tslib_1.__generator(this, function (_b) {
data = operation.data;
if (data instanceof Array) {
data.forEach(function (ele) {
(0, validator_1.checkAttributesNotNull)(ele, ['type', 'entity', 'entityId', 'relation']);
if (!ele.hasOwnProperty('number') || ele.type === 'transfer') {
Object.assign(ele, {
number: 1,
});
}
else {
if (ele.number <= 0) {
throw new types_1.OakInputIllegalException(['number', '分享的权限数量必须大于0']);
}
}
Object.assign(ele, {
confirmed: 0,
});
});
}
else {
(0, validator_1.checkAttributesNotNull)(data, ['type', 'entity', 'entityId', 'relation']);
if (!data.hasOwnProperty('number') || data.type === 'transfer') {
Object.assign(data, {
number: 1,
});
}
else {
if (data.number <= 0) {
throw new types_1.OakInputIllegalException(['number', '分享的权限数量必须大于0']);
}
}
Object.assign(data, {
confirmed: 0,
});
}
return [2 /*return*/, 0];
});
});
},
},
];
exports.default = checkers;

5
lib/checkers/wechatQrCode.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
import { Checker } from 'oak-domain/lib/types';
import { EntityDict } from '../general-app-domain';
import { GeneralRuntimeContext } from '../RuntimeContext';
declare const checkers: Checker<EntityDict, 'wechatQrCode', GeneralRuntimeContext<EntityDict>>[];
export default checkers;

View File

@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var checkers = [
{
type: 'data',
action: 'create',
entity: 'wechatQrCode',
checker: function (_a, context) {
var operation = _a.operation;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
return tslib_1.__generator(this, function (_b) {
return [2 /*return*/, 0];
});
});
},
},
];
exports.default = checkers;

0
lib/components/area/upsert/index.d.ts vendored Normal file
View File

View File

@ -0,0 +1,52 @@
"use strict";
// index.ts
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
OakComponent({
entity: 'area',
isList: false,
formData: function (_a) {
var area = _a.data;
return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_b) {
return [2 /*return*/, ({
name: area === null || area === void 0 ? void 0 : area.name,
})];
});
});
},
});

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1,28 @@
/** index.wxss **/
.page-body {
display: flex;
flex-direction: column;
align-items: stretch;
color: #aaa;
}
.label-bar {
padding: 20rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.label-bar text {
margin-right: 20rpx;
width: 200rpx;
}
.label-bar input {
flex: 1;
}
.usermotto {
margin-top: 200px;
}

View File

@ -0,0 +1,7 @@
<!-- index.wxml -->
<view class="page-body">
<view class="label-bar">
<text>地区名称</text>
<input placeholder="请输入名称" value="{{name}}" type="string" data-path="name" bindinput="setUpdateData" />
</view>
</view>

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var mockId_1 = require("oak-frontend-base/lib/utils/mockId");
var extraFile_1 = require("../../../utils/extraFile");
OakComponent({
entity: 'extraFile',
isList: false,
formData: function (_a) {
var extraFile = _a.data, features = _a.features;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var application, isTmp;
var _b;
return tslib_1.__generator(this, function (_c) {
switch (_c.label) {
case 0: return [4 /*yield*/, features.application.getApplication()];
case 1:
application = _c.sent();
isTmp = (extraFile === null || extraFile === void 0 ? void 0 : extraFile.id) && (0, mockId_1.isMockId)(extraFile.id);
return [2 /*return*/, {
src: extraFile && (0, extraFile_1.composeFileUrl)(extraFile, (_b = application === null || application === void 0 ? void 0 : application.system) === null || _b === void 0 ? void 0 : _b.config),
isTmp: isTmp,
}];
}
});
});
},
properties: {
// 图片显示模式
mode: {
type: String,
value: 'aspectFit',
},
},
});

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1,11 @@
/** index.wxss **/
.image {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
border: 1rpx solid #eee;
border-radius: 4rpx;
}

View File

@ -0,0 +1,2 @@
<!-- index.wxml -->
<image src="{{src}}" mode="{{mode}}" class="image l-class"/>

View File

@ -0,0 +1 @@
export default function render(): JSX.Element;

View File

@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var jsx_runtime_1 = require("react/jsx-runtime");
function render() {
return ((0, jsx_runtime_1.jsx)("div", { children: "react" }));
}
exports.default = render;

View File

@ -0,0 +1,2 @@
declare const _default: string;
export default _default;

View File

@ -0,0 +1,381 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var assert_1 = tslib_1.__importDefault(require("assert"));
var mockId_1 = require("oak-frontend-base/lib/utils/mockId");
var index_1 = tslib_1.__importDefault(require("../../../utils/dialog/index"));
var extraFile_1 = require("../../../utils/extraFile");
exports.default = OakComponent({
entity: 'extraFile',
isList: true,
formData: function (_a) {
var _b, _c;
var files = _a.data, features = _a.features;
return tslib_1.__awaiter(this, void 0, void 0, function () {
var application, number2;
return tslib_1.__generator(this, function (_d) {
switch (_d.label) {
case 0: return [4 /*yield*/, features.application.getApplication()];
case 1:
application = _d.sent();
number2 = this.props.maxNumber;
if (typeof number2 === 'number' &&
(number2 === 0 || (files === null || files === void 0 ? void 0 : files.length) >= number2)) {
return [2 /*return*/, {
files: files,
disableInsert: true,
systemConfig: (_b = application === null || application === void 0 ? void 0 : application.system) === null || _b === void 0 ? void 0 : _b.config,
}];
}
return [2 /*return*/, {
files: files,
disableInsert: false,
systemConfig: (_c = application === null || application === void 0 ? void 0 : application.system) === null || _c === void 0 ? void 0 : _c.config,
}];
}
});
});
},
data: {
selected: -1,
// 根据 size 不同,计算的图片显示大小不同
itemSizePercentage: '',
},
externalClasses: ['l-class', 'l-item-class'],
properties: {
oakFullpath: String,
oakParent: String,
oakPath: String,
maxNumber: {
type: Number,
value: 100,
},
selectCount: {
type: Number,
value: 1,
},
sourceType: {
type: Array,
value: ['album', 'camera'],
},
mediaType: {
type: Array,
value: ['image'],
},
// 图片显示模式
mode: {
type: String,
value: 'aspectFit',
},
// 图片是否可预览
preview: {
type: Boolean,
value: true,
},
// 每行可显示的个数
size: {
type: Number,
value: 3,
},
// 图片是否可预览
disableDelete: {
type: Boolean,
value: false,
},
type: String,
origin: String,
tag1: String,
tag2: String,
entity: String,
},
methods: {
/**
* 获取组件内部节点位置信息单个
* @param component 组件实例
* @param selector {String} css选择器
* @returns boundingClientRect() 回调函数的值
*/
getNodeRectFromComponent: function (component, selector) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, new Promise(function (resolve) {
component
.createSelectorQuery()
.select(selector)
.boundingClientRect(function (res) {
resolve(res);
})
.exec();
})];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
},
/**
// * px 转 rpx
// * @param px 像素值
// */
px2rpx: function (px) {
var windowWidth = wx.getSystemInfoSync().windowWidth;
return (750 / windowWidth) * px;
},
onPick: function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _a, selectCount, mediaType, sourceType, _b, errMsg, tempFiles, err_1;
var _this = this;
return tslib_1.__generator(this, function (_c) {
switch (_c.label) {
case 0:
_a = this.props, selectCount = _a.selectCount, mediaType = _a.mediaType, sourceType = _a.sourceType;
_c.label = 1;
case 1:
_c.trys.push([1, 6, , 7]);
return [4 /*yield*/, wx.chooseMedia({
count: selectCount,
mediaType: mediaType,
sourceType: sourceType,
})];
case 2:
_b = _c.sent(), errMsg = _b.errMsg, tempFiles = _b.tempFiles;
if (!(errMsg !== 'chooseMedia:ok')) return [3 /*break*/, 3];
this.triggerEvent('error', {
level: 'warning',
msg: errMsg,
});
return [3 /*break*/, 5];
case 3: return [4 /*yield*/, Promise.all(tempFiles.map(function (tempExtraFile) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var tempFilePath, thumbTempFilePath, fileType, size, filePath, fileFullName;
return tslib_1.__generator(this, function (_a) {
tempFilePath = tempExtraFile.tempFilePath, thumbTempFilePath = tempExtraFile.thumbTempFilePath, fileType = tempExtraFile.fileType, size = tempExtraFile.size;
filePath = tempFilePath || thumbTempFilePath;
fileFullName = filePath.match(/[^/]+(?!.*\/)/g)[0];
this.pushExtraFile({
name: fileFullName,
fileType: fileType,
size: size,
extra1: filePath,
});
return [2 /*return*/];
});
}); }))];
case 4:
_c.sent();
_c.label = 5;
case 5: return [3 /*break*/, 7];
case 6:
err_1 = _c.sent();
console.error(err_1);
if (err_1.errMsg !== 'chooseMedia:fail cancel') {
this.triggerEvent('error', {
level: 'error',
msg: err_1.errMsg,
});
}
return [3 /*break*/, 7];
case 7: return [2 /*return*/];
}
});
});
},
onWebPick: function (uploadFiles) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _this = this;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, Promise.all(uploadFiles.map(function (uploadFile) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var name, fileType, size, raw;
return tslib_1.__generator(this, function (_a) {
name = uploadFile.name, fileType = uploadFile.type, size = uploadFile.size, raw = uploadFile.raw;
this.pushExtraFile({
name: name,
fileType: fileType,
size: size,
extra1: raw,
});
return [2 /*return*/];
});
}); }))];
case 1:
_a.sent();
return [2 /*return*/];
}
});
});
},
pushExtraFile: function (options) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _a, type, origin, tag1, tag2, entity, name, extra1, fileType, size, extension, filename, ele;
var _b, _c;
var _this = this;
return tslib_1.__generator(this, function (_d) {
switch (_d.label) {
case 0:
_a = this.props, type = _a.type, origin = _a.origin, tag1 = _a.tag1, tag2 = _a.tag2, entity = _a.entity;
name = options.name, extra1 = options.extra1, fileType = options.fileType, size = options.size;
extension = name.substring(name.lastIndexOf('.') + 1);
filename = name.substring(0, name.lastIndexOf('.'));
(0, assert_1.default)(entity, '必须传入entity');
(0, assert_1.default)(origin === 'qiniu', '目前只支持七牛上传'); // 目前只支持七牛上传
_b = {};
_c = {
extra1: extra1,
origin: origin,
type: type || fileType,
tag1: tag1,
tag2: tag2
};
return [4 /*yield*/, generateNewId()];
case 1:
ele = (_b.updateData = (_c.objectId = _d.sent(),
_c.entity = entity,
_c.filename = filename,
_c.size = size,
_c.extension = extension,
_c),
_b.beforeExecute = function (updateData) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var _a, url, bucket;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.features.extraFile.upload(updateData)];
case 1:
_a = _b.sent(), url = _a.url, bucket = _a.bucket;
Object.assign(updateData, {
bucket: bucket,
extra1: null,
});
return [2 /*return*/];
}
});
}); },
_b);
this.pushNode(undefined, ele);
return [2 /*return*/];
}
});
});
},
onItemTapped: function (event) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _a, files, systemConfig, index, imageUrl, urls, detail, result;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = this.state, files = _a.files, systemConfig = _a.systemConfig;
index = event.currentTarget.dataset.index;
imageUrl = (0, extraFile_1.composeFileUrl)(files[index], systemConfig);
urls = files === null || files === void 0 ? void 0 : files.filter(function (ele) { return !!ele; }).map(function (ele) { return (0, extraFile_1.composeFileUrl)(ele, systemConfig); });
detail = {
all: files,
index: index,
urls: urls,
current: imageUrl,
};
this.triggerEvent('tap', detail);
if (!this.props.preview) return [3 /*break*/, 2];
return [4 /*yield*/, wx.previewImage({
urls: urls,
current: imageUrl,
})];
case 1:
result = _b.sent();
this.triggerEvent('preview', detail);
_b.label = 2;
case 2: return [2 /*return*/];
}
});
});
},
onDelete: function (event) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _a, value, index, id, result, confirm_1;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = event.currentTarget.dataset, value = _a.value, index = _a.index;
id = value.id;
if (!(0, mockId_1.isMockId)(id)) return [3 /*break*/, 1];
this.removeNode('', "".concat(index));
return [3 /*break*/, 3];
case 1: return [4 /*yield*/, wx.showModal({
title: '确认删除吗',
content: '删除现有文件',
})];
case 2:
result = _b.sent();
confirm_1 = result.confirm;
if (confirm_1) {
this.removeNode('', "".concat(index));
}
_b.label = 3;
case 3: return [2 /*return*/];
}
});
});
},
onWebDelete: function (value, index) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var id, confirm_2;
var _this = this;
return tslib_1.__generator(this, function (_a) {
id = value.id;
if ((0, mockId_1.isMockId)(id)) {
this.removeNode('', "".concat(index));
}
else {
confirm_2 = index_1.default.confirm({
header: '确认删除当前文件?',
body: '删除后,文件不可恢复',
title: '确认删除当前文件?',
content: '删除后,文件不可恢复',
cancelBtn: '取消',
confirmBtn: '确定',
onConfirm: function () {
_this.removeNode('', "".concat(index));
confirm_2.hide();
},
onCancel: function () {
confirm_2.hide();
},
onClose: function () {
confirm_2.hide();
},
});
}
return [2 /*return*/];
});
});
},
},
observers: {
maxNumber: function () {
this.reRender();
},
/**
* size 属性变化时重新调整图片大小
* @param size 新值
*/
size: function (size) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var res, widthRpx, itemSizePercentage;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!size) {
this.setState({ itemSizePercentage: '' });
return [2 /*return*/];
}
return [4 /*yield*/, this.getNodeRectFromComponent(this, '.file-list__container')];
case 1:
res = _a.sent();
widthRpx = this.px2rpx(res.right - res.left);
itemSizePercentage = (10 / size) * 10 - (20 / widthRpx) * 100 + '%;';
this.setState({ itemSizePercentage: itemSizePercentage });
return [2 /*return*/];
}
});
});
},
},
});

View File

@ -0,0 +1,9 @@
{
"component": true,
"usingComponents": {
"t-icon": "../../../miniprogram_npm/tdesign/icon/icon"
},
"componentGenerics": {
"item": true
}
}

View File

@ -0,0 +1,110 @@
@import "../../../config/styles/_base.less";
@import "../../../config/styles/_mixins.less";
.file-list__container {
position: relative;
display: flex;
flex-wrap: wrap;
}
.file-list__item {
position: relative;
width: 220rpx;
padding-bottom: 220rpx;
height: 0;
}
// size 不同时,对应的图片间距设置
// size 仅支持 1-10
each(range(2, 10), {
@valuePlusOne : @value+1;
.file-list__item--@{value}:nth-of-type(n+@{valuePlusOne}) {
margin-top : 20rpx;
}
.file-list__item--@{value}:not(:nth-of-type(@{value}n+1)) {
margin-left : 20rpx;
}
}) // 当 size 为 null每行会显示 3 张图片
.file-list__item--null:nth-of-type(n+4) {
margin-top: 20rpx;
}
.file-list__item--null:not(:nth-of-type(3n+1)) {
margin-left: 20rpx;
}
.file-list__image {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
border: 1rpx solid #eee;
border-radius: 4rpx;
}
.file-list__item--selected {
width: 100%;
height: 100%;
z-index: 10;
background-color: #000;
filter: Alpha(Opacity=50);
opacity: 0.5;
position: absolute;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;
}
.file-list__remove {
position: absolute;
right: 10rpx;
top: 10rpx;
height: 40rpx;
width: 40rpx;
border-radius: 50%;
background: rgb(0 0 0 / 40%);
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
.file-list__item--add {
border: 1rpx solid #eee;
border-radius: 4rpx;
background-color: white;
}
.file-list__image--add {
visibility: hidden;
position: absolute;
width: 50%;
height: 50%;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
align-items: center;
justify-content: center;
display: flex;
}
.file-list__item-slot-wrapper {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.file-list__item-slot-wrapper:empty+.file-list__image--add {
visibility: visible;
}

View File

@ -0,0 +1,20 @@
<view class="file-list__container l-class">
<block wx:for="{{files}}" wx:key="index">
<block wx:if="{{item}}">
<view class="file-list__item file-list__item--{{size}} l-item-class" style="{{itemSizePercentage?'width:'+itemSizePercentage+'padding-bottom:'+itemSizePercentage:'xxx'}}">
<item data-index="{{index}}" bind:tap="onItemTapped" mode="{{mode}}" oakValue="{{item}}" oakPath="{{index}}" oakParent="{{oakFullpath}}" />
<view wx:if="{{!disableDelete}}" mut-bind:tap="onDelete" class="file-list__remove" data-value="{{item}}" data-index="{{ index }}">
<t-icon name="close" color="#ffffff" size="18" />
</view>
</view>
</block>
</block>
<view class="file-list__item file-list__item--add file-list__item--{{size}} l-item-class" style="{{itemSizePercentage?'width:'+itemSizePercentage+'padding-bottom:'+itemSizePercentage:''}}" wx:if="{{!disableInsert}}" bind:tap="onPick">
<view class="file-list__item-slot-wrapper">
<slot />
</view>
<view class="file-list__image--add">
<t-icon name="add" size="80" />
</view>
</view>
</view>

View File

@ -0,0 +1 @@
export default function render(this: any): JSX.Element;

View File

@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var jsx_runtime_1 = require("react/jsx-runtime");
var tdesign_react_1 = require("tdesign-react");
var extraFile_1 = require("../../../utils/extraFile");
function extraFileToUploadFile(extraFile, systemConfig) {
return Object.assign({}, extraFile, {
url: (0, extraFile_1.composeFileUrl)(extraFile, systemConfig),
name: extraFile.filename,
});
}
function render() {
var _this = this;
var _a = this.props, mediaType = _a.mediaType, _b = _a.maxNumber, maxNumber = _b === void 0 ? 100 : _b, _c = _a.multiple, multiple = _c === void 0 ? true : _c;
var _d = this.state, files = _d.files, systemConfig = _d.systemConfig;
return ((0, jsx_runtime_1.jsx)(tdesign_react_1.Upload, { multiple: multiple, autoUpload: false, max: maxNumber, accept: mediaType, showUploadProgress: false, theme: "image", files: (files || []).map(function (ele) {
return extraFileToUploadFile(ele, systemConfig);
}), onChange: function (uploadFiles) {
var newUploadFiles = (uploadFiles === null || uploadFiles === void 0 ? void 0 : uploadFiles.filter(function (ele) { return !ele.id; })) || [];
_this.onWebPick(newUploadFiles);
}, onRemove: function (_a) {
var file = _a.file, index = _a.index, e = _a.e;
_this.onWebDelete(file, index);
}, onPreview: function (_a) {
var file = _a.file, e = _a.e;
// this.onWebDelete(file, e);
} }));
}
exports.default = render;

View File

View File

@ -0,0 +1,36 @@
"use strict";
Component({
properties: {
actions: Array,
actionDescriptions: Object,
show: {
type: Boolean,
value: false,
}
},
methods: {
onClick: function (touch) {
var index = touch.currentTarget.dataset.index;
var actions = this.data.actions;
var action = actions[index];
this.triggerEvent('click', { action: action });
},
closeDrawer: function () {
this.triggerEvent('close');
}
},
observers: {
actions: function (actions) {
var actionDescriptions = this.data.actionDescriptions;
var actionss = actions.map(function (action) { return actionDescriptions[action]; });
this.setData({ actionss: actionss });
},
},
lifetimes: {
ready: function () {
var _a = this.data, actions = _a.actions, actionDescriptions = _a.actionDescriptions;
var actionss = actions.map(function (action) { return actionDescriptions[action]; });
this.setData({ actionss: actionss });
}
}
});

View File

@ -0,0 +1,10 @@
{
"component": true,
"usingComponents": {
"t-button": "../../../miniprogram_npm/tdesign/button/button",
"t-icon": "../../../miniprogram_npm/tdesign/icon/icon",
"t-popup": "../../../miniprogram_npm/tdesign/popup/popup",
"t-grid": "../../../miniprogram_npm/tdesign/grid/grid",
"t-grid-item": "../../../miniprogram_npm/tdesign/grid/grid-item"
}
}

View File

@ -0,0 +1,55 @@
@import "../../../config/styles/_base.less";
@import "../../../config/styles/_mixins.less";
.grid {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
}
.grid-item {
min-width: 25%;
padding: 20rpx;
display: flex;
flex-direction: column;
justify-content: center;
box-sizing: border-box;
}
.block {
width: 176rpx;
height: 176rpx;
background: #fff;
color: #333;
display: flex;
}
.block--bottom {
width: 100vw;
height: 35vh;
border-top-left-radius: 16rpx;
border-top-right-radius: 16rpx;
}
.btn-box {
display: flex;
flex: 1;
flex-direction: column;
padding: 32rpx;
}
.five-grid {
position: unset;
}
.external-class-content {
padding: 32rpx 0 !important;
}
.image-icon {
width: 96rpx !important;
height: 96rpx !important;
}
.image {
width: 100%;
height: 100%;
}

View File

@ -0,0 +1,13 @@
<t-popup placement="bottom" visible="{{show}}" bind:visible-change="closeDrawer" close-btn="true">
<view class="block block--bottom">
<view class="btn-box">
<t-grid t-class="five-grid" column="{{5}}">
<block wx:for="{{actionss}}" wx:key="index">
<t-grid-item bind:tap="onClick" data-index="{{index}}" text="{{item.label}}" t-class-text="text" t-class-image="image-icon" t-class-content="external-class-content">
<t-icon class="image" name="{{item.icon.name}}" slot="image" />
</t-grid-item>
</block>
</t-grid>
</view>
</view>
</t-popup>

View File

@ -0,0 +1,2 @@
declare const _default: string;
export default _default;

View File

@ -0,0 +1,58 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = OakComponent({
data: {
visible: false,
dialogVisible: false,
},
methods: {
printDebugStore: function () {
console.log(this.features.cache.getFullData());
},
printCachedStore: function () {
console.log(this.features.cache.getCachedData());
},
printRunningTree: function () {
console.log(this.features.runningTree.getRoot());
},
resetInitialData: function () {
this.features.cache.resetInitialData();
},
setVisible: function (visible) {
this.setState({
visible: visible,
});
},
handlePopup: function () {
this.setVisible(true);
},
onVisibleChange: function (e) {
this.setVisible(e.detail.visible);
},
//小程序重置
handleReset: function () {
this.resetInitialData();
var pages = getCurrentPages(); //获取加载的页面
var currentPage = pages[pages.length - 1]; //获取当前页面的对象
var url = currentPage.route; //当前页面url
var options = currentPage.options; //如果要获取url中所带的参数可以查看options
this.redirectTo({
url: url
.replace('/pages', '')
.replace('pages', '')
.replace('/index', ''),
}, options);
this.closeDialog();
},
showDialog: function () {
this.setState({
dialogVisible: true,
});
},
closeDialog: function () {
this.setState({
dialogVisible: false,
});
},
},
});

View File

@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"t-button": "../../../miniprogram_npm/tdesign/button/button",
"t-popup": "../../../miniprogram_npm/tdesign/popup/popup",
"t-dialog": "../../../miniprogram_npm/tdesign/dialog/dialog"
}
}

View File

@ -0,0 +1,35 @@
.btn-popup {
position: fixed !important;
bottom: 10rpx;
// bottom: constant(safe-area-inset-bottom) !important;
// /* 兼容 iOS < 11.2 */
// bottom: env(safe-area-inset-bottom) !important;
right: 45%;
}
.block {
width: 176rpx;
height: 176rpx;
background: #fff;
color: #333;
display: flex;
}
.block--bottom {
width: 100vw;
height: 35vh;
border-top-left-radius: 16rpx;
border-top-right-radius: 16rpx;
}
.btn-box {
display: flex;
flex-direction: row;
padding: 32rpx;
flex-wrap: wrap;
}
.btn-item {
margin-top: 32rpx;
margin-right: 32rpx !important;
}

View File

@ -0,0 +1,12 @@
<t-button bind:tap="handlePopup" t-class="btn-popup" variant="text" theme="primary" icon="chevron-up" shape="circle"></t-button>
<t-popup visible="{{visible}}" bind:visible-change="onVisibleChange" placement="bottom" close-btn="true">
<view class="block block--bottom">
<view class="btn-box">
<t-button bind:tap="printRunningTree" t-class="btn-item" theme="primary" size="small" shape="circle">R</t-button>
<t-button bind:tap="printDebugStore" t-class="btn-item" theme="primary" size="small" shape="circle">S</t-button>
<t-button bind:tap="printCachedStore" t-class="btn-item" theme="primary" size="small" shape="circle">C</t-button>
<t-button bind:tap="showDialog" t-class="btn-item" theme="danger" size="small" shape="circle">Reset</t-button>
</view>
</view>
</t-popup>
<t-dialog visible="{{dialogVisible}}" title="重置数据" content="重置后,原来的数据不可恢复" cancel-btn="取消" confirm-btn="确定" bind:cancel="closeDialog" bind:confirm="handleReset" />

View File

@ -0,0 +1 @@
export default function render(this: any): JSX.Element;

View File

@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var react_1 = tslib_1.__importDefault(require("react"));
var tdesign_react_1 = require("tdesign-react");
var tdesign_icons_react_1 = require("tdesign-icons-react");
function render() {
var _this = this;
var _a = this.props, _b = _a.placement, placement = _b === void 0 ? 'bottom' : _b, _c = _a.style, style = _c === void 0 ? {} : _c;
var visible = this.state.visible;
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(tdesign_react_1.Button, { variant: "text", shape: "circle", theme: "primary", icon: (0, jsx_runtime_1.jsx)(tdesign_icons_react_1.ChevronUpIcon, {}), style: tslib_1.__assign({ position: 'fixed', bottom: 0, right: '45vw' }, style), onClick: function () {
_this.setVisible(true);
} }), (0, jsx_runtime_1.jsx)(tdesign_react_1.Drawer, tslib_1.__assign({ placement: placement, visible: visible, onClose: function () {
_this.setVisible(false);
}, header: "Debug\u63A7\u5236\u53F0", footer: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}) }, { children: (0, jsx_runtime_1.jsxs)(tdesign_react_1.Space, tslib_1.__assign({ breakLine: true, direction: "horizontal", size: "medium" }, { children: [(0, jsx_runtime_1.jsx)(tdesign_react_1.Button, tslib_1.__assign({ theme: "primary", shape: "circle", onClick: function () { return _this.printRunningTree(); } }, { children: "R" })), (0, jsx_runtime_1.jsx)(tdesign_react_1.Button, tslib_1.__assign({ theme: "primary", shape: "circle", onClick: function () { return _this.printDebugStore(); } }, { children: "S" })), (0, jsx_runtime_1.jsx)(tdesign_react_1.Button, tslib_1.__assign({ theme: "primary", shape: "circle", onClick: function () { return _this.printCachedStore(); } }, { children: "C" })), (0, jsx_runtime_1.jsx)(tdesign_react_1.Button, tslib_1.__assign({ theme: "warning", shape: "circle", onClick: function () {
var confirmDia = tdesign_react_1.DialogPlugin.confirm({
header: '重置数据',
body: '重置后,原来的数据不可恢复',
confirmBtn: '确定',
cancelBtn: '取消',
onConfirm: function (_a) {
var e = _a.e;
_this.resetInitialData();
confirmDia.hide();
window.location.reload();
},
onClose: function (_a) {
var e = _a.e, trigger = _a.trigger;
confirmDia.hide();
},
});
} }, { children: "Reset" }))] })) }))] }));
}
exports.default = render;

2
lib/components/message/index.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare const _default: string;
export default _default;

View File

@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var message_1 = tslib_1.__importDefault(require("../../utils/message"));
exports.default = OakComponent({
formData: function (_a) {
var props = _a.props;
return tslib_1.__awaiter(this, void 0, void 0, function () {
var width, data, self_1;
return tslib_1.__generator(this, function (_b) {
width = props.width;
data = this.consumeMessage();
if (data) {
self_1 = this;
message_1.default[data.type](Object.assign({}, width === 'xs' && {
//处理mobile
icon: true,
}, process.env.OAK_PLATFORM === 'wechatMp' && {
// 处理小程序
offset: [20, 32],
icon: true,
context: self_1,
}, data));
}
return [2 /*return*/, {}];
});
});
},
});

View File

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"t-message": "../../miniprogram_npm/tdesign/message/message"
}
}

View File

@ -0,0 +1,52 @@
@import "../../config/styles/_base.less";
@import "../../config/styles/_mixins.less";
.o-message {
width: 750rpx;
height: 0;
border-radius: 0rpx 0rpx 16rpx 16rpx;
display: flex;
justify-content: center;
align-items: center;
position: fixed;
left: 50%;
font-size: 28rpx;
color: #fff;
opacity: 0;
box-shadow: 0rpx 6rpx 16rpx 0rpx rgb(217 212 191 / 50%);
transform: translateX(-50%) translateZ(0) translateY(-100%);
transition: all 0.4s ease-in-out;
&-success {
background-color: @success-color;
}
&-error {
background-color: @error-color;
}
&-warning {
background-color: @warning-color;
color: #333;
}
&-info {
background-color: @primary-color;
}
&-loading {
background-color: @primary-color;
}
}
.o-message-show {
transform: translateX(-50%) translateZ(0) translateY(0);
height: 72rpx;
opacity: 1;
}
.o-message-image {
width: 30rpx;
height: 30rpx;
margin-right: 15rpx;
}

View File

@ -0,0 +1,2 @@
<t-message id="t-message" />

1
lib/components/message/web.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export default function render(): null;

View File

@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function render() {
return null;
}
exports.default = render;

View File

@ -0,0 +1 @@
@import "../../miniprogram_npm/tdesign/common/style/_variables.less";

View File

@ -0,0 +1,7 @@
// 解决全屏幕机型底部适配问题
.safe-area-inset-bottom() {
padding-bottom: constant(safe-area-inset-bottom) !important; /* 兼容 iOS < 11.2 */
padding-bottom: env(safe-area-inset-bottom) !important; /* 兼容 iOS >= 11.2 */
}

9
lib/constants.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
export declare const ROOT_ROLE_ID = "oak-root-role";
export declare const ROOT_USER_ID = "oak-root-user";
export declare const ROOT_MOBILE_ID = "oak-root-mobile";
export declare const ROOT_TOKEN_ID = "oak-root-token";
export declare const DefaultConfig: {
userEntityGrant: {
lifetimeLength: number;
};
};

12
lib/constants.js Normal file
View File

@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultConfig = exports.ROOT_TOKEN_ID = exports.ROOT_MOBILE_ID = exports.ROOT_USER_ID = exports.ROOT_ROLE_ID = void 0;
exports.ROOT_ROLE_ID = 'oak-root-role';
exports.ROOT_USER_ID = 'oak-root-user';
exports.ROOT_MOBILE_ID = 'oak-root-mobile';
exports.ROOT_TOKEN_ID = 'oak-root-token';
exports.DefaultConfig = {
userEntityGrant: {
lifetimeLength: 3600 * 1000,
},
};

5
lib/data/DEV-ID.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
export declare const DEV_WECHATMP_APPLICATION_ID = "MY_DEV_WECHATMP_APPLICATION_ID";
export declare const DEV_WEB_APPLICATION_ID = "MY_DEV_WEB_APPLICATION_ID";
export declare const DEV_WECHATPUPLIC_APPLICATION_ID = "MY_DEV_WECHATPUPLIC_APPLICATION_ID";
export declare const DEV_DOMAIN_ID = "MY_DEV_DOMAIN_ID";
export declare const DEV_SYSTEM_ID = "MY_DEV_SYSTEM_ID";

8
lib/data/DEV-ID.js Normal file
View File

@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEV_SYSTEM_ID = exports.DEV_DOMAIN_ID = exports.DEV_WECHATPUPLIC_APPLICATION_ID = exports.DEV_WEB_APPLICATION_ID = exports.DEV_WECHATMP_APPLICATION_ID = void 0;
exports.DEV_WECHATMP_APPLICATION_ID = 'MY_DEV_WECHATMP_APPLICATION_ID';
exports.DEV_WEB_APPLICATION_ID = 'MY_DEV_WEB_APPLICATION_ID';
exports.DEV_WECHATPUPLIC_APPLICATION_ID = 'MY_DEV_WECHATPUPLIC_APPLICATION_ID';
exports.DEV_DOMAIN_ID = 'MY_DEV_DOMAIN_ID';
exports.DEV_SYSTEM_ID = 'MY_DEV_SYSTEM_ID';

1
lib/data/area-debug.json Normal file

File diff suppressed because one or more lines are too long

35
lib/data/area.d.ts vendored Normal file
View File

@ -0,0 +1,35 @@
declare const area: ({
code: string;
level: string;
parentId: null;
name: string;
depth: number;
id: string;
center: {
type: string;
coordinate: number[];
};
} | {
code: string;
level: string;
parentId: string;
name: string;
depth: number;
id: string;
center: {
type: string;
coordinate: number[];
};
} | {
code: number;
level: string;
parentId: string;
name: string;
depth: number;
id: number;
center: {
type: string;
coordinate: number[];
};
})[];
export { area, };

8
lib/data/area.js Normal file
View File

@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.area = void 0;
var tslib_1 = require("tslib");
// import area2 from './area.json';
var area_debug_json_1 = tslib_1.__importDefault(require("./area-debug.json"));
var area = area_debug_json_1.default;
exports.area = area;

41
lib/data/index.d.ts vendored Normal file
View File

@ -0,0 +1,41 @@
declare const _default: {
user: import("../general-app-domain/User/Schema").CreateOperationData[];
role: import("../general-app-domain/Role/Schema").CreateOperationData[];
mobile: import("../general-app-domain/Mobile/Schema").CreateOperationData[];
token: import("../general-app-domain/Token/Schema").CreateOperationData[];
area: ({
code: string;
level: string;
parentId: null;
name: string;
depth: number;
id: string;
center: {
type: string;
coordinate: number[];
};
} | {
code: string;
level: string;
parentId: string;
name: string;
depth: number;
id: string;
center: {
type: string;
coordinate: number[];
};
} | {
code: number;
level: string;
parentId: string;
name: string;
depth: number;
id: number;
center: {
type: string;
coordinate: number[];
};
})[];
};
export default _default;

11
lib/data/index.js Normal file
View File

@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var userRole_1 = require("./userRole");
var area_1 = require("./area");
exports.default = {
user: userRole_1.users,
role: userRole_1.roles,
mobile: userRole_1.mobiles,
token: userRole_1.tokens,
area: area_1.area,
};

8
lib/data/userRole.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
import { CreateOperationData as UserCreate } from '../general-app-domain/User/Schema';
import { CreateOperationData as RoleCreate } from '../general-app-domain/Role/Schema';
import { CreateOperationData as MobileCreate } from '../general-app-domain/Mobile/Schema';
import { CreateOperationData as TokenCreate } from '../general-app-domain/Token/Schema';
export declare const users: Array<UserCreate>;
export declare const roles: Array<RoleCreate>;
export declare const mobiles: Array<MobileCreate>;
export declare const tokens: Array<TokenCreate>;

48
lib/data/userRole.js Normal file
View File

@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.tokens = exports.mobiles = exports.roles = exports.users = void 0;
var constants_1 = require("../constants");
var DEV_ID_1 = require("./DEV-ID");
exports.users = [
{
password: 'oak@2022',
nickname: 'root',
name: 'root',
id: constants_1.ROOT_USER_ID,
systemId: DEV_ID_1.DEV_SYSTEM_ID,
}
];
exports.roles = [
{
name: 'root',
id: constants_1.ROOT_ROLE_ID,
}
];
exports.mobiles = [
{
mobile: '13000000000',
id: constants_1.ROOT_MOBILE_ID,
userId: constants_1.ROOT_USER_ID,
}
];
exports.tokens = [
{
entity: 'mobile',
entityId: constants_1.ROOT_MOBILE_ID,
id: constants_1.ROOT_TOKEN_ID,
env: {
type: 'server',
},
userId: constants_1.ROOT_USER_ID,
playerId: constants_1.ROOT_USER_ID,
}
];
// 由触发器默认创建
/* export const userRoles: Array<UserRoleCreate> = [
{
userId: ROOT_USER_ID,
roleId: ROOT_ROLE_ID,
relation: 'owner',
id: 'root_user_role',
}
]; */

11
lib/entities/Address.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
import { String, 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;
}

15
lib/entities/Address.js Normal file
View File

@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
;
var locale = {
zh_CN: {
attr: {
detail: '详情',
area: '所在地区',
phone: '联系电话',
name: '姓名',
default: '是否默认',
remark: '备注',
},
},
};

27
lib/entities/Application.d.ts vendored Normal file
View File

@ -0,0 +1,27 @@
import { String, Text } from 'oak-domain/lib/types/DataType';
import { EntityShape } from 'oak-domain/lib/types/Entity';
import { Schema as System } from './System';
export declare type AppType = 'web' | 'wechatMp' | 'wechatPublic';
export declare type WechatMpConfig = {
type: 'wechatMp';
appId: string;
appSecret: string;
qrCodePrefix?: string;
};
export declare type WebConfig = {
type: 'web';
appId?: string;
appSecret?: string;
};
export declare type WechatPublicConfig = {
type: 'wechatPublic';
appId: string;
appSecret: string;
};
export interface Schema extends EntityShape {
name: String<32>;
description: Text;
type: AppType;
system: System;
config: WebConfig | WechatMpConfig | WechatPublicConfig;
}

View File

@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
;
var locale = {
zh_CN: {
attr: {
description: '描述',
type: '类型',
system: '系统',
name: '名称',
config: '设置',
},
v: {
type: {
web: '网站',
wechatPublic: '微信公众号',
wechatMp: '微信小程序',
}
}
},
};

10
lib/entities/Area.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
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;
}

24
lib/entities/Area.js Normal file
View File

@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
;
var locale = {
zh_CN: {
attr: {
level: '层级',
depth: '深度',
parent: '上级地区',
name: '名称',
code: '地区编码',
center: '中心坐标',
},
v: {
level: {
country: '国家',
province: '省',
city: '市',
district: '区',
street: '街道',
}
}
},
};

11
lib/entities/Captcha.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
import { EntityShape } from 'oak-domain/lib/types/Entity';
import { String, Text, Boolean, Datetime } from 'oak-domain/lib/types/DataType';
export interface Schema extends EntityShape {
mobile: String<11>;
code: String<4>;
visitorId: Text;
reason?: Text;
env: Object;
expired: Boolean;
expiresAt: Datetime;
}

57
lib/entities/Captcha.js Normal file
View File

@ -0,0 +1,57 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
;
var IActionDef = {
stm: {
send: ['unsent', 'sending'],
success: ['sending', 'sent'],
fail: ['sending', 'failure'],
},
is: 'unsent',
};
var indexes = [
{
name: 'index_mobile_code',
attributes: [
{
name: 'mobile',
direction: 'ASC',
},
{
name: 'code',
direction: 'ASC',
},
{
name: '$$createAt$$',
direction: 'DESC',
}
],
},
];
var locale = {
zh_CN: {
attr: {
mobile: '手机号',
code: '验证码',
visitorId: '用户标识',
reason: '失败原因',
env: '用户环境',
expired: '是否过期',
expiresAt: '过期时间',
iState: '状态',
},
action: {
send: '发送',
fail: '失败',
success: '成功',
},
v: {
iState: {
unsent: '未发送',
sending: '发送中',
sent: '已发送',
failure: '已失败',
}
},
},
};

10
lib/entities/Domain.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
import { String, Int } from 'oak-domain/lib/types/DataType';
import { EntityShape } from 'oak-domain/lib/types/Entity';
import { Schema as System } from './System';
export interface Schema extends EntityShape {
url: String<64>;
apiPath: String<32>;
protocol: 'http' | 'https';
port: Int<2>;
system: System;
}

20
lib/entities/Domain.js Normal file
View File

@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
;
var locale = {
zh_CN: {
attr: {
url: '域名',
apiPath: 'api路径',
protocol: '协议',
port: '端口',
system: '系统',
},
v: {
protocol: {
http: 'http',
https: 'https',
}
}
},
};

9
lib/entities/Email.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
import { String } 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 {
email: String<16>;
user: User;
tokens: Array<Token>;
}

40
lib/entities/Email.js Normal file
View File

@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var action_1 = require("oak-domain/lib/actions/action");
;
var AbleActionDef = (0, action_1.makeAbleActionDef)('enabled');
var indexes = [
{
name: 'index_email_ableState',
attributes: [
{
name: 'email',
direction: 'ASC',
},
{
name: 'ableState',
direction: 'ASC',
}
],
},
];
var locale = {
zh_CN: {
attr: {
ableState: '是否可用',
email: '邮箱',
user: '关联用户',
tokens: '相关令牌',
},
action: {
enable: '启用',
disable: '禁用',
},
v: {
ableState: {
enabled: '可用的',
disabled: '禁用的',
}
}
},
};

17
lib/entities/ExtraFile.d.ts vendored Normal file
View File

@ -0,0 +1,17 @@
import { String, Int, Text } from 'oak-domain/lib/types/DataType';
import { FileCarrierEntityShape } from 'oak-domain/lib/types/Entity';
export interface Schema extends FileCarrierEntityShape {
origin: 'qiniu' | 'unknown';
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>;
extra1?: Text;
extension: String<16>;
size?: Int<4>;
}

35
lib/entities/ExtraFile.js Normal file
View File

@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
;
var locale = {
zh_CN: {
attr: {
origin: '源',
type: '类型',
bucket: '桶',
objectId: '对象编号',
tag1: '标签一',
tag2: '标签二',
filename: '文件名',
md5: "md5",
entity: '关联对象',
entityId: '关联对象id',
extra1: '额外信息',
extension: '后缀名',
size: '体积',
},
v: {
origin: {
qiniu: '七牛云',
unknown: '未知',
},
type: {
image: '图像',
pdf: 'pdf',
video: '视频',
audio: '音频',
file: '文件',
}
}
},
};

9
lib/entities/Mobile.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
import { String } 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>;
}

40
lib/entities/Mobile.js Normal file
View File

@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var action_1 = require("oak-domain/lib/actions/action");
;
var AbleActionDef = (0, action_1.makeAbleActionDef)('enabled');
var indexes = [
{
name: 'index_mobile_ableState',
attributes: [
{
name: 'mobile',
direction: 'ASC',
},
{
name: 'ableState',
direction: 'ASC',
}
],
},
];
var locale = {
zh_CN: {
attr: {
ableState: '是否可用',
mobile: '手机号',
user: '关联用户',
tokens: '相关令牌',
},
action: {
enable: '启用',
disable: '禁用',
},
v: {
ableState: {
enabled: '可用的',
disabled: '禁用的',
}
}
},
};

6
lib/entities/Role.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
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 declare type Relation = 'owner';

13
lib/entities/Role.js Normal file
View File

@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
;
var locale = {
zh_CN: {
attr: {
name: '名称',
},
r: {
owner: '所有者',
}
},
};

28
lib/entities/System.d.ts vendored Normal file
View File

@ -0,0 +1,28 @@
import { String, Text } from 'oak-domain/lib/types/DataType';
import { EntityShape } from 'oak-domain/lib/types/Entity';
export declare type SystemConfig = {
Cos?: {
qiniu?: {
accessKey: string;
secretKey: string;
uploadHost: string;
bucket: string;
domain: string;
protocol: string | string[];
};
};
Map?: {
amap?: {
webApiKey: string;
};
};
UserEntityGrant?: {
lifetimeLength: number;
};
};
export interface Schema extends EntityShape {
name: String<32>;
description: Text;
config: SystemConfig;
}
export declare type Relation = 'owner';

15
lib/entities/System.js Normal file
View File

@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
;
var locale = {
zh_CN: {
attr: {
name: '名称',
description: '描述',
config: '设置',
},
r: {
owner: '所有者',
}
},
};

49
lib/entities/Token.d.ts vendored Normal file
View File

@ -0,0 +1,49 @@
import { String } from 'oak-domain/lib/types/DataType';
import { Schema as User } from './User';
import { Schema as Application } from './Application';
import { EntityShape } from 'oak-domain/lib/types/Entity';
export declare 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 declare type WebEnv = {
type: 'web';
visitorId: string;
platform: {
value: string;
};
timezone: {
value: string;
};
vendor: {
value: string;
};
vendorFlavors: {
value: string[];
};
};
export declare type ServerEnv = {
type: 'server';
};
export declare type Environment = WechatMpEnv | WebEnv | ServerEnv;
export interface Schema extends EntityShape {
application?: Application;
entity: String<32>;
entityId: String<64>;
user?: User;
player?: User;
env: Environment;
}

Some files were not shown because too many files have changed in this diff Show More