@detectant-api/sdk 0.0.1 → 0.0.2
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/README.md +111 -0
- package/dist/cjs/BaseClient.d.ts +54 -0
- package/dist/cjs/BaseClient.js +77 -0
- package/dist/cjs/Client.d.ts +86 -0
- package/dist/cjs/Client.js +255 -0
- package/dist/cjs/api/client/index.d.ts +1 -0
- package/dist/cjs/api/client/index.js +17 -0
- package/dist/cjs/api/client/requests/CreateScanBatchRequest.d.ts +5 -0
- package/dist/cjs/api/client/requests/CreateScanBatchRequest.js +3 -0
- package/dist/cjs/api/client/requests/CreateScanRequest.d.ts +5 -0
- package/dist/cjs/api/client/requests/CreateScanRequest.js +3 -0
- package/dist/cjs/api/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/client/requests/index.js +2 -0
- package/dist/cjs/api/errors/BadRequestError.d.ts +7 -0
- package/dist/cjs/api/errors/BadRequestError.js +54 -0
- package/dist/cjs/api/errors/ContentTooLargeError.d.ts +7 -0
- package/dist/cjs/api/errors/ContentTooLargeError.js +54 -0
- package/dist/cjs/api/errors/ForbiddenError.d.ts +7 -0
- package/dist/cjs/api/errors/ForbiddenError.js +54 -0
- package/dist/cjs/api/errors/InternalServerError.d.ts +7 -0
- package/dist/cjs/api/errors/InternalServerError.js +54 -0
- package/dist/cjs/api/errors/NotFoundError.d.ts +7 -0
- package/dist/cjs/api/errors/NotFoundError.js +54 -0
- package/dist/cjs/api/errors/ServiceUnavailableError.d.ts +5 -0
- package/dist/cjs/api/errors/ServiceUnavailableError.js +54 -0
- package/dist/cjs/api/errors/TooManyRequestsError.d.ts +7 -0
- package/dist/cjs/api/errors/TooManyRequestsError.js +54 -0
- package/dist/cjs/api/errors/UnauthorizedError.d.ts +7 -0
- package/dist/cjs/api/errors/UnauthorizedError.js +54 -0
- package/dist/cjs/api/errors/index.d.ts +8 -0
- package/dist/cjs/api/errors/index.js +24 -0
- package/dist/cjs/api/index.d.ts +4 -0
- package/dist/cjs/api/index.js +20 -0
- package/dist/cjs/api/resources/health/client/Client.d.ts +43 -0
- package/dist/cjs/api/resources/health/client/Client.js +152 -0
- package/dist/cjs/api/resources/health/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/health/client/index.js +2 -0
- package/dist/cjs/api/resources/health/exports.d.ts +2 -0
- package/dist/cjs/api/resources/health/exports.js +21 -0
- package/dist/cjs/api/resources/health/index.d.ts +1 -0
- package/dist/cjs/api/resources/health/index.js +17 -0
- package/dist/cjs/api/resources/index.d.ts +3 -0
- package/dist/cjs/api/resources/index.js +42 -0
- package/dist/cjs/api/resources/scans/client/Client.d.ts +54 -0
- package/dist/cjs/api/resources/scans/client/Client.js +196 -0
- package/dist/cjs/api/resources/scans/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/scans/client/index.js +17 -0
- package/dist/cjs/api/resources/scans/client/requests/GetScanRequest.d.ts +10 -0
- package/dist/cjs/api/resources/scans/client/requests/GetScanRequest.js +3 -0
- package/dist/cjs/api/resources/scans/client/requests/ListScansRequest.d.ts +18 -0
- package/dist/cjs/api/resources/scans/client/requests/ListScansRequest.js +3 -0
- package/dist/cjs/api/resources/scans/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/scans/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/scans/exports.d.ts +2 -0
- package/dist/cjs/api/resources/scans/exports.js +21 -0
- package/dist/cjs/api/resources/scans/index.d.ts +1 -0
- package/dist/cjs/api/resources/scans/index.js +17 -0
- package/dist/cjs/api/types/ApiError.d.ts +8 -0
- package/dist/cjs/api/types/ApiError.js +3 -0
- package/dist/cjs/api/types/ErrorResponse.d.ts +4 -0
- package/dist/cjs/api/types/ErrorResponse.js +3 -0
- package/dist/cjs/api/types/HealthResponse.d.ts +10 -0
- package/dist/cjs/api/types/HealthResponse.js +11 -0
- package/dist/cjs/api/types/Scan.d.ts +32 -0
- package/dist/cjs/api/types/Scan.js +17 -0
- package/dist/cjs/api/types/ScanBatchResponse.d.ts +5 -0
- package/dist/cjs/api/types/ScanBatchResponse.js +3 -0
- package/dist/cjs/api/types/ScanBatchResult.d.ts +13 -0
- package/dist/cjs/api/types/ScanBatchResult.js +3 -0
- package/dist/cjs/api/types/ScanFailure.d.ts +11 -0
- package/dist/cjs/api/types/ScanFailure.js +11 -0
- package/dist/cjs/api/types/ScanList.d.ts +7 -0
- package/dist/cjs/api/types/ScanList.js +3 -0
- package/dist/cjs/api/types/TypeAnalysis.d.ts +26 -0
- package/dist/cjs/api/types/TypeAnalysis.js +20 -0
- package/dist/cjs/api/types/TypeAnalysisReason.d.ts +13 -0
- package/dist/cjs/api/types/TypeAnalysisReason.js +12 -0
- package/dist/cjs/api/types/TypeDeclaration.d.ts +6 -0
- package/dist/cjs/api/types/TypeDeclaration.js +3 -0
- package/dist/cjs/api/types/TypeIdentification.d.ts +6 -0
- package/dist/cjs/api/types/TypeIdentification.js +3 -0
- package/dist/cjs/api/types/index.d.ts +12 -0
- package/dist/cjs/api/types/index.js +28 -0
- package/dist/cjs/auth/HeaderAuthProvider.d.ts +20 -0
- package/dist/cjs/auth/HeaderAuthProvider.js +80 -0
- package/dist/cjs/auth/index.d.ts +1 -0
- package/dist/cjs/auth/index.js +5 -0
- package/dist/cjs/core/auth/AuthProvider.d.ts +8 -0
- package/dist/cjs/core/auth/AuthProvider.js +9 -0
- package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
- package/dist/cjs/core/auth/AuthRequest.js +2 -0
- package/dist/cjs/core/auth/BasicAuth.d.ts +8 -0
- package/dist/cjs/core/auth/BasicAuth.js +33 -0
- package/dist/cjs/core/auth/BearerToken.d.ts +7 -0
- package/dist/cjs/core/auth/BearerToken.js +16 -0
- package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
- package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
- package/dist/cjs/core/auth/index.d.ts +5 -0
- package/dist/cjs/core/auth/index.js +11 -0
- package/dist/cjs/core/base64.d.ts +2 -0
- package/dist/cjs/core/base64.js +26 -0
- package/dist/cjs/core/exports.d.ts +2 -0
- package/dist/cjs/core/exports.js +18 -0
- package/dist/cjs/core/fetcher/APIResponse.d.ts +20 -0
- package/dist/cjs/core/fetcher/APIResponse.js +2 -0
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +19 -0
- package/dist/cjs/core/fetcher/BinaryResponse.js +17 -0
- package/dist/cjs/core/fetcher/EndpointMetadata.d.ts +13 -0
- package/dist/cjs/core/fetcher/EndpointMetadata.js +2 -0
- package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +12 -0
- package/dist/cjs/core/fetcher/EndpointSupplier.js +22 -0
- package/dist/cjs/core/fetcher/Fetcher.d.ts +56 -0
- package/dist/cjs/core/fetcher/Fetcher.js +244 -0
- package/dist/cjs/core/fetcher/Headers.d.ts +2 -0
- package/dist/cjs/core/fetcher/Headers.js +84 -0
- package/dist/cjs/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/cjs/core/fetcher/HttpResponsePromise.js +103 -0
- package/dist/cjs/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/cjs/core/fetcher/RawResponse.js +44 -0
- package/dist/cjs/core/fetcher/Supplier.d.ts +4 -0
- package/dist/cjs/core/fetcher/Supplier.js +22 -0
- package/dist/cjs/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/cjs/core/fetcher/createRequestUrl.js +8 -0
- package/dist/cjs/core/fetcher/getErrorResponseBody.d.ts +1 -0
- package/dist/cjs/core/fetcher/getErrorResponseBody.js +45 -0
- package/dist/cjs/core/fetcher/getFetchFn.d.ts +1 -0
- package/dist/cjs/core/fetcher/getFetchFn.js +17 -0
- package/dist/cjs/core/fetcher/getHeader.d.ts +1 -0
- package/dist/cjs/core/fetcher/getHeader.js +11 -0
- package/dist/cjs/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/cjs/core/fetcher/getRequestBody.js +27 -0
- package/dist/cjs/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/cjs/core/fetcher/getResponseBody.js +80 -0
- package/dist/cjs/core/fetcher/index.d.ts +13 -0
- package/dist/cjs/core/fetcher/index.js +19 -0
- package/dist/cjs/core/fetcher/makePassthroughRequest.d.ts +49 -0
- package/dist/cjs/core/fetcher/makePassthroughRequest.js +157 -0
- package/dist/cjs/core/fetcher/makeRequest.d.ts +6 -0
- package/dist/cjs/core/fetcher/makeRequest.js +61 -0
- package/dist/cjs/core/fetcher/redactUrl.d.ts +2 -0
- package/dist/cjs/core/fetcher/redactUrl.js +88 -0
- package/dist/cjs/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/cjs/core/fetcher/requestWithRetries.js +70 -0
- package/dist/cjs/core/fetcher/signals.d.ts +5 -0
- package/dist/cjs/core/fetcher/signals.js +32 -0
- package/dist/cjs/core/file/exports.d.ts +1 -0
- package/dist/cjs/core/file/exports.js +2 -0
- package/dist/cjs/core/file/file.d.ts +10 -0
- package/dist/cjs/core/file/file.js +225 -0
- package/dist/cjs/core/file/index.d.ts +2 -0
- package/dist/cjs/core/file/index.js +18 -0
- package/dist/cjs/core/file/types.d.ts +66 -0
- package/dist/cjs/core/file/types.js +2 -0
- package/dist/cjs/core/form-data-utils/FormDataWrapper.d.ts +15 -0
- package/dist/cjs/core/form-data-utils/FormDataWrapper.js +188 -0
- package/dist/cjs/core/form-data-utils/encodeAsFormParameter.d.ts +1 -0
- package/dist/cjs/core/form-data-utils/encodeAsFormParameter.js +12 -0
- package/dist/cjs/core/form-data-utils/index.d.ts +2 -0
- package/dist/cjs/core/form-data-utils/index.js +20 -0
- package/dist/cjs/core/headers.d.ts +2 -0
- package/dist/cjs/core/headers.js +31 -0
- package/dist/cjs/core/index.d.ts +8 -0
- package/dist/cjs/core/index.js +47 -0
- package/dist/cjs/core/json.d.ts +15 -0
- package/dist/cjs/core/json.js +24 -0
- package/dist/cjs/core/logging/exports.d.ts +18 -0
- package/dist/cjs/core/logging/exports.js +45 -0
- package/dist/cjs/core/logging/index.d.ts +1 -0
- package/dist/cjs/core/logging/index.js +17 -0
- package/dist/cjs/core/logging/logger.d.ts +126 -0
- package/dist/cjs/core/logging/logger.js +144 -0
- package/dist/cjs/core/requestBody.d.ts +12 -0
- package/dist/cjs/core/requestBody.js +26 -0
- package/dist/cjs/core/runtime/index.d.ts +1 -0
- package/dist/cjs/core/runtime/index.js +6 -0
- package/dist/cjs/core/runtime/runtime.d.ts +28 -0
- package/dist/cjs/core/runtime/runtime.js +176 -0
- package/dist/cjs/core/url/QueryStringBuilder.d.ts +47 -0
- package/dist/cjs/core/url/QueryStringBuilder.js +83 -0
- package/dist/cjs/core/url/encodePathParam.d.ts +1 -0
- package/dist/cjs/core/url/encodePathParam.js +21 -0
- package/dist/cjs/core/url/index.d.ts +4 -0
- package/dist/cjs/core/url/index.js +11 -0
- package/dist/cjs/core/url/join.d.ts +1 -0
- package/dist/cjs/core/url/join.js +68 -0
- package/dist/cjs/core/url/qs.d.ts +7 -0
- package/dist/cjs/core/url/qs.js +76 -0
- package/dist/cjs/environments.d.ts +4 -0
- package/dist/cjs/environments.js +7 -0
- package/dist/cjs/errors/DetectantApiError.d.ts +15 -0
- package/dist/cjs/errors/DetectantApiError.js +39 -0
- package/dist/cjs/errors/DetectantApiTimeoutError.d.ts +6 -0
- package/dist/cjs/errors/DetectantApiTimeoutError.js +52 -0
- package/dist/cjs/errors/handleNonStatusCodeError.d.ts +2 -0
- package/dist/cjs/errors/handleNonStatusCodeError.js +68 -0
- package/dist/cjs/errors/index.d.ts +2 -0
- package/dist/cjs/errors/index.js +7 -0
- package/dist/cjs/exports.d.ts +1 -0
- package/dist/cjs/exports.js +17 -0
- package/dist/cjs/index.d.ts +6 -0
- package/dist/cjs/index.js +48 -0
- package/dist/cjs/version.d.ts +1 -0
- package/dist/cjs/version.js +4 -0
- package/dist/esm/BaseClient.d.mts +54 -0
- package/dist/esm/BaseClient.mjs +40 -0
- package/dist/esm/Client.d.mts +86 -0
- package/dist/esm/Client.mjs +218 -0
- package/dist/esm/api/client/index.d.mts +1 -0
- package/dist/esm/api/client/index.mjs +1 -0
- package/dist/esm/api/client/requests/CreateScanBatchRequest.d.mts +5 -0
- package/dist/esm/api/client/requests/CreateScanBatchRequest.mjs +2 -0
- package/dist/esm/api/client/requests/CreateScanRequest.d.mts +5 -0
- package/dist/esm/api/client/requests/CreateScanRequest.mjs +2 -0
- package/dist/esm/api/client/requests/index.d.mts +2 -0
- package/dist/esm/api/client/requests/index.mjs +1 -0
- package/dist/esm/api/errors/BadRequestError.d.mts +7 -0
- package/dist/esm/api/errors/BadRequestError.mjs +17 -0
- package/dist/esm/api/errors/ContentTooLargeError.d.mts +7 -0
- package/dist/esm/api/errors/ContentTooLargeError.mjs +17 -0
- package/dist/esm/api/errors/ForbiddenError.d.mts +7 -0
- package/dist/esm/api/errors/ForbiddenError.mjs +17 -0
- package/dist/esm/api/errors/InternalServerError.d.mts +7 -0
- package/dist/esm/api/errors/InternalServerError.mjs +17 -0
- package/dist/esm/api/errors/NotFoundError.d.mts +7 -0
- package/dist/esm/api/errors/NotFoundError.mjs +17 -0
- package/dist/esm/api/errors/ServiceUnavailableError.d.mts +5 -0
- package/dist/esm/api/errors/ServiceUnavailableError.mjs +17 -0
- package/dist/esm/api/errors/TooManyRequestsError.d.mts +7 -0
- package/dist/esm/api/errors/TooManyRequestsError.mjs +17 -0
- package/dist/esm/api/errors/UnauthorizedError.d.mts +7 -0
- package/dist/esm/api/errors/UnauthorizedError.mjs +17 -0
- package/dist/esm/api/errors/index.d.mts +8 -0
- package/dist/esm/api/errors/index.mjs +8 -0
- package/dist/esm/api/index.d.mts +4 -0
- package/dist/esm/api/index.mjs +4 -0
- package/dist/esm/api/resources/health/client/Client.d.mts +43 -0
- package/dist/esm/api/resources/health/client/Client.mjs +115 -0
- package/dist/esm/api/resources/health/client/index.d.mts +1 -0
- package/dist/esm/api/resources/health/client/index.mjs +1 -0
- package/dist/esm/api/resources/health/exports.d.mts +2 -0
- package/dist/esm/api/resources/health/exports.mjs +3 -0
- package/dist/esm/api/resources/health/index.d.mts +1 -0
- package/dist/esm/api/resources/health/index.mjs +1 -0
- package/dist/esm/api/resources/index.d.mts +3 -0
- package/dist/esm/api/resources/index.mjs +3 -0
- package/dist/esm/api/resources/scans/client/Client.d.mts +54 -0
- package/dist/esm/api/resources/scans/client/Client.mjs +159 -0
- package/dist/esm/api/resources/scans/client/index.d.mts +1 -0
- package/dist/esm/api/resources/scans/client/index.mjs +1 -0
- package/dist/esm/api/resources/scans/client/requests/GetScanRequest.d.mts +10 -0
- package/dist/esm/api/resources/scans/client/requests/GetScanRequest.mjs +2 -0
- package/dist/esm/api/resources/scans/client/requests/ListScansRequest.d.mts +18 -0
- package/dist/esm/api/resources/scans/client/requests/ListScansRequest.mjs +2 -0
- package/dist/esm/api/resources/scans/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/scans/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/scans/exports.d.mts +2 -0
- package/dist/esm/api/resources/scans/exports.mjs +3 -0
- package/dist/esm/api/resources/scans/index.d.mts +1 -0
- package/dist/esm/api/resources/scans/index.mjs +1 -0
- package/dist/esm/api/types/ApiError.d.mts +8 -0
- package/dist/esm/api/types/ApiError.mjs +2 -0
- package/dist/esm/api/types/ErrorResponse.d.mts +4 -0
- package/dist/esm/api/types/ErrorResponse.mjs +2 -0
- package/dist/esm/api/types/HealthResponse.d.mts +10 -0
- package/dist/esm/api/types/HealthResponse.mjs +8 -0
- package/dist/esm/api/types/Scan.d.mts +32 -0
- package/dist/esm/api/types/Scan.mjs +14 -0
- package/dist/esm/api/types/ScanBatchResponse.d.mts +5 -0
- package/dist/esm/api/types/ScanBatchResponse.mjs +2 -0
- package/dist/esm/api/types/ScanBatchResult.d.mts +13 -0
- package/dist/esm/api/types/ScanBatchResult.mjs +2 -0
- package/dist/esm/api/types/ScanFailure.d.mts +11 -0
- package/dist/esm/api/types/ScanFailure.mjs +8 -0
- package/dist/esm/api/types/ScanList.d.mts +7 -0
- package/dist/esm/api/types/ScanList.mjs +2 -0
- package/dist/esm/api/types/TypeAnalysis.d.mts +26 -0
- package/dist/esm/api/types/TypeAnalysis.mjs +17 -0
- package/dist/esm/api/types/TypeAnalysisReason.d.mts +13 -0
- package/dist/esm/api/types/TypeAnalysisReason.mjs +9 -0
- package/dist/esm/api/types/TypeDeclaration.d.mts +6 -0
- package/dist/esm/api/types/TypeDeclaration.mjs +2 -0
- package/dist/esm/api/types/TypeIdentification.d.mts +6 -0
- package/dist/esm/api/types/TypeIdentification.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +12 -0
- package/dist/esm/api/types/index.mjs +12 -0
- package/dist/esm/auth/HeaderAuthProvider.d.mts +20 -0
- package/dist/esm/auth/HeaderAuthProvider.mjs +43 -0
- package/dist/esm/auth/index.d.mts +1 -0
- package/dist/esm/auth/index.mjs +1 -0
- package/dist/esm/core/auth/AuthProvider.d.mts +8 -0
- package/dist/esm/core/auth/AuthProvider.mjs +6 -0
- package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
- package/dist/esm/core/auth/AuthRequest.mjs +1 -0
- package/dist/esm/core/auth/BasicAuth.d.mts +8 -0
- package/dist/esm/core/auth/BasicAuth.mjs +30 -0
- package/dist/esm/core/auth/BearerToken.d.mts +7 -0
- package/dist/esm/core/auth/BearerToken.mjs +13 -0
- package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
- package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
- package/dist/esm/core/auth/index.d.mts +5 -0
- package/dist/esm/core/auth/index.mjs +4 -0
- package/dist/esm/core/base64.d.mts +2 -0
- package/dist/esm/core/base64.mjs +22 -0
- package/dist/esm/core/exports.d.mts +2 -0
- package/dist/esm/core/exports.mjs +2 -0
- package/dist/esm/core/fetcher/APIResponse.d.mts +20 -0
- package/dist/esm/core/fetcher/APIResponse.mjs +1 -0
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +19 -0
- package/dist/esm/core/fetcher/BinaryResponse.mjs +14 -0
- package/dist/esm/core/fetcher/EndpointMetadata.d.mts +13 -0
- package/dist/esm/core/fetcher/EndpointMetadata.mjs +1 -0
- package/dist/esm/core/fetcher/EndpointSupplier.d.mts +12 -0
- package/dist/esm/core/fetcher/EndpointSupplier.mjs +19 -0
- package/dist/esm/core/fetcher/Fetcher.d.mts +56 -0
- package/dist/esm/core/fetcher/Fetcher.mjs +240 -0
- package/dist/esm/core/fetcher/Headers.d.mts +2 -0
- package/dist/esm/core/fetcher/Headers.mjs +82 -0
- package/dist/esm/core/fetcher/HttpResponsePromise.d.mts +58 -0
- package/dist/esm/core/fetcher/HttpResponsePromise.mjs +99 -0
- package/dist/esm/core/fetcher/RawResponse.d.mts +29 -0
- package/dist/esm/core/fetcher/RawResponse.mjs +40 -0
- package/dist/esm/core/fetcher/Supplier.d.mts +4 -0
- package/dist/esm/core/fetcher/Supplier.mjs +19 -0
- package/dist/esm/core/fetcher/createRequestUrl.d.mts +1 -0
- package/dist/esm/core/fetcher/createRequestUrl.mjs +5 -0
- package/dist/esm/core/fetcher/getErrorResponseBody.d.mts +1 -0
- package/dist/esm/core/fetcher/getErrorResponseBody.mjs +42 -0
- package/dist/esm/core/fetcher/getFetchFn.d.mts +1 -0
- package/dist/esm/core/fetcher/getFetchFn.mjs +14 -0
- package/dist/esm/core/fetcher/getHeader.d.mts +1 -0
- package/dist/esm/core/fetcher/getHeader.mjs +8 -0
- package/dist/esm/core/fetcher/getRequestBody.d.mts +7 -0
- package/dist/esm/core/fetcher/getRequestBody.mjs +24 -0
- package/dist/esm/core/fetcher/getResponseBody.d.mts +1 -0
- package/dist/esm/core/fetcher/getResponseBody.mjs +77 -0
- package/dist/esm/core/fetcher/index.d.mts +13 -0
- package/dist/esm/core/fetcher/index.mjs +7 -0
- package/dist/esm/core/fetcher/makePassthroughRequest.d.mts +49 -0
- package/dist/esm/core/fetcher/makePassthroughRequest.mjs +154 -0
- package/dist/esm/core/fetcher/makeRequest.d.mts +6 -0
- package/dist/esm/core/fetcher/makeRequest.mjs +55 -0
- package/dist/esm/core/fetcher/redactUrl.d.mts +2 -0
- package/dist/esm/core/fetcher/redactUrl.mjs +84 -0
- package/dist/esm/core/fetcher/requestWithRetries.d.mts +1 -0
- package/dist/esm/core/fetcher/requestWithRetries.mjs +67 -0
- package/dist/esm/core/fetcher/signals.d.mts +5 -0
- package/dist/esm/core/fetcher/signals.mjs +28 -0
- package/dist/esm/core/file/exports.d.mts +1 -0
- package/dist/esm/core/file/exports.mjs +1 -0
- package/dist/esm/core/file/file.d.mts +10 -0
- package/dist/esm/core/file/file.mjs +188 -0
- package/dist/esm/core/file/index.d.mts +2 -0
- package/dist/esm/core/file/index.mjs +2 -0
- package/dist/esm/core/file/types.d.mts +66 -0
- package/dist/esm/core/file/types.mjs +1 -0
- package/dist/esm/core/form-data-utils/FormDataWrapper.d.mts +15 -0
- package/dist/esm/core/form-data-utils/FormDataWrapper.mjs +150 -0
- package/dist/esm/core/form-data-utils/encodeAsFormParameter.d.mts +1 -0
- package/dist/esm/core/form-data-utils/encodeAsFormParameter.mjs +9 -0
- package/dist/esm/core/form-data-utils/index.d.mts +2 -0
- package/dist/esm/core/form-data-utils/index.mjs +2 -0
- package/dist/esm/core/headers.d.mts +2 -0
- package/dist/esm/core/headers.mjs +27 -0
- package/dist/esm/core/index.d.mts +8 -0
- package/dist/esm/core/index.mjs +8 -0
- package/dist/esm/core/json.d.mts +15 -0
- package/dist/esm/core/json.mjs +19 -0
- package/dist/esm/core/logging/exports.d.mts +18 -0
- package/dist/esm/core/logging/exports.mjs +9 -0
- package/dist/esm/core/logging/index.d.mts +1 -0
- package/dist/esm/core/logging/index.mjs +1 -0
- package/dist/esm/core/logging/logger.d.mts +126 -0
- package/dist/esm/core/logging/logger.mjs +138 -0
- package/dist/esm/core/requestBody.d.mts +12 -0
- package/dist/esm/core/requestBody.mjs +23 -0
- package/dist/esm/core/runtime/index.d.mts +1 -0
- package/dist/esm/core/runtime/index.mjs +1 -0
- package/dist/esm/core/runtime/runtime.d.mts +28 -0
- package/dist/esm/core/runtime/runtime.mjs +172 -0
- package/dist/esm/core/url/QueryStringBuilder.d.mts +47 -0
- package/dist/esm/core/url/QueryStringBuilder.mjs +80 -0
- package/dist/esm/core/url/encodePathParam.d.mts +1 -0
- package/dist/esm/core/url/encodePathParam.mjs +18 -0
- package/dist/esm/core/url/index.d.mts +4 -0
- package/dist/esm/core/url/index.mjs +4 -0
- package/dist/esm/core/url/join.d.mts +1 -0
- package/dist/esm/core/url/join.mjs +65 -0
- package/dist/esm/core/url/qs.d.mts +7 -0
- package/dist/esm/core/url/qs.mjs +73 -0
- package/dist/esm/environments.d.mts +4 -0
- package/dist/esm/environments.mjs +4 -0
- package/dist/esm/errors/DetectantApiError.d.mts +15 -0
- package/dist/esm/errors/DetectantApiError.mjs +35 -0
- package/dist/esm/errors/DetectantApiTimeoutError.d.mts +6 -0
- package/dist/esm/errors/DetectantApiTimeoutError.mjs +15 -0
- package/dist/esm/errors/handleNonStatusCodeError.d.mts +2 -0
- package/dist/esm/errors/handleNonStatusCodeError.mjs +32 -0
- package/dist/esm/errors/index.d.mts +2 -0
- package/dist/esm/errors/index.mjs +2 -0
- package/dist/esm/exports.d.mts +1 -0
- package/dist/esm/exports.mjs +1 -0
- package/dist/esm/index.d.mts +6 -0
- package/dist/esm/index.mjs +5 -0
- package/dist/esm/version.d.mts +1 -0
- package/dist/esm/version.mjs +1 -0
- package/package.json +91 -1
- package/reference.md +380 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toQueryString = toQueryString;
|
|
4
|
+
const defaultQsOptions = {
|
|
5
|
+
arrayFormat: "indices",
|
|
6
|
+
encode: true,
|
|
7
|
+
};
|
|
8
|
+
function encodeValue(value, shouldEncode) {
|
|
9
|
+
if (value === undefined) {
|
|
10
|
+
return "";
|
|
11
|
+
}
|
|
12
|
+
if (value === null) {
|
|
13
|
+
return "";
|
|
14
|
+
}
|
|
15
|
+
const stringValue = String(value);
|
|
16
|
+
return shouldEncode ? encodeURIComponent(stringValue) : stringValue;
|
|
17
|
+
}
|
|
18
|
+
function stringifyObject(obj, prefix = "", options) {
|
|
19
|
+
const parts = [];
|
|
20
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
21
|
+
const fullKey = prefix ? `${prefix}[${key}]` : key;
|
|
22
|
+
if (value == null) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (Array.isArray(value)) {
|
|
26
|
+
if (value.length === 0) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const effectiveFormat = options.arrayFormat;
|
|
30
|
+
if (effectiveFormat === "comma") {
|
|
31
|
+
const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey;
|
|
32
|
+
const encodedValues = value
|
|
33
|
+
.filter((item) => item !== undefined && item !== null)
|
|
34
|
+
.map((item) => encodeValue(item, options.encode));
|
|
35
|
+
if (encodedValues.length > 0) {
|
|
36
|
+
parts.push(`${encodedKey}=${encodedValues.join(",")}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
for (let i = 0; i < value.length; i++) {
|
|
41
|
+
const item = value[i];
|
|
42
|
+
if (item == null) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (typeof item === "object" && !Array.isArray(item) && item !== null) {
|
|
46
|
+
const arrayKey = effectiveFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
|
|
47
|
+
parts.push(...stringifyObject(item, arrayKey, options));
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const arrayKey = effectiveFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
|
|
51
|
+
const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey;
|
|
52
|
+
parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else if (typeof value === "object" && value !== null) {
|
|
58
|
+
if (Object.keys(value).length === 0) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
parts.push(...stringifyObject(value, fullKey, options));
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey;
|
|
65
|
+
parts.push(`${encodedKey}=${encodeValue(value, options.encode)}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return parts;
|
|
69
|
+
}
|
|
70
|
+
function toQueryString(obj, options) {
|
|
71
|
+
if (obj == null || typeof obj !== "object") {
|
|
72
|
+
return "";
|
|
73
|
+
}
|
|
74
|
+
const parts = stringifyObject(obj, "", Object.assign(Object.assign({}, defaultQsOptions), options));
|
|
75
|
+
return parts.join("&");
|
|
76
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type * as core from "../core/index.js";
|
|
2
|
+
export declare class DetectantApiError extends Error {
|
|
3
|
+
readonly statusCode?: number;
|
|
4
|
+
readonly body?: unknown;
|
|
5
|
+
readonly rawResponse?: core.RawResponse;
|
|
6
|
+
readonly cause?: unknown;
|
|
7
|
+
constructor({ message, statusCode, body, rawResponse, cause, }: {
|
|
8
|
+
message?: string;
|
|
9
|
+
statusCode?: number;
|
|
10
|
+
body?: unknown;
|
|
11
|
+
rawResponse?: core.RawResponse;
|
|
12
|
+
cause?: unknown;
|
|
13
|
+
});
|
|
14
|
+
get requestId(): string | undefined;
|
|
15
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DetectantApiError = void 0;
|
|
5
|
+
const json_js_1 = require("../core/json.js");
|
|
6
|
+
class DetectantApiError extends Error {
|
|
7
|
+
constructor({ message, statusCode, body, rawResponse, cause, }) {
|
|
8
|
+
super(buildMessage({ message, statusCode, body }));
|
|
9
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
10
|
+
if (Error.captureStackTrace) {
|
|
11
|
+
Error.captureStackTrace(this, this.constructor);
|
|
12
|
+
}
|
|
13
|
+
this.name = "DetectantApiError";
|
|
14
|
+
this.statusCode = statusCode;
|
|
15
|
+
this.body = body;
|
|
16
|
+
this.rawResponse = rawResponse;
|
|
17
|
+
if (cause != null) {
|
|
18
|
+
this.cause = cause;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
get requestId() {
|
|
22
|
+
var _a, _b, _c;
|
|
23
|
+
return (_c = (_b = (_a = this.rawResponse) === null || _a === void 0 ? void 0 : _a.headers) === null || _b === void 0 ? void 0 : _b.get("x-request-id")) !== null && _c !== void 0 ? _c : undefined;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.DetectantApiError = DetectantApiError;
|
|
27
|
+
function buildMessage({ message, statusCode, body, }) {
|
|
28
|
+
const lines = [];
|
|
29
|
+
if (message != null) {
|
|
30
|
+
lines.push(message);
|
|
31
|
+
}
|
|
32
|
+
if (statusCode != null) {
|
|
33
|
+
lines.push(`Status code: ${statusCode.toString()}`);
|
|
34
|
+
}
|
|
35
|
+
if (body != null) {
|
|
36
|
+
lines.push(`Body: ${(0, json_js_1.toJson)(body, undefined, 2)}`);
|
|
37
|
+
}
|
|
38
|
+
return lines.join("\n");
|
|
39
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.DetectantApiTimeoutError = void 0;
|
|
38
|
+
const errors = __importStar(require("./index.js"));
|
|
39
|
+
class DetectantApiTimeoutError extends errors.DetectantApiError {
|
|
40
|
+
constructor(message, opts) {
|
|
41
|
+
super({
|
|
42
|
+
message: message,
|
|
43
|
+
cause: opts === null || opts === void 0 ? void 0 : opts.cause,
|
|
44
|
+
});
|
|
45
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
46
|
+
if (Error.captureStackTrace) {
|
|
47
|
+
Error.captureStackTrace(this, this.constructor);
|
|
48
|
+
}
|
|
49
|
+
this.name = "DetectantApiTimeoutError";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.DetectantApiTimeoutError = DetectantApiTimeoutError;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.handleNonStatusCodeError = handleNonStatusCodeError;
|
|
38
|
+
const errors = __importStar(require("./index.js"));
|
|
39
|
+
function handleNonStatusCodeError(error, rawResponse, method, path) {
|
|
40
|
+
switch (error.reason) {
|
|
41
|
+
case "non-json":
|
|
42
|
+
throw new errors.DetectantApiError({
|
|
43
|
+
statusCode: error.statusCode,
|
|
44
|
+
body: error.rawBody,
|
|
45
|
+
rawResponse: rawResponse,
|
|
46
|
+
});
|
|
47
|
+
case "body-is-null":
|
|
48
|
+
throw new errors.DetectantApiError({
|
|
49
|
+
statusCode: error.statusCode,
|
|
50
|
+
rawResponse: rawResponse,
|
|
51
|
+
});
|
|
52
|
+
case "timeout":
|
|
53
|
+
throw new errors.DetectantApiTimeoutError(`Timeout exceeded when calling ${method} ${path}.`, {
|
|
54
|
+
cause: error.cause,
|
|
55
|
+
});
|
|
56
|
+
case "unknown":
|
|
57
|
+
throw new errors.DetectantApiError({
|
|
58
|
+
message: error.errorMessage,
|
|
59
|
+
rawResponse: rawResponse,
|
|
60
|
+
cause: error.cause,
|
|
61
|
+
});
|
|
62
|
+
default:
|
|
63
|
+
throw new errors.DetectantApiError({
|
|
64
|
+
message: "Unknown error",
|
|
65
|
+
rawResponse: rawResponse,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DetectantApiTimeoutError = exports.DetectantApiError = void 0;
|
|
4
|
+
var DetectantApiError_js_1 = require("./DetectantApiError.js");
|
|
5
|
+
Object.defineProperty(exports, "DetectantApiError", { enumerable: true, get: function () { return DetectantApiError_js_1.DetectantApiError; } });
|
|
6
|
+
var DetectantApiTimeoutError_js_1 = require("./DetectantApiTimeoutError.js");
|
|
7
|
+
Object.defineProperty(exports, "DetectantApiTimeoutError", { enumerable: true, get: function () { return DetectantApiTimeoutError_js_1.DetectantApiTimeoutError; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./core/exports.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./core/exports.js"), exports);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * as DetectantApi from "./api/index.js";
|
|
2
|
+
export type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
|
|
3
|
+
export { Detectant } from "./Client.js";
|
|
4
|
+
export { DetectantApiEnvironment } from "./environments.js";
|
|
5
|
+
export { DetectantApiError, DetectantApiTimeoutError } from "./errors/index.js";
|
|
6
|
+
export * from "./exports.js";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.DetectantApiTimeoutError = exports.DetectantApiError = exports.DetectantApiEnvironment = exports.Detectant = exports.DetectantApi = void 0;
|
|
40
|
+
exports.DetectantApi = __importStar(require("./api/index.js"));
|
|
41
|
+
var Client_js_1 = require("./Client.js");
|
|
42
|
+
Object.defineProperty(exports, "Detectant", { enumerable: true, get: function () { return Client_js_1.Detectant; } });
|
|
43
|
+
var environments_js_1 = require("./environments.js");
|
|
44
|
+
Object.defineProperty(exports, "DetectantApiEnvironment", { enumerable: true, get: function () { return environments_js_1.DetectantApiEnvironment; } });
|
|
45
|
+
var index_js_1 = require("./errors/index.js");
|
|
46
|
+
Object.defineProperty(exports, "DetectantApiError", { enumerable: true, get: function () { return index_js_1.DetectantApiError; } });
|
|
47
|
+
Object.defineProperty(exports, "DetectantApiTimeoutError", { enumerable: true, get: function () { return index_js_1.DetectantApiTimeoutError; } });
|
|
48
|
+
__exportStar(require("./exports.js"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SDK_VERSION = "0.0.2";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { HeaderAuthProvider } from "./auth/HeaderAuthProvider.mjs";
|
|
2
|
+
import * as core from "./core/index.mjs";
|
|
3
|
+
import type * as environments from "./environments.mjs";
|
|
4
|
+
export type AuthOption = false | core.AuthProvider["getAuthRequest"] | core.AuthProvider | HeaderAuthProvider.AuthOptions;
|
|
5
|
+
export type BaseClientOptions = {
|
|
6
|
+
environment?: core.Supplier<environments.DetectantApiEnvironment | string>;
|
|
7
|
+
/** Specify a custom URL to connect the client to. */
|
|
8
|
+
baseUrl?: core.Supplier<string>;
|
|
9
|
+
/** Additional headers to include in requests. */
|
|
10
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
11
|
+
/** The default maximum time to wait for a response in seconds. */
|
|
12
|
+
timeoutInSeconds?: number;
|
|
13
|
+
/** The default number of times to retry the request. Defaults to 2. */
|
|
14
|
+
maxRetries?: number;
|
|
15
|
+
/** Provide a custom fetch implementation. Useful for platforms that don't have a built-in fetch or need a custom implementation. */
|
|
16
|
+
fetch?: typeof fetch;
|
|
17
|
+
/** Configure logging for the client. */
|
|
18
|
+
logging?: core.logging.LogConfig | core.logging.Logger;
|
|
19
|
+
/** Default options for SSE stream reconnection behavior. Has no effect on non-resumable endpoints. */
|
|
20
|
+
stream?: {
|
|
21
|
+
reconnectionEnabled?: boolean;
|
|
22
|
+
maxReconnectionAttempts?: number;
|
|
23
|
+
};
|
|
24
|
+
/** Override auth. Pass false to disable, a function returning auth headers, an AuthProvider, or auth options. */
|
|
25
|
+
auth?: AuthOption;
|
|
26
|
+
} & HeaderAuthProvider.AuthOptions;
|
|
27
|
+
export interface BaseRequestOptions {
|
|
28
|
+
/** The maximum time to wait for a response in seconds. */
|
|
29
|
+
timeoutInSeconds?: number;
|
|
30
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
31
|
+
maxRetries?: number;
|
|
32
|
+
/** A hook to abort the request. */
|
|
33
|
+
abortSignal?: AbortSignal;
|
|
34
|
+
/** Additional query string parameters to include in the request. */
|
|
35
|
+
queryParams?: Record<string, unknown>;
|
|
36
|
+
/** A dictionary containing additional parameters to spread into the request's body. */
|
|
37
|
+
additionalBodyParameters?: Record<string, unknown>;
|
|
38
|
+
/** Additional headers to include in the request. */
|
|
39
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
40
|
+
/** Options for SSE stream reconnection behavior. Has no effect on non-resumable endpoints. */
|
|
41
|
+
stream?: {
|
|
42
|
+
reconnectionEnabled?: boolean;
|
|
43
|
+
maxReconnectionAttempts?: number;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export type NormalizedClientOptions<T extends BaseClientOptions = BaseClientOptions> = T & {
|
|
47
|
+
logging: core.logging.Logger;
|
|
48
|
+
authProvider?: core.AuthProvider;
|
|
49
|
+
};
|
|
50
|
+
export type NormalizedClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions> = NormalizedClientOptions<T> & {
|
|
51
|
+
authProvider: core.AuthProvider;
|
|
52
|
+
};
|
|
53
|
+
export declare function normalizeClientOptions<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptions<T>;
|
|
54
|
+
export declare function normalizeClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptionsWithAuth<T>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import { HeaderAuthProvider } from "./auth/HeaderAuthProvider.mjs";
|
|
3
|
+
import { mergeHeaders } from "./core/headers.mjs";
|
|
4
|
+
import * as core from "./core/index.mjs";
|
|
5
|
+
export function normalizeClientOptions(options) {
|
|
6
|
+
const headers = mergeHeaders({
|
|
7
|
+
"X-Fern-Language": "JavaScript",
|
|
8
|
+
"X-Fern-SDK-Name": "@detectant-api/sdk",
|
|
9
|
+
"X-Fern-SDK-Version": "0.0.2",
|
|
10
|
+
"User-Agent": "@detectant-api/sdk/0.0.2",
|
|
11
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
|
+
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
14
|
+
return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
|
|
15
|
+
}
|
|
16
|
+
export function normalizeClientOptionsWithAuth(options) {
|
|
17
|
+
var _a;
|
|
18
|
+
const normalized = normalizeClientOptions(options);
|
|
19
|
+
if (options.auth === false) {
|
|
20
|
+
normalized.authProvider = new core.NoOpAuthProvider();
|
|
21
|
+
return normalized;
|
|
22
|
+
}
|
|
23
|
+
if (options.auth != null) {
|
|
24
|
+
if (typeof options.auth === "function") {
|
|
25
|
+
normalized.authProvider = { getAuthRequest: options.auth };
|
|
26
|
+
return normalized;
|
|
27
|
+
}
|
|
28
|
+
if (core.isAuthProvider(options.auth)) {
|
|
29
|
+
normalized.authProvider = options.auth;
|
|
30
|
+
return normalized;
|
|
31
|
+
}
|
|
32
|
+
Object.assign(normalized, options.auth);
|
|
33
|
+
}
|
|
34
|
+
const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
|
|
35
|
+
(_a = normalized.authProvider) !== null && _a !== void 0 ? _a : (normalized.authProvider = new HeaderAuthProvider(normalizedWithNoOpAuthProvider));
|
|
36
|
+
return normalized;
|
|
37
|
+
}
|
|
38
|
+
function withNoOpAuthProvider(options) {
|
|
39
|
+
return Object.assign(Object.assign({}, options), { authProvider: new core.NoOpAuthProvider() });
|
|
40
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as DetectantApi from "./api/index.mjs";
|
|
2
|
+
import { HealthClient } from "./api/resources/health/client/Client.mjs";
|
|
3
|
+
import { ScansClient } from "./api/resources/scans/client/Client.mjs";
|
|
4
|
+
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.mjs";
|
|
5
|
+
import { type NormalizedClientOptionsWithAuth } from "./BaseClient.mjs";
|
|
6
|
+
import * as core from "./core/index.mjs";
|
|
7
|
+
export declare namespace Detectant {
|
|
8
|
+
type Options = BaseClientOptions;
|
|
9
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare class Detectant {
|
|
13
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<Detectant.Options>;
|
|
14
|
+
protected _health: HealthClient | undefined;
|
|
15
|
+
protected _scans: ScansClient | undefined;
|
|
16
|
+
constructor(options?: Detectant.Options);
|
|
17
|
+
get health(): HealthClient;
|
|
18
|
+
get scans(): ScansClient;
|
|
19
|
+
/**
|
|
20
|
+
* Uploads one file and synchronously runs content-type and malware analysis.
|
|
21
|
+
* Only the first multipart part named `file` with a filename is
|
|
22
|
+
* scanned; other parts are ignored. Free accounts accept files up to
|
|
23
|
+
* 50 MiB; Grow and Scale accounts accept files up to 250 MiB.
|
|
24
|
+
*
|
|
25
|
+
* @param {core.file.Uploadable} file
|
|
26
|
+
* @param {Detectant.RequestOptions} requestOptions - Request-specific configuration.
|
|
27
|
+
*
|
|
28
|
+
* @throws {@link DetectantApi.BadRequestError}
|
|
29
|
+
* @throws {@link DetectantApi.UnauthorizedError}
|
|
30
|
+
* @throws {@link DetectantApi.ForbiddenError}
|
|
31
|
+
* @throws {@link DetectantApi.ContentTooLargeError}
|
|
32
|
+
* @throws {@link DetectantApi.TooManyRequestsError}
|
|
33
|
+
* @throws {@link DetectantApi.InternalServerError}
|
|
34
|
+
* @throws {@link DetectantApi.ServiceUnavailableError}
|
|
35
|
+
* @throws {@link errors.DetectantApiError}
|
|
36
|
+
* @throws {@link errors.DetectantApiTimeoutError}
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* import { createReadStream } from "fs";
|
|
40
|
+
* await client.scan(createReadStream("path/to/file"))
|
|
41
|
+
*/
|
|
42
|
+
scan(file: core.file.Uploadable, requestOptions?: Detectant.RequestOptions): core.HttpResponsePromise<DetectantApi.Scan>;
|
|
43
|
+
private __scan;
|
|
44
|
+
/**
|
|
45
|
+
* Uploads between 1 and 20 files in repeated `files` multipart parts. Each
|
|
46
|
+
* file uses its account plan's 50 MiB or 250 MiB per-file limit, validation, content-type
|
|
47
|
+
* analysis, malware detection, persistence, usage accounting, and billing path
|
|
48
|
+
* as `createScan`. The encoded multipart request limit is the plan's
|
|
49
|
+
* per-file limit × 20 plus 1 MiB for multipart framing.
|
|
50
|
+
*
|
|
51
|
+
* Results preserve submitted-file order. File-level validation or scanner
|
|
52
|
+
* failures are returned in the corresponding result and do not prevent
|
|
53
|
+
* other files from being scanned. The whole request is rejected only for
|
|
54
|
+
* request-level failures such as invalid multipart data, authentication or
|
|
55
|
+
* rate-limit failure, more than 20 files, or an oversized total request.
|
|
56
|
+
*
|
|
57
|
+
* @param {core.file.Uploadable[]} files
|
|
58
|
+
* @param {Detectant.RequestOptions} requestOptions - Request-specific configuration.
|
|
59
|
+
*
|
|
60
|
+
* @throws {@link DetectantApi.BadRequestError}
|
|
61
|
+
* @throws {@link DetectantApi.UnauthorizedError}
|
|
62
|
+
* @throws {@link DetectantApi.ForbiddenError}
|
|
63
|
+
* @throws {@link DetectantApi.ContentTooLargeError}
|
|
64
|
+
* @throws {@link DetectantApi.TooManyRequestsError}
|
|
65
|
+
* @throws {@link DetectantApi.InternalServerError}
|
|
66
|
+
* @throws {@link errors.DetectantApiError}
|
|
67
|
+
* @throws {@link errors.DetectantApiTimeoutError}
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* import { createReadStream } from "fs";
|
|
71
|
+
* await client.scanBatch([createReadStream("path/to/file")])
|
|
72
|
+
*/
|
|
73
|
+
scanBatch(files: core.file.Uploadable[], requestOptions?: Detectant.RequestOptions): core.HttpResponsePromise<DetectantApi.ScanBatchResponse>;
|
|
74
|
+
private __scanBatch;
|
|
75
|
+
/**
|
|
76
|
+
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
77
|
+
* This is useful for making requests to endpoints not yet supported in the SDK.
|
|
78
|
+
* The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
|
|
79
|
+
*
|
|
80
|
+
* @param {Request | string | URL} input - The URL, path, or Request object.
|
|
81
|
+
* @param {RequestInit} init - Standard fetch RequestInit options.
|
|
82
|
+
* @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
|
|
83
|
+
* @returns {Promise<Response>} A standard Response object.
|
|
84
|
+
*/
|
|
85
|
+
fetch(input: Request | string | URL, init?: RequestInit, requestOptions?: core.PassthroughRequest.RequestOptions): Promise<Response>;
|
|
86
|
+
}
|