@typetron/framework 0.5.20 → 0.5.22
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/.automaker/app_spec.txt +440 -0
- package/.automaker/categories.json +1 -0
- package/.automaker/features/a-b-testing-framework/feature.json +14 -0
- package/.automaker/features/account-lockout-protection/feature.json +14 -0
- package/.automaker/features/api-versioning/feature.json +14 -0
- package/.automaker/features/background-job-processing/feature.json +12 -0
- package/.automaker/features/cloud-storage-integration/feature.json +14 -0
- package/.automaker/features/compression-middleware/feature.json +14 -0
- package/.automaker/features/cors-and-security-headers/feature.json +14 -0
- package/.automaker/features/currency-and-timezone/feature.json +14 -0
- package/.automaker/features/database-backup-restore/feature.json +14 -0
- package/.automaker/features/database-query-logging/feature.json +15 -0
- package/.automaker/features/database-transaction-support/feature.json +14 -0
- package/.automaker/features/discord-notifications-channel/feature.json +14 -0
- package/.automaker/features/eager-loading-optimization/feature.json +14 -0
- package/.automaker/features/email-notifications-channel/feature.json +14 -0
- package/.automaker/features/error-tracking-integration/feature.json +14 -0
- package/.automaker/features/feature-flags/feature.json +12 -0
- package/.automaker/features/file-upload-handling/feature.json +14 -0
- package/.automaker/features/form-builder/feature.json +14 -0
- package/.automaker/features/full-text-search/feature.json +14 -0
- package/.automaker/features/graphql-api-support/feature.json +14 -0
- package/.automaker/features/graphql-documentation/feature.json +14 -0
- package/.automaker/features/graphql-subscriptions/feature.json +15 -0
- package/.automaker/features/html-view-rendering/feature.json +14 -0
- package/.automaker/features/http2-support/feature.json +14 -0
- package/.automaker/features/http3-quic-support/feature.json +14 -0
- package/.automaker/features/image-processing/feature.json +14 -0
- package/.automaker/features/internationalization-i18n/feature.json +12 -0
- package/.automaker/features/job-retries-and-failures/feature.json +14 -0
- package/.automaker/features/job-scheduling/feature.json +14 -0
- package/.automaker/features/locale-detection/feature.json +14 -0
- package/.automaker/features/log-rotation/feature.json +14 -0
- package/.automaker/features/logging-system/feature.json +12 -0
- package/.automaker/features/oauth-authentication/feature.json +14 -0
- package/.automaker/features/pagination-component/feature.json +14 -0
- package/.automaker/features/password-reset-flow/feature.json +14 -0
- package/.automaker/features/performance-monitoring/feature.json +14 -0
- package/.automaker/features/permission-management/feature.json +14 -0
- package/.automaker/features/policy-based-authorization/feature.json +14 -0
- package/.automaker/features/polymorphic-relationships/feature.json +14 -0
- package/.automaker/features/query-scopes/feature.json +14 -0
- package/.automaker/features/rate-limiting/feature.json +14 -0
- package/.automaker/features/request-validation-middleware/feature.json +14 -0
- package/.automaker/features/response-caching-headers/feature.json +14 -0
- package/.automaker/features/rest-api-documentation/feature.json +14 -0
- package/.automaker/features/role-based-access-control/feature.json +14 -0
- package/.automaker/features/session-management/feature.json +14 -0
- package/.automaker/features/session-middleware/feature.json +14 -0
- package/.automaker/features/slack-notifications-channel/feature.json +14 -0
- package/.automaker/features/sms-notifications-channel/feature.json +14 -0
- package/.automaker/features/soft-deletes/feature.json +14 -0
- package/.automaker/features/structured-logging/feature.json +14 -0
- package/.automaker/features/timestamps-and-auditing/feature.json +14 -0
- package/.automaker/features/two-factor-authentication/feature.json +14 -0
- package/.automaker/features/view-helpers-utilities/feature.json +14 -0
- package/.automaker/features/webhook-notifications/feature.json +14 -0
- package/.claude/settings.local.json +10 -0
- package/.editorconfig +11 -0
- package/.mocharc.json +13 -0
- package/CONTRIBUTING.md +9 -0
- package/Cache/Cache.ts +13 -0
- package/Cache/Stores/DatabaseStore.ts +120 -0
- package/Cache/Stores/FileStore.ts +69 -0
- package/Cache/Stores/MemoryStore.ts +71 -0
- package/Cache/index.ts +5 -0
- package/Cache/types.ts +4 -0
- package/Container/ClassResolver.ts +106 -0
- package/Container/Container.ts +144 -0
- package/Container/Contracts.ts +3 -0
- package/Container/Decorators.ts +20 -0
- package/Container/Metadata.ts +16 -0
- package/Container/Resolver.ts +27 -0
- package/Container/index.ts +5 -0
- package/Database/Clauses/Where.ts +0 -0
- package/Database/Connection.ts +52 -0
- package/Database/Decorators.ts +142 -0
- package/Database/Drivers/DatabaseDriver.ts +37 -0
- package/Database/Drivers/MySQL/Alter/index.ts +55 -0
- package/Database/Drivers/MySQL/ColumnDefinition.ts +16 -0
- package/Database/Drivers/MySQL/Create.ts +47 -0
- package/Database/Drivers/MySQL/MysqlDriver.ts +123 -0
- package/Database/Drivers/MySQL/Schema.ts +82 -0
- package/Database/Drivers/MySQL/index.ts +13 -0
- package/Database/Drivers/SQL/Schema.ts +73 -0
- package/Database/Drivers/SQL/Statements/Alter.ts +22 -0
- package/Database/Drivers/SQL/Statements/BaseStatement.ts +55 -0
- package/Database/Drivers/SQL/Statements/Delete.ts +20 -0
- package/Database/Drivers/SQL/Statements/Insert.ts +24 -0
- package/Database/Drivers/SQL/Statements/Select.ts +55 -0
- package/Database/Drivers/SQL/Statements/Update.ts +33 -0
- package/Database/Drivers/SQL/index.ts +8 -0
- package/Database/Drivers/SQLite/Create.ts +45 -0
- package/Database/Drivers/SQLite/Schema.ts +54 -0
- package/Database/Drivers/SQLite/SqliteDriver.ts +144 -0
- package/Database/Drivers/SQLite/index.ts +15 -0
- package/Database/Drivers/SchemaContract.ts +11 -0
- package/Database/Drivers/Statement.ts +16 -0
- package/Database/Drivers/index.ts +4 -0
- package/Database/Entity.ts +377 -0
- package/Database/EntityNotFoundError.ts +5 -0
- package/Database/EntityProxyHandler.ts +43 -0
- package/Database/EntityQuery.ts +197 -0
- package/Database/Expression.ts +3 -0
- package/Database/Fields.ts +816 -0
- package/Database/Helpers.ts +12 -0
- package/Database/List.ts +71 -0
- package/Database/Migrations/Migration.ts +10 -0
- package/Database/Migrations/MigrationHistory.ts +20 -0
- package/Database/Migrations/Migrator.ts +122 -0
- package/Database/Migrations/index.ts +3 -0
- package/Database/ORM/BaseRelationship.ts +10 -0
- package/Database/Query.ts +374 -0
- package/Database/Seeders/Seeder.ts +3 -0
- package/Database/Seeders/SeederManager.ts +27 -0
- package/Database/Seeders/index.ts +2 -0
- package/Database/StringExpression.ts +9 -0
- package/Database/Types.ts +165 -0
- package/Database/index.ts +23 -0
- package/Encryption/index.ts +51 -0
- package/Forms/Decorators.ts +29 -0
- package/Forms/Form.ts +70 -0
- package/Forms/FormFields.ts +36 -0
- package/Forms/index.ts +3 -0
- package/Framework/App.ts +10 -0
- package/Framework/Application.ts +118 -0
- package/Framework/Auth/Auth.ts +122 -0
- package/Framework/Auth/Authenticatable.ts +9 -0
- package/Framework/Auth/User.ts +27 -0
- package/Framework/Auth/index.ts +29 -0
- package/Framework/Config/AppConfig.ts +25 -0
- package/Framework/Config/AuthConfig.ts +11 -0
- package/Framework/Config/BaseConfig.ts +9 -0
- package/Framework/Config/CacheConfig.ts +38 -0
- package/Framework/Config/DatabaseConfig.ts +21 -0
- package/Framework/Config/MailConfig.ts +30 -0
- package/Framework/Config/index.ts +6 -0
- package/Framework/Middleware/AuthMiddleware.ts +31 -0
- package/Framework/Middleware/CorsMiddleware.ts +32 -0
- package/Framework/Middleware/StaticAssetsMiddleware.ts +76 -0
- package/Framework/Middleware/index.ts +2 -0
- package/Framework/Provider.ts +9 -0
- package/Framework/Providers/CacheProvider.ts +28 -0
- package/Framework/Providers/DatabaseProvider.ts +36 -0
- package/Framework/Providers/MailProvider.ts +31 -0
- package/Framework/Providers/WebsocketsProvider.ts +141 -0
- package/Framework/Resolvers/AuthResolver.ts +23 -0
- package/Framework/Resolvers/EntityResolver.ts +41 -0
- package/Framework/Resolvers/FormResolver.ts +37 -0
- package/Framework/RootDir.ts +1 -0
- package/Framework/index.ts +8 -0
- package/Frontend/Angular/Readme.md +7 -0
- package/Frontend/Angular/index.ts +24 -0
- package/Frontend/Angular/package-lock.json +2767 -0
- package/Frontend/Angular/package.json +38 -0
- package/Frontend/Angular/tsconfig.json +20 -0
- package/Frontend/Websockets/Readme.md +86 -0
- package/Frontend/Websockets/index.ts +99 -0
- package/Frontend/Websockets/package-lock.json +4371 -0
- package/Frontend/Websockets/package.json +45 -0
- package/Frontend/Websockets/tsc-alias.config.json +7 -0
- package/Frontend/Websockets/tsconfig.json +20 -0
- package/Mail/MailAddress.ts +4 -0
- package/Mail/MailTransport.ts +6 -0
- package/Mail/Mailable.ts +16 -0
- package/Mail/Mailer.ts +27 -0
- package/Mail/PendingMail.ts +68 -0
- package/Mail/SentMessage.ts +20 -0
- package/Mail/Transports/MemoryTransport.ts +13 -0
- package/Mail/Transports/SendGridTransport.ts +95 -0
- package/Mail/index.ts +3 -0
- package/Models/Model.ts +41 -0
- package/Models/index.ts +54 -0
- package/Router/BaseController.ts +7 -0
- package/Router/Decorators.ts +224 -0
- package/Router/Guard.ts +10 -0
- package/Router/Http/Contracts.ts +4 -0
- package/Router/Http/ErrorHandler.ts +45 -0
- package/Router/Http/ErrorHandlerInterface.ts +6 -0
- package/Router/Http/Errors/HttpError.ts +15 -0
- package/Router/Http/Handler.ts +183 -0
- package/Router/Http/HttpRoute.ts +110 -0
- package/Router/Http/Middleware.ts +7 -0
- package/Router/Http/Request.ts +225 -0
- package/Router/Http/Response.ts +35 -0
- package/Router/Http/index.ts +85 -0
- package/Router/Metadata.ts +34 -0
- package/Router/Middleware.ts +16 -0
- package/Router/Request.ts +65 -0
- package/Router/Route.ts +16 -0
- package/Router/RouteNotFoundError.ts +5 -0
- package/Router/Router.ts +35 -0
- package/Router/Servers/index.ts +6 -0
- package/Router/Servers/node.ts +49 -0
- package/Router/Servers/uNetworking.ts +151 -0
- package/Router/Websockets/Handler.ts +82 -0
- package/Router/Websockets/Middleware.ts +7 -0
- package/Router/Websockets/Request.ts +3 -0
- package/Router/Websockets/WebsocketRoute.ts +61 -0
- package/Router/Websockets/index.ts +59 -0
- package/Router/Websockets/types.ts +24 -0
- package/Router/index.ts +6 -0
- package/Storage/File.ts +30 -0
- package/Storage/Image.ts +19 -0
- package/Storage/InvalidImage.ts +3 -0
- package/Storage/Storage.ts +98 -0
- package/Storage/index.ts +4 -0
- package/Storage/utils.ts +18 -0
- package/Support/Array.ts +184 -0
- package/Support/Math.ts +12 -0
- package/Support/Metadata.ts +31 -0
- package/Support/String.ts +38 -0
- package/Support/index.ts +19 -0
- package/Support/utils.ts +7 -0
- package/Testing/TestCase.ts +193 -0
- package/Validation/Rule.ts +9 -0
- package/Validation/RuleInterface.ts +10 -0
- package/Validation/Rules/Email.ts +20 -0
- package/Validation/Rules/FileExtension.ts +21 -0
- package/Validation/Rules/MaxLength.ts +17 -0
- package/Validation/Rules/MinLength.ts +18 -0
- package/Validation/Rules/Optional.ts +18 -0
- package/Validation/Rules/Required.ts +29 -0
- package/Validation/Validator.ts +7 -0
- package/Validation/index.ts +12 -0
- package/benchmark.ts +47 -0
- package/eslint.config.mjs +78 -0
- package/package.json +10 -10
- package/tests/.nycrc.json +19 -0
- package/tests/Cache/DatabaseStoreTest.ts +110 -0
- package/tests/Cache/FileStoreTest.ts +93 -0
- package/tests/Cache/MemoryStoreTest.ts +92 -0
- package/tests/Container/ContainerTest.ts +336 -0
- package/tests/Database/Drivers/MySQL/AlterTest.ts +100 -0
- package/tests/Database/Drivers/MySQL/CreateTest.ts +39 -0
- package/tests/Database/Drivers/MysqlDriverTest.ts +140 -0
- package/tests/Database/Drivers/SqliteDriverTest.ts +126 -0
- package/tests/Database/Entities/Article.ts +21 -0
- package/tests/Database/Entities/Profile.ts +21 -0
- package/tests/Database/Entities/Role.ts +15 -0
- package/tests/Database/Entities/User.ts +35 -0
- package/tests/Database/EntityRelationshipsTest.ts +475 -0
- package/tests/Database/EntityTest.ts +202 -0
- package/tests/Database/Migrations/RunnerTest.ts +96 -0
- package/tests/Database/Migrations/migrations/1.createUserTable.ts +12 -0
- package/tests/Database/Migrations/migrations/2.createArticlesTable.ts +12 -0
- package/tests/Database/QueryTest.ts +573 -0
- package/tests/Database/SchemaTest.ts +32 -0
- package/tests/Database/Seeders/RunnerTest.ts +30 -0
- package/tests/Database/Seeders/seeders/RandomSeeder.ts +10 -0
- package/tests/Database/utils.ts +16 -0
- package/tests/Forms/FormsTest.ts +59 -0
- package/tests/Framework/Middleware/StaticAssetsMiddlewareTest.ts +129 -0
- package/tests/Framework/Middleware/articles/my-article.html +1 -0
- package/tests/Framework/Middleware/articles/some-directory/index.html +1 -0
- package/tests/Framework/Middleware/assets/styles.css +3 -0
- package/tests/Framework/Resolvers/EntityResolverTest.ts +48 -0
- package/tests/Framework/Router/RouterTest.ts +33 -0
- package/tests/Mail/MailerTest.ts +76 -0
- package/tests/Model/ModelTest.ts +183 -0
- package/tests/Router/HttpHandlerTest.ts +72 -0
- package/tests/Router/RequestTest.ts +77 -0
- package/tests/Router/WebSocketsHandlerTest.ts +51 -0
- package/tests/Storage/StorageTest.ts +97 -0
- package/tests/Support/ArrayTest.ts +167 -0
- package/tests/Support/StringTest.ts +18 -0
- package/tests/Validation/RulesTest.ts +54 -0
- package/tests/tsconfig.json +5 -0
- package/tsconfig.json +53 -0
- package/types.d.ts +8 -0
- package/build/Cache/Cache.d.ts +0 -9
- package/build/Cache/Cache.d.ts.map +0 -1
- package/build/Cache/Cache.js +0 -7
- package/build/Cache/Cache.js.map +0 -1
- package/build/Cache/Stores/DatabaseStore.d.ts +0 -16
- package/build/Cache/Stores/DatabaseStore.d.ts.map +0 -1
- package/build/Cache/Stores/DatabaseStore.js +0 -105
- package/build/Cache/Stores/DatabaseStore.js.map +0 -1
- package/build/Cache/Stores/FileStore.d.ts +0 -16
- package/build/Cache/Stores/FileStore.d.ts.map +0 -1
- package/build/Cache/Stores/FileStore.js +0 -65
- package/build/Cache/Stores/FileStore.js.map +0 -1
- package/build/Cache/Stores/MemoryStore.d.ts +0 -13
- package/build/Cache/Stores/MemoryStore.d.ts.map +0 -1
- package/build/Cache/Stores/MemoryStore.js +0 -57
- package/build/Cache/Stores/MemoryStore.js.map +0 -1
- package/build/Cache/index.d.ts +0 -6
- package/build/Cache/index.d.ts.map +0 -1
- package/build/Cache/index.js +0 -22
- package/build/Cache/index.js.map +0 -1
- package/build/Cache/types.d.ts +0 -5
- package/build/Cache/types.d.ts.map +0 -1
- package/build/Cache/types.js +0 -3
- package/build/Cache/types.js.map +0 -1
- package/build/Container/ClassResolver.d.ts +0 -9
- package/build/Container/ClassResolver.d.ts.map +0 -1
- package/build/Container/ClassResolver.js +0 -93
- package/build/Container/ClassResolver.js.map +0 -1
- package/build/Container/Container.d.ts +0 -25
- package/build/Container/Container.d.ts.map +0 -1
- package/build/Container/Container.js +0 -123
- package/build/Container/Container.js.map +0 -1
- package/build/Container/Contracts.d.ts +0 -3
- package/build/Container/Contracts.d.ts.map +0 -1
- package/build/Container/Contracts.js +0 -3
- package/build/Container/Contracts.js.map +0 -1
- package/build/Container/Decorators.d.ts +0 -5
- package/build/Container/Decorators.d.ts.map +0 -1
- package/build/Container/Decorators.js +0 -21
- package/build/Container/Decorators.js.map +0 -1
- package/build/Container/Metadata.d.ts +0 -21
- package/build/Container/Metadata.d.ts.map +0 -1
- package/build/Container/Metadata.js +0 -17
- package/build/Container/Metadata.js.map +0 -1
- package/build/Container/Resolver.d.ts +0 -19
- package/build/Container/Resolver.d.ts.map +0 -1
- package/build/Container/Resolver.js +0 -17
- package/build/Container/Resolver.js.map +0 -1
- package/build/Container/index.d.ts +0 -6
- package/build/Container/index.d.ts.map +0 -1
- package/build/Container/index.js +0 -22
- package/build/Container/index.js.map +0 -1
- package/build/Database/Clauses/Where.d.ts +0 -1
- package/build/Database/Clauses/Where.d.ts.map +0 -1
- package/build/Database/Clauses/Where.js +0 -2
- package/build/Database/Clauses/Where.js.map +0 -1
- package/build/Database/Connection.d.ts +0 -21
- package/build/Database/Connection.d.ts.map +0 -1
- package/build/Database/Connection.js +0 -44
- package/build/Database/Connection.js.map +0 -1
- package/build/Database/Decorators.d.ts +0 -36
- package/build/Database/Decorators.d.ts.map +0 -1
- package/build/Database/Decorators.js +0 -116
- package/build/Database/Decorators.js.map +0 -1
- package/build/Database/Drivers/DatabaseDriver.d.ts +0 -29
- package/build/Database/Drivers/DatabaseDriver.d.ts.map +0 -1
- package/build/Database/Drivers/DatabaseDriver.js +0 -7
- package/build/Database/Drivers/DatabaseDriver.js.map +0 -1
- package/build/Database/Drivers/MySQL/Alter/index.d.ts +0 -34
- package/build/Database/Drivers/MySQL/Alter/index.d.ts.map +0 -1
- package/build/Database/Drivers/MySQL/Alter/index.js +0 -70
- package/build/Database/Drivers/MySQL/Alter/index.js.map +0 -1
- package/build/Database/Drivers/MySQL/ColumnDefinition.d.ts +0 -7
- package/build/Database/Drivers/MySQL/ColumnDefinition.d.ts.map +0 -1
- package/build/Database/Drivers/MySQL/ColumnDefinition.js +0 -19
- package/build/Database/Drivers/MySQL/ColumnDefinition.js.map +0 -1
- package/build/Database/Drivers/MySQL/Create.d.ts +0 -10
- package/build/Database/Drivers/MySQL/Create.d.ts.map +0 -1
- package/build/Database/Drivers/MySQL/Create.js +0 -44
- package/build/Database/Drivers/MySQL/Create.js.map +0 -1
- package/build/Database/Drivers/MySQL/MysqlDriver.d.ts +0 -42
- package/build/Database/Drivers/MySQL/MysqlDriver.d.ts.map +0 -1
- package/build/Database/Drivers/MySQL/MysqlDriver.js +0 -93
- package/build/Database/Drivers/MySQL/MysqlDriver.js.map +0 -1
- package/build/Database/Drivers/MySQL/Schema.d.ts +0 -16
- package/build/Database/Drivers/MySQL/Schema.d.ts.map +0 -1
- package/build/Database/Drivers/MySQL/Schema.js +0 -67
- package/build/Database/Drivers/MySQL/Schema.js.map +0 -1
- package/build/Database/Drivers/MySQL/index.d.ts +0 -2
- package/build/Database/Drivers/MySQL/index.d.ts.map +0 -1
- package/build/Database/Drivers/MySQL/index.js +0 -16
- package/build/Database/Drivers/MySQL/index.js.map +0 -1
- package/build/Database/Drivers/SQL/Schema.d.ts +0 -7
- package/build/Database/Drivers/SQL/Schema.d.ts.map +0 -1
- package/build/Database/Drivers/SQL/Schema.js +0 -58
- package/build/Database/Drivers/SQL/Schema.js.map +0 -1
- package/build/Database/Drivers/SQL/Statements/Alter.d.ts +0 -8
- package/build/Database/Drivers/SQL/Statements/Alter.d.ts.map +0 -1
- package/build/Database/Drivers/SQL/Statements/Alter.js +0 -22
- package/build/Database/Drivers/SQL/Statements/Alter.js.map +0 -1
- package/build/Database/Drivers/SQL/Statements/BaseStatement.d.ts +0 -13
- package/build/Database/Drivers/SQL/Statements/BaseStatement.d.ts.map +0 -1
- package/build/Database/Drivers/SQL/Statements/BaseStatement.js +0 -46
- package/build/Database/Drivers/SQL/Statements/BaseStatement.js.map +0 -1
- package/build/Database/Drivers/SQL/Statements/Delete.d.ts +0 -6
- package/build/Database/Drivers/SQL/Statements/Delete.d.ts.map +0 -1
- package/build/Database/Drivers/SQL/Statements/Delete.js +0 -20
- package/build/Database/Drivers/SQL/Statements/Delete.js.map +0 -1
- package/build/Database/Drivers/SQL/Statements/Insert.d.ts +0 -7
- package/build/Database/Drivers/SQL/Statements/Insert.d.ts.map +0 -1
- package/build/Database/Drivers/SQL/Statements/Insert.js +0 -24
- package/build/Database/Drivers/SQL/Statements/Insert.js.map +0 -1
- package/build/Database/Drivers/SQL/Statements/Select.d.ts +0 -8
- package/build/Database/Drivers/SQL/Statements/Select.d.ts.map +0 -1
- package/build/Database/Drivers/SQL/Statements/Select.js +0 -51
- package/build/Database/Drivers/SQL/Statements/Select.js.map +0 -1
- package/build/Database/Drivers/SQL/Statements/Update.d.ts +0 -7
- package/build/Database/Drivers/SQL/Statements/Update.d.ts.map +0 -1
- package/build/Database/Drivers/SQL/Statements/Update.js +0 -33
- package/build/Database/Drivers/SQL/Statements/Update.js.map +0 -1
- package/build/Database/Drivers/SQL/index.d.ts +0 -9
- package/build/Database/Drivers/SQL/index.d.ts.map +0 -1
- package/build/Database/Drivers/SQL/index.js +0 -3
- package/build/Database/Drivers/SQL/index.js.map +0 -1
- package/build/Database/Drivers/SQLite/Create.d.ts +0 -10
- package/build/Database/Drivers/SQLite/Create.d.ts.map +0 -1
- package/build/Database/Drivers/SQLite/Create.js +0 -43
- package/build/Database/Drivers/SQLite/Create.js.map +0 -1
- package/build/Database/Drivers/SQLite/Schema.d.ts +0 -16
- package/build/Database/Drivers/SQLite/Schema.d.ts.map +0 -1
- package/build/Database/Drivers/SQLite/Schema.js +0 -49
- package/build/Database/Drivers/SQLite/Schema.js.map +0 -1
- package/build/Database/Drivers/SQLite/SqliteDriver.d.ts +0 -43
- package/build/Database/Drivers/SQLite/SqliteDriver.d.ts.map +0 -1
- package/build/Database/Drivers/SQLite/SqliteDriver.js +0 -115
- package/build/Database/Drivers/SQLite/SqliteDriver.js.map +0 -1
- package/build/Database/Drivers/SQLite/index.d.ts +0 -3
- package/build/Database/Drivers/SQLite/index.d.ts.map +0 -1
- package/build/Database/Drivers/SQLite/index.js +0 -31
- package/build/Database/Drivers/SQLite/index.js.map +0 -1
- package/build/Database/Drivers/SchemaContract.d.ts +0 -9
- package/build/Database/Drivers/SchemaContract.d.ts.map +0 -1
- package/build/Database/Drivers/SchemaContract.js +0 -11
- package/build/Database/Drivers/SchemaContract.js.map +0 -1
- package/build/Database/Drivers/Statement.d.ts +0 -10
- package/build/Database/Drivers/Statement.d.ts.map +0 -1
- package/build/Database/Drivers/Statement.js +0 -17
- package/build/Database/Drivers/Statement.js.map +0 -1
- package/build/Database/Drivers/index.d.ts +0 -5
- package/build/Database/Drivers/index.d.ts.map +0 -1
- package/build/Database/Drivers/index.js +0 -21
- package/build/Database/Drivers/index.js.map +0 -1
- package/build/Database/Entity.d.ts +0 -64
- package/build/Database/Entity.d.ts.map +0 -1
- package/build/Database/Entity.js +0 -243
- package/build/Database/Entity.js.map +0 -1
- package/build/Database/EntityNotFoundError.d.ts +0 -6
- package/build/Database/EntityNotFoundError.d.ts.map +0 -1
- package/build/Database/EntityNotFoundError.js +0 -12
- package/build/Database/EntityNotFoundError.js.map +0 -1
- package/build/Database/EntityProxyHandler.d.ts +0 -6
- package/build/Database/EntityProxyHandler.d.ts.map +0 -1
- package/build/Database/EntityProxyHandler.js +0 -40
- package/build/Database/EntityProxyHandler.js.map +0 -1
- package/build/Database/EntityQuery.d.ts +0 -29
- package/build/Database/EntityQuery.d.ts.map +0 -1
- package/build/Database/EntityQuery.js +0 -158
- package/build/Database/EntityQuery.js.map +0 -1
- package/build/Database/Expression.d.ts +0 -4
- package/build/Database/Expression.d.ts.map +0 -1
- package/build/Database/Expression.js +0 -7
- package/build/Database/Expression.js.map +0 -1
- package/build/Database/Fields.d.ts +0 -156
- package/build/Database/Fields.d.ts.map +0 -1
- package/build/Database/Fields.js +0 -564
- package/build/Database/Fields.js.map +0 -1
- package/build/Database/Helpers.d.ts +0 -2
- package/build/Database/Helpers.d.ts.map +0 -1
- package/build/Database/Helpers.js +0 -16
- package/build/Database/Helpers.js.map +0 -1
- package/build/Database/List.d.ts +0 -24
- package/build/Database/List.d.ts.map +0 -1
- package/build/Database/List.js +0 -48
- package/build/Database/List.js.map +0 -1
- package/build/Database/Migrations/Migration.d.ts +0 -8
- package/build/Database/Migrations/Migration.d.ts.map +0 -1
- package/build/Database/Migrations/Migration.js +0 -11
- package/build/Database/Migrations/Migration.js.map +0 -1
- package/build/Database/Migrations/MigrationHistory.d.ts +0 -9
- package/build/Database/Migrations/MigrationHistory.d.ts.map +0 -1
- package/build/Database/Migrations/MigrationHistory.js +0 -43
- package/build/Database/Migrations/MigrationHistory.js.map +0 -1
- package/build/Database/Migrations/Migrator.d.ts +0 -21
- package/build/Database/Migrations/Migrator.d.ts.map +0 -1
- package/build/Database/Migrations/Migrator.js +0 -135
- package/build/Database/Migrations/Migrator.js.map +0 -1
- package/build/Database/Migrations/index.d.ts +0 -4
- package/build/Database/Migrations/index.d.ts.map +0 -1
- package/build/Database/Migrations/index.js +0 -20
- package/build/Database/Migrations/index.js.map +0 -1
- package/build/Database/ORM/BaseRelationship.d.ts +0 -8
- package/build/Database/ORM/BaseRelationship.d.ts.map +0 -1
- package/build/Database/ORM/BaseRelationship.js +0 -13
- package/build/Database/ORM/BaseRelationship.js.map +0 -1
- package/build/Database/Query.d.ts +0 -63
- package/build/Database/Query.d.ts.map +0 -1
- package/build/Database/Query.js +0 -264
- package/build/Database/Query.js.map +0 -1
- package/build/Database/Seeders/Seeder.d.ts +0 -4
- package/build/Database/Seeders/Seeder.d.ts.map +0 -1
- package/build/Database/Seeders/Seeder.js +0 -7
- package/build/Database/Seeders/Seeder.js.map +0 -1
- package/build/Database/Seeders/SeederManager.d.ts +0 -9
- package/build/Database/Seeders/SeederManager.d.ts.map +0 -1
- package/build/Database/Seeders/SeederManager.js +0 -27
- package/build/Database/Seeders/SeederManager.js.map +0 -1
- package/build/Database/Seeders/index.d.ts +0 -3
- package/build/Database/Seeders/index.d.ts.map +0 -1
- package/build/Database/Seeders/index.js +0 -19
- package/build/Database/Seeders/index.js.map +0 -1
- package/build/Database/StringExpression.d.ts +0 -7
- package/build/Database/StringExpression.d.ts.map +0 -1
- package/build/Database/StringExpression.js +0 -16
- package/build/Database/StringExpression.js.map +0 -1
- package/build/Database/Types.d.ts +0 -118
- package/build/Database/Types.d.ts.map +0 -1
- package/build/Database/Types.js +0 -106
- package/build/Database/Types.js.map +0 -1
- package/build/Database/index.d.ts +0 -21
- package/build/Database/index.d.ts.map +0 -1
- package/build/Database/index.js +0 -25
- package/build/Database/index.js.map +0 -1
- package/build/Encryption/index.d.ts +0 -15
- package/build/Encryption/index.d.ts.map +0 -1
- package/build/Encryption/index.js +0 -68
- package/build/Encryption/index.js.map +0 -1
- package/build/Forms/Decorators.d.ts +0 -7
- package/build/Forms/Decorators.d.ts.map +0 -1
- package/build/Forms/Decorators.js +0 -29
- package/build/Forms/Decorators.js.map +0 -1
- package/build/Forms/Form.d.ts +0 -18
- package/build/Forms/Form.d.ts.map +0 -1
- package/build/Forms/Form.js +0 -68
- package/build/Forms/Form.js.map +0 -1
- package/build/Forms/FormFields.d.ts +0 -10
- package/build/Forms/FormFields.d.ts.map +0 -1
- package/build/Forms/FormFields.js +0 -39
- package/build/Forms/FormFields.js.map +0 -1
- package/build/Forms/index.d.ts +0 -4
- package/build/Forms/index.d.ts.map +0 -1
- package/build/Forms/index.js +0 -20
- package/build/Forms/index.js.map +0 -1
- package/build/Framework/App.d.ts +0 -7
- package/build/Framework/App.d.ts.map +0 -1
- package/build/Framework/App.js +0 -11
- package/build/Framework/App.js.map +0 -1
- package/build/Framework/Application.d.ts +0 -17
- package/build/Framework/Application.d.ts.map +0 -1
- package/build/Framework/Application.js +0 -94
- package/build/Framework/Application.js.map +0 -1
- package/build/Framework/Auth/Auth.d.ts +0 -24
- package/build/Framework/Auth/Auth.d.ts.map +0 -1
- package/build/Framework/Auth/Auth.js +0 -116
- package/build/Framework/Auth/Auth.js.map +0 -1
- package/build/Framework/Auth/Authenticatable.d.ts +0 -7
- package/build/Framework/Auth/Authenticatable.d.ts.map +0 -1
- package/build/Framework/Auth/Authenticatable.js +0 -3
- package/build/Framework/Auth/Authenticatable.js.map +0 -1
- package/build/Framework/Auth/User.d.ts +0 -11
- package/build/Framework/Auth/User.d.ts.map +0 -1
- package/build/Framework/Auth/User.js +0 -41
- package/build/Framework/Auth/User.js.map +0 -1
- package/build/Framework/Auth/index.d.ts +0 -6
- package/build/Framework/Auth/index.d.ts.map +0 -1
- package/build/Framework/Auth/index.js +0 -44
- package/build/Framework/Auth/index.js.map +0 -1
- package/build/Framework/Config/AppConfig.d.ts +0 -26
- package/build/Framework/Config/AppConfig.d.ts.map +0 -1
- package/build/Framework/Config/AppConfig.js +0 -20
- package/build/Framework/Config/AppConfig.js.map +0 -1
- package/build/Framework/Config/AuthConfig.d.ts +0 -11
- package/build/Framework/Config/AuthConfig.d.ts.map +0 -1
- package/build/Framework/Config/AuthConfig.js +0 -13
- package/build/Framework/Config/AuthConfig.js.map +0 -1
- package/build/Framework/Config/BaseConfig.d.ts +0 -7
- package/build/Framework/Config/BaseConfig.d.ts.map +0 -1
- package/build/Framework/Config/BaseConfig.js +0 -14
- package/build/Framework/Config/BaseConfig.js.map +0 -1
- package/build/Framework/Config/CacheConfig.d.ts +0 -16
- package/build/Framework/Config/CacheConfig.d.ts.map +0 -1
- package/build/Framework/Config/CacheConfig.js +0 -37
- package/build/Framework/Config/CacheConfig.js.map +0 -1
- package/build/Framework/Config/DatabaseConfig.d.ts +0 -11
- package/build/Framework/Config/DatabaseConfig.d.ts.map +0 -1
- package/build/Framework/Config/DatabaseConfig.js +0 -23
- package/build/Framework/Config/DatabaseConfig.js.map +0 -1
- package/build/Framework/Config/MailConfig.d.ts +0 -19
- package/build/Framework/Config/MailConfig.d.ts.map +0 -1
- package/build/Framework/Config/MailConfig.js +0 -11
- package/build/Framework/Config/MailConfig.js.map +0 -1
- package/build/Framework/Config/index.d.ts +0 -7
- package/build/Framework/Config/index.d.ts.map +0 -1
- package/build/Framework/Config/index.js +0 -23
- package/build/Framework/Config/index.js.map +0 -1
- package/build/Framework/Middleware/AuthMiddleware.d.ts +0 -9
- package/build/Framework/Middleware/AuthMiddleware.d.ts.map +0 -1
- package/build/Framework/Middleware/AuthMiddleware.js +0 -78
- package/build/Framework/Middleware/AuthMiddleware.js.map +0 -1
- package/build/Framework/Middleware/CorsMiddleware.d.ts +0 -8
- package/build/Framework/Middleware/CorsMiddleware.d.ts.map +0 -1
- package/build/Framework/Middleware/CorsMiddleware.js +0 -47
- package/build/Framework/Middleware/CorsMiddleware.js.map +0 -1
- package/build/Framework/Middleware/StaticAssetsMiddleware.d.ts +0 -16
- package/build/Framework/Middleware/StaticAssetsMiddleware.d.ts.map +0 -1
- package/build/Framework/Middleware/StaticAssetsMiddleware.js +0 -120
- package/build/Framework/Middleware/StaticAssetsMiddleware.js.map +0 -1
- package/build/Framework/Middleware/index.d.ts +0 -3
- package/build/Framework/Middleware/index.d.ts.map +0 -1
- package/build/Framework/Middleware/index.js +0 -19
- package/build/Framework/Middleware/index.js.map +0 -1
- package/build/Framework/Provider.d.ts +0 -6
- package/build/Framework/Provider.d.ts.map +0 -1
- package/build/Framework/Provider.js +0 -22
- package/build/Framework/Provider.js.map +0 -1
- package/build/Framework/Providers/CacheProvider.d.ts +0 -7
- package/build/Framework/Providers/CacheProvider.d.ts.map +0 -1
- package/build/Framework/Providers/CacheProvider.js +0 -40
- package/build/Framework/Providers/CacheProvider.js.map +0 -1
- package/build/Framework/Providers/DatabaseProvider.d.ts +0 -10
- package/build/Framework/Providers/DatabaseProvider.d.ts.map +0 -1
- package/build/Framework/Providers/DatabaseProvider.js +0 -80
- package/build/Framework/Providers/DatabaseProvider.js.map +0 -1
- package/build/Framework/Providers/MailProvider.d.ts +0 -7
- package/build/Framework/Providers/MailProvider.d.ts.map +0 -1
- package/build/Framework/Providers/MailProvider.js +0 -41
- package/build/Framework/Providers/MailProvider.js.map +0 -1
- package/build/Framework/Providers/WebsocketsProvider.d.ts +0 -13
- package/build/Framework/Providers/WebsocketsProvider.d.ts.map +0 -1
- package/build/Framework/Providers/WebsocketsProvider.js +0 -145
- package/build/Framework/Providers/WebsocketsProvider.js.map +0 -1
- package/build/Framework/Resolvers/AuthResolver.d.ts +0 -6
- package/build/Framework/Resolvers/AuthResolver.d.ts.map +0 -1
- package/build/Framework/Resolvers/AuthResolver.js +0 -19
- package/build/Framework/Resolvers/AuthResolver.js.map +0 -1
- package/build/Framework/Resolvers/EntityResolver.d.ts +0 -10
- package/build/Framework/Resolvers/EntityResolver.d.ts.map +0 -1
- package/build/Framework/Resolvers/EntityResolver.js +0 -40
- package/build/Framework/Resolvers/EntityResolver.js.map +0 -1
- package/build/Framework/Resolvers/FormResolver.d.ts +0 -10
- package/build/Framework/Resolvers/FormResolver.d.ts.map +0 -1
- package/build/Framework/Resolvers/FormResolver.js +0 -34
- package/build/Framework/Resolvers/FormResolver.js.map +0 -1
- package/build/Framework/RootDir.d.ts +0 -3
- package/build/Framework/RootDir.d.ts.map +0 -1
- package/build/Framework/RootDir.js +0 -7
- package/build/Framework/RootDir.js.map +0 -1
- package/build/Framework/index.d.ts +0 -9
- package/build/Framework/index.d.ts.map +0 -1
- package/build/Framework/index.js +0 -25
- package/build/Framework/index.js.map +0 -1
- package/build/LICENSE.md +0 -21
- package/build/Mail/MailAddress.d.ts +0 -5
- package/build/Mail/MailAddress.d.ts.map +0 -1
- package/build/Mail/MailAddress.js +0 -3
- package/build/Mail/MailAddress.js.map +0 -1
- package/build/Mail/MailTransport.d.ts +0 -6
- package/build/Mail/MailTransport.d.ts.map +0 -1
- package/build/Mail/MailTransport.js +0 -7
- package/build/Mail/MailTransport.js.map +0 -1
- package/build/Mail/Mailable.d.ts +0 -18
- package/build/Mail/Mailable.d.ts.map +0 -1
- package/build/Mail/Mailable.js +0 -17
- package/build/Mail/Mailable.js.map +0 -1
- package/build/Mail/Mailer.d.ts +0 -12
- package/build/Mail/Mailer.d.ts.map +0 -1
- package/build/Mail/Mailer.js +0 -27
- package/build/Mail/Mailer.js.map +0 -1
- package/build/Mail/PendingMail.d.ts +0 -30
- package/build/Mail/PendingMail.d.ts.map +0 -1
- package/build/Mail/PendingMail.js +0 -54
- package/build/Mail/PendingMail.js.map +0 -1
- package/build/Mail/SentMessage.d.ts +0 -16
- package/build/Mail/SentMessage.d.ts.map +0 -1
- package/build/Mail/SentMessage.js +0 -20
- package/build/Mail/SentMessage.js.map +0 -1
- package/build/Mail/Transports/MemoryTransport.d.ts +0 -8
- package/build/Mail/Transports/MemoryTransport.d.ts.map +0 -1
- package/build/Mail/Transports/MemoryTransport.js +0 -15
- package/build/Mail/Transports/MemoryTransport.js.map +0 -1
- package/build/Mail/Transports/SendGridTransport.d.ts +0 -11
- package/build/Mail/Transports/SendGridTransport.d.ts.map +0 -1
- package/build/Mail/Transports/SendGridTransport.js +0 -106
- package/build/Mail/Transports/SendGridTransport.js.map +0 -1
- package/build/Mail/index.d.ts +0 -4
- package/build/Mail/index.d.ts.map +0 -1
- package/build/Mail/index.js +0 -20
- package/build/Mail/index.js.map +0 -1
- package/build/Models/Model.d.ts +0 -10
- package/build/Models/Model.d.ts.map +0 -1
- package/build/Models/Model.js +0 -36
- package/build/Models/Model.js.map +0 -1
- package/build/Models/index.d.ts +0 -22
- package/build/Models/index.d.ts.map +0 -1
- package/build/Models/index.js +0 -64
- package/build/Models/index.js.map +0 -1
- package/build/Readme.md +0 -123
- package/build/Router/BaseController.d.ts +0 -5
- package/build/Router/BaseController.d.ts.map +0 -1
- package/build/Router/BaseController.js +0 -22
- package/build/Router/BaseController.js.map +0 -1
- package/build/Router/Decorators.d.ts +0 -19
- package/build/Router/Decorators.d.ts.map +0 -1
- package/build/Router/Decorators.js +0 -175
- package/build/Router/Decorators.js.map +0 -1
- package/build/Router/Guard.d.ts +0 -5
- package/build/Router/Guard.d.ts.map +0 -1
- package/build/Router/Guard.js +0 -11
- package/build/Router/Guard.js.map +0 -1
- package/build/Router/Http/Contracts.d.ts +0 -4
- package/build/Router/Http/Contracts.d.ts.map +0 -1
- package/build/Router/Http/Contracts.js +0 -3
- package/build/Router/Http/Contracts.js.map +0 -1
- package/build/Router/Http/ErrorHandler.d.ts +0 -10
- package/build/Router/Http/ErrorHandler.d.ts.map +0 -1
- package/build/Router/Http/ErrorHandler.js +0 -53
- package/build/Router/Http/ErrorHandler.js.map +0 -1
- package/build/Router/Http/ErrorHandlerInterface.d.ts +0 -6
- package/build/Router/Http/ErrorHandlerInterface.d.ts.map +0 -1
- package/build/Router/Http/ErrorHandlerInterface.js +0 -8
- package/build/Router/Http/ErrorHandlerInterface.js.map +0 -1
- package/build/Router/Http/Errors/HttpError.d.ts +0 -8
- package/build/Router/Http/Errors/HttpError.d.ts.map +0 -1
- package/build/Router/Http/Errors/HttpError.js +0 -18
- package/build/Router/Http/Errors/HttpError.js.map +0 -1
- package/build/Router/Http/Handler.d.ts +0 -19
- package/build/Router/Http/Handler.d.ts.map +0 -1
- package/build/Router/Http/Handler.js +0 -163
- package/build/Router/Http/Handler.js.map +0 -1
- package/build/Router/Http/HttpRoute.d.ts +0 -25
- package/build/Router/Http/HttpRoute.d.ts.map +0 -1
- package/build/Router/Http/HttpRoute.js +0 -97
- package/build/Router/Http/HttpRoute.js.map +0 -1
- package/build/Router/Http/Middleware.d.ts +0 -7
- package/build/Router/Http/Middleware.d.ts.map +0 -1
- package/build/Router/Http/Middleware.js +0 -8
- package/build/Router/Http/Middleware.js.map +0 -1
- package/build/Router/Http/Request.d.ts +0 -38
- package/build/Router/Http/Request.d.ts.map +0 -1
- package/build/Router/Http/Request.js +0 -211
- package/build/Router/Http/Request.js.map +0 -1
- package/build/Router/Http/Response.d.ts +0 -14
- package/build/Router/Http/Response.d.ts.map +0 -1
- package/build/Router/Http/Response.js +0 -31
- package/build/Router/Http/Response.js.map +0 -1
- package/build/Router/Http/index.d.ts +0 -84
- package/build/Router/Http/index.d.ts.map +0 -1
- package/build/Router/Http/index.js +0 -104
- package/build/Router/Http/index.js.map +0 -1
- package/build/Router/Metadata.d.ts +0 -41
- package/build/Router/Metadata.d.ts.map +0 -1
- package/build/Router/Metadata.js +0 -33
- package/build/Router/Metadata.js.map +0 -1
- package/build/Router/Middleware.d.ts +0 -13
- package/build/Router/Middleware.d.ts.map +0 -1
- package/build/Router/Middleware.js +0 -7
- package/build/Router/Middleware.js.map +0 -1
- package/build/Router/Request.d.ts +0 -24
- package/build/Router/Request.d.ts.map +0 -1
- package/build/Router/Request.js +0 -44
- package/build/Router/Request.js.map +0 -1
- package/build/Router/Route.d.ts +0 -13
- package/build/Router/Route.d.ts.map +0 -1
- package/build/Router/Route.js +0 -20
- package/build/Router/Route.js.map +0 -1
- package/build/Router/RouteNotFoundError.d.ts +0 -4
- package/build/Router/RouteNotFoundError.d.ts.map +0 -1
- package/build/Router/RouteNotFoundError.js +0 -10
- package/build/Router/RouteNotFoundError.js.map +0 -1
- package/build/Router/Router.d.ts +0 -19
- package/build/Router/Router.d.ts.map +0 -1
- package/build/Router/Router.js +0 -36
- package/build/Router/Router.js.map +0 -1
- package/build/Router/Servers/index.d.ts +0 -5
- package/build/Router/Servers/index.d.ts.map +0 -1
- package/build/Router/Servers/index.js +0 -19
- package/build/Router/Servers/index.js.map +0 -1
- package/build/Router/Servers/node.d.ts +0 -3
- package/build/Router/Servers/node.d.ts.map +0 -1
- package/build/Router/Servers/node.js +0 -41
- package/build/Router/Servers/node.js.map +0 -1
- package/build/Router/Servers/uNetworking.d.ts +0 -3
- package/build/Router/Servers/uNetworking.d.ts.map +0 -1
- package/build/Router/Servers/uNetworking.js +0 -172
- package/build/Router/Servers/uNetworking.js.map +0 -1
- package/build/Router/Websockets/Handler.d.ts +0 -15
- package/build/Router/Websockets/Handler.d.ts.map +0 -1
- package/build/Router/Websockets/Handler.js +0 -69
- package/build/Router/Websockets/Handler.js.map +0 -1
- package/build/Router/Websockets/Middleware.d.ts +0 -7
- package/build/Router/Websockets/Middleware.d.ts.map +0 -1
- package/build/Router/Websockets/Middleware.js +0 -8
- package/build/Router/Websockets/Middleware.js.map +0 -1
- package/build/Router/Websockets/Request.d.ts +0 -4
- package/build/Router/Websockets/Request.d.ts.map +0 -1
- package/build/Router/Websockets/Request.js +0 -8
- package/build/Router/Websockets/Request.js.map +0 -1
- package/build/Router/Websockets/WebsocketRoute.d.ts +0 -7
- package/build/Router/Websockets/WebsocketRoute.d.ts.map +0 -1
- package/build/Router/Websockets/WebsocketRoute.js +0 -47
- package/build/Router/Websockets/WebsocketRoute.js.map +0 -1
- package/build/Router/Websockets/index.d.ts +0 -19
- package/build/Router/Websockets/index.d.ts.map +0 -1
- package/build/Router/Websockets/index.js +0 -68
- package/build/Router/Websockets/index.js.map +0 -1
- package/build/Router/Websockets/types.d.ts +0 -22
- package/build/Router/Websockets/types.d.ts.map +0 -1
- package/build/Router/Websockets/types.js +0 -9
- package/build/Router/Websockets/types.js.map +0 -1
- package/build/Router/index.d.ts +0 -7
- package/build/Router/index.d.ts.map +0 -1
- package/build/Router/index.js +0 -23
- package/build/Router/index.js.map +0 -1
- package/build/Storage/File.d.ts +0 -12
- package/build/Storage/File.d.ts.map +0 -1
- package/build/Storage/File.js +0 -65
- package/build/Storage/File.js.map +0 -1
- package/build/Storage/Image.d.ts +0 -4
- package/build/Storage/Image.d.ts.map +0 -1
- package/build/Storage/Image.js +0 -8
- package/build/Storage/Image.js.map +0 -1
- package/build/Storage/InvalidImage.d.ts +0 -4
- package/build/Storage/InvalidImage.d.ts.map +0 -1
- package/build/Storage/InvalidImage.js +0 -8
- package/build/Storage/InvalidImage.js.map +0 -1
- package/build/Storage/Storage.d.ts +0 -13
- package/build/Storage/Storage.d.ts.map +0 -1
- package/build/Storage/Storage.js +0 -120
- package/build/Storage/Storage.js.map +0 -1
- package/build/Storage/index.d.ts +0 -5
- package/build/Storage/index.d.ts.map +0 -1
- package/build/Storage/index.js +0 -21
- package/build/Storage/index.js.map +0 -1
- package/build/Storage/utils.d.ts +0 -5
- package/build/Storage/utils.d.ts.map +0 -1
- package/build/Storage/utils.js +0 -20
- package/build/Storage/utils.js.map +0 -1
- package/build/Support/Array.d.ts +0 -29
- package/build/Support/Array.d.ts.map +0 -1
- package/build/Support/Array.js +0 -112
- package/build/Support/Array.js.map +0 -1
- package/build/Support/Math.d.ts +0 -7
- package/build/Support/Math.d.ts.map +0 -1
- package/build/Support/Math.js +0 -8
- package/build/Support/Math.js.map +0 -1
- package/build/Support/Metadata.d.ts +0 -16
- package/build/Support/Metadata.d.ts.map +0 -1
- package/build/Support/Metadata.js +0 -33
- package/build/Support/Metadata.js.map +0 -1
- package/build/Support/String.d.ts +0 -12
- package/build/Support/String.d.ts.map +0 -1
- package/build/Support/String.js +0 -24
- package/build/Support/String.js.map +0 -1
- package/build/Support/index.d.ts +0 -16
- package/build/Support/index.d.ts.map +0 -1
- package/build/Support/index.js +0 -7
- package/build/Support/index.js.map +0 -1
- package/build/Support/utils.d.ts +0 -2
- package/build/Support/utils.d.ts.map +0 -1
- package/build/Support/utils.js +0 -12
- package/build/Support/utils.js.map +0 -1
- package/build/Testing/TestCase.d.ts +0 -33
- package/build/Testing/TestCase.d.ts.map +0 -1
- package/build/Testing/TestCase.js +0 -138
- package/build/Testing/TestCase.js.map +0 -1
- package/build/Validation/Rule.d.ts +0 -7
- package/build/Validation/Rule.d.ts.map +0 -1
- package/build/Validation/Rule.js +0 -7
- package/build/Validation/Rule.js.map +0 -1
- package/build/Validation/RuleInterface.d.ts +0 -7
- package/build/Validation/RuleInterface.d.ts.map +0 -1
- package/build/Validation/RuleInterface.js +0 -3
- package/build/Validation/RuleInterface.js.map +0 -1
- package/build/Validation/Rules/Email.d.ts +0 -4
- package/build/Validation/Rules/Email.d.ts.map +0 -1
- package/build/Validation/Rules/Email.js +0 -17
- package/build/Validation/Rules/Email.js.map +0 -1
- package/build/Validation/Rules/FileExtension.d.ts +0 -4
- package/build/Validation/Rules/FileExtension.d.ts.map +0 -1
- package/build/Validation/Rules/FileExtension.js +0 -19
- package/build/Validation/Rules/FileExtension.js.map +0 -1
- package/build/Validation/Rules/MaxLength.d.ts +0 -4
- package/build/Validation/Rules/MaxLength.d.ts.map +0 -1
- package/build/Validation/Rules/MaxLength.js +0 -16
- package/build/Validation/Rules/MaxLength.js.map +0 -1
- package/build/Validation/Rules/MinLength.d.ts +0 -4
- package/build/Validation/Rules/MinLength.d.ts.map +0 -1
- package/build/Validation/Rules/MinLength.js +0 -16
- package/build/Validation/Rules/MinLength.js.map +0 -1
- package/build/Validation/Rules/Optional.d.ts +0 -4
- package/build/Validation/Rules/Optional.d.ts.map +0 -1
- package/build/Validation/Rules/Optional.js +0 -16
- package/build/Validation/Rules/Optional.js.map +0 -1
- package/build/Validation/Rules/Required.d.ts +0 -4
- package/build/Validation/Rules/Required.d.ts.map +0 -1
- package/build/Validation/Rules/Required.js +0 -24
- package/build/Validation/Rules/Required.js.map +0 -1
- package/build/Validation/Validator.d.ts +0 -12
- package/build/Validation/Validator.d.ts.map +0 -1
- package/build/Validation/Validator.js +0 -13
- package/build/Validation/Validator.js.map +0 -1
- package/build/Validation/index.d.ts +0 -11
- package/build/Validation/index.d.ts.map +0 -1
- package/build/Validation/index.js +0 -27
- package/build/Validation/index.js.map +0 -1
- package/build/package-lock.json +0 -5764
- package/build/package.json +0 -84
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "webhook-notifications",
|
|
3
|
+
"category": "Notifications",
|
|
4
|
+
"title": "Webhook Notifications",
|
|
5
|
+
"description": "Implement webhook delivery for notifications sent to external services. Supports webhook retry logic, signature verification, and payload transformation.",
|
|
6
|
+
"status": "backlog",
|
|
7
|
+
"priority": 2,
|
|
8
|
+
"complexity": "moderate",
|
|
9
|
+
"dependencies": [
|
|
10
|
+
"discord-notifications-channel"
|
|
11
|
+
],
|
|
12
|
+
"createdAt": "2025-12-21T22:11:28.282Z",
|
|
13
|
+
"updatedAt": "2025-12-21T22:11:28.282Z"
|
|
14
|
+
}
|
package/.editorconfig
ADDED
package/.mocharc.json
ADDED
package/CONTRIBUTING.md
ADDED
package/Cache/Cache.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export abstract class Cache {
|
|
2
|
+
abstract has(name: string): Promise<boolean>
|
|
3
|
+
|
|
4
|
+
abstract get<T>(name: string, defaultValue?: T | (() => T | Promise<T>)): Promise<T | undefined>
|
|
5
|
+
|
|
6
|
+
abstract remember<T>(name: string, defaultValue?: T | (() => T | Promise<T>), duration?: number): Promise<T | undefined>
|
|
7
|
+
|
|
8
|
+
abstract set(name: string, data: any, duration?: number): Promise<void>
|
|
9
|
+
|
|
10
|
+
abstract delete(name: string): Promise<void>
|
|
11
|
+
|
|
12
|
+
abstract flush(): Promise<void>
|
|
13
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Cache } from '@Typetron/Cache'
|
|
2
|
+
import { Query } from '@Typetron/Database'
|
|
3
|
+
import { JSONSafeParse } from '@Typetron/Support/utils'
|
|
4
|
+
import { CacheItem } from '@Typetron/Cache/types'
|
|
5
|
+
import { createHash } from 'crypto'
|
|
6
|
+
import { Create } from '@Typetron/Database/Drivers/SQLite/Create'
|
|
7
|
+
|
|
8
|
+
export class DatabaseStore extends Cache {
|
|
9
|
+
constructor(public table: string) {
|
|
10
|
+
super()
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
private get cacheTable() {
|
|
14
|
+
return new Query<CacheItem<unknown>>().table(this.table)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
private getNameHash(name: string) {
|
|
18
|
+
return createHash('sha1').update(name).digest('hex')
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async has(name: string): Promise<boolean> {
|
|
22
|
+
const row = await this.cacheTable.where('name', this.getNameHash(name)).first()
|
|
23
|
+
return !!row
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async get<T>(name: string, defaultValue?: T | (() => T | Promise<T>)): Promise<T | undefined> {
|
|
27
|
+
if (!await Query.connection.driver.tableExists(this.table)) {
|
|
28
|
+
return undefined
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const row = await this.cacheTable.where('name', this.getNameHash(name)).first()
|
|
32
|
+
|
|
33
|
+
if (!row) {
|
|
34
|
+
return this.getDefaultValue(defaultValue)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const currentTime = Date.now()
|
|
38
|
+
|
|
39
|
+
if (row.date && row.date < currentTime) {
|
|
40
|
+
await this.delete(name)
|
|
41
|
+
return this.getDefaultValue(defaultValue)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return JSONSafeParse<T>(String(row.value))
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async remember<T>(name: string, defaultValue?: T | (() => T | Promise<T>), durationInSeconds?: number): Promise<T | undefined> {
|
|
48
|
+
const value = await this.get<T>(name)
|
|
49
|
+
|
|
50
|
+
if (!value) {
|
|
51
|
+
const newValue = await this.getDefaultValue(defaultValue)
|
|
52
|
+
await this.set(name, newValue, durationInSeconds)
|
|
53
|
+
return newValue
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return value
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async set(name: string, value: any, durationInSeconds?: number): Promise<void> {
|
|
60
|
+
await this.makeSureTheTableExists()
|
|
61
|
+
const expirationTime = durationInSeconds ? Date.now() + durationInSeconds * 1000 : undefined
|
|
62
|
+
const serializedValue = JSON.stringify(value)
|
|
63
|
+
|
|
64
|
+
const existing = await this.cacheTable.where('name', this.getNameHash(name)).first()
|
|
65
|
+
|
|
66
|
+
if (existing) {
|
|
67
|
+
await this.cacheTable.where('name', this.getNameHash(name)).update({
|
|
68
|
+
value: serializedValue,
|
|
69
|
+
date: expirationTime
|
|
70
|
+
})
|
|
71
|
+
} else {
|
|
72
|
+
await this.cacheTable.insert({
|
|
73
|
+
name: this.getNameHash(name),
|
|
74
|
+
value: serializedValue,
|
|
75
|
+
date: expirationTime
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async delete(name: string): Promise<void> {
|
|
81
|
+
await this.cacheTable.where('name', this.getNameHash(name)).delete()
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async flush(): Promise<void> {
|
|
85
|
+
await this.cacheTable.delete()
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private async getDefaultValue<T>(defaultValue?: (() => (Promise<T> | T)) | T) {
|
|
89
|
+
const valueFunction = typeof defaultValue === 'function'
|
|
90
|
+
? defaultValue as () => Promise<T> | T
|
|
91
|
+
: () => defaultValue
|
|
92
|
+
|
|
93
|
+
return valueFunction()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private async makeSureTheTableExists() {
|
|
97
|
+
if (!await Query.connection.driver.tableExists(this.table)) {
|
|
98
|
+
const createStatement = new Create(this.table, [
|
|
99
|
+
{
|
|
100
|
+
name: 'name',
|
|
101
|
+
type: 'string',
|
|
102
|
+
primaryKey: true,
|
|
103
|
+
nullable: true,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'value',
|
|
107
|
+
type: 'string',
|
|
108
|
+
nullable: true,
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'date',
|
|
112
|
+
type: 'integer',
|
|
113
|
+
nullable: true,
|
|
114
|
+
},
|
|
115
|
+
])
|
|
116
|
+
|
|
117
|
+
await Query.connection.driver.run(createStatement.toSQL())
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Cache } from '@Typetron/Cache'
|
|
2
|
+
import { Storage } from '@Typetron/Storage'
|
|
3
|
+
import { createHash } from 'node:crypto'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
import { JSONSafeParse } from '@Typetron/Support/utils'
|
|
6
|
+
import { CacheItem } from '@Typetron/Cache/types'
|
|
7
|
+
|
|
8
|
+
export class FileStore extends Cache {
|
|
9
|
+
constructor(public storage: Storage, public directory: string) {
|
|
10
|
+
super()
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async has(name: string): Promise<boolean> {
|
|
14
|
+
return await this.storage.exists(this.path(name))
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async get<T>(name: string, defaultValue?: T | (() => T | Promise<T>)): Promise<T | undefined> {
|
|
18
|
+
const item: CacheItem<T> = await this.storage.read(this.path(name))
|
|
19
|
+
.then(async (data) => JSONSafeParse<CacheItem<T>>(data.toString()) ?? {value: await this.getDefaultValue<T>(defaultValue)})
|
|
20
|
+
.catch(async () => ({value: await this.getDefaultValue<T>(defaultValue)}))
|
|
21
|
+
|
|
22
|
+
if (item['date'] && item['date'] < new Date().getTime()) {
|
|
23
|
+
await this.delete(name)
|
|
24
|
+
return this.getDefaultValue(defaultValue)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return item['value']
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async remember<T>(name: string, defaultValue?: T | (() => T | Promise<T>), durationInSeconds?: number): Promise<T | undefined> {
|
|
31
|
+
const data = await this.get<T>(name)
|
|
32
|
+
|
|
33
|
+
if (data !== undefined) {
|
|
34
|
+
return data
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const value = await this.getDefaultValue(defaultValue)
|
|
38
|
+
await this.set(name, value, durationInSeconds)
|
|
39
|
+
return value
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async set(name: string, value: any, durationInSeconds?: number): Promise<void> {
|
|
43
|
+
await this.storage.put(this.path(name), JSON.stringify({
|
|
44
|
+
value,
|
|
45
|
+
date: durationInSeconds ? Date.now() + durationInSeconds * 1000 : undefined
|
|
46
|
+
} as CacheItem<unknown>))
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async delete(name: string): Promise<void> {
|
|
50
|
+
await this.storage.delete(this.path(name))
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async flush(): Promise<void> {
|
|
54
|
+
await this.storage.deleteDirectory(this.directory)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private path(key: string): string {
|
|
58
|
+
const hashKey = createHash('sha1').update(key).digest('hex')
|
|
59
|
+
return path.join(this.directory, '/', hashKey)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private async getDefaultValue<T>(defaultValue?: (() => (Promise<T> | T)) | T) {
|
|
63
|
+
const valueFunction = typeof defaultValue === 'function'
|
|
64
|
+
? defaultValue as () => Promise<T> | T
|
|
65
|
+
: () => defaultValue
|
|
66
|
+
|
|
67
|
+
return valueFunction()
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Cache } from '@Typetron/Cache'
|
|
2
|
+
import { CacheItem } from '@Typetron/Cache/types'
|
|
3
|
+
|
|
4
|
+
export class MemoryStore extends Cache {
|
|
5
|
+
public cache: Map<string, CacheItem<unknown>> = new Map()
|
|
6
|
+
|
|
7
|
+
async has(name: string): Promise<boolean> {
|
|
8
|
+
const cacheItem = this.cache.get(name)
|
|
9
|
+
|
|
10
|
+
if (!cacheItem) {
|
|
11
|
+
return false
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const currentTime = Date.now()
|
|
15
|
+
|
|
16
|
+
if (cacheItem.date && cacheItem.date < currentTime) {
|
|
17
|
+
this.cache.delete(name)
|
|
18
|
+
return false
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return true
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async get<T>(name: string, defaultValue?: T | (() => T | Promise<T>)): Promise<T | undefined> {
|
|
25
|
+
const cacheItem = this.cache.get(name)
|
|
26
|
+
|
|
27
|
+
if (!await this.has(name)) {
|
|
28
|
+
return this.getDefaultValue(defaultValue)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return cacheItem!.value as T
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// return (cacheItem as CacheItem<T>).value as T
|
|
35
|
+
async remember<T>(name: string, defaultValue?: T | (() => T | Promise<T>), durationInSeconds?: number): Promise<T | undefined> {
|
|
36
|
+
const cacheItem = this.cache.get(name)
|
|
37
|
+
|
|
38
|
+
if (await this.has(name)) {
|
|
39
|
+
return cacheItem!.value as T
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const value = await this.getDefaultValue(defaultValue)
|
|
43
|
+
await this.set(name, value, durationInSeconds)
|
|
44
|
+
return value
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async set(name: string, value: any, durationInSeconds?: number): Promise<void> {
|
|
48
|
+
const expirationTime = durationInSeconds ? Date.now() + durationInSeconds * 1000 : Infinity
|
|
49
|
+
|
|
50
|
+
this.cache.set(name, {
|
|
51
|
+
value: value,
|
|
52
|
+
date: expirationTime
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async delete(name: string): Promise<void> {
|
|
57
|
+
this.cache.delete(name)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async flush(): Promise<void> {
|
|
61
|
+
this.cache.clear()
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private async getDefaultValue<T>(defaultValue?: (() => (Promise<T> | T)) | T) {
|
|
65
|
+
const valueFunction = typeof defaultValue === 'function'
|
|
66
|
+
? defaultValue as () => Promise<T> | T
|
|
67
|
+
: () => defaultValue
|
|
68
|
+
|
|
69
|
+
return valueFunction()
|
|
70
|
+
}
|
|
71
|
+
}
|
package/Cache/index.ts
ADDED
package/Cache/types.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Constructor } from '../Support'
|
|
2
|
+
import { BaseResolver } from './Resolver'
|
|
3
|
+
import { InjectableMetadata, Scope } from './Metadata'
|
|
4
|
+
import { Container } from './Container'
|
|
5
|
+
import { ParametersTypesMetadata } from '@Typetron/Support/Metadata'
|
|
6
|
+
|
|
7
|
+
export class ClassResolver extends BaseResolver {
|
|
8
|
+
canResolve<T>(abstract: Constructor<T>): boolean {
|
|
9
|
+
return abstract.prototype && abstract.prototype.constructor.name
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
resolve<T>(abstract: Constructor<T>, parametersValues: object[]) {
|
|
13
|
+
|
|
14
|
+
// TODO improve this since it looks very hard to write next time
|
|
15
|
+
const parametersTypes: Constructor[] = ParametersTypesMetadata.get(abstract).parameters
|
|
16
|
+
?? (ParametersTypesMetadata.get(abstract).parameters = Reflect.getMetadata('design:paramtypes', abstract) ?? [])
|
|
17
|
+
|
|
18
|
+
const parameters = parametersTypes.map((parameterType, index) => {
|
|
19
|
+
if (parametersValues[index]) {
|
|
20
|
+
return parametersValues[index]
|
|
21
|
+
}
|
|
22
|
+
if (parameterType.name === 'Object' && parametersValues[index]) {
|
|
23
|
+
parameterType = parametersValues[index] as Constructor // || this.getParameterValue(abstract, index);
|
|
24
|
+
}
|
|
25
|
+
return this.container.get(parameterType)
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const instance = new abstract(...parameters)
|
|
29
|
+
|
|
30
|
+
const metadata = InjectableMetadata.get(abstract)
|
|
31
|
+
let asyncDependencies = 0
|
|
32
|
+
let resolve: (value: T | PromiseLike<T>) => void
|
|
33
|
+
let reject: (reason?: unknown) => void
|
|
34
|
+
for (const dependency in metadata.dependencies) {
|
|
35
|
+
const dependencyAbstract = metadata.dependencies[dependency]
|
|
36
|
+
if (!dependencyAbstract) {
|
|
37
|
+
continue
|
|
38
|
+
}
|
|
39
|
+
const value = this.container.get(dependencyAbstract) as T[keyof T]
|
|
40
|
+
if (value instanceof Promise) {
|
|
41
|
+
asyncDependencies++
|
|
42
|
+
value
|
|
43
|
+
.then((resolvedValue) => {
|
|
44
|
+
instance[dependency as keyof T] = resolvedValue
|
|
45
|
+
asyncDependencies--
|
|
46
|
+
if (!asyncDependencies) {
|
|
47
|
+
resolve(instance)
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
.catch((error) => {
|
|
51
|
+
reject(error)
|
|
52
|
+
})
|
|
53
|
+
} else {
|
|
54
|
+
instance[dependency as keyof T] = value
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (asyncDependencies) {
|
|
58
|
+
return new Promise<T>((resolveFunction, rejectFunction) => {
|
|
59
|
+
resolve = resolveFunction
|
|
60
|
+
reject = rejectFunction
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return instance
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// TODO figure out how to use this better
|
|
68
|
+
// private getParameterValue<T>(abstract: Constructor<T>, index: number) {
|
|
69
|
+
// const injectMetadata = Reflect.getMetadata('container:inject', abstract);
|
|
70
|
+
// if (!injectMetadata) {
|
|
71
|
+
// throw new Error(`No binding found for parameter ${index} in '${abstract.name}'`);
|
|
72
|
+
// }
|
|
73
|
+
// const value = injectMetadata.find((metadata: any) => metadata.index === index);
|
|
74
|
+
// return value.abstract;
|
|
75
|
+
// }
|
|
76
|
+
|
|
77
|
+
reload<T>(
|
|
78
|
+
abstract: Constructor<T>,
|
|
79
|
+
concrete: T,
|
|
80
|
+
container: Container = this.container
|
|
81
|
+
): T {
|
|
82
|
+
const metadata = InjectableMetadata.get(abstract)
|
|
83
|
+
for (const dependencyName in metadata.dependencies) {
|
|
84
|
+
if (!metadata.dependencies[dependencyName]) {
|
|
85
|
+
continue
|
|
86
|
+
}
|
|
87
|
+
const dependency = metadata.dependencies[dependencyName]
|
|
88
|
+
if (!dependency) {
|
|
89
|
+
continue
|
|
90
|
+
}
|
|
91
|
+
if (typeof dependency === 'symbol') {
|
|
92
|
+
concrete[dependencyName as keyof T] = container.get(
|
|
93
|
+
dependency
|
|
94
|
+
) as T[keyof T]
|
|
95
|
+
continue
|
|
96
|
+
}
|
|
97
|
+
const dependencyMetadata = InjectableMetadata.get(dependency)
|
|
98
|
+
if (dependencyMetadata.scope === Scope.REQUEST) {
|
|
99
|
+
concrete[dependencyName as keyof T] = container.get(
|
|
100
|
+
dependency
|
|
101
|
+
) as T[keyof T]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return concrete
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { Constructor, Type } from '../Support'
|
|
2
|
+
import { ClassResolver } from './ClassResolver'
|
|
3
|
+
import { ServiceIdentifier } from './Contracts'
|
|
4
|
+
import { InjectableMetadata, Scope } from './Metadata'
|
|
5
|
+
import { Resolver } from './Resolver'
|
|
6
|
+
|
|
7
|
+
export class Container {
|
|
8
|
+
protected static instance: Container
|
|
9
|
+
|
|
10
|
+
// TODO performance: get rid of this
|
|
11
|
+
public resolvers: Resolver[] = [
|
|
12
|
+
new ClassResolver(this)
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
// tslint:disable-next-line:no-any
|
|
16
|
+
protected instances = new Map<ServiceIdentifier<any>, any>()
|
|
17
|
+
|
|
18
|
+
public parent?: Container
|
|
19
|
+
|
|
20
|
+
static getInstance() {
|
|
21
|
+
if (!Container.instance) {
|
|
22
|
+
Container.instance = new Container()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return Container.instance
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static setInstance(container: Container) {
|
|
29
|
+
return Container.instance = container
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getInstances() {
|
|
33
|
+
return this.instances
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
set<T>(abstract: ServiceIdentifier<T>, concrete: T | Type<T> | (() => void)) {
|
|
37
|
+
this.instances.set(abstract, concrete)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated
|
|
42
|
+
*/
|
|
43
|
+
forceSet<T>(abstract: ServiceIdentifier<T>, concrete: T | Type<T> | (() => any)) {
|
|
44
|
+
this.set(abstract, concrete)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// tslint:disable-next-line:no-any
|
|
48
|
+
get<T>(abstract: ServiceIdentifier<T>, parameters: any[] = []): T {
|
|
49
|
+
const metadata = this.getMetadata(abstract)
|
|
50
|
+
|
|
51
|
+
if (metadata.scope === Scope.TRANSIENT) {
|
|
52
|
+
return this.getResolver(abstract, metadata).resolve(abstract, parameters) as T
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
let concrete = this.getInstance(abstract)
|
|
56
|
+
if (concrete) {
|
|
57
|
+
return concrete
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// if (this.parent && metadata.scope !== Scope.REQUEST
|
|
61
|
+
// && (concrete = this.parent.getInstance(abstract) ?? this.parent.get(abstract))
|
|
62
|
+
// ) {
|
|
63
|
+
// return concrete
|
|
64
|
+
// }
|
|
65
|
+
|
|
66
|
+
if (this.parent && metadata.scope !== Scope.REQUEST && (concrete = this.parent.getInstance(abstract))) {
|
|
67
|
+
return concrete
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (typeof abstract === 'string') {
|
|
71
|
+
const instance = this.getInstance<T>(abstract) as T
|
|
72
|
+
if (!instance) {
|
|
73
|
+
throw new Error(`No instance found for '${this.getAbstractName(abstract)}'`)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const resolver = this.getResolver(abstract, metadata)
|
|
78
|
+
concrete = resolver.resolve(abstract, parameters) as T
|
|
79
|
+
this.set(abstract, concrete)
|
|
80
|
+
return concrete
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
createChildContainer(): Container {
|
|
84
|
+
const childContainer = new Container()
|
|
85
|
+
childContainer.parent = this
|
|
86
|
+
childContainer.set(Container, childContainer)
|
|
87
|
+
// TODO performance: get rid of this
|
|
88
|
+
childContainer.resolvers = this.resolvers.map(resolver => {
|
|
89
|
+
return new (resolver.constructor as Constructor<Resolver>)(childContainer)
|
|
90
|
+
})
|
|
91
|
+
return childContainer
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private getMetadata<T>(abstract: ServiceIdentifier<T>) {
|
|
95
|
+
if (abstract instanceof Object) {
|
|
96
|
+
return InjectableMetadata.get(abstract)
|
|
97
|
+
}
|
|
98
|
+
return new InjectableMetadata
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private getAbstractName<T>(abstract: ServiceIdentifier<T>): string {
|
|
102
|
+
if (typeof abstract === 'string') {
|
|
103
|
+
return abstract
|
|
104
|
+
}
|
|
105
|
+
if (abstract === undefined) {
|
|
106
|
+
throw new Error(`
|
|
107
|
+
Cannot resolve a parameter having the value undefined.
|
|
108
|
+
This might be due to circular dependencies in your app
|
|
109
|
+
`)
|
|
110
|
+
}
|
|
111
|
+
if (typeof abstract === 'symbol') {
|
|
112
|
+
return abstract.toString()
|
|
113
|
+
}
|
|
114
|
+
if ('name' in abstract) {
|
|
115
|
+
return abstract.name
|
|
116
|
+
}
|
|
117
|
+
throw new Error(`Cannot get abstract name for ${abstract}`)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
private getResolver<T>(abstract: ServiceIdentifier<T>, metadata: InjectableMetadata) {
|
|
121
|
+
let resolver = metadata.resolver
|
|
122
|
+
if (!resolver) {
|
|
123
|
+
resolver = this.resolvers.find(item => item.canResolve(abstract))
|
|
124
|
+
}
|
|
125
|
+
if (!resolver) {
|
|
126
|
+
throw new Error(`Resolver not found for '${this.getAbstractName(abstract)}'`)
|
|
127
|
+
}
|
|
128
|
+
this.setResolverForAbstract(abstract, resolver, metadata)
|
|
129
|
+
resolver.container = this
|
|
130
|
+
return resolver
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
private setResolverForAbstract<T>(abstract: ServiceIdentifier<T>, resolver: Resolver, metadata: InjectableMetadata) {
|
|
134
|
+
if (typeof abstract === 'symbol') {
|
|
135
|
+
return
|
|
136
|
+
}
|
|
137
|
+
metadata.resolver = resolver
|
|
138
|
+
InjectableMetadata.set(metadata, abstract)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private getInstance<T>(abstract: ServiceIdentifier<T>): T | undefined {
|
|
142
|
+
return this.instances.get(abstract) || this.parent?.getInstance(abstract)
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ServiceIdentifier } from './Contracts'
|
|
2
|
+
import { InjectableMetadata, Scope } from './Metadata'
|
|
3
|
+
|
|
4
|
+
export function Injectable(scope: Scope = Scope.SINGLETON) {
|
|
5
|
+
return function <T extends Function>(target: T) {
|
|
6
|
+
const metadata = InjectableMetadata.get(target)
|
|
7
|
+
metadata.scope = scope
|
|
8
|
+
InjectableMetadata.set(metadata, target)
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function Inject<T extends Object>(abstract?: ServiceIdentifier<T>) {
|
|
13
|
+
return function (target: T, targetKey: string, index?: number) {
|
|
14
|
+
const fieldType = Reflect.getMetadata('design:type', target, targetKey) as ServiceIdentifier<T>
|
|
15
|
+
const metadata = InjectableMetadata.get(target.constructor)
|
|
16
|
+
metadata.dependencies[targetKey] = abstract ?? fieldType
|
|
17
|
+
InjectableMetadata.set(metadata, target.constructor)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Resolver } from './Resolver'
|
|
2
|
+
import { ServiceIdentifier } from './Contracts'
|
|
3
|
+
import { MetadataKey } from '../Support/Metadata'
|
|
4
|
+
|
|
5
|
+
export enum Scope {
|
|
6
|
+
TRANSIENT = 'TRANSIENT',
|
|
7
|
+
SINGLETON = 'SINGLETON',
|
|
8
|
+
REQUEST = 'REQUEST',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class InjectableMetadata extends MetadataKey('injectable') {
|
|
12
|
+
resolver?: Resolver
|
|
13
|
+
|
|
14
|
+
scope: Scope = Scope.SINGLETON
|
|
15
|
+
dependencies: {[key: string]: ServiceIdentifier<{}>} = {}
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Container } from './Container'
|
|
2
|
+
import { ServiceIdentifier } from './Contracts'
|
|
3
|
+
|
|
4
|
+
export interface Resolver {
|
|
5
|
+
container: Container;
|
|
6
|
+
|
|
7
|
+
canResolve<T>(abstract: ServiceIdentifier<T>): boolean;
|
|
8
|
+
|
|
9
|
+
resolve<T>(abstract: ServiceIdentifier<T>, parameters: object[]): T | Promise<T>;
|
|
10
|
+
|
|
11
|
+
reload<T>(abstract: ServiceIdentifier<T>, concrete: T, container?: Container): T;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export abstract class BaseResolver implements Resolver {
|
|
15
|
+
constructor(public container: Container) {}
|
|
16
|
+
|
|
17
|
+
abstract canResolve<T>(abstract: ServiceIdentifier<T>): boolean;
|
|
18
|
+
|
|
19
|
+
abstract resolve<T>(abstract: ServiceIdentifier<T>, parameters: object[]): T | Promise<T>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Used to update the dependencies that have the REQUEST scope
|
|
23
|
+
*/
|
|
24
|
+
reload<T>(abstract: ServiceIdentifier<T>, concrete: T, container?: Container): T {
|
|
25
|
+
return concrete
|
|
26
|
+
}
|
|
27
|
+
}
|
|
File without changes
|