@aldb2b/common 1.0.334 → 1.0.335

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 (252) hide show
  1. package/build/db/CustomModel.d.ts +4 -0
  2. package/build/db/CustomModel.js +8 -0
  3. package/build/db/CustomModel.js.map +1 -0
  4. package/build/db/MongooseBase.d.ts +41 -0
  5. package/build/db/MongooseBase.js +346 -0
  6. package/build/db/MongooseBase.js.map +1 -0
  7. package/build/db/aggregate/AggregateConvertor.d.ts +23 -0
  8. package/build/db/aggregate/AggregateConvertor.js +212 -0
  9. package/build/db/aggregate/AggregateConvertor.js.map +1 -0
  10. package/build/db/aggregate/createAggregateResponse.d.ts +2 -0
  11. package/build/db/aggregate/createAggregateResponse.js +50 -0
  12. package/build/db/aggregate/createAggregateResponse.js.map +1 -0
  13. package/build/db/mongoose-find-options.d.ts +12 -0
  14. package/build/db/mongoose-find-options.js +68 -0
  15. package/build/db/mongoose-find-options.js.map +1 -0
  16. package/build/decorators/get-event-id-decorator.d.ts +1 -0
  17. package/build/decorators/get-event-id-decorator.js +13 -0
  18. package/build/decorators/get-event-id-decorator.js.map +1 -0
  19. package/build/decorators/get-user-decorator.d.ts +1 -0
  20. package/build/decorators/get-user-decorator.js +13 -0
  21. package/build/decorators/get-user-decorator.js.map +1 -0
  22. package/build/events/exchanges.d.ts +4 -0
  23. package/build/events/exchanges.js +9 -0
  24. package/build/events/exchanges.js.map +1 -0
  25. package/build/index.js.map +1 -1
  26. package/build/interceptors/response-with-code.interceptor.d.ts +6 -0
  27. package/build/interceptors/response-with-code.interceptor.js +32 -0
  28. package/build/interceptors/response-with-code.interceptor.js.map +1 -0
  29. package/build/interceptors/response.interceptor.d.ts +6 -0
  30. package/build/interceptors/response.interceptor.js +31 -0
  31. package/build/interceptors/response.interceptor.js.map +1 -0
  32. package/build/interceptors/serialize.interceptor.d.ts +12 -0
  33. package/build/interceptors/serialize.interceptor.js +25 -0
  34. package/build/interceptors/serialize.interceptor.js.map +1 -0
  35. package/build/middlewares/app.middleware.d.ts +6 -0
  36. package/build/middlewares/app.middleware.js +30 -0
  37. package/build/middlewares/app.middleware.js.map +1 -0
  38. package/build/middlewares/event-status.middleware.d.ts +6 -0
  39. package/build/middlewares/event-status.middleware.js +29 -0
  40. package/build/middlewares/event-status.middleware.js.map +1 -0
  41. package/build/tsconfig.tsbuildinfo +1 -1
  42. package/build/types/analytic-group.interface.d.ts +12 -0
  43. package/build/types/analytic-group.interface.js +3 -0
  44. package/build/types/analytic-group.interface.js.map +1 -0
  45. package/build/types/bulk-users.enum.d.ts +5 -0
  46. package/build/types/bulk-users.enum.js +10 -0
  47. package/build/types/bulk-users.enum.js.map +1 -0
  48. package/build/types/calendar-source-type.enum.d.ts +7 -0
  49. package/build/types/calendar-source-type.enum.js +12 -0
  50. package/build/types/calendar-source-type.enum.js.map +1 -0
  51. package/build/types/chat-group.interface.d.ts +4 -0
  52. package/build/types/chat-group.interface.js +3 -0
  53. package/build/types/chat-group.interface.js.map +1 -0
  54. package/build/types/default-visibility.interface.d.ts +13 -0
  55. package/build/types/default-visibility.interface.js +3 -0
  56. package/build/types/default-visibility.interface.js.map +1 -0
  57. package/build/types/download-presigned-url.interface.d.ts +4 -0
  58. package/build/types/download-presigned-url.interface.js +3 -0
  59. package/build/types/download-presigned-url.interface.js.map +1 -0
  60. package/build/types/enddpoint.interface.d.ts +10 -0
  61. package/build/types/enddpoint.interface.js +3 -0
  62. package/build/types/enddpoint.interface.js.map +1 -0
  63. package/build/types/endpoint-type.enum.d.ts +5 -0
  64. package/build/types/endpoint-type.enum.js +10 -0
  65. package/build/types/endpoint-type.enum.js.map +1 -0
  66. package/build/types/event-status.enum.d.ts +8 -0
  67. package/build/types/event-status.enum.js +13 -0
  68. package/build/types/event-status.enum.js.map +1 -0
  69. package/build/types/feature-mappings.d.ts +18 -0
  70. package/build/types/feature-mappings.js +29 -0
  71. package/build/types/feature-mappings.js.map +1 -0
  72. package/build/types/feature-type.enum.d.ts +20 -0
  73. package/build/types/feature-type.enum.js +25 -0
  74. package/build/types/feature-type.enum.js.map +1 -0
  75. package/build/types/feature.interface.d.ts +10 -0
  76. package/build/types/feature.interface.js +3 -0
  77. package/build/types/feature.interface.js.map +1 -0
  78. package/build/types/group-visibility.interface.d.ts +13 -0
  79. package/build/types/group-visibility.interface.js +3 -0
  80. package/build/types/group-visibility.interface.js.map +1 -0
  81. package/build/types/header-user.interface.d.ts +10 -0
  82. package/build/types/header-user.interface.js +3 -0
  83. package/build/types/header-user.interface.js.map +1 -0
  84. package/build/types/match-group.interface.d.ts +7 -0
  85. package/build/types/match-group.interface.js +3 -0
  86. package/build/types/match-group.interface.js.map +1 -0
  87. package/build/types/match.interface.d.ts +6 -0
  88. package/build/types/match.interface.js +3 -0
  89. package/build/types/match.interface.js.map +1 -0
  90. package/build/types/meeting-request-token.interface.d.ts +6 -0
  91. package/build/types/meeting-request-token.interface.js +3 -0
  92. package/build/types/meeting-request-token.interface.js.map +1 -0
  93. package/build/types/meeting-type.enum.d.ts +8 -0
  94. package/build/types/meeting-type.enum.js +13 -0
  95. package/build/types/meeting-type.enum.js.map +1 -0
  96. package/build/types/notification-event.enum.d.ts +25 -0
  97. package/build/types/notification-event.enum.js +30 -0
  98. package/build/types/notification-event.enum.js.map +1 -0
  99. package/build/types/notification-type.enum.d.ts +6 -0
  100. package/build/types/notification-type.enum.js +11 -0
  101. package/build/types/notification-type.enum.js.map +1 -0
  102. package/build/types/onboarded-thru.enum.d.ts +11 -0
  103. package/build/types/onboarded-thru.enum.js +16 -0
  104. package/build/types/onboarded-thru.enum.js.map +1 -0
  105. package/build/types/operation-types.d.ts +6 -0
  106. package/build/types/operation-types.js +11 -0
  107. package/build/types/operation-types.js.map +1 -0
  108. package/build/types/payment-method.enum.d.ts +5 -0
  109. package/build/types/payment-method.enum.js +10 -0
  110. package/build/types/payment-method.enum.js.map +1 -0
  111. package/build/types/priority.enum.d.ts +6 -0
  112. package/build/types/priority.enum.js +11 -0
  113. package/build/types/priority.enum.js.map +1 -0
  114. package/build/types/read-result.interface.d.ts +5 -0
  115. package/build/types/read-result.interface.js +3 -0
  116. package/build/types/read-result.interface.js.map +1 -0
  117. package/build/types/record-type.enum.d.ts +19 -0
  118. package/build/types/record-type.enum.js +24 -0
  119. package/build/types/record-type.enum.js.map +1 -0
  120. package/build/types/subscription-model.enum.d.ts +4 -0
  121. package/build/types/subscription-model.enum.js +9 -0
  122. package/build/types/subscription-model.enum.js.map +1 -0
  123. package/build/types/update-input-data.interface.d.ts +11 -0
  124. package/build/types/update-input-data.interface.js +3 -0
  125. package/build/types/update-input-data.interface.js.map +1 -0
  126. package/build/types/upload-presigned-url.interface.d.ts +4 -0
  127. package/build/types/upload-presigned-url.interface.js +3 -0
  128. package/build/types/upload-presigned-url.interface.js.map +1 -0
  129. package/build/types/user-invitations.interface.d.ts +6 -0
  130. package/build/types/user-invitations.interface.js +3 -0
  131. package/build/types/user-invitations.interface.js.map +1 -0
  132. package/build/types/user-language.enum.d.ts +5 -0
  133. package/build/types/user-language.enum.js +10 -0
  134. package/build/types/user-language.enum.js.map +1 -0
  135. package/build/types/user-role.enum.d.ts +8 -0
  136. package/build/types/user-role.enum.js +13 -0
  137. package/build/types/user-role.enum.js.map +1 -0
  138. package/build/types/user-type.enum.d.ts +5 -0
  139. package/build/types/user-type.enum.js +10 -0
  140. package/build/types/user-type.enum.js.map +1 -0
  141. package/build/types/visibility-group.interface.d.ts +6 -0
  142. package/build/types/visibility-group.interface.js +3 -0
  143. package/build/types/visibility-group.interface.js.map +1 -0
  144. package/build/utils/addDaysToDate.d.ts +1 -0
  145. package/build/utils/addDaysToDate.js +10 -0
  146. package/build/utils/addDaysToDate.js.map +1 -0
  147. package/build/utils/addHours.d.ts +1 -0
  148. package/build/utils/addHours.js +9 -0
  149. package/build/utils/addHours.js.map +1 -0
  150. package/build/utils/adjustForTimezone.d.ts +1 -0
  151. package/build/utils/adjustForTimezone.js +10 -0
  152. package/build/utils/adjustForTimezone.js.map +1 -0
  153. package/build/utils/create-default-directories.d.ts +1 -0
  154. package/build/utils/create-default-directories.js +24 -0
  155. package/build/utils/create-default-directories.js.map +1 -0
  156. package/build/utils/equal-array-object.d.ts +1 -0
  157. package/build/utils/equal-array-object.js +10 -0
  158. package/build/utils/equal-array-object.js.map +1 -0
  159. package/build/utils/equal-object.d.ts +1 -0
  160. package/build/utils/equal-object.js +9 -0
  161. package/build/utils/equal-object.js.map +1 -0
  162. package/build/utils/get-parsed-query.d.ts +1 -0
  163. package/build/utils/get-parsed-query.js +18 -0
  164. package/build/utils/get-parsed-query.js.map +1 -0
  165. package/build/utils/getEndpoint.d.ts +5 -0
  166. package/build/utils/getEndpoint.js +43 -0
  167. package/build/utils/getEndpoint.js.map +1 -0
  168. package/build/utils/getHeaderParam.d.ts +1 -0
  169. package/build/utils/getHeaderParam.js +8 -0
  170. package/build/utils/getHeaderParam.js.map +1 -0
  171. package/build/utils/parse-query.d.ts +1 -0
  172. package/build/utils/parse-query.js +31 -0
  173. package/build/utils/parse-query.js.map +1 -0
  174. package/build/utils/projection.d.ts +1 -0
  175. package/build/utils/projection.js +26 -0
  176. package/build/utils/projection.js.map +1 -0
  177. package/build/utils/redis-client.d.ts +9 -0
  178. package/build/utils/redis-client.js +55 -0
  179. package/build/utils/redis-client.js.map +1 -0
  180. package/build/utils/rmq/client/rabbitmq.client.d.ts +29 -0
  181. package/build/utils/rmq/client/rabbitmq.client.js +162 -0
  182. package/build/utils/rmq/client/rabbitmq.client.js.map +1 -0
  183. package/build/utils/rmq/constants.d.ts +9 -0
  184. package/build/utils/rmq/constants.js +13 -0
  185. package/build/utils/rmq/constants.js.map +1 -0
  186. package/build/utils/rmq/ctx-host/rmq.context.d.ts +9 -0
  187. package/build/utils/rmq/ctx-host/rmq.context.js +20 -0
  188. package/build/utils/rmq/ctx-host/rmq.context.js.map +1 -0
  189. package/build/utils/rmq/index.d.ts +4 -0
  190. package/build/utils/rmq/index.js +10 -0
  191. package/build/utils/rmq/index.js.map +1 -0
  192. package/build/utils/rmq/interfaces/rmq-options.interfaces.d.ts +79 -0
  193. package/build/utils/rmq/interfaces/rmq-options.interfaces.js +12 -0
  194. package/build/utils/rmq/interfaces/rmq-options.interfaces.js.map +1 -0
  195. package/build/utils/rmq/server/rabbitmq.server.d.ts +19 -0
  196. package/build/utils/rmq/server/rabbitmq.server.js +114 -0
  197. package/build/utils/rmq/server/rabbitmq.server.js.map +1 -0
  198. package/build/utils/timezone.d.ts +2 -0
  199. package/build/utils/timezone.js +15 -0
  200. package/build/utils/timezone.js.map +1 -0
  201. package/build/validators/conditional-required.d.ts +2 -0
  202. package/build/validators/conditional-required.js +24 -0
  203. package/build/validators/conditional-required.js.map +1 -0
  204. package/build/validators/date-validator.d.ts +2 -0
  205. package/build/validators/date-validator.js +21 -0
  206. package/build/validators/date-validator.js.map +1 -0
  207. package/build/validators/responses/customizeArrayResponse.d.ts +3 -0
  208. package/build/validators/responses/customizeArrayResponse.js +24 -0
  209. package/build/validators/responses/customizeArrayResponse.js.map +1 -0
  210. package/build/validators/responses/error-with-code.d.ts +2 -0
  211. package/build/validators/responses/error-with-code.interface.d.ts +5 -0
  212. package/build/validators/responses/error-with-code.interface.js +3 -0
  213. package/build/validators/responses/error-with-code.interface.js.map +1 -0
  214. package/build/validators/responses/error-with-code.js +30 -0
  215. package/build/validators/responses/error-with-code.js.map +1 -0
  216. package/build/validators/responses/error.d.ts +2 -0
  217. package/build/validators/responses/error.interface.d.ts +4 -0
  218. package/build/validators/responses/error.interface.js +3 -0
  219. package/build/validators/responses/error.interface.js.map +1 -0
  220. package/build/validators/responses/error.js +29 -0
  221. package/build/validators/responses/error.js.map +1 -0
  222. package/build/validators/responses/response-option.interface.d.ts +7 -0
  223. package/build/validators/responses/response-option.interface.js +3 -0
  224. package/build/validators/responses/response-option.interface.js.map +1 -0
  225. package/build/validators/responses/succes-result.interface.d.ts +10 -0
  226. package/build/validators/responses/succes-result.interface.js +3 -0
  227. package/build/validators/responses/succes-result.interface.js.map +1 -0
  228. package/build/validators/responses/success-with-code.d.ts +3 -0
  229. package/build/validators/responses/success-with-code.interface.d.ts +4 -0
  230. package/build/validators/responses/success-with-code.interface.js +3 -0
  231. package/build/validators/responses/success-with-code.interface.js.map +1 -0
  232. package/build/validators/responses/success-with-code.js +15 -0
  233. package/build/validators/responses/success-with-code.js.map +1 -0
  234. package/build/validators/responses/success.d.ts +3 -0
  235. package/build/validators/responses/success.interface.d.ts +4 -0
  236. package/build/validators/responses/success.interface.js +3 -0
  237. package/build/validators/responses/success.interface.js.map +1 -0
  238. package/build/validators/responses/success.js +15 -0
  239. package/build/validators/responses/success.js.map +1 -0
  240. package/build/validators/validateNewItem.d.ts +1 -0
  241. package/build/validators/validateNewItem.js +23 -0
  242. package/build/validators/validateNewItem.js.map +1 -0
  243. package/build/validators/validateProjection.d.ts +1 -0
  244. package/build/validators/validateProjection.js +33 -0
  245. package/build/validators/validateProjection.js.map +1 -0
  246. package/build/validators/validateProjectionResult.d.ts +1 -0
  247. package/build/validators/validateProjectionResult.js +37 -0
  248. package/build/validators/validateProjectionResult.js.map +1 -0
  249. package/build/validators/validateUpdateItem.d.ts +1 -0
  250. package/build/validators/validateUpdateItem.js +23 -0
  251. package/build/validators/validateUpdateItem.js.map +1 -0
  252. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-with-code.interface.js","sourceRoot":"","sources":["../../../src/validators/responses/error-with-code.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.errorWithCode = void 0;
