nestjs-ddd-cli 3.2.1 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +118 -9
- package/ddd.schema.json +11 -1
- package/dist/commands/doctor-enhanced.d.ts +1 -0
- package/dist/commands/doctor-enhanced.js +94 -79
- package/dist/commands/doctor-enhanced.js.map +1 -1
- package/dist/commands/doctor.d.ts +9 -0
- package/dist/commands/doctor.js +68 -21
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/generate-all.js +238 -176
- package/dist/commands/generate-all.js.map +1 -1
- package/dist/commands/generate-controller.d.ts +1 -0
- package/dist/commands/generate-controller.js +71 -0
- package/dist/commands/generate-controller.js.map +1 -0
- package/dist/commands/generate-domain-service.d.ts +1 -1
- package/dist/commands/generate-domain-service.js +6 -4
- package/dist/commands/generate-domain-service.js.map +1 -1
- package/dist/commands/generate-dto.d.ts +4 -0
- package/dist/commands/generate-dto.js +162 -0
- package/dist/commands/generate-dto.js.map +1 -0
- package/dist/commands/generate-entity.js +44 -35
- package/dist/commands/generate-entity.js.map +1 -1
- package/dist/commands/generate-event.js +10 -4
- package/dist/commands/generate-event.js.map +1 -1
- package/dist/commands/generate-migration-deployment.d.ts +15 -0
- package/dist/commands/generate-migration-deployment.js +326 -0
- package/dist/commands/generate-migration-deployment.js.map +1 -0
- package/dist/commands/generate-migration-deployment.spec.d.ts +1 -0
- package/dist/commands/generate-migration-deployment.spec.js +337 -0
- package/dist/commands/generate-migration-deployment.spec.js.map +1 -0
- package/dist/commands/generate-module.js +41 -31
- package/dist/commands/generate-module.js.map +1 -1
- package/dist/commands/generate-query.js +23 -4
- package/dist/commands/generate-query.js.map +1 -1
- package/dist/commands/generate-repository.d.ts +1 -1
- package/dist/commands/generate-repository.js +17 -34
- package/dist/commands/generate-repository.js.map +1 -1
- package/dist/commands/generate-service.js +19 -4
- package/dist/commands/generate-service.js.map +1 -1
- package/dist/commands/generate-usecase.js +12 -31
- package/dist/commands/generate-usecase.js.map +1 -1
- package/dist/commands/generate-value-object.js +3 -14
- package/dist/commands/generate-value-object.js.map +1 -1
- package/dist/commands/init-project.d.ts +3 -0
- package/dist/commands/init-project.js +19 -9
- package/dist/commands/init-project.js.map +1 -1
- package/dist/commands/interactive-scaffold.js +10 -0
- package/dist/commands/interactive-scaffold.js.map +1 -1
- package/dist/commands/migration.d.ts +3 -0
- package/dist/commands/migration.js +83 -48
- package/dist/commands/migration.js.map +1 -1
- package/dist/commands/recipe.d.ts +2 -0
- package/dist/commands/recipe.js +282 -91
- package/dist/commands/recipe.js.map +1 -1
- package/dist/commands/recipes/banklink-connector-contract.recipe.d.ts +1 -0
- package/dist/commands/recipes/banklink-connector-contract.recipe.js +161 -0
- package/dist/commands/recipes/banklink-connector-contract.recipe.js.map +1 -0
- package/dist/commands/recipes/bounded-json-http.recipe.d.ts +2 -0
- package/dist/commands/recipes/bounded-json-http.recipe.js +53 -0
- package/dist/commands/recipes/bounded-json-http.recipe.js.map +1 -0
- package/dist/commands/recipes/business-reference-identifiers.recipe.d.ts +1 -0
- package/dist/commands/recipes/business-reference-identifiers.recipe.js +223 -0
- package/dist/commands/recipes/business-reference-identifiers.recipe.js.map +1 -0
- package/dist/commands/recipes/event-backbone.recipe.d.ts +1 -0
- package/dist/commands/recipes/event-backbone.recipe.js +1118 -0
- package/dist/commands/recipes/event-backbone.recipe.js.map +1 -0
- package/dist/commands/recipes/external-projection-worker.recipe.d.ts +6 -0
- package/dist/commands/recipes/external-projection-worker.recipe.js +211 -0
- package/dist/commands/recipes/external-projection-worker.recipe.js.map +1 -0
- package/dist/commands/recipes/index.d.ts +12 -0
- package/dist/commands/recipes/index.js +12 -0
- package/dist/commands/recipes/index.js.map +1 -1
- package/dist/commands/recipes/jest-cjs-compat.recipe.d.ts +3 -0
- package/dist/commands/recipes/jest-cjs-compat.recipe.js +130 -0
- package/dist/commands/recipes/jest-cjs-compat.recipe.js.map +1 -0
- package/dist/commands/recipes/joi-env.recipe.d.ts +1 -0
- package/dist/commands/recipes/joi-env.recipe.js +301 -0
- package/dist/commands/recipes/joi-env.recipe.js.map +1 -0
- package/dist/commands/recipes/kafka-consumer.recipe.d.ts +1 -0
- package/dist/commands/recipes/kafka-consumer.recipe.js +65 -0
- package/dist/commands/recipes/kafka-consumer.recipe.js.map +1 -0
- package/dist/commands/recipes/oauth2-client-credentials.recipe.d.ts +1 -0
- package/dist/commands/recipes/oauth2-client-credentials.recipe.js +60 -0
- package/dist/commands/recipes/oauth2-client-credentials.recipe.js.map +1 -0
- package/dist/commands/recipes/oauth2-token-introspection.recipe.d.ts +1 -0
- package/dist/commands/recipes/oauth2-token-introspection.recipe.js +67 -0
- package/dist/commands/recipes/oauth2-token-introspection.recipe.js.map +1 -0
- package/dist/commands/recipes/oidc-bff-session.recipe.d.ts +1 -0
- package/dist/commands/recipes/oidc-bff-session.recipe.js +57 -0
- package/dist/commands/recipes/oidc-bff-session.recipe.js.map +1 -0
- package/dist/commands/recipes/oidc-dashboard.recipe.d.ts +1 -0
- package/dist/commands/recipes/oidc-dashboard.recipe.js +463 -0
- package/dist/commands/recipes/oidc-dashboard.recipe.js.map +1 -0
- package/dist/commands/recipes/oidc-resource-server.recipe.d.ts +1 -0
- package/dist/commands/recipes/oidc-resource-server.recipe.js +85 -0
- package/dist/commands/recipes/oidc-resource-server.recipe.js.map +1 -0
- package/dist/commands/recipes/platform-context.recipe.d.ts +1 -0
- package/dist/commands/recipes/platform-context.recipe.js +229 -0
- package/dist/commands/recipes/platform-context.recipe.js.map +1 -0
- package/dist/commands/recipes/platform-parc-authorization.recipe.d.ts +1 -0
- package/dist/commands/recipes/platform-parc-authorization.recipe.js +339 -0
- package/dist/commands/recipes/platform-parc-authorization.recipe.js.map +1 -0
- package/dist/commands/recipes/platform-parc-bound-authorization.recipe.d.ts +1 -0
- package/dist/commands/recipes/platform-parc-bound-authorization.recipe.js +56 -0
- package/dist/commands/recipes/platform-parc-bound-authorization.recipe.js.map +1 -0
- package/dist/commands/recipes/platform-service-access-request-context.recipe.d.ts +1 -0
- package/dist/commands/recipes/platform-service-access-request-context.recipe.js +103 -0
- package/dist/commands/recipes/platform-service-access-request-context.recipe.js.map +1 -0
- package/dist/commands/recipes/platform-service-runtime.recipe.d.ts +1 -0
- package/dist/commands/recipes/platform-service-runtime.recipe.js +415 -0
- package/dist/commands/recipes/platform-service-runtime.recipe.js.map +1 -0
- package/dist/index.js +82 -11
- package/dist/index.js.map +1 -1
- package/dist/templates/ai-context/CLAUDE.md.hbs +54 -3
- package/dist/templates/ai-context/conventions.md.hbs +20 -8
- package/dist/templates/command/create-command.hbs +8 -3
- package/dist/templates/command/delete-command.hbs +1 -1
- package/dist/templates/command/update-command.hbs +1 -1
- package/dist/templates/controller/application-controller.hbs +7 -0
- package/dist/templates/controller/controller.hbs +6 -0
- package/dist/templates/dto/create-dto.hbs +17 -5
- package/dist/templates/dto/filter-dto.hbs +1 -1
- package/dist/templates/dto/response-dto.hbs +1 -1
- package/dist/templates/entity/entity.hbs +4 -0
- package/dist/templates/mapper/mapper.hbs +6 -2
- package/dist/templates/orm-entity/orm-entity.hbs +9 -1
- package/dist/templates/prisma/prisma-mapper.hbs +6 -0
- package/dist/templates/prisma/prisma-repository.hbs +57 -5
- package/dist/templates/prisma/prisma-schema.hbs +2 -0
- package/dist/templates/query/get-all.query.hbs +10 -2
- package/dist/templates/recipes/bounded-json-http/README.md.hbs +36 -0
- package/dist/templates/recipes/external-projection-worker/README.md.hbs +157 -0
- package/dist/templates/recipes/external-projection-worker/canonical-json.ts.hbs +123 -0
- package/dist/templates/recipes/external-projection-worker/enqueuer.ts.hbs +167 -0
- package/dist/templates/recipes/external-projection-worker/index.ts.hbs +6 -0
- package/dist/templates/recipes/external-projection-worker/migration.ts.hbs +88 -0
- package/dist/templates/recipes/external-projection-worker/module.ts.hbs +36 -0
- package/dist/templates/recipes/external-projection-worker/store.ts.hbs +354 -0
- package/dist/templates/recipes/external-projection-worker/types.ts.hbs +134 -0
- package/dist/templates/recipes/external-projection-worker/worker.ts.hbs +296 -0
- package/dist/templates/recipes/kafka-consumer/README.md.hbs +50 -0
- package/dist/templates/recipes/kafka-consumer/kafka-consumer.ts.hbs +135 -0
- package/dist/templates/recipes/kafka-consumer/migration.ts.hbs +17 -0
- package/dist/templates/recipes/oauth2-client-credentials/README.md.hbs +40 -0
- package/dist/templates/recipes/oauth2-client-credentials/client.spec.ts.hbs +234 -0
- package/dist/templates/recipes/oauth2-client-credentials/client.ts.hbs +210 -0
- package/dist/templates/recipes/oauth2-client-credentials/index.ts.hbs +2 -0
- package/dist/templates/recipes/oauth2-client-credentials/module.ts.hbs +58 -0
- package/dist/templates/recipes/oauth2-token-introspection/README.md.hbs +158 -0
- package/dist/templates/recipes/oauth2-token-introspection/client.spec.ts.hbs +350 -0
- package/dist/templates/recipes/oauth2-token-introspection/client.ts.hbs +241 -0
- package/dist/templates/recipes/oauth2-token-introspection/http-client.spec.ts.hbs +411 -0
- package/dist/templates/recipes/oauth2-token-introspection/http-client.ts.hbs +343 -0
- package/dist/templates/recipes/oauth2-token-introspection/index.ts.hbs +3 -0
- package/dist/templates/recipes/oauth2-token-introspection/module.ts.hbs +58 -0
- package/dist/templates/recipes/oidc-bff-session/README.md.hbs +96 -0
- package/dist/templates/recipes/oidc-bff-session/client.test.ts.hbs +663 -0
- package/dist/templates/recipes/oidc-bff-session/client.ts.hbs +635 -0
- package/dist/templates/recipes/oidc-bff-session/index.ts.hbs +3 -0
- package/dist/templates/recipes/oidc-bff-session/store.integration.test.ts.hbs +480 -0
- package/dist/templates/recipes/oidc-bff-session/store.test.ts.hbs +87 -0
- package/dist/templates/recipes/oidc-bff-session/store.ts.hbs +549 -0
- package/dist/templates/recipes/oidc-bff-session/valkey.test.ts.hbs +158 -0
- package/dist/templates/recipes/oidc-bff-session/valkey.ts.hbs +148 -0
- package/dist/templates/recipes/oidc-resource-server/README.md.hbs +74 -0
- package/dist/templates/recipes/oidc-resource-server/index.ts.hbs +2 -0
- package/dist/templates/recipes/oidc-resource-server/module.ts.hbs +51 -0
- package/dist/templates/recipes/oidc-resource-server/verifier.spec.ts.hbs +186 -0
- package/dist/templates/recipes/oidc-resource-server/verifier.ts.hbs +440 -0
- package/dist/templates/recipes/platform-parc-bound-authorization/README.md.hbs +92 -0
- package/dist/templates/recipes/platform-parc-bound-authorization/client.ts.hbs +142 -0
- package/dist/templates/recipes/platform-service-access-request-context/docs.md.hbs +61 -0
- package/dist/templates/recipes/platform-service-access-request-context/env.example.hbs +7 -0
- package/dist/templates/recipes/platform-service-access-request-context/index.ts.hbs +7 -0
- package/dist/templates/recipes/platform-service-access-request-context/request-context-headers.ts.hbs +61 -0
- package/dist/templates/recipes/platform-service-access-request-context/request-context-introspection.parser.ts.hbs +132 -0
- package/dist/templates/recipes/platform-service-access-request-context/request-context-introspection.types.ts.hbs +40 -0
- package/dist/templates/recipes/platform-service-access-request-context/service-access-request-context.client.ts.hbs +45 -0
- package/dist/templates/recipes/platform-service-access-request-context/service-access-request-context.config.ts.hbs +142 -0
- package/dist/templates/recipes/platform-service-access-request-context/service-access-request-context.guard.ts.hbs +77 -0
- package/dist/templates/recipes/platform-service-access-request-context/service-access-request-context.module.ts.hbs +17 -0
- package/dist/templates/repository/repository.hbs +43 -5
- package/dist/templates/resolver/graphql-input.hbs +23 -6
- package/dist/templates/resolver/resolver.hbs +4 -0
- package/dist/templates/service/domain-service.hbs +2 -2
- package/dist/templates/test/controller.spec.hbs +5 -1
- package/dist/templates/test/prisma-repository.spec.hbs +192 -0
- package/dist/templates/test/repository.spec.hbs +41 -2
- package/dist/templates/test/usecase.spec.hbs +24 -5
- package/dist/templates/usecase/application-usecase.hbs +17 -0
- package/dist/templates/usecase/create-usecase.hbs +34 -3
- package/dist/templates/usecase/update-usecase.hbs +15 -1
- package/dist/utils/config.utils.d.ts +2 -0
- package/dist/utils/config.utils.js +14 -2
- package/dist/utils/config.utils.js.map +1 -1
- package/dist/utils/dependency.utils.d.ts +18 -2
- package/dist/utils/dependency.utils.js +144 -15
- package/dist/utils/dependency.utils.js.map +1 -1
- package/dist/utils/field.utils.d.ts +6 -0
- package/dist/utils/field.utils.js +78 -24
- package/dist/utils/field.utils.js.map +1 -1
- package/dist/utils/field.utils.spec.d.ts +1 -0
- package/dist/utils/field.utils.spec.js +38 -0
- package/dist/utils/field.utils.spec.js.map +1 -0
- package/dist/utils/file.utils.d.ts +39 -3
- package/dist/utils/file.utils.js +150 -13
- package/dist/utils/file.utils.js.map +1 -1
- package/dist/utils/naming.utils.js +5 -4
- package/dist/utils/naming.utils.js.map +1 -1
- package/dist/utils/static-recipe.utils.d.ts +4 -0
- package/dist/utils/static-recipe.utils.js +148 -0
- package/dist/utils/static-recipe.utils.js.map +1 -0
- package/dist/utils/template-engine.utils.js +83 -68
- package/dist/utils/template-engine.utils.js.map +1 -1
- package/package.json +20 -11
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.applyJoiEnvRecipe = applyJoiEnvRecipe;
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
+
const file_utils_1 = require("../../utils/file.utils");
|
|
43
|
+
async function applyJoiEnvRecipe(basePath) {
|
|
44
|
+
const configPath = path.join(basePath, 'src/config');
|
|
45
|
+
await (0, file_utils_1.ensureDir)(configPath);
|
|
46
|
+
await (0, file_utils_1.writeFile)(path.join(configPath, 'env.validation.ts'), envValidationContent);
|
|
47
|
+
await (0, file_utils_1.writeFile)(path.join(configPath, 'configuration.ts'), configurationContent);
|
|
48
|
+
await (0, file_utils_1.writeFile)(path.join(configPath, 'config-module.options.ts'), configModuleOptionsContent);
|
|
49
|
+
await (0, file_utils_1.writeFile)(path.join(configPath, 'index.ts'), indexContent);
|
|
50
|
+
const envExamplePath = path.join(basePath, '.env.example');
|
|
51
|
+
const fallbackExamplePath = path.join(basePath, '.env.joi.example');
|
|
52
|
+
const targetExamplePath = (await (0, file_utils_1.fileExists)(envExamplePath))
|
|
53
|
+
? fallbackExamplePath
|
|
54
|
+
: envExamplePath;
|
|
55
|
+
await (0, file_utils_1.writeFile)(targetExamplePath, envExampleContent);
|
|
56
|
+
console.log(chalk_1.default.green(' ✓ Joi environment validation schema'));
|
|
57
|
+
console.log(chalk_1.default.green(' ✓ Typed configuration factory'));
|
|
58
|
+
console.log(chalk_1.default.green(' ✓ ConfigModule options helper'));
|
|
59
|
+
console.log(chalk_1.default.green(` ✓ ${path.basename(targetExamplePath)} with platform service defaults`));
|
|
60
|
+
console.log(chalk_1.default.yellow(' Add `ConfigModule.forRoot(configModuleOptions)` in AppModule to enforce this schema.'));
|
|
61
|
+
}
|
|
62
|
+
const envValidationContent = `import * as Joi from 'joi';
|
|
63
|
+
|
|
64
|
+
const uuid = Joi.string().guid({ version: ['uuidv4', 'uuidv5'] });
|
|
65
|
+
const requiredInProduction = <T extends Joi.Schema>(schema: T): T =>
|
|
66
|
+
schema.when('NODE_ENV', {
|
|
67
|
+
is: 'production',
|
|
68
|
+
then: schema.required(),
|
|
69
|
+
otherwise: schema.optional(),
|
|
70
|
+
}) as T;
|
|
71
|
+
|
|
72
|
+
export const envValidationSchema = Joi.object({
|
|
73
|
+
NODE_ENV: Joi.string()
|
|
74
|
+
.valid('development', 'test', 'staging', 'production')
|
|
75
|
+
.default('development'),
|
|
76
|
+
PORT: Joi.number().integer().min(1).max(65535).default(3000),
|
|
77
|
+
API_PREFIX: Joi.string().trim().default('api/v1'),
|
|
78
|
+
APP_NAME: Joi.string().trim().default('nestjs-ddd-service'),
|
|
79
|
+
|
|
80
|
+
DATABASE_URL: requiredInProduction(
|
|
81
|
+
Joi.string().trim().uri({ scheme: ['postgres', 'postgresql'] }),
|
|
82
|
+
),
|
|
83
|
+
DATABASE_SSL: Joi.boolean().truthy('true').falsy('false').default(false),
|
|
84
|
+
DATABASE_LOGGING: Joi.boolean().truthy('true').falsy('false').default(false),
|
|
85
|
+
|
|
86
|
+
INTERNAL_API_KEY: requiredInProduction(Joi.string().trim().min(32)),
|
|
87
|
+
SERVICE_ACCESS_INTERNAL_API_KEY: Joi.string().trim().min(32).optional(),
|
|
88
|
+
|
|
89
|
+
SERVICE_ACCESS_URL: Joi.string().trim().uri().optional(),
|
|
90
|
+
SERVICE_ACCESS_TIMEOUT_MS: Joi.number().integer().min(1000).default(5000),
|
|
91
|
+
|
|
92
|
+
IDENTITY_MANAGER_URL: Joi.string().trim().uri().optional(),
|
|
93
|
+
BUSINESS_ENTITY_URL: Joi.string().trim().uri().optional(),
|
|
94
|
+
|
|
95
|
+
IDENTITY_BOOTSTRAP_PLATFORM_USERS: Joi.boolean()
|
|
96
|
+
.truthy('true')
|
|
97
|
+
.falsy('false')
|
|
98
|
+
.default(true),
|
|
99
|
+
SERVICE_ACCESS_BOOTSTRAP_CATALOG: Joi.boolean()
|
|
100
|
+
.truthy('true')
|
|
101
|
+
.falsy('false')
|
|
102
|
+
.default(true),
|
|
103
|
+
SERVICE_ACCESS_BOOTSTRAP_PLATFORM_GRANTS: Joi.boolean()
|
|
104
|
+
.truthy('true')
|
|
105
|
+
.falsy('false')
|
|
106
|
+
.default(true),
|
|
107
|
+
BUSINESS_ENTITY_BOOTSTRAP_PLATFORM_BUSINESSES: Joi.boolean()
|
|
108
|
+
.truthy('true')
|
|
109
|
+
.falsy('false')
|
|
110
|
+
.default(true),
|
|
111
|
+
|
|
112
|
+
PLATFORM_BUSINESS_OWNER_ID: uuid.default(
|
|
113
|
+
'00000000-0000-4000-8000-000000000001',
|
|
114
|
+
),
|
|
115
|
+
KORIDO_BUSINESS_ENTITY_ID: uuid.default(
|
|
116
|
+
'00000000-0000-4000-8000-000000000101',
|
|
117
|
+
),
|
|
118
|
+
KORIDO_BUSINESS_OWNER_ID: uuid.optional(),
|
|
119
|
+
|
|
120
|
+
PLATFORM_OWNER_EMAIL: Joi.string()
|
|
121
|
+
.trim()
|
|
122
|
+
.lowercase()
|
|
123
|
+
.email()
|
|
124
|
+
.default('platform-owner@joonapay.local'),
|
|
125
|
+
PLATFORM_OWNER_USERNAME: Joi.string().trim().default('platform-owner'),
|
|
126
|
+
PLATFORM_OWNER_FIRST_NAME: Joi.string().trim().default('Platform'),
|
|
127
|
+
PLATFORM_OWNER_LAST_NAME: Joi.string().trim().default('Owner'),
|
|
128
|
+
|
|
129
|
+
LOG_LEVEL: Joi.string()
|
|
130
|
+
.valid('error', 'warn', 'info', 'debug', 'verbose')
|
|
131
|
+
.default('info'),
|
|
132
|
+
CORS_ORIGINS: Joi.string().trim().allow('').default(''),
|
|
133
|
+
})
|
|
134
|
+
.or('INTERNAL_API_KEY', 'SERVICE_ACCESS_INTERNAL_API_KEY')
|
|
135
|
+
.prefs({
|
|
136
|
+
abortEarly: false,
|
|
137
|
+
allowUnknown: true,
|
|
138
|
+
convert: true,
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
export type ValidatedEnv = {
|
|
142
|
+
NODE_ENV: 'development' | 'test' | 'staging' | 'production';
|
|
143
|
+
PORT: number;
|
|
144
|
+
API_PREFIX: string;
|
|
145
|
+
APP_NAME: string;
|
|
146
|
+
DATABASE_URL?: string;
|
|
147
|
+
DATABASE_SSL: boolean;
|
|
148
|
+
DATABASE_LOGGING: boolean;
|
|
149
|
+
INTERNAL_API_KEY?: string;
|
|
150
|
+
SERVICE_ACCESS_INTERNAL_API_KEY?: string;
|
|
151
|
+
SERVICE_ACCESS_URL?: string;
|
|
152
|
+
SERVICE_ACCESS_TIMEOUT_MS: number;
|
|
153
|
+
IDENTITY_MANAGER_URL?: string;
|
|
154
|
+
BUSINESS_ENTITY_URL?: string;
|
|
155
|
+
IDENTITY_BOOTSTRAP_PLATFORM_USERS: boolean;
|
|
156
|
+
SERVICE_ACCESS_BOOTSTRAP_CATALOG: boolean;
|
|
157
|
+
SERVICE_ACCESS_BOOTSTRAP_PLATFORM_GRANTS: boolean;
|
|
158
|
+
BUSINESS_ENTITY_BOOTSTRAP_PLATFORM_BUSINESSES: boolean;
|
|
159
|
+
PLATFORM_BUSINESS_OWNER_ID: string;
|
|
160
|
+
KORIDO_BUSINESS_ENTITY_ID: string;
|
|
161
|
+
KORIDO_BUSINESS_OWNER_ID?: string;
|
|
162
|
+
PLATFORM_OWNER_EMAIL: string;
|
|
163
|
+
PLATFORM_OWNER_USERNAME: string;
|
|
164
|
+
PLATFORM_OWNER_FIRST_NAME: string;
|
|
165
|
+
PLATFORM_OWNER_LAST_NAME: string;
|
|
166
|
+
LOG_LEVEL: 'error' | 'warn' | 'info' | 'debug' | 'verbose';
|
|
167
|
+
CORS_ORIGINS: string;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export function validateEnv(config: Record<string, unknown>): ValidatedEnv {
|
|
171
|
+
const { error, value } = envValidationSchema.validate(config);
|
|
172
|
+
|
|
173
|
+
if (error) {
|
|
174
|
+
const message = error.details
|
|
175
|
+
.map((detail) => \` - \${detail.path.join('.')}: \${detail.message}\`)
|
|
176
|
+
.join('\\n');
|
|
177
|
+
throw new Error(\`Environment validation failed:\\n\${message}\`);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return value as ValidatedEnv;
|
|
181
|
+
}
|
|
182
|
+
`;
|
|
183
|
+
const configurationContent = `import { validateEnv } from './env.validation';
|
|
184
|
+
|
|
185
|
+
export default () => {
|
|
186
|
+
const env = validateEnv(process.env);
|
|
187
|
+
const internalApiKey =
|
|
188
|
+
env.INTERNAL_API_KEY ?? env.SERVICE_ACCESS_INTERNAL_API_KEY;
|
|
189
|
+
|
|
190
|
+
return {
|
|
191
|
+
app: {
|
|
192
|
+
name: env.APP_NAME,
|
|
193
|
+
nodeEnv: env.NODE_ENV,
|
|
194
|
+
port: env.PORT,
|
|
195
|
+
apiPrefix: env.API_PREFIX,
|
|
196
|
+
isProduction: env.NODE_ENV === 'production',
|
|
197
|
+
isStaging: env.NODE_ENV === 'staging',
|
|
198
|
+
isTest: env.NODE_ENV === 'test',
|
|
199
|
+
},
|
|
200
|
+
database: {
|
|
201
|
+
url: env.DATABASE_URL,
|
|
202
|
+
ssl: env.DATABASE_SSL,
|
|
203
|
+
logging: env.DATABASE_LOGGING,
|
|
204
|
+
},
|
|
205
|
+
security: {
|
|
206
|
+
internalApiKey,
|
|
207
|
+
},
|
|
208
|
+
serviceAccess: {
|
|
209
|
+
baseUrl: env.SERVICE_ACCESS_URL,
|
|
210
|
+
internalApiKey,
|
|
211
|
+
timeoutMs: env.SERVICE_ACCESS_TIMEOUT_MS,
|
|
212
|
+
},
|
|
213
|
+
platformAdapters: {
|
|
214
|
+
identityManagerUrl: env.IDENTITY_MANAGER_URL,
|
|
215
|
+
businessEntityUrl: env.BUSINESS_ENTITY_URL,
|
|
216
|
+
},
|
|
217
|
+
platformBootstrap: {
|
|
218
|
+
identityUsersEnabled: env.IDENTITY_BOOTSTRAP_PLATFORM_USERS,
|
|
219
|
+
serviceCatalogEnabled: env.SERVICE_ACCESS_BOOTSTRAP_CATALOG,
|
|
220
|
+
serviceGrantsEnabled: env.SERVICE_ACCESS_BOOTSTRAP_PLATFORM_GRANTS,
|
|
221
|
+
businessEntitiesEnabled:
|
|
222
|
+
env.BUSINESS_ENTITY_BOOTSTRAP_PLATFORM_BUSINESSES,
|
|
223
|
+
platformBusinessOwnerId: env.PLATFORM_BUSINESS_OWNER_ID,
|
|
224
|
+
koridoBusinessEntityId: env.KORIDO_BUSINESS_ENTITY_ID,
|
|
225
|
+
koridoBusinessOwnerId:
|
|
226
|
+
env.KORIDO_BUSINESS_OWNER_ID ?? env.PLATFORM_BUSINESS_OWNER_ID,
|
|
227
|
+
platformOwnerEmail: env.PLATFORM_OWNER_EMAIL,
|
|
228
|
+
platformOwnerUsername: env.PLATFORM_OWNER_USERNAME,
|
|
229
|
+
platformOwnerFirstName: env.PLATFORM_OWNER_FIRST_NAME,
|
|
230
|
+
platformOwnerLastName: env.PLATFORM_OWNER_LAST_NAME,
|
|
231
|
+
},
|
|
232
|
+
logging: {
|
|
233
|
+
level: env.LOG_LEVEL,
|
|
234
|
+
},
|
|
235
|
+
cors: {
|
|
236
|
+
origins: env.CORS_ORIGINS
|
|
237
|
+
? env.CORS_ORIGINS.split(',').map((item) => item.trim()).filter(Boolean)
|
|
238
|
+
: [],
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
`;
|
|
243
|
+
const configModuleOptionsContent = `import { ConfigModuleOptions } from '@nestjs/config';
|
|
244
|
+
import configuration from './configuration';
|
|
245
|
+
import { envValidationSchema } from './env.validation';
|
|
246
|
+
|
|
247
|
+
export const configModuleOptions: ConfigModuleOptions = {
|
|
248
|
+
isGlobal: true,
|
|
249
|
+
load: [configuration],
|
|
250
|
+
validationSchema: envValidationSchema,
|
|
251
|
+
validationOptions: {
|
|
252
|
+
abortEarly: false,
|
|
253
|
+
allowUnknown: true,
|
|
254
|
+
},
|
|
255
|
+
envFilePath: ['.env.local', '.env'],
|
|
256
|
+
cache: true,
|
|
257
|
+
expandVariables: true,
|
|
258
|
+
};
|
|
259
|
+
`;
|
|
260
|
+
const indexContent = `export * from './config-module.options';
|
|
261
|
+
export * from './configuration';
|
|
262
|
+
export * from './env.validation';
|
|
263
|
+
`;
|
|
264
|
+
const envExampleContent = `# Application
|
|
265
|
+
NODE_ENV=development
|
|
266
|
+
PORT=3000
|
|
267
|
+
API_PREFIX=api/v1
|
|
268
|
+
APP_NAME=nestjs-ddd-service
|
|
269
|
+
|
|
270
|
+
# Database
|
|
271
|
+
DATABASE_URL=postgres://postgres:postgres@localhost:5432/app
|
|
272
|
+
DATABASE_SSL=false
|
|
273
|
+
DATABASE_LOGGING=false
|
|
274
|
+
|
|
275
|
+
# Internal platform auth
|
|
276
|
+
INTERNAL_API_KEY=replace-with-a-long-random-shared-secret
|
|
277
|
+
# SERVICE_ACCESS_INTERNAL_API_KEY=replace-with-a-long-random-shared-secret
|
|
278
|
+
|
|
279
|
+
# Platform adapters
|
|
280
|
+
SERVICE_ACCESS_URL=http://localhost:3010
|
|
281
|
+
SERVICE_ACCESS_TIMEOUT_MS=5000
|
|
282
|
+
IDENTITY_MANAGER_URL=http://localhost:3000
|
|
283
|
+
BUSINESS_ENTITY_URL=http://localhost:3020
|
|
284
|
+
|
|
285
|
+
# Platform bootstrap defaults
|
|
286
|
+
IDENTITY_BOOTSTRAP_PLATFORM_USERS=true
|
|
287
|
+
SERVICE_ACCESS_BOOTSTRAP_CATALOG=true
|
|
288
|
+
SERVICE_ACCESS_BOOTSTRAP_PLATFORM_GRANTS=true
|
|
289
|
+
BUSINESS_ENTITY_BOOTSTRAP_PLATFORM_BUSINESSES=true
|
|
290
|
+
PLATFORM_BUSINESS_OWNER_ID=00000000-0000-4000-8000-000000000001
|
|
291
|
+
KORIDO_BUSINESS_ENTITY_ID=00000000-0000-4000-8000-000000000101
|
|
292
|
+
PLATFORM_OWNER_EMAIL=platform-owner@joonapay.local
|
|
293
|
+
PLATFORM_OWNER_USERNAME=platform-owner
|
|
294
|
+
PLATFORM_OWNER_FIRST_NAME=Platform
|
|
295
|
+
PLATFORM_OWNER_LAST_NAME=Owner
|
|
296
|
+
|
|
297
|
+
# Runtime
|
|
298
|
+
LOG_LEVEL=info
|
|
299
|
+
CORS_ORIGINS=http://localhost:3000
|
|
300
|
+
`;
|
|
301
|
+
//# sourceMappingURL=joi-env.recipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"joi-env.recipe.js","sourceRoot":"","sources":["../../../src/commands/recipes/joi-env.recipe.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,8CA4BC;AAhCD,2CAA6B;AAC7B,kDAA0B;AAC1B,uDAA0E;AAEnE,KAAK,UAAU,iBAAiB,CAAC,QAAgB;IACtD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACrD,MAAM,IAAA,sBAAS,EAAC,UAAU,CAAC,CAAC;IAE5B,MAAM,IAAA,sBAAS,EAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,mBAAmB,CAAC,EAAE,oBAAoB,CAAC,CAAC;IAClF,MAAM,IAAA,sBAAS,EAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,kBAAkB,CAAC,EAAE,oBAAoB,CAAC,CAAC;IACjF,MAAM,IAAA,sBAAS,EAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,0BAA0B,CAAC,EAAE,0BAA0B,CAAC,CAAC;IAC/F,MAAM,IAAA,sBAAS,EAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,YAAY,CAAC,CAAC;IAEjE,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IAC3D,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;IACpE,MAAM,iBAAiB,GAAG,CAAC,MAAM,IAAA,uBAAU,EAAC,cAAc,CAAC,CAAC;QAC1D,CAAC,CAAC,mBAAmB;QACrB,CAAC,CAAC,cAAc,CAAC;IAEnB,MAAM,IAAA,sBAAS,EAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;IAEtD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC,CAAC;IAClE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC,CAAC;IAC5D,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC,CAAC;IAC5D,OAAO,CAAC,GAAG,CACT,eAAK,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,iCAAiC,CAAC,CACtF,CAAC;IACF,OAAO,CAAC,GAAG,CACT,eAAK,CAAC,MAAM,CACV,wFAAwF,CACzF,CACF,CAAC;AACJ,CAAC;AAED,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwH5B,CAAC;AAEF,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2D5B,CAAC;AAEF,MAAM,0BAA0B,GAAG;;;;;;;;;;;;;;;;CAgBlC,CAAC;AAEF,MAAM,YAAY,GAAG;;;CAGpB,CAAC;AAEF,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function applyKafkaConsumerRecipe(basePath: string, dryRun?: boolean): Promise<void>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.applyKafkaConsumerRecipe = applyKafkaConsumerRecipe;
|
|
37
|
+
const path = __importStar(require("node:path"));
|
|
38
|
+
const fs = __importStar(require("fs-extra"));
|
|
39
|
+
const file_utils_1 = require("../../utils/file.utils");
|
|
40
|
+
const files = [
|
|
41
|
+
['kafka-consumer.ts.hbs', 'src/shared/kafka-consumer/kafka-consumer.ts'],
|
|
42
|
+
['migration.ts.hbs', 'src/migrations/1788600000000-KafkaConsumerReceipts.ts'],
|
|
43
|
+
['README.md.hbs', 'docs/platform/kafka-consumer.md'],
|
|
44
|
+
];
|
|
45
|
+
async function applyKafkaConsumerRecipe(basePath, dryRun = false) {
|
|
46
|
+
const root = path.join(__dirname, '../../templates/recipes/kafka-consumer');
|
|
47
|
+
const planned = await Promise.all(files.map(async ([source, target]) => ({
|
|
48
|
+
target: path.join(basePath, target),
|
|
49
|
+
content: await (0, file_utils_1.readTemplate)(path.join(root, source)),
|
|
50
|
+
})));
|
|
51
|
+
// Check all targets first; reruns must never overwrite application adaptations.
|
|
52
|
+
for (const file of planned) {
|
|
53
|
+
if ((await fs.pathExists(file.target)) &&
|
|
54
|
+
(await fs.readFile(file.target, 'utf8')) !== file.content) {
|
|
55
|
+
throw new Error(`Kafka recipe target already differs: ${file.target}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
for (const file of planned) {
|
|
59
|
+
if (dryRun)
|
|
60
|
+
console.log(`Would generate: ${file.target}`);
|
|
61
|
+
else if (!(await fs.pathExists(file.target)))
|
|
62
|
+
await (0, file_utils_1.writeFile)(file.target, file.content);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=kafka-consumer.recipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kafka-consumer.recipe.js","sourceRoot":"","sources":["../../../src/commands/recipes/kafka-consumer.recipe.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,4DAqBC;AA/BD,gDAAkC;AAClC,6CAA+B;AAC/B,uDAAiE;AAEjE,MAAM,KAAK,GAAG;IACZ,CAAC,uBAAuB,EAAE,6CAA6C,CAAC;IACxE,CAAC,kBAAkB,EAAE,uDAAuD,CAAC;IAC7E,CAAC,eAAe,EAAE,iCAAiC,CAAC;CAC5C,CAAC;AAEJ,KAAK,UAAU,wBAAwB,CAAC,QAAgB,EAAE,MAAM,GAAG,KAAK;IAC7E,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,wCAAwC,CAAC,CAAC;IAC5E,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;QACrC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC;QACnC,OAAO,EAAE,MAAM,IAAA,yBAAY,EAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;KACrD,CAAC,CAAC,CACJ,CAAC;IACF,gFAAgF;IAChF,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,IACE,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAClC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,IAAI,CAAC,OAAO,EACzD,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,wCAAwC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,IAAI,MAAM;YAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;aACrD,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAAE,MAAM,IAAA,sBAAS,EAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3F,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function applyOAuth2ClientCredentialsRecipe(basePath: string, dryRun?: boolean): Promise<void>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.applyOAuth2ClientCredentialsRecipe = applyOAuth2ClientCredentialsRecipe;
|
|
37
|
+
const path = __importStar(require("node:path"));
|
|
38
|
+
const static_recipe_utils_1 = require("../../utils/static-recipe.utils");
|
|
39
|
+
async function applyOAuth2ClientCredentialsRecipe(basePath, dryRun = false) {
|
|
40
|
+
const root = path.join(__dirname, '../../templates/recipes');
|
|
41
|
+
const own = 'src/shared/auth/oauth2-client-credentials';
|
|
42
|
+
const transport = 'src/shared/auth/oauth2-token-introspection';
|
|
43
|
+
const files = [
|
|
44
|
+
['oauth2-client-credentials/client.ts.hbs', own + '/oauth2-client-credentials.client.ts'],
|
|
45
|
+
[
|
|
46
|
+
'oauth2-client-credentials/client.spec.ts.hbs',
|
|
47
|
+
own + '/oauth2-client-credentials.client.spec.ts',
|
|
48
|
+
],
|
|
49
|
+
['oauth2-client-credentials/module.ts.hbs', own + '/oauth2-client-credentials.module.ts'],
|
|
50
|
+
['oauth2-client-credentials/index.ts.hbs', own + '/index.ts'],
|
|
51
|
+
['oauth2-client-credentials/README.md.hbs', 'docs/auth/oauth2-client-credentials.md'],
|
|
52
|
+
['oauth2-token-introspection/http-client.ts.hbs', transport + '/bounded-json-http.client.ts'],
|
|
53
|
+
[
|
|
54
|
+
'oauth2-token-introspection/http-client.spec.ts.hbs',
|
|
55
|
+
transport + '/bounded-json-http.client.spec.ts',
|
|
56
|
+
],
|
|
57
|
+
];
|
|
58
|
+
await (0, static_recipe_utils_1.applyStaticRecipePlan)(basePath, files.map(([source, destination]) => ({ template: path.join(root, source), destination })), dryRun);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=oauth2-client-credentials.recipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth2-client-credentials.recipe.js","sourceRoot":"","sources":["../../../src/commands/recipes/oauth2-client-credentials.recipe.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,gFA2BC;AA9BD,gDAAkC;AAClC,yEAAwE;AAEjE,KAAK,UAAU,kCAAkC,CACtD,QAAgB,EAChB,MAAM,GAAG,KAAK;IAEd,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC;IAC7D,MAAM,GAAG,GAAG,2CAA2C,CAAC;IACxD,MAAM,SAAS,GAAG,4CAA4C,CAAC;IAC/D,MAAM,KAAK,GAAG;QACZ,CAAC,yCAAyC,EAAE,GAAG,GAAG,sCAAsC,CAAC;QACzF;YACE,8CAA8C;YAC9C,GAAG,GAAG,2CAA2C;SAClD;QACD,CAAC,yCAAyC,EAAE,GAAG,GAAG,sCAAsC,CAAC;QACzF,CAAC,wCAAwC,EAAE,GAAG,GAAG,WAAW,CAAC;QAC7D,CAAC,yCAAyC,EAAE,wCAAwC,CAAC;QACrF,CAAC,+CAA+C,EAAE,SAAS,GAAG,8BAA8B,CAAC;QAC7F;YACE,oDAAoD;YACpD,SAAS,GAAG,mCAAmC;SAChD;KACO,CAAC;IACX,MAAM,IAAA,2CAAqB,EACzB,QAAQ,EACR,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,EAC1F,MAAM,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function applyOAuth2TokenIntrospectionRecipe(basePath: string, dryRun?: boolean): Promise<void>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.applyOAuth2TokenIntrospectionRecipe = applyOAuth2TokenIntrospectionRecipe;
|
|
37
|
+
const path = __importStar(require("node:path"));
|
|
38
|
+
const static_recipe_utils_1 = require("../../utils/static-recipe.utils");
|
|
39
|
+
const files = [
|
|
40
|
+
[
|
|
41
|
+
'client.ts.hbs',
|
|
42
|
+
'src/shared/auth/oauth2-token-introspection/oauth2-token-introspection.client.ts',
|
|
43
|
+
],
|
|
44
|
+
[
|
|
45
|
+
'client.spec.ts.hbs',
|
|
46
|
+
'src/shared/auth/oauth2-token-introspection/oauth2-token-introspection.client.spec.ts',
|
|
47
|
+
],
|
|
48
|
+
[
|
|
49
|
+
'module.ts.hbs',
|
|
50
|
+
'src/shared/auth/oauth2-token-introspection/oauth2-token-introspection.module.ts',
|
|
51
|
+
],
|
|
52
|
+
['index.ts.hbs', 'src/shared/auth/oauth2-token-introspection/index.ts'],
|
|
53
|
+
['http-client.ts.hbs', 'src/shared/auth/oauth2-token-introspection/bounded-json-http.client.ts'],
|
|
54
|
+
[
|
|
55
|
+
'http-client.spec.ts.hbs',
|
|
56
|
+
'src/shared/auth/oauth2-token-introspection/bounded-json-http.client.spec.ts',
|
|
57
|
+
],
|
|
58
|
+
['README.md.hbs', 'docs/auth/oauth2-token-introspection.md'],
|
|
59
|
+
];
|
|
60
|
+
async function applyOAuth2TokenIntrospectionRecipe(basePath, dryRun = false) {
|
|
61
|
+
const templateRoot = path.join(__dirname, '../../templates/recipes/oauth2-token-introspection');
|
|
62
|
+
await (0, static_recipe_utils_1.applyStaticRecipePlan)(basePath, files.map(([source, destination]) => ({
|
|
63
|
+
template: path.join(templateRoot, source),
|
|
64
|
+
destination,
|
|
65
|
+
})), dryRun);
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=oauth2-token-introspection.recipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth2-token-introspection.recipe.js","sourceRoot":"","sources":["../../../src/commands/recipes/oauth2-token-introspection.recipe.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,kFAaC;AAtCD,gDAAkC;AAClC,yEAAwE;AAExE,MAAM,KAAK,GAAG;IACZ;QACE,eAAe;QACf,iFAAiF;KAClF;IACD;QACE,oBAAoB;QACpB,sFAAsF;KACvF;IACD;QACE,eAAe;QACf,iFAAiF;KAClF;IACD,CAAC,cAAc,EAAE,qDAAqD,CAAC;IACvE,CAAC,oBAAoB,EAAE,wEAAwE,CAAC;IAChG;QACE,yBAAyB;QACzB,6EAA6E;KAC9E;IACD,CAAC,eAAe,EAAE,yCAAyC,CAAC;CACpD,CAAC;AAEJ,KAAK,UAAU,mCAAmC,CACvD,QAAgB,EAChB,MAAM,GAAG,KAAK;IAEd,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oDAAoD,CAAC,CAAC;IAChG,MAAM,IAAA,2CAAqB,EACzB,QAAQ,EACR,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC;QACpC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC;QACzC,WAAW;KACZ,CAAC,CAAC,EACH,MAAM,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function applyOidcBffSessionRecipe(basePath: string, dryRun?: boolean): Promise<void>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.applyOidcBffSessionRecipe = applyOidcBffSessionRecipe;
|
|
37
|
+
const path = __importStar(require("node:path"));
|
|
38
|
+
const static_recipe_utils_1 = require("../../utils/static-recipe.utils");
|
|
39
|
+
const files = [
|
|
40
|
+
['client.ts.hbs', 'src/shared/oidc-bff/oidc-bff.client.ts'],
|
|
41
|
+
['client.test.ts.hbs', 'src/shared/oidc-bff/oidc-bff.client.test.ts'],
|
|
42
|
+
['store.ts.hbs', 'src/shared/oidc-bff/opaque-session-store.ts'],
|
|
43
|
+
['store.test.ts.hbs', 'src/shared/oidc-bff/opaque-session-store.test.ts'],
|
|
44
|
+
['store.integration.test.ts.hbs', 'src/shared/oidc-bff/opaque-session-store.integration.test.ts'],
|
|
45
|
+
['valkey.ts.hbs', 'src/shared/oidc-bff/valkey-session-store.ts'],
|
|
46
|
+
['valkey.test.ts.hbs', 'src/shared/oidc-bff/valkey-session-store.test.ts'],
|
|
47
|
+
['index.ts.hbs', 'src/shared/oidc-bff/index.ts'],
|
|
48
|
+
['README.md.hbs', 'docs/auth/oidc-bff-session.md'],
|
|
49
|
+
];
|
|
50
|
+
async function applyOidcBffSessionRecipe(basePath, dryRun = false) {
|
|
51
|
+
const templateRoot = path.join(__dirname, '../../templates/recipes/oidc-bff-session');
|
|
52
|
+
await (0, static_recipe_utils_1.applyStaticRecipePlan)(basePath, files.map(([source, destination]) => ({
|
|
53
|
+
template: path.join(templateRoot, source),
|
|
54
|
+
destination,
|
|
55
|
+
})), dryRun);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=oidc-bff-session.recipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oidc-bff-session.recipe.js","sourceRoot":"","sources":["../../../src/commands/recipes/oidc-bff-session.recipe.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,8DAUC;AAzBD,gDAAkC;AAClC,yEAAwE;AAExE,MAAM,KAAK,GAAG;IACZ,CAAC,eAAe,EAAE,wCAAwC,CAAC;IAC3D,CAAC,oBAAoB,EAAE,6CAA6C,CAAC;IACrE,CAAC,cAAc,EAAE,6CAA6C,CAAC;IAC/D,CAAC,mBAAmB,EAAE,kDAAkD,CAAC;IACzE,CAAC,+BAA+B,EAAE,8DAA8D,CAAC;IACjG,CAAC,eAAe,EAAE,6CAA6C,CAAC;IAChE,CAAC,oBAAoB,EAAE,kDAAkD,CAAC;IAC1E,CAAC,cAAc,EAAE,8BAA8B,CAAC;IAChD,CAAC,eAAe,EAAE,+BAA+B,CAAC;CAC1C,CAAC;AAEJ,KAAK,UAAU,yBAAyB,CAAC,QAAgB,EAAE,MAAM,GAAG,KAAK;IAC9E,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,0CAA0C,CAAC,CAAC;IACtF,MAAM,IAAA,2CAAqB,EACzB,QAAQ,EACR,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC;QACpC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC;QACzC,WAAW;KACZ,CAAC,CAAC,EACH,MAAM,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function applyOidcDashboardRecipe(basePath: string): Promise<void>;
|