@geekmidas/cli 10.0.0-alpha.33 → 10.0.0-alpha.34

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.mjs CHANGED
@@ -4,7 +4,7 @@ import { c as isPartitionedRoutes, i as ConstructGenerator, t as discover } from
4
4
  import { a as loadConfig, c as parseModuleConfig, i as loadAppConfig, l as appKey, r as getAppNameFromCwd, s as loadWorkspaceConfig, u as derivedApps } from "./config-Du8AQJRK.mjs";
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-CsL76tpc.mjs";
6
6
  import { c as getKeyPath, i as setCustomSecret, n as readStageSecrets, o as toEmbeddableSecrets, r as secretsExist, s as writeStageSecrets, t as maskPassword } from "./storage-BjTLjDDp.mjs";
7
- import { _ as findAvailablePort, b as loadSecretsForApp, c as applyPostgres, d as cacheBackendFor, f as eventsBackendFor, g as createEntryWrapper, h as createCredentialsPreload, i as reconcileWorkspace, l as resourceName, m as storageBackendFor, n as constructGlobs, o as COMPOSE_PATH, p as providerOf, r as derivedContainers, s as LOCAL_CA_PATH, t as backendsOf, u as rootSite, v as isPortAvailable, x as prepareEntryCredentials, y as loadEnvFiles } from "./workspace-BNurJoFx.mjs";
7
+ import { _ as findAvailablePort, b as loadSecretsForApp, c as applyPostgres, d as cacheBackendFor, f as eventsBackendFor, g as createEntryWrapper, h as createCredentialsPreload, i as reconcileWorkspace, l as resourceName, m as storageBackendFor, n as constructGlobs, o as COMPOSE_PATH, p as providerOf, r as derivedContainers, s as LOCAL_CA_PATH, t as backendsOf, u as rootSite, v as isPortAvailable, x as prepareEntryCredentials, y as loadEnvFiles } from "./workspace-DB2YHgOl.mjs";
8
8
  import { n as EndpointGenerator, r as runtimeFor } from "./OpenApiTsGenerator-hDINScnz.mjs";
9
9
  import { generateOpenApi, openapiCommand, resolveOpenApiConfig } from "./openapi.mjs";
10
10
  import { a as writeTestHarness, i as TEST_MANIFEST_ENV, n as TEST_READY_FILE, o as cacheBackendsIn, s as driversFor, t as TEST_READY_ENV } from "./ready-D1BCiaYU.mjs";
@@ -37,7 +37,7 @@ import { Subscriber } from "@geekmidas/constructs/subscribers";
37
37
  import { Topic } from "@geekmidas/constructs/topic";
38
38
  import { lookup } from "node:dns/promises";
39
39
  //#region package.json
40
- var version = "10.0.0-alpha.33";
40
+ var version = "10.0.0-alpha.34";
41
41
  //#endregion
42
42
  //#region src/auth/credentials.ts
43
43
  /**
@@ -1087,9 +1087,9 @@ async function workspaceDevCommand(workspace, options) {
1087
1087
  ...reconciled.env
1088
1088
  };
1089
1089
  if (options.migrate || options.seed) {
1090
- const { prepareDevDatabases } = await import("./migrate-D2rtGKYi.mjs");
1090
+ const { prepareDevDatabases } = await import("./migrate-BbhXxQer.mjs");
1091
1091
  await prepareDevDatabases(workspace, reconciled.env, { seed: !!options.seed });
1092
- } else await import("./migrate-D2rtGKYi.mjs").then(({ reportPendingMigrations }) => reportPendingMigrations(workspace, reconciled.env)).catch((error) => {
1092
+ } else await import("./migrate-BbhXxQer.mjs").then(({ reportPendingMigrations }) => reportPendingMigrations(workspace, reconciled.env)).catch((error) => {
1093
1093
  logger$10.log(`⚠️ Could not check for pending migrations: ${error instanceof Error ? error.message : String(error)}`);
1094
1094
  });
1095
1095
  const appUrls = {};
@@ -3102,6 +3102,7 @@ const PROVISIONERS = {
3102
3102
  context.deferred.push(...statementsFor({
3103
3103
  id: declaration.id,
3104
3104
  database: postgres.databaseName,
3105
+ ownsDatabase: true,
3105
3106
  runtime,
3106
3107
  owner,
3107
3108
  ...reads ? { reader: readerRole(runtime) } : {},
@@ -3337,6 +3338,7 @@ function statementsFor(options) {
3337
3338
  owner,
3338
3339
  ...reader ? { reader } : {},
3339
3340
  schema,
3341
+ ...options.ownsDatabase ? { database } : {},
3340
3342
  passwords: {
3341
3343
  runtime: derivedPassword(context, runtime),
3342
3344
  owner: derivedPassword(context, owner),
@@ -8783,26 +8785,26 @@ function loadPackageJson() {
8783
8785
  * Run: pnpm --filter @geekmidas/cli sync-versions
8784
8786
  */
