简化了大量泛型声明,适配了frontend的改动
This commit is contained in:
commit
8ee0a9e3be
|
|
@ -58,6 +58,8 @@ export type GeneralAspectDict<ED extends EntityDict, Cxt extends BackendRuntimeC
|
|||
getApplication: (params: {
|
||||
type: AppType;
|
||||
domain: string;
|
||||
data: ED['application']['Selection']['data'];
|
||||
appId?: string;
|
||||
}, context: Cxt) => Promise<string>;
|
||||
signatureJsSDK: (params: {
|
||||
url: string;
|
||||
|
|
|
|||
|
|
@ -1,23 +1,25 @@
|
|||
import { EntityDict } from '../oak-app-domain';
|
||||
import { AppType } from '../oak-app-domain/Application/Schema';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { MediaType, MaterialType } from '../types/WeChat';
|
||||
import { WebEnv } from 'oak-domain/lib/types/Environment';
|
||||
import { File } from 'formidable';
|
||||
export declare function getApplication<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
export declare function getApplication<ED extends EntityDict>(params: {
|
||||
type: AppType;
|
||||
domain: string;
|
||||
}, context: Cxt): Promise<string>;
|
||||
export declare function signatureJsSDK<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({ url, env }: {
|
||||
data: ED['application']['Selection']['data'];
|
||||
appId?: string;
|
||||
}, context: BRC<ED>): Promise<string>;
|
||||
export declare function signatureJsSDK<ED extends EntityDict>({ url, env }: {
|
||||
url: string;
|
||||
env: WebEnv;
|
||||
}, context: Cxt): Promise<{
|
||||
}, context: BRC<ED>): Promise<{
|
||||
signature: string;
|
||||
noncestr: string;
|
||||
timestamp: number;
|
||||
appId: string;
|
||||
}>;
|
||||
export declare function uploadWechatMedia<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
export declare function uploadWechatMedia<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
file: File;
|
||||
type: MediaType;
|
||||
|
|
@ -25,31 +27,31 @@ export declare function uploadWechatMedia<ED extends EntityDict, Cxt extends Bac
|
|||
description?: string;
|
||||
extraFileId?: string;
|
||||
}, // FormData表单提交 isPermanent 变成 'true' | 'false'
|
||||
context: Cxt): Promise<{
|
||||
context: BRC<ED>): Promise<{
|
||||
mediaId: string;
|
||||
}>;
|
||||
export declare function getMaterial<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
export declare function getMaterial<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
mediaId: string;
|
||||
isPermanent?: boolean;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function deleteMaterial<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function deleteMaterial<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
mediaId: string;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function batchGetArticle<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function batchGetArticle<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
offset?: number;
|
||||
count: number;
|
||||
noContent?: 0 | 1;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function getArticle<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function getArticle<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
articleId: string;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function batchGetMaterialList<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function batchGetMaterialList<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
type: MaterialType;
|
||||
offset?: number;
|
||||
count: number;
|
||||
}, context: Cxt): Promise<any>;
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
|
|
|
|||
|
|
@ -5,19 +5,24 @@ import fs from 'fs';
|
|||
import { cloneDeep } from 'oak-domain/lib/utils/lodash';
|
||||
import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
||||
export async function getApplication(params, context) {
|
||||
const { type, domain } = params;
|
||||
const url = context.getHeader('host');
|
||||
console.log('url is', url);
|
||||
const [application] = await context.select('application', {
|
||||
data: cloneDeep(applicationProjection),
|
||||
filter: {
|
||||
type,
|
||||
system: {
|
||||
domain$system: {
|
||||
url: domain,
|
||||
},
|
||||
const { type, domain, data, appId } = params;
|
||||
let filter = {
|
||||
type,
|
||||
system: {
|
||||
domain$system: {
|
||||
url: domain,
|
||||
},
|
||||
},
|
||||
};
|
||||
if (appId && process.env.NODE_ENV === 'development') {
|
||||
filter = {
|
||||
id: appId,
|
||||
};
|
||||
}
|
||||
const closeFn = context.openRootMode();
|
||||
const [application] = await context.select('application', {
|
||||
data,
|
||||
filter,
|
||||
}, {});
|
||||
//微信小程序环境下 没有就报错
|
||||
if (type === 'wechatMp') {
|
||||
|
|
@ -32,7 +37,7 @@ export async function getApplication(params, context) {
|
|||
// 如果微信公众号环境下 application不存在公众号配置,但又在公众号访问,这时可以使用web的application
|
||||
if (!application) {
|
||||
const [application2] = await context.select('application', {
|
||||
data: cloneDeep(applicationProjection),
|
||||
data,
|
||||
filter: {
|
||||
type: 'web',
|
||||
system: {
|
||||
|
|
@ -50,6 +55,7 @@ export async function getApplication(params, context) {
|
|||
assert(application, 'web环境下 application必须存在web相关配置');
|
||||
}
|
||||
}
|
||||
closeFn();
|
||||
return application.id;
|
||||
}
|
||||
export async function signatureJsSDK({ url, env }, context) {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { Config } from '../types/Config';
|
||||
import { Style } from '../types/Style';
|
||||
export declare function updateConfig<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
export declare function updateConfig<ED extends EntityDict>(params: {
|
||||
entity: 'platform' | 'system';
|
||||
entityId: string;
|
||||
config: Config;
|
||||
}, context: Cxt): Promise<void>;
|
||||
export declare function updateApplicationConfig<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<void>;
|
||||
export declare function updateApplicationConfig<ED extends EntityDict>(params: {
|
||||
entity: 'application';
|
||||
entityId: string;
|
||||
config: EntityDict['application']['Schema']['config'];
|
||||
}, context: Cxt): Promise<void>;
|
||||
export declare function updateStyle<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<void>;
|
||||
export declare function updateStyle<ED extends EntityDict>(params: {
|
||||
entity: 'platform' | 'system';
|
||||
entityId: string;
|
||||
style: Style;
|
||||
}, context: Cxt): Promise<void>;
|
||||
}, context: BRC<ED>): Promise<void>;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import { mergeUser, getChangePasswordChannels, updateUserPassword } from './user
|
|||
import { createWechatLogin } from './wechatLogin';
|
||||
import { unbindingWechat } from './wechatUser';
|
||||
import { getMpUnlimitWxaCode } from './wechatQrCode';
|
||||
import { confirmUserEntityGrant } from './userEntityGrant';
|
||||
import { createSession } from './session';
|
||||
import { getCurrentMenu, getMenu, createMenu, createConditionalMenu, deleteConditionalMenu, deleteMenu } from './wechatMenu';
|
||||
import { createTag, getTags, editTag, deleteTag, syncTag, oneKeySync } from './wechatPublicTag';
|
||||
|
|
@ -39,7 +38,6 @@ declare const aspectDict: {
|
|||
getChangePasswordChannels: typeof getChangePasswordChannels;
|
||||
updateUserPassword: typeof updateUserPassword;
|
||||
getMpUnlimitWxaCode: typeof getMpUnlimitWxaCode;
|
||||
confirmUserEntityGrant: typeof confirmUserEntityGrant;
|
||||
createSession: typeof createSession;
|
||||
uploadWechatMedia: typeof uploadWechatMedia;
|
||||
getCurrentMenu: typeof getCurrentMenu;
|
||||
|
|
@ -73,3 +71,4 @@ declare const aspectDict: {
|
|||
syncSmsTemplate: typeof syncSmsTemplate;
|
||||
};
|
||||
export default aspectDict;
|
||||
export { GeneralAspectDict as AspectDict } from './AspectDict';
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import { mergeUser, getChangePasswordChannels, updateUserPassword } from './user
|
|||
import { createWechatLogin } from './wechatLogin';
|
||||
import { unbindingWechat } from './wechatUser';
|
||||
import { getMpUnlimitWxaCode } from './wechatQrCode';
|
||||
import { confirmUserEntityGrant } from './userEntityGrant';
|
||||
import { createSession } from './session';
|
||||
import { getCurrentMenu, getMenu, createMenu, createConditionalMenu, deleteConditionalMenu, deleteMenu, } from './wechatMenu';
|
||||
import { createTag, getTags, editTag, deleteTag, syncTag, oneKeySync, } from './wechatPublicTag';
|
||||
|
|
@ -39,7 +38,6 @@ const aspectDict = {
|
|||
getChangePasswordChannels,
|
||||
updateUserPassword,
|
||||
getMpUnlimitWxaCode,
|
||||
confirmUserEntityGrant,
|
||||
createSession,
|
||||
uploadWechatMedia,
|
||||
getCurrentMenu,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { EntityDict } from '../oak-app-domain';
|
||||
import { AppType } from '../oak-app-domain/Application/Schema';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { WechatPublicEventData, WechatMpEventData } from 'oak-external-sdk';
|
||||
export declare function createSession<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
export declare function createSession<ED extends EntityDict>(params: {
|
||||
data?: WechatPublicEventData | WechatMpEventData;
|
||||
type: AppType;
|
||||
entity?: string;
|
||||
entityId?: string;
|
||||
}, context: Cxt): Promise<string | undefined>;
|
||||
}, context: BRC<ED>): Promise<string | undefined>;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { EntityDict } from '../oak-app-domain';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
export declare function syncSmsTemplate<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
export declare function syncSmsTemplate<ED extends EntityDict>(params: {
|
||||
origin: string;
|
||||
systemId: string;
|
||||
}, context: Cxt): Promise<void>;
|
||||
}, context: BRC<ED>): Promise<void>;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
export declare function registerMessageType(messageType: string[]): void;
|
||||
export declare function getMessageType(): Promise<string[]>;
|
||||
export declare function syncMessageTemplate<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
export declare function syncMessageTemplate<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
}, context: Cxt): Promise<{
|
||||
}, context: BRC<ED>): Promise<{
|
||||
wechatId: string;
|
||||
title: string;
|
||||
primaryIndustry: string;
|
||||
|
|
|
|||
|
|
@ -1,76 +1,76 @@
|
|||
import { EntityDict } from '../oak-app-domain';
|
||||
import { NativeEnv, WebEnv, WechatMpEnv } from 'oak-domain/lib/types/Environment';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
export declare function loginByMobile<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
export declare function loginByMobile<ED extends EntityDict>(params: {
|
||||
captcha?: string;
|
||||
password?: string;
|
||||
mobile: string;
|
||||
disableRegister?: boolean;
|
||||
env: WebEnv | WechatMpEnv | NativeEnv;
|
||||
}, context: Cxt): Promise<string>;
|
||||
export declare function refreshWechatPublicUserInfo<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({}: {}, context: Cxt): Promise<void>;
|
||||
export declare function loginByWechat<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<string>;
|
||||
export declare function refreshWechatPublicUserInfo<ED extends EntityDict>({}: {}, context: BRC<ED>): Promise<void>;
|
||||
export declare function loginByWechat<ED extends EntityDict>(params: {
|
||||
wechatLoginId: string;
|
||||
env: WebEnv | WechatMpEnv;
|
||||
}, context: Cxt): Promise<string>;
|
||||
}, context: BRC<ED>): Promise<string>;
|
||||
/**
|
||||
* 公众号授权登录
|
||||
* @param param0
|
||||
* @param context
|
||||
*/
|
||||
export declare function loginWechat<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({ code, env, wechatLoginId, }: {
|
||||
export declare function loginWechat<ED extends EntityDict>({ code, env, wechatLoginId, }: {
|
||||
code: string;
|
||||
env: WebEnv;
|
||||
wechatLoginId?: string;
|
||||
}, context: Cxt): Promise<string>;
|
||||
}, context: BRC<ED>): Promise<string>;
|
||||
/**
|
||||
* 小程序授权登录
|
||||
* @param param0
|
||||
* @param context
|
||||
* @returns
|
||||
*/
|
||||
export declare function loginWechatMp<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({ code, env, }: {
|
||||
export declare function loginWechatMp<ED extends EntityDict>({ code, env, }: {
|
||||
code: string;
|
||||
env: WechatMpEnv;
|
||||
}, context: Cxt): Promise<string>;
|
||||
}, context: BRC<ED>): Promise<string>;
|
||||
/**
|
||||
* 同步从wx.getUserProfile拿到的用户信息
|
||||
* @param param0
|
||||
* @param context
|
||||
*/
|
||||
export declare function syncUserInfoWechatMp<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({ nickname, avatarUrl, encryptedData, iv, signature, }: {
|
||||
export declare function syncUserInfoWechatMp<ED extends EntityDict>({ 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 BackendRuntimeContext<ED>>({ mobile, env, type: type2, }: {
|
||||
}, context: BRC<ED>): Promise<void>;
|
||||
export declare function sendCaptcha<ED extends EntityDict>({ mobile, env, type: type2, }: {
|
||||
mobile: string;
|
||||
env: WechatMpEnv | WebEnv | NativeEnv;
|
||||
type: 'login' | 'changePassword' | 'confirm';
|
||||
}, context: Cxt): Promise<string>;
|
||||
export declare function switchTo<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({ userId }: {
|
||||
}, context: BRC<ED>): Promise<string>;
|
||||
export declare function switchTo<ED extends EntityDict>({ userId }: {
|
||||
userId: string;
|
||||
}, context: Cxt): Promise<void>;
|
||||
export declare function getWechatMpUserPhoneNumber<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({ code, env }: {
|
||||
}, context: BRC<ED>): Promise<void>;
|
||||
export declare function getWechatMpUserPhoneNumber<ED extends EntityDict>({ code, env }: {
|
||||
code: string;
|
||||
env: WechatMpEnv;
|
||||
}, context: Cxt): Promise<string>;
|
||||
export declare function logout<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<string>;
|
||||
export declare function logout<ED extends EntityDict>(params: {
|
||||
tokenValue: string;
|
||||
}, context: Cxt): Promise<void>;
|
||||
}, context: BRC<ED>): Promise<void>;
|
||||
/**
|
||||
* 创建一个当前parasite上的token
|
||||
* @param params
|
||||
* @param context
|
||||
* @returns
|
||||
*/
|
||||
export declare function wakeupParasite<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
export declare function wakeupParasite<ED extends EntityDict>(params: {
|
||||
id: string;
|
||||
env: WebEnv | WechatMpEnv | NativeEnv;
|
||||
}, context: Cxt): Promise<string>;
|
||||
export declare function refreshToken<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<string>;
|
||||
export declare function refreshToken<ED extends EntityDict>(params: {
|
||||
env: WebEnv | WechatMpEnv | NativeEnv;
|
||||
tokenValue: string;
|
||||
}, context: Cxt): Promise<string>;
|
||||
}, context: BRC<ED>): Promise<string>;
|
||||
|
|
|
|||
|
|
@ -1,23 +1,22 @@
|
|||
import { BackendRuntimeContext } from "../context/BackendRuntimeContext";
|
||||
import { EntityDict } from "../oak-app-domain";
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
||||
export declare function mergeUser<ED extends EntityDict & BaseEntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
import { BRC } from "../types/RuntimeCxt";
|
||||
export declare function mergeUser<ED extends EntityDict>(params: {
|
||||
from: string;
|
||||
to: string;
|
||||
mergeMobile?: true;
|
||||
mergeEmail?: true;
|
||||
mergeWechatUser?: true;
|
||||
}, context: Cxt, innerLogic?: boolean): Promise<void>;
|
||||
export declare function getChangePasswordChannels<ED extends EntityDict & BaseEntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>, innerLogic?: boolean): Promise<void>;
|
||||
export declare function getChangePasswordChannels<ED extends EntityDict>(params: {
|
||||
userId: string;
|
||||
}, context: Cxt, innerLogic?: boolean): Promise<string[]>;
|
||||
export declare function updateUserPassword<ED extends EntityDict & BaseEntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>, innerLogic?: boolean): Promise<string[]>;
|
||||
export declare function updateUserPassword<ED extends EntityDict>(params: {
|
||||
userId: string;
|
||||
prevPassword?: string;
|
||||
captcha?: string;
|
||||
newPassword: string;
|
||||
mobile?: string;
|
||||
}, context: Cxt, innerLogic?: boolean): Promise<{
|
||||
}, context: BRC<ED>, innerLogic?: boolean): Promise<{
|
||||
result: string;
|
||||
times: number;
|
||||
} | {
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
import { BackendRuntimeContext } from "../context/BackendRuntimeContext";
|
||||
import { EntityDict } from "../oak-app-domain";
|
||||
import { WebEnv, WechatMpEnv } from 'oak-domain/lib/types/Environment';
|
||||
export declare function confirmUserEntityGrant<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
id: string;
|
||||
env: WebEnv | WechatMpEnv;
|
||||
}, context: Cxt): Promise<void>;
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
export async function confirmUserEntityGrant(params, context) {
|
||||
/* const { id, env } = params;
|
||||
const { userId } = context.getToken()!;
|
||||
const [userEntityGrant] = await context.select(
|
||||
'userEntityGrant',
|
||||
{
|
||||
data: {
|
||||
id: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
relationId: 1,
|
||||
number: 1,
|
||||
confirmed: 1,
|
||||
},
|
||||
filter: {
|
||||
id,
|
||||
},
|
||||
indexFrom: 0,
|
||||
count: 1,
|
||||
},
|
||||
{
|
||||
dontCollect: true,
|
||||
}
|
||||
);
|
||||
const closeRootMode = context.openRootMode();
|
||||
const { number, confirmed } = userEntityGrant;
|
||||
if (confirmed! >= number!) {
|
||||
closeRootMode()
|
||||
throw new OakUserException(`超出分享上限人数${number}人`);
|
||||
}
|
||||
Object.assign(userEntityGrant, {
|
||||
confirmed: confirmed! + 1,
|
||||
});
|
||||
if (number === 1) {
|
||||
// 单次分享 附上接收者id
|
||||
Object.assign(userEntityGrant, {
|
||||
granteeId: userId,
|
||||
});
|
||||
}
|
||||
|
||||
const { entity, entityId, relationId, granterId, type } =
|
||||
userEntityGrant;
|
||||
|
||||
const result2 = await context.select(
|
||||
'userRelation',
|
||||
{
|
||||
data: {
|
||||
id: 1,
|
||||
userId: 1,
|
||||
relationId: 1,
|
||||
},
|
||||
filter: {
|
||||
userId: userId!,
|
||||
relationId,
|
||||
entity,
|
||||
entityId,
|
||||
},
|
||||
indexFrom: 0,
|
||||
count: 1,
|
||||
},
|
||||
{
|
||||
dontCollect: true,
|
||||
}
|
||||
);
|
||||
if (result2.length) {
|
||||
const e = new OakRowInconsistencyException<EntityDict>(undefined, '已领取该权限');
|
||||
e.addData('userRelation', result2);
|
||||
closeRootMode();
|
||||
throw e;
|
||||
} else {
|
||||
try {
|
||||
await context.operate(
|
||||
'userRelation',
|
||||
{
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'create',
|
||||
data: {
|
||||
id: await generateNewIdAsync(),
|
||||
userId,
|
||||
relationId,
|
||||
entity,
|
||||
entityId,
|
||||
},
|
||||
},
|
||||
{
|
||||
dontCollect: true,
|
||||
}
|
||||
);
|
||||
// todo type是转让的话 需要回收授权者的关系
|
||||
if (type === 'transfer') {
|
||||
await context.operate(
|
||||
'userRelation',
|
||||
{
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'remove',
|
||||
data: {},
|
||||
filter: {
|
||||
relationId,
|
||||
userId: granterId,
|
||||
entity,
|
||||
entityId,
|
||||
},
|
||||
},
|
||||
{
|
||||
dontCollect: true,
|
||||
}
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
closeRootMode();
|
||||
throw err;
|
||||
}
|
||||
|
||||
closeRootMode();
|
||||
return 1;
|
||||
} */
|
||||
}
|
||||
|
|
@ -1,42 +1,42 @@
|
|||
import { EntityDict } from "../oak-app-domain";
|
||||
import { BackendRuntimeContext } from "../context/BackendRuntimeContext";
|
||||
export declare function getTagUsers<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
export declare function getTagUsers<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
tagId: number;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function batchtagging<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function batchtagging<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
openIdList: string[];
|
||||
tagId: number;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function batchuntagging<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function batchuntagging<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
openIdList: string[];
|
||||
tagId: number;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function getUserTags<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function getUserTags<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
openId: string;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function getUsers<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function getUsers<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
nextOpenId: string;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function getSubscribedUserInfo<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function getSubscribedUserInfo<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
openId: string;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function tagging<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function tagging<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
openId: string;
|
||||
tagIdList: number[];
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function syncToLocale<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function syncToLocale<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
openId: string;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function syncToWechat<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function syncToWechat<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
id: string;
|
||||
openId: string;
|
||||
}, context: Cxt): Promise<any>;
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { EntityDict } from "../oak-app-domain";
|
||||
import { BackendRuntimeContext } from "../context/BackendRuntimeContext";
|
||||
export declare function createWechatLogin<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
export declare function createWechatLogin<ED extends EntityDict>(params: {
|
||||
type: EntityDict['wechatLogin']['Schema']['type'];
|
||||
interval: number;
|
||||
}, context: Cxt): Promise<string>;
|
||||
}, context: BRC<ED>): Promise<string>;
|
||||
|
|
|
|||
|
|
@ -1,25 +1,25 @@
|
|||
import { EntityDict } from '../oak-app-domain';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
export declare function getCurrentMenu<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
export declare function getCurrentMenu<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function getMenu<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function getMenu<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function createMenu<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function createMenu<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
menuConfig: any;
|
||||
id: string;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function createConditionalMenu<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function createConditionalMenu<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
menuConfig: any;
|
||||
id: string;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function deleteConditionalMenu<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function deleteConditionalMenu<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
menuId: number;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function deleteMenu<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function deleteMenu<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
}, context: Cxt): Promise<any>;
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { EntityDict } from "../oak-app-domain";
|
||||
import { BackendRuntimeContext } from "../context/BackendRuntimeContext";
|
||||
export declare function wechatMpJump<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
import { BRC } from "../types/RuntimeCxt";
|
||||
export declare function wechatMpJump<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
jump_wxa: {
|
||||
path?: string;
|
||||
|
|
@ -10,4 +10,4 @@ export declare function wechatMpJump<ED extends EntityDict, Cxt extends BackendR
|
|||
expireType?: number;
|
||||
expiresAt?: number;
|
||||
expireInterval?: number;
|
||||
}, context: Cxt): Promise<any>;
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
import { EntityDict } from '../oak-app-domain';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
export declare function createTag<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
export declare function createTag<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
name: string;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function getTags<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function getTags<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function editTag<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function editTag<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
id: number;
|
||||
name: string;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function deleteTag<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function deleteTag<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
id: string;
|
||||
wechatId: number;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function syncTag<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function syncTag<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
id: string;
|
||||
}, context: Cxt): Promise<any>;
|
||||
export declare function oneKeySync<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
export declare function oneKeySync<ED extends EntityDict>(params: {
|
||||
applicationId: string;
|
||||
}, context: Cxt): Promise<any>;
|
||||
}, context: BRC<ED>): Promise<any>;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { EntityDict } from "../oak-app-domain";
|
||||
import { QrCodeType } from '../types/Config';
|
||||
import { WechatQrCodeProps } from '../oak-app-domain/WechatQrCode/Schema';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
/**
|
||||
* 生成二维码优先级如下:
|
||||
* 0)如果在SystemConfig中指定了qrCodeType,则按照qrCodeType去生成
|
||||
|
|
@ -11,12 +11,12 @@ import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
|||
* @param context
|
||||
* @returns
|
||||
*/
|
||||
export declare function createWechatQrCode<ED extends EntityDict, T extends keyof ED, Cxt extends BackendRuntimeContext<ED>>(options: {
|
||||
export declare function createWechatQrCode<ED extends EntityDict, T extends keyof ED>(options: {
|
||||
entity: T;
|
||||
entityId: string;
|
||||
tag?: string;
|
||||
permanent?: boolean;
|
||||
type?: QrCodeType;
|
||||
props: WechatQrCodeProps;
|
||||
}, context: Cxt): Promise<void>;
|
||||
export declare function getMpUnlimitWxaCode<ED extends EntityDict, T extends keyof ED, Cxt extends BackendRuntimeContext<ED>>(wechatQrCodeId: string, context: Cxt): Promise<string>;
|
||||
}, context: BRC<ED>): Promise<void>;
|
||||
export declare function getMpUnlimitWxaCode<ED extends EntityDict>(wechatQrCodeId: string, context: BRC<ED>): Promise<string>;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { EntityDict } from "../oak-app-domain";
|
||||
import { BackendRuntimeContext } from "../context/BackendRuntimeContext";
|
||||
export declare function unbindingWechat<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
||||
import { BRC } from "../types/RuntimeCxt";
|
||||
export declare function unbindingWechat<ED extends EntityDict>(params: {
|
||||
wechatUserId: string;
|
||||
captcha?: string;
|
||||
mobile?: string;
|
||||
}, context: Cxt): Promise<void>;
|
||||
}, context: BRC<ED>): Promise<void>;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Checker } from "oak-domain/lib/types";
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||
declare const checkers: Checker<EntityDict, 'address', RuntimeCxt>[];
|
||||
declare const checkers: Checker<EntityDict, 'address', RuntimeCxt<EntityDict>>[];
|
||||
export default checkers;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Checker } from 'oak-domain/lib/types';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||
declare const checkers: Checker<EntityDict, 'application', RuntimeCxt>[];
|
||||
declare const checkers: Checker<EntityDict, 'application', RuntimeCxt<EntityDict>>[];
|
||||
export default checkers;
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
declare const checkers: (import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "parasite", import("..").RuntimeCxt> | import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "message", import("..").RuntimeCxt> | import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "wechatPublicTag", import("..").RuntimeCxt> | import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "mobile", import("..").RuntimeCxt> | import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "wechatQrCode", import("..").RuntimeCxt> | import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "userEntityGrant", import("..").RuntimeCxt> | import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "user", import("..").RuntimeCxt> | import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "token", import("..").RuntimeCxt> | import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "application", import("..").RuntimeCxt> | import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "address", import("..").RuntimeCxt>)[];
|
||||
declare const checkers: (import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "address", import("..").RuntimeCxt<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "application", import("..").RuntimeCxt<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "token", import("..").RuntimeCxt<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "user", import("..").RuntimeCxt<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "userEntityGrant", import("..").RuntimeCxt<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "wechatQrCode", import("..").RuntimeCxt<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "mobile", import("..").RuntimeCxt<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "wechatPublicTag", import("..").RuntimeCxt<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "message", import("..").RuntimeCxt<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Checker<import("../oak-app-domain").EntityDict, "parasite", import("..").RuntimeCxt<import("../oak-app-domain").EntityDict>>)[];
|
||||
export default checkers;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Checker } from "oak-domain/lib/types";
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||
declare const checkers: Checker<EntityDict, 'message', RuntimeCxt>[];
|
||||
declare const checkers: Checker<EntityDict, 'message', RuntimeCxt<EntityDict>>[];
|
||||
export default checkers;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Checker } from 'oak-domain/lib/types';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||
declare const checkers: Checker<EntityDict, 'mobile', RuntimeCxt>[];
|
||||
declare const checkers: Checker<EntityDict, 'mobile', RuntimeCxt<EntityDict>>[];
|
||||
export default checkers;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Checker } from 'oak-domain/lib/types';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||
declare const checkers: Checker<EntityDict, 'parasite', RuntimeCxt>[];
|
||||
declare const checkers: Checker<EntityDict, 'parasite', RuntimeCxt<EntityDict>>[];
|
||||
export default checkers;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Checker } from 'oak-domain/lib/types';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||
declare const checkers: Checker<EntityDict, 'platform', RuntimeCxt>[];
|
||||
declare const checkers: Checker<EntityDict, 'platform', RuntimeCxt<EntityDict>>[];
|
||||
export default checkers;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Checker } from 'oak-domain/lib/types';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||
declare const checkers: Checker<EntityDict, 'system', RuntimeCxt>[];
|
||||
declare const checkers: Checker<EntityDict, 'system', RuntimeCxt<EntityDict>>[];
|
||||
export default checkers;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Checker } from "oak-domain/lib/types";
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { RuntimeCxt } from "../types/RuntimeCxt";
|
||||
declare const checkers: Checker<EntityDict, 'token', RuntimeCxt>[];
|
||||
declare const checkers: Checker<EntityDict, 'token', RuntimeCxt<EntityDict>>[];
|
||||
export default checkers;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Checker } from "oak-domain/lib/types";
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { RuntimeCxt } from "../types/RuntimeCxt";
|
||||
declare const checkers: Checker<EntityDict, 'user', RuntimeCxt>[];
|
||||
declare const checkers: Checker<EntityDict, 'user', RuntimeCxt<EntityDict>>[];
|
||||
export default checkers;
|
||||
export declare const UserCheckers: Checker<EntityDict, 'user', RuntimeCxt>[];
|
||||
export declare const UserCheckers: Checker<EntityDict, 'user', RuntimeCxt<EntityDict>>[];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Checker } from 'oak-domain/lib/types';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||
declare const checkers: Checker<EntityDict, 'userEntityGrant', RuntimeCxt>[];
|
||||
declare const checkers: Checker<EntityDict, 'userEntityGrant', RuntimeCxt<EntityDict>>[];
|
||||
export default checkers;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Checker } from 'oak-domain/lib/types';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||
declare const checkers: Checker<EntityDict, 'wechatPublicTag', RuntimeCxt>[];
|
||||
declare const checkers: Checker<EntityDict, 'wechatPublicTag', RuntimeCxt<EntityDict>>[];
|
||||
export default checkers;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Checker } from 'oak-domain/lib/types';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||
declare const checkers: Checker<EntityDict, 'wechatQrCode', RuntimeCxt>[];
|
||||
declare const checkers: Checker<EntityDict, 'wechatQrCode', RuntimeCxt<EntityDict>>[];
|
||||
export default checkers;
|
||||
|
|
|
|||
|
|
@ -43,17 +43,9 @@ export default OakComponent({
|
|||
});
|
||||
},
|
||||
callAreaPicker() {
|
||||
const event = 'address:upsert:selectArea';
|
||||
this.subEvent(event, ({ id }) => {
|
||||
this.update({
|
||||
areaId: id,
|
||||
});
|
||||
this.navigateBack();
|
||||
});
|
||||
this.navigateTo({
|
||||
url: '/pickers/area',
|
||||
}, {
|
||||
itemSelectedEvent: event,
|
||||
depth: 3,
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { Style } from '../../../../types/Style';
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../../oak-app-domain").EntityDict, keyof import("../../../../oak-app-domain").EntityDict, false, {
|
||||
style: Style;
|
||||
entity: "application" | "platform" | "system";
|
||||
entity: "application" | "system" | "platform";
|
||||
entityId: string;
|
||||
name: string;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { Config } from '../../../types/Config';
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, false, {
|
||||
config: Config;
|
||||
entity: "platform" | "system";
|
||||
entity: "system" | "platform";
|
||||
name: string;
|
||||
entityId: string;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
|||
import { ReactComponentProps } from 'oak-frontend-base/lib/types/Page';
|
||||
import { ButtonProps } from 'antd';
|
||||
import { ButtonProps as AmButtonProps } from 'antd-mobile';
|
||||
type AfterCommit = ((id?: string) => void) | undefined;
|
||||
type AfterCommit = (() => void) | undefined;
|
||||
type BeforeCommit = (() => boolean | undefined | Promise<boolean | undefined>) | undefined;
|
||||
declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends keyof ED2>(props: ReactComponentProps<ED2, T2, true, {
|
||||
action?: string | undefined;
|
||||
|
|
@ -12,21 +12,21 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
|
|||
type?: ButtonProps['type'] | AmButtonProps['type'];
|
||||
executeText?: string | undefined;
|
||||
buttonProps?: (ButtonProps & {
|
||||
color?: "success" | "default" | "warning" | "primary" | "danger" | undefined;
|
||||
color?: "default" | "success" | "warning" | "primary" | "danger" | undefined;
|
||||
fill?: "none" | "solid" | "outline" | undefined;
|
||||
size?: "small" | "middle" | "large" | "mini" | undefined;
|
||||
size?: "small" | "large" | "middle" | "mini" | undefined;
|
||||
block?: boolean | undefined;
|
||||
loading?: boolean | "auto" | undefined;
|
||||
loadingText?: string | undefined;
|
||||
loadingIcon?: import("react").ReactNode;
|
||||
disabled?: boolean | undefined;
|
||||
onClick?: ((event: import("react").MouseEvent<HTMLButtonElement, MouseEvent>) => unknown) | undefined;
|
||||
type?: "button" | "submit" | "reset" | undefined;
|
||||
type?: "reset" | "submit" | "button" | undefined;
|
||||
shape?: "default" | "rounded" | "rectangular" | undefined;
|
||||
children?: import("react").ReactNode;
|
||||
} & Pick<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement>, "id" | "onMouseDown" | "onMouseUp" | "onTouchEnd" | "onTouchStart"> & {
|
||||
} & Pick<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement>, "id" | "onMouseUp" | "onMouseDown" | "onTouchStart" | "onTouchEnd"> & {
|
||||
className?: string | undefined;
|
||||
style?: (import("react").CSSProperties & Partial<Record<"--background-color" | "--border-color" | "--text-color" | "--border-width" | "--border-radius" | "--border-style", string>>) | undefined;
|
||||
style?: (import("react").CSSProperties & Partial<Record<"--text-color" | "--background-color" | "--border-radius" | "--border-width" | "--border-style" | "--border-color", string>>) | undefined;
|
||||
tabIndex?: number | undefined;
|
||||
} & import("react").AriaAttributes) | undefined;
|
||||
afterCommit?: AfterCommit;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ export default OakComponent({
|
|||
},
|
||||
data: {
|
||||
failureIds: undefined,
|
||||
currentId: undefined,
|
||||
},
|
||||
lifetimes: {
|
||||
ready() {
|
||||
|
|
@ -130,42 +129,36 @@ export default OakComponent({
|
|||
return;
|
||||
}
|
||||
}
|
||||
const id = this.getId();
|
||||
await this.execute(undefined, messageProps);
|
||||
const failureIds = await this.upload(ids);
|
||||
if (failureIds && failureIds.length > 0) {
|
||||
this.setState({
|
||||
failureIds,
|
||||
currentId: id,
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
failureIds: undefined,
|
||||
currentId: undefined,
|
||||
});
|
||||
if (afterCommit) {
|
||||
afterCommit(id);
|
||||
afterCommit();
|
||||
}
|
||||
}
|
||||
else {
|
||||
const { failureIds, currentId } = this.state;
|
||||
const id2 = currentId;
|
||||
const { failureIds } = this.state;
|
||||
assert(failureIds && failureIds.length > 0);
|
||||
const failureIds2 = await this.upload(failureIds);
|
||||
if (failureIds2 && failureIds2.length > 0) {
|
||||
this.setState({
|
||||
failureIds: failureIds2,
|
||||
currentId: id2,
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
failureIds: undefined,
|
||||
currentId: undefined,
|
||||
});
|
||||
if (afterCommit) {
|
||||
afterCommit(id2);
|
||||
afterCommit();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -91,12 +91,6 @@ export default OakComponent({
|
|||
if (typeof callback === 'function') {
|
||||
callback();
|
||||
}
|
||||
else if (eventLoggedIn) {
|
||||
this.pubEvent(eventLoggedIn);
|
||||
}
|
||||
else {
|
||||
this.navigateBack();
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
this.setMessage({
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { MobileOutlined, DeleteOutlined } from '@ant-design/icons';
|
|||
import MobileLogin from '../login';
|
||||
export default function render(props) {
|
||||
const { mobiles, allowRemove, tokenMobileId, showBack = false } = props.data;
|
||||
const { goAddMobile, removeItem, recoverItem, execute, subEvent } = props.methods;
|
||||
const { goAddMobile, removeItem, recoverItem, execute } = props.methods;
|
||||
const [open, setOpen] = useState(false);
|
||||
const eventLoggedIn = `user:info:login:${Date.now()}`;
|
||||
return (<>
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ export default OakComponent({
|
|||
});
|
||||
}
|
||||
else {
|
||||
const relationId = await this.features.relationAuth.getRelationIdByName(entity, relation);
|
||||
const relationId = await this.features.cache.getRelationIdByName(entity, relation);
|
||||
this.update({
|
||||
user: {
|
||||
id: generateNewId(),
|
||||
|
|
|
|||
|
|
@ -42,11 +42,6 @@ export default OakComponent({
|
|||
},
|
||||
]);
|
||||
}
|
||||
else if (this.props.itemSelectedEvent) {
|
||||
this.pubEvent(this.props.itemSelectedEvent, {
|
||||
id: item.id,
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log('area selected:', item);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ export default OakComponent({
|
|||
async onCellClicked(id) {
|
||||
const { event } = this.props;
|
||||
if (event) {
|
||||
this.pubEvent(event, this.state.userArr.find((ele) => ele.id === id));
|
||||
console.warn('event机制已经废除');
|
||||
}
|
||||
else {
|
||||
this.navigateTo({
|
||||
|
|
@ -148,10 +148,5 @@ export default OakComponent({
|
|||
}
|
||||
this.refresh();
|
||||
},
|
||||
},
|
||||
lifetimes: {
|
||||
detached() {
|
||||
this.unsubAllEvents(this.props.event);
|
||||
},
|
||||
},
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
|
|||
entity: keyof EntityDict;
|
||||
entityFilter: any;
|
||||
relationIds: string[];
|
||||
rule: "all" | "single" | "free";
|
||||
ruleOnRow: "all" | "single" | "free";
|
||||
rule: "single" | "all" | "free";
|
||||
ruleOnRow: "single" | "all" | "free";
|
||||
onPickRelations: (ids: string[]) => void;
|
||||
onPickRows: (ids: string[]) => void;
|
||||
pickedRowIds: string[] | undefined;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
|
|||
claimUrl: string;
|
||||
qrCodeType: QrCodeType;
|
||||
multiple: boolean;
|
||||
rule: "all" | "single" | "free";
|
||||
ruleOnRow: "all" | "single" | "free";
|
||||
rule: "single" | "all" | "free";
|
||||
ruleOnRow: "single" | "all" | "free";
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { EntityDict } from '../../../oak-app-domain';
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, keyof EntityDict, false, {
|
||||
type: "bind" | "login";
|
||||
type: "login" | "bind";
|
||||
url: string;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ export default OakComponent({
|
|||
if (str.includes('data:image/png;')) {
|
||||
return str;
|
||||
}
|
||||
return this.features.locales.makeBridgeUrl(str);
|
||||
return this.features.cache.makeBridgeUrl(str);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ export default OakComponent({
|
|||
if (str.includes('data:image/png;')) {
|
||||
return str;
|
||||
}
|
||||
return this.features.locales.makeBridgeUrl(str);
|
||||
return this.features.cache.makeBridgeUrl(str);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ export default OakComponent({
|
|||
if (str.includes('data:image/png;')) {
|
||||
return str;
|
||||
}
|
||||
return this.features.locales.makeBridgeUrl(str);
|
||||
return this.features.cache.makeBridgeUrl(str);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ export default OakComponent({
|
|||
if (str.includes('data:image/png;')) {
|
||||
return str;
|
||||
}
|
||||
return this.features.locales.makeBridgeUrl(str);
|
||||
return this.features.cache.makeBridgeUrl(str);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
import { AuthDeduceRelationMap, SelectFreeEntities, UpdateFreeDict } from 'oak-domain/lib/types/Entity';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
export declare const authDeduceRelationMap: AuthDeduceRelationMap<EntityDict>;
|
||||
export declare const selectFreeEntities: SelectFreeEntities<EntityDict>;
|
||||
export declare const updateFreeDict: UpdateFreeDict<EntityDict>;
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
// 此对象所标识的entity的权限由其外键指向的父对象判定
|
||||
export const authDeduceRelationMap = {
|
||||
extraFile: 'entity',
|
||||
message: 'entity',
|
||||
wechatQrCode: 'entity',
|
||||
};
|
||||
// 可以自由选择的对象
|
||||
export const selectFreeEntities = [
|
||||
'application',
|
||||
'domain',
|
||||
'area',
|
||||
'mobile',
|
||||
'wechatQrCode',
|
||||
'wechatLogin',
|
||||
'messageTypeTemplate',
|
||||
'articleMenu',
|
||||
'article',
|
||||
'userEntityGrant',
|
||||
'wechatMpJump',
|
||||
];
|
||||
// 可以自由更新的对象
|
||||
export const updateFreeDict = {
|
||||
userEntityGrant: ['claim'],
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
import { RenderConfiguration } from 'oak-domain/lib/types/Configuration';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
declare const _default: RenderConfiguration<EntityDict>;
|
||||
export default _default;
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
import { styleDict } from '../oak-app-domain/StyleDict';
|
||||
export default {
|
||||
styleDict,
|
||||
};
|
||||
|
|
@ -6,19 +6,19 @@ import { RuntimeContext } from './RuntimeContext';
|
|||
import GeneralAspectDict from '../aspects/AspectDict';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { SyncRowStore } from 'oak-domain/lib/store/SyncRowStore';
|
||||
import { GeneralFeatures } from '../features';
|
||||
import { FeatureDict } from '../features';
|
||||
import { BackendRuntimeContext } from './BackendRuntimeContext';
|
||||
export type AspectDict<ED extends EntityDict & BaseEntityDict, Cxt extends BackendRuntimeContext<ED>> = GeneralAspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>;
|
||||
export type AspectDict<ED extends EntityDict & BaseEntityDict> = GeneralAspectDict<ED, BackendRuntimeContext<ED>> & CommonAspectDict<ED, BackendRuntimeContext<ED>>;
|
||||
export interface SerializedData extends Fsd {
|
||||
a?: string;
|
||||
t?: string;
|
||||
userId?: string;
|
||||
rm?: boolean;
|
||||
}
|
||||
export declare abstract class FrontendRuntimeContext<ED extends EntityDict & BaseEntityDict, Cxt extends BackendRuntimeContext<ED>, AD extends AspectDict<ED, Cxt>> extends Frc<ED, Cxt, AD> implements RuntimeContext {
|
||||
export declare abstract class FrontendRuntimeContext<ED extends EntityDict & BaseEntityDict> extends Frc<ED, BackendRuntimeContext<ED>, GeneralAspectDict<ED, BackendRuntimeContext<ED>>> implements RuntimeContext {
|
||||
private application;
|
||||
private token;
|
||||
constructor(store: SyncRowStore<ED, FrontendRuntimeContext<ED, Cxt, AD>>, features: GeneralFeatures<ED, Cxt, FrontendRuntimeContext<ED, Cxt, AD>, AD> & BasicFeatures<ED, Cxt, FrontendRuntimeContext<ED, Cxt, AD>, AD>);
|
||||
constructor(store: SyncRowStore<ED, FrontendRuntimeContext<ED>>, features: FeatureDict<ED> & BasicFeatures<ED>);
|
||||
protected getSerializedData(): Promise<SerializedData>;
|
||||
getApplicationId(): string;
|
||||
getSystemId(): string | undefined;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { registerWeChatPublicEventCallback } from './wechat';
|
||||
declare const _default: {
|
||||
[x: string]: import("oak-domain/lib/types").Endpoint<import("../oak-app-domain").EntityDict, import("..").BRC>;
|
||||
[x: string]: import("oak-domain/lib/types").Endpoint<import("../oak-app-domain").EntityDict, import("..").BRC<import("../oak-app-domain").EntityDict>>;
|
||||
};
|
||||
export default _default;
|
||||
export { registerWeChatPublicEventCallback, };
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@ import { Endpoint } from 'oak-domain/lib/types/Endpoint';
|
|||
import { EntityDict } from '../oak-app-domain';
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
import { WechatPublicEventData } from 'oak-external-sdk/lib/types/Wechat';
|
||||
export declare function registerWeChatPublicEventCallback(appId: string, callback: (data: WechatPublicEventData, context: BRC) => void): void;
|
||||
declare const endpoints: Record<string, Endpoint<EntityDict, BRC>>;
|
||||
export declare function registerWeChatPublicEventCallback(appId: string, callback: (data: WechatPublicEventData, context: BRC<EntityDict>) => void): void;
|
||||
declare const endpoints: Record<string, Endpoint<EntityDict, BRC<EntityDict>>>;
|
||||
export default endpoints;
|
||||
|
|
|
|||
|
|
@ -1,26 +1,18 @@
|
|||
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { AppType } from '../oak-app-domain/Application/Schema';
|
||||
import AspectDict from '../aspects/AspectDict';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
|
||||
import { MediaType, MediaVideoDescription } from '../types/WeChat';
|
||||
export declare class Application<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
|
||||
private type;
|
||||
private domain;
|
||||
export declare class Application<ED extends EntityDict> extends Feature {
|
||||
private applicationId?;
|
||||
private application?;
|
||||
private cache;
|
||||
private storage;
|
||||
private projection;
|
||||
constructor(type: AppType, domain: string, cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>, storage: LocalStorage);
|
||||
private refresh;
|
||||
constructor(cache: Cache<ED>, storage: LocalStorage);
|
||||
private getApplicationFromCache;
|
||||
private loadApplicationInfo;
|
||||
initialize(appId?: string | null, projection?: EntityDict['application']['Selection']['data']): Promise<void>;
|
||||
initialize(domain: string, appId?: string | null, projection?: EntityDict['application']['Selection']['data']): Promise<void>;
|
||||
getApplication(): Partial<import("../oak-app-domain/Application/Schema").Schema> | undefined;
|
||||
getApplicationId(): string;
|
||||
uploadWechatMedia(params: {
|
||||
|
|
@ -29,5 +21,5 @@ export declare class Application<ED extends EntityDict, Cxt extends BackendRunti
|
|||
type: MediaType;
|
||||
isPermanent?: boolean;
|
||||
description?: MediaVideoDescription;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["uploadWechatMedia"]>>;
|
||||
}): Promise<any>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,39 +1,20 @@
|
|||
import { LOCAL_STORAGE_KEYS } from '../config/constants';
|
||||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { cloneDeep, merge } from 'oak-domain/lib/utils/lodash';
|
||||
import { applicationProjection } from '../types/Projection';
|
||||
import { OakApplicationLoadingException, } from '../types/Exception';
|
||||
export class Application extends Feature {
|
||||
type;
|
||||
domain; //域名
|
||||
applicationId;
|
||||
application;
|
||||
cache;
|
||||
storage;
|
||||
projection;
|
||||
constructor(type, domain, cache, storage) {
|
||||
constructor(cache, storage) {
|
||||
super();
|
||||
this.cache = cache;
|
||||
this.storage = storage;
|
||||
this.type = type;
|
||||
this.domain = domain;
|
||||
this.projection = cloneDeep(applicationProjection);
|
||||
}
|
||||
async refresh() {
|
||||
const { data } = await this.cache.refresh('application', {
|
||||
data: this.projection,
|
||||
filter: {
|
||||
id: this.applicationId,
|
||||
},
|
||||
});
|
||||
assert(data.length === 1, `refresh:applicationId${this.applicationId}没有取到有效数据`);
|
||||
this.application = data[0];
|
||||
this.publish();
|
||||
if (this.application.type !== this.type) {
|
||||
this.storage.remove(LOCAL_STORAGE_KEYS.appId);
|
||||
}
|
||||
}
|
||||
getApplicationFromCache() {
|
||||
const data = this.cache.get('application', {
|
||||
data: this.projection,
|
||||
|
|
@ -44,18 +25,27 @@ export class Application extends Feature {
|
|||
assert(data.length === 1, `cache:applicationId${this.applicationId}没有取到有效数据`);
|
||||
this.application = data[0];
|
||||
}
|
||||
async loadApplicationInfo(type, domain) {
|
||||
async loadApplicationInfo(domain) {
|
||||
let applicationId;
|
||||
try {
|
||||
const { result } = await this.cache.exec('getApplication', {
|
||||
type,
|
||||
domain,
|
||||
}, undefined, true, true);
|
||||
applicationId = result;
|
||||
let appType = 'web';
|
||||
if (process.env.OAK_PLATFORM === 'wechatMp') {
|
||||
appType = 'wechatMp';
|
||||
}
|
||||
catch (err) {
|
||||
throw err;
|
||||
else if (process.env.OAK_PLATFORM === 'native') {
|
||||
appType = 'native';
|
||||
}
|
||||
else {
|
||||
if (/MicroMessenger/i.test(window.navigator.userAgent)) {
|
||||
appType = 'wechatPublic';
|
||||
}
|
||||
}
|
||||
const { result } = await this.cache.exec('getApplication', {
|
||||
type: appType,
|
||||
domain,
|
||||
data: this.projection,
|
||||
appId: this.applicationId
|
||||
}, undefined, true, true);
|
||||
applicationId = result;
|
||||
this.applicationId = applicationId;
|
||||
this.getApplicationFromCache();
|
||||
// 如果取得的type和当前环境不同,则不缓存id(未来可能有type相同的application上线)
|
||||
|
|
@ -64,7 +54,7 @@ export class Application extends Feature {
|
|||
// }
|
||||
this.publish();
|
||||
}
|
||||
async initialize(appId, projection) {
|
||||
async initialize(domain, appId, projection) {
|
||||
// const applicationId = await this.storage.load(LOCAL_STORAGE_KEYS.appId);
|
||||
// this.applicationId = applicationId;
|
||||
//接收外层注入的projection
|
||||
|
|
@ -72,16 +62,8 @@ export class Application extends Feature {
|
|||
if (process.env.NODE_ENV === 'development' && appId) {
|
||||
// development环境下允许注入一个线上的appId
|
||||
this.applicationId = appId;
|
||||
if (this.applicationId) {
|
||||
return await this.refresh();
|
||||
}
|
||||
}
|
||||
// if (this.applicationId) {
|
||||
// await this.refresh();
|
||||
// } else {
|
||||
// await this.loadApplicationInfo(this.type, this.domain);
|
||||
// }
|
||||
return await this.loadApplicationInfo(this.type, this.domain);
|
||||
return await this.loadApplicationInfo(domain);
|
||||
}
|
||||
getApplication() {
|
||||
if (this.applicationId === undefined) {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
import AspectDict from '../aspects/AspectDict';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||
import { Config as ConfigDef } from '../types/Config';
|
||||
import { Style as StyleDef } from '../types/Style';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
|
||||
export declare class Config<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
|
||||
export declare class Config<ED extends EntityDict> extends Feature {
|
||||
private cache;
|
||||
constructor(cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>);
|
||||
constructor(cache: Cache<ED>);
|
||||
updateConfig(entity: 'platform' | 'system', entityId: string, config: ConfigDef): Promise<void>;
|
||||
updateApplicationConfig(entity: 'application', entityId: string, config: EntityDict['application']['Schema']['config']): Promise<void>;
|
||||
updateStyle(entity: 'platform' | 'system' | 'application', entityId: string, style: StyleDef): Promise<void>;
|
||||
|
|
|
|||
|
|
@ -1,21 +1,13 @@
|
|||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||
import { RunningTree } from 'oak-frontend-base/es/features/runningTree';
|
||||
import { Locales } from 'oak-frontend-base/es/features/locales';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import AspectDict from '../aspects/AspectDict';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
|
||||
import { Application } from './application';
|
||||
export type FileState = 'local' | 'uploading' | 'uploaded' | 'failed';
|
||||
export declare class ExtraFile<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
|
||||
export declare class ExtraFile<ED extends EntityDict> extends Feature {
|
||||
private cache;
|
||||
private application;
|
||||
private locales;
|
||||
private files;
|
||||
private runningTree;
|
||||
constructor(cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>, application: Application<ED, Cxt, FrontCxt, AD>, locales: Locales<ED, Cxt, FrontCxt, AD>, runningTree: RunningTree<ED, Cxt, FrontCxt, AD>);
|
||||
constructor(cache: Cache<ED>, application: Application<ED>);
|
||||
addLocalFile(id: string, file: File | string): void;
|
||||
removeLocalFiles(ids: string[]): void;
|
||||
upload(id: string, entity: keyof ED): Promise<void>;
|
||||
|
|
@ -24,8 +16,8 @@ export declare class ExtraFile<ED extends EntityDict, Cxt extends BackendRuntime
|
|||
state: FileState;
|
||||
percentage?: number;
|
||||
} | undefined;
|
||||
getFileName(extraFile: EntityDict['extraFile']['OpSchema']): string;
|
||||
getFileName(extraFile: ED['extraFile']['OpSchema']): string;
|
||||
formatBytes(size: number): string;
|
||||
autoUpload(extraFile: EntityDict['extraFile']['OpSchema'], file: File | string, style?: string): Promise<string>;
|
||||
autoUpload(extraFile: ED['extraFile']['OpSchema'], file: File | string, style?: string): Promise<string>;
|
||||
private uploadToAspect;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,16 +9,12 @@ import { extraFileProjection } from '../types/Projection';
|
|||
export class ExtraFile extends Feature {
|
||||
cache;
|
||||
application;
|
||||
locales;
|
||||
files;
|
||||
runningTree;
|
||||
constructor(cache, application, locales, runningTree) {
|
||||
constructor(cache, application) {
|
||||
super();
|
||||
this.cache = cache;
|
||||
this.application = application;
|
||||
this.locales = locales;
|
||||
this.files = {};
|
||||
this.runningTree = runningTree;
|
||||
}
|
||||
addLocalFile(id, file) {
|
||||
assert(!this.files[id]);
|
||||
|
|
@ -136,7 +132,7 @@ export class ExtraFile extends Feature {
|
|||
return '';
|
||||
}
|
||||
if (extraFile?.isBridge && extraFile?.extra1) {
|
||||
return this.locales.makeBridgeUrl(extraFile?.extra1);
|
||||
return this.cache.makeBridgeUrl(extraFile?.extra1);
|
||||
}
|
||||
const { id } = extraFile;
|
||||
if (this.files[id]) {
|
||||
|
|
@ -154,9 +150,7 @@ export class ExtraFile extends Feature {
|
|||
return extra1 || '';
|
||||
}
|
||||
const cos = getCos(origin);
|
||||
const context = this.cache.begin();
|
||||
this.cache.commit();
|
||||
return cos.composeFileUrl(extraFile, context, style);
|
||||
return cos.composeFileUrl(extraFile, this.application.getApplication(), style);
|
||||
}
|
||||
getFileState(id) {
|
||||
if (this.files[id]) {
|
||||
|
|
|
|||
|
|
@ -1,30 +1,25 @@
|
|||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { Token } from './token';
|
||||
import { ExtraFile } from './extraFile';
|
||||
import { Application } from './application';
|
||||
import { Config } from './config';
|
||||
import { Template } from './template';
|
||||
import { WeiXinJsSdk } from './weiXinJsSdk';
|
||||
import { WechatSdk } from './wechatSdk';
|
||||
import { WechatMenu } from './wechatMenu';
|
||||
import { WechatPublicTag } from './wechatPublicTag';
|
||||
import { UserWechatPublicTag } from './userWechatPublicTag';
|
||||
import { BasicFeatures } from 'oak-frontend-base';
|
||||
import AspectDict from '../aspects/AspectDict';
|
||||
import { AppType } from '../oak-app-domain/Application/Schema';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import Theme from './theme';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
|
||||
export declare function initialize<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>>(basicFeatures: BasicFeatures<ED, Cxt, FrontCxt, AD>, type: AppType, domain: string): GeneralFeatures<ED, Cxt, FrontCxt, AD>;
|
||||
export type GeneralFeatures<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> = {
|
||||
token: Token<ED, Cxt, FrontCxt, AD>;
|
||||
extraFile: ExtraFile<ED, Cxt, FrontCxt, AD>;
|
||||
application: Application<ED, Cxt, FrontCxt, AD>;
|
||||
config: Config<ED, Cxt, FrontCxt, AD>;
|
||||
template: Template<ED, Cxt, FrontCxt, AD>;
|
||||
weiXinJsSdk: WeiXinJsSdk<ED, Cxt, FrontCxt, AD>;
|
||||
theme: Theme<ED, Cxt, FrontCxt, AD>;
|
||||
wechatMenu: WechatMenu<ED, Cxt, FrontCxt, AD>;
|
||||
wechatPublicTag: WechatPublicTag<ED, Cxt, FrontCxt, AD>;
|
||||
userWechatPublicTag: UserWechatPublicTag<ED, Cxt, FrontCxt, AD>;
|
||||
export declare function initialize<ED extends EntityDict>(basicFeatures: BasicFeatures<ED>): FeatureDict<ED>;
|
||||
export type FeatureDict<ED extends EntityDict> = {
|
||||
token: Token<ED>;
|
||||
extraFile: ExtraFile<ED>;
|
||||
application: Application<ED>;
|
||||
config: Config<ED>;
|
||||
template: Template<ED>;
|
||||
wechatSdk: WechatSdk<ED>;
|
||||
theme: Theme;
|
||||
wechatMenu: WechatMenu<ED>;
|
||||
wechatPublicTag: WechatPublicTag<ED>;
|
||||
userWechatPublicTag: UserWechatPublicTag<ED>;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,29 +3,29 @@ import { ExtraFile } from './extraFile';
|
|||
import { Application } from './application';
|
||||
import { Config } from './config';
|
||||
import { Template } from './template';
|
||||
import { WeiXinJsSdk } from './weiXinJsSdk';
|
||||
import { WechatSdk } from './wechatSdk';
|
||||
import { WechatMenu } from './wechatMenu';
|
||||
import { WechatPublicTag } from './wechatPublicTag';
|
||||
import { UserWechatPublicTag } from './userWechatPublicTag';
|
||||
import Theme from './theme';
|
||||
export function initialize(basicFeatures, type, domain) {
|
||||
export function initialize(basicFeatures) {
|
||||
const token = new Token(basicFeatures.cache, basicFeatures.localStorage, basicFeatures.environment);
|
||||
const application = new Application(type, domain, basicFeatures.cache, basicFeatures.localStorage);
|
||||
const application = new Application(basicFeatures.cache, basicFeatures.localStorage);
|
||||
const wechatMenu = new WechatMenu(basicFeatures.cache, basicFeatures.localStorage);
|
||||
const wechatPublicTag = new WechatPublicTag(basicFeatures.cache, basicFeatures.localStorage);
|
||||
const userWechatPublicTag = new UserWechatPublicTag(basicFeatures.cache, basicFeatures.localStorage);
|
||||
const extraFile = new ExtraFile(basicFeatures.cache, application, basicFeatures.locales, basicFeatures.runningTree);
|
||||
const extraFile = new ExtraFile(basicFeatures.cache, application);
|
||||
const config = new Config(basicFeatures.cache);
|
||||
const template = new Template(basicFeatures.cache);
|
||||
const weiXinJsSdk = new WeiXinJsSdk(basicFeatures.cache, basicFeatures.localStorage, basicFeatures.environment);
|
||||
const theme = new Theme(basicFeatures.cache, basicFeatures.localStorage);
|
||||
const wechatSdk = new WechatSdk(basicFeatures.cache, basicFeatures.localStorage, basicFeatures.environment);
|
||||
const theme = new Theme(basicFeatures.localStorage);
|
||||
return {
|
||||
token,
|
||||
extraFile,
|
||||
application,
|
||||
config,
|
||||
template,
|
||||
weiXinJsSdk,
|
||||
wechatSdk,
|
||||
theme,
|
||||
wechatMenu,
|
||||
wechatPublicTag,
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
import AspectDict from '../aspects/AspectDict';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
|
||||
export declare class Template<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
|
||||
export declare class Template<ED extends EntityDict> extends Feature {
|
||||
private cache;
|
||||
private messageTypes;
|
||||
constructor(cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>);
|
||||
constructor(cache: Cache<ED>);
|
||||
getMessageType(): Promise<{
|
||||
result: Awaited<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["getMessageType"]>>;
|
||||
result: any;
|
||||
message: string | null | undefined;
|
||||
}>;
|
||||
syncMessageTemplate(applicationId: string): Promise<void>;
|
||||
|
|
|
|||
|
|
@ -1,18 +1,11 @@
|
|||
import { EntityDict } from '../oak-app-domain';
|
||||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
||||
import AspectDict from '../aspects/AspectDict';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
|
||||
import { ETheme, IThemeState } from '../types/Theme';
|
||||
export default class Theme<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
|
||||
private cache;
|
||||
export default class Theme extends Feature {
|
||||
private themeState;
|
||||
private storage;
|
||||
private loadSavedState;
|
||||
constructor(cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>, storage: LocalStorage);
|
||||
constructor(storage: LocalStorage);
|
||||
get(): IThemeState;
|
||||
set(themeState: IThemeState): void;
|
||||
toggleSetting(): void;
|
||||
|
|
|
|||
|
|
@ -13,16 +13,14 @@ const initialThemeState = {
|
|||
showFooter: true,
|
||||
};
|
||||
export default class Theme extends Feature {
|
||||
cache;
|
||||
themeState;
|
||||
storage;
|
||||
async loadSavedState() {
|
||||
const themeState = await this.storage.load(LOCAL_STORAGE_KEYS.themeState);
|
||||
this.themeState = themeState;
|
||||
}
|
||||
constructor(cache, storage) {
|
||||
constructor(storage) {
|
||||
super();
|
||||
this.cache = cache;
|
||||
this.storage = storage;
|
||||
this.themeState = initialThemeState;
|
||||
this.switchThemeMode(this.themeState.themeMode);
|
||||
|
|
|
|||
|
|
@ -2,18 +2,14 @@ import { Feature } from 'oak-frontend-base/es/types/Feature';
|
|||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
||||
import { Environment } from 'oak-frontend-base/es/features/environment';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import AspectDict from '../aspects/AspectDict';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
|
||||
export declare class Token<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
|
||||
export declare class Token<ED extends EntityDict> extends Feature {
|
||||
private tokenValue?;
|
||||
private environment;
|
||||
private cache;
|
||||
private storage;
|
||||
private loadSavedToken;
|
||||
constructor(cache: Cache<ED, Cxt, FrontCxt, AD>, storage: LocalStorage, environment: Environment);
|
||||
constructor(cache: Cache<ED>, storage: LocalStorage, environment: Environment);
|
||||
refreshTokenData(tokenValue?: string): Promise<void>;
|
||||
loginByMobile(mobile: string, password?: string, captcha?: string, disableRegister?: boolean): Promise<void>;
|
||||
loginByWechatInWebEnv(wechatLoginId: string): Promise<void>;
|
||||
|
|
|
|||
|
|
@ -1,49 +1,45 @@
|
|||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import AspectDict from '../aspects/AspectDict';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
|
||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
||||
export declare class UserWechatPublicTag<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
|
||||
export declare class UserWechatPublicTag<ED extends EntityDict> extends Feature {
|
||||
private cache;
|
||||
private storage;
|
||||
constructor(cache: Cache<ED, Cxt, FrontCxt, AD>, storage: LocalStorage);
|
||||
constructor(cache: Cache<ED>, storage: LocalStorage);
|
||||
getTagUsers(params: {
|
||||
applicationId: string;
|
||||
tagId: number;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["getTagUsers"]>>;
|
||||
}): Promise<any>;
|
||||
batchtagging(params: {
|
||||
applicationId: string;
|
||||
openIdList: string[];
|
||||
tagId: number;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["batchtagging"]>>;
|
||||
}): Promise<any>;
|
||||
batchuntagging(params: {
|
||||
applicationId: string;
|
||||
openIdList: string[];
|
||||
tagId: number;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["batchuntagging"]>>;
|
||||
}): Promise<any>;
|
||||
getUserTags(params: {
|
||||
applicationId: string;
|
||||
openId: string;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["getUserTags"]>>;
|
||||
}): Promise<any>;
|
||||
getUsers(params: {
|
||||
applicationId: string;
|
||||
nextOpenId: string;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["getUsers"]>>;
|
||||
}): Promise<any>;
|
||||
tagging(params: {
|
||||
applicationId: string;
|
||||
openId: string;
|
||||
tagIdList: number[];
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["tagging"]>>;
|
||||
}): Promise<any>;
|
||||
syncToLocale(params: {
|
||||
applicationId: string;
|
||||
openId: string;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["syncToLocale"]>>;
|
||||
}): Promise<any>;
|
||||
syncToWechat(params: {
|
||||
applicationId: string;
|
||||
id: string;
|
||||
openId: string;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["syncToWechat"]>>;
|
||||
}): Promise<any>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,62 +1,58 @@
|
|||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import AspectDict from '../aspects/AspectDict';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
|
||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
||||
import { MediaType, MediaVideoDescription, MaterialType } from '../types/WeChat';
|
||||
export declare class WechatMenu<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
|
||||
export declare class WechatMenu<ED extends EntityDict> extends Feature {
|
||||
private cache;
|
||||
private storage;
|
||||
constructor(cache: Cache<ED, Cxt, FrontCxt, AD>, storage: LocalStorage);
|
||||
constructor(cache: Cache<ED>, storage: LocalStorage);
|
||||
getCurrentMenu(params: {
|
||||
applicationId: string;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["getCurrentMenu"]>>;
|
||||
}): Promise<any>;
|
||||
getMenu(params: {
|
||||
applicationId: string;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["getMenu"]>>;
|
||||
}): Promise<any>;
|
||||
createMenu(params: {
|
||||
applicationId: string;
|
||||
menuConfig: any;
|
||||
id: string;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["createMenu"]>>;
|
||||
}): Promise<any>;
|
||||
createConditionalMenu(params: {
|
||||
applicationId: string;
|
||||
menuConfig: any;
|
||||
id: string;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["createConditionalMenu"]>>;
|
||||
}): Promise<any>;
|
||||
deleteConditionalMenu(params: {
|
||||
applicationId: string;
|
||||
menuId: number;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["deleteConditionalMenu"]>>;
|
||||
}): Promise<any>;
|
||||
deleteMenu(params: {
|
||||
applicationId: string;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["deleteMenu"]>>;
|
||||
}): Promise<any>;
|
||||
batchGetArticle(params: {
|
||||
applicationId: string;
|
||||
offset?: number;
|
||||
count: number;
|
||||
noContent?: 0 | 1;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["batchGetArticle"]>>;
|
||||
}): Promise<any>;
|
||||
getArticle(params: {
|
||||
applicationId: string;
|
||||
articleId: string;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["getArticle"]>>;
|
||||
}): Promise<any>;
|
||||
createMaterial(params: {
|
||||
applicationId: string;
|
||||
type: MediaType;
|
||||
file: File;
|
||||
description?: MediaVideoDescription;
|
||||
isPermanent?: boolean;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["uploadWechatMedia"]>>;
|
||||
}): Promise<any>;
|
||||
batchGetMaterialList(params: {
|
||||
applicationId: string;
|
||||
type: MaterialType;
|
||||
offset?: number;
|
||||
count: number;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["batchGetMaterialList"]>>;
|
||||
}): Promise<any>;
|
||||
/**
|
||||
* 获取素材详情
|
||||
* @param params
|
||||
|
|
@ -66,5 +62,5 @@ export declare class WechatMenu<ED extends EntityDict, Cxt extends BackendRuntim
|
|||
applicationId: string;
|
||||
mediaId: string;
|
||||
isPermanent?: boolean;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["getMaterial"]>>;
|
||||
}): Promise<any>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,37 +1,33 @@
|
|||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import AspectDict from '../aspects/AspectDict';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
|
||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
||||
export declare class WechatPublicTag<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
|
||||
export declare class WechatPublicTag<ED extends EntityDict> extends Feature {
|
||||
private cache;
|
||||
private storage;
|
||||
constructor(cache: Cache<ED, Cxt, FrontCxt, AD>, storage: LocalStorage);
|
||||
constructor(cache: Cache<ED>, storage: LocalStorage);
|
||||
createTag(params: {
|
||||
applicationId: string;
|
||||
name: string;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["createTag"]>>;
|
||||
}): Promise<any>;
|
||||
getTags(params: {
|
||||
applicationId: string;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["getTags"]>>;
|
||||
}): Promise<any>;
|
||||
editTag(params: {
|
||||
applicationId: string;
|
||||
id: number;
|
||||
name: string;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["editTag"]>>;
|
||||
}): Promise<any>;
|
||||
deleteTag(params: {
|
||||
applicationId: string;
|
||||
id: string;
|
||||
wechatId: number;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["deleteTag"]>>;
|
||||
}): Promise<any>;
|
||||
syncTag(params: {
|
||||
applicationId: string;
|
||||
id: string;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["syncTag"]>>;
|
||||
}): Promise<any>;
|
||||
oneKeySync(params: {
|
||||
applicationId: string;
|
||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["oneKeySync"]>>;
|
||||
}): Promise<any>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
export * from './wechatSdk.web';
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
console.warn('不应该跑到这里[features/weiXinJsSdk]');
|
||||
export * from './weiXinJsSdk.web';
|
||||
export * from './wechatSdk.web';
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||
import { Message } from 'oak-frontend-base/es/features/message';
|
||||
export declare class WechatSdk<ED extends EntityDict> extends Feature {
|
||||
private cache;
|
||||
private message;
|
||||
constructor(cache: Cache<ED>, message: Message);
|
||||
wxConfig(): void;
|
||||
initWeiXinJsSDK(): Promise<void>;
|
||||
loadWeiXinJsSDK(): Promise<void>;
|
||||
/**
|
||||
* 小程序订阅模板消息
|
||||
* @param messageTypes
|
||||
* @param haveToAccept
|
||||
* @param tip
|
||||
*/
|
||||
subscribeMpMessage(messageTypes: string[], haveToAccept?: boolean, tip?: string): Promise<boolean>;
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
import { OakMpHaveToSubscribeMessage } from '../types/Exception';
|
||||
import assert from 'assert';
|
||||
export class WechatSdk extends Feature {
|
||||
cache;
|
||||
message;
|
||||
constructor(cache, message) {
|
||||
super();
|
||||
this.cache = cache;
|
||||
this.message = message;
|
||||
}
|
||||
wxConfig() {
|
||||
console.error('小程序无需该操作');
|
||||
}
|
||||
async initWeiXinJsSDK() {
|
||||
console.error('小程序无需该操作');
|
||||
}
|
||||
async loadWeiXinJsSDK() {
|
||||
console.error('小程序无需该操作');
|
||||
}
|
||||
/**
|
||||
* 小程序订阅模板消息
|
||||
* @param messageTypes
|
||||
* @param haveToAccept
|
||||
* @param tip
|
||||
*/
|
||||
async subscribeMpMessage(messageTypes, haveToAccept, tip) {
|
||||
let mttIds = this.cache.get('messageTypeTemplate', {
|
||||
data: {
|
||||
id: 1,
|
||||
templateId: 1,
|
||||
template: {
|
||||
id: 1,
|
||||
wechatId: 1,
|
||||
},
|
||||
type: 1,
|
||||
},
|
||||
filter: {
|
||||
type: {
|
||||
$in: messageTypes,
|
||||
},
|
||||
},
|
||||
}, true);
|
||||
if (mttIds.length < messageTypes.length) {
|
||||
mttIds = (await this.cache.refresh('messageTypeTemplate', {
|
||||
data: {
|
||||
id: 1,
|
||||
templateId: 1,
|
||||
template: {
|
||||
id: 1,
|
||||
wechatId: 1,
|
||||
},
|
||||
type: 1,
|
||||
},
|
||||
filter: {
|
||||
type: {
|
||||
$in: messageTypes,
|
||||
},
|
||||
},
|
||||
})).data;
|
||||
}
|
||||
assert(mttIds.length === messageTypes.length);
|
||||
const tmplIds = mttIds.map(ele => ele.template?.wechatId);
|
||||
const result = await wx.requestSubscribeMessage({
|
||||
tmplIds
|
||||
});
|
||||
const rejected = Object.keys(result).filter(ele => {
|
||||
// 排除errMsg
|
||||
if (ele === 'errMsg') {
|
||||
return false;
|
||||
}
|
||||
else if (result[ele] === 'reject') {
|
||||
return true;
|
||||
}
|
||||
else if (result[ele] !== 'accept') {
|
||||
this.message.setMessage({
|
||||
type: 'warning',
|
||||
content: `类型${ele}的模板消息被${result[ele]},请管理员查看后台`,
|
||||
});
|
||||
}
|
||||
});
|
||||
if (rejected.length > 0 && haveToAccept) {
|
||||
if (tip) {
|
||||
this.message.setMessage({
|
||||
type: 'warning',
|
||||
content: tip,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
throw new OakMpHaveToSubscribeMessage(rejected);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
||||
export declare class WechatSdk<ED extends EntityDict> extends Feature {
|
||||
private cache;
|
||||
private storage;
|
||||
constructor(cache: Cache<ED>, storage: LocalStorage);
|
||||
wxConfig(): void;
|
||||
initWeiXinJsSDK(): Promise<void>;
|
||||
loadWeiXinJsSDK(): Promise<void>;
|
||||
subscribeMpMessage(messageTypes: string[], haveToAccept?: boolean, tip?: string): Promise<boolean>;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
export class WechatSdk extends Feature {
|
||||
cache;
|
||||
storage;
|
||||
constructor(cache, storage) {
|
||||
super();
|
||||
this.cache = cache;
|
||||
this.storage = storage;
|
||||
}
|
||||
wxConfig() {
|
||||
console.error('native无需该操作');
|
||||
}
|
||||
async initWeiXinJsSDK() {
|
||||
console.error('native无需该操作');
|
||||
}
|
||||
async loadWeiXinJsSDK() {
|
||||
console.error('native无需该操作');
|
||||
}
|
||||
async subscribeMpMessage(messageTypes, haveToAccept, tip) {
|
||||
console.error('native无需该操作');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,5 @@
|
|||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import AspectDict from '../aspects/AspectDict';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
|
||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
||||
import { Environment } from 'oak-frontend-base/es/features/environment';
|
||||
|
|
@ -18,13 +14,13 @@ type ConfigOptions = {
|
|||
openTagList?: wx.openTagList;
|
||||
};
|
||||
type ParamOptions = wx.IcheckJsApi | wx.IaddCard | wx.IchooseCard | wx.IonMenuShareTimeline | wx.IonMenuShareAppMessage | wx.IonMenuShareQQ | wx.IonMenuShareWeibo | wx.IonMenuShareQZone | wx.IchooseImage | wx.IpreviewImage | wx.IgetLocalImgData | wx.IplaypausestopVoice | wx.IopenLocation | wx.IgetLocation | wx.IscanQRCode | wx.IopenProductSpecificView | wx.IchooseCard | wx.IopenCard | wx.IchooseWXPay;
|
||||
export declare class WeiXinJsSdk<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
|
||||
export declare class WechatSdk<ED extends EntityDict> extends Feature {
|
||||
private cache;
|
||||
private storage;
|
||||
private environment;
|
||||
private landingUrl?;
|
||||
constructor(cache: Cache<ED, Cxt, FrontCxt, AD>, storage: LocalStorage, environment: Environment);
|
||||
signatureJsSDK(url: string): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["signatureJsSDK"]>>;
|
||||
constructor(cache: Cache<ED>, storage: LocalStorage, environment: Environment);
|
||||
signatureJsSDK(url: string): Promise<any>;
|
||||
getConfig(config: ConfigOptions): Promise<unknown>;
|
||||
setLandingUrl(url?: string): void;
|
||||
init(options?: {
|
||||
|
|
@ -36,5 +32,6 @@ export declare class WeiXinJsSdk<ED extends EntityDict, Cxt extends BackendRunti
|
|||
* 微信jssdk 传入方法名
|
||||
*/
|
||||
loadWxAPi(name: wx.ApiMethod, options?: ParamOptions, jsApiList?: wx.jsApiList, openTagList?: wx.openTagList): Promise<object>;
|
||||
subscribeMpMessage(messageTypes: string[], haveToAccept?: boolean, tip?: string): Promise<boolean>;
|
||||
}
|
||||
export {};
|
||||
|
|
@ -3,7 +3,7 @@ import { isIos, isWeiXin, isWeiXinDevTools, } from 'oak-frontend-base/es/utils/u
|
|||
import { promisify as wxPromisify } from 'oak-frontend-base/es/utils/promisify';
|
||||
import { uniq } from 'oak-domain/lib/utils/lodash';
|
||||
import wx from 'weixin-js-sdk';
|
||||
export class WeiXinJsSdk extends Feature {
|
||||
export class WechatSdk extends Feature {
|
||||
cache;
|
||||
storage;
|
||||
environment;
|
||||
|
|
@ -96,4 +96,8 @@ export class WeiXinJsSdk extends Feature {
|
|||
const result = await wxFn(options);
|
||||
return result;
|
||||
}
|
||||
async subscribeMpMessage(messageTypes, haveToAccept, tip) {
|
||||
console.error('native无需该操作');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
export * from './weiXinJsSdk.web';
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import AspectDict from '../aspects/AspectDict';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
|
||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
||||
export declare class WeiXinJsSdk<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
|
||||
private cache;
|
||||
private storage;
|
||||
constructor(cache: Cache<ED, Cxt, FrontCxt, AD>, storage: LocalStorage);
|
||||
wxConfig(): void;
|
||||
initWeiXinJsSDK(): Promise<void>;
|
||||
loadWeiXinJsSDK(): Promise<void>;
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
export class WeiXinJsSdk extends Feature {
|
||||
cache;
|
||||
storage;
|
||||
constructor(cache, storage) {
|
||||
super();
|
||||
this.cache = cache;
|
||||
this.storage = storage;
|
||||
}
|
||||
wxConfig() {
|
||||
console.warn('小程序无需该操作');
|
||||
}
|
||||
async initWeiXinJsSDK() {
|
||||
console.warn('小程序无需该操作');
|
||||
}
|
||||
async loadWeiXinJsSDK() {
|
||||
console.warn('小程序无需该操作');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import AspectDict from '../aspects/AspectDict';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
|
||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
||||
export declare class WeiXinJsSdk<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> extends Feature {
|
||||
private cache;
|
||||
private storage;
|
||||
constructor(cache: Cache<ED, Cxt, FrontCxt, AD>, storage: LocalStorage);
|
||||
wxConfig(): void;
|
||||
initWeiXinJsSDK(): Promise<void>;
|
||||
loadWeiXinJsSDK(): Promise<void>;
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||
export class WeiXinJsSdk extends Feature {
|
||||
cache;
|
||||
storage;
|
||||
constructor(cache, storage) {
|
||||
super();
|
||||
this.cache = cache;
|
||||
this.storage = storage;
|
||||
}
|
||||
wxConfig() {
|
||||
console.warn('native无需该操作');
|
||||
}
|
||||
async initWeiXinJsSDK() {
|
||||
console.warn('native无需该操作');
|
||||
}
|
||||
async loadWeiXinJsSDK() {
|
||||
console.warn('native无需该操作');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
import { BasicFeatures } from 'oak-frontend-base';
|
||||
import { GeneralFeatures } from '../features';
|
||||
import { FeatureDict } from '../features';
|
||||
import { EntityDict } from '../oak-app-domain';
|
||||
import { BRC, FrcAspectDict, FRC } from '../types/RuntimeCxt';
|
||||
export default function useFeatures(): GeneralFeatures<EntityDict, BRC, FRC, FrcAspectDict> & BasicFeatures<EntityDict, BRC, FRC, FrcAspectDict>;
|
||||
export default function useFeatures(): FeatureDict<EntityDict> & BasicFeatures<EntityDict>;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
export type { GeneralFeatures } from './features';
|
||||
export type { FeatureDict as GeneralFeatures } from './features';
|
||||
export type { GeneralAspectDict } from './aspects/AspectDict';
|
||||
export * from './types/Exception';
|
||||
export * from './types/Page';
|
||||
export * from './types/Message';
|
||||
export * from './types/RuntimeCxt';
|
||||
export { BackendRuntimeContext } from './context/BackendRuntimeContext';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
// import { registerMessageNotificationConverters } from './triggers/message';
|
||||
// import { registerWeChatPublicEventCallback } from './endpoints';
|
||||
export * from './types/Exception';
|
||||
export * from './types/Page';
|
||||
export * from './types/Message';
|
||||
export * from './types/RuntimeCxt';
|
||||
// export { getLivestream, getPlayBackUrl, getStreamObj } from './utils/livestream';
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import { Aspect, Checker, Routine, StorageSchema, Timer, Trigger, Watcher } from 'oak-domain/lib/types';
|
||||
import { EntityDict } from './oak-app-domain';
|
||||
import { CacheStore } from 'oak-frontend-base/es/cacheStore/CacheStore';
|
||||
import { AsyncRowStore } from 'oak-domain/lib/store/AsyncRowStore';
|
||||
import { BackendRuntimeContext } from './context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext } from './context/FrontendRuntimeContext';
|
||||
import { GAD, GFD } from './types/Page';
|
||||
import type GeneralAspectDict from './aspects/AspectDict';
|
||||
import { AppType } from './oak-app-domain/Application/Schema';
|
||||
import { InitializeOptions } from 'oak-frontend-base';
|
||||
export declare function initialize<ED extends EntityDict & BaseEntityDict, Cxt extends BackendRuntimeContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD & GAD<ED, Cxt>>>(type: AppType, domain: string, storageSchema: StorageSchema<ED>, frontendContextBuilder: () => (store: CacheStore<ED, FrontCxt>) => FrontCxt, backendContextBuilder: (contextStr?: string) => (store: AsyncRowStore<ED, Cxt>) => Promise<Cxt>, aspectDict: AD, triggers: Array<Trigger<ED, keyof ED, Cxt>>, checkers: Array<Checker<ED, keyof ED, FrontCxt | Cxt>>, watchers: Array<Watcher<ED, keyof ED, Cxt>>, timers: Array<Timer<ED, keyof ED, Cxt>>, startRoutines: Array<Routine<ED, keyof ED, Cxt>>, initialData: {
|
||||
[T in keyof ED]?: Array<ED[T]['OpSchema']>;
|
||||
}, option: InitializeOptions<ED, Cxt>): {
|
||||
features: GFD<ED, Cxt, FrontCxt, AD & GeneralAspectDict<ED, Cxt> & import("oak-common-aspect").CommonAspectDict<ED, Cxt>>;
|
||||
};
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
import { ActionDefDict as generalActionDefDict } from './oak-app-domain';
|
||||
import { initialize as initDev } from 'oak-frontend-base/es/initialize-dev';
|
||||
import { intersection } from 'oak-domain/lib/utils/lodash';
|
||||
import generalWatchers from './watchers';
|
||||
import generalCheckers from './checkers';
|
||||
import generalTriggers from './triggers';
|
||||
import generalAspectDict from './aspects';
|
||||
import generalStartRoutines from './routines/start';
|
||||
import generalData from './data';
|
||||
import { initialize as initGeneralFeatures } from './features';
|
||||
import { rewriteSelection, rewriteOperation } from './utils/selectionRewriter';
|
||||
export function initialize(type, domain, storageSchema, frontendContextBuilder, backendContextBuilder, aspectDict, triggers, checkers, watchers, timers, startRoutines, initialData, option) {
|
||||
let intersected = intersection(Object.keys(generalAspectDict), Object.keys(aspectDict));
|
||||
if (intersected.length > 0) {
|
||||
throw new Error(`用户定义的aspect中不能和general-business中的aspect同名:「${intersected.join(',')}」`);
|
||||
}
|
||||
const aspectDict2 = Object.assign({}, aspectDict, generalAspectDict);
|
||||
const checkers2 = generalCheckers.concat(checkers || []);
|
||||
const triggers2 = generalTriggers.concat(triggers || []);
|
||||
const watchers2 = generalWatchers.concat(watchers || []);
|
||||
const startRoutines2 = generalStartRoutines.concat(startRoutines || []);
|
||||
const data2 = Object.assign({}, generalData, initialData);
|
||||
if (initialData) {
|
||||
intersected = intersection(Object.keys(generalData), Object.keys(initialData));
|
||||
if (intersected.length > 0 && process.env.NODE_ENV === 'development') {
|
||||
console.warn(`用户定义的initialData中存在和general-business中的initialData同名:「${intersected.join(',')}」,将产生合并,请确保逻辑正确`);
|
||||
intersected.forEach((ele) => Object.assign(data2, {
|
||||
[ele]: [
|
||||
...generalData[ele],
|
||||
...initialData[ele],
|
||||
],
|
||||
}));
|
||||
}
|
||||
}
|
||||
const { common } = option;
|
||||
if (common.actionDict) {
|
||||
intersected = intersection(Object.keys(generalActionDefDict), Object.keys(common.actionDict));
|
||||
if (intersected.length > 0 && process.env.NODE_ENV === 'development') {
|
||||
console.warn(`用户定义的actionDict中存在和general-business中的actionDict同名:「${intersected.join(',')}」,将覆盖general-business中定义的actionDict,请确保逻辑正确`);
|
||||
}
|
||||
}
|
||||
common.actionDict = Object.assign({}, generalActionDefDict, common.actionDict);
|
||||
const { features } = initDev(storageSchema, frontendContextBuilder, backendContextBuilder, aspectDict2, triggers2, checkers2, watchers2, timers, startRoutines2, data2, option);
|
||||
const generalFeatures = initGeneralFeatures(features, type, domain);
|
||||
// 临时代码
|
||||
features.cache.cacheStore.registerOperationRewriter(rewriteOperation);
|
||||
features.cache.cacheStore.registerSelectionRewriter(rewriteSelection);
|
||||
return {
|
||||
features: Object.assign(features, generalFeatures),
|
||||
};
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import { InitializeOptions } from 'oak-frontend-base';
|
||||
import { Aspect, Checker, Connector, StorageSchema } from 'oak-domain/lib/types';
|
||||
import { EntityDict } from './oak-app-domain';
|
||||
import { CacheStore } from 'oak-frontend-base/es/cacheStore/CacheStore';
|
||||
import { BackendRuntimeContext } from './context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext } from './context/FrontendRuntimeContext';
|
||||
import { GAD, GFD } from './types/Page';
|
||||
import { AppType } from './oak-app-domain/Application/Schema';
|
||||
export declare function initialize<ED extends EntityDict & BaseEntityDict, Cxt extends BackendRuntimeContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD & GAD<ED, Cxt>>>(type: AppType, domain: string, storageSchema: StorageSchema<ED>, frontendContextBuilder: () => (store: CacheStore<ED, FrontCxt>) => FrontCxt, connector: Connector<ED, FrontCxt>, checkers: Array<Checker<ED, keyof ED, FrontCxt | Cxt>>, option: InitializeOptions<ED, Cxt>): {
|
||||
features: GFD<ED, Cxt, FrontCxt, AD & import(".").GeneralAspectDict<ED, Cxt> & import("oak-common-aspect").CommonAspectDict<ED, Cxt>>;
|
||||
};
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
import { initialize as initProd } from 'oak-frontend-base/es/initialize-prod';
|
||||
import { ActionDefDict as generalActionDefDict } from './oak-app-domain';
|
||||
import { intersection } from 'oak-domain/lib/utils/lodash';
|
||||
import generalCheckers from './checkers';
|
||||
import { initialize as initGeneralFeatures } from './features';
|
||||
import { rewriteSelection, rewriteOperation } from './utils/selectionRewriter';
|
||||
export function initialize(type, domain, storageSchema, frontendContextBuilder, connector, checkers, option) {
|
||||
const checkers2 = generalCheckers.concat(checkers || []);
|
||||
let intersected;
|
||||
const { common } = option;
|
||||
if (common.actionDict) {
|
||||
intersected = intersection(Object.keys(generalActionDefDict), Object.keys(common.actionDict));
|
||||
if (intersected.length > 0 && process.env.NODE_ENV === 'development') {
|
||||
console.warn(`用户定义的actionDict中存在和general-business中的actionDict同名:「${intersected.join(',')}」,将覆盖general-business中定义的actionDict,请确保逻辑正确`);
|
||||
}
|
||||
}
|
||||
common.actionDict = Object.assign({}, generalActionDefDict, common.actionDict);
|
||||
const { features } = initProd(storageSchema, frontendContextBuilder, connector, checkers2, option);
|
||||
// 临时代码
|
||||
features.cache.cacheStore.registerOperationRewriter(rewriteOperation);
|
||||
features.cache.cacheStore.registerSelectionRewriter(rewriteSelection);
|
||||
const generalFeatures = initGeneralFeatures(features, type, domain);
|
||||
return {
|
||||
features: Object.assign(features, generalFeatures),
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
async function initialize(features, access, projection) {
|
||||
const location = features.navigator.getLocation();
|
||||
const searchParams = new URLSearchParams(location.search);
|
||||
const appId = searchParams.get('appId');
|
||||
await features.application.initialize(access.http.hostname, appId, projection);
|
||||
}
|
||||
export {};
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
import { ComponentPublicThisType, DataOption } from 'oak-frontend-base';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import { EntityDict } from './oak-app-domain';
|
||||
import { BasicFeatures } from 'oak-frontend-base';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { BackendRuntimeContext } from './context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext } from './context/FrontendRuntimeContext';
|
||||
import { GAD, GFD, OakComponentOption } from './types/Page';
|
||||
/**
|
||||
* 这里的逻辑暴露出去,是为了让general可以被其它库重载
|
||||
* @param this
|
||||
* @param messageTypes
|
||||
* @param haveToAccept
|
||||
* @param action
|
||||
* @param messageProps
|
||||
* @returns
|
||||
*/
|
||||
export declare function subscribeMpMessage<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends GAD<ED, Cxt>, FD extends GFD<ED, Cxt, FrontCxt, AD>, FormedData extends Record<string, any>, TData extends Record<string, any> = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(this: ComponentPublicThisType<ED, T, Cxt, FrontCxt, AD, FD, FormedData, IsList, TData, TProperty, TMethod>, messageTypes: string[], haveToAccept?: boolean, tip?: string): Promise<boolean>;
|
||||
export declare function createComponent<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends GAD<ED, Cxt>, FD extends GFD<ED, Cxt, FrontCxt, AD>, FormedData extends Record<string, any>, TData extends Record<string, any> = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>> & FD): string;
|
||||
180
es/page.mp.js
180
es/page.mp.js
|
|
@ -1,180 +0,0 @@
|
|||
import { OakMpHaveToSubscribeMessage, OakApplicationLoadingException } from './types/Exception';
|
||||
import { createComponent as createBaseComponent } from 'oak-frontend-base/es/page.mp';
|
||||
/**
|
||||
* 这里的逻辑暴露出去,是为了让general可以被其它库重载
|
||||
* @param this
|
||||
* @param messageTypes
|
||||
* @param haveToAccept
|
||||
* @param action
|
||||
* @param messageProps
|
||||
* @returns
|
||||
*/
|
||||
export async function subscribeMpMessage(messageTypes, haveToAccept, tip) {
|
||||
const mttIds = this.features.cache.get('messageTypeTemplate', {
|
||||
data: {
|
||||
id: 1,
|
||||
templateId: 1,
|
||||
template: {
|
||||
id: 1,
|
||||
wechatId: 1,
|
||||
},
|
||||
type: 1,
|
||||
},
|
||||
filter: {
|
||||
type: {
|
||||
$in: messageTypes,
|
||||
},
|
||||
},
|
||||
});
|
||||
if (mttIds.length > 0) {
|
||||
const tmplIds = mttIds.map(ele => ele.template?.wechatId);
|
||||
const result = await wx.requestSubscribeMessage({
|
||||
tmplIds
|
||||
});
|
||||
const rejected = Object.keys(result).filter(ele => {
|
||||
// 排除errMsg
|
||||
if (ele === 'errMsg') {
|
||||
return false;
|
||||
}
|
||||
else if (result[ele] === 'reject') {
|
||||
return true;
|
||||
}
|
||||
else if (result[ele] !== 'accept') {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: `类型${ele}的模板消息被${result[ele]},请管理员查看后台`,
|
||||
});
|
||||
}
|
||||
});
|
||||
if (rejected.length > 0 && haveToAccept) {
|
||||
if (tip) {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: tip,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
throw new OakMpHaveToSubscribeMessage(rejected);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
export function createComponent(option, features) {
|
||||
const { wechatMp, data, methods, lifetimes, userInsensitive, features: optionFeatures, ...rest } = option;
|
||||
const { relatedMessageTypes } = wechatMp || {};
|
||||
const { ready, attached, show, hide, ...restLifeTimes } = lifetimes || {};
|
||||
const tokenFeatures = optionFeatures?.find(ele => ele === 'token' || (typeof ele === 'object' && ele.feature === 'token'));
|
||||
return createBaseComponent({
|
||||
data: typeof data === 'function'
|
||||
? function () {
|
||||
return {
|
||||
__userId: null,
|
||||
...data.call(this),
|
||||
};
|
||||
}
|
||||
: {
|
||||
__userId: null,
|
||||
...data,
|
||||
},
|
||||
methods: {
|
||||
async subscribeMpMessage(messageTypes, haveToAccept, tip) {
|
||||
return await subscribeMpMessage.call(this, messageTypes, haveToAccept, tip);
|
||||
},
|
||||
async getMessageTypeTemplate() {
|
||||
if (relatedMessageTypes) {
|
||||
try {
|
||||
const applicationId = this.features.application.getApplicationId();
|
||||
const existedOnes = this.features.cache.get('messageTypeTemplate', {
|
||||
data: {
|
||||
id: 1,
|
||||
templateId: 1,
|
||||
template: {
|
||||
id: 1,
|
||||
applicationId: 1,
|
||||
wechatId: 1,
|
||||
},
|
||||
type: 1,
|
||||
},
|
||||
filter: {
|
||||
type: {
|
||||
$in: relatedMessageTypes,
|
||||
},
|
||||
template: {
|
||||
applicationId,
|
||||
},
|
||||
},
|
||||
});
|
||||
if (existedOnes.length === 0) {
|
||||
await this.features.cache.refresh('messageTypeTemplate', {
|
||||
data: {
|
||||
id: 1,
|
||||
templateId: 1,
|
||||
template: {
|
||||
id: 1,
|
||||
applicationId: 1,
|
||||
wechatId: 1,
|
||||
},
|
||||
type: 1,
|
||||
},
|
||||
filter: {
|
||||
type: {
|
||||
$in: relatedMessageTypes,
|
||||
},
|
||||
template: {
|
||||
applicationId,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
if (err instanceof OakApplicationLoadingException) {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
console.warn('当Application(全局应用程序)对象正在加载和配置时,为了确保正确地获取模板消息类型的数据,我们会在Application准备就绪之后重新执行getMessageTypeTemplate方法来安全地获取并应用所需模版');
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
...methods,
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
this.addFeatureSub('application', () => this.getMessageTypeTemplate());
|
||||
attached && attached.call(this);
|
||||
},
|
||||
ready() {
|
||||
this.getMessageTypeTemplate();
|
||||
ready && ready.call(this);
|
||||
},
|
||||
show() {
|
||||
show && show.call(this);
|
||||
if (!userInsensitive) {
|
||||
const userId = this.features.token.getUserId(true);
|
||||
if (userId !== this.state.__userId) {
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
},
|
||||
hide() {
|
||||
hide && hide.call(this);
|
||||
if (!userInsensitive) {
|
||||
const userId = this.features.token.getUserId(true);
|
||||
this.setState({
|
||||
__userId: userId,
|
||||
});
|
||||
}
|
||||
},
|
||||
...restLifeTimes,
|
||||
},
|
||||
features: (userInsensitive || !!tokenFeatures) ? optionFeatures : (optionFeatures || []).concat([{
|
||||
feature: 'token',
|
||||
behavior: 'refresh'
|
||||
}]),
|
||||
wechatMp,
|
||||
...rest,
|
||||
}, features);
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
import React from 'react';
|
||||
import { DataOption } from 'oak-frontend-base';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import { EntityDict } from './oak-app-domain';
|
||||
import { BasicFeatures } from 'oak-frontend-base';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { BackendRuntimeContext } from './context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext } from './context/FrontendRuntimeContext';
|
||||
import { GAD, GFD, OakComponentOption } from './types/Page';
|
||||
export declare function createComponent<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends GAD<ED, Cxt>, FD extends GFD<ED, Cxt, FrontCxt, AD>, FormedData extends Record<string, any>, TData extends Record<string, any> = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>> & FD): React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
import { createComponent as createBaseComponent } from 'oak-frontend-base/es/page.native';
|
||||
export function createComponent(option, features) {
|
||||
const { methods, features: optionFeatures, userInsensitive, ...rest } = option;
|
||||
const tokenFeatures = optionFeatures?.find(ele => ele === 'token' || (typeof ele === 'object' && ele.feature === 'token'));
|
||||
return createBaseComponent({
|
||||
methods: {
|
||||
async subscribeMpMessage(messageTypes, haveToAccept, tip) {
|
||||
throw new Error('小程序环境专有函数在native下不成立');
|
||||
},
|
||||
...methods,
|
||||
},
|
||||
features: (userInsensitive || !!tokenFeatures) ? optionFeatures : (optionFeatures || []).concat([{
|
||||
feature: 'token',
|
||||
behavior: 'refresh'
|
||||
}]),
|
||||
...rest,
|
||||
}, features);
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
import React from 'react';
|
||||
import { DataOption } from 'oak-frontend-base';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import { EntityDict } from './oak-app-domain';
|
||||
import { BasicFeatures } from 'oak-frontend-base';
|
||||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { BackendRuntimeContext } from './context/BackendRuntimeContext';
|
||||
import { FrontendRuntimeContext } from './context/FrontendRuntimeContext';
|
||||
import { GAD, GFD, OakComponentOption } from './types/Page';
|
||||
export declare function createComponent<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends GAD<ED, Cxt>, FD extends GFD<ED, Cxt, FrontCxt, AD>, FormedData extends Record<string, any>, TData extends Record<string, any> = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>> & FD): React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
import { createComponent as createBaseComponent } from 'oak-frontend-base/es/page.web';
|
||||
export function createComponent(option, features) {
|
||||
const { methods, features: optionFeatures, userInsensitive, ...rest } = option;
|
||||
const tokenFeatures = optionFeatures?.find(ele => ele === 'token' || (typeof ele === 'object' && ele.feature === 'token'));
|
||||
return createBaseComponent({
|
||||
methods: {
|
||||
async subscribeMpMessage(messageTypes, haveToAccept, tip) {
|
||||
throw new Error('小程序环境专有函数在web下不成立');
|
||||
},
|
||||
...methods,
|
||||
},
|
||||
features: (userInsensitive || !!tokenFeatures) ? optionFeatures : (optionFeatures || []).concat([{
|
||||
feature: 'token',
|
||||
behavior: 'refresh'
|
||||
}]),
|
||||
...rest,
|
||||
}, features);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue