@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.cjs CHANGED
@@ -8,11 +8,11 @@ const require_derive = require("./derive-DAbo49sm.cjs");
8
8
  const require_workspace = require("./workspace-vdrcRI-m.cjs");
9
9
  const require_config = require("./config.cjs");
10
10
  const require_state = require("./state-CCuTJNRH.cjs");
11
- const require_OpenApiTsGenerator = require("./OpenApiTsGenerator-DZZwHdDC.cjs");
11
+ const require_OpenApiTsGenerator = require("./OpenApiTsGenerator-BlP53kf2.cjs");
12
12
  const require_sniffer = require("./sniffer-DpHpFZBD.cjs");
13
13
  const require_openapi = require("./openapi.cjs");
14
14
  const require_appPorts = require("./appPorts-Cu79hJF6.cjs");
15
- const require_ready = require("./ready-Dp6arkI4.cjs");
15
+ const require_ready = require("./ready-B-7LayMF.cjs");
16
16
  const require_emit = require("./emit-Dmc1nvdS.cjs");
17
17
  const require_deploy = require("./deploy-CZE0m6jd.cjs");
18
18
  const require_compose = require("./compose-B-MME-4C.cjs");
@@ -53,7 +53,7 @@ let _geekmidas_constructs_functions = require("@geekmidas/constructs/functions")
53
53
  let _geekmidas_constructs_queue = require("@geekmidas/constructs/queue");
54
54
  let _geekmidas_constructs_topic = require("@geekmidas/constructs/topic");
55
55
  //#region package.json
56
- var version = "10.0.0-alpha.71";
56
+ var version = "10.0.0-alpha.72";
57
57
  //#endregion
58
58
  //#region src/prompt.ts
59
59
  /**
@@ -1680,6 +1680,7 @@ async function devCommand(options) {
1680
1680
  target: "server",
1681
1681
  enableOpenApi,
1682
1682
  cacheBackend: require_state.cacheBackendFor(require_state.providerOf(workspace ?? config)),
1683
+ eventsBackend: require_state.eventsBackendFor(require_state.providerOf(workspace ?? config)),
1683
1684
  telescope,
1684
1685
  databaseApi: true,
1685
1686
  hooks,
@@ -2649,6 +2650,22 @@ var CronGenerator = class extends require_discover.ConstructGenerator {
2649
2650
  async generateServerCronsFile(outputDir, crons) {
2650
2651
  await (0, node_fs_promises.mkdir)(outputDir, { recursive: true });
2651
2652
  const cronsPath = (0, node_path.join)(outputDir, "crons.ts");
2653
+ if (crons.length === 0) {
2654
+ await (0, node_fs_promises.writeFile)(cronsPath, `/**
2655
+ * Generated cron setup — this app declares none.
2656
+ */
2657
+ import type { EnvironmentParser } from '@geekmidas/envkit';
2658
+ import type { Logger } from '@geekmidas/logger';
2659
+
2660
+ export async function setupCrons(
2661
+ _envParser: EnvironmentParser<any>,
2662
+ _logger: Logger,
2663
+ ): Promise<void> {}
2664
+
2665
+ export async function stopCrons(): Promise<void> {}
2666
+ `);
2667
+ return cronsPath;
2668
+ }
2652
2669
  const importsByFile = /* @__PURE__ */ new Map();
2653
2670
  for (const { path, key } of crons) {
2654
2671
  const importPath = (0, node_path.relative)((0, node_path.dirname)(cronsPath), path.relative).replace(/\.ts$/, ".js");
@@ -2758,8 +2775,13 @@ export async function setupCrons(
2758
2775
  return;
2759
2776
  }
2760
2777
 
2761
- const { PgBossConnection } = await import('@geekmidas/events/pgboss');
2762
- const connection = await PgBossConnection.fromConnectionString(url);
2778
+ // Through the registered pg-boss driver, which the entry registers for a
2779
+ // server whose broker is pg-boss. Naming \`@geekmidas/events/pgboss\` here
2780
+ // made every bundle with a cron resolve pg-boss, whatever its broker.
2781
+ const { EventConnectionFactory } = await import('@geekmidas/events');
2782
+ const connection = (await EventConnectionFactory.fromConnectionString(
2783
+ url,
2784
+ )) as import('@geekmidas/events').EventConnection & { instance?: any };
2763
2785
  const boss = connection.instance!;
2764
2786
 
2765
2787
  // What this app declares now. Anything else under the prefix belonged to a
@@ -2807,8 +2829,9 @@ export async function stopCrons(): Promise<void> {
2807
2829
  const content = `import { AWSScheduledFunction } from '@geekmidas/constructs/aws';
