fragment-ts 1.0.2 โ 1.0.4
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 +401 -0
- package/USAGE.md +1439 -0
- package/bin/fragment.js +2 -0
- package/dist/ai/ai.module.d.ts +27 -0
- package/dist/ai/ai.module.d.ts.map +1 -0
- package/dist/ai/ai.module.js +77 -0
- package/dist/ai/ai.module.js.map +1 -0
- package/dist/auth/auth.module.d.ts +18 -0
- package/dist/auth/auth.module.d.ts.map +1 -0
- package/dist/auth/auth.module.js +89 -0
- package/dist/auth/auth.module.js.map +1 -0
- package/dist/cli/commands/build.command.d.ts +6 -1
- package/dist/cli/commands/build.command.d.ts.map +1 -0
- package/dist/cli/commands/build.command.js +130 -10
- package/dist/cli/commands/build.command.js.map +1 -1
- package/dist/cli/commands/diagnostics.command.d.ts +16 -0
- package/dist/cli/commands/diagnostics.command.d.ts.map +1 -0
- package/dist/cli/commands/diagnostics.command.js +419 -0
- package/dist/cli/commands/diagnostics.command.js.map +1 -0
- package/dist/cli/commands/generate.command.d.ts +13 -6
- package/dist/cli/commands/generate.command.d.ts.map +1 -0
- package/dist/cli/commands/generate.command.js +200 -128
- package/dist/cli/commands/generate.command.js.map +1 -1
- package/dist/cli/commands/init.command.d.ts +11 -5
- package/dist/cli/commands/init.command.d.ts.map +1 -0
- package/dist/cli/commands/init.command.js +267 -305
- package/dist/cli/commands/init.command.js.map +1 -1
- package/dist/cli/commands/migrate.command.d.ts +12 -5
- package/dist/cli/commands/migrate.command.d.ts.map +1 -0
- package/dist/cli/commands/migrate.command.js +211 -83
- package/dist/cli/commands/migrate.command.js.map +1 -1
- package/dist/cli/commands/serve.command.d.ts +5 -4
- package/dist/cli/commands/serve.command.d.ts.map +1 -0
- package/dist/cli/commands/serve.command.js +178 -21
- package/dist/cli/commands/serve.command.js.map +1 -1
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +22 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/container/di-container.d.ts +13 -7
- package/dist/core/container/di-container.d.ts.map +1 -0
- package/dist/core/container/di-container.js +75 -25
- package/dist/core/container/di-container.js.map +1 -1
- package/dist/core/decorators/application.decorator.d.ts +8 -0
- package/dist/core/decorators/application.decorator.d.ts.map +1 -0
- package/dist/core/decorators/application.decorator.js +16 -0
- package/dist/core/decorators/application.decorator.js.map +1 -0
- package/dist/core/decorators/auto-configuration.decorator.d.ts +2 -0
- package/dist/core/decorators/auto-configuration.decorator.d.ts.map +1 -0
- package/dist/core/decorators/auto-configuration.decorator.js +19 -0
- package/dist/core/decorators/auto-configuration.decorator.js.map +1 -0
- package/dist/core/decorators/conditional.decorators.d.ts +4 -0
- package/dist/core/decorators/conditional.decorators.d.ts.map +1 -0
- package/dist/core/decorators/conditional.decorators.js +22 -0
- package/dist/core/decorators/conditional.decorators.js.map +1 -0
- package/dist/core/decorators/controller.decorator.d.ts +1 -3
- package/dist/core/decorators/controller.decorator.d.ts.map +1 -0
- package/dist/core/decorators/controller.decorator.js +12 -9
- package/dist/core/decorators/controller.decorator.js.map +1 -1
- package/dist/core/decorators/http.decorators.d.ts +12 -0
- package/dist/core/decorators/http.decorators.d.ts.map +1 -0
- package/dist/core/decorators/http.decorators.js +52 -0
- package/dist/core/decorators/http.decorators.js.map +1 -0
- package/dist/core/decorators/injectable.decorator.d.ts +3 -3
- package/dist/core/decorators/injectable.decorator.d.ts.map +1 -0
- package/dist/core/decorators/injectable.decorator.js +11 -8
- package/dist/core/decorators/injectable.decorator.js.map +1 -1
- package/dist/core/decorators/injection.decorators.d.ts +5 -0
- package/dist/core/decorators/injection.decorators.d.ts.map +1 -0
- package/dist/core/decorators/injection.decorators.js +29 -0
- package/dist/core/decorators/injection.decorators.js.map +1 -0
- package/dist/core/decorators/repository.decorator.d.ts +1 -0
- package/dist/core/decorators/repository.decorator.d.ts.map +1 -0
- package/dist/core/decorators/repository.decorator.js +12 -1
- package/dist/core/decorators/repository.decorator.js.map +1 -1
- package/dist/core/decorators/service.decorator.d.ts +1 -0
- package/dist/core/decorators/service.decorator.d.ts.map +1 -0
- package/dist/core/decorators/service.decorator.js +12 -1
- package/dist/core/decorators/service.decorator.js.map +1 -1
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +29 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/loader/file-loader.d.ts +5 -0
- package/dist/core/loader/file-loader.d.ts.map +1 -0
- package/dist/core/loader/file-loader.js +85 -0
- package/dist/core/loader/file-loader.js.map +1 -0
- package/dist/core/metadata/metadata-keys.d.ts +20 -0
- package/dist/core/metadata/metadata-keys.d.ts.map +1 -0
- package/dist/core/metadata/metadata-keys.js +23 -0
- package/dist/core/metadata/metadata-keys.js.map +1 -0
- package/dist/core/metadata/metadata-storage.d.ts +36 -0
- package/dist/core/metadata/metadata-storage.d.ts.map +1 -0
- package/dist/core/metadata/metadata-storage.js +53 -0
- package/dist/core/metadata/metadata-storage.js.map +1 -0
- package/dist/core/scanner/component-scanner.d.ts +16 -0
- package/dist/core/scanner/component-scanner.d.ts.map +1 -0
- package/dist/core/scanner/component-scanner.js +147 -0
- package/dist/core/scanner/component-scanner.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/plugin-manager.d.ts +14 -0
- package/dist/plugins/plugin-manager.d.ts.map +1 -0
- package/dist/{cli/utils/file-generator.js โ plugins/plugin-manager.js} +32 -24
- package/dist/plugins/plugin-manager.js.map +1 -0
- package/dist/shared/errors.d.ts +18 -0
- package/dist/shared/errors.d.ts.map +1 -0
- package/dist/shared/errors.js +41 -0
- package/dist/shared/errors.js.map +1 -0
- package/dist/testing/runner.d.ts +26 -0
- package/dist/testing/runner.d.ts.map +1 -0
- package/dist/testing/runner.js +143 -0
- package/dist/testing/runner.js.map +1 -0
- package/dist/typeorm/typeorm-module.d.ts +36 -0
- package/dist/typeorm/typeorm-module.d.ts.map +1 -0
- package/dist/typeorm/typeorm-module.js +150 -0
- package/dist/typeorm/typeorm-module.js.map +1 -0
- package/dist/web/application.d.ts +29 -0
- package/dist/web/application.d.ts.map +1 -0
- package/dist/web/application.js +301 -0
- package/dist/web/application.js.map +1 -0
- package/dist/web/interfaces.d.ts +14 -0
- package/dist/web/interfaces.d.ts.map +1 -0
- package/dist/{auth/dto/login.dto.js โ web/interfaces.js} +1 -1
- package/dist/web/interfaces.js.map +1 -0
- package/examples/blog-api/fragment.json +14 -0
- package/examples/blog-api/package-lock.json +3405 -0
- package/examples/blog-api/package.json +19 -0
- package/examples/blog-api/src/controllers/app.controller.ts +9 -0
- package/examples/blog-api/src/controllers/auth.controller.ts +17 -0
- package/examples/blog-api/src/controllers/category.controller.ts +29 -0
- package/examples/blog-api/src/controllers/comment.controller.ts +31 -0
- package/examples/blog-api/src/controllers/post.controller.ts +46 -0
- package/examples/blog-api/src/dto/create-category.dto.ts +6 -0
- package/examples/blog-api/src/dto/create-comment.dto.ts +6 -0
- package/examples/blog-api/src/dto/create-post.dto.ts +6 -0
- package/examples/blog-api/src/entities/category.entity.ts +16 -0
- package/examples/blog-api/src/entities/comment.entity.ts +29 -0
- package/examples/blog-api/src/entities/post.entity.ts +42 -0
- package/examples/blog-api/src/entities/user.entity.ts +25 -0
- package/examples/blog-api/src/main.ts +16 -0
- package/examples/blog-api/src/migrations/1767737463842-InitialSchema.ts +60 -0
- package/examples/blog-api/src/repositories/category.repository.ts +25 -0
- package/examples/blog-api/src/repositories/comment.repository.ts +25 -0
- package/examples/blog-api/src/repositories/post.repository.ts +29 -0
- package/examples/blog-api/src/seeds/SampleData.seed.ts +41 -0
- package/examples/blog-api/src/services/app.service.ts +8 -0
- package/examples/blog-api/src/services/auth.service.ts +15 -0
- package/examples/blog-api/src/services/category.service.ts +27 -0
- package/examples/blog-api/src/services/comment.service.ts +31 -0
- package/examples/blog-api/src/services/post.service.ts +35 -0
- package/examples/blog-api/tsconfig.json +23 -0
- package/package.json +55 -33
- package/src/ai/ai.module.ts +110 -0
- package/src/auth/auth.module.ts +77 -0
- package/src/cli/commands/build.command.ts +123 -13
- package/src/cli/commands/diagnostics.command.ts +438 -0
- package/src/cli/commands/generate.command.ts +206 -137
- package/src/cli/commands/init.command.ts +337 -349
- package/src/cli/commands/migrate.command.ts +203 -88
- package/src/cli/commands/serve.command.ts +176 -24
- package/src/cli/index.ts +23 -0
- package/src/core/container/di-container.ts +83 -26
- package/src/core/decorators/application.decorator.ts +26 -0
- package/src/core/decorators/auto-configuration.decorator.ts +17 -0
- package/src/core/decorators/conditional.decorators.ts +19 -0
- package/src/core/decorators/controller.decorator.ts +14 -11
- package/src/core/decorators/http.decorators.ts +71 -0
- package/src/core/decorators/injectable.decorator.ts +14 -9
- package/src/core/decorators/injection.decorators.ts +26 -0
- package/src/core/decorators/repository.decorator.ts +13 -2
- package/src/core/decorators/service.decorator.ts +13 -2
- package/src/core/index.ts +13 -0
- package/src/core/loader/file-loader.ts +55 -0
- package/src/core/metadata/metadata-keys.ts +19 -0
- package/src/core/metadata/metadata-storage.ts +91 -0
- package/src/core/scanner/component-scanner.ts +129 -0
- package/src/index.ts +45 -0
- package/src/plugins/plugin-manager.ts +52 -0
- package/src/shared/errors.ts +34 -0
- package/src/testing/runner.ts +143 -0
- package/src/typeorm/typeorm-module.ts +216 -0
- package/src/web/application.ts +348 -0
- package/src/web/interfaces.ts +17 -0
- package/tsconfig.json +8 -6
- package/.env.example +0 -0
- package/base.ts +0 -1810
- package/base2.ts +0 -968
- package/bin/frg.ts +0 -5
- package/config/fragment.lock.yaml +0 -0
- package/config/fragment.yaml +0 -0
- package/dist/app.d.ts +0 -15
- package/dist/app.js +0 -91
- package/dist/app.js.map +0 -1
- package/dist/auth/auth.controller.d.ts +0 -10
- package/dist/auth/auth.controller.js +0 -88
- package/dist/auth/auth.controller.js.map +0 -1
- package/dist/auth/auth.middleware.d.ts +0 -2
- package/dist/auth/auth.middleware.js +0 -25
- package/dist/auth/auth.middleware.js.map +0 -1
- package/dist/auth/auth.service.d.ts +0 -20
- package/dist/auth/auth.service.js +0 -144
- package/dist/auth/auth.service.js.map +0 -1
- package/dist/auth/dto/login.dto.d.ts +0 -9
- package/dist/auth/dto/login.dto.js.map +0 -1
- package/dist/cli/cli.d.ts +0 -12
- package/dist/cli/cli.js +0 -187
- package/dist/cli/cli.js.map +0 -1
- package/dist/cli/commands/config.command.d.ts +0 -6
- package/dist/cli/commands/config.command.js +0 -285
- package/dist/cli/commands/config.command.js.map +0 -1
- package/dist/cli/templates/controller.template.d.ts +0 -1
- package/dist/cli/templates/controller.template.js +0 -53
- package/dist/cli/templates/controller.template.js.map +0 -1
- package/dist/cli/templates/entity.template.d.ts +0 -1
- package/dist/cli/templates/entity.template.js +0 -24
- package/dist/cli/templates/entity.template.js.map +0 -1
- package/dist/cli/templates/repository.template.d.ts +0 -1
- package/dist/cli/templates/repository.template.js +0 -44
- package/dist/cli/templates/repository.template.js.map +0 -1
- package/dist/cli/templates/service.template.d.ts +0 -1
- package/dist/cli/templates/service.template.js +0 -44
- package/dist/cli/templates/service.template.js.map +0 -1
- package/dist/cli/utils/file-generator.d.ts +0 -9
- package/dist/cli/utils/file-generator.js.map +0 -1
- package/dist/cli/utils/logger.d.ts +0 -14
- package/dist/cli/utils/logger.js +0 -50
- package/dist/cli/utils/logger.js.map +0 -1
- package/dist/controllers/health.controller.d.ts +0 -13
- package/dist/controllers/health.controller.js +0 -51
- package/dist/controllers/health.controller.js.map +0 -1
- package/dist/core/config/config-loader.d.ts +0 -31
- package/dist/core/config/config-loader.js +0 -99
- package/dist/core/config/config-loader.js.map +0 -1
- package/dist/core/decorators/auth-guard.decorator.d.ts +0 -3
- package/dist/core/decorators/auth-guard.decorator.js +0 -19
- package/dist/core/decorators/auth-guard.decorator.js.map +0 -1
- package/dist/core/decorators/autowire.decorator.d.ts +0 -3
- package/dist/core/decorators/autowire.decorator.js +0 -18
- package/dist/core/decorators/autowire.decorator.js.map +0 -1
- package/dist/core/decorators/middleware.decorator.d.ts +0 -3
- package/dist/core/decorators/middleware.decorator.js +0 -21
- package/dist/core/decorators/middleware.decorator.js.map +0 -1
- package/dist/core/decorators/route.decorator.d.ts +0 -14
- package/dist/core/decorators/route.decorator.js +0 -33
- package/dist/core/decorators/route.decorator.js.map +0 -1
- package/dist/core/openai/openai-client.d.ts +0 -12
- package/dist/core/openai/openai-client.js +0 -94
- package/dist/core/openai/openai-client.js.map +0 -1
- package/dist/database/data-source.d.ts +0 -4
- package/dist/database/data-source.js +0 -27
- package/dist/database/data-source.js.map +0 -1
- package/dist/entities/session.entity.d.ts +0 -9
- package/dist/entities/session.entity.js +0 -46
- package/dist/entities/session.entity.js.map +0 -1
- package/dist/entities/user.entity.d.ts +0 -10
- package/dist/entities/user.entity.js +0 -49
- package/dist/entities/user.entity.js.map +0 -1
- package/dist/middlewares/logging.middleware.d.ts +0 -2
- package/dist/middlewares/logging.middleware.js +0 -29
- package/dist/middlewares/logging.middleware.js.map +0 -1
- package/dist/repositories/session.repository.d.ts +0 -9
- package/dist/repositories/session.repository.js +0 -51
- package/dist/repositories/session.repository.js.map +0 -1
- package/dist/repositories/user.repository.d.ts +0 -10
- package/dist/repositories/user.repository.js +0 -44
- package/dist/repositories/user.repository.js.map +0 -1
- package/dist/server.d.ts +0 -1
- package/dist/server.js +0 -31
- package/dist/server.js.map +0 -1
- package/dist/services/health.service.d.ts +0 -13
- package/dist/services/health.service.js +0 -45
- package/dist/services/health.service.js.map +0 -1
- package/readme.md +0 -120
- package/src/app.ts +0 -121
- package/src/auth/auth.controller.ts +0 -52
- package/src/auth/auth.middleware.ts +0 -27
- package/src/auth/auth.service.ts +0 -110
- package/src/auth/dto/login.dto.ts +0 -11
- package/src/cli/cli.ts +0 -212
- package/src/cli/commands/config.command.ts +0 -280
- package/src/cli/templates/controller.template.ts +0 -51
- package/src/cli/templates/entity.template.ts +0 -22
- package/src/cli/templates/repository.template.ts +0 -42
- package/src/cli/templates/service.template.ts +0 -42
- package/src/cli/utils/file-generator.ts +0 -37
- package/src/cli/utils/logger.ts +0 -52
- package/src/controllers/health.controller.ts +0 -24
- package/src/core/config/config-loader.ts +0 -98
- package/src/core/decorators/auth-guard.decorator.ts +0 -15
- package/src/core/decorators/autowire.decorator.ts +0 -18
- package/src/core/decorators/middleware.decorator.ts +0 -18
- package/src/core/decorators/route.decorator.ts +0 -33
- package/src/core/openai/openai-client.ts +0 -99
- package/src/database/data-source.ts +0 -29
- package/src/entities/session.entity.ts +0 -25
- package/src/entities/user.entity.ts +0 -27
- package/src/middlewares/logging.middleware.ts +0 -28
- package/src/repositories/session.repository.ts +0 -42
- package/src/repositories/user.repository.ts +0 -37
- package/src/server.ts +0 -32
- package/src/services/health.service.ts +0 -29
|
@@ -0,0 +1,147 @@
|
|
|
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.ComponentScanner = void 0;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const glob_1 = require("glob");
|
|
40
|
+
class ComponentScanner {
|
|
41
|
+
/**
|
|
42
|
+
* Scans and imports compiled JS files (production mode)
|
|
43
|
+
* This ensures decorators are executed
|
|
44
|
+
*/
|
|
45
|
+
static async scan(patterns = [
|
|
46
|
+
"dist/**/*.controller.js",
|
|
47
|
+
"dist/**/*.service.js",
|
|
48
|
+
"dist/**/*.repository.js",
|
|
49
|
+
"dist/**/*.entity.js",
|
|
50
|
+
]) {
|
|
51
|
+
const cwd = process.cwd();
|
|
52
|
+
const allFiles = [];
|
|
53
|
+
// Collect all matching files
|
|
54
|
+
for (const pattern of patterns) {
|
|
55
|
+
try {
|
|
56
|
+
const files = await (0, glob_1.glob)(pattern, { cwd, absolute: true });
|
|
57
|
+
allFiles.push(...files);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
console.warn(`Warning: Pattern ${pattern} failed:`, error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Remove duplicates
|
|
64
|
+
const uniqueFiles = [...new Set(allFiles)];
|
|
65
|
+
// Import each file to trigger decorators
|
|
66
|
+
let loaded = 0;
|
|
67
|
+
let failed = 0;
|
|
68
|
+
for (const file of uniqueFiles) {
|
|
69
|
+
try {
|
|
70
|
+
require(file);
|
|
71
|
+
loaded++;
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
failed++;
|
|
75
|
+
console.warn(` โ ๏ธ Failed to load ${path.relative(cwd, file)}`);
|
|
76
|
+
if (process.env.FRAGMENT_DEBUG === "true") {
|
|
77
|
+
console.error(error);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
console.log(` โ Loaded ${loaded} component file(s)${failed > 0 ? `, ${failed} failed` : ""}`);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Scans TypeScript source files (development mode with ts-node/tsx)
|
|
85
|
+
*/
|
|
86
|
+
static async scanSource(patterns = [
|
|
87
|
+
"src/**/*.controller.ts",
|
|
88
|
+
"src/**/*.service.ts",
|
|
89
|
+
"src/**/*.repository.ts",
|
|
90
|
+
"src/**/*.entity.ts",
|
|
91
|
+
]) {
|
|
92
|
+
const cwd = process.cwd();
|
|
93
|
+
const allFiles = [];
|
|
94
|
+
for (const pattern of patterns) {
|
|
95
|
+
try {
|
|
96
|
+
const files = await (0, glob_1.glob)(pattern, { cwd, absolute: true });
|
|
97
|
+
allFiles.push(...files);
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
console.warn(`Warning: Pattern ${pattern} failed:`, error);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const uniqueFiles = [...new Set(allFiles)];
|
|
104
|
+
let loaded = 0;
|
|
105
|
+
let failed = 0;
|
|
106
|
+
for (const file of uniqueFiles) {
|
|
107
|
+
try {
|
|
108
|
+
require(file);
|
|
109
|
+
loaded++;
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
failed++;
|
|
113
|
+
console.warn(` โ ๏ธ Failed to load ${path.relative(cwd, file)}`);
|
|
114
|
+
if (process.env.FRAGMENT_DEBUG === "true") {
|
|
115
|
+
console.error(error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
console.log(` โ Loaded ${loaded} source file(s)${failed > 0 ? `, ${failed} failed` : ""}`);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Recursive directory scan (alternative approach)
|
|
123
|
+
*/
|
|
124
|
+
static scanDirectory(dir, extensions = [".js", ".ts"]) {
|
|
125
|
+
if (!fs.existsSync(dir)) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const files = fs.readdirSync(dir);
|
|
129
|
+
for (const file of files) {
|
|
130
|
+
const fullPath = path.join(dir, file);
|
|
131
|
+
const stat = fs.statSync(fullPath);
|
|
132
|
+
if (stat.isDirectory()) {
|
|
133
|
+
this.scanDirectory(fullPath, extensions);
|
|
134
|
+
}
|
|
135
|
+
else if (extensions.some((ext) => file.endsWith(ext))) {
|
|
136
|
+
try {
|
|
137
|
+
require(fullPath);
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
console.warn(`Warning: Failed to load ${fullPath}:`, error);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.ComponentScanner = ComponentScanner;
|
|
147
|
+
//# sourceMappingURL=component-scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-scanner.js","sourceRoot":"","sources":["../../../src/core/scanner/component-scanner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,uCAAyB;AACzB,+BAA4B;AAE5B,MAAa,gBAAgB;IAC3B;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,IAAI,CACf,WAAqB;QACnB,yBAAyB;QACzB,sBAAsB;QACtB,yBAAyB;QACzB,qBAAqB;KACtB;QAED,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAC1B,MAAM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MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAChF,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,aAAa,CAClB,GAAW,EACX,aAAuB,CAAC,KAAK,EAAE,KAAK,CAAC;QAErC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACxB,OAAO;QACT,CAAC;QAED,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAElC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YACtC,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAEnC,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;gBACvB,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YAC3C,CAAC;iBAAM,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBACxD,IAAI,CAAC;oBACH,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACpB,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,IAAI,CAAC,2BAA2B,QAAQ,GAAG,EAAE,KAAK,CAAC,CAAC;gBAC9D,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF;AA5HD,4CA4HC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
export * from "./core/decorators/application.decorator";
|
|
3
|
+
export * from "./core/decorators/injectable.decorator";
|
|
4
|
+
export * from "./core/decorators/service.decorator";
|
|
5
|
+
export * from "./core/decorators/controller.decorator";
|
|
6
|
+
export * from "./core/decorators/repository.decorator";
|
|
7
|
+
export * from "./core/decorators/auto-configuration.decorator";
|
|
8
|
+
export * from "./core/decorators/conditional.decorators";
|
|
9
|
+
export * from "./core/decorators/injection.decorators";
|
|
10
|
+
export * from "./core/decorators/http.decorators";
|
|
11
|
+
export * from "./core/container/di-container";
|
|
12
|
+
export * from "./core/metadata/metadata-storage";
|
|
13
|
+
export * from "./web/application";
|
|
14
|
+
export * from "./web/interfaces";
|
|
15
|
+
export * from "./typeorm/typeorm-module";
|
|
16
|
+
export * from "./auth/auth.module";
|
|
17
|
+
export * from "./ai/ai.module";
|
|
18
|
+
export * from "./plugins/plugin-manager";
|
|
19
|
+
export * from "./shared/errors";
|
|
20
|
+
export * from './core/scanner/component-scanner';
|
|
21
|
+
export { FragmentApplication, Injectable, Service, Controller, Repository, AutoConfiguration, Get, Post, Put, Delete, Patch, Body, Param, Query, Header, Req, Res, Autowired, Inject, Value, Qualifier, } from "./core";
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,cAAc,yCAAyC,CAAC;AACxD,cAAc,wCAAwC,CAAC;AACvD,cAAc,qCAAqC,CAAC;AACpD,cAAc,wCAAwC,CAAC;AACvD,cAAc,wCAAwC,CAAC;AACvD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,0CAA0C,CAAC;AACzD,cAAc,wCAAwC,CAAC;AACvD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kCAAkC,CAAC;AAEjD,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,OAAO,EACP,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,GAAG,EACH,IAAI,EACJ,GAAG,EACH,MAAM,EACN,KAAK,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,MAAM,EACN,GAAG,EACH,GAAG,EACH,SAAS,EACT,MAAM,EACN,KAAK,EACL,SAAS,GACV,MAAM,QAAQ,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.Qualifier = exports.Value = exports.Inject = exports.Autowired = exports.Res = exports.Req = exports.Header = exports.Query = exports.Param = exports.Body = exports.Patch = exports.Delete = exports.Put = exports.Post = exports.Get = exports.AutoConfiguration = exports.Repository = exports.Controller = exports.Service = exports.Injectable = exports.FragmentApplication = void 0;
|
|
18
|
+
require("reflect-metadata");
|
|
19
|
+
__exportStar(require("./core/decorators/application.decorator"), exports);
|
|
20
|
+
__exportStar(require("./core/decorators/injectable.decorator"), exports);
|
|
21
|
+
__exportStar(require("./core/decorators/service.decorator"), exports);
|
|
22
|
+
__exportStar(require("./core/decorators/controller.decorator"), exports);
|
|
23
|
+
__exportStar(require("./core/decorators/repository.decorator"), exports);
|
|
24
|
+
__exportStar(require("./core/decorators/auto-configuration.decorator"), exports);
|
|
25
|
+
__exportStar(require("./core/decorators/conditional.decorators"), exports);
|
|
26
|
+
__exportStar(require("./core/decorators/injection.decorators"), exports);
|
|
27
|
+
__exportStar(require("./core/decorators/http.decorators"), exports);
|
|
28
|
+
__exportStar(require("./core/container/di-container"), exports);
|
|
29
|
+
__exportStar(require("./core/metadata/metadata-storage"), exports);
|
|
30
|
+
__exportStar(require("./web/application"), exports);
|
|
31
|
+
__exportStar(require("./web/interfaces"), exports);
|
|
32
|
+
__exportStar(require("./typeorm/typeorm-module"), exports);
|
|
33
|
+
__exportStar(require("./auth/auth.module"), exports);
|
|
34
|
+
__exportStar(require("./ai/ai.module"), exports);
|
|
35
|
+
__exportStar(require("./plugins/plugin-manager"), exports);
|
|
36
|
+
__exportStar(require("./shared/errors"), exports);
|
|
37
|
+
__exportStar(require("./core/scanner/component-scanner"), exports);
|
|
38
|
+
var core_1 = require("./core");
|
|
39
|
+
Object.defineProperty(exports, "FragmentApplication", { enumerable: true, get: function () { return core_1.FragmentApplication; } });
|
|
40
|
+
Object.defineProperty(exports, "Injectable", { enumerable: true, get: function () { return core_1.Injectable; } });
|
|
41
|
+
Object.defineProperty(exports, "Service", { enumerable: true, get: function () { return core_1.Service; } });
|
|
42
|
+
Object.defineProperty(exports, "Controller", { enumerable: true, get: function () { return core_1.Controller; } });
|
|
43
|
+
Object.defineProperty(exports, "Repository", { enumerable: true, get: function () { return core_1.Repository; } });
|
|
44
|
+
Object.defineProperty(exports, "AutoConfiguration", { enumerable: true, get: function () { return core_1.AutoConfiguration; } });
|
|
45
|
+
Object.defineProperty(exports, "Get", { enumerable: true, get: function () { return core_1.Get; } });
|
|
46
|
+
Object.defineProperty(exports, "Post", { enumerable: true, get: function () { return core_1.Post; } });
|
|
47
|
+
Object.defineProperty(exports, "Put", { enumerable: true, get: function () { return core_1.Put; } });
|
|
48
|
+
Object.defineProperty(exports, "Delete", { enumerable: true, get: function () { return core_1.Delete; } });
|
|
49
|
+
Object.defineProperty(exports, "Patch", { enumerable: true, get: function () { return core_1.Patch; } });
|
|
50
|
+
Object.defineProperty(exports, "Body", { enumerable: true, get: function () { return core_1.Body; } });
|
|
51
|
+
Object.defineProperty(exports, "Param", { enumerable: true, get: function () { return core_1.Param; } });
|
|
52
|
+
Object.defineProperty(exports, "Query", { enumerable: true, get: function () { return core_1.Query; } });
|
|
53
|
+
Object.defineProperty(exports, "Header", { enumerable: true, get: function () { return core_1.Header; } });
|
|
54
|
+
Object.defineProperty(exports, "Req", { enumerable: true, get: function () { return core_1.Req; } });
|
|
55
|
+
Object.defineProperty(exports, "Res", { enumerable: true, get: function () { return core_1.Res; } });
|
|
56
|
+
Object.defineProperty(exports, "Autowired", { enumerable: true, get: function () { return core_1.Autowired; } });
|
|
57
|
+
Object.defineProperty(exports, "Inject", { enumerable: true, get: function () { return core_1.Inject; } });
|
|
58
|
+
Object.defineProperty(exports, "Value", { enumerable: true, get: function () { return core_1.Value; } });
|
|
59
|
+
Object.defineProperty(exports, "Qualifier", { enumerable: true, get: function () { return core_1.Qualifier; } });
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4BAA0B;AAE1B,0EAAwD;AACxD,yEAAuD;AACvD,sEAAoD;AACpD,yEAAuD;AACvD,yEAAuD;AACvD,iFAA+D;AAC/D,2EAAyD;AACzD,yEAAuD;AACvD,oEAAkD;AAClD,gEAA8C;AAC9C,mEAAiD;AACjD,oDAAkC;AAClC,mDAAiC;AACjC,2DAAyC;AACzC,qDAAmC;AACnC,iDAA+B;AAC/B,2DAAyC;AACzC,kDAAgC;AAChC,mEAAiD;AAEjD,+BAsBgB;AArBd,2GAAA,mBAAmB,OAAA;AACnB,kGAAA,UAAU,OAAA;AACV,+FAAA,OAAO,OAAA;AACP,kGAAA,UAAU,OAAA;AACV,kGAAA,UAAU,OAAA;AACV,yGAAA,iBAAiB,OAAA;AACjB,2FAAA,GAAG,OAAA;AACH,4FAAA,IAAI,OAAA;AACJ,2FAAA,GAAG,OAAA;AACH,8FAAA,MAAM,OAAA;AACN,6FAAA,KAAK,OAAA;AACL,4FAAA,IAAI,OAAA;AACJ,6FAAA,KAAK,OAAA;AACL,6FAAA,KAAK,OAAA;AACL,8FAAA,MAAM,OAAA;AACN,2FAAA,GAAG,OAAA;AACH,2FAAA,GAAG,OAAA;AACH,iGAAA,SAAS,OAAA;AACT,8FAAA,MAAM,OAAA;AACN,6FAAA,KAAK,OAAA;AACL,iGAAA,SAAS,OAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface Plugin {
|
|
2
|
+
name: string;
|
|
3
|
+
version: string;
|
|
4
|
+
initialize(app: any): void | Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export declare class PluginManager {
|
|
7
|
+
private plugins;
|
|
8
|
+
loadPlugin(pluginPath: string): Promise<void>;
|
|
9
|
+
loadPluginsFromDirectory(directory: string): Promise<void>;
|
|
10
|
+
initializeAll(app: any): Promise<void>;
|
|
11
|
+
getPlugin(name: string): Plugin | undefined;
|
|
12
|
+
getAllPlugins(): Plugin[];
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=plugin-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-manager.d.ts","sourceRoot":"","sources":["../../src/plugins/plugin-manager.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAkC;IAE3C,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU7C,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAe1D,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAO5C,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI3C,aAAa,IAAI,MAAM,EAAE;CAG1B"}
|
|
@@ -33,36 +33,44 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
36
|
+
exports.PluginManager = void 0;
|
|
37
37
|
const fs = __importStar(require("fs"));
|
|
38
38
|
const path = __importStar(require("path"));
|
|
39
|
-
class
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
fs.mkdirSync(dirPath, { recursive: true });
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
static writeFile(filePath, content) {
|
|
46
|
-
const dir = path.dirname(filePath);
|
|
47
|
-
this.createDirectory(dir);
|
|
48
|
-
fs.writeFileSync(filePath, content, 'utf-8');
|
|
39
|
+
class PluginManager {
|
|
40
|
+
constructor() {
|
|
41
|
+
this.plugins = new Map();
|
|
49
42
|
}
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
async loadPlugin(pluginPath) {
|
|
44
|
+
const plugin = require(pluginPath);
|
|
45
|
+
if (!plugin.name || !plugin.initialize) {
|
|
46
|
+
throw new Error(`Invalid plugin at ${pluginPath}`);
|
|
47
|
+
}
|
|
48
|
+
this.plugins.set(plugin.name, plugin);
|
|
52
49
|
}
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
async loadPluginsFromDirectory(directory) {
|
|
51
|
+
if (!fs.existsSync(directory)) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const files = fs.readdirSync(directory);
|
|
55
|
+
for (const file of files) {
|
|
56
|
+
if (file.endsWith('.js') || file.endsWith('.ts')) {
|
|
57
|
+
const pluginPath = path.join(directory, file);
|
|
58
|
+
await this.loadPlugin(pluginPath);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
55
61
|
}
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
async initializeAll(app) {
|
|
63
|
+
for (const plugin of this.plugins.values()) {
|
|
64
|
+
await plugin.initialize(app);
|
|
65
|
+
console.log(`Plugin initialized: ${plugin.name} v${plugin.version}`);
|
|
66
|
+
}
|
|
58
67
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return camel.charAt(0).toUpperCase() + camel.slice(1);
|
|
68
|
+
getPlugin(name) {
|
|
69
|
+
return this.plugins.get(name);
|
|
62
70
|
}
|
|
63
|
-
|
|
64
|
-
return
|
|
71
|
+
getAllPlugins() {
|
|
72
|
+
return Array.from(this.plugins.values());
|
|
65
73
|
}
|
|
66
74
|
}
|
|
67
|
-
exports.
|
|
68
|
-
//# sourceMappingURL=
|
|
75
|
+
exports.PluginManager = PluginManager;
|
|
76
|
+
//# sourceMappingURL=plugin-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-manager.js","sourceRoot":"","sources":["../../src/plugins/plugin-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAQ7B,MAAa,aAAa;IAA1B;QACU,YAAO,GAAwB,IAAI,GAAG,EAAE,CAAC;IAyCnD,CAAC;IAvCC,KAAK,CAAC,UAAU,CAAC,UAAkB;QACjC,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAW,CAAC;QAE7C,IAAI,CA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,CAAC;IAC3C,CAAC;CACF;AA1CD,sCA0CC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare class FragmentError extends Error {
|
|
2
|
+
code?: string | undefined;
|
|
3
|
+
constructor(message: string, code?: string | undefined);
|
|
4
|
+
}
|
|
5
|
+
export declare class ValidationError extends FragmentError {
|
|
6
|
+
errors?: any[] | undefined;
|
|
7
|
+
constructor(message: string, errors?: any[] | undefined);
|
|
8
|
+
}
|
|
9
|
+
export declare class NotFoundError extends FragmentError {
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
12
|
+
export declare class UnauthorizedError extends FragmentError {
|
|
13
|
+
constructor(message?: string);
|
|
14
|
+
}
|
|
15
|
+
export declare class ForbiddenError extends FragmentError {
|
|
16
|
+
constructor(message?: string);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/shared/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAc,SAAQ,KAAK;IACF,IAAI,CAAC,EAAE,MAAM;gBAArC,OAAO,EAAE,MAAM,EAAS,IAAI,CAAC,EAAE,MAAM,YAAA;CAIlD;AAED,qBAAa,eAAgB,SAAQ,aAAa;IACZ,MAAM,CAAC,EAAE,GAAG,EAAE;gBAAtC,OAAO,EAAE,MAAM,EAAS,MAAM,CAAC,EAAE,GAAG,EAAE,YAAA;CAInD;AAED,qBAAa,aAAc,SAAQ,aAAa;gBAClC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,iBAAkB,SAAQ,aAAa;gBACtC,OAAO,GAAE,MAAuB;CAI7C;AAED,qBAAa,cAAe,SAAQ,aAAa;gBACnC,OAAO,GAAE,MAAoB;CAI1C"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ForbiddenError = exports.UnauthorizedError = exports.NotFoundError = exports.ValidationError = exports.FragmentError = void 0;
|
|
4
|
+
class FragmentError extends Error {
|
|
5
|
+
constructor(message, code) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.code = code;
|
|
8
|
+
this.name = 'FragmentError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.FragmentError = FragmentError;
|
|
12
|
+
class ValidationError extends FragmentError {
|
|
13
|
+
constructor(message, errors) {
|
|
14
|
+
super(message, 'VALIDATION_ERROR');
|
|
15
|
+
this.errors = errors;
|
|
16
|
+
this.name = 'ValidationError';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ValidationError = ValidationError;
|
|
20
|
+
class NotFoundError extends FragmentError {
|
|
21
|
+
constructor(message) {
|
|
22
|
+
super(message, 'NOT_FOUND');
|
|
23
|
+
this.name = 'NotFoundError';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.NotFoundError = NotFoundError;
|
|
27
|
+
class UnauthorizedError extends FragmentError {
|
|
28
|
+
constructor(message = 'Unauthorized') {
|
|
29
|
+
super(message, 'UNAUTHORIZED');
|
|
30
|
+
this.name = 'UnauthorizedError';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.UnauthorizedError = UnauthorizedError;
|
|
34
|
+
class ForbiddenError extends FragmentError {
|
|
35
|
+
constructor(message = 'Forbidden') {
|
|
36
|
+
super(message, 'FORBIDDEN');
|
|
37
|
+
this.name = 'ForbiddenError';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.ForbiddenError = ForbiddenError;
|
|
41
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/shared/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe,EAAS,IAAa;QAC/C,KAAK,CAAC,OAAO,CAAC,CAAC;QADmB,SAAI,GAAJ,IAAI,CAAS;QAE/C,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AALD,sCAKC;AAED,MAAa,eAAgB,SAAQ,aAAa;IAChD,YAAY,OAAe,EAAS,MAAc;QAChD,KAAK,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;QADD,WAAM,GAAN,MAAM,CAAQ;QAEhD,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AALD,0CAKC;AAED,MAAa,aAAc,SAAQ,aAAa;IAC9C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AALD,sCAKC;AAED,MAAa,iBAAkB,SAAQ,aAAa;IAClD,YAAY,UAAkB,cAAc;QAC1C,KAAK,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AALD,8CAKC;AAED,MAAa,cAAe,SAAQ,aAAa;IAC/C,YAAY,UAAkB,WAAW;QACvC,KAAK,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AALD,wCAKC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface TestSuite {
|
|
2
|
+
name: string;
|
|
3
|
+
tests: Test[];
|
|
4
|
+
}
|
|
5
|
+
export interface Test {
|
|
6
|
+
name: string;
|
|
7
|
+
fn: () => void | Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare class TestRunner {
|
|
10
|
+
private suites;
|
|
11
|
+
private passed;
|
|
12
|
+
private failed;
|
|
13
|
+
describe(name: string, fn: () => void): void;
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
loadTestFiles(pattern: string): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export declare function describe(name: string, fn: () => void): void;
|
|
18
|
+
export declare function it(name: string, fn: () => void | Promise<void>): void;
|
|
19
|
+
export declare function expect(actual: any): {
|
|
20
|
+
toBe(expected: any): void;
|
|
21
|
+
toEqual(expected: any): void;
|
|
22
|
+
toBeTruthy(): void;
|
|
23
|
+
toBeFalsy(): void;
|
|
24
|
+
toThrow(): void;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/testing/runner.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAED,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAKD,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,MAAM,CAAK;IAEnB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI;IAgBtC,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IA4BpB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAOpD;AAKD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI,CAE3D;AAED,wBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAErE;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,GAAG;mBAEf,GAAG;sBAKA,GAAG;;;;EA0BxB"}
|
|
@@ -0,0 +1,143 @@
|
|
|
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.TestRunner = void 0;
|
|
37
|
+
exports.describe = describe;
|
|
38
|
+
exports.it = it;
|
|
39
|
+
exports.expect = expect;
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
const glob_1 = require("glob");
|
|
42
|
+
const G = global;
|
|
43
|
+
/* ======================================================
|
|
44
|
+
* Test Runner
|
|
45
|
+
* ====================================================== */
|
|
46
|
+
class TestRunner {
|
|
47
|
+
constructor() {
|
|
48
|
+
this.suites = [];
|
|
49
|
+
this.passed = 0;
|
|
50
|
+
this.failed = 0;
|
|
51
|
+
}
|
|
52
|
+
describe(name, fn) {
|
|
53
|
+
const suite = { name, tests: [] };
|
|
54
|
+
this.suites.push(suite);
|
|
55
|
+
const currentSuite = suite;
|
|
56
|
+
const originalIt = G.it;
|
|
57
|
+
G.it = (testName, testFn) => {
|
|
58
|
+
currentSuite.tests.push({ name: testName, fn: testFn });
|
|
59
|
+
};
|
|
60
|
+
fn();
|
|
61
|
+
G.it = originalIt;
|
|
62
|
+
}
|
|
63
|
+
async run() {
|
|
64
|
+
console.log('\n๐งช Running Fragment Tests\n');
|
|
65
|
+
for (const suite of this.suites) {
|
|
66
|
+
console.log(`\n๐ฆ ${suite.name}`);
|
|
67
|
+
for (const test of suite.tests) {
|
|
68
|
+
try {
|
|
69
|
+
await test.fn();
|
|
70
|
+
console.log(` โ ${test.name}`);
|
|
71
|
+
this.passed++;
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
console.log(` โ ${test.name}`);
|
|
75
|
+
console.error(` ${error}`);
|
|
76
|
+
this.failed++;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
console.log(`\n\n๐ Results: ${this.passed} passed, ${this.failed} failed\n`);
|
|
81
|
+
if (this.failed > 0) {
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async loadTestFiles(pattern) {
|
|
86
|
+
const files = await (0, glob_1.glob)(pattern);
|
|
87
|
+
for (const file of files) {
|
|
88
|
+
require(path.resolve(file));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.TestRunner = TestRunner;
|
|
93
|
+
/* ======================================================
|
|
94
|
+
* Global test helpers
|
|
95
|
+
* ====================================================== */
|
|
96
|
+
function describe(name, fn) {
|
|
97
|
+
G.__testRunner?.describe(name, fn);
|
|
98
|
+
}
|
|
99
|
+
function it(name, fn) {
|
|
100
|
+
// Implemented dynamically by TestRunner.describe
|
|
101
|
+
}
|
|
102
|
+
function expect(actual) {
|
|
103
|
+
return {
|
|
104
|
+
toBe(expected) {
|
|
105
|
+
if (actual !== expected) {
|
|
106
|
+
throw new Error(`Expected ${actual} to be ${expected}`);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
toEqual(expected) {
|
|
110
|
+
if (JSON.stringify(actual) !== JSON.stringify(expected)) {
|
|
111
|
+
throw new Error(`Expected ${JSON.stringify(actual)} to equal ${JSON.stringify(expected)}`);
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
toBeTruthy() {
|
|
115
|
+
if (!actual) {
|
|
116
|
+
throw new Error(`Expected ${actual} to be truthy`);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
toBeFalsy() {
|
|
120
|
+
if (actual) {
|
|
121
|
+
throw new Error(`Expected ${actual} to be falsy`);
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
toThrow() {
|
|
125
|
+
try {
|
|
126
|
+
actual();
|
|
127
|
+
throw new Error('Expected function to throw');
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
/* expected */
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/* ======================================================
|
|
136
|
+
* CLI entry
|
|
137
|
+
* ====================================================== */
|
|
138
|
+
if (require.main === module) {
|
|
139
|
+
const runner = new TestRunner();
|
|
140
|
+
G.__testRunner = runner;
|
|
141
|
+
runner.loadTestFiles('dist/**/*.spec.js').then(() => runner.run());
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=runner.js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AAY,MAAM,UAAU,QAAQ,EAAE,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;QACD,OAAO,CAAC,QAAa;YACnB,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACxD,MAAM,IAAI,KAAK,CACb,YAAY,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAC1E,CAAC;YACJ,CAAC;QACH,CAAC;QACD,UAAU;YACR,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,YAAY,MAAM,eAAe,CAAC,CAAC;YACrD,CAAC;QACH,CAAC;QACD,SAAS;YACP,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,IAAI,KAAK,CAAC,YAAY,MAAM,cAAc,CAAC,CAAC;YACpD,CAAC;QACH,CAAC;QACD,OAAO;YACL,IAAI,CAAC;gBACH,MAAM,EAAE,CAAC;gBACT,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;YAChD,CAAC;YAAC,MAAM,CAAC;gBACP,cAAc;YAChB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;4DAE4D;AAC5D,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAChC,CAAC,CAAC,YAAY,GAAG,MAAM,CAAC;IAExB,MAAM,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { DataSource } from "typeorm";
|
|
2
|
+
import { SqliteConnectionOptions } from "typeorm/driver/sqlite/SqliteConnectionOptions";
|
|
3
|
+
import { MysqlConnectionOptions } from "typeorm/driver/mysql/MysqlConnectionOptions";
|
|
4
|
+
import { PostgresConnectionOptions } from "typeorm/driver/postgres/PostgresConnectionOptions";
|
|
5
|
+
import { CockroachConnectionOptions } from "typeorm/driver/cockroachdb/CockroachConnectionOptions";
|
|
6
|
+
import { SqlServerConnectionOptions } from "typeorm/driver/sqlserver/SqlServerConnectionOptions";
|
|
7
|
+
import { SapConnectionOptions } from "typeorm/driver/sap/SapConnectionOptions";
|
|
8
|
+
import { OracleConnectionOptions } from "typeorm/driver/oracle/OracleConnectionOptions";
|
|
9
|
+
import { CordovaConnectionOptions } from "typeorm/driver/cordova/CordovaConnectionOptions";
|
|
10
|
+
import { NativescriptConnectionOptions } from "typeorm/driver/nativescript/NativescriptConnectionOptions";
|
|
11
|
+
import { ReactNativeConnectionOptions } from "typeorm/driver/react-native/ReactNativeConnectionOptions";
|
|
12
|
+
import { SqljsConnectionOptions } from "typeorm/driver/sqljs/SqljsConnectionOptions";
|
|
13
|
+
import { MongoConnectionOptions } from "typeorm/driver/mongodb/MongoConnectionOptions";
|
|
14
|
+
import { AuroraMysqlConnectionOptions } from "typeorm/driver/aurora-mysql/AuroraMysqlConnectionOptions";
|
|
15
|
+
import { AuroraPostgresConnectionOptions } from "typeorm/driver/aurora-postgres/AuroraPostgresConnectionOptions";
|
|
16
|
+
import { ExpoConnectionOptions } from "typeorm/driver/expo/ExpoConnectionOptions";
|
|
17
|
+
import { BetterSqlite3ConnectionOptions } from "typeorm/driver/better-sqlite3/BetterSqlite3ConnectionOptions";
|
|
18
|
+
import { CapacitorConnectionOptions } from "typeorm/driver/capacitor/CapacitorConnectionOptions";
|
|
19
|
+
import { SpannerConnectionOptions } from "typeorm/driver/spanner/SpannerConnectionOptions";
|
|
20
|
+
type SupportedDatabaseConfig = Partial<MysqlConnectionOptions> | Partial<PostgresConnectionOptions> | Partial<CockroachConnectionOptions> | Partial<SqliteConnectionOptions> | Partial<SqlServerConnectionOptions> | Partial<SapConnectionOptions> | Partial<OracleConnectionOptions> | Partial<CordovaConnectionOptions> | Partial<NativescriptConnectionOptions> | Partial<ReactNativeConnectionOptions> | Partial<SqljsConnectionOptions> | Partial<MongoConnectionOptions> | Partial<AuroraMysqlConnectionOptions> | Partial<AuroraPostgresConnectionOptions> | Partial<ExpoConnectionOptions> | Partial<BetterSqlite3ConnectionOptions> | Partial<CapacitorConnectionOptions> | Partial<SpannerConnectionOptions>;
|
|
21
|
+
export declare class TypeORMModule {
|
|
22
|
+
private static dataSource;
|
|
23
|
+
static initialize(options?: SupportedDatabaseConfig): Promise<DataSource>;
|
|
24
|
+
private static loadConfig;
|
|
25
|
+
private static buildSqliteConfig;
|
|
26
|
+
private static buildMysqlConfig;
|
|
27
|
+
private static buildPostgresConfig;
|
|
28
|
+
private static loadFileConfig;
|
|
29
|
+
static getDataSource(): DataSource;
|
|
30
|
+
static runMigrations(): Promise<void>;
|
|
31
|
+
static revertMigration(): Promise<void>;
|
|
32
|
+
static syncSchema(): Promise<void>;
|
|
33
|
+
static dropSchema(): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=typeorm-module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeorm-module.d.ts","sourceRoot":"","sources":["../../src/typeorm/typeorm-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAIrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mDAAmD,CAAC;AAC9F,OAAO,EAAE,0BAA0B,EAAE,MAAM,uDAAuD,CAAC;AACnG,OAAO,EAAE,0BAA0B,EAAE,MAAM,qDAAqD,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,M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