@geekmidas/cli 10.0.0-alpha.52 → 10.0.0-alpha.53

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 (29) hide show
  1. package/dist/{backends-BXcwhb7p.cjs → backends-D5aDWxuA.cjs} +2 -2
  2. package/dist/{backends-BXcwhb7p.cjs.map → backends-D5aDWxuA.cjs.map} +1 -1
  3. package/dist/{backends-CLq1wlQf.mjs → backends-Dfeu5Dgc.mjs} +2 -2
  4. package/dist/{backends-CLq1wlQf.mjs.map → backends-Dfeu5Dgc.mjs.map} +1 -1
  5. package/dist/{encryption-Cv-Ej9vR.mjs → encryption-O-XdeNxe.mjs} +2 -2
  6. package/dist/{encryption-Cv-Ej9vR.mjs.map → encryption-O-XdeNxe.mjs.map} +1 -1
  7. package/dist/{encryption-DCsdx4Po.cjs → encryption-tB4LqLKN.cjs} +2 -2
  8. package/dist/{encryption-DCsdx4Po.cjs.map → encryption-tB4LqLKN.cjs.map} +1 -1
  9. package/dist/index.cjs +75 -35
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.mjs +75 -35
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/{migrate-DmabhO_N.mjs → migrate-CHQyNzj-.mjs} +2 -2
  14. package/dist/{migrate-DmabhO_N.mjs.map → migrate-CHQyNzj-.mjs.map} +1 -1
  15. package/dist/{migrate-DCxK1NRd.cjs → migrate-SDIRUyY5.cjs} +2 -2
  16. package/dist/{migrate-DCxK1NRd.cjs.map → migrate-SDIRUyY5.cjs.map} +1 -1
  17. package/dist/{ready-tQLNHNya.mjs → ready-C8wG_d0v.mjs} +7 -3
  18. package/dist/ready-C8wG_d0v.mjs.map +1 -0
  19. package/dist/{ready-ClUpTxoL.cjs → ready-VkNwfJu7.cjs} +7 -3
  20. package/dist/ready-VkNwfJu7.cjs.map +1 -0
  21. package/dist/vitest.cjs +1 -1
  22. package/dist/vitest.mjs +1 -1
  23. package/dist/{workspace-BEGUDNwK.cjs → workspace-P_V5t4Uk.cjs} +3 -3
  24. package/dist/{workspace-BEGUDNwK.cjs.map → workspace-P_V5t4Uk.cjs.map} +1 -1
  25. package/dist/{workspace-fa5H6l7D.mjs → workspace-qcva2dTt.mjs} +3 -3
  26. package/dist/{workspace-fa5H6l7D.mjs.map → workspace-qcva2dTt.mjs.map} +1 -1
  27. package/package.json +14 -14
  28. package/dist/ready-ClUpTxoL.cjs.map +0 -1
  29. package/dist/ready-tQLNHNya.mjs.map +0 -1
