lakutata 2.0.54 → 2.0.56

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.
Files changed (118) hide show
  1. package/com/cacher.cjs +1 -1
  2. package/com/cacher.d.ts +1 -1
  3. package/com/cacher.mjs +1 -1
  4. package/com/docker.d.ts +1 -1
  5. package/com/entrypoint.cjs +29 -11
  6. package/com/entrypoint.d.ts +11 -182
  7. package/com/entrypoint.mjs +12 -0
  8. package/decorator/asst.d.ts +1 -1
  9. package/decorator/ctrl.cjs +15 -5
  10. package/decorator/ctrl.d.ts +112 -10
  11. package/decorator/ctrl.mjs +11 -1
  12. package/decorator/di.d.ts +2 -2
  13. package/decorator/dto.d.ts +3 -3
  14. package/decorator/orm.d.ts +1 -1
  15. package/helper.cjs +13 -11
  16. package/helper.d.ts +1 -1
  17. package/helper.mjs +3 -1
  18. package/lakutata.cjs +18 -6
  19. package/lakutata.d.ts +7 -8
  20. package/lakutata.mjs +12 -0
  21. package/orm.d.ts +1 -1
  22. package/package.json +1 -1
  23. package/src/components/cacher/Cacher.cjs +1 -1
  24. package/src/components/cacher/Cacher.mjs +1 -1
  25. package/src/components/cacher/adapters/CreateFileCacheAdapter.cjs +1 -1
  26. package/src/components/cacher/adapters/CreateFileCacheAdapter.mjs +1 -1
  27. package/src/components/cacher/adapters/CreateMemcacheCacheAdapter.cjs +2 -2
  28. package/src/components/cacher/adapters/CreateMemcacheCacheAdapter.mjs +2 -2
  29. package/src/components/cacher/adapters/CreateMongoCacheAdapter.cjs +2 -2
  30. package/src/components/cacher/adapters/CreateMongoCacheAdapter.mjs +2 -2
  31. package/src/components/cacher/adapters/CreateMysqlCacheAdapter.cjs +2 -2
  32. package/src/components/cacher/adapters/CreateMysqlCacheAdapter.mjs +2 -2
  33. package/src/components/cacher/adapters/CreatePostgresCacheAdapter.cjs +2 -2
  34. package/src/components/cacher/adapters/CreatePostgresCacheAdapter.mjs +2 -2
  35. package/src/components/cacher/adapters/CreateRedisCacheAdapter.cjs +2 -2
  36. package/src/components/cacher/adapters/CreateRedisCacheAdapter.mjs +2 -2
  37. package/src/components/cacher/adapters/CreateSqliteCacheAdapter.cjs +2 -2
  38. package/src/components/cacher/adapters/CreateSqliteCacheAdapter.mjs +2 -2
  39. package/src/components/entrypoint/Entrypoint.cjs +1074 -973
  40. package/src/components/entrypoint/Entrypoint.mjs +884 -781
  41. package/src/components/entrypoint/exceptions/AccessDenyException.cjs +35 -0
  42. package/src/components/entrypoint/exceptions/AccessDenyException.mjs +29 -0
  43. package/src/components/entrypoint/exceptions/DuplicateActionNameException.cjs +34 -0
  44. package/src/components/entrypoint/exceptions/DuplicateActionNameException.mjs +28 -0
  45. package/src/components/entrypoint/lib/AccessControl.cjs +247 -0
  46. package/src/components/entrypoint/lib/AccessControl.mjs +241 -0
  47. package/src/components/entrypoint/lib/AccessControlRule.cjs +163 -0
  48. package/src/components/entrypoint/lib/AccessControlRule.mjs +157 -0
  49. package/src/decorators/ctrl/CLIAction.cjs +17 -10
  50. package/src/decorators/ctrl/CLIAction.mjs +17 -10
  51. package/src/decorators/ctrl/HTTPAction.cjs +18 -11
  52. package/src/decorators/ctrl/HTTPAction.mjs +16 -9
  53. package/src/decorators/ctrl/ServiceAction.cjs +15 -8
  54. package/src/decorators/ctrl/ServiceAction.mjs +16 -9
  55. package/src/decorators/ctrl/http/DELETE.cjs +13 -3
  56. package/src/decorators/ctrl/http/DELETE.mjs +13 -3
  57. package/src/decorators/ctrl/http/GET.cjs +13 -3
  58. package/src/decorators/ctrl/http/GET.mjs +13 -3
  59. package/src/decorators/ctrl/http/HEAD.cjs +13 -3
  60. package/src/decorators/ctrl/http/HEAD.mjs +13 -3
  61. package/src/decorators/ctrl/http/OPTIONS.cjs +13 -3
  62. package/src/decorators/ctrl/http/OPTIONS.mjs +13 -3
  63. package/src/decorators/ctrl/http/PATCH.cjs +13 -3
  64. package/src/decorators/ctrl/http/PATCH.mjs +13 -3
  65. package/src/decorators/ctrl/http/POST.cjs +13 -3
  66. package/src/decorators/ctrl/http/POST.mjs +13 -3
  67. package/src/decorators/ctrl/http/PUT.cjs +13 -3
  68. package/src/decorators/ctrl/http/PUT.mjs +13 -3
  69. package/src/lib/base/internal/ActionOptions.cjs +79 -0
  70. package/src/lib/base/internal/ActionOptions.mjs +73 -0
  71. package/src/lib/base/internal/ControllerEntrypoint.cjs +625 -53
  72. package/src/lib/base/internal/ControllerEntrypoint.mjs +640 -68
  73. package/src/lib/base/internal/GetActionDTOAndOptions.cjs +89 -0
  74. package/src/lib/base/internal/GetActionDTOAndOptions.mjs +83 -0
  75. package/src/lib/base/internal/StringifyPattern.cjs +69 -0
  76. package/src/lib/base/internal/StringifyPattern.mjs +63 -0
  77. package/src/lib/core/Application.cjs +29 -17
  78. package/src/lib/core/Application.mjs +33 -21
  79. package/src/lib/helpers/MD5.cjs +1 -1
  80. package/src/lib/helpers/MD5.mjs +1 -1
  81. package/src/lib/helpers/SHA1.cjs +1 -1
  82. package/src/lib/helpers/SHA1.mjs +1 -1
  83. package/src/lib/helpers/SHA256.cjs +1 -1
  84. package/src/lib/helpers/SHA256.mjs +1 -1
  85. package/src/lib/helpers/SortArray.cjs +18 -201
  86. package/src/lib/helpers/SortArray.mjs +17 -200
  87. package/vendor/Package.19.cjs +85 -90
  88. package/vendor/Package.19.mjs +1 -1
  89. package/vendor/Package.3.cjs +1 -1
  90. package/vendor/Package.3.mjs +1 -1
  91. package/vendor/Package.610.cjs +85 -103
  92. package/vendor/Package.610.mjs +80 -98
  93. package/vendor/Package.611.cjs +100 -121
  94. package/vendor/Package.611.mjs +97 -120
  95. package/vendor/Package.612.cjs +196 -0
  96. package/vendor/Package.612.mjs +180 -0
  97. package/vendor/Package.64.cjs +140 -4118
  98. package/vendor/Package.64.mjs +140 -4126
  99. package/vendor/Package.65.cjs +4142 -692
  100. package/vendor/Package.65.mjs +4151 -689
  101. package/vendor/Package.66.cjs +571 -535
  102. package/vendor/Package.66.mjs +586 -528
  103. package/vendor/Package.67.cjs +633 -96
  104. package/vendor/Package.67.mjs +619 -94
  105. package/vendor/Package.68.cjs +96 -294
  106. package/vendor/Package.68.mjs +95 -295
  107. package/vendor/Package.69.cjs +297 -113
  108. package/vendor/Package.69.mjs +285 -97
  109. package/vendor/TypeDef.10.d.ts +13 -2
  110. package/vendor/TypeDef.11.d.ts +6 -5
  111. package/vendor/TypeDef.12.d.ts +104 -4
  112. package/vendor/TypeDef.13.d.ts +315 -62
  113. package/vendor/TypeDef.3.d.ts +2 -2
  114. package/vendor/TypeDef.5.d.ts +1 -1
  115. package/vendor/TypeDef.7.d.ts +19 -10
  116. package/vendor/TypeDef.8.d.ts +2 -20
  117. package/vendor/TypeDef.9.d.ts +5 -2
  118. package/vendor/TypeDef.14.d.ts +0 -72
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, {
4
+ value: "Module"
5
+ });
6
+
7
+ const e = require("../../../lib/base/abstracts/Exception.cjs");
8
+
9
+ require("../../../lib/base/internal/BasicInfo.cjs");
10
+
11
+ require("../../../lib/helpers/As.cjs");
12
+
13
+ require("../../../../vendor/Package.6.cjs");
14
+
15
+ require("../../../../vendor/Package.5.cjs");
16
+
17
+ require("../../../../vendor/Package.7.cjs");
18
+
19
+ require("../../../lib/base/internal/ThrowWarning.cjs");
20
+
21
+ require("../../../lib/helpers/Templating.cjs");
22
+
23
+ require("../../../lib/base/internal/CamelCase.cjs");
24
+
25
+ require("../../../lib/helpers/NoCase.cjs");
26
+
27
+ class AccessDenyException extends e.Exception {
28
+ constructor() {
29
+ super(...arguments);
30
+ this.errno = "E_ACCESS_DENY";
31
+ this.message = "Access denied";
32
+ }
33
+ }
34
+
35
+ exports.AccessDenyException = AccessDenyException;
@@ -0,0 +1,29 @@
1
+ import { Exception as e } from "../../../lib/base/abstracts/Exception.mjs";
2
+
3
+ import "../../../lib/base/internal/BasicInfo.mjs";
4
+
5
+ import "../../../lib/helpers/As.mjs";
6
+
7
+ import "../../../../vendor/Package.6.mjs";
8
+
9
+ import "../../../../vendor/Package.5.mjs";
10
+
11
+ import "../../../../vendor/Package.7.mjs";
12
+
13
+ import "../../../lib/base/internal/ThrowWarning.mjs";
14
+
15
+ import "../../../lib/helpers/Templating.mjs";
16
+
17
+ import "../../../lib/base/internal/CamelCase.mjs";
18
+
19
+ import "../../../lib/helpers/NoCase.mjs";
20
+
21
+ class AccessDenyException extends e {
22
+ constructor() {
23
+ super(...arguments);
24
+ this.errno = "E_ACCESS_DENY";
25
+ this.message = "Access denied";
26
+ }
27
+ }
28
+
29
+ export { AccessDenyException };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, {
4
+ value: "Module"
5
+ });
6
+
7
+ const e = require("../../../lib/base/abstracts/Exception.cjs");
8
+
9
+ require("../../../lib/base/internal/BasicInfo.cjs");
10
+
11
+ require("../../../lib/helpers/As.cjs");
12
+
13
+ require("../../../../vendor/Package.6.cjs");
14
+
15
+ require("../../../../vendor/Package.5.cjs");
16
+
17
+ require("../../../../vendor/Package.7.cjs");
18
+
19
+ require("../../../lib/base/internal/ThrowWarning.cjs");
20
+
21
+ require("../../../lib/helpers/Templating.cjs");
22
+
23
+ require("../../../lib/base/internal/CamelCase.cjs");
24
+
25
+ require("../../../lib/helpers/NoCase.cjs");
26
+
27
+ class DuplicateActionNameException extends e.Exception {
28
+ constructor() {
29
+ super(...arguments);
30
+ this.errno = "E_DUPLICATE_ACTION_NAME";
31
+ }
32
+ }
33
+
34
+ exports.DuplicateActionNameException = DuplicateActionNameException;
@@ -0,0 +1,28 @@
1
+ import { Exception as e } from "../../../lib/base/abstracts/Exception.mjs";
2
+
3
+ import "../../../lib/base/internal/BasicInfo.mjs";
4
+
5
+ import "../../../lib/helpers/As.mjs";
6
+
7
+ import "../../../../vendor/Package.6.mjs";
8
+
9
+ import "../../../../vendor/Package.5.mjs";
10
+
11
+ import "../../../../vendor/Package.7.mjs";
12
+
13
+ import "../../../lib/base/internal/ThrowWarning.mjs";
14
+
15
+ import "../../../lib/helpers/Templating.mjs";
16
+
17
+ import "../../../lib/base/internal/CamelCase.mjs";
18
+
19
+ import "../../../lib/helpers/NoCase.mjs";
20
+
21
+ class DuplicateActionNameException extends e {
22
+ constructor() {
23
+ super(...arguments);
24
+ this.errno = "E_DUPLICATE_ACTION_NAME";
25
+ }
26
+ }
27
+
28
+ export { DuplicateActionNameException };
@@ -0,0 +1,247 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, {
4
+ value: "Module"
5
+ });
6
+
7
+ const e = require("../../../../vendor/Package.1.cjs");
8
+
9
+ const r = require("../../../../vendor/Package.3.cjs");
10
+
11
+ const t = require("../../../decorators/di/Configurable.cjs");
12
+
13
+ const i = require("../exceptions/AccessDenyException.cjs");
14
+
15
+ const s = require("./AccessControlRule.cjs");
16
+
17
+ const c = require("../../../../vendor/Package.2.cjs");
18
+
19
+ const o = require("../../../lib/helpers/As.cjs");
20
+
21
+ require("../../../lib/base/async-constructor/AsyncConstructor.cjs");
22
+
23
+ require("../../../lib/base/async-constructor/Append.cjs");
24
+
25
+ require("../../../lib/helpers/IsPromiseLike.cjs");
26
+
27
+ require("../../../lib/helpers/IsPromise.cjs");
28
+
29
+ require("util/types");
30
+
31
+ require("../../../decorators/di/Lifetime.cjs");
32
+
33
+ require("../../../lib/base/internal/ObjectLifetime.cjs");
34
+
35
+ require("../../../constants/DIMetadataKey.cjs");
36
+
37
+ require("../../../../vendor/Package.4.cjs");
38
+
39
+ require("../../../../vendor/Package.5.cjs");
40
+
41
+ require("../../../exceptions/di/LifetimeLockedException.cjs");
42
+
43
+ require("../../../lib/base/abstracts/Exception.cjs");
44
+
45
+ require("../../../lib/base/internal/BasicInfo.cjs");
46
+
47
+ require("../../../../vendor/Package.6.cjs");
48
+
49
+ require("../../../../vendor/Package.7.cjs");
50
+
51
+ require("../../../lib/base/internal/ThrowWarning.cjs");
52
+
53
+ require("../../../lib/helpers/Templating.cjs");
54
+
55
+ require("../../../lib/base/internal/CamelCase.cjs");
56
+
57
+ require("../../../lib/helpers/NoCase.cjs");
58
+
59
+ require("../../../exceptions/MethodNotFoundException.cjs");
60
+
61
+ require("../../../lib/ioc/DependencyInjectionContainer.cjs");
62
+
63
+ require("util");
64
+
65
+ require("../../../lib/ioc/Errors.cjs");
66
+
67
+ require("../../../exceptions/di/DependencyInjectionException.cjs");
68
+
69
+ require("../../../lib/base/internal/ConstructorSymbol.cjs");
70
+
71
+ require("node:crypto");
72
+
73
+ require("../../../lib/base/internal/DataValidator.cjs");
74
+
75
+ require("node:util/types");
76
+
77
+ require("../../../lib/validation/VLD.cjs");
78
+
79
+ require("../../../../vendor/Package.11.cjs");
80
+
81
+ require("url");
82
+
83
+ require("../../../../vendor/Package.10.cjs");
84
+
85
+ require("../../../exceptions/dto/InvalidValueException.cjs");
86
+
87
+ require("../../../../vendor/Package.9.cjs");
88
+
89
+ require("../../../lib/helpers/IsHtml.cjs");
90
+
91
+ require("../../../lib/helpers/IsXML.cjs");
92
+
93
+ require("../../../constants/DTOMetadataKey.cjs");
94
+
95
+ require("../../../lib/helpers/ObjectConstructor.cjs");
96
+
97
+ require("../../../lib/helpers/ObjectParentConstructors.cjs");
98
+
99
+ require("../../../lib/helpers/ObjectParentConstructor.cjs");
100
+
101
+ require("../../../lib/helpers/ObjectPrototype.cjs");
102
+
103
+ require("../../../lib/ioc/InjectionMode.cjs");
104
+
105
+ require("../../../lib/ioc/Lifetime.cjs");
106
+
107
+ require("../../../lib/ioc/ListModules.cjs");
108
+
109
+ require("../../../../vendor/Package.8.cjs");
110
+
111
+ require("os");
112
+
113
+ require("path");
114
+
115
+ require("stream");
116
+
117
+ require("events");
118
+
119
+ require("fs");
120
+
121
+ require("../../../lib/ioc/Utils.cjs");
122
+
123
+ require("../../../lib/ioc/FunctionTokenizer.cjs");
124
+
125
+ require("../../../lib/ioc/LoadModules.cjs");
126
+
127
+ require("../../../lib/ioc/Resolvers.cjs");
128
+
129
+ require("../../../lib/ioc/ParamParser.cjs");
130
+
131
+ require("../../../lib/base/internal/ObjectWeakRefs.cjs");
132
+
133
+ require("../../../lib/base/internal/ConfigurableRecordsInjection.cjs");
134
+
135
+ require("../../../lib/base/internal/ObjectConfiguration.cjs");
136
+
137
+ require("../../../lib/base/internal/ObjectInjection.cjs");
138
+
139
+ require("../../../lib/base/internal/ObjectContainer.cjs");
140
+
141
+ require("../../../lib/helpers/DevNull.cjs");
142
+
143
+ require("../../../decorators/dto/Expect.cjs");
144
+
145
+ require("../../../decorators/dto/IndexSignature.cjs");
146
+
147
+ require("../../../decorators/dto/Accept.cjs");
148
+
149
+ require("../../../lib/base/internal/MethodValidation.cjs");
150
+
151
+ require("../../../exceptions/dto/InvalidMethodAcceptException.cjs");
152
+
153
+ require("../../../exceptions/dto/InvalidMethodReturnException.cjs");
154
+
155
+ require("../../../lib/helpers/IsEmptyObject.cjs");
156
+
157
+ class AccessControl extends r.BaseObject {
158
+ constructor() {
159
+ super(...arguments);
160
+ this.accessControlRuleConstructorDTO = c.DTO.Class(s.AccessControlRule);
161
+ }
162
+ async init() {
163
+ try {
164
+ const e = await this.match();
165
+ if (e) return this.allowCallback();
166
+ return this.denyCallback();
167
+ } catch (e) {
168
+ return this.denyCallback(e);
169
+ }
170
+ }
171
+ async match() {
172
+ for (const e of this.rules) {
173
+ if (c.DTO.isValid(e, this.accessControlRuleConstructorDTO)) {
174
+ const r = o.As(e);
175
+ const t = await this.runtimeContainer.build(r, {
176
+ actions: this.actions,
177
+ targetAction: this.target,
178
+ context: this.context,
179
+ input: this.input
180
+ });
181
+ if (!t.supportContextTypes.includes(this.context.type)) continue;
182
+ if (!await t.rule()) return false;
183
+ } else {
184
+ const r = o.As(e);
185
+ if (!await r(this.context, this.input)) return false;
186
+ }
187
+ }
188
+ return true;
189
+ }
190
+ static async run(e, r, t, s, c, o) {
191
+ const n = o(t.type);
192
+ let a = !c.acl;
193
+ let l = new i.AccessDenyException;
194
+ if (!a) {
195
+ await r.set(this, {
196
+ rules: [ ...e, c.rule ].filter((e => !!e)),
197
+ runtimeContainer: r,
198
+ actions: n,
199
+ context: t,
200
+ input: s,
201
+ target: c.getActionInfo(),
202
+ allowCallback: () => {
203
+ a = true;
204
+ },
205
+ denyCallback: e => {
206
+ a = false;
207
+ l = e ? e : l;
208
+ }
209
+ });
210
+ } else if (c.rule) {
211
+ await r.set(this, {
212
+ rules: [ c.rule ],
213
+ runtimeContainer: r,
214
+ actions: n,
215
+ context: t,
216
+ input: s,
217
+ target: c.getActionInfo(),
218
+ allowCallback: () => {
219
+ a = true;
220
+ },
221
+ denyCallback: e => {
222
+ a = false;
223
+ l = e ? e : l;
224
+ }
225
+ });
226
+ }
227
+ return [ a, l ];
228
+ }
229
+ }
230
+
231
+ e.__decorate([ t.Configurable(), e.__metadata("design:type", r.Container) ], AccessControl.prototype, "runtimeContainer", void 0);
232
+
233
+ e.__decorate([ t.Configurable(), e.__metadata("design:type", Array) ], AccessControl.prototype, "actions", void 0);
234
+
235
+ e.__decorate([ t.Configurable(), e.__metadata("design:type", Object) ], AccessControl.prototype, "target", void 0);
236
+
237
+ e.__decorate([ t.Configurable(), e.__metadata("design:type", Object) ], AccessControl.prototype, "context", void 0);
238
+
239
+ e.__decorate([ t.Configurable(), e.__metadata("design:type", Object) ], AccessControl.prototype, "input", void 0);
240
+
241
+ e.__decorate([ t.Configurable(), e.__metadata("design:type", Function) ], AccessControl.prototype, "allowCallback", void 0);
242
+
243
+ e.__decorate([ t.Configurable(), e.__metadata("design:type", Function) ], AccessControl.prototype, "denyCallback", void 0);
244
+
245
+ e.__decorate([ t.Configurable(), e.__metadata("design:type", Array) ], AccessControl.prototype, "rules", void 0);
246
+
247
+ exports.AccessControl = AccessControl;
@@ -0,0 +1,241 @@
1
+ import { _ as t, a as e } from "../../../../vendor/Package.1.mjs";
2
+
3
+ import { B as o, C as i } from "../../../../vendor/Package.3.mjs";
4
+
5
+ import { Configurable as s } from "../../../decorators/di/Configurable.mjs";
6
+
7
+ import { AccessDenyException as r } from "../exceptions/AccessDenyException.mjs";
8
+
9
+ import { AccessControlRule as n } from "./AccessControlRule.mjs";
10
+
11
+ import { D as a } from "../../../../vendor/Package.2.mjs";
12
+
13
+ import { As as m } from "../../../lib/helpers/As.mjs";
14
+
15
+ import "../../../lib/base/async-constructor/AsyncConstructor.mjs";
16
+
17
+ import "../../../lib/base/async-constructor/Append.mjs";
18
+
19
+ import "../../../lib/helpers/IsPromiseLike.mjs";
20
+
21
+ import "../../../lib/helpers/IsPromise.mjs";
22
+
23
+ import "util/types";
24
+
25
+ import "../../../decorators/di/Lifetime.mjs";
26
+
27
+ import "../../../lib/base/internal/ObjectLifetime.mjs";
28
+
29
+ import "../../../constants/DIMetadataKey.mjs";
30
+
31
+ import "../../../../vendor/Package.4.mjs";
32
+
33
+ import "../../../../vendor/Package.5.mjs";
34
+
35
+ import "../../../exceptions/di/LifetimeLockedException.mjs";
36
+
37
+ import "../../../lib/base/abstracts/Exception.mjs";
38
+
39
+ import "../../../lib/base/internal/BasicInfo.mjs";
40
+
41
+ import "../../../../vendor/Package.6.mjs";
42
+
43
+ import "../../../../vendor/Package.7.mjs";
44
+
45
+ import "../../../lib/base/internal/ThrowWarning.mjs";
46
+
47
+ import "../../../lib/helpers/Templating.mjs";
48
+
49
+ import "../../../lib/base/internal/CamelCase.mjs";
50
+
51
+ import "../../../lib/helpers/NoCase.mjs";
52
+
53
+ import "../../../exceptions/MethodNotFoundException.mjs";
54
+
55
+ import "../../../lib/ioc/DependencyInjectionContainer.mjs";
56
+
57
+ import "util";
58
+
59
+ import "../../../lib/ioc/Errors.mjs";
60
+
61
+ import "../../../exceptions/di/DependencyInjectionException.mjs";
62
+
63
+ import "../../../lib/base/internal/ConstructorSymbol.mjs";
64
+
65
+ import "node:crypto";
66
+
67
+ import "../../../lib/base/internal/DataValidator.mjs";
68
+
69
+ import "node:util/types";
70
+
71
+ import "../../../lib/validation/VLD.mjs";
72
+
73
+ import "../../../../vendor/Package.11.mjs";
74
+
75
+ import "url";
76
+
77
+ import "../../../../vendor/Package.10.mjs";
78
+
79
+ import "../../../exceptions/dto/InvalidValueException.mjs";
80
+
81
+ import "../../../../vendor/Package.9.mjs";
82
+
83
+ import "../../../lib/helpers/IsHtml.mjs";
84
+
85
+ import "../../../lib/helpers/IsXML.mjs";
86
+
87
+ import "../../../constants/DTOMetadataKey.mjs";
88
+
89
+ import "../../../lib/helpers/ObjectConstructor.mjs";
90
+
91
+ import "../../../lib/helpers/ObjectParentConstructors.mjs";
92
+
93
+ import "../../../lib/helpers/ObjectParentConstructor.mjs";
94
+
95
+ import "../../../lib/helpers/ObjectPrototype.mjs";
96
+
97
+ import "../../../lib/ioc/InjectionMode.mjs";
98
+
99
+ import "../../../lib/ioc/Lifetime.mjs";
100
+
101
+ import "../../../lib/ioc/ListModules.mjs";
102
+
103
+ import "../../../../vendor/Package.8.mjs";
104
+
105
+ import "os";
106
+
107
+ import "path";
108
+
109
+ import "stream";
110
+
111
+ import "events";
112
+
113
+ import "fs";
114
+
115
+ import "../../../lib/ioc/Utils.mjs";
116
+
117
+ import "../../../lib/ioc/FunctionTokenizer.mjs";
118
+
119
+ import "../../../lib/ioc/LoadModules.mjs";
120
+
121
+ import "../../../lib/ioc/Resolvers.mjs";
122
+
123
+ import "../../../lib/ioc/ParamParser.mjs";
124
+
125
+ import "../../../lib/base/internal/ObjectWeakRefs.mjs";
126
+
127
+ import "../../../lib/base/internal/ConfigurableRecordsInjection.mjs";
128
+
129
+ import "../../../lib/base/internal/ObjectConfiguration.mjs";
130
+
131
+ import "../../../lib/base/internal/ObjectInjection.mjs";
132
+
133
+ import "../../../lib/base/internal/ObjectContainer.mjs";
134
+
135
+ import "../../../lib/helpers/DevNull.mjs";
136
+
137
+ import "../../../decorators/dto/Expect.mjs";
138
+
139
+ import "../../../decorators/dto/IndexSignature.mjs";
140
+
141
+ import "../../../decorators/dto/Accept.mjs";
142
+
143
+ import "../../../lib/base/internal/MethodValidation.mjs";
144
+
145
+ import "../../../exceptions/dto/InvalidMethodAcceptException.mjs";
146
+
147
+ import "../../../exceptions/dto/InvalidMethodReturnException.mjs";
148
+
149
+ import "../../../lib/helpers/IsEmptyObject.mjs";
150
+
151
+ class AccessControl extends o {
152
+ constructor() {
153
+ super(...arguments);
154
+ this.accessControlRuleConstructorDTO = a.Class(n);
155
+ }
156
+ async init() {
157
+ try {
158
+ const t = await this.match();
159
+ if (t) return this.allowCallback();
160
+ return this.denyCallback();
161
+ } catch (t) {
162
+ return this.denyCallback(t);
163
+ }
164
+ }
165
+ async match() {
166
+ for (const t of this.rules) {
167
+ if (a.isValid(t, this.accessControlRuleConstructorDTO)) {
168
+ const e = m(t);
169
+ const o = await this.runtimeContainer.build(e, {
170
+ actions: this.actions,
171
+ targetAction: this.target,
172
+ context: this.context,
173
+ input: this.input
174
+ });
175
+ if (!o.supportContextTypes.includes(this.context.type)) continue;
176
+ if (!await o.rule()) return false;
177
+ } else {
178
+ const e = m(t);
179
+ if (!await e(this.context, this.input)) return false;
180
+ }
181
+ }
182
+ return true;
183
+ }
184
+ static async run(t, e, o, i, s, n) {
185
+ const a = n(o.type);
186
+ let m = !s.acl;
187
+ let c = new r;
188
+ if (!m) {
189
+ await e.set(this, {
190
+ rules: [ ...t, s.rule ].filter((t => !!t)),
191
+ runtimeContainer: e,
192
+ actions: a,
193
+ context: o,
194
+ input: i,
195
+ target: s.getActionInfo(),
196
+ allowCallback: () => {
197
+ m = true;
198
+ },
199
+ denyCallback: t => {
200
+ m = false;
201
+ c = t ? t : c;
202
+ }
203
+ });
204
+ } else if (s.rule) {
205
+ await e.set(this, {
206
+ rules: [ s.rule ],
207
+ runtimeContainer: e,
208
+ actions: a,
209
+ context: o,
210
+ input: i,
211
+ target: s.getActionInfo(),
212
+ allowCallback: () => {
213
+ m = true;
214
+ },
215
+ denyCallback: t => {
216
+ m = false;
217
+ c = t ? t : c;
218
+ }
219
+ });
220
+ }
221
+ return [ m, c ];
222
+ }
223
+ }
224
+
225
+ t([ s(), e("design:type", i) ], AccessControl.prototype, "runtimeContainer", void 0);
226
+
227
+ t([ s(), e("design:type", Array) ], AccessControl.prototype, "actions", void 0);
228
+
229
+ t([ s(), e("design:type", Object) ], AccessControl.prototype, "target", void 0);
230
+
231
+ t([ s(), e("design:type", Object) ], AccessControl.prototype, "context", void 0);
232
+
233
+ t([ s(), e("design:type", Object) ], AccessControl.prototype, "input", void 0);
234
+
235
+ t([ s(), e("design:type", Function) ], AccessControl.prototype, "allowCallback", void 0);
236
+
237
+ t([ s(), e("design:type", Function) ], AccessControl.prototype, "denyCallback", void 0);
238
+
239
+ t([ s(), e("design:type", Array) ], AccessControl.prototype, "rules", void 0);
240
+
241
+ export { AccessControl };