@geekmidas/cli 10.0.0-alpha.4 → 10.0.0-alpha.5
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/config.d.cts +2 -2
- package/dist/{index-DCtipn2h.d.cts → index-CHB4tSzX.d.cts} +2 -2
- package/dist/{index-DCtipn2h.d.cts.map → index-CHB4tSzX.d.cts.map} +1 -1
- package/dist/index.cjs +59 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +59 -92
- package/dist/index.mjs.map +1 -1
- package/dist/openapi.d.cts +1 -1
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/{types-BhIl-COG.d.cts → types-abJQuk7m.d.cts} +4 -4
- package/dist/{types-BhIl-COG.d.cts.map → types-abJQuk7m.d.cts.map} +1 -1
- package/dist/workspace/index.d.cts +2 -2
- package/package.json +11 -11
package/dist/config.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GkmConfig, LoadedConfig, NormalizedAppConfig, NormalizedWorkspace, WorkspaceConfig } from "./types-
|
|
2
|
-
import { defineWorkspace } from "./index-
|
|
1
|
+
import { GkmConfig, LoadedConfig, NormalizedAppConfig, NormalizedWorkspace, WorkspaceConfig } from "./types-abJQuk7m.cjs";
|
|
2
|
+
import { defineWorkspace } from "./index-CHB4tSzX.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/config.d.ts
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppsRecord, Framework, GkmConfig, InferredWorkspaceConfig, LoadedConfig, NormalizedWorkspace, Routes, WorkspaceConfig, WorkspaceInput } from "./types-
|
|
1
|
+
import { AppsRecord, Framework, GkmConfig, InferredWorkspaceConfig, LoadedConfig, NormalizedWorkspace, Routes, WorkspaceConfig, WorkspaceInput } from "./types-abJQuk7m.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/workspace/publicEnv.d.ts
|
|
4
4
|
|
|
@@ -172,4 +172,4 @@ declare function getEndpointForStage(dokployConfig: {
|
|
|
172
172
|
//# sourceMappingURL=index.d.ts.map
|
|
173
173
|
//#endregion
|
|
174
174
|
export { PUBLIC_ENV_PREFIXES, allConstructGlobs, appConstructGlobs, constructPatterns, defineWorkspace, getAppBuildOrder, getAppGkmConfig, getDependencyEnvVars, getEndpointForStage, getPublicEnvPrefix, normalizeWorkspace, processConfig, stripPublicPrefix, workspaceConstructGlobs, wrapSingleAppAsWorkspace };
|
|
175
|
-
//# sourceMappingURL=index-
|
|
175
|
+
//# sourceMappingURL=index-CHB4tSzX.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-CHB4tSzX.d.cts","names":[],"sources":["../src/workspace/publicEnv.ts","../src/workspace/index.ts"],"sourcesContent":[],"mappings":";;;;;;AASA;AAoBA;AAoBA;;;cAxCa;AC0Hb;;;;;;;AAE0B;AA8B1B;;;;AAGsB;AA8CtB;AAAwC,iBDvLxB,kBAAA,CCuLwB,SAAA,CAAA,EDvLO,SCuLP,CAAA,EAAA,MAAA;;;AAGlB;AA6EtB;AAA6B,iBDnPb,iBAAA,CCmPa,IAAA,EAAA,MAAA,CAAA,EAAA,MAAA,GAAA,IAAA;;;;;;;;AAjK7B;;;;;;;AAE0B;AA8B1B;;;;AAGsB;AA8CtB;;;;AAGsB;AA6EtB;;;;;AAGe;AA6Bf;AAmBA;AAwBA;AAaA;AAiBA;;;;AAGY;AAuCZ;AAmCA;;;;AAIS;AAgDO,iBA3YA,eA6YqB,CAAA,oBA7Ye,UA6YT,CAAA,CAAA,MAAA,EA5YlC,cA4YkC,CA5YnB,KA4YmB,CAAA,CAAA,EA3YxC,uBA2YwC,CA3YhB,KA2YgB,CAAA;;;;iBA7W3B,kBAAA,SACP,+BAEN;;;;;iBA8Ca,wBAAA,SACP,yBAEN;;;;;iBA6Ea,aAAA,SACP,YAAY,+BAElB;;;;;;;iBA6Ba,uBAAA,YACJ;;;;;;;;;;;;iBAkBI,iBAAA,YACJ;;;;;;;iBAuBI,iBAAA,YAA6B;;iBAa7B,iBAAA,SAA0B;;;;;iBAiB1B,eAAA,YACJ,uCAET;;;;;iBAuCa,gBAAA,YAA4B;;;;;;;;;;iBAmC5B,oBAAA,YACJ,2DAGT;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgDa,mBAAA;;cAEqB"}
|
package/dist/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@ const prompts = require_chunk.__toESM(require("prompts"));
|
|
|
43
43
|
|
|
44
44
|
//#region package.json
|
|
45
45
|
var name = "@geekmidas/cli";
|
|
46
|
-
var version = "10.0.0-alpha.
|
|
46
|
+
var version = "10.0.0-alpha.4";
|
|
47
47
|
var description = "CLI tools for building Lambda handlers, server applications, and generating OpenAPI specs";
|
|
48
48
|
var private$1 = false;
|
|
49
49
|
var type = "module";
|
|
@@ -7814,26 +7814,26 @@ const CLI_VERSION = `~${pkg.version}`;
|
|
|
7814
7814
|
* Run: pnpm --filter @geekmidas/cli sync-versions
|
|
7815
7815
|
*/
|
|
7816
7816
|
const GEEKMIDAS_VERSIONS = {
|
|
7817
|
-
"@geekmidas/audit": "~10.0.0-alpha.
|
|
7818
|
-
"@geekmidas/auth": "~10.0.0-alpha.
|
|
7819
|
-
"@geekmidas/cache": "~10.0.0-alpha.
|
|
7820
|
-
"@geekmidas/client": "~10.0.0-alpha.
|
|
7821
|
-
"@geekmidas/cloud": "~10.0.0-alpha.
|
|
7822
|
-
"@geekmidas/constructs": "~10.0.0-alpha.
|
|
7823
|
-
"@geekmidas/db": "~10.0.0-alpha.
|
|
7824
|
-
"@geekmidas/emailkit": "~10.0.0-alpha.
|
|
7825
|
-
"@geekmidas/envkit": "~10.0.0-alpha.
|
|
7826
|
-
"@geekmidas/errors": "~10.0.0-alpha.
|
|
7827
|
-
"@geekmidas/events": "~10.0.0-alpha.
|
|
7828
|
-
"@geekmidas/logger": "~10.0.0-alpha.
|
|
7829
|
-
"@geekmidas/manifest": "~10.0.0-alpha.
|
|
7830
|
-
"@geekmidas/rate-limit": "~10.0.0-alpha.
|
|
7831
|
-
"@geekmidas/schema": "~10.0.0-alpha.
|
|
7832
|
-
"@geekmidas/services": "~10.0.0-alpha.
|
|
7833
|
-
"@geekmidas/storage": "~10.0.0-alpha.
|
|
7834
|
-
"@geekmidas/studio": "~10.0.0-alpha.
|
|
7835
|
-
"@geekmidas/telescope": "~10.0.0-alpha.
|
|
7836
|
-
"@geekmidas/testkit": "~10.0.0-alpha.
|
|
7817
|
+
"@geekmidas/audit": "~10.0.0-alpha.4",
|
|
7818
|
+
"@geekmidas/auth": "~10.0.0-alpha.4",
|
|
7819
|
+
"@geekmidas/cache": "~10.0.0-alpha.4",
|
|
7820
|
+
"@geekmidas/client": "~10.0.0-alpha.4",
|
|
7821
|
+
"@geekmidas/cloud": "~10.0.0-alpha.4",
|
|
7822
|
+
"@geekmidas/constructs": "~10.0.0-alpha.4",
|
|
7823
|
+
"@geekmidas/db": "~10.0.0-alpha.4",
|
|
7824
|
+
"@geekmidas/emailkit": "~10.0.0-alpha.4",
|
|
7825
|
+
"@geekmidas/envkit": "~10.0.0-alpha.4",
|
|
7826
|
+
"@geekmidas/errors": "~10.0.0-alpha.4",
|
|
7827
|
+
"@geekmidas/events": "~10.0.0-alpha.4",
|
|
7828
|
+
"@geekmidas/logger": "~10.0.0-alpha.4",
|
|
7829
|
+
"@geekmidas/manifest": "~10.0.0-alpha.4",
|
|
7830
|
+
"@geekmidas/rate-limit": "~10.0.0-alpha.4",
|
|
7831
|
+
"@geekmidas/schema": "~10.0.0-alpha.4",
|
|
7832
|
+
"@geekmidas/services": "~10.0.0-alpha.4",
|
|
7833
|
+
"@geekmidas/storage": "~10.0.0-alpha.4",
|
|
7834
|
+
"@geekmidas/studio": "~10.0.0-alpha.4",
|
|
7835
|
+
"@geekmidas/telescope": "~10.0.0-alpha.4",
|
|
7836
|
+
"@geekmidas/testkit": "~10.0.0-alpha.4",
|
|
7837
7837
|
"@geekmidas/cli": CLI_VERSION
|
|
7838
7838
|
};
|
|
7839
7839
|
|
|
@@ -10480,6 +10480,23 @@ export const telescope = new Telescope({
|
|
|
10480
10480
|
|
|
10481
10481
|
//#endregion
|
|
10482
10482
|
//#region src/init/templates/worker.ts
|
|
10483
|
+
/**
|
|
10484
|
+
* A project that is background work and nothing else.
|
|
10485
|
+
*
|
|
10486
|
+
* It used to scaffold a `RestApi` with no endpoints on it — an HTTP surface
|
|
10487
|
+
* declared by a project whose premise is that nothing calls it over HTTP —
|
|
10488
|
+
* because a surface was the only construct that made an app exist and the only
|
|
10489
|
+
* way to get a logger into the generated runtime. `Worker` is the construct
|
|
10490
|
+
* that was missing: it takes no authorizer, publishes no address, and hands out
|
|
10491
|
+
* factories already carrying its logger.
|
|
10492
|
+
*
|
|
10493
|
+
* It scaffolds no cron. A cron is the obvious thing to put in a worker and it
|
|
10494
|
+
* would not run: `CronGenerator` emits handlers for `aws-lambda` only, and
|
|
10495
|
+
* `.gkm/server/` has no crons file, so a scheduled job on a server target
|
|
10496
|
+
* deploys nothing at all. Subscribers and queues do have a server runtime,
|
|
10497
|
+
* which is why those are what this template teaches. The cron example returns
|
|
10498
|
+
* when there is a scheduler to run it.
|
|
10499
|
+
*/
|
|
10483
10500
|
const workerTemplate = {
|
|
10484
10501
|
name: "worker",
|
|
10485
10502
|
description: "Background job processing",
|
|
@@ -10489,11 +10506,8 @@ const workerTemplate = {
|
|
|
10489
10506
|
"@geekmidas/envkit": GEEKMIDAS_VERSIONS["@geekmidas/envkit"],
|
|
10490
10507
|
"@geekmidas/events": GEEKMIDAS_VERSIONS["@geekmidas/events"],
|
|
10491
10508
|
"@geekmidas/logger": GEEKMIDAS_VERSIONS["@geekmidas/logger"],
|
|
10492
|
-
"@geekmidas/rate-limit": GEEKMIDAS_VERSIONS["@geekmidas/rate-limit"],
|
|
10493
10509
|
"@geekmidas/schema": GEEKMIDAS_VERSIONS["@geekmidas/schema"],
|
|
10494
|
-
|
|
10495
|
-
hono: "~4.8.2",
|
|
10496
|
-
pino: "~9.6.0"
|
|
10510
|
+
pino: "~10.3.1"
|
|
10497
10511
|
},
|
|
10498
10512
|
devDependencies: {
|
|
10499
10513
|
"@biomejs/biome": "~2.3.0",
|
|
@@ -10515,34 +10529,18 @@ const workerTemplate = {
|
|
|
10515
10529
|
"fmt:check": "biome format ."
|
|
10516
10530
|
},
|
|
10517
10531
|
files: (options) => {
|
|
10518
|
-
const { loggerType,
|
|
10532
|
+
const { loggerType, name: name$1 } = options;
|
|
10519
10533
|
const loggerContent = `import { createLogger } from '@geekmidas/logger/${loggerType}';
|
|
10520
10534
|
|
|
10521
10535
|
export const logger = createLogger();
|
|
10522
10536
|
`;
|
|
10523
|
-
const getRoutePath = (file) => {
|
|
10524
|
-
switch (routesStructure) {
|
|
10525
|
-
case "centralized-endpoints": return `src/endpoints/${file}`;
|
|
10526
|
-
case "centralized-routes": return `src/routes/${file}`;
|
|
10527
|
-
case "domain-based": return `src/${file.replace(".ts", "")}/routes/index.ts`;
|
|
10528
|
-
}
|
|
10529
|
-
};
|
|
10530
|
-
const apiImport = routesStructure === "domain-based" ? "../../constructs/api.js" : "../constructs/api.js";
|
|
10531
10537
|
const files$1 = [
|
|
10532
10538
|
{
|
|
10533
|
-
path: "src/constructs/
|
|
10534
|
-
content: `import {
|
|
10539
|
+
path: "src/constructs/worker.ts",
|
|
10540
|
+
content: `import { Worker } from '@geekmidas/constructs/worker';
|
|
10535
10541
|
import { logger } from '../config/logger.ts';
|
|
10536
10542
|
|
|
10537
|
-
export const
|
|
10538
|
-
// Typed out rather than omitted: an API that ships open because a field was
|
|
10539
|
-
// left off is the one default worth refusing to have.
|
|
10540
|
-
defaultAuthorizer: 'none',
|
|
10541
|
-
|
|
10542
|
-
// The actual logger, not a path to one. Every endpoint built from this
|
|
10543
|
-
// surface runs with it, and so does the generated entry.
|
|
10544
|
-
logger,
|
|
10545
|
-
});
|
|
10543
|
+
export const worker = new Worker('Jobs', { logger });
|
|
10546
10544
|
`
|
|
10547
10545
|
},
|
|
10548
10546
|
{
|
|
@@ -10566,23 +10564,6 @@ export const config = envParser
|
|
|
10566
10564
|
path: "src/config/logger.ts",
|
|
10567
10565
|
content: loggerContent
|
|
10568
10566
|
},
|
|
10569
|
-
{
|
|
10570
|
-
path: getRoutePath("health.ts"),
|
|
10571
|
-
content: `import { z } from 'zod';
|
|
10572
|
-
import { api } from '${apiImport}';
|
|
10573
|
-
|
|
10574
|
-
export const healthEndpoint = api
|
|
10575
|
-
.get('/health')
|
|
10576
|
-
.output(z.object({
|
|
10577
|
-
status: z.string(),
|
|
10578
|
-
timestamp: z.string(),
|
|
10579
|
-
}))
|
|
10580
|
-
.handle(async () => ({
|
|
10581
|
-
status: 'ok',
|
|
10582
|
-
timestamp: new Date().toISOString(),
|
|
10583
|
-
}));
|
|
10584
|
-
`
|
|
10585
|
-
},
|
|
10586
10567
|
{
|
|
10587
10568
|
path: "src/events/types.ts",
|
|
10588
10569
|
content: `import type { PublishableMessage } from '@geekmidas/events';
|
|
@@ -10624,42 +10605,28 @@ export const eventsPublisherService = {
|
|
|
10624
10605
|
},
|
|
10625
10606
|
{
|
|
10626
10607
|
path: "src/subscribers/user-events.ts",
|
|
10627
|
-
content: `import {
|
|
10608
|
+
content: `import { worker } from '~/constructs/worker.ts';
|
|
10628
10609
|
import { eventsPublisherService } from '~/events/publisher.ts';
|
|
10629
10610
|
|
|
10630
|
-
export const userEventsSubscriber =
|
|
10611
|
+
export const userEventsSubscriber = worker.subscribers
|
|
10631
10612
|
.publisher(eventsPublisherService)
|
|
10632
10613
|
.subscribe(['user.created', 'user.updated'])
|
|
10633
|
-
.handle(async ({
|
|
10634
|
-
|
|
10635
|
-
|
|
10636
|
-
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
|
|
10642
|
-
|
|
10643
|
-
|
|
10644
|
-
|
|
10614
|
+
.handle(async ({ events, logger }) => {
|
|
10615
|
+
// A batch, not a single event. Both transports deliver in batches, so
|
|
10616
|
+
// handling them one at a time is a round trip per event for no reason.
|
|
10617
|
+
logger.info({ count: events.length }, 'Processing user events');
|
|
10618
|
+
|
|
10619
|
+
for (const event of events) {
|
|
10620
|
+
switch (event.type) {
|
|
10621
|
+
case 'user.created':
|
|
10622
|
+
logger.info({ userId: event.payload.userId }, 'New user created');
|
|
10623
|
+
break;
|
|
10624
|
+
case 'user.updated':
|
|
10625
|
+
logger.info({ userId: event.payload.userId }, 'User updated');
|
|
10626
|
+
break;
|
|
10627
|
+
}
|
|
10645
10628
|
}
|
|
10646
10629
|
});
|
|
10647
|
-
`
|
|
10648
|
-
},
|
|
10649
|
-
{
|
|
10650
|
-
path: "src/crons/cleanup.ts",
|
|
10651
|
-
content: `import { cron } from '@geekmidas/constructs/crons';
|
|
10652
|
-
|
|
10653
|
-
// Run every day at midnight
|
|
10654
|
-
export const cleanupCron = cron('0 0 * * *')
|
|
10655
|
-
.handle(async ({ logger }) => {
|
|
10656
|
-
logger.info('Running cleanup job');
|
|
10657
|
-
|
|
10658
|
-
// Add your cleanup logic here
|
|
10659
|
-
// e.g., delete old sessions, clean up temp files, etc.
|
|
10660
|
-
|
|
10661
|
-
logger.info('Cleanup job completed');
|
|
10662
|
-
});
|
|
10663
10630
|
`
|
|
10664
10631
|
}
|
|
10665
10632
|
];
|