@ug.software/opposer 3.0.10
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 +504 -0
- package/lib/bin/commands/build.js +75 -0
- package/lib/bin/commands/generate/api-key.js +28 -0
- package/lib/bin/commands/generate/jwt-key.js +46 -0
- package/lib/bin/commands/init.js +169 -0
- package/lib/bin/helpers/crypto.js +33 -0
- package/lib/bin/opposer.js +26 -0
- package/lib/cjs/examples/full-app/index.d.ts +1 -0
- package/lib/cjs/examples/full-app/index.js +102 -0
- package/lib/cjs/examples/full-app/models/author.d.ts +7 -0
- package/lib/cjs/examples/full-app/models/author.js +42 -0
- package/lib/cjs/examples/full-app/models/book.d.ts +9 -0
- package/lib/cjs/examples/full-app/models/book.js +51 -0
- package/lib/cjs/examples/full-app/models/category.d.ts +4 -0
- package/lib/cjs/examples/full-app/models/category.js +26 -0
- package/lib/cjs/examples/full-app/schedules/catalog-refresh.d.ts +28 -0
- package/lib/cjs/examples/full-app/schedules/catalog-refresh.js +149 -0
- package/lib/cjs/examples/full-app/schedules/inventory-sync.d.ts +12 -0
- package/lib/cjs/examples/full-app/schedules/inventory-sync.js +61 -0
- package/lib/cjs/examples/full-app/schedules/library-alerts.d.ts +11 -0
- package/lib/cjs/examples/full-app/schedules/library-alerts.js +55 -0
- package/lib/cjs/examples/minimal/src/handlers/book.d.ts +11 -0
- package/lib/cjs/examples/minimal/src/handlers/book.js +51 -0
- package/lib/cjs/examples/minimal/src/index.d.ts +1 -0
- package/lib/cjs/examples/minimal/src/index.js +14 -0
- package/lib/cjs/examples/minimal/src/models/books.d.ts +4 -0
- package/lib/cjs/examples/minimal/src/models/books.js +26 -0
- package/lib/cjs/examples/orm/models/permission.d.ts +6 -0
- package/lib/cjs/examples/orm/models/permission.js +38 -0
- package/lib/cjs/examples/orm/models/profile.d.ts +7 -0
- package/lib/cjs/examples/orm/models/profile.js +42 -0
- package/lib/cjs/examples/orm/models/user.d.ts +11 -0
- package/lib/cjs/examples/orm/models/user.js +70 -0
- package/lib/cjs/examples/orm/mysql/index.d.ts +1 -0
- package/lib/cjs/examples/orm/mysql/index.js +44 -0
- package/lib/cjs/examples/orm/postgres/index.d.ts +1 -0
- package/lib/cjs/examples/orm/postgres/index.js +40 -0
- package/lib/cjs/examples/orm/sqlite/index.d.ts +1 -0
- package/lib/cjs/examples/orm/sqlite/index.js +41 -0
- package/lib/cjs/index.d.ts +2 -0
- package/lib/cjs/index.js +23 -0
- package/lib/cjs/interfaces/controller.d.ts +109 -0
- package/lib/cjs/interfaces/controller.js +2 -0
- package/lib/cjs/interfaces/field.d.ts +23 -0
- package/lib/cjs/interfaces/field.js +2 -0
- package/lib/cjs/interfaces/handler.d.ts +18 -0
- package/lib/cjs/interfaces/handler.js +2 -0
- package/lib/cjs/interfaces/jwt.d.ts +21 -0
- package/lib/cjs/interfaces/jwt.js +2 -0
- package/lib/cjs/interfaces/model.d.ts +9 -0
- package/lib/cjs/interfaces/model.js +2 -0
- package/lib/cjs/interfaces/request.d.ts +13 -0
- package/lib/cjs/interfaces/request.js +2 -0
- package/lib/cjs/interfaces/schema.d.ts +9 -0
- package/lib/cjs/interfaces/schema.js +2 -0
- package/lib/cjs/interfaces/security.d.ts +32 -0
- package/lib/cjs/interfaces/security.js +2 -0
- package/lib/cjs/interfaces/server.d.ts +37 -0
- package/lib/cjs/interfaces/server.js +2 -0
- package/lib/cjs/interfaces/system.d.ts +41 -0
- package/lib/cjs/interfaces/system.js +2 -0
- package/lib/cjs/orm/decorators/index.d.ts +33 -0
- package/lib/cjs/orm/decorators/index.js +131 -0
- package/lib/cjs/orm/driver/mysql.d.ts +14 -0
- package/lib/cjs/orm/driver/mysql.js +103 -0
- package/lib/cjs/orm/driver/postgres.d.ts +14 -0
- package/lib/cjs/orm/driver/postgres.js +105 -0
- package/lib/cjs/orm/driver/sqlite.d.ts +14 -0
- package/lib/cjs/orm/driver/sqlite.js +143 -0
- package/lib/cjs/orm/index.d.ts +8 -0
- package/lib/cjs/orm/index.js +28 -0
- package/lib/cjs/orm/metadata.d.ts +47 -0
- package/lib/cjs/orm/metadata.js +47 -0
- package/lib/cjs/orm/opposer.d.ts +30 -0
- package/lib/cjs/orm/opposer.js +33 -0
- package/lib/cjs/orm/query-builder.d.ts +32 -0
- package/lib/cjs/orm/query-builder.js +278 -0
- package/lib/cjs/orm/repository.d.ts +54 -0
- package/lib/cjs/orm/repository.js +325 -0
- package/lib/cjs/orm/validation.d.ts +44 -0
- package/lib/cjs/orm/validation.js +128 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/persistent/cache/core-context.d.ts +17 -0
- package/lib/cjs/persistent/cache/core-context.js +39 -0
- package/lib/cjs/persistent/cache/global.d.ts +18 -0
- package/lib/cjs/persistent/cache/global.js +22 -0
- package/lib/cjs/persistent/cache/index.d.ts +3 -0
- package/lib/cjs/persistent/cache/index.js +12 -0
- package/lib/cjs/persistent/cache/session.d.ts +19 -0
- package/lib/cjs/persistent/cache/session.js +39 -0
- package/lib/cjs/persistent/cache/storage.d.ts +14 -0
- package/lib/cjs/persistent/cache/storage.js +88 -0
- package/lib/cjs/persistent/cache/store.d.ts +16 -0
- package/lib/cjs/persistent/cache/store.js +112 -0
- package/lib/cjs/persistent/context/index.d.ts +3 -0
- package/lib/cjs/persistent/context/index.js +5 -0
- package/lib/cjs/persistent/decorators/global.d.ts +1 -0
- package/lib/cjs/persistent/decorators/global.js +25 -0
- package/lib/cjs/persistent/decorators/session.d.ts +1 -0
- package/lib/cjs/persistent/decorators/session.js +27 -0
- package/lib/cjs/persistent/index.d.ts +6 -0
- package/lib/cjs/persistent/index.js +18 -0
- package/lib/cjs/persistent/interfaces/context.d.ts +5 -0
- package/lib/cjs/persistent/interfaces/context.js +2 -0
- package/lib/cjs/persistent/interfaces/system.d.ts +47 -0
- package/lib/cjs/persistent/interfaces/system.js +29 -0
- package/lib/cjs/persistent/system/index.d.ts +7 -0
- package/lib/cjs/persistent/system/index.js +44 -0
- package/lib/cjs/persistent/utils/memory.d.ts +8 -0
- package/lib/cjs/persistent/utils/memory.js +44 -0
- package/lib/cjs/persistent/utils/timer.d.ts +14 -0
- package/lib/cjs/persistent/utils/timer.js +21 -0
- package/lib/cjs/playground/build/client/assets/AddRounded-ByHfnsiW.js +4 -0
- package/lib/cjs/playground/build/client/assets/Button-DLrxHRm7.js +1 -0
- package/lib/cjs/playground/build/client/assets/Container-CgITmmbk.js +1 -0
- package/lib/cjs/playground/build/client/assets/Divider-B_Wx9srO.js +1 -0
- package/lib/cjs/playground/build/client/assets/List-juBjUmfP.js +1 -0
- package/lib/cjs/playground/build/client/assets/ListItemText-DgWZmgzc.js +1 -0
- package/lib/cjs/playground/build/client/assets/MenuItem-D_5SuVKQ.js +1 -0
- package/lib/cjs/playground/build/client/assets/Modal-BwXR_5Bh.js +1 -0
- package/lib/cjs/playground/build/client/assets/TableRow-B9hAmlnV.js +2 -0
- package/lib/cjs/playground/build/client/assets/TextField-UybdTIGB.js +3 -0
- package/lib/cjs/playground/build/client/assets/Tooltip-BGcUWUcF.js +1 -0
- package/lib/cjs/playground/build/client/assets/auth-CD1rXHzz.js +1 -0
- package/lib/cjs/playground/build/client/assets/auth-GyTIVKy5.js +1 -0
- package/lib/cjs/playground/build/client/assets/confirm-Dr0pbiV6.js +1 -0
- package/lib/cjs/playground/build/client/assets/dividerClasses-CIiqeEPO.js +1 -0
- package/lib/cjs/playground/build/client/assets/entry.client-D6FYz1yh.js +13 -0
- package/lib/cjs/playground/build/client/assets/index-CJ0wdt6Z.js +1 -0
- package/lib/cjs/playground/build/client/assets/index-CQc11yq_.js +1153 -0
- package/lib/cjs/playground/build/client/assets/index-Cr4I-4J2.js +1 -0
- package/lib/cjs/playground/build/client/assets/index-CtPqstFl.js +26 -0
- package/lib/cjs/playground/build/client/assets/index-Ct_NE85o.js +1 -0
- package/lib/cjs/playground/build/client/assets/index-D0I6xwmb.js +1 -0
- package/lib/cjs/playground/build/client/assets/index-DmDCpKb3.js +1 -0
- package/lib/cjs/playground/build/client/assets/index-DsSkAwyn.js +1 -0
- package/lib/cjs/playground/build/client/assets/index-_DMgWZ3Y.js +1 -0
- package/lib/cjs/playground/build/client/assets/listItemIconClasses-39Itzgzt.js +1 -0
- package/lib/cjs/playground/build/client/assets/listItemTextClasses-EQFLPLzt.js +1 -0
- package/lib/cjs/playground/build/client/assets/manifest-c06e9a7f.js +1 -0
- package/lib/cjs/playground/build/client/assets/mergeSlotProps-DptgQgAT.js +1 -0
- package/lib/cjs/playground/build/client/assets/playground-Hl52p9f5.js +108 -0
- package/lib/cjs/playground/build/client/assets/root-CQTBmuv8.js +1 -0
- package/lib/cjs/playground/build/client/assets/toast-CsAH5FIf.js +1 -0
- package/lib/cjs/playground/build/client/assets/use-request-BZNkzlTr.js +1 -0
- package/lib/cjs/playground/build/client/favicon.ico +0 -0
- package/lib/cjs/playground/build/client/index.html +6 -0
- package/lib/cjs/playground/index.d.ts +2 -0
- package/lib/cjs/playground/index.js +135 -0
- package/lib/cjs/scheduler/controllers/index.d.ts +19 -0
- package/lib/cjs/scheduler/controllers/index.js +62 -0
- package/lib/cjs/scheduler/decorators/index.d.ts +9 -0
- package/lib/cjs/scheduler/decorators/index.js +21 -0
- package/lib/cjs/scheduler/handlers/index.d.ts +19 -0
- package/lib/cjs/scheduler/handlers/index.js +62 -0
- package/lib/cjs/scheduler/index.d.ts +24 -0
- package/lib/cjs/scheduler/index.js +110 -0
- package/lib/cjs/scheduler/models/history.d.ts +10 -0
- package/lib/cjs/scheduler/models/history.js +50 -0
- package/lib/cjs/server/constants/index.d.ts +78 -0
- package/lib/cjs/server/constants/index.js +372 -0
- package/lib/cjs/server/context/index.d.ts +17 -0
- package/lib/cjs/server/context/index.js +33 -0
- package/lib/cjs/server/controller/index.d.ts +3 -0
- package/lib/cjs/server/controller/index.js +217 -0
- package/lib/cjs/server/controllers/index.d.ts +5 -0
- package/lib/cjs/server/controllers/index.js +72 -0
- package/lib/cjs/server/core/index.d.ts +16 -0
- package/lib/cjs/server/core/index.js +110 -0
- package/lib/cjs/server/core/middleware/body-parser.d.ts +2 -0
- package/lib/cjs/server/core/middleware/body-parser.js +27 -0
- package/lib/cjs/server/core/middleware/cors.d.ts +4 -0
- package/lib/cjs/server/core/middleware/cors.js +32 -0
- package/lib/cjs/server/core/middleware/logger.d.ts +2 -0
- package/lib/cjs/server/core/middleware/logger.js +15 -0
- package/lib/cjs/server/decorators/controller.d.ts +3 -0
- package/lib/cjs/server/decorators/controller.js +14 -0
- package/lib/cjs/server/decorators/field.d.ts +2 -0
- package/lib/cjs/server/decorators/field.js +36 -0
- package/lib/cjs/server/decorators/handler.d.ts +3 -0
- package/lib/cjs/server/decorators/handler.js +14 -0
- package/lib/cjs/server/decorators/index.d.ts +7 -0
- package/lib/cjs/server/decorators/index.js +26 -0
- package/lib/cjs/server/decorators/is-public-method.d.ts +3 -0
- package/lib/cjs/server/decorators/is-public-method.js +16 -0
- package/lib/cjs/server/decorators/is-public.d.ts +3 -0
- package/lib/cjs/server/decorators/is-public.js +14 -0
- package/lib/cjs/server/decorators/method.d.ts +3 -0
- package/lib/cjs/server/decorators/method.js +16 -0
- package/lib/cjs/server/decorators/payload.d.ts +3 -0
- package/lib/cjs/server/decorators/payload.js +15 -0
- package/lib/cjs/server/handlers/index.d.ts +5 -0
- package/lib/cjs/server/handlers/index.js +72 -0
- package/lib/cjs/server/helpers/index.d.ts +17 -0
- package/lib/cjs/server/helpers/index.js +39 -0
- package/lib/cjs/server/index.d.ts +12 -0
- package/lib/cjs/server/index.js +176 -0
- package/lib/cjs/server/security/controller/auth.d.ts +76 -0
- package/lib/cjs/server/security/controller/auth.js +346 -0
- package/lib/cjs/server/security/index.d.ts +2 -0
- package/lib/cjs/server/security/index.js +10 -0
- package/lib/cjs/server/security/jwt/index.d.ts +23 -0
- package/lib/cjs/server/security/jwt/index.js +108 -0
- package/lib/cjs/server/security/middleware/autorization.d.ts +3 -0
- package/lib/cjs/server/security/middleware/autorization.js +46 -0
- package/lib/cjs/server/security/middleware/permission.d.ts +3 -0
- package/lib/cjs/server/security/middleware/permission.js +138 -0
- package/lib/cjs/server/security/models/crp.d.ts +8 -0
- package/lib/cjs/server/security/models/crp.js +42 -0
- package/lib/cjs/server/security/models/ke.d.ts +7 -0
- package/lib/cjs/server/security/models/ke.js +38 -0
- package/lib/cjs/server/security/models/rl.d.ts +9 -0
- package/lib/cjs/server/security/models/rl.js +50 -0
- package/lib/cjs/server/security/models/se.d.ts +11 -0
- package/lib/cjs/server/security/models/se.js +54 -0
- package/lib/cjs/server/security/models/usr.d.ts +14 -0
- package/lib/cjs/server/security/models/usr.js +82 -0
- package/lib/cjs/server/services/delete.d.ts +13 -0
- package/lib/cjs/server/services/delete.js +49 -0
- package/lib/cjs/server/services/get.d.ts +4 -0
- package/lib/cjs/server/services/get.js +145 -0
- package/lib/cjs/server/services/insert.d.ts +13 -0
- package/lib/cjs/server/services/insert.js +74 -0
- package/lib/cjs/server/services/update.d.ts +13 -0
- package/lib/cjs/server/services/update.js +60 -0
- package/lib/cjs/system/index.d.ts +13 -0
- package/lib/cjs/system/index.js +237 -0
- package/lib/esm/examples/full-app/index.d.ts +1 -0
- package/lib/esm/examples/full-app/index.js +64 -0
- package/lib/esm/examples/full-app/models/author.d.ts +7 -0
- package/lib/esm/examples/full-app/models/author.js +37 -0
- package/lib/esm/examples/full-app/models/book.d.ts +9 -0
- package/lib/esm/examples/full-app/models/book.js +46 -0
- package/lib/esm/examples/full-app/models/category.d.ts +4 -0
- package/lib/esm/examples/full-app/models/category.js +24 -0
- package/lib/esm/examples/full-app/schedules/catalog-refresh.d.ts +28 -0
- package/lib/esm/examples/full-app/schedules/catalog-refresh.js +143 -0
- package/lib/esm/examples/full-app/schedules/inventory-sync.d.ts +12 -0
- package/lib/esm/examples/full-app/schedules/inventory-sync.js +55 -0
- package/lib/esm/examples/full-app/schedules/library-alerts.d.ts +11 -0
- package/lib/esm/examples/full-app/schedules/library-alerts.js +52 -0
- package/lib/esm/examples/minimal/src/handlers/book.d.ts +11 -0
- package/lib/esm/examples/minimal/src/handlers/book.js +49 -0
- package/lib/esm/examples/minimal/src/index.d.ts +1 -0
- package/lib/esm/examples/minimal/src/index.js +9 -0
- package/lib/esm/examples/minimal/src/models/books.d.ts +4 -0
- package/lib/esm/examples/minimal/src/models/books.js +24 -0
- package/lib/esm/examples/orm/models/permission.d.ts +6 -0
- package/lib/esm/examples/orm/models/permission.js +33 -0
- package/lib/esm/examples/orm/models/profile.d.ts +7 -0
- package/lib/esm/examples/orm/models/profile.js +37 -0
- package/lib/esm/examples/orm/models/user.d.ts +11 -0
- package/lib/esm/examples/orm/models/user.js +65 -0
- package/lib/esm/examples/orm/mysql/index.d.ts +1 -0
- package/lib/esm/examples/orm/mysql/index.js +39 -0
- package/lib/esm/examples/orm/postgres/index.d.ts +1 -0
- package/lib/esm/examples/orm/postgres/index.js +35 -0
- package/lib/esm/examples/orm/sqlite/index.d.ts +1 -0
- package/lib/esm/examples/orm/sqlite/index.js +36 -0
- package/lib/esm/index.d.ts +2 -0
- package/lib/esm/index.js +2 -0
- package/lib/esm/interfaces/controller.d.ts +109 -0
- package/lib/esm/interfaces/controller.js +1 -0
- package/lib/esm/interfaces/field.d.ts +23 -0
- package/lib/esm/interfaces/field.js +1 -0
- package/lib/esm/interfaces/handler.d.ts +18 -0
- package/lib/esm/interfaces/handler.js +1 -0
- package/lib/esm/interfaces/jwt.d.ts +21 -0
- package/lib/esm/interfaces/jwt.js +1 -0
- package/lib/esm/interfaces/model.d.ts +9 -0
- package/lib/esm/interfaces/model.js +1 -0
- package/lib/esm/interfaces/request.d.ts +13 -0
- package/lib/esm/interfaces/request.js +1 -0
- package/lib/esm/interfaces/schema.d.ts +9 -0
- package/lib/esm/interfaces/schema.js +1 -0
- package/lib/esm/interfaces/security.d.ts +32 -0
- package/lib/esm/interfaces/security.js +1 -0
- package/lib/esm/interfaces/server.d.ts +37 -0
- package/lib/esm/interfaces/server.js +1 -0
- package/lib/esm/interfaces/system.d.ts +41 -0
- package/lib/esm/interfaces/system.js +1 -0
- package/lib/esm/orm/decorators/index.d.ts +33 -0
- package/lib/esm/orm/decorators/index.js +118 -0
- package/lib/esm/orm/driver/mysql.d.ts +14 -0
- package/lib/esm/orm/driver/mysql.js +66 -0
- package/lib/esm/orm/driver/postgres.d.ts +14 -0
- package/lib/esm/orm/driver/postgres.js +68 -0
- package/lib/esm/orm/driver/sqlite.d.ts +14 -0
- package/lib/esm/orm/driver/sqlite.js +106 -0
- package/lib/esm/orm/index.d.ts +8 -0
- package/lib/esm/orm/index.js +8 -0
- package/lib/esm/orm/metadata.d.ts +47 -0
- package/lib/esm/orm/metadata.js +43 -0
- package/lib/esm/orm/opposer.d.ts +30 -0
- package/lib/esm/orm/opposer.js +29 -0
- package/lib/esm/orm/query-builder.d.ts +32 -0
- package/lib/esm/orm/query-builder.js +274 -0
- package/lib/esm/orm/repository.d.ts +54 -0
- package/lib/esm/orm/repository.js +318 -0
- package/lib/esm/orm/validation.d.ts +44 -0
- package/lib/esm/orm/validation.js +122 -0
- package/lib/esm/persistent/cache/core-context.d.ts +17 -0
- package/lib/esm/persistent/cache/core-context.js +34 -0
- package/lib/esm/persistent/cache/global.d.ts +18 -0
- package/lib/esm/persistent/cache/global.js +17 -0
- package/lib/esm/persistent/cache/index.d.ts +3 -0
- package/lib/esm/persistent/cache/index.js +3 -0
- package/lib/esm/persistent/cache/session.d.ts +19 -0
- package/lib/esm/persistent/cache/session.js +34 -0
- package/lib/esm/persistent/cache/storage.d.ts +14 -0
- package/lib/esm/persistent/cache/storage.js +82 -0
- package/lib/esm/persistent/cache/store.d.ts +16 -0
- package/lib/esm/persistent/cache/store.js +106 -0
- package/lib/esm/persistent/context/index.d.ts +3 -0
- package/lib/esm/persistent/context/index.js +3 -0
- package/lib/esm/persistent/decorators/global.d.ts +1 -0
- package/lib/esm/persistent/decorators/global.js +19 -0
- package/lib/esm/persistent/decorators/session.d.ts +1 -0
- package/lib/esm/persistent/decorators/session.js +21 -0
- package/lib/esm/persistent/index.d.ts +6 -0
- package/lib/esm/persistent/index.js +6 -0
- package/lib/esm/persistent/interfaces/context.d.ts +5 -0
- package/lib/esm/persistent/interfaces/context.js +1 -0
- package/lib/esm/persistent/interfaces/system.d.ts +47 -0
- package/lib/esm/persistent/interfaces/system.js +26 -0
- package/lib/esm/persistent/system/index.d.ts +7 -0
- package/lib/esm/persistent/system/index.js +39 -0
- package/lib/esm/persistent/utils/memory.d.ts +8 -0
- package/lib/esm/persistent/utils/memory.js +42 -0
- package/lib/esm/persistent/utils/timer.d.ts +14 -0
- package/lib/esm/persistent/utils/timer.js +16 -0
- package/lib/esm/playground/build/client/assets/AddRounded-ByHfnsiW.js +4 -0
- package/lib/esm/playground/build/client/assets/Button-DLrxHRm7.js +1 -0
- package/lib/esm/playground/build/client/assets/Container-CgITmmbk.js +1 -0
- package/lib/esm/playground/build/client/assets/Divider-B_Wx9srO.js +1 -0
- package/lib/esm/playground/build/client/assets/List-juBjUmfP.js +1 -0
- package/lib/esm/playground/build/client/assets/ListItemText-DgWZmgzc.js +1 -0
- package/lib/esm/playground/build/client/assets/MenuItem-D_5SuVKQ.js +1 -0
- package/lib/esm/playground/build/client/assets/Modal-BwXR_5Bh.js +1 -0
- package/lib/esm/playground/build/client/assets/TableRow-B9hAmlnV.js +2 -0
- package/lib/esm/playground/build/client/assets/TextField-UybdTIGB.js +3 -0
- package/lib/esm/playground/build/client/assets/Tooltip-BGcUWUcF.js +1 -0
- package/lib/esm/playground/build/client/assets/auth-CD1rXHzz.js +1 -0
- package/lib/esm/playground/build/client/assets/auth-GyTIVKy5.js +1 -0
- package/lib/esm/playground/build/client/assets/confirm-Dr0pbiV6.js +1 -0
- package/lib/esm/playground/build/client/assets/dividerClasses-CIiqeEPO.js +1 -0
- package/lib/esm/playground/build/client/assets/entry.client-D6FYz1yh.js +13 -0
- package/lib/esm/playground/build/client/assets/index-CJ0wdt6Z.js +1 -0
- package/lib/esm/playground/build/client/assets/index-CQc11yq_.js +1153 -0
- package/lib/esm/playground/build/client/assets/index-Cr4I-4J2.js +1 -0
- package/lib/esm/playground/build/client/assets/index-CtPqstFl.js +26 -0
- package/lib/esm/playground/build/client/assets/index-Ct_NE85o.js +1 -0
- package/lib/esm/playground/build/client/assets/index-D0I6xwmb.js +1 -0
- package/lib/esm/playground/build/client/assets/index-DmDCpKb3.js +1 -0
- package/lib/esm/playground/build/client/assets/index-DsSkAwyn.js +1 -0
- package/lib/esm/playground/build/client/assets/index-_DMgWZ3Y.js +1 -0
- package/lib/esm/playground/build/client/assets/listItemIconClasses-39Itzgzt.js +1 -0
- package/lib/esm/playground/build/client/assets/listItemTextClasses-EQFLPLzt.js +1 -0
- package/lib/esm/playground/build/client/assets/manifest-c06e9a7f.js +1 -0
- package/lib/esm/playground/build/client/assets/mergeSlotProps-DptgQgAT.js +1 -0
- package/lib/esm/playground/build/client/assets/playground-Hl52p9f5.js +108 -0
- package/lib/esm/playground/build/client/assets/root-CQTBmuv8.js +1 -0
- package/lib/esm/playground/build/client/assets/toast-CsAH5FIf.js +1 -0
- package/lib/esm/playground/build/client/assets/use-request-BZNkzlTr.js +1 -0
- package/lib/esm/playground/build/client/favicon.ico +0 -0
- package/lib/esm/playground/build/client/index.html +6 -0
- package/lib/esm/playground/index.d.ts +2 -0
- package/lib/esm/playground/index.js +129 -0
- package/lib/esm/scheduler/controllers/index.d.ts +19 -0
- package/lib/esm/scheduler/controllers/index.js +57 -0
- package/lib/esm/scheduler/decorators/index.d.ts +9 -0
- package/lib/esm/scheduler/decorators/index.js +16 -0
- package/lib/esm/scheduler/handlers/index.d.ts +19 -0
- package/lib/esm/scheduler/handlers/index.js +57 -0
- package/lib/esm/scheduler/index.d.ts +24 -0
- package/lib/esm/scheduler/index.js +89 -0
- package/lib/esm/scheduler/models/history.d.ts +10 -0
- package/lib/esm/scheduler/models/history.js +48 -0
- package/lib/esm/server/constants/index.d.ts +78 -0
- package/lib/esm/server/constants/index.js +369 -0
- package/lib/esm/server/context/index.d.ts +17 -0
- package/lib/esm/server/context/index.js +31 -0
- package/lib/esm/server/controller/index.d.ts +3 -0
- package/lib/esm/server/controller/index.js +179 -0
- package/lib/esm/server/controllers/index.d.ts +5 -0
- package/lib/esm/server/controllers/index.js +31 -0
- package/lib/esm/server/core/index.d.ts +16 -0
- package/lib/esm/server/core/index.js +103 -0
- package/lib/esm/server/core/middleware/body-parser.d.ts +2 -0
- package/lib/esm/server/core/middleware/body-parser.js +24 -0
- package/lib/esm/server/core/middleware/cors.d.ts +4 -0
- package/lib/esm/server/core/middleware/cors.js +29 -0
- package/lib/esm/server/core/middleware/logger.d.ts +2 -0
- package/lib/esm/server/core/middleware/logger.js +12 -0
- package/lib/esm/server/decorators/controller.d.ts +3 -0
- package/lib/esm/server/decorators/controller.js +10 -0
- package/lib/esm/server/decorators/field.d.ts +2 -0
- package/lib/esm/server/decorators/field.js +32 -0
- package/lib/esm/server/decorators/handler.d.ts +3 -0
- package/lib/esm/server/decorators/handler.js +10 -0
- package/lib/esm/server/decorators/index.d.ts +7 -0
- package/lib/esm/server/decorators/index.js +7 -0
- package/lib/esm/server/decorators/is-public-method.d.ts +3 -0
- package/lib/esm/server/decorators/is-public-method.js +12 -0
- package/lib/esm/server/decorators/is-public.d.ts +3 -0
- package/lib/esm/server/decorators/is-public.js +10 -0
- package/lib/esm/server/decorators/method.d.ts +3 -0
- package/lib/esm/server/decorators/method.js +12 -0
- package/lib/esm/server/decorators/payload.d.ts +3 -0
- package/lib/esm/server/decorators/payload.js +11 -0
- package/lib/esm/server/handlers/index.d.ts +5 -0
- package/lib/esm/server/handlers/index.js +31 -0
- package/lib/esm/server/helpers/index.d.ts +17 -0
- package/lib/esm/server/helpers/index.js +34 -0
- package/lib/esm/server/index.d.ts +12 -0
- package/lib/esm/server/index.js +147 -0
- package/lib/esm/server/security/controller/auth.d.ts +76 -0
- package/lib/esm/server/security/controller/auth.js +341 -0
- package/lib/esm/server/security/index.d.ts +2 -0
- package/lib/esm/server/security/index.js +2 -0
- package/lib/esm/server/security/jwt/index.d.ts +23 -0
- package/lib/esm/server/security/jwt/index.js +103 -0
- package/lib/esm/server/security/middleware/autorization.d.ts +3 -0
- package/lib/esm/server/security/middleware/autorization.js +41 -0
- package/lib/esm/server/security/middleware/permission.d.ts +3 -0
- package/lib/esm/server/security/middleware/permission.js +133 -0
- package/lib/esm/server/security/models/crp.d.ts +8 -0
- package/lib/esm/server/security/models/crp.js +40 -0
- package/lib/esm/server/security/models/ke.d.ts +7 -0
- package/lib/esm/server/security/models/ke.js +36 -0
- package/lib/esm/server/security/models/rl.d.ts +9 -0
- package/lib/esm/server/security/models/rl.js +45 -0
- package/lib/esm/server/security/models/se.d.ts +11 -0
- package/lib/esm/server/security/models/se.js +52 -0
- package/lib/esm/server/security/models/usr.d.ts +14 -0
- package/lib/esm/server/security/models/usr.js +77 -0
- package/lib/esm/server/services/delete.d.ts +13 -0
- package/lib/esm/server/services/delete.js +44 -0
- package/lib/esm/server/services/get.d.ts +4 -0
- package/lib/esm/server/services/get.js +140 -0
- package/lib/esm/server/services/insert.d.ts +13 -0
- package/lib/esm/server/services/insert.js +69 -0
- package/lib/esm/server/services/update.d.ts +13 -0
- package/lib/esm/server/services/update.js +55 -0
- package/lib/esm/system/index.d.ts +13 -0
- package/lib/esm/system/index.js +197 -0
- package/package.json +95 -0
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
// Enum só com códigos
|
|
2
|
+
export var HttpStatusCode;
|
|
3
|
+
(function (HttpStatusCode) {
|
|
4
|
+
HttpStatusCode[HttpStatusCode["Continue"] = 100] = "Continue";
|
|
5
|
+
HttpStatusCode[HttpStatusCode["SwitchingProtocols"] = 101] = "SwitchingProtocols";
|
|
6
|
+
HttpStatusCode[HttpStatusCode["Processing"] = 102] = "Processing";
|
|
7
|
+
HttpStatusCode[HttpStatusCode["EarlyHints"] = 103] = "EarlyHints";
|
|
8
|
+
HttpStatusCode[HttpStatusCode["OK"] = 200] = "OK";
|
|
9
|
+
HttpStatusCode[HttpStatusCode["Created"] = 201] = "Created";
|
|
10
|
+
HttpStatusCode[HttpStatusCode["Accepted"] = 202] = "Accepted";
|
|
11
|
+
HttpStatusCode[HttpStatusCode["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
|
|
12
|
+
HttpStatusCode[HttpStatusCode["NoContent"] = 204] = "NoContent";
|
|
13
|
+
HttpStatusCode[HttpStatusCode["ResetContent"] = 205] = "ResetContent";
|
|
14
|
+
HttpStatusCode[HttpStatusCode["PartialContent"] = 206] = "PartialContent";
|
|
15
|
+
HttpStatusCode[HttpStatusCode["MultiStatus"] = 207] = "MultiStatus";
|
|
16
|
+
HttpStatusCode[HttpStatusCode["AlreadyReported"] = 208] = "AlreadyReported";
|
|
17
|
+
HttpStatusCode[HttpStatusCode["IMUsed"] = 226] = "IMUsed";
|
|
18
|
+
HttpStatusCode[HttpStatusCode["MultipleChoices"] = 300] = "MultipleChoices";
|
|
19
|
+
HttpStatusCode[HttpStatusCode["MovedPermanently"] = 301] = "MovedPermanently";
|
|
20
|
+
HttpStatusCode[HttpStatusCode["Found"] = 302] = "Found";
|
|
21
|
+
HttpStatusCode[HttpStatusCode["SeeOther"] = 303] = "SeeOther";
|
|
22
|
+
HttpStatusCode[HttpStatusCode["NotModified"] = 304] = "NotModified";
|
|
23
|
+
HttpStatusCode[HttpStatusCode["UseProxy"] = 305] = "UseProxy";
|
|
24
|
+
HttpStatusCode[HttpStatusCode["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
|
25
|
+
HttpStatusCode[HttpStatusCode["PermanentRedirect"] = 308] = "PermanentRedirect";
|
|
26
|
+
HttpStatusCode[HttpStatusCode["BadRequest"] = 400] = "BadRequest";
|
|
27
|
+
HttpStatusCode[HttpStatusCode["Unauthorized"] = 401] = "Unauthorized";
|
|
28
|
+
HttpStatusCode[HttpStatusCode["PaymentRequired"] = 402] = "PaymentRequired";
|
|
29
|
+
HttpStatusCode[HttpStatusCode["Forbidden"] = 403] = "Forbidden";
|
|
30
|
+
HttpStatusCode[HttpStatusCode["NotFound"] = 404] = "NotFound";
|
|
31
|
+
HttpStatusCode[HttpStatusCode["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
|
32
|
+
HttpStatusCode[HttpStatusCode["NotAcceptable"] = 406] = "NotAcceptable";
|
|
33
|
+
HttpStatusCode[HttpStatusCode["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
|
|
34
|
+
HttpStatusCode[HttpStatusCode["RequestTimeout"] = 408] = "RequestTimeout";
|
|
35
|
+
HttpStatusCode[HttpStatusCode["Conflict"] = 409] = "Conflict";
|
|
36
|
+
HttpStatusCode[HttpStatusCode["Gone"] = 410] = "Gone";
|
|
37
|
+
HttpStatusCode[HttpStatusCode["LengthRequired"] = 411] = "LengthRequired";
|
|
38
|
+
HttpStatusCode[HttpStatusCode["PreconditionFailed"] = 412] = "PreconditionFailed";
|
|
39
|
+
HttpStatusCode[HttpStatusCode["PayloadTooLarge"] = 413] = "PayloadTooLarge";
|
|
40
|
+
HttpStatusCode[HttpStatusCode["URITooLong"] = 414] = "URITooLong";
|
|
41
|
+
HttpStatusCode[HttpStatusCode["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
|
|
42
|
+
HttpStatusCode[HttpStatusCode["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
|
|
43
|
+
HttpStatusCode[HttpStatusCode["ExpectationFailed"] = 417] = "ExpectationFailed";
|
|
44
|
+
HttpStatusCode[HttpStatusCode["ImATeapot"] = 418] = "ImATeapot";
|
|
45
|
+
HttpStatusCode[HttpStatusCode["MisdirectedRequest"] = 421] = "MisdirectedRequest";
|
|
46
|
+
HttpStatusCode[HttpStatusCode["UnprocessableEntity"] = 422] = "UnprocessableEntity";
|
|
47
|
+
HttpStatusCode[HttpStatusCode["Locked"] = 423] = "Locked";
|
|
48
|
+
HttpStatusCode[HttpStatusCode["FailedDependency"] = 424] = "FailedDependency";
|
|
49
|
+
HttpStatusCode[HttpStatusCode["TooEarly"] = 425] = "TooEarly";
|
|
50
|
+
HttpStatusCode[HttpStatusCode["UpgradeRequired"] = 426] = "UpgradeRequired";
|
|
51
|
+
HttpStatusCode[HttpStatusCode["PreconditionRequired"] = 428] = "PreconditionRequired";
|
|
52
|
+
HttpStatusCode[HttpStatusCode["TooManyRequests"] = 429] = "TooManyRequests";
|
|
53
|
+
HttpStatusCode[HttpStatusCode["RequestHeaderFieldsTooLarge"] = 431] = "RequestHeaderFieldsTooLarge";
|
|
54
|
+
HttpStatusCode[HttpStatusCode["UnavailableForLegalReasons"] = 451] = "UnavailableForLegalReasons";
|
|
55
|
+
HttpStatusCode[HttpStatusCode["InternalServerError"] = 500] = "InternalServerError";
|
|
56
|
+
HttpStatusCode[HttpStatusCode["NotImplemented"] = 501] = "NotImplemented";
|
|
57
|
+
HttpStatusCode[HttpStatusCode["BadGateway"] = 502] = "BadGateway";
|
|
58
|
+
HttpStatusCode[HttpStatusCode["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
|
59
|
+
HttpStatusCode[HttpStatusCode["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
60
|
+
HttpStatusCode[HttpStatusCode["HTTPVersionNotSupported"] = 505] = "HTTPVersionNotSupported";
|
|
61
|
+
HttpStatusCode[HttpStatusCode["VariantAlsoNegotiates"] = 506] = "VariantAlsoNegotiates";
|
|
62
|
+
HttpStatusCode[HttpStatusCode["InsufficientStorage"] = 507] = "InsufficientStorage";
|
|
63
|
+
HttpStatusCode[HttpStatusCode["LoopDetected"] = 508] = "LoopDetected";
|
|
64
|
+
HttpStatusCode[HttpStatusCode["NotExtended"] = 510] = "NotExtended";
|
|
65
|
+
HttpStatusCode[HttpStatusCode["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
|
|
66
|
+
})(HttpStatusCode || (HttpStatusCode = {}));
|
|
67
|
+
// Map auxiliar para obter name e category
|
|
68
|
+
export const HttpStatus = {
|
|
69
|
+
[HttpStatusCode.Continue]: {
|
|
70
|
+
code: 100,
|
|
71
|
+
name: "Continue",
|
|
72
|
+
category: "Informational",
|
|
73
|
+
},
|
|
74
|
+
[HttpStatusCode.SwitchingProtocols]: {
|
|
75
|
+
code: 101,
|
|
76
|
+
name: "SwitchingProtocols",
|
|
77
|
+
category: "Informational",
|
|
78
|
+
},
|
|
79
|
+
[HttpStatusCode.Processing]: {
|
|
80
|
+
code: 102,
|
|
81
|
+
name: "Processing",
|
|
82
|
+
category: "Informational",
|
|
83
|
+
},
|
|
84
|
+
[HttpStatusCode.EarlyHints]: {
|
|
85
|
+
code: 103,
|
|
86
|
+
name: "EarlyHints",
|
|
87
|
+
category: "Informational",
|
|
88
|
+
},
|
|
89
|
+
[HttpStatusCode.OK]: { code: 200, name: "OK", category: "Success" },
|
|
90
|
+
[HttpStatusCode.Created]: { code: 201, name: "Created", category: "Success" },
|
|
91
|
+
[HttpStatusCode.Accepted]: {
|
|
92
|
+
code: 202,
|
|
93
|
+
name: "Accepted",
|
|
94
|
+
category: "Success",
|
|
95
|
+
},
|
|
96
|
+
[HttpStatusCode.NonAuthoritativeInformation]: {
|
|
97
|
+
code: 203,
|
|
98
|
+
name: "NonAuthoritativeInformation",
|
|
99
|
+
category: "Success",
|
|
100
|
+
},
|
|
101
|
+
[HttpStatusCode.NoContent]: {
|
|
102
|
+
code: 204,
|
|
103
|
+
name: "NoContent",
|
|
104
|
+
category: "Success",
|
|
105
|
+
},
|
|
106
|
+
[HttpStatusCode.ResetContent]: {
|
|
107
|
+
code: 205,
|
|
108
|
+
name: "ResetContent",
|
|
109
|
+
category: "Success",
|
|
110
|
+
},
|
|
111
|
+
[HttpStatusCode.PartialContent]: {
|
|
112
|
+
code: 206,
|
|
113
|
+
name: "PartialContent",
|
|
114
|
+
category: "Success",
|
|
115
|
+
},
|
|
116
|
+
[HttpStatusCode.MultiStatus]: {
|
|
117
|
+
code: 207,
|
|
118
|
+
name: "MultiStatus",
|
|
119
|
+
category: "Success",
|
|
120
|
+
},
|
|
121
|
+
[HttpStatusCode.AlreadyReported]: {
|
|
122
|
+
code: 208,
|
|
123
|
+
name: "AlreadyReported",
|
|
124
|
+
category: "Success",
|
|
125
|
+
},
|
|
126
|
+
[HttpStatusCode.IMUsed]: { code: 226, name: "IMUsed", category: "Success" },
|
|
127
|
+
[HttpStatusCode.MultipleChoices]: {
|
|
128
|
+
code: 300,
|
|
129
|
+
name: "MultipleChoices",
|
|
130
|
+
category: "Redirection",
|
|
131
|
+
},
|
|
132
|
+
[HttpStatusCode.MovedPermanently]: {
|
|
133
|
+
code: 301,
|
|
134
|
+
name: "MovedPermanently",
|
|
135
|
+
category: "Redirection",
|
|
136
|
+
},
|
|
137
|
+
[HttpStatusCode.Found]: { code: 302, name: "Found", category: "Redirection" },
|
|
138
|
+
[HttpStatusCode.SeeOther]: {
|
|
139
|
+
code: 303,
|
|
140
|
+
name: "SeeOther",
|
|
141
|
+
category: "Redirection",
|
|
142
|
+
},
|
|
143
|
+
[HttpStatusCode.NotModified]: {
|
|
144
|
+
code: 304,
|
|
145
|
+
name: "NotModified",
|
|
146
|
+
category: "Redirection",
|
|
147
|
+
},
|
|
148
|
+
[HttpStatusCode.UseProxy]: {
|
|
149
|
+
code: 305,
|
|
150
|
+
name: "UseProxy",
|
|
151
|
+
category: "Redirection",
|
|
152
|
+
},
|
|
153
|
+
[HttpStatusCode.TemporaryRedirect]: {
|
|
154
|
+
code: 307,
|
|
155
|
+
name: "TemporaryRedirect",
|
|
156
|
+
category: "Redirection",
|
|
157
|
+
},
|
|
158
|
+
[HttpStatusCode.PermanentRedirect]: {
|
|
159
|
+
code: 308,
|
|
160
|
+
name: "PermanentRedirect",
|
|
161
|
+
category: "Redirection",
|
|
162
|
+
},
|
|
163
|
+
[HttpStatusCode.BadRequest]: {
|
|
164
|
+
code: 400,
|
|
165
|
+
name: "BadRequest",
|
|
166
|
+
category: "Client Error",
|
|
167
|
+
},
|
|
168
|
+
[HttpStatusCode.Unauthorized]: {
|
|
169
|
+
code: 401,
|
|
170
|
+
name: "Unauthorized",
|
|
171
|
+
category: "Client Error",
|
|
172
|
+
},
|
|
173
|
+
[HttpStatusCode.PaymentRequired]: {
|
|
174
|
+
code: 402,
|
|
175
|
+
name: "PaymentRequired",
|
|
176
|
+
category: "Client Error",
|
|
177
|
+
},
|
|
178
|
+
[HttpStatusCode.Forbidden]: {
|
|
179
|
+
code: 403,
|
|
180
|
+
name: "Forbidden",
|
|
181
|
+
category: "Client Error",
|
|
182
|
+
},
|
|
183
|
+
[HttpStatusCode.NotFound]: {
|
|
184
|
+
code: 404,
|
|
185
|
+
name: "NotFound",
|
|
186
|
+
category: "Client Error",
|
|
187
|
+
},
|
|
188
|
+
[HttpStatusCode.MethodNotAllowed]: {
|
|
189
|
+
code: 405,
|
|
190
|
+
name: "MethodNotAllowed",
|
|
191
|
+
category: "Client Error",
|
|
192
|
+
},
|
|
193
|
+
[HttpStatusCode.NotAcceptable]: {
|
|
194
|
+
code: 406,
|
|
195
|
+
name: "NotAcceptable",
|
|
196
|
+
category: "Client Error",
|
|
197
|
+
},
|
|
198
|
+
[HttpStatusCode.ProxyAuthenticationRequired]: {
|
|
199
|
+
code: 407,
|
|
200
|
+
name: "ProxyAuthenticationRequired",
|
|
201
|
+
category: "Client Error",
|
|
202
|
+
},
|
|
203
|
+
[HttpStatusCode.RequestTimeout]: {
|
|
204
|
+
code: 408,
|
|
205
|
+
name: "RequestTimeout",
|
|
206
|
+
category: "Client Error",
|
|
207
|
+
},
|
|
208
|
+
[HttpStatusCode.Conflict]: {
|
|
209
|
+
code: 409,
|
|
210
|
+
name: "Conflict",
|
|
211
|
+
category: "Client Error",
|
|
212
|
+
},
|
|
213
|
+
[HttpStatusCode.Gone]: { code: 410, name: "Gone", category: "Client Error" },
|
|
214
|
+
[HttpStatusCode.LengthRequired]: {
|
|
215
|
+
code: 411,
|
|
216
|
+
name: "LengthRequired",
|
|
217
|
+
category: "Client Error",
|
|
218
|
+
},
|
|
219
|
+
[HttpStatusCode.PreconditionFailed]: {
|
|
220
|
+
code: 412,
|
|
221
|
+
name: "PreconditionFailed",
|
|
222
|
+
category: "Client Error",
|
|
223
|
+
},
|
|
224
|
+
[HttpStatusCode.PayloadTooLarge]: {
|
|
225
|
+
code: 413,
|
|
226
|
+
name: "PayloadTooLarge",
|
|
227
|
+
category: "Client Error",
|
|
228
|
+
},
|
|
229
|
+
[HttpStatusCode.URITooLong]: {
|
|
230
|
+
code: 414,
|
|
231
|
+
name: "URITooLong",
|
|
232
|
+
category: "Client Error",
|
|
233
|
+
},
|
|
234
|
+
[HttpStatusCode.UnsupportedMediaType]: {
|
|
235
|
+
code: 415,
|
|
236
|
+
name: "UnsupportedMediaType",
|
|
237
|
+
category: "Client Error",
|
|
238
|
+
},
|
|
239
|
+
[HttpStatusCode.RangeNotSatisfiable]: {
|
|
240
|
+
code: 416,
|
|
241
|
+
name: "RangeNotSatisfiable",
|
|
242
|
+
category: "Client Error",
|
|
243
|
+
},
|
|
244
|
+
[HttpStatusCode.ExpectationFailed]: {
|
|
245
|
+
code: 417,
|
|
246
|
+
name: "ExpectationFailed",
|
|
247
|
+
category: "Client Error",
|
|
248
|
+
},
|
|
249
|
+
[HttpStatusCode.ImATeapot]: {
|
|
250
|
+
code: 418,
|
|
251
|
+
name: "ImATeapot",
|
|
252
|
+
category: "Client Error",
|
|
253
|
+
},
|
|
254
|
+
[HttpStatusCode.MisdirectedRequest]: {
|
|
255
|
+
code: 421,
|
|
256
|
+
name: "MisdirectedRequest",
|
|
257
|
+
category: "Client Error",
|
|
258
|
+
},
|
|
259
|
+
[HttpStatusCode.UnprocessableEntity]: {
|
|
260
|
+
code: 422,
|
|
261
|
+
name: "UnprocessableEntity",
|
|
262
|
+
category: "Client Error",
|
|
263
|
+
},
|
|
264
|
+
[HttpStatusCode.Locked]: {
|
|
265
|
+
code: 423,
|
|
266
|
+
name: "Locked",
|
|
267
|
+
category: "Client Error",
|
|
268
|
+
},
|
|
269
|
+
[HttpStatusCode.FailedDependency]: {
|
|
270
|
+
code: 424,
|
|
271
|
+
name: "FailedDependency",
|
|
272
|
+
category: "Client Error",
|
|
273
|
+
},
|
|
274
|
+
[HttpStatusCode.TooEarly]: {
|
|
275
|
+
code: 425,
|
|
276
|
+
name: "TooEarly",
|
|
277
|
+
category: "Client Error",
|
|
278
|
+
},
|
|
279
|
+
[HttpStatusCode.UpgradeRequired]: {
|
|
280
|
+
code: 426,
|
|
281
|
+
name: "UpgradeRequired",
|
|
282
|
+
category: "Client Error",
|
|
283
|
+
},
|
|
284
|
+
[HttpStatusCode.PreconditionRequired]: {
|
|
285
|
+
code: 428,
|
|
286
|
+
name: "PreconditionRequired",
|
|
287
|
+
category: "Client Error",
|
|
288
|
+
},
|
|
289
|
+
[HttpStatusCode.TooManyRequests]: {
|
|
290
|
+
code: 429,
|
|
291
|
+
name: "TooManyRequests",
|
|
292
|
+
category: "Client Error",
|
|
293
|
+
},
|
|
294
|
+
[HttpStatusCode.RequestHeaderFieldsTooLarge]: {
|
|
295
|
+
code: 431,
|
|
296
|
+
name: "RequestHeaderFieldsTooLarge",
|
|
297
|
+
category: "Client Error",
|
|
298
|
+
},
|
|
299
|
+
[HttpStatusCode.UnavailableForLegalReasons]: {
|
|
300
|
+
code: 451,
|
|
301
|
+
name: "UnavailableForLegalReasons",
|
|
302
|
+
category: "Client Error",
|
|
303
|
+
},
|
|
304
|
+
[HttpStatusCode.InternalServerError]: {
|
|
305
|
+
code: 500,
|
|
306
|
+
name: "InternalServerError",
|
|
307
|
+
category: "Server Error",
|
|
308
|
+
},
|
|
309
|
+
[HttpStatusCode.NotImplemented]: {
|
|
310
|
+
code: 501,
|
|
311
|
+
name: "NotImplemented",
|
|
312
|
+
category: "Server Error",
|
|
313
|
+
},
|
|
314
|
+
[HttpStatusCode.BadGateway]: {
|
|
315
|
+
code: 502,
|
|
316
|
+
name: "BadGateway",
|
|
317
|
+
category: "Server Error",
|
|
318
|
+
},
|
|
319
|
+
[HttpStatusCode.ServiceUnavailable]: {
|
|
320
|
+
code: 503,
|
|
321
|
+
name: "ServiceUnavailable",
|
|
322
|
+
category: "Server Error",
|
|
323
|
+
},
|
|
324
|
+
[HttpStatusCode.GatewayTimeout]: {
|
|
325
|
+
code: 504,
|
|
326
|
+
name: "GatewayTimeout",
|
|
327
|
+
category: "Server Error",
|
|
328
|
+
},
|
|
329
|
+
[HttpStatusCode.HTTPVersionNotSupported]: {
|
|
330
|
+
code: 505,
|
|
331
|
+
name: "HTTPVersionNotSupported",
|
|
332
|
+
category: "Server Error",
|
|
333
|
+
},
|
|
334
|
+
[HttpStatusCode.VariantAlsoNegotiates]: {
|
|
335
|
+
code: 506,
|
|
336
|
+
name: "VariantAlsoNegotiates",
|
|
337
|
+
category: "Server Error",
|
|
338
|
+
},
|
|
339
|
+
[HttpStatusCode.InsufficientStorage]: {
|
|
340
|
+
code: 507,
|
|
341
|
+
name: "InsufficientStorage",
|
|
342
|
+
category: "Server Error",
|
|
343
|
+
},
|
|
344
|
+
[HttpStatusCode.LoopDetected]: {
|
|
345
|
+
code: 508,
|
|
346
|
+
name: "LoopDetected",
|
|
347
|
+
category: "Server Error",
|
|
348
|
+
},
|
|
349
|
+
[HttpStatusCode.NotExtended]: {
|
|
350
|
+
code: 510,
|
|
351
|
+
name: "NotExtended",
|
|
352
|
+
category: "Server Error",
|
|
353
|
+
},
|
|
354
|
+
[HttpStatusCode.NetworkAuthenticationRequired]: {
|
|
355
|
+
code: 511,
|
|
356
|
+
name: "NetworkAuthenticationRequired",
|
|
357
|
+
category: "Server Error",
|
|
358
|
+
},
|
|
359
|
+
};
|
|
360
|
+
export var Type;
|
|
361
|
+
(function (Type) {
|
|
362
|
+
Type["string"] = "string";
|
|
363
|
+
Type["number"] = "number";
|
|
364
|
+
Type["jsonb"] = "jsonb";
|
|
365
|
+
Type["boolean"] = "boolean";
|
|
366
|
+
Type["array"] = "array";
|
|
367
|
+
Type["date"] = "date";
|
|
368
|
+
Type["relation"] = "relation";
|
|
369
|
+
})(Type || (Type = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Specialized storage for Opposer Server Context.
|
|
3
|
+
* Manages global application state like database connections and model definitions.
|
|
4
|
+
*/
|
|
5
|
+
declare class ServerContext {
|
|
6
|
+
private static instance;
|
|
7
|
+
private data;
|
|
8
|
+
private constructor();
|
|
9
|
+
static getInstance(): ServerContext;
|
|
10
|
+
set<T>(key: string, value: T): void;
|
|
11
|
+
get<T>(key: string): T;
|
|
12
|
+
has(key: string): boolean;
|
|
13
|
+
delete(key: string): boolean;
|
|
14
|
+
clear(): void;
|
|
15
|
+
}
|
|
16
|
+
declare const _default: ServerContext;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Specialized storage for Opposer Server Context.
|
|
3
|
+
* Manages global application state like database connections and model definitions.
|
|
4
|
+
*/
|
|
5
|
+
class ServerContext {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.data = new Map();
|
|
8
|
+
}
|
|
9
|
+
static getInstance() {
|
|
10
|
+
if (!ServerContext.instance) {
|
|
11
|
+
ServerContext.instance = new ServerContext();
|
|
12
|
+
}
|
|
13
|
+
return ServerContext.instance;
|
|
14
|
+
}
|
|
15
|
+
set(key, value) {
|
|
16
|
+
this.data.set(key, value);
|
|
17
|
+
}
|
|
18
|
+
get(key) {
|
|
19
|
+
return this.data.get(key);
|
|
20
|
+
}
|
|
21
|
+
has(key) {
|
|
22
|
+
return this.data.has(key);
|
|
23
|
+
}
|
|
24
|
+
delete(key) {
|
|
25
|
+
return this.data.delete(key);
|
|
26
|
+
}
|
|
27
|
+
clear() {
|
|
28
|
+
this.data.clear();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export default ServerContext.getInstance();
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import _get from "../services/get.js";
|
|
2
|
+
import _insert from "../services/insert.js";
|
|
3
|
+
import _update from "../services/update.js";
|
|
4
|
+
import _delete from "../services/delete.js";
|
|
5
|
+
import { HttpStatus } from "../constants/index.js";
|
|
6
|
+
import system from "../../system/index.js";
|
|
7
|
+
import * as helper from "../controllers/index.js";
|
|
8
|
+
import Auth from "../security/controller/auth.js";
|
|
9
|
+
import { getPayloadMetadata } from "../decorators/payload.js";
|
|
10
|
+
import { Exception, validateData } from "../helpers/index.js";
|
|
11
|
+
import Context from "../context/index.js";
|
|
12
|
+
const settings = system.getSettingsFile();
|
|
13
|
+
export default async (req, res) => {
|
|
14
|
+
if (!req.body || typeof req.body !== 'object' || Object.keys(req.body).length === 0) {
|
|
15
|
+
return res.status(400).json({
|
|
16
|
+
...HttpStatus[400],
|
|
17
|
+
message: 'Request body is empty or invalid. Please provide a valid JSON payload.',
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
var props = req.body;
|
|
21
|
+
//controller method call
|
|
22
|
+
if (props.controller) {
|
|
23
|
+
var { method, payload, controller } = props;
|
|
24
|
+
if (!controller) {
|
|
25
|
+
return res.status(400).json({
|
|
26
|
+
...HttpStatus[400],
|
|
27
|
+
message: "Unable to identify controller name.",
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const customControllers = Context.get("controllers");
|
|
31
|
+
var controllers = await helper.loadControllers(customControllers);
|
|
32
|
+
if (settings.auth) {
|
|
33
|
+
var auth = {
|
|
34
|
+
methods: [
|
|
35
|
+
{ name: "register" },
|
|
36
|
+
{ name: "login" },
|
|
37
|
+
{ name: "refresh" },
|
|
38
|
+
{ name: "logout" },
|
|
39
|
+
{ name: "me" },
|
|
40
|
+
],
|
|
41
|
+
controller: Auth,
|
|
42
|
+
metadata: { name: "Auth" },
|
|
43
|
+
};
|
|
44
|
+
if (typeof settings.auth === "object" &&
|
|
45
|
+
settings.auth.exposeChangePassword) {
|
|
46
|
+
auth.methods.push(...[{ name: "changePassword" }, { name: "forgotPassword" }]);
|
|
47
|
+
}
|
|
48
|
+
Object.defineProperty(controllers, "Auth", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
configurable: true,
|
|
51
|
+
writable: true,
|
|
52
|
+
value: auth,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (!controllers[controller]) {
|
|
56
|
+
return res.status(400).json({
|
|
57
|
+
...HttpStatus[400],
|
|
58
|
+
message: "Impossible to find controller.",
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if (!method) {
|
|
62
|
+
return res.status(400).json({
|
|
63
|
+
...HttpStatus[400],
|
|
64
|
+
message: "Unable to identify method name.",
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
var __meta = controllers[controller];
|
|
68
|
+
if (!__meta.methods.find((x) => x.name === method)) {
|
|
69
|
+
return res.status(400).json({
|
|
70
|
+
...HttpStatus[400],
|
|
71
|
+
message: "Unable to find action method.",
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
var allDto = getPayloadMetadata(__meta.controller);
|
|
75
|
+
//realize validation dto
|
|
76
|
+
if (Array.isArray(allDto) && allDto.length > 0) {
|
|
77
|
+
var payloadMetadata = allDto.find((x) => x.name === method);
|
|
78
|
+
if (payloadMetadata) {
|
|
79
|
+
var erros = validateData(payloadMetadata.dto, payload);
|
|
80
|
+
if (Object.keys(erros).length > 0) {
|
|
81
|
+
res.status(400).json({
|
|
82
|
+
erros,
|
|
83
|
+
message: "Data not valid for method, verify erros and try again.",
|
|
84
|
+
});
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const data = payload;
|
|
91
|
+
payload = {
|
|
92
|
+
headers: {
|
|
93
|
+
accept: req.headers.accept,
|
|
94
|
+
autorization: req.headers.authorization,
|
|
95
|
+
contentType: req.headers["content-type"],
|
|
96
|
+
origin: req.headers.origin,
|
|
97
|
+
ip: req.ip,
|
|
98
|
+
referer: req.headers.referer,
|
|
99
|
+
userAgent: req.headers["user-agent"],
|
|
100
|
+
cookies: {
|
|
101
|
+
data: req.cookies,
|
|
102
|
+
set: (name, value, options) => {
|
|
103
|
+
res.cookie(name, value, options);
|
|
104
|
+
},
|
|
105
|
+
remove: (name, options) => {
|
|
106
|
+
res.clearCookie(name, options);
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
data,
|
|
111
|
+
};
|
|
112
|
+
var resultController = await new __meta.controller()[method](payload);
|
|
113
|
+
return res.status(200).json(resultController);
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
const error = err;
|
|
117
|
+
return res.status(400).json(Exception({
|
|
118
|
+
...HttpStatus[400],
|
|
119
|
+
message: error.message,
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//database request...
|
|
124
|
+
const customModels = Context.get("models");
|
|
125
|
+
var allModels = await system.getAllModels(customModels);
|
|
126
|
+
var model = allModels.find((x) => x.name.toLocaleLowerCase() === props.model.toLocaleLowerCase());
|
|
127
|
+
if (!model) {
|
|
128
|
+
res.status(400).json({
|
|
129
|
+
name: HttpStatus[400].name,
|
|
130
|
+
code: HttpStatus[400].code,
|
|
131
|
+
message: "Unable to identify Model.",
|
|
132
|
+
});
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
var result = {
|
|
136
|
+
success: false,
|
|
137
|
+
error: {
|
|
138
|
+
name: HttpStatus[400].name,
|
|
139
|
+
code: HttpStatus[400].code,
|
|
140
|
+
message: "Unable to identify Model",
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
if (!["get", "insert", "update", "delete"].includes(props.method)) {
|
|
144
|
+
result.error.message = "It was not possible to identify the method used.";
|
|
145
|
+
}
|
|
146
|
+
if (["insert", "update"].includes(props.method)) {
|
|
147
|
+
var erros = validateData(model.entity, props.data);
|
|
148
|
+
if (Object.keys(erros).length > 0) {
|
|
149
|
+
return res.status(400).json({
|
|
150
|
+
erros,
|
|
151
|
+
message: "Data not valid for method, verify erros and try again.",
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
switch (props.method) {
|
|
156
|
+
case "get":
|
|
157
|
+
var getBody = req.body;
|
|
158
|
+
result = await _get(getBody);
|
|
159
|
+
break;
|
|
160
|
+
case "insert":
|
|
161
|
+
var insertBody = req.body;
|
|
162
|
+
result = await _insert(insertBody);
|
|
163
|
+
break;
|
|
164
|
+
case "update":
|
|
165
|
+
var updateBody = req.body;
|
|
166
|
+
result = await _update(updateBody);
|
|
167
|
+
break;
|
|
168
|
+
case "delete":
|
|
169
|
+
var deleteBody = req.body;
|
|
170
|
+
result = await _delete(deleteBody);
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
if (result.success) {
|
|
174
|
+
res.status(HttpStatus[200].code).json(result.data);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
res.status(result.error.code).json(result.error);
|
|
178
|
+
return;
|
|
179
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ResultGetAllControllers } from "../../interfaces/controller.js";
|
|
2
|
+
import { ClassType } from "../../interfaces/system.js";
|
|
3
|
+
export declare function toKebabCase(str: string): string;
|
|
4
|
+
export declare function toCamelCase(str: string): string;
|
|
5
|
+
export declare function loadControllers(customControllers?: string | ClassType<unknown>[]): Promise<ResultGetAllControllers>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import system from "../../system/index.js";
|
|
2
|
+
import * as decorator from "../decorators/index.js";
|
|
3
|
+
const controllers = {};
|
|
4
|
+
export function toKebabCase(str) {
|
|
5
|
+
return str
|
|
6
|
+
.replace(/([a-z0-9])([A-Z])/g, "$1-$2") // adiciona hífen antes de maiúsculas
|
|
7
|
+
.replace(/([A-Z])([A-Z][a-z])/g, "$1-$2") // caso AAAa
|
|
8
|
+
.toLowerCase();
|
|
9
|
+
}
|
|
10
|
+
export function toCamelCase(str) {
|
|
11
|
+
return str
|
|
12
|
+
.toLowerCase()
|
|
13
|
+
.replace(/-([a-z0-9])/g, (_, char) => char.toUpperCase());
|
|
14
|
+
}
|
|
15
|
+
// function responsible per cache controllers in project;
|
|
16
|
+
export async function loadControllers(customControllers) {
|
|
17
|
+
var __allControllers = await system.getAllControllers(customControllers);
|
|
18
|
+
if (Array.isArray(__allControllers) && Object.keys(controllers).length === 0) {
|
|
19
|
+
return __allControllers.reduce((controllers, controller) => {
|
|
20
|
+
var controllerMetadata = decorator.getControllerMetadata(controller);
|
|
21
|
+
var methodsMetadata = decorator.getMethodMetadata(controller);
|
|
22
|
+
controllers[controllerMetadata.name] = {
|
|
23
|
+
metadata: controllerMetadata,
|
|
24
|
+
methods: Array.isArray(methodsMetadata) ? methodsMetadata : [],
|
|
25
|
+
controller: controller,
|
|
26
|
+
};
|
|
27
|
+
return controllers;
|
|
28
|
+
}, controllers);
|
|
29
|
+
}
|
|
30
|
+
return controllers;
|
|
31
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import http from 'http';
|
|
2
|
+
import { type Request, type Response, type NextFunction, OpposerServer as IOpposerServer } from '../../interfaces/server.js';
|
|
3
|
+
export { Request, Response, NextFunction };
|
|
4
|
+
export type Middleware = (req: Request, res: Response, next: NextFunction) => Promise<void> | void;
|
|
5
|
+
export declare class OpposerServer implements IOpposerServer {
|
|
6
|
+
private middlewares;
|
|
7
|
+
private settings;
|
|
8
|
+
constructor();
|
|
9
|
+
use(middleware: Middleware): this;
|
|
10
|
+
private runMiddlewares;
|
|
11
|
+
handleRequest(req: http.IncomingMessage, res: http.ServerResponse): Promise<void>;
|
|
12
|
+
private parseCookies;
|
|
13
|
+
listen(port: number, callback?: () => void): http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
|
14
|
+
}
|
|
15
|
+
declare const instance: OpposerServer;
|
|
16
|
+
export default instance;
|