@lark-apaas/fullstack-cli 1.1.28-alpha.21 → 1.1.28-alpha.23
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 +17 -37
- 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
|
|
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
|
|
1425
|
+
{ params: { dbBranch }, headers: { "x-supaas-bizsource": "miaoda" } }
|
|
1425
1426
|
),
|
|
1426
1427
|
timeoutPromise
|
|
1427
1428
|
]);
|
|
@@ -7255,12 +7256,6 @@ var SCENE_CONFIGS = {
|
|
|
7255
7256
|
buildRequestBody: () => ({ commitID: "" })
|
|
7256
7257
|
}
|
|
7257
7258
|
};
|
|
7258
|
-
var UPLOAD_STATIC_DEFAULTS = {
|
|
7259
|
-
staticDir: "shared/static",
|
|
7260
|
-
tosutilPath: "tosutil",
|
|
7261
|
-
endpoint: "tos-cn-beijing.volces.com",
|
|
7262
|
-
region: "cn-beijing"
|
|
7263
|
-
};
|
|
7264
7259
|
|
|
7265
7260
|
// src/commands/build/api-client.ts
|
|
7266
7261
|
async function genArtifactUploadCredential(appId, body) {
|
|
@@ -7276,20 +7271,17 @@ async function genArtifactUploadCredential(appId, body) {
|
|
|
7276
7271
|
}
|
|
7277
7272
|
async function getDefaultBucketId(appId) {
|
|
7278
7273
|
const client = getHttpClient();
|
|
7279
|
-
const url = `/
|
|
7280
|
-
const response = await client.
|
|
7274
|
+
const url = `/b/${appId}/get_published_v2`;
|
|
7275
|
+
const response = await client.get(url);
|
|
7281
7276
|
if (!response.ok || response.status !== 200) {
|
|
7282
7277
|
throw new Error(
|
|
7283
|
-
`
|
|
7278
|
+
`get_published_v2 \u8BF7\u6C42\u5931\u8D25: ${response.status} ${response.statusText}`
|
|
7284
7279
|
);
|
|
7285
7280
|
}
|
|
7286
7281
|
const data = await response.json();
|
|
7287
|
-
|
|
7288
|
-
throw new Error(`getOrCreateStaticBucket \u8FD4\u56DE\u5F02\u5E38, status_code: ${data.status_code}`);
|
|
7289
|
-
}
|
|
7290
|
-
const bucketId = data?.data?.bucketID;
|
|
7282
|
+
const bucketId = data?.data?.app_runtime_extra?.bucket?.default_bucket_id;
|
|
7291
7283
|
if (!bucketId) {
|
|
7292
|
-
throw new Error(`\u672A\u627E\u5230\u5E94\u7528 ${appId} \u7684\
|
|
7284
|
+
throw new Error(`\u672A\u627E\u5230\u5E94\u7528 ${appId} \u7684\u9ED8\u8BA4\u5B58\u50A8\u6876`);
|
|
7293
7285
|
}
|
|
7294
7286
|
return bucketId;
|
|
7295
7287
|
}
|
|
@@ -7369,10 +7361,10 @@ async function uploadStatic(options) {
|
|
|
7369
7361
|
try {
|
|
7370
7362
|
const {
|
|
7371
7363
|
appId,
|
|
7372
|
-
staticDir =
|
|
7373
|
-
tosutilPath =
|
|
7374
|
-
endpoint =
|
|
7375
|
-
region =
|
|
7364
|
+
staticDir = "shared/static",
|
|
7365
|
+
tosutilPath = "/workspace/tosutil",
|
|
7366
|
+
endpoint = "tos-cn-beijing.volces.com",
|
|
7367
|
+
region = "cn-beijing"
|
|
7376
7368
|
} = options;
|
|
7377
7369
|
const resolvedStaticDir = path21.resolve(staticDir);
|
|
7378
7370
|
if (!fs25.existsSync(resolvedStaticDir)) {
|
|
@@ -7383,10 +7375,9 @@ async function uploadStatic(options) {
|
|
|
7383
7375
|
console.error(`${LOG_PREFIX} \u76EE\u5F55\u4E3A\u7A7A: ${resolvedStaticDir}\uFF0C\u8DF3\u8FC7\u4E0A\u4F20`);
|
|
7384
7376
|
return;
|
|
7385
7377
|
}
|
|
7386
|
-
|
|
7387
|
-
if (!resolvedTosutil) {
|
|
7378
|
+
if (!fs25.existsSync(tosutilPath)) {
|
|
7388
7379
|
throw new Error(
|
|
7389
|
-
`tosutil \u4E0D\u5B58\u5728: ${tosutilPath}\u3002\u8BF7\u786E\u4FDD
|
|
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`
|
|
7390
7381
|
);
|
|
7391
7382
|
}
|
|
7392
7383
|
let uploadPrefix;
|
|
@@ -7409,7 +7400,7 @@ async function uploadStatic(options) {
|
|
|
7409
7400
|
}
|
|
7410
7401
|
console.error(`${LOG_PREFIX} \u4E0A\u4F20\u76EE\u6807: ${uploadPrefix}`);
|
|
7411
7402
|
console.error(`${LOG_PREFIX} \u914D\u7F6E tosutil...`);
|
|
7412
|
-
configureTosutil(
|
|
7403
|
+
configureTosutil(tosutilPath, {
|
|
7413
7404
|
endpoint,
|
|
7414
7405
|
region,
|
|
7415
7406
|
accessKeyID,
|
|
@@ -7417,7 +7408,7 @@ async function uploadStatic(options) {
|
|
|
7417
7408
|
sessionToken
|
|
7418
7409
|
});
|
|
7419
7410
|
console.error(`${LOG_PREFIX} \u4E0A\u4F20 ${resolvedStaticDir} -> ${uploadPrefix}`);
|
|
7420
|
-
uploadToTos(
|
|
7411
|
+
uploadToTos(tosutilPath, resolvedStaticDir, uploadPrefix);
|
|
7421
7412
|
console.error(`${LOG_PREFIX} tosutil \u4E0A\u4F20\u5B8C\u6210`);
|
|
7422
7413
|
console.error(`${LOG_PREFIX} \u8C03\u7528 callbackStatic (uploadID: ${uploadID})...`);
|
|
7423
7414
|
const callbackResp = await uploadStaticAttachmentCallback(appId, bucketId, { uploadID });
|
|
@@ -7433,17 +7424,6 @@ async function uploadStatic(options) {
|
|
|
7433
7424
|
process.exit(1);
|
|
7434
7425
|
}
|
|
7435
7426
|
}
|
|
7436
|
-
function resolveTosutilPath(tosutilPath) {
|
|
7437
|
-
if (path21.isAbsolute(tosutilPath)) {
|
|
7438
|
-
return fs25.existsSync(tosutilPath) ? tosutilPath : null;
|
|
7439
|
-
}
|
|
7440
|
-
try {
|
|
7441
|
-
const resolved = execFileSync("which", [tosutilPath], { encoding: "utf-8" }).trim();
|
|
7442
|
-
return resolved || null;
|
|
7443
|
-
} catch {
|
|
7444
|
-
return null;
|
|
7445
|
-
}
|
|
7446
|
-
}
|
|
7447
7427
|
async function fetchPreUpload(appId, bucketId) {
|
|
7448
7428
|
const response = await preUploadStaticAttachment(appId, bucketId);
|
|
7449
7429
|
if (response.status_code !== "0") {
|
|
@@ -7538,7 +7518,7 @@ var uploadStaticCommand = {
|
|
|
7538
7518
|
name: "upload-static",
|
|
7539
7519
|
description: "Upload shared/static files to TOS",
|
|
7540
7520
|
register(program) {
|
|
7541
|
-
program.command(this.name).description(this.description).requiredOption("--app-id <id>", "Application ID").option("--static-dir <dir>", "Static files directory",
|
|
7521
|
+
program.command(this.name).description(this.description).requiredOption("--app-id <id>", "Application ID").option("--static-dir <dir>", "Static files directory", "shared/static").option("--tosutil-path <path>", "Path to tosutil binary", "/workspace/tosutil").option("--endpoint <endpoint>", "TOS endpoint", "tos-cn-beijing.volces.com").option("--region <region>", "TOS region", "cn-beijing").action(async (options) => {
|
|
7542
7522
|
await uploadStatic(options);
|
|
7543
7523
|
});
|
|
7544
7524
|
}
|