@geekmidas/cli 10.0.0-alpha.71 → 10.0.0-alpha.72

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
@@ -6,12 +6,12 @@ import { l as withOwningTsconfigJsx, r as discover, u as ConstructGenerator } fr
6
6
  import { t as appKey } from "./derive-B4vDpzgP.mjs";
7
7
  import { A as deployedProblems, D as InvalidStages, O as TEST_STAGE, c as getAppGkmConfig, j as stageProblems, n as allConstructGlobs, s as getAppBuildOrder } from "./workspace-C7NqCsQF.mjs";
8
8
  import { ConfigNotFound, NotABackendApp, NotInAnApp, loadAppConfig, loadConfig, loadWorkspaceConfig, loadWorkspaceSettings, parseModuleConfig } from "./config.mjs";
9
- import { At as findAvailablePort, Dt as primaryPortKey, G as constructGlobs, H as keyFingerprint, I as parseDevServices, It as secretsStoreFor, K as derivedContainers, Mt as loadEnvFiles, Nt as loadSecretsForApp, Ot as createCredentialsPreload, Pt as prepareEntryCredentials, Qt as maskPassword, Rt as FileSecretsStore, Tt as fakeKey, U as FAKE_ENV, Vt as projectKey, W as backendsOf$1, Wt as deployIdentity, X as forgetState, Y as LOCAL_CA_PATH, en as toEmbeddableSecrets, jt as isPortAvailable, kt as createEntryWrapper, ot as pgClient, q as reconcileWorkspace, rt as quoteIdentifier, tn as withCustomSecret, tt as postgresDatabaseNames, wt as describeServices, xt as providerOf, y as dockerCommand, yt as cacheBackendFor, zt as getKeyPath } from "./state-BJFherj1.mjs";
10
- import { i as telemetryFor, n as EndpointGenerator, r as runtimeFor } from "./OpenApiTsGenerator-Bhr_XWWN.mjs";
9
+ import { At as findAvailablePort, Dt as primaryPortKey, G as constructGlobs, H as keyFingerprint, I as parseDevServices, It as secretsStoreFor, K as derivedContainers, Mt as loadEnvFiles, Nt as loadSecretsForApp, Ot as createCredentialsPreload, Pt as prepareEntryCredentials, Qt as maskPassword, Rt as FileSecretsStore, Tt as fakeKey, U as FAKE_ENV, Vt as projectKey, W as backendsOf$1, Wt as deployIdentity, X as forgetState, Y as LOCAL_CA_PATH, bt as eventsBackendFor, en as toEmbeddableSecrets, jt as isPortAvailable, kt as createEntryWrapper, ot as pgClient, q as reconcileWorkspace, rt as quoteIdentifier, tn as withCustomSecret, tt as postgresDatabaseNames, wt as describeServices, xt as providerOf, y as dockerCommand, yt as cacheBackendFor, zt as getKeyPath } from "./state-BJFherj1.mjs";
10
+ import { i as telemetryFor, n as EndpointGenerator, r as runtimeFor } from "./OpenApiTsGenerator-Dv0gT2DL.mjs";
11
11
  import { g as createStateStore, n as sniffAppEnvironment, o as DokployApi } from "./sniffer-vAXsU_4G.mjs";
12
12
  import { generateOpenApi, openapiCommand, resolveOpenApiConfig } from "./openapi.mjs";
13
13
  import { a as describeHolder, i as assignAppPorts, o as holderOf, r as appTag, s as withAppPorts, t as APP_TAG_ENV } from "./appPorts-C9z9Pzn9.mjs";
14
- 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-xpoX11uu.mjs";
14
+ import { a as writeTestHarness, c as driversFor, i as TEST_MANIFEST_ENV, l as eventsBackendsIn, n as TEST_READY_FILE, o as SubscriberGenerator, s as cacheBackendsIn, t as TEST_READY_ENV } from "./ready-ULc5BTOb.mjs";
15
15
  import { n as withCompute, r as withRoutes, t as manifestModule } from "./emit-C1e8qD08.mjs";
