@tuya-sat/micro-script 3.1.11 → 3.2.0
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.
|
@@ -94,7 +94,7 @@ function mockSaasInfo(app, microPort) {
|
|
|
94
94
|
multiApps === null || multiApps === void 0 ? void 0 : multiApps.forEach((app) => {
|
|
95
95
|
idsMap.set(app.name, { entry_id: (0, uuid_1.v4)(), oem_micro_app_id: (0, uid_1.uid)(16) });
|
|
96
96
|
});
|
|
97
|
-
app.get('/api/saas-info', (req, res) => {
|
|
97
|
+
app.get('/api/saas-info', (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
98
98
|
const lang = parseCookie(req.headers['cookie'], 'main-i18next');
|
|
99
99
|
if ((0, utils_1.isMonorepo)() || (multiApps && multiApps.length > 0)) {
|
|
100
100
|
const result = {
|
|
@@ -133,10 +133,21 @@ function mockSaasInfo(app, microPort) {
|
|
|
133
133
|
const entry_id = (0, uuid_1.v4)();
|
|
134
134
|
const oem_micro_app_id = manifest.universalId;
|
|
135
135
|
const baseUrl = `/apps/${oem_micro_app_id}`;
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
const saasApps = yield refactorConstructApp({
|
|
137
|
+
url: target,
|
|
138
|
+
headers: {
|
|
139
|
+
cookie: expressApp.__appProxy__.getCookie(''),
|
|
140
|
+
csrf: expressApp.__appProxy__.csrfValue.value,
|
|
141
|
+
}
|
|
142
|
+
}, [
|
|
143
|
+
{
|
|
144
|
+
manifest,
|
|
145
|
+
oem_micro_app_id,
|
|
146
|
+
baseUrl,
|
|
147
|
+
lang,
|
|
148
|
+
port: microPort
|
|
149
|
+
}
|
|
150
|
+
]);
|
|
140
151
|
const entryInfo = consturctEntry(manifest, oem_micro_app_id, entry_id, baseUrl, lang, '');
|
|
141
152
|
const permission = consturctPermissions();
|
|
142
153
|
res.send({
|
|
@@ -144,7 +155,7 @@ function mockSaasInfo(app, microPort) {
|
|
|
144
155
|
errorMsg: null,
|
|
145
156
|
msg: null,
|
|
146
157
|
result: {
|
|
147
|
-
apps:
|
|
158
|
+
apps: saasApps,
|
|
148
159
|
entry_info: { entries: [entryInfo], entry_mode: 'normal' },
|
|
149
160
|
permissions: { [oem_micro_app_id]: permission },
|
|
150
161
|
saas_id_info_list: [
|
|
@@ -154,7 +165,7 @@ function mockSaasInfo(app, microPort) {
|
|
|
154
165
|
success: true,
|
|
155
166
|
});
|
|
156
167
|
}
|
|
157
|
-
});
|
|
168
|
+
}));
|
|
158
169
|
}
|
|
159
170
|
}
|
|
160
171
|
exports.default = mockSaasInfo;
|
|
@@ -211,7 +222,21 @@ function refactorConstructApp(config, localApps) {
|
|
|
211
222
|
return localApps.map((app) => {
|
|
212
223
|
const uuid = app.manifest.universalId;
|
|
213
224
|
const code = app.code || `${packageInfo.name}`;
|
|
214
|
-
|
|
225
|
+
const appInfo = saasAppsMap[app.oem_micro_app_id];
|
|
226
|
+
return {
|
|
227
|
+
ext_info: appInfo === null || appInfo === void 0 ? void 0 : appInfo.ext_info,
|
|
228
|
+
micro_app_config: appInfo.micro_app_config,
|
|
229
|
+
lang_package_biz_id: appInfo.lang_package_biz_id,
|
|
230
|
+
active_rule: app.baseUrl,
|
|
231
|
+
micro_app_code: code,
|
|
232
|
+
micro_app_name: code ? `${code}-dev` : `${packageInfo.name}-dev`,
|
|
233
|
+
micro_app_version: '0.0.0-x',
|
|
234
|
+
oem_micro_app_id: app.oem_micro_app_id,
|
|
235
|
+
resource: `http://localhost:${app.port}/${code || 'index'}.html`,
|
|
236
|
+
universal_id: uuid,
|
|
237
|
+
isAuth: true,
|
|
238
|
+
schema: null,
|
|
239
|
+
};
|
|
215
240
|
});
|
|
216
241
|
});
|
|
217
242
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuya-sat/micro-script",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"bin": "./dist/bin/cli.js",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"@babel/preset-typescript": "7.16.7",
|
|
24
24
|
"@babel/traverse": "^7.20.13",
|
|
25
25
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
|
|
26
|
-
"@tuya-sat/micro-dev-loader": "3.
|
|
27
|
-
"@tuya-sat/micro-dev-proxy": "3.
|
|
28
|
-
"@tuya-sat/micro-utils": "3.
|
|
26
|
+
"@tuya-sat/micro-dev-loader": "3.2.0",
|
|
27
|
+
"@tuya-sat/micro-dev-proxy": "3.2.0",
|
|
28
|
+
"@tuya-sat/micro-utils": "3.2.0",
|
|
29
29
|
"@types/kill-port": "^2.0.0",
|
|
30
30
|
"babel-loader": "8.2.4",
|
|
31
31
|
"babel-plugin-import": "1.13.3",
|