zudojs-cli 2.0.1 → 2.1.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/README.md +59 -7
- package/dist/src/adapters/frontend/angular.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/angular.adapter.js +14 -97
- package/dist/src/adapters/frontend/astro.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/astro.adapter.js +4 -64
- package/dist/src/adapters/frontend/fallback/fallback.helper.d.ts +41 -0
- package/dist/src/adapters/frontend/fallback/fallback.helper.js +57 -0
- package/dist/src/adapters/frontend/fallback/framework/angular/angular.fallback.d.ts +18 -0
- package/dist/src/adapters/frontend/fallback/framework/angular/angular.fallback.js +107 -0
- package/dist/src/adapters/frontend/fallback/framework/angular/angularWorkspace.fallback.d.ts +23 -0
- package/dist/src/adapters/frontend/fallback/framework/angular/angularWorkspace.fallback.js +125 -0
- package/dist/src/adapters/frontend/fallback/framework/angular/index.d.ts +8 -0
- package/dist/src/adapters/frontend/fallback/framework/angular/index.js +8 -0
- package/dist/src/adapters/frontend/fallback/framework/astro.fallback.d.ts +14 -0
- package/dist/src/adapters/frontend/fallback/framework/astro.fallback.js +76 -0
- package/dist/src/adapters/frontend/fallback/framework/index.d.ts +13 -0
- package/dist/src/adapters/frontend/fallback/framework/index.js +13 -0
- package/dist/src/adapters/frontend/fallback/framework/next.fallback.d.ts +13 -0
- package/dist/src/adapters/frontend/fallback/framework/next.fallback.js +105 -0
- package/dist/src/adapters/frontend/fallback/framework/nuxt.fallback.d.ts +14 -0
- package/dist/src/adapters/frontend/fallback/framework/nuxt.fallback.js +56 -0
- package/dist/src/adapters/frontend/fallback/framework/sveltekit.fallback.d.ts +15 -0
- package/dist/src/adapters/frontend/fallback/framework/sveltekit.fallback.js +94 -0
- package/dist/src/adapters/frontend/fallback/index.d.ts +12 -0
- package/dist/src/adapters/frontend/fallback/index.js +12 -0
- package/dist/src/adapters/frontend/fallback/vite/index.d.ts +11 -0
- package/dist/src/adapters/frontend/fallback/vite/index.js +11 -0
- package/dist/src/adapters/frontend/fallback/vite/react.fallback.d.ts +13 -0
- package/dist/src/adapters/frontend/fallback/vite/react.fallback.js +77 -0
- package/dist/src/adapters/frontend/fallback/vite/svelte.fallback.d.ts +14 -0
- package/dist/src/adapters/frontend/fallback/vite/svelte.fallback.js +95 -0
- package/dist/src/adapters/frontend/fallback/vite/vanilla.fallback.d.ts +13 -0
- package/dist/src/adapters/frontend/fallback/vite/vanilla.fallback.js +71 -0
- package/dist/src/adapters/frontend/fallback/vite/vue.fallback.d.ts +14 -0
- package/dist/src/adapters/frontend/fallback/vite/vue.fallback.js +78 -0
- package/dist/src/adapters/frontend/next.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/next.adapter.js +16 -95
- package/dist/src/adapters/frontend/nuxt.adapter.d.ts +1 -2
- package/dist/src/adapters/frontend/nuxt.adapter.js +32 -43
- package/dist/src/adapters/frontend/react-native.adapter.js +1 -1
- package/dist/src/adapters/frontend/react.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/react.adapter.js +7 -89
- package/dist/src/adapters/frontend/svelte.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/svelte.adapter.js +4 -86
- package/dist/src/adapters/frontend/sveltekit.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/sveltekit.adapter.js +4 -57
- package/dist/src/adapters/frontend/vanilla.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/vanilla.adapter.js +4 -47
- package/dist/src/adapters/frontend/vue.adapter.d.ts +0 -1
- package/dist/src/adapters/frontend/vue.adapter.js +4 -76
- package/dist/src/bin/bin.menu.d.ts +22 -0
- package/dist/src/bin/bin.menu.js +40 -0
- package/dist/src/bin/bin.runner.d.ts +38 -0
- package/dist/src/bin/bin.runner.js +51 -0
- package/dist/src/bin/index.d.ts +9 -0
- package/dist/src/bin/index.js +9 -0
- package/dist/src/bin/zudojs.js +15 -4
- package/dist/src/cliApplication/cliApplication.core.d.ts +4 -2
- package/dist/src/cliApplication/cliApplication.core.js +48 -36
- package/dist/src/cliApplication/cliApplication.logger.d.ts +5 -0
- package/dist/src/cliApplication/cliApplication.logger.js +5 -3
- package/dist/src/cliApplication/invocation/index.d.ts +12 -0
- package/dist/src/cliApplication/invocation/index.js +12 -0
- package/dist/src/cliApplication/invocation/invocation.hint.d.ts +30 -0
- package/dist/src/cliApplication/invocation/invocation.hint.js +74 -0
- package/dist/src/cliApplication/invocation/invocation.locate.d.ts +34 -0
- package/dist/src/cliApplication/invocation/invocation.locate.js +53 -0
- package/dist/src/cliApplication/invocation/invocation.name.d.ts +37 -0
- package/dist/src/cliApplication/invocation/invocation.name.js +69 -0
- package/dist/src/cliApplication/invocation/invocation.sanitize.d.ts +19 -0
- package/dist/src/cliApplication/invocation/invocation.sanitize.js +32 -0
- package/dist/src/cliParser/cliParser.core.js +3 -1
- package/dist/src/cliParser/cliParser.helper.d.ts +7 -0
- package/dist/src/cliParser/cliParser.helper.js +19 -2
- package/dist/src/cliParser/cliParser.longOption.js +2 -2
- package/dist/src/commands/add.command.d.ts +7 -3
- package/dist/src/commands/add.command.js +96 -57
- package/dist/src/commands/create.command.js +29 -42
- package/dist/src/commands/doctor.command.d.ts +2 -1
- package/dist/src/commands/doctor.command.js +52 -4
- package/dist/src/commands/generate.command.js +31 -16
- package/dist/src/commands/info.command.js +11 -1
- package/dist/src/constants/index.d.ts +21 -3
- package/dist/src/constants/index.js +40 -5
- package/dist/src/constants/zudojsVersions.generated.d.ts +9 -0
- package/dist/src/constants/zudojsVersions.generated.js +48 -0
- package/dist/src/constants/zudojsVersions.helper.d.ts +21 -0
- package/dist/src/constants/zudojsVersions.helper.js +29 -0
- package/dist/src/generators/frontend/frontendGenerator.core.js +9 -10
- package/dist/src/generators/frontend/frontendPipeline.d.ts +6 -1
- package/dist/src/generators/frontend/frontendPipeline.js +9 -1
- package/dist/src/generators/fullstack/fullstackComposer.core.js +7 -1
- package/dist/src/generators/index.d.ts +1 -2
- package/dist/src/generators/index.js +1 -2
- package/dist/src/generators/infrastructure/infrastructure.generator.js +13 -5
- package/dist/src/generators/integration/integrationGenerator.core.d.ts +2 -0
- package/dist/src/generators/integration/integrationGenerator.core.js +31 -2
- package/dist/src/generators/module/module.generator.js +36 -4
- package/dist/src/generators/resource/index.d.ts +8 -0
- package/dist/src/generators/resource/index.js +8 -0
- package/dist/src/generators/resource/resource.generator.d.ts +27 -0
- package/dist/src/generators/resource/resource.generator.js +87 -0
- package/dist/src/generators/resource/resource.layout.d.ts +26 -0
- package/dist/src/generators/resource/resource.layout.js +46 -0
- package/dist/src/generators/resource/resource.plan.d.ts +27 -0
- package/dist/src/generators/resource/resource.plan.js +46 -0
- package/dist/src/generators/resource/resource.run.d.ts +25 -0
- package/dist/src/generators/resource/resource.run.js +52 -0
- package/dist/src/prompts/cancel.prompt.d.ts +5 -1
- package/dist/src/prompts/cancel.prompt.js +4 -0
- package/dist/src/prompts/menu/index.d.ts +13 -0
- package/dist/src/prompts/menu/index.js +13 -0
- package/dist/src/prompts/menu/menu.adapter.d.ts +16 -0
- package/dist/src/prompts/menu/menu.adapter.js +56 -0
- package/dist/src/prompts/menu/menu.constant.d.ts +20 -0
- package/dist/src/prompts/menu/menu.constant.js +29 -0
- package/dist/src/prompts/menu/menu.flow.d.ts +18 -0
- package/dist/src/prompts/menu/menu.flow.js +82 -0
- package/dist/src/prompts/menu/menu.select.d.ts +26 -0
- package/dist/src/prompts/menu/menu.select.js +118 -0
- package/dist/src/prompts/menu/menu.type.d.ts +66 -0
- package/dist/src/prompts/menu/menu.type.js +8 -0
- package/dist/src/recipes/apply/index.d.ts +9 -0
- package/dist/src/recipes/apply/index.js +9 -0
- package/dist/src/recipes/apply/recipeApply.app.d.ts +20 -0
- package/dist/src/recipes/apply/recipeApply.app.js +79 -0
- package/dist/src/recipes/apply/recipeApply.context.d.ts +14 -0
- package/dist/src/recipes/apply/recipeApply.context.js +76 -0
- package/dist/src/recipes/apply/recipeApply.files.d.ts +39 -0
- package/dist/src/recipes/apply/recipeApply.files.js +84 -0
- package/dist/src/recipes/apply/recipeApply.project.d.ts +11 -0
- package/dist/src/recipes/apply/recipeApply.project.js +50 -0
- package/dist/src/recipes/apply/recipeApply.report.d.ts +20 -0
- package/dist/src/recipes/apply/recipeApply.report.js +51 -0
- package/dist/src/recipes/catalog/database/database.files.d.ts +15 -0
- package/dist/src/recipes/catalog/database/database.files.js +98 -0
- package/dist/src/recipes/catalog/database/database.recipe.d.ts +9 -0
- package/dist/src/recipes/catalog/database/database.recipe.js +50 -0
- package/dist/src/recipes/catalog/database/index.d.ts +6 -0
- package/dist/src/recipes/catalog/database/index.js +6 -0
- package/dist/src/recipes/catalog/email.recipe.d.ts +9 -0
- package/dist/src/recipes/catalog/email.recipe.js +122 -0
- package/dist/src/recipes/catalog/index.d.ts +11 -0
- package/dist/src/recipes/catalog/index.js +11 -0
- package/dist/src/recipes/catalog/openapi.recipe.d.ts +8 -0
- package/dist/src/recipes/catalog/openapi.recipe.js +25 -0
- package/dist/src/recipes/catalog/platform/cache.recipe.d.ts +7 -0
- package/dist/src/recipes/catalog/platform/cache.recipe.js +55 -0
- package/dist/src/recipes/catalog/platform/index.d.ts +9 -0
- package/dist/src/recipes/catalog/platform/index.js +9 -0
- package/dist/src/recipes/catalog/platform/messaging.recipe.d.ts +7 -0
- package/dist/src/recipes/catalog/platform/messaging.recipe.js +46 -0
- package/dist/src/recipes/catalog/platform/observability.recipe.d.ts +8 -0
- package/dist/src/recipes/catalog/platform/observability.recipe.js +49 -0
- package/dist/src/recipes/catalog/platform/queue.recipe.d.ts +7 -0
- package/dist/src/recipes/catalog/platform/queue.recipe.js +61 -0
- package/dist/src/recipes/catalog/platform/scheduler.recipe.d.ts +7 -0
- package/dist/src/recipes/catalog/platform/scheduler.recipe.js +56 -0
- package/dist/src/recipes/catalog/redis.recipe.d.ts +8 -0
- package/dist/src/recipes/catalog/redis.recipe.js +79 -0
- package/dist/src/recipes/catalog/storage.recipe.d.ts +7 -0
- package/dist/src/recipes/catalog/storage.recipe.js +49 -0
- package/dist/src/recipes/catalog/websockets.recipe.d.ts +10 -0
- package/dist/src/recipes/catalog/websockets.recipe.js +84 -0
- package/dist/src/recipes/docker/docker.compose.d.ts +19 -0
- package/dist/src/recipes/docker/docker.compose.js +90 -0
- package/dist/src/recipes/docker/docker.recipe.d.ts +10 -0
- package/dist/src/recipes/docker/docker.recipe.js +51 -0
- package/dist/src/recipes/docker/docker.refresh.d.ts +13 -0
- package/dist/src/recipes/docker/docker.refresh.js +37 -0
- package/dist/src/recipes/docker/index.d.ts +7 -0
- package/dist/src/recipes/docker/index.js +7 -0
- package/dist/src/recipes/index.d.ts +8 -0
- package/dist/src/recipes/index.js +8 -0
- package/dist/src/recipes/recipe.registry.d.ts +17 -0
- package/dist/src/recipes/recipe.registry.js +46 -0
- package/dist/src/recipes/recipe.type.d.ts +93 -0
- package/dist/src/recipes/recipe.type.js +12 -0
- package/dist/src/resolvers/dependency/dependencyVersions.constant.d.ts +100 -5
- package/dist/src/resolvers/dependency/dependencyVersions.constant.js +103 -34
- package/dist/src/resolvers/dependency/index.d.ts +1 -1
- package/dist/src/resolvers/dependency/index.js +1 -1
- package/dist/src/resolvers/project.resolver.d.ts +14 -1
- package/dist/src/resolvers/project.resolver.js +11 -3
- package/dist/src/scaffolders/scaffolder.helper.js +12 -1
- package/dist/src/templates/backendApp/backendApp.core.d.ts +45 -0
- package/dist/src/templates/backendApp/backendApp.core.js +66 -0
- package/dist/src/templates/backendApp/backendApp.modules.d.ts +26 -0
- package/dist/src/templates/backendApp/backendApp.modules.js +25 -0
- package/dist/src/templates/backendApp/backendApp.project.d.ts +26 -0
- package/dist/src/templates/backendApp/backendApp.project.js +87 -0
- package/dist/src/templates/backendApp/index.d.ts +8 -0
- package/dist/src/templates/backendApp/index.js +8 -0
- package/dist/src/templates/backendApp/parts/config.template.d.ts +28 -0
- package/dist/src/templates/backendApp/parts/config.template.js +118 -0
- package/dist/src/templates/backendApp/parts/httpUtils.template.d.ts +10 -0
- package/dist/src/templates/backendApp/parts/httpUtils.template.js +103 -0
- package/dist/src/templates/backendApp/parts/index.d.ts +9 -0
- package/dist/src/templates/backendApp/parts/index.js +9 -0
- package/dist/src/templates/backendApp/parts/integrations.template.d.ts +16 -0
- package/dist/src/templates/backendApp/parts/integrations.template.js +115 -0
- package/dist/src/templates/backendApp/parts/wiring.template.d.ts +26 -0
- package/dist/src/templates/backendApp/parts/wiring.template.js +111 -0
- package/dist/src/templates/microservice/microservice.template.js +61 -87
- package/dist/src/templates/modular-monolith/modularMonolith.template.js +25 -77
- package/dist/src/templates/monolith/monolith.template.d.ts +11 -26
- package/dist/src/templates/monolith/monolith.template.js +49 -146
- package/dist/src/templates/resource/index.d.ts +9 -0
- package/dist/src/templates/resource/index.js +9 -0
- package/dist/src/templates/resource/layers/index.d.ts +9 -0
- package/dist/src/templates/resource/layers/index.js +9 -0
- package/dist/src/templates/resource/layers/resourceData.template.d.ts +9 -0
- package/dist/src/templates/resource/layers/resourceData.template.js +108 -0
- package/dist/src/templates/resource/layers/resourcePrisma.template.d.ts +15 -0
- package/dist/src/templates/resource/layers/resourcePrisma.template.js +89 -0
- package/dist/src/templates/resource/layers/resourceRoutes.template.d.ts +13 -0
- package/dist/src/templates/resource/layers/resourceRoutes.template.js +128 -0
- package/dist/src/templates/resource/layers/resourceService.template.d.ts +13 -0
- package/dist/src/templates/resource/layers/resourceService.template.js +95 -0
- package/dist/src/templates/resource/resource.files.d.ts +33 -0
- package/dist/src/templates/resource/resource.files.js +99 -0
- package/dist/src/templates/resource/resource.names.d.ts +38 -0
- package/dist/src/templates/resource/resource.names.js +60 -0
- package/dist/src/templates/resource/resource.type.d.ts +19 -0
- package/dist/src/templates/resource/resource.type.js +15 -0
- package/dist/src/templates/shared/appRuntime.template.js +28 -11
- package/dist/src/templates/shared/capability.template.d.ts +13 -4
- package/dist/src/templates/shared/capability.template.js +21 -5
- package/dist/src/templates/shared/dockerfile.template.d.ts +12 -4
- package/dist/src/templates/shared/dockerfile.template.js +68 -29
- package/dist/src/templates/shared/pnpm.template.d.ts +8 -2
- package/dist/src/templates/shared/pnpm.template.js +9 -1
- package/dist/src/templates/shared/server.template.d.ts +23 -22
- package/dist/src/templates/shared/server.template.js +79 -53
- package/dist/src/types/scaffold.type.d.ts +6 -0
- package/dist/src/types/scaffold.type.js +2 -1
- package/dist/src/utils/utils.name.js +6 -0
- package/dist/src/utils/utils.writeGuard.d.ts +5 -0
- package/dist/src/utils/utils.writeGuard.js +23 -0
- package/dist/src/wiring/index.d.ts +10 -0
- package/dist/src/wiring/index.js +10 -0
- package/dist/src/wiring/wiring.dependencies.d.ts +29 -0
- package/dist/src/wiring/wiring.dependencies.js +83 -0
- package/dist/src/wiring/wiring.edits.d.ts +51 -0
- package/dist/src/wiring/wiring.edits.js +90 -0
- package/dist/src/wiring/wiring.markers.d.ts +53 -0
- package/dist/src/wiring/wiring.markers.js +87 -0
- package/package.json +20 -15
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — `zudojs add cache`: an in-memory cache (@zudojs/cache) with
|
|
3
|
+
* a bounded entry count and a default TTL from the environment.
|
|
4
|
+
*/
|
|
5
|
+
import { zudojsDependencies } from "../../../constants/index.js";
|
|
6
|
+
const source = () => `import {
|
|
7
|
+
createCacheService,
|
|
8
|
+
createMemoryCacheAdapter,
|
|
9
|
+
type CacheService,
|
|
10
|
+
} from "@zudojs/cache";
|
|
11
|
+
|
|
12
|
+
import type { Integration } from "./integration.js";
|
|
13
|
+
|
|
14
|
+
let service: CacheService | undefined;
|
|
15
|
+
|
|
16
|
+
/** The cache. Throws before the runtime has started. */
|
|
17
|
+
export function cache(): CacheService {
|
|
18
|
+
if (service === undefined) {
|
|
19
|
+
throw new Error("The cache is not ready: start the runtime first.");
|
|
20
|
+
}
|
|
21
|
+
return service;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const cacheIntegration: Integration = {
|
|
25
|
+
name: "cache",
|
|
26
|
+
|
|
27
|
+
async start({ config }) {
|
|
28
|
+
service = createCacheService({
|
|
29
|
+
adapter: createMemoryCacheAdapter({ maxEntries: config.cache.maxEntries }),
|
|
30
|
+
config: { defaultTtl: config.cache.defaultTtlMs },
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
async stop() {
|
|
35
|
+
service = undefined;
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
async health() {
|
|
39
|
+
return service !== undefined;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
`;
|
|
43
|
+
export const cacheRecipe = {
|
|
44
|
+
scope: "app",
|
|
45
|
+
feature: "cache",
|
|
46
|
+
summary: "In-memory cache (src/integrations/cache.ts)",
|
|
47
|
+
dependencies: zudojsDependencies(["@zudojs/cache"]),
|
|
48
|
+
env: () => [
|
|
49
|
+
{ name: "CACHE_MAX_ENTRIES", value: "10000" },
|
|
50
|
+
{ name: "CACHE_DEFAULT_TTL_MS", value: "60000" },
|
|
51
|
+
],
|
|
52
|
+
configSection: `cache: Object.freeze({ maxEntries: int(config, "cache_max_entries", 10_000), defaultTtlMs: int(config, "cache_default_ttl_ms", 60_000) }),`,
|
|
53
|
+
integration: { file: "cache.ts", exportName: "cacheIntegration", source },
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=cache.recipe.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — Recipes backed by @zudojs platform packages.
|
|
3
|
+
*/
|
|
4
|
+
export { cacheRecipe } from "./cache.recipe.js";
|
|
5
|
+
export { messagingRecipe } from "./messaging.recipe.js";
|
|
6
|
+
export { observabilityRecipe } from "./observability.recipe.js";
|
|
7
|
+
export { queueRecipe } from "./queue.recipe.js";
|
|
8
|
+
export { schedulerRecipe } from "./scheduler.recipe.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — Recipes backed by @zudojs platform packages.
|
|
3
|
+
*/
|
|
4
|
+
export { cacheRecipe } from "./cache.recipe.js";
|
|
5
|
+
export { messagingRecipe } from "./messaging.recipe.js";
|
|
6
|
+
export { observabilityRecipe } from "./observability.recipe.js";
|
|
7
|
+
export { queueRecipe } from "./queue.recipe.js";
|
|
8
|
+
export { schedulerRecipe } from "./scheduler.recipe.js";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — `zudojs add messaging`: an in-process message bus
|
|
3
|
+
* (@zudojs/messaging), disposed on stop.
|
|
4
|
+
*/
|
|
5
|
+
import type { AppRecipe } from "../../recipe.type.js";
|
|
6
|
+
export declare const messagingRecipe: AppRecipe;
|
|
7
|
+
//# sourceMappingURL=messaging.recipe.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — `zudojs add messaging`: an in-process message bus
|
|
3
|
+
* (@zudojs/messaging), disposed on stop.
|
|
4
|
+
*/
|
|
5
|
+
import { zudojsDependencies } from "../../../constants/index.js";
|
|
6
|
+
const source = () => `import { createMessageBus } from "@zudojs/messaging";
|
|
7
|
+
|
|
8
|
+
import type { Integration } from "./integration.js";
|
|
9
|
+
|
|
10
|
+
type MessageBus = ReturnType<typeof createMessageBus>;
|
|
11
|
+
|
|
12
|
+
let bus: MessageBus | undefined;
|
|
13
|
+
|
|
14
|
+
/** The message bus. Throws before the runtime has started. */
|
|
15
|
+
export function messages(): MessageBus {
|
|
16
|
+
if (bus === undefined) {
|
|
17
|
+
throw new Error("The message bus is not running: start the runtime first.");
|
|
18
|
+
}
|
|
19
|
+
return bus;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const messagingIntegration: Integration = {
|
|
23
|
+
name: "messaging",
|
|
24
|
+
|
|
25
|
+
async start() {
|
|
26
|
+
bus = createMessageBus();
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
async stop() {
|
|
30
|
+
bus?.dispose();
|
|
31
|
+
bus = undefined;
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
async health() {
|
|
35
|
+
return bus !== undefined;
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
`;
|
|
39
|
+
export const messagingRecipe = {
|
|
40
|
+
scope: "app",
|
|
41
|
+
feature: "messaging",
|
|
42
|
+
summary: "In-process message bus (src/integrations/messaging.ts)",
|
|
43
|
+
dependencies: zudojsDependencies(["@zudojs/messaging"]),
|
|
44
|
+
integration: { file: "messaging.ts", exportName: "messagingIntegration", source },
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=messaging.recipe.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — `zudojs add observability`: logger, metrics and tracer
|
|
3
|
+
* (@zudojs/observability), flushed and shut down on stop. Console
|
|
4
|
+
* exporters are on outside production.
|
|
5
|
+
*/
|
|
6
|
+
import type { AppRecipe } from "../../recipe.type.js";
|
|
7
|
+
export declare const observabilityRecipe: AppRecipe;
|
|
8
|
+
//# sourceMappingURL=observability.recipe.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — `zudojs add observability`: logger, metrics and tracer
|
|
3
|
+
* (@zudojs/observability), flushed and shut down on stop. Console
|
|
4
|
+
* exporters are on outside production.
|
|
5
|
+
*/
|
|
6
|
+
import { zudojsDependencies } from "../../../constants/index.js";
|
|
7
|
+
const source = () => `import { createObservability } from "@zudojs/observability";
|
|
8
|
+
|
|
9
|
+
import type { Integration } from "./integration.js";
|
|
10
|
+
|
|
11
|
+
type Observability = ReturnType<typeof createObservability>;
|
|
12
|
+
|
|
13
|
+
let instance: Observability | undefined;
|
|
14
|
+
|
|
15
|
+
/** Logger, metrics and tracer. Throws before the runtime has started. */
|
|
16
|
+
export function observability(): Observability {
|
|
17
|
+
if (instance === undefined) {
|
|
18
|
+
throw new Error("Observability is not started: start the runtime first.");
|
|
19
|
+
}
|
|
20
|
+
return instance;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const observabilityIntegration: Integration = {
|
|
24
|
+
name: "observability",
|
|
25
|
+
|
|
26
|
+
async start({ config }) {
|
|
27
|
+
instance = createObservability({
|
|
28
|
+
serviceName: config.observability.serviceName,
|
|
29
|
+
environment: config.nodeEnv,
|
|
30
|
+
useConsoleExporters: config.nodeEnv !== "production",
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
async stop() {
|
|
35
|
+
await instance?.shutdown();
|
|
36
|
+
instance = undefined;
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
`;
|
|
40
|
+
export const observabilityRecipe = {
|
|
41
|
+
scope: "app",
|
|
42
|
+
feature: "observability",
|
|
43
|
+
summary: "Metrics, tracing and structured logs (src/integrations/observability.ts)",
|
|
44
|
+
dependencies: zudojsDependencies(["@zudojs/observability"]),
|
|
45
|
+
env: (context) => [{ name: "SERVICE_NAME", value: context.projectSlug }],
|
|
46
|
+
configSection: `observability: Object.freeze({ serviceName: text(config, "service_name", "app") }),`,
|
|
47
|
+
integration: { file: "observability.ts", exportName: "observabilityIntegration", source },
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=observability.recipe.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — `zudojs add queue`: an in-process job queue (@zudojs/queue)
|
|
3
|
+
* with an example processor; closed (draining in-flight jobs) on stop.
|
|
4
|
+
*/
|
|
5
|
+
import type { AppRecipe } from "../../recipe.type.js";
|
|
6
|
+
export declare const queueRecipe: AppRecipe;
|
|
7
|
+
//# sourceMappingURL=queue.recipe.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — `zudojs add queue`: an in-process job queue (@zudojs/queue)
|
|
3
|
+
* with an example processor; closed (draining in-flight jobs) on stop.
|
|
4
|
+
*/
|
|
5
|
+
import { zudojsDependencies } from "../../../constants/index.js";
|
|
6
|
+
const source = () => `import { createInMemoryQueue, createQueueName } from "@zudojs/queue";
|
|
7
|
+
|
|
8
|
+
import type { Integration } from "./integration.js";
|
|
9
|
+
|
|
10
|
+
/** Payload of the jobs this app queues. */
|
|
11
|
+
export type JobData = Readonly<Record<string, unknown>>;
|
|
12
|
+
|
|
13
|
+
type JobQueue = ReturnType<typeof createInMemoryQueue<JobData>>;
|
|
14
|
+
|
|
15
|
+
let queue: JobQueue | undefined;
|
|
16
|
+
|
|
17
|
+
/** The job queue. Throws before the runtime has started. */
|
|
18
|
+
export function jobs(): JobQueue {
|
|
19
|
+
if (queue === undefined) {
|
|
20
|
+
throw new Error("The job queue is not running: start the runtime first.");
|
|
21
|
+
}
|
|
22
|
+
return queue;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const queueIntegration: Integration = {
|
|
26
|
+
name: "queue",
|
|
27
|
+
|
|
28
|
+
async start({ config, logger }) {
|
|
29
|
+
queue = createInMemoryQueue<JobData>(createQueueName("jobs"), {
|
|
30
|
+
concurrency: config.queue.concurrency,
|
|
31
|
+
logger: {
|
|
32
|
+
info: (message, data) => logger.info(message, data),
|
|
33
|
+
error: (message, data) => logger.error(message, data),
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
// Example processor: add yours, then queue work with jobs().add("log", { ... }).
|
|
37
|
+
queue.process("log", async (job) => {
|
|
38
|
+
logger.info("Processed job", { id: job.id });
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
async stop() {
|
|
43
|
+
await queue?.close();
|
|
44
|
+
queue = undefined;
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
async health() {
|
|
48
|
+
return queue !== undefined;
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
`;
|
|
52
|
+
export const queueRecipe = {
|
|
53
|
+
scope: "app",
|
|
54
|
+
feature: "queue",
|
|
55
|
+
summary: "In-process job queue (src/integrations/queue.ts)",
|
|
56
|
+
dependencies: zudojsDependencies(["@zudojs/queue"]),
|
|
57
|
+
env: () => [{ name: "QUEUE_CONCURRENCY", value: "5" }],
|
|
58
|
+
configSection: `queue: Object.freeze({ concurrency: int(config, "queue_concurrency", 5) }),`,
|
|
59
|
+
integration: { file: "queue.ts", exportName: "queueIntegration", source },
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=queue.recipe.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — `zudojs add scheduler`: a cron scheduler (@zudojs/scheduler)
|
|
3
|
+
* with an example job; in-flight jobs are aborted and awaited on stop.
|
|
4
|
+
*/
|
|
5
|
+
import type { AppRecipe } from "../../recipe.type.js";
|
|
6
|
+
export declare const schedulerRecipe: AppRecipe;
|
|
7
|
+
//# sourceMappingURL=scheduler.recipe.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — `zudojs add scheduler`: a cron scheduler (@zudojs/scheduler)
|
|
3
|
+
* with an example job; in-flight jobs are aborted and awaited on stop.
|
|
4
|
+
*/
|
|
5
|
+
import { zudojsDependencies } from "../../../constants/index.js";
|
|
6
|
+
const source = () => `import { Scheduler } from "@zudojs/scheduler";
|
|
7
|
+
|
|
8
|
+
import type { Integration } from "./integration.js";
|
|
9
|
+
|
|
10
|
+
let scheduler: Scheduler | undefined;
|
|
11
|
+
|
|
12
|
+
/** The scheduler. Throws before the runtime has started. */
|
|
13
|
+
export function schedules(): Scheduler {
|
|
14
|
+
if (scheduler === undefined) {
|
|
15
|
+
throw new Error("The scheduler is not running: start the runtime first.");
|
|
16
|
+
}
|
|
17
|
+
return scheduler;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const schedulerIntegration: Integration = {
|
|
21
|
+
name: "scheduler",
|
|
22
|
+
|
|
23
|
+
async start({ logger }) {
|
|
24
|
+
scheduler = new Scheduler({
|
|
25
|
+
onError: ({ jobId, error }) => logger.error("Scheduled job failed", { jobId, error }),
|
|
26
|
+
});
|
|
27
|
+
// Example job: replace with yours.
|
|
28
|
+
scheduler.define({
|
|
29
|
+
id: "heartbeat",
|
|
30
|
+
name: "Heartbeat",
|
|
31
|
+
handler: async () => {
|
|
32
|
+
logger.debug("Scheduler heartbeat");
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
scheduler.cron("*/5 * * * *", "heartbeat", { timezone: "UTC" });
|
|
36
|
+
scheduler.start();
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
async stop() {
|
|
40
|
+
await scheduler?.stop({ timeoutMs: 10_000 });
|
|
41
|
+
scheduler = undefined;
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
async health() {
|
|
45
|
+
return scheduler !== undefined;
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
`;
|
|
49
|
+
export const schedulerRecipe = {
|
|
50
|
+
scope: "app",
|
|
51
|
+
feature: "scheduler",
|
|
52
|
+
summary: "Cron scheduler (src/integrations/scheduler.ts)",
|
|
53
|
+
dependencies: zudojsDependencies(["@zudojs/scheduler"]),
|
|
54
|
+
integration: { file: "scheduler.ts", exportName: "schedulerIntegration", source },
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=scheduler.recipe.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — `zudojs add redis`: a node-redis client with config from
|
|
3
|
+
* REDIS_URL, connected on start (failing fast when Redis is unreachable),
|
|
4
|
+
* reconnecting afterwards, with a PING health check.
|
|
5
|
+
*/
|
|
6
|
+
import type { AppRecipe } from "../recipe.type.js";
|
|
7
|
+
export declare const redisRecipe: AppRecipe;
|
|
8
|
+
//# sourceMappingURL=redis.recipe.d.ts.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — `zudojs add redis`: a node-redis client with config from
|
|
3
|
+
* REDIS_URL, connected on start (failing fast when Redis is unreachable),
|
|
4
|
+
* reconnecting afterwards, with a PING health check.
|
|
5
|
+
*/
|
|
6
|
+
import { DEPENDENCY_VERSION_RANGES } from "../../resolvers/dependency/dependencyVersions.constant.js";
|
|
7
|
+
const source = () => `import { createClient } from "redis";
|
|
8
|
+
|
|
9
|
+
import type { Integration } from "./integration.js";
|
|
10
|
+
|
|
11
|
+
/** Connection attempts before start() gives up on an unreachable server. */
|
|
12
|
+
const STARTUP_ATTEMPTS = 5;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Creates the client. Reconnects forever once connected, but gives up
|
|
16
|
+
* after STARTUP_ATTEMPTS while \`isStarting()\` so start() fails fast.
|
|
17
|
+
*/
|
|
18
|
+
function createRedisClient(url: string, isStarting: () => boolean) {
|
|
19
|
+
return createClient({
|
|
20
|
+
url,
|
|
21
|
+
socket: {
|
|
22
|
+
connectTimeout: 5_000,
|
|
23
|
+
reconnectStrategy: (retries: number, cause: Error) =>
|
|
24
|
+
isStarting() && retries >= STARTUP_ATTEMPTS ? cause : Math.min(retries * 200, 3_000),
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type RedisClient = ReturnType<typeof createRedisClient>;
|
|
30
|
+
|
|
31
|
+
let client: RedisClient | undefined;
|
|
32
|
+
|
|
33
|
+
/** The connected Redis client. Throws before the runtime has started. */
|
|
34
|
+
export function redis(): RedisClient {
|
|
35
|
+
if (client === undefined) {
|
|
36
|
+
throw new Error("Redis is not connected: start the runtime first.");
|
|
37
|
+
}
|
|
38
|
+
return client;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const redisIntegration: Integration = {
|
|
42
|
+
name: "redis",
|
|
43
|
+
|
|
44
|
+
async start({ config, logger }) {
|
|
45
|
+
let connected = false;
|
|
46
|
+
const next = createRedisClient(config.redis.url, () => !connected);
|
|
47
|
+
next.on("error", (error: unknown) => {
|
|
48
|
+
logger.error("Redis connection error", { error });
|
|
49
|
+
});
|
|
50
|
+
await next.connect();
|
|
51
|
+
connected = true;
|
|
52
|
+
client = next;
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
async stop() {
|
|
56
|
+
const current = client;
|
|
57
|
+
client = undefined;
|
|
58
|
+
if (current?.isOpen) await current.close();
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
async health() {
|
|
62
|
+
if (client === undefined || !client.isReady) return false;
|
|
63
|
+
return (await client.ping()) === "PONG";
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
`;
|
|
67
|
+
export const redisRecipe = {
|
|
68
|
+
scope: "app",
|
|
69
|
+
feature: "redis",
|
|
70
|
+
summary: "Redis client (src/integrations/redis.ts) with a health check",
|
|
71
|
+
dependencies: { redis: DEPENDENCY_VERSION_RANGES.redis },
|
|
72
|
+
env: () => [{ name: "REDIS_URL", value: "redis://localhost:6379" }],
|
|
73
|
+
configSection: `redis: Object.freeze({ url: text(config, "redis_url", "redis://localhost:6379") }),`,
|
|
74
|
+
integration: { file: "redis.ts", exportName: "redisIntegration", source },
|
|
75
|
+
nextSteps: () => [
|
|
76
|
+
`Use it anywhere after start: import { redis } from "./integrations/redis.js"; await redis().set("key", "value");`,
|
|
77
|
+
],
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=redis.recipe.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — `zudojs add storage`: object storage on the local disk
|
|
3
|
+
* (@zudojs/storage `LocalObjectStorage`) under STORAGE_DIRECTORY.
|
|
4
|
+
*/
|
|
5
|
+
import type { AppRecipe } from "../recipe.type.js";
|
|
6
|
+
export declare const storageRecipe: AppRecipe;
|
|
7
|
+
//# sourceMappingURL=storage.recipe.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — `zudojs add storage`: object storage on the local disk
|
|
3
|
+
* (@zudojs/storage `LocalObjectStorage`) under STORAGE_DIRECTORY.
|
|
4
|
+
*/
|
|
5
|
+
import { zudojsDependencies } from "../../constants/index.js";
|
|
6
|
+
const source = () => `import { mkdir } from "node:fs/promises";
|
|
7
|
+
|
|
8
|
+
import { LocalObjectStorage } from "@zudojs/storage";
|
|
9
|
+
|
|
10
|
+
import type { Integration } from "./integration.js";
|
|
11
|
+
|
|
12
|
+
let storage: LocalObjectStorage | undefined;
|
|
13
|
+
|
|
14
|
+
/** The object store. Throws before the runtime has started. */
|
|
15
|
+
export function objectStorage(): LocalObjectStorage {
|
|
16
|
+
if (storage === undefined) {
|
|
17
|
+
throw new Error("Object storage is not ready: start the runtime first.");
|
|
18
|
+
}
|
|
19
|
+
return storage;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const storageIntegration: Integration = {
|
|
23
|
+
name: "storage",
|
|
24
|
+
|
|
25
|
+
async start({ config }) {
|
|
26
|
+
await mkdir(config.storage.directory, { recursive: true });
|
|
27
|
+
storage = new LocalObjectStorage(config.storage.directory);
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
async stop() {
|
|
31
|
+
storage = undefined;
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
async health() {
|
|
35
|
+
return storage !== undefined;
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
`;
|
|
39
|
+
export const storageRecipe = {
|
|
40
|
+
scope: "app",
|
|
41
|
+
feature: "storage",
|
|
42
|
+
summary: "Local object storage (src/integrations/storage.ts)",
|
|
43
|
+
dependencies: zudojsDependencies(["@zudojs/storage"]),
|
|
44
|
+
env: () => [{ name: "STORAGE_DIRECTORY", value: "./.data/storage" }],
|
|
45
|
+
configSection: `storage: Object.freeze({ directory: text(config, "storage_directory", "./.data/storage") }),`,
|
|
46
|
+
integration: { file: "storage.ts", exportName: "storageIntegration", source },
|
|
47
|
+
gitignore: () => [".data/"],
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=storage.recipe.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — `zudojs add websockets`: a `ws` WebSocketServer attached to
|
|
3
|
+
* the app's HTTP server at WEBSOCKET_PATH. Browser connections are only
|
|
4
|
+
* accepted from CORS_ORIGINS (cross-site WebSocket hijacking), messages
|
|
5
|
+
* are capped at 64 KiB, and open sockets are closed with 1001 when
|
|
6
|
+
* shutdown begins so the HTTP server can stop.
|
|
7
|
+
*/
|
|
8
|
+
import type { AppRecipe } from "../recipe.type.js";
|
|
9
|
+
export declare const websocketsRecipe: AppRecipe;
|
|
10
|
+
//# sourceMappingURL=websockets.recipe.d.ts.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — `zudojs add websockets`: a `ws` WebSocketServer attached to
|
|
3
|
+
* the app's HTTP server at WEBSOCKET_PATH. Browser connections are only
|
|
4
|
+
* accepted from CORS_ORIGINS (cross-site WebSocket hijacking), messages
|
|
5
|
+
* are capped at 64 KiB, and open sockets are closed with 1001 when
|
|
6
|
+
* shutdown begins so the HTTP server can stop.
|
|
7
|
+
*/
|
|
8
|
+
import { DEPENDENCY_VERSION_RANGES } from "../../resolvers/dependency/dependencyVersions.constant.js";
|
|
9
|
+
const source = () => `import { WebSocketServer, type WebSocket } from "ws";
|
|
10
|
+
|
|
11
|
+
import type { Integration } from "./integration.js";
|
|
12
|
+
|
|
13
|
+
let server: WebSocketServer | undefined;
|
|
14
|
+
|
|
15
|
+
/** The WebSocket server. Throws before the runtime has started. */
|
|
16
|
+
export function websockets(): WebSocketServer {
|
|
17
|
+
if (server === undefined) {
|
|
18
|
+
throw new Error("The WebSocket server is not running: start the runtime first.");
|
|
19
|
+
}
|
|
20
|
+
return server;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Sends \`data\` to every open connection. */
|
|
24
|
+
export function broadcast(data: string): void {
|
|
25
|
+
for (const socket of websockets().clients) {
|
|
26
|
+
if (socket.readyState === socket.OPEN) socket.send(data);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const websocketsIntegration: Integration = {
|
|
31
|
+
name: "websockets",
|
|
32
|
+
|
|
33
|
+
async start({ config, httpServer, logger }) {
|
|
34
|
+
if (httpServer === undefined) {
|
|
35
|
+
throw new Error("WebSockets need the HTTP server: pass httpServer to createApp().");
|
|
36
|
+
}
|
|
37
|
+
const allowed = new Set(config.corsOrigins);
|
|
38
|
+
server = new WebSocketServer({
|
|
39
|
+
server: httpServer,
|
|
40
|
+
path: config.websockets.path,
|
|
41
|
+
maxPayload: 64 * 1024,
|
|
42
|
+
// A browser always sends Origin; refuse pages from origins not in
|
|
43
|
+
// CORS_ORIGINS. Clients without Origin are not browsers.
|
|
44
|
+
verifyClient: ({ origin }: { origin?: string }) =>
|
|
45
|
+
origin === undefined || origin === "" || allowed.has(origin),
|
|
46
|
+
});
|
|
47
|
+
server.on("connection", (socket: WebSocket) => {
|
|
48
|
+
socket.on("error", (error: Error) => logger.warn("WebSocket error", { error }));
|
|
49
|
+
// Example handler: echo each message back. Replace with your protocol.
|
|
50
|
+
socket.on("message", (data) => socket.send(data.toString()));
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
async drain() {
|
|
55
|
+
for (const socket of server?.clients ?? []) socket.close(1001, "Server shutting down");
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
async stop() {
|
|
59
|
+
const current = server;
|
|
60
|
+
server = undefined;
|
|
61
|
+
if (current === undefined) return;
|
|
62
|
+
for (const socket of current.clients) socket.terminate();
|
|
63
|
+
await new Promise<void>((resolve) => current.close(() => resolve()));
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
async health() {
|
|
67
|
+
return server !== undefined;
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
`;
|
|
71
|
+
export const websocketsRecipe = {
|
|
72
|
+
scope: "app",
|
|
73
|
+
feature: "websockets",
|
|
74
|
+
summary: "WebSocket server attached to the HTTP server (src/integrations/websockets.ts)",
|
|
75
|
+
dependencies: { ws: DEPENDENCY_VERSION_RANGES.ws },
|
|
76
|
+
devDependencies: { "@types/ws": DEPENDENCY_VERSION_RANGES["@types/ws"] },
|
|
77
|
+
env: () => [{ name: "WEBSOCKET_PATH", value: "/ws" }],
|
|
78
|
+
configSection: `websockets: Object.freeze({ path: text(config, "websocket_path", "/ws") }),`,
|
|
79
|
+
integration: { file: "websockets.ts", exportName: "websocketsIntegration", source },
|
|
80
|
+
nextSteps: () => [
|
|
81
|
+
`Connect to ws://localhost:<PORT>/ws; browsers must be on an origin listed in CORS_ORIGINS.`,
|
|
82
|
+
],
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=websockets.recipe.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — `compose.yaml` for `zudojs add docker`.
|
|
3
|
+
*
|
|
4
|
+
* One service per backend app plus one per enabled integration that needs
|
|
5
|
+
* a server: `postgres` (database), `redis` and `mailpit` (email, SMTP on
|
|
6
|
+
* 1025, web UI on 8025). Backing services publish on 127.0.0.1 only, and
|
|
7
|
+
* the Postgres password is read from `.env` (POSTGRES_PASSWORD): compose
|
|
8
|
+
* refuses to start without it, so no credential is written into the file.
|
|
9
|
+
*/
|
|
10
|
+
import type { ProjectRecipeContext } from "../recipe.type.js";
|
|
11
|
+
/**
|
|
12
|
+
* Whether compose runs a `postgres` service. The `database` capability is
|
|
13
|
+
* recorded for MySQL and SQLite projects too, which used to get a Postgres
|
|
14
|
+
* container and a DATABASE_URL overriding their own.
|
|
15
|
+
*/
|
|
16
|
+
export declare function usesPostgres(context: ProjectRecipeContext): boolean;
|
|
17
|
+
/** Renders `compose.yaml`. */
|
|
18
|
+
export declare function renderComposeFile(context: ProjectRecipeContext): string;
|
|
19
|
+
//# sourceMappingURL=docker.compose.d.ts.map
|