@geekmidas/cli 9.3.0 → 9.5.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 +76 -0
- package/dist/index.cjs +41 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +42 -27
- package/dist/index.mjs.map +1 -1
- package/dist/{openapi-BlIiUahn.mjs → openapi-Dm1_sCxe.mjs} +4 -8
- package/dist/openapi-Dm1_sCxe.mjs.map +1 -0
- package/dist/{openapi-C-YgZHyd.cjs → openapi-ayEknaaM.cjs} +4 -8
- package/dist/openapi-ayEknaaM.cjs.map +1 -0
- package/dist/openapi.cjs +1 -1
- package/dist/openapi.mjs +1 -1
- package/package.json +9 -9
- package/src/generators/CronGenerator.ts +6 -2
- package/src/generators/EndpointGenerator.ts +0 -13
- package/src/generators/FunctionGenerator.ts +0 -1
- package/src/generators/QueueGenerator.ts +12 -1
- package/src/generators/__tests__/CronGenerator.spec.ts +14 -7
- package/src/generators/__tests__/EndpointGenerator.spec.ts +2 -80
- package/src/generators/__tests__/FunctionGenerator.spec.ts +0 -20
- package/src/generators/__tests__/QueueGenerator.spec.ts +4 -0
- package/src/init/versions.ts +19 -19
- package/dist/openapi-BlIiUahn.mjs.map +0 -1
- package/dist/openapi-C-YgZHyd.cjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { getCredentialsPath, getDokployCredentials, getDokployRegistryId, getDok
|
|
|
6
6
|
import { createStageSecrets, generateDbPassword, generateDbUrl, generateFullstackCustomSecrets, rotateServicePassword } from "./fullstack-secrets-l8s3II_H.mjs";
|
|
7
7
|
import { getKeyPath, maskPassword, readStageSecrets, secretsExist, setCustomSecret, toEmbeddableSecrets, writeStageSecrets } from "./storage-dbb9RyBl.mjs";
|
|
8
8
|
import { createCredentialsPreload, createEntryWrapper, findAvailablePort, isPortAvailable, loadEnvFiles, loadSecretsForApp, prepareEntryCredentials, resolveServicePorts, rewriteUrlsWithPorts, setupCommand, startWorkspaceServices } from "./setup-A-BX8JUm.mjs";
|
|
9
|
-
import { ConstructGenerator, EndpointGenerator, OPENAPI_OUTPUT_PATH, generateOpenApi, isPartitionedRoutes, normalizeRoutes, openapiCommand, resolveOpenApiConfig } from "./openapi-
|
|
9
|
+
import { ConstructGenerator, EndpointGenerator, OPENAPI_OUTPUT_PATH, generateOpenApi, isPartitionedRoutes, normalizeRoutes, openapiCommand, resolveOpenApiConfig } from "./openapi-Dm1_sCxe.mjs";
|
|
10
10
|
import { DokployApi } from "./dokploy-api-sfZFlWuE.mjs";
|
|
11
11
|
import { encryptSecrets } from "./encryption-CO5Q4Bhf.mjs";
|
|
12
12
|
import { CachedStateProvider } from "./CachedStateProvider-CzyFct42.mjs";
|
|
@@ -25,7 +25,7 @@ import fg from "fast-glob";
|
|
|
25
25
|
import { parse as parse$1 } from "yaml";
|
|
26
26
|
import { randomBytes } from "node:crypto";
|
|
27
27
|
import { Cron } from "@geekmidas/constructs/crons";
|
|
28
|
-
import { InvalidCronExpressionError, toAwsCron } from "@geekmidas/manifest";
|
|
28
|
+
import { InvalidCronExpressionError, cronPeriod, toAwsCron } from "@geekmidas/manifest";
|
|
29
29
|
import { Function } from "@geekmidas/constructs/functions";
|
|
30
30
|
import { Queue } from "@geekmidas/constructs/queue";
|
|
31
31
|
import { Subscriber } from "@geekmidas/constructs/subscribers";
|
|
@@ -37,7 +37,7 @@ import prompts from "prompts";
|
|
|
37
37
|
|
|
38
38
|
//#region package.json
|
|
39
39
|
var name = "@geekmidas/cli";
|
|
40
|
-
var version = "9.
|
|
40
|
+
var version = "9.4.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 ConstructGenerator {
|
|
|
383
383
|
await 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: relative(process.cwd(), handlerFile).replace(/\.ts$/, ".handler"),
|
|
389
|
-
schedule
|
|
391
|
+
schedule,
|
|
390
392
|
timeout: construct.timeout,
|
|
391
393
|
memorySize: construct.memorySize,
|
|
392
394
|
environment: await construct.getEnvironment({ markOptional: context.markOptional }),
|
|
393
|
-
|
|
395
|
+
...uptime && { uptime: {
|
|
396
|
+
...uptime,
|
|
397
|
+
period: cronPeriod(schedule)
|
|
398
|
+
} }
|
|
394
399
|
});
|
|
395
400
|
logger$13.log(`Generated cron handler: ${key}`);
|
|
396
401
|
}
|
|
@@ -484,8 +489,7 @@ var FunctionGenerator = class extends ConstructGenerator {
|
|
|
484
489
|
handler: 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
|
}
|
|
@@ -594,6 +598,8 @@ import type { EnvironmentParser } from '@geekmidas/envkit';
|
|
|
594
598
|
import type { Logger } from '@geekmidas/logger';
|
|
595
599
|
import { EventConnectionFactory, Subscriber } from '@geekmidas/events';
|
|
596
600
|
import type { EventConnection, EventSubscriber } from '@geekmidas/events';
|
|
601
|
+
import { randomUUID } from 'node:crypto';
|
|
602
|
+
import { isQueueResult } from '@geekmidas/constructs/queue';
|
|
597
603
|
import { ServiceDiscovery } from '@geekmidas/services';
|
|
598
604
|
${imports}
|
|
599
605
|
|
|
@@ -646,12 +652,21 @@ export async function setupQueues(
|
|
|
646
652
|
return;
|
|
647
653
|
}
|
|
648
654
|
|
|
649
|
-
|
|
655
|
+
// One message per delivery locally, so it gets an id of its own for
|
|
656
|
+
// the handler to report it by, as SQS's message id is deployed.
|
|
657
|
+
const id = randomUUID();
|
|
658
|
+
const result = await queue.handler({
|
|
650
659
|
messages: [validation.value],
|
|
660
|
+
records: [{ id, message: validation.value }],
|
|
651
661
|
services: services,
|
|
652
662
|
logger: queue.logger,
|
|
653
663
|
});
|
|
654
664
|
|
|
665
|
+
if (isQueueResult(result) && result.failed.includes(id)) {
|
|
666
|
+
logger.error({ queue: queue.name }, 'Queue handler reported the message as failed');
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
|
|
655
670
|
logger.debug({ queue: queue.name }, 'Successfully processed queue message');
|
|
656
671
|
} catch (error) {
|
|
657
672
|
logger.error({ error, queue: queue.name }, 'Failed to process queue message');
|
|
@@ -6943,25 +6958,25 @@ const CLI_VERSION = `~${pkg.version}`;
|
|
|
6943
6958
|
* Run: pnpm --filter @geekmidas/cli sync-versions
|
|
6944
6959
|
*/
|
|
6945
6960
|
const GEEKMIDAS_VERSIONS = {
|
|
6946
|
-
"@geekmidas/audit": "~9.
|
|
6947
|
-
"@geekmidas/auth": "~9.
|
|
6948
|
-
"@geekmidas/cache": "~9.
|
|
6949
|
-
"@geekmidas/client": "~9.
|
|
6950
|
-
"@geekmidas/cloud": "~9.
|
|
6951
|
-
"@geekmidas/constructs": "~9.
|
|
6952
|
-
"@geekmidas/db": "~9.
|
|
6953
|
-
"@geekmidas/emailkit": "~9.
|
|
6954
|
-
"@geekmidas/envkit": "~9.
|
|
6955
|
-
"@geekmidas/errors": "~9.
|
|
6956
|
-
"@geekmidas/events": "~9.
|
|
6957
|
-
"@geekmidas/logger": "~9.
|
|
6958
|
-
"@geekmidas/rate-limit": "~9.
|
|
6959
|
-
"@geekmidas/schema": "~9.
|
|
6960
|
-
"@geekmidas/services": "~9.
|
|
6961
|
-
"@geekmidas/storage": "~9.
|
|
6962
|
-
"@geekmidas/studio": "~9.
|
|
6963
|
-
"@geekmidas/telescope": "~9.
|
|
6964
|
-
"@geekmidas/testkit": "~9.
|
|
6961
|
+
"@geekmidas/audit": "~9.4.0",
|
|
6962
|
+
"@geekmidas/auth": "~9.4.0",
|
|
6963
|
+
"@geekmidas/cache": "~9.4.0",
|
|
6964
|
+
"@geekmidas/client": "~9.4.0",
|
|
6965
|
+
"@geekmidas/cloud": "~9.4.0",
|
|
6966
|
+
"@geekmidas/constructs": "~9.4.0",
|
|
6967
|
+
"@geekmidas/db": "~9.4.0",
|
|
6968
|
+
"@geekmidas/emailkit": "~9.4.0",
|
|
6969
|
+
"@geekmidas/envkit": "~9.4.0",
|
|
6970
|
+
"@geekmidas/errors": "~9.4.0",
|
|
6971
|
+
"@geekmidas/events": "~9.4.0",
|
|
6972
|
+
"@geekmidas/logger": "~9.4.0",
|
|
6973
|
+
"@geekmidas/rate-limit": "~9.4.0",
|
|
6974
|
+
"@geekmidas/schema": "~9.4.0",
|
|
6975
|
+
"@geekmidas/services": "~9.4.0",
|
|
6976
|
+
"@geekmidas/storage": "~9.4.0",
|
|
6977
|
+
"@geekmidas/studio": "~9.4.0",
|
|
6978
|
+
"@geekmidas/telescope": "~9.4.0",
|
|
6979
|
+
"@geekmidas/testkit": "~9.4.0",
|
|
6965
6980
|
"@geekmidas/cli": CLI_VERSION
|
|
6966
6981
|
};
|
|
6967
6982
|
|