cdk-insights 0.7.1 → 0.7.3

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/cli/entry.js +48 -4
  2. package/package.json +1 -1
package/dist/cli/entry.js CHANGED
@@ -82487,6 +82487,49 @@ var decodeJWTPayload = (token) => {
82487
82487
  var hashLicenseKey = (licenseKey) => {
82488
82488
  return crypto6.createHash("sha256").update(licenseKey).digest("hex").slice(0, 16);
82489
82489
  };
82490
+ var fetchLicenseInfo = async (token, apiBase) => {
82491
+ try {
82492
+ const quotaUrl = `${apiBase}/license/quota`;
82493
+ cliLogger.debug("\u{1F4E1} Fetching fresh license info with cached token", {
82494
+ url: quotaUrl
82495
+ });
82496
+ const response = await axios_default.get(quotaUrl, {
82497
+ headers: {
82498
+ Authorization: `Bearer ${token}`,
82499
+ "Content-Type": "application/json"
82500
+ },
82501
+ timeout: 1e4
82502
+ });
82503
+ const data = response.data;
82504
+ cliLogger.debug("\u{1F4E5} Received fresh license info", {
82505
+ hasData: !!data,
82506
+ totalResourcesAnalyzed: data?.totalResourcesAnalyzed,
82507
+ maxUsage: data?.maxUsage,
82508
+ status: data?.status
82509
+ });
82510
+ return {
82511
+ licenseType: data?.licenseType,
82512
+ tier: data?.tier || (data?.status === "TRIAL" ? "trial" : "pro"),
82513
+ status: data?.status,
82514
+ maxUsage: data?.maxUsage,
82515
+ currentPeriodUsage: data?.currentPeriodUsage,
82516
+ totalResourcesAnalyzed: data?.totalResourcesAnalyzed,
82517
+ createdAt: data?.createdAt,
82518
+ updatedAt: data?.updatedAt,
82519
+ lastUsageAt: data?.lastUsageAt,
82520
+ trialStart: data?.trialStart,
82521
+ trialEnd: data?.trialEnd,
82522
+ expiresAt: data?.expiresAt,
82523
+ trialUsageLimit: data?.trialUsageLimit,
82524
+ productMetadata: data?.productMetadata
82525
+ };
82526
+ } catch (error2) {
82527
+ cliLogger.warn("Failed to fetch fresh license info", {
82528
+ error: error2 instanceof Error ? error2.message : String(error2)
82529
+ });
82530
+ return void 0;
82531
+ }
82532
+ };
82490
82533
  var getCachedAuthToken = (licenseKey) => {
82491
82534
  try {
82492
82535
  if (!fs2.existsSync(AUTH_TOKEN_CACHE_FILE)) return null;
@@ -82545,15 +82588,16 @@ async function authenticateUser(licenseKey, fingerprint, project2) {
82545
82588
  const apiBase2 = resolveApiBase();
82546
82589
  const jwtPayload = decodeJWTPayload(cachedToken.token);
82547
82590
  const jwtFingerprint = jwtPayload?.fingerprint;
82548
- cliLogger.info("\u2705 Using cached auth token", {
82591
+ cliLogger.info("\u2705 Using cached auth token, fetching fresh license info", {
82549
82592
  hasToken: true,
82550
82593
  hasJwtFingerprint: !!jwtFingerprint,
82551
82594
  apiUrl: apiBase2
82552
82595
  });
82596
+ const freshLicenseInfo = apiBase2 ? await fetchLicenseInfo(cachedToken.token, apiBase2) : void 0;
82553
82597
  return {
82554
82598
  token: cachedToken.token,
82555
82599
  usageData: void 0,
82556
- licenseInfo: void 0,
82600
+ licenseInfo: freshLicenseInfo,
82557
82601
  fingerprint: jwtFingerprint,
82558
82602
  apiUrl: apiBase2
82559
82603
  };
@@ -95117,8 +95161,8 @@ async function runStackAnalysis(finalConfig, fingerprint, authToken, licenseInfo
95117
95161
  terminal.displayQuotaWarning({
95118
95162
  currentResourcesAnalyzed: quotaValidation.quota.currentResourcesAnalyzed,
95119
95163
  maxResources: quotaValidation.quota.maxResources,
95120
- requestedResources: 50,
95121
- // Use a reasonable estimate for display
95164
+ requestedResources: totalResources,
95165
+ // Use actual resource count
95122
95166
  remainingResources: quotaValidation.quota.remainingResources,
95123
95167
  isTrial: quotaValidation.quota.isTrial
95124
95168
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cdk-insights",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "AWS CDK security and cost analysis tool with AI-powered insights",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",