@cloudbase/lowcode-builder 1.8.96 → 1.8.98

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/lowcode-builder",
3
- "version": "1.8.96",
3
+ "version": "1.8.98",
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",
@@ -47,7 +47,7 @@
47
47
  "dependencies": {
48
48
  "@babel/core": "7.21.4",
49
49
  "@babel/preset-env": "7.21.4",
50
- "@cloudbase/cals": "^1.0.75",
50
+ "@cloudbase/cals": "^1.0.79",
51
51
  "@cloudbase/lowcode-generator": "^1.8.29",
52
52
  "axios": "^0.21.0",
53
53
  "browserfs": "^1.4.3",
@@ -549,7 +549,7 @@
549
549
  crossorigin
550
550
  src="<%=
551
551
  cdnEndpoints.cdngo
552
- %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.dcb4b774286f577116be.bundle.js"
552
+ %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.acef94ce4b0574004da6.bundle.js"
553
553
  ></script>
554
554
  </body>
555
555
  </html>
@@ -1,3 +1,5 @@
1
+ // 必须优先初始化数据源
2
+ import '<%= subLevelPath %>../datasources/index';
1
3
  import { observable } from 'mobx'
2
4
  import { createMpApp } from '@cloudbase/weda-client';
3
5
  import { createComputed, formatEnum, enumOptions } from '<%= subLevelPath %>../common/util'
@@ -1,8 +1,6 @@
1
- // 必须优先初始化数据源
2
- import '<%= wedaRootRelativePath %>datasources/index';
1
+ import { app, $app } from '<%= wedaRootRelativePath %>app/weapps-api';
3
2
  <%= importor.lifecycle? `import lifeCycle from '${wedaRootRelativePath}lowcode/lifecycle'` : "const lifeCycle = {}" %>
4
3
  // 引入数据源管理器并进行初始化
5
- import { app, $app } from '<%= wedaRootRelativePath %>app/weapps-api';
6
4
  import {
7
5
  EXTRA_API,
8
6
  createStateDataSourceVar,
@@ -2,6 +2,23 @@ import { observable, autorun, toJS } from 'mobx';
2
2
  import { createEventHandlers, getMpEventHandlerName, mergeDynamic2StaticData } from './util';
3
3
  import { Event } from './event-emitter';
4
4
 
5
+
6
+ const QUERY_RESOURCE = {
7
+ SQL : 'mysql-plugin',
8
+ SQLSERVER : 'mssql-plugin',
9
+ CLOUDCONNECTOR : 'apis-plugin',
10
+ }
11
+
12
+ const QUERY_PATH = {
13
+ SQL : '/WeDa/Query/V1/RunPluginQuery',
14
+ SQLSERVER : '/WeDa/Query/V1/RunPluginQuery',
15
+ CLOUDCONNECTOR : '/WeDa/Connector/v1/RunApisQuery',
16
+ }
17
+
18
+ const KEYS = ['id', 'label', 'description', 'data', 'error', 'isFetching', 'trigger', 'reset'];
19
+
20
+ const GENERALFUNC = 'general-func'
21
+
5
22
  export class Query {
6
23
  _schema = {};
7
24
  #schema;
@@ -17,9 +34,9 @@ export class Query {
17
34
  #eventHandlerMap = {};
18
35
  #action = () => {};
19
36
  #runQueryMap = {
20
- sql: { QueryResource: 'mysql-plugin', QueryPath: '/WeDa/Query/V1/RunPluginQuery' },
21
- sqlserver: { QueryResource: 'mssql-plugin', QueryPath: '/WeDa/Query/V1/RunPluginQuery' },
22
- 'cloud-connector': { QueryResource: 'apis-plugin', QueryPath: '/WeDa/Connector/v1/RunApisQuery' },
37
+ sql: { QueryResource: QUERY_RESOURCE.SQL, QueryPath: QUERY_PATH.SQL },
38
+ sqlserver: { QueryResource: QUERY_RESOURCE.SQLSERVER, QueryPath: QUERY_PATH.SQLSERVER },
39
+ 'cloud-connector': { QueryResource: QUERY_RESOURCE.CLOUDCONNECTOR, QueryPath: QUERY_PATH.CLOUDCONNECTOR },
23
40
  };
24
41
  constructor({ schema, context, options = {} }) {
25
42
  const { looseError = false } = options;
@@ -64,85 +81,93 @@ export class Query {
64
81
 
65
82
  const { $w } = this.#context;
66
83
 
67
- this.#action = this.#isRunQueryType
68
- ? async function (data) {
69
- const requestData = {
70
- EnvId: $w.env.envId,
71
- Name: data.sqlTemplateId,
72
- Parameter: JSON.stringify(
73
- Object.entries(data.params || {}).reduce((list, [key, value]) => {
74
- if (value !== undefined) {
75
- let type = 'OBJECT';
76
- const typeofValue = typeof value;
77
- switch (typeofValue) {
78
- case 'boolean': {
79
- type = 'BOOLEAN';
80
- break;
81
- }
82
- case 'number': {
83
- type = 'NUMBER';
84
- break;
85
- }
86
- case 'string': {
87
- type = 'STRING';
88
- break;
89
- }
90
- default: {
91
- if (Array.isArray(value)) {
92
- type = 'ARRAY';
93
- } else {
94
- type = 'OBJECT';
95
- }
96
- }
84
+ const runQueryType = async function (data) {
85
+ const requestData = {
86
+ EnvId: $w.env.envId,
87
+ Name: data.sqlTemplateId,
88
+ Parameter: JSON.stringify(
89
+ Object.entries(data.params || {}).reduce((list, [key, value]) => {
90
+ if (value !== undefined) {
91
+ let type = 'OBJECT';
92
+ const typeofValue = typeof value;
93
+ switch (typeofValue) {
94
+ case 'boolean': {
95
+ type = 'BOOLEAN';
96
+ break;
97
+ }
98
+ case 'number': {
99
+ type = 'NUMBER';
100
+ break;
101
+ }
102
+ case 'string': {
103
+ type = 'STRING';
104
+ break;
105
+ }
106
+ default: {
107
+ if (Array.isArray(value)) {
108
+ type = 'ARRAY';
109
+ } else {
110
+ type = 'OBJECT';
97
111
  }
98
-
99
- list.push({
100
- Key: key,
101
- Type: type,
102
- Value: type === 'STRING' ? value : JSON.stringify(value),
103
- });
104
112
  }
113
+ }
105
114
 
106
- return list;
107
- }, []) || [],
108
- ),
109
- };
115
+ list.push({
116
+ Key: key,
117
+ Type: type,
118
+ Value: type === 'STRING' ? value : JSON.stringify(value),
119
+ });
120
+ }
110
121
 
111
- const Data = await $w.cloud.callWedaApi({
112
- action: 'RunQuery',
113
- CallQuery: true,
114
- ...(this.#runQueryMap[this.#schema.type] || this.#runQueryMap['sql']),
115
- EnvId: requestData.EnvId,
116
- QueryName: requestData.Name,
117
- data: requestData,
118
- });
122
+ return list;
123
+ }, []) || [],
124
+ ),
125
+ };
119
126
 
120
- // const Data = await $w.cloud.callWedaApi({
121
- // action: 'RunPluginQuery',
122
- // data: {
123
- // MainAppId: $w.app.id,
124
- // ...requestData
125
- // },
126
- // });
127
+ const Data = await $w.cloud.callWedaApi({
128
+ action: 'RunQuery',
129
+ CallQuery: true,
130
+ ...(this.#runQueryMap[this.#schema.type] || this.#runQueryMap['sql']),
131
+ EnvId: requestData.EnvId,
132
+ QueryName: requestData.Name,
133
+ data: requestData,
134
+ });
127
135
 
128
- const { ExecuteResultList = [], Total, Payload } = Data || {};
136
+ // const Data = await $w.cloud.callWedaApi({
137
+ // action: 'RunPluginQuery',
138
+ // data: {
139
+ // MainAppId: $w.app.id,
140
+ // ...requestData
141
+ // },
142
+ // });
129
143
 
130
- let payload = Payload;
131
- try {
132
- if (Payload) {
133
- payload = JSON.parse(Payload);
134
- }
135
- } catch (e) {}
136
- return {
137
- ...(this.#schema.type === 'cloud-connector'
138
- ? payload
139
- : {
140
- records: ExecuteResultList.map((item) => JSON.parse(item)),
141
- total: Total || ExecuteResultList.length,
142
- }),
143
- };
144
+ const { ExecuteResultList = [], Total, Payload } = Data || {};
145
+
146
+ let payload = Payload;
147
+ try {
148
+ if (Payload) {
149
+ payload = JSON.parse(Payload);
144
150
  }
145
- : this.#schema.handler;
151
+ } catch (e) {}
152
+ return {
153
+ ...(this.#schema.type === 'cloud-connector'
154
+ ? payload
155
+ : {
156
+ records: ExecuteResultList.map((item) => JSON.parse(item)),
157
+ total: Total || ExecuteResultList.length,
158
+ }),
159
+ };
160
+ }
161
+
162
+ this.#action = async function (data,additionalScope){
163
+ return this.#isRunQueryType
164
+ ? runQueryType.call(this,data)
165
+ : this.#schema.type === GENERALFUNC
166
+ ? this.#schema.handler.call(this,data,additionalScope)
167
+ : this.#schema.handler.call(this,data);
168
+ }
169
+
170
+
146
171
  this.#eventHandlerMap = Object.entries(
147
172
  createEventHandlers(this.#schema.eventHandlers || {}, {
148
173
  looseError: looseError,
@@ -183,7 +208,7 @@ export class Query {
183
208
  }
184
209
  async trigger(additionalScope, options = {}) {
185
210
  this.#triggered = true;
186
- return this.#innerTrigger(this.#resolveParams(additionalScope), options);
211
+ return this.#innerTrigger(this.#resolveParams(additionalScope),additionalScope, options);
187
212
  }
188
213
  reset() {
189
214
  this.#observableValue.data = null;
@@ -202,12 +227,12 @@ export class Query {
202
227
  return this.#schema;
203
228
  }
204
229
 
205
- async #innerTrigger(args, options = {}) {
230
+ async #innerTrigger(args, additionalScope,options = {}) {
206
231
  this.#currentRequestKey = Date.now();
207
232
  const key = this.#currentRequestKey;
208
233
  try {
209
234
  this.#observableValue.isFetching = true;
210
- const res = await this.#action(...args);
235
+ const res = await this.#action(args?.[0],additionalScope);
211
236
  if (key === this.#currentRequestKey) {
212
237
  this.#observableValue.isFetching = false;
213
238
  this.#observableValue.data = res;
@@ -260,7 +285,6 @@ export class Query {
260
285
  }
261
286
 
262
287
  toJSON() {
263
- const KEYS = ['id', 'label', 'description', 'data', 'error', 'isFetching', 'trigger', 'reset'];
264
288
  return KEYS.reduce((obj, key) => {
265
289
  obj[key] = this[key];
266
290
  return obj;
@@ -522,6 +522,11 @@ export function formatErrorMsg(e) {
522
522
  export async function checkAuth(app, appId, $page) {
523
523
  <% if(skipCheckAuth){ %> return true <% } %>
524
524
 
525
+ // 免密登录
526
+ if (await app?.cloud?.judgePasswordFreeLogin()) {
527
+ return true;
528
+ }
529
+
525
530
  const loginConfig = await getLoginConfig();
526
531
  const hasPhoneLoginType = loginConfig?.miniprogram?.find(v => v.type === 'miniprogram_phone');
527
532
  const hasOpenIdLoginType = loginConfig?.miniprogram?.find(v => v.type === 'openid_login');
@@ -3,9 +3,10 @@
3
3
  "version": "1.0.8",
4
4
  "scripts": {},
5
5
  "dependencies": {<% if(importJSSDK) {%>
6
- "@cloudbase/js-sdk": "2.5.41-beta.0",<% } %>
7
- "@cloudbase/oauth": "0.1.1-alpha.5",
8
- "@cloudbase/weda-client": "1.0.31",
6
+ "@cloudbase/js-sdk": "2.5.42-beta.0",<%
7
+ } %>
8
+ "@cloudbase/oauth": "0.1.1-alpha.6",
9
+ "@cloudbase/weda-client": "1.0.32",
9
10
  "@cloudbase/weda-cloud-sdk": "1.0.61",
10
11
  "mobx": "^5.15.4",
11
12
  "lodash.get": "^4.4.2",
@@ -1,5 +1,5 @@
1
1
  <page-meta page-style="{{pageStyle}}">
2
- <view wx:if="{{!initing && !error}}" id="wd-page-root" data-weui-theme="light">
2
+ <view wx:if="{{!initing && !error}}" id="wd-page-root" class="wd-mp-root" data-weui-theme="light">
3
3
  <view id="id33" style="width:90%;margin:0px auto;display:flex;flex-direction:column;max-width:50rem;" class="login-class">
4
4
  <view id="id44" style="margin:80px 0px;">
5
5
  <image id="id15" style="margin:0px auto;display:flex;justify-content:center;width: 120px;height: 120px;" class="weda-ui weda-image" mode="aspectFit" src="{{settingData.logo}}" />
@@ -1,3 +1,4 @@
1
1
  {
2
+ "renderer": "webview",
2
3
  "usingComponents": <%= JSON.stringify(usingComponents, undefined, 2)%><%= componentPlaceholder? `, "componentPlaceholder": ${JSON.stringify(componentPlaceholder, undefined, 2)}` : "" %><%= extra %>
3
4
  }