@autofleet/sadot 1.6.18-beta.0 → 1.6.18-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/decorate.cjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/decorateMetadata.cjs +8 -0
- package/dist/_virtual/rolldown_runtime.cjs +43 -0
- package/dist/_virtual/{rolldown_runtime.mjs → rolldown_runtime.js} +1 -2
- package/dist/api/index.cjs +12 -0
- package/dist/{packages/sadot/src/api/index.mjs → api/index.js} +2 -2
- package/dist/api/v1/definition/index.cjs +113 -0
- package/dist/{packages/sadot/src/api/v1/definition/index.mjs → api/v1/definition/index.js} +5 -5
- package/dist/api/v1/definition/validations.cjs +128 -0
- package/dist/{packages/sadot/src/api/v1/definition/validations.mjs → api/v1/definition/validations.js} +1 -1
- package/dist/api/v1/errors.cjs +14 -0
- package/dist/api/v1/field-policies/index.cjs +86 -0
- package/dist/api/v1/field-policies/index.js +85 -0
- package/dist/api/v1/index.cjs +16 -0
- package/dist/api/v1/index.js +15 -0
- package/dist/api/v1/validator/index.cjs +115 -0
- package/dist/{packages/sadot/src/api/v1/validator/index.mjs → api/v1/validator/index.js} +6 -6
- package/dist/api/v1/validator/validations.cjs +40 -0
- package/dist/api/v1/validator/validations.d.ts +22 -0
- package/dist/errors/index.cjs +62 -0
- package/dist/events/index.cjs +52 -0
- package/dist/{packages/sadot/src/events/index.mjs → events/index.js} +1 -1
- package/dist/hooks/enrich.cjs +175 -0
- package/dist/{packages/sadot/src/hooks/enrich.mjs → hooks/enrich.js} +4 -4
- package/dist/hooks/find.cjs +22 -0
- package/dist/{packages/sadot/src/hooks/find.mjs → hooks/find.js} +1 -1
- package/dist/hooks/hooks.cjs +310 -0
- package/dist/{packages/sadot/src/hooks/hooks.mjs → hooks/hooks.js} +7 -7
- package/dist/hooks/index.cjs +3 -0
- package/dist/hooks/index.js +5 -0
- package/dist/hooks/utils/updateInstanceValues.cjs +27 -0
- package/dist/{packages/sadot/src/hooks/utils/updateInstanceValues.mjs → hooks/utils/updateInstanceValues.js} +2 -2
- package/dist/index.cjs +83 -0
- package/dist/index.d.cts +25 -0
- package/dist/index.d.ts +26 -0
- package/dist/{index.mjs → index.js} +19 -23
- package/dist/init-state.cjs +56 -0
- package/dist/init-state.d.ts +35 -0
- package/dist/mat-path-state.cjs +10 -0
- package/dist/migrations/001-create-core-tables.cjs +70 -0
- package/dist/migrations/002-create-custom-field-entries.cjs +27 -0
- package/dist/migrations/003-create-custom-field-model-type-map.cjs +35 -0
- package/dist/migrations/004-create-field-policy-tables.cjs +29 -0
- package/dist/migrations/005-add-entity-type-to-field-policies.cjs +20 -0
- package/dist/migrations/005-add-entity-type-to-field-policies.js +18 -0
- package/dist/migrations/index.cjs +94 -0
- package/dist/{packages/sadot/src/migrations/index.mjs → migrations/index.js} +12 -6
- package/dist/models/CustomFieldDefinition.cjs +147 -0
- package/dist/{packages/sadot/src/models/CustomFieldDefinition.d.mts → models/CustomFieldDefinition.d.cts} +4 -4
- package/dist/models/CustomFieldDefinition.d.ts +40 -0
- package/dist/{packages/sadot/src/models/CustomFieldDefinition.mjs → models/CustomFieldDefinition.js} +9 -9
- package/dist/models/CustomFieldEntries.cjs +71 -0
- package/dist/models/CustomFieldEntries.d.cts +15 -0
- package/dist/{packages/sadot/src/models/CustomFieldEntries.mjs → models/CustomFieldEntries.js} +5 -5
- package/dist/models/CustomFieldModelTypeMap.cjs +62 -0
- package/dist/{packages/sadot/src/models/CustomFieldModelTypeMap.d.mts → models/CustomFieldModelTypeMap.d.cts} +1 -1
- package/dist/models/CustomFieldModelTypeMap.d.ts +14 -0
- package/dist/{packages/sadot/src/models/CustomFieldModelTypeMap.mjs → models/CustomFieldModelTypeMap.js} +3 -3
- package/dist/models/CustomFieldValue.cjs +109 -0
- package/dist/{packages/sadot/src/models/CustomFieldValue.d.mts → models/CustomFieldValue.d.cts} +2 -2
- package/dist/models/CustomFieldValue.d.ts +20 -0
- package/dist/{packages/sadot/src/models/CustomFieldValue.mjs → models/CustomFieldValue.js} +7 -7
- package/dist/models/CustomValidator.cjs +68 -0
- package/dist/{packages/sadot/src/models/CustomValidator.d.mts → models/CustomValidator.d.cts} +2 -2
- package/dist/models/CustomValidator.d.ts +18 -0
- package/dist/{packages/sadot/src/models/CustomValidator.mjs → models/CustomValidator.js} +3 -3
- package/dist/models/FieldPolicy.cjs +54 -0
- package/dist/{packages/sadot/src/models/FieldPolicy.d.mts → models/FieldPolicy.d.cts} +3 -1
- package/dist/models/FieldPolicy.d.ts +25 -0
- package/dist/{packages/sadot/src/models/FieldPolicy.mjs → models/FieldPolicy.js} +6 -2
- package/dist/models/index.cjs +163 -0
- package/dist/models/index.d.ts +7 -0
- package/dist/{packages/sadot/src/models/index.mjs → models/index.js} +11 -11
- package/dist/models/tests/AssociatedTestModel.cjs +51 -0
- package/dist/{packages/sadot/src/models/tests/AssociatedTestModel.mjs → models/tests/AssociatedTestModel.js} +3 -3
- package/dist/models/tests/TestModel.cjs +43 -0
- package/dist/{packages/sadot/src/models/tests/TestModel.mjs → models/tests/TestModel.js} +3 -3
- package/dist/models/tests/contextAwareModels/ContextAwareTestModel.cjs +35 -0
- package/dist/{packages/sadot/src/models/tests/contextAwareModels/ContextAwareTestModel.mjs → models/tests/contextAwareModels/ContextAwareTestModel.js} +3 -3
- package/dist/models/tests/contextAwareModels/ContextTestModel.cjs +33 -0
- package/dist/{packages/sadot/src/models/tests/contextAwareModels/ContextTestModel.mjs → models/tests/contextAwareModels/ContextTestModel.js} +2 -2
- package/dist/repository/definition.cjs +221 -0
- package/dist/{packages/sadot/src/repository/definition.mjs → repository/definition.js} +4 -4
- package/dist/repository/entries.cjs +69 -0
- package/dist/{packages/sadot/src/repository/entries.mjs → repository/entries.js} +6 -6
- package/dist/repository/field-policy.cjs +47 -0
- package/dist/repository/field-policy.d.cts +34 -0
- package/dist/{packages/sadot/src/repository/field-policy.d.mts → repository/field-policy.d.ts} +7 -2
- package/dist/{packages/sadot/src/repository/field-policy.mjs → repository/field-policy.js} +9 -4
- package/dist/repository/utils/formatValues.cjs +14 -0
- package/dist/{packages/sadot/src/repository/utils/formatValues.mjs → repository/utils/formatValues.js} +1 -1
- package/dist/repository/validator.cjs +58 -0
- package/dist/{packages/sadot/src/repository/validator.mjs → repository/validator.js} +3 -3
- package/dist/repository/value.cjs +77 -0
- package/dist/{packages/sadot/src/repository/value.mjs → repository/value.js} +6 -6
- package/dist/scopes/filter.cjs +56 -0
- package/dist/{packages/sadot/src/scopes/filter.d.mts → scopes/filter.d.cts} +2 -2
- package/dist/scopes/filter.d.ts +22 -0
- package/dist/{packages/sadot/src/scopes/filter.mjs → scopes/filter.js} +2 -2
- package/dist/scopes/helpers/filter.helpers.cjs +152 -0
- package/dist/scopes/helpers/filter.helpers.d.ts +16 -0
- package/dist/scopes/index.cjs +1 -0
- package/dist/scopes/index.js +3 -0
- package/dist/{packages/sadot/src/types/index.d.mts → types/index.d.cts} +3 -6
- package/dist/types/index.d.ts +70 -0
- package/dist/utils/constants/index.cjs +32 -0
- package/dist/utils/constants/index.d.ts +23 -0
- package/dist/utils/db/index.cjs +15 -0
- package/dist/utils/helpers/index.cjs +23 -0
- package/dist/{packages/sadot/src/utils/helpers/index.d.mts → utils/helpers/index.d.cts} +2 -2
- package/dist/utils/helpers/index.d.ts +30 -0
- package/dist/{packages/sadot/src/utils/helpers/index.mjs → utils/helpers/index.js} +1 -1
- package/dist/utils/init.cjs +115 -0
- package/dist/{packages/sadot/src/utils/init.mjs → utils/init.js} +11 -11
- package/dist/utils/logger/index.cjs +15 -0
- package/dist/utils/scopeAttributes.cjs +12 -0
- package/dist/utils/validations/index.cjs +34 -0
- package/dist/{packages/sadot/src/utils/validations/index.mjs → utils/validations/index.js} +2 -2
- package/dist/utils/validations/schema/custom-fields.cjs +9 -0
- package/dist/utils/validations/schema/custom-fields.d.ts +6 -0
- package/dist/utils/validations/schema/validator-schema.cjs +102 -0
- package/dist/{packages/sadot/src/utils/validations/schema/validator-schema.mjs → utils/validations/schema/validator-schema.js} +1 -1
- package/dist/utils/validations/validators/index.cjs +45 -0
- package/dist/{packages/sadot/src/utils/validations/validators/index.mjs → utils/validations/validators/index.js} +5 -5
- package/dist/utils/validations/validators/multi-select-dropdown.validator.cjs +7 -0
- package/dist/{packages/sadot/src/utils/validations/validators/multi-select-dropdown.validator.mjs → utils/validations/validators/multi-select-dropdown.validator.js} +1 -1
- package/dist/utils/validations/validators/multi-select-status.validator.cjs +10 -0
- package/dist/{packages/sadot/src/utils/validations/validators/multi-select-status.validator.mjs → utils/validations/validators/multi-select-status.validator.js} +1 -1
- package/dist/utils/validations/validators/multi-select.helpers.cjs +12 -0
- package/dist/utils/validations/validators/select.validator.cjs +12 -0
- package/dist/utils/validations/validators/status.validator.cjs +12 -0
- package/package.json +23 -23
- package/dist/index.d.mts +0 -26
- package/dist/node_modules/accepts/index.mjs +0 -175
- package/dist/node_modules/array-flatten/array-flatten.mjs +0 -56
- package/dist/node_modules/body-parser/index.mjs +0 -135
- package/dist/node_modules/body-parser/lib/read.mjs +0 -164
- package/dist/node_modules/body-parser/lib/types/json.mjs +0 -200
- package/dist/node_modules/body-parser/lib/types/raw.mjs +0 -85
- package/dist/node_modules/body-parser/lib/types/text.mjs +0 -101
- package/dist/node_modules/body-parser/lib/types/urlencoded.mjs +0 -217
- package/dist/node_modules/body-parser/node_modules/qs/lib/formats.mjs +0 -29
- package/dist/node_modules/body-parser/node_modules/qs/lib/index.mjs +0 -21
- package/dist/node_modules/body-parser/node_modules/qs/lib/parse.mjs +0 -182
- package/dist/node_modules/body-parser/node_modules/qs/lib/stringify.mjs +0 -187
- package/dist/node_modules/body-parser/node_modules/qs/lib/utils.mjs +0 -173
- package/dist/node_modules/bytes/index.mjs +0 -121
- package/dist/node_modules/call-bind-apply-helpers/actualApply.mjs +0 -20
- package/dist/node_modules/call-bind-apply-helpers/functionApply.mjs +0 -12
- package/dist/node_modules/call-bind-apply-helpers/functionCall.mjs +0 -12
- package/dist/node_modules/call-bind-apply-helpers/index.mjs +0 -23
- package/dist/node_modules/call-bind-apply-helpers/reflectApply.mjs +0 -12
- package/dist/node_modules/call-bound/index.mjs +0 -22
- package/dist/node_modules/content-disposition/index.mjs +0 -309
- package/dist/node_modules/content-type/index.mjs +0 -151
- package/dist/node_modules/cookie/index.mjs +0 -245
- package/dist/node_modules/cookie-signature/index.mjs +0 -48
- package/dist/node_modules/debug/node_modules/has-flag/index.mjs +0 -17
- package/dist/node_modules/debug/node_modules/supports-color/index.mjs +0 -70
- package/dist/node_modules/debug/src/browser.mjs +0 -203
- package/dist/node_modules/debug/src/common.mjs +0 -209
- package/dist/node_modules/debug/src/index.mjs +0 -18
- package/dist/node_modules/debug/src/node.mjs +0 -215
- package/dist/node_modules/depd/index.mjs +0 -316
- package/dist/node_modules/destroy/index.mjs +0 -155
- package/dist/node_modules/dunder-proto/get.mjs +0 -27
- package/dist/node_modules/ee-first/index.mjs +0 -75
- package/dist/node_modules/encodeurl/index.mjs +0 -56
- package/dist/node_modules/es-define-property/index.mjs +0 -18
- package/dist/node_modules/es-errors/eval.mjs +0 -12
- package/dist/node_modules/es-errors/index.mjs +0 -12
- package/dist/node_modules/es-errors/range.mjs +0 -12
- package/dist/node_modules/es-errors/ref.mjs +0 -12
- package/dist/node_modules/es-errors/syntax.mjs +0 -12
- package/dist/node_modules/es-errors/type.mjs +0 -12
- package/dist/node_modules/es-errors/uri.mjs +0 -12
- package/dist/node_modules/es-object-atoms/index.mjs +0 -12
- package/dist/node_modules/escape-html/index.mjs +0 -67
- package/dist/node_modules/etag/index.mjs +0 -82
- package/dist/node_modules/express/index.mjs +0 -19
- package/dist/node_modules/express/lib/application.mjs +0 -503
- package/dist/node_modules/express/lib/express.mjs +0 -114
- package/dist/node_modules/express/lib/middleware/init.mjs +0 -44
- package/dist/node_modules/express/lib/middleware/query.mjs +0 -47
- package/dist/node_modules/express/lib/request.mjs +0 -422
- package/dist/node_modules/express/lib/response.mjs +0 -867
- package/dist/node_modules/express/lib/router/index.mjs +0 -424
- package/dist/node_modules/express/lib/router/layer.mjs +0 -140
- package/dist/node_modules/express/lib/router/route.mjs +0 -158
- package/dist/node_modules/express/lib/utils.mjs +0 -247
- package/dist/node_modules/express/lib/view.mjs +0 -135
- package/dist/node_modules/express/node_modules/qs/lib/formats.mjs +0 -29
- package/dist/node_modules/express/node_modules/qs/lib/index.mjs +0 -21
- package/dist/node_modules/express/node_modules/qs/lib/parse.mjs +0 -182
- package/dist/node_modules/express/node_modules/qs/lib/stringify.mjs +0 -187
- package/dist/node_modules/express/node_modules/qs/lib/utils.mjs +0 -173
- package/dist/node_modules/finalhandler/index.mjs +0 -234
- package/dist/node_modules/forwarded/index.mjs +0 -67
- package/dist/node_modules/fresh/index.mjs +0 -96
- package/dist/node_modules/function-bind/implementation.mjs +0 -58
- package/dist/node_modules/function-bind/index.mjs +0 -13
- package/dist/node_modules/get-intrinsic/index.mjs +0 -357
- package/dist/node_modules/get-proto/Object.getPrototypeOf.mjs +0 -14
- package/dist/node_modules/get-proto/Reflect.getPrototypeOf.mjs +0 -12
- package/dist/node_modules/get-proto/index.mjs +0 -25
- package/dist/node_modules/gopd/gOPD.mjs +0 -12
- package/dist/node_modules/gopd/index.mjs +0 -19
- package/dist/node_modules/has-symbols/index.mjs +0 -21
- package/dist/node_modules/has-symbols/shams.mjs +0 -35
- package/dist/node_modules/hasown/index.mjs +0 -16
- package/dist/node_modules/http-errors/index.mjs +0 -207
- package/dist/node_modules/iconv-lite/encodings/dbcs-codec.mjs +0 -321
- package/dist/node_modules/iconv-lite/encodings/dbcs-data.mjs +0 -126
- package/dist/node_modules/iconv-lite/encodings/index.mjs +0 -32
- package/dist/node_modules/iconv-lite/encodings/internal.mjs +0 -135
- package/dist/node_modules/iconv-lite/encodings/sbcs-codec.mjs +0 -53
- package/dist/node_modules/iconv-lite/encodings/sbcs-data-generated.mjs +0 -458
- package/dist/node_modules/iconv-lite/encodings/sbcs-data.mjs +0 -150
- package/dist/node_modules/iconv-lite/encodings/tables/big5-added.mjs +0 -172
- package/dist/node_modules/iconv-lite/encodings/tables/cp936.mjs +0 -2587
- package/dist/node_modules/iconv-lite/encodings/tables/cp949.mjs +0 -2223
- package/dist/node_modules/iconv-lite/encodings/tables/cp950.mjs +0 -230
- package/dist/node_modules/iconv-lite/encodings/tables/eucjp.mjs +0 -428
- package/dist/node_modules/iconv-lite/encodings/tables/gb18030-ranges.mjs +0 -430
- package/dist/node_modules/iconv-lite/encodings/tables/gbk-added.mjs +0 -232
- package/dist/node_modules/iconv-lite/encodings/tables/shiftjis.mjs +0 -295
- package/dist/node_modules/iconv-lite/encodings/utf16.mjs +0 -107
- package/dist/node_modules/iconv-lite/encodings/utf7.mjs +0 -183
- package/dist/node_modules/iconv-lite/lib/bom-handling.mjs +0 -45
- package/dist/node_modules/iconv-lite/lib/extend-node.mjs +0 -150
- package/dist/node_modules/iconv-lite/lib/index.mjs +0 -96
- package/dist/node_modules/iconv-lite/lib/streams.mjs +0 -97
- package/dist/node_modules/inherits/inherits.mjs +0 -20
- package/dist/node_modules/inherits/inherits_browser.mjs +0 -30
- package/dist/node_modules/ipaddr.js/lib/ipaddr.mjs +0 -677
- package/dist/node_modules/math-intrinsics/abs.mjs +0 -12
- package/dist/node_modules/math-intrinsics/floor.mjs +0 -12
- package/dist/node_modules/math-intrinsics/isNaN.mjs +0 -14
- package/dist/node_modules/math-intrinsics/max.mjs +0 -12
- package/dist/node_modules/math-intrinsics/min.mjs +0 -12
- package/dist/node_modules/math-intrinsics/pow.mjs +0 -12
- package/dist/node_modules/math-intrinsics/round.mjs +0 -12
- package/dist/node_modules/math-intrinsics/sign.mjs +0 -17
- package/dist/node_modules/merge-descriptors/index.mjs +0 -46
- package/dist/node_modules/methods/index.mjs +0 -69
- package/dist/node_modules/mime/mime.mjs +0 -79
- package/dist/node_modules/mime/types.mjs +0 -1104
- package/dist/node_modules/mime-types/index.mjs +0 -123
- package/dist/node_modules/mime-types/node_modules/mime-db/db.mjs +0 -7051
- package/dist/node_modules/mime-types/node_modules/mime-db/index.mjs +0 -21
- package/dist/node_modules/ms/index.mjs +0 -124
- package/dist/node_modules/negotiator/index.mjs +0 -76
- package/dist/node_modules/negotiator/lib/charset.mjs +0 -132
- package/dist/node_modules/negotiator/lib/encoding.mjs +0 -143
- package/dist/node_modules/negotiator/lib/language.mjs +0 -138
- package/dist/node_modules/negotiator/lib/mediaType.mjs +0 -200
- package/dist/node_modules/object-inspect/index.mjs +0 -389
- package/dist/node_modules/object-inspect/util.inspect.mjs +0 -11
- package/dist/node_modules/on-finished/index.mjs +0 -178
- package/dist/node_modules/parseurl/index.mjs +0 -111
- package/dist/node_modules/path-to-regexp/index.mjs +0 -118
- package/dist/node_modules/proxy-addr/index.mjs +0 -212
- package/dist/node_modules/range-parser/index.mjs +0 -110
- package/dist/node_modules/raw-body/index.mjs +0 -209
- package/dist/node_modules/safe-buffer/index.mjs +0 -46
- package/dist/node_modules/safer-buffer/safer.mjs +0 -48
- package/dist/node_modules/send/index.mjs +0 -801
- package/dist/node_modules/send/node_modules/encodeurl/index.mjs +0 -56
- package/dist/node_modules/serve-static/index.mjs +0 -134
- package/dist/node_modules/setprototypeof/index.mjs +0 -19
- package/dist/node_modules/side-channel/index.mjs +0 -45
- package/dist/node_modules/side-channel-list/index.mjs +0 -84
- package/dist/node_modules/side-channel-map/index.mjs +0 -62
- package/dist/node_modules/side-channel-weakmap/index.mjs +0 -73
- package/dist/node_modules/statuses/codes.mjs +0 -75
- package/dist/node_modules/statuses/index.mjs +0 -108
- package/dist/node_modules/toidentifier/index.mjs +0 -32
- package/dist/node_modules/type-is/index.mjs +0 -179
- package/dist/node_modules/type-is/node_modules/media-typer/index.mjs +0 -186
- package/dist/node_modules/unpipe/index.mjs +0 -50
- package/dist/node_modules/utils-merge/index.mjs +0 -28
- package/dist/node_modules/vary/index.mjs +0 -95
- package/dist/packages/sadot/src/api/v1/index.mjs +0 -15
- package/dist/packages/sadot/src/api/v1/templates/index.mjs +0 -76
- package/dist/packages/sadot/src/hooks/index.mjs +0 -5
- package/dist/packages/sadot/src/models/index.d.mts +0 -7
- package/dist/packages/sadot/src/scopes/index.mjs +0 -3
- package/dist/packages/zehut/src/check-permission.d.mts +0 -6
- package/dist/packages/zehut/src/errors.d.mts +0 -1
- package/dist/packages/zehut/src/index.d.mts +0 -6
- package/dist/packages/zehut/src/permissions/SDK/evaluatePermissions.d.mts +0 -1
- package/dist/packages/zehut/src/permissions/SDK/types.d.mts +0 -1
- package/dist/packages/zehut/src/permissions/index.d.mts +0 -2
- package/dist/packages/zehut/src/permissions/middleware/requirePermissions.d.mts +0 -1
- package/dist/packages/zehut/src/user/ApiUser.d.mts +0 -59
- package/dist/packages/zehut/src/user/fastify.d.mts +0 -8
- package/dist/packages/zehut/src/user/index.d.mts +0 -9
- /package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/{decorate.mjs → decorate.js} +0 -0
- /package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/{decorateMetadata.mjs → decorateMetadata.js} +0 -0
- /package/dist/{packages/sadot/src/api/v1/errors.mjs → api/v1/errors.js} +0 -0
- /package/dist/{packages/sadot/src/api/v1/validator/validations.d.mts → api/v1/validator/validations.d.cts} +0 -0
- /package/dist/{packages/sadot/src/api/v1/validator/validations.mjs → api/v1/validator/validations.js} +0 -0
- /package/dist/{packages/sadot/src/errors/index.mjs → errors/index.js} +0 -0
- /package/dist/{packages/sadot/src/init-state.d.mts → init-state.d.cts} +0 -0
- /package/dist/{packages/sadot/src/init-state.mjs → init-state.js} +0 -0
- /package/dist/{packages/sadot/src/mat-path-state.mjs → mat-path-state.js} +0 -0
- /package/dist/{packages/sadot/src/migrations/001-create-core-tables.mjs → migrations/001-create-core-tables.js} +0 -0
- /package/dist/{packages/sadot/src/migrations/002-create-custom-field-entries.mjs → migrations/002-create-custom-field-entries.js} +0 -0
- /package/dist/{packages/sadot/src/migrations/003-create-custom-field-model-type-map.mjs → migrations/003-create-custom-field-model-type-map.js} +0 -0
- /package/dist/{packages/sadot/src/migrations/004-create-field-policy-tables.mjs → migrations/004-create-field-policy-tables.js} +0 -0
- /package/dist/{packages/sadot/src/models/CustomFieldEntries.d.mts → models/CustomFieldEntries.d.ts} +0 -0
- /package/dist/{packages/sadot/src/scopes/helpers/filter.helpers.d.mts → scopes/helpers/filter.helpers.d.cts} +0 -0
- /package/dist/{packages/sadot/src/scopes/helpers/filter.helpers.mjs → scopes/helpers/filter.helpers.js} +0 -0
- /package/dist/{packages/sadot/src/utils/constants/index.d.mts → utils/constants/index.d.cts} +0 -0
- /package/dist/{packages/sadot/src/utils/constants/index.mjs → utils/constants/index.js} +0 -0
- /package/dist/{packages/sadot/src/utils/db/index.mjs → utils/db/index.js} +0 -0
- /package/dist/{packages/sadot/src/utils/logger/index.mjs → utils/logger/index.js} +0 -0
- /package/dist/{packages/sadot/src/utils/scopeAttributes.mjs → utils/scopeAttributes.js} +0 -0
- /package/dist/{packages/sadot/src/utils/validations/schema/custom-fields.d.mts → utils/validations/schema/custom-fields.d.cts} +0 -0
- /package/dist/{packages/sadot/src/utils/validations/schema/custom-fields.mjs → utils/validations/schema/custom-fields.js} +0 -0
- /package/dist/{packages/sadot/src/utils/validations/validators/multi-select.helpers.mjs → utils/validations/validators/multi-select.helpers.js} +0 -0
- /package/dist/{packages/sadot/src/utils/validations/validators/select.validator.mjs → utils/validations/validators/select.validator.js} +0 -0
- /package/dist/{packages/sadot/src/utils/validations/validators/status.validator.mjs → utils/validations/validators/status.validator.js} +0 -0
|
@@ -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,43 @@
|
|
|
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 __export = (all, symbols) => {
|
|
9
|
+
let target = {};
|
|
10
|
+
for (var name in all) {
|
|
11
|
+
__defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
if (symbols) {
|
|
17
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
|
+
}
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
24
|
+
key = keys[i];
|
|
25
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
26
|
+
__defProp(to, key, {
|
|
27
|
+
get: ((k) => from[k]).bind(null, key),
|
|
28
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return to;
|
|
34
|
+
};
|
|
35
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
36
|
+
value: mod,
|
|
37
|
+
enumerable: true
|
|
38
|
+
}) : target, mod));
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
|
|
42
|
+
exports.__export = __export;
|
|
43
|
+
exports.__toESM = __toESM;
|
|
@@ -2,7 +2,6 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
|
|
3
3
|
//#region rolldown:runtime
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
6
5
|
var __export = (all, symbols) => {
|
|
7
6
|
let target = {};
|
|
8
7
|
for (var name in all) {
|
|
@@ -19,4 +18,4 @@ var __export = (all, symbols) => {
|
|
|
19
18
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
20
19
|
|
|
21
20
|
//#endregion
|
|
22
|
-
export {
|
|
21
|
+
export { __export, __require };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_index = require('../utils/logger/index.cjs');
|
|
3
|
+
const require_index$1 = require('./v1/index.cjs');
|
|
4
|
+
let _autofleet_node_common = require("@autofleet/node-common");
|
|
5
|
+
|
|
6
|
+
//#region src/api/index.ts
|
|
7
|
+
const router = (0, _autofleet_node_common.Router)({ logger: require_index.default });
|
|
8
|
+
router.use("/v1", require_index$1.default);
|
|
9
|
+
var api_default = router;
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
exports.default = api_default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import logger_default from "../utils/logger/index.
|
|
2
|
-
import v1_default from "./v1/index.
|
|
1
|
+
import logger_default from "../utils/logger/index.js";
|
|
2
|
+
import v1_default from "./v1/index.js";
|
|
3
3
|
import { Router } from "@autofleet/node-common";
|
|
4
4
|
|
|
5
5
|
//#region src/api/index.ts
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_index = require('../../../utils/logger/index.cjs');
|
|
3
|
+
const require_definition = require('../../../repository/definition.cjs');
|
|
4
|
+
const require_errors = require('../errors.cjs');
|
|
5
|
+
const require_validations = require('./validations.cjs');
|
|
6
|
+
const require_mat_path_state = require('../../../mat-path-state.cjs');
|
|
7
|
+
let _autofleet_errors = require("@autofleet/errors");
|
|
8
|
+
let _autofleet_node_common = require("@autofleet/node-common");
|
|
9
|
+
|
|
10
|
+
//#region src/api/v1/definition/index.ts
|
|
11
|
+
const router = (0, _autofleet_node_common.Router)({ logger: require_index.default });
|
|
12
|
+
const ENTITY = "CustomFieldDefinition";
|
|
13
|
+
const toPascalCase = (str) => str.replace(/(^\w|-\w)/g, (subStr) => subStr.replace(/-/, "").toUpperCase());
|
|
14
|
+
/**
|
|
15
|
+
* Create
|
|
16
|
+
*/
|
|
17
|
+
router.post("/", async (req, res) => {
|
|
18
|
+
const { modelName } = req.params;
|
|
19
|
+
const modelType = toPascalCase(modelName);
|
|
20
|
+
try {
|
|
21
|
+
const validatedPayload = await require_validations.validateCustomFieldDefinitionCreation(req.body);
|
|
22
|
+
const customFieldDefinition = await require_definition.create({
|
|
23
|
+
...validatedPayload,
|
|
24
|
+
modelType
|
|
25
|
+
});
|
|
26
|
+
return res.status(201).json(customFieldDefinition);
|
|
27
|
+
} catch (err) {
|
|
28
|
+
require_index.default.error("Failed to create custom field definition", err);
|
|
29
|
+
return require_errors.default(err, res, {
|
|
30
|
+
logger: require_index.default,
|
|
31
|
+
message: `Error in create ${ENTITY} request`
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Get by id
|
|
37
|
+
*/
|
|
38
|
+
router.get("/:customFieldDefinitionId", async (req, res) => {
|
|
39
|
+
const { customFieldDefinitionId } = req.params;
|
|
40
|
+
try {
|
|
41
|
+
const customFieldDefinition = await require_definition.findById(customFieldDefinitionId);
|
|
42
|
+
if (!customFieldDefinition) throw new _autofleet_errors.ResourceNotFoundError();
|
|
43
|
+
return res.json(customFieldDefinition);
|
|
44
|
+
} catch (err) {
|
|
45
|
+
require_index.default.error("Failed to fetch custom field definition", err);
|
|
46
|
+
return require_errors.default(err, res, {
|
|
47
|
+
logger: require_index.default,
|
|
48
|
+
message: `Error in get ${ENTITY} request`
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Get all
|
|
54
|
+
*/
|
|
55
|
+
router.get("/", async (req, res) => {
|
|
56
|
+
const { params: { modelName }, query: { entityIds, modelTypeId } } = req;
|
|
57
|
+
const modelType = toPascalCase(modelName);
|
|
58
|
+
try {
|
|
59
|
+
const applyEntityIdsFilter = !require_mat_path_state.matPathState.isMatPathEnabled?.() && entityIds && entityIds.length > 0;
|
|
60
|
+
if (modelTypeId) {
|
|
61
|
+
const customFieldDefinitions$1 = await require_definition.findByModelTypeId(modelTypeId, {
|
|
62
|
+
withDisabled: true,
|
|
63
|
+
modelType,
|
|
64
|
+
entityIds: applyEntityIdsFilter ? entityIds : void 0
|
|
65
|
+
});
|
|
66
|
+
return res.json(customFieldDefinitions$1);
|
|
67
|
+
}
|
|
68
|
+
const where = {
|
|
69
|
+
modelType,
|
|
70
|
+
...applyEntityIdsFilter && { entityId: entityIds }
|
|
71
|
+
};
|
|
72
|
+
const customFieldDefinitions = await require_definition.findAll(where, {
|
|
73
|
+
withDisabled: true,
|
|
74
|
+
enrichWithModelTypeIds: true
|
|
75
|
+
});
|
|
76
|
+
return res.json(customFieldDefinitions);
|
|
77
|
+
} catch (err) {
|
|
78
|
+
require_index.default.error("Failed to fetch custom field definitions", err);
|
|
79
|
+
return require_errors.default(err, res, {
|
|
80
|
+
logger: require_index.default,
|
|
81
|
+
message: `Error in get all ${ENTITY} request`
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
/**
|
|
86
|
+
* Update
|
|
87
|
+
*/
|
|
88
|
+
router.patch("/:customFieldDefinitionId", async (req, res) => {
|
|
89
|
+
const { customFieldDefinitionId, modelName } = req.params;
|
|
90
|
+
const modelType = toPascalCase(modelName);
|
|
91
|
+
try {
|
|
92
|
+
const validatedPayload = await require_validations.validateCustomFieldDefinitionUpdate(req.body);
|
|
93
|
+
if (!await require_definition.findByWhere({
|
|
94
|
+
id: customFieldDefinitionId,
|
|
95
|
+
modelType
|
|
96
|
+
})) throw new _autofleet_errors.ResourceNotFoundError();
|
|
97
|
+
const updatedCustomFieldDefinition = await require_definition.update(customFieldDefinitionId, {
|
|
98
|
+
...validatedPayload,
|
|
99
|
+
modelType
|
|
100
|
+
});
|
|
101
|
+
return res.status(200).json(updatedCustomFieldDefinition);
|
|
102
|
+
} catch (err) {
|
|
103
|
+
require_index.default.error("Failed to patch custom field definition", err);
|
|
104
|
+
return require_errors.default(err, res, {
|
|
105
|
+
logger: require_index.default,
|
|
106
|
+
message: `Error in update ${ENTITY} request`
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
var definition_default = router;
|
|
111
|
+
|
|
112
|
+
//#endregion
|
|
113
|
+
exports.default = definition_default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import logger_default from "../../../utils/logger/index.
|
|
2
|
-
import { create, findAll, findById, findByModelTypeId, findByWhere, update } from "../../../repository/definition.
|
|
3
|
-
import errors_default from "../errors.
|
|
4
|
-
import { validateCustomFieldDefinitionCreation, validateCustomFieldDefinitionUpdate } from "./validations.
|
|
5
|
-
import { matPathState } from "../../../mat-path-state.
|
|
1
|
+
import logger_default from "../../../utils/logger/index.js";
|
|
2
|
+
import { create, findAll, findById, findByModelTypeId, findByWhere, update } from "../../../repository/definition.js";
|
|
3
|
+
import errors_default from "../errors.js";
|
|
4
|
+
import { validateCustomFieldDefinitionCreation, validateCustomFieldDefinitionUpdate } from "./validations.js";
|
|
5
|
+
import { matPathState } from "../../../mat-path-state.js";
|
|
6
6
|
import { ResourceNotFoundError } from "@autofleet/errors";
|
|
7
7
|
import { Router } from "@autofleet/node-common";
|
|
8
8
|
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_index = require('../../../utils/constants/index.cjs');
|
|
3
|
+
let joi = require("joi");
|
|
4
|
+
joi = require_rolldown_runtime.__toESM(joi);
|
|
5
|
+
|
|
6
|
+
//#region src/api/v1/definition/validations.ts
|
|
7
|
+
const FileValidationSchema = joi.default.object({
|
|
8
|
+
name: joi.default.string().required(),
|
|
9
|
+
type: joi.default.string(),
|
|
10
|
+
size: joi.default.string(),
|
|
11
|
+
addedBy: joi.default.string().uuid()
|
|
12
|
+
});
|
|
13
|
+
const statusValidationObject = joi.default.object({
|
|
14
|
+
value: joi.default.string().required(),
|
|
15
|
+
color: joi.default.string().required()
|
|
16
|
+
});
|
|
17
|
+
const stringOptionsSchema = joi.default.array().required().items(joi.default.string()).min(1).unique();
|
|
18
|
+
const statusOptionsSchema = joi.default.array().required().items(statusValidationObject).min(1).unique("value");
|
|
19
|
+
/**
|
|
20
|
+
* Schema for the validation of custom field definition
|
|
21
|
+
* The only custom validation is for
|
|
22
|
+
* {@link CustomFieldDefinitionType.SELECT SELECT},
|
|
23
|
+
* {@link CustomFieldDefinitionType.MULTI_SELECT_DROPDOWN MULTI_SELECT_DROPDOWN},
|
|
24
|
+
* {@link CustomFieldDefinitionType.STATUS STATUS},
|
|
25
|
+
* and
|
|
26
|
+
* {@link CustomFieldDefinitionType.MULTI_SELECT_STATUS MULTI_SELECT_STATUS}
|
|
27
|
+
* field types.
|
|
28
|
+
* The rest of the field types are validated by Joi
|
|
29
|
+
*/
|
|
30
|
+
const ValidationSchema = joi.default.when("fieldType", {
|
|
31
|
+
switch: [
|
|
32
|
+
{
|
|
33
|
+
is: require_index.CustomFieldDefinitionType.SELECT,
|
|
34
|
+
then: stringOptionsSchema
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
is: require_index.CustomFieldDefinitionType.MULTI_SELECT_DROPDOWN,
|
|
38
|
+
then: stringOptionsSchema
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
is: require_index.CustomFieldDefinitionType.STATUS,
|
|
42
|
+
then: statusOptionsSchema
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
is: require_index.CustomFieldDefinitionType.MULTI_SELECT_STATUS,
|
|
46
|
+
then: statusOptionsSchema
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
otherwise: joi.default.forbidden()
|
|
50
|
+
});
|
|
51
|
+
const multiSelectDefaultValueSchema = joi.default.array().items(joi.default.string()).unique().allow(null);
|
|
52
|
+
const DefaultValueSchema = joi.default.when("fieldType", { switch: [
|
|
53
|
+
{
|
|
54
|
+
is: require_index.CustomFieldDefinitionType.BOOLEAN,
|
|
55
|
+
then: joi.default.boolean().allow(null)
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
is: require_index.CustomFieldDefinitionType.DATE,
|
|
59
|
+
then: joi.default.date().allow(null)
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
is: require_index.CustomFieldDefinitionType.DATETIME,
|
|
63
|
+
then: joi.default.date().allow(null)
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
is: require_index.CustomFieldDefinitionType.FILE,
|
|
67
|
+
then: joi.default.array().items(FileValidationSchema).allow(null)
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
is: require_index.CustomFieldDefinitionType.IMAGE,
|
|
71
|
+
then: joi.default.array().items(joi.default.string().uri()).allow(null)
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
is: require_index.CustomFieldDefinitionType.NUMBER,
|
|
75
|
+
then: joi.default.number().allow(null)
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
is: require_index.CustomFieldDefinitionType.SELECT,
|
|
79
|
+
then: joi.default.string().allow(null)
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
is: require_index.CustomFieldDefinitionType.STATUS,
|
|
83
|
+
then: joi.default.string().allow(null)
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
is: require_index.CustomFieldDefinitionType.TEXT,
|
|
87
|
+
then: joi.default.string().allow(null)
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
is: require_index.CustomFieldDefinitionType.MULTI_SELECT_STATUS,
|
|
91
|
+
then: multiSelectDefaultValueSchema
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
is: require_index.CustomFieldDefinitionType.MULTI_SELECT_DROPDOWN,
|
|
95
|
+
then: multiSelectDefaultValueSchema
|
|
96
|
+
}
|
|
97
|
+
] });
|
|
98
|
+
const CustomFieldDefinitionCreationSchema = joi.default.object({
|
|
99
|
+
name: joi.default.string().required(),
|
|
100
|
+
displayName: joi.default.string().required(),
|
|
101
|
+
validation: ValidationSchema,
|
|
102
|
+
defaultValue: DefaultValueSchema,
|
|
103
|
+
fieldType: joi.default.string().valid(...Object.values(require_index.CustomFieldDefinitionType)).required(),
|
|
104
|
+
entityId: joi.default.string().guid().required(),
|
|
105
|
+
entityType: joi.default.string().required(),
|
|
106
|
+
description: joi.default.string(),
|
|
107
|
+
required: joi.default.boolean(),
|
|
108
|
+
disabled: joi.default.boolean(),
|
|
109
|
+
blockEditingFromUI: joi.default.boolean(),
|
|
110
|
+
modelTypeIds: joi.default.array().items(joi.default.string().guid())
|
|
111
|
+
}).oxor("required", "blockEditingFromUI", { isPresent: (value) => value === true });
|
|
112
|
+
const CustomFieldDefinitionUpdateSchema = joi.default.object({
|
|
113
|
+
displayName: joi.default.string(),
|
|
114
|
+
validation: ValidationSchema,
|
|
115
|
+
defaultValue: DefaultValueSchema,
|
|
116
|
+
fieldType: joi.default.string().valid(...Object.values(require_index.CustomFieldDefinitionType)),
|
|
117
|
+
description: joi.default.string().allow(null),
|
|
118
|
+
required: joi.default.boolean(),
|
|
119
|
+
disabled: joi.default.boolean(),
|
|
120
|
+
blockEditingFromUI: joi.default.boolean(),
|
|
121
|
+
modelTypeIds: joi.default.array().items(joi.default.string().guid())
|
|
122
|
+
}).oxor("required", "blockEditingFromUI", { isPresent: (value) => value === true });
|
|
123
|
+
const validateCustomFieldDefinitionCreation = (payload) => CustomFieldDefinitionCreationSchema.validateAsync(payload, { abortEarly: false });
|
|
124
|
+
const validateCustomFieldDefinitionUpdate = (payload) => CustomFieldDefinitionUpdateSchema.validateAsync(payload, { abortEarly: false });
|
|
125
|
+
|
|
126
|
+
//#endregion
|
|
127
|
+
exports.validateCustomFieldDefinitionCreation = validateCustomFieldDefinitionCreation;
|
|
128
|
+
exports.validateCustomFieldDefinitionUpdate = validateCustomFieldDefinitionUpdate;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let sequelize = require("sequelize");
|
|
3
|
+
let joi = require("joi");
|
|
4
|
+
let _autofleet_errors = require("@autofleet/errors");
|
|
5
|
+
|
|
6
|
+
//#region src/api/v1/errors.ts
|
|
7
|
+
var errors_default = (err, res, additionalData) => {
|
|
8
|
+
let error = err;
|
|
9
|
+
if ([joi.ValidationError, sequelize.ValidationError].some((ErrClass) => err instanceof ErrClass)) error = new _autofleet_errors.BadRequest([err]);
|
|
10
|
+
return (0, _autofleet_errors.handleError)(error, res, additionalData);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.default = errors_default;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_index = require('../../../utils/logger/index.cjs');
|
|
3
|
+
const require_errors = require('../errors.cjs');
|
|
4
|
+
const require_field_policy = require('../../../repository/field-policy.cjs');
|
|
5
|
+
let sequelize = require("sequelize");
|
|
6
|
+
let _autofleet_node_common = require("@autofleet/node-common");
|
|
7
|
+
|
|
8
|
+
//#region src/api/v1/field-policies/index.ts
|
|
9
|
+
const router = (0, _autofleet_node_common.Router)({ logger: require_index.default });
|
|
10
|
+
router.get("/", async (_req, res) => {
|
|
11
|
+
try {
|
|
12
|
+
const policies = await require_field_policy.findAll();
|
|
13
|
+
res.status(200).json(policies);
|
|
14
|
+
} catch (err) {
|
|
15
|
+
require_errors.default(err, res, {
|
|
16
|
+
logger: require_index.default,
|
|
17
|
+
message: "Error in get field policies request"
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
router.post("/", async (req, res) => {
|
|
22
|
+
const { contextId, name, entityType, fields, models } = req.body;
|
|
23
|
+
if (!contextId || !name) {
|
|
24
|
+
res.status(400).json({ error: "contextId and name are required" });
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const policy = await require_field_policy.create({
|
|
29
|
+
contextId,
|
|
30
|
+
name,
|
|
31
|
+
entityType,
|
|
32
|
+
fields,
|
|
33
|
+
models
|
|
34
|
+
});
|
|
35
|
+
res.status(201).json(policy);
|
|
36
|
+
} catch (err) {
|
|
37
|
+
if (err instanceof sequelize.UniqueConstraintError) {
|
|
38
|
+
res.status(409).json({ error: "A field policy for this contextId and name already exists" });
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
require_errors.default(err, res, {
|
|
42
|
+
logger: require_index.default,
|
|
43
|
+
message: "Error in create field policy request"
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
router.put("/:policyId", async (req, res) => {
|
|
48
|
+
const { policyId } = req.params;
|
|
49
|
+
const { entityType, fields, models } = req.body;
|
|
50
|
+
try {
|
|
51
|
+
const updated = await require_field_policy.update(policyId, {
|
|
52
|
+
entityType,
|
|
53
|
+
fields,
|
|
54
|
+
models
|
|
55
|
+
});
|
|
56
|
+
if (!updated) {
|
|
57
|
+
res.status(404).json({ error: "Field policy not found" });
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
res.status(200).json(updated);
|
|
61
|
+
} catch (err) {
|
|
62
|
+
require_errors.default(err, res, {
|
|
63
|
+
logger: require_index.default,
|
|
64
|
+
message: "Error in update field policy request"
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
router.delete("/:policyId", async (req, res) => {
|
|
69
|
+
const { policyId } = req.params;
|
|
70
|
+
try {
|
|
71
|
+
if (!await require_field_policy.remove(policyId)) {
|
|
72
|
+
res.status(404).json({ error: "Field policy not found" });
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
res.status(204).send();
|
|
76
|
+
} catch (err) {
|
|
77
|
+
require_errors.default(err, res, {
|
|
78
|
+
logger: require_index.default,
|
|
79
|
+
message: "Error in delete field policy request"
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
var field_policies_default = router;
|
|
84
|
+
|
|
85
|
+
//#endregion
|
|
86
|
+
exports.default = field_policies_default;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import logger_default from "../../../utils/logger/index.js";
|
|
2
|
+
import errors_default from "../errors.js";
|
|
3
|
+
import { create, findAll, remove, update } from "../../../repository/field-policy.js";
|
|
4
|
+
import { UniqueConstraintError } from "sequelize";
|
|
5
|
+
import { Router } from "@autofleet/node-common";
|
|
6
|
+
|
|
7
|
+
//#region src/api/v1/field-policies/index.ts
|
|
8
|
+
const router = Router({ logger: logger_default });
|
|
9
|
+
router.get("/", async (_req, res) => {
|
|
10
|
+
try {
|
|
11
|
+
const policies = await findAll();
|
|
12
|
+
res.status(200).json(policies);
|
|
13
|
+
} catch (err) {
|
|
14
|
+
errors_default(err, res, {
|
|
15
|
+
logger: logger_default,
|
|
16
|
+
message: "Error in get field policies request"
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
router.post("/", async (req, res) => {
|
|
21
|
+
const { contextId, name, entityType, fields, models } = req.body;
|
|
22
|
+
if (!contextId || !name) {
|
|
23
|
+
res.status(400).json({ error: "contextId and name are required" });
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
const policy = await create({
|
|
28
|
+
contextId,
|
|
29
|
+
name,
|
|
30
|
+
entityType,
|
|
31
|
+
fields,
|
|
32
|
+
models
|
|
33
|
+
});
|
|
34
|
+
res.status(201).json(policy);
|
|
35
|
+
} catch (err) {
|
|
36
|
+
if (err instanceof UniqueConstraintError) {
|
|
37
|
+
res.status(409).json({ error: "A field policy for this contextId and name already exists" });
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
errors_default(err, res, {
|
|
41
|
+
logger: logger_default,
|
|
42
|
+
message: "Error in create field policy request"
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
router.put("/:policyId", async (req, res) => {
|
|
47
|
+
const { policyId } = req.params;
|
|
48
|
+
const { entityType, fields, models } = req.body;
|
|
49
|
+
try {
|
|
50
|
+
const updated = await update(policyId, {
|
|
51
|
+
entityType,
|
|
52
|
+
fields,
|
|
53
|
+
models
|
|
54
|
+
});
|
|
55
|
+
if (!updated) {
|
|
56
|
+
res.status(404).json({ error: "Field policy not found" });
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
res.status(200).json(updated);
|
|
60
|
+
} catch (err) {
|
|
61
|
+
errors_default(err, res, {
|
|
62
|
+
logger: logger_default,
|
|
63
|
+
message: "Error in update field policy request"
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
router.delete("/:policyId", async (req, res) => {
|
|
68
|
+
const { policyId } = req.params;
|
|
69
|
+
try {
|
|
70
|
+
if (!await remove(policyId)) {
|
|
71
|
+
res.status(404).json({ error: "Field policy not found" });
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
res.status(204).send();
|
|
75
|
+
} catch (err) {
|
|
76
|
+
errors_default(err, res, {
|
|
77
|
+
logger: logger_default,
|
|
78
|
+
message: "Error in delete field policy request"
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
var field_policies_default = router;
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
export { field_policies_default as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_index = require('../../utils/logger/index.cjs');
|
|
3
|
+
const require_index$1 = require('./definition/index.cjs');
|
|
4
|
+
const require_index$2 = require('./validator/index.cjs');
|
|
5
|
+
const require_index$3 = require('./field-policies/index.cjs');
|
|
6
|
+
let _autofleet_node_common = require("@autofleet/node-common");
|
|
7
|
+
|
|
8
|
+
//#region src/api/v1/index.ts
|
|
9
|
+
const router = (0, _autofleet_node_common.Router)({ logger: require_index.default });
|
|
10
|
+
router.use("/custom-field-definitions/:modelName", require_index$1.default);
|
|
11
|
+
router.use("/custom-validators/:modelName", require_index$2.default);
|
|
12
|
+
router.use("/field-policies/:modelName", require_index$3.default);
|
|
13
|
+
var v1_default = router;
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.default = v1_default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import logger_default from "../../utils/logger/index.js";
|
|
2
|
+
import definition_default from "./definition/index.js";
|
|
3
|
+
import validator_default from "./validator/index.js";
|
|
4
|
+
import field_policies_default from "./field-policies/index.js";
|
|
5
|
+
import { Router } from "@autofleet/node-common";
|
|
6
|
+
|
|
7
|
+
//#region src/api/v1/index.ts
|
|
8
|
+
const router = Router({ logger: logger_default });
|
|
9
|
+
router.use("/custom-field-definitions/:modelName", definition_default);
|
|
10
|
+
router.use("/custom-validators/:modelName", validator_default);
|
|
11
|
+
router.use("/field-policies/:modelName", field_policies_default);
|
|
12
|
+
var v1_default = router;
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { v1_default as default };
|