@lark-apaas/fullstack-cli 1.1.22-alpha.11 → 1.1.22-alpha.13
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/dist/index.js +58 -33
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1404,38 +1404,60 @@ function getHttpClient() {
|
|
|
1404
1404
|
}
|
|
1405
1405
|
|
|
1406
1406
|
// src/commands/db/gen-dbschema/utils/fetch-synced-tables.ts
|
|
1407
|
+
var DEFAULT_TIMEOUT_MS2 = 1e4;
|
|
1407
1408
|
async function fetchSyncedTables(appId, workspace) {
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1409
|
+
try {
|
|
1410
|
+
const client = getHttpClient();
|
|
1411
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
1412
|
+
setTimeout(
|
|
1413
|
+
() => reject(new Error(`Timeout after ${DEFAULT_TIMEOUT_MS2}ms`)),
|
|
1414
|
+
DEFAULT_TIMEOUT_MS2
|
|
1415
|
+
);
|
|
1416
|
+
});
|
|
1417
|
+
const start = Date.now();
|
|
1418
|
+
console.log(
|
|
1419
|
+
`[fetchSyncedTables] \u2192 GET listTableView (dbBranch=main) appId=${appId ? "set" : "unset"} workspace=${workspace ? "set" : "unset"}`
|
|
1420
|
+
);
|
|
1421
|
+
const response = await Promise.race([
|
|
1422
|
+
client.get(
|
|
1423
|
+
`/api/v1/dataloom/inner/app/${appId}/workspaces/${workspace}/listTableView`,
|
|
1424
|
+
{ params: { dbBranch: "dev" }, headers: { "x-supaas-bizsource": "miaoda" } }
|
|
1425
|
+
),
|
|
1426
|
+
timeoutPromise
|
|
1427
|
+
]);
|
|
1428
|
+
console.log(
|
|
1429
|
+
`[fetchSyncedTables] \u2190 listTableView response: ${response.status} ${response.statusText} (${Date.now() - start}ms) with logId=${response.headers.get("x-tt-log-id")}`
|
|
1430
|
+
);
|
|
1431
|
+
if (!response.ok) {
|
|
1432
|
+
throw new Error(
|
|
1433
|
+
`listTableView API failed: ${response.status} ${response.statusText}`
|
|
1434
|
+
);
|
|
1435
|
+
}
|
|
1436
|
+
const json = await response.json();
|
|
1437
|
+
const tableView = json?.data?.data;
|
|
1438
|
+
console.log(
|
|
1439
|
+
"[fetchSyncedTables] listTableView raw response:",
|
|
1440
|
+
JSON.stringify(json, null, 2)
|
|
1441
|
+
);
|
|
1442
|
+
if (!tableView) {
|
|
1443
|
+
console.warn(
|
|
1444
|
+
"[fetchSyncedTables] \u26A0 listTableView response missing data.data, returning empty map"
|
|
1445
|
+
);
|
|
1446
|
+
return /* @__PURE__ */ new Map();
|
|
1447
|
+
}
|
|
1448
|
+
const syncedMap = extractSyncedTableMap(tableView);
|
|
1449
|
+
const totalCount = (tableView.table?.data?.length ?? 0) + (tableView.view?.data?.length ?? 0) + (tableView.materializedView?.data?.length ?? 0);
|
|
1450
|
+
console.log(
|
|
1451
|
+
`[fetchSyncedTables] \u2713 Extracted synced tables: ${syncedMap.size}/${totalCount} (elapsed ${Date.now() - start}ms)`
|
|
1452
|
+
);
|
|
1453
|
+
return syncedMap;
|
|
1454
|
+
} catch (error) {
|
|
1455
|
+
console.error(
|
|
1456
|
+
"[fetchSyncedTables] \u274C Error fetching synced tables:",
|
|
1457
|
+
error
|
|
1458
|
+
);
|
|
1459
|
+
return void 0;
|
|
1432
1460
|
}
|
|
1433
|
-
const syncedMap = extractSyncedTableMap(tableView);
|
|
1434
|
-
const totalCount = (tableView.table?.data?.length ?? 0) + (tableView.view?.data?.length ?? 0) + (tableView.materializedView?.data?.length ?? 0);
|
|
1435
|
-
console.log(
|
|
1436
|
-
`[fetchSyncedTables] \u2713 Extracted synced tables: ${syncedMap.size}/${totalCount} (elapsed ${Date.now() - start}ms)`
|
|
1437
|
-
);
|
|
1438
|
-
return syncedMap;
|
|
1439
1461
|
}
|
|
1440
1462
|
function extractSyncedTableMap(tableView) {
|
|
1441
1463
|
const syncedMap = /* @__PURE__ */ new Map();
|
|
@@ -1446,7 +1468,10 @@ function extractSyncedTableMap(tableView) {
|
|
|
1446
1468
|
];
|
|
1447
1469
|
for (const table of allTables) {
|
|
1448
1470
|
if (table.bitableSyncTask && table.bitableSyncTask.fieldApiNameList?.length > 0) {
|
|
1449
|
-
syncedMap.set(
|
|
1471
|
+
syncedMap.set(
|
|
1472
|
+
table.tableName,
|
|
1473
|
+
new Set(table.bitableSyncTask.fieldApiNameList)
|
|
1474
|
+
);
|
|
1450
1475
|
}
|
|
1451
1476
|
}
|
|
1452
1477
|
return syncedMap;
|
|
@@ -2178,7 +2203,7 @@ async function run(options = {}) {
|
|
|
2178
2203
|
const appId = process.env.app_id;
|
|
2179
2204
|
const workspace = process.env.suda_workspace_id;
|
|
2180
2205
|
console.log(
|
|
2181
|
-
`[gen-db-schema] Pre-fetch info: columnComments=enabled, syncedTables=${
|
|
2206
|
+
`[gen-db-schema] Pre-fetch info: columnComments=enabled, syncedTables=${appId && workspace ? "enabled" : "skipped"} (app_id=${appId ? "set" : "unset"}, suda_workspace_id=${workspace ? "set" : "unset"})`
|
|
2182
2207
|
);
|
|
2183
2208
|
const columnCommentsTask = (async () => {
|
|
2184
2209
|
const start = Date.now();
|
|
@@ -2191,7 +2216,7 @@ async function run(options = {}) {
|
|
|
2191
2216
|
const start = Date.now();
|
|
2192
2217
|
console.log("[gen-db-schema] \u2192 Fetching synced tables from listTableView...");
|
|
2193
2218
|
const res = await fetchSyncedTables(appId, workspace);
|
|
2194
|
-
console.log(`[gen-db-schema] \u2190 Fetched synced tables: ${res
|
|
2219
|
+
console.log(`[gen-db-schema] \u2190 Fetched synced tables: ${res?.size} tables (${Date.now() - start}ms)`);
|
|
2195
2220
|
return res;
|
|
2196
2221
|
})() : void 0;
|
|
2197
2222
|
const fetchTasks = await Promise.allSettled([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/fullstack-cli",
|
|
3
|
-
"version": "1.1.22-alpha.
|
|
3
|
+
"version": "1.1.22-alpha.13",
|
|
4
4
|
"description": "CLI tool for fullstack template management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@lark-apaas/http-client": "0.1.
|
|
34
|
+
"@lark-apaas/http-client": "^0.1.2",
|
|
35
35
|
"@lydell/node-pty": "1.1.0",
|
|
36
36
|
"@vercel/nft": "^0.30.3",
|
|
37
37
|
"commander": "^13.0.0",
|