@autofleet/sadot 1.6.18-beta.4 → 1.6.18-beta.5

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 (227) hide show
  1. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/decorate.cjs +11 -0
  2. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/decorateMetadata.cjs +8 -0
  3. package/dist/_virtual/rolldown_runtime.cjs +45 -0
  4. package/dist/api/v1/validator/validations.d.cts +22 -0
  5. package/dist/index.cjs +87 -0
  6. package/dist/index.d.cts +25 -0
  7. package/dist/init-state.d.cts +35 -0
  8. package/dist/models/CustomFieldDefinition.d.cts +40 -0
  9. package/dist/models/CustomFieldEntries.d.cts +15 -0
  10. package/dist/models/CustomFieldModelTypeMap.d.cts +14 -0
  11. package/dist/models/CustomFieldValue.d.cts +20 -0
  12. package/dist/models/CustomValidator.d.cts +18 -0
  13. package/dist/models/FieldPolicy.d.cts +23 -0
  14. package/dist/node_modules/accepts/index.cjs +180 -0
  15. package/dist/node_modules/array-flatten/array-flatten.cjs +61 -0
  16. package/dist/node_modules/body-parser/index.cjs +140 -0
  17. package/dist/node_modules/body-parser/lib/read.cjs +169 -0
  18. package/dist/node_modules/body-parser/lib/types/json.cjs +205 -0
  19. package/dist/node_modules/body-parser/lib/types/raw.cjs +90 -0
  20. package/dist/node_modules/body-parser/lib/types/text.cjs +106 -0
  21. package/dist/node_modules/body-parser/lib/types/urlencoded.cjs +222 -0
  22. package/dist/node_modules/body-parser/node_modules/qs/lib/formats.cjs +34 -0
  23. package/dist/node_modules/body-parser/node_modules/qs/lib/index.cjs +26 -0
  24. package/dist/node_modules/body-parser/node_modules/qs/lib/parse.cjs +187 -0
  25. package/dist/node_modules/body-parser/node_modules/qs/lib/stringify.cjs +192 -0
  26. package/dist/node_modules/body-parser/node_modules/qs/lib/utils.cjs +178 -0
  27. package/dist/node_modules/bytes/index.cjs +126 -0
  28. package/dist/node_modules/call-bind-apply-helpers/actualApply.cjs +25 -0
  29. package/dist/node_modules/call-bind-apply-helpers/functionApply.cjs +17 -0
  30. package/dist/node_modules/call-bind-apply-helpers/functionCall.cjs +17 -0
  31. package/dist/node_modules/call-bind-apply-helpers/index.cjs +28 -0
  32. package/dist/node_modules/call-bind-apply-helpers/reflectApply.cjs +17 -0
  33. package/dist/node_modules/call-bound/index.cjs +27 -0
  34. package/dist/node_modules/content-disposition/index.cjs +314 -0
  35. package/dist/node_modules/content-type/index.cjs +156 -0
  36. package/dist/node_modules/cookie/index.cjs +250 -0
  37. package/dist/node_modules/cookie-signature/index.cjs +51 -0
  38. package/dist/node_modules/debug/node_modules/has-flag/index.cjs +22 -0
  39. package/dist/node_modules/debug/node_modules/supports-color/index.cjs +75 -0
  40. package/dist/node_modules/debug/src/browser.cjs +206 -0
  41. package/dist/node_modules/debug/src/common.cjs +212 -0
  42. package/dist/node_modules/debug/src/index.cjs +21 -0
  43. package/dist/node_modules/debug/src/node.cjs +218 -0
  44. package/dist/node_modules/depd/index.cjs +319 -0
  45. package/dist/node_modules/destroy/index.cjs +160 -0
  46. package/dist/node_modules/dunder-proto/get.cjs +32 -0
  47. package/dist/node_modules/ee-first/index.cjs +80 -0
  48. package/dist/node_modules/encodeurl/index.cjs +61 -0
  49. package/dist/node_modules/es-define-property/index.cjs +23 -0
  50. package/dist/node_modules/es-errors/eval.cjs +17 -0
  51. package/dist/node_modules/es-errors/index.cjs +17 -0
  52. package/dist/node_modules/es-errors/range.cjs +17 -0
  53. package/dist/node_modules/es-errors/ref.cjs +17 -0
  54. package/dist/node_modules/es-errors/syntax.cjs +17 -0
  55. package/dist/node_modules/es-errors/type.cjs +17 -0
  56. package/dist/node_modules/es-errors/uri.cjs +17 -0
  57. package/dist/node_modules/es-object-atoms/index.cjs +17 -0
  58. package/dist/node_modules/escape-html/index.cjs +72 -0
  59. package/dist/node_modules/etag/index.cjs +87 -0
  60. package/dist/node_modules/express/index.cjs +24 -0
  61. package/dist/node_modules/express/lib/application.cjs +508 -0
  62. package/dist/node_modules/express/lib/express.cjs +119 -0
  63. package/dist/node_modules/express/lib/middleware/init.cjs +49 -0
  64. package/dist/node_modules/express/lib/middleware/query.cjs +52 -0
  65. package/dist/node_modules/express/lib/request.cjs +427 -0
  66. package/dist/node_modules/express/lib/response.cjs +872 -0
  67. package/dist/node_modules/express/lib/router/index.cjs +429 -0
  68. package/dist/node_modules/express/lib/router/layer.cjs +145 -0
  69. package/dist/node_modules/express/lib/router/route.cjs +163 -0
  70. package/dist/node_modules/express/lib/utils.cjs +252 -0
  71. package/dist/node_modules/express/lib/view.cjs +140 -0
  72. package/dist/node_modules/express/node_modules/qs/lib/formats.cjs +34 -0
  73. package/dist/node_modules/express/node_modules/qs/lib/index.cjs +26 -0
  74. package/dist/node_modules/express/node_modules/qs/lib/parse.cjs +187 -0
  75. package/dist/node_modules/express/node_modules/qs/lib/stringify.cjs +192 -0
  76. package/dist/node_modules/express/node_modules/qs/lib/utils.cjs +178 -0
  77. package/dist/node_modules/finalhandler/index.cjs +239 -0
  78. package/dist/node_modules/forwarded/index.cjs +72 -0
  79. package/dist/node_modules/fresh/index.cjs +101 -0
  80. package/dist/node_modules/function-bind/implementation.cjs +63 -0
  81. package/dist/node_modules/function-bind/index.cjs +18 -0
  82. package/dist/node_modules/get-intrinsic/index.cjs +362 -0
  83. package/dist/node_modules/get-proto/Object.getPrototypeOf.cjs +19 -0
  84. package/dist/node_modules/get-proto/Reflect.getPrototypeOf.cjs +17 -0
  85. package/dist/node_modules/get-proto/index.cjs +30 -0
  86. package/dist/node_modules/gopd/gOPD.cjs +17 -0
  87. package/dist/node_modules/gopd/index.cjs +24 -0
  88. package/dist/node_modules/has-symbols/index.cjs +26 -0
  89. package/dist/node_modules/has-symbols/shams.cjs +40 -0
  90. package/dist/node_modules/hasown/index.cjs +21 -0
  91. package/dist/node_modules/http-errors/index.cjs +212 -0
  92. package/dist/node_modules/iconv-lite/encodings/dbcs-codec.cjs +326 -0
  93. package/dist/node_modules/iconv-lite/encodings/dbcs-data.cjs +131 -0
  94. package/dist/node_modules/iconv-lite/encodings/index.cjs +37 -0
  95. package/dist/node_modules/iconv-lite/encodings/internal.cjs +140 -0
  96. package/dist/node_modules/iconv-lite/encodings/sbcs-codec.cjs +58 -0
  97. package/dist/node_modules/iconv-lite/encodings/sbcs-data-generated.cjs +463 -0
  98. package/dist/node_modules/iconv-lite/encodings/sbcs-data.cjs +155 -0
  99. package/dist/node_modules/iconv-lite/encodings/tables/big5-added.cjs +175 -0
  100. package/dist/node_modules/iconv-lite/encodings/tables/cp936.cjs +2590 -0
  101. package/dist/node_modules/iconv-lite/encodings/tables/cp949.cjs +2226 -0
  102. package/dist/node_modules/iconv-lite/encodings/tables/cp950.cjs +233 -0
  103. package/dist/node_modules/iconv-lite/encodings/tables/eucjp.cjs +431 -0
  104. package/dist/node_modules/iconv-lite/encodings/tables/gb18030-ranges.cjs +433 -0
  105. package/dist/node_modules/iconv-lite/encodings/tables/gbk-added.cjs +235 -0
  106. package/dist/node_modules/iconv-lite/encodings/tables/shiftjis.cjs +298 -0
  107. package/dist/node_modules/iconv-lite/encodings/utf16.cjs +112 -0
  108. package/dist/node_modules/iconv-lite/encodings/utf7.cjs +188 -0
  109. package/dist/node_modules/iconv-lite/lib/bom-handling.cjs +50 -0
  110. package/dist/node_modules/iconv-lite/lib/extend-node.cjs +155 -0
  111. package/dist/node_modules/iconv-lite/lib/index.cjs +101 -0
  112. package/dist/node_modules/iconv-lite/lib/streams.cjs +102 -0
  113. package/dist/node_modules/inherits/inherits.cjs +23 -0
  114. package/dist/node_modules/inherits/inherits_browser.cjs +33 -0
  115. package/dist/node_modules/ipaddr.js/lib/ipaddr.cjs +680 -0
  116. package/dist/node_modules/math-intrinsics/abs.cjs +17 -0
  117. package/dist/node_modules/math-intrinsics/floor.cjs +17 -0
  118. package/dist/node_modules/math-intrinsics/isNaN.cjs +19 -0
  119. package/dist/node_modules/math-intrinsics/max.cjs +17 -0
  120. package/dist/node_modules/math-intrinsics/min.cjs +17 -0
  121. package/dist/node_modules/math-intrinsics/pow.cjs +17 -0
  122. package/dist/node_modules/math-intrinsics/round.cjs +17 -0
  123. package/dist/node_modules/math-intrinsics/sign.cjs +22 -0
  124. package/dist/node_modules/merge-descriptors/index.cjs +51 -0
  125. package/dist/node_modules/methods/index.cjs +74 -0
  126. package/dist/node_modules/mime/mime.cjs +82 -0
  127. package/dist/node_modules/mime/types.cjs +1107 -0
  128. package/dist/node_modules/mime-types/index.cjs +128 -0
  129. package/dist/node_modules/mime-types/node_modules/mime-db/db.cjs +7054 -0
  130. package/dist/node_modules/mime-types/node_modules/mime-db/index.cjs +24 -0
  131. package/dist/node_modules/ms/index.cjs +127 -0
  132. package/dist/node_modules/negotiator/index.cjs +81 -0
  133. package/dist/node_modules/negotiator/lib/charset.cjs +137 -0
  134. package/dist/node_modules/negotiator/lib/encoding.cjs +148 -0
  135. package/dist/node_modules/negotiator/lib/language.cjs +143 -0
  136. package/dist/node_modules/negotiator/lib/mediaType.cjs +205 -0
  137. package/dist/node_modules/object-inspect/index.cjs +392 -0
  138. package/dist/node_modules/object-inspect/util.inspect.cjs +14 -0
  139. package/dist/node_modules/on-finished/index.cjs +183 -0
  140. package/dist/node_modules/parseurl/index.cjs +116 -0
  141. package/dist/node_modules/path-to-regexp/index.cjs +121 -0
  142. package/dist/node_modules/proxy-addr/index.cjs +217 -0
  143. package/dist/node_modules/range-parser/index.cjs +115 -0
  144. package/dist/node_modules/raw-body/index.cjs +214 -0
  145. package/dist/node_modules/safe-buffer/index.cjs +49 -0
  146. package/dist/node_modules/safer-buffer/safer.cjs +53 -0
  147. package/dist/node_modules/send/index.cjs +806 -0
  148. package/dist/node_modules/send/node_modules/encodeurl/index.cjs +61 -0
  149. package/dist/node_modules/serve-static/index.cjs +139 -0
  150. package/dist/node_modules/setprototypeof/index.cjs +24 -0
  151. package/dist/node_modules/side-channel/index.cjs +50 -0
  152. package/dist/node_modules/side-channel-list/index.cjs +89 -0
  153. package/dist/node_modules/side-channel-map/index.cjs +67 -0
  154. package/dist/node_modules/side-channel-weakmap/index.cjs +78 -0
  155. package/dist/node_modules/statuses/codes.cjs +78 -0
  156. package/dist/node_modules/statuses/index.cjs +113 -0
  157. package/dist/node_modules/toidentifier/index.cjs +37 -0
  158. package/dist/node_modules/type-is/index.cjs +184 -0
  159. package/dist/node_modules/type-is/node_modules/media-typer/index.cjs +189 -0
  160. package/dist/node_modules/unpipe/index.cjs +55 -0
  161. package/dist/node_modules/utils-merge/index.cjs +31 -0
  162. package/dist/node_modules/vary/index.cjs +100 -0
  163. package/dist/packages/sadot/src/api/index.cjs +12 -0
  164. package/dist/packages/sadot/src/api/v1/definition/index.cjs +113 -0
  165. package/dist/packages/sadot/src/api/v1/definition/validations.cjs +128 -0
  166. package/dist/packages/sadot/src/api/v1/errors.cjs +14 -0
  167. package/dist/packages/sadot/src/api/v1/index.cjs +16 -0
  168. package/dist/packages/sadot/src/api/v1/templates/index.cjs +77 -0
  169. package/dist/packages/sadot/src/api/v1/validator/index.cjs +115 -0
  170. package/dist/packages/sadot/src/api/v1/validator/validations.cjs +40 -0
  171. package/dist/packages/sadot/src/errors/index.cjs +62 -0
  172. package/dist/packages/sadot/src/events/index.cjs +52 -0
  173. package/dist/packages/sadot/src/hooks/enrich.cjs +175 -0
  174. package/dist/packages/sadot/src/hooks/find.cjs +22 -0
  175. package/dist/packages/sadot/src/hooks/hooks.cjs +310 -0
  176. package/dist/packages/sadot/src/hooks/index.cjs +3 -0
  177. package/dist/packages/sadot/src/hooks/utils/updateInstanceValues.cjs +27 -0
  178. package/dist/packages/sadot/src/init-state.cjs +56 -0
  179. package/dist/packages/sadot/src/mat-path-state.cjs +10 -0
  180. package/dist/packages/sadot/src/migrations/001-create-core-tables.cjs +70 -0
  181. package/dist/packages/sadot/src/migrations/002-create-custom-field-entries.cjs +27 -0
  182. package/dist/packages/sadot/src/migrations/003-create-custom-field-model-type-map.cjs +35 -0
  183. package/dist/packages/sadot/src/migrations/004-create-field-policy-tables.cjs +29 -0
  184. package/dist/packages/sadot/src/migrations/index.cjs +88 -0
  185. package/dist/packages/sadot/src/models/CustomFieldDefinition.cjs +147 -0
  186. package/dist/packages/sadot/src/models/CustomFieldEntries.cjs +71 -0
  187. package/dist/packages/sadot/src/models/CustomFieldModelTypeMap.cjs +62 -0
  188. package/dist/packages/sadot/src/models/CustomFieldValue.cjs +109 -0
  189. package/dist/packages/sadot/src/models/CustomValidator.cjs +68 -0
  190. package/dist/packages/sadot/src/models/FieldPolicy.cjs +50 -0
  191. package/dist/packages/sadot/src/models/index.cjs +163 -0
  192. package/dist/packages/sadot/src/models/tests/AssociatedTestModel.cjs +51 -0
  193. package/dist/packages/sadot/src/models/tests/TestModel.cjs +43 -0
  194. package/dist/packages/sadot/src/models/tests/contextAwareModels/ContextAwareTestModel.cjs +35 -0
  195. package/dist/packages/sadot/src/models/tests/contextAwareModels/ContextTestModel.cjs +33 -0
  196. package/dist/packages/sadot/src/repository/definition.cjs +221 -0
  197. package/dist/packages/sadot/src/repository/entries.cjs +69 -0
  198. package/dist/packages/sadot/src/repository/field-policy.cjs +42 -0
  199. package/dist/packages/sadot/src/repository/utils/formatValues.cjs +14 -0
  200. package/dist/packages/sadot/src/repository/validator.cjs +58 -0
  201. package/dist/packages/sadot/src/repository/value.cjs +77 -0
  202. package/dist/packages/sadot/src/scopes/filter.cjs +56 -0
  203. package/dist/packages/sadot/src/scopes/helpers/filter.helpers.cjs +152 -0
  204. package/dist/packages/sadot/src/scopes/index.cjs +1 -0
  205. package/dist/packages/sadot/src/utils/constants/index.cjs +32 -0
  206. package/dist/packages/sadot/src/utils/db/index.cjs +15 -0
  207. package/dist/packages/sadot/src/utils/helpers/index.cjs +23 -0
  208. package/dist/packages/sadot/src/utils/init.cjs +115 -0
  209. package/dist/packages/sadot/src/utils/logger/index.cjs +15 -0
  210. package/dist/packages/sadot/src/utils/scopeAttributes.cjs +12 -0
  211. package/dist/packages/sadot/src/utils/validations/index.cjs +34 -0
  212. package/dist/packages/sadot/src/utils/validations/schema/custom-fields.cjs +9 -0
  213. package/dist/packages/sadot/src/utils/validations/schema/validator-schema.cjs +102 -0
  214. package/dist/packages/sadot/src/utils/validations/validators/index.cjs +45 -0
  215. package/dist/packages/sadot/src/utils/validations/validators/multi-select-dropdown.validator.cjs +7 -0
  216. package/dist/packages/sadot/src/utils/validations/validators/multi-select-status.validator.cjs +10 -0
  217. package/dist/packages/sadot/src/utils/validations/validators/multi-select.helpers.cjs +12 -0
  218. package/dist/packages/sadot/src/utils/validations/validators/select.validator.cjs +12 -0
  219. package/dist/packages/sadot/src/utils/validations/validators/status.validator.cjs +12 -0
  220. package/dist/repository/field-policy.d.cts +29 -0
  221. package/dist/scopes/filter.d.cts +22 -0
  222. package/dist/scopes/helpers/filter.helpers.d.cts +16 -0
  223. package/dist/types/index.d.cts +69 -0
  224. package/dist/utils/constants/index.d.cts +23 -0
  225. package/dist/utils/helpers/index.d.cts +30 -0
  226. package/dist/utils/validations/schema/custom-fields.d.cts +6 -0
  227. package/package.json +3 -3
