@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,78 @@
|
|
|
1
|
+
# ESLint — no-console (logger enforcement) (`eslint-no-console`)
|
|
2
|
+
|
|
3
|
+
> A drop-in ESLint flat-config fragment that bans `console.*` so logging goes through the
|
|
4
|
+
> structured logger instead of `console.log` technical debt.
|
|
5
|
+
|
|
6
|
+
| | |
|
|
7
|
+
| ------------- | ---------------------------------------------- |
|
|
8
|
+
| **ID** | `eslint-no-console` |
|
|
9
|
+
| **Category** | Core infrastructure / lint |
|
|
10
|
+
| **Requires** | — |
|
|
11
|
+
| **Conflicts** | none |
|
|
12
|
+
| **Branch** | `feature/generator-template-eslint-no-console` |
|
|
13
|
+
|
|
14
|
+
Author/agent-facing reference, beside `manifest.json` — not emitted into projects.
|
|
15
|
+
|
|
16
|
+
## What it does
|
|
17
|
+
|
|
18
|
+
Closes the **enforcement gap** behind console.log debt: agents (and people) default to `console.log`
|
|
19
|
+
because nothing stops them. This ships the `no-console` rule the codebase already assumes exists
|
|
20
|
+
(several templates emit `// eslint-disable-next-line no-console` for legitimate console use). With the
|
|
21
|
+
rule in place, `console.*` shows up in lint — a `warn` (the non-breaking default) or a CI-failing
|
|
22
|
+
`error` — and the structured logger becomes the path of least resistance.
|
|
23
|
+
|
|
24
|
+
It's a **fragment**, not a whole config — it spreads into your existing `eslint.config.mjs` rather than
|
|
25
|
+
fighting it.
|
|
26
|
+
|
|
27
|
+
## What it scaffolds
|
|
28
|
+
|
|
29
|
+
- `eslint.no-console.mjs` — exports `noConsoleConfig` (a flat-config array): `no-console` at the chosen
|
|
30
|
+
severity, plus an override turning it **off** for the sanctioned console sites.
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
`hexagen add eslint-no-console`. Question:
|
|
35
|
+
|
|
36
|
+
| Question | Options (default) |
|
|
37
|
+
| --------------- | ---------------------------------------------------------------- |
|
|
38
|
+
| `console_level` | `warn` / `error` (`warn`) — `warn` only nudges; `error` fails CI |
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
// eslint.config.mjs
|
|
44
|
+
import { noConsoleConfig } from "./eslint.no-console.mjs";
|
|
45
|
+
|
|
46
|
+
export default [
|
|
47
|
+
...baseConfig,
|
|
48
|
+
...noConsoleConfig, // last, so the no-console rule + exemptions win
|
|
49
|
+
];
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
// Then, instead of console.log:
|
|
54
|
+
import { logger } from "@/infrastructure/logging"; // from the observability template
|
|
55
|
+
logger.info({ userId }, "user.created");
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Notes for agents
|
|
59
|
+
|
|
60
|
+
- **The logger is the only sanctioned `console` site** (its transport). The fragment exempts
|
|
61
|
+
`**/infrastructure/logging/**`, `**/server/startup/**`, `scripts/**`, and `**/*.config.*`; everything
|
|
62
|
+
else must use the logger or an explicit `// eslint-disable-next-line no-console`.
|
|
63
|
+
- **`warn` for legacy, `error` for greenfield.** On an existing codebase start at `warn` to surface the
|
|
64
|
+
backlog without blocking, then tighten to `error`.
|
|
65
|
+
- Pairs with [`observability`](../observability) (the logger) and [`agents-md`](../agents-md) (which
|
|
66
|
+
carries the "use the logger, never `console.log`" directive). The rule is logger-agnostic — it bans
|
|
67
|
+
`console.*` regardless of which logger you use.
|
|
68
|
+
|
|
69
|
+
## Checklist (post-install)
|
|
70
|
+
|
|
71
|
+
Install ESLint if needed; spread `noConsoleConfig` into `eslint.config.mjs` after your base config;
|
|
72
|
+
route logging through the structured logger; run lint to surface existing `console.*`; start at `warn`
|
|
73
|
+
on a legacy codebase, then tighten to `error`.
|
|
74
|
+
|
|
75
|
+
## Related
|
|
76
|
+
|
|
77
|
+
[`observability`](../observability) (structured logger), [`agents-md`](../agents-md) (logging directive),
|
|
78
|
+
[`ci-github-actions`](../ci-github-actions) (runs lint in CI).
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// ESLint flat-config fragment: ban console.* so logging goes through the structured
|
|
2
|
+
// logger, not console.log technical debt (no level, no correlation id, no redaction).
|
|
3
|
+
//
|
|
4
|
+
// Spread it into your eslint.config.mjs AFTER your base config:
|
|
5
|
+
//
|
|
6
|
+
// import { noConsoleConfig } from "./eslint.no-console.mjs";
|
|
7
|
+
// export default [ ...baseConfig, ...noConsoleConfig ];
|
|
8
|
+
//
|
|
9
|
+
export const noConsoleConfig = [
|
|
10
|
+
{
|
|
11
|
+
rules: {
|
|
12
|
+
// Route logging through the logger (e.g. the observability template's
|
|
13
|
+
// src/infrastructure/logging/logger.ts). For a deliberate one-off, add a
|
|
14
|
+
// `// eslint-disable-next-line no-console` on that line.
|
|
15
|
+
"no-console": "{console_level}",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
// The sanctioned console sites: the logger's own transport, process startup,
|
|
20
|
+
// CLI scripts, config files, and smoke-test diagnostics. These legitimately
|
|
21
|
+
// write to the console.
|
|
22
|
+
files: [
|
|
23
|
+
"**/infrastructure/logging/**",
|
|
24
|
+
"**/server/startup/**",
|
|
25
|
+
"scripts/**",
|
|
26
|
+
"**/*.config.*",
|
|
27
|
+
"**/smoke-*.{ts,tsx,js,mjs}",
|
|
28
|
+
],
|
|
29
|
+
rules: {
|
|
30
|
+
"no-console": "off",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
export default noConsoleConfig;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "eslint-no-console",
|
|
3
|
+
"name": "ESLint — no-console (logger enforcement)",
|
|
4
|
+
"description": "A drop-in ESLint flat-config fragment that bans console.* (no-console) so logging goes through the structured logger instead of console.log technical debt — with the logger transport, server startup, CLI scripts, and config files exempted. Spread it into your eslint.config.mjs.",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"requires": [],
|
|
7
|
+
"conflicts": [],
|
|
8
|
+
"questions": [
|
|
9
|
+
{
|
|
10
|
+
"id": "console_level",
|
|
11
|
+
"type": "select",
|
|
12
|
+
"prompt": "no-console severity? (warn nudges; error blocks CI)",
|
|
13
|
+
"options": ["warn", "error"],
|
|
14
|
+
"default": "warn"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"envVars": [],
|
|
18
|
+
"outputs": ["eslint.no-console.mjs"],
|
|
19
|
+
"checklist": [
|
|
20
|
+
"Install ESLint if your project doesn't already have it: npm install -D eslint",
|
|
21
|
+
"Wire the fragment into your eslint.config.mjs AFTER your base config: import { noConsoleConfig } from './eslint.no-console.mjs'; export default [ ...baseConfig, ...noConsoleConfig ];",
|
|
22
|
+
"Route logging through the structured logger (the observability template ships src/infrastructure/logging/logger.ts) — never console.*; console.log carries no level, correlation id, or redaction",
|
|
23
|
+
"Sanctioned console sites are pre-exempted: the logger transport (infrastructure/logging/**), server/startup/**, scripts/**, and *.config.* — add a // eslint-disable-next-line no-console for any other deliberate console use",
|
|
24
|
+
"Run your lint script (e.g. npx eslint .) to surface existing console.* calls to migrate to the logger",
|
|
25
|
+
"Severity is set at install via console_level. The default warn is non-breaking — it surfaces console.* (including legitimate console.error in error handlers shipped by other templates like error-handling/oauth) as warnings without failing CI. Migrate or // eslint-disable-next-line no-console those call sites, then tighten to error for hard enforcement"
|
|
26
|
+
],
|
|
27
|
+
"branch": "feature/generator-template-eslint-no-console"
|
|
28
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# GitHub OAuth (`github-oauth`)
|
|
2
|
+
|
|
3
|
+
> GitHub OAuth App integration: code exchange, primary-email fetch, org-membership gate,
|
|
4
|
+
> AES-256-GCM session cookie, and a root middleware protecting configured paths.
|
|
5
|
+
|
|
6
|
+
| | |
|
|
7
|
+
| ------------- | ------------------------------------------------ |
|
|
8
|
+
| **ID** | `github-oauth` |
|
|
9
|
+
| **Category** | Auth provider (adapter group A) |
|
|
10
|
+
| **Requires** | `shared-types`, `auth-mock`, `env-setup` |
|
|
11
|
+
| **Conflicts** | every other auth provider (one strategy per app) |
|
|
12
|
+
| **Branch** | `feature/auth-stack-restructure` |
|
|
13
|
+
|
|
14
|
+
Author/agent-facing reference, beside `manifest.json` — not emitted into projects.
|
|
15
|
+
|
|
16
|
+
## What it does
|
|
17
|
+
|
|
18
|
+
GitHub sign-in with an optional org gate: login → GitHub → callback → encrypted session. Fetches
|
|
19
|
+
the user's primary email and maps the profile onto the shared `UserContext`. The emitted
|
|
20
|
+
`middleware.ts` overwrites `auth-mock`'s while honouring `AUTH_MODE=mock`.
|
|
21
|
+
|
|
22
|
+
## Service & API
|
|
23
|
+
|
|
24
|
+
- **Provider:** GitHub OAuth App (authorization-code flow); primary-email + (optional)
|
|
25
|
+
org-membership fetch.
|
|
26
|
+
- **Session:** stateless AES-256-GCM cookie. Optional `GITHUB_ALLOWED_ORGS` gate.
|
|
27
|
+
- **Routes:** `GET /api/auth/login/github`, `GET /api/auth/callback/github`, `POST /api/auth/logout/github`, `GET /api/auth/me`.
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
`hexagen add github-oauth`. Questions: `redirect_uri`, `scopes` (default `read:user,user:email`),
|
|
32
|
+
`allowed_orgs` (blank = any), `protected_paths`.
|
|
33
|
+
|
|
34
|
+
Env: `GITHUB_CLIENT_ID`, `GITHUB_CLIENT_SECRET`, `GITHUB_REDIRECT_URI`, `GITHUB_OAUTH_SCOPES`,
|
|
35
|
+
`GITHUB_ALLOWED_ORGS`, `AUTH_SESSION_SECRET`.
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { getCurrentUser } from "@/lib/auth/get-current-user";
|
|
41
|
+
const user = await getCurrentUser(); // UserContext | null
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Flow: `GET /api/auth/login/github` → GitHub → `GET /api/auth/callback/github` → `/dashboard`.
|
|
45
|
+
|
|
46
|
+
## Notes for agents
|
|
47
|
+
|
|
48
|
+
- For `GITHUB_ALLOWED_ORGS`, the token needs the `read:org` scope.
|
|
49
|
+
- `middleware.ts` overwrites `auth-mock`'s; `AUTH_MODE=mock` short-circuits to `MOCK_USER`.
|
|
50
|
+
- Mutually exclusive with every other auth provider.
|
|
51
|
+
|
|
52
|
+
## Checklist (post-install)
|
|
53
|
+
|
|
54
|
+
Create an OAuth App; set the callback URL; set client id/secret; generate `AUTH_SESSION_SECRET`;
|
|
55
|
+
add `read:org` if gating by org; test the login→callback→`/dashboard` flow; verify `/api/auth/me`
|
|
56
|
+
and logout.
|
|
57
|
+
|
|
58
|
+
## Related
|
|
59
|
+
|
|
60
|
+
Requires [`shared-types`](../shared-types), [`auth-mock`](../auth-mock), [`env-setup`](../env-setup).
|
|
61
|
+
Siblings: [`google-oauth`](../google-oauth), [`microsoft-entra`](../microsoft-entra).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# GitHub OAuth — copy these into .env.local
|
|
2
|
+
# Create an OAuth App at: https://github.com/settings/developers
|
|
3
|
+
# Set "Authorization callback URL" to GITHUB_REDIRECT_URI below
|
|
4
|
+
|
|
5
|
+
GITHUB_CLIENT_ID=
|
|
6
|
+
GITHUB_CLIENT_SECRET=
|
|
7
|
+
GITHUB_REDIRECT_URI=http://localhost:3000/api/auth/callback/github
|
|
8
|
+
GITHUB_OAUTH_SCOPES=read:user,user:email
|
|
9
|
+
GITHUB_ALLOWED_ORGS= # optional: comma-separated org names, e.g. my-org,another-org
|
|
10
|
+
|
|
11
|
+
# Required: encrypt the session cookie
|
|
12
|
+
# Generate: openssl rand -hex 32
|
|
13
|
+
AUTH_SESSION_SECRET=
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from "next/server";
|
|
2
|
+
import {
|
|
3
|
+
exchangeCode,
|
|
4
|
+
fetchUser,
|
|
5
|
+
fetchPrimaryEmail,
|
|
6
|
+
checkOrgMembership,
|
|
7
|
+
} from "../../../../../src/infrastructure/auth/github/github-client";
|
|
8
|
+
import { GITHUB_CONFIG } from "../../../../../src/infrastructure/auth/github/config";
|
|
9
|
+
import { mapGitHubUser } from "../../../../../src/infrastructure/auth/github/user-profile-mapper";
|
|
10
|
+
import { GitHubAuthAdapter } from "../../../../../src/infrastructure/auth/github/github-auth.adapter";
|
|
11
|
+
import { buildSessionCookieHeader } from "../../../../../src/infrastructure/auth/session/session-manager";
|
|
12
|
+
|
|
13
|
+
const STATE_COOKIE = "__github_state";
|
|
14
|
+
const IS_SECURE = process.env.NODE_ENV === "production";
|
|
15
|
+
|
|
16
|
+
function readCookie(cookieHeader: string, name: string): string | null {
|
|
17
|
+
for (const part of cookieHeader.split(";")) {
|
|
18
|
+
const [rawKey, ...rest] = part.trim().split("=");
|
|
19
|
+
if (rawKey.trim() === name) return decodeURIComponent(rest.join("="));
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function clearStateCookie(): string {
|
|
25
|
+
const parts = [
|
|
26
|
+
`${STATE_COOKIE}=`,
|
|
27
|
+
"Max-Age=0",
|
|
28
|
+
"Expires=Thu, 01 Jan 1970 00:00:00 GMT",
|
|
29
|
+
"Path=/api/auth/callback/github",
|
|
30
|
+
"HttpOnly",
|
|
31
|
+
"SameSite=Lax",
|
|
32
|
+
];
|
|
33
|
+
if (IS_SECURE) parts.push("Secure");
|
|
34
|
+
return parts.join("; ");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const adapter = new GitHubAuthAdapter();
|
|
38
|
+
|
|
39
|
+
export async function GET(request: NextRequest): Promise<NextResponse> {
|
|
40
|
+
const { searchParams } = request.nextUrl;
|
|
41
|
+
const code = searchParams.get("code");
|
|
42
|
+
const returnedState = searchParams.get("state");
|
|
43
|
+
const error = searchParams.get("error");
|
|
44
|
+
|
|
45
|
+
if (error) {
|
|
46
|
+
return NextResponse.redirect(
|
|
47
|
+
new URL(`/login?error=${encodeURIComponent(error)}`, request.url),
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!code) {
|
|
52
|
+
return NextResponse.json({ error: "Missing authorization code" }, { status: 400 });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const cookieHeader = request.headers.get("cookie") ?? "";
|
|
56
|
+
const savedState = readCookie(cookieHeader, STATE_COOKIE);
|
|
57
|
+
|
|
58
|
+
if (!savedState || returnedState !== savedState) {
|
|
59
|
+
return NextResponse.json({ error: "State mismatch — possible CSRF" }, { status: 400 });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let accessToken: string;
|
|
63
|
+
try {
|
|
64
|
+
const tokens = await exchangeCode(code);
|
|
65
|
+
accessToken = tokens.access_token;
|
|
66
|
+
} catch (err) {
|
|
67
|
+
const message = err instanceof Error ? err.message : "Token exchange failed";
|
|
68
|
+
return NextResponse.redirect(new URL(`/login?error=${encodeURIComponent(message)}`, request.url));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let sessionToken: string;
|
|
72
|
+
try {
|
|
73
|
+
const [ghUser, primaryEmail] = await Promise.all([
|
|
74
|
+
fetchUser(accessToken),
|
|
75
|
+
fetchPrimaryEmail(accessToken),
|
|
76
|
+
]);
|
|
77
|
+
|
|
78
|
+
// Org membership gate — checked before creating the session
|
|
79
|
+
if (GITHUB_CONFIG.allowedOrgs.length > 0) {
|
|
80
|
+
const memberships = await Promise.all(
|
|
81
|
+
GITHUB_CONFIG.allowedOrgs.map((org) => checkOrgMembership(accessToken, org, ghUser.login)),
|
|
82
|
+
);
|
|
83
|
+
if (!memberships.some(Boolean)) {
|
|
84
|
+
const orgs = GITHUB_CONFIG.allowedOrgs.join(", ");
|
|
85
|
+
return NextResponse.redirect(
|
|
86
|
+
new URL(
|
|
87
|
+
`/login?error=${encodeURIComponent(`Access restricted to members of: ${orgs}`)}`,
|
|
88
|
+
request.url,
|
|
89
|
+
),
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const githubUser = mapGitHubUser(ghUser, primaryEmail);
|
|
95
|
+
sessionToken = await adapter.createSessionFromGitHubUser(githubUser);
|
|
96
|
+
} catch (err) {
|
|
97
|
+
const message = err instanceof Error ? err.message : "Profile fetch failed";
|
|
98
|
+
return NextResponse.redirect(new URL(`/login?error=${encodeURIComponent(message)}`, request.url));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const response = NextResponse.redirect(new URL("/dashboard", request.url));
|
|
102
|
+
response.headers.append("Set-Cookie", clearStateCookie());
|
|
103
|
+
response.headers.append("Set-Cookie", buildSessionCookieHeader(sessionToken));
|
|
104
|
+
return response;
|
|
105
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from "next/server";
|
|
2
|
+
import { buildAuthorizeUrl } from "../../../../../src/infrastructure/auth/github/github-client";
|
|
3
|
+
|
|
4
|
+
const STATE_COOKIE = "__github_state";
|
|
5
|
+
const STATE_TTL = 300;
|
|
6
|
+
const IS_SECURE = process.env.NODE_ENV === "production";
|
|
7
|
+
|
|
8
|
+
function generateState(): string {
|
|
9
|
+
const random = new Uint8Array(new ArrayBuffer(32));
|
|
10
|
+
crypto.getRandomValues(random);
|
|
11
|
+
let binary = "";
|
|
12
|
+
for (const b of random) binary += String.fromCharCode(b);
|
|
13
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function stateCookie(value: string): string {
|
|
17
|
+
const parts = [
|
|
18
|
+
`${STATE_COOKIE}=${encodeURIComponent(value)}`,
|
|
19
|
+
`Max-Age=${STATE_TTL}`,
|
|
20
|
+
"Path=/api/auth/callback/github",
|
|
21
|
+
"HttpOnly",
|
|
22
|
+
"SameSite=Lax",
|
|
23
|
+
];
|
|
24
|
+
if (IS_SECURE) parts.push("Secure");
|
|
25
|
+
return parts.join("; ");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export async function GET(_request: NextRequest): Promise<NextResponse> {
|
|
29
|
+
const state = generateState();
|
|
30
|
+
const response = NextResponse.redirect(buildAuthorizeUrl(state));
|
|
31
|
+
response.headers.append("Set-Cookie", stateCookie(state));
|
|
32
|
+
return response;
|
|
33
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
import { buildClearSessionCookieHeader } from "../../../../../src/infrastructure/auth/session/session-manager";
|
|
3
|
+
|
|
4
|
+
export async function POST() {
|
|
5
|
+
const response = NextResponse.json({ ok: true });
|
|
6
|
+
response.headers.set("Set-Cookie", buildClearSessionCookieHeader());
|
|
7
|
+
return response;
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
import { getCurrentUser } from "../../../../src/lib/auth/get-current-user";
|
|
3
|
+
|
|
4
|
+
export async function GET() {
|
|
5
|
+
const user = await getCurrentUser();
|
|
6
|
+
if (!user) {
|
|
7
|
+
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
8
|
+
}
|
|
9
|
+
return NextResponse.json({ user });
|
|
10
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { NextResponse, type NextRequest } from "next/server";
|
|
2
|
+
import { readSessionToken } from "./src/infrastructure/auth/session/session-manager";
|
|
3
|
+
import { decryptSession } from "./src/infrastructure/auth/github/session-store";
|
|
4
|
+
import { mapGitHubUserToUserContext } from "./src/infrastructure/auth/github/user-profile-mapper";
|
|
5
|
+
import { MOCK_USER } from "./src/infrastructure/auth/mock-user";
|
|
6
|
+
|
|
7
|
+
// Root middleware. x-user-context is stripped from incoming headers on every
|
|
8
|
+
// code path so it can only carry middleware-validated values.
|
|
9
|
+
const PROTECTED_PATHS = "{protected_paths}"
|
|
10
|
+
.split(",")
|
|
11
|
+
.map((p) => {
|
|
12
|
+
const trimmed = p.trim();
|
|
13
|
+
// Preserve "/" as the literal root path; only strip trailing slashes for non-root.
|
|
14
|
+
return trimmed === "/" ? "/" : trimmed.replace(/\/+$/, "");
|
|
15
|
+
})
|
|
16
|
+
.filter(Boolean);
|
|
17
|
+
|
|
18
|
+
function isProtected(pathname: string): boolean {
|
|
19
|
+
return PROTECTED_PATHS.some(
|
|
20
|
+
(prefix) =>
|
|
21
|
+
prefix === "/" ||
|
|
22
|
+
pathname === prefix ||
|
|
23
|
+
pathname.startsWith(prefix + "/"),
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default async function middleware(request: NextRequest) {
|
|
28
|
+
const headers = new Headers(request.headers);
|
|
29
|
+
headers.delete("x-user-context");
|
|
30
|
+
|
|
31
|
+
if (process.env.AUTH_MODE === "mock") {
|
|
32
|
+
if (process.env.NODE_ENV !== "development") {
|
|
33
|
+
throw new Error("AUTH_MODE=mock is only supported in development");
|
|
34
|
+
}
|
|
35
|
+
headers.set("x-user-context", JSON.stringify(MOCK_USER));
|
|
36
|
+
return NextResponse.next({ request: { headers } });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const { pathname } = request.nextUrl;
|
|
40
|
+
if (!isProtected(pathname)) {
|
|
41
|
+
return NextResponse.next({ request: { headers } });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const token = readSessionToken(request);
|
|
45
|
+
if (!token) {
|
|
46
|
+
return NextResponse.redirect(new URL("/api/auth/login/github", request.url));
|
|
47
|
+
}
|
|
48
|
+
const user = await decryptSession(token);
|
|
49
|
+
if (!user) {
|
|
50
|
+
return NextResponse.redirect(new URL("/api/auth/login/github", request.url));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
headers.set("x-user-context", JSON.stringify(mapGitHubUserToUserContext(user)));
|
|
54
|
+
return NextResponse.next({ request: { headers } });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const config = {
|
|
58
|
+
matcher: ["/((?!_next/static|_next/image|favicon.ico).*)"],
|
|
59
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const clientId = process.env.GITHUB_CLIENT_ID;
|
|
2
|
+
const clientSecret = process.env.GITHUB_CLIENT_SECRET;
|
|
3
|
+
|
|
4
|
+
if (!clientId) {
|
|
5
|
+
throw new Error("GITHUB_CLIENT_ID is required. Set it in .env.local from your GitHub OAuth App settings.");
|
|
6
|
+
}
|
|
7
|
+
if (!clientSecret) {
|
|
8
|
+
throw new Error("GITHUB_CLIENT_SECRET is required. Set it in .env.local from your GitHub OAuth App settings.");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const allowedOrgsRaw = process.env.GITHUB_ALLOWED_ORGS ?? "{allowed_orgs}";
|
|
12
|
+
|
|
13
|
+
export const GITHUB_CONFIG = {
|
|
14
|
+
clientId,
|
|
15
|
+
clientSecret,
|
|
16
|
+
redirectUri: process.env.GITHUB_REDIRECT_URI ?? "{redirect_uri}",
|
|
17
|
+
scopes: (process.env.GITHUB_OAUTH_SCOPES ?? "{scopes}").split(",").map((s) => s.trim()),
|
|
18
|
+
/** Optional: restrict login to members of these GitHub orgs */
|
|
19
|
+
allowedOrgs: allowedOrgsRaw
|
|
20
|
+
? allowedOrgsRaw
|
|
21
|
+
.split(",")
|
|
22
|
+
.map((o) => o.trim())
|
|
23
|
+
.filter(Boolean)
|
|
24
|
+
: [],
|
|
25
|
+
} as const;
|
|
26
|
+
|
|
27
|
+
export const GITHUB_ENDPOINTS = {
|
|
28
|
+
authorize: "https://github.com/login/oauth/authorize",
|
|
29
|
+
token: "https://github.com/login/oauth/access_token",
|
|
30
|
+
user: "https://api.github.com/user",
|
|
31
|
+
emails: "https://api.github.com/user/emails",
|
|
32
|
+
orgMember: (org: string, username: string) =>
|
|
33
|
+
`https://api.github.com/orgs/${encodeURIComponent(org)}/members/${encodeURIComponent(username)}`,
|
|
34
|
+
} as const;
|
package/dist/templates/github-oauth/files/src/infrastructure/auth/github/github-auth.adapter.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GitHubUser } from "./github-user";
|
|
2
|
+
import { encryptSession } from "./session-store";
|
|
3
|
+
|
|
4
|
+
// Thin helper for the OAuth callback: encrypts the GitHub user into the session
|
|
5
|
+
// cookie. Validation of an existing session happens in middleware via
|
|
6
|
+
// decryptSession + the user-profile mapper, so this no longer implements a
|
|
7
|
+
// generic auth port.
|
|
8
|
+
export class GitHubAuthAdapter {
|
|
9
|
+
async createSessionFromGitHubUser(user: GitHubUser): Promise<string> {
|
|
10
|
+
return encryptSession(user);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { GITHUB_CONFIG, GITHUB_ENDPOINTS } from "./config";
|
|
2
|
+
|
|
3
|
+
export interface GitHubTokenResponse {
|
|
4
|
+
access_token: string;
|
|
5
|
+
token_type: string;
|
|
6
|
+
scope: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface GitHubUserResponse {
|
|
10
|
+
id: number;
|
|
11
|
+
login: string;
|
|
12
|
+
name: string | null;
|
|
13
|
+
email: string | null;
|
|
14
|
+
avatar_url?: string;
|
|
15
|
+
company?: string | null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface GitHubEmailEntry {
|
|
19
|
+
email: string;
|
|
20
|
+
primary: boolean;
|
|
21
|
+
verified: boolean;
|
|
22
|
+
visibility: string | null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function buildAuthorizeUrl(state: string): string {
|
|
26
|
+
const params = new URLSearchParams({
|
|
27
|
+
client_id: GITHUB_CONFIG.clientId,
|
|
28
|
+
redirect_uri: GITHUB_CONFIG.redirectUri,
|
|
29
|
+
scope: GITHUB_CONFIG.scopes.join(" "),
|
|
30
|
+
state,
|
|
31
|
+
});
|
|
32
|
+
return `${GITHUB_ENDPOINTS.authorize}?${params.toString()}`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export async function exchangeCode(code: string): Promise<GitHubTokenResponse> {
|
|
36
|
+
const res = await fetch(GITHUB_ENDPOINTS.token, {
|
|
37
|
+
method: "POST",
|
|
38
|
+
headers: {
|
|
39
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
40
|
+
Accept: "application/json",
|
|
41
|
+
},
|
|
42
|
+
body: new URLSearchParams({
|
|
43
|
+
client_id: GITHUB_CONFIG.clientId,
|
|
44
|
+
client_secret: GITHUB_CONFIG.clientSecret,
|
|
45
|
+
code,
|
|
46
|
+
redirect_uri: GITHUB_CONFIG.redirectUri,
|
|
47
|
+
}).toString(),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
if (!res.ok) {
|
|
51
|
+
const body = await res.text();
|
|
52
|
+
throw new Error(`GitHub token exchange failed (${res.status}): ${body}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const data = await res.json() as Record<string, unknown>;
|
|
56
|
+
if (data.error) {
|
|
57
|
+
throw new Error(`GitHub token exchange error: ${String(data.error_description ?? data.error)}`);
|
|
58
|
+
}
|
|
59
|
+
return data as unknown as GitHubTokenResponse;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function githubHeaders(token: string): Record<string, string> {
|
|
63
|
+
return {
|
|
64
|
+
Authorization: `Bearer ${token}`,
|
|
65
|
+
Accept: "application/vnd.github+json",
|
|
66
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export async function fetchUser(accessToken: string): Promise<GitHubUserResponse> {
|
|
71
|
+
const res = await fetch(GITHUB_ENDPOINTS.user, { headers: githubHeaders(accessToken) });
|
|
72
|
+
if (!res.ok) throw new Error(`GitHub user fetch failed (${res.status})`);
|
|
73
|
+
return res.json() as Promise<GitHubUserResponse>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export async function fetchPrimaryEmail(accessToken: string): Promise<string> {
|
|
77
|
+
const res = await fetch(GITHUB_ENDPOINTS.emails, { headers: githubHeaders(accessToken) });
|
|
78
|
+
if (!res.ok) throw new Error(`GitHub emails fetch failed (${res.status})`);
|
|
79
|
+
const emails = await res.json() as GitHubEmailEntry[];
|
|
80
|
+
const primary = emails.find((e) => e.primary && e.verified);
|
|
81
|
+
if (!primary) throw new Error("No primary verified email found on GitHub account.");
|
|
82
|
+
return primary.email;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export async function checkOrgMembership(
|
|
86
|
+
accessToken: string,
|
|
87
|
+
org: string,
|
|
88
|
+
username: string,
|
|
89
|
+
): Promise<boolean> {
|
|
90
|
+
const res = await fetch(GITHUB_ENDPOINTS.orgMember(org, username), {
|
|
91
|
+
headers: githubHeaders(accessToken),
|
|
92
|
+
});
|
|
93
|
+
// 204 = member, 302/404 = not a member, 403 = requester not in org
|
|
94
|
+
return res.status === 204;
|
|
95
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { GitHubUser } from "./github-user";
|
|
2
|
+
|
|
3
|
+
const SECRET = process.env.AUTH_SESSION_SECRET ?? "";
|
|
4
|
+
|
|
5
|
+
interface SessionPayload {
|
|
6
|
+
user: GitHubUser;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async function secretKey(): Promise<CryptoKey> {
|
|
10
|
+
const raw = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(SECRET));
|
|
11
|
+
return crypto.subtle.importKey("raw", raw, { name: "AES-GCM" }, false, ["encrypt", "decrypt"]);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function b64uEncode(buf: ArrayBuffer): string {
|
|
15
|
+
const bytes = new Uint8Array(buf);
|
|
16
|
+
let binary = "";
|
|
17
|
+
for (const b of bytes) binary += String.fromCharCode(b);
|
|
18
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function b64uDecode(str: string): Uint8Array {
|
|
22
|
+
const base64 = str.replace(/-/g, "+").replace(/_/g, "/");
|
|
23
|
+
const padded = base64 + "=".repeat((4 - (base64.length % 4)) % 4);
|
|
24
|
+
const binary = atob(padded);
|
|
25
|
+
const bytes = new Uint8Array(binary.length);
|
|
26
|
+
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
27
|
+
return bytes;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export async function encryptSession(user: GitHubUser): Promise<string> {
|
|
31
|
+
if (!SECRET) throw new Error("AUTH_SESSION_SECRET is required.");
|
|
32
|
+
const key = await secretKey();
|
|
33
|
+
const iv = new Uint8Array(new ArrayBuffer(12));
|
|
34
|
+
crypto.getRandomValues(iv);
|
|
35
|
+
const plaintext = new TextEncoder().encode(JSON.stringify({ user } satisfies SessionPayload));
|
|
36
|
+
const ciphertext = await crypto.subtle.encrypt({ name: "AES-GCM", iv }, key, plaintext);
|
|
37
|
+
return `${b64uEncode(iv.buffer as ArrayBuffer)}.${b64uEncode(ciphertext)}`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export async function decryptSession(token: string): Promise<GitHubUser | null> {
|
|
41
|
+
if (!SECRET) return null;
|
|
42
|
+
try {
|
|
43
|
+
const [ivB64, ctB64] = token.split(".");
|
|
44
|
+
if (!ivB64 || !ctB64) return null;
|
|
45
|
+
const key = await secretKey();
|
|
46
|
+
const plaintext = await crypto.subtle.decrypt(
|
|
47
|
+
{ name: "AES-GCM", iv: b64uDecode(ivB64) },
|
|
48
|
+
key,
|
|
49
|
+
b64uDecode(ctB64),
|
|
50
|
+
);
|
|
51
|
+
const payload = JSON.parse(new TextDecoder().decode(plaintext)) as SessionPayload;
|
|
52
|
+
return payload.user;
|
|
53
|
+
} catch {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|