16
16
  import { t as deploy$1 } from "./deploy-ClC53rc6.mjs";
17
17
  import { a as stackDir, i as composeProject, o as dockerCompose, r as stackOverrideFile, t as composeTarget } from "./compose-T3hnnjKZ.mjs";
@@ -47,7 +47,7 @@ import { Function } from "@geekmidas/constructs/functions";
47
47
  import { Queue } from "@geekmidas/constructs/queue";
48
48
  import { Topic } from "@geekmidas/constructs/topic";
49
49
  //#region package.json
50
- var version = "10.0.0-alpha.71";
50
+ var version = "10.0.0-alpha.72";
51
51
  //#endregion
52
52
  //#region src/prompt.ts
53
53
  /**
@@ -1674,6 +1674,7 @@ async function devCommand(options) {
1674
1674
  target: "server",
1675
1675
  enableOpenApi,
1676
1676
  cacheBackend: cacheBackendFor(providerOf(workspace ?? config)),
1677
+ eventsBackend: eventsBackendFor(providerOf(workspace ?? config)),
1677
1678
  telescope,
1678
1679
  databaseApi: true,
1679
1680
  hooks,
@@ -2643,6 +2644,22 @@ var CronGenerator = class extends ConstructGenerator {
2643
2644
  async generateServerCronsFile(outputDir, crons) {
2644
2645
  await mkdir(outputDir, { recursive: true });
2645
2646
  const cronsPath = join(outputDir, "crons.ts");
2647
+ if (crons.length === 0) {
2648
+ await writeFile(cronsPath, `/**
2649
+ * Generated cron setup — this app declares none.
2650
+ */
2651
+ import type { EnvironmentParser } from '@geekmidas/envkit';
2652
+ import type { Logger } from '@geekmidas/logger';
2653
+
2654
+ export async function setupCrons(
2655
+ _envParser: EnvironmentParser<any>,
2656
+ _logger: Logger,
2657
+ ): Promise<void> {}
2658
+
2659
+ export async function stopCrons(): Promise<void> {}
2660
+ `);
2661
+ return cronsPath;
2662
+ }
2646
2663
  const importsByFile = /* @__PURE__ */ new Map();
2647
2664
  for (const { path, key } of crons) {
2648
2665
  const importPath = relative(dirname(cronsPath), path.relative).replace(/\.ts$/, ".js");
@@ -2752,8 +2769,13 @@ export async function setupCrons(
2752
2769
  return;
2753
2770
  }
2754
2771
 
2755
- const { PgBossConnection } = await import('@geekmidas/events/pgboss');
2756
- const connection = await PgBossConnection.fromConnectionString(url);
2772
+ // Through the registered pg-boss driver, which the entry registers for a
2773
+ // server whose broker is pg-boss. Naming \`@geekmidas/events/pgboss\` here
2774
+ // made every bundle with a cron resolve pg-boss, whatever its broker.
2775
+ const { EventConnectionFactory } = await import('@geekmidas/events');
2776
+ const connection = (await EventConnectionFactory.fromConnectionString(
2777
+ url,
2778
+ )) as import('@geekmidas/events').EventConnection & { instance?: any };
2757
2779
  const boss = connection.instance!;
2758
2780
 
2759
2781
  // What this app declares now. Anything else under the prefix belonged to a
@@ -2801,8 +2823,9 @@ export async function stopCrons(): Promise<void> {
2801
2823
  const content = `import { AWSScheduledFunction } from '@geekmidas/constructs/aws';
2802
2824
  import { ${exportName} } from '${importPath}';
2803
2825
  ${runtime.imports}
2826
+ ${context.storageDrivers?.imports ?? ""}
2804
2827
  ${runtime.bindings}
2805
-
2828
+ ${context.storageDrivers?.setup ? `\n// The handler registers the drivers its target needs.\n${context.storageDrivers.setup}\n` : ""}
2806
2829
  const adapter = new AWSScheduledFunction(envParser, ${exportName});
2807
2830
 
2808
2831
  export const handler = adapter.handler;
