@lark-apaas/fullstack-cli 1.1.22-alpha.7 → 1.1.22-alpha.9
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 +52 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2441,6 +2441,50 @@ function getHttpClient() {
|
|
|
2441
2441
|
return clientInstance;
|
|
2442
2442
|
}
|
|
2443
2443
|
|
|
2444
|
+
// src/utils/telemetry.ts
|
|
2445
|
+
async function reportEvents(events) {
|
|
2446
|
+
if (events.length === 0) {
|
|
2447
|
+
return true;
|
|
2448
|
+
}
|
|
2449
|
+
try {
|
|
2450
|
+
const client = getHttpClient();
|
|
2451
|
+
const response = await client.post("/api/v1/studio/innerapi/resource_events", { events });
|
|
2452
|
+
if (!response.ok) {
|
|
2453
|
+
console.warn(`[telemetry] Failed to report events: ${response.status} ${response.statusText}`);
|
|
2454
|
+
return false;
|
|
2455
|
+
}
|
|
2456
|
+
const result = await response.json();
|
|
2457
|
+
if (result.status_code !== "0") {
|
|
2458
|
+
console.warn(`[telemetry] API error: ${result.message}`);
|
|
2459
|
+
return false;
|
|
2460
|
+
}
|
|
2461
|
+
return true;
|
|
2462
|
+
} catch (error) {
|
|
2463
|
+
console.warn(`[telemetry] Failed to report events: ${error instanceof Error ? error.message : error}`);
|
|
2464
|
+
return false;
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
async function reportInstallEvent(pluginKey, version) {
|
|
2468
|
+
await reportEvents([
|
|
2469
|
+
{
|
|
2470
|
+
resourceType: "plugin",
|
|
2471
|
+
resourceKey: pluginKey,
|
|
2472
|
+
eventType: "install",
|
|
2473
|
+
details: { version }
|
|
2474
|
+
}
|
|
2475
|
+
]);
|
|
2476
|
+
}
|
|
2477
|
+
async function reportCreateInstanceEvent(pluginKey, version) {
|
|
2478
|
+
await reportEvents([
|
|
2479
|
+
{
|
|
2480
|
+
resourceType: "plugin",
|
|
2481
|
+
resourceKey: pluginKey,
|
|
2482
|
+
eventType: "create_instance",
|
|
2483
|
+
details: { version }
|
|
2484
|
+
}
|
|
2485
|
+
]);
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2444
2488
|
// src/utils/git.ts
|
|
2445
2489
|
import { execSync, spawnSync as spawnSync2 } from "child_process";
|
|
2446
2490
|
import fs7 from "fs";
|
|
@@ -3221,6 +3265,8 @@ async function installOne(nameWithVersion) {
|
|
|
3221
3265
|
if (actualVersion === requestedVersion) {
|
|
3222
3266
|
console.log(`[action-plugin] Plugin ${name}@${requestedVersion} is already installed`);
|
|
3223
3267
|
syncActionPluginsRecord(name, actualVersion);
|
|
3268
|
+
reportCreateInstanceEvent(name, actualVersion).catch(() => {
|
|
3269
|
+
});
|
|
3224
3270
|
return { name, version: actualVersion, success: true, skipped: true };
|
|
3225
3271
|
}
|
|
3226
3272
|
}
|
|
@@ -3231,6 +3277,8 @@ async function installOne(nameWithVersion) {
|
|
|
3231
3277
|
if (actualVersion === targetVersion) {
|
|
3232
3278
|
console.log(`[action-plugin] Plugin ${name} is already up to date (version: ${actualVersion})`);
|
|
3233
3279
|
syncActionPluginsRecord(name, actualVersion);
|
|
3280
|
+
reportCreateInstanceEvent(name, actualVersion).catch(() => {
|
|
3281
|
+
});
|
|
3234
3282
|
return { name, version: actualVersion, success: true, skipped: true };
|
|
3235
3283
|
}
|
|
3236
3284
|
console.log(`[action-plugin] Found newer version: ${targetVersion} (installed: ${actualVersion || "none"})`);
|
|
@@ -3261,6 +3309,10 @@ async function installOne(nameWithVersion) {
|
|
|
3261
3309
|
writeActionPlugins(plugins);
|
|
3262
3310
|
const source = fromCache ? "from cache" : "downloaded";
|
|
3263
3311
|
console.log(`[action-plugin] Successfully installed ${name}@${installedVersion} (${source})`);
|
|
3312
|
+
reportInstallEvent(name, installedVersion).catch(() => {
|
|
3313
|
+
});
|
|
3314
|
+
reportCreateInstanceEvent(name, installedVersion).catch(() => {
|
|
3315
|
+
});
|
|
3264
3316
|
return { name, version: installedVersion, success: true };
|
|
3265
3317
|
} catch (error) {
|
|
3266
3318
|
const message = error instanceof Error ? error.message : String(error);
|