@hexagen-monaco/sync 0.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/LICENSE +33 -0
- package/README.md +181 -0
- package/dist/application/index.d.ts +3 -0
- package/dist/application/index.d.ts.map +1 -0
- package/dist/application/ports/index.d.ts +2 -0
- package/dist/application/ports/index.d.ts.map +1 -0
- package/dist/application/ports/out/architecture-graph-provider.port.d.ts +6 -0
- package/dist/application/ports/out/architecture-graph-provider.port.d.ts.map +1 -0
- package/dist/application/ports/out/file-system.port.d.ts +22 -0
- package/dist/application/ports/out/file-system.port.d.ts.map +1 -0
- package/dist/application/ports/out/generator-config.port.d.ts +51 -0
- package/dist/application/ports/out/generator-config.port.d.ts.map +1 -0
- package/dist/application/ports/out/index.d.ts +9 -0
- package/dist/application/ports/out/index.d.ts.map +1 -0
- package/dist/application/ports/out/linter-report-provider.port.d.ts +6 -0
- package/dist/application/ports/out/linter-report-provider.port.d.ts.map +1 -0
- package/dist/application/ports/out/ownership-registry.port.d.ts +35 -0
- package/dist/application/ports/out/ownership-registry.port.d.ts.map +1 -0
- package/dist/application/ports/out/project-configuration-read.port.d.ts +9 -0
- package/dist/application/ports/out/project-configuration-read.port.d.ts.map +1 -0
- package/dist/application/ports/out/symbol-reference-provider.port.d.ts +10 -0
- package/dist/application/ports/out/symbol-reference-provider.port.d.ts.map +1 -0
- package/dist/application/ports/out/workspace-file-provider.port.d.ts +14 -0
- package/dist/application/ports/out/workspace-file-provider.port.d.ts.map +1 -0
- package/dist/application/use-cases/get-architecture-graph.use-case.d.ts +8 -0
- package/dist/application/use-cases/get-architecture-graph.use-case.d.ts.map +1 -0
- package/dist/application/use-cases/get-linter-report.use-case.d.ts +8 -0
- package/dist/application/use-cases/get-linter-report.use-case.d.ts.map +1 -0
- package/dist/application/use-cases/get-manifest-resource.use-case.d.ts +8 -0
- package/dist/application/use-cases/get-manifest-resource.use-case.d.ts.map +1 -0
- package/dist/application/use-cases/index.d.ts +4 -0
- package/dist/application/use-cases/index.d.ts.map +1 -0
- package/dist/application/use-cases/refactoring-impact.use-case.d.ts +29 -0
- package/dist/application/use-cases/refactoring-impact.use-case.d.ts.map +1 -0
- package/dist/application/use-cases/stub-generation.use-case.d.ts +23 -0
- package/dist/application/use-cases/stub-generation.use-case.d.ts.map +1 -0
- package/dist/arch-linter-bin.d.ts +20 -0
- package/dist/arch-linter-bin.d.ts.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +12149 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/add/index.d.ts +8 -0
- package/dist/commands/add/index.d.ts.map +1 -0
- package/dist/commands/add/validate.d.ts +2 -0
- package/dist/commands/add/validate.d.ts.map +1 -0
- package/dist/commands/arch/add.d.ts +3 -0
- package/dist/commands/arch/add.d.ts.map +1 -0
- package/dist/commands/arch/context/command.d.ts +4 -0
- package/dist/commands/arch/context/command.d.ts.map +1 -0
- package/dist/commands/arch/context/persistence.d.ts +22 -0
- package/dist/commands/arch/context/persistence.d.ts.map +1 -0
- package/dist/commands/arch/context/wizard.d.ts +7 -0
- package/dist/commands/arch/context/wizard.d.ts.map +1 -0
- package/dist/commands/arch/diff.d.ts +3 -0
- package/dist/commands/arch/diff.d.ts.map +1 -0
- package/dist/commands/arch/edit.d.ts +9 -0
- package/dist/commands/arch/edit.d.ts.map +1 -0
- package/dist/commands/arch/index.d.ts +3 -0
- package/dist/commands/arch/index.d.ts.map +1 -0
- package/dist/commands/arch/list.d.ts +2 -0
- package/dist/commands/arch/list.d.ts.map +1 -0
- package/dist/commands/arch/port/persistence.d.ts +28 -0
- package/dist/commands/arch/port/persistence.d.ts.map +1 -0
- package/dist/commands/arch/port.d.ts +4 -0
- package/dist/commands/arch/port.d.ts.map +1 -0
- package/dist/commands/arch/refactor-rename-entity.d.ts +3 -0
- package/dist/commands/arch/refactor-rename-entity.d.ts.map +1 -0
- package/dist/commands/arch/refactor-rename-port.d.ts +3 -0
- package/dist/commands/arch/refactor-rename-port.d.ts.map +1 -0
- package/dist/commands/arch/refactor-rename-use-case.d.ts +3 -0
- package/dist/commands/arch/refactor-rename-use-case.d.ts.map +1 -0
- package/dist/commands/arch/refactor-shared.d.ts +11 -0
- package/dist/commands/arch/refactor-shared.d.ts.map +1 -0
- package/dist/commands/arch/refactor.d.ts +3 -0
- package/dist/commands/arch/refactor.d.ts.map +1 -0
- package/dist/commands/arch/remove/context.d.ts +7 -0
- package/dist/commands/arch/remove/context.d.ts.map +1 -0
- package/dist/commands/arch/remove/port.d.ts +7 -0
- package/dist/commands/arch/remove/port.d.ts.map +1 -0
- package/dist/commands/arch/remove.d.ts +3 -0
- package/dist/commands/arch/remove.d.ts.map +1 -0
- package/dist/commands/arch/validate.d.ts +2 -0
- package/dist/commands/arch/validate.d.ts.map +1 -0
- package/dist/commands/manifest/index.d.ts +3 -0
- package/dist/commands/manifest/index.d.ts.map +1 -0
- package/dist/commands/manifest/split-utils.d.ts +8 -0
- package/dist/commands/manifest/split-utils.d.ts.map +1 -0
- package/dist/commands/manifest/split.d.ts +3 -0
- package/dist/commands/manifest/split.d.ts.map +1 -0
- package/dist/commands/shared/confirm.d.ts +5 -0
- package/dist/commands/shared/confirm.d.ts.map +1 -0
- package/dist/commands/shared/error-formatter.d.ts +7 -0
- package/dist/commands/shared/error-formatter.d.ts.map +1 -0
- package/dist/commands/shared/index.d.ts +15 -0
- package/dist/commands/shared/index.d.ts.map +1 -0
- package/dist/commands/shared/project-root.d.ts +3 -0
- package/dist/commands/shared/project-root.d.ts.map +1 -0
- package/dist/commands/shared/prompt-service.d.ts +15 -0
- package/dist/commands/shared/prompt-service.d.ts.map +1 -0
- package/dist/commands/shared/spinner.d.ts +13 -0
- package/dist/commands/shared/spinner.d.ts.map +1 -0
- package/dist/commands/shared/template-engine-path.d.ts +12 -0
- package/dist/commands/shared/template-engine-path.d.ts.map +1 -0
- package/dist/commands/shared/validation.d.ts +15 -0
- package/dist/commands/shared/validation.d.ts.map +1 -0
- package/dist/commands/shared/yaml-service.d.ts +23 -0
- package/dist/commands/shared/yaml-service.d.ts.map +1 -0
- package/dist/commands/templates/index.d.ts +3 -0
- package/dist/commands/templates/index.d.ts.map +1 -0
- package/dist/commands/templates/info.d.ts +2 -0
- package/dist/commands/templates/info.d.ts.map +1 -0
- package/dist/commands/templates/list.d.ts +2 -0
- package/dist/commands/templates/list.d.ts.map +1 -0
- package/dist/config/barrel-exclusions.d.ts +10 -0
- package/dist/config/barrel-exclusions.d.ts.map +1 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/domain/index.d.ts +5 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/result.d.ts +4 -0
- package/dist/domain/result.d.ts.map +1 -0
- package/dist/domain/services/architectural-boundary-checker.d.ts +18 -0
- package/dist/domain/services/architectural-boundary-checker.d.ts.map +1 -0
- package/dist/domain/services/emission-plan-builder.d.ts +17 -0
- package/dist/domain/services/emission-plan-builder.d.ts.map +1 -0
- package/dist/domain/services/impact-analysis.types.d.ts +24 -0
- package/dist/domain/services/impact-analysis.types.d.ts.map +1 -0
- package/dist/domain/services/impact-request-validator.d.ts +14 -0
- package/dist/domain/services/impact-request-validator.d.ts.map +1 -0
- package/dist/domain/services/index.d.ts +7 -0
- package/dist/domain/services/index.d.ts.map +1 -0
- package/dist/domain/services/layer-classifier.d.ts +4 -0
- package/dist/domain/services/layer-classifier.d.ts.map +1 -0
- package/dist/domain/services/stub-template-resolver.d.ts +16 -0
- package/dist/domain/services/stub-template-resolver.d.ts.map +1 -0
- package/dist/domain/session.d.ts +6 -0
- package/dist/domain/session.d.ts.map +1 -0
- package/dist/domain/stub-templates.d.ts +8 -0
- package/dist/domain/stub-templates.d.ts.map +1 -0
- package/dist/domain/types.d.ts +4 -0
- package/dist/domain/types.d.ts.map +1 -0
- package/dist/fs-utils.d.ts +28 -0
- package/dist/fs-utils.d.ts.map +1 -0
- package/dist/generators/apps-framework-templates.d.ts +4 -0
- package/dist/generators/apps-framework-templates.d.ts.map +1 -0
- package/dist/generators/apps.d.ts +5 -0
- package/dist/generators/apps.d.ts.map +1 -0
- package/dist/generators/architecture-file-templates.d.ts +9 -0
- package/dist/generators/architecture-file-templates.d.ts.map +1 -0
- package/dist/generators/architecture-files.d.ts +5 -0
- package/dist/generators/architecture-files.d.ts.map +1 -0
- package/dist/generators/barrels/index.d.ts +6 -0
- package/dist/generators/barrels/index.d.ts.map +1 -0
- package/dist/generators/barrels/recursive.d.ts +44 -0
- package/dist/generators/barrels/recursive.d.ts.map +1 -0
- package/dist/generators/barrels/utils.d.ts +56 -0
- package/dist/generators/barrels/utils.d.ts.map +1 -0
- package/dist/generators/barrels.d.ts +31 -0
- package/dist/generators/barrels.d.ts.map +1 -0
- package/dist/generators/eslint.d.ts +47 -0
- package/dist/generators/eslint.d.ts.map +1 -0
- package/dist/generators/layer-folders.d.ts +16 -0
- package/dist/generators/layer-folders.d.ts.map +1 -0
- package/dist/generators/migration-assistant.d.ts +7 -0
- package/dist/generators/migration-assistant.d.ts.map +1 -0
- package/dist/generators/migration-audit.d.ts +28 -0
- package/dist/generators/migration-audit.d.ts.map +1 -0
- package/dist/generators/migration-stubs.d.ts +7 -0
- package/dist/generators/migration-stubs.d.ts.map +1 -0
- package/dist/generators/package-json.d.ts +11 -0
- package/dist/generators/package-json.d.ts.map +1 -0
- package/dist/generators/port-analyzer.d.ts +56 -0
- package/dist/generators/port-analyzer.d.ts.map +1 -0
- package/dist/generators/reap.d.ts +11 -0
- package/dist/generators/reap.d.ts.map +1 -0
- package/dist/generators/root-file-templates.d.ts +8 -0
- package/dist/generators/root-file-templates.d.ts.map +1 -0
- package/dist/generators/root-files.d.ts +5 -0
- package/dist/generators/root-files.d.ts.map +1 -0
- package/dist/generators/stubs/index.d.ts +4 -0
- package/dist/generators/stubs/index.d.ts.map +1 -0
- package/dist/generators/stubs/stub-templates.d.ts +3 -0
- package/dist/generators/stubs/stub-templates.d.ts.map +1 -0
- package/dist/generators/stubs.d.ts +5 -0
- package/dist/generators/stubs.d.ts.map +1 -0
- package/dist/generators/test-generator.d.ts +7 -0
- package/dist/generators/test-generator.d.ts.map +1 -0
- package/dist/generators/test-templates/data-builder.d.ts +2 -0
- package/dist/generators/test-templates/data-builder.d.ts.map +1 -0
- package/dist/generators/test-templates/enhanced-test-double.d.ts +2 -0
- package/dist/generators/test-templates/enhanced-test-double.d.ts.map +1 -0
- package/dist/generators/test-templates/index.d.ts +5 -0
- package/dist/generators/test-templates/index.d.ts.map +1 -0
- package/dist/generators/test-templates/integration-test.d.ts +2 -0
- package/dist/generators/test-templates/integration-test.d.ts.map +1 -0
- package/dist/generators/test-templates/unit-test.d.ts +2 -0
- package/dist/generators/test-templates/unit-test.d.ts.map +1 -0
- package/dist/generators/tsconfig.d.ts +16 -0
- package/dist/generators/tsconfig.d.ts.map +1 -0
- package/dist/generators/validators/index.d.ts +11 -0
- package/dist/generators/validators/index.d.ts.map +1 -0
- package/dist/generators/validators/validate-dependencies.d.ts +7 -0
- package/dist/generators/validators/validate-dependencies.d.ts.map +1 -0
- package/dist/generators/validators/validate-manifest-sync.d.ts +5 -0
- package/dist/generators/validators/validate-manifest-sync.d.ts.map +1 -0
- package/dist/generators/validators/validate-port-adapter.d.ts +5 -0
- package/dist/generators/validators/validate-port-adapter.d.ts.map +1 -0
- package/dist/generators/validators/validation-types.d.ts +20 -0
- package/dist/generators/validators/validation-types.d.ts.map +1 -0
- package/dist/generators/validators.d.ts +7 -0
- package/dist/generators/validators.d.ts.map +1 -0
- package/dist/generators/wiring.d.ts +20 -0
- package/dist/generators/wiring.d.ts.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8070 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/adapters/atomic-file-system.adapter.d.ts +13 -0
- package/dist/infrastructure/adapters/atomic-file-system.adapter.d.ts.map +1 -0
- package/dist/infrastructure/adapters/file-system-workspace.adapter.d.ts +12 -0
- package/dist/infrastructure/adapters/file-system-workspace.adapter.d.ts.map +1 -0
- package/dist/infrastructure/adapters/in-memory-config-double.d.ts +30 -0
- package/dist/infrastructure/adapters/in-memory-config-double.d.ts.map +1 -0
- package/dist/infrastructure/adapters/index.d.ts +5 -0
- package/dist/infrastructure/adapters/index.d.ts.map +1 -0
- package/dist/infrastructure/adapters/yaml-config.adapter.d.ts +38 -0
- package/dist/infrastructure/adapters/yaml-config.adapter.d.ts.map +1 -0
- package/dist/infrastructure/index.d.ts +2 -0
- package/dist/infrastructure/index.d.ts.map +1 -0
- package/dist/linter.d.ts +7 -0
- package/dist/linter.d.ts.map +1 -0
- package/dist/loaders/index.d.ts +2 -0
- package/dist/loaders/index.d.ts.map +1 -0
- package/dist/loaders/manifest-merge-loader.d.ts +3 -0
- package/dist/loaders/manifest-merge-loader.d.ts.map +1 -0
- package/dist/lock.d.ts +14 -0
- package/dist/lock.d.ts.map +1 -0
- package/dist/manifest-service.d.ts +10 -0
- package/dist/manifest-service.d.ts.map +1 -0
- package/dist/migration-report.d.ts +12 -0
- package/dist/migration-report.d.ts.map +1 -0
- package/dist/preflight.d.ts +7 -0
- package/dist/preflight.d.ts.map +1 -0
- package/dist/refactoring/git-operations.d.ts +9 -0
- package/dist/refactoring/git-operations.d.ts.map +1 -0
- package/dist/refactoring/impact-analyzer.d.ts +23 -0
- package/dist/refactoring/impact-analyzer.d.ts.map +1 -0
- package/dist/refactoring/index.d.ts +6 -0
- package/dist/refactoring/index.d.ts.map +1 -0
- package/dist/refactoring/refactoring-engine.d.ts +40 -0
- package/dist/refactoring/refactoring-engine.d.ts.map +1 -0
- package/dist/refactoring/refactoring-patterns/base-pattern.d.ts +37 -0
- package/dist/refactoring/refactoring-patterns/base-pattern.d.ts.map +1 -0
- package/dist/refactoring/refactoring-patterns/index.d.ts +5 -0
- package/dist/refactoring/refactoring-patterns/index.d.ts.map +1 -0
- package/dist/refactoring/refactoring-patterns/refactoring-utils.d.ts +8 -0
- package/dist/refactoring/refactoring-patterns/refactoring-utils.d.ts.map +1 -0
- package/dist/refactoring/refactoring-patterns/rename-entity.pattern.d.ts +19 -0
- package/dist/refactoring/refactoring-patterns/rename-entity.pattern.d.ts.map +1 -0
- package/dist/refactoring/refactoring-patterns/rename-port.pattern.d.ts +42 -0
- package/dist/refactoring/refactoring-patterns/rename-port.pattern.d.ts.map +1 -0
- package/dist/refactoring/refactoring-patterns/rename-use-case.pattern.d.ts +40 -0
- package/dist/refactoring/refactoring-patterns/rename-use-case.pattern.d.ts.map +1 -0
- package/dist/refactoring/safe-refactoring-orchestrator.d.ts +24 -0
- package/dist/refactoring/safe-refactoring-orchestrator.d.ts.map +1 -0
- package/dist/refactoring/validation-suite.d.ts +20 -0
- package/dist/refactoring/validation-suite.d.ts.map +1 -0
- package/dist/results.d.ts +16 -0
- package/dist/results.d.ts.map +1 -0
- package/dist/sync-engine-helpers.d.ts +15 -0
- package/dist/sync-engine-helpers.d.ts.map +1 -0
- package/dist/sync-engine-init.d.ts +12 -0
- package/dist/sync-engine-init.d.ts.map +1 -0
- package/dist/sync-engine.d.ts +21 -0
- package/dist/sync-engine.d.ts.map +1 -0
- package/dist/template-engine.d.ts +3 -0
- package/dist/template-engine.d.ts.map +1 -0
- package/dist/templates/__example__/files/example-output.txt +9 -0
- package/dist/templates/__example__/manifest.json +44 -0
- package/dist/templates/adobe-creative-production/README.md +89 -0
- package/dist/templates/adobe-creative-production/files/.env.adobe-creative-production.example +6 -0
- package/dist/templates/adobe-creative-production/files/src/domain/ports/out/creative-production.port.ts +62 -0
- package/dist/templates/adobe-creative-production/files/src/infrastructure/adobe/creative-production/creative-production.adapter.ts +144 -0
- package/dist/templates/adobe-creative-production/manifest.json +25 -0
- package/dist/templates/adobe-express/README.md +85 -0
- package/dist/templates/adobe-express/files/.env.adobe-express.example +7 -0
- package/dist/templates/adobe-express/files/src/domain/ports/out/express.port.ts +47 -0
- package/dist/templates/adobe-express/files/src/infrastructure/adobe/express/express.adapter.ts +155 -0
- package/dist/templates/adobe-express/manifest.json +32 -0
- package/dist/templates/adobe-firefly-composite/README.md +75 -0
- package/dist/templates/adobe-firefly-composite/files/.env.adobe-composite.example +5 -0
- package/dist/templates/adobe-firefly-composite/files/src/domain/ports/out/composite.port.ts +39 -0
- package/dist/templates/adobe-firefly-composite/files/src/infrastructure/adobe/composite/composite.adapter.ts +102 -0
- package/dist/templates/adobe-firefly-composite/manifest.json +32 -0
- package/dist/templates/adobe-firefly-content-tagging/README.md +70 -0
- package/dist/templates/adobe-firefly-content-tagging/files/.env.adobe-content-tagging.example +4 -0
- package/dist/templates/adobe-firefly-content-tagging/files/src/domain/ports/out/content-tagging.port.ts +28 -0
- package/dist/templates/adobe-firefly-content-tagging/files/src/infrastructure/adobe/content-tagging/content-tagging.adapter.ts +120 -0
- package/dist/templates/adobe-firefly-content-tagging/manifest.json +31 -0
- package/dist/templates/adobe-firefly-core/README.md +147 -0
- package/dist/templates/adobe-firefly-core/files/.env.adobe.example +15 -0
- package/dist/templates/adobe-firefly-core/files/src/domain/ports/out/firefly-auth.port.ts +11 -0
- package/dist/templates/adobe-firefly-core/files/src/domain/ports/out/firefly-job.port.ts +50 -0
- package/dist/templates/adobe-firefly-core/files/src/domain/ports/out/firefly-storage.port.ts +20 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/auth/ims-token-provider.adapter.ts +112 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/auth/smoke-token.ts +17 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/errors/firefly-errors.ts +91 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/http/firefly-client.ts +135 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/index.ts +46 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/jobs/job-poller.ts +52 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/jobs/job-port.ts +149 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/jobs/job-result.ts +113 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/jobs/webhook-verifier.ts +67 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/storage/passthrough-storage.adapter.ts +36 -0
- package/dist/templates/adobe-firefly-core/manifest.json +86 -0
- package/dist/templates/adobe-firefly-custom-models/README.md +96 -0
- package/dist/templates/adobe-firefly-custom-models/files/.env.adobe-custom-models.example +6 -0
- package/dist/templates/adobe-firefly-custom-models/files/src/domain/ports/out/custom-model.port.ts +77 -0
- package/dist/templates/adobe-firefly-custom-models/files/src/infrastructure/adobe/custom-models/firefly-custom-model.adapter.ts +199 -0
- package/dist/templates/adobe-firefly-custom-models/manifest.json +33 -0
- package/dist/templates/adobe-firefly-generate/README.md +86 -0
- package/dist/templates/adobe-firefly-generate/files/.env.adobe-generate.example +5 -0
- package/dist/templates/adobe-firefly-generate/files/src/domain/ports/out/image-generation.port.ts +61 -0
- package/dist/templates/adobe-firefly-generate/files/src/infrastructure/adobe/generate/firefly-generate.adapter.ts +167 -0
- package/dist/templates/adobe-firefly-generate/manifest.json +45 -0
- package/dist/templates/adobe-firefly-media/README.md +99 -0
- package/dist/templates/adobe-firefly-media/files/.env.adobe-media.example +8 -0
- package/dist/templates/adobe-firefly-media/files/src/domain/ports/out/media-generation.port.ts +80 -0
- package/dist/templates/adobe-firefly-media/files/src/infrastructure/adobe/media/firefly-media.adapter.ts +161 -0
- package/dist/templates/adobe-firefly-media/manifest.json +32 -0
- package/dist/templates/adobe-firefly-storage-azure/README.md +88 -0
- package/dist/templates/adobe-firefly-storage-azure/files/.env.adobe-storage-azure.example +9 -0
- package/dist/templates/adobe-firefly-storage-azure/files/src/infrastructure/adobe/storage/azure-blob-presign.adapter.ts +171 -0
- package/dist/templates/adobe-firefly-storage-azure/files/src/infrastructure/adobe/storage/azure-register.ts +15 -0
- package/dist/templates/adobe-firefly-storage-azure/manifest.json +37 -0
- package/dist/templates/adobe-firefly-storage-gcs/README.md +85 -0
- package/dist/templates/adobe-firefly-storage-gcs/files/.env.adobe-storage-gcs.example +8 -0
- package/dist/templates/adobe-firefly-storage-gcs/files/src/infrastructure/adobe/storage/gcs-presign.adapter.ts +100 -0
- package/dist/templates/adobe-firefly-storage-gcs/files/src/infrastructure/adobe/storage/gcs-register.ts +15 -0
- package/dist/templates/adobe-firefly-storage-gcs/manifest.json +33 -0
- package/dist/templates/adobe-firefly-storage-s3/README.md +76 -0
- package/dist/templates/adobe-firefly-storage-s3/files/.env.adobe-storage-s3.example +8 -0
- package/dist/templates/adobe-firefly-storage-s3/files/src/infrastructure/adobe/storage/s3-presign.adapter.ts +109 -0
- package/dist/templates/adobe-firefly-storage-s3/files/src/infrastructure/adobe/storage/s3-register.ts +15 -0
- package/dist/templates/adobe-firefly-storage-s3/manifest.json +31 -0
- package/dist/templates/adobe-firefly-upscale/README.md +68 -0
- package/dist/templates/adobe-firefly-upscale/files/.env.adobe-upscale.example +3 -0
- package/dist/templates/adobe-firefly-upscale/files/src/domain/ports/out/upscale.port.ts +25 -0
- package/dist/templates/adobe-firefly-upscale/files/src/infrastructure/adobe/upscale/upscale.adapter.ts +85 -0
- package/dist/templates/adobe-firefly-upscale/manifest.json +30 -0
- package/dist/templates/adobe-illustrator/README.md +80 -0
- package/dist/templates/adobe-illustrator/files/.env.adobe-illustrator.example +7 -0
- package/dist/templates/adobe-illustrator/files/src/domain/ports/out/illustrator.port.ts +51 -0
- package/dist/templates/adobe-illustrator/files/src/infrastructure/adobe/illustrator/illustrator.adapter.ts +167 -0
- package/dist/templates/adobe-illustrator/manifest.json +38 -0
- package/dist/templates/adobe-ims-spa/README.md +99 -0
- package/dist/templates/adobe-ims-spa/files/.env.adobe-ims.example +12 -0
- package/dist/templates/adobe-ims-spa/files/app/api/auth/callback/route.ts +84 -0
- package/dist/templates/adobe-ims-spa/files/app/api/auth/login/route.ts +30 -0
- package/dist/templates/adobe-ims-spa/files/app/api/auth/logout/route.ts +24 -0
- package/dist/templates/adobe-ims-spa/files/app/api/auth/me/route.ts +18 -0
- package/dist/templates/adobe-ims-spa/files/middleware.ts +74 -0
- package/dist/templates/adobe-ims-spa/files/src/domain/ports/out/ims-auth.port.ts +24 -0
- package/dist/templates/adobe-ims-spa/files/src/infrastructure/auth/adobe-ims/adobe-ims-auth.adapter.ts +71 -0
- package/dist/templates/adobe-ims-spa/files/src/infrastructure/auth/adobe-ims/config.ts +34 -0
- package/dist/templates/adobe-ims-spa/files/src/infrastructure/auth/adobe-ims/ims-client.ts +85 -0
- package/dist/templates/adobe-ims-spa/files/src/infrastructure/auth/adobe-ims/pkce.ts +37 -0
- package/dist/templates/adobe-ims-spa/files/src/infrastructure/auth/adobe-ims/token-store.ts +54 -0
- package/dist/templates/adobe-ims-spa/files/src/infrastructure/auth/adobe-ims/user-profile-mapper.ts +12 -0
- package/dist/templates/adobe-ims-spa/files/src/lib/auth/get-current-user.ts +56 -0
- package/dist/templates/adobe-ims-spa/files/src/lib/auth/require-auth.ts +11 -0
- package/dist/templates/adobe-ims-spa/manifest.json +88 -0
- package/dist/templates/adobe-indesign/README.md +76 -0
- package/dist/templates/adobe-indesign/files/.env.adobe-indesign.example +7 -0
- package/dist/templates/adobe-indesign/files/src/domain/ports/out/indesign.port.ts +43 -0
- package/dist/templates/adobe-indesign/files/src/infrastructure/adobe/indesign/indesign.adapter.ts +160 -0
- package/dist/templates/adobe-indesign/manifest.json +38 -0
- package/dist/templates/adobe-lightroom/README.md +81 -0
- package/dist/templates/adobe-lightroom/files/.env.adobe-lightroom.example +7 -0
- package/dist/templates/adobe-lightroom/files/src/domain/ports/out/lightroom.port.ts +36 -0
- package/dist/templates/adobe-lightroom/files/src/infrastructure/adobe/lightroom/lightroom.adapter.ts +145 -0
- package/dist/templates/adobe-lightroom/manifest.json +39 -0
- package/dist/templates/adobe-photoshop/README.md +87 -0
- package/dist/templates/adobe-photoshop/files/.env.adobe-photoshop.example +7 -0
- package/dist/templates/adobe-photoshop/files/src/domain/ports/out/photoshop-automation.port.ts +60 -0
- package/dist/templates/adobe-photoshop/files/src/infrastructure/adobe/photoshop/photoshop-automation.adapter.ts +180 -0
- package/dist/templates/adobe-photoshop/manifest.json +45 -0
- package/dist/templates/adobe-substance-3d/README.md +88 -0
- package/dist/templates/adobe-substance-3d/files/.env.adobe-substance-3d.example +12 -0
- package/dist/templates/adobe-substance-3d/files/src/domain/ports/out/substance-3d.port.ts +45 -0
- package/dist/templates/adobe-substance-3d/files/src/infrastructure/adobe/substance-3d/substance-3d.adapter.ts +177 -0
- package/dist/templates/adobe-substance-3d/manifest.json +39 -0
- package/dist/templates/agents-md/README.md +55 -0
- package/dist/templates/agents-md/files/.agents/architecture.md +42 -0
- package/dist/templates/agents-md/files/.agents/git.md +30 -0
- package/dist/templates/agents-md/files/.agents/session-log.md +37 -0
- package/dist/templates/agents-md/files/.agents/tech-stack.md +34 -0
- package/dist/templates/agents-md/files/.agents/testing.md +30 -0
- package/dist/templates/agents-md/files/AGENTS.md +97 -0
- package/dist/templates/agents-md/manifest.json +49 -0
- package/dist/templates/auth-mock/README.md +57 -0
- package/dist/templates/auth-mock/files/.env.auth.example +9 -0
- package/dist/templates/auth-mock/files/middleware.ts +28 -0
- package/dist/templates/auth-mock/manifest.json +23 -0
- package/dist/templates/bedrock-agentcore-runtime/README.md +68 -0
- package/dist/templates/bedrock-agentcore-runtime/files/.env.agentcore.example +19 -0
- package/dist/templates/bedrock-agentcore-runtime/files/.github/workflows/deploy-agentcore.yml +100 -0
- package/dist/templates/bedrock-agentcore-runtime/files/Dockerfile.agentcore +33 -0
- package/dist/templates/bedrock-agentcore-runtime/files/agentcore/agentcore.json +16 -0
- package/dist/templates/bedrock-agentcore-runtime/files/agentcore/aws-targets.json +7 -0
- package/dist/templates/bedrock-agentcore-runtime/files/iam/agentcore-runtime-role.policy.json +49 -0
- package/dist/templates/bedrock-agentcore-runtime/files/infra/agentcore-stack.ts +90 -0
- package/dist/templates/bedrock-agentcore-runtime/files/src/infrastructure/agentcore/http/invocations.handler.ts +152 -0
- package/dist/templates/bedrock-agentcore-runtime/files/src/infrastructure/agentcore/http/ping.handler.ts +13 -0
- package/dist/templates/bedrock-agentcore-runtime/files/src/infrastructure/agentcore/http/server.ts +134 -0
- package/dist/templates/bedrock-agentcore-runtime/files/src/infrastructure/agentcore/runtime/payload.ts +63 -0
- package/dist/templates/bedrock-agentcore-runtime/files/src/infrastructure/agentcore/runtime/session.ts +58 -0
- package/dist/templates/bedrock-agentcore-runtime/manifest.json +89 -0
- package/dist/templates/bedrock-agentcore-services/README.md +65 -0
- package/dist/templates/bedrock-agentcore-services/files/.env.agentcore-services.example +20 -0
- package/dist/templates/bedrock-agentcore-services/files/agentcore/agentcore-services.json +14 -0
- package/dist/templates/bedrock-agentcore-services/files/src/domain/ports/out/agent-identity.port.ts +26 -0
- package/dist/templates/bedrock-agentcore-services/files/src/domain/ports/out/agent-memory.port.ts +30 -0
- package/dist/templates/bedrock-agentcore-services/files/src/domain/ports/out/tool-gateway.port.ts +27 -0
- package/dist/templates/bedrock-agentcore-services/files/src/infrastructure/agentcore/gateway/agentcore-gateway.adapter.ts +103 -0
- package/dist/templates/bedrock-agentcore-services/files/src/infrastructure/agentcore/gateway/mcp-tool-mapper.ts +44 -0
- package/dist/templates/bedrock-agentcore-services/files/src/infrastructure/agentcore/identity/agentcore-identity.adapter.ts +82 -0
- package/dist/templates/bedrock-agentcore-services/files/src/infrastructure/agentcore/identity/idp-bridge.ts +74 -0
- package/dist/templates/bedrock-agentcore-services/files/src/infrastructure/agentcore/memory/agentcore-memory.adapter.ts +82 -0
- package/dist/templates/bedrock-agentcore-services/files/src/infrastructure/agentcore/memory/memory-config.ts +45 -0
- package/dist/templates/bedrock-agentcore-services/manifest.json +97 -0
- package/dist/templates/better-auth/README.md +60 -0
- package/dist/templates/better-auth/files/.env.better-auth.example +20 -0
- package/dist/templates/better-auth/files/app/api/auth/[...all]/route.ts +5 -0
- package/dist/templates/better-auth/files/src/db/index.ts +10 -0
- package/dist/templates/better-auth/files/src/db/migrations/0001_better_auth.sql +49 -0
- package/dist/templates/better-auth/files/src/db/schema/better-auth.ts +57 -0
- package/dist/templates/better-auth/files/src/lib/auth-client.ts +13 -0
- package/dist/templates/better-auth/files/src/lib/auth.ts +72 -0
- package/dist/templates/better-auth/manifest.json +71 -0
- package/dist/templates/bullmq/README.md +61 -0
- package/dist/templates/bullmq/files/.env.bullmq.example +34 -0
- package/dist/templates/bullmq/files/app/admin/queues/[[...slug]]/route.ts +103 -0
- package/dist/templates/bullmq/files/scripts/start-worker.ts +55 -0
- package/dist/templates/bullmq/files/server/startup/start-workers.ts +171 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/connection.ts +105 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/fallback/sync-executor.ts +96 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/index.ts +30 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/jobs/ai-generation.job.ts +53 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/jobs/email.job.ts +42 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/jobs/export.job.ts +49 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/jobs/image-processing.job.ts +48 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/jobs/webhook.job.ts +139 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/parse-int-env.ts +28 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/queues.ts +153 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/scheduler/job-scheduler.ts +70 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/workers.ts +101 -0
- package/dist/templates/bullmq/manifest.json +120 -0
- package/dist/templates/ci-github-actions/README.md +62 -0
- package/dist/templates/ci-github-actions/files/.github/dependabot.yml +20 -0
- package/dist/templates/ci-github-actions/files/.github/workflows/ci.yml +103 -0
- package/dist/templates/ci-github-actions/files/.github/workflows/deploy-fly.yml +30 -0
- package/dist/templates/ci-github-actions/files/.github/workflows/deploy-railway.yml +32 -0
- package/dist/templates/ci-github-actions/files/.github/workflows/deploy-vercel.yml +39 -0
- package/dist/templates/ci-github-actions/files/.github/workflows/deploy-vps.yml +34 -0
- package/dist/templates/ci-github-actions/files/.github/workflows/preview.yml +58 -0
- package/dist/templates/ci-github-actions/files/fly.toml +23 -0
- package/dist/templates/ci-github-actions/manifest.json +100 -0
- package/dist/templates/clerk/README.md +59 -0
- package/dist/templates/clerk/files/.env.clerk.example +11 -0
- package/dist/templates/clerk/files/app/(protected)/layout.tsx +18 -0
- package/dist/templates/clerk/files/app/api/protected-example/route.ts +17 -0
- package/dist/templates/clerk/files/middleware.ts +25 -0
- package/dist/templates/clerk/files/src/lib/auth.ts +12 -0
- package/dist/templates/clerk/files/src/lib/role-guard.tsx +32 -0
- package/dist/templates/clerk/manifest.json +67 -0
- package/dist/templates/design-system/README.md +60 -0
- package/dist/templates/design-system/files/.storybook/main.ts +9 -0
- package/dist/templates/design-system/files/.storybook/preview.ts +13 -0
- package/dist/templates/design-system/files/DESIGN.md +76 -0
- package/dist/templates/design-system/files/src/components/ui/button.stories.tsx +17 -0
- package/dist/templates/design-system/files/src/components/ui/button.tsx +61 -0
- package/dist/templates/design-system/files/src/components/ui/card.tsx +40 -0
- package/dist/templates/design-system/files/src/components/ui/index.ts +6 -0
- package/dist/templates/design-system/files/src/components/ui/input.tsx +29 -0
- package/dist/templates/design-system/files/src/lib/cn.ts +13 -0
- package/dist/templates/design-system/files/src/styles/globals.css +37 -0
- package/dist/templates/design-system/files/src/styles/theme.ts +56 -0
- package/dist/templates/design-system/files/src/styles/tokens.css +73 -0
- package/dist/templates/design-system/files/tailwind.config.ts +58 -0
- package/dist/templates/design-system/manifest.json +81 -0
- package/dist/templates/docker/README.md +62 -0
- package/dist/templates/docker/files/.dockerignore +34 -0
- package/dist/templates/docker/files/.github/workflows/docker-build.yml +74 -0
- package/dist/templates/docker/files/Dockerfile +57 -0
- package/dist/templates/docker/files/docker-compose.ci.yml +22 -0
- package/dist/templates/docker/files/docker-compose.override.yml +20 -0
- package/dist/templates/docker/files/docker-compose.yml +109 -0
- package/dist/templates/docker/manifest.json +59 -0
- package/dist/templates/env-setup/README.md +70 -0
- package/dist/templates/env-setup/files/.env.example +28 -0
- package/dist/templates/env-setup/files/.gitignore.hexagen +16 -0
- package/dist/templates/env-setup/files/SETUP.md +70 -0
- package/dist/templates/env-setup/files/scripts/check-env.ts +95 -0
- package/dist/templates/env-setup/files/src/config/env.client.ts +18 -0
- package/dist/templates/env-setup/files/src/config/env.server.ts +49 -0
- package/dist/templates/env-setup/files/src/config/env.ts +14 -0
- package/dist/templates/env-setup/files/src/config/load-env.ts +40 -0
- package/dist/templates/env-setup/manifest.json +55 -0
- package/dist/templates/error-handling/README.md +72 -0
- package/dist/templates/error-handling/files/.env.sentry.example +8 -0
- package/dist/templates/error-handling/files/app/components/ErrorBoundary.tsx +49 -0
- package/dist/templates/error-handling/files/app/components/ErrorFallback.tsx +35 -0
- package/dist/templates/error-handling/files/server/middleware/error-handler.ts +131 -0
- package/dist/templates/error-handling/files/src/application/errors/application.error.ts +33 -0
- package/dist/templates/error-handling/files/src/domain/errors/authorization.error.ts +20 -0
- package/dist/templates/error-handling/files/src/domain/errors/domain.error.ts +23 -0
- package/dist/templates/error-handling/files/src/domain/errors/not-found.error.ts +11 -0
- package/dist/templates/error-handling/files/src/domain/errors/validation.error.ts +17 -0
- package/dist/templates/error-handling/files/src/infrastructure/errors/external-service.error.ts +24 -0
- package/dist/templates/error-handling/files/src/infrastructure/errors/infrastructure.error.ts +22 -0
- package/dist/templates/error-handling/files/src/infrastructure/errors/llm-errors.ts +57 -0
- package/dist/templates/error-handling/files/src/shared/errors/error-codes.ts +29 -0
- package/dist/templates/error-handling/files/src/shared/result.ts +38 -0
- package/dist/templates/error-handling/manifest.json +63 -0
- package/dist/templates/eslint-no-console/README.md +78 -0
- package/dist/templates/eslint-no-console/files/eslint.no-console.mjs +35 -0
- package/dist/templates/eslint-no-console/manifest.json +28 -0
- package/dist/templates/github-oauth/README.md +61 -0
- package/dist/templates/github-oauth/files/.env.github-oauth.example +13 -0
- package/dist/templates/github-oauth/files/app/api/auth/callback/github/route.ts +105 -0
- package/dist/templates/github-oauth/files/app/api/auth/login/github/route.ts +33 -0
- package/dist/templates/github-oauth/files/app/api/auth/logout/github/route.ts +8 -0
- package/dist/templates/github-oauth/files/app/api/auth/me/route.ts +10 -0
- package/dist/templates/github-oauth/files/middleware.ts +59 -0
- package/dist/templates/github-oauth/files/src/infrastructure/auth/github/config.ts +34 -0
- package/dist/templates/github-oauth/files/src/infrastructure/auth/github/github-auth.adapter.ts +12 -0
- package/dist/templates/github-oauth/files/src/infrastructure/auth/github/github-client.ts +95 -0
- package/dist/templates/github-oauth/files/src/infrastructure/auth/github/github-user.ts +8 -0
- package/dist/templates/github-oauth/files/src/infrastructure/auth/github/session-store.ts +56 -0
- package/dist/templates/github-oauth/files/src/infrastructure/auth/github/user-profile-mapper.ts +24 -0
- package/dist/templates/github-oauth/files/src/lib/auth/get-current-user.ts +31 -0
- package/dist/templates/github-oauth/files/src/lib/auth/require-auth.ts +11 -0
- package/dist/templates/github-oauth/manifest.json +83 -0
- package/dist/templates/google-oauth/README.md +70 -0
- package/dist/templates/google-oauth/files/.env.google-oauth.example +14 -0
- package/dist/templates/google-oauth/files/app/api/auth/callback/google/route.ts +78 -0
- package/dist/templates/google-oauth/files/app/api/auth/login/google/route.ts +34 -0
- package/dist/templates/google-oauth/files/app/api/auth/logout/google/route.ts +8 -0
- package/dist/templates/google-oauth/files/app/api/auth/me/route.ts +13 -0
- package/dist/templates/google-oauth/files/middleware.ts +62 -0
- package/dist/templates/google-oauth/files/src/infrastructure/auth/google/config.ts +29 -0
- package/dist/templates/google-oauth/files/src/infrastructure/auth/google/google-auth.adapter.ts +22 -0
- package/dist/templates/google-oauth/files/src/infrastructure/auth/google/google-client.ts +65 -0
- package/dist/templates/google-oauth/files/src/infrastructure/auth/google/google-user.ts +9 -0
- package/dist/templates/google-oauth/files/src/infrastructure/auth/google/session-store.ts +62 -0
- package/dist/templates/google-oauth/files/src/infrastructure/auth/google/user-profile-mapper.ts +24 -0
- package/dist/templates/google-oauth/files/src/lib/auth/get-current-user.ts +36 -0
- package/dist/templates/google-oauth/files/src/lib/auth/require-auth.ts +13 -0
- package/dist/templates/google-oauth/manifest.json +82 -0
- package/dist/templates/langgraph/README.md +60 -0
- package/dist/templates/langgraph/files/.env.langgraph.example +26 -0
- package/dist/templates/langgraph/files/app/api/agent/invoke/route.ts +48 -0
- package/dist/templates/langgraph/files/app/api/agent/resume/route.ts +66 -0
- package/dist/templates/langgraph/files/app/api/agent/stream/route.ts +63 -0
- package/dist/templates/langgraph/files/src/domain/ports/out/agent-graph.port.ts +78 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/adapters/langgraph.adapter.ts +185 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/checkpointers/index.ts +84 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/checkpointers/memory-checkpointer.ts +12 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/checkpointers/postgres-checkpointer.ts +20 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/checkpointers/redis-checkpointer.ts +25 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/checkpointers/supabase-checkpointer.ts +26 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/edges/routing.ts +31 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/graphs/research-agent.graph.ts +81 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/graphs/simple-chain.graph.ts +81 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/index.ts +23 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/nodes/human-review.node.ts +34 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/nodes/input-processor.node.ts +31 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/nodes/llm-call.node.ts +38 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/nodes/output-formatter.node.ts +27 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/nodes/planner.node.ts +51 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/nodes/researcher.node.ts +63 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/nodes/synthesiser.node.ts +62 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/state/graph-state.ts +57 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/streaming/token-stream.ts +84 -0
- package/dist/templates/langgraph/manifest.json +131 -0
- package/dist/templates/llm-adapter/README.md +63 -0
- package/dist/templates/llm-adapter/files/.env.llm.example +49 -0
- package/dist/templates/llm-adapter/files/src/domain/ports/out/llm-client.port.ts +36 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/anthropic-llm-client.adapter.ts +111 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/azure-openai-llm-client.adapter.ts +105 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/ollama-llm-client.adapter.ts +102 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/openai-llm-client.adapter.ts +104 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/xai-llm-client.adapter.ts +104 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/constants/capabilities.ts +38 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/constants/models.ts +39 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/errors/llm-errors.ts +83 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/index.ts +39 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/router/llm-router.ts +117 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/router/provider-registry.ts +45 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/smoke-test.ts +25 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/utils/parse-env.ts +8 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/utils/retry.ts +39 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/utils/structured-output.ts +78 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/utils/timeout.ts +22 -0
- package/dist/templates/llm-adapter/manifest.json +113 -0
- package/dist/templates/llm-adapter-bedrock/README.md +58 -0
- package/dist/templates/llm-adapter-bedrock/files/.env.bedrock.example +23 -0
- package/dist/templates/llm-adapter-bedrock/files/src/infrastructure/llm/adapters/bedrock-llm-client.adapter.ts +126 -0
- package/dist/templates/llm-adapter-bedrock/files/src/infrastructure/llm/adapters/bedrock-register.ts +20 -0
- package/dist/templates/llm-adapter-bedrock/files/src/infrastructure/llm/errors/bedrock-errors.ts +42 -0
- package/dist/templates/llm-adapter-bedrock/manifest.json +51 -0
- package/dist/templates/magic-link/README.md +66 -0
- package/dist/templates/magic-link/files/.env.magic-link.example +24 -0
- package/dist/templates/magic-link/files/app/api/auth/logout/route.ts +12 -0
- package/dist/templates/magic-link/files/app/api/auth/magic-link/request/route.ts +34 -0
- package/dist/templates/magic-link/files/app/api/auth/magic-link/verify/route.ts +41 -0
- package/dist/templates/magic-link/files/app/api/auth/me/route.ts +10 -0
- package/dist/templates/magic-link/files/middleware.ts +60 -0
- package/dist/templates/magic-link/files/src/infrastructure/auth/magic-link/config.ts +17 -0
- package/dist/templates/magic-link/files/src/infrastructure/auth/magic-link/email-templates.ts +46 -0
- package/dist/templates/magic-link/files/src/infrastructure/auth/magic-link/email-transport.ts +71 -0
- package/dist/templates/magic-link/files/src/infrastructure/auth/magic-link/magic-link-auth.adapter.ts +11 -0
- package/dist/templates/magic-link/files/src/infrastructure/auth/magic-link/magic-link-store.ts +31 -0
- package/dist/templates/magic-link/files/src/infrastructure/auth/magic-link/session-store.ts +56 -0
- package/dist/templates/magic-link/files/src/infrastructure/auth/magic-link/token-generator.ts +71 -0
- package/dist/templates/magic-link/files/src/infrastructure/auth/magic-link/user-profile-mapper.ts +10 -0
- package/dist/templates/magic-link/files/src/lib/auth/get-current-user.ts +28 -0
- package/dist/templates/magic-link/files/src/lib/auth/require-auth.ts +11 -0
- package/dist/templates/magic-link/manifest.json +99 -0
- package/dist/templates/microsoft-entra/README.md +63 -0
- package/dist/templates/microsoft-entra/files/.env.microsoft-entra.example +17 -0
- package/dist/templates/microsoft-entra/files/app/api/auth/callback/entra/route.ts +93 -0
- package/dist/templates/microsoft-entra/files/app/api/auth/login/entra/route.ts +29 -0
- package/dist/templates/microsoft-entra/files/app/api/auth/logout/entra/route.ts +26 -0
- package/dist/templates/microsoft-entra/files/app/api/auth/me/route.ts +10 -0
- package/dist/templates/microsoft-entra/files/middleware.ts +59 -0
- package/dist/templates/microsoft-entra/files/src/infrastructure/auth/entra/config.ts +43 -0
- package/dist/templates/microsoft-entra/files/src/infrastructure/auth/entra/entra-auth.adapter.ts +14 -0
- package/dist/templates/microsoft-entra/files/src/infrastructure/auth/entra/entra-client.ts +82 -0
- package/dist/templates/microsoft-entra/files/src/infrastructure/auth/entra/entra-user.ts +9 -0
- package/dist/templates/microsoft-entra/files/src/infrastructure/auth/entra/group-role-mapper.ts +22 -0
- package/dist/templates/microsoft-entra/files/src/infrastructure/auth/entra/pkce.ts +20 -0
- package/dist/templates/microsoft-entra/files/src/infrastructure/auth/entra/session-store.ts +56 -0
- package/dist/templates/microsoft-entra/files/src/infrastructure/auth/entra/user-profile-mapper.ts +33 -0
- package/dist/templates/microsoft-entra/files/src/lib/auth/get-current-user.ts +31 -0
- package/dist/templates/microsoft-entra/files/src/lib/auth/require-auth.ts +11 -0
- package/dist/templates/microsoft-entra/manifest.json +93 -0
- package/dist/templates/nextauth/README.md +61 -0
- package/dist/templates/nextauth/files/.env.nextauth.example +16 -0
- package/dist/templates/nextauth/files/app/api/auth/[...nextauth]/route.ts +4 -0
- package/dist/templates/nextauth/files/middleware.ts +17 -0
- package/dist/templates/nextauth/files/src/auth.config.ts +41 -0
- package/dist/templates/nextauth/files/src/auth.ts +67 -0
- package/dist/templates/nextauth/files/types/next-auth.d.ts +16 -0
- package/dist/templates/nextauth/manifest.json +74 -0
- package/dist/templates/observability/README.md +69 -0
- package/dist/templates/observability/files/.env.observability.example +12 -0
- package/dist/templates/observability/files/.env.otel.example +7 -0
- package/dist/templates/observability/files/app/api/health/route.ts +37 -0
- package/dist/templates/observability/files/instrumentation.ts +52 -0
- package/dist/templates/observability/files/server/middleware/request-logger.ts +53 -0
- package/dist/templates/observability/files/src/infrastructure/logging/context.ts +21 -0
- package/dist/templates/observability/files/src/infrastructure/logging/correlation.ts +39 -0
- package/dist/templates/observability/files/src/infrastructure/logging/index.ts +12 -0
- package/dist/templates/observability/files/src/infrastructure/logging/logger.ts +68 -0
- package/dist/templates/observability/files/src/infrastructure/logging/redact.ts +89 -0
- package/dist/templates/observability/manifest.json +57 -0
- package/dist/templates/rate-limiting/README.md +63 -0
- package/dist/templates/rate-limiting/files/.env.rate-limit.example +21 -0
- package/dist/templates/rate-limiting/files/server/errors/rate-limit-exceeded.error.ts +43 -0
- package/dist/templates/rate-limiting/files/server/middleware/rate-limit.ts +79 -0
- package/dist/templates/rate-limiting/files/server/utils/get-client-ip.ts +27 -0
- package/dist/templates/rate-limiting/files/server/utils/rate-limiter.ts +82 -0
- package/dist/templates/rate-limiting/files/server/utils/session-id.ts +28 -0
- package/dist/templates/rate-limiting/files/types/rate-limit.d.ts +12 -0
- package/dist/templates/rate-limiting/manifest.json +66 -0
- package/dist/templates/shared-types/README.md +59 -0
- package/dist/templates/shared-types/files/.env.shared-types.example +14 -0
- package/dist/templates/shared-types/files/src/domain/value-objects/user-context.ts +11 -0
- package/dist/templates/shared-types/files/src/infrastructure/auth/mock-user.ts +16 -0
- package/dist/templates/shared-types/files/src/infrastructure/auth/session/session-manager.ts +59 -0
- package/dist/templates/shared-types/manifest.json +37 -0
- package/dist/templates/supabase/README.md +59 -0
- package/dist/templates/supabase/files/.env.supabase.example +15 -0
- package/dist/templates/supabase/files/drizzle.config.ts +15 -0
- package/dist/templates/supabase/files/scripts/gen-types.sh +9 -0
- package/dist/templates/supabase/files/scripts/migrate.ts +23 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/admin.ts +23 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/client.ts +16 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/drizzle/client.ts +17 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/drizzle/schema.ts +10 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/realtime/subscribe.ts +41 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/result.ts +30 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/server.ts +28 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/storage/delete.ts +17 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/storage/download.ts +17 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/storage/index.ts +4 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/storage/signed-url.ts +26 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/storage/upload.ts +24 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/types/database.types.ts +10 -0
- package/dist/templates/supabase/files/supabase/migrations/0001_example_rls.sql +23 -0
- package/dist/templates/supabase/files/supabase/seed.sql +7 -0
- package/dist/templates/supabase/manifest.json +133 -0
- package/dist/templates/supabase-auth/README.md +55 -0
- package/dist/templates/supabase-auth/files/app/api/auth/me/route.ts +10 -0
- package/dist/templates/supabase-auth/files/middleware.ts +108 -0
- package/dist/templates/supabase-auth/files/src/lib/auth/get-current-user.ts +46 -0
- package/dist/templates/supabase-auth/files/src/lib/auth/require-auth.ts +11 -0
- package/dist/templates/supabase-auth/manifest.json +40 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/manifest/apps.d.ts +24 -0
- package/dist/types/manifest/apps.d.ts.map +1 -0
- package/dist/types/manifest/bounded-context.d.ts +43 -0
- package/dist/types/manifest/bounded-context.d.ts.map +1 -0
- package/dist/types/manifest/generator.d.ts +51 -0
- package/dist/types/manifest/generator.d.ts.map +1 -0
- package/dist/types/manifest/helpers.d.ts +30 -0
- package/dist/types/manifest/helpers.d.ts.map +1 -0
- package/dist/types/manifest/index.d.ts +8 -0
- package/dist/types/manifest/index.d.ts.map +1 -0
- package/dist/types/manifest/layers.d.ts +32 -0
- package/dist/types/manifest/layers.d.ts.map +1 -0
- package/dist/types/manifest/manifest.d.ts +64 -0
- package/dist/types/manifest/manifest.d.ts.map +1 -0
- package/dist/types/manifest/monorepo.d.ts +94 -0
- package/dist/types/manifest/monorepo.d.ts.map +1 -0
- package/dist/types/manifest.d.ts +2 -0
- package/dist/types/manifest.d.ts.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { Job } from "bullmq";
|
|
2
|
+
|
|
3
|
+
// Drop-in stand-in for BullMQ's `Job` shape returned by Queue.add() when the
|
|
4
|
+
// queue layer is running in fallback mode. The minimal surface area covers
|
|
5
|
+
// the fields most callers read (id, name, data, return value), so consumer
|
|
6
|
+
// code that does `const job = await addJob(...); job.id; job.returnvalue;`
|
|
7
|
+
// works the same regardless of whether Redis was up.
|
|
8
|
+
export interface SyncJob<TData, TResult> {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly data: TData;
|
|
12
|
+
readonly returnvalue: TResult;
|
|
13
|
+
readonly timestamp: number;
|
|
14
|
+
readonly finishedOn: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let counter = 0;
|
|
18
|
+
|
|
19
|
+
function nextId(): string {
|
|
20
|
+
counter += 1;
|
|
21
|
+
// Prefixed so consumers can tell sync-executed jobs from real BullMQ ones
|
|
22
|
+
// when logging or storing references.
|
|
23
|
+
return `sync-${Date.now()}-${counter}`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Build a Job-shaped object that satisfies the structural minimum BullMQ
|
|
28
|
+
* worker callbacks use — id, name, data, log(), updateProgress(), etc. The
|
|
29
|
+
* type assertion is isolated to this single factory: every other piece of
|
|
30
|
+
* fallback code receives a "real-looking" Job instead of an ad-hoc inline
|
|
31
|
+
* stub, so if a handler later starts using a field we don't proxy here,
|
|
32
|
+
* the failure surfaces in one well-named place rather than as a runtime
|
|
33
|
+
* TypeError deep inside a per-job wrapper.
|
|
34
|
+
*/
|
|
35
|
+
function makeFallbackJob<TData>(
|
|
36
|
+
id: string,
|
|
37
|
+
name: string,
|
|
38
|
+
data: TData,
|
|
39
|
+
timestamp: number,
|
|
40
|
+
): Job<TData> {
|
|
41
|
+
const stub: Partial<Job<TData>> & { progress: number | object } = {
|
|
42
|
+
id,
|
|
43
|
+
name,
|
|
44
|
+
data,
|
|
45
|
+
timestamp,
|
|
46
|
+
attemptsMade: 0,
|
|
47
|
+
progress: 0,
|
|
48
|
+
log: async (row: string): Promise<number> => {
|
|
49
|
+
// eslint-disable-next-line no-console
|
|
50
|
+
console.log(`[bullmq:fallback:${name}:${id}] ${row}`);
|
|
51
|
+
return 0;
|
|
52
|
+
},
|
|
53
|
+
updateProgress: async function (next: number | object): Promise<void> {
|
|
54
|
+
stub.progress = next;
|
|
55
|
+
},
|
|
56
|
+
updateData: async function (next: TData): Promise<void> {
|
|
57
|
+
stub.data = next;
|
|
58
|
+
},
|
|
59
|
+
getState: async (): Promise<"completed"> => "completed",
|
|
60
|
+
isCompleted: async (): Promise<boolean> => true,
|
|
61
|
+
isFailed: async (): Promise<boolean> => false,
|
|
62
|
+
remove: async (): Promise<void> => undefined,
|
|
63
|
+
};
|
|
64
|
+
return stub as unknown as Job<TData>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Runs the handler synchronously in the current process and returns a
|
|
69
|
+
* BullMQ-shaped Job stub. The handler receives a fallback Job rather than
|
|
70
|
+
* raw data so its signature stays identical to the BullMQ worker path —
|
|
71
|
+
* no per-handler wrappers, no `as never` casts at the call site.
|
|
72
|
+
*/
|
|
73
|
+
export async function executeSync<TData, TResult>(
|
|
74
|
+
jobName: string,
|
|
75
|
+
data: TData,
|
|
76
|
+
handler: (job: Job<TData>) => Promise<TResult>,
|
|
77
|
+
): Promise<SyncJob<TData, TResult>> {
|
|
78
|
+
const id = nextId();
|
|
79
|
+
const timestamp = Date.now();
|
|
80
|
+
// eslint-disable-next-line no-console
|
|
81
|
+
console.log(`[bullmq:fallback] executing ${jobName} (${id}) inline`);
|
|
82
|
+
const job = makeFallbackJob(id, jobName, data, timestamp);
|
|
83
|
+
const returnvalue = await handler(job);
|
|
84
|
+
return {
|
|
85
|
+
id,
|
|
86
|
+
name: jobName,
|
|
87
|
+
// Read job.data, not the original `data` arg — handlers can call
|
|
88
|
+
// updateData() to evolve the payload, and BullMQ's real Job exposes
|
|
89
|
+
// the mutated value here. Returning the original would silently
|
|
90
|
+
// diverge fallback behaviour from the BullMQ path.
|
|
91
|
+
data: job.data,
|
|
92
|
+
returnvalue,
|
|
93
|
+
timestamp,
|
|
94
|
+
finishedOn: Date.now(),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Barrel — re-exports the consumer-facing surface for the queue layer.
|
|
2
|
+
// Consumer code should import `addJob`, `QUEUE_NAMES`, etc. from here rather
|
|
3
|
+
// than from individual files so internal restructuring stays invisible.
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
addJob,
|
|
7
|
+
closeAllQueues,
|
|
8
|
+
getQueue,
|
|
9
|
+
QUEUE_NAMES,
|
|
10
|
+
registerFallbackHandler,
|
|
11
|
+
type QueueName,
|
|
12
|
+
} from "./queues";
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
registerJobHandler,
|
|
16
|
+
startWorkers,
|
|
17
|
+
stopWorkers,
|
|
18
|
+
} from "./workers";
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
disconnectRedis,
|
|
22
|
+
getRedisConnection,
|
|
23
|
+
isFallbackActive,
|
|
24
|
+
isRedisAvailable,
|
|
25
|
+
parseIntEnv,
|
|
26
|
+
} from "./connection";
|
|
27
|
+
|
|
28
|
+
export { scheduleRecurringJobs } from "./scheduler/job-scheduler";
|
|
29
|
+
|
|
30
|
+
export type { SyncJob } from "./fallback/sync-executor";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Job } from "bullmq";
|
|
2
|
+
|
|
3
|
+
export interface AIGenerationJobData {
|
|
4
|
+
projectId: string;
|
|
5
|
+
prompt: string;
|
|
6
|
+
model: string;
|
|
7
|
+
/** Optional webhook to ping when the generation completes. */
|
|
8
|
+
callbackUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface AIGenerationJobResult {
|
|
12
|
+
generatedContent: string;
|
|
13
|
+
tokenUsage: {
|
|
14
|
+
prompt: number;
|
|
15
|
+
completion: number;
|
|
16
|
+
};
|
|
17
|
+
model: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const AI_GENERATION_JOB_NAME = "ai-generation";
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Default queue this job runs on. Used by start-workers.ts to register
|
|
25
|
+
* the handler only on the matching queue (when present in BULLMQ_QUEUE_NAMES).
|
|
26
|
+
* Fall-through is "default" — the convention is that every install has a
|
|
27
|
+
* "default" queue.
|
|
28
|
+
*/
|
|
29
|
+
export const AI_GENERATION_DEFAULT_QUEUE = "default";
|
|
30
|
+
/**
|
|
31
|
+
* Stub handler — replace with your LLM client (the llm-adapter template
|
|
32
|
+
* exposes a typed port). Long-running by nature; expects a callback URL
|
|
33
|
+
* for client notification on completion.
|
|
34
|
+
*/
|
|
35
|
+
export async function processAIGenerationJob(
|
|
36
|
+
job: Job<AIGenerationJobData>,
|
|
37
|
+
): Promise<AIGenerationJobResult> {
|
|
38
|
+
await job.log(
|
|
39
|
+
`ai-generation project=${job.data.projectId} model=${job.data.model}`,
|
|
40
|
+
);
|
|
41
|
+
await job.updateProgress(20);
|
|
42
|
+
|
|
43
|
+
// TODO: replace stub with a real LLM call (consider the llm-adapter template).
|
|
44
|
+
const generatedContent = "";
|
|
45
|
+
|
|
46
|
+
await job.updateProgress(100);
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
generatedContent,
|
|
50
|
+
tokenUsage: { prompt: 0, completion: 0 },
|
|
51
|
+
model: job.data.model,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Job } from "bullmq";
|
|
2
|
+
|
|
3
|
+
export interface EmailJobData {
|
|
4
|
+
to: string;
|
|
5
|
+
from: string;
|
|
6
|
+
subject: string;
|
|
7
|
+
html: string;
|
|
8
|
+
text?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface EmailJobResult {
|
|
12
|
+
messageId: string;
|
|
13
|
+
acceptedAt: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const EMAIL_JOB_NAME = "email";
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Default queue this job runs on. Used by start-workers.ts to register
|
|
21
|
+
* the handler only on the matching queue (when present in BULLMQ_QUEUE_NAMES).
|
|
22
|
+
* Fall-through is "default" — the convention is that every install has a
|
|
23
|
+
* "default" queue.
|
|
24
|
+
*/
|
|
25
|
+
export const EMAIL_DEFAULT_QUEUE = "default";
|
|
26
|
+
/**
|
|
27
|
+
* Stub handler — replace with your transport (Resend, SES, SendGrid, etc.).
|
|
28
|
+
* Pure so it can be unit-tested without a Redis connection.
|
|
29
|
+
*/
|
|
30
|
+
export async function processEmailJob(
|
|
31
|
+
job: Job<EmailJobData>,
|
|
32
|
+
): Promise<EmailJobResult> {
|
|
33
|
+
await job.log(`sending email to=${job.data.to} subject="${job.data.subject}"`);
|
|
34
|
+
|
|
35
|
+
// TODO: replace stub with real transport
|
|
36
|
+
const messageId = `msg-${job.id}`;
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
messageId,
|
|
40
|
+
acceptedAt: Date.now(),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Job } from "bullmq";
|
|
2
|
+
|
|
3
|
+
export interface ExportJobData {
|
|
4
|
+
/** Logical dataset identifier — interpreted by the handler. */
|
|
5
|
+
dataset: string;
|
|
6
|
+
/** Output format: "csv" | "json" | "parquet" etc. */
|
|
7
|
+
format: string;
|
|
8
|
+
/** Optional row limit; useful for paginated exports. */
|
|
9
|
+
limit?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ExportJobResult {
|
|
13
|
+
outputUrl: string;
|
|
14
|
+
rowCount: number;
|
|
15
|
+
bytes: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const EXPORT_JOB_NAME = "export";
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Default queue this job runs on. Used by start-workers.ts to register
|
|
23
|
+
* the handler only on the matching queue (when present in BULLMQ_QUEUE_NAMES).
|
|
24
|
+
* Fall-through is "default" — the convention is that every install has a
|
|
25
|
+
* "default" queue.
|
|
26
|
+
*/
|
|
27
|
+
export const EXPORT_DEFAULT_QUEUE = "default";
|
|
28
|
+
/**
|
|
29
|
+
* Stub handler for long-running data exports — typically too slow for
|
|
30
|
+
* request/response (CSV of all orders, etc.). Replace the body with your
|
|
31
|
+
* query + upload pipeline. The result row count is reported separately
|
|
32
|
+
* from bytes so callers can show "X rows, Y MB" without re-fetching.
|
|
33
|
+
*/
|
|
34
|
+
export async function processExportJob(
|
|
35
|
+
job: Job<ExportJobData>,
|
|
36
|
+
): Promise<ExportJobResult> {
|
|
37
|
+
await job.log(`export dataset=${job.data.dataset} format=${job.data.format}`);
|
|
38
|
+
await job.updateProgress(10);
|
|
39
|
+
|
|
40
|
+
// TODO: replace stub with real query + upload
|
|
41
|
+
const outputUrl = `https://cdn.example.com/exports/${job.id}.${job.data.format}`;
|
|
42
|
+
await job.updateProgress(100);
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
outputUrl,
|
|
46
|
+
rowCount: 0,
|
|
47
|
+
bytes: 0,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Job } from "bullmq";
|
|
2
|
+
|
|
3
|
+
export interface ImageProcessingJobData {
|
|
4
|
+
sourceUrl: string;
|
|
5
|
+
targetWidth: number;
|
|
6
|
+
targetHeight: number;
|
|
7
|
+
format: "jpeg" | "png" | "webp";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ImageProcessingJobResult {
|
|
11
|
+
outputUrl: string;
|
|
12
|
+
bytes: number;
|
|
13
|
+
durationMs: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const IMAGE_PROCESSING_JOB_NAME = "image-processing";
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Default queue this job runs on. Used by start-workers.ts to register
|
|
21
|
+
* the handler only on the matching queue (when present in BULLMQ_QUEUE_NAMES).
|
|
22
|
+
* Fall-through is "default" — the convention is that every install has a
|
|
23
|
+
* "default" queue.
|
|
24
|
+
*/
|
|
25
|
+
export const IMAGE_PROCESSING_DEFAULT_QUEUE = "images";
|
|
26
|
+
/**
|
|
27
|
+
* Stub handler — replace the body with a real image pipeline (sharp, Cloudinary,
|
|
28
|
+
* etc.). Kept pure so it can be unit-tested without a Redis connection.
|
|
29
|
+
*/
|
|
30
|
+
export async function processImageProcessingJob(
|
|
31
|
+
job: Job<ImageProcessingJobData>,
|
|
32
|
+
): Promise<ImageProcessingJobResult> {
|
|
33
|
+
const start = Date.now();
|
|
34
|
+
await job.log(
|
|
35
|
+
`image-processing source=${job.data.sourceUrl} target=${job.data.targetWidth}x${job.data.targetHeight}`,
|
|
36
|
+
);
|
|
37
|
+
await job.updateProgress(10);
|
|
38
|
+
|
|
39
|
+
// TODO: replace stub with real processing
|
|
40
|
+
const outputUrl = `https://cdn.example.com/${job.id}.${job.data.format}`;
|
|
41
|
+
await job.updateProgress(100);
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
outputUrl,
|
|
45
|
+
bytes: 0,
|
|
46
|
+
durationMs: Date.now() - start,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { Job } from "bullmq";
|
|
2
|
+
import { parseIntEnv } from "../parse-int-env";
|
|
3
|
+
|
|
4
|
+
export interface WebhookJobData {
|
|
5
|
+
url: string;
|
|
6
|
+
method: "POST" | "PUT" | "PATCH";
|
|
7
|
+
headers?: Record<string, string>;
|
|
8
|
+
body: unknown;
|
|
9
|
+
/** Number of attempts already made; surfaced to the worker for exponential backoff. */
|
|
10
|
+
attempt?: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface WebhookJobResult {
|
|
14
|
+
status: number;
|
|
15
|
+
responseSnippet: string;
|
|
16
|
+
/** True when the underlying body exceeded RESPONSE_TRUNCATE_BYTES and was cut off. */
|
|
17
|
+
truncated: boolean;
|
|
18
|
+
durationMs: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const WEBHOOK_JOB_NAME = "webhook";
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Default queue this job runs on. Used by start-workers.ts to register
|
|
26
|
+
* the handler only on the matching queue (when present in BULLMQ_QUEUE_NAMES).
|
|
27
|
+
* Fall-through is "default" — the convention is that every install has a
|
|
28
|
+
* "default" queue.
|
|
29
|
+
*/
|
|
30
|
+
export const WEBHOOK_DEFAULT_QUEUE = "default";
|
|
31
|
+
const RESPONSE_TRUNCATE_BYTES = 512;
|
|
32
|
+
// Hard cap on the outbound fetch. Without it, a target that accepts the
|
|
33
|
+
// connection but never returns headers would tie up the worker until the
|
|
34
|
+
// node-level keepalive eventually closes the socket. 30s gives slow
|
|
35
|
+
// receivers room while still bounding the blast radius. Operators can
|
|
36
|
+
// override via env without re-rendering the template.
|
|
37
|
+
const WEBHOOK_FETCH_TIMEOUT_MS = parseIntEnv(
|
|
38
|
+
"WEBHOOK_FETCH_TIMEOUT_MS",
|
|
39
|
+
30_000,
|
|
40
|
+
1,
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Read at most `limit` bytes from a `fetch()` response body, stopping (and
|
|
45
|
+
* cancelling the stream) as soon as the cap is reached. `await response.text()`
|
|
46
|
+
* would buffer the entire body first — a misconfigured or hostile webhook
|
|
47
|
+
* target that returns gigabytes of data would crash the worker before the
|
|
48
|
+
* job result is even written. Streaming + cancel keeps memory bounded.
|
|
49
|
+
*/
|
|
50
|
+
async function readResponseBounded(
|
|
51
|
+
response: Response,
|
|
52
|
+
limit: number,
|
|
53
|
+
): Promise<{ text: string; truncated: boolean }> {
|
|
54
|
+
if (!response.body) {
|
|
55
|
+
const text = await response.text();
|
|
56
|
+
return text.length > limit
|
|
57
|
+
? { text: text.slice(0, limit), truncated: true }
|
|
58
|
+
: { text, truncated: false };
|
|
59
|
+
}
|
|
60
|
+
const reader = response.body.getReader();
|
|
61
|
+
const chunks: Uint8Array[] = [];
|
|
62
|
+
let total = 0;
|
|
63
|
+
let truncated = false;
|
|
64
|
+
try {
|
|
65
|
+
while (total < limit) {
|
|
66
|
+
const { done, value } = await reader.read();
|
|
67
|
+
if (done) break;
|
|
68
|
+
const remaining = limit - total;
|
|
69
|
+
if (value.byteLength > remaining) {
|
|
70
|
+
chunks.push(value.subarray(0, remaining));
|
|
71
|
+
total += remaining;
|
|
72
|
+
truncated = true;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
chunks.push(value);
|
|
76
|
+
total += value.byteLength;
|
|
77
|
+
}
|
|
78
|
+
// If we hit the cap but more data is buffered upstream, mark truncated.
|
|
79
|
+
if (total >= limit) {
|
|
80
|
+
const peek = await reader.read();
|
|
81
|
+
if (!peek.done) truncated = true;
|
|
82
|
+
}
|
|
83
|
+
} finally {
|
|
84
|
+
await reader.cancel().catch(() => undefined);
|
|
85
|
+
}
|
|
86
|
+
const merged =
|
|
87
|
+
chunks.length === 1 ? chunks[0] : Buffer.concat(chunks, total);
|
|
88
|
+
return { text: new TextDecoder().decode(merged), truncated };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Dispatches an outbound webhook with strict body-size truncation on the
|
|
93
|
+
* response we keep for the job result. The full response is NOT logged so a
|
|
94
|
+
* malicious target can't blow the job-result store.
|
|
95
|
+
*/
|
|
96
|
+
export async function processWebhookJob(
|
|
97
|
+
job: Job<WebhookJobData>,
|
|
98
|
+
): Promise<WebhookJobResult> {
|
|
99
|
+
const start = Date.now();
|
|
100
|
+
await job.log(`webhook ${job.data.method} ${job.data.url}`);
|
|
101
|
+
const controller = new AbortController();
|
|
102
|
+
const timer = setTimeout(
|
|
103
|
+
() => controller.abort(),
|
|
104
|
+
WEBHOOK_FETCH_TIMEOUT_MS,
|
|
105
|
+
);
|
|
106
|
+
try {
|
|
107
|
+
const response = await fetch(job.data.url, {
|
|
108
|
+
method: job.data.method,
|
|
109
|
+
headers: {
|
|
110
|
+
"content-type": "application/json",
|
|
111
|
+
...(job.data.headers ?? {}),
|
|
112
|
+
},
|
|
113
|
+
body: JSON.stringify(job.data.body),
|
|
114
|
+
signal: controller.signal,
|
|
115
|
+
});
|
|
116
|
+
const { text, truncated } = await readResponseBounded(
|
|
117
|
+
response,
|
|
118
|
+
RESPONSE_TRUNCATE_BYTES,
|
|
119
|
+
);
|
|
120
|
+
return {
|
|
121
|
+
status: response.status,
|
|
122
|
+
responseSnippet: text,
|
|
123
|
+
truncated,
|
|
124
|
+
durationMs: Date.now() - start,
|
|
125
|
+
};
|
|
126
|
+
} catch (err) {
|
|
127
|
+
// Rethrow as a clearer error when the abort fired; BullMQ records the
|
|
128
|
+
// failure and applies the queue's retry policy, which is the right
|
|
129
|
+
// outcome for a timing-out upstream.
|
|
130
|
+
if (err instanceof Error && err.name === "AbortError") {
|
|
131
|
+
throw new Error(
|
|
132
|
+
`webhook ${job.data.method} ${job.data.url} timed out after ${WEBHOOK_FETCH_TIMEOUT_MS}ms`,
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
throw err;
|
|
136
|
+
} finally {
|
|
137
|
+
clearTimeout(timer);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse a numeric environment variable with bounds-checking. Returns the
|
|
3
|
+
* default and logs a warning if the input is missing, non-numeric, or
|
|
4
|
+
* outside [min, max]. Naive `Number()` parsing yields NaN for "abc"
|
|
5
|
+
* (e.g. REDIS_MAX_RETRIES=abc), and NaN comparisons silently corrupt
|
|
6
|
+
* retry budgets — `times >= NaN` is always false, so the connection
|
|
7
|
+
* client would retry forever. Validating up-front lets the workload
|
|
8
|
+
* keep running on safe defaults instead of paging out at 03:00 over
|
|
9
|
+
* an env typo.
|
|
10
|
+
*/
|
|
11
|
+
export function parseIntEnv(
|
|
12
|
+
name: string,
|
|
13
|
+
fallback: number,
|
|
14
|
+
min = 0,
|
|
15
|
+
max = Number.MAX_SAFE_INTEGER,
|
|
16
|
+
): number {
|
|
17
|
+
const raw = process.env[name];
|
|
18
|
+
if (raw === undefined || raw === "") return fallback;
|
|
19
|
+
const parsed = Number.parseInt(raw, 10);
|
|
20
|
+
if (!Number.isFinite(parsed) || parsed < min || parsed > max) {
|
|
21
|
+
// eslint-disable-next-line no-console
|
|
22
|
+
console.warn(
|
|
23
|
+
`[bullmq] env ${name}=${JSON.stringify(raw)} is not a valid integer in [${min}, ${max}] — using default ${fallback}.`,
|
|
24
|
+
);
|
|
25
|
+
return fallback;
|
|
26
|
+
}
|
|
27
|
+
return parsed;
|
|
28
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { Queue, type Job, type JobsOptions } from "bullmq";
|
|
2
|
+
import { getRedisConnection, isFallbackActive } from "./connection";
|
|
3
|
+
import { executeSync, type SyncJob } from "./fallback/sync-executor";
|
|
4
|
+
|
|
5
|
+
// The install-time comma-list is captured as a string literal *type* so
|
|
6
|
+
// the typed surface (QueueName) is a literal union of the configured names,
|
|
7
|
+
// not the broad `string`. The runtime list is derived from the same answer
|
|
8
|
+
// (or a BULLMQ_QUEUE_NAMES override, validated against the install set
|
|
9
|
+
// further down) so the two stay in lock-step.
|
|
10
|
+
type InstallQueueNamesLiteral = "{queue_names}";
|
|
11
|
+
|
|
12
|
+
type _TrimWs<S extends string> = S extends ` ${infer R}`
|
|
13
|
+
? _TrimWs<R>
|
|
14
|
+
: S extends `${infer R} `
|
|
15
|
+
? _TrimWs<R>
|
|
16
|
+
: S;
|
|
17
|
+
|
|
18
|
+
type _SplitCsv<S extends string> = S extends `${infer Head},${infer Tail}`
|
|
19
|
+
? _TrimWs<Head> | _SplitCsv<Tail>
|
|
20
|
+
: _TrimWs<S>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Literal union of every queue name configured at install time. addJob(),
|
|
24
|
+
* getQueue(), and registerJobHandler() all narrow their `queue` arg to this
|
|
25
|
+
* union, so typos surface at compile time rather than as a runtime
|
|
26
|
+
* "no handler registered" error after the job has already been enqueued.
|
|
27
|
+
*/
|
|
28
|
+
export type QueueName = _SplitCsv<InstallQueueNamesLiteral>;
|
|
29
|
+
|
|
30
|
+
const INSTALL_QUEUE_NAMES = "{queue_names}"
|
|
31
|
+
.split(",")
|
|
32
|
+
.map((n) => n.trim())
|
|
33
|
+
.filter(Boolean) as QueueName[];
|
|
34
|
+
|
|
35
|
+
// BULLMQ_QUEUE_NAMES can override the install-time list at deploy time, but
|
|
36
|
+
// only with a *subset* of the names declared at install — anything else
|
|
37
|
+
// would mean workers start for a queue without a registered handler, or
|
|
38
|
+
// handlers register for a queue that no Worker ever opens. We validate up
|
|
39
|
+
// front and throw with the offending names so the misconfiguration surfaces
|
|
40
|
+
// at boot rather than as a per-job dispatcher error later.
|
|
41
|
+
function resolveRuntimeQueueNames(): QueueName[] {
|
|
42
|
+
const override = process.env.BULLMQ_QUEUE_NAMES;
|
|
43
|
+
if (!override) return INSTALL_QUEUE_NAMES;
|
|
44
|
+
const parsed = override
|
|
45
|
+
.split(",")
|
|
46
|
+
.map((n) => n.trim())
|
|
47
|
+
.filter(Boolean);
|
|
48
|
+
const unknown = parsed.filter(
|
|
49
|
+
(n) => !(INSTALL_QUEUE_NAMES as string[]).includes(n),
|
|
50
|
+
);
|
|
51
|
+
if (unknown.length > 0) {
|
|
52
|
+
throw new Error(
|
|
53
|
+
`BULLMQ_QUEUE_NAMES contains queues not declared at install time: ${unknown.join(", ")}. Install-time queues: ${INSTALL_QUEUE_NAMES.join(", ")}.`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
return parsed as QueueName[];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const QUEUE_NAMES = resolveRuntimeQueueNames();
|
|
60
|
+
|
|
61
|
+
const queues = new Map<QueueName, Queue>();
|
|
62
|
+
|
|
63
|
+
function getQueueInternal(name: QueueName): Queue {
|
|
64
|
+
// Fallback mode means Redis is unreachable; addJob() routes to the
|
|
65
|
+
// in-process executor instead. Handing out a Queue here would let a
|
|
66
|
+
// caller bypass the fallback contract and enqueue into BullMQ's still-
|
|
67
|
+
// open client, where the writes would either time out or pile up
|
|
68
|
+
// waiting for a reconnect that never comes. Force callers through
|
|
69
|
+
// addJob() so the routing decision stays in one place.
|
|
70
|
+
if (isFallbackActive()) {
|
|
71
|
+
throw new Error(
|
|
72
|
+
`getQueue('${name}'): fallback mode is active. Use addJob() so the in-process executor is used automatically.`,
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
let queue = queues.get(name);
|
|
76
|
+
if (!queue) {
|
|
77
|
+
const connection = getRedisConnection();
|
|
78
|
+
if (!connection) {
|
|
79
|
+
throw new Error(
|
|
80
|
+
`getQueue('${name}'): Redis connection is unavailable. In fallback mode the queue object is not created; use addJob() which routes to the in-process executor automatically.`,
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
queue = new Queue(name, { connection });
|
|
84
|
+
queues.set(name, queue);
|
|
85
|
+
}
|
|
86
|
+
return queue;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function getQueue(name: QueueName): Queue {
|
|
90
|
+
return getQueueInternal(name);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Schedule a job for processing. In normal mode the data is pushed to
|
|
95
|
+
* Redis-backed BullMQ; in fallback mode the registered handler is invoked
|
|
96
|
+
* inline and the returned shape mimics a BullMQ Job so callers don't need
|
|
97
|
+
* branchy code at the call site.
|
|
98
|
+
*
|
|
99
|
+
* Handlers for fallback mode live alongside the queue at registration time
|
|
100
|
+
* via {@link registerFallbackHandler}. If a job is added to a queue with no
|
|
101
|
+
* registered handler while Redis is down, the call rejects so the
|
|
102
|
+
* misconfiguration surfaces immediately.
|
|
103
|
+
*/
|
|
104
|
+
// Fallback handlers take a Job-shaped argument (built by executeSync), so
|
|
105
|
+
// the signature matches the BullMQ Worker callback exactly — the same
|
|
106
|
+
// handler can be passed unmodified to both the worker dispatcher and the
|
|
107
|
+
// fallback registry, without `as never` casts at the call site.
|
|
108
|
+
type FallbackHandler<TData, TResult> = (job: Job<TData>) => Promise<TResult>;
|
|
109
|
+
|
|
110
|
+
const fallbackHandlers = new Map<string, FallbackHandler<unknown, unknown>>();
|
|
111
|
+
|
|
112
|
+
function fallbackKey(queue: QueueName, jobName: string): string {
|
|
113
|
+
return `${queue}:${jobName}`;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function registerFallbackHandler<TData, TResult>(
|
|
117
|
+
queue: QueueName,
|
|
118
|
+
jobName: string,
|
|
119
|
+
handler: FallbackHandler<TData, TResult>,
|
|
120
|
+
): void {
|
|
121
|
+
fallbackHandlers.set(
|
|
122
|
+
fallbackKey(queue, jobName),
|
|
123
|
+
handler as FallbackHandler<unknown, unknown>,
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export async function addJob<TData = unknown, TResult = unknown>(
|
|
128
|
+
queue: QueueName,
|
|
129
|
+
jobName: string,
|
|
130
|
+
data: TData,
|
|
131
|
+
opts?: JobsOptions,
|
|
132
|
+
): Promise<Job<TData, TResult> | SyncJob<TData, TResult>> {
|
|
133
|
+
if (isFallbackActive()) {
|
|
134
|
+
const handler = fallbackHandlers.get(fallbackKey(queue, jobName)) as
|
|
135
|
+
| FallbackHandler<TData, TResult>
|
|
136
|
+
| undefined;
|
|
137
|
+
if (!handler) {
|
|
138
|
+
throw new Error(
|
|
139
|
+
`addJob('${queue}', '${jobName}'): no fallback handler registered and Redis is unavailable. Register via registerFallbackHandler() at module load.`,
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
return executeSync(jobName, data, handler);
|
|
143
|
+
}
|
|
144
|
+
const q = getQueueInternal(queue);
|
|
145
|
+
return (await q.add(jobName, data, opts)) as Job<TData, TResult>;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export async function closeAllQueues(): Promise<void> {
|
|
149
|
+
for (const [, queue] of queues) {
|
|
150
|
+
await queue.close().catch(() => undefined);
|
|
151
|
+
}
|
|
152
|
+
queues.clear();
|
|
153
|
+
}
|