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