@geekmidas/cli 9.3.0 → 9.4.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @geekmidas/cli
2
2
 
3
+ ## 9.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#334](https://github.com/geekmidas/toolbox/pull/334) [`b03c43d`](https://github.com/geekmidas/toolbox/commit/b03c43dfd2c86b1daa7f0a47f43e5fb2e518518b) Thanks [@geekmidas](https://github.com/geekmidas)! - Crons report to an uptime monitor with `.uptime()`, which replaces `.monitor()`
8
+
9
+ **Breaking:** `.monitor()` is removed from functions, crons, endpoints and `EndpointFactory`, along with the monitor hooks in the endpoint adaptors. The manifest's `monitoring` field is removed from routes, functions and crons.
10
+
11
+ A monitor only adds something a cron can't report itself: that it didn't run. A function or endpoint runs when it's called, so no ping is ever due, and its failures are already logged where they happen. So uptime is now set on crons alone:
12
+
13
+ ```ts
14
+ export const nightlyReport = c
15
+ .schedule("cron(0 8 * * MON-FRI)")
16
+ .uptime(heartbeat.betterStack("MONITORING_URL"))
17
+ .handle(async () => {});
18
+ ```
19
+
20
+ Calling `.uptime()` again replaces the monitor. `gkm build` records it on the cron's manifest entry as `uptime`, with the period the heartbeat should expect, derived from the schedule by `cronPeriod`:
21
+
22
+ ```ts
23
+ uptime: { type: 'heartbeat', provider: 'betterStack', env: 'MONITORING_URL', period: 259200 }
24
+ ```
25
+
26
+ `MonitorInfo` in `@geekmidas/manifest` is replaced by `UptimeInfo`.
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies [[`b03c43d`](https://github.com/geekmidas/toolbox/commit/b03c43dfd2c86b1daa7f0a47f43e5fb2e518518b)]:
31
+ - @geekmidas/manifest@9.4.0
32
+ - @geekmidas/constructs@9.4.0
33
+ - @geekmidas/envkit@9.4.0
34
+ - @geekmidas/errors@9.4.0
35
+ - @geekmidas/logger@9.4.0
36
+ - @geekmidas/schema@9.4.0
37
+ - @geekmidas/telescope@9.4.0
38
+
3
39
  ## 9.3.0
4
40
 
5
41
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -6,7 +6,7 @@ const require_credentials = require('./credentials-C8DWtnMY.cjs');
6
6
  const require_fullstack_secrets = require('./fullstack-secrets-BYzi6Hwl.cjs');
7
7
  const require_storage = require('./storage-B1wvztiJ.cjs');
8
8
  const require_setup = require('./setup-C2UhXWhN.cjs');
9
- const require_openapi = require('./openapi-C-YgZHyd.cjs');
9
+ const require_openapi = require('./openapi-ayEknaaM.cjs');
10
10
  const require_dokploy_api = require('./dokploy-api-CqOIKHme.cjs');
11
11
  const require_encryption = require('./encryption-MfXAiFTm.cjs');
12
12
  const require_CachedStateProvider = require('./CachedStateProvider-klLWZXWF.cjs');
@@ -37,7 +37,7 @@ const prompts = require_chunk.__toESM(require("prompts"));
37
37
 
38
38
  //#region package.json
39
39
  var name = "@geekmidas/cli";
40
- var version = "9.2.1";
40
+ var version = "9.3.0";
41
41
  var description = "CLI tools for building Lambda handlers, server applications, and generating OpenAPI specs";
42
42
  var private$1 = false;
43
43
  var type = "module";
@@ -383,14 +383,19 @@ var CronGenerator = class extends require_openapi.ConstructGenerator {
383
383
  await (0, node_fs_promises.mkdir)(cronsDir, { recursive: true });
384
384
  for (const { key, construct, path } of constructs) {
385
385
  const handlerFile = await this.generateCronHandler(cronsDir, path.relative, key, context);
386
+ const schedule = schedules.get(key);
387
+ const uptime = construct.getUptime();
386
388
  cronInfos.push({
387
389
  name: key,
388
390
  handler: (0, node_path.relative)(process.cwd(), handlerFile).replace(/\.ts$/, ".handler"),
389
- schedule: schedules.get(key),
391
+ schedule,
390
392
  timeout: construct.timeout,
391
393
  memorySize: construct.memorySize,
392
394
  environment: await construct.getEnvironment({ markOptional: context.markOptional }),
393
- monitoring: construct.getMonitoring()
395
+ ...uptime && { uptime: {
396
+ ...uptime,
397
+ period: (0, __geekmidas_manifest.cronPeriod)(schedule)
398
+ } }
394
399
  });
395
400
  logger$13.log(`Generated cron handler: ${key}`);
396
401
  }
@@ -484,8 +489,7 @@ var FunctionGenerator = class extends require_openapi.ConstructGenerator {
484
489
  handler: (0, node_path.relative)(process.cwd(), handlerFile).replace(/\.ts$/, ".handler"),
485
490
  timeout: construct.timeout,
486
491
  memorySize: construct.memorySize,
487
- environment: await construct.getEnvironment({ markOptional: context.markOptional }),
488
- monitoring: construct.getMonitoring()
492
+ environment: await construct.getEnvironment({ markOptional: context.markOptional })
489
493
  });
490
494
  logger$13.log(`Generated function handler: ${key}`);
491
495
  }
@@ -6943,25 +6947,25 @@ const CLI_VERSION = `~${pkg.version}`;
6943
6947
  * Run: pnpm --filter @geekmidas/cli sync-versions
6944
6948
  */
6945
6949
  const GEEKMIDAS_VERSIONS = {
6946
- "@geekmidas/audit": "~9.2.1",
6947
- "@geekmidas/auth": "~9.2.1",
6948
- "@geekmidas/cache": "~9.2.1",
6949
- "@geekmidas/client": "~9.2.1",
6950
- "@geekmidas/cloud": "~9.2.1",
6951
- "@geekmidas/constructs": "~9.2.1",
6952
- "@geekmidas/db": "~9.2.1",
6953
- "@geekmidas/emailkit": "~9.2.1",
6954
- "@geekmidas/envkit": "~9.2.1",
6955
- "@geekmidas/errors": "~9.2.1",
6956
- "@geekmidas/events": "~9.2.1",
6957
- "@geekmidas/logger": "~9.2.1",
6958
- "@geekmidas/rate-limit": "~9.2.1",
6959
- "@geekmidas/schema": "~9.2.1",
6960
- "@geekmidas/services": "~9.2.1",
6961
- "@geekmidas/storage": "~9.2.1",
6962
- "@geekmidas/studio": "~9.2.1",
6963
- "@geekmidas/telescope": "~9.2.1",
6964
- "@geekmidas/testkit": "~9.2.1",
6950
+ "@geekmidas/audit": "~9.3.0",
6951
+ "@geekmidas/auth": "~9.3.0",
6952
+ "@geekmidas/cache": "~9.3.0",
6953
+ "@geekmidas/client": "~9.3.0",
6954
+ "@geekmidas/cloud": "~9.3.0",
6955
+ "@geekmidas/constructs": "~9.3.0",
6956
+ "@geekmidas/db": "~9.3.0",
6957
+ "@geekmidas/emailkit": "~9.3.0",
6958
+ "@geekmidas/envkit": "~9.3.0",
6959
+ "@geekmidas/errors": "~9.3.0",
6960
+ "@geekmidas/events": "~9.3.0",
6961
+ "@geekmidas/logger": "~9.3.0",
6962
+ "@geekmidas/rate-limit": "~9.3.0",
6963
+ "@geekmidas/schema": "~9.3.0",
6964
+ "@geekmidas/services": "~9.3.0",
6965
+ "@geekmidas/storage": "~9.3.0",
6966
+ "@geekmidas/studio": "~9.3.0",
6967
+ "@geekmidas/telescope": "~9.3.0",
6968
+ "@geekmidas/testkit": "~9.3.0",
6965
6969
  "@geekmidas/cli": CLI_VERSION
6966
6970
  };
6967
6971