@cloudbase/lowcode-builder 1.1.5-alpha.3 → 1.1.5-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -459,7 +459,7 @@ async function installDependencies(targetDir, options = {}) {
|
|
|
459
459
|
const isPkgModify = !generateFiles_1.generatedFileContents[path_1.default.resolve(targetDir, 'package.json')]
|
|
460
460
|
? true
|
|
461
461
|
: generateFiles_1.generatedFileContents[path_1.default.resolve(targetDir, 'package.json')].modify;
|
|
462
|
-
if ((options === null || options === void 0 ? void 0 : options.ignoreInstall) && fs_extra_1.default.existsSync(path_1.default.join(targetDir, 'node_modules'))
|
|
462
|
+
if ((options === null || options === void 0 ? void 0 : options.ignoreInstall) && fs_extra_1.default.existsSync(path_1.default.join(targetDir, 'node_modules'))) {
|
|
463
463
|
console.log(`ignore install dependencies in ${targetDir}`);
|
|
464
464
|
return;
|
|
465
465
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/lowcode-builder",
|
|
3
|
-
"version": "1.1.5-alpha.
|
|
3
|
+
"version": "1.1.5-alpha.5",
|
|
4
4
|
"description": "云开发 Tencent CloudBase Framework Low Code Plugin,将低码配置生成完整项目并一键部署云开发资源。",
|
|
5
5
|
"author": "yhsunshining@gmail.com",
|
|
6
6
|
"homepage": "https://github.com/TencentCloudBase/cloudbase-framework#readme",
|
package/template/mp/app.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { app } from './app/weapps-api'
|
|
3
3
|
// 引入数据源管理器并进行初始化
|
|
4
4
|
import { setConfig, getAccessToken, EXTRA_API, createStateDataSourceVar, generateParamsParser } from './datasources/index'
|
|
5
|
-
import { redirectToLogin, findLoginPage, getAuthConfig } from './common/util'
|
|
5
|
+
import { redirectToLogin, findLoginPage, getAuthConfig, checkAnonymous } from './common/util'
|
|
6
6
|
|
|
7
7
|
// 防止报类型不匹配warning
|
|
8
8
|
const originWarn = console.warn;
|
|
@@ -69,11 +69,7 @@ setConfig({
|
|
|
69
69
|
const loginPage = findLoginPage();
|
|
70
70
|
if (loginPage) {
|
|
71
71
|
const authConfig = await getAuthConfig();
|
|
72
|
-
|
|
73
|
-
try {
|
|
74
|
-
const { accessToken } = await getAccessToken();
|
|
75
|
-
isAnonymous = !accessToken;
|
|
76
|
-
} catch (e) { }
|
|
72
|
+
const isAnonymous = await checkAnonymous();
|
|
77
73
|
if (isAnonymous && authConfig.RejectStrategy == 'to_login') {
|
|
78
74
|
redirectToLogin();
|
|
79
75
|
} else if (authConfig.RejectStrategy == 'show_warning') {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
import { findForItemsOfWidget, getWidget } from './widget'
|
|
3
3
|
import { observable, untracked } from 'mobx';
|
|
4
|
-
import { getAccessToken } from '../datasources/index'
|
|
4
|
+
import { getAccessToken, loginScope } from '../datasources/index'
|
|
5
5
|
import { app } from '../app/weapps-api'
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -61,7 +61,7 @@ export function createEventHandlers(evtListeners) {
|
|
|
61
61
|
const [prefix = ''] = name.split('$');
|
|
62
62
|
// The page event handler
|
|
63
63
|
const { lists = [], itemsById = {} } = !!currentTarget && findForItemsOfWidget(currentTarget) || {}
|
|
64
|
-
const dataContext = untracked(()=>generateDataContext(currentTarget))
|
|
64
|
+
const dataContext = untracked(() => generateDataContext(currentTarget))
|
|
65
65
|
|
|
66
66
|
listeners.forEach(async l => {
|
|
67
67
|
let { data = {}, boundData = {} } = l;
|
|
@@ -310,6 +310,21 @@ async function getAccessPermission(app, appId, pageId) {
|
|
|
310
310
|
return isAccess
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
+
export async function checkAnonymous() {
|
|
314
|
+
let isAnonymous = true;
|
|
315
|
+
try {
|
|
316
|
+
const { accessToken } = await getAccessToken();
|
|
317
|
+
isAnonymous = !accessToken;
|
|
318
|
+
const { app } = getApp();
|
|
319
|
+
// 私密链路有token则不是匿名; tcb链路会匿名登录需要多验证scope === 'anonymous'
|
|
320
|
+
if (accessToken && app.__internal__.getCloudSdkConfig('endpointType') === 'tcb-api') {
|
|
321
|
+
const scope = await loginScope();
|
|
322
|
+
isAnonymous = scope === 'anonymous';
|
|
323
|
+
}
|
|
324
|
+
} catch (e) { }
|
|
325
|
+
return isAnonymous;
|
|
326
|
+
}
|
|
327
|
+
|
|
313
328
|
/**
|
|
314
329
|
* 检查页面权限
|
|
315
330
|
**/
|
|
@@ -327,11 +342,7 @@ export async function checkAuth(app, appId, $page) {
|
|
|
327
342
|
const [isAccess, authConfig] = await Promise.all(requestList);
|
|
328
343
|
app.hideNavigationBarLoading();
|
|
329
344
|
|
|
330
|
-
|
|
331
|
-
try {
|
|
332
|
-
const { accessToken } = await getAccessToken();
|
|
333
|
-
isAnonymousUser = !accessToken;
|
|
334
|
-
} catch (e) { }
|
|
345
|
+
const isAnonymousUser = await checkAnonymous();
|
|
335
346
|
|
|
336
347
|
if (!isAccess) {
|
|
337
348
|
if (isAnonymousUser && loginPage && (authConfig.NeedLogin || authConfig.RejectStrategy == 'to_login')) {
|
|
@@ -19,12 +19,17 @@ export default {
|
|
|
19
19
|
dataSourceProfiles: dataSourceProfiles,
|
|
20
20
|
/**
|
|
21
21
|
* 新的dataset变量配置对象
|
|
22
|
-
*
|
|
22
|
+
* key 为页面ID(全局为$global), val 为变量配置数组
|
|
23
23
|
*/
|
|
24
24
|
datasetProfiles: datasetProfiles,
|
|
25
25
|
/**
|
|
26
26
|
* 确定调用链路
|
|
27
27
|
*/
|
|
28
28
|
endpointType: <%= isPrivateMode %> ? 'tcb-api' : 'wechat-service',
|
|
29
|
+
/**
|
|
30
|
+
* 调用链路为 tcb-api 时有效
|
|
31
|
+
* 私有化需要设置
|
|
32
|
+
*/
|
|
33
|
+
tcbApiOrigin: '<%= tcbApiOrigin %>',
|
|
29
34
|
isPrivate: <%= isPrivateMode %>
|
|
30
35
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _WEDA_CLOUD_SDK as WEDA_CLOUD_SDK, auth} from '@cloudbase/weda-client'
|
|
1
|
+
import { _WEDA_CLOUD_SDK as WEDA_CLOUD_SDK, auth } from '@cloudbase/weda-client'
|
|
2
2
|
const {
|
|
3
3
|
setConfig,
|
|
4
4
|
initTcb,
|
|
@@ -10,6 +10,7 @@ const {
|
|
|
10
10
|
DS_SDK,
|
|
11
11
|
} = WEDA_CLOUD_SDK
|
|
12
12
|
const getAccessToken = auth.getAccessToken
|
|
13
|
+
const loginScope = auth.loginScope
|
|
13
14
|
|
|
14
15
|
export {
|
|
15
16
|
createDataset,
|
|
@@ -20,6 +21,7 @@ export {
|
|
|
20
21
|
DS_SDK,
|
|
21
22
|
setConfig,
|
|
22
23
|
getAccessToken,
|
|
24
|
+
loginScope,
|
|
23
25
|
initTcb,
|
|
24
26
|
}
|
|
25
27
|
|
package/template/mp/package.json
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
"version": "1.0.8",
|
|
4
4
|
"scripts": {},
|
|
5
5
|
"dependencies": {<% if(isPrivateMode) {%>
|
|
6
|
-
"@cloudbase/js-sdk": "2.5.
|
|
6
|
+
"@cloudbase/js-sdk": "2.5.6-beta.1",<% } %>
|
|
7
7
|
"@cloudbase/oauth": "0.1.1-alpha.5",
|
|
8
|
-
"@cloudbase/weda-client": "0.2.
|
|
8
|
+
"@cloudbase/weda-client": "0.2.36",
|
|
9
9
|
"@cloudbase/weda-cloud-sdk": "1.0.24-alpha.3",
|
|
10
10
|
"mobx": "^5.15.4",
|
|
11
11
|
"lodash.get": "^4.4.2",
|