@@ -2846,8 +2869,9 @@ var FunctionGenerator = class extends ConstructGenerator {
2846
2869
  const content = `import { AWSLambdaFunction } from '@geekmidas/constructs/aws';
2847
2870
  import { ${exportName} } from '${importPath}';
2848
2871
  ${runtime.imports}
2872
+ ${context.storageDrivers?.imports ?? ""}
2849
2873
  ${runtime.bindings}
2850
-
2874
+ ${context.storageDrivers?.setup ? `\n// The handler registers the drivers its target needs.\n${context.storageDrivers.setup}\n` : ""}
2851
2875
  const adapter = new AWSLambdaFunction(envParser, ${exportName});
2852
2876
 
2853
2877
  export const handler = adapter.handler;
@@ -2905,8 +2929,9 @@ var QueueGenerator = class extends ConstructGenerator {
2905
2929
  const content = `import { AWSLambdaQueue } from '@geekmidas/constructs/aws';
2906
2930
  import { ${exportName} } from '${importPath}';
2907
2931
  ${runtime.imports}
2932
+ ${context.storageDrivers?.imports ?? ""}
2908
2933
  ${runtime.bindings}
2909
-
2934
+ ${context.storageDrivers?.setup ? `\n// The handler registers the drivers its target needs.\n${context.storageDrivers.setup}\n` : ""}
2910
2935
  const adapter = new AWSLambdaQueue(envParser, ${exportName});
2911
2936
 
2912
2937
  export const handler = adapter.handler;
@@ -3336,6 +3361,7 @@ function backendsOf(workspace) {
3336
3361
  async function buildOneApp(input) {
3337
3362
  const { config, options, workspace, appRoot, target } = input;
3338
3363
  const cacheBackend = cacheBackendFor(providerOf(workspace));
3364
+ const eventsBackend = eventsBackendFor(providerOf(workspace));
3339
3365
  const production = normalizeProductionConfig(options.production ?? false);
3340
3366
  if (production) logger$4.log(`🏭 Building for PRODUCTION`);
3341
3367
  logger$4.log(`Building for ${target}`);
@@ -3351,6 +3377,7 @@ async function buildOneApp(input) {
3351
3377
  target,
3352
3378
  enableOpenApi: options.enableOpenApi ?? false,
3353
3379
  cacheBackend,
3380
+ eventsBackend,
3354
3381
  production,
3355
3382
  telescope,
3356
3383
  hooks,
@@ -3396,7 +3423,7 @@ async function writeManifest(input) {
3396
3423
  * dev did not, and failed on exactly the apps the build had learned to handle.
3397
3424
  */
3398
3425
  async function buildApp(input) {
3399
- const { config, workspaceRoot, appRoot, target, enableOpenApi, cacheBackend, production, telescope, databaseApi, hooks, bustCache = false } = input;
3426
+ const { config, workspaceRoot, appRoot, target, enableOpenApi, cacheBackend, eventsBackend, production, telescope, databaseApi, hooks, bustCache = false } = input;
3400
3427
  const constructGlobs = config.constructs;
3401
3428
  const constructSources = {};
3402
3429
  const declared = constructGlobs ? await discover({
@@ -3437,6 +3464,7 @@ async function buildApp(input) {
3437
3464
  appRoot,
3438
3465
  databaseApi
3439
3466
  });
3467
+ const eventsBackends = eventsBackendsIn(declared, eventsBackend);
3440
3468
  const buildContext = {
3441
3469
  ...derived,
3442
3470
  telescope,
@@ -3447,8 +3475,10 @@ async function buildApp(input) {
3447
3475
  emailBackend: "ses",
3448
3476
  storageDrivers: driversFor({
3449
3477
  appRoot,
3450
- cache: cacheBackendsIn(declared, cacheBackend)
3478
+ cache: cacheBackendsIn(declared, cacheBackend),
3479
+ events: eventsBackends
3451
3480
  }),
3481
+ eventsBackends,
3452
3482
  markOptional: input.markOptional ?? false,
3453
3483
  ...production && { telemetry: telemetryFor({
3454
3484
  appRoot,
@@ -5254,25 +5284,25 @@ function loadPackageJson() {
5254
5284
  * Run: pnpm --filter @geekmidas/cli sync-versions
5255
5285
  */
5256
5286
  const GEEKMIDAS_VERSIONS = {
5257
- "@geekmidas/audit": "~10.0.0-alpha.71",
5258
- "@geekmidas/auth": "~10.0.0-alpha.71",
5259
- "@geekmidas/cache": "~10.0.0-alpha.71",
5260
- "@geekmidas/client": "~10.0.0-alpha.71",
5261
- "@geekmidas/cloud": "~10.0.0-alpha.71",
5262
- "@geekmidas/constructs": "~10.0.0-alpha.71",
5263
- "@geekmidas/db": "~10.0.0-alpha.71",
5264
- "@geekmidas/emailkit": "~10.0.0-alpha.71",
5265
- "@geekmidas/envkit": "~10.0.0-alpha.71",
5266
- "@geekmidas/errors": "~10.0.0-alpha.71",
5267
- "@geekmidas/events": "~10.0.0-alpha.71",
5268
- "@geekmidas/logger": "~10.0.0-alpha.71",
5269
- "@geekmidas/manifest": "~10.0.0-alpha.71",
5270
- "@geekmidas/rate-limit": "~10.0.0-alpha.71",
5271
- "@geekmidas/schema": "~10.0.0-alpha.71",
5272
- "@geekmidas/services": "~10.0.0-alpha.71",
5273
- "@geekmidas/storage": "~10.0.0-alpha.71",
5274
- "@geekmidas/telescope": "~10.0.0-alpha.71",
5275
- "@geekmidas/testkit": "~10.0.0-alpha.71",
5287
+ "@geekmidas/audit": "~10.0.0-alpha.72",
5288
+ "@geekmidas/auth": "~10.0.0-alpha.72",
5289
+ "@geekmidas/cache": "~10.0.0-alpha.72",
5290
+ "@geekmidas/client": "~10.0.0-alpha.72",
5291
+ "@geekmidas/cloud": "~10.0.0-alpha.72",
5292
+ "@geekmidas/constructs": "~10.0.0-alpha.72",
5293
+ "@geekmidas/db": "~10.0.0-alpha.72",
5294
+ "@geekmidas/emailkit": "~10.0.0-alpha.72",
5295
+ "@geekmidas/envkit": "~10.0.0-alpha.72",
5296
+ "@geekmidas/errors": "~10.0.0-alpha.72",
5297
+ "@geekmidas/events": "~10.0.0-alpha.72",
5298
+ "@geekmidas/logger": "~10.0.0-alpha.72",
5299
+ "@geekmidas/manifest": "~10.0.0-alpha.72",
5300
+ "@geekmidas/rate-limit": "~10.0.0-alpha.72",
5301
+ "@geekmidas/schema": "~10.0.0-alpha.72",
5302
+ "@geekmidas/services": "~10.0.0-alpha.72",
5303
+ "@geekmidas/storage": "~10.0.0-alpha.72",
5304
+ "@geekmidas/telescope": "~10.0.0-alpha.72",
5305
+ "@geekmidas/testkit": "~10.0.0-alpha.72",
5276
5306
  "@geekmidas/cli": `~${loadPackageJson().version}`
5277
5307
  };
5278
5308
  //#endregion
@@ -10988,6 +11018,7 @@ async function testCommand(options = {}) {
10988
11018
  targets: [workspace.root, ...Object.values(workspace.apps).map((app) => isAbsolute(app.path) ? app.path : join(workspace.root, app.path))],
10989
11019
  patterns: constructGlobs(workspace),
10990
11020
  cacheBackend: backendsOf$1(workspace).cache,
11021
+ eventsBackend: backendsOf$1(workspace).events,
10991
11022
  stage: TEST_STAGE,
10992
11023
  env: finalCredentials,
10993
11024
  factories: join(workspace.root, workspace.test.factories ?? "test/factories")