2808
2830
  import { ${exportName} } from '${importPath}';
2809
2831
  ${runtime.imports}
2832
+ ${context.storageDrivers?.imports ?? ""}
2810
2833
  ${runtime.bindings}
2811
-
2834
+ ${context.storageDrivers?.setup ? `\n// The handler registers the drivers its target needs.\n${context.storageDrivers.setup}\n` : ""}
2812
2835
  const adapter = new AWSScheduledFunction(envParser, ${exportName});
2813
2836
 
2814
2837
  export const handler = adapter.handler;
@@ -2852,8 +2875,9 @@ var FunctionGenerator = class extends require_discover.ConstructGenerator {
2852
2875
  const content = `import { AWSLambdaFunction } from '@geekmidas/constructs/aws';
2853
2876
  import { ${exportName} } from '${importPath}';
2854
2877
  ${runtime.imports}
2878
+ ${context.storageDrivers?.imports ?? ""}
2855
2879
  ${runtime.bindings}
2856
-
2880
+ ${context.storageDrivers?.setup ? `\n// The handler registers the drivers its target needs.\n${context.storageDrivers.setup}\n` : ""}
2857
2881
  const adapter = new AWSLambdaFunction(envParser, ${exportName});
2858
2882
 
2859
2883
  export const handler = adapter.handler;
@@ -2911,8 +2935,9 @@ var QueueGenerator = class extends require_discover.ConstructGenerator {
2911
2935
  const content = `import { AWSLambdaQueue } from '@geekmidas/constructs/aws';
2912
2936
  import { ${exportName} } from '${importPath}';
2913
2937
  ${runtime.imports}
2938
+ ${context.storageDrivers?.imports ?? ""}
2914
2939
  ${runtime.bindings}
2915
-
2940
+ ${context.storageDrivers?.setup ? `\n// The handler registers the drivers its target needs.\n${context.storageDrivers.setup}\n` : ""}
2916
2941
  const adapter = new AWSLambdaQueue(envParser, ${exportName});
2917
2942
 
2918
2943
  export const handler = adapter.handler;
@@ -3342,6 +3367,7 @@ function backendsOf(workspace) {
3342
3367
  async function buildOneApp(input) {
3343
3368
  const { config, options, workspace, appRoot, target } = input;
3344
3369
  const cacheBackend = require_state.cacheBackendFor(require_state.providerOf(workspace));
3370
+ const eventsBackend = require_state.eventsBackendFor(require_state.providerOf(workspace));
3345
3371
  const production = normalizeProductionConfig(options.production ?? false);
3346
3372
  if (production) logger$4.log(`🏭 Building for PRODUCTION`);
3347
3373
  logger$4.log(`Building for ${target}`);
@@ -3357,6 +3383,7 @@ async function buildOneApp(input) {
3357
3383
  target,
3358
3384
  enableOpenApi: options.enableOpenApi ?? false,
3359
3385
  cacheBackend,
3386
+ eventsBackend,
3360
3387
  production,
3361
3388
  telescope,
3362
3389
  hooks,
@@ -3402,7 +3429,7 @@ async function writeManifest(input) {
3402
3429
  * dev did not, and failed on exactly the apps the build had learned to handle.
3403
3430
  */
3404
3431
  async function buildApp(input) {
3405
- const { config, workspaceRoot, appRoot, target, enableOpenApi, cacheBackend, production, telescope, databaseApi, hooks, bustCache = false } = input;
3432
+ const { config, workspaceRoot, appRoot, target, enableOpenApi, cacheBackend, eventsBackend, production, telescope, databaseApi, hooks, bustCache = false } = input;
3406
3433
  const constructGlobs = config.constructs;
3407
3434
  const constructSources = {};
3408
3435
  const declared = constructGlobs ? await require_discover.discover({
@@ -3443,6 +3470,7 @@ async function buildApp(input) {
3443
3470
  appRoot,
3444
3471
  databaseApi
3445
3472
  });
3473
+ const eventsBackends = require_ready.eventsBackendsIn(declared, eventsBackend);
3446
3474
  const buildContext = {
3447
3475
  ...derived,
3448
3476
  telescope,
@@ -3453,8 +3481,10 @@ async function buildApp(input) {
3453
3481
  emailBackend: "ses",
3454
3482
  storageDrivers: require_ready.driversFor({
3455
3483
  appRoot,
3456
- cache: require_ready.cacheBackendsIn(declared, cacheBackend)
3484
+ cache: require_ready.cacheBackendsIn(declared, cacheBackend),
3485
+ events: eventsBackends
3457
3486
  }),
3487
+ eventsBackends,
3458
3488
  markOptional: input.markOptional ?? false,
3459
3489
  ...production && { telemetry: require_OpenApiTsGenerator.telemetryFor({
3460
3490
  appRoot,
@@ -5260,25 +5290,25 @@ function loadPackageJson() {
5260
5290
  * Run: pnpm --filter @geekmidas/cli sync-versions
5261
5291
  */
5262
5292
  const GEEKMIDAS_VERSIONS = {
5263
- "@geekmidas/audit": "~10.0.0-alpha.71",
5264
- "@geekmidas/auth": "~10.0.0-alpha.71",
5265
- "@geekmidas/cache": "~10.0.0-alpha.71",
5266
- "@geekmidas/client": "~10.0.0-alpha.71",
5267
- "@geekmidas/cloud": "~10.0.0-alpha.71",
5268
- "@geekmidas/constructs": "~10.0.0-alpha.71",
5269
- "@geekmidas/db": "~10.0.0-alpha.71",
5270
- "@geekmidas/emailkit": "~10.0.0-alpha.71",
5271
- "@geekmidas/envkit": "~10.0.0-alpha.71",
5272
- "@geekmidas/errors": "~10.0.0-alpha.71",
5273
- "@geekmidas/events": "~10.0.0-alpha.71",
5274
- "@geekmidas/logger": "~10.0.0-alpha.71",
5275
- "@geekmidas/manifest": "~10.0.0-alpha.71",
5276
- "@geekmidas/rate-limit": "~10.0.0-alpha.71",
5277
- "@geekmidas/schema": "~10.0.0-alpha.71",
5278
- "@geekmidas/services": "~10.0.0-alpha.71",
5279
- "@geekmidas/storage": "~10.0.0-alpha.71",
5280
- "@geekmidas/telescope": "~10.0.0-alpha.71",
5281
- "@geekmidas/testkit": "~10.0.0-alpha.71",
5293
+ "@geekmidas/audit": "~10.0.0-alpha.72",
5294
+ "@geekmidas/auth": "~10.0.0-alpha.72",
5295
+ "@geekmidas/cache": "~10.0.0-alpha.72",
5296
+ "@geekmidas/client": "~10.0.0-alpha.72",
5297
+ "@geekmidas/cloud": "~10.0.0-alpha.72",
5298
+ "@geekmidas/constructs": "~10.0.0-alpha.72",
5299
+ "@geekmidas/db": "~10.0.0-alpha.72",
5300
+ "@geekmidas/emailkit": "~10.0.0-alpha.72",
5301
+ "@geekmidas/envkit": "~10.0.0-alpha.72",
5302
+ "@geekmidas/errors": "~10.0.0-alpha.72",
5303
+ "@geekmidas/events": "~10.0.0-alpha.72",
5304
+ "@geekmidas/logger": "~10.0.0-alpha.72",
5305
+ "@geekmidas/manifest": "~10.0.0-alpha.72",
5306
+ "@geekmidas/rate-limit": "~10.0.0-alpha.72",
5307
+ "@geekmidas/schema": "~10.0.0-alpha.72",
5308
+ "@geekmidas/services": "~10.0.0-alpha.72",
5309
+ "@geekmidas/storage": "~10.0.0-alpha.72",
5310
+ "@geekmidas/telescope": "~10.0.0-alpha.72",
5311
+ "@geekmidas/testkit": "~10.0.0-alpha.72",
5282
5312
  "@geekmidas/cli": `~${loadPackageJson().version}`
5283
5313
  };
5284
5314
  //#endregion
@@ -10994,6 +11024,7 @@ async function testCommand(options = {}) {
10994
11024
  targets: [workspace.root, ...Object.values(workspace.apps).map((app) => (0, node_path.isAbsolute)(app.path) ? app.path : (0, node_path.join)(workspace.root, app.path))],
10995
11025
  patterns: require_state.constructGlobs(workspace),
10996
11026
  cacheBackend: require_state.backendsOf(workspace).cache,
11027
+ eventsBackend: require_state.backendsOf(workspace).events,
10997
11028
  stage: require_workspace.TEST_STAGE,
10998
11029
  env: finalCredentials,
10999
11030
  factories: (0, node_path.join)(workspace.root, workspace.test.factories ?? "test/factories")