@lark-apaas/fullstack-cli 1.1.28-alpha.20 → 1.1.28-alpha.22

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -27
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1414,14 +1414,15 @@ async function fetchSyncedTables(appId, workspace) {
1414
1414
  DEFAULT_TIMEOUT_MS2
1415
1415
  );
1416
1416
  });
1417
+ const dbBranch = process.env.FORCE_DB_BRANCH || "main";
1417
1418
  const start = Date.now();
1418
1419
  console.log(
1419
- `[fetchSyncedTables] \u2192 GET listTableView (dbBranch=main) appId=${appId ? "set" : "unset"} workspace=${workspace ? "set" : "unset"}`
1420
+ `[fetchSyncedTables] \u2192 GET listTableView (dbBranch=${dbBranch}) appId=${appId ? "set" : "unset"} workspace=${workspace ? "set" : "unset"}`
1420
1421
  );
1421
1422
  const response = await Promise.race([
1422
1423
  client.get(
1423
1424
  `/api/v1/dataloom/inner/app/${appId}/workspaces/${workspace}/listTableView`,
1424
- { params: { dbBranch: "main" }, headers: { "x-supaas-bizsource": "miaoda" } }
1425
+ { params: { dbBranch }, headers: { "x-supaas-bizsource": "miaoda" } }
1425
1426
  ),
1426
1427
  timeoutPromise
1427
1428
  ]);
@@ -7270,20 +7271,17 @@ async function genArtifactUploadCredential(appId, body) {
7270
7271
  }
7271
7272
  async function getDefaultBucketId(appId) {
7272
7273
  const client = getHttpClient();
7273
- const url = `/v1/app/${appId}/storage/inner/staticBucket`;
7274
- const response = await client.post(url, {});
7274
+ const url = `/b/${appId}/get_published_v2`;
7275
+ const response = await client.get(url);
7275
7276
  if (!response.ok || response.status !== 200) {
7276
7277
  throw new Error(
7277
- `getOrCreateStaticBucket \u8BF7\u6C42\u5931\u8D25: ${response.status} ${response.statusText}`
7278
+ `get_published_v2 \u8BF7\u6C42\u5931\u8D25: ${response.status} ${response.statusText}`
7278
7279
  );
7279
7280
  }
7280
7281
  const data = await response.json();
7281
- if (data.status_code !== "0") {
7282
- throw new Error(`getOrCreateStaticBucket \u8FD4\u56DE\u5F02\u5E38, status_code: ${data.status_code}`);
7283
- }
7284
- const bucketId = data?.data?.bucketID;
7282
+ const bucketId = data?.data?.app_runtime_extra?.bucket?.default_bucket_id;
7285
7283
  if (!bucketId) {
7286
- throw new Error(`\u672A\u627E\u5230\u5E94\u7528 ${appId} \u7684\u9759\u6001\u8D44\u6E90\u5B58\u50A8\u6876`);
7284
+ throw new Error(`\u672A\u627E\u5230\u5E94\u7528 ${appId} \u7684\u9ED8\u8BA4\u5B58\u50A8\u6876`);
7287
7285
  }
7288
7286
  return bucketId;
7289
7287
  }
@@ -7364,7 +7362,7 @@ async function uploadStatic(options) {
7364
7362
  const {
7365
7363
  appId,
7366
7364
  staticDir = "shared/static",
7367
- tosutilPath = "tosutil",
7365
+ tosutilPath = "/workspace/tosutil",
7368
7366
  endpoint = "tos-cn-beijing.volces.com",
7369
7367
  region = "cn-beijing"
7370
7368
  } = options;
@@ -7377,10 +7375,9 @@ async function uploadStatic(options) {
7377
7375
  console.error(`${LOG_PREFIX} \u76EE\u5F55\u4E3A\u7A7A: ${resolvedStaticDir}\uFF0C\u8DF3\u8FC7\u4E0A\u4F20`);
7378
7376
  return;
7379
7377
  }
7380
- const resolvedTosutil = resolveTosutilPath(tosutilPath);
7381
- if (!resolvedTosutil) {
7378
+ if (!fs25.existsSync(tosutilPath)) {
7382
7379
  throw new Error(
7383
- `tosutil \u4E0D\u5B58\u5728: ${tosutilPath}\u3002\u8BF7\u786E\u4FDD tosutil \u5DF2\u5B89\u88C5\u5728\u7CFB\u7EDF PATH \u4E2D\u6216\u901A\u8FC7 --tosutil-path \u6307\u5B9A\u8DEF\u5F84\u3002`
7380
+ `tosutil \u4E0D\u5B58\u5728: ${tosutilPath}\u3002\u8BF7\u786E\u4FDD\u6D41\u6C34\u7EBF\u5DF2\u5728"\u4EA7\u7269\u6253\u5305\u4E0A\u4F20"\u6B65\u9AA4\u4E2D\u4E0B\u8F7D tosutil\u3002`
7384
7381
  );
7385
7382
  }
7386
7383
  let uploadPrefix;
@@ -7403,7 +7400,7 @@ async function uploadStatic(options) {
7403
7400
  }
7404
7401
  console.error(`${LOG_PREFIX} \u4E0A\u4F20\u76EE\u6807: ${uploadPrefix}`);
7405
7402
  console.error(`${LOG_PREFIX} \u914D\u7F6E tosutil...`);
7406
- configureTosutil(resolvedTosutil, {
7403
+ configureTosutil(tosutilPath, {
7407
7404
  endpoint,
7408
7405
  region,
7409
7406
  accessKeyID,
@@ -7411,7 +7408,7 @@ async function uploadStatic(options) {
7411
7408
  sessionToken
7412
7409
  });
7413
7410
  console.error(`${LOG_PREFIX} \u4E0A\u4F20 ${resolvedStaticDir} -> ${uploadPrefix}`);
7414
- uploadToTos(resolvedTosutil, resolvedStaticDir, uploadPrefix);
7411
+ uploadToTos(tosutilPath, resolvedStaticDir, uploadPrefix);
7415
7412
  console.error(`${LOG_PREFIX} tosutil \u4E0A\u4F20\u5B8C\u6210`);
7416
7413
  console.error(`${LOG_PREFIX} \u8C03\u7528 callbackStatic (uploadID: ${uploadID})...`);
7417
7414
  const callbackResp = await uploadStaticAttachmentCallback(appId, bucketId, { uploadID });
@@ -7427,17 +7424,6 @@ async function uploadStatic(options) {
7427
7424
  process.exit(1);
7428
7425
  }
7429
7426
  }
7430
- function resolveTosutilPath(tosutilPath) {
7431
- if (path21.isAbsolute(tosutilPath)) {
7432
- return fs25.existsSync(tosutilPath) ? tosutilPath : null;
7433
- }
7434
- try {
7435
- const resolved = execFileSync("which", [tosutilPath], { encoding: "utf-8" }).trim();
7436
- return resolved || null;
7437
- } catch {
7438
- return null;
7439
- }
7440
- }
7441
7427
  async function fetchPreUpload(appId, bucketId) {
7442
7428
  const response = await preUploadStaticAttachment(appId, bucketId);
7443
7429
  if (response.status_code !== "0") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-cli",
3
- "version": "1.1.28-alpha.20",
3
+ "version": "1.1.28-alpha.22",
4
4
  "description": "CLI tool for fullstack template management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",