8785
8787
  const GEEKMIDAS_VERSIONS = {
8786
- "@geekmidas/audit": "~10.0.0-alpha.33",
8787
- "@geekmidas/auth": "~10.0.0-alpha.33",
8788
- "@geekmidas/cache": "~10.0.0-alpha.33",
8789
- "@geekmidas/client": "~10.0.0-alpha.33",
8790
- "@geekmidas/cloud": "~10.0.0-alpha.33",
8791
- "@geekmidas/constructs": "~10.0.0-alpha.33",
8792
- "@geekmidas/db": "~10.0.0-alpha.33",
8793
- "@geekmidas/emailkit": "~10.0.0-alpha.33",
8794
- "@geekmidas/envkit": "~10.0.0-alpha.33",
8795
- "@geekmidas/errors": "~10.0.0-alpha.33",
8796
- "@geekmidas/events": "~10.0.0-alpha.33",
8797
- "@geekmidas/logger": "~10.0.0-alpha.33",
8798
- "@geekmidas/manifest": "~10.0.0-alpha.33",
8799
- "@geekmidas/rate-limit": "~10.0.0-alpha.33",
8800
- "@geekmidas/schema": "~10.0.0-alpha.33",
8801
- "@geekmidas/services": "~10.0.0-alpha.33",
8802
- "@geekmidas/storage": "~10.0.0-alpha.33",
8803
- "@geekmidas/studio": "~10.0.0-alpha.33",
8804
- "@geekmidas/telescope": "~10.0.0-alpha.33",
8805
- "@geekmidas/testkit": "~10.0.0-alpha.33",
8788
+ "@geekmidas/audit": "~10.0.0-alpha.34",
8789
+ "@geekmidas/auth": "~10.0.0-alpha.34",
8790
+ "@geekmidas/cache": "~10.0.0-alpha.34",
8791
+ "@geekmidas/client": "~10.0.0-alpha.34",
8792
+ "@geekmidas/cloud": "~10.0.0-alpha.34",
8793
+ "@geekmidas/constructs": "~10.0.0-alpha.34",
8794
+ "@geekmidas/db": "~10.0.0-alpha.34",
8795
+ "@geekmidas/emailkit": "~10.0.0-alpha.34",
8796
+ "@geekmidas/envkit": "~10.0.0-alpha.34",
8797
+ "@geekmidas/errors": "~10.0.0-alpha.34",
8798
+ "@geekmidas/events": "~10.0.0-alpha.34",
8799
+ "@geekmidas/logger": "~10.0.0-alpha.34",
8800
+ "@geekmidas/manifest": "~10.0.0-alpha.34",
8801
+ "@geekmidas/rate-limit": "~10.0.0-alpha.34",
8802
+ "@geekmidas/schema": "~10.0.0-alpha.34",
8803
+ "@geekmidas/services": "~10.0.0-alpha.34",
8804
+ "@geekmidas/storage": "~10.0.0-alpha.34",
8805
+ "@geekmidas/studio": "~10.0.0-alpha.34",
8806
+ "@geekmidas/telescope": "~10.0.0-alpha.34",
8807
+ "@geekmidas/testkit": "~10.0.0-alpha.34",
8806
8808
  "@geekmidas/cli": `~${loadPackageJson().version}`
8807
8809
  };
8808
8810
  //#endregion
@@ -10378,6 +10380,18 @@ function rootConstructDependencies(options) {
10378
10380
  };
10379
10381
  }
10380
10382
  /**
10383
+ * What `test/factories/` imports at the root: the factory and faker, and
10384
+ * Kysely's types where the root does not already install it for the
10385
+ * constructs.
10386
+ */
10387
+ function rootFactoryDependencies(options) {
10388
+ return {
10389
+ "@geekmidas/testkit": GEEKMIDAS_VERSIONS["@geekmidas/testkit"],
10390
+ "@faker-js/faker": DEPENDENCY_VERSIONS["@faker-js/faker"],
10391
+ ...options.template === "fullstack" ? {} : { kysely: DEPENDENCY_VERSIONS.kysely }
10392
+ };
10393
+ }
10394
+ /**
10381
10395
  * Generate monorepo root files (pnpm-workspace.yaml, root package.json, etc.)
10382
10396
  */
