@herrromich/az-functions 1.0.0
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/LICENSE +21 -0
- package/README.md +830 -0
- package/coverage/cobertura-coverage.xml +3482 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/context/forked-invocation-context.ts.html +127 -0
- package/coverage/lcov-report/context/index.html +191 -0
- package/coverage/lcov-report/context/index.ts.html +97 -0
- package/coverage/lcov-report/context/platform-context.manager.ts.html +193 -0
- package/coverage/lcov-report/context/platform-context.model.ts.html +262 -0
- package/coverage/lcov-report/context/platform-context.provider.ts.html +196 -0
- package/coverage/lcov-report/context/platform.execution.context.ts.html +217 -0
- package/coverage/lcov-report/context/wrapped-invocation-context.ts.html +163 -0
- package/coverage/lcov-report/event-hub-handler/azure-event-hub-trigger.model.ts.html +187 -0
- package/coverage/lcov-report/event-hub-handler/azure-event-hub-trigger.service.ts.html +760 -0
- package/coverage/lcov-report/event-hub-handler/decorators/decorators.model.ts.html +292 -0
- package/coverage/lcov-report/event-hub-handler/decorators/decorators.ts.html +778 -0
- package/coverage/lcov-report/event-hub-handler/decorators/index.html +146 -0
- package/coverage/lcov-report/event-hub-handler/decorators/index.ts.html +91 -0
- package/coverage/lcov-report/event-hub-handler/event-hub-handle-method-args-metadata.service.ts.html +130 -0
- package/coverage/lcov-report/event-hub-handler/event-hub-handler-metadata.reader.ts.html +199 -0
- package/coverage/lcov-report/event-hub-handler/event-hub-handler-registration.service.ts.html +220 -0
- package/coverage/lcov-report/event-hub-handler/event-hub-handler.factory.ts.html +283 -0
- package/coverage/lcov-report/event-hub-handler/event-hub-handler.model.ts.html +421 -0
- package/coverage/lcov-report/event-hub-handler/event-hub-handler.provider.ts.html +187 -0
- package/coverage/lcov-report/event-hub-handler/event-hub-trigger-support.factory.ts.html +787 -0
- package/coverage/lcov-report/event-hub-handler/event-hub-trigger-support.service.ts.html +829 -0
- package/coverage/lcov-report/event-hub-handler/event-hub-trigger.model.ts.html +193 -0
- package/coverage/lcov-report/event-hub-handler/event-hub-trigger.service.ts.html +859 -0
- package/coverage/lcov-report/event-hub-handler/event-hub-triggers-registration.service.ts.html +307 -0
- package/coverage/lcov-report/event-hub-handler/index.html +221 -0
- package/coverage/lcov-report/event-hub-handler/index.ts.html +142 -0
- package/coverage/lcov-report/eventhub-handler/decorators/decorators.model.ts.html +277 -0
- package/coverage/lcov-report/eventhub-handler/decorators/decorators.ts.html +679 -0
- package/coverage/lcov-report/eventhub-handler/decorators/index.html +131 -0
- package/coverage/lcov-report/eventhub-handler/eventhub-handler-metadata.reader.ts.html +196 -0
- package/coverage/lcov-report/eventhub-handler/eventhub-handler-registration.service.ts.html +220 -0
- package/coverage/lcov-report/eventhub-handler/eventhub-handler.factory.ts.html +193 -0
- package/coverage/lcov-report/eventhub-handler/eventhub-handler.model.ts.html +406 -0
- package/coverage/lcov-report/eventhub-handler/eventhub-trigger.model.ts.html +187 -0
- package/coverage/lcov-report/eventhub-handler/eventhub-trigger.service.ts.html +760 -0
- package/coverage/lcov-report/eventhub-handler/eventhub-triggers-registration.service.ts.html +304 -0
- package/coverage/lcov-report/eventhub-handler/index.html +206 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/forked-invocation-context.ts.html +127 -0
- package/coverage/lcov-report/function-handler-metadata.reader.ts.html +172 -0
- package/coverage/lcov-report/http-controller/authentication.provider.ts.html +481 -0
- package/coverage/lcov-report/http-controller/authenticator.provider.ts.html +460 -0
- package/coverage/lcov-report/http-controller/azure-http-trigger.service.ts.html +1045 -0
- package/coverage/lcov-report/http-controller/decorators/decorators.model.ts.html +388 -0
- package/coverage/lcov-report/http-controller/decorators/decorators.ts.html +1627 -0
- package/coverage/lcov-report/http-controller/decorators/index.html +146 -0
- package/coverage/lcov-report/http-controller/decorators/index.ts.html +94 -0
- package/coverage/lcov-report/http-controller/http-controller-metadata.reader.ts.html +271 -0
- package/coverage/lcov-report/http-controller/http-controller-metadata.service.ts.html +130 -0
- package/coverage/lcov-report/http-controller/http-controller-platform.model.ts.html +187 -0
- package/coverage/lcov-report/http-controller/http-controller-registration.service.ts.html +241 -0
- package/coverage/lcov-report/http-controller/http-controller.model.ts.html +745 -0
- package/coverage/lcov-report/http-controller/http-handler-support.factory.ts.html +499 -0
- package/coverage/lcov-report/http-controller/http-handler.factory.ts.html +415 -0
- package/coverage/lcov-report/http-controller/http-operation-registration.service.ts.html +328 -0
- package/coverage/lcov-report/http-controller/http-operations-registration.service.ts.html +328 -0
- package/coverage/lcov-report/http-controller/http-request-arg-provider.factory.ts.html +580 -0
- package/coverage/lcov-report/http-controller/http-request-handler.provider.ts.html +388 -0
- package/coverage/lcov-report/http-controller/http-response-processor.factory.ts.html +316 -0
- package/coverage/lcov-report/http-controller/index.html +311 -0
- package/coverage/lcov-report/http-controller/index.ts.html +226 -0
- package/coverage/lcov-report/http-controller/open-api-definition.service.ts.html +568 -0
- package/coverage/lcov-report/http-controller/open-api-metadata.service.ts.html +373 -0
- package/coverage/lcov-report/http-controller/open-api-print.service.ts.html +232 -0
- package/coverage/lcov-report/http-controller/open-api-registration.service.ts.html +220 -0
- package/coverage/lcov-report/http-controller/rest-open-api.regstry.ts.html +262 -0
- package/coverage/lcov-report/http-controller/security/authentication-service.factory.ts.html +280 -0
- package/coverage/lcov-report/http-controller/security/authentication-service.ts.html +115 -0
- package/coverage/lcov-report/http-controller/security/authenticator.provider.ts.html +799 -0
- package/coverage/lcov-report/http-controller/security/bearer-security-authentication.service.ts.html +133 -0
- package/coverage/lcov-report/http-controller/security/index.html +206 -0
- package/coverage/lcov-report/http-controller/security/index.ts.html +94 -0
- package/coverage/lcov-report/http-controller/security/model.ts.html +133 -0
- package/coverage/lcov-report/http-controller/security/operation-authentication.resolver.ts.html +418 -0
- package/coverage/lcov-report/http-controller/security/principal-merge.service.ts.html +163 -0
- package/coverage/lcov-report/http-controller/security/strict-principal-merge.servce.ts.html +154 -0
- package/coverage/lcov-report/http-controller/swagger-handling.service.ts.html +463 -0
- package/coverage/lcov-report/index.html +281 -0
- package/coverage/lcov-report/init.ts.html +97 -0
- package/coverage/lcov-report/ioc-container.utils.ts.html +100 -0
- package/coverage/lcov-report/logger/azure-log-transport.service.ts.html +433 -0
- package/coverage/lcov-report/logger/bindings.ts.html +253 -0
- package/coverage/lcov-report/logger/index.html +221 -0
- package/coverage/lcov-report/logger/index.ts.html +163 -0
- package/coverage/lcov-report/logger/log-level.service.ts.html +127 -0
- package/coverage/lcov-report/logger/log-transport.service.ts.html +571 -0
- package/coverage/lcov-report/logger/logger-factory.provider.ts.html +142 -0
- package/coverage/lcov-report/logger/logger.factory.ts.html +172 -0
- package/coverage/lcov-report/logger/logger.model.ts.html +868 -0
- package/coverage/lcov-report/logger/logger.utils.ts.html +877 -0
- package/coverage/lcov-report/logger/model.ts.html +172 -0
- package/coverage/lcov-report/logger/otel.logger.ts.html +358 -0
- package/coverage/lcov-report/logger/platform.logger.ts.html +229 -0
- package/coverage/lcov-report/logger/trie-search.service.ts.html +616 -0
- package/coverage/lcov-report/platform/azure-platform.ts.html +256 -0
- package/coverage/lcov-report/platform/index.html +176 -0
- package/coverage/lcov-report/platform/index.ts.html +139 -0
- package/coverage/lcov-report/platform/platform-component-metadata.service.ts.html +115 -0
- package/coverage/lcov-report/platform/register-function.factory.ts.html +145 -0
- package/coverage/lcov-report/platform/register-trigger-handler.factory.ts.html +214 -0
- package/coverage/lcov-report/platform/security-context.ts.html +127 -0
- package/coverage/lcov-report/platform/startup.service.ts.html +106 -0
- package/coverage/lcov-report/platform/system-logger-name.provider.ts.html +145 -0
- package/coverage/lcov-report/platform/system.container.ts.html +169 -0
- package/coverage/lcov-report/platform-context.model.ts.html +124 -0
- package/coverage/lcov-report/platform.logger.ts.html +316 -0
- package/coverage/lcov-report/platform.model.ts.html +292 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/security/index.html +146 -0
- package/coverage/lcov-report/security/index.ts.html +91 -0
- package/coverage/lcov-report/security/security-context.ts.html +130 -0
- package/coverage/lcov-report/security/security.model.ts.html +169 -0
- package/coverage/lcov-report/shared/all-settled.util.ts.html +118 -0
- package/coverage/lcov-report/shared/decorators/decorators.model.ts.html +136 -0
- package/coverage/lcov-report/shared/decorators/decorators.ts.html +346 -0
- package/coverage/lcov-report/shared/decorators/index.html +146 -0
- package/coverage/lcov-report/shared/decorators/index.ts.html +91 -0
- package/coverage/lcov-report/shared/function-handler-metadata.reader.ts.html +172 -0
- package/coverage/lcov-report/shared/index.html +176 -0
- package/coverage/lcov-report/shared/index.ts.html +133 -0
- package/coverage/lcov-report/shared/ioc-container.utils.ts.html +115 -0
- package/coverage/lcov-report/shared/platform-context-local-storage.ts.html +133 -0
- package/coverage/lcov-report/shared/platform-context.manager.ts.html +253 -0
- package/coverage/lcov-report/shared/platform.context.provider.ts.html +136 -0
- package/coverage/lcov-report/shared/platform.model.ts.html +298 -0
- package/coverage/lcov-report/shared/security.model.ts.html +142 -0
- package/coverage/lcov-report/shared/trie-search.service.ts.html +337 -0
- package/coverage/lcov-report/shared/trigger-handler-metadata.reader.ts.html +166 -0
- package/coverage/lcov-report/shared/zod-parser-wrapper.service.ts.html +217 -0
- package/coverage/lcov-report/shared/zod-parser-wrapper.ts.html +232 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov-report/src/context/index.html +191 -0
- package/coverage/lcov-report/src/context/index.ts.html +97 -0
- package/coverage/lcov-report/src/context/platform-context.manager.ts.html +193 -0
- package/coverage/lcov-report/src/context/platform-context.model.ts.html +262 -0
- package/coverage/lcov-report/src/context/platform-context.provider.ts.html +196 -0
- package/coverage/lcov-report/src/context/platform.execution.context.ts.html +217 -0
- package/coverage/lcov-report/src/context/wrapped-invocation-context.ts.html +163 -0
- package/coverage/lcov-report/src/event-hub-handler/azure-event-hub-trigger.model.ts.html +187 -0
- package/coverage/lcov-report/src/event-hub-handler/azure-event-hub-trigger.service.ts.html +769 -0
- package/coverage/lcov-report/src/event-hub-handler/decorators/decorators.model.ts.html +313 -0
- package/coverage/lcov-report/src/event-hub-handler/decorators/decorators.ts.html +778 -0
- package/coverage/lcov-report/src/event-hub-handler/decorators/index.html +146 -0
- package/coverage/lcov-report/src/event-hub-handler/decorators/index.ts.html +91 -0
- package/coverage/lcov-report/src/event-hub-handler/event-hub-handle-method-args-metadata.service.ts.html +130 -0
- package/coverage/lcov-report/src/event-hub-handler/event-hub-handler-metadata.reader.ts.html +199 -0
- package/coverage/lcov-report/src/event-hub-handler/event-hub-handler-registration.service.ts.html +220 -0
- package/coverage/lcov-report/src/event-hub-handler/event-hub-handler.factory.ts.html +283 -0
- package/coverage/lcov-report/src/event-hub-handler/event-hub-handler.model.ts.html +421 -0
- package/coverage/lcov-report/src/event-hub-handler/event-hub-handler.provider.ts.html +187 -0
- package/coverage/lcov-report/src/event-hub-handler/event-hub-trigger-support.factory.ts.html +787 -0
- package/coverage/lcov-report/src/event-hub-handler/event-hub-trigger-support.service.ts.html +832 -0
- package/coverage/lcov-report/src/event-hub-handler/event-hub-trigger.model.ts.html +193 -0
- package/coverage/lcov-report/src/event-hub-handler/event-hub-trigger.service.ts.html +859 -0
- package/coverage/lcov-report/src/event-hub-handler/event-hub-triggers-registration.service.ts.html +307 -0
- package/coverage/lcov-report/src/event-hub-handler/index.html +221 -0
- package/coverage/lcov-report/src/event-hub-handler/index.ts.html +142 -0
- package/coverage/lcov-report/src/framework.container.ts.html +157 -0
- package/coverage/lcov-report/src/http-controller/authentication.provider.ts.html +481 -0
- package/coverage/lcov-report/src/http-controller/authenticator.provider.ts.html +460 -0
- package/coverage/lcov-report/src/http-controller/azure-http-trigger.service.ts.html +865 -0
- package/coverage/lcov-report/src/http-controller/decorators/decorators.model.ts.html +553 -0
- package/coverage/lcov-report/src/http-controller/decorators/decorators.ts.html +1633 -0
- package/coverage/lcov-report/src/http-controller/decorators/index.html +146 -0
- package/coverage/lcov-report/src/http-controller/decorators/index.ts.html +94 -0
- package/coverage/lcov-report/src/http-controller/http-controller-metadata.reader.ts.html +271 -0
- package/coverage/lcov-report/src/http-controller/http-controller-metadata.service.ts.html +121 -0
- package/coverage/lcov-report/src/http-controller/http-controller-platform.model.ts.html +187 -0
- package/coverage/lcov-report/src/http-controller/http-controller-registration.service.ts.html +241 -0
- package/coverage/lcov-report/src/http-controller/http-controller.model.ts.html +784 -0
- package/coverage/lcov-report/src/http-controller/http-handler-support.factory.ts.html +481 -0
- package/coverage/lcov-report/src/http-controller/http-handler.factory.ts.html +406 -0
- package/coverage/lcov-report/src/http-controller/http-operation-registration.service.ts.html +328 -0
- package/coverage/lcov-report/src/http-controller/http-operations-registration.service.ts.html +328 -0
- package/coverage/lcov-report/src/http-controller/http-request-arg-provider.factory.ts.html +580 -0
- package/coverage/lcov-report/src/http-controller/http-request-handler.provider.ts.html +388 -0
- package/coverage/lcov-report/src/http-controller/http-response-processor.factory.ts.html +316 -0
- package/coverage/lcov-report/src/http-controller/index.html +311 -0
- package/coverage/lcov-report/src/http-controller/index.ts.html +226 -0
- package/coverage/lcov-report/src/http-controller/open-api-definition.service.ts.html +550 -0
- package/coverage/lcov-report/src/http-controller/open-api-metadata.service.ts.html +373 -0
- package/coverage/lcov-report/src/http-controller/open-api-print.service.ts.html +232 -0
- package/coverage/lcov-report/src/http-controller/open-api-registration.service.ts.html +220 -0
- package/coverage/lcov-report/src/http-controller/rest-open-api.regstry.ts.html +262 -0
- package/coverage/lcov-report/src/http-controller/security/authentication-service.factory.ts.html +280 -0
- package/coverage/lcov-report/src/http-controller/security/authentication-service.ts.html +139 -0
- package/coverage/lcov-report/src/http-controller/security/authenticator.provider.ts.html +799 -0
- package/coverage/lcov-report/src/http-controller/security/bearer-security-authentication.service.ts.html +133 -0
- package/coverage/lcov-report/src/http-controller/security/index.html +206 -0
- package/coverage/lcov-report/src/http-controller/security/index.ts.html +94 -0
- package/coverage/lcov-report/src/http-controller/security/model.ts.html +133 -0
- package/coverage/lcov-report/src/http-controller/security/operation-authentication.resolver.ts.html +418 -0
- package/coverage/lcov-report/src/http-controller/security/principal-merge.service.ts.html +163 -0
- package/coverage/lcov-report/src/http-controller/security/strict-principal-merge.servce.ts.html +154 -0
- package/coverage/lcov-report/src/http-controller/swagger-handling.service.ts.html +463 -0
- package/coverage/lcov-report/src/index.html +161 -0
- package/coverage/lcov-report/src/init.ts.html +97 -0
- package/coverage/lcov-report/src/logger/azure-log-transport.service.ts.html +433 -0
- package/coverage/lcov-report/src/logger/bindings.ts.html +253 -0
- package/coverage/lcov-report/src/logger/index.html +221 -0
- package/coverage/lcov-report/src/logger/index.ts.html +163 -0
- package/coverage/lcov-report/src/logger/log-level.service.ts.html +127 -0
- package/coverage/lcov-report/src/logger/log-transport.service.ts.html +571 -0
- package/coverage/lcov-report/src/logger/logger-factory.provider.ts.html +142 -0
- package/coverage/lcov-report/src/logger/logger.factory.ts.html +172 -0
- package/coverage/lcov-report/src/logger/logger.model.ts.html +868 -0
- package/coverage/lcov-report/src/logger/logger.utils.ts.html +877 -0
- package/coverage/lcov-report/src/logger/otel.logger.ts.html +358 -0
- package/coverage/lcov-report/src/logger/platform.logger.ts.html +229 -0
- package/coverage/lcov-report/src/logger/trie-search.service.ts.html +616 -0
- package/coverage/lcov-report/src/middleware.ts.html +232 -0
- package/coverage/lcov-report/src/platform/azure-platform.ts.html +256 -0
- package/coverage/lcov-report/src/platform/index.html +176 -0
- package/coverage/lcov-report/src/platform/index.ts.html +139 -0
- package/coverage/lcov-report/src/platform/platform-component-metadata.service.ts.html +115 -0
- package/coverage/lcov-report/src/platform/register-function.factory.ts.html +145 -0
- package/coverage/lcov-report/src/platform/register-trigger-handler.factory.ts.html +214 -0
- package/coverage/lcov-report/src/platform/security-context.ts.html +127 -0
- package/coverage/lcov-report/src/platform/startup.service.ts.html +202 -0
- package/coverage/lcov-report/src/platform/system-logger-name.provider.ts.html +145 -0
- package/coverage/lcov-report/src/platform/system.container.ts.html +172 -0
- package/coverage/lcov-report/src/platform.container.ts.html +148 -0
- package/coverage/lcov-report/src/security/index.html +146 -0
- package/coverage/lcov-report/src/security/index.ts.html +91 -0
- package/coverage/lcov-report/src/security/security-context.ts.html +175 -0
- package/coverage/lcov-report/src/security/security.model.ts.html +223 -0
- package/coverage/lcov-report/src/shared/decorators/decorators.model.ts.html +136 -0
- package/coverage/lcov-report/src/shared/decorators/decorators.ts.html +346 -0
- package/coverage/lcov-report/src/shared/decorators/index.html +146 -0
- package/coverage/lcov-report/src/shared/decorators/index.ts.html +91 -0
- package/coverage/lcov-report/src/shared/index.html +176 -0
- package/coverage/lcov-report/src/shared/index.ts.html +133 -0
- package/coverage/lcov-report/src/shared/ioc-container.utils.ts.html +115 -0
- package/coverage/lcov-report/src/shared/platform-context-local-storage.ts.html +133 -0
- package/coverage/lcov-report/src/shared/platform.model.ts.html +298 -0
- package/coverage/lcov-report/src/shared/security.model.ts.html +139 -0
- package/coverage/lcov-report/src/shared/trie-search.service.ts.html +337 -0
- package/coverage/lcov-report/src/shared/trigger-handler-metadata.reader.ts.html +166 -0
- package/coverage/lcov-report/src/shared/zod-parser-wrapper.ts.html +232 -0
- package/coverage/lcov-report/test/index.html +116 -0
- package/coverage/lcov-report/test/utils.ts.html +100 -0
- package/coverage/lcov-report/test-utils/index.html +116 -0
- package/coverage/lcov-report/test-utils/utils.ts.html +100 -0
- package/coverage/lcov-report/trie-search.service.ts.html +469 -0
- package/coverage/lcov-report/trigger-handler-metadata.reader.ts.html +187 -0
- package/coverage/lcov-report/wrapped-invocation-context.ts.html +163 -0
- package/coverage/lcov-report/zod-parser-wrapper.ts.html +232 -0
- package/coverage/lcov.info +3220 -0
- package/dist/assets/swagger-ui/LICENSE +202 -0
- package/dist/assets/swagger-ui/NOTICE +2 -0
- package/dist/assets/swagger-ui/README.md +40 -0
- package/dist/assets/swagger-ui/absolute-path.js +1 -0
- package/dist/assets/swagger-ui/favicon-16x16.png +0 -0
- package/dist/assets/swagger-ui/favicon-32x32.png +0 -0
- package/dist/assets/swagger-ui/index.css +16 -0
- package/dist/assets/swagger-ui/index.html +19 -0
- package/dist/assets/swagger-ui/index.js +1 -0
- package/dist/assets/swagger-ui/log.bundle-sizes.swagger-ui.txt +114 -0
- package/dist/assets/swagger-ui/log.es-bundle-core-sizes.swagger-ui.txt +14 -0
- package/dist/assets/swagger-ui/log.es-bundle-sizes.swagger-ui.txt +114 -0
- package/dist/assets/swagger-ui/oauth2-redirect.html +6 -0
- package/dist/assets/swagger-ui/oauth2-redirect.js +1 -0
- package/dist/assets/swagger-ui/package.json +20 -0
- package/dist/assets/swagger-ui/swagger-initializer.js +1 -0
- package/dist/assets/swagger-ui/swagger-ui-bundle.js +2 -0
- package/dist/assets/swagger-ui/swagger-ui-bundle.js.LICENSE.txt +106 -0
- package/dist/assets/swagger-ui/swagger-ui-bundle.js.map +1 -0
- package/dist/assets/swagger-ui/swagger-ui-es-bundle-core.js +2 -0
- package/dist/assets/swagger-ui/swagger-ui-es-bundle-core.js.LICENSE.txt +35 -0
- package/dist/assets/swagger-ui/swagger-ui-es-bundle-core.js.map +1 -0
- package/dist/assets/swagger-ui/swagger-ui-es-bundle.js +2 -0
- package/dist/assets/swagger-ui/swagger-ui-es-bundle.js.LICENSE.txt +106 -0
- package/dist/assets/swagger-ui/swagger-ui-es-bundle.js.map +1 -0
- package/dist/assets/swagger-ui/swagger-ui-standalone-preset.js +2 -0
- package/dist/assets/swagger-ui/swagger-ui-standalone-preset.js.LICENSE.txt +22 -0
- package/dist/assets/swagger-ui/swagger-ui-standalone-preset.js.map +1 -0
- package/dist/assets/swagger-ui/swagger-ui.css +3 -0
- package/dist/assets/swagger-ui/swagger-ui.css.map +1 -0
- package/dist/assets/swagger-ui/swagger-ui.js +1 -0
- package/dist/assets/swagger-ui/swagger-ui.js.map +1 -0
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.LICENSE.txt +24 -0
- package/dist/src/context/index.d.ts +4 -0
- package/dist/src/context/platform-context.manager.d.ts +23 -0
- package/dist/src/context/platform-context.model.d.ts +56 -0
- package/dist/src/context/platform-context.provider.d.ts +23 -0
- package/dist/src/context/platform.execution.context.d.ts +13 -0
- package/dist/src/context/wrapped-invocation-context.d.ts +5 -0
- package/dist/src/event-hub-handler/decorators/decorators.d.ts +161 -0
- package/dist/src/event-hub-handler/decorators/decorators.model.d.ts +62 -0
- package/dist/src/event-hub-handler/decorators/index.d.ts +2 -0
- package/dist/src/event-hub-handler/event-hub-handler-metadata.reader.d.ts +8 -0
- package/dist/src/event-hub-handler/event-hub-handler-registration.service.d.ts +12 -0
- package/dist/src/event-hub-handler/event-hub-handler.factory.d.ts +13 -0
- package/dist/src/event-hub-handler/event-hub-handler.model.d.ts +101 -0
- package/dist/src/event-hub-handler/event-hub-trigger-support.factory.d.ts +10 -0
- package/dist/src/event-hub-handler/event-hub-trigger.model.d.ts +39 -0
- package/dist/src/event-hub-handler/event-hub-triggers-registration.service.d.ts +18 -0
- package/dist/src/event-hub-handler/index.d.ts +4 -0
- package/dist/src/framework.container.d.ts +6 -0
- package/dist/src/http-controller/decorators/decorators.d.ts +410 -0
- package/dist/src/http-controller/decorators/decorators.model.d.ts +123 -0
- package/dist/src/http-controller/decorators/index.d.ts +3 -0
- package/dist/src/http-controller/http-controller-metadata.reader.d.ts +8 -0
- package/dist/src/http-controller/http-controller-registration.service.d.ts +12 -0
- package/dist/src/http-controller/http-controller.model.d.ts +131 -0
- package/dist/src/http-controller/http-handler-support.factory.d.ts +26 -0
- package/dist/src/http-controller/http-handler.factory.d.ts +16 -0
- package/dist/src/http-controller/http-operations-registration.service.d.ts +22 -0
- package/dist/src/http-controller/http-request-arg-provider.factory.d.ts +12 -0
- package/dist/src/http-controller/http-response-processor.factory.d.ts +10 -0
- package/dist/src/http-controller/index.d.ts +11 -0
- package/dist/src/http-controller/open-api-definition.service.d.ts +29 -0
- package/dist/src/http-controller/open-api-metadata.service.d.ts +11 -0
- package/dist/src/http-controller/open-api-print.service.d.ts +8 -0
- package/dist/src/http-controller/open-api-registration.service.d.ts +17 -0
- package/dist/src/http-controller/security/authentication-service.d.ts +15 -0
- package/dist/src/http-controller/security/authenticator.provider.d.ts +31 -0
- package/dist/src/http-controller/security/bearer-security-authentication.service.d.ts +9 -0
- package/dist/src/http-controller/security/bearer-token.service.d.ts +5 -0
- package/dist/src/http-controller/security/index.d.ts +3 -0
- package/dist/src/http-controller/security/operation-authentication.resolver.d.ts +18 -0
- package/dist/src/http-controller/security/principal-merge.service.d.ts +11 -0
- package/dist/src/http-controller/security/strict-principal-merge.servce.d.ts +5 -0
- package/dist/src/http-controller/swagger-handling.service.d.ts +11 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/init.d.ts +1 -0
- package/dist/src/logger/bindings.d.ts +7 -0
- package/dist/src/logger/index.d.ts +6 -0
- package/dist/src/logger/log-level.service.d.ts +7 -0
- package/dist/src/logger/log-transport.service.d.ts +19 -0
- package/dist/src/logger/logger.model.d.ts +241 -0
- package/dist/src/logger/logger.utils.d.ts +17 -0
- package/dist/src/logger/otel.logger.d.ts +9 -0
- package/dist/src/logger/trie-search.service.d.ts +65 -0
- package/dist/src/middleware.d.ts +10 -0
- package/dist/src/platform/azure-platform.d.ts +15 -0
- package/dist/src/platform/index.d.ts +5 -0
- package/dist/src/platform/model.d.ts +18 -0
- package/dist/src/platform/register-trigger-handler.factory.d.ts +5 -0
- package/dist/src/platform/startup.service.d.ts +36 -0
- package/dist/src/platform/system-logger-name.provider.d.ts +1 -0
- package/dist/src/platform.container.d.ts +3 -0
- package/dist/src/security/index.d.ts +2 -0
- package/dist/src/security/security-context.d.ts +22 -0
- package/dist/src/security/security.model.d.ts +37 -0
- package/dist/src/shared/decorators/decorators.d.ts +37 -0
- package/dist/src/shared/decorators/decorators.model.d.ts +13 -0
- package/dist/src/shared/decorators/index.d.ts +2 -0
- package/dist/src/shared/index.d.ts +8 -0
- package/dist/src/shared/ioc-container.utils.d.ts +7 -0
- package/dist/src/shared/platform.model.d.ts +44 -0
- package/dist/src/shared/trigger-handler-metadata.reader.d.ts +6 -0
- package/dist/src/shared/zod-parser-wrapper.d.ts +5 -0
- package/docs/logging.md +805 -0
- package/package.json +87 -0
- package/src/context/index.ts +4 -0
- package/src/context/platform-context.manager.ts +36 -0
- package/src/context/platform-context.model.ts +59 -0
- package/src/context/platform-context.provider.ts +37 -0
- package/src/context/platform.execution.context.ts +44 -0
- package/src/context/wrapped-invocation-context.ts +26 -0
- package/src/event-hub-handler/decorators/decorators.model.ts +76 -0
- package/src/event-hub-handler/decorators/decorators.ts +231 -0
- package/src/event-hub-handler/decorators/index.ts +2 -0
- package/src/event-hub-handler/event-hub-handler-metadata.reader.ts +38 -0
- package/src/event-hub-handler/event-hub-handler-registration.service.ts +45 -0
- package/src/event-hub-handler/event-hub-handler.factory.ts +66 -0
- package/src/event-hub-handler/event-hub-handler.model.ts +112 -0
- package/src/event-hub-handler/event-hub-trigger-support.factory.ts +234 -0
- package/src/event-hub-handler/event-hub-trigger.model.ts +36 -0
- package/src/event-hub-handler/event-hub-triggers-registration.service.ts +74 -0
- package/src/event-hub-handler/index.ts +19 -0
- package/src/framework.container.ts +24 -0
- package/src/http-controller/decorators/decorators.model.ts +156 -0
- package/src/http-controller/decorators/decorators.ts +516 -0
- package/src/http-controller/decorators/index.ts +3 -0
- package/src/http-controller/http-controller-metadata.reader.ts +62 -0
- package/src/http-controller/http-controller-registration.service.ts +52 -0
- package/src/http-controller/http-controller.model.ts +233 -0
- package/src/http-controller/http-handler-support.factory.ts +132 -0
- package/src/http-controller/http-handler.factory.ts +107 -0
- package/src/http-controller/http-operations-registration.service.ts +81 -0
- package/src/http-controller/http-request-arg-provider.factory.ts +165 -0
- package/src/http-controller/http-response-processor.factory.ts +77 -0
- package/src/http-controller/index.ts +47 -0
- package/src/http-controller/open-api-definition.service.ts +155 -0
- package/src/http-controller/open-api-metadata.service.ts +96 -0
- package/src/http-controller/open-api-print.service.ts +49 -0
- package/src/http-controller/open-api-registration.service.ts +45 -0
- package/src/http-controller/security/authentication-service.ts +18 -0
- package/src/http-controller/security/authenticator.provider.ts +238 -0
- package/src/http-controller/security/bearer-security-authentication.service.ts +16 -0
- package/src/http-controller/security/bearer-token.service.ts +6 -0
- package/src/http-controller/security/index.ts +3 -0
- package/src/http-controller/security/operation-authentication.resolver.ts +111 -0
- package/src/http-controller/security/principal-merge.service.ts +26 -0
- package/src/http-controller/security/strict-principal-merge.servce.ts +23 -0
- package/src/http-controller/swagger-handling.service.ts +126 -0
- package/src/index.ts +80 -0
- package/src/init.ts +4 -0
- package/src/logger/bindings.ts +56 -0
- package/src/logger/index.ts +26 -0
- package/src/logger/log-level.service.ts +14 -0
- package/src/logger/log-transport.service.ts +162 -0
- package/src/logger/logger.model.ts +261 -0
- package/src/logger/logger.utils.ts +264 -0
- package/src/logger/otel.logger.ts +91 -0
- package/src/logger/trie-search.service.ts +177 -0
- package/src/middleware.ts +49 -0
- package/src/platform/azure-platform.ts +57 -0
- package/src/platform/index.ts +18 -0
- package/src/platform/model.ts +19 -0
- package/src/platform/register-trigger-handler.factory.ts +43 -0
- package/src/platform/startup.service.ts +39 -0
- package/src/platform/system-logger-name.provider.ts +20 -0
- package/src/platform.container.ts +21 -0
- package/src/security/index.ts +2 -0
- package/src/security/security-context.ts +30 -0
- package/src/security/security.model.ts +46 -0
- package/src/shared/decorators/decorators.model.ts +17 -0
- package/src/shared/decorators/decorators.ts +87 -0
- package/src/shared/decorators/index.ts +2 -0
- package/src/shared/index.ts +16 -0
- package/src/shared/ioc-container.utils.ts +10 -0
- package/src/shared/platform.model.ts +71 -0
- package/src/shared/trigger-handler-metadata.reader.ts +27 -0
- package/src/shared/zod-parser-wrapper.ts +49 -0
- package/src/test-utilities/index.ts +1 -0
- package/src/test-utilities/utils.ts +5 -0
- package/tsconfig.test.json +8 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { ResponseConfig, ZodMediaTypeObject } from '@asteasolutions/zod-to-openapi';
|
|
2
|
+
import { HttpFunctionOptions } from '@azure/functions';
|
|
3
|
+
import { HeadersObject, OperationObject } from 'openapi3-ts/oas30';
|
|
4
|
+
import { CommonArgMetadata, TriggerHandlerClassMetadata } from 'shared';
|
|
5
|
+
import { _ZodString, ZodObject, ZodType } from 'zod';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ControllerConfig defines the configuration for an HTTP controller.
|
|
9
|
+
* - `application`: Optional string representing the application name. Name should be reference to a registered application in the platform.
|
|
10
|
+
* if not provided, the controller will be registered under the default application.
|
|
11
|
+
* - `path`: Required string representing the base path for the controller, relative to the application base path.
|
|
12
|
+
* This path will be prefixed to all operation paths defined in the controller.
|
|
13
|
+
* - `tags`: Optional array of strings representing tags for the controller.
|
|
14
|
+
*/
|
|
15
|
+
export interface ControllerConfig {
|
|
16
|
+
application?: string;
|
|
17
|
+
path: string;
|
|
18
|
+
tags?: string[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const HTTP_CONTROLLER_TYPE = 'http-controller';
|
|
22
|
+
|
|
23
|
+
export interface HttpControllerMetadata extends TriggerHandlerClassMetadata, ControllerConfig {
|
|
24
|
+
type: typeof HTTP_CONTROLLER_TYPE;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* DirectResponseObject defines the structure for a direct response in an HTTP controller operation.
|
|
29
|
+
* - `status`: Optional number representing the HTTP status code for the response. Defaults to 200 if not provided.
|
|
30
|
+
* - `description`: Required string providing a description of the response.
|
|
31
|
+
* - `jsonContent`: Optional ZodMediaTypeObject defining the JSON content schema for the response body.
|
|
32
|
+
* - `headers`: Optional object defining the headers for the response. Can be either a ZodObject or a HeadersObject.
|
|
33
|
+
*/
|
|
34
|
+
export interface DirectResponseObject {
|
|
35
|
+
status?: number;
|
|
36
|
+
description: string;
|
|
37
|
+
jsonContent?: ZodMediaTypeObject;
|
|
38
|
+
headers?: ZodObject<Record<string, _ZodString>> | HeadersObject;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* ControllerOperationConfig defines the configuration for an HTTP controller operation.
|
|
43
|
+
* - `operationId`: Optional string representing the unique identifier for the operation.
|
|
44
|
+
* - `description`: Optional string providing a description of the operation.
|
|
45
|
+
* - `summary`: Optional string providing a summary of the operation.
|
|
46
|
+
* - `tags`: Optional array of strings representing tags for the operation.
|
|
47
|
+
* - `parameters`: Optional array of parameters for the operation, as defined in the OpenAPI specification.
|
|
48
|
+
* - `security`: Optional array defining the security requirements for the operation, as defined in the OpenAPI specification.
|
|
49
|
+
* - `path`: Optional string representing the path for the operation, relative to the controller's base path.
|
|
50
|
+
* - `directResponse`: Optional DirectResponseObject defining a direct response for the operation.
|
|
51
|
+
* - `responses`: Optional record mapping HTTP status codes to ResponseConfig objects, defining the responses for the operation.
|
|
52
|
+
* - `authLevel`: Optional string defining the authentication level required for the operation, as defined in the Azure Functions HttpFunctionOptions.
|
|
53
|
+
* - `extraInputs`: Optional array of extra input bindings for the operation, as defined in the Azure Functions HttpFunctionOptions.
|
|
54
|
+
* - `extraOutputs`: Optional array of extra output bindings for the operation, as defined in the Azure Functions HttpFunctionOptions.
|
|
55
|
+
*/
|
|
56
|
+
export type ControllerOperationConfig = Pick<
|
|
57
|
+
OperationObject,
|
|
58
|
+
'operationId' | 'description' | 'summary' | 'tags' | 'parameters' | 'security'
|
|
59
|
+
> &
|
|
60
|
+
Partial<Pick<OperationObject, 'responses'>> & {
|
|
61
|
+
path?: string;
|
|
62
|
+
directResponse?: DirectResponseObject;
|
|
63
|
+
responses?: Record<string, ResponseConfig>;
|
|
64
|
+
} & Pick<HttpFunctionOptions, 'authLevel' | 'extraInputs' | 'extraOutputs'>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* ControllerRequest defines the structure for a request body in an HTTP controller operation.
|
|
68
|
+
* - `required`: Optional boolean indicating whether the request body is required. Defaults to false if not provided.
|
|
69
|
+
* - `description`: Optional string providing a description of the request body.
|
|
70
|
+
* - `schema`: Required ZodType defining the schema for the request body.
|
|
71
|
+
* - `example`: Optional example value for the request body, which can be of any type.
|
|
72
|
+
*/
|
|
73
|
+
export interface ControllerRequest {
|
|
74
|
+
required?: boolean;
|
|
75
|
+
description?: string;
|
|
76
|
+
schema: ZodType<unknown>;
|
|
77
|
+
example?: unknown;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* ControllerRequestBodyOperationConfig defines the configuration for an HTTP controller operation that includes a request body.
|
|
82
|
+
* It extends the ControllerOperationConfig and includes the 'requestBody' property from the OpenAPI OperationObject.
|
|
83
|
+
* - `operationId`: Optional string representing the unique identifier for the operation.
|
|
84
|
+
* - `description`: Optional string providing a description of the operation.
|
|
85
|
+
* - `summary`: Optional string providing a summary of the operation.
|
|
86
|
+
* - `tags`: Optional array of strings representing tags for the operation.
|
|
87
|
+
* - `parameters`: Optional array of parameters for the operation, as defined in the OpenAPI specification.
|
|
88
|
+
* - `security`: Optional array defining the security requirements for the operation, as defined in the OpenAPI specification.
|
|
89
|
+
* - `path`: Optional string representing the path for the operation, relative to the controller's base path.
|
|
90
|
+
* - `directResponse`: Optional DirectResponseObject defining a direct response for the operation.
|
|
91
|
+
* - `responses`: Optional record mapping HTTP status codes to ResponseConfig objects, defining the responses for the operation.
|
|
92
|
+
* - `authLevel`: Optional string defining the authentication level required for the operation, as defined in the Azure Functions HttpFunctionOptions.
|
|
93
|
+
* - `extraInputs`: Optional array of extra input bindings for the operation, as defined in the Azure Functions HttpFunctionOptions.
|
|
94
|
+
* - `extraOutputs`: Optional array of extra output bindings for the operation, as defined in the Azure Functions HttpFunctionOptions.
|
|
95
|
+
* - `requestBody`: Optional property from the OpenAPI OperationObject defining the request body for the operation.
|
|
96
|
+
*/
|
|
97
|
+
export type ControllerRequestBodyOperationConfig = ControllerOperationConfig & Pick<OperationObject, 'requestBody'>;
|
|
98
|
+
|
|
99
|
+
export type ControllerOperationCommonArgMetadata =
|
|
100
|
+
| {
|
|
101
|
+
type: 'request' | 'authContext';
|
|
102
|
+
}
|
|
103
|
+
| CommonArgMetadata;
|
|
104
|
+
|
|
105
|
+
export type PathSchema = ZodType<string | number>;
|
|
106
|
+
|
|
107
|
+
export interface ControllerOperationPathArgMetadata {
|
|
108
|
+
type: 'path';
|
|
109
|
+
name: string;
|
|
110
|
+
schema?: PathSchema;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface ControllerOperationHeaderArgMetadata {
|
|
114
|
+
type: 'header';
|
|
115
|
+
name: string;
|
|
116
|
+
schema?: ZodType<string | undefined>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export type QueryItemType = string | number | boolean | string[] | number[] | undefined;
|
|
120
|
+
export type QueryItemSchema = ZodType<QueryItemType>;
|
|
121
|
+
|
|
122
|
+
export interface ControllerOperationQueryArgMetadata {
|
|
123
|
+
type: 'query';
|
|
124
|
+
name: string;
|
|
125
|
+
schema?: QueryItemSchema;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface ControllerOperationBodyArgMetadata extends ControllerRequest {
|
|
129
|
+
type: 'body';
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export type ControllerOperationArgMetadata =
|
|
133
|
+
| ControllerOperationCommonArgMetadata
|
|
134
|
+
| ControllerOperationPathArgMetadata
|
|
135
|
+
| ControllerOperationHeaderArgMetadata
|
|
136
|
+
| ControllerOperationQueryArgMetadata
|
|
137
|
+
| ControllerOperationBodyArgMetadata;
|
|
138
|
+
|
|
139
|
+
export interface ControllerOperationArgsMetadata {
|
|
140
|
+
args: ControllerOperationArgMetadata[];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export type ControllerOperationBaseMetadata =
|
|
144
|
+
| (ControllerOperationConfig & {
|
|
145
|
+
method: 'get' | 'head' | 'delete';
|
|
146
|
+
})
|
|
147
|
+
| (ControllerRequestBodyOperationConfig & {
|
|
148
|
+
method: 'post' | 'put' | 'patch';
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
export type ControllerOperationMetadata = {
|
|
152
|
+
type: typeof HTTP_CONTROLLER_TYPE;
|
|
153
|
+
} & ControllerOperationBaseMetadata &
|
|
154
|
+
ControllerOperationArgsMetadata;
|
|
155
|
+
|
|
156
|
+
export type OperationMethod = ControllerOperationMetadata['method'];
|
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
import { decorate, injectable } from 'inversify';
|
|
2
|
+
import * as shared from 'shared';
|
|
3
|
+
import { adjustMetadata, FUNCTION_HANDLER_METADATA } from 'shared';
|
|
4
|
+
import { ZodType } from 'zod';
|
|
5
|
+
import {
|
|
6
|
+
ControllerConfig,
|
|
7
|
+
ControllerOperationArgMetadata,
|
|
8
|
+
ControllerOperationArgsMetadata,
|
|
9
|
+
ControllerOperationBaseMetadata,
|
|
10
|
+
ControllerOperationCommonArgMetadata,
|
|
11
|
+
ControllerOperationConfig,
|
|
12
|
+
ControllerOperationMetadata,
|
|
13
|
+
ControllerRequest,
|
|
14
|
+
ControllerRequestBodyOperationConfig,
|
|
15
|
+
HttpControllerMetadata,
|
|
16
|
+
PathSchema,
|
|
17
|
+
QueryItemSchema,
|
|
18
|
+
} from './decorators.model';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Class decorator to define an HTTP controller.
|
|
22
|
+
*
|
|
23
|
+
* @param config
|
|
24
|
+
* @returns Class decorator function
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const ItemSchema = z.object({
|
|
29
|
+
* id: z.string(),
|
|
30
|
+
* name: z.string(),
|
|
31
|
+
* }).openapi('Item');
|
|
32
|
+
*
|
|
33
|
+
* type Item = z.infer<typeof ItemSchema>;
|
|
34
|
+
*
|
|
35
|
+
* @HttpController({ path: '/items' })
|
|
36
|
+
* export class MyController {
|
|
37
|
+
* @Get({ description: 'Get all items',
|
|
38
|
+
* directResponse: {
|
|
39
|
+
* description: 'A list of items',
|
|
40
|
+
* jsonContent: { schema: z.array(ItemSchema) }
|
|
41
|
+
* }
|
|
42
|
+
* })
|
|
43
|
+
* async getItems(@Request() req: HttpRequest): Promise<Item[]> {
|
|
44
|
+
* // Handle GET /api/items
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* @Post({
|
|
48
|
+
* description: 'Create a new item',
|
|
49
|
+
* responses: {
|
|
50
|
+
* 201: {
|
|
51
|
+
* description: 'Item created'
|
|
52
|
+
* }
|
|
53
|
+
* }
|
|
54
|
+
* })
|
|
55
|
+
* async createItem(@Body({ schema: z.object({ name: z.string() }) }) body: { name: string }): Promise<void> {
|
|
56
|
+
* // Handle POST /api/items
|
|
57
|
+
* }
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export function HttpController(config: ControllerConfig): ClassDecorator {
|
|
62
|
+
return target => {
|
|
63
|
+
const metadata: HttpControllerMetadata = {
|
|
64
|
+
type: 'http-controller',
|
|
65
|
+
...config,
|
|
66
|
+
};
|
|
67
|
+
Reflect.defineMetadata(FUNCTION_HANDLER_METADATA, metadata, target);
|
|
68
|
+
decorate(injectable(), target);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Method decorator to define an HTTP GET controllerMethod.
|
|
74
|
+
*
|
|
75
|
+
* @param operationConfig
|
|
76
|
+
* @return Method decorator function
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* @HttpController({ path: '/items' })
|
|
81
|
+
* class MyController {
|
|
82
|
+
* @Get({
|
|
83
|
+
* path: '/{id}',
|
|
84
|
+
* description: 'Get item by ID',
|
|
85
|
+
* directResponse: {
|
|
86
|
+
* status: 200,
|
|
87
|
+
* description: 'A single item',
|
|
88
|
+
* jsonContent: { schema: z.object({ id: z.string(), name: z.string() }) },
|
|
89
|
+
* }
|
|
90
|
+
* })
|
|
91
|
+
* async getItemById(@PathParam({ name: 'id', schema: z.string().uuid() }) id: string): Promise<{ id: string; name: string }> {
|
|
92
|
+
* // Handle GET /item/{id}
|
|
93
|
+
* return { id, name: 'Sample Item' };
|
|
94
|
+
* }
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export function Get(operationConfig?: ControllerOperationConfig): MethodDecorator {
|
|
99
|
+
return provideControllerOperationDecorator({ method: 'get', ...operationConfig });
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Method decorator to define an HTTP HEAD controllerMethod.
|
|
104
|
+
*
|
|
105
|
+
* @param operationConfig
|
|
106
|
+
* @return Method decorator function
|
|
107
|
+
*/
|
|
108
|
+
export function Head(operationConfig?: ControllerOperationConfig): MethodDecorator {
|
|
109
|
+
return provideControllerOperationDecorator({ method: 'head', ...operationConfig });
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Method decorator to define an HTTP DELETE controllerMethod.
|
|
114
|
+
*
|
|
115
|
+
* @param operationConfig
|
|
116
|
+
* @return Method decorator function
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* @HttpController({ path: '/items' })
|
|
121
|
+
* class MyController {
|
|
122
|
+
* @Delete({
|
|
123
|
+
* path: '/{id}',
|
|
124
|
+
* description: 'Delete item by ID',
|
|
125
|
+
* directResponse: {
|
|
126
|
+
* description: 'Item deleted successfully',
|
|
127
|
+
* status: 204,
|
|
128
|
+
* },
|
|
129
|
+
* responses: {
|
|
130
|
+
* 404: {
|
|
131
|
+
* description: 'Item not found',
|
|
132
|
+
* },
|
|
133
|
+
* }, * })
|
|
134
|
+
* async deleteItemById(@PathParam({ name: 'id', schema: z.string().uuid() }) id: string): Promise<void> {
|
|
135
|
+
* // Handle DELETE /item/{id}
|
|
136
|
+
* const item = await this.itemsRepository.getItemById(id);
|
|
137
|
+
* if (!item) {
|
|
138
|
+
* throw new NotFoundError('Item not found', { details: { id } });
|
|
139
|
+
* }
|
|
140
|
+
* await this.itemsRepository.deleteItemById(id);
|
|
141
|
+
* }
|
|
142
|
+
* }
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
export function Delete(operationConfig?: ControllerOperationConfig): MethodDecorator {
|
|
146
|
+
return provideControllerOperationDecorator({ method: 'delete', ...operationConfig });
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Method decorator to define an HTTP POST controllerMethod.
|
|
151
|
+
* @param operationConfig
|
|
152
|
+
* @return Method decorator function
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```ts
|
|
156
|
+
* @HttpController({ path: '/items' })
|
|
157
|
+
* class MyController {
|
|
158
|
+
* @Post({
|
|
159
|
+
* description: 'Create a new item',
|
|
160
|
+
* directResponse: {
|
|
161
|
+
* description: 'Item created successfully',
|
|
162
|
+
* status: 201,
|
|
163
|
+
* jsonContent: { schema: z.object({ id: z.string(), name: z.string() }) },
|
|
164
|
+
* },
|
|
165
|
+
* })
|
|
166
|
+
* async createItem(@Body({ schema: z.object({ name: z.string() }) }) body: { name: string }): Promise<{ id: string; name: string }> {
|
|
167
|
+
* // Handle POST /items
|
|
168
|
+
* }
|
|
169
|
+
* }
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
export function Post(operationConfig?: ControllerRequestBodyOperationConfig): MethodDecorator {
|
|
173
|
+
return provideControllerOperationDecorator({ method: 'post', ...operationConfig });
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Method decorator to define an HTTP PUT controllerMethod.
|
|
178
|
+
*
|
|
179
|
+
* @param operationConfig
|
|
180
|
+
* @return Method decorator function
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```ts
|
|
184
|
+
* @HttpController({ path: '/items' })
|
|
185
|
+
* class MyController {
|
|
186
|
+
* @Put({
|
|
187
|
+
* path: '/{id}',
|
|
188
|
+
* description: 'Update item by ID',
|
|
189
|
+
* directResponse: {
|
|
190
|
+
* description: 'Item updated successfully',
|
|
191
|
+
* status: 204,
|
|
192
|
+
* jsonContent: { schema: z.object({ id: z.string(), name: z.string() }) },
|
|
193
|
+
* },
|
|
194
|
+
* responses: {
|
|
195
|
+
* 404: {
|
|
196
|
+
* description: 'Item not found',
|
|
197
|
+
* },
|
|
198
|
+
* },
|
|
199
|
+
* })
|
|
200
|
+
* async updateItemById(
|
|
201
|
+
* @PathParam({ name: 'id', schema: z.string().uuid() }) id: string,
|
|
202
|
+
* @Body({ schema: z.object({ name: z.string() }) }) body: { name: string }
|
|
203
|
+
* ): Promise<{ id: string; name: string }> {
|
|
204
|
+
* // Handle PUT /item/{id}
|
|
205
|
+
* const item = await this.itemsRepository.getItemById(id);
|
|
206
|
+
* if (!item) {
|
|
207
|
+
* throw new NotFoundError('Item not found', { details: { id } });
|
|
208
|
+
* }
|
|
209
|
+
* const updatedItem = await this.itemsRepository.updateItemById(id, body);
|
|
210
|
+
* return updatedItem;
|
|
211
|
+
* }
|
|
212
|
+
* }
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
|
|
216
|
+
export function Put(operationConfig?: ControllerRequestBodyOperationConfig): MethodDecorator {
|
|
217
|
+
return provideControllerOperationDecorator({ method: 'put', ...operationConfig });
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Method decorator to define an HTTP PATCH controllerMethod.
|
|
222
|
+
*
|
|
223
|
+
* @param operationConfig
|
|
224
|
+
* @return Method decorator function
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```ts
|
|
228
|
+
* @HttpController({ path: '/items' })
|
|
229
|
+
* class MyController {
|
|
230
|
+
* @Patch({
|
|
231
|
+
* path: '/{id}',
|
|
232
|
+
* description: 'Partially update item by ID',
|
|
233
|
+
* directResponse: {
|
|
234
|
+
* description: 'Item updated successfully',
|
|
235
|
+
* status: 204,
|
|
236
|
+
* jsonContent: { schema: z.object({ id: z.string(), name: z.string() }) },
|
|
237
|
+
* },
|
|
238
|
+
* responses: {
|
|
239
|
+
* 404: {
|
|
240
|
+
* description: 'Item not found',
|
|
241
|
+
* },
|
|
242
|
+
* }
|
|
243
|
+
* })
|
|
244
|
+
* async partiallyUpdateItemById(
|
|
245
|
+
* @PathParam({ name: 'id', schema: z.string().uuid() }) id: string,
|
|
246
|
+
* @Body({ schema: z.object({ name: z.string().optional() }) }) body: { name?: string }
|
|
247
|
+
* ): Promise<{ id: string; name: string }> {
|
|
248
|
+
* // Handle PATCH /item/{id}
|
|
249
|
+
* const item = await this.itemsRepository.getItemById(id);
|
|
250
|
+
* if (!item) {
|
|
251
|
+
* throw new NotFoundError('Item not found', { details: { id } });
|
|
252
|
+
* }
|
|
253
|
+
* const updatedItem = await this.itemsRepository.partiallyUpdateItemById(id, body);
|
|
254
|
+
* return updatedItem;
|
|
255
|
+
* }
|
|
256
|
+
* }
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
259
|
+
export function Patch(operationConfig?: ControllerRequestBodyOperationConfig): MethodDecorator {
|
|
260
|
+
return provideControllerOperationDecorator({ method: 'patch', ...operationConfig });
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function provideControllerOperationDecorator(baseMetadata: ControllerOperationBaseMetadata): MethodDecorator {
|
|
264
|
+
return (target, propertyKey) => {
|
|
265
|
+
const ownMetadata = Reflect.getOwnMetadata(FUNCTION_HANDLER_METADATA, target, propertyKey) as
|
|
266
|
+
| ControllerOperationArgsMetadata
|
|
267
|
+
| undefined;
|
|
268
|
+
const argsMetadata =
|
|
269
|
+
ownMetadata ?? shared.initializeMetadata<ControllerOperationArgMetadata>(target, propertyKey, getCommonArg);
|
|
270
|
+
const metadata: ControllerOperationMetadata = {
|
|
271
|
+
type: 'http-controller',
|
|
272
|
+
...baseMetadata,
|
|
273
|
+
...argsMetadata,
|
|
274
|
+
};
|
|
275
|
+
Reflect.defineMetadata(FUNCTION_HANDLER_METADATA, metadata, target, propertyKey);
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Parameter decorator to define the HTTP request body.
|
|
281
|
+
*
|
|
282
|
+
* @param bodyConfig
|
|
283
|
+
* @returns Parameter decorator function
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* ```ts
|
|
287
|
+
* @HttpController({ path: '/items' })
|
|
288
|
+
* class MyController {
|
|
289
|
+
* @Post({
|
|
290
|
+
* description: 'Create a new item',
|
|
291
|
+
* responses: {
|
|
292
|
+
* 201: {
|
|
293
|
+
* description: 'Item created'
|
|
294
|
+
* }
|
|
295
|
+
* }
|
|
296
|
+
* })
|
|
297
|
+
* async createItem(@Body({ schema: z.object({ name: z.string() }) }) body: { name: string }): Promise<void> {
|
|
298
|
+
* // Handle POST /items
|
|
299
|
+
* }
|
|
300
|
+
* }
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
export function Body(bodyConfig: ControllerRequest): ParameterDecorator {
|
|
304
|
+
return adjustOperationMetadata({
|
|
305
|
+
type: 'body',
|
|
306
|
+
...bodyConfig,
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Configuration for the {@link PathParam} decorator.
|
|
312
|
+
*
|
|
313
|
+
* @property name - The name of the path parameter as defined in the route.
|
|
314
|
+
* @property schema - Optional Zod schema to validate the path parameter.
|
|
315
|
+
*
|
|
316
|
+
*/
|
|
317
|
+
export interface PathParamConfig {
|
|
318
|
+
name: string;
|
|
319
|
+
schema?: PathSchema;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Parameter decorator to define an HTTP path parameter.
|
|
324
|
+
*
|
|
325
|
+
* @param config
|
|
326
|
+
* @returns Parameter decorator function
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* ```ts
|
|
330
|
+
* @HttpController({ path: '/items' })
|
|
331
|
+
* class MyController {
|
|
332
|
+
* @Get({
|
|
333
|
+
* path: '/{id}',
|
|
334
|
+
* description: 'Get item by ID',
|
|
335
|
+
* responses: {
|
|
336
|
+
* 200: {
|
|
337
|
+
* description: 'Successful directResponse',
|
|
338
|
+
* schema: z.object({ id: z.string(), name: z.string() })
|
|
339
|
+
* }
|
|
340
|
+
* }
|
|
341
|
+
* })
|
|
342
|
+
* async getItemById(@PathParam({ name: 'id', schema: z.string().uuid() }) id: string): Promise<{ id: string; name: string }> {
|
|
343
|
+
* // Handle GET /item/{id}
|
|
344
|
+
* return { id, name: 'Sample Item' };
|
|
345
|
+
* }
|
|
346
|
+
* }
|
|
347
|
+
* ```
|
|
348
|
+
*/
|
|
349
|
+
export function PathParam(config: PathParamConfig): ParameterDecorator {
|
|
350
|
+
return adjustOperationMetadata({
|
|
351
|
+
type: 'path',
|
|
352
|
+
...config,
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Configuration for the {@link QueryParam} decorator.
|
|
358
|
+
*
|
|
359
|
+
* @property name - The name of the query parameter.
|
|
360
|
+
* @property schema - Optional schema to validate the query parameter.
|
|
361
|
+
*/
|
|
362
|
+
export interface QueryParamConfig {
|
|
363
|
+
name: string;
|
|
364
|
+
schema?: QueryItemSchema;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Parameter decorator to define an HTTP query parameter.
|
|
369
|
+
*
|
|
370
|
+
* @param config
|
|
371
|
+
* @returns Parameter decorator function
|
|
372
|
+
*
|
|
373
|
+
* @example
|
|
374
|
+
* ```ts
|
|
375
|
+
* @HttpController({ path: '/items' })
|
|
376
|
+
* class MyController {
|
|
377
|
+
* @Get({
|
|
378
|
+
* description: 'Search items',
|
|
379
|
+
* responses: {
|
|
380
|
+
* 200: {
|
|
381
|
+
* description: 'Successful directResponse',
|
|
382
|
+
* schema: z.array(z.object({ id: z.string(), name: z.string() }))
|
|
383
|
+
* }
|
|
384
|
+
* }
|
|
385
|
+
* })
|
|
386
|
+
* async searchItems(@QueryParam({ name: 'query', schema: z.string().min(3) }) query: string): Promise<{ id: string; name: string }[]> {
|
|
387
|
+
* // Handle GET /items?query=searchTerm
|
|
388
|
+
* return [{ id: '1', name: 'Sample Item' }];
|
|
389
|
+
* }
|
|
390
|
+
* }
|
|
391
|
+
* ```
|
|
392
|
+
*/
|
|
393
|
+
export function QueryParam(config: QueryParamConfig): ParameterDecorator {
|
|
394
|
+
return adjustOperationMetadata({
|
|
395
|
+
type: 'query',
|
|
396
|
+
...config,
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Configuration for the {@link HeaderParam} decorator.
|
|
402
|
+
*
|
|
403
|
+
* @property name - The name of the header parameter.
|
|
404
|
+
* @property schema - Optional Zod schema to validate the header parameter.
|
|
405
|
+
*/
|
|
406
|
+
export interface HeaderParamConfig {
|
|
407
|
+
name: string;
|
|
408
|
+
schema?: ZodType<string | undefined>;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Parameter decorator to define an HTTP header parameter.
|
|
413
|
+
*
|
|
414
|
+
* @param config
|
|
415
|
+
* @returns Parameter decorator function
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* ```ts
|
|
419
|
+
* @HttpController({ path: '/items' })
|
|
420
|
+
* class MyController {
|
|
421
|
+
* @Get({
|
|
422
|
+
* description: 'Get items with custom header',
|
|
423
|
+
* responses: {
|
|
424
|
+
* 200: {
|
|
425
|
+
* description: 'Successful directResponse',
|
|
426
|
+
* schema: z.array(z.object({ id: z.string(), name: z.string() }))
|
|
427
|
+
* }
|
|
428
|
+
* }
|
|
429
|
+
* })
|
|
430
|
+
* async getItems(@HeaderParam({ name: 'X-Custom-Header', schema: z.string().optional() }) customHeader: string | undefined): Promise<{ id: string; name: string }[]> {
|
|
431
|
+
* // Handle GET /items with custom header
|
|
432
|
+
* return [{ id: '1', name: 'Sample Item' }];
|
|
433
|
+
* }
|
|
434
|
+
* }
|
|
435
|
+
* ```
|
|
436
|
+
*/
|
|
437
|
+
export function HeaderParam(config: HeaderParamConfig): ParameterDecorator {
|
|
438
|
+
return adjustOperationMetadata({
|
|
439
|
+
type: 'header',
|
|
440
|
+
...config,
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Parameter decorator to inject the full HTTP request object.
|
|
446
|
+
*
|
|
447
|
+
* @returns Parameter decorator function
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
* ```ts
|
|
451
|
+
* @HttpController({ path: '/items' })
|
|
452
|
+
* class MyController {
|
|
453
|
+
* @Get({
|
|
454
|
+
* description: 'Get all items',
|
|
455
|
+
* responses: {
|
|
456
|
+
* 200: {
|
|
457
|
+
* description: 'Successful directResponse',
|
|
458
|
+
* schema: z.array(z.object({ id: z.string(), name: z.string() }))
|
|
459
|
+
* }
|
|
460
|
+
* }
|
|
461
|
+
* })
|
|
462
|
+
* async getItems(@Request() req: HttpRequest): Promise<{ id: string; name: string }[]> {
|
|
463
|
+
* // Handle GET /api/items
|
|
464
|
+
* const name = req.query.get('name');
|
|
465
|
+
* return [{ id: '1', name: name ?? 'Sample Item' }];
|
|
466
|
+
* }
|
|
467
|
+
* }
|
|
468
|
+
* ```
|
|
469
|
+
*/
|
|
470
|
+
export function Request(): ParameterDecorator {
|
|
471
|
+
return adjustOperationMetadata({
|
|
472
|
+
type: 'request',
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Parameter decorator to inject the authentication context.
|
|
478
|
+
* Injects an object containing information about the authenticated user, such as their principal and claims.
|
|
479
|
+
* Injection should be used of type {@link AuthContext}.
|
|
480
|
+
*
|
|
481
|
+
* @returns Parameter decorator function
|
|
482
|
+
*
|
|
483
|
+
* @example
|
|
484
|
+
* ```ts
|
|
485
|
+
* @HttpController({ path: '/items' })
|
|
486
|
+
* class MyController {
|
|
487
|
+
* @Get({
|
|
488
|
+
* description: 'Get all items',
|
|
489
|
+
* responses: {
|
|
490
|
+
* 200: {
|
|
491
|
+
* description: 'Successful directResponse',
|
|
492
|
+
* schema: z.array(z.object({ id: z.string(), name: z.string() }))
|
|
493
|
+
* }
|
|
494
|
+
* }
|
|
495
|
+
* })
|
|
496
|
+
* async getItems(@AuthCtx() authContext: AuthContext): Promise<{ id: string; name: string }[]> {
|
|
497
|
+
* // Handle GET /api/items
|
|
498
|
+
* const userId = authContext.principal?.subject ?? 'unknown';
|
|
499
|
+
* return [{ id: '1', name: `Sample Item for user ${userId}` }];
|
|
500
|
+
* }
|
|
501
|
+
* }
|
|
502
|
+
* ```
|
|
503
|
+
*/
|
|
504
|
+
export function AuthCtx() {
|
|
505
|
+
return adjustOperationMetadata({
|
|
506
|
+
type: 'authContext',
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
function adjustOperationMetadata(operationArg: ControllerOperationArgMetadata): ParameterDecorator {
|
|
511
|
+
return adjustMetadata(FUNCTION_HANDLER_METADATA, operationArg, getCommonArg);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
function getCommonArg(): ControllerOperationCommonArgMetadata {
|
|
515
|
+
return shared.getCommonArg() as ControllerOperationCommonArgMetadata;
|
|
516
|
+
}
|