@tapra/sdk 0.0.0-stage → 0.1.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/README.md +41 -3
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.js +5 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/realtime.d.ts +99 -0
- package/dist/lib/realtime.js +230 -0
- package/dist/lib/realtime.js.map +1 -0
- package/dist/src/BaseClient.d.ts +57 -0
- package/dist/src/BaseClient.js +37 -0
- package/dist/src/BaseClient.js.map +1 -0
- package/dist/src/Client.d.ts +41 -0
- package/dist/src/Client.js +61 -0
- package/dist/src/Client.js.map +1 -0
- package/dist/src/api/errors/BadRequestError.d.ts +7 -0
- package/dist/src/api/errors/BadRequestError.js +18 -0
- package/dist/src/api/errors/BadRequestError.js.map +1 -0
- package/dist/src/api/errors/ContentTooLargeError.d.ts +7 -0
- package/dist/src/api/errors/ContentTooLargeError.js +18 -0
- package/dist/src/api/errors/ContentTooLargeError.js.map +1 -0
- package/dist/src/api/errors/ForbiddenError.d.ts +7 -0
- package/dist/src/api/errors/ForbiddenError.js +18 -0
- package/dist/src/api/errors/ForbiddenError.js.map +1 -0
- package/dist/src/api/errors/InternalServerError.d.ts +7 -0
- package/dist/src/api/errors/InternalServerError.js +18 -0
- package/dist/src/api/errors/InternalServerError.js.map +1 -0
- package/dist/src/api/errors/PaymentRequiredError.d.ts +7 -0
- package/dist/src/api/errors/PaymentRequiredError.js +18 -0
- package/dist/src/api/errors/PaymentRequiredError.js.map +1 -0
- package/dist/src/api/errors/ServiceUnavailableError.d.ts +7 -0
- package/dist/src/api/errors/ServiceUnavailableError.js +18 -0
- package/dist/src/api/errors/ServiceUnavailableError.js.map +1 -0
- package/dist/src/api/errors/TooManyRequestsError.d.ts +7 -0
- package/dist/src/api/errors/TooManyRequestsError.js +18 -0
- package/dist/src/api/errors/TooManyRequestsError.js.map +1 -0
- package/dist/src/api/errors/UnauthorizedError.d.ts +7 -0
- package/dist/src/api/errors/UnauthorizedError.js +18 -0
- package/dist/src/api/errors/UnauthorizedError.js.map +1 -0
- package/dist/src/api/errors/index.d.ts +8 -0
- package/dist/src/api/errors/index.js +9 -0
- package/dist/src/api/errors/index.js.map +1 -0
- package/dist/src/api/index.d.ts +3 -0
- package/dist/src/api/index.js +4 -0
- package/dist/src/api/index.js.map +1 -0
- package/dist/src/api/resources/diarization/client/Client.d.ts +40 -0
- package/dist/src/api/resources/diarization/client/Client.js +97 -0
- package/dist/src/api/resources/diarization/client/Client.js.map +1 -0
- package/dist/src/api/resources/diarization/client/index.d.ts +1 -0
- package/dist/src/api/resources/diarization/client/index.js +2 -0
- package/dist/src/api/resources/diarization/client/index.js.map +1 -0
- package/dist/src/api/resources/diarization/client/requests/DiarizationRequest.d.ts +11 -0
- package/dist/src/api/resources/diarization/client/requests/DiarizationRequest.js +3 -0
- package/dist/src/api/resources/diarization/client/requests/DiarizationRequest.js.map +1 -0
- package/dist/src/api/resources/diarization/client/requests/index.d.ts +1 -0
- package/dist/src/api/resources/diarization/client/requests/index.js +2 -0
- package/dist/src/api/resources/diarization/client/requests/index.js.map +1 -0
- package/dist/src/api/resources/diarization/exports.d.ts +2 -0
- package/dist/src/api/resources/diarization/exports.js +4 -0
- package/dist/src/api/resources/diarization/exports.js.map +1 -0
- package/dist/src/api/resources/diarization/index.d.ts +1 -0
- package/dist/src/api/resources/diarization/index.js +2 -0
- package/dist/src/api/resources/diarization/index.js.map +1 -0
- package/dist/src/api/resources/index.d.ts +11 -0
- package/dist/src/api/resources/index.js +12 -0
- package/dist/src/api/resources/index.js.map +1 -0
- package/dist/src/api/resources/models/client/Client.d.ts +27 -0
- package/dist/src/api/resources/models/client/Client.js +56 -0
- package/dist/src/api/resources/models/client/Client.js.map +1 -0
- package/dist/src/api/resources/models/client/index.d.ts +1 -0
- package/dist/src/api/resources/models/client/index.js +2 -0
- package/dist/src/api/resources/models/client/index.js.map +1 -0
- package/dist/src/api/resources/models/exports.d.ts +2 -0
- package/dist/src/api/resources/models/exports.js +4 -0
- package/dist/src/api/resources/models/exports.js.map +1 -0
- package/dist/src/api/resources/models/index.d.ts +1 -0
- package/dist/src/api/resources/models/index.js +2 -0
- package/dist/src/api/resources/models/index.js.map +1 -0
- package/dist/src/api/resources/script/client/Client.d.ts +47 -0
- package/dist/src/api/resources/script/client/Client.js +99 -0
- package/dist/src/api/resources/script/client/Client.js.map +1 -0
- package/dist/src/api/resources/script/client/index.d.ts +1 -0
- package/dist/src/api/resources/script/client/index.js +2 -0
- package/dist/src/api/resources/script/client/index.js.map +1 -0
- package/dist/src/api/resources/script/client/requests/ConversionRequest.d.ts +26 -0
- package/dist/src/api/resources/script/client/requests/ConversionRequest.js +10 -0
- package/dist/src/api/resources/script/client/requests/ConversionRequest.js.map +1 -0
- package/dist/src/api/resources/script/client/requests/index.d.ts +1 -0
- package/dist/src/api/resources/script/client/requests/index.js +2 -0
- package/dist/src/api/resources/script/client/requests/index.js.map +1 -0
- package/dist/src/api/resources/script/exports.d.ts +2 -0
- package/dist/src/api/resources/script/exports.js +4 -0
- package/dist/src/api/resources/script/exports.js.map +1 -0
- package/dist/src/api/resources/script/index.d.ts +1 -0
- package/dist/src/api/resources/script/index.js +2 -0
- package/dist/src/api/resources/script/index.js.map +1 -0
- package/dist/src/api/resources/speech/client/Client.d.ts +43 -0
- package/dist/src/api/resources/speech/client/Client.js +145 -0
- package/dist/src/api/resources/speech/client/Client.js.map +1 -0
- package/dist/src/api/resources/speech/client/index.d.ts +1 -0
- package/dist/src/api/resources/speech/client/index.js +2 -0
- package/dist/src/api/resources/speech/client/index.js.map +1 -0
- package/dist/src/api/resources/speech/client/requests/SpeechRequest.d.ts +56 -0
- package/dist/src/api/resources/speech/client/requests/SpeechRequest.js +23 -0
- package/dist/src/api/resources/speech/client/requests/SpeechRequest.js.map +1 -0
- package/dist/src/api/resources/speech/client/requests/index.d.ts +1 -0
- package/dist/src/api/resources/speech/client/requests/index.js +2 -0
- package/dist/src/api/resources/speech/client/requests/index.js.map +1 -0
- package/dist/src/api/resources/speech/exports.d.ts +2 -0
- package/dist/src/api/resources/speech/exports.js +4 -0
- package/dist/src/api/resources/speech/exports.js.map +1 -0
- package/dist/src/api/resources/speech/index.d.ts +1 -0
- package/dist/src/api/resources/speech/index.js +2 -0
- package/dist/src/api/resources/speech/index.js.map +1 -0
- package/dist/src/api/resources/transcriptions/client/Client.d.ts +40 -0
- package/dist/src/api/resources/transcriptions/client/Client.js +118 -0
- package/dist/src/api/resources/transcriptions/client/Client.js.map +1 -0
- package/dist/src/api/resources/transcriptions/client/index.d.ts +1 -0
- package/dist/src/api/resources/transcriptions/client/index.js +2 -0
- package/dist/src/api/resources/transcriptions/client/index.js.map +1 -0
- package/dist/src/api/resources/transcriptions/client/requests/TranscriptionRequest.d.ts +32 -0
- package/dist/src/api/resources/transcriptions/client/requests/TranscriptionRequest.js +10 -0
- package/dist/src/api/resources/transcriptions/client/requests/TranscriptionRequest.js.map +1 -0
- package/dist/src/api/resources/transcriptions/client/requests/index.d.ts +1 -0
- package/dist/src/api/resources/transcriptions/client/requests/index.js +2 -0
- package/dist/src/api/resources/transcriptions/client/requests/index.js.map +1 -0
- package/dist/src/api/resources/transcriptions/exports.d.ts +2 -0
- package/dist/src/api/resources/transcriptions/exports.js +4 -0
- package/dist/src/api/resources/transcriptions/exports.js.map +1 -0
- package/dist/src/api/resources/transcriptions/index.d.ts +1 -0
- package/dist/src/api/resources/transcriptions/index.js +2 -0
- package/dist/src/api/resources/transcriptions/index.js.map +1 -0
- package/dist/src/api/resources/translations/client/Client.d.ts +57 -0
- package/dist/src/api/resources/translations/client/Client.js +208 -0
- package/dist/src/api/resources/translations/client/Client.js.map +1 -0
- package/dist/src/api/resources/translations/client/index.d.ts +1 -0
- package/dist/src/api/resources/translations/client/index.js +2 -0
- package/dist/src/api/resources/translations/client/index.js.map +1 -0
- package/dist/src/api/resources/translations/client/requests/CreateTranslationsRequest.d.ts +26 -0
- package/dist/src/api/resources/translations/client/requests/CreateTranslationsRequest.js +11 -0
- package/dist/src/api/resources/translations/client/requests/CreateTranslationsRequest.js.map +1 -0
- package/dist/src/api/resources/translations/client/requests/CreateTranslationsStreamRequest.d.ts +26 -0
- package/dist/src/api/resources/translations/client/requests/CreateTranslationsStreamRequest.js +11 -0
- package/dist/src/api/resources/translations/client/requests/CreateTranslationsStreamRequest.js.map +1 -0
- package/dist/src/api/resources/translations/client/requests/index.d.ts +2 -0
- package/dist/src/api/resources/translations/client/requests/index.js +3 -0
- package/dist/src/api/resources/translations/client/requests/index.js.map +1 -0
- package/dist/src/api/resources/translations/exports.d.ts +2 -0
- package/dist/src/api/resources/translations/exports.js +4 -0
- package/dist/src/api/resources/translations/exports.js.map +1 -0
- package/dist/src/api/resources/translations/index.d.ts +1 -0
- package/dist/src/api/resources/translations/index.js +2 -0
- package/dist/src/api/resources/translations/index.js.map +1 -0
- package/dist/src/api/types/Conversion.d.ts +18 -0
- package/dist/src/api/types/Conversion.js +9 -0
- package/dist/src/api/types/Conversion.js.map +1 -0
- package/dist/src/api/types/Diarization.d.ts +12 -0
- package/dist/src/api/types/Diarization.js +3 -0
- package/dist/src/api/types/Diarization.js.map +1 -0
- package/dist/src/api/types/ErrorObject.d.ts +18 -0
- package/dist/src/api/types/ErrorObject.js +16 -0
- package/dist/src/api/types/ErrorObject.js.map +1 -0
- package/dist/src/api/types/Error_.d.ts +6 -0
- package/dist/src/api/types/Error_.js +3 -0
- package/dist/src/api/types/Error_.js.map +1 -0
- package/dist/src/api/types/Model.d.ts +17 -0
- package/dist/src/api/types/Model.js +11 -0
- package/dist/src/api/types/Model.js.map +1 -0
- package/dist/src/api/types/ModelList.d.ts +13 -0
- package/dist/src/api/types/ModelList.js +8 -0
- package/dist/src/api/types/ModelList.js.map +1 -0
- package/dist/src/api/types/RealtimeClientMessage.d.ts +13 -0
- package/dist/src/api/types/RealtimeClientMessage.js +9 -0
- package/dist/src/api/types/RealtimeClientMessage.js.map +1 -0
- package/dist/src/api/types/RealtimeEvent.d.ts +39 -0
- package/dist/src/api/types/RealtimeEvent.js +13 -0
- package/dist/src/api/types/RealtimeEvent.js.map +1 -0
- package/dist/src/api/types/Segment.d.ts +10 -0
- package/dist/src/api/types/Segment.js +3 -0
- package/dist/src/api/types/Segment.js.map +1 -0
- package/dist/src/api/types/Speaker.d.ts +9 -0
- package/dist/src/api/types/Speaker.js +3 -0
- package/dist/src/api/types/Speaker.js.map +1 -0
- package/dist/src/api/types/SpeakerTurn.d.ts +7 -0
- package/dist/src/api/types/SpeakerTurn.js +3 -0
- package/dist/src/api/types/SpeakerTurn.js.map +1 -0
- package/dist/src/api/types/Speech.d.ts +25 -0
- package/dist/src/api/types/Speech.js +8 -0
- package/dist/src/api/types/Speech.js.map +1 -0
- package/dist/src/api/types/Transcription.d.ts +21 -0
- package/dist/src/api/types/Transcription.js +3 -0
- package/dist/src/api/types/Transcription.js.map +1 -0
- package/dist/src/api/types/Translation.d.ts +16 -0
- package/dist/src/api/types/Translation.js +3 -0
- package/dist/src/api/types/Translation.js.map +1 -0
- package/dist/src/api/types/TranslationLanguage.d.ts +8 -0
- package/dist/src/api/types/TranslationLanguage.js +3 -0
- package/dist/src/api/types/TranslationLanguage.js.map +1 -0
- package/dist/src/api/types/TranslationLanguageList.d.ts +14 -0
- package/dist/src/api/types/TranslationLanguageList.js +8 -0
- package/dist/src/api/types/TranslationLanguageList.js.map +1 -0
- package/dist/src/api/types/TranslationRequest.d.ts +22 -0
- package/dist/src/api/types/TranslationRequest.js +11 -0
- package/dist/src/api/types/TranslationRequest.js.map +1 -0
- package/dist/src/api/types/TranslationStreamEvent.d.ts +19 -0
- package/dist/src/api/types/TranslationStreamEvent.js +11 -0
- package/dist/src/api/types/TranslationStreamEvent.js.map +1 -0
- package/dist/src/api/types/Usage.d.ts +8 -0
- package/dist/src/api/types/Usage.js +3 -0
- package/dist/src/api/types/Usage.js.map +1 -0
- package/dist/src/api/types/Word.d.ts +9 -0
- package/dist/src/api/types/Word.js +3 -0
- package/dist/src/api/types/Word.js.map +1 -0
- package/dist/src/api/types/index.d.ts +20 -0
- package/dist/src/api/types/index.js +21 -0
- package/dist/src/api/types/index.js.map +1 -0
- package/dist/src/auth/BearerAuthProvider.d.ts +20 -0
- package/dist/src/auth/BearerAuthProvider.js +34 -0
- package/dist/src/auth/BearerAuthProvider.js.map +1 -0
- package/dist/src/auth/index.d.ts +1 -0
- package/dist/src/auth/index.js +2 -0
- package/dist/src/auth/index.js.map +1 -0
- package/dist/src/core/auth/AuthProvider.d.ts +8 -0
- package/dist/src/core/auth/AuthProvider.js +7 -0
- package/dist/src/core/auth/AuthProvider.js.map +1 -0
- package/dist/src/core/auth/AuthRequest.d.ts +9 -0
- package/dist/src/core/auth/AuthRequest.js +2 -0
- package/dist/src/core/auth/AuthRequest.js.map +1 -0
- package/dist/src/core/auth/BasicAuth.d.ts +8 -0
- package/dist/src/core/auth/BasicAuth.js +30 -0
- package/dist/src/core/auth/BasicAuth.js.map +1 -0
- package/dist/src/core/auth/BearerToken.d.ts +7 -0
- package/dist/src/core/auth/BearerToken.js +14 -0
- package/dist/src/core/auth/BearerToken.js.map +1 -0
- package/dist/src/core/auth/NoOpAuthProvider.d.ts +5 -0
- package/dist/src/core/auth/NoOpAuthProvider.js +6 -0
- package/dist/src/core/auth/NoOpAuthProvider.js.map +1 -0
- package/dist/src/core/auth/index.d.ts +5 -0
- package/dist/src/core/auth/index.js +5 -0
- package/dist/src/core/auth/index.js.map +1 -0
- package/dist/src/core/base64.d.ts +2 -0
- package/dist/src/core/base64.js +23 -0
- package/dist/src/core/base64.js.map +1 -0
- package/dist/src/core/exports.d.ts +2 -0
- package/dist/src/core/exports.js +3 -0
- package/dist/src/core/exports.js.map +1 -0
- package/dist/src/core/fetcher/APIResponse.d.ts +20 -0
- package/dist/src/core/fetcher/APIResponse.js +2 -0
- package/dist/src/core/fetcher/APIResponse.js.map +1 -0
- package/dist/src/core/fetcher/BinaryResponse.d.ts +19 -0
- package/dist/src/core/fetcher/BinaryResponse.js +15 -0
- package/dist/src/core/fetcher/BinaryResponse.js.map +1 -0
- package/dist/src/core/fetcher/EndpointMetadata.d.ts +13 -0
- package/dist/src/core/fetcher/EndpointMetadata.js +2 -0
- package/dist/src/core/fetcher/EndpointMetadata.js.map +1 -0
- package/dist/src/core/fetcher/EndpointSupplier.d.ts +12 -0
- package/dist/src/core/fetcher/EndpointSupplier.js +11 -0
- package/dist/src/core/fetcher/EndpointSupplier.js.map +1 -0
- package/dist/src/core/fetcher/Fetcher.d.ts +56 -0
- package/dist/src/core/fetcher/Fetcher.js +224 -0
- package/dist/src/core/fetcher/Fetcher.js.map +1 -0
- package/dist/src/core/fetcher/Headers.d.ts +2 -0
- package/dist/src/core/fetcher/Headers.js +84 -0
- package/dist/src/core/fetcher/Headers.js.map +1 -0
- package/dist/src/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/src/core/fetcher/HttpResponsePromise.js +91 -0
- package/dist/src/core/fetcher/HttpResponsePromise.js.map +1 -0
- package/dist/src/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/src/core/fetcher/RawResponse.js +41 -0
- package/dist/src/core/fetcher/RawResponse.js.map +1 -0
- package/dist/src/core/fetcher/Supplier.d.ts +4 -0
- package/dist/src/core/fetcher/Supplier.js +11 -0
- package/dist/src/core/fetcher/Supplier.js.map +1 -0
- package/dist/src/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/src/core/fetcher/createRequestUrl.js +6 -0
- package/dist/src/core/fetcher/createRequestUrl.js.map +1 -0
- package/dist/src/core/fetcher/getErrorResponseBody.d.ts +1 -0
- package/dist/src/core/fetcher/getErrorResponseBody.js +31 -0
- package/dist/src/core/fetcher/getErrorResponseBody.js.map +1 -0
- package/dist/src/core/fetcher/getFetchFn.d.ts +1 -0
- package/dist/src/core/fetcher/getFetchFn.js +4 -0
- package/dist/src/core/fetcher/getFetchFn.js.map +1 -0
- package/dist/src/core/fetcher/getHeader.d.ts +1 -0
- package/dist/src/core/fetcher/getHeader.js +9 -0
- package/dist/src/core/fetcher/getHeader.js.map +1 -0
- package/dist/src/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/src/core/fetcher/getRequestBody.js +14 -0
- package/dist/src/core/fetcher/getRequestBody.js.map +1 -0
- package/dist/src/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/src/core/fetcher/getResponseBody.js +67 -0
- package/dist/src/core/fetcher/getResponseBody.js.map +1 -0
- package/dist/src/core/fetcher/index.d.ts +13 -0
- package/dist/src/core/fetcher/index.js +8 -0
- package/dist/src/core/fetcher/index.js.map +1 -0
- package/dist/src/core/fetcher/makePassthroughRequest.d.ts +49 -0
- package/dist/src/core/fetcher/makePassthroughRequest.js +142 -0
- package/dist/src/core/fetcher/makePassthroughRequest.js.map +1 -0
- package/dist/src/core/fetcher/makeRequest.d.ts +6 -0
- package/dist/src/core/fetcher/makeRequest.js +54 -0
- package/dist/src/core/fetcher/makeRequest.js.map +1 -0
- package/dist/src/core/fetcher/redactUrl.d.ts +2 -0
- package/dist/src/core/fetcher/redactUrl.js +85 -0
- package/dist/src/core/fetcher/redactUrl.js.map +1 -0
- package/dist/src/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/src/core/fetcher/requestWithRetries.js +57 -0
- package/dist/src/core/fetcher/requestWithRetries.js.map +1 -0
- package/dist/src/core/fetcher/signals.d.ts +5 -0
- package/dist/src/core/fetcher/signals.js +29 -0
- package/dist/src/core/fetcher/signals.js.map +1 -0
- package/dist/src/core/file/exports.d.ts +1 -0
- package/dist/src/core/file/exports.js +2 -0
- package/dist/src/core/file/exports.js.map +1 -0
- package/dist/src/core/file/file.d.ts +10 -0
- package/dist/src/core/file/file.js +169 -0
- package/dist/src/core/file/file.js.map +1 -0
- package/dist/src/core/file/index.d.ts +2 -0
- package/dist/src/core/file/index.js +3 -0
- package/dist/src/core/file/index.js.map +1 -0
- package/dist/src/core/file/types.d.ts +66 -0
- package/dist/src/core/file/types.js +2 -0
- package/dist/src/core/file/types.js.map +1 -0
- package/dist/src/core/form-data-utils/FormDataWrapper.d.ts +15 -0
- package/dist/src/core/form-data-utils/FormDataWrapper.js +109 -0
- package/dist/src/core/form-data-utils/FormDataWrapper.js.map +1 -0
- package/dist/src/core/form-data-utils/encodeAsFormParameter.d.ts +1 -0
- package/dist/src/core/form-data-utils/encodeAsFormParameter.js +10 -0
- package/dist/src/core/form-data-utils/encodeAsFormParameter.js.map +1 -0
- package/dist/src/core/form-data-utils/index.d.ts +2 -0
- package/dist/src/core/form-data-utils/index.js +3 -0
- package/dist/src/core/form-data-utils/index.js.map +1 -0
- package/dist/src/core/headers.d.ts +2 -0
- package/dist/src/core/headers.js +28 -0
- package/dist/src/core/headers.js.map +1 -0
- package/dist/src/core/index.d.ts +9 -0
- package/dist/src/core/index.js +10 -0
- package/dist/src/core/index.js.map +1 -0
- package/dist/src/core/json.d.ts +15 -0
- package/dist/src/core/json.js +20 -0
- package/dist/src/core/json.js.map +1 -0
- package/dist/src/core/logging/exports.d.ts +18 -0
- package/dist/src/core/logging/exports.js +10 -0
- package/dist/src/core/logging/exports.js.map +1 -0
- package/dist/src/core/logging/index.d.ts +1 -0
- package/dist/src/core/logging/index.js +2 -0
- package/dist/src/core/logging/index.js.map +1 -0
- package/dist/src/core/logging/logger.d.ts +126 -0
- package/dist/src/core/logging/logger.js +141 -0
- package/dist/src/core/logging/logger.js.map +1 -0
- package/dist/src/core/requestBody.d.ts +12 -0
- package/dist/src/core/requestBody.js +24 -0
- package/dist/src/core/requestBody.js.map +1 -0
- package/dist/src/core/runtime/index.d.ts +1 -0
- package/dist/src/core/runtime/index.js +2 -0
- package/dist/src/core/runtime/index.js.map +1 -0
- package/dist/src/core/runtime/runtime.d.ts +28 -0
- package/dist/src/core/runtime/runtime.js +172 -0
- package/dist/src/core/runtime/runtime.js.map +1 -0
- package/dist/src/core/stream/Stream.d.ts +100 -0
- package/dist/src/core/stream/Stream.js +427 -0
- package/dist/src/core/stream/Stream.js.map +1 -0
- package/dist/src/core/stream/index.d.ts +2 -0
- package/dist/src/core/stream/index.js +2 -0
- package/dist/src/core/stream/index.js.map +1 -0
- package/dist/src/core/url/QueryStringBuilder.d.ts +47 -0
- package/dist/src/core/url/QueryStringBuilder.js +79 -0
- package/dist/src/core/url/QueryStringBuilder.js.map +1 -0
- package/dist/src/core/url/encodePathParam.d.ts +1 -0
- package/dist/src/core/url/encodePathParam.js +19 -0
- package/dist/src/core/url/encodePathParam.js.map +1 -0
- package/dist/src/core/url/index.d.ts +4 -0
- package/dist/src/core/url/index.js +5 -0
- package/dist/src/core/url/index.js.map +1 -0
- package/dist/src/core/url/join.d.ts +1 -0
- package/dist/src/core/url/join.js +66 -0
- package/dist/src/core/url/join.js.map +1 -0
- package/dist/src/core/url/qs.d.ts +7 -0
- package/dist/src/core/url/qs.js +77 -0
- package/dist/src/core/url/qs.js.map +1 -0
- package/dist/src/environments.d.ts +4 -0
- package/dist/src/environments.js +5 -0
- package/dist/src/environments.js.map +1 -0
- package/dist/src/errors/TapraError.d.ts +15 -0
- package/dist/src/errors/TapraError.js +39 -0
- package/dist/src/errors/TapraError.js.map +1 -0
- package/dist/src/errors/TapraTimeoutError.d.ts +6 -0
- package/dist/src/errors/TapraTimeoutError.js +16 -0
- package/dist/src/errors/TapraTimeoutError.js.map +1 -0
- package/dist/src/errors/handleNonStatusCodeError.d.ts +2 -0
- package/dist/src/errors/handleNonStatusCodeError.js +33 -0
- package/dist/src/errors/handleNonStatusCodeError.js.map +1 -0
- package/dist/src/errors/index.d.ts +2 -0
- package/dist/src/errors/index.js +3 -0
- package/dist/src/errors/index.js.map +1 -0
- package/dist/src/exports.d.ts +1 -0
- package/dist/src/exports.js +2 -0
- package/dist/src/exports.js.map +1 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.js +6 -0
- package/dist/src/index.js.map +1 -0
- package/package.json +30 -6
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Uploadable } from "./types.js";
|
|
2
|
+
export declare function toBinaryUploadRequest(file: Uploadable): Promise<{
|
|
3
|
+
body: Uploadable.FileLike;
|
|
4
|
+
headers?: Record<string, string>;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function toMultipartDataPart(file: Uploadable): Promise<{
|
|
7
|
+
data: Uploadable.FileLike;
|
|
8
|
+
filename?: string;
|
|
9
|
+
contentType?: string;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
export async function toBinaryUploadRequest(file) {
|
|
2
|
+
const { data, filename, contentLength, contentType } = await getFileWithMetadata(file);
|
|
3
|
+
const request = {
|
|
4
|
+
body: data,
|
|
5
|
+
headers: {},
|
|
6
|
+
};
|
|
7
|
+
if (filename) {
|
|
8
|
+
request.headers["Content-Disposition"] = `attachment; filename="${filename}"`;
|
|
9
|
+
}
|
|
10
|
+
if (contentType) {
|
|
11
|
+
request.headers["Content-Type"] = contentType;
|
|
12
|
+
}
|
|
13
|
+
if (contentLength != null) {
|
|
14
|
+
request.headers["Content-Length"] = contentLength.toString();
|
|
15
|
+
}
|
|
16
|
+
return request;
|
|
17
|
+
}
|
|
18
|
+
export async function toMultipartDataPart(file) {
|
|
19
|
+
const { data, filename, contentType } = await getFileWithMetadata(file, {
|
|
20
|
+
noSniffFileSize: true,
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
data,
|
|
24
|
+
filename,
|
|
25
|
+
contentType,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
async function getFileWithMetadata(file, { noSniffFileSize } = {}) {
|
|
29
|
+
if (file == null) {
|
|
30
|
+
throw new Error(`Expected file to be a Blob, Buffer, ReadableStream, or an object with a "path" or "data" property, but received ${file === null ? "null" : "undefined"}.`);
|
|
31
|
+
}
|
|
32
|
+
if (isFileLike(file)) {
|
|
33
|
+
return getFileWithMetadata({
|
|
34
|
+
data: file,
|
|
35
|
+
}, { noSniffFileSize });
|
|
36
|
+
}
|
|
37
|
+
if ("path" in file) {
|
|
38
|
+
const fs = await import("fs");
|
|
39
|
+
if (!fs?.createReadStream) {
|
|
40
|
+
throw new Error("File path uploads are not supported in this environment.");
|
|
41
|
+
}
|
|
42
|
+
const data = fs.createReadStream(file.path);
|
|
43
|
+
const contentLength = file.contentLength ?? (noSniffFileSize === true ? undefined : await tryGetFileSizeFromPath(file.path));
|
|
44
|
+
const filename = file.filename ?? getNameFromPath(file.path);
|
|
45
|
+
return {
|
|
46
|
+
data,
|
|
47
|
+
filename,
|
|
48
|
+
contentType: file.contentType,
|
|
49
|
+
contentLength,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if ("data" in file) {
|
|
53
|
+
const data = file.data;
|
|
54
|
+
const contentLength = file.contentLength ??
|
|
55
|
+
(await tryGetContentLengthFromFileLike(data, {
|
|
56
|
+
noSniffFileSize,
|
|
57
|
+
}));
|
|
58
|
+
const filename = file.filename ?? tryGetNameFromFileLike(data);
|
|
59
|
+
return {
|
|
60
|
+
data,
|
|
61
|
+
filename,
|
|
62
|
+
contentType: file.contentType ?? tryGetContentTypeFromFileLike(data),
|
|
63
|
+
contentLength,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
throw new Error(`Invalid FileUpload of type ${typeof file}: ${JSON.stringify(file)}`);
|
|
67
|
+
}
|
|
68
|
+
function isFileLike(value) {
|
|
69
|
+
return (isBuffer(value) ||
|
|
70
|
+
isArrayBufferView(value) ||
|
|
71
|
+
isArrayBuffer(value) ||
|
|
72
|
+
isUint8Array(value) ||
|
|
73
|
+
isBlob(value) ||
|
|
74
|
+
isFile(value) ||
|
|
75
|
+
isStreamLike(value) ||
|
|
76
|
+
isReadableStream(value));
|
|
77
|
+
}
|
|
78
|
+
async function tryGetFileSizeFromPath(path) {
|
|
79
|
+
try {
|
|
80
|
+
const fs = await import("fs");
|
|
81
|
+
if (!fs?.promises?.stat) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
const fileStat = await fs.promises.stat(path);
|
|
85
|
+
return fileStat.size;
|
|
86
|
+
}
|
|
87
|
+
catch (_fallbackError) {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function tryGetNameFromFileLike(data) {
|
|
92
|
+
if (isNamedValue(data)) {
|
|
93
|
+
return data.name;
|
|
94
|
+
}
|
|
95
|
+
if (isPathedValue(data)) {
|
|
96
|
+
return getNameFromPath(data.path.toString());
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
async function tryGetContentLengthFromFileLike(data, { noSniffFileSize } = {}) {
|
|
101
|
+
if (isBuffer(data)) {
|
|
102
|
+
return data.length;
|
|
103
|
+
}
|
|
104
|
+
if (isArrayBufferView(data)) {
|
|
105
|
+
return data.byteLength;
|
|
106
|
+
}
|
|
107
|
+
if (isArrayBuffer(data)) {
|
|
108
|
+
return data.byteLength;
|
|
109
|
+
}
|
|
110
|
+
if (isBlob(data)) {
|
|
111
|
+
return data.size;
|
|
112
|
+
}
|
|
113
|
+
if (isFile(data)) {
|
|
114
|
+
return data.size;
|
|
115
|
+
}
|
|
116
|
+
if (noSniffFileSize === true) {
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
if (isPathedValue(data)) {
|
|
120
|
+
return await tryGetFileSizeFromPath(data.path.toString());
|
|
121
|
+
}
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
function tryGetContentTypeFromFileLike(data) {
|
|
125
|
+
if (isBlob(data)) {
|
|
126
|
+
return data.type;
|
|
127
|
+
}
|
|
128
|
+
if (isFile(data)) {
|
|
129
|
+
return data.type;
|
|
130
|
+
}
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
function getNameFromPath(path) {
|
|
134
|
+
const lastForwardSlash = path.lastIndexOf("/");
|
|
135
|
+
const lastBackSlash = path.lastIndexOf("\\");
|
|
136
|
+
const lastSlashIndex = Math.max(lastForwardSlash, lastBackSlash);
|
|
137
|
+
return lastSlashIndex >= 0 ? path.substring(lastSlashIndex + 1) : path;
|
|
138
|
+
}
|
|
139
|
+
function isNamedValue(value) {
|
|
140
|
+
return typeof value === "object" && value != null && "name" in value;
|
|
141
|
+
}
|
|
142
|
+
function isPathedValue(value) {
|
|
143
|
+
return typeof value === "object" && value != null && "path" in value;
|
|
144
|
+
}
|
|
145
|
+
function isStreamLike(value) {
|
|
146
|
+
return typeof value === "object" && value != null && ("read" in value || "pipe" in value);
|
|
147
|
+
}
|
|
148
|
+
function isReadableStream(value) {
|
|
149
|
+
return typeof value === "object" && value != null && "getReader" in value;
|
|
150
|
+
}
|
|
151
|
+
function isBuffer(value) {
|
|
152
|
+
return typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(value);
|
|
153
|
+
}
|
|
154
|
+
function isArrayBufferView(value) {
|
|
155
|
+
return typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView(value);
|
|
156
|
+
}
|
|
157
|
+
function isArrayBuffer(value) {
|
|
158
|
+
return typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer;
|
|
159
|
+
}
|
|
160
|
+
function isUint8Array(value) {
|
|
161
|
+
return typeof Uint8Array !== "undefined" && value instanceof Uint8Array;
|
|
162
|
+
}
|
|
163
|
+
function isBlob(value) {
|
|
164
|
+
return typeof Blob !== "undefined" && value instanceof Blob;
|
|
165
|
+
}
|
|
166
|
+
function isFile(value) {
|
|
167
|
+
return typeof File !== "undefined" && value instanceof File;
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../../src/core/file/file.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACvC,IAAgB;IAEhB,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,MAAM,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACvF,MAAM,OAAO,GAAG;QACZ,IAAI,EA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index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A file that can be uploaded. Can be a file-like object (stream, buffer, blob, etc.),
|
|
3
|
+
* a path to a file, or an object with a file-like object and metadata.
|
|
4
|
+
*/
|
|
5
|
+
export type Uploadable = Uploadable.FileLike | Uploadable.FromPath | Uploadable.WithMetadata;
|
|
6
|
+
export declare namespace Uploadable {
|
|
7
|
+
/**
|
|
8
|
+
* Various file-like objects that can be used to upload a file.
|
|
9
|
+
*/
|
|
10
|
+
type FileLike = ArrayBuffer | ArrayBufferLike | ArrayBufferView | Uint8Array | import("buffer").Buffer | import("buffer").Blob | import("buffer").File | import("stream").Readable | import("stream/web").ReadableStream | globalThis.Blob | globalThis.File | ReadableStream;
|
|
11
|
+
/**
|
|
12
|
+
* A file path with optional metadata, used for uploading a file from the file system.
|
|
13
|
+
*/
|
|
14
|
+
type FromPath = {
|
|
15
|
+
/** The path to the file to upload */
|
|
16
|
+
path: string;
|
|
17
|
+
/**
|
|
18
|
+
* Optional override for the file name (defaults to basename of path).
|
|
19
|
+
* This is used to set the `Content-Disposition` header in upload requests.
|
|
20
|
+
*/
|
|
21
|
+
filename?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional MIME type of the file (e.g., 'image/jpeg', 'text/plain').
|
|
24
|
+
* This is used to set the `Content-Type` header in upload requests.
|
|
25
|
+
*/
|
|
26
|
+
contentType?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Optional file size in bytes.
|
|
29
|
+
* If not provided, the file size will be determined from the file system.
|
|
30
|
+
* The content length is used to set the `Content-Length` header in upload requests.
|
|
31
|
+
*/
|
|
32
|
+
contentLength?: number;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* A file-like object with metadata, used for uploading files.
|
|
36
|
+
*/
|
|
37
|
+
type WithMetadata = {
|
|
38
|
+
/** The file data */
|
|
39
|
+
data: FileLike;
|
|
40
|
+
/**
|
|
41
|
+
* Optional override for the file name (defaults to basename of path).
|
|
42
|
+
* This is used to set the `Content-Disposition` header in upload requests.
|
|
43
|
+
*/
|
|
44
|
+
filename?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Optional MIME type of the file (e.g., 'image/jpeg', 'text/plain').
|
|
47
|
+
* This is used to set the `Content-Type` header in upload requests.
|
|
48
|
+
*
|
|
49
|
+
* If not provided, the content type may be determined from the data itself.
|
|
50
|
+
* * If the data is a `File`, `Blob`, or similar, the content type will be determined from the file itself, if the type is set.
|
|
51
|
+
* * Any other data type will not have a content type set, and the upload request will use `Content-Type: application/octet-stream` instead.
|
|
52
|
+
*/
|
|
53
|
+
contentType?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Optional file size in bytes.
|
|
56
|
+
* The content length is used to set the `Content-Length` header in upload requests.
|
|
57
|
+
* If the content length is not provided and cannot be determined, the upload request will not include the `Content-Length` header, but will use `Transfer-Encoding: chunked` instead.
|
|
58
|
+
*
|
|
59
|
+
* If not provided, the file size will be determined depending on the data type.
|
|
60
|
+
* * If the data is of type `fs.ReadStream` (`createReadStream`), the size will be determined from the file system.
|
|
61
|
+
* * If the data is a `Buffer`, `ArrayBuffer`, `Uint8Array`, `Blob`, `File`, or similar, the size will be determined from the data itself.
|
|
62
|
+
* * If the data is a `Readable` or `ReadableStream`, the size will not be determined.
|
|
63
|
+
*/
|
|
64
|
+
contentLength?: number;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/core/file/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Uploadable } from "../../core/file/index.js";
|
|
2
|
+
interface FormDataRequest<Body> {
|
|
3
|
+
body: Body;
|
|
4
|
+
headers: Record<string, string>;
|
|
5
|
+
duplex?: "half";
|
|
6
|
+
}
|
|
7
|
+
export declare function newFormData(): Promise<FormDataWrapper>;
|
|
8
|
+
export declare class FormDataWrapper {
|
|
9
|
+
private fd;
|
|
10
|
+
setup(): Promise<void>;
|
|
11
|
+
append(key: string, value: unknown): void;
|
|
12
|
+
appendFile(key: string, value: Uploadable): Promise<void>;
|
|
13
|
+
getRequest(): FormDataRequest<FormData>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { toMultipartDataPart } from "../../core/file/index.js";
|
|
2
|
+
import { toJson } from "../../core/json.js";
|
|
3
|
+
import { RUNTIME } from "../runtime/index.js";
|
|
4
|
+
export async function newFormData() {
|
|
5
|
+
return new FormDataWrapper();
|
|
6
|
+
}
|
|
7
|
+
export class FormDataWrapper {
|
|
8
|
+
fd = new FormData();
|
|
9
|
+
async setup() {
|
|
10
|
+
// noop
|
|
11
|
+
}
|
|
12
|
+
append(key, value) {
|
|
13
|
+
this.fd.append(key, String(value));
|
|
14
|
+
}
|
|
15
|
+
async appendFile(key, value) {
|
|
16
|
+
if (value == null) {
|
|
17
|
+
throw new Error(`File upload for "${key}" received ${value === null ? "null" : "undefined"}. The generated code should not call appendFile with null/undefined — check that optional file fields are guarded before this call.`);
|
|
18
|
+
}
|
|
19
|
+
const { data, filename, contentType } = await toMultipartDataPart(value);
|
|
20
|
+
const blob = await convertToBlob(data, contentType);
|
|
21
|
+
if (filename) {
|
|
22
|
+
this.fd.append(key, blob, filename);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
this.fd.append(key, blob);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
getRequest() {
|
|
29
|
+
return {
|
|
30
|
+
body: this.fd,
|
|
31
|
+
headers: {},
|
|
32
|
+
duplex: "half",
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function isStreamLike(value) {
|
|
37
|
+
return typeof value === "object" && value != null && ("read" in value || "pipe" in value);
|
|
38
|
+
}
|
|
39
|
+
function isReadableStream(value) {
|
|
40
|
+
return typeof value === "object" && value != null && "getReader" in value;
|
|
41
|
+
}
|
|
42
|
+
function isBuffer(value) {
|
|
43
|
+
return typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(value);
|
|
44
|
+
}
|
|
45
|
+
function isArrayBufferView(value) {
|
|
46
|
+
return ArrayBuffer.isView(value);
|
|
47
|
+
}
|
|
48
|
+
async function streamToBuffer(stream) {
|
|
49
|
+
if (RUNTIME.type === "node") {
|
|
50
|
+
const { Readable } = await import("stream");
|
|
51
|
+
if (stream instanceof Readable) {
|
|
52
|
+
const chunks = [];
|
|
53
|
+
for await (const chunk of stream) {
|
|
54
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
55
|
+
}
|
|
56
|
+
return Buffer.concat(chunks);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (isReadableStream(stream)) {
|
|
60
|
+
const reader = stream.getReader();
|
|
61
|
+
const chunks = [];
|
|
62
|
+
try {
|
|
63
|
+
while (true) {
|
|
64
|
+
const { done, value } = await reader.read();
|
|
65
|
+
if (done)
|
|
66
|
+
break;
|
|
67
|
+
chunks.push(value);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
reader.releaseLock();
|
|
72
|
+
}
|
|
73
|
+
const totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
74
|
+
const result = new Uint8Array(totalLength);
|
|
75
|
+
let offset = 0;
|
|
76
|
+
for (const chunk of chunks) {
|
|
77
|
+
result.set(chunk, offset);
|
|
78
|
+
offset += chunk.length;
|
|
79
|
+
}
|
|
80
|
+
return Buffer.from(result);
|
|
81
|
+
}
|
|
82
|
+
throw new Error(`Unsupported stream type: ${typeof stream}. Expected Node.js Readable stream or Web ReadableStream.`);
|
|
83
|
+
}
|
|
84
|
+
async function convertToBlob(value, contentType) {
|
|
85
|
+
if (isStreamLike(value) || isReadableStream(value)) {
|
|
86
|
+
const buffer = await streamToBuffer(value);
|
|
87
|
+
return new Blob([buffer], { type: contentType });
|
|
88
|
+
}
|
|
89
|
+
if (value instanceof Blob) {
|
|
90
|
+
return value;
|
|
91
|
+
}
|
|
92
|
+
if (isBuffer(value)) {
|
|
93
|
+
return new Blob([value], { type: contentType });
|
|
94
|
+
}
|
|
95
|
+
if (value instanceof ArrayBuffer) {
|
|
96
|
+
return new Blob([value], { type: contentType });
|
|
97
|
+
}
|
|
98
|
+
if (isArrayBufferView(value)) {
|
|
99
|
+
return new Blob([value], { type: contentType });
|
|
100
|
+
}
|
|
101
|
+
if (typeof value === "string") {
|
|
102
|
+
return new Blob([value], { type: contentType });
|
|
103
|
+
}
|
|
104
|
+
if (typeof value === "object" && value !== null) {
|
|
105
|
+
return new Blob([toJson(value)], { type: contentType ?? "application/json" });
|
|
106
|
+
}
|
|
107
|
+
return new Blob([String(value)], { type: contentType });
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=FormDataWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormDataWrapper.js","sourceRoot":"","sources":["../../../../src/core/form-data-utils/FormDataWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAmB,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAQ9C,MAAM,CAAC,KAAK,UAAU,WAAW;IAC7B,OAAO,IAAI,eAAe,EAAE,CAAC;AACjC,CAAC;AAED,MAAM,OAAO,eAAe;IAChB,EAAE,GAAa,IAAI,QAAQ,EAAE,CAAC;IAE/B,KAAK,CAAC,KAAK;QACd,OAAO;IACX,CAAC;IAEM,MAAM,CAAC,GAAW,EAAE,KAAc;QACrC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACvC,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E,WAAW,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC9C,OAAO,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,IAAI,kBAAkB,EAAE,CAAC,CAAC;IAClF,CAAC;IAED,OAAO,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function encodeAsFormParameter(value: unknown): Record<string, string>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { toQueryString } from "../url/qs.js";
|
|
2
|
+
export function encodeAsFormParameter(value) {
|
|
3
|
+
const stringified = toQueryString(value, { encode: false });
|
|
4
|
+
const keyValuePairs = stringified.split("&").map((pair) => {
|
|
5
|
+
const [key, value] = pair.split("=");
|
|
6
|
+
return [key, value];
|
|
7
|
+
});
|
|
8
|
+
return Object.fromEntries(keyValuePairs);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=encodeAsFormParameter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encodeAsFormParameter.js","sourceRoot":"","sources":["../../../../src/core/form-data-utils/encodeAsFormParameter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAChD,MAAM,WAAW,GAAG,aAAa,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAE5D,MAAM,aAAa,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACtD,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACrC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAU,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/form-data-utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function mergeHeaders(...headersArray) {
|
|
2
|
+
const result = {};
|
|
3
|
+
for (const [key, value] of headersArray
|
|
4
|
+
.filter((headers) => headers != null)
|
|
5
|
+
.flatMap((headers) => Object.entries(headers))) {
|
|
6
|
+
const insensitiveKey = key.toLowerCase();
|
|
7
|
+
if (value != null) {
|
|
8
|
+
result[insensitiveKey] = value;
|
|
9
|
+
}
|
|
10
|
+
else if (insensitiveKey in result) {
|
|
11
|
+
delete result[insensitiveKey];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
export function mergeOnlyDefinedHeaders(...headersArray) {
|
|
17
|
+
const result = {};
|
|
18
|
+
for (const [key, value] of headersArray
|
|
19
|
+
.filter((headers) => headers != null)
|
|
20
|
+
.flatMap((headers) => Object.entries(headers))) {
|
|
21
|
+
const insensitiveKey = key.toLowerCase();
|
|
22
|
+
if (value != null) {
|
|
23
|
+
result[insensitiveKey] = value;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|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L,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./auth/index.js";
|
|
2
|
+
export * from "./base64.js";
|
|
3
|
+
export * from "./fetcher/index.js";
|
|
4
|
+
export * as file from "./file/index.js";
|
|
5
|
+
export * from "./form-data-utils/index.js";
|
|
6
|
+
export * as logging from "./logging/index.js";
|
|
7
|
+
export * from "./runtime/index.js";
|
|
8
|
+
export * from "./stream/index.js";
|
|
9
|
+
export * as url from "./url/index.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./auth/index.js";
|
|
2
|
+
export * from "./base64.js";
|
|
3
|
+
export * from "./fetcher/index.js";
|
|
4
|
+
export * as file from "./file/index.js";
|
|
5
|
+
export * from "./form-data-utils/index.js";
|
|
6
|
+
export * as logging from "./logging/index.js";
|
|
7
|
+
export * from "./runtime/index.js";
|
|
8
|
+
export * from "./stream/index.js";
|
|
9
|
+
export * as url from "./url/index.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialize a value to JSON
|
|
3
|
+
* @param value A JavaScript value, usually an object or array, to be converted.
|
|
4
|
+
* @param replacer A function that transforms the results.
|
|
5
|
+
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
|
|
6
|
+
* @returns JSON string
|
|
7
|
+
*/
|
|
8
|
+
export declare const toJson: (value: unknown, replacer?: (this: unknown, key: string, value: unknown) => unknown, space?: string | number) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Parse JSON string to object, array, or other type
|
|
11
|
+
* @param text A valid JSON string.
|
|
12
|
+
* @param reviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is.
|
|
13
|
+
* @returns Parsed object, array, or other type
|
|
14
|
+
*/
|
|
15
|
+
export declare function fromJson<T = unknown>(text: string, reviver?: (this: unknown, key: string, value: unknown) => unknown): T;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialize a value to JSON
|
|
3
|
+
* @param value A JavaScript value, usually an object or array, to be converted.
|
|
4
|
+
* @param replacer A function that transforms the results.
|
|
5
|
+
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
|
|
6
|
+
* @returns JSON string
|
|
7
|
+
*/
|
|
8
|
+
export const toJson = (value, replacer, space) => {
|
|
9
|
+
return JSON.stringify(value, replacer, space);
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Parse JSON string to object, array, or other type
|
|
13
|
+
* @param text A valid JSON string.
|
|
14
|
+
* @param reviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is.
|
|
15
|
+
* @returns Parsed object, array, or other type
|
|
16
|
+
*/
|
|
17
|
+
export function fromJson(text, reviver) {
|
|
18
|
+
return JSON.parse(text, reviver);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/core/json.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAClB,KAAc,EACd,QAAkE,EAClE,KAAuB,EACjB,EAAE;IACR,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CACpB,IAAY,EACZ,OAAiE;IAEjE,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as logger from "./logger.js";
|
|
2
|
+
export declare namespace logging {
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for logger instances.
|
|
5
|
+
*/
|
|
6
|
+
type LogConfig = logger.LogConfig;
|
|
7
|
+
type LogLevel = logger.LogLevel;
|
|
8
|
+
const LogLevel: typeof logger.LogLevel;
|
|
9
|
+
type ILogger = logger.ILogger;
|
|
10
|
+
/**
|
|
11
|
+
* Console logger implementation that outputs to the console.
|
|
12
|
+
*/
|
|
13
|
+
type ConsoleLogger = logger.ConsoleLogger;
|
|
14
|
+
/**
|
|
15
|
+
* Console logger implementation that outputs to the console.
|
|
16
|
+
*/
|
|
17
|
+
const ConsoleLogger: typeof logger.ConsoleLogger;
|
|
18
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as logger from "./logger.js";
|
|
2
|
+
export var logging;
|
|
3
|
+
(function (logging) {
|
|
4
|
+
logging.LogLevel = logger.LogLevel;
|
|
5
|
+
/**
|
|
6
|
+
* Console logger implementation that outputs to the console.
|
|
7
|
+
*/
|
|
8
|
+
logging.ConsoleLogger = logger.ConsoleLogger;
|
|
9
|
+
})(logging || (logging = {}));
|
|
10
|
+
//# sourceMappingURL=exports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../../../src/core/logging/exports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,MAAM,KAAW,OAAO,CAgBvB;AAhBD,WAAiB,OAAO;IAMP,gBAAQ,GAA2B,MAAM,CAAC,QAAQ,CAAC;IAMhE;;OAEG;IACU,qBAAa,GAAgC,MAAM,CAAC,aAAa,CAAC;AACnF,CAAC,EAhBgB,OAAO,KAAP,OAAO,QAgBvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./logger.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/logging/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|