@athenaintel/sdk 4.3.308 → 4.3.310
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 +117 -9
- package/dist/cjs/BaseClient.d.ts +14 -1
- package/dist/cjs/BaseClient.js +59 -0
- package/dist/cjs/Client.d.ts +24 -23
- package/dist/cjs/Client.js +10 -51
- package/dist/cjs/api/errors/BadRequestError.d.ts +1 -1
- package/dist/cjs/api/errors/ContentTooLargeError.d.ts +2 -2
- package/dist/cjs/api/errors/ForbiddenError.d.ts +1 -1
- package/dist/cjs/api/errors/InternalServerError.d.ts +1 -1
- package/dist/cjs/api/errors/NotFoundError.d.ts +1 -1
- package/dist/cjs/api/errors/NotImplementedError.d.ts +1 -1
- package/dist/cjs/api/errors/ServiceUnavailableError.d.ts +1 -1
- package/dist/cjs/api/errors/UnauthorizedError.d.ts +1 -1
- package/dist/cjs/api/errors/UnprocessableEntityError.d.ts +1 -1
- package/dist/cjs/api/errors/UnsupportedMediaTypeError.d.ts +2 -2
- package/dist/cjs/api/errors/index.d.ts +5 -5
- package/dist/cjs/api/errors/index.js +5 -5
- package/dist/cjs/api/index.d.ts +1 -1
- package/dist/cjs/api/index.js +1 -1
- package/dist/cjs/api/resources/agents/client/Client.d.ts +20 -20
- package/dist/cjs/api/resources/agents/client/Client.js +29 -26
- package/dist/cjs/api/resources/agents/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/agents/resources/drive/client/Client.d.ts +7 -7
- package/dist/cjs/api/resources/agents/resources/drive/client/Client.js +20 -17
- package/dist/cjs/api/resources/agents/resources/drive/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/drive/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/agents/resources/general/client/Client.d.ts +11 -11
- package/dist/cjs/api/resources/agents/resources/general/client/Client.js +42 -23
- package/dist/cjs/api/resources/agents/resources/index.d.ts +3 -3
- package/dist/cjs/api/resources/agents/resources/index.js +6 -6
- package/dist/cjs/api/resources/agents/resources/research/client/Client.d.ts +7 -7
- package/dist/cjs/api/resources/agents/resources/research/client/Client.js +20 -17
- package/dist/cjs/api/resources/agents/resources/research/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/research/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/agents/resources/sql/client/Client.d.ts +7 -7
- package/dist/cjs/api/resources/agents/resources/sql/client/Client.js +20 -17
- package/dist/cjs/api/resources/agents/resources/sql/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/agents/resources/sql/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/aop/client/Client.d.ts +9 -9
- package/dist/cjs/api/resources/aop/client/Client.js +31 -20
- package/dist/cjs/api/resources/assets/client/Client.d.ts +14 -14
- package/dist/cjs/api/resources/assets/client/Client.js +62 -35
- package/dist/cjs/api/resources/assets/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/assets/client/requests/CreateAssetRequestIn.d.ts +1 -1
- package/dist/cjs/api/resources/assets/client/requests/index.d.ts +3 -3
- package/dist/cjs/api/resources/databases/client/Client.d.ts +36 -32
- package/dist/cjs/api/resources/databases/client/Client.js +149 -81
- package/dist/cjs/api/resources/databases/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/databases/client/requests/DatabasesDeleteRequest.d.ts +15 -0
- package/dist/cjs/api/resources/databases/client/requests/DatabasesDeleteRequest.js +3 -0
- package/dist/cjs/api/resources/databases/client/requests/UpdateDataRequest.d.ts +3 -0
- package/dist/cjs/api/resources/databases/client/requests/index.d.ts +4 -3
- package/dist/cjs/api/resources/index.d.ts +8 -8
- package/dist/cjs/api/resources/index.js +12 -12
- package/dist/cjs/api/resources/query/client/Client.d.ts +9 -9
- package/dist/cjs/api/resources/query/client/Client.js +34 -23
- package/dist/cjs/api/resources/query/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/query/client/requests/QueryExecuteRequest.d.ts +1 -1
- package/dist/cjs/api/resources/query/client/requests/index.d.ts +2 -2
- package/dist/cjs/api/resources/query/index.d.ts +1 -1
- package/dist/cjs/api/resources/query/index.js +1 -1
- package/dist/cjs/api/resources/threads/client/Client.d.ts +8 -8
- package/dist/cjs/api/resources/threads/client/Client.js +25 -22
- package/dist/cjs/api/resources/tools/client/Client.d.ts +33 -33
- package/dist/cjs/api/resources/tools/client/Client.js +106 -55
- package/dist/cjs/api/resources/tools/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/tools/client/requests/BodySaveAssetApiV0ToolsFileSavePost.d.ts +2 -2
- package/dist/cjs/api/resources/tools/client/requests/ToolsDataFrameRequest.d.ts +1 -1
- package/dist/cjs/api/resources/tools/client/requests/index.d.ts +7 -7
- package/dist/cjs/api/resources/tools/index.d.ts +1 -1
- package/dist/cjs/api/resources/tools/index.js +1 -1
- package/dist/cjs/api/resources/tools/resources/calendar/client/Client.d.ts +9 -9
- package/dist/cjs/api/resources/tools/resources/calendar/client/Client.js +30 -19
- package/dist/cjs/api/resources/tools/resources/email/client/Client.d.ts +11 -11
- package/dist/cjs/api/resources/tools/resources/email/client/Client.js +41 -22
- package/dist/cjs/api/resources/tools/resources/index.d.ts +3 -3
- package/dist/cjs/api/resources/tools/resources/index.js +3 -3
- package/dist/cjs/api/resources/tools/resources/sheets/client/Client.d.ts +39 -39
- package/dist/cjs/api/resources/tools/resources/sheets/client/Client.js +196 -65
- package/dist/cjs/api/resources/tools/resources/sheets/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/tools/resources/sheets/client/requests/CreateNewSheetTabRequest.d.ts +1 -1
- package/dist/cjs/api/resources/tools/resources/sheets/client/requests/FormatSheetRangeRequest.d.ts +1 -1
- package/dist/cjs/api/resources/tools/resources/sheets/client/requests/InsertTableRowRequest.d.ts +1 -1
- package/dist/cjs/api/resources/tools/resources/sheets/client/requests/UpdateSheetRangeRequest.d.ts +1 -1
- package/dist/cjs/api/resources/tools/resources/sheets/client/requests/index.d.ts +17 -17
- package/dist/cjs/api/resources/tools/resources/structuredDataExtractor/client/Client.d.ts +7 -7
- package/dist/cjs/api/resources/tools/resources/structuredDataExtractor/client/Client.js +20 -17
- package/dist/cjs/api/resources/tools/resources/structuredDataExtractor/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/tools/resources/structuredDataExtractor/client/requests/StructuredDataExtractorRequest.d.ts +1 -1
- package/dist/cjs/api/resources/tools/resources/structuredDataExtractor/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/tools/resources/tasks/client/Client.d.ts +7 -7
- package/dist/cjs/api/resources/tools/resources/tasks/client/Client.js +20 -17
- package/dist/cjs/api/resources/tools/resources/tasks/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/tools/resources/tasks/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/types/AopExecuteResponseOut.d.ts +1 -1
- package/dist/cjs/api/types/AssetNode.d.ts +1 -1
- package/dist/cjs/api/types/BorderModel.d.ts +1 -1
- package/dist/cjs/api/types/BordersModel.d.ts +1 -1
- package/dist/cjs/api/types/CellFormat.d.ts +1 -1
- package/dist/cjs/api/types/Chunk.d.ts +1 -1
- package/dist/cjs/api/types/ChunkContentItem.d.ts +1 -1
- package/dist/cjs/api/types/ConversationAssetInfo.d.ts +1 -1
- package/dist/cjs/api/types/ConversationMessage.d.ts +1 -1
- package/dist/cjs/api/types/ConversationResult.d.ts +1 -1
- package/dist/cjs/api/types/DatabaseTableSchemaResponse.d.ts +1 -1
- package/dist/cjs/api/types/DatabaseTablesResponse.d.ts +1 -1
- package/dist/cjs/api/types/FolderResponse.d.ts +1 -1
- package/dist/cjs/api/types/GeneralAgentRequest.d.ts +1 -1
- package/dist/cjs/api/types/GeneralAgentResponse.d.ts +1 -1
- package/dist/cjs/api/types/GeneralAgentResponseMessage.d.ts +1 -1
- package/dist/cjs/api/types/GeneralAgentResponseMessageKwargs.d.ts +1 -1
- package/dist/cjs/api/types/InputMessage.d.ts +1 -1
- package/dist/cjs/api/types/InputMessageContentItem.d.ts +1 -1
- package/dist/cjs/api/types/NumberFormatModel.d.ts +1 -1
- package/dist/cjs/api/types/PaginatedAssetsOut.d.ts +1 -1
- package/dist/cjs/api/types/Sheet.d.ts +1 -1
- package/dist/cjs/api/types/StructuredDataExtractorResponse.d.ts +1 -1
- package/dist/cjs/api/types/TextFormatModel.d.ts +1 -1
- package/dist/cjs/api/types/ThreadStatusResponseOut.d.ts +1 -1
- package/dist/cjs/api/types/index.d.ts +5 -5
- package/dist/cjs/api/types/index.js +5 -5
- package/dist/cjs/auth/HeaderAuthProvider.d.ts +14 -0
- package/dist/cjs/auth/HeaderAuthProvider.js +71 -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 +7 -0
- package/dist/cjs/core/auth/AuthProvider.js +2 -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 +27 -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 +9 -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 +1 -0
- package/dist/cjs/core/exports.js +1 -0
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +6 -7
- package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +1 -1
- package/dist/cjs/core/fetcher/Fetcher.d.ts +9 -2
- package/dist/cjs/core/fetcher/Fetcher.js +204 -9
- package/dist/cjs/core/fetcher/getErrorResponseBody.js +2 -1
- package/dist/cjs/core/fetcher/getRequestBody.d.ts +1 -1
- package/dist/cjs/core/fetcher/getRequestBody.js +4 -0
- package/dist/cjs/core/fetcher/getResponseBody.js +21 -7
- package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
- package/dist/cjs/core/fetcher/makeRequest.js +2 -4
- package/dist/cjs/core/fetcher/requestWithRetries.js +3 -12
- package/dist/cjs/core/fetcher/signals.d.ts +1 -7
- package/dist/cjs/core/fetcher/signals.js +0 -12
- package/dist/cjs/core/file/file.d.ts +5 -0
- package/dist/cjs/core/file/file.js +25 -7
- package/dist/cjs/core/form-data-utils/FormDataWrapper.d.ts +2 -3
- package/dist/cjs/core/form-data-utils/FormDataWrapper.js +62 -85
- package/dist/cjs/core/headers.js +6 -4
- package/dist/cjs/core/index.d.ts +5 -2
- package/dist/cjs/core/index.js +6 -3
- 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/runtime/runtime.js +11 -10
- 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 +1 -0
- package/dist/cjs/core/url/index.js +3 -1
- package/dist/cjs/core/url/join.js +3 -4
- package/dist/cjs/errors/AthenaIntelligenceError.d.ts +1 -1
- package/dist/cjs/errors/AthenaIntelligenceError.js +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +14 -1
- package/dist/esm/BaseClient.mjs +23 -1
- package/dist/esm/Client.d.mts +24 -23
- package/dist/esm/Client.mjs +17 -26
- package/dist/esm/api/errors/BadRequestError.d.mts +1 -1
- package/dist/esm/api/errors/BadRequestError.mjs +0 -1
- package/dist/esm/api/errors/ContentTooLargeError.d.mts +2 -2
- package/dist/esm/api/errors/ContentTooLargeError.mjs +0 -2
- package/dist/esm/api/errors/ForbiddenError.d.mts +1 -1
- package/dist/esm/api/errors/ForbiddenError.mjs +0 -1
- package/dist/esm/api/errors/InternalServerError.d.mts +1 -1
- package/dist/esm/api/errors/InternalServerError.mjs +0 -1
- package/dist/esm/api/errors/NotFoundError.d.mts +1 -1
- package/dist/esm/api/errors/NotFoundError.mjs +0 -1
- package/dist/esm/api/errors/NotImplementedError.d.mts +1 -1
- package/dist/esm/api/errors/NotImplementedError.mjs +0 -1
- package/dist/esm/api/errors/ServiceUnavailableError.d.mts +1 -1
- package/dist/esm/api/errors/ServiceUnavailableError.mjs +0 -1
- package/dist/esm/api/errors/UnauthorizedError.d.mts +1 -1
- package/dist/esm/api/errors/UnauthorizedError.mjs +0 -1
- package/dist/esm/api/errors/UnprocessableEntityError.d.mts +1 -1
- package/dist/esm/api/errors/UnprocessableEntityError.mjs +0 -1
- package/dist/esm/api/errors/UnsupportedMediaTypeError.d.mts +2 -2
- package/dist/esm/api/errors/UnsupportedMediaTypeError.mjs +0 -2
- package/dist/esm/api/errors/index.d.mts +5 -5
- package/dist/esm/api/errors/index.mjs +5 -5
- package/dist/esm/api/index.d.mts +1 -1
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/resources/agents/client/Client.d.mts +20 -20
- package/dist/esm/api/resources/agents/client/Client.mjs +31 -28
- package/dist/esm/api/resources/agents/client/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/client/index.mjs +0 -1
- package/dist/esm/api/resources/agents/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/agents/client/requests/index.mjs +1 -1
- package/dist/esm/api/resources/agents/resources/drive/client/Client.d.mts +7 -7
- package/dist/esm/api/resources/agents/resources/drive/client/Client.mjs +18 -15
- package/dist/esm/api/resources/agents/resources/drive/client/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/drive/client/index.mjs +0 -1
- package/dist/esm/api/resources/agents/resources/drive/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/agents/resources/drive/client/requests/index.mjs +1 -1
- package/dist/esm/api/resources/agents/resources/general/client/Client.d.mts +11 -11
- package/dist/esm/api/resources/agents/resources/general/client/Client.mjs +40 -21
- package/dist/esm/api/resources/agents/resources/index.d.mts +3 -3
- package/dist/esm/api/resources/agents/resources/index.mjs +3 -3
- package/dist/esm/api/resources/agents/resources/research/client/Client.d.mts +7 -7
- package/dist/esm/api/resources/agents/resources/research/client/Client.mjs +18 -15
- package/dist/esm/api/resources/agents/resources/research/client/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/research/client/index.mjs +0 -1
- package/dist/esm/api/resources/agents/resources/research/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/agents/resources/research/client/requests/index.mjs +1 -1
- package/dist/esm/api/resources/agents/resources/sql/client/Client.d.mts +7 -7
- package/dist/esm/api/resources/agents/resources/sql/client/Client.mjs +18 -15
- package/dist/esm/api/resources/agents/resources/sql/client/index.d.mts +0 -1
- package/dist/esm/api/resources/agents/resources/sql/client/index.mjs +0 -1
- package/dist/esm/api/resources/agents/resources/sql/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/agents/resources/sql/client/requests/index.mjs +1 -1
- package/dist/esm/api/resources/aop/client/Client.d.mts +9 -9
- package/dist/esm/api/resources/aop/client/Client.mjs +29 -18
- package/dist/esm/api/resources/assets/client/Client.d.mts +14 -14
- package/dist/esm/api/resources/assets/client/Client.mjs +60 -33
- package/dist/esm/api/resources/assets/client/index.d.mts +0 -1
- package/dist/esm/api/resources/assets/client/index.mjs +0 -1
- package/dist/esm/api/resources/assets/client/requests/CreateAssetRequestIn.d.mts +1 -1
- package/dist/esm/api/resources/assets/client/requests/CreateAssetRequestIn.mjs +1 -1
- package/dist/esm/api/resources/assets/client/requests/index.d.mts +3 -3
- package/dist/esm/api/resources/assets/client/requests/index.mjs +1 -3
- package/dist/esm/api/resources/databases/client/Client.d.mts +36 -32
- package/dist/esm/api/resources/databases/client/Client.mjs +147 -79
- package/dist/esm/api/resources/databases/client/index.d.mts +0 -1
- package/dist/esm/api/resources/databases/client/index.mjs +0 -1
- package/dist/esm/api/resources/databases/client/requests/DatabasesDeleteRequest.d.mts +15 -0
- package/dist/esm/api/resources/databases/client/requests/DatabasesDeleteRequest.mjs +2 -0
- package/dist/esm/api/resources/databases/client/requests/UpdateDataRequest.d.mts +3 -0
- package/dist/esm/api/resources/databases/client/requests/index.d.mts +4 -3
- package/dist/esm/api/resources/databases/client/requests/index.mjs +1 -3
- package/dist/esm/api/resources/index.d.mts +8 -8
- package/dist/esm/api/resources/index.mjs +8 -8
- package/dist/esm/api/resources/query/client/Client.d.mts +9 -9
- package/dist/esm/api/resources/query/client/Client.mjs +32 -21
- package/dist/esm/api/resources/query/client/index.d.mts +0 -1
- package/dist/esm/api/resources/query/client/index.mjs +0 -1
- package/dist/esm/api/resources/query/client/requests/QueryExecuteRequest.d.mts +1 -1
- package/dist/esm/api/resources/query/client/requests/QueryExecuteRequest.mjs +1 -1
- package/dist/esm/api/resources/query/client/requests/index.d.mts +2 -2
- package/dist/esm/api/resources/query/client/requests/index.mjs +1 -2
- package/dist/esm/api/resources/query/index.d.mts +1 -1
- package/dist/esm/api/resources/query/index.mjs +1 -1
- package/dist/esm/api/resources/threads/client/Client.d.mts +8 -8
- package/dist/esm/api/resources/threads/client/Client.mjs +23 -20
- package/dist/esm/api/resources/tools/client/Client.d.mts +33 -33
- package/dist/esm/api/resources/tools/client/Client.mjs +109 -59
- package/dist/esm/api/resources/tools/client/index.d.mts +0 -1
- package/dist/esm/api/resources/tools/client/index.mjs +0 -1
- package/dist/esm/api/resources/tools/client/requests/BodySaveAssetApiV0ToolsFileSavePost.d.mts +2 -2
- package/dist/esm/api/resources/tools/client/requests/BodySaveAssetApiV0ToolsFileSavePost.mjs +1 -2
- package/dist/esm/api/resources/tools/client/requests/ToolsDataFrameRequest.d.mts +1 -1
- package/dist/esm/api/resources/tools/client/requests/ToolsDataFrameRequest.mjs +1 -1
- package/dist/esm/api/resources/tools/client/requests/index.d.mts +7 -7
- package/dist/esm/api/resources/tools/client/requests/index.mjs +1 -7
- package/dist/esm/api/resources/tools/index.d.mts +1 -1
- package/dist/esm/api/resources/tools/index.mjs +1 -1
- package/dist/esm/api/resources/tools/resources/calendar/client/Client.d.mts +9 -9
- package/dist/esm/api/resources/tools/resources/calendar/client/Client.mjs +28 -17
- package/dist/esm/api/resources/tools/resources/email/client/Client.d.mts +11 -11
- package/dist/esm/api/resources/tools/resources/email/client/Client.mjs +39 -20
- package/dist/esm/api/resources/tools/resources/index.d.mts +3 -3
- package/dist/esm/api/resources/tools/resources/index.mjs +3 -3
- package/dist/esm/api/resources/tools/resources/sheets/client/Client.d.mts +39 -39
- package/dist/esm/api/resources/tools/resources/sheets/client/Client.mjs +194 -63
- package/dist/esm/api/resources/tools/resources/sheets/client/index.d.mts +0 -1
- package/dist/esm/api/resources/tools/resources/sheets/client/index.mjs +0 -1
- package/dist/esm/api/resources/tools/resources/sheets/client/requests/CreateNewSheetTabRequest.d.mts +1 -1
- package/dist/esm/api/resources/tools/resources/sheets/client/requests/CreateNewSheetTabRequest.mjs +1 -1
- package/dist/esm/api/resources/tools/resources/sheets/client/requests/FormatSheetRangeRequest.d.mts +1 -1
- package/dist/esm/api/resources/tools/resources/sheets/client/requests/FormatSheetRangeRequest.mjs +1 -1
- package/dist/esm/api/resources/tools/resources/sheets/client/requests/InsertTableRowRequest.d.mts +1 -1
- package/dist/esm/api/resources/tools/resources/sheets/client/requests/InsertTableRowRequest.mjs +1 -1
- package/dist/esm/api/resources/tools/resources/sheets/client/requests/UpdateSheetRangeRequest.d.mts +1 -1
- package/dist/esm/api/resources/tools/resources/sheets/client/requests/UpdateSheetRangeRequest.mjs +1 -1
- package/dist/esm/api/resources/tools/resources/sheets/client/requests/index.d.mts +17 -17
- package/dist/esm/api/resources/tools/resources/sheets/client/requests/index.mjs +1 -17
- package/dist/esm/api/resources/tools/resources/structuredDataExtractor/client/Client.d.mts +7 -7
- package/dist/esm/api/resources/tools/resources/structuredDataExtractor/client/Client.mjs +18 -15
- package/dist/esm/api/resources/tools/resources/structuredDataExtractor/client/index.d.mts +0 -1
- package/dist/esm/api/resources/tools/resources/structuredDataExtractor/client/index.mjs +0 -1
- package/dist/esm/api/resources/tools/resources/structuredDataExtractor/client/requests/StructuredDataExtractorRequest.d.mts +1 -1
- package/dist/esm/api/resources/tools/resources/structuredDataExtractor/client/requests/StructuredDataExtractorRequest.mjs +1 -1
- package/dist/esm/api/resources/tools/resources/structuredDataExtractor/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/tools/resources/structuredDataExtractor/client/requests/index.mjs +1 -1
- package/dist/esm/api/resources/tools/resources/tasks/client/Client.d.mts +7 -7
- package/dist/esm/api/resources/tools/resources/tasks/client/Client.mjs +18 -15
- package/dist/esm/api/resources/tools/resources/tasks/client/index.d.mts +0 -1
- package/dist/esm/api/resources/tools/resources/tasks/client/index.mjs +0 -1
- package/dist/esm/api/resources/tools/resources/tasks/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/tools/resources/tasks/client/requests/index.mjs +1 -1
- package/dist/esm/api/types/AopExecuteResponseOut.d.mts +1 -1
- package/dist/esm/api/types/AopExecuteResponseOut.mjs +1 -1
- package/dist/esm/api/types/AssetNode.d.mts +1 -1
- package/dist/esm/api/types/AssetNode.mjs +1 -1
- package/dist/esm/api/types/BorderModel.d.mts +1 -1
- package/dist/esm/api/types/BorderModel.mjs +1 -1
- package/dist/esm/api/types/BordersModel.d.mts +1 -1
- package/dist/esm/api/types/BordersModel.mjs +1 -1
- package/dist/esm/api/types/CellFormat.d.mts +1 -1
- package/dist/esm/api/types/CellFormat.mjs +0 -1
- package/dist/esm/api/types/Chunk.d.mts +1 -1
- package/dist/esm/api/types/Chunk.mjs +1 -1
- package/dist/esm/api/types/ChunkContentItem.d.mts +1 -1
- package/dist/esm/api/types/ChunkContentItem.mjs +1 -1
- package/dist/esm/api/types/ConversationAssetInfo.d.mts +1 -1
- package/dist/esm/api/types/ConversationAssetInfo.mjs +1 -1
- package/dist/esm/api/types/ConversationMessage.d.mts +1 -1
- package/dist/esm/api/types/ConversationMessage.mjs +1 -1
- package/dist/esm/api/types/ConversationResult.d.mts +1 -1
- package/dist/esm/api/types/ConversationResult.mjs +1 -1
- package/dist/esm/api/types/DatabaseTableSchemaResponse.d.mts +1 -1
- package/dist/esm/api/types/DatabaseTableSchemaResponse.mjs +1 -1
- package/dist/esm/api/types/DatabaseTablesResponse.d.mts +1 -1
- package/dist/esm/api/types/DatabaseTablesResponse.mjs +1 -1
- package/dist/esm/api/types/FolderResponse.d.mts +1 -1
- package/dist/esm/api/types/FolderResponse.mjs +1 -1
- package/dist/esm/api/types/GeneralAgentRequest.d.mts +1 -1
- package/dist/esm/api/types/GeneralAgentRequest.mjs +1 -1
- package/dist/esm/api/types/GeneralAgentResponse.d.mts +1 -1
- package/dist/esm/api/types/GeneralAgentResponse.mjs +1 -1
- package/dist/esm/api/types/GeneralAgentResponseMessage.d.mts +1 -1
- package/dist/esm/api/types/GeneralAgentResponseMessage.mjs +1 -1
- package/dist/esm/api/types/GeneralAgentResponseMessageKwargs.d.mts +1 -1
- package/dist/esm/api/types/GeneralAgentResponseMessageKwargs.mjs +1 -1
- package/dist/esm/api/types/InputMessage.d.mts +1 -1
- package/dist/esm/api/types/InputMessage.mjs +1 -1
- package/dist/esm/api/types/InputMessageContentItem.d.mts +1 -1
- package/dist/esm/api/types/InputMessageContentItem.mjs +1 -1
- package/dist/esm/api/types/NumberFormatModel.d.mts +1 -1
- package/dist/esm/api/types/NumberFormatModel.mjs +1 -1
- package/dist/esm/api/types/PaginatedAssetsOut.d.mts +1 -1
- package/dist/esm/api/types/PaginatedAssetsOut.mjs +1 -1
- package/dist/esm/api/types/Sheet.d.mts +1 -1
- package/dist/esm/api/types/Sheet.mjs +1 -1
- package/dist/esm/api/types/StructuredDataExtractorResponse.d.mts +1 -1
- package/dist/esm/api/types/StructuredDataExtractorResponse.mjs +1 -1
- package/dist/esm/api/types/TextFormatModel.d.mts +1 -1
- package/dist/esm/api/types/TextFormatModel.mjs +1 -1
- package/dist/esm/api/types/ThreadStatusResponseOut.d.mts +1 -1
- package/dist/esm/api/types/ThreadStatusResponseOut.mjs +1 -1
- package/dist/esm/api/types/index.d.mts +5 -5
- package/dist/esm/api/types/index.mjs +5 -5
- package/dist/esm/auth/HeaderAuthProvider.d.mts +14 -0
- package/dist/esm/auth/HeaderAuthProvider.mjs +34 -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 +7 -0
- package/dist/esm/core/auth/AuthProvider.mjs +1 -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 +24 -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 +3 -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 +1 -0
- package/dist/esm/core/exports.mjs +1 -0
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +6 -7
- package/dist/esm/core/fetcher/EndpointSupplier.d.mts +1 -1
- package/dist/esm/core/fetcher/EndpointSupplier.mjs +0 -1
- package/dist/esm/core/fetcher/Fetcher.d.mts +9 -2
- package/dist/esm/core/fetcher/Fetcher.mjs +204 -9
- package/dist/esm/core/fetcher/getErrorResponseBody.mjs +2 -1
- package/dist/esm/core/fetcher/getRequestBody.d.mts +1 -1
- package/dist/esm/core/fetcher/getRequestBody.mjs +4 -0
- package/dist/esm/core/fetcher/getResponseBody.mjs +21 -7
- package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
- package/dist/esm/core/fetcher/makeRequest.mjs +2 -4
- package/dist/esm/core/fetcher/requestWithRetries.mjs +3 -12
- package/dist/esm/core/fetcher/signals.d.mts +1 -7
- package/dist/esm/core/fetcher/signals.mjs +0 -12
- package/dist/esm/core/file/file.d.mts +5 -0
- package/dist/esm/core/file/file.mjs +24 -7
- package/dist/esm/core/form-data-utils/FormDataWrapper.d.mts +2 -3
- package/dist/esm/core/form-data-utils/FormDataWrapper.mjs +59 -82
- package/dist/esm/core/headers.mjs +6 -4
- package/dist/esm/core/index.d.mts +5 -2
- package/dist/esm/core/index.mjs +5 -2
- 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/runtime/runtime.mjs +11 -10
- 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 +1 -0
- package/dist/esm/core/url/index.mjs +1 -0
- package/dist/esm/core/url/join.mjs +3 -4
- package/dist/esm/errors/AthenaIntelligenceError.d.mts +1 -1
- package/dist/esm/errors/AthenaIntelligenceError.mjs +1 -2
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/index.mjs +1 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +11 -5
- package/reference.md +455 -491
- package/dist/cjs/core/fetcher/ResponseWithBody.d.ts +0 -4
- package/dist/cjs/core/fetcher/ResponseWithBody.js +0 -6
- package/dist/esm/core/fetcher/ResponseWithBody.d.mts +0 -4
- package/dist/esm/core/fetcher/ResponseWithBody.mjs +0 -3
|
@@ -11,8 +11,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getRequestBody = getRequestBody;
|
|
13
13
|
const json_js_1 = require("../json.js");
|
|
14
|
+
const qs_js_1 = require("../url/qs.js");
|
|
14
15
|
function getRequestBody(_a) {
|
|
15
16
|
return __awaiter(this, arguments, void 0, function* ({ body, type }) {
|
|
17
|
+
if (type === "form") {
|
|
18
|
+
return (0, qs_js_1.toQueryString)(body, { arrayFormat: "repeat", encode: true });
|
|
19
|
+
}
|
|
16
20
|
if (type.includes("json")) {
|
|
17
21
|
return (0, json_js_1.toJson)(body);
|
|
18
22
|
}
|
|
@@ -10,14 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getResponseBody = getResponseBody;
|
|
13
|
-
const BinaryResponse_js_1 = require("./BinaryResponse.js");
|
|
14
|
-
const ResponseWithBody_js_1 = require("./ResponseWithBody.js");
|
|
15
13
|
const json_js_1 = require("../json.js");
|
|
14
|
+
const BinaryResponse_js_1 = require("./BinaryResponse.js");
|
|
16
15
|
function getResponseBody(response, responseType) {
|
|
17
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
if (!(0, ResponseWithBody_js_1.isResponseWithBody)(response)) {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
17
|
switch (responseType) {
|
|
22
18
|
case "binary-response":
|
|
23
19
|
return (0, BinaryResponse_js_1.getBinaryResponse)(response);
|
|
@@ -26,8 +22,26 @@ function getResponseBody(response, responseType) {
|
|
|
26
22
|
case "arrayBuffer":
|
|
27
23
|
return yield response.arrayBuffer();
|
|
28
24
|
case "sse":
|
|
25
|
+
if (response.body == null) {
|
|
26
|
+
return {
|
|
27
|
+
ok: false,
|
|
28
|
+
error: {
|
|
29
|
+
reason: "body-is-null",
|
|
30
|
+
statusCode: response.status,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
29
34
|
return response.body;
|
|
30
35
|
case "streaming":
|
|
36
|
+
if (response.body == null) {
|
|
37
|
+
return {
|
|
38
|
+
ok: false,
|
|
39
|
+
error: {
|
|
40
|
+
reason: "body-is-null",
|
|
41
|
+
statusCode: response.status,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
31
45
|
return response.body;
|
|
32
46
|
case "text":
|
|
33
47
|
return yield response.text();
|
|
@@ -36,10 +50,10 @@ function getResponseBody(response, responseType) {
|
|
|
36
50
|
const text = yield response.text();
|
|
37
51
|
if (text.length > 0) {
|
|
38
52
|
try {
|
|
39
|
-
|
|
53
|
+
const responseBody = (0, json_js_1.fromJson)(text);
|
|
40
54
|
return responseBody;
|
|
41
55
|
}
|
|
42
|
-
catch (
|
|
56
|
+
catch (_err) {
|
|
43
57
|
return {
|
|
44
58
|
ok: false,
|
|
45
59
|
error: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const makeRequest: (fetchFn: (url: string, init: RequestInit) => Promise<Response>, url: string, method: string, headers: Record<string, string>, requestBody: BodyInit | undefined, timeoutMs?: number, abortSignal?: AbortSignal, withCredentials?: boolean, duplex?: "half") => Promise<Response>;
|
|
1
|
+
export declare const makeRequest: (fetchFn: (url: string, init: RequestInit) => Promise<Response>, url: string, method: string, headers: Headers | Record<string, string>, requestBody: BodyInit | undefined, timeoutMs?: number, abortSignal?: AbortSignal, withCredentials?: boolean, duplex?: "half") => Promise<Response>;
|
|
@@ -13,18 +13,16 @@ exports.makeRequest = void 0;
|
|
|
13
13
|
const signals_js_1 = require("./signals.js");
|
|
14
14
|
const makeRequest = (fetchFn, url, method, headers, requestBody, timeoutMs, abortSignal, withCredentials, duplex) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
15
|
const signals = [];
|
|
16
|
-
|
|
17
|
-
let timeoutAbortId = undefined;
|
|
16
|
+
let timeoutAbortId;
|
|
18
17
|
if (timeoutMs != null) {
|
|
19
18
|
const { signal, abortId } = (0, signals_js_1.getTimeoutSignal)(timeoutMs);
|
|
20
19
|
timeoutAbortId = abortId;
|
|
21
20
|
signals.push(signal);
|
|
22
21
|
}
|
|
23
|
-
// Add arbitrary signal
|
|
24
22
|
if (abortSignal != null) {
|
|
25
23
|
signals.push(abortSignal);
|
|
26
24
|
}
|
|
27
|
-
|
|
25
|
+
const newSignals = (0, signals_js_1.anySignal)(signals);
|
|
28
26
|
const response = yield fetchFn(url, {
|
|
29
27
|
method: method,
|
|
30
28
|
headers,
|
|
@@ -15,46 +15,38 @@ const MAX_RETRY_DELAY = 60000; // in milliseconds
|
|
|
15
15
|
const DEFAULT_MAX_RETRIES = 2;
|
|
16
16
|
const JITTER_FACTOR = 0.2; // 20% random jitter
|
|
17
17
|
function addPositiveJitter(delay) {
|
|
18
|
-
// Generate a random value between 0 and +JITTER_FACTOR
|
|
19
18
|
const jitterMultiplier = 1 + Math.random() * JITTER_FACTOR;
|
|
20
19
|
return delay * jitterMultiplier;
|
|
21
20
|
}
|
|
22
21
|
function addSymmetricJitter(delay) {
|
|
23
|
-
// Generate a random value in a JITTER_FACTOR-sized percentage range around delay
|
|
24
22
|
const jitterMultiplier = 1 + (Math.random() - 0.5) * JITTER_FACTOR;
|
|
25
23
|
return delay * jitterMultiplier;
|
|
26
24
|
}
|
|
27
25
|
function getRetryDelayFromHeaders(response, retryAttempt) {
|
|
28
|
-
// Check for Retry-After header first (RFC 7231), with no jitter
|
|
29
26
|
const retryAfter = response.headers.get("Retry-After");
|
|
30
27
|
if (retryAfter) {
|
|
31
|
-
// Parse as number of seconds...
|
|
32
28
|
const retryAfterSeconds = parseInt(retryAfter, 10);
|
|
33
|
-
if (!isNaN(retryAfterSeconds) && retryAfterSeconds > 0) {
|
|
29
|
+
if (!Number.isNaN(retryAfterSeconds) && retryAfterSeconds > 0) {
|
|
34
30
|
return Math.min(retryAfterSeconds * 1000, MAX_RETRY_DELAY);
|
|
35
31
|
}
|
|
36
|
-
// ...or as an HTTP date; both are valid
|
|
37
32
|
const retryAfterDate = new Date(retryAfter);
|
|
38
|
-
if (!isNaN(retryAfterDate.getTime())) {
|
|
33
|
+
if (!Number.isNaN(retryAfterDate.getTime())) {
|
|
39
34
|
const delay = retryAfterDate.getTime() - Date.now();
|
|
40
35
|
if (delay > 0) {
|
|
41
36
|
return Math.min(Math.max(delay, 0), MAX_RETRY_DELAY);
|
|
42
37
|
}
|
|
43
38
|
}
|
|
44
39
|
}
|
|
45
|
-
// Then check for industry-standard X-RateLimit-Reset header, with positive jitter
|
|
46
40
|
const rateLimitReset = response.headers.get("X-RateLimit-Reset");
|
|
47
41
|
if (rateLimitReset) {
|
|
48
42
|
const resetTime = parseInt(rateLimitReset, 10);
|
|
49
|
-
if (!isNaN(resetTime)) {
|
|
50
|
-
// Assume Unix timestamp in epoch seconds
|
|
43
|
+
if (!Number.isNaN(resetTime)) {
|
|
51
44
|
const delay = resetTime * 1000 - Date.now();
|
|
52
45
|
if (delay > 0) {
|
|
53
46
|
return addPositiveJitter(Math.min(delay, MAX_RETRY_DELAY));
|
|
54
47
|
}
|
|
55
48
|
}
|
|
56
49
|
}
|
|
57
|
-
// Fall back to exponential backoff, with symmetric jitter
|
|
58
50
|
return addSymmetricJitter(Math.min(INITIAL_RETRY_DELAY * Math.pow(2, retryAttempt), MAX_RETRY_DELAY));
|
|
59
51
|
}
|
|
60
52
|
function requestWithRetries(requestFn_1) {
|
|
@@ -62,7 +54,6 @@ function requestWithRetries(requestFn_1) {
|
|
|
62
54
|
let response = yield requestFn();
|
|
63
55
|
for (let i = 0; i < maxRetries; ++i) {
|
|
64
56
|
if ([408, 429].includes(response.status) || response.status >= 500) {
|
|
65
|
-
// Get delay with appropriate jitter applied
|
|
66
57
|
const delay = getRetryDelayFromHeaders(response, i);
|
|
67
58
|
yield new Promise((resolve) => setTimeout(resolve, delay));
|
|
68
59
|
response = yield requestFn();
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
export declare function getTimeoutSignal(timeoutMs: number): {
|
|
2
2
|
signal: AbortSignal;
|
|
3
|
-
abortId:
|
|
3
|
+
abortId: ReturnType<typeof setTimeout>;
|
|
4
4
|
};
|
|
5
|
-
/**
|
|
6
|
-
* Returns an abort signal that is getting aborted when
|
|
7
|
-
* at least one of the specified abort signals is aborted.
|
|
8
|
-
*
|
|
9
|
-
* Requires at least node.js 18.
|
|
10
|
-
*/
|
|
11
5
|
export declare function anySignal(...args: AbortSignal[] | [AbortSignal[]]): AbortSignal;
|
|
@@ -8,26 +8,14 @@ function getTimeoutSignal(timeoutMs) {
|
|
|
8
8
|
const abortId = setTimeout(() => controller.abort(TIMEOUT), timeoutMs);
|
|
9
9
|
return { signal: controller.signal, abortId };
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Returns an abort signal that is getting aborted when
|
|
13
|
-
* at least one of the specified abort signals is aborted.
|
|
14
|
-
*
|
|
15
|
-
* Requires at least node.js 18.
|
|
16
|
-
*/
|
|
17
11
|
function anySignal(...args) {
|
|
18
|
-
// Allowing signals to be passed either as array
|
|
19
|
-
// of signals or as multiple arguments.
|
|
20
12
|
const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args);
|
|
21
13
|
const controller = new AbortController();
|
|
22
14
|
for (const signal of signals) {
|
|
23
15
|
if (signal.aborted) {
|
|
24
|
-
// Exiting early if one of the signals
|
|
25
|
-
// is already aborted.
|
|
26
16
|
controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason);
|
|
27
17
|
break;
|
|
28
18
|
}
|
|
29
|
-
// Listening for signals and removing the listeners
|
|
30
|
-
// when at least one symbol is aborted.
|
|
31
19
|
signal.addEventListener("abort", () => controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason), {
|
|
32
20
|
signal: controller.signal,
|
|
33
21
|
});
|
|
@@ -3,3 +3,8 @@ export declare function toBinaryUploadRequest(file: Uploadable): Promise<{
|
|
|
3
3
|
body: Uploadable.FileLike;
|
|
4
4
|
headers?: Record<string, string>;
|
|
5
5
|
}>;
|
|
6
|
+
export declare function toMultipartDataPart(file: Uploadable): Promise<{
|
|
7
|
+
data: Uploadable.FileLike;
|
|
8
|
+
filename?: string;
|
|
9
|
+
contentType?: string;
|
|
10
|
+
}>;
|
|
@@ -43,6 +43,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
};
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
45
|
exports.toBinaryUploadRequest = toBinaryUploadRequest;
|
|
46
|
+
exports.toMultipartDataPart = toMultipartDataPart;
|
|
46
47
|
function toBinaryUploadRequest(file) {
|
|
47
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
49
|
const { data, filename, contentLength, contentType } = yield getFileWithMetadata(file);
|
|
@@ -62,13 +63,25 @@ function toBinaryUploadRequest(file) {
|
|
|
62
63
|
return request;
|
|
63
64
|
});
|
|
64
65
|
}
|
|
65
|
-
function
|
|
66
|
+
function toMultipartDataPart(file) {
|
|
66
67
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
const { data, filename, contentType } = yield getFileWithMetadata(file, {
|
|
69
|
+
noSniffFileSize: true,
|
|
70
|
+
});
|
|
71
|
+
return {
|
|
72
|
+
data,
|
|
73
|
+
filename,
|
|
74
|
+
contentType,
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function getFileWithMetadata(file_1) {
|
|
79
|
+
return __awaiter(this, arguments, void 0, function* (file, { noSniffFileSize } = {}) {
|
|
67
80
|
var _a, _b, _c, _d, _e;
|
|
68
81
|
if (isFileLike(file)) {
|
|
69
82
|
return getFileWithMetadata({
|
|
70
83
|
data: file,
|
|
71
|
-
});
|
|
84
|
+
}, { noSniffFileSize });
|
|
72
85
|
}
|
|
73
86
|
if ("path" in file) {
|
|
74
87
|
const fs = yield Promise.resolve().then(() => __importStar(require("fs")));
|
|
@@ -76,7 +89,7 @@ function getFileWithMetadata(file) {
|
|
|
76
89
|
throw new Error("File path uploads are not supported in this environment.");
|
|
77
90
|
}
|
|
78
91
|
const data = fs.createReadStream(file.path);
|
|
79
|
-
const contentLength = (_a = file.contentLength) !== null && _a !== void 0 ? _a : (yield tryGetFileSizeFromPath(file.path));
|
|
92
|
+
const contentLength = (_a = file.contentLength) !== null && _a !== void 0 ? _a : (noSniffFileSize === true ? undefined : yield tryGetFileSizeFromPath(file.path));
|
|
80
93
|
const filename = (_b = file.filename) !== null && _b !== void 0 ? _b : getNameFromPath(file.path);
|
|
81
94
|
return {
|
|
82
95
|
data,
|
|
@@ -87,7 +100,9 @@ function getFileWithMetadata(file) {
|
|
|
87
100
|
}
|
|
88
101
|
if ("data" in file) {
|
|
89
102
|
const data = file.data;
|
|
90
|
-
const contentLength = (_c = file.contentLength) !== null && _c !== void 0 ? _c : (yield tryGetContentLengthFromFileLike(data
|
|
103
|
+
const contentLength = (_c = file.contentLength) !== null && _c !== void 0 ? _c : (yield tryGetContentLengthFromFileLike(data, {
|
|
104
|
+
noSniffFileSize,
|
|
105
|
+
}));
|
|
91
106
|
const filename = (_d = file.filename) !== null && _d !== void 0 ? _d : tryGetNameFromFileLike(data);
|
|
92
107
|
return {
|
|
93
108
|
data,
|
|
@@ -119,7 +134,7 @@ function tryGetFileSizeFromPath(path) {
|
|
|
119
134
|
const fileStat = yield fs.promises.stat(path);
|
|
120
135
|
return fileStat.size;
|
|
121
136
|
}
|
|
122
|
-
catch (
|
|
137
|
+
catch (_fallbackError) {
|
|
123
138
|
return undefined;
|
|
124
139
|
}
|
|
125
140
|
});
|
|
@@ -133,8 +148,8 @@ function tryGetNameFromFileLike(data) {
|
|
|
133
148
|
}
|
|
134
149
|
return undefined;
|
|
135
150
|
}
|
|
136
|
-
function tryGetContentLengthFromFileLike(
|
|
137
|
-
return __awaiter(this,
|
|
151
|
+
function tryGetContentLengthFromFileLike(data_1) {
|
|
152
|
+
return __awaiter(this, arguments, void 0, function* (data, { noSniffFileSize } = {}) {
|
|
138
153
|
if (isBuffer(data)) {
|
|
139
154
|
return data.length;
|
|
140
155
|
}
|
|
@@ -150,6 +165,9 @@ function tryGetContentLengthFromFileLike(data) {
|
|
|
150
165
|
if (isFile(data)) {
|
|
151
166
|
return data.size;
|
|
152
167
|
}
|
|
168
|
+
if (noSniffFileSize === true) {
|
|
169
|
+
return undefined;
|
|
170
|
+
}
|
|
153
171
|
if (isPathedValue(data)) {
|
|
154
172
|
return yield tryGetFileSizeFromPath(data.path.toString());
|
|
155
173
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Uploadable } from "../../core/file/index.js";
|
|
1
2
|
interface FormDataRequest<Body> {
|
|
2
3
|
body: Body;
|
|
3
4
|
headers: Record<string, string>;
|
|
@@ -8,9 +9,7 @@ export declare class FormDataWrapper {
|
|
|
8
9
|
private fd;
|
|
9
10
|
setup(): Promise<void>;
|
|
10
11
|
append(key: string, value: unknown): void;
|
|
11
|
-
|
|
12
|
-
private convertToBlob;
|
|
13
|
-
appendFile(key: string, value: unknown, fileName?: string): Promise<void>;
|
|
12
|
+
appendFile(key: string, value: Uploadable): Promise<void>;
|
|
14
13
|
getRequest(): FormDataRequest<FormData>;
|
|
15
14
|
}
|
|
16
15
|
export {};
|
|
@@ -51,14 +51,47 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
|
51
51
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
52
|
exports.FormDataWrapper = void 0;
|
|
53
53
|
exports.newFormData = newFormData;
|
|
54
|
+
const index_js_1 = require("../../core/file/index.js");
|
|
54
55
|
const json_js_1 = require("../../core/json.js");
|
|
55
|
-
const
|
|
56
|
-
function
|
|
57
|
-
return
|
|
56
|
+
const index_js_2 = require("../runtime/index.js");
|
|
57
|
+
function newFormData() {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return new FormDataWrapper();
|
|
60
|
+
});
|
|
58
61
|
}
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
class FormDataWrapper {
|
|
63
|
+
constructor() {
|
|
64
|
+
this.fd = new FormData();
|
|
65
|
+
}
|
|
66
|
+
setup() {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
// noop
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
append(key, value) {
|
|
72
|
+
this.fd.append(key, String(value));
|
|
73
|
+
}
|
|
74
|
+
appendFile(key, value) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const { data, filename, contentType } = yield (0, index_js_1.toMultipartDataPart)(value);
|
|
77
|
+
const blob = yield convertToBlob(data, contentType);
|
|
78
|
+
if (filename) {
|
|
79
|
+
this.fd.append(key, blob, filename);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
this.fd.append(key, blob);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
getRequest() {
|
|
87
|
+
return {
|
|
88
|
+
body: this.fd,
|
|
89
|
+
headers: {},
|
|
90
|
+
duplex: "half",
|
|
91
|
+
};
|
|
92
|
+
}
|
|
61
93
|
}
|
|
94
|
+
exports.FormDataWrapper = FormDataWrapper;
|
|
62
95
|
function isStreamLike(value) {
|
|
63
96
|
return typeof value === "object" && value != null && ("read" in value || "pipe" in value);
|
|
64
97
|
}
|
|
@@ -71,17 +104,11 @@ function isBuffer(value) {
|
|
|
71
104
|
function isArrayBufferView(value) {
|
|
72
105
|
return ArrayBuffer.isView(value);
|
|
73
106
|
}
|
|
74
|
-
function getLastPathSegment(pathStr) {
|
|
75
|
-
const lastForwardSlash = pathStr.lastIndexOf("/");
|
|
76
|
-
const lastBackSlash = pathStr.lastIndexOf("\\");
|
|
77
|
-
const lastSlashIndex = Math.max(lastForwardSlash, lastBackSlash);
|
|
78
|
-
return lastSlashIndex >= 0 ? pathStr.substring(lastSlashIndex + 1) : pathStr;
|
|
79
|
-
}
|
|
80
107
|
function streamToBuffer(stream) {
|
|
81
108
|
return __awaiter(this, void 0, void 0, function* () {
|
|
82
109
|
var _a, stream_1, stream_1_1;
|
|
83
110
|
var _b, e_1, _c, _d;
|
|
84
|
-
if (
|
|
111
|
+
if (index_js_2.RUNTIME.type === "node") {
|
|
85
112
|
const { Readable } = yield Promise.resolve().then(() => __importStar(require("stream")));
|
|
86
113
|
if (stream instanceof Readable) {
|
|
87
114
|
const chunks = [];
|
|
@@ -126,83 +153,33 @@ function streamToBuffer(stream) {
|
|
|
126
153
|
}
|
|
127
154
|
return Buffer.from(result);
|
|
128
155
|
}
|
|
129
|
-
throw new Error(
|
|
156
|
+
throw new Error(`Unsupported stream type: ${typeof stream}. Expected Node.js Readable stream or Web ReadableStream.`);
|
|
130
157
|
});
|
|
131
158
|
}
|
|
132
|
-
function
|
|
159
|
+
function convertToBlob(value, contentType) {
|
|
133
160
|
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
class FormDataWrapper {
|
|
138
|
-
constructor() {
|
|
139
|
-
this.fd = new FormData();
|
|
140
|
-
}
|
|
141
|
-
setup() {
|
|
142
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
-
// noop
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
append(key, value) {
|
|
147
|
-
this.fd.append(key, String(value));
|
|
148
|
-
}
|
|
149
|
-
getFileName(value, filename) {
|
|
150
|
-
if (filename != null) {
|
|
151
|
-
return filename;
|
|
161
|
+
if (isStreamLike(value) || isReadableStream(value)) {
|
|
162
|
+
const buffer = yield streamToBuffer(value);
|
|
163
|
+
return new Blob([buffer], { type: contentType });
|
|
152
164
|
}
|
|
153
|
-
if (
|
|
154
|
-
return value
|
|
165
|
+
if (value instanceof Blob) {
|
|
166
|
+
return value;
|
|
155
167
|
}
|
|
156
|
-
if (
|
|
157
|
-
return
|
|
168
|
+
if (isBuffer(value)) {
|
|
169
|
+
return new Blob([value], { type: contentType });
|
|
158
170
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (value instanceof ArrayBuffer) {
|
|
174
|
-
return new Blob([value]);
|
|
175
|
-
}
|
|
176
|
-
if (isArrayBufferView(value)) {
|
|
177
|
-
return new Blob([value]);
|
|
178
|
-
}
|
|
179
|
-
if (typeof value === "string") {
|
|
180
|
-
return new Blob([value]);
|
|
181
|
-
}
|
|
182
|
-
if (typeof value === "object" && value !== null) {
|
|
183
|
-
return new Blob([(0, json_js_1.toJson)(value)], { type: "application/json" });
|
|
184
|
-
}
|
|
185
|
-
return new Blob([String(value)]);
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
appendFile(key, value, fileName) {
|
|
189
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
190
|
-
fileName = this.getFileName(value, fileName);
|
|
191
|
-
const blob = yield this.convertToBlob(value);
|
|
192
|
-
if (fileName) {
|
|
193
|
-
this.fd.append(key, blob, fileName);
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
this.fd.append(key, blob);
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
getRequest() {
|
|
201
|
-
return {
|
|
202
|
-
body: this.fd,
|
|
203
|
-
headers: {},
|
|
204
|
-
duplex: "half",
|
|
205
|
-
};
|
|
206
|
-
}
|
|
171
|
+
if (value instanceof ArrayBuffer) {
|
|
172
|
+
return new Blob([value], { type: contentType });
|
|
173
|
+
}
|
|
174
|
+
if (isArrayBufferView(value)) {
|
|
175
|
+
return new Blob([value], { type: contentType });
|
|
176
|
+
}
|
|
177
|
+
if (typeof value === "string") {
|
|
178
|
+
return new Blob([value], { type: contentType });
|
|
179
|
+
}
|
|
180
|
+
if (typeof value === "object" && value !== null) {
|
|
181
|
+
return new Blob([(0, json_js_1.toJson)(value)], { type: contentType !== null && contentType !== void 0 ? contentType : "application/json" });
|
|
182
|
+
}
|
|
183
|
+
return new Blob([String(value)], { type: contentType });
|
|
184
|
+
});
|
|
207
185
|
}
|
|
208
|
-
exports.FormDataWrapper = FormDataWrapper;
|
package/dist/cjs/core/headers.js
CHANGED
|
@@ -7,11 +7,12 @@ function mergeHeaders(...headersArray) {
|
|
|
7
7
|
for (const [key, value] of headersArray
|
|
8
8
|
.filter((headers) => headers != null)
|
|
9
9
|
.flatMap((headers) => Object.entries(headers))) {
|
|
10
|
+
const insensitiveKey = key.toLowerCase();
|
|
10
11
|
if (value != null) {
|
|
11
|
-
result[
|
|
12
|
+
result[insensitiveKey] = value;
|
|
12
13
|
}
|
|
13
|
-
else if (
|
|
14
|
-
delete result[
|
|
14
|
+
else if (insensitiveKey in result) {
|
|
15
|
+
delete result[insensitiveKey];
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
return result;
|
|
@@ -21,8 +22,9 @@ function mergeOnlyDefinedHeaders(...headersArray) {
|
|
|
21
22
|
for (const [key, value] of headersArray
|
|
22
23
|
.filter((headers) => headers != null)
|
|
23
24
|
.flatMap((headers) => Object.entries(headers))) {
|
|
25
|
+
const insensitiveKey = key.toLowerCase();
|
|
24
26
|
if (value != null) {
|
|
25
|
-
result[
|
|
27
|
+
result[insensitiveKey] = value;
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
return result;
|
package/dist/cjs/core/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
export * from "./auth/index.js";
|
|
2
|
+
export * from "./base64.js";
|
|
1
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";
|
|
2
7
|
export * from "./runtime/index.js";
|
|
3
8
|
export * as url from "./url/index.js";
|
|
4
|
-
export * from "./form-data-utils/index.js";
|
|
5
|
-
export * as file from "./file/index.js";
|
package/dist/cjs/core/index.js
CHANGED
|
@@ -36,9 +36,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.url = exports.logging = exports.file = void 0;
|
|
40
|
+
__exportStar(require("./auth/index.js"), exports);
|
|
41
|
+
__exportStar(require("./base64.js"), exports);
|
|
40
42
|
__exportStar(require("./fetcher/index.js"), exports);
|
|
43
|
+
exports.file = __importStar(require("./file/index.js"));
|
|
44
|
+
__exportStar(require("./form-data-utils/index.js"), exports);
|
|
45
|
+
exports.logging = __importStar(require("./logging/index.js"));
|
|
41
46
|
__exportStar(require("./runtime/index.js"), exports);
|
|
42
47
|
exports.url = __importStar(require("./url/index.js"));
|
|
43
|
-
__exportStar(require("./form-data-utils/index.js"), exports);
|
|
44
|
-
exports.file = __importStar(require("./file/index.js"));
|
|
@@ -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,45 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.logging = void 0;
|
|
37
|
+
const logger = __importStar(require("./logger.js"));
|
|
38
|
+
var logging;
|
|
39
|
+
(function (logging) {
|
|
40
|
+
logging.LogLevel = logger.LogLevel;
|
|
41
|
+
/**
|
|
42
|
+
* Console logger implementation that outputs to the console.
|
|
43
|
+
*/
|
|
44
|
+
logging.ConsoleLogger = logger.ConsoleLogger;
|
|
45
|
+
})(logging || (exports.logging = logging = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./logger.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("./logger.js"), exports);
|