@rudderhq/cli 0.3.3-canary.5 → 0.3.3-canary.7

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 CHANGED
@@ -1649,7 +1649,7 @@ var init_project = __esm({
1649
1649
 
1650
1650
  // ../packages/shared/dist/validators/issue.js
1651
1651
  import { z as z14 } from "zod";
1652
- var executionWorkspaceStrategySchema2, issueExecutionWorkspaceSettingsSchema, issueAssigneeAdapterOverridesSchema, createIssueSchema, createIssueLabelSchema, updateIssueLabelSchema, updateIssueSchema, reorderIssueSchema, checkoutIssueSchema, addIssueCommentSchema, reportIssueCommitSchema, linkIssueApprovalSchema, createIssueAttachmentMetadataSchema, createIssueWorkspaceAttachmentSchema, ISSUE_DOCUMENT_FORMATS, issueDocumentFormatSchema, issueDocumentKeySchema, upsertIssueDocumentSchema, createLibraryDocumentSchema, updateLibraryDocumentSchema, restoreLibraryDocumentRevisionSchema;
1652
+ var executionWorkspaceStrategySchema2, issueExecutionWorkspaceSettingsSchema, issueAssigneeAdapterOverridesSchema, createIssueSchema, createIssueLabelSchema, updateIssueLabelSchema, updateIssueSchema, reorderIssueSchema, checkoutIssueSchema, addIssueCommentSchema, updateIssueCommentSchema, reportIssueCommitSchema, linkIssueApprovalSchema, createIssueAttachmentMetadataSchema, createIssueWorkspaceAttachmentSchema, ISSUE_DOCUMENT_FORMATS, issueDocumentFormatSchema, issueDocumentKeySchema, upsertIssueDocumentSchema, createLibraryDocumentSchema, updateLibraryDocumentSchema, restoreLibraryDocumentRevisionSchema;
1653
1653
  var init_issue = __esm({
1654
1654
  "../packages/shared/dist/validators/issue.js"() {
1655
1655
  "use strict";
@@ -1730,6 +1730,9 @@ var init_issue = __esm({
1730
1730
  reopen: z14.boolean().optional(),
1731
1731
  interrupt: z14.boolean().optional()
1732
1732
  });
1733
+ updateIssueCommentSchema = z14.object({
1734
+ body: z14.string().trim().min(1)
1735
+ });
1733
1736
  reportIssueCommitSchema = z14.object({
1734
1737
  sha: z14.string().trim().regex(/^[0-9a-f]{7,64}$/i, "Commit SHA must be 7 to 64 hexadecimal characters"),
1735
1738
  message: z14.string().trim().min(1).max(500),
@@ -3972,6 +3975,48 @@ async function touchRuntimeInstallMetadata(cacheDir) {
3972
3975
  } catch {
3973
3976
  }
3974
3977
  }
3978
+ function resolveEmbeddedPostgresPlatformPackage(platform = process.platform, arch = process.arch) {
3979
+ if (platform === "darwin" && arch === "arm64") return "@embedded-postgres/darwin-arm64";
3980
+ if (platform === "darwin" && arch === "x64") return "@embedded-postgres/darwin-x64";
3981
+ if (platform === "linux" && arch === "arm64") return "@embedded-postgres/linux-arm64";
3982
+ if (platform === "linux" && arch === "arm") return "@embedded-postgres/linux-arm";
3983
+ if (platform === "linux" && arch === "ia32") return "@embedded-postgres/linux-ia32";
3984
+ if (platform === "linux" && arch === "ppc64") return "@embedded-postgres/linux-ppc64";
3985
+ if (platform === "linux" && arch === "x64") return "@embedded-postgres/linux-x64";
3986
+ if (platform === "win32" && arch === "x64") return "@embedded-postgres/windows-x64";
3987
+ return null;
3988
+ }
3989
+ async function canResolveRuntimePackage(cacheDir, packageName) {
3990
+ try {
3991
+ await readFile(path6.join(cacheDir, "node_modules", ...packageName.split("/"), "package.json"), "utf8");
3992
+ return true;
3993
+ } catch {
3994
+ return false;
3995
+ }
3996
+ }
3997
+ async function hasRequiredRuntimePlatformDependencies(cacheDir) {
3998
+ if (!await canResolveRuntimePackage(cacheDir, EMBEDDED_POSTGRES_PACKAGE_NAME)) return true;
3999
+ const platformPackage = resolveEmbeddedPostgresPlatformPackage();
4000
+ if (!platformPackage) return true;
4001
+ return await canResolveRuntimePackage(cacheDir, platformPackage);
4002
+ }
4003
+ async function assertRequiredRuntimePlatformDependencies(cacheDir, command, output) {
4004
+ if (!await canResolveRuntimePackage(cacheDir, EMBEDDED_POSTGRES_PACKAGE_NAME)) return;
4005
+ const platformPackage = resolveEmbeddedPostgresPlatformPackage();
4006
+ if (!platformPackage || await canResolveRuntimePackage(cacheDir, platformPackage)) return;
4007
+ throw new RuntimeInstallError(
4008
+ `Rudder runtime installation is missing required platform package ${platformPackage}. Re-run manually: ${command}`,
4009
+ {
4010
+ cacheDir,
4011
+ command,
4012
+ output: [
4013
+ output,
4014
+ `Missing required optional dependency: ${platformPackage}`,
4015
+ "Your npm registry, mirror, proxy, or cache may have skipped the embedded PostgreSQL platform package."
4016
+ ].filter((line) => line.trim().length > 0).join("\n")
4017
+ }
4018
+ );
4019
+ }
3975
4020
  async function isRuntimeCacheHit(options) {
3976
4021
  const packageName = options.packageName ?? RUNTIME_NPM_PACKAGE_NAME;
3977
4022
  const packageVersion = resolveRuntimePackageVersion(options.version);
@@ -3982,7 +4027,8 @@ async function isRuntimeCacheHit(options) {
3982
4027
  try {
3983
4028
  const packageJsonPath = path6.join(options.cacheDir, "node_modules", ...packageName.split("/"), "package.json");
3984
4029
  const packageJson = JSON.parse(await readFile(packageJsonPath, "utf8"));
3985
- return packageVersion === "latest" || packageJson.version === packageVersion;
4030
+ const packageVersionMatches = packageVersion === "latest" || packageJson.version === packageVersion;
4031
+ return packageVersionMatches && await hasRequiredRuntimePlatformDependencies(options.cacheDir);
3986
4032
  } catch {
3987
4033
  return false;
3988
4034
  }
@@ -4003,6 +4049,7 @@ async function ensureRuntimeInstalled(options) {
4003
4049
  });
4004
4050
  return { status: "hit", cacheDir, packageSpec, command, output: "", ...prune2 ? { prune: prune2 } : {} };
4005
4051
  }
4052
+ await rm(cacheDir, { recursive: true, force: true });
4006
4053
  await mkdir(cacheDir, { recursive: true });
4007
4054
  await writeFile(path6.join(cacheDir, "package.json"), `${JSON.stringify({ private: true, type: "module" }, null, 2)}
4008
4055
  `, "utf8");
@@ -4023,12 +4070,14 @@ async function ensureRuntimeInstalled(options) {
4023
4070
  output: ""
4024
4071
  };
4025
4072
  }
4073
+ await rm(fallbackCacheDir, { recursive: true, force: true });
4026
4074
  await mkdir(fallbackCacheDir, { recursive: true });
4027
4075
  await writeFile(path6.join(fallbackCacheDir, "package.json"), `${JSON.stringify({ private: true, type: "module" }, null, 2)}
4028
4076
  `, "utf8");
4029
4077
  const fallbackResult = runNpmRuntimeInstall(spawnSyncImpl, fallbackCacheDir, fallbackSpec);
4030
4078
  const fallbackOutput = collectSpawnOutput(fallbackResult);
4031
4079
  if (fallbackResult.status === 0) {
4080
+ await assertRequiredRuntimePlatformDependencies(fallbackCacheDir, formatRuntimeInstallCommand(fallbackCacheDir, fallbackSpec), fallbackOutput);
4032
4081
  const fallbackMetadata = {
4033
4082
  version: 1,
4034
4083
  packageName,
@@ -4052,6 +4101,7 @@ async function ensureRuntimeInstalled(options) {
4052
4101
  { cacheDir, command, output }
4053
4102
  );
4054
4103
  }
4104
+ await assertRequiredRuntimePlatformDependencies(cacheDir, command, output);
4055
4105
  const metadata = {
4056
4106
  version: 1,
4057
4107
  packageName,
@@ -4317,7 +4367,7 @@ function parseRuntimeVersion(version) {
4317
4367
  canaryNumber: canaryMatch ? Number(canaryMatch[1]) : null
4318
4368
  };
4319
4369
  }
4320
- var RUNTIME_NPM_PACKAGE_NAME, RUNTIME_METADATA_FILE, DEFAULT_RUNTIME_CACHE_MAX_ENTRIES, DEFAULT_RUNTIME_CACHE_MAX_AGE_MS, DEFAULT_RUNTIME_CACHE_MAX_BYTES, DEFAULT_RUNTIME_CACHE_KEEP_PREVIOUS, RUNTIME_NPM_INSTALL_FLAGS, RuntimeInstallError;
4370
+ var RUNTIME_NPM_PACKAGE_NAME, RUNTIME_METADATA_FILE, DEFAULT_RUNTIME_CACHE_MAX_ENTRIES, DEFAULT_RUNTIME_CACHE_MAX_AGE_MS, DEFAULT_RUNTIME_CACHE_MAX_BYTES, DEFAULT_RUNTIME_CACHE_KEEP_PREVIOUS, RUNTIME_NPM_INSTALL_FLAGS, EMBEDDED_POSTGRES_PACKAGE_NAME, RuntimeInstallError;
4321
4371
  var init_install = __esm({
4322
4372
  "src/runtime/install.ts"() {
4323
4373
  "use strict";
@@ -4329,6 +4379,7 @@ var init_install = __esm({
4329
4379
  DEFAULT_RUNTIME_CACHE_MAX_BYTES = 2 * 1024 * 1024 * 1024;
4330
4380
  DEFAULT_RUNTIME_CACHE_KEEP_PREVIOUS = 0;
4331
4381
  RUNTIME_NPM_INSTALL_FLAGS = ["--omit=dev", "--include=optional", "--no-audit", "--no-fund"];
4382
+ EMBEDDED_POSTGRES_PACKAGE_NAME = "embedded-postgres";
4332
4383
  RuntimeInstallError = class extends Error {
4333
4384
  cacheDir;
4334
4385
  command;