arkos 1.4.10-beta → 1.4.11-beta
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/cjs/app.js +1 -1
- package/dist/cjs/app.js.map +1 -1
- package/dist/cjs/modules/auth/auth.router.js +39 -4
- package/dist/cjs/modules/auth/auth.router.js.map +1 -1
- package/dist/cjs/modules/auth/utils/auth-openapi-generator.js +372 -0
- package/dist/cjs/modules/auth/utils/auth-openapi-generator.js.map +1 -0
- package/dist/cjs/modules/auth/utils/auth-prisma-json-schema-generator.js +102 -0
- package/dist/cjs/modules/auth/utils/auth-prisma-json-schema-generator.js.map +1 -0
- package/dist/cjs/modules/base/base.middlewares.js +1 -1
- package/dist/cjs/modules/base/base.middlewares.js.map +1 -1
- package/dist/cjs/modules/base/types/base.service.types.js.map +1 -1
- package/dist/cjs/modules/base/utils/helpers/base.router.helpers.js +46 -14
- package/dist/cjs/modules/base/utils/helpers/base.router.helpers.js.map +1 -1
- package/dist/cjs/modules/base/utils/helpers/base.service.helpers.js +17 -5
- package/dist/cjs/modules/base/utils/helpers/base.service.helpers.js.map +1 -1
- package/dist/cjs/modules/base/utils/model-openapi-generator.js +443 -0
- package/dist/cjs/modules/base/utils/model-openapi-generator.js.map +1 -0
- package/dist/cjs/modules/error-handler/error-handler.controller.js +0 -2
- package/dist/cjs/modules/error-handler/error-handler.controller.js.map +1 -1
- package/dist/cjs/modules/error-handler/utils/error-handler.helpers.js +0 -106
- package/dist/cjs/modules/error-handler/utils/error-handler.helpers.js.map +1 -1
- package/dist/cjs/modules/file-upload/file-upload.router.js +19 -0
- package/dist/cjs/modules/file-upload/file-upload.router.js.map +1 -1
- package/dist/cjs/modules/file-upload/utils/file-upload-json-schema-generator.js +351 -0
- package/dist/cjs/modules/file-upload/utils/file-upload-json-schema-generator.js.map +1 -0
- package/dist/cjs/modules/swagger/swagger.router.js +35 -16
- package/dist/cjs/modules/swagger/swagger.router.js.map +1 -1
- package/dist/cjs/modules/swagger/utils/helpers/get-swagger-default-configs.js +1 -2
- package/dist/cjs/modules/swagger/utils/helpers/get-swagger-default-configs.js.map +1 -1
- package/dist/cjs/modules/swagger/utils/helpers/openapi-schema-converter.js +68 -31
- package/dist/cjs/modules/swagger/utils/helpers/openapi-schema-converter.js.map +1 -1
- package/dist/cjs/server.js +0 -6
- package/dist/cjs/server.js.map +1 -1
- package/dist/cjs/types/arkos-config.js.map +1 -1
- package/dist/cjs/types/{arkos-config/utils.js → arkos-prisma-input.bak.js} +1 -1
- package/dist/cjs/types/arkos-prisma-input.bak.js.map +1 -0
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/utils/arkos-router/arkos-router-openapi-manager.js +3 -12
- package/dist/cjs/utils/arkos-router/arkos-router-openapi-manager.js.map +1 -1
- package/dist/cjs/utils/arkos-router/index.js +47 -8
- package/dist/cjs/utils/arkos-router/index.js.map +1 -1
- package/dist/cjs/utils/arkos-router/types/openapi-config.js.map +1 -1
- package/dist/cjs/utils/arkos-router/utils/helpers/index.js +15 -2
- package/dist/cjs/utils/arkos-router/utils/helpers/index.js.map +1 -1
- package/dist/cjs/utils/cli/generate.js +4 -4
- package/dist/cjs/utils/cli/generate.js.map +1 -1
- package/dist/cjs/utils/cli/index.js +11 -11
- package/dist/cjs/utils/cli/index.js.map +1 -1
- package/dist/cjs/utils/cli/utils/cli.helpers.js +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js +29 -5
- package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js.map +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js +26 -5
- package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js.map +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator-dto-generator.js +52 -0
- package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator-dto-generator.js.map +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/zod/create-schema-template.js +10 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/zod/create-schema-template.js.map +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/zod/update-schema-template.js +9 -2
- package/dist/cjs/utils/cli/utils/template-generator/templates/zod/update-schema-template.js.map +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/zod-schema-generator.js +26 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/zod-schema-generator.js.map +1 -1
- package/dist/cjs/utils/helpers/routers.helpers.js +2 -4
- package/dist/cjs/utils/helpers/routers.helpers.js.map +1 -1
- package/dist/cjs/utils/prisma/prisma-json-schema-generator.js +144 -257
- package/dist/cjs/utils/prisma/prisma-json-schema-generator.js.map +1 -1
- package/dist/cjs/utils/prisma/prisma-schema-parser.js +15 -2
- package/dist/cjs/utils/prisma/prisma-schema-parser.js.map +1 -1
- package/dist/cjs/utils/prisma/types.js.map +1 -1
- package/dist/esm/app.js +1 -1
- package/dist/esm/app.js.map +1 -1
- package/dist/esm/modules/auth/auth.router.js +39 -4
- package/dist/esm/modules/auth/auth.router.js.map +1 -1
- package/dist/esm/modules/auth/utils/auth-openapi-generator.js +367 -0
- package/dist/esm/modules/auth/utils/auth-openapi-generator.js.map +1 -0
- package/dist/esm/modules/auth/utils/auth-prisma-json-schema-generator.js +97 -0
- package/dist/esm/modules/auth/utils/auth-prisma-json-schema-generator.js.map +1 -0
- package/dist/esm/modules/base/base.middlewares.js +1 -1
- package/dist/esm/modules/base/base.middlewares.js.map +1 -1
- package/dist/esm/modules/base/types/base.service.types.js.map +1 -1
- package/dist/esm/modules/base/utils/helpers/base.router.helpers.js +46 -13
- package/dist/esm/modules/base/utils/helpers/base.router.helpers.js.map +1 -1
- package/dist/esm/modules/base/utils/helpers/base.service.helpers.js +17 -5
- package/dist/esm/modules/base/utils/helpers/base.service.helpers.js.map +1 -1
- package/dist/esm/modules/base/utils/model-openapi-generator.js +438 -0
- package/dist/esm/modules/base/utils/model-openapi-generator.js.map +1 -0
- package/dist/esm/modules/error-handler/error-handler.controller.js +0 -2
- package/dist/esm/modules/error-handler/error-handler.controller.js.map +1 -1
- package/dist/esm/modules/error-handler/utils/error-handler.helpers.js +0 -87
- package/dist/esm/modules/error-handler/utils/error-handler.helpers.js.map +1 -1
- package/dist/esm/modules/file-upload/file-upload.router.js +19 -0
- package/dist/esm/modules/file-upload/file-upload.router.js.map +1 -1
- package/dist/esm/modules/file-upload/utils/file-upload-json-schema-generator.js +346 -0
- package/dist/esm/modules/file-upload/utils/file-upload-json-schema-generator.js.map +1 -0
- package/dist/esm/modules/swagger/swagger.router.js +35 -16
- package/dist/esm/modules/swagger/swagger.router.js.map +1 -1
- package/dist/esm/modules/swagger/utils/helpers/get-swagger-default-configs.js +1 -2
- package/dist/esm/modules/swagger/utils/helpers/get-swagger-default-configs.js.map +1 -1
- package/dist/esm/modules/swagger/utils/helpers/openapi-schema-converter.js +68 -31
- package/dist/esm/modules/swagger/utils/helpers/openapi-schema-converter.js.map +1 -1
- package/dist/esm/server.js +0 -5
- package/dist/esm/server.js.map +1 -1
- package/dist/esm/types/arkos-config.js.map +1 -1
- package/dist/esm/types/arkos-prisma-input.bak.js +2 -0
- package/dist/esm/types/arkos-prisma-input.bak.js.map +1 -0
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/utils/arkos-router/arkos-router-openapi-manager.js +3 -12
- package/dist/esm/utils/arkos-router/arkos-router-openapi-manager.js.map +1 -1
- package/dist/esm/utils/arkos-router/index.js +47 -8
- package/dist/esm/utils/arkos-router/index.js.map +1 -1
- package/dist/esm/utils/arkos-router/types/openapi-config.js.map +1 -1
- package/dist/esm/utils/arkos-router/utils/helpers/index.js +15 -2
- package/dist/esm/utils/arkos-router/utils/helpers/index.js.map +1 -1
- package/dist/esm/utils/cli/generate.js +4 -4
- package/dist/esm/utils/cli/generate.js.map +1 -1
- package/dist/esm/utils/cli/index.js +11 -11
- package/dist/esm/utils/cli/index.js.map +1 -1
- package/dist/esm/utils/cli/utils/cli.helpers.js +1 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js +29 -5
- package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js.map +1 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js +26 -5
- package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js.map +1 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/class-validator-dto-generator.js +52 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/class-validator-dto-generator.js.map +1 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/zod/create-schema-template.js +10 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/zod/create-schema-template.js.map +1 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/zod/update-schema-template.js +9 -2
- package/dist/esm/utils/cli/utils/template-generator/templates/zod/update-schema-template.js.map +1 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/zod-schema-generator.js +26 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/zod-schema-generator.js.map +1 -1
- package/dist/esm/utils/helpers/routers.helpers.js +2 -4
- package/dist/esm/utils/helpers/routers.helpers.js.map +1 -1
- package/dist/esm/utils/prisma/prisma-json-schema-generator.js +144 -257
- package/dist/esm/utils/prisma/prisma-json-schema-generator.js.map +1 -1
- package/dist/esm/utils/prisma/prisma-schema-parser.js +15 -2
- package/dist/esm/utils/prisma/prisma-schema-parser.js.map +1 -1
- package/dist/esm/utils/prisma/types.js.map +1 -1
- package/dist/types/modules/auth/utils/auth-openapi-generator.d.ts +9 -0
- package/dist/types/modules/auth/utils/auth-prisma-json-schema-generator.d.ts +13 -0
- package/dist/types/modules/base/base.middlewares.d.ts +3 -0
- package/dist/types/modules/base/types/base.service.types.d.ts +0 -3
- package/dist/types/modules/base/utils/helpers/base.router.helpers.d.ts +0 -1
- package/dist/types/modules/base/utils/helpers/base.service.helpers.d.ts +1 -1
- package/dist/types/modules/base/utils/model-openapi-generator.d.ts +12 -0
- package/dist/types/modules/error-handler/utils/error-handler.helpers.d.ts +0 -19
- package/dist/types/modules/file-upload/utils/file-upload-json-schema-generator.d.ts +12 -0
- package/dist/types/modules/swagger/utils/helpers/get-swagger-default-configs.d.ts +1 -2
- package/dist/types/modules/swagger/utils/helpers/openapi-schema-converter.d.ts +27 -3
- package/dist/types/server.d.ts +0 -6
- package/dist/types/types/arkos-config.d.ts +1 -1
- package/dist/types/types/arkos-prisma-input.bak.d.ts +237 -0
- package/dist/types/types/index.d.ts +0 -48
- package/dist/types/utils/arkos-router/types/openapi-config.d.ts +3 -2
- package/dist/types/utils/helpers/routers.helpers.d.ts +1 -1
- package/dist/types/utils/prisma/prisma-json-schema-generator.d.ts +12 -42
- package/dist/types/utils/prisma/prisma-schema-parser.d.ts +2 -0
- package/dist/types/utils/prisma/types.d.ts +2 -1
- package/package.json +3 -1
- package/dist/cjs/components/arkos-policy/index.js +0 -38
- package/dist/cjs/components/arkos-policy/index.js.map +0 -1
- package/dist/cjs/components/arkos-policy/types.js +0 -3
- package/dist/cjs/components/arkos-policy/types.js.map +0 -1
- package/dist/cjs/exports/config.js +0 -6
- package/dist/cjs/exports/config.js.map +0 -1
- package/dist/cjs/modules/base/utils/helpers/base.controller.helpers.js +0 -80
- package/dist/cjs/modules/base/utils/helpers/base.controller.helpers.js.map +0 -1
- package/dist/cjs/modules/swagger/utils/built-in-route-path-object-manager.js +0 -7
- package/dist/cjs/modules/swagger/utils/built-in-route-path-object-manager.js.map +0 -1
- package/dist/cjs/modules/swagger/utils/get-open-api-login-html.js +0 -276
- package/dist/cjs/modules/swagger/utils/get-open-api-login-html.js.map +0 -1
- package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +0 -482
- package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js.map +0 -1
- package/dist/cjs/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js +0 -505
- package/dist/cjs/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js.map +0 -1
- package/dist/cjs/modules/swagger/utils/helpers/get-system-json-schema-paths.js +0 -37
- package/dist/cjs/modules/swagger/utils/helpers/get-system-json-schema-paths.js.map +0 -1
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-class-validator-json-schemas.js +0 -50
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-class-validator-json-schemas.js.map +0 -1
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.js +0 -32
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.js.map +0 -1
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-system-json-schemas.js +0 -49
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-system-json-schemas.js.map +0 -1
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-zod-json-schemas.js +0 -34
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-zod-json-schemas.js.map +0 -1
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js +0 -508
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js.map +0 -1
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-parent-routes-paths.js +0 -573
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-parent-routes-paths.js.map +0 -1
- package/dist/cjs/modules/swagger/utils/helpers/missing-json-schemas-generator.js +0 -261
- package/dist/cjs/modules/swagger/utils/helpers/missing-json-schemas-generator.js.map +0 -1
- package/dist/cjs/modules/swagger/utils/helpers/swagger.router.helpers.js +0 -114
- package/dist/cjs/modules/swagger/utils/helpers/swagger.router.helpers.js.map +0 -1
- package/dist/cjs/paths.js +0 -9
- package/dist/cjs/paths.js.map +0 -1
- package/dist/cjs/types/arkos-config/utils.js.map +0 -1
- package/dist/cjs/types/arkos.js +0 -3
- package/dist/cjs/types/arkos.js.map +0 -1
- package/dist/cjs/utils/arkos-router/utils/helpers/apply-arkos-router-proxy.js +0 -152
- package/dist/cjs/utils/arkos-router/utils/helpers/apply-arkos-router-proxy.js.map +0 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/policy-template.js +0 -53
- package/dist/cjs/utils/cli/utils/template-generator/templates/policy-template.js.map +0 -1
- package/dist/cjs/utils/helpers/exit-error.js +0 -12
- package/dist/cjs/utils/helpers/exit-error.js.map +0 -1
- package/dist/cjs/utils/initialize-app.js +0 -56
- package/dist/cjs/utils/initialize-app.js.map +0 -1
- package/dist/cjs/utils/setup-app.js +0 -119
- package/dist/cjs/utils/setup-app.js.map +0 -1
- package/dist/esm/components/arkos-policy/index.js +0 -32
- package/dist/esm/components/arkos-policy/index.js.map +0 -1
- package/dist/esm/components/arkos-policy/types.js +0 -2
- package/dist/esm/components/arkos-policy/types.js.map +0 -1
- package/dist/esm/exports/config.js +0 -3
- package/dist/esm/exports/config.js.map +0 -1
- package/dist/esm/modules/base/utils/helpers/base.controller.helpers.js +0 -76
- package/dist/esm/modules/base/utils/helpers/base.controller.helpers.js.map +0 -1
- package/dist/esm/modules/swagger/utils/built-in-route-path-object-manager.js +0 -5
- package/dist/esm/modules/swagger/utils/built-in-route-path-object-manager.js.map +0 -1
- package/dist/esm/modules/swagger/utils/get-open-api-login-html.js +0 -273
- package/dist/esm/modules/swagger/utils/get-open-api-login-html.js.map +0 -1
- package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +0 -477
- package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js.map +0 -1
- package/dist/esm/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js +0 -499
- package/dist/esm/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js.map +0 -1
- package/dist/esm/modules/swagger/utils/helpers/get-system-json-schema-paths.js +0 -34
- package/dist/esm/modules/swagger/utils/helpers/get-system-json-schema-paths.js.map +0 -1
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-class-validator-json-schemas.js +0 -44
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-class-validator-json-schemas.js.map +0 -1
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.js +0 -26
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.js.map +0 -1
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-system-json-schemas.js +0 -46
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-system-json-schemas.js.map +0 -1
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-zod-json-schemas.js +0 -28
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-zod-json-schemas.js.map +0 -1
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js +0 -502
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js.map +0 -1
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-parent-routes-paths.js +0 -567
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-parent-routes-paths.js.map +0 -1
- package/dist/esm/modules/swagger/utils/helpers/missing-json-schemas-generator.js +0 -256
- package/dist/esm/modules/swagger/utils/helpers/missing-json-schemas-generator.js.map +0 -1
- package/dist/esm/modules/swagger/utils/helpers/swagger.router.helpers.js +0 -103
- package/dist/esm/modules/swagger/utils/helpers/swagger.router.helpers.js.map +0 -1
- package/dist/esm/paths.js +0 -3
- package/dist/esm/paths.js.map +0 -1
- package/dist/esm/types/arkos-config/utils.js +0 -2
- package/dist/esm/types/arkos-config/utils.js.map +0 -1
- package/dist/esm/types/arkos.js +0 -2
- package/dist/esm/types/arkos.js.map +0 -1
- package/dist/esm/utils/arkos-router/utils/helpers/apply-arkos-router-proxy.js +0 -146
- package/dist/esm/utils/arkos-router/utils/helpers/apply-arkos-router-proxy.js.map +0 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/policy-template.js +0 -47
- package/dist/esm/utils/cli/utils/template-generator/templates/policy-template.js.map +0 -1
- package/dist/esm/utils/helpers/exit-error.js +0 -6
- package/dist/esm/utils/helpers/exit-error.js.map +0 -1
- package/dist/esm/utils/initialize-app.js +0 -50
- package/dist/esm/utils/initialize-app.js.map +0 -1
- package/dist/esm/utils/setup-app.js +0 -113
- package/dist/esm/utils/setup-app.js.map +0 -1
- package/dist/types/components/arkos-policy/index.d.ts +0 -31
- package/dist/types/components/arkos-policy/types.d.ts +0 -21
- package/dist/types/exports/config.d.ts +0 -2
- package/dist/types/modules/base/utils/helpers/base.controller.helpers.d.ts +0 -4
- package/dist/types/modules/swagger/utils/built-in-route-path-object-manager.d.ts +0 -4
- package/dist/types/modules/swagger/utils/get-open-api-login-html.d.ts +0 -1
- package/dist/types/modules/swagger/utils/helpers/get-authentication-json-schema-paths.d.ts +0 -4
- package/dist/types/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.d.ts +0 -3
- package/dist/types/modules/swagger/utils/helpers/get-system-json-schema-paths.d.ts +0 -2
- package/dist/types/modules/swagger/utils/helpers/json-schema-generators/generate-class-validator-json-schemas.d.ts +0 -1
- package/dist/types/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.d.ts +0 -2
- package/dist/types/modules/swagger/utils/helpers/json-schema-generators/generate-system-json-schemas.d.ts +0 -4
- package/dist/types/modules/swagger/utils/helpers/json-schema-generators/generate-zod-json-schemas.d.ts +0 -1
- package/dist/types/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.d.ts +0 -3
- package/dist/types/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-parent-routes-paths.d.ts +0 -3
- package/dist/types/modules/swagger/utils/helpers/missing-json-schemas-generator.d.ts +0 -77
- package/dist/types/modules/swagger/utils/helpers/swagger.router.helpers.d.ts +0 -20
- package/dist/types/paths.d.ts +0 -1
- package/dist/types/types/arkos-config/utils.d.ts +0 -35
- package/dist/types/types/arkos.d.ts +0 -31
- package/dist/types/utils/arkos-router/utils/helpers/apply-arkos-router-proxy.d.ts +0 -7
- package/dist/types/utils/cli/utils/template-generator/templates/policy-template.d.ts +0 -2
- package/dist/types/utils/helpers/exit-error.d.ts +0 -1
- package/dist/types/utils/initialize-app.d.ts +0 -2
- package/dist/types/utils/setup-app.d.ts +0 -2
|
@@ -1,499 +0,0 @@
|
|
|
1
|
-
import { getModuleComponents } from "../../../../utils/dynamic-loader.js";
|
|
2
|
-
import { isEndpointDisabled } from "../../../base/utils/helpers/base.router.helpers.js";
|
|
3
|
-
import deepmerge from "../../../../utils/helpers/deepmerge.helper.js";
|
|
4
|
-
import { fileUploadDefaultRestrictions } from "../../../file-upload/file-upload.service.js";
|
|
5
|
-
export default function getFileUploadJsonSchemaPaths(arkosConfig, existingPaths) {
|
|
6
|
-
const paths = { ...existingPaths };
|
|
7
|
-
if (!arkosConfig.fileUpload)
|
|
8
|
-
return paths;
|
|
9
|
-
const FileUploadModuleComponents = getModuleComponents("file-upload");
|
|
10
|
-
const routerConfig = FileUploadModuleComponents?.router
|
|
11
|
-
?.config;
|
|
12
|
-
const authConfigs = FileUploadModuleComponents?.authConfigs;
|
|
13
|
-
if (routerConfig?.disable === true)
|
|
14
|
-
return paths;
|
|
15
|
-
const isFileUploadEndpointDisabled = (endpoint) => {
|
|
16
|
-
return isEndpointDisabled(routerConfig, endpoint);
|
|
17
|
-
};
|
|
18
|
-
const basePathname = arkosConfig.fileUpload?.baseRoute || "/api/uploads/";
|
|
19
|
-
const baseUploadDir = arkosConfig.fileUpload?.baseUploadDir || "uploads";
|
|
20
|
-
const restrictions = deepmerge(fileUploadDefaultRestrictions, arkosConfig.fileUpload?.restrictions || {});
|
|
21
|
-
const formatBytes = (bytes) => {
|
|
22
|
-
if (bytes === 0)
|
|
23
|
-
return "0 Bytes";
|
|
24
|
-
const k = 1024;
|
|
25
|
-
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
26
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
27
|
-
return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + " " + sizes[i];
|
|
28
|
-
};
|
|
29
|
-
const getFileTypeDescription = (fileType) => {
|
|
30
|
-
const restriction = restrictions[fileType];
|
|
31
|
-
if (!restriction)
|
|
32
|
-
return "";
|
|
33
|
-
const maxSize = formatBytes(restriction.maxSize);
|
|
34
|
-
const maxCount = restriction.maxCount;
|
|
35
|
-
const formats = restriction.supportedFilesRegex
|
|
36
|
-
?.toString()
|
|
37
|
-
.replace(/\|/g, ", ")
|
|
38
|
-
.replace(/\//g, "")
|
|
39
|
-
.replace(/\.\*/g, "any format");
|
|
40
|
-
return `Maximum file size: ${maxSize}. Maximum files per upload: ${maxCount}. Supported formats: ${formats}`;
|
|
41
|
-
};
|
|
42
|
-
const shouldIncludeSecurity = (action) => {
|
|
43
|
-
const authControl = authConfigs?.authenticationControl;
|
|
44
|
-
if (!authControl)
|
|
45
|
-
return false;
|
|
46
|
-
if (typeof authControl === "boolean")
|
|
47
|
-
return authControl;
|
|
48
|
-
if (typeof authControl === "object") {
|
|
49
|
-
return authControl[action] === true;
|
|
50
|
-
}
|
|
51
|
-
return false;
|
|
52
|
-
};
|
|
53
|
-
if (!isFileUploadEndpointDisabled("findFile")) {
|
|
54
|
-
const cleanBasePath = basePathname.endsWith("/")
|
|
55
|
-
? basePathname.slice(0, -1)
|
|
56
|
-
: basePathname;
|
|
57
|
-
const pathname = `${cleanBasePath}/{filePath*}`;
|
|
58
|
-
if (!paths[pathname])
|
|
59
|
-
paths[pathname] = {};
|
|
60
|
-
const currentPath = paths[pathname].get;
|
|
61
|
-
const defaultParameters = [
|
|
62
|
-
{
|
|
63
|
-
name: "filePath",
|
|
64
|
-
in: "path",
|
|
65
|
-
required: true,
|
|
66
|
-
schema: { type: "string" },
|
|
67
|
-
description: "Path to the file including file type directory (e.g., images/photo.jpg, videos/clip.mp4)",
|
|
68
|
-
},
|
|
69
|
-
];
|
|
70
|
-
const existingParams = currentPath?.parameters || [];
|
|
71
|
-
const existingParamKeys = new Set(existingParams.map((p) => `${p.in}-${p.name}`));
|
|
72
|
-
const mergedParameters = [
|
|
73
|
-
...existingParams,
|
|
74
|
-
...defaultParameters.filter((p) => !existingParamKeys.has(`${p.in}-${p.name}`)),
|
|
75
|
-
];
|
|
76
|
-
const defaultSpec = {
|
|
77
|
-
tags: ["File Upload", ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
|
|
78
|
-
summary: currentPath?.summary === pathname || !currentPath?.summary
|
|
79
|
-
? "Retrieve uploaded file"
|
|
80
|
-
: currentPath?.summary,
|
|
81
|
-
description: currentPath?.description === pathname || !currentPath?.description
|
|
82
|
-
? `Serves static files from the upload directory (${baseUploadDir}). This endpoint uses wildcard path matching to serve files from any subdirectory.`
|
|
83
|
-
: currentPath?.description,
|
|
84
|
-
operationId: currentPath?.operationId?.includes(pathname) ||
|
|
85
|
-
!currentPath?.operationId
|
|
86
|
-
? "findFile"
|
|
87
|
-
: currentPath?.operationId,
|
|
88
|
-
...(shouldIncludeSecurity("View") && {
|
|
89
|
-
security: [{ BearerAuth: [] }],
|
|
90
|
-
}),
|
|
91
|
-
parameters: mergedParameters,
|
|
92
|
-
responses: {
|
|
93
|
-
...(currentPath?.responses || {}),
|
|
94
|
-
"200": currentPath?.responses?.["200"] || {
|
|
95
|
-
description: "File retrieved successfully",
|
|
96
|
-
content: {
|
|
97
|
-
"application/octet-stream": {
|
|
98
|
-
schema: {
|
|
99
|
-
type: "string",
|
|
100
|
-
format: "binary",
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
"404": currentPath?.responses?.["404"] || {
|
|
106
|
-
description: "File not found",
|
|
107
|
-
},
|
|
108
|
-
...(shouldIncludeSecurity("View") && {
|
|
109
|
-
"401": currentPath?.responses?.["401"] || {
|
|
110
|
-
description: "Authentication required",
|
|
111
|
-
},
|
|
112
|
-
"403": currentPath?.responses?.["403"] || {
|
|
113
|
-
description: "Insufficient permissions to view files",
|
|
114
|
-
},
|
|
115
|
-
}),
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
paths[pathname].get = { ...(currentPath || {}), ...defaultSpec };
|
|
119
|
-
}
|
|
120
|
-
if (!isFileUploadEndpointDisabled("uploadFile")) {
|
|
121
|
-
const cleanBasePath = basePathname.endsWith("/")
|
|
122
|
-
? basePathname.slice(0, -1)
|
|
123
|
-
: basePathname;
|
|
124
|
-
const pathname = `${cleanBasePath}/{fileType}`;
|
|
125
|
-
if (!paths[pathname])
|
|
126
|
-
paths[pathname] = {};
|
|
127
|
-
const currentPath = paths[pathname].post;
|
|
128
|
-
const defaultParameters = [
|
|
129
|
-
{
|
|
130
|
-
name: "fileType",
|
|
131
|
-
in: "path",
|
|
132
|
-
required: true,
|
|
133
|
-
schema: {
|
|
134
|
-
type: "string",
|
|
135
|
-
enum: ["images", "videos", "documents", "files"],
|
|
136
|
-
},
|
|
137
|
-
description: "Type of file being uploaded",
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
name: "format",
|
|
141
|
-
in: "query",
|
|
142
|
-
required: false,
|
|
143
|
-
schema: {
|
|
144
|
-
type: "string",
|
|
145
|
-
enum: ["jpeg", "jpg", "png", "webp", "gif", "avif"],
|
|
146
|
-
},
|
|
147
|
-
description: "Image format for conversion (only applicable for fileType=images)",
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
name: "width",
|
|
151
|
-
in: "query",
|
|
152
|
-
required: false,
|
|
153
|
-
schema: { type: "integer", minimum: 1 },
|
|
154
|
-
description: "Target width for image resize (only applicable for fileType=images)",
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
name: "height",
|
|
158
|
-
in: "query",
|
|
159
|
-
required: false,
|
|
160
|
-
schema: { type: "integer", minimum: 1 },
|
|
161
|
-
description: "Target height for image resize (only applicable for fileType=images)",
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
name: "resizeTo",
|
|
165
|
-
in: "query",
|
|
166
|
-
required: false,
|
|
167
|
-
schema: {
|
|
168
|
-
type: "string",
|
|
169
|
-
enum: ["cover", "contain", "fill", "inside", "outside"],
|
|
170
|
-
},
|
|
171
|
-
description: "Resize strategy (only applicable for fileType=images)",
|
|
172
|
-
},
|
|
173
|
-
];
|
|
174
|
-
const existingParams = currentPath?.parameters || [];
|
|
175
|
-
const existingParamKeys = new Set(existingParams.map((p) => `${p.in}-${p.name}`));
|
|
176
|
-
const mergedParameters = [
|
|
177
|
-
...existingParams,
|
|
178
|
-
...defaultParameters.filter((p) => !existingParamKeys.has(`${p.in}-${p.name}`)),
|
|
179
|
-
];
|
|
180
|
-
const defaultSpec = {
|
|
181
|
-
tags: ["File Upload", ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
|
|
182
|
-
summary: currentPath?.summary === pathname || !currentPath?.summary
|
|
183
|
-
? "Upload file(s)"
|
|
184
|
-
: currentPath?.summary,
|
|
185
|
-
description: currentPath?.description === pathname || !currentPath?.description
|
|
186
|
-
? "Upload one or multiple files. Supports image processing options for image uploads."
|
|
187
|
-
: currentPath?.description,
|
|
188
|
-
operationId: currentPath?.operationId?.includes(pathname) ||
|
|
189
|
-
!currentPath?.operationId
|
|
190
|
-
? "uploadFile"
|
|
191
|
-
: currentPath?.operationId,
|
|
192
|
-
...(shouldIncludeSecurity("Create") && {
|
|
193
|
-
security: [{ BearerAuth: [] }],
|
|
194
|
-
}),
|
|
195
|
-
parameters: mergedParameters,
|
|
196
|
-
requestBody: currentPath?.requestBody || {
|
|
197
|
-
required: true,
|
|
198
|
-
content: {
|
|
199
|
-
"multipart/form-data": {
|
|
200
|
-
schema: {
|
|
201
|
-
type: "object",
|
|
202
|
-
properties: {
|
|
203
|
-
images: {
|
|
204
|
-
type: "array",
|
|
205
|
-
items: { type: "string", format: "binary" },
|
|
206
|
-
description: getFileTypeDescription("images"),
|
|
207
|
-
},
|
|
208
|
-
videos: {
|
|
209
|
-
type: "array",
|
|
210
|
-
items: { type: "string", format: "binary" },
|
|
211
|
-
description: getFileTypeDescription("videos"),
|
|
212
|
-
},
|
|
213
|
-
documents: {
|
|
214
|
-
type: "array",
|
|
215
|
-
items: { type: "string", format: "binary" },
|
|
216
|
-
description: getFileTypeDescription("documents"),
|
|
217
|
-
},
|
|
218
|
-
files: {
|
|
219
|
-
type: "array",
|
|
220
|
-
items: { type: "string", format: "binary" },
|
|
221
|
-
description: getFileTypeDescription("files"),
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
},
|
|
225
|
-
},
|
|
226
|
-
},
|
|
227
|
-
},
|
|
228
|
-
responses: {
|
|
229
|
-
...(currentPath?.responses || {}),
|
|
230
|
-
"200": currentPath?.responses?.["200"] || {
|
|
231
|
-
description: "File(s) uploaded successfully",
|
|
232
|
-
content: {
|
|
233
|
-
"application/json": {
|
|
234
|
-
schema: {
|
|
235
|
-
type: "object",
|
|
236
|
-
properties: {
|
|
237
|
-
success: { type: "boolean", example: true },
|
|
238
|
-
data: {
|
|
239
|
-
oneOf: [
|
|
240
|
-
{ type: "string", description: "URL of uploaded file" },
|
|
241
|
-
{
|
|
242
|
-
type: "array",
|
|
243
|
-
items: { type: "string" },
|
|
244
|
-
description: "URLs of uploaded files",
|
|
245
|
-
},
|
|
246
|
-
],
|
|
247
|
-
},
|
|
248
|
-
message: { type: "string" },
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
},
|
|
253
|
-
},
|
|
254
|
-
"400": currentPath?.responses?.["400"] || {
|
|
255
|
-
description: "Invalid file type, size limit exceeded, or no file uploaded",
|
|
256
|
-
},
|
|
257
|
-
...(shouldIncludeSecurity("Create") && {
|
|
258
|
-
"401": currentPath?.responses?.["401"] || {
|
|
259
|
-
description: "Authentication required",
|
|
260
|
-
},
|
|
261
|
-
"403": currentPath?.responses?.["403"] || {
|
|
262
|
-
description: "Insufficient permissions to upload files",
|
|
263
|
-
},
|
|
264
|
-
}),
|
|
265
|
-
},
|
|
266
|
-
};
|
|
267
|
-
paths[pathname].post = { ...(currentPath || {}), ...defaultSpec };
|
|
268
|
-
}
|
|
269
|
-
if (!isFileUploadEndpointDisabled("updateFile")) {
|
|
270
|
-
const cleanBasePath = basePathname.endsWith("/")
|
|
271
|
-
? basePathname.slice(0, -1)
|
|
272
|
-
: basePathname;
|
|
273
|
-
const pathname = `${cleanBasePath}/{fileType}/{fileName}`;
|
|
274
|
-
if (!paths[pathname])
|
|
275
|
-
paths[pathname] = {};
|
|
276
|
-
const currentPath = paths[pathname].patch;
|
|
277
|
-
const defaultParameters = [
|
|
278
|
-
{
|
|
279
|
-
name: "fileType",
|
|
280
|
-
in: "path",
|
|
281
|
-
required: true,
|
|
282
|
-
schema: {
|
|
283
|
-
type: "string",
|
|
284
|
-
enum: ["images", "videos", "documents", "files"],
|
|
285
|
-
},
|
|
286
|
-
description: "Type of file being updated",
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
name: "fileName",
|
|
290
|
-
in: "path",
|
|
291
|
-
required: true,
|
|
292
|
-
schema: { type: "string" },
|
|
293
|
-
description: "Name of the file to update",
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
name: "format",
|
|
297
|
-
in: "query",
|
|
298
|
-
required: false,
|
|
299
|
-
schema: {
|
|
300
|
-
type: "string",
|
|
301
|
-
enum: ["jpeg", "jpg", "png", "webp", "gif", "avif"],
|
|
302
|
-
},
|
|
303
|
-
description: "Image format for conversion (only applicable for fileType=images)",
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
name: "width",
|
|
307
|
-
in: "query",
|
|
308
|
-
required: false,
|
|
309
|
-
schema: { type: "integer", minimum: 1 },
|
|
310
|
-
description: "Target width for image resize (only applicable for fileType=images)",
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
name: "height",
|
|
314
|
-
in: "query",
|
|
315
|
-
required: false,
|
|
316
|
-
schema: { type: "integer", minimum: 1 },
|
|
317
|
-
description: "Target height for image resize (only applicable for fileType=images)",
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
name: "resizeTo",
|
|
321
|
-
in: "query",
|
|
322
|
-
required: false,
|
|
323
|
-
schema: {
|
|
324
|
-
type: "string",
|
|
325
|
-
enum: ["cover", "contain", "fill", "inside", "outside"],
|
|
326
|
-
},
|
|
327
|
-
description: "Resize strategy (only applicable for fileType=images)",
|
|
328
|
-
},
|
|
329
|
-
];
|
|
330
|
-
const existingParams = currentPath?.parameters || [];
|
|
331
|
-
const existingParamKeys = new Set(existingParams.map((p) => `${p.in}-${p.name}`));
|
|
332
|
-
const mergedParameters = [
|
|
333
|
-
...existingParams,
|
|
334
|
-
...defaultParameters.filter((p) => !existingParamKeys.has(`${p.in}-${p.name}`)),
|
|
335
|
-
];
|
|
336
|
-
const defaultSpec = {
|
|
337
|
-
tags: ["File Upload", ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
|
|
338
|
-
summary: currentPath?.summary === pathname || !currentPath?.summary
|
|
339
|
-
? "Update existing file"
|
|
340
|
-
: currentPath?.summary,
|
|
341
|
-
description: currentPath?.description === pathname || !currentPath?.description
|
|
342
|
-
? "Replace an existing file with a new one. Deletes the old file and uploads the new one."
|
|
343
|
-
: currentPath?.description,
|
|
344
|
-
operationId: currentPath?.operationId?.includes(pathname) ||
|
|
345
|
-
!currentPath?.operationId
|
|
346
|
-
? "updateFile"
|
|
347
|
-
: currentPath?.operationId,
|
|
348
|
-
...(shouldIncludeSecurity("Update") && {
|
|
349
|
-
security: [{ BearerAuth: [] }],
|
|
350
|
-
}),
|
|
351
|
-
parameters: mergedParameters,
|
|
352
|
-
requestBody: currentPath?.requestBody || {
|
|
353
|
-
required: true,
|
|
354
|
-
content: {
|
|
355
|
-
"multipart/form-data": {
|
|
356
|
-
schema: {
|
|
357
|
-
type: "object",
|
|
358
|
-
properties: {
|
|
359
|
-
images: {
|
|
360
|
-
type: "array",
|
|
361
|
-
items: { type: "string", format: "binary" },
|
|
362
|
-
description: getFileTypeDescription("images"),
|
|
363
|
-
},
|
|
364
|
-
videos: {
|
|
365
|
-
type: "array",
|
|
366
|
-
items: { type: "string", format: "binary" },
|
|
367
|
-
description: getFileTypeDescription("videos"),
|
|
368
|
-
},
|
|
369
|
-
documents: {
|
|
370
|
-
type: "array",
|
|
371
|
-
items: { type: "string", format: "binary" },
|
|
372
|
-
description: getFileTypeDescription("documents"),
|
|
373
|
-
},
|
|
374
|
-
files: {
|
|
375
|
-
type: "array",
|
|
376
|
-
items: { type: "string", format: "binary" },
|
|
377
|
-
description: getFileTypeDescription("files"),
|
|
378
|
-
},
|
|
379
|
-
},
|
|
380
|
-
},
|
|
381
|
-
},
|
|
382
|
-
},
|
|
383
|
-
},
|
|
384
|
-
responses: {
|
|
385
|
-
...(currentPath?.responses || {}),
|
|
386
|
-
"200": currentPath?.responses?.["200"] || {
|
|
387
|
-
description: "File updated successfully",
|
|
388
|
-
content: {
|
|
389
|
-
"application/json": {
|
|
390
|
-
schema: {
|
|
391
|
-
type: "object",
|
|
392
|
-
properties: {
|
|
393
|
-
success: { type: "boolean", example: true },
|
|
394
|
-
data: {
|
|
395
|
-
oneOf: [
|
|
396
|
-
{ type: "string", description: "URL of updated file" },
|
|
397
|
-
{
|
|
398
|
-
type: "array",
|
|
399
|
-
items: { type: "string" },
|
|
400
|
-
description: "URLs of updated files",
|
|
401
|
-
},
|
|
402
|
-
],
|
|
403
|
-
},
|
|
404
|
-
message: { type: "string" },
|
|
405
|
-
},
|
|
406
|
-
},
|
|
407
|
-
},
|
|
408
|
-
},
|
|
409
|
-
},
|
|
410
|
-
"400": currentPath?.responses?.["400"] || {
|
|
411
|
-
description: "Invalid file type, size limit exceeded, or no file uploaded",
|
|
412
|
-
},
|
|
413
|
-
"404": currentPath?.responses?.["404"] || {
|
|
414
|
-
description: "Original file not found",
|
|
415
|
-
},
|
|
416
|
-
...(shouldIncludeSecurity("Update") && {
|
|
417
|
-
"401": currentPath?.responses?.["401"] || {
|
|
418
|
-
description: "Authentication required",
|
|
419
|
-
},
|
|
420
|
-
"403": currentPath?.responses?.["403"] || {
|
|
421
|
-
description: "Insufficient permissions to update files",
|
|
422
|
-
},
|
|
423
|
-
}),
|
|
424
|
-
},
|
|
425
|
-
};
|
|
426
|
-
paths[pathname].patch = { ...(currentPath || {}), ...defaultSpec };
|
|
427
|
-
}
|
|
428
|
-
if (!isFileUploadEndpointDisabled("deleteFile")) {
|
|
429
|
-
const cleanBasePath = basePathname.endsWith("/")
|
|
430
|
-
? basePathname.slice(0, -1)
|
|
431
|
-
: basePathname;
|
|
432
|
-
const pathname = `${cleanBasePath}/{fileType}/{fileName}`;
|
|
433
|
-
if (!paths[pathname])
|
|
434
|
-
paths[pathname] = {};
|
|
435
|
-
const currentPath = paths[pathname].delete;
|
|
436
|
-
const defaultParameters = [
|
|
437
|
-
{
|
|
438
|
-
name: "fileType",
|
|
439
|
-
in: "path",
|
|
440
|
-
required: true,
|
|
441
|
-
schema: {
|
|
442
|
-
type: "string",
|
|
443
|
-
enum: ["images", "videos", "documents", "files"],
|
|
444
|
-
},
|
|
445
|
-
description: "Type of file being deleted",
|
|
446
|
-
},
|
|
447
|
-
{
|
|
448
|
-
name: "fileName",
|
|
449
|
-
in: "path",
|
|
450
|
-
required: true,
|
|
451
|
-
schema: { type: "string" },
|
|
452
|
-
description: "Name of the file to delete",
|
|
453
|
-
},
|
|
454
|
-
];
|
|
455
|
-
const existingParams = currentPath?.parameters || [];
|
|
456
|
-
const existingParamKeys = new Set(existingParams.map((p) => `${p.in}-${p.name}`));
|
|
457
|
-
const mergedParameters = [
|
|
458
|
-
...existingParams,
|
|
459
|
-
...defaultParameters.filter((p) => !existingParamKeys.has(`${p.in}-${p.name}`)),
|
|
460
|
-
];
|
|
461
|
-
const defaultSpec = {
|
|
462
|
-
tags: ["File Upload", ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
|
|
463
|
-
summary: currentPath?.summary === pathname || !currentPath?.summary
|
|
464
|
-
? "Delete file"
|
|
465
|
-
: currentPath?.summary,
|
|
466
|
-
description: currentPath?.description === pathname || !currentPath?.description
|
|
467
|
-
? "Delete an uploaded file from the server"
|
|
468
|
-
: currentPath?.description,
|
|
469
|
-
operationId: currentPath?.operationId?.includes(pathname) ||
|
|
470
|
-
!currentPath?.operationId
|
|
471
|
-
? "deleteFile"
|
|
472
|
-
: currentPath?.operationId,
|
|
473
|
-
...(shouldIncludeSecurity("Delete") && {
|
|
474
|
-
security: [{ BearerAuth: [] }],
|
|
475
|
-
}),
|
|
476
|
-
parameters: mergedParameters,
|
|
477
|
-
responses: {
|
|
478
|
-
...(currentPath?.responses || {}),
|
|
479
|
-
"204": currentPath?.responses?.["204"] || {
|
|
480
|
-
description: "File deleted successfully",
|
|
481
|
-
},
|
|
482
|
-
"404": currentPath?.responses?.["404"] || {
|
|
483
|
-
description: "File not found",
|
|
484
|
-
},
|
|
485
|
-
...(shouldIncludeSecurity("Delete") && {
|
|
486
|
-
"401": currentPath?.responses?.["401"] || {
|
|
487
|
-
description: "Authentication required",
|
|
488
|
-
},
|
|
489
|
-
"403": currentPath?.responses?.["403"] || {
|
|
490
|
-
description: "Insufficient permissions to delete files",
|
|
491
|
-
},
|
|
492
|
-
}),
|
|
493
|
-
},
|
|
494
|
-
};
|
|
495
|
-
paths[pathname].delete = { ...(currentPath || {}), ...defaultSpec };
|
|
496
|
-
}
|
|
497
|
-
return paths;
|
|
498
|
-
}
|
|
499
|
-
//# sourceMappingURL=get-file-upload-json-schema-paths.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-file-upload-json-schema-paths.js","sourceRoot":"","sources":["../../../../../../src/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;A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QAAQ,CAAC,IAAI;gBACrC,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;aAC/B,CAAC;YACF,UAAU,EAAE,gBAAgB;YAC5B,SAAS,EAAE;gBACT,GAAG,CAAC,WAAW,EAAE,SAAS,IAAI,EAAE,CAAC;gBACjC,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,IAAI;oBACxC,WAAW,EAAE,2BAA2B;iBACzC;gBACD,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,IAAI;oBACxC,WAAW,EAAE,gBAAgB;iBAC9B;gBACD,GAAG,CAAC,qBAAqB,CAAC,QAAQ,CAAC,IAAI;oBACrC,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,IAAI;wBACxC,WAAW,EAAE,yBAAyB;qBACvC;oBACD,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,IAAI;wBACxC,WAAW,EAAE,0CAA0C;qBACxD;iBACF,CAAC;aACH;SACF,CAAC;QAEF,KAAK,CAAC,QAAQ,CAAE,CAAC,MAAM,GAAG,EAAE,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,EAAE,GAAG,WAAW,EAAE,CAAC;IACvE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { OpenAPIV3 } from \"openapi-types\";\nimport { ArkosConfig, RouterConfig } from \"../../../../exports\";\nimport { getModuleComponents } from \"../../../../utils/dynamic-loader\";\nimport { isEndpointDisabled } from \"../../../base/utils/helpers/base.router.helpers\";\nimport deepmerge from \"../../../../utils/helpers/deepmerge.helper\";\nimport { fileUploadDefaultRestrictions } from \"../../../file-upload/file-upload.service\";\n\nexport default function getFileUploadJsonSchemaPaths(\n arkosConfig: ArkosConfig,\n existingPaths: OpenAPIV3.PathsObject\n) {\n const paths: OpenAPIV3.PathsObject = { ...existingPaths };\n\n if (!arkosConfig.fileUpload) return paths;\n\n const FileUploadModuleComponents = getModuleComponents(\"file-upload\");\n const routerConfig = FileUploadModuleComponents?.router\n ?.config as RouterConfig<\"file-upload\">;\n const authConfigs = FileUploadModuleComponents?.authConfigs;\n\n if (routerConfig?.disable === true) return paths;\n\n const isFileUploadEndpointDisabled = (endpoint: string): boolean => {\n return isEndpointDisabled(routerConfig, endpoint as any);\n };\n\n const basePathname = arkosConfig.fileUpload?.baseRoute || \"/api/uploads/\";\n const baseUploadDir = arkosConfig.fileUpload?.baseUploadDir || \"uploads\";\n\n const restrictions = deepmerge(\n fileUploadDefaultRestrictions,\n arkosConfig.fileUpload?.restrictions || {}\n );\n\n const formatBytes = (bytes: number): string => {\n if (bytes === 0) return \"0 Bytes\";\n const k = 1024;\n const sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\"];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + \" \" + sizes[i];\n };\n\n const getFileTypeDescription = (fileType: string): string => {\n const restriction = restrictions[fileType as keyof typeof restrictions];\n if (!restriction) return \"\";\n\n const maxSize = formatBytes(restriction.maxSize!);\n const maxCount = restriction.maxCount;\n const formats = restriction.supportedFilesRegex\n ?.toString()\n .replace(/\\|/g, \", \")\n .replace(/\\//g, \"\")\n .replace(/\\.\\*/g, \"any format\");\n\n return `Maximum file size: ${maxSize}. Maximum files per upload: ${maxCount}. Supported formats: ${formats}`;\n };\n\n const shouldIncludeSecurity = (\n action: \"View\" | \"Create\" | \"Update\" | \"Delete\"\n ): boolean => {\n const authControl = authConfigs?.authenticationControl;\n if (!authControl) return false;\n\n if (typeof authControl === \"boolean\") return authControl;\n if (typeof authControl === \"object\") {\n return authControl[action] === true;\n }\n\n return false;\n };\n\n // Find File - GET /{filePath*}\n if (!isFileUploadEndpointDisabled(\"findFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n const pathname = `${cleanBasePath}/{filePath*}`;\n\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.get;\n\n const defaultParameters: OpenAPIV3.ParameterObject[] = [\n {\n name: \"filePath\",\n in: \"path\",\n required: true,\n schema: { type: \"string\" },\n description:\n \"Path to the file including file type directory (e.g., images/photo.jpg, videos/clip.mp4)\",\n },\n ];\n\n const existingParams =\n (currentPath?.parameters as OpenAPIV3.ParameterObject[]) || [];\n const existingParamKeys = new Set(\n existingParams.map((p) => `${p.in}-${p.name}`)\n );\n\n const mergedParameters = [\n ...existingParams,\n ...defaultParameters.filter(\n (p) => !existingParamKeys.has(`${p.in}-${p.name}`)\n ),\n ];\n\n const defaultSpec = {\n tags: [\"File Upload\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Retrieve uploaded file\"\n : currentPath?.summary,\n description:\n currentPath?.description === pathname || !currentPath?.description\n ? `Serves static files from the upload directory (${baseUploadDir}). This endpoint uses wildcard path matching to serve files from any subdirectory.`\n : currentPath?.description,\n operationId:\n currentPath?.operationId?.includes(pathname) ||\n !currentPath?.operationId\n ? \"findFile\"\n : currentPath?.operationId,\n ...(shouldIncludeSecurity(\"View\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: mergedParameters,\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"File retrieved successfully\",\n content: {\n \"application/octet-stream\": {\n schema: {\n type: \"string\",\n format: \"binary\",\n },\n },\n },\n },\n \"404\": currentPath?.responses?.[\"404\"] || {\n description: \"File not found\",\n },\n ...(shouldIncludeSecurity(\"View\") && {\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n \"403\": currentPath?.responses?.[\"403\"] || {\n description: \"Insufficient permissions to view files\",\n },\n }),\n },\n };\n\n paths[pathname]!.get = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Upload File - POST /{fileType}\n if (!isFileUploadEndpointDisabled(\"uploadFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n const pathname = `${cleanBasePath}/{fileType}`;\n\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.post;\n\n const defaultParameters: OpenAPIV3.ParameterObject[] = [\n {\n name: \"fileType\",\n in: \"path\",\n required: true,\n schema: {\n type: \"string\",\n enum: [\"images\", \"videos\", \"documents\", \"files\"],\n },\n description: \"Type of file being uploaded\",\n },\n {\n name: \"format\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"jpeg\", \"jpg\", \"png\", \"webp\", \"gif\", \"avif\"],\n },\n description:\n \"Image format for conversion (only applicable for fileType=images)\",\n },\n {\n name: \"width\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target width for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"height\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target height for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"resizeTo\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"cover\", \"contain\", \"fill\", \"inside\", \"outside\"],\n },\n description: \"Resize strategy (only applicable for fileType=images)\",\n },\n ];\n\n const existingParams =\n (currentPath?.parameters as OpenAPIV3.ParameterObject[]) || [];\n const existingParamKeys = new Set(\n existingParams.map((p) => `${p.in}-${p.name}`)\n );\n\n const mergedParameters = [\n ...existingParams,\n ...defaultParameters.filter(\n (p) => !existingParamKeys.has(`${p.in}-${p.name}`)\n ),\n ];\n\n const defaultSpec = {\n tags: [\"File Upload\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Upload file(s)\"\n : currentPath?.summary,\n description:\n currentPath?.description === pathname || !currentPath?.description\n ? \"Upload one or multiple files. Supports image processing options for image uploads.\"\n : currentPath?.description,\n operationId:\n currentPath?.operationId?.includes(pathname) ||\n !currentPath?.operationId\n ? \"uploadFile\"\n : currentPath?.operationId,\n ...(shouldIncludeSecurity(\"Create\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: mergedParameters,\n requestBody: currentPath?.requestBody || {\n required: true,\n content: {\n \"multipart/form-data\": {\n schema: {\n type: \"object\",\n properties: {\n images: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"images\"),\n },\n videos: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"videos\"),\n },\n documents: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"documents\"),\n },\n files: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"files\"),\n },\n },\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"File(s) uploaded successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n success: { type: \"boolean\", example: true },\n data: {\n oneOf: [\n { type: \"string\", description: \"URL of uploaded file\" },\n {\n type: \"array\",\n items: { type: \"string\" },\n description: \"URLs of uploaded files\",\n },\n ],\n },\n message: { type: \"string\" },\n },\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description:\n \"Invalid file type, size limit exceeded, or no file uploaded\",\n },\n ...(shouldIncludeSecurity(\"Create\") && {\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n \"403\": currentPath?.responses?.[\"403\"] || {\n description: \"Insufficient permissions to upload files\",\n },\n }),\n },\n };\n\n paths[pathname]!.post = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Update File - PATCH /{fileType}/{fileName}\n if (!isFileUploadEndpointDisabled(\"updateFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n const pathname = `${cleanBasePath}/{fileType}/{fileName}`;\n\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.patch;\n\n const defaultParameters: OpenAPIV3.ParameterObject[] = [\n {\n name: \"fileType\",\n in: \"path\",\n required: true,\n schema: {\n type: \"string\",\n enum: [\"images\", \"videos\", \"documents\", \"files\"],\n },\n description: \"Type of file being updated\",\n },\n {\n name: \"fileName\",\n in: \"path\",\n required: true,\n schema: { type: \"string\" },\n description: \"Name of the file to update\",\n },\n {\n name: \"format\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"jpeg\", \"jpg\", \"png\", \"webp\", \"gif\", \"avif\"],\n },\n description:\n \"Image format for conversion (only applicable for fileType=images)\",\n },\n {\n name: \"width\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target width for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"height\",\n in: \"query\",\n required: false,\n schema: { type: \"integer\", minimum: 1 },\n description:\n \"Target height for image resize (only applicable for fileType=images)\",\n },\n {\n name: \"resizeTo\",\n in: \"query\",\n required: false,\n schema: {\n type: \"string\",\n enum: [\"cover\", \"contain\", \"fill\", \"inside\", \"outside\"],\n },\n description: \"Resize strategy (only applicable for fileType=images)\",\n },\n ];\n\n const existingParams =\n (currentPath?.parameters as OpenAPIV3.ParameterObject[]) || [];\n const existingParamKeys = new Set(\n existingParams.map((p) => `${p.in}-${p.name}`)\n );\n\n const mergedParameters = [\n ...existingParams,\n ...defaultParameters.filter(\n (p) => !existingParamKeys.has(`${p.in}-${p.name}`)\n ),\n ];\n\n const defaultSpec = {\n tags: [\"File Upload\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Update existing file\"\n : currentPath?.summary,\n description:\n currentPath?.description === pathname || !currentPath?.description\n ? \"Replace an existing file with a new one. Deletes the old file and uploads the new one.\"\n : currentPath?.description,\n operationId:\n currentPath?.operationId?.includes(pathname) ||\n !currentPath?.operationId\n ? \"updateFile\"\n : currentPath?.operationId,\n ...(shouldIncludeSecurity(\"Update\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: mergedParameters,\n requestBody: currentPath?.requestBody || {\n required: true,\n content: {\n \"multipart/form-data\": {\n schema: {\n type: \"object\",\n properties: {\n images: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"images\"),\n },\n videos: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"videos\"),\n },\n documents: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"documents\"),\n },\n files: {\n type: \"array\",\n items: { type: \"string\", format: \"binary\" },\n description: getFileTypeDescription(\"files\"),\n },\n },\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"File updated successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n success: { type: \"boolean\", example: true },\n data: {\n oneOf: [\n { type: \"string\", description: \"URL of updated file\" },\n {\n type: \"array\",\n items: { type: \"string\" },\n description: \"URLs of updated files\",\n },\n ],\n },\n message: { type: \"string\" },\n },\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description:\n \"Invalid file type, size limit exceeded, or no file uploaded\",\n },\n \"404\": currentPath?.responses?.[\"404\"] || {\n description: \"Original file not found\",\n },\n ...(shouldIncludeSecurity(\"Update\") && {\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n \"403\": currentPath?.responses?.[\"403\"] || {\n description: \"Insufficient permissions to update files\",\n },\n }),\n },\n };\n\n paths[pathname]!.patch = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Delete File - DELETE /{fileType}/{fileName}\n if (!isFileUploadEndpointDisabled(\"deleteFile\")) {\n const cleanBasePath = basePathname.endsWith(\"/\")\n ? basePathname.slice(0, -1)\n : basePathname;\n const pathname = `${cleanBasePath}/{fileType}/{fileName}`;\n\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.delete;\n\n const defaultParameters: OpenAPIV3.ParameterObject[] = [\n {\n name: \"fileType\",\n in: \"path\",\n required: true,\n schema: {\n type: \"string\",\n enum: [\"images\", \"videos\", \"documents\", \"files\"],\n },\n description: \"Type of file being deleted\",\n },\n {\n name: \"fileName\",\n in: \"path\",\n required: true,\n schema: { type: \"string\" },\n description: \"Name of the file to delete\",\n },\n ];\n\n const existingParams =\n (currentPath?.parameters as OpenAPIV3.ParameterObject[]) || [];\n const existingParamKeys = new Set(\n existingParams.map((p) => `${p.in}-${p.name}`)\n );\n\n const mergedParameters = [\n ...existingParams,\n ...defaultParameters.filter(\n (p) => !existingParamKeys.has(`${p.in}-${p.name}`)\n ),\n ];\n\n const defaultSpec = {\n tags: [\"File Upload\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Delete file\"\n : currentPath?.summary,\n description:\n currentPath?.description === pathname || !currentPath?.description\n ? \"Delete an uploaded file from the server\"\n : currentPath?.description,\n operationId:\n currentPath?.operationId?.includes(pathname) ||\n !currentPath?.operationId\n ? \"deleteFile\"\n : currentPath?.operationId,\n ...(shouldIncludeSecurity(\"Delete\") && {\n security: [{ BearerAuth: [] }],\n }),\n parameters: mergedParameters,\n responses: {\n ...(currentPath?.responses || {}),\n \"204\": currentPath?.responses?.[\"204\"] || {\n description: \"File deleted successfully\",\n },\n \"404\": currentPath?.responses?.[\"404\"] || {\n description: \"File not found\",\n },\n ...(shouldIncludeSecurity(\"Delete\") && {\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n \"403\": currentPath?.responses?.[\"403\"] || {\n description: \"Insufficient permissions to delete files\",\n },\n }),\n },\n };\n\n paths[pathname]!.delete = { ...(currentPath || {}), ...defaultSpec };\n }\n\n return paths;\n}\n"]}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export function getSystemJsonSchemaPaths() {
|
|
2
|
-
const paths = {};
|
|
3
|
-
paths["/api/available-resources"] = {
|
|
4
|
-
get: {
|
|
5
|
-
tags: ["System"],
|
|
6
|
-
summary: "Get available resources",
|
|
7
|
-
description: "Returns a comprehensive list of all available API resource endpoints",
|
|
8
|
-
operationId: "getAvailableResources",
|
|
9
|
-
responses: {
|
|
10
|
-
"200": {
|
|
11
|
-
description: "List of available resources retrieved successfully",
|
|
12
|
-
content: {
|
|
13
|
-
"application/json": {
|
|
14
|
-
schema: {
|
|
15
|
-
type: "object",
|
|
16
|
-
properties: {
|
|
17
|
-
data: {
|
|
18
|
-
type: "array",
|
|
19
|
-
items: {
|
|
20
|
-
type: "string",
|
|
21
|
-
},
|
|
22
|
-
description: "Array of available resource endpoints",
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
return paths;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=get-system-json-schema-paths.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-system-json-schema-paths.js","sourceRoot":"","sources":["../../../../../../src/modules/swagger/utils/helpers/get-system-json-schema-paths.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,wBAAwB;IACtC,MAAM,KAAK,GAA0B,EAAE,CAAC;IAExC,KAAK,CAAC,0BAA0B,CAAC,GAAG;QAClC,GAAG,EAAE;YACH,IAAI,EAAE,CAAC,QAAQ,CAAC;YAChB,OAAO,EAAE,yBAAyB;YAClC,WAAW,EACT,sEAAsE;YACxE,WAAW,EAAE,uBAAuB;YACpC,SAAS,EAAE;gBACT,KAAK,EAAE;oBACL,WAAW,EAAE,oDAAoD;oBACjE,OAAO,EAAE;wBACP,kBAAkB,EAAE;4BAClB,MAAM,EAAE;gCACN,IAAI,EAAE,QAAQ;gCACd,UAAU,EAAE;oCACV,IAAI,EAAE;wCACJ,IAAI,EAAE,OAAO;wCACb,KAAK,EAAE;4CACL,IAAI,EAAE,QAAQ;yCACf;wCACD,WAAW,EAAE,uCAAuC;qCACrD;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;SACF;KACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { OpenAPIV3 } from \"openapi-types\";\n\nexport function getSystemJsonSchemaPaths() {\n const paths: OpenAPIV3.PathsObject = {};\n\n paths[\"/api/available-resources\"] = {\n get: {\n tags: [\"System\"],\n summary: \"Get available resources\",\n description:\n \"Returns a comprehensive list of all available API resource endpoints\",\n operationId: \"getAvailableResources\",\n responses: {\n \"200\": {\n description: \"List of available resources retrieved successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n data: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n description: \"Array of available resource endpoints\",\n },\n },\n },\n },\n },\n },\n },\n },\n };\n\n return paths;\n}\n"]}
|