打包优化
This commit is contained in:
parent
390903eaef
commit
d4542c7b47
|
|
@ -1,4 +1,4 @@
|
|||
import { isMockId } from 'oak-frontend-base/src/utils/mockId';
|
||||
import { isMockId } from 'oak-frontend-base/lib/utils/mockId';
|
||||
import { composeFileUrl } from '../../../../src/utils/extraFile';
|
||||
OakComponent(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import assert from 'assert';
|
||||
import { EntityDict } from 'general-app-domain';
|
||||
import { DeduceCreateOperationData } from "oak-domain/lib/types";
|
||||
import { isMockId } from "oak-frontend-base/src/utils/mockId";
|
||||
import { isMockId } from "oak-frontend-base/lib/utils/mockId";
|
||||
import { composeFileUrl } from '../../../../src/utils/extraFile';
|
||||
|
||||
export default OakComponent({
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
// },
|
||||
// });
|
||||
|
||||
import { NotificationProps } from 'oak-frontend-base';
|
||||
import { NotificationProps } from 'oak-frontend-base/lib/types/Notification';
|
||||
import Message from '../../utils/message';
|
||||
|
||||
export default OakComponent({
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { MakeOakComponent, MakeOakPage } from 'oak-frontend-base/src/page.mp';
|
||||
import { MakeOakComponent, MakeOakPage } from 'oak-frontend-base/lib/page.mp';
|
||||
import { EntityDict } from 'general-app-domain';
|
||||
import { GeneralRuntimeContext } from '../../src/RuntimeContext';
|
||||
import { aspectDict } from '../../src/aspects';
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.GeneralRuntimeContext = void 0;
|
||||
const UniversalContext_1 = require("oak-domain/lib/store/UniversalContext");
|
||||
const lodash_1 = require("lodash");
|
||||
const concurrent_1 = require("oak-domain/lib/utils/concurrent");
|
||||
const assert_1 = __importDefault(require("assert"));
|
||||
const assert_1 = require("oak-domain/lib/utils/assert");
|
||||
class GeneralRuntimeContext extends UniversalContext_1.UniversalContext {
|
||||
applicationId;
|
||||
application;
|
||||
|
|
@ -62,7 +58,7 @@ class GeneralRuntimeContext extends UniversalContext_1.UniversalContext {
|
|||
return result;
|
||||
}
|
||||
setApplication(app) {
|
||||
(0, assert_1.default)(!this.application);
|
||||
(0, assert_1.assert)(!this.application);
|
||||
this.application = app;
|
||||
this.applicationId = app.id;
|
||||
this.rwLockApplication.release();
|
||||
|
|
@ -92,13 +88,13 @@ class GeneralRuntimeContext extends UniversalContext_1.UniversalContext {
|
|||
applicationId: this.getApplicationId(),
|
||||
};
|
||||
if (this.token) {
|
||||
(0, lodash_1.assign)(data, {
|
||||
Object.assign(data, {
|
||||
token: this.token,
|
||||
});
|
||||
}
|
||||
const scene = this.getScene();
|
||||
if (scene) {
|
||||
(0, lodash_1.assign)(data, {
|
||||
Object.assign(data, {
|
||||
scene,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
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/src/types/Upload";
|
||||
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: {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ const token_1 = require("./token");
|
|||
const extraFile_1 = require("./extraFile");
|
||||
const application_1 = require("./application");
|
||||
// import commonAspectDict from 'oak-common-aspect';
|
||||
const lodash_1 = require("lodash");
|
||||
exports.aspectDict = (0, lodash_1.assign)({
|
||||
exports.aspectDict = {
|
||||
loginByMobile: token_1.loginByMobile,
|
||||
loginMp: token_1.loginMp,
|
||||
loginWechatMp: token_1.loginWechatMp,
|
||||
|
|
@ -14,5 +13,5 @@ exports.aspectDict = (0, lodash_1.assign)({
|
|||
getUploadInfo: extraFile_1.getUploadInfo,
|
||||
sendCaptcha: token_1.sendCaptcha,
|
||||
getApplication: application_1.getApplication,
|
||||
} /* , commonAspectDict */);
|
||||
};
|
||||
// export type AspectDict<ED extends EntityDict & BaseEntityDict> = TokenAD<ED> & CrudAD<ED>;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sendCaptcha = exports.syncUserInfoWechatMp = exports.loginWechatMp = exports.loginByMobile = exports.loginMp = void 0;
|
||||
const oak_external_sdk_1 = require("oak-external-sdk");
|
||||
const assert_1 = __importDefault(require("assert"));
|
||||
const lodash_1 = require("lodash");
|
||||
const assert_1 = require("oak-domain/lib/utils/assert");
|
||||
const lodash_1 = require("oak-domain/lib/utils/lodash");
|
||||
const types_1 = require("oak-domain/lib/types");
|
||||
const extraFile_1 = require("../utils/extraFile");
|
||||
const Exceptions_1 = require("../types/Exceptions");
|
||||
|
|
@ -42,7 +39,7 @@ async function makeDistinguishException(userId, context) {
|
|||
id: userId,
|
||||
}
|
||||
}, context);
|
||||
(0, assert_1.default)(user);
|
||||
(0, assert_1.assert)(user);
|
||||
const { password, passwordOrigin, idState, wechatUser$user, email$user } = user;
|
||||
return new Exceptions_1.OakDistinguishUserException(userId, !!(password || passwordOrigin), idState === 'verified', wechatUser$user.length > 0, email$user.length > 0);
|
||||
}
|
||||
|
|
@ -70,7 +67,7 @@ async function tryMakeChangeLoginWay(userId, context) {
|
|||
id: userId,
|
||||
}
|
||||
}, context);
|
||||
(0, assert_1.default)(user);
|
||||
(0, assert_1.assert)(user);
|
||||
const { idState, wechatUser$user, email$user } = user;
|
||||
if (idState === 'verified' || wechatUser$user.length > 0 || email$user.length > 0) {
|
||||
return new Exceptions_1.OakChangLoginWayException(userId, idState === 'verified', wechatUser$user.length > 0, email$user.length > 0);
|
||||
|
|
@ -108,7 +105,7 @@ async function setupMobile(mobile, env, context) {
|
|||
}, context, { notCollect: true });
|
||||
if (result2.length > 0) {
|
||||
// 此手机号已经存在
|
||||
(0, assert_1.default)(result2.length === 1);
|
||||
(0, assert_1.assert)(result2.length === 1);
|
||||
const [mobileRow] = result2;
|
||||
if (currentToken) {
|
||||
if (currentToken.userId === mobileRow.userId) {
|
||||
|
|
@ -135,7 +132,7 @@ async function setupMobile(mobile, env, context) {
|
|||
throw new Exceptions_1.OakUserDisabledException();
|
||||
}
|
||||
case 'shadow': {
|
||||
(0, lodash_1.assign)(tokenData, {
|
||||
Object.assign(tokenData, {
|
||||
userId: mobileRow.userId,
|
||||
user: {
|
||||
action: 'activate',
|
||||
|
|
@ -144,8 +141,8 @@ async function setupMobile(mobile, env, context) {
|
|||
break;
|
||||
}
|
||||
default: {
|
||||
(0, assert_1.default)(userState === 'normal');
|
||||
(0, lodash_1.assign)(tokenData, {
|
||||
(0, assert_1.assert)(userState === 'normal');
|
||||
Object.assign(tokenData, {
|
||||
userId: mobileRow.id,
|
||||
});
|
||||
}
|
||||
|
|
@ -241,7 +238,7 @@ async function loginByMobile(params, context) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
(0, assert_1.default)(password);
|
||||
(0, assert_1.assert)(password);
|
||||
const { result } = await rowStore.select('mobile', {
|
||||
data: {
|
||||
id: 1,
|
||||
|
|
@ -290,7 +287,7 @@ async function loginWechatMp({ code, env }, context) {
|
|||
const { rowStore } = context;
|
||||
const application = await context.getApplication();
|
||||
const { type, config, systemId } = application;
|
||||
(0, assert_1.default)(type === 'wechatMp' || config.type === 'wechatMp');
|
||||
(0, assert_1.assert)(type === 'wechatMp' || config.type === 'wechatMp');
|
||||
const config2 = config;
|
||||
const { appId, appSecret } = config2;
|
||||
const wechatInstance = oak_external_sdk_1.WechatSDK.getInstance(appId, appSecret, 'wechatMp');
|
||||
|
|
@ -326,7 +323,7 @@ async function loginWechatMp({ code, env }, context) {
|
|||
sessionKey,
|
||||
};
|
||||
if (unionId !== wechatUser.unionId) {
|
||||
(0, lodash_1.assign)(wechatUserUpdateData, {
|
||||
Object.assign(wechatUserUpdateData, {
|
||||
unionId,
|
||||
});
|
||||
}
|
||||
|
|
@ -378,7 +375,7 @@ async function loginWechatMp({ code, env }, context) {
|
|||
}
|
||||
else {
|
||||
// 创建user
|
||||
(0, lodash_1.assign)(wechatUserUpdateData, {
|
||||
Object.assign(wechatUserUpdateData, {
|
||||
user: {
|
||||
action: 'create',
|
||||
data: {
|
||||
|
|
@ -555,7 +552,7 @@ async function syncUserInfoWechatMp({ nickname, avatarUrl, encryptedData, iv, si
|
|||
const extraFileOperations = [
|
||||
{
|
||||
action: 'create',
|
||||
data: (0, lodash_1.assign)({
|
||||
data: Object.assign({
|
||||
id: await generateNewId(),
|
||||
tag1: 'avatar',
|
||||
entity: 'user',
|
||||
|
|
@ -572,11 +569,11 @@ async function syncUserInfoWechatMp({ nickname, avatarUrl, encryptedData, iv, si
|
|||
}
|
||||
});
|
||||
}
|
||||
(0, lodash_1.assign)(updateData, {
|
||||
Object.assign(updateData, {
|
||||
extraFile$entity: extraFileOperations,
|
||||
});
|
||||
}
|
||||
if ((0, lodash_1.keys)(updateData).length > 0) {
|
||||
if (Object.keys(updateData).length > 0) {
|
||||
await rowStore.operate('user', {
|
||||
action: 'update',
|
||||
data: updateData,
|
||||
|
|
@ -590,7 +587,7 @@ async function syncUserInfoWechatMp({ nickname, avatarUrl, encryptedData, iv, si
|
|||
exports.syncUserInfoWechatMp = syncUserInfoWechatMp;
|
||||
async function sendCaptcha({ mobile, env }, context) {
|
||||
const { type } = env;
|
||||
(0, assert_1.default)(type === 'web');
|
||||
(0, assert_1.assert)(type === 'web');
|
||||
let { visitorId } = env;
|
||||
const { rowStore } = context;
|
||||
const now = Date.now();
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createWechatQrCode = void 0;
|
||||
const assert_1 = __importDefault(require("assert"));
|
||||
const assert_1 = require("oak-domain/lib/utils/assert");
|
||||
async function createWechatQrCode(options, context) {
|
||||
const { entity, entityId, applicationId, tag, lifetimeLength, permanent, props } = options;
|
||||
const { type: appType, config } = (await context.getApplication());
|
||||
|
|
@ -55,7 +52,7 @@ async function createWechatQrCode(options, context) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
(0, assert_1.default)(appType === 'wechatPublic');
|
||||
(0, assert_1.assert)(appType === 'wechatPublic');
|
||||
// 还未实现,记得
|
||||
throw new Error('method not implemented yet');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const types_1 = require("oak-domain/lib/types");
|
||||
const validator_1 = require("oak-domain/lib/utils/validator");
|
||||
const lodash_1 = require("lodash");
|
||||
const checkers = [
|
||||
{
|
||||
type: 'data',
|
||||
|
|
@ -14,7 +13,7 @@ const checkers = [
|
|||
data.forEach(ele => {
|
||||
(0, validator_1.checkAttributesNotNull)(ele, ['type', 'entity', 'entityId', 'relation']);
|
||||
if (!ele.hasOwnProperty('number') || ele.type === 'transfer') {
|
||||
(0, lodash_1.assign)(ele, {
|
||||
Object.assign(ele, {
|
||||
number: 1,
|
||||
});
|
||||
}
|
||||
|
|
@ -23,7 +22,7 @@ const checkers = [
|
|||
throw new types_1.OakInputIllegalException(['number', '分享的权限数量必须大于0']);
|
||||
}
|
||||
}
|
||||
(0, lodash_1.assign)(ele, {
|
||||
Object.assign(ele, {
|
||||
confirmed: 0,
|
||||
});
|
||||
});
|
||||
|
|
@ -31,7 +30,7 @@ const checkers = [
|
|||
else {
|
||||
(0, validator_1.checkAttributesNotNull)(data, ['type', 'entity', 'entityId', 'relation']);
|
||||
if (!data.hasOwnProperty('number') || data.type === 'transfer') {
|
||||
(0, lodash_1.assign)(data, {
|
||||
Object.assign(data, {
|
||||
number: 1,
|
||||
});
|
||||
}
|
||||
|
|
@ -40,7 +39,7 @@ const checkers = [
|
|||
throw new types_1.OakInputIllegalException(['number', '分享的权限数量必须大于0']);
|
||||
}
|
||||
}
|
||||
(0, lodash_1.assign)(data, {
|
||||
Object.assign(data, {
|
||||
confirmed: 0,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
import { ExceptionRouters } from "oak-frontend-base";
|
||||
import { ExceptionRouters } from "oak-frontend-base/lib/types/ExceptionRoute";
|
||||
export declare const routers: ExceptionRouters;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import { EntityDict } from 'general-app-domain';
|
||||
import { AppType } from 'general-app-domain/Application/Schema';
|
||||
import { Feature, LocalStorage } from 'oak-frontend-base';
|
||||
import { LocalStorage } from 'oak-frontend-base/lib/features/localStorage';
|
||||
import { Cache } from 'oak-frontend-base/lib/features/cache';
|
||||
import { Feature } from 'oak-frontend-base/lib/types/Feature';
|
||||
import { AspectWrapper, SelectRowShape } from 'oak-domain/lib/types';
|
||||
import { Cache } from 'oak-frontend-base';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { AspectDict } from '../aspects/AspectDict';
|
||||
import { GeneralRuntimeContext } from '../RuntimeContext';
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Application = void 0;
|
||||
const oak_frontend_base_1 = require("oak-frontend-base");
|
||||
const Feature_1 = require("oak-frontend-base/lib/types/Feature");
|
||||
const concurrent_1 = require("oak-domain/lib/utils/concurrent");
|
||||
const assert_1 = __importDefault(require("assert"));
|
||||
const assert_1 = require("oak-domain/lib/utils/assert");
|
||||
const projection = {
|
||||
id: 1,
|
||||
name: 1,
|
||||
|
|
@ -19,7 +16,7 @@ const projection = {
|
|||
config: 1,
|
||||
}
|
||||
};
|
||||
class Application extends oak_frontend_base_1.Feature {
|
||||
class Application extends Feature_1.Feature {
|
||||
applicationId;
|
||||
application;
|
||||
rwLock;
|
||||
|
|
@ -48,7 +45,7 @@ class Application extends oak_frontend_base_1.Feature {
|
|||
id: this.applicationId,
|
||||
}
|
||||
});
|
||||
(0, assert_1.default)(result.length === 1);
|
||||
(0, assert_1.assert)(result.length === 1);
|
||||
this.application = result[0];
|
||||
callback(this.application);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { EntityDict } from 'general-app-domain';
|
||||
import { Feature } from 'oak-frontend-base';
|
||||
import { Feature } from 'oak-frontend-base/lib/types/Feature';
|
||||
import { AspectWrapper, DeduceCreateOperationData } from 'oak-domain/lib/types';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { AspectDict } from '../aspects/AspectDict';
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ExtraFile = void 0;
|
||||
const oak_frontend_base_1 = require("oak-frontend-base");
|
||||
const oak_frontend_base_2 = require("oak-frontend-base");
|
||||
class ExtraFile extends oak_frontend_base_1.Feature {
|
||||
const Feature_1 = require("oak-frontend-base/lib/types/Feature");
|
||||
const upload_1 = require("oak-frontend-base/lib/utils/upload");
|
||||
class ExtraFile extends Feature_1.Feature {
|
||||
constructor(aspectWrapper) {
|
||||
super(aspectWrapper);
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ class ExtraFile extends oak_frontend_base_1.Feature {
|
|||
});
|
||||
if (process.env.OAK_PLATFORM === 'wechatMp') {
|
||||
// 微信小程序使用wx.uploadFile, 封装upload,上传源为origin
|
||||
const up = new oak_frontend_base_2.Upload();
|
||||
const up = new upload_1.Upload();
|
||||
const result = await up.uploadFile(origin, filePath, uploadInfo);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -38,6 +38,6 @@ class ExtraFile extends oak_frontend_base_1.Feature {
|
|||
}
|
||||
}
|
||||
__decorate([
|
||||
oak_frontend_base_1.Action
|
||||
Feature_1.Action
|
||||
], ExtraFile.prototype, "upload", null);
|
||||
exports.ExtraFile = ExtraFile;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { Token } from './token';
|
|||
import { ExtraFile } from './extraFile';
|
||||
import { Application } from './application';
|
||||
import { GeneralRuntimeContext } from '..';
|
||||
import { BasicFeatures } from 'oak-frontend-base';
|
||||
import { BasicFeatures } from 'oak-frontend-base/lib/features';
|
||||
import { AspectDict } from '../aspects/AspectDict';
|
||||
import { AspectWrapper } from 'oak-domain/lib/types';
|
||||
import { AppType } from 'general-app-domain/Application/Schema';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { EntityDict } from 'general-app-domain';
|
||||
import { Feature, LocalStorage } from 'oak-frontend-base';
|
||||
import { Cache } from 'oak-frontend-base';
|
||||
import { Feature } from 'oak-frontend-base/lib/types/Feature';
|
||||
import { Cache } from 'oak-frontend-base/lib/features/cache';
|
||||
import { LocalStorage } from 'oak-frontend-base/lib/features/localStorage';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { AspectDict } from '../aspects/AspectDict';
|
||||
import { GeneralRuntimeContext } from '..';
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Token = void 0;
|
||||
const oak_frontend_base_1 = require("oak-frontend-base");
|
||||
const Feature_1 = require("oak-frontend-base/lib/types/Feature");
|
||||
const concurrent_1 = require("oak-domain/lib/utils/concurrent");
|
||||
const env_1 = require("../utils/env");
|
||||
const constants_1 = require("../constants");
|
||||
class Token extends oak_frontend_base_1.Feature {
|
||||
class Token extends Feature_1.Feature {
|
||||
token;
|
||||
rwLock;
|
||||
cache;
|
||||
|
|
@ -146,18 +146,18 @@ class Token extends oak_frontend_base_1.Feature {
|
|||
}
|
||||
}
|
||||
__decorate([
|
||||
oak_frontend_base_1.Action
|
||||
Feature_1.Action
|
||||
], Token.prototype, "loginByMobile", null);
|
||||
__decorate([
|
||||
oak_frontend_base_1.Action
|
||||
Feature_1.Action
|
||||
], Token.prototype, "loginWechatMp", null);
|
||||
__decorate([
|
||||
oak_frontend_base_1.Action
|
||||
Feature_1.Action
|
||||
], Token.prototype, "syncUserInfoWechatMp", null);
|
||||
__decorate([
|
||||
oak_frontend_base_1.Action
|
||||
Feature_1.Action
|
||||
], Token.prototype, "logout", null);
|
||||
__decorate([
|
||||
oak_frontend_base_1.Action
|
||||
Feature_1.Action
|
||||
], Token.prototype, "sendCaptcha", null);
|
||||
exports.Token = Token;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert_1 = __importDefault(require("assert"));
|
||||
const assert_1 = require("oak-domain/lib/utils/assert");
|
||||
const constants_1 = require("../constants");
|
||||
const lodash_1 = require("lodash");
|
||||
const filter_1 = require("oak-domain/lib/store/filter");
|
||||
let NO_ANY_USER = true;
|
||||
const triggers = [
|
||||
|
|
@ -75,7 +71,7 @@ const triggers = [
|
|||
when: 'after',
|
||||
fn: async ({ operation }, context, params) => {
|
||||
const { filter } = operation;
|
||||
(0, assert_1.default)(filter.id);
|
||||
(0, assert_1.assert)(filter.id);
|
||||
const { id } = (await context.getToken());
|
||||
await context.rowStore.operate('token', {
|
||||
action: 'update',
|
||||
|
|
@ -99,14 +95,14 @@ const triggers = [
|
|||
if (app) {
|
||||
const { filter } = operation;
|
||||
if (!filter) {
|
||||
(0, lodash_1.assign)(operation, {
|
||||
Object.assign(operation, {
|
||||
filter: {
|
||||
systemId: app.systemId,
|
||||
},
|
||||
});
|
||||
}
|
||||
else {
|
||||
(0, lodash_1.assign)(operation, {
|
||||
Object.assign(operation, {
|
||||
filter: (0, filter_1.addFilterSegment)({
|
||||
systemId: app.systemId,
|
||||
}, filter),
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const lodash_1 = require("lodash");
|
||||
const types_1 = require("oak-domain/lib/types");
|
||||
const assert_1 = __importDefault(require("assert"));
|
||||
const assert_1 = require("oak-domain/lib/utils/assert");
|
||||
const constants_1 = require("../constants");
|
||||
const wechatQrCode_1 = require("../aspects/wechatQrCode");
|
||||
const string_1 = require("oak-domain/lib/utils/string");
|
||||
|
|
@ -20,7 +16,7 @@ const triggers = [
|
|||
const fn = async (userEntityGrantData) => {
|
||||
const { userId } = (await context.getToken());
|
||||
const { id: applicationId, config: appConfig, system: { config: SystemConfig } } = (await context.getApplication());
|
||||
(0, assert_1.default)(userId);
|
||||
(0, assert_1.assert)(userId);
|
||||
const { type, entity, entityId, relation, id } = userEntityGrantData;
|
||||
const { result } = await context.rowStore.select('userEntityGrant', {
|
||||
data: {
|
||||
|
|
@ -50,7 +46,7 @@ const triggers = [
|
|||
throw new types_1.OakCongruentRowExists(result[0], '有可重用的userEntityGrant');
|
||||
}
|
||||
const expiresAt = Date.now() + (SystemConfig.UserEntityGrant?.lifetimeLength || constants_1.DefaultConfig.userEntityGrant.lifetimeLength);
|
||||
(0, lodash_1.assign)(userEntityGrantData, {
|
||||
Object.assign(userEntityGrantData, {
|
||||
granterId: userId,
|
||||
expiresAt,
|
||||
expired: false,
|
||||
|
|
@ -71,7 +67,7 @@ const triggers = [
|
|||
}
|
||||
};
|
||||
if (data instanceof Array) {
|
||||
(0, assert_1.default)('授权不存在一对多的情况');
|
||||
(0, assert_1.assert)('授权不存在一对多的情况');
|
||||
}
|
||||
else {
|
||||
await fn(data);
|
||||
|
|
|
|||
|
|
@ -1,12 +1,8 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert_1 = __importDefault(require("assert"));
|
||||
const assert_1 = require("oak-domain/lib/utils/assert");
|
||||
const oak_external_sdk_1 = require("oak-external-sdk");
|
||||
const uuid_1 = require("oak-domain/lib/utils/uuid");
|
||||
const lodash_1 = require("lodash");
|
||||
const triggers = [
|
||||
{
|
||||
name: '选择wechatQrCode时,动态生成需要的数据',
|
||||
|
|
@ -17,7 +13,7 @@ const triggers = [
|
|||
let count = 0;
|
||||
const application = await context.getApplication();
|
||||
const { type, config } = application;
|
||||
(0, assert_1.default)(type === 'wechatMp' || config.type === 'wechatMp');
|
||||
(0, assert_1.assert)(type === 'wechatMp' || config.type === 'wechatMp');
|
||||
const config2 = config;
|
||||
const { appId, appSecret } = config2;
|
||||
for (const code of result) {
|
||||
|
|
@ -31,7 +27,7 @@ const triggers = [
|
|||
});
|
||||
// 把arrayBuffer转成字符串返回
|
||||
const str = String.fromCharCode(...new Uint8Array(buffer));
|
||||
(0, lodash_1.assign)(code, {
|
||||
Object.assign(code, {
|
||||
buffer: str,
|
||||
});
|
||||
count++;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.processCheckers = void 0;
|
||||
const lodash_1 = require("lodash");
|
||||
const constants_1 = require("../constants");
|
||||
async function checkIsRoot(context) {
|
||||
const token = await context.getToken();
|
||||
|
|
@ -26,7 +25,7 @@ function processCheckers(checkers) {
|
|||
for (const checker of checkers) {
|
||||
const { type, checker: fn } = checker;
|
||||
if (type === 'user') {
|
||||
(0, lodash_1.assign)(checker, {
|
||||
Object.assign(checker, {
|
||||
checker: async (dummy, context) => {
|
||||
if (await checkIsRoot(context)) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getEnv = void 0;
|
||||
const lodash_1 = require("lodash");
|
||||
const lodash_1 = require("oak-domain/lib/utils/lodash");
|
||||
async function getEnv() {
|
||||
const env = await wx.getSystemInfo();
|
||||
const env2 = (0, lodash_1.pick)(env, [
|
||||
|
|
@ -20,7 +20,7 @@ async function getEnv() {
|
|||
'fontSizeSetting',
|
||||
'SDKVersion'
|
||||
]);
|
||||
return (0, lodash_1.assign)(env2, {
|
||||
return Object.assign(env2, {
|
||||
type: 'wechatMp',
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getEnv = void 0;
|
||||
const fingerprintjs_1 = __importDefault(require("@fingerprintjs/fingerprintjs"));
|
||||
const lodash_1 = require("lodash");
|
||||
const lodash_1 = require("oak-domain/lib/utils/lodash");
|
||||
/**
|
||||
* fingerprintJs当中的一些敏感项
|
||||
* @returns
|
||||
|
|
@ -14,7 +14,7 @@ async function getEnv() {
|
|||
const fp = await fingerprintjs_1.default.load();
|
||||
const result = await fp.get();
|
||||
const { visitorId, components } = result;
|
||||
return (0, lodash_1.assign)((0, lodash_1.pick)(components, [
|
||||
return Object.assign((0, lodash_1.pick)(components, [
|
||||
'platform',
|
||||
'timezone',
|
||||
'vendor',
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
"@fingerprintjs/fingerprintjs": "^3.3.3",
|
||||
"antd": "^4.21.5",
|
||||
"classnames": "^2.3.1",
|
||||
"lodash": "^4.17.21",
|
||||
"moment": "^2.29.4",
|
||||
"oak-common-aspect": "file:../oak-common-aspect",
|
||||
"oak-domain": "file:../oak-domain",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { unset } from 'lodash';
|
||||
import { unset } from 'oak-domain/lib/utils/lodash';
|
||||
import { buildSchema, analyzeEntities } from 'oak-domain/src/compiler/schemalBuilder';
|
||||
|
||||
process.env.NODE_ENV = 'development';
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ import { SelectRowShape, SelectionResult } 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';
|
||||
import { assign } from 'lodash';
|
||||
|
||||
import { RWLock } from 'oak-domain/lib/utils/concurrent';
|
||||
import assert from 'assert';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
|
||||
type AppType = SelectRowShape<EntityDict['application']['Schema'], {
|
||||
id: 1,
|
||||
|
|
@ -114,13 +114,13 @@ export abstract class GeneralRuntimeContext<ED extends EntityDict> extends Unive
|
|||
applicationId: this.getApplicationId(),
|
||||
};
|
||||
if (this.token) {
|
||||
assign(data, {
|
||||
Object.assign(data, {
|
||||
token: this.token,
|
||||
});
|
||||
}
|
||||
const scene = this.getScene();
|
||||
if (scene) {
|
||||
assign(data, {
|
||||
Object.assign(data, {
|
||||
scene,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
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/src/types/Upload";
|
||||
import { QiniuUploadInfo } from "oak-frontend-base/lib/types/Upload";
|
||||
// import { AspectDict as CommonAspectDict } from 'oak-common-aspect/src/aspectDict';
|
||||
import { GeneralRuntimeContext } from "../RuntimeContext";
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ import { loginByMobile, loginMp, loginWechatMp, syncUserInfoWechatMp, sendCaptch
|
|||
import { getUploadInfo } from './extraFile';
|
||||
import { getApplication } from './application';
|
||||
// import commonAspectDict from 'oak-common-aspect';
|
||||
import { assign } from 'lodash';
|
||||
export const aspectDict = assign({
|
||||
export const aspectDict = {
|
||||
loginByMobile,
|
||||
loginMp,
|
||||
loginWechatMp,
|
||||
|
|
@ -11,6 +10,6 @@ export const aspectDict = assign({
|
|||
getUploadInfo,
|
||||
sendCaptcha,
|
||||
getApplication,
|
||||
}/* , commonAspectDict */);
|
||||
};
|
||||
|
||||
// export type AspectDict<ED extends EntityDict & BaseEntityDict> = TokenAD<ED> & CrudAD<ED>;
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
import { GeneralRuntimeContext } from '../RuntimeContext';
|
||||
import { EntityDict } from 'general-app-domain';
|
||||
import { WechatSDK } from 'oak-external-sdk';
|
||||
import assert from 'assert';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { WechatMpConfig } from 'general-app-domain/Application/Schema';
|
||||
import { CreateOperationData as CreateToken, WebEnv, WechatMpEnv } from 'general-app-domain/Token/Schema';
|
||||
import { CreateOperationData as CreateWechatUser } from 'general-app-domain/WechatUser/Schema';
|
||||
import { CreateOperationData as CreateUser, Schema as User } from 'general-app-domain/User/Schema';
|
||||
import { Operation as ExtraFileOperation } from 'general-app-domain/ExtraFile/Schema';
|
||||
import { assign, isEqual, keys } from 'lodash';
|
||||
import { isEqual } from 'oak-domain/lib/utils/lodash';
|
||||
import { OakUserException, SelectRowShape } from 'oak-domain/lib/types';
|
||||
import { composeFileUrl, decomposeFileUrl } from '../utils/extraFile';
|
||||
import { OakChangLoginWayException, OakDistinguishUserException, OakUserDisabledException } from '../types/Exceptions';
|
||||
|
|
@ -162,7 +162,7 @@ async function setupMobile<ED extends EntityDict, Cxt extends GeneralRuntimeCont
|
|||
throw new OakUserDisabledException();
|
||||
}
|
||||
case 'shadow': {
|
||||
assign(tokenData, {
|
||||
Object.assign(tokenData, {
|
||||
userId: mobileRow.userId,
|
||||
user: {
|
||||
action: 'activate',
|
||||
|
|
@ -172,7 +172,7 @@ async function setupMobile<ED extends EntityDict, Cxt extends GeneralRuntimeCont
|
|||
}
|
||||
default: {
|
||||
assert(userState === 'normal');
|
||||
assign(tokenData, {
|
||||
Object.assign(tokenData, {
|
||||
userId: mobileRow.id,
|
||||
});
|
||||
}
|
||||
|
|
@ -376,7 +376,7 @@ export async function loginWechatMp<ED extends EntityDict, Cxt extends GeneralRu
|
|||
sessionKey,
|
||||
};
|
||||
if (unionId !== wechatUser.unionId as any) {
|
||||
assign(wechatUserUpdateData, {
|
||||
Object.assign(wechatUserUpdateData, {
|
||||
unionId,
|
||||
});
|
||||
}
|
||||
|
|
@ -430,7 +430,7 @@ export async function loginWechatMp<ED extends EntityDict, Cxt extends GeneralRu
|
|||
}
|
||||
else {
|
||||
// 创建user
|
||||
assign(wechatUserUpdateData, {
|
||||
Object.assign(wechatUserUpdateData, {
|
||||
user: {
|
||||
action: 'create',
|
||||
data: {
|
||||
|
|
@ -622,7 +622,7 @@ export async function syncUserInfoWechatMp<ED extends EntityDict, Cxt extends Ge
|
|||
const extraFileOperations: ExtraFileOperation['data'][] = [
|
||||
{
|
||||
action: 'create',
|
||||
data: assign({
|
||||
data: Object.assign({
|
||||
id: await generateNewId(),
|
||||
tag1: 'avatar',
|
||||
entity: 'user',
|
||||
|
|
@ -641,12 +641,12 @@ export async function syncUserInfoWechatMp<ED extends EntityDict, Cxt extends Ge
|
|||
}
|
||||
);
|
||||
}
|
||||
assign(updateData, {
|
||||
Object.assign(updateData, {
|
||||
extraFile$entity: extraFileOperations,
|
||||
});
|
||||
}
|
||||
|
||||
if (keys(updateData).length > 0) {
|
||||
if (Object.keys(updateData).length > 0) {
|
||||
await rowStore.operate('user', {
|
||||
action: 'update',
|
||||
data: updateData,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import assert from "assert";
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { EntityDict } from "general-app-domain";
|
||||
import { WechatMpConfig } from "general-app-domain/Application/Schema";
|
||||
import { CreateOperationData as CreateWechatQrcodeData, WechatQrCodeProps } from 'general-app-domain/WechatQrCode/Schema';
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
import { Checker, OakUserUnpermittedException } from "oak-domain/lib/types";
|
||||
import { EntityDict } from 'general-app-domain';
|
||||
import { GeneralRuntimeContext } from '../RuntimeContext';
|
||||
import { OakUnloggedInException } from "../types/Exceptions";
|
||||
import { assign } from "lodash";
|
||||
import { addFilterSegment, combineFilters } from "oak-domain/lib/store/filter";
|
||||
|
||||
const checkers: Checker<EntityDict, 'token', GeneralRuntimeContext<EntityDict>> [] = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ import { checkFilterContains } from 'oak-domain/lib/store/actionDef';
|
|||
import { OakInputIllegalException, Checker, OakUserUnpermittedException, OakRowInconsistencyException } from "oak-domain/lib/types";
|
||||
import { EntityDict } from 'general-app-domain';
|
||||
import { GeneralRuntimeContext } from '../RuntimeContext';
|
||||
import { ROOT_ROLE_ID } from '../constants';
|
||||
import { assign } from 'lodash';
|
||||
|
||||
const checkers: Checker<EntityDict, 'user', GeneralRuntimeContext<EntityDict>> [] = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import {
|
|||
import { EntityDict } from 'general-app-domain';
|
||||
import { GeneralRuntimeContext } from '../RuntimeContext';
|
||||
import { checkAttributesNotNull } from 'oak-domain/lib/utils/validator';
|
||||
import { assign } from 'lodash';
|
||||
|
||||
const checkers: Checker<
|
||||
EntityDict,
|
||||
|
|
@ -22,7 +21,7 @@ const checkers: Checker<
|
|||
ele => {
|
||||
checkAttributesNotNull(ele, ['type', 'entity', 'entityId', 'relation']);
|
||||
if (!ele.hasOwnProperty('number') || ele.type === 'transfer') {
|
||||
assign(ele, {
|
||||
Object.assign(ele, {
|
||||
number: 1,
|
||||
});
|
||||
}
|
||||
|
|
@ -31,7 +30,7 @@ const checkers: Checker<
|
|||
throw new OakInputIllegalException(['number', '分享的权限数量必须大于0']);
|
||||
}
|
||||
}
|
||||
assign(ele, {
|
||||
Object.assign(ele, {
|
||||
confirmed: 0,
|
||||
});
|
||||
}
|
||||
|
|
@ -40,7 +39,7 @@ const checkers: Checker<
|
|||
else {
|
||||
checkAttributesNotNull(data, ['type', 'entity', 'entityId', 'relation']);
|
||||
if (!data.hasOwnProperty('number') || data.type === 'transfer') {
|
||||
assign(data, {
|
||||
Object.assign(data, {
|
||||
number: 1,
|
||||
});
|
||||
}
|
||||
|
|
@ -49,7 +48,7 @@ const checkers: Checker<
|
|||
throw new OakInputIllegalException(['number', '分享的权限数量必须大于0']);
|
||||
}
|
||||
}
|
||||
assign(data, {
|
||||
Object.assign(data, {
|
||||
confirmed: 0,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { ExceptionRouters } from "oak-frontend-base";
|
||||
import { ExceptionRouters } from "oak-frontend-base/lib/types/ExceptionRoute";
|
||||
import { OakUnloggedInException } from "./types/Exceptions";
|
||||
|
||||
export const routers: ExceptionRouters = [
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
import { EntityDict } from 'general-app-domain';
|
||||
import { AppType } from 'general-app-domain/Application/Schema';
|
||||
import { Action, Feature, LocalStorage } from 'oak-frontend-base';
|
||||
import { Aspect, AspectWrapper, Context, SelectRowShape } from 'oak-domain/lib/types';
|
||||
import { LocalStorage } from 'oak-frontend-base/lib/features/localStorage';
|
||||
import { Cache } from 'oak-frontend-base/lib/features/cache';
|
||||
import { Feature } from 'oak-frontend-base/lib/types/Feature';
|
||||
import { AspectWrapper, SelectRowShape } from 'oak-domain/lib/types';
|
||||
import { RWLock } from 'oak-domain/lib/utils/concurrent';
|
||||
import { Cache } from 'oak-frontend-base';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import assert from 'assert';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
|
||||
import { AspectDict } from '../aspects/AspectDict';
|
||||
import { GeneralRuntimeContext } from '../RuntimeContext';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { EntityDict } from 'general-app-domain';
|
||||
import { Action, Feature } from 'oak-frontend-base';
|
||||
import { Action, Feature } from 'oak-frontend-base/lib/types/Feature';
|
||||
import { AspectWrapper, DeduceCreateOperationData } from 'oak-domain/lib/types';
|
||||
import { Upload } from 'oak-frontend-base';
|
||||
import { Upload } from 'oak-frontend-base/lib/utils/upload';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { AspectDict } from '../aspects/AspectDict';
|
||||
import { GeneralRuntimeContext } from '..';
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { Token } from './token';
|
|||
import { ExtraFile } from './extraFile';
|
||||
import { Application } from './application';
|
||||
import { GeneralRuntimeContext } from '..';
|
||||
import { BasicFeatures } from 'oak-frontend-base';
|
||||
import { BasicFeatures } from 'oak-frontend-base/lib/features';
|
||||
import { AspectDict } from '../aspects/AspectDict';
|
||||
import { AspectWrapper } from 'oak-domain/lib/types';
|
||||
import { AppType } from 'general-app-domain/Application/Schema';
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import { EntityDict } from 'general-app-domain';
|
||||
import { Action, Feature, LocalStorage } from 'oak-frontend-base';
|
||||
import { Action, Feature } from 'oak-frontend-base/lib/types/Feature';
|
||||
import { RWLock } from 'oak-domain/lib/utils/concurrent';
|
||||
import { WebEnv, WechatMpEnv } from 'general-app-domain/Token/Schema';
|
||||
import { Cache } from 'oak-frontend-base';
|
||||
import { Cache } from 'oak-frontend-base/lib/features/cache';
|
||||
import { LocalStorage } from 'oak-frontend-base/lib/features/localStorage';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { getEnv } from '../utils/env';
|
||||
import { AspectDict } from '../aspects/AspectDict';
|
||||
|
|
|
|||
|
|
@ -3,9 +3,8 @@ import { EntityDict } from 'general-app-domain/EntityDict';
|
|||
import { GeneralRuntimeContext } from '../RuntimeContext';
|
||||
import { CreateOperationData as CreateUserRoleData } from 'general-app-domain/UserRole/Schema';
|
||||
import { CreateOperationData as CreateUserData } from 'general-app-domain/User/Schema';
|
||||
import assert from 'assert';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { ROOT_ROLE_ID, ROOT_USER_ID } from '../constants';
|
||||
import { assign } from 'lodash';
|
||||
import { addFilterSegment } from 'oak-domain/lib/store/filter';
|
||||
|
||||
let NO_ANY_USER = true;
|
||||
|
|
@ -102,14 +101,14 @@ const triggers: Trigger<EntityDict, 'user', GeneralRuntimeContext<EntityDict>>[]
|
|||
if (app) {
|
||||
const { filter } = operation;
|
||||
if (!filter) {
|
||||
assign(operation, {
|
||||
Object.assign(operation, {
|
||||
filter: {
|
||||
systemId: app.systemId,
|
||||
},
|
||||
});
|
||||
}
|
||||
else {
|
||||
assign(operation, {
|
||||
Object.assign(operation, {
|
||||
filter: addFilterSegment({
|
||||
systemId: app.systemId,
|
||||
}, filter),
|
||||
|
|
|
|||
|
|
@ -3,9 +3,8 @@ import { CreateTriggerInTxn, Trigger } from 'oak-domain/lib/types/Trigger';
|
|||
import { GeneralRuntimeContext } from '../RuntimeContext';
|
||||
import { CreateOperationData as CreateUserEntityGrantData } from 'general-app-domain/UserEntityGrant/Schema';
|
||||
|
||||
import { assign, keys } from 'lodash';
|
||||
import { OakCongruentRowExists } from 'oak-domain/lib/types';
|
||||
import assert from 'assert';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { DefaultConfig } from '../constants';
|
||||
import { createWechatQrCode } from '../aspects/wechatQrCode';
|
||||
import { firstLetterUpperCase } from 'oak-domain/lib/utils/string';
|
||||
|
|
@ -53,7 +52,7 @@ const triggers: Trigger<EntityDict, 'userEntityGrant', GeneralRuntimeContext<Ent
|
|||
|
||||
const expiresAt = Date.now() + (SystemConfig.UserEntityGrant?.lifetimeLength || DefaultConfig.userEntityGrant.lifetimeLength);
|
||||
|
||||
assign(userEntityGrantData, {
|
||||
Object.assign(userEntityGrantData, {
|
||||
granterId: userId,
|
||||
expiresAt,
|
||||
expired: false,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,10 @@ import { EntityDict } from 'general-app-domain/EntityDict';
|
|||
import { SelectTriggerAfter, Trigger } from 'oak-domain/lib/types/Trigger';
|
||||
import { GeneralRuntimeContext } from '../RuntimeContext';
|
||||
|
||||
import assert from 'assert';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { WechatSDK } from 'oak-external-sdk';
|
||||
import { WechatMpConfig } from 'general-app-domain/Application/Schema';
|
||||
import { shrinkUuidTo32Bytes } from 'oak-domain/lib/utils/uuid';
|
||||
import { assign } from 'lodash';
|
||||
|
||||
const triggers: Trigger<EntityDict, 'wechatQrCode', GeneralRuntimeContext<EntityDict>>[] = [
|
||||
{
|
||||
|
|
@ -33,7 +32,7 @@ const triggers: Trigger<EntityDict, 'wechatQrCode', GeneralRuntimeContext<Entity
|
|||
});
|
||||
// 把arrayBuffer转成字符串返回
|
||||
const str = String.fromCharCode(...new Uint8Array(buffer));
|
||||
assign(code, {
|
||||
Object.assign(code, {
|
||||
buffer: str,
|
||||
});
|
||||
count ++;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { EntityDict } from "general-app-domain";
|
||||
import { assign } from "lodash";
|
||||
import { Checker } from "oak-domain/lib/types";
|
||||
import { ROOT_ROLE_ID } from "../constants";
|
||||
import { GeneralRuntimeContext } from "../RuntimeContext";
|
||||
|
|
@ -29,7 +28,7 @@ export function processCheckers<ED extends EntityDict, Cxt extends GeneralRuntim
|
|||
for (const checker of checkers) {
|
||||
const { type, checker: fn } = checker;
|
||||
if (type === 'user') {
|
||||
assign(checker, {
|
||||
Object.assign(checker, {
|
||||
checker: async (dummy: any, context: Cxt) => {
|
||||
if (await checkIsRoot<ED, Cxt>(context)) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { WechatMpEnv } from "general-app-domain/Token/Schema";
|
||||
import { pick, assign } from "lodash";
|
||||
import { pick } from "oak-domain/lib/utils/lodash";
|
||||
|
||||
export async function getEnv() {
|
||||
const env = await wx.getSystemInfo();
|
||||
|
|
@ -19,7 +19,7 @@ export async function getEnv() {
|
|||
'fontSizeSetting',
|
||||
'SDKVersion'
|
||||
]);
|
||||
return assign(env2, {
|
||||
return Object.assign(env2, {
|
||||
type: 'wechatMp',
|
||||
}) as any;
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import FingerprintJS from '@fingerprintjs/fingerprintjs';
|
||||
import { WebEnv } from 'general-app-domain/Token/Schema';
|
||||
import { assign, pick } from 'lodash';
|
||||
import { pick } from 'oak-domain/lib/utils/lodash';
|
||||
|
||||
/**
|
||||
* fingerprintJs当中的一些敏感项
|
||||
|
|
@ -11,7 +11,7 @@ export async function getEnv() {
|
|||
const result = await fp.get();
|
||||
|
||||
const { visitorId, components } = result;
|
||||
return assign(
|
||||
return Object.assign(
|
||||
pick(components, [
|
||||
'platform',
|
||||
'timezone',
|
||||
|
|
|
|||
10
test/test.ts
10
test/test.ts
|
|
@ -1 +1,9 @@
|
|||
console.log(undefined === undefined);
|
||||
const a = {
|
||||
b: {
|
||||
c: 'xc',
|
||||
name: 'ddd',
|
||||
}
|
||||
};
|
||||
|
||||
delete a.b;
|
||||
console.log(a);
|
||||
Loading…
Reference in New Issue