4
+ function errorWithCode(err) {
5
+ var _a;
6
+ const error = ((_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.message)
7
+ ? err.response.message
8
+ : err.stack
9
+ ? err.stack
10
+ : extractError(err) || err;
11
+ return {
12
+ success: false,
13
+ error: error,
14
+ statusCode: err.status,
15
+ };
16
+ }
17
+ exports.errorWithCode = errorWithCode;
18
+ const extractError = err => {
19
+ if (err.errors) {
20
+ for (const errorKey in err.errors) {
21
+ if (err.errors[errorKey].message) {
22
+ return err.errors[errorKey].message;
23
+ }
24
+ }
25
+ }
26
+ else {
27
+ return false;
28
+ }
29
+ };
30
+ //# sourceMappingURL=error-with-code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-with-code.js","sourceRoot":"","sources":["../../../src/validators/responses/error-with-code.ts"],"names":[],"mappings":";;;AAEA,SAAgB,aAAa,CAAC,GAAG;;IAC/B,MAAM,KAAK,GAAG,CAAA,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,OAAO;QAClC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO;QACtB,CAAC,CAAC,GAAG,CAAC,KAAK;YACX,CAAC,CAAC,GAAG,CAAC,KAAK;YACX,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,GAAG,CAAA;IAC5B,OAAO;QACL,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,KAAK;QACZ,UAAU,EAAE,GAAG,CAAC,MAAM;KACvB,CAAA;AACH,CAAC;AAXD,sCAWC;AAED,MAAM,YAAY,GAAG,GAAG,CAAC,EAAE;IACzB,IAAI,GAAG,CAAC,MAAM,EAAE;QACd,KAAK,MAAM,QAAQ,IAAI,GAAG,CAAC,MAAM,EAAE;YACjC,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE;gBAChC,OAAO,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAA;aACpC;SACF;KACF;SAAM;QACL,OAAO,KAAK,CAAA;KACb;AACH,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { ErrorResponse } from './error.interface';
2
+ export declare function error(err: any): ErrorResponse;
@@ -0,0 +1,4 @@
1
+ export interface ErrorResponse {
2
+ success: boolean;
3
+ error: object;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=error.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.interface.js","sourceRoot":"","sources":["../../../src/validators/responses/error.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.error = void 0;
4
+ function error(err) {
5
+ var _a;
6
+ const error = ((_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.message)
7
+ ? err.response.message
8
+ : err.stack
9
+ ? err.stack
10
+ : extractError(err) || err;
11
+ return {
12
+ success: false,
13
+ error: error,
14
+ };
15
+ }
16
+ exports.error = error;
17
+ const extractError = err => {
18
+ if (err.errors) {
19
+ for (const errorKey in err.errors) {
20
+ if (err.errors[errorKey].message) {
21
+ return err.errors[errorKey].message;
22
+ }
23
+ }
24
+ }
25
+ else {
26
+ return false;
27
+ }
28
+ };
29
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/validators/responses/error.ts"],"names":[],"mappings":";;;AAEA,SAAgB,KAAK,CAAC,GAAG;;IACvB,MAAM,KAAK,GAAG,CAAA,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,OAAO;QAClC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO;QACtB,CAAC,CAAC,GAAG,CAAC,KAAK;YACX,CAAC,CAAC,GAAG,CAAC,KAAK;YACX,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,GAAG,CAAA;IAC5B,OAAO;QACL,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,KAAK;KACb,CAAA;AACH,CAAC;AAVD,sBAUC;AAED,MAAM,YAAY,GAAG,GAAG,CAAC,EAAE;IACzB,IAAI,GAAG,CAAC,MAAM,EAAE;QACd,KAAK,MAAM,QAAQ,IAAI,GAAG,CAAC,MAAM,EAAE;YACjC,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE;gBAChC,OAAO,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAA;aACpC;SACF;KACF;SAAM;QACL,OAAO,KAAK,CAAA;KACb;AACH,CAAC,CAAA"}
@@ -0,0 +1,7 @@
1
+ export interface ResponseOption {
2
+ hasTotal?: boolean;
3
+ total?: number;
4
+ skip?: number;
5
+ limit?: number;
6
+ sort?: object | string;
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=response-option.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-option.interface.js","sourceRoot":"","sources":["../../../src/validators/responses/response-option.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ export interface SuccessResult {
2
+ data: object | object[];
3
+ count?: number;
4
+ total?: number;
5
+ hasStaticRange?: boolean;
6
+ skip?: number;
7
+ limit?: number;
8
+ sort?: object | string;
9
+ customSort?: boolean;
10
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=succes-result.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"succes-result.interface.js","sourceRoot":"","sources":["../../../src/validators/responses/succes-result.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { ResponseOption } from './response-option.interface';
2
+ import { SuccessResponseWithCode } from './success-with-code.interface';
3
+ export declare function successWithCode(result: object | object[], options?: ResponseOption): SuccessResponseWithCode;
@@ -0,0 +1,4 @@
1
+ export interface SuccessResponseWithCode {
2
+ success: boolean;
3
+ [key: string]: object | boolean | number;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=success-with-code.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"success-with-code.interface.js","sourceRoot":"","sources":["../../../src/validators/responses/success-with-code.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.successWithCode = void 0;
4
+ const customizeArrayResponse_1 = require("./customizeArrayResponse");
5
+ function successWithCode(result, options) {
6
+ return {
7
+ success: true,
8
+ statusCode: 200,
9
+ result: Array.isArray(result)
10
+ ? customizeArrayResponse_1.customizeArrayResponse(result, options)
11
+ : result,
12
+ };
13
+ }
14
+ exports.successWithCode = successWithCode;
15
+ //# sourceMappingURL=success-with-code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"success-with-code.js","sourceRoot":"","sources":["../../../src/validators/responses/success-with-code.ts"],"names":[],"mappings":";;;AAAA,qEAAgE;AAIhE,SAAgB,eAAe,CAC7B,MAAyB,EACzB,OAAwB;IAExB,OAAO;QACL,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,GAAG;QACf,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YACzB,CAAC,CAAC,+CAAsB,CAAC,MAAM,EAAE,OAAO,CAAC;YACzC,CAAC,CAAC,MAAM;KACb,CAAC;AACJ,CAAC;AAXD,0CAWC"}
@@ -0,0 +1,3 @@
1
+ import { ResponseOption } from './response-option.interface';
2
+ import { SuccessResponse } from './success.interface';
3
+ export declare function success(result: object | object[], options?: ResponseOption): SuccessResponse;
@@ -0,0 +1,4 @@
1
+ export interface SuccessResponse {
2
+ success: boolean;
3
+ [key: string]: object | boolean;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=success.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"success.interface.js","sourceRoot":"","sources":["../../../src/validators/responses/success.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.success = void 0;
4
+ const customizeArrayResponse_1 = require("./customizeArrayResponse");
5
+ function success(result, options) {
6
+ const response = {
7
+ success: true,
8
+ result: Array.isArray(result)
9
+ ? customizeArrayResponse_1.customizeArrayResponse(result, options)
10
+ : result,
11
+ };
12
+ return response;
13
+ }
14
+ exports.success = success;
15
+ //# sourceMappingURL=success.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"success.js","sourceRoot":"","sources":["../../../src/validators/responses/success.ts"],"names":[],"mappings":";;;AAAA,qEAAkE;AAIlE,SAAgB,OAAO,CACrB,MAAyB,EACzB,OAAwB;IAExB,MAAM,QAAQ,GAAoB;QAChC,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAC3B,CAAC,CAAC,+CAAsB,CAAC,MAAM,EAAE,OAAO,CAAC;YACzC,CAAC,CAAC,MAAM;KACX,CAAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAXD,0BAWC"}
@@ -0,0 +1 @@
1
+ export declare function validateNewItem(allValidateNewItemFieldArray: string[], newItemObj: object): object;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateNewItem = void 0;
4
+ function validateNewItem(allValidateNewItemFieldArray, newItemObj) {
5
+ const validatedNewItem = {};
6
+ try {
7
+ if (Array.isArray(allValidateNewItemFieldArray) &&
8
+ allValidateNewItemFieldArray.length) {
9
+ for (const fieldName in newItemObj) {
10
+ if (newItemObj[fieldName] !== undefined &&
11
+ allValidateNewItemFieldArray.includes(fieldName)) {
12
+ validatedNewItem[fieldName] = newItemObj[fieldName];
13
+ }
14
+ }
15
+ }
16
+ return validatedNewItem;
17
+ }
18
+ catch (err) {
19
+ throw err;
20
+ }
21
+ }
22
+ exports.validateNewItem = validateNewItem;
23
+ //# sourceMappingURL=validateNewItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateNewItem.js","sourceRoot":"","sources":["../../src/validators/validateNewItem.ts"],"names":[],"mappings":";;;AAAA,SAAgB,eAAe,CAC7B,4BAAsC,EACtC,UAAkB;IAElB,MAAM,gBAAgB,GAAG,EAAE,CAAC;IAC5B,IAAI;QACF,IACE,KAAK,CAAC,OAAO,CAAC,4BAA4B,CAAC;YAC3C,4BAA4B,CAAC,MAAM,EACnC;YACA,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;gBAClC,IACE,UAAU,CAAC,SAAS,CAAC,KAAK,SAAS;oBACnC,4BAA4B,CAAC,QAAQ,CAAC,SAAS,CAAC,EAChD;oBACA,gBAAgB,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;iBACrD;aACF;SACF;QAED,OAAO,gBAAgB,CAAC;KACzB;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,GAAG,CAAC;KACX;AACH,CAAC;AAxBD,0CAwBC"}
@@ -0,0 +1 @@
1
+ export declare function validateProjection(allProjectionFieldArray: string[], necessaryProjectionArray: string[]): object;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateProjection = void 0;
4
+ function validateProjection(allProjectionFieldArray, necessaryProjectionArray) {
5
+ const validatedProjection = {};
6
+ try {
7
+ let returnAll = true;
8
+ Array.isArray(necessaryProjectionArray) &&
9
+ necessaryProjectionArray.length &&
10
+ necessaryProjectionArray.map((key) => {
11
+ if (allProjectionFieldArray.length) {
12
+ if (allProjectionFieldArray.includes(key)) {
13
+ returnAll = false;
14
+ validatedProjection[key] = true;
15
+ }
16
+ }
17
+ else {
18
+ returnAll = false;
19
+ validatedProjection[key] = true;
20
+ }
21
+ });
22
+ if (returnAll) {
23
+ allProjectionFieldArray.map((key) => (validatedProjection[key] = true));
24
+ }
25
+ }
26
+ catch (err) {
27
+ }
28
+ finally {
29
+ return validatedProjection;
30
+ }
31
+ }
32
+ exports.validateProjection = validateProjection;
33
+ //# sourceMappingURL=validateProjection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateProjection.js","sourceRoot":"","sources":["../../src/validators/validateProjection.ts"],"names":[],"mappings":";;;AAAA,SAAgB,kBAAkB,CAChC,uBAAiC,EACjC,wBAAkC;IAElC,MAAM,mBAAmB,GAAG,EAAE,CAAC;IAC/B,IAAI;QACF,IAAI,SAAS,GAAG,IAAI,CAAC;QAErB,KAAK,CAAC,OAAO,CAAC,wBAAwB,CAAC;YACrC,wBAAwB,CAAC,MAAM;YAC/B,wBAAwB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;gBACnC,IAAI,uBAAuB,CAAC,MAAM,EAAE;oBAClC,IAAI,uBAAuB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;wBACzC,SAAS,GAAG,KAAK,CAAC;wBAClB,mBAAmB,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;qBACjC;iBACF;qBAAM;oBACL,SAAS,GAAG,KAAK,CAAC;oBAClB,mBAAmB,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;iBACjC;YACH,CAAC,CAAC,CAAC;QAEL,IAAI,SAAS,EAAE;YACb,uBAAuB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;SACzE;KACF;IAAC,OAAO,GAAG,EAAE;KACb;YAAS;QACR,OAAO,mBAAmB,CAAC;KAC5B;AACH,CAAC;AA7BD,gDA6BC"}
@@ -0,0 +1 @@
1
+ export declare function validateProjectionResult(allProjectionFieldArray: string[], necessaryProjectionObj: any): object;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateProjectionResult = void 0;
4
+ function validateProjectionResult(allProjectionFieldArray, necessaryProjectionObj) {
5
+ const returnProjectedResult = {};
6
+ try {
7
+ let returnAll = true;
8
+ if (typeof necessaryProjectionObj === 'object' &&
9
+ necessaryProjectionObj !== null &&
10
+ Object.keys(necessaryProjectionObj).length) {
11
+ for (const key in necessaryProjectionObj) {
12
+ if (necessaryProjectionObj.hasOwnProperty(key)) {
13
+ if (allProjectionFieldArray.length) {
14
+ if (allProjectionFieldArray.includes(key)) {
15
+ returnAll = false;
16
+ returnProjectedResult[key] = necessaryProjectionObj[key];
17
+ }
18
+ }
19
+ else {
20
+ returnAll = false;
21
+ returnProjectedResult[key] = necessaryProjectionObj[key];
22
+ }
23
+ }
24
+ }
25
+ }
26
+ if (returnAll) {
27
+ allProjectionFieldArray.map((key) => (returnProjectedResult[key] = necessaryProjectionObj[key]));
28
+ }
29
+ }
30
+ catch (err) {
31
+ }
32
+ finally {
33
+ return returnProjectedResult;
34
+ }
35
+ }
36
+ exports.validateProjectionResult = validateProjectionResult;
37
+ //# sourceMappingURL=validateProjectionResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateProjectionResult.js","sourceRoot":"","sources":["../../src/validators/validateProjectionResult.ts"],"names":[],"mappings":";;;AAAA,SAAgB,wBAAwB,CACtC,uBAAiC,EACjC,sBAAsB;IAEtB,MAAM,qBAAqB,GAAG,EAAE,CAAC;IACjC,IAAI;QACF,IAAI,SAAS,GAAG,IAAI,CAAC;QAErB,IACE,OAAO,sBAAsB,KAAK,QAAQ;YAC1C,sBAAsB,KAAK,IAAI;YAC/B,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,MAAM,EAC1C;YACA,KAAK,MAAM,GAAG,IAAI,sBAAsB,EAAE;gBACxC,IAAI,sBAAsB,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBAC9C,IAAI,uBAAuB,CAAC,MAAM,EAAE;wBAClC,IAAI,uBAAuB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;4BACzC,SAAS,GAAG,KAAK,CAAC;4BAClB,qBAAqB,CAAC,GAAG,CAAC,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC;yBAC1D;qBACF;yBAAM;wBACL,SAAS,GAAG,KAAK,CAAC;wBAClB,qBAAqB,CAAC,GAAG,CAAC,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC;qBAC1D;iBACF;aACF;SACF;QAED,IAAI,SAAS,EAAE;YACb,uBAAuB,CAAC,GAAG,CACzB,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC,CACpE,CAAC;SACH;KACF;IAAC,OAAO,GAAG,EAAE;KACb;YAAS;QACR,OAAO,qBAAqB,CAAC;KAC9B;AACH,CAAC;AArCD,4DAqCC"}
@@ -0,0 +1 @@
1
+ export declare function validateUpdateItem(allValidateUpdateItemFieldArray: string[], updateItemObj: any): object;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateUpdateItem = void 0;
4
+ function validateUpdateItem(allValidateUpdateItemFieldArray, updateItemObj) {
5
+ try {
6
+ const validatedUpdateItem = {};
7
+ if (Array.isArray(allValidateUpdateItemFieldArray) &&
8
+ allValidateUpdateItemFieldArray.length) {
9
+ for (const fieldName in updateItemObj) {
10
+ if (updateItemObj[fieldName] !== undefined &&
11
+ allValidateUpdateItemFieldArray.includes(fieldName)) {
12
+ validatedUpdateItem[fieldName] = updateItemObj[fieldName];
13
+ }
14
+ }
15
+ }
16
+ return validatedUpdateItem;
17
+ }
18
+ catch (err) {
19
+ throw err;
20
+ }
21
+ }
22
+ exports.validateUpdateItem = validateUpdateItem;
23
+ //# sourceMappingURL=validateUpdateItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateUpdateItem.js","sourceRoot":"","sources":["../../src/validators/validateUpdateItem.ts"],"names":[],"mappings":";;;AAAA,SAAgB,kBAAkB,CAChC,+BAAyC,EACzC,aAAa;IAEb,IAAI;QACF,MAAM,mBAAmB,GAAG,EAAE,CAAC;QAC/B,IACE,KAAK,CAAC,OAAO,CAAC,+BAA+B,CAAC;YAC9C,+BAA+B,CAAC,MAAM,EACtC;YACA,KAAK,MAAM,SAAS,IAAI,aAAa,EAAE;gBACrC,IACE,aAAa,CAAC,SAAS,CAAC,KAAK,SAAS;oBACtC,+BAA+B,CAAC,QAAQ,CAAC,SAAS,CAAC,EACnD;oBACA,mBAAmB,CAAC,SAAS,CAAC,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;iBAC3D;aACF;SACF;QAED,OAAO,mBAAmB,CAAC;KAC5B;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,GAAG,CAAC;KACX;AACH,CAAC;AAxBD,gDAwBC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aldb2b/common",
3
- "version": "1.0.334",
3
+ "version": "1.0.335",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",