@airweave/sdk 0.6.0 → 0.6.26
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 +14 -3
- package/dist/cjs/Client.d.ts +4 -8
- package/dist/cjs/Client.js +6 -16
- package/dist/cjs/api/resources/collections/client/Client.d.ts +14 -27
- package/dist/cjs/api/resources/collections/client/Client.js +37 -85
- package/dist/cjs/api/resources/collections/client/requests/ListCollectionsGetRequest.d.ts +6 -7
- package/dist/cjs/api/resources/collections/client/requests/SearchCollectionsReadableIdSearchGetRequest.d.ts +10 -16
- package/dist/cjs/api/resources/collections/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/resources/index.d.ts +0 -4
- package/dist/cjs/api/resources/index.js +1 -5
- package/dist/cjs/api/resources/sourceConnections/client/Client.d.ts +60 -80
- package/dist/cjs/api/resources/sourceConnections/client/Client.js +104 -157
- package/dist/cjs/api/resources/sourceConnections/client/requests/GetSourceConnectionJobsSourceConnectionsSourceConnectionIdJobsGetRequest.d.ts +12 -0
- package/dist/cjs/api/resources/sourceConnections/client/requests/ListSourceConnectionsGetRequest.d.ts +6 -10
- package/dist/cjs/api/resources/sourceConnections/client/requests/SourceConnectionCreate.d.ts +21 -20
- package/dist/cjs/api/resources/sourceConnections/client/requests/SourceConnectionUpdate.d.ts +7 -18
- package/dist/cjs/api/resources/sourceConnections/client/requests/index.d.ts +1 -2
- package/dist/cjs/api/resources/sources/client/Client.d.ts +17 -17
- package/dist/cjs/api/resources/sources/client/Client.js +24 -20
- package/dist/cjs/api/types/ActionCheckRequest.d.ts +10 -0
- package/dist/cjs/api/types/ActionCheckResponse.d.ts +3 -16
- package/dist/cjs/api/types/ActionCheckResponse.js +0 -8
- package/dist/cjs/api/types/AuthProvider.d.ts +0 -2
- package/dist/cjs/api/types/AuthProviderAuthentication.d.ts +12 -0
- package/dist/cjs/api/types/AuthProviderConnection.d.ts +2 -0
- package/dist/cjs/api/{resources/authProviders/client/requests → types}/AuthProviderConnectionCreate.d.ts +2 -10
- package/dist/cjs/api/types/AuthenticationDetails.d.ts +19 -0
- package/dist/cjs/api/types/AuthenticationMethod.d.ts +14 -0
- package/dist/cjs/api/types/AuthenticationMethod.js +13 -0
- package/dist/cjs/api/{resources/collections/client/requests → types}/CollectionUpdate.d.ts +4 -4
- package/dist/cjs/api/types/Destination.d.ts +0 -2
- package/dist/cjs/api/types/DestinationWithAuthenticationFields.d.ts +0 -1
- package/dist/cjs/api/types/DirectAuthentication.d.ts +10 -0
- package/dist/cjs/api/types/EmbeddingModel.d.ts +0 -2
- package/dist/cjs/api/types/EmbeddingModelWithAuthenticationFields.d.ts +0 -1
- package/dist/cjs/api/types/EntityCountWithDefinition.d.ts +1 -0
- package/dist/cjs/api/types/EntitySummary.d.ts +11 -0
- package/dist/cjs/api/types/EntityTypeStats.d.ts +10 -0
- package/dist/cjs/api/types/FieldCondition.d.ts +3 -3
- package/dist/cjs/api/types/IntegrationCredentialInDb.d.ts +2 -1
- package/dist/cjs/api/types/IntegrationCredentialRawCreate.d.ts +2 -1
- package/dist/cjs/api/types/MatchPhrase.d.ts +10 -0
- package/dist/cjs/api/types/OAuthBrowserAuthentication.d.ts +14 -0
- package/dist/cjs/api/types/OAuthTokenAuthentication.d.ts +14 -0
- package/dist/cjs/api/types/OAuthType.d.ts +12 -0
- package/dist/cjs/api/types/OAuthType.js +11 -0
- package/dist/cjs/api/types/ScheduleConfig.d.ts +14 -0
- package/dist/cjs/api/types/ScheduleDetails.d.ts +13 -0
- package/dist/cjs/api/types/SingleActionCheckResponse.d.ts +23 -0
- package/dist/cjs/api/types/SingleActionCheckResponse.js +13 -0
- package/dist/cjs/api/types/Source.d.ts +13 -9
- package/dist/cjs/api/types/SourceConnection.d.ts +9 -52
- package/dist/cjs/api/types/SourceConnectionJob.d.ts +9 -34
- package/dist/cjs/api/types/SourceConnectionListItem.d.ts +8 -16
- package/dist/cjs/api/types/SourceConnectionStatus.d.ts +7 -4
- package/dist/cjs/api/types/SourceConnectionStatus.js +5 -2
- package/dist/cjs/api/types/SubscriptionInfo.d.ts +12 -0
- package/dist/cjs/api/types/Sync.d.ts +0 -1
- package/dist/cjs/api/types/SyncCreate.d.ts +0 -1
- package/dist/cjs/api/types/SyncDetails.d.ts +13 -0
- package/dist/cjs/api/types/SyncJobDetails.d.ts +20 -0
- package/dist/cjs/api/types/SyncJobStatus.d.ts +3 -2
- package/dist/cjs/api/types/SyncJobStatus.js +2 -1
- package/dist/cjs/api/types/SyncUpdate.d.ts +0 -1
- package/dist/cjs/api/types/SyncWithSourceConnection.d.ts +0 -1
- package/dist/cjs/api/types/UpdatePlanRequest.d.ts +2 -0
- package/dist/cjs/api/types/UsageSnapshot.d.ts +4 -8
- package/dist/cjs/api/types/index.d.ts +18 -10
- package/dist/cjs/api/types/index.js +18 -10
- package/dist/cjs/core/fetcher/EndpointMetadata.d.ts +13 -0
- package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +12 -0
- package/dist/cjs/core/fetcher/EndpointSupplier.js +22 -0
- package/dist/cjs/core/fetcher/Fetcher.d.ts +5 -3
- package/dist/cjs/core/fetcher/Fetcher.js +4 -3
- package/dist/cjs/core/fetcher/index.d.ts +7 -5
- package/dist/cjs/core/fetcher/index.js +7 -5
- package/dist/cjs/core/fetcher/requestWithRetries.js +44 -8
- package/dist/cjs/core/headers.d.ts +2 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +4 -8
- package/dist/esm/Client.mjs +2 -12
- package/dist/esm/api/resources/collections/client/Client.d.mts +14 -27
- package/dist/esm/api/resources/collections/client/Client.mjs +37 -85
- package/dist/esm/api/resources/collections/client/requests/ListCollectionsGetRequest.d.mts +6 -7
- package/dist/esm/api/resources/collections/client/requests/SearchCollectionsReadableIdSearchGetRequest.d.mts +10 -16
- package/dist/esm/api/resources/collections/client/requests/index.d.mts +0 -1
- package/dist/esm/api/resources/index.d.mts +0 -4
- package/dist/esm/api/resources/index.mjs +0 -4
- package/dist/esm/api/resources/sourceConnections/client/Client.d.mts +60 -80
- package/dist/esm/api/resources/sourceConnections/client/Client.mjs +104 -157
- package/dist/esm/api/resources/sourceConnections/client/requests/GetSourceConnectionJobsSourceConnectionsSourceConnectionIdJobsGetRequest.d.mts +12 -0
- package/dist/esm/api/resources/sourceConnections/client/requests/ListSourceConnectionsGetRequest.d.mts +6 -10
- package/dist/esm/api/resources/sourceConnections/client/requests/SourceConnectionCreate.d.mts +21 -20
- package/dist/esm/api/resources/sourceConnections/client/requests/SourceConnectionUpdate.d.mts +7 -18
- package/dist/esm/api/resources/sourceConnections/client/requests/index.d.mts +1 -2
- package/dist/esm/api/resources/sources/client/Client.d.mts +17 -17
- package/dist/esm/api/resources/sources/client/Client.mjs +24 -20
- package/dist/esm/api/types/ActionCheckRequest.d.mts +10 -0
- package/dist/esm/api/types/ActionCheckResponse.d.mts +3 -16
- package/dist/esm/api/types/ActionCheckResponse.mjs +1 -7
- package/dist/esm/api/types/AuthProvider.d.mts +0 -2
- package/dist/esm/api/types/AuthProviderAuthentication.d.mts +12 -0
- package/dist/esm/api/types/AuthProviderConnection.d.mts +2 -0
- package/dist/esm/api/{resources/authProviders/client/requests → types}/AuthProviderConnectionCreate.d.mts +2 -10
- package/dist/esm/api/types/AuthenticationDetails.d.mts +19 -0
- package/dist/esm/api/types/AuthenticationMethod.d.mts +14 -0
- package/dist/esm/api/types/AuthenticationMethod.mjs +10 -0
- package/dist/esm/api/{resources/collections/client/requests → types}/CollectionUpdate.d.mts +4 -4
- package/dist/esm/api/types/Destination.d.mts +0 -2
- package/dist/esm/api/types/DestinationWithAuthenticationFields.d.mts +0 -1
- package/dist/esm/api/types/DirectAuthentication.d.mts +10 -0
- package/dist/esm/api/types/EmbeddingModel.d.mts +0 -2
- package/dist/esm/api/types/EmbeddingModelWithAuthenticationFields.d.mts +0 -1
- package/dist/esm/api/types/EntityCountWithDefinition.d.mts +1 -0
- package/dist/esm/api/types/EntitySummary.d.mts +11 -0
- package/dist/esm/api/types/EntityTypeStats.d.mts +10 -0
- package/dist/esm/api/types/FieldCondition.d.mts +3 -3
- package/dist/esm/api/types/IntegrationCredentialInDb.d.mts +2 -1
- package/dist/esm/api/types/IntegrationCredentialRawCreate.d.mts +2 -1
- package/dist/esm/api/types/MatchPhrase.d.mts +10 -0
- package/dist/esm/api/types/OAuthBrowserAuthentication.d.mts +14 -0
- package/dist/esm/api/types/OAuthTokenAuthentication.d.mts +14 -0
- package/dist/esm/api/types/OAuthType.d.mts +12 -0
- package/dist/esm/api/types/OAuthType.mjs +8 -0
- package/dist/esm/api/types/ScheduleConfig.d.mts +14 -0
- package/dist/esm/api/types/ScheduleDetails.d.mts +13 -0
- package/dist/esm/api/types/SingleActionCheckResponse.d.mts +23 -0
- package/dist/esm/api/types/SingleActionCheckResponse.mjs +10 -0
- package/dist/esm/api/types/Source.d.mts +13 -9
- package/dist/esm/api/types/SourceConnection.d.mts +9 -52
- package/dist/esm/api/types/SourceConnectionJob.d.mts +9 -34
- package/dist/esm/api/types/SourceConnectionListItem.d.mts +8 -16
- package/dist/esm/api/types/SourceConnectionStatus.d.mts +7 -4
- package/dist/esm/api/types/SourceConnectionStatus.mjs +5 -2
- package/dist/esm/api/types/SubscriptionInfo.d.mts +12 -0
- package/dist/esm/api/types/Sync.d.mts +0 -1
- package/dist/esm/api/types/SyncCreate.d.mts +0 -1
- package/dist/esm/api/types/SyncDetails.d.mts +13 -0
- package/dist/esm/api/types/SyncJobDetails.d.mts +20 -0
- package/dist/esm/api/types/SyncJobStatus.d.mts +3 -2
- package/dist/esm/api/types/SyncJobStatus.mjs +2 -1
- package/dist/esm/api/types/SyncUpdate.d.mts +0 -1
- package/dist/esm/api/types/SyncWithSourceConnection.d.mts +0 -1
- package/dist/esm/api/types/UpdatePlanRequest.d.mts +2 -0
- package/dist/esm/api/types/UsageSnapshot.d.mts +4 -8
- package/dist/esm/api/types/index.d.mts +18 -10
- package/dist/esm/api/types/index.mjs +18 -10
- package/dist/esm/core/fetcher/EndpointMetadata.d.mts +13 -0
- package/dist/esm/core/fetcher/EndpointSupplier.d.mts +12 -0
- package/dist/esm/core/fetcher/EndpointSupplier.mjs +19 -0
- package/dist/esm/core/fetcher/Fetcher.d.mts +5 -3
- package/dist/esm/core/fetcher/Fetcher.mjs +4 -3
- package/dist/esm/core/fetcher/index.d.mts +7 -5
- package/dist/esm/core/fetcher/index.mjs +3 -2
- package/dist/esm/core/fetcher/requestWithRetries.mjs +44 -8
- package/dist/esm/core/headers.d.mts +2 -3
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +8 -13
- package/reference.md +218 -1092
- package/dist/cjs/api/resources/authProviders/client/Client.d.ts +0 -90
- package/dist/cjs/api/resources/authProviders/client/Client.js +0 -213
- package/dist/cjs/api/resources/authProviders/client/index.d.ts +0 -2
- package/dist/cjs/api/resources/authProviders/client/index.js +0 -17
- package/dist/cjs/api/resources/authProviders/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/resources/authProviders/index.d.ts +0 -1
- package/dist/cjs/api/resources/authProviders/index.js +0 -17
- package/dist/cjs/api/resources/sourceConnections/client/requests/BodyRunSourceConnectionsSourceConnectionIdRunPost.d.ts +0 -11
- package/dist/cjs/api/resources/sourceConnections/client/requests/GetSourceConnectionsSourceConnectionIdGetRequest.d.ts +0 -13
- package/dist/cjs/api/resources/whiteLabels/client/Client.d.ts +0 -189
- package/dist/cjs/api/resources/whiteLabels/client/Client.js +0 -585
- package/dist/cjs/api/resources/whiteLabels/client/index.d.ts +0 -2
- package/dist/cjs/api/resources/whiteLabels/client/index.js +0 -17
- package/dist/cjs/api/resources/whiteLabels/client/requests/BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions.d.ts +0 -16
- package/dist/cjs/api/resources/whiteLabels/client/requests/WhiteLabelCreate.d.ts +0 -28
- package/dist/cjs/api/resources/whiteLabels/client/requests/WhiteLabelUpdate.d.ts +0 -23
- package/dist/cjs/api/resources/whiteLabels/client/requests/index.d.ts +0 -3
- package/dist/cjs/api/resources/whiteLabels/client/requests/index.js +0 -2
- package/dist/cjs/api/resources/whiteLabels/index.d.ts +0 -1
- package/dist/cjs/api/resources/whiteLabels/index.js +0 -17
- package/dist/cjs/api/types/AuthType.d.ts +0 -27
- package/dist/cjs/api/types/AuthType.js +0 -16
- package/dist/cjs/api/types/BodyCreateCredentialsFromAuthorizationCodeSourceConnectionsSourceShortNameCodeToTokenCredentialsPost.d.ts +0 -13
- package/dist/cjs/api/types/CancelSubscriptionRequest.d.ts +0 -11
- package/dist/cjs/api/types/OAuth2AuthUrl.d.ts +0 -13
- package/dist/cjs/api/types/SourceConnectionContinuousResponse.d.ts +0 -67
- package/dist/cjs/api/types/SourceConnectionCreateContinuous.d.ts +0 -33
- package/dist/cjs/api/types/SourceConnectionCreateWithCredential.d.ts +0 -25
- package/dist/cjs/api/types/SourceConnectionCreateWithWhiteLabel.d.ts +0 -29
- package/dist/cjs/api/types/SourceConnectionMakeContinuous.d.ts +0 -14
- package/dist/cjs/api/types/WhiteLabel.d.ts +0 -32
- package/dist/esm/api/resources/authProviders/client/Client.d.mts +0 -90
- package/dist/esm/api/resources/authProviders/client/Client.mjs +0 -176
- package/dist/esm/api/resources/authProviders/client/index.d.mts +0 -2
- package/dist/esm/api/resources/authProviders/client/index.mjs +0 -1
- package/dist/esm/api/resources/authProviders/client/requests/index.d.mts +0 -1
- package/dist/esm/api/resources/authProviders/index.d.mts +0 -1
- package/dist/esm/api/resources/authProviders/index.mjs +0 -1
- package/dist/esm/api/resources/sourceConnections/client/requests/BodyRunSourceConnectionsSourceConnectionIdRunPost.d.mts +0 -11
- package/dist/esm/api/resources/sourceConnections/client/requests/GetSourceConnectionsSourceConnectionIdGetRequest.d.mts +0 -13
- package/dist/esm/api/resources/whiteLabels/client/Client.d.mts +0 -189
- package/dist/esm/api/resources/whiteLabels/client/Client.mjs +0 -548
- package/dist/esm/api/resources/whiteLabels/client/index.d.mts +0 -2
- package/dist/esm/api/resources/whiteLabels/client/index.mjs +0 -1
- package/dist/esm/api/resources/whiteLabels/client/requests/BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions.d.mts +0 -16
- package/dist/esm/api/resources/whiteLabels/client/requests/WhiteLabelCreate.d.mts +0 -28
- package/dist/esm/api/resources/whiteLabels/client/requests/WhiteLabelUpdate.d.mts +0 -23
- package/dist/esm/api/resources/whiteLabels/client/requests/index.d.mts +0 -3
- package/dist/esm/api/resources/whiteLabels/client/requests/index.mjs +0 -1
- package/dist/esm/api/resources/whiteLabels/index.d.mts +0 -1
- package/dist/esm/api/resources/whiteLabels/index.mjs +0 -1
- package/dist/esm/api/types/AuthType.d.mts +0 -27
- package/dist/esm/api/types/AuthType.mjs +0 -13
- package/dist/esm/api/types/BodyCreateCredentialsFromAuthorizationCodeSourceConnectionsSourceShortNameCodeToTokenCredentialsPost.d.mts +0 -13
- package/dist/esm/api/types/CancelSubscriptionRequest.d.mts +0 -11
- package/dist/esm/api/types/OAuth2AuthUrl.d.mts +0 -13
- package/dist/esm/api/types/SourceConnectionContinuousResponse.d.mts +0 -67
- package/dist/esm/api/types/SourceConnectionCreateContinuous.d.mts +0 -33
- package/dist/esm/api/types/SourceConnectionCreateWithCredential.d.mts +0 -25
- package/dist/esm/api/types/SourceConnectionCreateWithWhiteLabel.d.mts +0 -29
- package/dist/esm/api/types/SourceConnectionMakeContinuous.d.mts +0 -14
- package/dist/esm/api/types/WhiteLabel.d.mts +0 -32
- /package/dist/cjs/api/resources/{authProviders/client/requests/AuthProviderConnectionCreate.js → sourceConnections/client/requests/GetSourceConnectionJobsSourceConnectionsSourceConnectionIdJobsGetRequest.js} +0 -0
- /package/dist/cjs/api/{resources/collections/client/requests/CollectionUpdate.js → types/ActionCheckRequest.js} +0 -0
- /package/dist/cjs/api/{resources/sourceConnections/client/requests/BodyRunSourceConnectionsSourceConnectionIdRunPost.js → types/AuthProviderAuthentication.js} +0 -0
- /package/dist/cjs/api/{resources/sourceConnections/client/requests/GetSourceConnectionsSourceConnectionIdGetRequest.js → types/AuthProviderConnectionCreate.js} +0 -0
- /package/dist/cjs/api/{resources/whiteLabels/client/requests/BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions.js → types/AuthenticationDetails.js} +0 -0
- /package/dist/cjs/api/{resources/whiteLabels/client/requests/WhiteLabelCreate.js → types/CollectionUpdate.js} +0 -0
- /package/dist/cjs/api/{resources/whiteLabels/client/requests/WhiteLabelUpdate.js → types/DirectAuthentication.js} +0 -0
- /package/dist/cjs/api/types/{BodyCreateCredentialsFromAuthorizationCodeSourceConnectionsSourceShortNameCodeToTokenCredentialsPost.js → EntitySummary.js} +0 -0
- /package/dist/cjs/api/types/{CancelSubscriptionRequest.js → EntityTypeStats.js} +0 -0
- /package/dist/cjs/api/types/{OAuth2AuthUrl.js → MatchPhrase.js} +0 -0
- /package/dist/cjs/api/types/{SourceConnectionContinuousResponse.js → OAuthBrowserAuthentication.js} +0 -0
- /package/dist/cjs/api/types/{SourceConnectionCreateContinuous.js → OAuthTokenAuthentication.js} +0 -0
- /package/dist/cjs/api/types/{SourceConnectionCreateWithCredential.js → ScheduleConfig.js} +0 -0
- /package/dist/cjs/api/types/{SourceConnectionCreateWithWhiteLabel.js → ScheduleDetails.js} +0 -0
- /package/dist/cjs/api/types/{SourceConnectionMakeContinuous.js → SyncDetails.js} +0 -0
- /package/dist/cjs/api/types/{WhiteLabel.js → SyncJobDetails.js} +0 -0
- /package/dist/cjs/{api/resources/authProviders/client/requests/index.js → core/fetcher/EndpointMetadata.js} +0 -0
- /package/dist/esm/api/resources/{authProviders/client/requests/AuthProviderConnectionCreate.mjs → sourceConnections/client/requests/GetSourceConnectionJobsSourceConnectionsSourceConnectionIdJobsGetRequest.mjs} +0 -0
- /package/dist/esm/api/{resources/collections/client/requests/CollectionUpdate.mjs → types/ActionCheckRequest.mjs} +0 -0
- /package/dist/esm/api/{resources/sourceConnections/client/requests/BodyRunSourceConnectionsSourceConnectionIdRunPost.mjs → types/AuthProviderAuthentication.mjs} +0 -0
- /package/dist/esm/api/{resources/sourceConnections/client/requests/GetSourceConnectionsSourceConnectionIdGetRequest.mjs → types/AuthProviderConnectionCreate.mjs} +0 -0
- /package/dist/esm/api/{resources/whiteLabels/client/requests/BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions.mjs → types/AuthenticationDetails.mjs} +0 -0
- /package/dist/esm/api/{resources/whiteLabels/client/requests/WhiteLabelCreate.mjs → types/CollectionUpdate.mjs} +0 -0
- /package/dist/esm/api/{resources/whiteLabels/client/requests/WhiteLabelUpdate.mjs → types/DirectAuthentication.mjs} +0 -0
- /package/dist/esm/api/types/{BodyCreateCredentialsFromAuthorizationCodeSourceConnectionsSourceShortNameCodeToTokenCredentialsPost.mjs → EntitySummary.mjs} +0 -0
- /package/dist/esm/api/types/{CancelSubscriptionRequest.mjs → EntityTypeStats.mjs} +0 -0
- /package/dist/esm/api/types/{OAuth2AuthUrl.mjs → MatchPhrase.mjs} +0 -0
- /package/dist/esm/api/types/{SourceConnectionContinuousResponse.mjs → OAuthBrowserAuthentication.mjs} +0 -0
- /package/dist/esm/api/types/{SourceConnectionCreateContinuous.mjs → OAuthTokenAuthentication.mjs} +0 -0
- /package/dist/esm/api/types/{SourceConnectionCreateWithCredential.mjs → ScheduleConfig.mjs} +0 -0
- /package/dist/esm/api/types/{SourceConnectionCreateWithWhiteLabel.mjs → ScheduleDetails.mjs} +0 -0
- /package/dist/esm/api/types/{SourceConnectionMakeContinuous.mjs → SyncDetails.mjs} +0 -0
- /package/dist/esm/api/types/{WhiteLabel.mjs → SyncJobDetails.mjs} +0 -0
- /package/dist/esm/{api/resources/authProviders/client/requests/index.mjs → core/fetcher/EndpointMetadata.mjs} +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { APIResponse } from "./APIResponse.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { EndpointMetadata } from "./EndpointMetadata.mjs";
|
|
3
|
+
import { EndpointSupplier } from "./EndpointSupplier.mjs";
|
|
3
4
|
export type FetchFunction = <R = unknown>(args: Fetcher.Args) => Promise<APIResponse<R, Fetcher.Error>>;
|
|
4
5
|
export declare namespace Fetcher {
|
|
5
6
|
interface Args {
|
|
6
7
|
url: string;
|
|
7
8
|
method: string;
|
|
8
9
|
contentType?: string;
|
|
9
|
-
headers?: Record<string, string |
|
|
10
|
-
queryParameters?: Record<string,
|
|
10
|
+
headers?: Record<string, string | EndpointSupplier<string | null | undefined> | null | undefined>;
|
|
11
|
+
queryParameters?: Record<string, unknown>;
|
|
11
12
|
body?: unknown;
|
|
12
13
|
timeoutMs?: number;
|
|
13
14
|
maxRetries?: number;
|
|
@@ -16,6 +17,7 @@ export declare namespace Fetcher {
|
|
|
16
17
|
requestType?: "json" | "file" | "bytes";
|
|
17
18
|
responseType?: "json" | "blob" | "sse" | "streaming" | "text" | "arrayBuffer" | "binary-response";
|
|
18
19
|
duplex?: "half";
|
|
20
|
+
endpointMetadata?: EndpointMetadata;
|
|
19
21
|
}
|
|
20
22
|
type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError;
|
|
21
23
|
interface FailedStatusCodeError {
|
|
@@ -8,17 +8,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { toJson } from "../json.mjs";
|
|
11
|
-
import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
|
|
12
|
-
import { Supplier } from "./Supplier.mjs";
|
|
13
11
|
import { createRequestUrl } from "./createRequestUrl.mjs";
|
|
12
|
+
import { EndpointSupplier } from "./EndpointSupplier.mjs";
|
|
14
13
|
import { getErrorResponseBody } from "./getErrorResponseBody.mjs";
|
|
15
14
|
import { getFetchFn } from "./getFetchFn.mjs";
|
|
16
15
|
import { getRequestBody } from "./getRequestBody.mjs";
|
|
17
16
|
import { getResponseBody } from "./getResponseBody.mjs";
|
|
18
17
|
import { makeRequest } from "./makeRequest.mjs";
|
|
18
|
+
import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
|
|
19
19
|
import { requestWithRetries } from "./requestWithRetries.mjs";
|
|
20
20
|
function getHeaders(args) {
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
var _a;
|
|
22
23
|
const newHeaders = {};
|
|
23
24
|
if (args.body !== undefined && args.contentType != null) {
|
|
24
25
|
newHeaders["Content-Type"] = args.contentType;
|
|
@@ -27,7 +28,7 @@ function getHeaders(args) {
|
|
|
27
28
|
return newHeaders;
|
|
28
29
|
}
|
|
29
30
|
for (const [key, value] of Object.entries(args.headers)) {
|
|
30
|
-
const result = yield
|
|
31
|
+
const result = yield EndpointSupplier.get(value, { endpointMetadata: (_a = args.endpointMetadata) !== null && _a !== void 0 ? _a : {} });
|
|
31
32
|
if (typeof result === "string") {
|
|
32
33
|
newHeaders[key] = result;
|
|
33
34
|
continue;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export type { APIResponse } from "./APIResponse.mjs";
|
|
2
|
-
export {
|
|
2
|
+
export type { BinaryResponse } from "./BinaryResponse.mjs";
|
|
3
|
+
export type { EndpointMetadata } from "./EndpointMetadata.mjs";
|
|
4
|
+
export { EndpointSupplier } from "./EndpointSupplier.mjs";
|
|
3
5
|
export type { Fetcher, FetchFunction } from "./Fetcher.mjs";
|
|
6
|
+
export { fetcher } from "./Fetcher.mjs";
|
|
4
7
|
export { getHeader } from "./getHeader.mjs";
|
|
5
|
-
export { Supplier } from "./Supplier.mjs";
|
|
6
|
-
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
|
|
7
|
-
export type { RawResponse, WithRawResponse } from "./RawResponse.mjs";
|
|
8
8
|
export { HttpResponsePromise } from "./HttpResponsePromise.mjs";
|
|
9
|
-
export {
|
|
9
|
+
export type { RawResponse, WithRawResponse } from "./RawResponse.mjs";
|
|
10
|
+
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
|
|
11
|
+
export { Supplier } from "./Supplier.mjs";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
export { EndpointSupplier } from "./EndpointSupplier.mjs";
|
|
1
2
|
export { fetcher } from "./Fetcher.mjs";
|
|
2
3
|
export { getHeader } from "./getHeader.mjs";
|
|
3
|
-
export { Supplier } from "./Supplier.mjs";
|
|
4
|
-
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
|
|
5
4
|
export { HttpResponsePromise } from "./HttpResponsePromise.mjs";
|
|
5
|
+
export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
|
|
6
|
+
export { Supplier } from "./Supplier.mjs";
|
|
@@ -11,21 +11,57 @@ const INITIAL_RETRY_DELAY = 1000; // in milliseconds
|
|
|
11
11
|
const MAX_RETRY_DELAY = 60000; // in milliseconds
|
|
12
12
|
const DEFAULT_MAX_RETRIES = 2;
|
|
13
13
|
const JITTER_FACTOR = 0.2; // 20% random jitter
|
|
14
|
-
function
|
|
15
|
-
// Generate a random value between
|
|
16
|
-
const jitterMultiplier = 1 +
|
|
14
|
+
function addPositiveJitter(delay) {
|
|
15
|
+
// Generate a random value between 0 and +JITTER_FACTOR
|
|
16
|
+
const jitterMultiplier = 1 + Math.random() * JITTER_FACTOR;
|
|
17
17
|
return delay * jitterMultiplier;
|
|
18
18
|
}
|
|
19
|
+
function addSymmetricJitter(delay) {
|
|
20
|
+
// Generate a random value in a JITTER_FACTOR-sized percentage range around delay
|
|
21
|
+
const jitterMultiplier = 1 + (Math.random() - 0.5) * JITTER_FACTOR;
|
|
22
|
+
return delay * jitterMultiplier;
|
|
23
|
+
}
|
|
24
|
+
function getRetryDelayFromHeaders(response, retryAttempt) {
|
|
25
|
+
// Check for Retry-After header first (RFC 7231), with no jitter
|
|
26
|
+
const retryAfter = response.headers.get("Retry-After");
|
|
27
|
+
if (retryAfter) {
|
|
28
|
+
// Parse as number of seconds...
|
|
29
|
+
const retryAfterSeconds = parseInt(retryAfter, 10);
|
|
30
|
+
if (!isNaN(retryAfterSeconds) && retryAfterSeconds > 0) {
|
|
31
|
+
return Math.min(retryAfterSeconds * 1000, MAX_RETRY_DELAY);
|
|
32
|
+
}
|
|
33
|
+
// ...or as an HTTP date; both are valid
|
|
34
|
+
const retryAfterDate = new Date(retryAfter);
|
|
35
|
+
if (!isNaN(retryAfterDate.getTime())) {
|
|
36
|
+
const delay = retryAfterDate.getTime() - Date.now();
|
|
37
|
+
if (delay > 0) {
|
|
38
|
+
return Math.min(Math.max(delay, 0), MAX_RETRY_DELAY);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// Then check for industry-standard X-RateLimit-Reset header, with positive jitter
|
|
43
|
+
const rateLimitReset = response.headers.get("X-RateLimit-Reset");
|
|
44
|
+
if (rateLimitReset) {
|
|
45
|
+
const resetTime = parseInt(rateLimitReset, 10);
|
|
46
|
+
if (!isNaN(resetTime)) {
|
|
47
|
+
// Assume Unix timestamp in epoch seconds
|
|
48
|
+
const delay = resetTime * 1000 - Date.now();
|
|
49
|
+
if (delay > 0) {
|
|
50
|
+
return addPositiveJitter(Math.min(delay, MAX_RETRY_DELAY));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Fall back to exponential backoff, with symmetric jitter
|
|
55
|
+
return addSymmetricJitter(Math.min(INITIAL_RETRY_DELAY * Math.pow(2, retryAttempt), MAX_RETRY_DELAY));
|
|
56
|
+
}
|
|
19
57
|
export function requestWithRetries(requestFn_1) {
|
|
20
58
|
return __awaiter(this, arguments, void 0, function* (requestFn, maxRetries = DEFAULT_MAX_RETRIES) {
|
|
21
59
|
let response = yield requestFn();
|
|
22
60
|
for (let i = 0; i < maxRetries; ++i) {
|
|
23
61
|
if ([408, 429].includes(response.status) || response.status >= 500) {
|
|
24
|
-
//
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
const delayWithJitter = addJitter(baseDelay);
|
|
28
|
-
yield new Promise((resolve) => setTimeout(resolve, delayWithJitter));
|
|
62
|
+
// Get delay with appropriate jitter applied
|
|
63
|
+
const delay = getRetryDelayFromHeaders(response, i);
|
|
64
|
+
yield new Promise((resolve) => setTimeout(resolve, delay));
|
|
29
65
|
response = yield requestFn();
|
|
30
66
|
}
|
|
31
67
|
else {
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function mergeOnlyDefinedHeaders(...headersArray: (Record<string, string | core.Supplier<string | undefined> | undefined> | undefined)[]): Record<string, string | core.Supplier<string | undefined>>;
|
|
1
|
+
export declare function mergeHeaders<THeaderValue>(...headersArray: (Record<string, THeaderValue> | null | undefined)[]): Record<string, string | THeaderValue>;
|
|
2
|
+
export declare function mergeOnlyDefinedHeaders<THeaderValue>(...headersArray: (Record<string, THeaderValue> | null | undefined)[]): Record<string, THeaderValue>;
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "v0.6.
|
|
1
|
+
export declare const SDK_VERSION = "v0.6.26";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "v0.6.
|
|
1
|
+
export const SDK_VERSION = "v0.6.26";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airweave/sdk",
|
|
3
|
-
"version": "v0.6.
|
|
3
|
+
"version": "v0.6.26",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": "github:airweave-ai/typescript-sdk",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -30,23 +30,18 @@
|
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
32
|
"format": "prettier . --write --ignore-unknown",
|
|
33
|
-
"build": "
|
|
33
|
+
"build": "pnpm build:cjs && pnpm build:esm",
|
|
34
34
|
"build:cjs": "tsc --project ./tsconfig.cjs.json",
|
|
35
35
|
"build:esm": "tsc --project ./tsconfig.esm.json && node scripts/rename-to-esm-files.js dist/esm",
|
|
36
|
-
"test": "
|
|
37
|
-
"test:unit": "
|
|
38
|
-
"test:
|
|
39
|
-
"test:wire": "jest --selectProjects wire"
|
|
36
|
+
"test": "vitest",
|
|
37
|
+
"test:unit": "vitest --project unit",
|
|
38
|
+
"test:wire": "vitest --project wire"
|
|
40
39
|
},
|
|
41
40
|
"devDependencies": {
|
|
42
41
|
"webpack": "^5.97.1",
|
|
43
42
|
"ts-loader": "^9.5.1",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"@types/jest": "^29.5.14",
|
|
47
|
-
"ts-jest": "^29.3.4",
|
|
48
|
-
"jest-environment-jsdom": "^29.7.0",
|
|
49
|
-
"msw": "^2.8.4",
|
|
43
|
+
"vitest": "^3.2.4",
|
|
44
|
+
"msw": "2.11.2",
|
|
50
45
|
"@types/node": "^18.19.70",
|
|
51
46
|
"prettier": "^3.4.2",
|
|
52
47
|
"typescript": "~5.7.2"
|
|
@@ -57,7 +52,7 @@
|
|
|
57
52
|
"path": false,
|
|
58
53
|
"stream": false
|
|
59
54
|
},
|
|
60
|
-
"packageManager": "
|
|
55
|
+
"packageManager": "pnpm@10.14.0",
|
|
61
56
|
"engines": {
|
|
62
57
|
"node": ">=18.0.0"
|
|
63
58
|
},
|