@@ -0,0 +1,11 @@
1
+
2
+ //#region \0@oxc-project+runtime@0.103.0/helpers/decorate.js
3
+ function __decorate(decorators, target, key, desc) {
4
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
8
+ }
9
+
10
+ //#endregion
11
+ exports.__decorate = __decorate;
@@ -0,0 +1,8 @@
1
+
2
+ //#region \0@oxc-project+runtime@0.103.0/helpers/decorateMetadata.js
3
+ function __decorateMetadata(k, v) {
4
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
5
+ }
6
+
7
+ //#endregion
8
+ exports.__decorateMetadata = __decorateMetadata;
@@ -0,0 +1,45 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
9
+ var __export = (all, symbols) => {
10
+ let target = {};
11
+ for (var name in all) {
12
+ __defProp(target, name, {
13
+ get: all[name],
14
+ enumerable: true
15
+ });
16
+ }
17
+ if (symbols) {
18
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
19
+ }
20
+ return target;
21
+ };
22
+ var __copyProps = (to, from, except, desc) => {
23
+ if (from && typeof from === "object" || typeof from === "function") {
24
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
25
+ key = keys[i];
26
+ if (!__hasOwnProp.call(to, key) && key !== except) {
27
+ __defProp(to, key, {
28
+ get: ((k) => from[k]).bind(null, key),
29
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
30
+ });
31
+ }
32
+ }
33
+ }
34
+ return to;
35
+ };
36
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
37
+ value: mod,
38
+ enumerable: true
39
+ }) : target, mod));
40
+
41
+ //#endregion
42
+
43
+ exports.__commonJSMin = __commonJSMin;
44
+ exports.__export = __export;
45
+ exports.__toESM = __toESM;
@@ -0,0 +1,22 @@
1
+ import Joi from "joi";
2
+
3
+ //#region src/api/v1/validator/validations.d.ts
4
+ interface SchemaObject {
5
+ type: "object";
6
+ properties?: {
7
+ before?: object;
8
+ after?: object;
9
+ };
10
+ required?: string[];
11
+ allOf?: object[];
12
+ anyOf?: object[];
13
+ oneOf?: object[];
14
+ additionalProperties?: boolean | object;
15
+ $id?: string;
16
+ $schema?: string;
17
+ if?: object;
18
+ then?: object;
19
+ else?: object;
20
+ }
21
+ //#endregion
22
+ export { SchemaObject };
package/dist/index.cjs ADDED
@@ -0,0 +1,87 @@
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+ const require_index = require('./packages/sadot/src/utils/logger/index.cjs');
3
+ const require_index$1 = require('./packages/sadot/src/utils/constants/index.cjs');
4
+ const require_CustomFieldValue = require('./packages/sadot/src/models/CustomFieldValue.cjs');
5
+ const require_CustomFieldDefinition = require('./packages/sadot/src/models/CustomFieldDefinition.cjs');
6
+ const require_CustomFieldEntries = require('./packages/sadot/src/models/CustomFieldEntries.cjs');
7
+ const require_CustomValidator = require('./packages/sadot/src/models/CustomValidator.cjs');
8
+ const require_index$2 = require('./packages/sadot/src/migrations/index.cjs');
9
+ const require_index$3 = require('./packages/sadot/src/models/index.cjs');
10
+ const require_mat_path_state = require('./packages/sadot/src/mat-path-state.cjs');
11
+ const require_FieldPolicy = require('./packages/sadot/src/models/FieldPolicy.cjs');
12
+ const require_field_policy = require('./packages/sadot/src/repository/field-policy.cjs');
13
+ const require_index$4 = require('./packages/sadot/src/api/v1/templates/index.cjs');
14
+ const require_index$5 = require('./packages/sadot/src/api/index.cjs');
15
+ const require_index$6 = require('./packages/sadot/src/utils/db/index.cjs');
16
+ const require_index$7 = require('./packages/sadot/src/utils/helpers/index.cjs');
17
+ const require_filter = require('./packages/sadot/src/scopes/filter.cjs');
18
+ const require_init = require('./packages/sadot/src/utils/init.cjs');
19
+ const require_init_state = require('./packages/sadot/src/init-state.cjs');
20
+ const require_custom_fields = require('./packages/sadot/src/utils/validations/schema/custom-fields.cjs');
21
+
22
+ //#region src/index.ts
23
+ const sadotInitState = new require_init_state.SadotInitializationState();
24
+ /**
25
+ * Internal implementation of custom fields initialization
26
+ * Contains all the business logic without state tracking
27
+ */
28
+ const internalUseCustomFields = async (app, getModel, options) => {
29
+ require_index.tryAddingTraceIdMiddleware();
30
+ const { models, useCustomFieldsEntries, useModelTypeMapping, isMatPathEnabled, runLegacyMigrations } = options;
31
+ require_mat_path_state.matPathState.isMatPathEnabled = isMatPathEnabled;
32
+ if (app) {
33
+ app.use("/api", require_index$5.default);
34
+ app.use("/api/v1/templates", require_index$4.default);
35
+ }
36
+ const sequelize = options.sequelize ?? require_index$6.default(options.databaseConfig);
37
+ if (process.env.NODE_ENV === "test") await require_index$3.initTestModels(sequelize);
38
+ sequelize.addModels([require_FieldPolicy.default]);
39
+ require_init.addHooks(models, getModel, { useCustomFieldsEntries });
40
+ await require_index$3.initTables(sequelize, options.getUser, {
41
+ useCustomFieldsEntries,
42
+ useModelTypeMapping,
43
+ isMatPathEnabled,
44
+ runLegacyMigrations
45
+ });
46
+ await require_index$2.runSadotMigrations(sequelize);
47
+ require_init.addScopes(models, getModel, { useCustomFieldsEntries });
48
+ require_init.applyCustomAssociation(models);
49
+ require_index.default.debug("sadot - custom fields finished initializing with models", models);
50
+ return sequelize;
51
+ };
52
+ /**
53
+ * Adding custom fields enrichment to the models inside the MODELS_FILE_NAME json file
54
+ * @see {@link 'custom-fields/config'} for configurations
55
+ */
56
+ const useCustomFields = async (app, getModel, options) => {
57
+ const initPromise = internalUseCustomFields(app, getModel, options);
58
+ sadotInitState.setInitPromise(initPromise, !options.sequelize);
59
+ return await initPromise;
60
+ };
61
+ var src_default = useCustomFields;
62
+ const disableCustomFields = (models, getModel) => {
63
+ require_init.removeHooks(models, getModel);
64
+ };
65
+
66
+ //#endregion
67
+ exports.CUSTOM_FIELDS_FILTER_SCOPE = require_index$1.CUSTOM_FIELDS_FILTER_SCOPE;
68
+ exports.CustomFieldDefinition = require_CustomFieldDefinition.default;
69
+ exports.CustomFieldDefinitionType = require_index$1.CustomFieldDefinitionType;
70
+ exports.CustomFieldEntries = require_CustomFieldEntries.default;
71
+ exports.CustomFieldValue = require_CustomFieldValue.default;
72
+ exports.CustomFieldsSchema = require_custom_fields.CustomFieldsSchema;
73
+ exports.CustomValidator = require_CustomValidator.default;
74
+ exports.FieldPolicy = require_FieldPolicy.default;
75
+ Object.defineProperty(exports, 'FieldPolicyRepo', {
76
+ enumerable: true,
77
+ get: function () {
78
+ return require_field_policy.field_policy_exports;
79
+ }
80
+ });
81
+ exports.customFieldsSortScope = require_filter.customFieldsSortScope;
82
+ exports.default = src_default;
83
+ exports.disableCustomFields = disableCustomFields;
84
+ exports.generateCustomFieldSearchQueryPayload = require_index$7.generateCustomFieldSearchQueryPayload;
85
+ exports.generateRandomString = require_index$7.generateRandomString;
86
+ exports.sadotInitState = sadotInitState;
87
+ exports.supportedEntities = require_index$1.supportedEntities;
@@ -0,0 +1,25 @@
1
+ import { CUSTOM_FIELDS_FILTER_SCOPE, CustomFieldDefinitionType, supportedEntities } from "./utils/constants/index.cjs";
2
+ import { CustomFieldValue } from "./models/CustomFieldValue.cjs";
3
+ import { CustomFieldDefinition } from "./models/CustomFieldDefinition.cjs";
4
+ import { CustomValidator } from "./models/CustomValidator.cjs";
5
+ import { CustomFieldOptions, ModelFetcher, Models } from "./types/index.cjs";
6
+ import { SadotInitializationState } from "./init-state.cjs";
7
+ import { CustomFieldsSchema } from "./utils/validations/schema/custom-fields.cjs";
8
+ import { generateCustomFieldSearchQueryPayload, generateRandomString } from "./utils/helpers/index.cjs";
9
+ import { customFieldsSortScope } from "./scopes/filter.cjs";
10
+ import { CustomFieldEntries } from "./models/CustomFieldEntries.cjs";
11
+ import { FieldPolicy, ModelInclusion, ModelMode } from "./models/FieldPolicy.cjs";
12
+ import { field_policy_d_exports } from "./repository/field-policy.cjs";
13
+ import { Application } from "express";
14
+ import { Sequelize } from "sequelize-typescript";
15
+
16
+ //#region src/index.d.ts
17
+ declare const sadotInitState: SadotInitializationState;
18
+ /**
19
+ * Adding custom fields enrichment to the models inside the MODELS_FILE_NAME json file
20
+ * @see {@link 'custom-fields/config'} for configurations
21
+ */
22
+ declare const useCustomFields: (app: Pick<Application, "use"> | null, getModel: ModelFetcher, options: CustomFieldOptions) => Promise<Sequelize>;
23
+ declare const disableCustomFields: (models: Models[], getModel: ModelFetcher) => void;
24
+ //#endregion
25
+ export { CUSTOM_FIELDS_FILTER_SCOPE, CustomFieldDefinition, CustomFieldDefinitionType, CustomFieldEntries, CustomFieldValue, CustomFieldsSchema, CustomValidator, FieldPolicy, field_policy_d_exports as FieldPolicyRepo, type ModelInclusion, type ModelMode, customFieldsSortScope, useCustomFields as default, disableCustomFields, generateCustomFieldSearchQueryPayload, generateRandomString, sadotInitState, supportedEntities };
@@ -0,0 +1,35 @@
1
+ import { Sequelize } from "sequelize-typescript";
2
+
3
+ //#region src/init-state.d.ts
4
+
5
+ /**
6
+ * Tracks the initialization state of sadot's useCustomFields function
7
+ * Allows HealthManager to wait for initialization before passing readiness checks
8
+ */
9
+ declare class SadotInitializationState {
10
+ private initPromise;
11
+ private initError;
12
+ private isInitialized;
13
+ private sequelizeInstance;
14
+ private ownsSequelizeInstance;
15
+ /** Set the initialization promise */
16
+ setInitPromise(promise: Promise<Sequelize>, ownsSequelize: boolean): void;
17
+ /**
18
+ * Get the Sequelize instance
19
+ * Returns null if initialization hasn't completed yet, or in cases where it failed.
20
+ */
21
+ get sequelize(): Sequelize | null;
22
+ /**
23
+ * Wait for initialization to complete and return the Sequelize instance
24
+ * Returns the Sequelize instance only if Sadot created it (owns it)
25
+ * Returns undefined if the Sequelize instance was provided externally
26
+ * Rejects when initialization fails
27
+ */
28
+ waitForInitialization(): Promise<Sequelize | undefined>;
29
+ /** Check if initialization is complete and successful */
30
+ get isReady(): boolean;
31
+ /** Get the initialization error if one occurred */
32
+ get error(): Error | null;
33
+ }
34
+ //#endregion
35
+ export { SadotInitializationState };
@@ -0,0 +1,40 @@
1
+ import { CustomFieldDefinitionType } from "../utils/constants/index.cjs";
2
+ import { CustomFieldValue } from "./CustomFieldValue.cjs";
3
+ import { CustomFieldModelTypeMap } from "./CustomFieldModelTypeMap.cjs";
4
+ import { Model } from "sequelize-typescript";
5
+ import { CreateOptions } from "sequelize";
6
+
7
+ //#region src/models/CustomFieldDefinition.d.ts
8
+ declare class CustomFieldDefinition extends Model {
9
+ id: string;
10
+ name: string;
11
+ displayName?: string;
12
+ fieldType: CustomFieldDefinitionType;
13
+ validation?: any;
14
+ entityId: string;
15
+ entityType: string;
16
+ modelType: string;
17
+ description?: string;
18
+ required?: boolean;
19
+ disabled?: boolean;
20
+ defaultValue?: any;
21
+ createdAt?: Date;
22
+ updatedAt?: Date;
23
+ deletedAt?: Date;
24
+ blockEditingFromUI: boolean;
25
+ values: CustomFieldValue[];
26
+ modelTypeMappings?: CustomFieldModelTypeMap[];
27
+ private _modelTypeIds?;
28
+ get modelTypeIds(): string[] | undefined;
29
+ set modelTypeIds(value: string[] | undefined);
30
+ static displayNameDefaultValue(instance: CustomFieldDefinition): void;
31
+ static afterSaveHandler(instance: CustomFieldDefinition, options: CreateOptions): void;
32
+ /**
33
+ * Override toJSON to exclude internal associations from API responses
34
+ * The modelTypeMappings association is used internally to optimize queries
35
+ * but should not be exposed in the API response (use modelTypeIds instead)
36
+ */
37
+ toJSON(): object;
38
+ }
39
+ //#endregion
40
+ export { CustomFieldDefinition };
@@ -0,0 +1,15 @@
1
+ import { Model } from "sequelize-typescript";
2
+ import { CreateOptions } from "sequelize";
3
+
4
+ //#region src/models/CustomFieldEntries.d.ts
5
+ declare class CustomFieldEntries extends Model {
6
+ modelId: string;
7
+ entityId: string;
8
+ customFields: Record<string, any>;
9
+ modelType: string;
10
+ createdAt?: Date;
11
+ updatedAt?: Date;
12
+ static afterSaveHandler(instance: CustomFieldEntries[], options: CreateOptions): void;
13
+ }
14
+ //#endregion
15
+ export { CustomFieldEntries };
@@ -0,0 +1,14 @@
1
+ import { CustomFieldDefinition } from "./CustomFieldDefinition.cjs";
2
+ import { Model } from "sequelize-typescript";
3
+
4
+ //#region src/models/CustomFieldModelTypeMap.d.ts
5
+ declare class CustomFieldModelTypeMap extends Model {
6
+ id: string;
7
+ modelTypeId: string;
8
+ customFieldDefinitionId: string;
9
+ customFieldDefinition: CustomFieldDefinition;
10
+ createdAt?: Date;
11
+ updatedAt?: Date;
12
+ }
13
+ //#endregion
14
+ export { CustomFieldModelTypeMap };
@@ -0,0 +1,20 @@
1
+ import { CustomFieldDefinition } from "./CustomFieldDefinition.cjs";
2
+ import { Model } from "sequelize-typescript";
3
+ import { CreateOptions } from "sequelize";
4
+
5
+ //#region src/models/CustomFieldValue.d.ts
6
+ declare class CustomFieldValue extends Model {
7
+ modelId: string;
8
+ customFieldDefinitionId: string;
9
+ value: any;
10
+ createdAt?: Date;
11
+ updatedAt?: Date;
12
+ deletedAt?: Date;
13
+ customFieldDefinition: CustomFieldDefinition;
14
+ private static validateValueAgainstDefinition;
15
+ static validateCustomFieldValues(instances: CustomFieldValue[]): Promise<void>;
16
+ static validateCustomFieldValue(instance: CustomFieldValue): Promise<void>;
17
+ static afterSaveHandler(instance: CustomFieldValue[], options: CreateOptions): void;
18
+ }
19
+ //#endregion
20
+ export { CustomFieldValue };
@@ -0,0 +1,18 @@
1
+ import { SchemaObject } from "../api/v1/validator/validations.cjs";
2
+ import { Model } from "sequelize-typescript";
3
+ import { CreateOptions } from "sequelize";
4
+
5
+ //#region src/models/CustomValidator.d.ts
6
+ declare class CustomValidator extends Model {
7
+ id: string;
8
+ entityId: string;
9
+ entityType: string;
10
+ modelType: string;
11
+ schema: SchemaObject;
12
+ disabled: boolean;
13
+ createdAt?: Date;
14
+ updatedAt?: Date;
15
+ static afterSaveHandler(instance: CustomValidator, options: CreateOptions): void;
16
+ }
17
+ //#endregion
18
+ export { CustomValidator };
@@ -0,0 +1,23 @@
1
+ import { Model } from "sequelize-typescript";
2
+
3
+ //#region src/models/FieldPolicy.d.ts
4
+ type ModelMode = "full" | "partial";
5
+ type ModelInclusion = {
6
+ name: string;
7
+ mode: "full";
8
+ } | {
9
+ name: string;
10
+ mode: "partial";
11
+ fields: string[];
12
+ };
13
+ declare class FieldPolicy extends Model {
14
+ id: string;
15
+ contextId: string;
16
+ name: string;
17
+ /** Base-level field names to include */
18
+ fields: string[];
19
+ /** Model inclusions; full = all fields, partial = only listed fields */
20
+ models: ModelInclusion[];
21
+ }
22
+ //#endregion
23
+ export { FieldPolicy, ModelInclusion, ModelMode };
@@ -0,0 +1,180 @@
1
+ 'use strict';
2
+
3
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
4
+ const require_index = require('../mime-types/index.cjs');
5
+ const require_index$1 = require('../negotiator/index.cjs');
6
+
7
+ //#region ../../node_modules/accepts/index.js
8
+ /*!
9
+ * accepts
10
+ * Copyright(c) 2014 Jonathan Ong
11
+ * Copyright(c) 2015 Douglas Christopher Wilson
12
+ * MIT Licensed
13
+ */
14
+ var require_accepts = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
15
+ /**
16
+ * Module dependencies.
17
+ * @private
18
+ */
19
+ var Negotiator = require_index$1.default;
20
+ var mime = require_index.default;
21
+ /**
22
+ * Module exports.
23
+ * @public
24
+ */
25
+ module.exports = Accepts;
26
+ /**
27
+ * Create a new Accepts object for the given req.
28
+ *
29
+ * @param {object} req
30
+ * @public
31
+ */
32
+ function Accepts(req) {
33
+ if (!(this instanceof Accepts)) return new Accepts(req);
34
+ this.headers = req.headers;
35
+ this.negotiator = new Negotiator(req);
36
+ }
37
+ /**
38
+ * Check if the given `type(s)` is acceptable, returning
39
+ * the best match when true, otherwise `undefined`, in which
40
+ * case you should respond with 406 "Not Acceptable".
41
+ *
42
+ * The `type` value may be a single mime type string
43
+ * such as "application/json", the extension name
44
+ * such as "json" or an array `["json", "html", "text/plain"]`. When a list
45
+ * or array is given the _best_ match, if any is returned.
46
+ *
47
+ * Examples:
48
+ *
49
+ * // Accept: text/html
50
+ * this.types('html');
51
+ * // => "html"
52
+ *
53
+ * // Accept: text/*, application/json
54
+ * this.types('html');
55
+ * // => "html"
56
+ * this.types('text/html');
57
+ * // => "text/html"
58
+ * this.types('json', 'text');
59
+ * // => "json"
60
+ * this.types('application/json');
61
+ * // => "application/json"
62
+ *
63
+ * // Accept: text/*, application/json
64
+ * this.types('image/png');
65
+ * this.types('png');
66
+ * // => undefined
67
+ *
68
+ * // Accept: text/*;q=.5, application/json
69
+ * this.types(['html', 'json']);
70
+ * this.types('html', 'json');
71
+ * // => "json"
72
+ *
73
+ * @param {String|Array} types...
74
+ * @return {String|Array|Boolean}
75
+ * @public
76
+ */
77
+ Accepts.prototype.type = Accepts.prototype.types = function(types_) {
78
+ var types = types_;
79
+ if (types && !Array.isArray(types)) {
80
+ types = new Array(arguments.length);
81
+ for (var i = 0; i < types.length; i++) types[i] = arguments[i];
82
+ }
83
+ if (!types || types.length === 0) return this.negotiator.mediaTypes();
84
+ if (!this.headers.accept) return types[0];
85
+ var mimes = types.map(extToMime);
86
+ var first = this.negotiator.mediaTypes(mimes.filter(validMime))[0];
87
+ return first ? types[mimes.indexOf(first)] : false;
88
+ };
89
+ /**
90
+ * Return accepted encodings or best fit based on `encodings`.
91
+ *
92
+ * Given `Accept-Encoding: gzip, deflate`
93
+ * an array sorted by quality is returned:
94
+ *
95
+ * ['gzip', 'deflate']
96
+ *
97
+ * @param {String|Array} encodings...
98
+ * @return {String|Array}
99
+ * @public
100
+ */
101
+ Accepts.prototype.encoding = Accepts.prototype.encodings = function(encodings_) {
102
+ var encodings = encodings_;
103
+ if (encodings && !Array.isArray(encodings)) {
104
+ encodings = new Array(arguments.length);
105
+ for (var i = 0; i < encodings.length; i++) encodings[i] = arguments[i];
106
+ }
107
+ if (!encodings || encodings.length === 0) return this.negotiator.encodings();
108
+ return this.negotiator.encodings(encodings)[0] || false;
109
+ };
110
+ /**
111
+ * Return accepted charsets or best fit based on `charsets`.
112
+ *
113
+ * Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
114
+ * an array sorted by quality is returned:
115
+ *
116
+ * ['utf-8', 'utf-7', 'iso-8859-1']
117
+ *
118
+ * @param {String|Array} charsets...
119
+ * @return {String|Array}
120
+ * @public
121
+ */
122
+ Accepts.prototype.charset = Accepts.prototype.charsets = function(charsets_) {
123
+ var charsets = charsets_;
124
+ if (charsets && !Array.isArray(charsets)) {
125
+ charsets = new Array(arguments.length);
126
+ for (var i = 0; i < charsets.length; i++) charsets[i] = arguments[i];
127
+ }
128
+ if (!charsets || charsets.length === 0) return this.negotiator.charsets();
129
+ return this.negotiator.charsets(charsets)[0] || false;
130
+ };
131
+ /**
132
+ * Return accepted languages or best fit based on `langs`.
133
+ *
134
+ * Given `Accept-Language: en;q=0.8, es, pt`
135
+ * an array sorted by quality is returned:
136
+ *
137
+ * ['es', 'pt', 'en']
138
+ *
139
+ * @param {String|Array} langs...
140
+ * @return {Array|String}
141
+ * @public
142
+ */
143
+ Accepts.prototype.lang = Accepts.prototype.langs = Accepts.prototype.language = Accepts.prototype.languages = function(languages_) {
144
+ var languages = languages_;
145
+ if (languages && !Array.isArray(languages)) {
146
+ languages = new Array(arguments.length);
147
+ for (var i = 0; i < languages.length; i++) languages[i] = arguments[i];
148
+ }
149
+ if (!languages || languages.length === 0) return this.negotiator.languages();
150
+ return this.negotiator.languages(languages)[0] || false;
151
+ };
152
+ /**
153
+ * Convert extnames to mime.
154
+ *
155
+ * @param {String} type
156
+ * @return {String}
157
+ * @private
158
+ */
159
+ function extToMime(type) {
160
+ return type.indexOf("/") === -1 ? mime.lookup(type) : type;
161
+ }
162
+ /**
163
+ * Check if mime is valid.
164
+ *
165
+ * @param {String} type
166
+ * @return {String}
167
+ * @private
168
+ */
169
+ function validMime(type) {
170
+ return typeof type === "string";
171
+ }
172
+ }));
173
+
174
+ //#endregion
175
+ Object.defineProperty(exports, 'default', {
176
+ enumerable: true,
177
+ get: function () {
178
+ return require_accepts();
179
+ }
180
+ });
@@ -0,0 +1,61 @@
1
+ 'use strict';
2
+
3
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
4
+
5
+ //#region ../../node_modules/array-flatten/array-flatten.js
6
+ var require_array_flatten = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
7
+ /**
8
+ * Expose `arrayFlatten`.
9
+ */
10
+ module.exports = arrayFlatten;
11
+ /**
12
+ * Recursive flatten function with depth.
13
+ *
14
+ * @param {Array} array
15
+ * @param {Array} result
16
+ * @param {Number} depth
17
+ * @return {Array}
18
+ */
19
+ function flattenWithDepth(array, result, depth) {
20
+ for (var i = 0; i < array.length; i++) {
21
+ var value = array[i];
22
+ if (depth > 0 && Array.isArray(value)) flattenWithDepth(value, result, depth - 1);
23
+ else result.push(value);
24
+ }
25
+ return result;
26
+ }
27
+ /**
28
+ * Recursive flatten function. Omitting depth is slightly faster.
29
+ *
30
+ * @param {Array} array
31
+ * @param {Array} result
32
+ * @return {Array}
33
+ */
34
+ function flattenForever(array, result) {
35
+ for (var i = 0; i < array.length; i++) {
36
+ var value = array[i];
37
+ if (Array.isArray(value)) flattenForever(value, result);
38
+ else result.push(value);
39
+ }
40
+ return result;
41
+ }
42
+ /**
43
+ * Flatten an array, with the ability to define a depth.
44
+ *
45
+ * @param {Array} array
46
+ * @param {Number} depth
47
+ * @return {Array}
48
+ */
49
+ function arrayFlatten(array, depth) {
50
+ if (depth == null) return flattenForever(array, []);
51
+ return flattenWithDepth(array, [], depth);
52
+ }
53
+ }));
54
+
55
+ //#endregion
56
+ Object.defineProperty(exports, 'default', {
57
+ enumerable: true,
58
+ get: function () {
59
+ return require_array_flatten();
60
+ }
61
+ });