package/dist/index.mjs CHANGED
@@ -5,11 +5,11 @@ import { d as parseModuleConfig, f as appKey, l as loadWorkspaceConfig, n as Not
5
5
  import { D as assertDeployedStage, E as TEST_STAGE, O as deployedProblems, T as InvalidStages, a as getAppBuildOrder, b as getDeployTargetError, k as stageProblems, m as stripPublicPrefix, o as getAppGkmConfig, p as getPublicEnvPrefix, t as allConstructGlobs, x as isDeployTargetSupported } from "./workspace-bOsks1uk.mjs";
6
6
  import { a as withCustomSecret, i as toEmbeddableSecrets, n as maskPassword, t as initStageSecrets } from "./storage-BzaUxmqe.mjs";
7
7
  import { a as getKeyPath, i as FileSecretsStore, n as secretsStoreFor } from "./store-DeGATCS-.mjs";
8
- import { C as loadEnvFiles, S as isPortAvailable, T as prepareEntryCredentials, _ as fakeKey, a as reconcileWorkspace, b as createEntryWrapper, c as LOCAL_CA_PATH, d as postgresDatabaseNames, f as quoteIdentifier, g as describeServices, h as rootSite, i as derivedContainers, l as forgetState, m as resourceName, n as backendsOf$1, p as pgClient, r as constructGlobs, s as COMPOSE_PATH, t as FAKE_ENV, u as applyPostgres, v as primaryPortKey, w as loadSecretsForApp, x as findAvailablePort, y as createCredentialsPreload } from "./workspace-fa5H6l7D.mjs";
8
+ import { C as loadEnvFiles, S as isPortAvailable, T as prepareEntryCredentials, _ as fakeKey, a as reconcileWorkspace, b as createEntryWrapper, c as LOCAL_CA_PATH, d as postgresDatabaseNames, f as quoteIdentifier, g as describeServices, h as rootSite, i as derivedContainers, l as forgetState, m as resourceName, n as backendsOf$1, p as pgClient, r as constructGlobs, s as COMPOSE_PATH, t as FAKE_ENV, u as applyPostgres, v as primaryPortKey, w as loadSecretsForApp, x as findAvailablePort, y as createCredentialsPreload } from "./workspace-qcva2dTt.mjs";
9
9
  import { n as EndpointGenerator, r as runtimeFor } from "./OpenApiTsGenerator-BzIGy8KE.mjs";
10
10
  import { generateOpenApi, openapiCommand, resolveOpenApiConfig } from "./openapi.mjs";
11
- import { a as writeTestHarness, c as driversFor, i as TEST_MANIFEST_ENV, n as TEST_READY_FILE, o as SubscriberGenerator, s as cacheBackendsIn, t as TEST_READY_ENV } from "./ready-tQLNHNya.mjs";
12
- import { i as storageBackendFor, n as eventsBackendFor, r as providerOf, t as cacheBackendFor } from "./backends-CLq1wlQf.mjs";
11
+ import { a as writeTestHarness, c as driversFor, i as TEST_MANIFEST_ENV, n as TEST_READY_FILE, o as SubscriberGenerator, s as cacheBackendsIn, t as TEST_READY_ENV } from "./ready-C8wG_d0v.mjs";
12
+ import { i as storageBackendFor, n as eventsBackendFor, r as providerOf, t as cacheBackendFor } from "./backends-Dfeu5Dgc.mjs";
13
13
  import { n as withCompute, r as withRoutes, t as manifestModule } from "./emit-C1e8qD08.mjs";
14
14
  import { createRequire } from "node:module";
15
15
  import { Command } from "commander";
@@ -42,7 +42,7 @@ import { Queue } from "@geekmidas/constructs/queue";
42
42
  import { Topic } from "@geekmidas/constructs/topic";
43
43
  import { lookup } from "node:dns/promises";
44
44
  //#region package.json
45
- var version = "10.0.0-alpha.52";
45
+ var version = "10.0.0-alpha.53";
46
46
  //#endregion
47
47
  //#region src/auth/credentials.ts
48
48
  /**
@@ -567,7 +567,8 @@ var UnsupportedPlatform = class extends Error {
567
567
  * So the holder is asked who it is. Every app process gkm starts is tagged with
568
568
  * {@link APP_TAG_ENV} — the workspace and the app — and children inherit it, so
569
569
  * whatever actually binds the port (`next-server`, a Metro worker, the tsx
570
- * server) carries it. A held port whose holder carries this app's tag is a
570
+ * server) carries it — or, when its own can't be read, one of its parents does.
571
+ * A held port whose holder carries this app's tag is a
571
572
  * leftover, and is refused; anything else — untagged, another workspace's,
572
573
  * unreadable — is not ours, and the app moves to the next free port.
573
574
  *
@@ -625,13 +626,32 @@ function holderOf(port) {
625
626
  const pid = Number(out.match(/^p(\d+)/m)?.[1]);
626
627
  if (!pid) return void 0;
627
628
  const command = out.match(/^c(.+)$/m)?.[1];
628
- const tag = tagOf(pid);
629
+ const tag = lineageTagOf(pid);
629
630
  return {
630
631
  pid,
631
632
  ...command ? { command } : {},
632
633
  ...tag ? { tag } : {}
633
634
  };
634
635
  }
636
+ /** How far up a holder's parents to look before calling it untagged. */
637
+ const MAX_ANCESTORS = 8;
638
+ /**
639
+ * The tag of `pid`, or of its nearest parent that has one.
640
+ *
641
+ * A process can hide the tag it inherited: `next-server` renames itself, which
642
+ * on macOS overwrites the memory `ps eww` reads its environment from, so `ps`
643
+ * shows only its title. Its parent, the `next dev` gkm started, still carries
644
+ * the tag. A child is only ever started by its parent, so a tagged parent makes
645
+ * the holder this app's.
646
+ */
647
+ function lineageTagOf(pid) {
648
+ let current = pid;
649
+ for (let depth = 0; current && current > 1; depth += 1) {
650
+ const tag = tagOf(current);
651
+ if (tag || depth === MAX_ANCESTORS) return tag;
652
+ current = parentOf(current);
653
+ }
654
+ }
635
655
  function tagOf(pid) {
636
656
  const prefix = `${APP_TAG_ENV}=`;
637
657
  try {
@@ -653,6 +673,26 @@ function tagOf(pid) {
653
673
  return;
654
674
  }
655
675
  }
676
+ function parentOf(pid) {
677
+ try {
678
+ const ppid = Number(execFileSync("ps", [
679
+ "-o",
680
+ "ppid=",
681
+ "-p",
682
+ String(pid)
683
+ ], {
684
+ encoding: "utf8",
685
+ stdio: [
686
+ "ignore",
687
+ "pipe",
688
+ "ignore"
689
+ ]
690
+ }).trim());
691
+ return ppid > 0 ? ppid : void 0;
692
+ } catch {
693
+ return;
694
+ }
695
+ }
656
696
  /** The ports apps were given before, by app name. */
657
697
  async function savedAppPorts(root) {
658
698
  try {
@@ -1725,9 +1765,9 @@ async function workspaceDevCommand(configured, options) {
1725
1765
  for (const { id, port } of fakes) logger$9.log(`🎭 ${id} fake: http://localhost:${port}`);
1726
1766
  logger$9.log(options.migrate || options.seed ? "🗄️ Migrating the databases" : "🗄️ Checking for pending migrations");
1727
1767
  if (options.migrate || options.seed) {
1728
- const { prepareDevDatabases } = await import("./migrate-DmabhO_N.mjs");
1768
+ const { prepareDevDatabases } = await import("./migrate-CHQyNzj-.mjs");
1729
1769
  await prepareDevDatabases(workspace, reconciled.env, { seed: !!options.seed });
1730
- } else await import("./migrate-DmabhO_N.mjs").then(({ reportPendingMigrations }) => reportPendingMigrations(workspace, reconciled.env)).catch((error) => {
1770
+ } else await import("./migrate-CHQyNzj-.mjs").then(({ reportPendingMigrations }) => reportPendingMigrations(workspace, reconciled.env)).catch((error) => {
1731
1771
  logger$9.log(`⚠️ Could not check for pending migrations: ${error instanceof Error ? error.message : String(error)}`);
1732
1772
  });
1733
1773
  const appUrls = {};
@@ -9328,26 +9368,26 @@ function loadPackageJson() {
9328
9368
  * Run: pnpm --filter @geekmidas/cli sync-versions
9329
9369
  */
9330
9370
  const GEEKMIDAS_VERSIONS = {
9331
- "@geekmidas/audit": "~10.0.0-alpha.52",
9332
- "@geekmidas/auth": "~10.0.0-alpha.52",
9333
- "@geekmidas/cache": "~10.0.0-alpha.52",
9334
- "@geekmidas/client": "~10.0.0-alpha.52",
9335
- "@geekmidas/cloud": "~10.0.0-alpha.52",
9336
- "@geekmidas/constructs": "~10.0.0-alpha.52",
9337
- "@geekmidas/db": "~10.0.0-alpha.52",
9338
- "@geekmidas/emailkit": "~10.0.0-alpha.52",
9339
- "@geekmidas/envkit": "~10.0.0-alpha.52",
9340
- "@geekmidas/errors": "~10.0.0-alpha.52",
9341
- "@geekmidas/events": "~10.0.0-alpha.52",
9342
- "@geekmidas/logger": "~10.0.0-alpha.52",
9343
- "@geekmidas/manifest": "~10.0.0-alpha.52",
9344
- "@geekmidas/rate-limit": "~10.0.0-alpha.52",
9345
- "@geekmidas/schema": "~10.0.0-alpha.52",
9346
- "@geekmidas/services": "~10.0.0-alpha.52",
9347
- "@geekmidas/storage": "~10.0.0-alpha.52",
9348
- "@geekmidas/studio": "~10.0.0-alpha.52",
9349
- "@geekmidas/telescope": "~10.0.0-alpha.52",
9350
- "@geekmidas/testkit": "~10.0.0-alpha.52",
9371
+ "@geekmidas/audit": "~10.0.0-alpha.53",
9372
+ "@geekmidas/auth": "~10.0.0-alpha.53",
9373
+ "@geekmidas/cache": "~10.0.0-alpha.53",
9374
+ "@geekmidas/client": "~10.0.0-alpha.53",
9375
+ "@geekmidas/cloud": "~10.0.0-alpha.53",
9376
+ "@geekmidas/constructs": "~10.0.0-alpha.53",
9377
+ "@geekmidas/db": "~10.0.0-alpha.53",
9378
+ "@geekmidas/emailkit": "~10.0.0-alpha.53",
9379
+ "@geekmidas/envkit": "~10.0.0-alpha.53",
9380
+ "@geekmidas/errors": "~10.0.0-alpha.53",
9381
+ "@geekmidas/events": "~10.0.0-alpha.53",
9382
+ "@geekmidas/logger": "~10.0.0-alpha.53",
9383
+ "@geekmidas/manifest": "~10.0.0-alpha.53",
9384
+ "@geekmidas/rate-limit": "~10.0.0-alpha.53",
9385
+ "@geekmidas/schema": "~10.0.0-alpha.53",
9386
+ "@geekmidas/services": "~10.0.0-alpha.53",
9387
+ "@geekmidas/storage": "~10.0.0-alpha.53",
9388
+ "@geekmidas/studio": "~10.0.0-alpha.53",
9389
+ "@geekmidas/telescope": "~10.0.0-alpha.53",
9390
+ "@geekmidas/testkit": "~10.0.0-alpha.53",
9351
9391
  "@geekmidas/cli": `~${loadPackageJson().version}`
9352
9392
  };
9353
9393
  //#endregion
@@ -16090,7 +16130,7 @@ function testDatabases(reconciled) {
16090
16130
  * starts without the reference data the app needs.
16091
16131
  */
16092
16132
  async function migrateTestStage(workspace, env) {
16093
- const { migrateAndSeed } = await import("./migrate-DmabhO_N.mjs");
16133
+ const { migrateAndSeed } = await import("./migrate-CHQyNzj-.mjs");
16094
16134
  const { discover } = await import("./discover-Cf2jAcgF.mjs").then((n) => n.n);
16095
16135
  const sources = {};
16096
16136
  const manifest = await discover({
@@ -16521,7 +16561,7 @@ program.command("migrate").description("Apply each database construct's migratio
16521
16561
  try {
16522
16562
  const globalOptions = program.opts();
16523
16563
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
16524
- const { migrateCommand } = await import("./migrate-DmabhO_N.mjs");
16564
+ const { migrateCommand } = await import("./migrate-CHQyNzj-.mjs");
16525
16565
  await migrateCommand({
16526
16566
  ...options,
16527
16567
  ...construct ? { construct } : {}
@@ -16535,7 +16575,7 @@ program.command("seed").description("Migrate, then run each database construct's
16535
16575
  try {
16536
16576
  const globalOptions = program.opts();
16537
16577
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
16538
- const { seedCommand } = await import("./migrate-DmabhO_N.mjs");
16578
+ const { seedCommand } = await import("./migrate-CHQyNzj-.mjs");
16539
16579
  await seedCommand({
16540
16580
  ...options,
16541
16581
  ...construct ? { construct } : {}
@@ -16549,7 +16589,7 @@ program.command("migration").description("Write a construct's next migration: an
16549
16589
  try {
16550
16590
  const globalOptions = program.opts();
16551
16591
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
16552
- const { migrationCommand } = await import("./migrate-DmabhO_N.mjs");
16592
+ const { migrationCommand } = await import("./migrate-CHQyNzj-.mjs");
16553
16593
  await migrationCommand({
16554
16594
  construct,
16555
16595
  ...name ? { name } : {}
@@ -16647,7 +16687,7 @@ program.command("encryption:rotate").description("Add a new current key to an En
16647
16687
  try {
16648
16688
  const globalOptions = program.opts();
16649
16689
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
16650
- const { encryptionRotateCommand } = await import("./encryption-Cv-Ej9vR.mjs");
16690
+ const { encryptionRotateCommand } = await import("./encryption-O-XdeNxe.mjs");
16651
16691
  await encryptionRotateCommand(construct, options);
16652
16692
  } catch (error) {
16653
16693
  console.error(formatError(error));
@@ -16658,7 +16698,7 @@ program.command("encryption:retire").description("Remove an old key from an Encr
16658
16698
  try {
16659
16699
  const globalOptions = program.opts();
16660
16700
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
16661
- const { encryptionRetireCommand } = await import("./encryption-Cv-Ej9vR.mjs");
16701
+ const { encryptionRetireCommand } = await import("./encryption-O-XdeNxe.mjs");
16662
16702
  await encryptionRetireCommand(construct, key, options);
16663
16703
  } catch (error) {
16664
16704
  console.error(formatError(error));
@@ -16710,7 +16750,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
16710
16750
  console.error(`No secrets found for stage "${stage}". Run "gkm secrets:init --stage ${stage}" first.`);
16711
16751
  process.exit(1);
16712
16752
  }
16713
- const { derivedContainers } = await import("./workspace-fa5H6l7D.mjs").then((n) => n.o);
16753
+ const { derivedContainers } = await import("./workspace-qcva2dTt.mjs").then((n) => n.o);
16714
16754
  const result = reconcileMissingSecrets(secrets, workspace, await derivedContainers(workspace, stage));
16715
16755
  if (!result) {
16716
16756
  console.log(`\n✓ Secrets for stage "${stage}" are up-to-date`);