简化了大量泛型声明,适配了frontend的改动
This commit is contained in:
commit
8ee0a9e3be
|
|
@ -58,6 +58,8 @@ export type GeneralAspectDict<ED extends EntityDict, Cxt extends BackendRuntimeC
|
||||||
getApplication: (params: {
|
getApplication: (params: {
|
||||||
type: AppType;
|
type: AppType;
|
||||||
domain: string;
|
domain: string;
|
||||||
|
data: ED['application']['Selection']['data'];
|
||||||
|
appId?: string;
|
||||||
}, context: Cxt) => Promise<string>;
|
}, context: Cxt) => Promise<string>;
|
||||||
signatureJsSDK: (params: {
|
signatureJsSDK: (params: {
|
||||||
url: string;
|
url: string;
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,25 @@
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { AppType } from '../oak-app-domain/Application/Schema';
|
import { AppType } from '../oak-app-domain/Application/Schema';
|
||||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
|
||||||
import { MediaType, MaterialType } from '../types/WeChat';
|
import { MediaType, MaterialType } from '../types/WeChat';
|
||||||
import { WebEnv } from 'oak-domain/lib/types/Environment';
|
import { WebEnv } from 'oak-domain/lib/types/Environment';
|
||||||
import { File } from 'formidable';
|
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;
|
type: AppType;
|
||||||
domain: string;
|
domain: string;
|
||||||
}, context: Cxt): Promise<string>;
|
data: ED['application']['Selection']['data'];
|
||||||
export declare function signatureJsSDK<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({ url, env }: {
|
appId?: string;
|
||||||
|
}, context: BRC<ED>): Promise<string>;
|
||||||
|
export declare function signatureJsSDK<ED extends EntityDict>({ url, env }: {
|
||||||
url: string;
|
url: string;
|
||||||
env: WebEnv;
|
env: WebEnv;
|
||||||
}, context: Cxt): Promise<{
|
}, context: BRC<ED>): Promise<{
|
||||||
signature: string;
|
signature: string;
|
||||||
noncestr: string;
|
noncestr: string;
|
||||||
timestamp: number;
|
timestamp: number;
|
||||||
appId: string;
|
appId: string;
|
||||||
}>;
|
}>;
|
||||||
export declare function uploadWechatMedia<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function uploadWechatMedia<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
file: File;
|
file: File;
|
||||||
type: MediaType;
|
type: MediaType;
|
||||||
|
|
@ -25,31 +27,31 @@ export declare function uploadWechatMedia<ED extends EntityDict, Cxt extends Bac
|
||||||
description?: string;
|
description?: string;
|
||||||
extraFileId?: string;
|
extraFileId?: string;
|
||||||
}, // FormData表单提交 isPermanent 变成 'true' | 'false'
|
}, // FormData表单提交 isPermanent 变成 'true' | 'false'
|
||||||
context: Cxt): Promise<{
|
context: BRC<ED>): Promise<{
|
||||||
mediaId: string;
|
mediaId: string;
|
||||||
}>;
|
}>;
|
||||||
export declare function getMaterial<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function getMaterial<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
mediaId: string;
|
mediaId: string;
|
||||||
isPermanent?: boolean;
|
isPermanent?: boolean;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function deleteMaterial<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function deleteMaterial<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
mediaId: string;
|
mediaId: string;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function batchGetArticle<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function batchGetArticle<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
offset?: number;
|
offset?: number;
|
||||||
count: number;
|
count: number;
|
||||||
noContent?: 0 | 1;
|
noContent?: 0 | 1;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function getArticle<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function getArticle<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
articleId: string;
|
articleId: string;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function batchGetMaterialList<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function batchGetMaterialList<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
type: MaterialType;
|
type: MaterialType;
|
||||||
offset?: number;
|
offset?: number;
|
||||||
count: 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 { cloneDeep } from 'oak-domain/lib/utils/lodash';
|
||||||
import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
||||||
export async function getApplication(params, context) {
|
export async function getApplication(params, context) {
|
||||||
const { type, domain } = params;
|
const { type, domain, data, appId } = params;
|
||||||
const url = context.getHeader('host');
|
let filter = {
|
||||||
console.log('url is', url);
|
type,
|
||||||
const [application] = await context.select('application', {
|
system: {
|
||||||
data: cloneDeep(applicationProjection),
|
domain$system: {
|
||||||
filter: {
|
url: domain,
|
||||||
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') {
|
if (type === 'wechatMp') {
|
||||||
|
|
@ -32,7 +37,7 @@ export async function getApplication(params, context) {
|
||||||
// 如果微信公众号环境下 application不存在公众号配置,但又在公众号访问,这时可以使用web的application
|
// 如果微信公众号环境下 application不存在公众号配置,但又在公众号访问,这时可以使用web的application
|
||||||
if (!application) {
|
if (!application) {
|
||||||
const [application2] = await context.select('application', {
|
const [application2] = await context.select('application', {
|
||||||
data: cloneDeep(applicationProjection),
|
data,
|
||||||
filter: {
|
filter: {
|
||||||
type: 'web',
|
type: 'web',
|
||||||
system: {
|
system: {
|
||||||
|
|
@ -50,6 +55,7 @@ export async function getApplication(params, context) {
|
||||||
assert(application, 'web环境下 application必须存在web相关配置');
|
assert(application, 'web环境下 application必须存在web相关配置');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
closeFn();
|
||||||
return application.id;
|
return application.id;
|
||||||
}
|
}
|
||||||
export async function signatureJsSDK({ url, env }, context) {
|
export async function signatureJsSDK({ url, env }, context) {
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,19 @@
|
||||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { Config } from '../types/Config';
|
import { Config } from '../types/Config';
|
||||||
import { Style } from '../types/Style';
|
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';
|
entity: 'platform' | 'system';
|
||||||
entityId: string;
|
entityId: string;
|
||||||
config: Config;
|
config: Config;
|
||||||
}, context: Cxt): Promise<void>;
|
}, context: BRC<ED>): Promise<void>;
|
||||||
export declare function updateApplicationConfig<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function updateApplicationConfig<ED extends EntityDict>(params: {
|
||||||
entity: 'application';
|
entity: 'application';
|
||||||
entityId: string;
|
entityId: string;
|
||||||
config: EntityDict['application']['Schema']['config'];
|
config: EntityDict['application']['Schema']['config'];
|
||||||
}, context: Cxt): Promise<void>;
|
}, context: BRC<ED>): Promise<void>;
|
||||||
export declare function updateStyle<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function updateStyle<ED extends EntityDict>(params: {
|
||||||
entity: 'platform' | 'system';
|
entity: 'platform' | 'system';
|
||||||
entityId: string;
|
entityId: string;
|
||||||
style: Style;
|
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 { createWechatLogin } from './wechatLogin';
|
||||||
import { unbindingWechat } from './wechatUser';
|
import { unbindingWechat } from './wechatUser';
|
||||||
import { getMpUnlimitWxaCode } from './wechatQrCode';
|
import { getMpUnlimitWxaCode } from './wechatQrCode';
|
||||||
import { confirmUserEntityGrant } from './userEntityGrant';
|
|
||||||
import { createSession } from './session';
|
import { createSession } from './session';
|
||||||
import { getCurrentMenu, getMenu, createMenu, createConditionalMenu, deleteConditionalMenu, deleteMenu } from './wechatMenu';
|
import { getCurrentMenu, getMenu, createMenu, createConditionalMenu, deleteConditionalMenu, deleteMenu } from './wechatMenu';
|
||||||
import { createTag, getTags, editTag, deleteTag, syncTag, oneKeySync } from './wechatPublicTag';
|
import { createTag, getTags, editTag, deleteTag, syncTag, oneKeySync } from './wechatPublicTag';
|
||||||
|
|
@ -39,7 +38,6 @@ declare const aspectDict: {
|
||||||
getChangePasswordChannels: typeof getChangePasswordChannels;
|
getChangePasswordChannels: typeof getChangePasswordChannels;
|
||||||
updateUserPassword: typeof updateUserPassword;
|
updateUserPassword: typeof updateUserPassword;
|
||||||
getMpUnlimitWxaCode: typeof getMpUnlimitWxaCode;
|
getMpUnlimitWxaCode: typeof getMpUnlimitWxaCode;
|
||||||
confirmUserEntityGrant: typeof confirmUserEntityGrant;
|
|
||||||
createSession: typeof createSession;
|
createSession: typeof createSession;
|
||||||
uploadWechatMedia: typeof uploadWechatMedia;
|
uploadWechatMedia: typeof uploadWechatMedia;
|
||||||
getCurrentMenu: typeof getCurrentMenu;
|
getCurrentMenu: typeof getCurrentMenu;
|
||||||
|
|
@ -73,3 +71,4 @@ declare const aspectDict: {
|
||||||
syncSmsTemplate: typeof syncSmsTemplate;
|
syncSmsTemplate: typeof syncSmsTemplate;
|
||||||
};
|
};
|
||||||
export default aspectDict;
|
export default aspectDict;
|
||||||
|
export { GeneralAspectDict as AspectDict } from './AspectDict';
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import { mergeUser, getChangePasswordChannels, updateUserPassword } from './user
|
||||||
import { createWechatLogin } from './wechatLogin';
|
import { createWechatLogin } from './wechatLogin';
|
||||||
import { unbindingWechat } from './wechatUser';
|
import { unbindingWechat } from './wechatUser';
|
||||||
import { getMpUnlimitWxaCode } from './wechatQrCode';
|
import { getMpUnlimitWxaCode } from './wechatQrCode';
|
||||||
import { confirmUserEntityGrant } from './userEntityGrant';
|
|
||||||
import { createSession } from './session';
|
import { createSession } from './session';
|
||||||
import { getCurrentMenu, getMenu, createMenu, createConditionalMenu, deleteConditionalMenu, deleteMenu, } from './wechatMenu';
|
import { getCurrentMenu, getMenu, createMenu, createConditionalMenu, deleteConditionalMenu, deleteMenu, } from './wechatMenu';
|
||||||
import { createTag, getTags, editTag, deleteTag, syncTag, oneKeySync, } from './wechatPublicTag';
|
import { createTag, getTags, editTag, deleteTag, syncTag, oneKeySync, } from './wechatPublicTag';
|
||||||
|
|
@ -39,7 +38,6 @@ const aspectDict = {
|
||||||
getChangePasswordChannels,
|
getChangePasswordChannels,
|
||||||
updateUserPassword,
|
updateUserPassword,
|
||||||
getMpUnlimitWxaCode,
|
getMpUnlimitWxaCode,
|
||||||
confirmUserEntityGrant,
|
|
||||||
createSession,
|
createSession,
|
||||||
uploadWechatMedia,
|
uploadWechatMedia,
|
||||||
getCurrentMenu,
|
getCurrentMenu,
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { AppType } from '../oak-app-domain/Application/Schema';
|
import { AppType } from '../oak-app-domain/Application/Schema';
|
||||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
|
||||||
import { WechatPublicEventData, WechatMpEventData } from 'oak-external-sdk';
|
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;
|
data?: WechatPublicEventData | WechatMpEventData;
|
||||||
type: AppType;
|
type: AppType;
|
||||||
entity?: string;
|
entity?: string;
|
||||||
entityId?: 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 { EntityDict } from '../oak-app-domain';
|
||||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
import { BRC } from '../types/RuntimeCxt';
|
||||||
export declare function syncSmsTemplate<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function syncSmsTemplate<ED extends EntityDict>(params: {
|
||||||
origin: string;
|
origin: string;
|
||||||
systemId: 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 { EntityDict } from '../oak-app-domain';
|
||||||
|
import { BRC } from '../types/RuntimeCxt';
|
||||||
export declare function registerMessageType(messageType: string[]): void;
|
export declare function registerMessageType(messageType: string[]): void;
|
||||||
export declare function getMessageType(): Promise<string[]>;
|
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;
|
applicationId: string;
|
||||||
}, context: Cxt): Promise<{
|
}, context: BRC<ED>): Promise<{
|
||||||
wechatId: string;
|
wechatId: string;
|
||||||
title: string;
|
title: string;
|
||||||
primaryIndustry: string;
|
primaryIndustry: string;
|
||||||
|
|
|
||||||
|
|
@ -1,76 +1,76 @@
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { NativeEnv, WebEnv, WechatMpEnv } from 'oak-domain/lib/types/Environment';
|
import { NativeEnv, WebEnv, WechatMpEnv } from 'oak-domain/lib/types/Environment';
|
||||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
import { BRC } from '../types/RuntimeCxt';
|
||||||
export declare function loginByMobile<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function loginByMobile<ED extends EntityDict>(params: {
|
||||||
captcha?: string;
|
captcha?: string;
|
||||||
password?: string;
|
password?: string;
|
||||||
mobile: string;
|
mobile: string;
|
||||||
disableRegister?: boolean;
|
disableRegister?: boolean;
|
||||||
env: WebEnv | WechatMpEnv | NativeEnv;
|
env: WebEnv | WechatMpEnv | NativeEnv;
|
||||||
}, context: Cxt): Promise<string>;
|
}, context: BRC<ED>): Promise<string>;
|
||||||
export declare function refreshWechatPublicUserInfo<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({}: {}, context: Cxt): Promise<void>;
|
export declare function refreshWechatPublicUserInfo<ED extends EntityDict>({}: {}, context: BRC<ED>): Promise<void>;
|
||||||
export declare function loginByWechat<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function loginByWechat<ED extends EntityDict>(params: {
|
||||||
wechatLoginId: string;
|
wechatLoginId: string;
|
||||||
env: WebEnv | WechatMpEnv;
|
env: WebEnv | WechatMpEnv;
|
||||||
}, context: Cxt): Promise<string>;
|
}, context: BRC<ED>): Promise<string>;
|
||||||
/**
|
/**
|
||||||
* 公众号授权登录
|
* 公众号授权登录
|
||||||
* @param param0
|
* @param param0
|
||||||
* @param context
|
* @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;
|
code: string;
|
||||||
env: WebEnv;
|
env: WebEnv;
|
||||||
wechatLoginId?: string;
|
wechatLoginId?: string;
|
||||||
}, context: Cxt): Promise<string>;
|
}, context: BRC<ED>): Promise<string>;
|
||||||
/**
|
/**
|
||||||
* 小程序授权登录
|
* 小程序授权登录
|
||||||
* @param param0
|
* @param param0
|
||||||
* @param context
|
* @param context
|
||||||
* @returns
|
* @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;
|
code: string;
|
||||||
env: WechatMpEnv;
|
env: WechatMpEnv;
|
||||||
}, context: Cxt): Promise<string>;
|
}, context: BRC<ED>): Promise<string>;
|
||||||
/**
|
/**
|
||||||
* 同步从wx.getUserProfile拿到的用户信息
|
* 同步从wx.getUserProfile拿到的用户信息
|
||||||
* @param param0
|
* @param param0
|
||||||
* @param context
|
* @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;
|
nickname: string;
|
||||||
avatarUrl: string;
|
avatarUrl: string;
|
||||||
encryptedData: string;
|
encryptedData: string;
|
||||||
iv: string;
|
iv: string;
|
||||||
signature: string;
|
signature: string;
|
||||||
}, context: Cxt): Promise<void>;
|
}, context: BRC<ED>): Promise<void>;
|
||||||
export declare function sendCaptcha<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({ mobile, env, type: type2, }: {
|
export declare function sendCaptcha<ED extends EntityDict>({ mobile, env, type: type2, }: {
|
||||||
mobile: string;
|
mobile: string;
|
||||||
env: WechatMpEnv | WebEnv | NativeEnv;
|
env: WechatMpEnv | WebEnv | NativeEnv;
|
||||||
type: 'login' | 'changePassword' | 'confirm';
|
type: 'login' | 'changePassword' | 'confirm';
|
||||||
}, context: Cxt): Promise<string>;
|
}, context: BRC<ED>): Promise<string>;
|
||||||
export declare function switchTo<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({ userId }: {
|
export declare function switchTo<ED extends EntityDict>({ userId }: {
|
||||||
userId: string;
|
userId: string;
|
||||||
}, context: Cxt): Promise<void>;
|
}, context: BRC<ED>): Promise<void>;
|
||||||
export declare function getWechatMpUserPhoneNumber<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>({ code, env }: {
|
export declare function getWechatMpUserPhoneNumber<ED extends EntityDict>({ code, env }: {
|
||||||
code: string;
|
code: string;
|
||||||
env: WechatMpEnv;
|
env: WechatMpEnv;
|
||||||
}, context: Cxt): Promise<string>;
|
}, context: BRC<ED>): Promise<string>;
|
||||||
export declare function logout<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function logout<ED extends EntityDict>(params: {
|
||||||
tokenValue: string;
|
tokenValue: string;
|
||||||
}, context: Cxt): Promise<void>;
|
}, context: BRC<ED>): Promise<void>;
|
||||||
/**
|
/**
|
||||||
* 创建一个当前parasite上的token
|
* 创建一个当前parasite上的token
|
||||||
* @param params
|
* @param params
|
||||||
* @param context
|
* @param context
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export declare function wakeupParasite<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function wakeupParasite<ED extends EntityDict>(params: {
|
||||||
id: string;
|
id: string;
|
||||||
env: WebEnv | WechatMpEnv | NativeEnv;
|
env: WebEnv | WechatMpEnv | NativeEnv;
|
||||||
}, context: Cxt): Promise<string>;
|
}, context: BRC<ED>): Promise<string>;
|
||||||
export declare function refreshToken<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function refreshToken<ED extends EntityDict>(params: {
|
||||||
env: WebEnv | WechatMpEnv | NativeEnv;
|
env: WebEnv | WechatMpEnv | NativeEnv;
|
||||||
tokenValue: string;
|
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 } from "../oak-app-domain";
|
||||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
import { BRC } from "../types/RuntimeCxt";
|
||||||
export declare function mergeUser<ED extends EntityDict & BaseEntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function mergeUser<ED extends EntityDict>(params: {
|
||||||
from: string;
|
from: string;
|
||||||
to: string;
|
to: string;
|
||||||
mergeMobile?: true;
|
mergeMobile?: true;
|
||||||
mergeEmail?: true;
|
mergeEmail?: true;
|
||||||
mergeWechatUser?: true;
|
mergeWechatUser?: true;
|
||||||
}, context: Cxt, innerLogic?: boolean): Promise<void>;
|
}, context: BRC<ED>, innerLogic?: boolean): Promise<void>;
|
||||||
export declare function getChangePasswordChannels<ED extends EntityDict & BaseEntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function getChangePasswordChannels<ED extends EntityDict>(params: {
|
||||||
userId: string;
|
userId: string;
|
||||||
}, context: Cxt, innerLogic?: boolean): Promise<string[]>;
|
}, context: BRC<ED>, innerLogic?: boolean): Promise<string[]>;
|
||||||
export declare function updateUserPassword<ED extends EntityDict & BaseEntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function updateUserPassword<ED extends EntityDict>(params: {
|
||||||
userId: string;
|
userId: string;
|
||||||
prevPassword?: string;
|
prevPassword?: string;
|
||||||
captcha?: string;
|
captcha?: string;
|
||||||
newPassword: string;
|
newPassword: string;
|
||||||
mobile?: string;
|
mobile?: string;
|
||||||
}, context: Cxt, innerLogic?: boolean): Promise<{
|
}, context: BRC<ED>, innerLogic?: boolean): Promise<{
|
||||||
result: string;
|
result: string;
|
||||||
times: number;
|
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 { EntityDict } from "../oak-app-domain";
|
||||||
import { BackendRuntimeContext } from "../context/BackendRuntimeContext";
|
import { BRC } from '../types/RuntimeCxt';
|
||||||
export declare function getTagUsers<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function getTagUsers<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
tagId: number;
|
tagId: number;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function batchtagging<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function batchtagging<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
openIdList: string[];
|
openIdList: string[];
|
||||||
tagId: number;
|
tagId: number;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function batchuntagging<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function batchuntagging<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
openIdList: string[];
|
openIdList: string[];
|
||||||
tagId: number;
|
tagId: number;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function getUserTags<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function getUserTags<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
openId: string;
|
openId: string;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function getUsers<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function getUsers<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
nextOpenId: string;
|
nextOpenId: string;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function getSubscribedUserInfo<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function getSubscribedUserInfo<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
openId: string;
|
openId: string;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function tagging<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function tagging<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
openId: string;
|
openId: string;
|
||||||
tagIdList: number[];
|
tagIdList: number[];
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function syncToLocale<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function syncToLocale<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
openId: string;
|
openId: string;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function syncToWechat<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function syncToWechat<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
id: string;
|
id: string;
|
||||||
openId: string;
|
openId: string;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { EntityDict } from "../oak-app-domain";
|
import { EntityDict } from "../oak-app-domain";
|
||||||
import { BackendRuntimeContext } from "../context/BackendRuntimeContext";
|
import { BRC } from '../types/RuntimeCxt';
|
||||||
export declare function createWechatLogin<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function createWechatLogin<ED extends EntityDict>(params: {
|
||||||
type: EntityDict['wechatLogin']['Schema']['type'];
|
type: EntityDict['wechatLogin']['Schema']['type'];
|
||||||
interval: number;
|
interval: number;
|
||||||
}, context: Cxt): Promise<string>;
|
}, context: BRC<ED>): Promise<string>;
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,25 @@
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
import { BRC } from '../types/RuntimeCxt';
|
||||||
export declare function getCurrentMenu<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function getCurrentMenu<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function getMenu<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function getMenu<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function createMenu<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function createMenu<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
menuConfig: any;
|
menuConfig: any;
|
||||||
id: string;
|
id: string;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function createConditionalMenu<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function createConditionalMenu<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
menuConfig: any;
|
menuConfig: any;
|
||||||
id: string;
|
id: string;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function deleteConditionalMenu<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function deleteConditionalMenu<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
menuId: number;
|
menuId: number;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function deleteMenu<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function deleteMenu<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { EntityDict } from "../oak-app-domain";
|
import { EntityDict } from "../oak-app-domain";
|
||||||
import { BackendRuntimeContext } from "../context/BackendRuntimeContext";
|
import { BRC } from "../types/RuntimeCxt";
|
||||||
export declare function wechatMpJump<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function wechatMpJump<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
jump_wxa: {
|
jump_wxa: {
|
||||||
path?: string;
|
path?: string;
|
||||||
|
|
@ -10,4 +10,4 @@ export declare function wechatMpJump<ED extends EntityDict, Cxt extends BackendR
|
||||||
expireType?: number;
|
expireType?: number;
|
||||||
expiresAt?: number;
|
expiresAt?: number;
|
||||||
expireInterval?: number;
|
expireInterval?: number;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,26 @@
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
import { BRC } from '../types/RuntimeCxt';
|
||||||
export declare function createTag<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function createTag<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
name: string;
|
name: string;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function getTags<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function getTags<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function editTag<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function editTag<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function deleteTag<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function deleteTag<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
id: string;
|
id: string;
|
||||||
wechatId: number;
|
wechatId: number;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function syncTag<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function syncTag<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
id: string;
|
id: string;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
export declare function oneKeySync<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function oneKeySync<ED extends EntityDict>(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
}, context: Cxt): Promise<any>;
|
}, context: BRC<ED>): Promise<any>;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { EntityDict } from "../oak-app-domain";
|
import { EntityDict } from "../oak-app-domain";
|
||||||
import { QrCodeType } from '../types/Config';
|
import { QrCodeType } from '../types/Config';
|
||||||
import { WechatQrCodeProps } from '../oak-app-domain/WechatQrCode/Schema';
|
import { WechatQrCodeProps } from '../oak-app-domain/WechatQrCode/Schema';
|
||||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
import { BRC } from '../types/RuntimeCxt';
|
||||||
/**
|
/**
|
||||||
* 生成二维码优先级如下:
|
* 生成二维码优先级如下:
|
||||||
* 0)如果在SystemConfig中指定了qrCodeType,则按照qrCodeType去生成
|
* 0)如果在SystemConfig中指定了qrCodeType,则按照qrCodeType去生成
|
||||||
|
|
@ -11,12 +11,12 @@ import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||||
* @param context
|
* @param context
|
||||||
* @returns
|
* @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;
|
entity: T;
|
||||||
entityId: string;
|
entityId: string;
|
||||||
tag?: string;
|
tag?: string;
|
||||||
permanent?: boolean;
|
permanent?: boolean;
|
||||||
type?: QrCodeType;
|
type?: QrCodeType;
|
||||||
props: WechatQrCodeProps;
|
props: WechatQrCodeProps;
|
||||||
}, context: Cxt): Promise<void>;
|
}, context: BRC<ED>): Promise<void>;
|
||||||
export declare function getMpUnlimitWxaCode<ED extends EntityDict, T extends keyof ED, Cxt extends BackendRuntimeContext<ED>>(wechatQrCodeId: string, context: Cxt): Promise<string>;
|
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 { EntityDict } from "../oak-app-domain";
|
||||||
import { BackendRuntimeContext } from "../context/BackendRuntimeContext";
|
import { BRC } from "../types/RuntimeCxt";
|
||||||
export declare function unbindingWechat<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>>(params: {
|
export declare function unbindingWechat<ED extends EntityDict>(params: {
|
||||||
wechatUserId: string;
|
wechatUserId: string;
|
||||||
captcha?: string;
|
captcha?: string;
|
||||||
mobile?: string;
|
mobile?: string;
|
||||||
}, context: Cxt): Promise<void>;
|
}, context: BRC<ED>): Promise<void>;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Checker } from "oak-domain/lib/types";
|
import { Checker } from "oak-domain/lib/types";
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||||
declare const checkers: Checker<EntityDict, 'address', RuntimeCxt>[];
|
declare const checkers: Checker<EntityDict, 'address', RuntimeCxt<EntityDict>>[];
|
||||||
export default checkers;
|
export default checkers;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Checker } from 'oak-domain/lib/types';
|
import { Checker } from 'oak-domain/lib/types';
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||||
declare const checkers: Checker<EntityDict, 'application', RuntimeCxt>[];
|
declare const checkers: Checker<EntityDict, 'application', RuntimeCxt<EntityDict>>[];
|
||||||
export default checkers;
|
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;
|
export default checkers;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Checker } from "oak-domain/lib/types";
|
import { Checker } from "oak-domain/lib/types";
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||||
declare const checkers: Checker<EntityDict, 'message', RuntimeCxt>[];
|
declare const checkers: Checker<EntityDict, 'message', RuntimeCxt<EntityDict>>[];
|
||||||
export default checkers;
|
export default checkers;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Checker } from 'oak-domain/lib/types';
|
import { Checker } from 'oak-domain/lib/types';
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||||
declare const checkers: Checker<EntityDict, 'mobile', RuntimeCxt>[];
|
declare const checkers: Checker<EntityDict, 'mobile', RuntimeCxt<EntityDict>>[];
|
||||||
export default checkers;
|
export default checkers;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Checker } from 'oak-domain/lib/types';
|
import { Checker } from 'oak-domain/lib/types';
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||||
declare const checkers: Checker<EntityDict, 'parasite', RuntimeCxt>[];
|
declare const checkers: Checker<EntityDict, 'parasite', RuntimeCxt<EntityDict>>[];
|
||||||
export default checkers;
|
export default checkers;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Checker } from 'oak-domain/lib/types';
|
import { Checker } from 'oak-domain/lib/types';
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||||
declare const checkers: Checker<EntityDict, 'platform', RuntimeCxt>[];
|
declare const checkers: Checker<EntityDict, 'platform', RuntimeCxt<EntityDict>>[];
|
||||||
export default checkers;
|
export default checkers;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Checker } from 'oak-domain/lib/types';
|
import { Checker } from 'oak-domain/lib/types';
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||||
declare const checkers: Checker<EntityDict, 'system', RuntimeCxt>[];
|
declare const checkers: Checker<EntityDict, 'system', RuntimeCxt<EntityDict>>[];
|
||||||
export default checkers;
|
export default checkers;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Checker } from "oak-domain/lib/types";
|
import { Checker } from "oak-domain/lib/types";
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { RuntimeCxt } from "../types/RuntimeCxt";
|
import { RuntimeCxt } from "../types/RuntimeCxt";
|
||||||
declare const checkers: Checker<EntityDict, 'token', RuntimeCxt>[];
|
declare const checkers: Checker<EntityDict, 'token', RuntimeCxt<EntityDict>>[];
|
||||||
export default checkers;
|
export default checkers;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Checker } from "oak-domain/lib/types";
|
import { Checker } from "oak-domain/lib/types";
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { RuntimeCxt } from "../types/RuntimeCxt";
|
import { RuntimeCxt } from "../types/RuntimeCxt";
|
||||||
declare const checkers: Checker<EntityDict, 'user', RuntimeCxt>[];
|
declare const checkers: Checker<EntityDict, 'user', RuntimeCxt<EntityDict>>[];
|
||||||
export default checkers;
|
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 { Checker } from 'oak-domain/lib/types';
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||||
declare const checkers: Checker<EntityDict, 'userEntityGrant', RuntimeCxt>[];
|
declare const checkers: Checker<EntityDict, 'userEntityGrant', RuntimeCxt<EntityDict>>[];
|
||||||
export default checkers;
|
export default checkers;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Checker } from 'oak-domain/lib/types';
|
import { Checker } from 'oak-domain/lib/types';
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||||
declare const checkers: Checker<EntityDict, 'wechatPublicTag', RuntimeCxt>[];
|
declare const checkers: Checker<EntityDict, 'wechatPublicTag', RuntimeCxt<EntityDict>>[];
|
||||||
export default checkers;
|
export default checkers;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Checker } from 'oak-domain/lib/types';
|
import { Checker } from 'oak-domain/lib/types';
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||||
declare const checkers: Checker<EntityDict, 'wechatQrCode', RuntimeCxt>[];
|
declare const checkers: Checker<EntityDict, 'wechatQrCode', RuntimeCxt<EntityDict>>[];
|
||||||
export default checkers;
|
export default checkers;
|
||||||
|
|
|
||||||
|
|
@ -43,17 +43,9 @@ export default OakComponent({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
callAreaPicker() {
|
callAreaPicker() {
|
||||||
const event = 'address:upsert:selectArea';
|
|
||||||
this.subEvent(event, ({ id }) => {
|
|
||||||
this.update({
|
|
||||||
areaId: id,
|
|
||||||
});
|
|
||||||
this.navigateBack();
|
|
||||||
});
|
|
||||||
this.navigateTo({
|
this.navigateTo({
|
||||||
url: '/pickers/area',
|
url: '/pickers/area',
|
||||||
}, {
|
}, {
|
||||||
itemSelectedEvent: event,
|
|
||||||
depth: 3,
|
depth: 3,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { Style } from '../../../../types/Style';
|
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, {
|
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../../oak-app-domain").EntityDict, keyof import("../../../../oak-app-domain").EntityDict, false, {
|
||||||
style: Style;
|
style: Style;
|
||||||
entity: "application" | "platform" | "system";
|
entity: "application" | "system" | "platform";
|
||||||
entityId: string;
|
entityId: string;
|
||||||
name: string;
|
name: string;
|
||||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { Config } from '../../../types/Config';
|
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, {
|
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, false, {
|
||||||
config: Config;
|
config: Config;
|
||||||
entity: "platform" | "system";
|
entity: "system" | "platform";
|
||||||
name: string;
|
name: string;
|
||||||
entityId: string;
|
entityId: string;
|
||||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
}>) => 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 { ReactComponentProps } from 'oak-frontend-base/lib/types/Page';
|
||||||
import { ButtonProps } from 'antd';
|
import { ButtonProps } from 'antd';
|
||||||
import { ButtonProps as AmButtonProps } from 'antd-mobile';
|
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;
|
type BeforeCommit = (() => boolean | undefined | Promise<boolean | undefined>) | undefined;
|
||||||
declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends keyof ED2>(props: ReactComponentProps<ED2, T2, true, {
|
declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends keyof ED2>(props: ReactComponentProps<ED2, T2, true, {
|
||||||
action?: string | undefined;
|
action?: string | undefined;
|
||||||
|
|
@ -12,21 +12,21 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
|
||||||
type?: ButtonProps['type'] | AmButtonProps['type'];
|
type?: ButtonProps['type'] | AmButtonProps['type'];
|
||||||
executeText?: string | undefined;
|
executeText?: string | undefined;
|
||||||
buttonProps?: (ButtonProps & {
|
buttonProps?: (ButtonProps & {
|
||||||
color?: "success" | "default" | "warning" | "primary" | "danger" | undefined;
|
color?: "default" | "success" | "warning" | "primary" | "danger" | undefined;
|
||||||
fill?: "none" | "solid" | "outline" | undefined;
|
fill?: "none" | "solid" | "outline" | undefined;
|
||||||
size?: "small" | "middle" | "large" | "mini" | undefined;
|
size?: "small" | "large" | "middle" | "mini" | undefined;
|
||||||
block?: boolean | undefined;
|
block?: boolean | undefined;
|
||||||
loading?: boolean | "auto" | undefined;
|
loading?: boolean | "auto" | undefined;
|
||||||
loadingText?: string | undefined;
|
loadingText?: string | undefined;
|
||||||
loadingIcon?: import("react").ReactNode;
|
loadingIcon?: import("react").ReactNode;
|
||||||
disabled?: boolean | undefined;
|
disabled?: boolean | undefined;
|
||||||
onClick?: ((event: import("react").MouseEvent<HTMLButtonElement, MouseEvent>) => unknown) | 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;
|
shape?: "default" | "rounded" | "rectangular" | undefined;
|
||||||
children?: import("react").ReactNode;
|
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;
|
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;
|
tabIndex?: number | undefined;
|
||||||
} & import("react").AriaAttributes) | undefined;
|
} & import("react").AriaAttributes) | undefined;
|
||||||
afterCommit?: AfterCommit;
|
afterCommit?: AfterCommit;
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ export default OakComponent({
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
failureIds: undefined,
|
failureIds: undefined,
|
||||||
currentId: undefined,
|
|
||||||
},
|
},
|
||||||
lifetimes: {
|
lifetimes: {
|
||||||
ready() {
|
ready() {
|
||||||
|
|
@ -130,42 +129,36 @@ export default OakComponent({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const id = this.getId();
|
|
||||||
await this.execute(undefined, messageProps);
|
await this.execute(undefined, messageProps);
|
||||||
const failureIds = await this.upload(ids);
|
const failureIds = await this.upload(ids);
|
||||||
if (failureIds && failureIds.length > 0) {
|
if (failureIds && failureIds.length > 0) {
|
||||||
this.setState({
|
this.setState({
|
||||||
failureIds,
|
failureIds,
|
||||||
currentId: id,
|
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
failureIds: undefined,
|
failureIds: undefined,
|
||||||
currentId: undefined,
|
|
||||||
});
|
});
|
||||||
if (afterCommit) {
|
if (afterCommit) {
|
||||||
afterCommit(id);
|
afterCommit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const { failureIds, currentId } = this.state;
|
const { failureIds } = this.state;
|
||||||
const id2 = currentId;
|
|
||||||
assert(failureIds && failureIds.length > 0);
|
assert(failureIds && failureIds.length > 0);
|
||||||
const failureIds2 = await this.upload(failureIds);
|
const failureIds2 = await this.upload(failureIds);
|
||||||
if (failureIds2 && failureIds2.length > 0) {
|
if (failureIds2 && failureIds2.length > 0) {
|
||||||
this.setState({
|
this.setState({
|
||||||
failureIds: failureIds2,
|
failureIds: failureIds2,
|
||||||
currentId: id2,
|
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
failureIds: undefined,
|
failureIds: undefined,
|
||||||
currentId: undefined,
|
|
||||||
});
|
});
|
||||||
if (afterCommit) {
|
if (afterCommit) {
|
||||||
afterCommit(id2);
|
afterCommit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -91,12 +91,6 @@ export default OakComponent({
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
else if (eventLoggedIn) {
|
|
||||||
this.pubEvent(eventLoggedIn);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.navigateBack();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
this.setMessage({
|
this.setMessage({
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { MobileOutlined, DeleteOutlined } from '@ant-design/icons';
|
||||||
import MobileLogin from '../login';
|
import MobileLogin from '../login';
|
||||||
export default function render(props) {
|
export default function render(props) {
|
||||||
const { mobiles, allowRemove, tokenMobileId, showBack = false } = props.data;
|
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 [open, setOpen] = useState(false);
|
||||||
const eventLoggedIn = `user:info:login:${Date.now()}`;
|
const eventLoggedIn = `user:info:login:${Date.now()}`;
|
||||||
return (<>
|
return (<>
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ export default OakComponent({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const relationId = await this.features.relationAuth.getRelationIdByName(entity, relation);
|
const relationId = await this.features.cache.getRelationIdByName(entity, relation);
|
||||||
this.update({
|
this.update({
|
||||||
user: {
|
user: {
|
||||||
id: generateNewId(),
|
id: generateNewId(),
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,6 @@ export default OakComponent({
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
else if (this.props.itemSelectedEvent) {
|
|
||||||
this.pubEvent(this.props.itemSelectedEvent, {
|
|
||||||
id: item.id,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
console.log('area selected:', item);
|
console.log('area selected:', item);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ export default OakComponent({
|
||||||
async onCellClicked(id) {
|
async onCellClicked(id) {
|
||||||
const { event } = this.props;
|
const { event } = this.props;
|
||||||
if (event) {
|
if (event) {
|
||||||
this.pubEvent(event, this.state.userArr.find((ele) => ele.id === id));
|
console.warn('event机制已经废除');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.navigateTo({
|
this.navigateTo({
|
||||||
|
|
@ -148,10 +148,5 @@ export default OakComponent({
|
||||||
}
|
}
|
||||||
this.refresh();
|
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;
|
entity: keyof EntityDict;
|
||||||
entityFilter: any;
|
entityFilter: any;
|
||||||
relationIds: string[];
|
relationIds: string[];
|
||||||
rule: "all" | "single" | "free";
|
rule: "single" | "all" | "free";
|
||||||
ruleOnRow: "all" | "single" | "free";
|
ruleOnRow: "single" | "all" | "free";
|
||||||
onPickRelations: (ids: string[]) => void;
|
onPickRelations: (ids: string[]) => void;
|
||||||
onPickRows: (ids: string[]) => void;
|
onPickRows: (ids: string[]) => void;
|
||||||
pickedRowIds: string[] | undefined;
|
pickedRowIds: string[] | undefined;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
|
||||||
claimUrl: string;
|
claimUrl: string;
|
||||||
qrCodeType: QrCodeType;
|
qrCodeType: QrCodeType;
|
||||||
multiple: boolean;
|
multiple: boolean;
|
||||||
rule: "all" | "single" | "free";
|
rule: "single" | "all" | "free";
|
||||||
ruleOnRow: "all" | "single" | "free";
|
ruleOnRow: "single" | "all" | "free";
|
||||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||||
export default _default;
|
export default _default;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { EntityDict } from '../../../oak-app-domain';
|
import { EntityDict } from '../../../oak-app-domain';
|
||||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, keyof EntityDict, false, {
|
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, keyof EntityDict, false, {
|
||||||
type: "bind" | "login";
|
type: "login" | "bind";
|
||||||
url: string;
|
url: string;
|
||||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||||
export default _default;
|
export default _default;
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ export default OakComponent({
|
||||||
if (str.includes('data:image/png;')) {
|
if (str.includes('data:image/png;')) {
|
||||||
return str;
|
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;')) {
|
if (str.includes('data:image/png;')) {
|
||||||
return str;
|
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;')) {
|
if (str.includes('data:image/png;')) {
|
||||||
return str;
|
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;')) {
|
if (str.includes('data:image/png;')) {
|
||||||
return str;
|
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 GeneralAspectDict from '../aspects/AspectDict';
|
||||||
import { CommonAspectDict } from 'oak-common-aspect';
|
import { CommonAspectDict } from 'oak-common-aspect';
|
||||||
import { SyncRowStore } from 'oak-domain/lib/store/SyncRowStore';
|
import { SyncRowStore } from 'oak-domain/lib/store/SyncRowStore';
|
||||||
import { GeneralFeatures } from '../features';
|
import { FeatureDict } from '../features';
|
||||||
import { BackendRuntimeContext } from './BackendRuntimeContext';
|
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 {
|
export interface SerializedData extends Fsd {
|
||||||
a?: string;
|
a?: string;
|
||||||
t?: string;
|
t?: string;
|
||||||
userId?: string;
|
userId?: string;
|
||||||
rm?: boolean;
|
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 application;
|
||||||
private token;
|
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>;
|
protected getSerializedData(): Promise<SerializedData>;
|
||||||
getApplicationId(): string;
|
getApplicationId(): string;
|
||||||
getSystemId(): string | undefined;
|
getSystemId(): string | undefined;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { registerWeChatPublicEventCallback } from './wechat';
|
import { registerWeChatPublicEventCallback } from './wechat';
|
||||||
declare const _default: {
|
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 default _default;
|
||||||
export { registerWeChatPublicEventCallback, };
|
export { registerWeChatPublicEventCallback, };
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,6 @@ import { Endpoint } from 'oak-domain/lib/types/Endpoint';
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { BRC } from '../types/RuntimeCxt';
|
import { BRC } from '../types/RuntimeCxt';
|
||||||
import { WechatPublicEventData } from 'oak-external-sdk/lib/types/Wechat';
|
import { WechatPublicEventData } from 'oak-external-sdk/lib/types/Wechat';
|
||||||
export declare function registerWeChatPublicEventCallback(appId: string, callback: (data: WechatPublicEventData, context: BRC) => void): void;
|
export declare function registerWeChatPublicEventCallback(appId: string, callback: (data: WechatPublicEventData, context: BRC<EntityDict>) => void): void;
|
||||||
declare const endpoints: Record<string, Endpoint<EntityDict, BRC>>;
|
declare const endpoints: Record<string, Endpoint<EntityDict, BRC<EntityDict>>>;
|
||||||
export default endpoints;
|
export default endpoints;
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,18 @@
|
||||||
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
||||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||||
import { CommonAspectDict } from 'oak-common-aspect';
|
|
||||||
import { EntityDict } from '../oak-app-domain';
|
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';
|
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 {
|
export declare class Application<ED extends EntityDict> extends Feature {
|
||||||
private type;
|
|
||||||
private domain;
|
|
||||||
private applicationId?;
|
private applicationId?;
|
||||||
private application?;
|
private application?;
|
||||||
private cache;
|
private cache;
|
||||||
private storage;
|
private storage;
|
||||||
private projection;
|
private projection;
|
||||||
constructor(type: AppType, domain: string, cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>, storage: LocalStorage);
|
constructor(cache: Cache<ED>, storage: LocalStorage);
|
||||||
private refresh;
|
|
||||||
private getApplicationFromCache;
|
private getApplicationFromCache;
|
||||||
private loadApplicationInfo;
|
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;
|
getApplication(): Partial<import("../oak-app-domain/Application/Schema").Schema> | undefined;
|
||||||
getApplicationId(): string;
|
getApplicationId(): string;
|
||||||
uploadWechatMedia(params: {
|
uploadWechatMedia(params: {
|
||||||
|
|
@ -29,5 +21,5 @@ export declare class Application<ED extends EntityDict, Cxt extends BackendRunti
|
||||||
type: MediaType;
|
type: MediaType;
|
||||||
isPermanent?: boolean;
|
isPermanent?: boolean;
|
||||||
description?: MediaVideoDescription;
|
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 { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||||
import { assert } from 'oak-domain/lib/utils/assert';
|
import { assert } from 'oak-domain/lib/utils/assert';
|
||||||
import { cloneDeep, merge } from 'oak-domain/lib/utils/lodash';
|
import { cloneDeep, merge } from 'oak-domain/lib/utils/lodash';
|
||||||
import { applicationProjection } from '../types/Projection';
|
import { applicationProjection } from '../types/Projection';
|
||||||
import { OakApplicationLoadingException, } from '../types/Exception';
|
import { OakApplicationLoadingException, } from '../types/Exception';
|
||||||
export class Application extends Feature {
|
export class Application extends Feature {
|
||||||
type;
|
|
||||||
domain; //域名
|
|
||||||
applicationId;
|
applicationId;
|
||||||
application;
|
application;
|
||||||
cache;
|
cache;
|
||||||
storage;
|
storage;
|
||||||
projection;
|
projection;
|
||||||
constructor(type, domain, cache, storage) {
|
constructor(cache, storage) {
|
||||||
super();
|
super();
|
||||||
this.cache = cache;
|
this.cache = cache;
|
||||||
this.storage = storage;
|
this.storage = storage;
|
||||||
this.type = type;
|
|
||||||
this.domain = domain;
|
|
||||||
this.projection = cloneDeep(applicationProjection);
|
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() {
|
getApplicationFromCache() {
|
||||||
const data = this.cache.get('application', {
|
const data = this.cache.get('application', {
|
||||||
data: this.projection,
|
data: this.projection,
|
||||||
|
|
@ -44,18 +25,27 @@ export class Application extends Feature {
|
||||||
assert(data.length === 1, `cache:applicationId${this.applicationId}没有取到有效数据`);
|
assert(data.length === 1, `cache:applicationId${this.applicationId}没有取到有效数据`);
|
||||||
this.application = data[0];
|
this.application = data[0];
|
||||||
}
|
}
|
||||||
async loadApplicationInfo(type, domain) {
|
async loadApplicationInfo(domain) {
|
||||||
let applicationId;
|
let applicationId;
|
||||||
try {
|
let appType = 'web';
|
||||||
const { result } = await this.cache.exec('getApplication', {
|
if (process.env.OAK_PLATFORM === 'wechatMp') {
|
||||||
type,
|
appType = 'wechatMp';
|
||||||
domain,
|
|
||||||
}, undefined, true, true);
|
|
||||||
applicationId = result;
|
|
||||||
}
|
}
|
||||||
catch (err) {
|
else if (process.env.OAK_PLATFORM === 'native') {
|
||||||
throw err;
|
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.applicationId = applicationId;
|
||||||
this.getApplicationFromCache();
|
this.getApplicationFromCache();
|
||||||
// 如果取得的type和当前环境不同,则不缓存id(未来可能有type相同的application上线)
|
// 如果取得的type和当前环境不同,则不缓存id(未来可能有type相同的application上线)
|
||||||
|
|
@ -64,7 +54,7 @@ export class Application extends Feature {
|
||||||
// }
|
// }
|
||||||
this.publish();
|
this.publish();
|
||||||
}
|
}
|
||||||
async initialize(appId, projection) {
|
async initialize(domain, appId, projection) {
|
||||||
// const applicationId = await this.storage.load(LOCAL_STORAGE_KEYS.appId);
|
// const applicationId = await this.storage.load(LOCAL_STORAGE_KEYS.appId);
|
||||||
// this.applicationId = applicationId;
|
// this.applicationId = applicationId;
|
||||||
//接收外层注入的projection
|
//接收外层注入的projection
|
||||||
|
|
@ -72,16 +62,8 @@ export class Application extends Feature {
|
||||||
if (process.env.NODE_ENV === 'development' && appId) {
|
if (process.env.NODE_ENV === 'development' && appId) {
|
||||||
// development环境下允许注入一个线上的appId
|
// development环境下允许注入一个线上的appId
|
||||||
this.applicationId = appId;
|
this.applicationId = appId;
|
||||||
if (this.applicationId) {
|
|
||||||
return await this.refresh();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// if (this.applicationId) {
|
return await this.loadApplicationInfo(domain);
|
||||||
// await this.refresh();
|
|
||||||
// } else {
|
|
||||||
// await this.loadApplicationInfo(this.type, this.domain);
|
|
||||||
// }
|
|
||||||
return await this.loadApplicationInfo(this.type, this.domain);
|
|
||||||
}
|
}
|
||||||
getApplication() {
|
getApplication() {
|
||||||
if (this.applicationId === undefined) {
|
if (this.applicationId === undefined) {
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,11 @@
|
||||||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||||
import AspectDict from '../aspects/AspectDict';
|
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||||
import { Config as ConfigDef } from '../types/Config';
|
import { Config as ConfigDef } from '../types/Config';
|
||||||
import { Style as StyleDef } from '../types/Style';
|
import { Style as StyleDef } from '../types/Style';
|
||||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
export declare class Config<ED extends EntityDict> extends Feature {
|
||||||
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 {
|
|
||||||
private cache;
|
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>;
|
updateConfig(entity: 'platform' | 'system', entityId: string, config: ConfigDef): Promise<void>;
|
||||||
updateApplicationConfig(entity: 'application', entityId: string, config: EntityDict['application']['Schema']['config']): 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>;
|
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 { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
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 { EntityDict } from '../oak-app-domain';
|
||||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
|
||||||
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
|
|
||||||
import { Application } from './application';
|
import { Application } from './application';
|
||||||
export type FileState = 'local' | 'uploading' | 'uploaded' | 'failed';
|
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 cache;
|
||||||
private application;
|
private application;
|
||||||
private locales;
|
|
||||||
private files;
|
private files;
|
||||||
private runningTree;
|
constructor(cache: Cache<ED>, application: Application<ED>);
|
||||||
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>);
|
|
||||||
addLocalFile(id: string, file: File | string): void;
|
addLocalFile(id: string, file: File | string): void;
|
||||||
removeLocalFiles(ids: string[]): void;
|
removeLocalFiles(ids: string[]): void;
|
||||||
upload(id: string, entity: keyof ED): Promise<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;
|
state: FileState;
|
||||||
percentage?: number;
|
percentage?: number;
|
||||||
} | undefined;
|
} | undefined;
|
||||||
getFileName(extraFile: EntityDict['extraFile']['OpSchema']): string;
|
getFileName(extraFile: ED['extraFile']['OpSchema']): string;
|
||||||
formatBytes(size: number): 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;
|
private uploadToAspect;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,12 @@ import { extraFileProjection } from '../types/Projection';
|
||||||
export class ExtraFile extends Feature {
|
export class ExtraFile extends Feature {
|
||||||
cache;
|
cache;
|
||||||
application;
|
application;
|
||||||
locales;
|
|
||||||
files;
|
files;
|
||||||
runningTree;
|
constructor(cache, application) {
|
||||||
constructor(cache, application, locales, runningTree) {
|
|
||||||
super();
|
super();
|
||||||
this.cache = cache;
|
this.cache = cache;
|
||||||
this.application = application;
|
this.application = application;
|
||||||
this.locales = locales;
|
|
||||||
this.files = {};
|
this.files = {};
|
||||||
this.runningTree = runningTree;
|
|
||||||
}
|
}
|
||||||
addLocalFile(id, file) {
|
addLocalFile(id, file) {
|
||||||
assert(!this.files[id]);
|
assert(!this.files[id]);
|
||||||
|
|
@ -136,7 +132,7 @@ export class ExtraFile extends Feature {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if (extraFile?.isBridge && extraFile?.extra1) {
|
if (extraFile?.isBridge && extraFile?.extra1) {
|
||||||
return this.locales.makeBridgeUrl(extraFile?.extra1);
|
return this.cache.makeBridgeUrl(extraFile?.extra1);
|
||||||
}
|
}
|
||||||
const { id } = extraFile;
|
const { id } = extraFile;
|
||||||
if (this.files[id]) {
|
if (this.files[id]) {
|
||||||
|
|
@ -154,9 +150,7 @@ export class ExtraFile extends Feature {
|
||||||
return extra1 || '';
|
return extra1 || '';
|
||||||
}
|
}
|
||||||
const cos = getCos(origin);
|
const cos = getCos(origin);
|
||||||
const context = this.cache.begin();
|
return cos.composeFileUrl(extraFile, this.application.getApplication(), style);
|
||||||
this.cache.commit();
|
|
||||||
return cos.composeFileUrl(extraFile, context, style);
|
|
||||||
}
|
}
|
||||||
getFileState(id) {
|
getFileState(id) {
|
||||||
if (this.files[id]) {
|
if (this.files[id]) {
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,25 @@
|
||||||
import { CommonAspectDict } from 'oak-common-aspect';
|
|
||||||
import { Token } from './token';
|
import { Token } from './token';
|
||||||
import { ExtraFile } from './extraFile';
|
import { ExtraFile } from './extraFile';
|
||||||
import { Application } from './application';
|
import { Application } from './application';
|
||||||
import { Config } from './config';
|
import { Config } from './config';
|
||||||
import { Template } from './template';
|
import { Template } from './template';
|
||||||
import { WeiXinJsSdk } from './weiXinJsSdk';
|
import { WechatSdk } from './wechatSdk';
|
||||||
import { WechatMenu } from './wechatMenu';
|
import { WechatMenu } from './wechatMenu';
|
||||||
import { WechatPublicTag } from './wechatPublicTag';
|
import { WechatPublicTag } from './wechatPublicTag';
|
||||||
import { UserWechatPublicTag } from './userWechatPublicTag';
|
import { UserWechatPublicTag } from './userWechatPublicTag';
|
||||||
import { BasicFeatures } from 'oak-frontend-base';
|
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 { EntityDict } from '../oak-app-domain';
|
||||||
import Theme from './theme';
|
import Theme from './theme';
|
||||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
export declare function initialize<ED extends EntityDict>(basicFeatures: BasicFeatures<ED>): FeatureDict<ED>;
|
||||||
import { FrontendRuntimeContext } from '../context/FrontendRuntimeContext';
|
export type FeatureDict<ED extends EntityDict> = {
|
||||||
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>;
|
token: Token<ED>;
|
||||||
export type GeneralFeatures<ED extends EntityDict, Cxt extends BackendRuntimeContext<ED>, FrontCxt extends FrontendRuntimeContext<ED, Cxt, AD>, AD extends AspectDict<ED, Cxt> & CommonAspectDict<ED, Cxt>> = {
|
extraFile: ExtraFile<ED>;
|
||||||
token: Token<ED, Cxt, FrontCxt, AD>;
|
application: Application<ED>;
|
||||||
extraFile: ExtraFile<ED, Cxt, FrontCxt, AD>;
|
config: Config<ED>;
|
||||||
application: Application<ED, Cxt, FrontCxt, AD>;
|
template: Template<ED>;
|
||||||
config: Config<ED, Cxt, FrontCxt, AD>;
|
wechatSdk: WechatSdk<ED>;
|
||||||
template: Template<ED, Cxt, FrontCxt, AD>;
|
theme: Theme;
|
||||||
weiXinJsSdk: WeiXinJsSdk<ED, Cxt, FrontCxt, AD>;
|
wechatMenu: WechatMenu<ED>;
|
||||||
theme: Theme<ED, Cxt, FrontCxt, AD>;
|
wechatPublicTag: WechatPublicTag<ED>;
|
||||||
wechatMenu: WechatMenu<ED, Cxt, FrontCxt, AD>;
|
userWechatPublicTag: UserWechatPublicTag<ED>;
|
||||||
wechatPublicTag: WechatPublicTag<ED, Cxt, FrontCxt, AD>;
|
|
||||||
userWechatPublicTag: UserWechatPublicTag<ED, Cxt, FrontCxt, AD>;
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,29 +3,29 @@ import { ExtraFile } from './extraFile';
|
||||||
import { Application } from './application';
|
import { Application } from './application';
|
||||||
import { Config } from './config';
|
import { Config } from './config';
|
||||||
import { Template } from './template';
|
import { Template } from './template';
|
||||||
import { WeiXinJsSdk } from './weiXinJsSdk';
|
import { WechatSdk } from './wechatSdk';
|
||||||
import { WechatMenu } from './wechatMenu';
|
import { WechatMenu } from './wechatMenu';
|
||||||
import { WechatPublicTag } from './wechatPublicTag';
|
import { WechatPublicTag } from './wechatPublicTag';
|
||||||
import { UserWechatPublicTag } from './userWechatPublicTag';
|
import { UserWechatPublicTag } from './userWechatPublicTag';
|
||||||
import Theme from './theme';
|
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 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 wechatMenu = new WechatMenu(basicFeatures.cache, basicFeatures.localStorage);
|
||||||
const wechatPublicTag = new WechatPublicTag(basicFeatures.cache, basicFeatures.localStorage);
|
const wechatPublicTag = new WechatPublicTag(basicFeatures.cache, basicFeatures.localStorage);
|
||||||
const userWechatPublicTag = new UserWechatPublicTag(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 config = new Config(basicFeatures.cache);
|
||||||
const template = new Template(basicFeatures.cache);
|
const template = new Template(basicFeatures.cache);
|
||||||
const weiXinJsSdk = new WeiXinJsSdk(basicFeatures.cache, basicFeatures.localStorage, basicFeatures.environment);
|
const wechatSdk = new WechatSdk(basicFeatures.cache, basicFeatures.localStorage, basicFeatures.environment);
|
||||||
const theme = new Theme(basicFeatures.cache, basicFeatures.localStorage);
|
const theme = new Theme(basicFeatures.localStorage);
|
||||||
return {
|
return {
|
||||||
token,
|
token,
|
||||||
extraFile,
|
extraFile,
|
||||||
application,
|
application,
|
||||||
config,
|
config,
|
||||||
template,
|
template,
|
||||||
weiXinJsSdk,
|
wechatSdk,
|
||||||
theme,
|
theme,
|
||||||
wechatMenu,
|
wechatMenu,
|
||||||
wechatPublicTag,
|
wechatPublicTag,
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,12 @@
|
||||||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||||
import AspectDict from '../aspects/AspectDict';
|
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
export declare class Template<ED extends EntityDict> extends Feature {
|
||||||
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 {
|
|
||||||
private cache;
|
private cache;
|
||||||
private messageTypes;
|
private messageTypes;
|
||||||
constructor(cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>);
|
constructor(cache: Cache<ED>);
|
||||||
getMessageType(): Promise<{
|
getMessageType(): Promise<{
|
||||||
result: Awaited<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["getMessageType"]>>;
|
result: any;
|
||||||
message: string | null | undefined;
|
message: string | null | undefined;
|
||||||
}>;
|
}>;
|
||||||
syncMessageTemplate(applicationId: string): Promise<void>;
|
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 { 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 { 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';
|
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 {
|
export default class Theme extends Feature {
|
||||||
private cache;
|
|
||||||
private themeState;
|
private themeState;
|
||||||
private storage;
|
private storage;
|
||||||
private loadSavedState;
|
private loadSavedState;
|
||||||
constructor(cache: Cache<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>, storage: LocalStorage);
|
constructor(storage: LocalStorage);
|
||||||
get(): IThemeState;
|
get(): IThemeState;
|
||||||
set(themeState: IThemeState): void;
|
set(themeState: IThemeState): void;
|
||||||
toggleSetting(): void;
|
toggleSetting(): void;
|
||||||
|
|
|
||||||
|
|
@ -13,16 +13,14 @@ const initialThemeState = {
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
};
|
};
|
||||||
export default class Theme extends Feature {
|
export default class Theme extends Feature {
|
||||||
cache;
|
|
||||||
themeState;
|
themeState;
|
||||||
storage;
|
storage;
|
||||||
async loadSavedState() {
|
async loadSavedState() {
|
||||||
const themeState = await this.storage.load(LOCAL_STORAGE_KEYS.themeState);
|
const themeState = await this.storage.load(LOCAL_STORAGE_KEYS.themeState);
|
||||||
this.themeState = themeState;
|
this.themeState = themeState;
|
||||||
}
|
}
|
||||||
constructor(cache, storage) {
|
constructor(storage) {
|
||||||
super();
|
super();
|
||||||
this.cache = cache;
|
|
||||||
this.storage = storage;
|
this.storage = storage;
|
||||||
this.themeState = initialThemeState;
|
this.themeState = initialThemeState;
|
||||||
this.switchThemeMode(this.themeState.themeMode);
|
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 { Cache } from 'oak-frontend-base/es/features/cache';
|
||||||
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
||||||
import { Environment } from 'oak-frontend-base/es/features/environment';
|
import { Environment } from 'oak-frontend-base/es/features/environment';
|
||||||
import { CommonAspectDict } from 'oak-common-aspect';
|
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import AspectDict from '../aspects/AspectDict';
|
export declare class Token<ED extends EntityDict> extends Feature {
|
||||||
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 {
|
|
||||||
private tokenValue?;
|
private tokenValue?;
|
||||||
private environment;
|
private environment;
|
||||||
private cache;
|
private cache;
|
||||||
private storage;
|
private storage;
|
||||||
private loadSavedToken;
|
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>;
|
refreshTokenData(tokenValue?: string): Promise<void>;
|
||||||
loginByMobile(mobile: string, password?: string, captcha?: string, disableRegister?: boolean): Promise<void>;
|
loginByMobile(mobile: string, password?: string, captcha?: string, disableRegister?: boolean): Promise<void>;
|
||||||
loginByWechatInWebEnv(wechatLoginId: string): Promise<void>;
|
loginByWechatInWebEnv(wechatLoginId: string): Promise<void>;
|
||||||
|
|
|
||||||
|
|
@ -1,49 +1,45 @@
|
||||||
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
import { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||||
import { CommonAspectDict } from 'oak-common-aspect';
|
|
||||||
import { EntityDict } from '../oak-app-domain';
|
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 { Cache } from 'oak-frontend-base/es/features/cache';
|
||||||
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
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 cache;
|
||||||
private storage;
|
private storage;
|
||||||
constructor(cache: Cache<ED, Cxt, FrontCxt, AD>, storage: LocalStorage);
|
constructor(cache: Cache<ED>, storage: LocalStorage);
|
||||||
getTagUsers(params: {
|
getTagUsers(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
tagId: number;
|
tagId: number;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["getTagUsers"]>>;
|
}): Promise<any>;
|
||||||
batchtagging(params: {
|
batchtagging(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
openIdList: string[];
|
openIdList: string[];
|
||||||
tagId: number;
|
tagId: number;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["batchtagging"]>>;
|
}): Promise<any>;
|
||||||
batchuntagging(params: {
|
batchuntagging(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
openIdList: string[];
|
openIdList: string[];
|
||||||
tagId: number;
|
tagId: number;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["batchuntagging"]>>;
|
}): Promise<any>;
|
||||||
getUserTags(params: {
|
getUserTags(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
openId: string;
|
openId: string;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["getUserTags"]>>;
|
}): Promise<any>;
|
||||||
getUsers(params: {
|
getUsers(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
nextOpenId: string;
|
nextOpenId: string;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["getUsers"]>>;
|
}): Promise<any>;
|
||||||
tagging(params: {
|
tagging(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
openId: string;
|
openId: string;
|
||||||
tagIdList: number[];
|
tagIdList: number[];
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["tagging"]>>;
|
}): Promise<any>;
|
||||||
syncToLocale(params: {
|
syncToLocale(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
openId: string;
|
openId: string;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["syncToLocale"]>>;
|
}): Promise<any>;
|
||||||
syncToWechat(params: {
|
syncToWechat(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
id: string;
|
id: string;
|
||||||
openId: 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 { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||||
import { CommonAspectDict } from 'oak-common-aspect';
|
|
||||||
import { EntityDict } from '../oak-app-domain';
|
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 { Cache } from 'oak-frontend-base/es/features/cache';
|
||||||
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
||||||
import { MediaType, MediaVideoDescription, MaterialType } from '../types/WeChat';
|
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 cache;
|
||||||
private storage;
|
private storage;
|
||||||
constructor(cache: Cache<ED, Cxt, FrontCxt, AD>, storage: LocalStorage);
|
constructor(cache: Cache<ED>, storage: LocalStorage);
|
||||||
getCurrentMenu(params: {
|
getCurrentMenu(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["getCurrentMenu"]>>;
|
}): Promise<any>;
|
||||||
getMenu(params: {
|
getMenu(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["getMenu"]>>;
|
}): Promise<any>;
|
||||||
createMenu(params: {
|
createMenu(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
menuConfig: any;
|
menuConfig: any;
|
||||||
id: string;
|
id: string;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["createMenu"]>>;
|
}): Promise<any>;
|
||||||
createConditionalMenu(params: {
|
createConditionalMenu(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
menuConfig: any;
|
menuConfig: any;
|
||||||
id: string;
|
id: string;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["createConditionalMenu"]>>;
|
}): Promise<any>;
|
||||||
deleteConditionalMenu(params: {
|
deleteConditionalMenu(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
menuId: number;
|
menuId: number;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["deleteConditionalMenu"]>>;
|
}): Promise<any>;
|
||||||
deleteMenu(params: {
|
deleteMenu(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["deleteMenu"]>>;
|
}): Promise<any>;
|
||||||
batchGetArticle(params: {
|
batchGetArticle(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
offset?: number;
|
offset?: number;
|
||||||
count: number;
|
count: number;
|
||||||
noContent?: 0 | 1;
|
noContent?: 0 | 1;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["batchGetArticle"]>>;
|
}): Promise<any>;
|
||||||
getArticle(params: {
|
getArticle(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
articleId: string;
|
articleId: string;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["getArticle"]>>;
|
}): Promise<any>;
|
||||||
createMaterial(params: {
|
createMaterial(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
type: MediaType;
|
type: MediaType;
|
||||||
file: File;
|
file: File;
|
||||||
description?: MediaVideoDescription;
|
description?: MediaVideoDescription;
|
||||||
isPermanent?: boolean;
|
isPermanent?: boolean;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["uploadWechatMedia"]>>;
|
}): Promise<any>;
|
||||||
batchGetMaterialList(params: {
|
batchGetMaterialList(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
type: MaterialType;
|
type: MaterialType;
|
||||||
offset?: number;
|
offset?: number;
|
||||||
count: number;
|
count: number;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["batchGetMaterialList"]>>;
|
}): Promise<any>;
|
||||||
/**
|
/**
|
||||||
* 获取素材详情
|
* 获取素材详情
|
||||||
* @param params
|
* @param params
|
||||||
|
|
@ -66,5 +62,5 @@ export declare class WechatMenu<ED extends EntityDict, Cxt extends BackendRuntim
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
mediaId: string;
|
mediaId: string;
|
||||||
isPermanent?: boolean;
|
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 { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||||
import { CommonAspectDict } from 'oak-common-aspect';
|
|
||||||
import { EntityDict } from '../oak-app-domain';
|
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 { Cache } from 'oak-frontend-base/es/features/cache';
|
||||||
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
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 cache;
|
||||||
private storage;
|
private storage;
|
||||||
constructor(cache: Cache<ED, Cxt, FrontCxt, AD>, storage: LocalStorage);
|
constructor(cache: Cache<ED>, storage: LocalStorage);
|
||||||
createTag(params: {
|
createTag(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
name: string;
|
name: string;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["createTag"]>>;
|
}): Promise<any>;
|
||||||
getTags(params: {
|
getTags(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["getTags"]>>;
|
}): Promise<any>;
|
||||||
editTag(params: {
|
editTag(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["editTag"]>>;
|
}): Promise<any>;
|
||||||
deleteTag(params: {
|
deleteTag(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
id: string;
|
id: string;
|
||||||
wechatId: number;
|
wechatId: number;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["deleteTag"]>>;
|
}): Promise<any>;
|
||||||
syncTag(params: {
|
syncTag(params: {
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
id: string;
|
id: string;
|
||||||
}): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["syncTag"]>>;
|
}): Promise<any>;
|
||||||
oneKeySync(params: {
|
oneKeySync(params: {
|
||||||
applicationId: string;
|
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]');
|
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 { Feature } from 'oak-frontend-base/es/types/Feature';
|
||||||
import { CommonAspectDict } from 'oak-common-aspect';
|
|
||||||
import { EntityDict } from '../oak-app-domain';
|
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 { Cache } from 'oak-frontend-base/es/features/cache';
|
||||||
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
||||||
import { Environment } from 'oak-frontend-base/es/features/environment';
|
import { Environment } from 'oak-frontend-base/es/features/environment';
|
||||||
|
|
@ -18,13 +14,13 @@ type ConfigOptions = {
|
||||||
openTagList?: wx.openTagList;
|
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;
|
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 cache;
|
||||||
private storage;
|
private storage;
|
||||||
private environment;
|
private environment;
|
||||||
private landingUrl?;
|
private landingUrl?;
|
||||||
constructor(cache: Cache<ED, Cxt, FrontCxt, AD>, storage: LocalStorage, environment: Environment);
|
constructor(cache: Cache<ED>, storage: LocalStorage, environment: Environment);
|
||||||
signatureJsSDK(url: string): Promise<ReturnType<(AD & CommonAspectDict<ED, Cxt>)["signatureJsSDK"]>>;
|
signatureJsSDK(url: string): Promise<any>;
|
||||||
getConfig(config: ConfigOptions): Promise<unknown>;
|
getConfig(config: ConfigOptions): Promise<unknown>;
|
||||||
setLandingUrl(url?: string): void;
|
setLandingUrl(url?: string): void;
|
||||||
init(options?: {
|
init(options?: {
|
||||||
|
|
@ -36,5 +32,6 @@ export declare class WeiXinJsSdk<ED extends EntityDict, Cxt extends BackendRunti
|
||||||
* 微信jssdk 传入方法名
|
* 微信jssdk 传入方法名
|
||||||
*/
|
*/
|
||||||
loadWxAPi(name: wx.ApiMethod, options?: ParamOptions, jsApiList?: wx.jsApiList, openTagList?: wx.openTagList): Promise<object>;
|
loadWxAPi(name: wx.ApiMethod, options?: ParamOptions, jsApiList?: wx.jsApiList, openTagList?: wx.openTagList): Promise<object>;
|
||||||
|
subscribeMpMessage(messageTypes: string[], haveToAccept?: boolean, tip?: string): Promise<boolean>;
|
||||||
}
|
}
|
||||||
export {};
|
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 { promisify as wxPromisify } from 'oak-frontend-base/es/utils/promisify';
|
||||||
import { uniq } from 'oak-domain/lib/utils/lodash';
|
import { uniq } from 'oak-domain/lib/utils/lodash';
|
||||||
import wx from 'weixin-js-sdk';
|
import wx from 'weixin-js-sdk';
|
||||||
export class WeiXinJsSdk extends Feature {
|
export class WechatSdk extends Feature {
|
||||||
cache;
|
cache;
|
||||||
storage;
|
storage;
|
||||||
environment;
|
environment;
|
||||||
|
|
@ -96,4 +96,8 @@ export class WeiXinJsSdk extends Feature {
|
||||||
const result = await wxFn(options);
|
const result = await wxFn(options);
|
||||||
return result;
|
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 { BasicFeatures } from 'oak-frontend-base';
|
||||||
import { GeneralFeatures } from '../features';
|
import { FeatureDict } from '../features';
|
||||||
import { EntityDict } from '../oak-app-domain';
|
import { EntityDict } from '../oak-app-domain';
|
||||||
import { BRC, FrcAspectDict, FRC } from '../types/RuntimeCxt';
|
export default function useFeatures(): FeatureDict<EntityDict> & BasicFeatures<EntityDict>;
|
||||||
export default function useFeatures(): GeneralFeatures<EntityDict, BRC, FRC, FrcAspectDict> & BasicFeatures<EntityDict, BRC, FRC, FrcAspectDict>;
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
export type { GeneralFeatures } from './features';
|
export type { FeatureDict as GeneralFeatures } from './features';
|
||||||
export type { GeneralAspectDict } from './aspects/AspectDict';
|
export type { GeneralAspectDict } from './aspects/AspectDict';
|
||||||
export * from './types/Exception';
|
export * from './types/Exception';
|
||||||
export * from './types/Page';
|
|
||||||
export * from './types/Message';
|
export * from './types/Message';
|
||||||
export * from './types/RuntimeCxt';
|
export * from './types/RuntimeCxt';
|
||||||
export { BackendRuntimeContext } from './context/BackendRuntimeContext';
|
export { BackendRuntimeContext } from './context/BackendRuntimeContext';
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
// import { registerMessageNotificationConverters } from './triggers/message';
|
// import { registerMessageNotificationConverters } from './triggers/message';
|
||||||
// import { registerWeChatPublicEventCallback } from './endpoints';
|
// import { registerWeChatPublicEventCallback } from './endpoints';
|
||||||
export * from './types/Exception';
|
export * from './types/Exception';
|
||||||
export * from './types/Page';
|
|
||||||
export * from './types/Message';
|
export * from './types/Message';
|
||||||
export * from './types/RuntimeCxt';
|
export * from './types/RuntimeCxt';
|
||||||
// export { getLivestream, getPlayBackUrl, getStreamObj } from './utils/livestream';
|
// 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