From 966396387c0dc5900649d6ecd3552f28626c529f Mon Sep 17 00:00:00 2001 From: "Xc@centOs" Date: Wed, 2 Nov 2022 10:27:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E5=B1=80token=E7=9A=84=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E5=92=8Capplication=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AE=8C=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/components/common/empty/empty.d.ts | 1 - lib/components/common/empty/simple.d.ts | 1 - .../common/weChatLoginQrCode/index.d.ts | 1 - .../config/upsert/account/index.d.ts | 1 - lib/components/config/upsert/web.pc.d.ts | 1 - lib/components/extraFile/display/web.d.ts | 1 - lib/components/extraFile/gallery/web.d.ts | 1 - lib/components/func/debugPanel/web.d.ts | 1 - lib/context/BackendRuntimeContext.js | 5 +++ lib/context/FrontendRuntimeContext.d.ts | 34 +++++++++++++++++-- lib/context/FrontendRuntimeContext.js | 4 +-- lib/context/RuntimeContext.d.ts | 5 +++ lib/features/application.d.ts | 5 +++ lib/features/application.js | 5 +++ lib/features/token.d.ts | 4 +-- lib/features/token.js | 13 ++++--- lib/pages/address/list/web.d.ts | 1 - lib/pages/address/upsert/web.d.ts | 1 - lib/pages/article/detail/web.d.ts | 1 - lib/pages/article/list/web.d.ts | 1 - lib/pages/article/preview/web.d.ts | 1 - lib/pages/article/upsert/web.d.ts | 1 - lib/pages/login/web.d.ts | 1 - lib/pages/mobile/login/web.d.ts | 1 - lib/pages/mobile/me/web.d.ts | 1 - lib/pages/pickers/area/web.d.ts | 1 - lib/pages/platform/config/upsert/web.pc.d.ts | 1 - lib/pages/platform/list/web.pc.d.ts | 1 - lib/pages/platform/upsert/web.pc.d.ts | 1 - lib/pages/token/me/web.d.ts | 1 - lib/pages/user/manage/detail/web.d.ts | 1 - lib/pages/user/manage/upsert/web.d.ts | 1 - lib/pages/user/manage/web.d.ts | 1 - lib/pages/user/manage/web.pc.d.ts | 1 - lib/pages/user/search/web.d.ts | 1 - lib/pages/userEntityGrant/confirm/web.d.ts | 1 - lib/pages/userEntityGrant/detail/web.d.ts | 1 - lib/pages/userEntityGrant/grant/web.d.ts | 1 - lib/pages/userRelation/list/web.d.ts | 1 - lib/pages/userRelation/list/web.pc.d.ts | 1 - lib/pages/userRelation/manage/index.less | 25 ++++++++++++++ lib/pages/userRelation/manage/web.d.ts | 1 - lib/pages/userRelation/onEntity/web.d.ts | 1 - .../userRelation/onEntity/web.module.less | 9 +++++ lib/pages/userRelation/onUser/web.d.ts | 1 - .../userRelation/upsert/byMobile/web.pc.d.ts | 1 - .../userRelation/upsert/byUser/web.pc.d.ts | 1 - .../upsert/byUserEntityGrant/web.d.ts | 1 - .../upsert/byUserEntityGrant/web.pc.d.ts | 1 - lib/pages/userRelation/upsert/onUser/web.d.ts | 1 - .../userRelation/upsert/onUser/web.pc.d.ts | 1 - lib/pages/userRelation/upsert/web.d.ts | 1 - lib/pages/userRelation/upsert/web.pc.d.ts | 1 - lib/pages/wechatQrCode/scan/web.d.ts | 1 - lib/pages/wechatUser/login/web.d.ts | 1 - src/context/BackendRuntimeContext.ts | 5 +++ src/context/FrontendRuntimeContext.ts | 4 +-- src/context/RuntimeContext.ts | 5 +++ src/features/application.ts | 10 ++++++ src/features/token.ts | 12 ++++--- 60 files changed, 129 insertions(+), 61 deletions(-) diff --git a/lib/components/common/empty/empty.d.ts b/lib/components/common/empty/empty.d.ts index a67bcf109..5ad33b8bc 100644 --- a/lib/components/common/empty/empty.d.ts +++ b/lib/components/common/empty/empty.d.ts @@ -1,4 +1,3 @@ -/// import './index.less'; declare const Empty: () => JSX.Element; export default Empty; diff --git a/lib/components/common/empty/simple.d.ts b/lib/components/common/empty/simple.d.ts index a67bcf109..5ad33b8bc 100644 --- a/lib/components/common/empty/simple.d.ts +++ b/lib/components/common/empty/simple.d.ts @@ -1,4 +1,3 @@ -/// import './index.less'; declare const Empty: () => JSX.Element; export default Empty; diff --git a/lib/components/common/weChatLoginQrCode/index.d.ts b/lib/components/common/weChatLoginQrCode/index.d.ts index 7f7374737..9a67a68fd 100644 --- a/lib/components/common/weChatLoginQrCode/index.d.ts +++ b/lib/components/common/weChatLoginQrCode/index.d.ts @@ -1,4 +1,3 @@ -/// import './index.less'; interface QrCodeProps { id?: string; diff --git a/lib/components/config/upsert/account/index.d.ts b/lib/components/config/upsert/account/index.d.ts index ed8ae19c5..d12966ca5 100644 --- a/lib/components/config/upsert/account/index.d.ts +++ b/lib/components/config/upsert/account/index.d.ts @@ -1,4 +1,3 @@ -/// import { Config } from '../../../../types/Config'; export default function Account(props: { account: Required['Account']; diff --git a/lib/components/config/upsert/web.pc.d.ts b/lib/components/config/upsert/web.pc.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/components/config/upsert/web.pc.d.ts +++ b/lib/components/config/upsert/web.pc.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/components/extraFile/display/web.d.ts b/lib/components/extraFile/display/web.d.ts index 5eaeadcc2..cfaabf286 100644 --- a/lib/components/extraFile/display/web.d.ts +++ b/lib/components/extraFile/display/web.d.ts @@ -1,2 +1 @@ -/// export default function render(): JSX.Element; diff --git a/lib/components/extraFile/gallery/web.d.ts b/lib/components/extraFile/gallery/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/components/extraFile/gallery/web.d.ts +++ b/lib/components/extraFile/gallery/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/components/func/debugPanel/web.d.ts b/lib/components/func/debugPanel/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/components/func/debugPanel/web.d.ts +++ b/lib/components/func/debugPanel/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/context/BackendRuntimeContext.js b/lib/context/BackendRuntimeContext.js index 88328a481..3e6641295 100644 --- a/lib/context/BackendRuntimeContext.js +++ b/lib/context/BackendRuntimeContext.js @@ -35,6 +35,11 @@ var BackendRuntimeContext = /** @class */ (function (_super) { id: 1, name: 1, config: 1, + platformId: 1, + platform: { + id: 1, + config: 1, + }, }, }, filter: { diff --git a/lib/context/FrontendRuntimeContext.d.ts b/lib/context/FrontendRuntimeContext.d.ts index d01ef61b0..34214e2df 100644 --- a/lib/context/FrontendRuntimeContext.d.ts +++ b/lib/context/FrontendRuntimeContext.d.ts @@ -26,6 +26,11 @@ export declare class FrontendRuntimeContext[T][0], { id: 1; @@ -48,6 +58,11 @@ export declare class FrontendRuntimeContext[] : T extends import("oak-domain/lib/types").OptionalKeys ? import("oak-domain/lib/types").SelectRowShape[T]>, { id: 1; @@ -59,6 +74,11 @@ export declare class FrontendRuntimeContext | null : import("oak-domain/lib/types").SelectRowShape[T]>, { id: 1; @@ -70,6 +90,11 @@ export declare class FrontendRuntimeContext : never : never : never) | undefined>; getApplication(): Promise | undefined>; getTokenValue(): Promise; - getToken(): Promise | undefined>; - getCurrentUserId(): Promise; + getCurrentUserId(allowUnloggedIn?: boolean): Promise; toString(): Promise; isRoot(): Promise; } diff --git a/lib/context/FrontendRuntimeContext.js b/lib/context/FrontendRuntimeContext.js index 808e65934..6b180dc7b 100644 --- a/lib/context/FrontendRuntimeContext.js +++ b/lib/context/FrontendRuntimeContext.js @@ -49,7 +49,7 @@ var FrontendRuntimeContext = /** @class */ (function (_super) { }); }); }; - FrontendRuntimeContext.prototype.getToken = function () { + FrontendRuntimeContext.prototype.getToken = function (allowUnloggedIn) { var _a; return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_b) { @@ -57,7 +57,7 @@ var FrontendRuntimeContext = /** @class */ (function (_super) { }); }); }; - FrontendRuntimeContext.prototype.getCurrentUserId = function () { + FrontendRuntimeContext.prototype.getCurrentUserId = function (allowUnloggedIn) { var _a; return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_b) { diff --git a/lib/context/RuntimeContext.d.ts b/lib/context/RuntimeContext.d.ts index a1ef3beaa..82fd67e1f 100644 --- a/lib/context/RuntimeContext.d.ts +++ b/lib/context/RuntimeContext.d.ts @@ -11,6 +11,11 @@ export declare type GetApplicationShape = { id: 1; name: 1; config: 1; + platformId: 1; + platform: { + id: 1; + config: 1; + }; }; }; export declare type GetTokeShape = { diff --git a/lib/features/application.d.ts b/lib/features/application.d.ts index 3fe1556a2..7bb702320 100644 --- a/lib/features/application.d.ts +++ b/lib/features/application.d.ts @@ -28,6 +28,11 @@ export declare class Application>; getApplicationId(noWait?: true): Promise; diff --git a/lib/features/application.js b/lib/features/application.js index 8ab416b4d..3b38d21e2 100644 --- a/lib/features/application.js +++ b/lib/features/application.js @@ -15,6 +15,11 @@ var projection = { id: 1, name: 1, config: 1, + platformId: 1, + platform: { + id: 1, + config: 1, + }, } }; var Application = /** @class */ (function (_super) { diff --git a/lib/features/token.d.ts b/lib/features/token.d.ts index a8822fa95..dbcb7b695 100644 --- a/lib/features/token.d.ts +++ b/lib/features/token.d.ts @@ -77,8 +77,8 @@ export declare class Token syncUserInfoWechatMp(): Promise; logout(): Promise; getTokenValue(noWait?: true): Promise; - getToken(): Promise>; - getUserId(): Promise; + getToken(allowUnloggedIn?: boolean): Promise | undefined>; + getUserId(allowUnloggedIn?: boolean): Promise; getUserInfo(): Promise<("user" extends infer T ? T extends "user" ? T extends keyof ED["token"]["Schema"] ? TokenProjection[T] extends 1 | undefined ? ED["token"]["Schema"][T] : TokenProjection[T] extends import("oak-domain/lib/types").OtmSubProjection ? never[] | SelectRowShape[T][0], TokenProjection[T]["data"]>[] : T extends import("oak-domain/lib/types").OptionalKeys ? SelectRowShape[T]>, TokenProjection[T]> | null : SelectRowShape[T]>, TokenProjection[T]> : never : never : never) | SelectRowShape | undefined>; isRoot(): Promise; sendCaptcha(mobile: string): Promise; diff --git a/lib/features/token.js b/lib/features/token.js index 9d1aa6ccd..dd0140809 100644 --- a/lib/features/token.js +++ b/lib/features/token.js @@ -4,6 +4,7 @@ exports.Token = void 0; var tslib_1 = require("tslib"); var Feature_1 = require("oak-frontend-base/lib/types/Feature"); var concurrent_1 = require("oak-domain/lib/utils/concurrent"); +var Exception_1 = require("oak-domain/lib/types/Exception"); var env_1 = require("../utils/env"); var userProjection = { id: 1, @@ -266,7 +267,7 @@ var Token = /** @class */ (function (_super) { }); }); }; - Token.prototype.getToken = function () { + Token.prototype.getToken = function (allowUnloggedIn) { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { switch (_a.label) { @@ -279,17 +280,21 @@ var Token = /** @class */ (function (_super) { case 1: _a.sent(); _a.label = 2; - case 2: return [2 /*return*/, this.token]; + case 2: + if (allowUnloggedIn || this.token) { + return [2 /*return*/, this.token]; + } + throw new Exception_1.OakUnloggedInException(); } }); }); }; - Token.prototype.getUserId = function () { + Token.prototype.getUserId = function (allowUnloggedIn) { return tslib_1.__awaiter(this, void 0, void 0, function () { var token; return tslib_1.__generator(this, function (_a) { switch (_a.label) { - case 0: return [4 /*yield*/, this.getToken()]; + case 0: return [4 /*yield*/, this.getToken(allowUnloggedIn)]; case 1: token = _a.sent(); return [2 /*return*/, token === null || token === void 0 ? void 0 : token.userId]; diff --git a/lib/pages/address/list/web.d.ts b/lib/pages/address/list/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/address/list/web.d.ts +++ b/lib/pages/address/list/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/address/upsert/web.d.ts b/lib/pages/address/upsert/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/address/upsert/web.d.ts +++ b/lib/pages/address/upsert/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/article/detail/web.d.ts b/lib/pages/article/detail/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/article/detail/web.d.ts +++ b/lib/pages/article/detail/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/article/list/web.d.ts b/lib/pages/article/list/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/article/list/web.d.ts +++ b/lib/pages/article/list/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/article/preview/web.d.ts b/lib/pages/article/preview/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/article/preview/web.d.ts +++ b/lib/pages/article/preview/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/article/upsert/web.d.ts b/lib/pages/article/upsert/web.d.ts index 6b79ea6c3..5a31aa4b8 100644 --- a/lib/pages/article/upsert/web.d.ts +++ b/lib/pages/article/upsert/web.d.ts @@ -1,3 +1,2 @@ -/// import '@wangeditor/editor/dist/css/style.css'; export default function render(this: any): JSX.Element; diff --git a/lib/pages/login/web.d.ts b/lib/pages/login/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/login/web.d.ts +++ b/lib/pages/login/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/mobile/login/web.d.ts b/lib/pages/mobile/login/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/mobile/login/web.d.ts +++ b/lib/pages/mobile/login/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/mobile/me/web.d.ts b/lib/pages/mobile/me/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/mobile/me/web.d.ts +++ b/lib/pages/mobile/me/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/pickers/area/web.d.ts b/lib/pages/pickers/area/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/pickers/area/web.d.ts +++ b/lib/pages/pickers/area/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/platform/config/upsert/web.pc.d.ts b/lib/pages/platform/config/upsert/web.pc.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/platform/config/upsert/web.pc.d.ts +++ b/lib/pages/platform/config/upsert/web.pc.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/platform/list/web.pc.d.ts b/lib/pages/platform/list/web.pc.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/platform/list/web.pc.d.ts +++ b/lib/pages/platform/list/web.pc.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/platform/upsert/web.pc.d.ts b/lib/pages/platform/upsert/web.pc.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/platform/upsert/web.pc.d.ts +++ b/lib/pages/platform/upsert/web.pc.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/token/me/web.d.ts b/lib/pages/token/me/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/token/me/web.d.ts +++ b/lib/pages/token/me/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/user/manage/detail/web.d.ts b/lib/pages/user/manage/detail/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/user/manage/detail/web.d.ts +++ b/lib/pages/user/manage/detail/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/user/manage/upsert/web.d.ts b/lib/pages/user/manage/upsert/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/user/manage/upsert/web.d.ts +++ b/lib/pages/user/manage/upsert/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/user/manage/web.d.ts b/lib/pages/user/manage/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/user/manage/web.d.ts +++ b/lib/pages/user/manage/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/user/manage/web.pc.d.ts b/lib/pages/user/manage/web.pc.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/user/manage/web.pc.d.ts +++ b/lib/pages/user/manage/web.pc.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/user/search/web.d.ts b/lib/pages/user/search/web.d.ts index 5eaeadcc2..cfaabf286 100644 --- a/lib/pages/user/search/web.d.ts +++ b/lib/pages/user/search/web.d.ts @@ -1,2 +1 @@ -/// export default function render(): JSX.Element; diff --git a/lib/pages/userEntityGrant/confirm/web.d.ts b/lib/pages/userEntityGrant/confirm/web.d.ts index 5eaeadcc2..cfaabf286 100644 --- a/lib/pages/userEntityGrant/confirm/web.d.ts +++ b/lib/pages/userEntityGrant/confirm/web.d.ts @@ -1,2 +1 @@ -/// export default function render(): JSX.Element; diff --git a/lib/pages/userEntityGrant/detail/web.d.ts b/lib/pages/userEntityGrant/detail/web.d.ts index 5eaeadcc2..cfaabf286 100644 --- a/lib/pages/userEntityGrant/detail/web.d.ts +++ b/lib/pages/userEntityGrant/detail/web.d.ts @@ -1,2 +1 @@ -/// export default function render(): JSX.Element; diff --git a/lib/pages/userEntityGrant/grant/web.d.ts b/lib/pages/userEntityGrant/grant/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/userEntityGrant/grant/web.d.ts +++ b/lib/pages/userEntityGrant/grant/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/list/web.d.ts b/lib/pages/userRelation/list/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/userRelation/list/web.d.ts +++ b/lib/pages/userRelation/list/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/list/web.pc.d.ts b/lib/pages/userRelation/list/web.pc.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/userRelation/list/web.pc.d.ts +++ b/lib/pages/userRelation/list/web.pc.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/manage/index.less b/lib/pages/userRelation/manage/index.less index e69de29bb..925d48c13 100644 --- a/lib/pages/userRelation/manage/index.less +++ b/lib/pages/userRelation/manage/index.less @@ -0,0 +1,25 @@ +/** index.wxss **/ +@import "../../../config/styles/mp/index.less"; +@import "../../../config/styles/mp/mixins.less"; + +page { + height: 100%; + background-color: @bg-color-fade; +} + +.container { + height: 100%; + display: flex; + flex: 1; + flex-direction: column; + box-sizing: border-box; + align-items: stretch; + padding: 0; + .safe-area-inset-bottom(); +} + +.col { + display: flex; + flex-direction: column; + background-color: #fff; +} diff --git a/lib/pages/userRelation/manage/web.d.ts b/lib/pages/userRelation/manage/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/userRelation/manage/web.d.ts +++ b/lib/pages/userRelation/manage/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/onEntity/web.d.ts b/lib/pages/userRelation/onEntity/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/userRelation/onEntity/web.d.ts +++ b/lib/pages/userRelation/onEntity/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/onEntity/web.module.less b/lib/pages/userRelation/onEntity/web.module.less index e69de29bb..ab16b7613 100644 --- a/lib/pages/userRelation/onEntity/web.module.less +++ b/lib/pages/userRelation/onEntity/web.module.less @@ -0,0 +1,9 @@ + + +.container { + height: 100vh; + display: flex; + flex-direction: column; + justify-content: 'center'; + align-items: 'center'; +} diff --git a/lib/pages/userRelation/onUser/web.d.ts b/lib/pages/userRelation/onUser/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/userRelation/onUser/web.d.ts +++ b/lib/pages/userRelation/onUser/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/upsert/byMobile/web.pc.d.ts b/lib/pages/userRelation/upsert/byMobile/web.pc.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/userRelation/upsert/byMobile/web.pc.d.ts +++ b/lib/pages/userRelation/upsert/byMobile/web.pc.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/upsert/byUser/web.pc.d.ts b/lib/pages/userRelation/upsert/byUser/web.pc.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/userRelation/upsert/byUser/web.pc.d.ts +++ b/lib/pages/userRelation/upsert/byUser/web.pc.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/upsert/byUserEntityGrant/web.d.ts b/lib/pages/userRelation/upsert/byUserEntityGrant/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/userRelation/upsert/byUserEntityGrant/web.d.ts +++ b/lib/pages/userRelation/upsert/byUserEntityGrant/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/upsert/byUserEntityGrant/web.pc.d.ts b/lib/pages/userRelation/upsert/byUserEntityGrant/web.pc.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/userRelation/upsert/byUserEntityGrant/web.pc.d.ts +++ b/lib/pages/userRelation/upsert/byUserEntityGrant/web.pc.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/upsert/onUser/web.d.ts b/lib/pages/userRelation/upsert/onUser/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/userRelation/upsert/onUser/web.d.ts +++ b/lib/pages/userRelation/upsert/onUser/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/upsert/onUser/web.pc.d.ts b/lib/pages/userRelation/upsert/onUser/web.pc.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/userRelation/upsert/onUser/web.pc.d.ts +++ b/lib/pages/userRelation/upsert/onUser/web.pc.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/upsert/web.d.ts b/lib/pages/userRelation/upsert/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/userRelation/upsert/web.d.ts +++ b/lib/pages/userRelation/upsert/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/userRelation/upsert/web.pc.d.ts b/lib/pages/userRelation/upsert/web.pc.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/userRelation/upsert/web.pc.d.ts +++ b/lib/pages/userRelation/upsert/web.pc.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/wechatQrCode/scan/web.d.ts b/lib/pages/wechatQrCode/scan/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/wechatQrCode/scan/web.d.ts +++ b/lib/pages/wechatQrCode/scan/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/lib/pages/wechatUser/login/web.d.ts b/lib/pages/wechatUser/login/web.d.ts index ad0b8f2aa..11df1296a 100644 --- a/lib/pages/wechatUser/login/web.d.ts +++ b/lib/pages/wechatUser/login/web.d.ts @@ -1,2 +1 @@ -/// export default function render(this: any): JSX.Element; diff --git a/src/context/BackendRuntimeContext.ts b/src/context/BackendRuntimeContext.ts index 0c6814c3f..15451b71b 100644 --- a/src/context/BackendRuntimeContext.ts +++ b/src/context/BackendRuntimeContext.ts @@ -51,6 +51,11 @@ export class BackendRuntimeContext extends UniversalConte id: 1, name: 1, config: 1, + platformId: 1, + platform: { + id: 1, + config: 1, + }, }, }, filter: { diff --git a/src/context/FrontendRuntimeContext.ts b/src/context/FrontendRuntimeContext.ts index 569d5d9aa..7fc570b2d 100644 --- a/src/context/FrontendRuntimeContext.ts +++ b/src/context/FrontendRuntimeContext.ts @@ -42,11 +42,11 @@ export class FrontendRuntimeContext { + async getCurrentUserId(allowUnloggedIn?: boolean): Promise { return this.token?.getUserId(); } diff --git a/src/context/RuntimeContext.ts b/src/context/RuntimeContext.ts index 88a54d2fe..7940ae2b2 100644 --- a/src/context/RuntimeContext.ts +++ b/src/context/RuntimeContext.ts @@ -13,6 +13,11 @@ export type GetApplicationShape = { id: 1, name: 1, config: 1, + platformId: 1, + platform: { + id: 1, + config: 1, + } }, }; diff --git a/src/features/application.ts b/src/features/application.ts index 7ff4974b9..2316389e2 100644 --- a/src/features/application.ts +++ b/src/features/application.ts @@ -21,6 +21,11 @@ const projection: { id: 1, name: 1, config: 1, + platformId: 1, + platform: { + id: 1, + config: 1, + }, } } = { id: 1, @@ -32,6 +37,11 @@ const projection: { id: 1, name: 1, config: 1, + platformId: 1, + platform: { + id: 1, + config: 1, + }, } }; diff --git a/src/features/token.ts b/src/features/token.ts index d39f57e80..6f8a21c0b 100644 --- a/src/features/token.ts +++ b/src/features/token.ts @@ -1,5 +1,6 @@ import { Action, Feature } from 'oak-frontend-base/lib/types/Feature'; import { RWLock } from 'oak-domain/lib/utils/concurrent'; +import { OakUnloggedInException } from 'oak-domain/lib/types/Exception'; import { Cache } from 'oak-frontend-base/lib/features/cache'; import { LocalStorage } from 'oak-frontend-base/lib/features/localStorage'; import { CommonAspectDict } from 'oak-common-aspect'; @@ -283,18 +284,21 @@ export class Token< return token; } - async getToken() { + async getToken(allowUnloggedIn?: boolean) { if (this.token) { return this.token; } if (this.tokenValue) { await this.loadTokenInfo(); } - return this.token!; + if (allowUnloggedIn || this.token) { + return this.token; + } + throw new OakUnloggedInException(); } - async getUserId() { - const token = await this.getToken(); + async getUserId(allowUnloggedIn?: boolean) { + const token = await this.getToken(allowUnloggedIn); return token?.userId as string | undefined; }