10383
10397
  function generateMonorepoFiles(options, _template) {
@@ -10416,6 +10430,7 @@ function generateMonorepoFiles(options, _template) {
10416
10430
  turbo: DEPENDENCY_VERSIONS["turbo"],
10417
10431
  typescript: TOOLCHAIN_VERSIONS["typescript"],
10418
10432
  vitest: TOOLCHAIN_VERSIONS["vitest"],
10433
+ ...options.constructs.database ? rootFactoryDependencies(options) : {},
10419
10434
  ...deploy.devDependencies
10420
10435
  }
10421
10436
  };
@@ -12044,7 +12059,7 @@ describe('example', () => {
12044
12059
  function generateTestFactoryFiles(options) {
12045
12060
  if (!options.constructs.database) return [];
12046
12061
  const db = databaseFor();
12047
- const schema = options.monorepo ? `@${options.name}/constructs/database.ts` : "../../src/constructs/database.ts";
12062
+ const schema = options.monorepo && options.template === "fullstack" ? `@${options.name}/constructs/database.ts` : options.monorepo ? `../../${options.apiPath}/src/constructs/database.ts` : "../../src/constructs/database.ts";
12048
12063
  return [{
12049
12064
  path: `test/factories/${kebabCase(db.id)}.ts`,
12050
12065
  content: `import type { Kysely } from 'kysely';
@@ -15012,7 +15027,7 @@ var NoStoredSecrets = class extends Error {
15012
15027
  }
15013
15028
  };
15014
15029
  async function reconcile(secrets, workspace, stage) {
15015
- const { derivedContainers } = await import("./workspace-BNurJoFx.mjs").then((n) => n.a);
15030
+ const { derivedContainers } = await import("./workspace-DB2YHgOl.mjs").then((n) => n.a);
15016
15031
  const result = reconcileMissingSecrets(secrets, workspace, await derivedContainers(workspace, stage));
15017
15032
  return result ? {
15018
15033
  secrets: result.secrets,
@@ -15411,7 +15426,7 @@ async function testCommand(options = {}) {
15411
15426
  * starts without the reference data the app needs.
15412
15427
  */
15413
15428
  async function migrateTestStage(workspace, env) {
15414
- const { migrateAndSeed } = await import("./migrate-D2rtGKYi.mjs");
15429
+ const { migrateAndSeed } = await import("./migrate-BbhXxQer.mjs");
15415
15430
  const { discover } = await import("./discover-CMxesskG.mjs").then((n) => n.n);
15416
15431
  const sources = {};
15417
15432
  const manifest = await discover({
@@ -15856,7 +15871,7 @@ program.command("migrate").description("Apply each database construct's migratio
15856
15871
  try {
15857
15872
  const globalOptions = program.opts();
15858
15873
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
15859
- const { migrateCommand } = await import("./migrate-D2rtGKYi.mjs");
15874
+ const { migrateCommand } = await import("./migrate-BbhXxQer.mjs");
15860
15875
  await migrateCommand({
15861
15876
  ...options,
15862
15877
  ...construct ? { construct } : {}
@@ -15870,7 +15885,7 @@ program.command("seed").description("Migrate, then run each database construct's
15870
15885
  try {
15871
15886
  const globalOptions = program.opts();
15872
15887
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
15873
- const { seedCommand } = await import("./migrate-D2rtGKYi.mjs");
15888
+ const { seedCommand } = await import("./migrate-BbhXxQer.mjs");
15874
15889
  await seedCommand({
15875
15890
  ...options,
15876
15891
  ...construct ? { construct } : {}
@@ -15884,7 +15899,7 @@ program.command("migration").description("Write a construct's next migration: an
15884
15899
  try {
15885
15900
  const globalOptions = program.opts();
15886
15901
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
15887
- const { migrationCommand } = await import("./migrate-D2rtGKYi.mjs");
15902
+ const { migrationCommand } = await import("./migrate-BbhXxQer.mjs");
15888
15903
  await migrationCommand({
15889
15904
  construct,
15890
15905
  ...name ? { name } : {}
@@ -16052,7 +16067,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
16052
16067
  console.error(`No secrets found for stage "${stage}". Run "gkm secrets:init --stage ${stage}" first.`);
16053
16068
  process.exit(1);
16054
16069
  }
16055
- const { derivedContainers } = await import("./workspace-BNurJoFx.mjs").then((n) => n.a);
16070
+ const { derivedContainers } = await import("./workspace-DB2YHgOl.mjs").then((n) => n.a);
16056
16071
  const result = reconcileMissingSecrets(secrets, workspace, await derivedContainers(workspace, stage));
16057
16072
  if (!result) {
16058
16073
  console.log(`\n✓ Secrets for stage "${stage}" are up-to-date`);