@airweave/sdk 0.3.45 → 0.3.47
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/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/sourceConnections/client/requests/SourceConnectionCreate.d.ts +4 -0
- package/dist/cjs/api/resources/sourceConnections/client/requests/SourceConnectionUpdate.d.ts +4 -0
- package/dist/cjs/api/resources/whiteLabels/client/Client.d.ts +7 -7
- package/dist/cjs/api/resources/whiteLabels/client/Client.js +9 -9
- package/dist/cjs/api/resources/whiteLabels/client/requests/{BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodePost.d.ts → BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions.d.ts} +1 -1
- package/dist/cjs/api/resources/whiteLabels/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/types/AuthProvider.d.ts +32 -0
- package/dist/cjs/api/types/AuthProvider.js +5 -0
- package/dist/cjs/api/types/AuthProviderConnection.d.ts +21 -0
- package/dist/cjs/api/types/AuthProviderConnection.js +5 -0
- package/dist/cjs/api/types/AuthProviderConnectionCreate.d.ts +19 -0
- package/dist/cjs/api/types/AuthProviderConnectionCreate.js +5 -0
- package/dist/cjs/api/types/AuthProviderConnectionUpdate.d.ts +15 -0
- package/dist/cjs/api/types/AuthProviderConnectionUpdate.js +5 -0
- package/dist/cjs/api/types/ConfigField.d.ts +1 -0
- package/dist/cjs/api/types/Connection.d.ts +9 -0
- package/dist/cjs/api/types/IntegrationType.d.ts +2 -1
- package/dist/cjs/api/types/IntegrationType.js +1 -0
- package/dist/cjs/api/types/SourceConnection.d.ts +4 -0
- package/dist/cjs/api/types/index.d.ts +4 -0
- package/dist/cjs/api/types/index.js +4 -0
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +7 -4
- package/dist/cjs/core/fetcher/BinaryResponse.js +5 -2
- package/dist/cjs/core/fetcher/Fetcher.js +3 -3
- package/dist/cjs/core/fetcher/getErrorResponseBody.d.ts +1 -0
- package/dist/cjs/core/fetcher/getErrorResponseBody.js +44 -0
- package/dist/cjs/core/fetcher/getFetchFn.d.ts +1 -4
- package/dist/cjs/core/fetcher/getFetchFn.js +1 -52
- package/dist/cjs/core/fetcher/getResponseBody.js +3 -3
- package/dist/cjs/core/url/join.js +23 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/sourceConnections/client/requests/SourceConnectionCreate.d.mts +4 -0
- package/dist/esm/api/resources/sourceConnections/client/requests/SourceConnectionUpdate.d.mts +4 -0
- package/dist/esm/api/resources/whiteLabels/client/Client.d.mts +7 -7
- package/dist/esm/api/resources/whiteLabels/client/Client.mjs +9 -9
- package/dist/esm/api/resources/whiteLabels/client/requests/{BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodePost.d.mts → BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions.d.mts} +1 -1
- package/dist/esm/api/resources/whiteLabels/client/requests/index.d.mts +1 -1
- package/dist/esm/api/types/AuthProvider.d.mts +32 -0
- package/dist/esm/api/types/AuthProvider.mjs +4 -0
- package/dist/esm/api/types/AuthProviderConnection.d.mts +21 -0
- package/dist/esm/api/types/AuthProviderConnection.mjs +4 -0
- package/dist/esm/api/types/AuthProviderConnectionCreate.d.mts +19 -0
- package/dist/esm/api/types/AuthProviderConnectionCreate.mjs +4 -0
- package/dist/esm/api/types/AuthProviderConnectionUpdate.d.mts +15 -0
- package/dist/esm/api/types/AuthProviderConnectionUpdate.mjs +4 -0
- package/dist/esm/api/types/ConfigField.d.mts +1 -0
- package/dist/esm/api/types/Connection.d.mts +9 -0
- package/dist/esm/api/types/IntegrationType.d.mts +2 -1
- package/dist/esm/api/types/IntegrationType.mjs +1 -0
- package/dist/esm/api/types/SourceConnection.d.mts +4 -0
- package/dist/esm/api/types/index.d.mts +4 -0
- package/dist/esm/api/types/index.mjs +4 -0
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +7 -4
- package/dist/esm/core/fetcher/BinaryResponse.mjs +5 -2
- package/dist/esm/core/fetcher/Fetcher.mjs +3 -3
- package/dist/esm/core/fetcher/getErrorResponseBody.d.mts +1 -0
- package/dist/esm/core/fetcher/getErrorResponseBody.mjs +41 -0
- package/dist/esm/core/fetcher/getFetchFn.d.mts +1 -4
- package/dist/esm/core/fetcher/getFetchFn.mjs +1 -19
- package/dist/esm/core/fetcher/getResponseBody.mjs +3 -3
- package/dist/esm/core/url/join.mjs +23 -3
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +14 -16
- package/reference.md +5 -5
- package/dist/cjs/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +0 -30
- package/dist/cjs/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +0 -247
- package/dist/cjs/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -21
- package/dist/cjs/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +0 -126
- package/dist/cjs/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +0 -31
- package/dist/cjs/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +0 -229
- package/dist/cjs/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +0 -18
- package/dist/cjs/core/fetcher/stream-wrappers/chooseStreamWrapper.js +0 -59
- package/dist/esm/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.mts +0 -30
- package/dist/esm/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.mjs +0 -243
- package/dist/esm/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.mts +0 -21
- package/dist/esm/core/fetcher/stream-wrappers/NodePre18StreamWrapper.mjs +0 -122
- package/dist/esm/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.mts +0 -31
- package/dist/esm/core/fetcher/stream-wrappers/UndiciStreamWrapper.mjs +0 -225
- package/dist/esm/core/fetcher/stream-wrappers/chooseStreamWrapper.d.mts +0 -18
- package/dist/esm/core/fetcher/stream-wrappers/chooseStreamWrapper.mjs +0 -23
- /package/dist/cjs/api/resources/whiteLabels/client/requests/{BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodePost.js → BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions.js} +0 -0
- /package/dist/esm/api/resources/whiteLabels/client/requests/{BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodePost.mjs → BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions.mjs} +0 -0
package/dist/cjs/Client.js
CHANGED
|
@@ -50,8 +50,8 @@ class AirweaveSDKClient {
|
|
|
50
50
|
"X-Organization-ID": _options === null || _options === void 0 ? void 0 : _options.organizationId,
|
|
51
51
|
"X-Fern-Language": "JavaScript",
|
|
52
52
|
"X-Fern-SDK-Name": "@airweave/sdk",
|
|
53
|
-
"X-Fern-SDK-Version": "v0.3.
|
|
54
|
-
"User-Agent": "@airweave/sdk/v0.3.
|
|
53
|
+
"X-Fern-SDK-Version": "v0.3.47",
|
|
54
|
+
"User-Agent": "@airweave/sdk/v0.3.47",
|
|
55
55
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
56
56
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
57
57
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
package/dist/cjs/api/resources/sourceConnections/client/requests/SourceConnectionCreate.d.ts
CHANGED
|
@@ -24,6 +24,10 @@ export interface SourceConnectionCreate {
|
|
|
24
24
|
cron_schedule?: string;
|
|
25
25
|
/** Authentication credentials required to access the data source. The required fields vary by source type. Check the documentation of a specific source (for example [Github](https://docs.airweave.ai/docs/connectors/github)) to see what is required. */
|
|
26
26
|
auth_fields?: AirweaveSDK.ConfigValues;
|
|
27
|
+
/** Unique readable ID of a connected auth provider to use for authentication instead of providing auth_fields directly. When specified, credentials for the source will be obtained and refreshed automatically by Airweave interaction with the auth provider. To see which auth providers are supported and learn more about how to use them, check [this page](https://docs.airweave.ai/docs/auth-providers). */
|
|
28
|
+
auth_provider?: string;
|
|
29
|
+
/** Configuration for the auth provider when using auth_provider field. Required fields vary by auth provider. For Composio, use integration_id and account_id to specify which integration and account from Composio you want to use to connect to the source. */
|
|
30
|
+
auth_provider_config?: AirweaveSDK.ConfigValues;
|
|
27
31
|
/** Whether to start an initial data synchronization immediately after creating the connection. */
|
|
28
32
|
sync_immediately?: boolean;
|
|
29
33
|
}
|
package/dist/cjs/api/resources/sourceConnections/client/requests/SourceConnectionUpdate.d.ts
CHANGED
|
@@ -21,6 +21,10 @@ export interface SourceConnectionUpdate {
|
|
|
21
21
|
connection_id?: string;
|
|
22
22
|
/** ID of the white label integration. Used for custom OAuth integrations with your own branding. */
|
|
23
23
|
white_label_id?: string;
|
|
24
|
+
/** Updated auth provider readable ID. Only relevant if the connection uses an auth provider. */
|
|
25
|
+
auth_provider?: string;
|
|
26
|
+
/** Updated configuration for the auth provider. Only relevant if the connection uses an auth provider. */
|
|
27
|
+
auth_provider_config?: Record<string, unknown>;
|
|
24
28
|
}
|
|
25
29
|
export declare namespace SourceConnectionUpdate {
|
|
26
30
|
/**
|
|
@@ -147,10 +147,10 @@ export declare class WhiteLabels {
|
|
|
147
147
|
* @throws {@link AirweaveSDK.UnprocessableEntityError}
|
|
148
148
|
*
|
|
149
149
|
* @example
|
|
150
|
-
* await client.whiteLabels.
|
|
150
|
+
* await client.whiteLabels.getWhiteLabelOauth2AuthUrlWhiteLabelsWhiteLabelIdOauth2AuthUrlOptions("white_label_id")
|
|
151
151
|
*/
|
|
152
|
-
|
|
153
|
-
private
|
|
152
|
+
getWhiteLabelOauth2AuthUrlWhiteLabelsWhiteLabelIdOauth2AuthUrlOptions(whiteLabelId: string, requestOptions?: WhiteLabels.RequestOptions): core.HttpResponsePromise<string>;
|
|
153
|
+
private __getWhiteLabelOauth2AuthUrlWhiteLabelsWhiteLabelIdOauth2AuthUrlOptions;
|
|
154
154
|
/**
|
|
155
155
|
* List all source connections created through a specific white label integration.
|
|
156
156
|
*
|
|
@@ -178,16 +178,16 @@ export declare class WhiteLabels {
|
|
|
178
178
|
* tracking and branding purposes.
|
|
179
179
|
*
|
|
180
180
|
* @param {string} whiteLabelId - The unique identifier of the white label integration
|
|
181
|
-
* @param {AirweaveSDK.
|
|
181
|
+
* @param {AirweaveSDK.BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions} request
|
|
182
182
|
* @param {WhiteLabels.RequestOptions} requestOptions - Request-specific configuration.
|
|
183
183
|
*
|
|
184
184
|
* @throws {@link AirweaveSDK.UnprocessableEntityError}
|
|
185
185
|
*
|
|
186
186
|
* @example
|
|
187
|
-
* await client.whiteLabels.
|
|
187
|
+
* await client.whiteLabels.exchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions("white_label_id", {
|
|
188
188
|
* code: "4/P7q7W91a-oMsCeLvIaQm6bTrgtp7"
|
|
189
189
|
* })
|
|
190
190
|
*/
|
|
191
|
-
|
|
192
|
-
private
|
|
191
|
+
exchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions(whiteLabelId: string, request: AirweaveSDK.BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions, requestOptions?: WhiteLabels.RequestOptions): core.HttpResponsePromise<AirweaveSDK.SourceConnection>;
|
|
192
|
+
private __exchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions;
|
|
193
193
|
}
|
|
@@ -409,12 +409,12 @@ class WhiteLabels {
|
|
|
409
409
|
* @throws {@link AirweaveSDK.UnprocessableEntityError}
|
|
410
410
|
*
|
|
411
411
|
* @example
|
|
412
|
-
* await client.whiteLabels.
|
|
412
|
+
* await client.whiteLabels.getWhiteLabelOauth2AuthUrlWhiteLabelsWhiteLabelIdOauth2AuthUrlOptions("white_label_id")
|
|
413
413
|
*/
|
|
414
|
-
|
|
415
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
414
|
+
getWhiteLabelOauth2AuthUrlWhiteLabelsWhiteLabelIdOauth2AuthUrlOptions(whiteLabelId, requestOptions) {
|
|
415
|
+
return core.HttpResponsePromise.fromPromise(this.__getWhiteLabelOauth2AuthUrlWhiteLabelsWhiteLabelIdOauth2AuthUrlOptions(whiteLabelId, requestOptions));
|
|
416
416
|
}
|
|
417
|
-
|
|
417
|
+
__getWhiteLabelOauth2AuthUrlWhiteLabelsWhiteLabelIdOauth2AuthUrlOptions(whiteLabelId, requestOptions) {
|
|
418
418
|
return __awaiter(this, void 0, void 0, function* () {
|
|
419
419
|
var _a, _b, _c;
|
|
420
420
|
const _response = yield core.fetcher({
|
|
@@ -537,20 +537,20 @@ class WhiteLabels {
|
|
|
537
537
|
* tracking and branding purposes.
|
|
538
538
|
*
|
|
539
539
|
* @param {string} whiteLabelId - The unique identifier of the white label integration
|
|
540
|
-
* @param {AirweaveSDK.
|
|
540
|
+
* @param {AirweaveSDK.BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions} request
|
|
541
541
|
* @param {WhiteLabels.RequestOptions} requestOptions - Request-specific configuration.
|
|
542
542
|
*
|
|
543
543
|
* @throws {@link AirweaveSDK.UnprocessableEntityError}
|
|
544
544
|
*
|
|
545
545
|
* @example
|
|
546
|
-
* await client.whiteLabels.
|
|
546
|
+
* await client.whiteLabels.exchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions("white_label_id", {
|
|
547
547
|
* code: "4/P7q7W91a-oMsCeLvIaQm6bTrgtp7"
|
|
548
548
|
* })
|
|
549
549
|
*/
|
|
550
|
-
|
|
551
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
550
|
+
exchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions(whiteLabelId, request, requestOptions) {
|
|
551
|
+
return core.HttpResponsePromise.fromPromise(this.__exchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions(whiteLabelId, request, requestOptions));
|
|
552
552
|
}
|
|
553
|
-
|
|
553
|
+
__exchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions(whiteLabelId, request, requestOptions) {
|
|
554
554
|
return __awaiter(this, void 0, void 0, function* () {
|
|
555
555
|
var _a, _b, _c;
|
|
556
556
|
const _response = yield core.fetcher({
|
|
@@ -8,7 +8,7 @@ import * as AirweaveSDK from "../../../../index.js";
|
|
|
8
8
|
* code: "4/P7q7W91a-oMsCeLvIaQm6bTrgtp7"
|
|
9
9
|
* }
|
|
10
10
|
*/
|
|
11
|
-
export interface
|
|
11
|
+
export interface BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions {
|
|
12
12
|
/** The OAuth2 authorization code received from the OAuth callback after customer authentication */
|
|
13
13
|
code: string;
|
|
14
14
|
/** Optional configuration for the source connection. If not provided, a source connection will be created automatically with default settings. The white label integration is automatically linked to the source connection. */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { type WhiteLabelCreate } from "./WhiteLabelCreate.js";
|
|
2
2
|
export { type WhiteLabelUpdate } from "./WhiteLabelUpdate.js";
|
|
3
|
-
export { type
|
|
3
|
+
export { type BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions } from "./BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions.js";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as AirweaveSDK from "../index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Schema for auth provider response.
|
|
7
|
+
*/
|
|
8
|
+
export interface AuthProvider {
|
|
9
|
+
/** Human-readable name of the auth provider (e.g., 'Google OAuth', 'GitHub') */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Technical identifier used internally to reference this auth provider. Must be unique. */
|
|
12
|
+
short_name: string;
|
|
13
|
+
/** Python class name of the auth provider implementation */
|
|
14
|
+
class_name: string;
|
|
15
|
+
/** Python class name that defines the authentication configuration fields */
|
|
16
|
+
auth_config_class: string;
|
|
17
|
+
/** Python class name that defines the auth provider-specific configuration */
|
|
18
|
+
config_class: string;
|
|
19
|
+
/** Type of authentication mechanism used by this provider */
|
|
20
|
+
auth_type: AirweaveSDK.AuthType;
|
|
21
|
+
/** Detailed description explaining what this auth provider offers */
|
|
22
|
+
description?: string;
|
|
23
|
+
/** Organization identifier for custom auth providers. System providers have this set to null. */
|
|
24
|
+
organization_id?: string;
|
|
25
|
+
id: string;
|
|
26
|
+
created_at: string;
|
|
27
|
+
modified_at: string;
|
|
28
|
+
/** Dynamically populated field definitions for authentication configuration. These describe what credentials are required to connect to this auth provider. */
|
|
29
|
+
auth_fields?: AirweaveSDK.Fields;
|
|
30
|
+
/** Dynamically populated field definitions for auth provider-specific configuration. These describe what additional configuration is required when using this auth provider to connect to a source (e.g., integration_id and account_id for Composio). */
|
|
31
|
+
config_fields?: AirweaveSDK.Fields;
|
|
32
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Schema for auth provider connection response.
|
|
6
|
+
*/
|
|
7
|
+
export interface AuthProviderConnection {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
/** URL-safe unique identifier that can be used to reference this connection when setting up source connections. */
|
|
11
|
+
readable_id: string;
|
|
12
|
+
short_name: string;
|
|
13
|
+
/** Description of the connection */
|
|
14
|
+
description?: string;
|
|
15
|
+
/** Email of the user who created this connection */
|
|
16
|
+
created_by_email?: string;
|
|
17
|
+
/** Email of the user who last modified this connection */
|
|
18
|
+
modified_by_email?: string;
|
|
19
|
+
created_at: string;
|
|
20
|
+
modified_at: string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as AirweaveSDK from "../index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Schema for creating an auth provider connection with credentials.
|
|
7
|
+
*/
|
|
8
|
+
export interface AuthProviderConnectionCreate {
|
|
9
|
+
/** Human-readable name for this auth provider connection */
|
|
10
|
+
name: string;
|
|
11
|
+
/** URL-safe unique identifier for the connection. Must contain only lowercase letters, numbers, and hyphens. If not provided, it will be automatically generated from the connection name with a random suffix for uniqueness (e.g., 'composio-connection-ab123'). */
|
|
12
|
+
readable_id?: string;
|
|
13
|
+
/** Optional detailed description of what this auth provider connection provides. */
|
|
14
|
+
description?: string;
|
|
15
|
+
/** Technical identifier of the auth provider */
|
|
16
|
+
short_name: string;
|
|
17
|
+
/** Authentication credentials required to access the auth provider. The required fields vary by auth provider type. */
|
|
18
|
+
auth_fields?: AirweaveSDK.ConfigValues;
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as AirweaveSDK from "../index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Schema for updating an auth provider connection.
|
|
7
|
+
*/
|
|
8
|
+
export interface AuthProviderConnectionUpdate {
|
|
9
|
+
/** Human-readable name for this auth provider connection */
|
|
10
|
+
name?: string;
|
|
11
|
+
/** Optional detailed description of what this auth provider connection provides. */
|
|
12
|
+
description?: string;
|
|
13
|
+
/** Updated authentication credentials for the auth provider. The required fields vary by auth provider type. If provided, all existing credentials will be replaced. */
|
|
14
|
+
auth_fields?: AirweaveSDK.ConfigValues;
|
|
15
|
+
}
|
|
@@ -6,12 +6,21 @@ import * as AirweaveSDK from "../index.js";
|
|
|
6
6
|
* Schema for connection with config fields.
|
|
7
7
|
*/
|
|
8
8
|
export interface Connection {
|
|
9
|
+
/** Human-readable display name for the connection. */
|
|
9
10
|
name: string;
|
|
11
|
+
/** URL-safe unique identifier used in API endpoints. This becomes non-optional once the connection is created. */
|
|
12
|
+
readable_id: string;
|
|
13
|
+
description?: string;
|
|
10
14
|
integration_type: AirweaveSDK.IntegrationType;
|
|
11
15
|
integration_credential_id?: string;
|
|
12
16
|
status: AirweaveSDK.ConnectionStatus;
|
|
13
17
|
short_name: string;
|
|
18
|
+
/** Unique system identifier for the connection. */
|
|
14
19
|
id: string;
|
|
20
|
+
/** Timestamp when the connection was created (ISO 8601 format). */
|
|
21
|
+
created_at: string;
|
|
22
|
+
/** Timestamp when the connection was last modified (ISO 8601 format). */
|
|
23
|
+
modified_at: string;
|
|
15
24
|
organization_id?: string;
|
|
16
25
|
created_by_email?: string;
|
|
17
26
|
modified_by_email?: string;
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Integration type enum.
|
|
6
6
|
*/
|
|
7
|
-
export type IntegrationType = "source" | "destination" | "embedding_model";
|
|
7
|
+
export type IntegrationType = "source" | "destination" | "embedding_model" | "auth_provider";
|
|
8
8
|
export declare const IntegrationType: {
|
|
9
9
|
readonly Source: "source";
|
|
10
10
|
readonly Destination: "destination";
|
|
11
11
|
readonly EmbeddingModel: "embedding_model";
|
|
12
|
+
readonly AuthProvider: "auth_provider";
|
|
12
13
|
};
|
|
@@ -16,6 +16,10 @@ export interface SourceConnection {
|
|
|
16
16
|
short_name: string;
|
|
17
17
|
/** Identifier for custom OAuth integrations. Only present for connections created through white label OAuth flows. */
|
|
18
18
|
white_label_id?: string;
|
|
19
|
+
/** Readable ID of the auth provider used to create this connection. Present only if the connection was created through an auth provider. */
|
|
20
|
+
auth_provider?: string;
|
|
21
|
+
/** Configuration used with the auth provider to create this connection. Present only if the connection was created through an auth provider. */
|
|
22
|
+
auth_provider_config?: Record<string, unknown>;
|
|
19
23
|
/** Unique system identifier for this source connection. This UUID is generated automatically and used for API operations. */
|
|
20
24
|
id: string;
|
|
21
25
|
/** Internal identifier for the sync configuration associated with this source connection. Managed automatically by the system. */
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export * from "./ApiKey.js";
|
|
2
2
|
export * from "./ApiKeyCreate.js";
|
|
3
|
+
export * from "./AuthProvider.js";
|
|
4
|
+
export * from "./AuthProviderConnection.js";
|
|
5
|
+
export * from "./AuthProviderConnectionCreate.js";
|
|
6
|
+
export * from "./AuthProviderConnectionUpdate.js";
|
|
3
7
|
export * from "./AuthType.js";
|
|
4
8
|
export * from "./BodyConnectSlackWithTokenConnectionsDirectTokenSlackPost.js";
|
|
5
9
|
export * from "./BodyCreateCredentialsFromAuthorizationCodeSourceConnectionsSourceShortNameCodeToTokenCredentialsPost.js";
|
|
@@ -16,6 +16,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./ApiKey.js"), exports);
|
|
18
18
|
__exportStar(require("./ApiKeyCreate.js"), exports);
|
|
19
|
+
__exportStar(require("./AuthProvider.js"), exports);
|
|
20
|
+
__exportStar(require("./AuthProviderConnection.js"), exports);
|
|
21
|
+
__exportStar(require("./AuthProviderConnectionCreate.js"), exports);
|
|
22
|
+
__exportStar(require("./AuthProviderConnectionUpdate.js"), exports);
|
|
19
23
|
__exportStar(require("./AuthType.js"), exports);
|
|
20
24
|
__exportStar(require("./BodyConnectSlackWithTokenConnectionsDirectTokenSlackPost.js"), exports);
|
|
21
25
|
__exportStar(require("./BodyCreateCredentialsFromAuthorizationCodeSourceConnectionsSourceShortNameCodeToTokenCredentialsPost.js"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResponseWithBody } from "./ResponseWithBody.js";
|
|
2
|
-
export
|
|
2
|
+
export type BinaryResponse = {
|
|
3
3
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */
|
|
4
4
|
bodyUsed: boolean;
|
|
5
5
|
/**
|
|
@@ -11,7 +11,10 @@ export interface BinaryResponse {
|
|
|
11
11
|
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
12
12
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */
|
|
13
13
|
blob: () => Promise<Blob>;
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
/**
|
|
15
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes)
|
|
16
|
+
* Some versions of the Fetch API may not support this method.
|
|
17
|
+
*/
|
|
18
|
+
bytes?(): Promise<Uint8Array>;
|
|
19
|
+
};
|
|
17
20
|
export declare function getBinaryResponse(response: ResponseWithBody): BinaryResponse;
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getBinaryResponse = getBinaryResponse;
|
|
4
4
|
function getBinaryResponse(response) {
|
|
5
|
-
|
|
5
|
+
const binaryResponse = {
|
|
6
6
|
get bodyUsed() {
|
|
7
7
|
return response.bodyUsed;
|
|
8
8
|
},
|
|
9
9
|
stream: () => response.body,
|
|
10
10
|
arrayBuffer: response.arrayBuffer.bind(response),
|
|
11
11
|
blob: response.blob.bind(response),
|
|
12
|
-
bytes: response.bytes.bind(response),
|
|
13
12
|
};
|
|
13
|
+
if ("bytes" in response && typeof response.bytes === "function") {
|
|
14
|
+
binaryResponse.bytes = response.bytes.bind(response);
|
|
15
|
+
}
|
|
16
|
+
return binaryResponse;
|
|
14
17
|
}
|
|
@@ -15,6 +15,7 @@ const json_js_1 = require("../json.js");
|
|
|
15
15
|
const RawResponse_js_1 = require("./RawResponse.js");
|
|
16
16
|
const Supplier_js_1 = require("./Supplier.js");
|
|
17
17
|
const createRequestUrl_js_1 = require("./createRequestUrl.js");
|
|
18
|
+
const getErrorResponseBody_js_1 = require("./getErrorResponseBody.js");
|
|
18
19
|
const getFetchFn_js_1 = require("./getFetchFn.js");
|
|
19
20
|
const getRequestBody_js_1 = require("./getRequestBody.js");
|
|
20
21
|
const getResponseBody_js_1 = require("./getResponseBody.js");
|
|
@@ -55,11 +56,10 @@ function fetcherImpl(args) {
|
|
|
55
56
|
const response = yield (0, requestWithRetries_js_1.requestWithRetries)(() => __awaiter(this, void 0, void 0, function* () {
|
|
56
57
|
return (0, makeRequest_js_1.makeRequest)(fetchFn, url, args.method, yield getHeaders(args), requestBody, args.timeoutMs, args.abortSignal, args.withCredentials, args.duplex);
|
|
57
58
|
}), args.maxRetries);
|
|
58
|
-
const responseBody = yield (0, getResponseBody_js_1.getResponseBody)(response, args.responseType);
|
|
59
59
|
if (response.status >= 200 && response.status < 400) {
|
|
60
60
|
return {
|
|
61
61
|
ok: true,
|
|
62
|
-
body:
|
|
62
|
+
body: (yield (0, getResponseBody_js_1.getResponseBody)(response, args.responseType)),
|
|
63
63
|
headers: response.headers,
|
|
64
64
|
rawResponse: (0, RawResponse_js_1.toRawResponse)(response),
|
|
65
65
|
};
|
|
@@ -70,7 +70,7 @@ function fetcherImpl(args) {
|
|
|
70
70
|
error: {
|
|
71
71
|
reason: "status-code",
|
|
72
72
|
statusCode: response.status,
|
|
73
|
-
body:
|
|
73
|
+
body: yield (0, getErrorResponseBody_js_1.getErrorResponseBody)(response),
|
|
74
74
|
},
|
|
75
75
|
rawResponse: (0, RawResponse_js_1.toRawResponse)(response),
|
|
76
76
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getErrorResponseBody(response: Response): Promise<unknown>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getErrorResponseBody = getErrorResponseBody;
|
|
13
|
+
const json_js_1 = require("../json.js");
|
|
14
|
+
const getResponseBody_js_1 = require("./getResponseBody.js");
|
|
15
|
+
function getErrorResponseBody(response) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
var _a, _b, _c;
|
|
18
|
+
let contentType = (_a = response.headers.get("Content-Type")) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
19
|
+
if (contentType == null || contentType.length === 0) {
|
|
20
|
+
return (0, getResponseBody_js_1.getResponseBody)(response);
|
|
21
|
+
}
|
|
22
|
+
if (contentType.indexOf(";") !== -1) {
|
|
23
|
+
contentType = (_c = (_b = contentType.split(";")[0]) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : "";
|
|
24
|
+
}
|
|
25
|
+
switch (contentType) {
|
|
26
|
+
case "application/hal+json":
|
|
27
|
+
case "application/json":
|
|
28
|
+
case "application/ld+json":
|
|
29
|
+
case "application/problem+json":
|
|
30
|
+
case "application/vnd.api+json":
|
|
31
|
+
case "text/json":
|
|
32
|
+
const text = yield response.text();
|
|
33
|
+
return text.length > 0 ? (0, json_js_1.fromJson)(text) : undefined;
|
|
34
|
+
default:
|
|
35
|
+
if (contentType.startsWith("application/vnd.") && contentType.endsWith("+json")) {
|
|
36
|
+
const text = yield response.text();
|
|
37
|
+
return text.length > 0 ? (0, json_js_1.fromJson)(text) : undefined;
|
|
38
|
+
}
|
|
39
|
+
// Fallback to plain text if content type is not recognized
|
|
40
|
+
// Even if no body is present, the response will be an empty string
|
|
41
|
+
return yield response.text();
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
@@ -1,37 +1,4 @@
|
|
|
1
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
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -43,26 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
10
|
};
|
|
44
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
12
|
exports.getFetchFn = getFetchFn;
|
|
46
|
-
const index_js_1 = require("../runtime/index.js");
|
|
47
|
-
/**
|
|
48
|
-
* Returns a fetch function based on the runtime
|
|
49
|
-
*/
|
|
50
13
|
function getFetchFn() {
|
|
51
14
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
|
|
53
|
-
if (index_js_1.RUNTIME.type === "node" && index_js_1.RUNTIME.parsedVersion != null && index_js_1.RUNTIME.parsedVersion >= 18) {
|
|
54
|
-
return fetch;
|
|
55
|
-
}
|
|
56
|
-
// In Node.js 18 or lower environments, the SDK always uses`node-fetch`.
|
|
57
|
-
if (index_js_1.RUNTIME.type === "node") {
|
|
58
|
-
return (yield Promise.resolve().then(() => __importStar(require("node-fetch")))).default;
|
|
59
|
-
}
|
|
60
|
-
// Otherwise the SDK uses global fetch if available,
|
|
61
|
-
// and falls back to node-fetch.
|
|
62
|
-
if (typeof fetch == "function") {
|
|
63
|
-
return fetch;
|
|
64
|
-
}
|
|
65
|
-
// Defaults to node `node-fetch` if global fetch isn't available
|
|
66
|
-
return (yield Promise.resolve().then(() => __importStar(require("node-fetch")))).default;
|
|
15
|
+
return fetch;
|
|
67
16
|
});
|
|
68
17
|
}
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.getResponseBody = getResponseBody;
|
|
13
13
|
const BinaryResponse_js_1 = require("./BinaryResponse.js");
|
|
14
14
|
const ResponseWithBody_js_1 = require("./ResponseWithBody.js");
|
|
15
|
-
const
|
|
15
|
+
const json_js_1 = require("../json.js");
|
|
16
16
|
function getResponseBody(response, responseType) {
|
|
17
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
18
|
if (!(0, ResponseWithBody_js_1.isResponseWithBody)(response)) {
|
|
@@ -28,7 +28,7 @@ function getResponseBody(response, responseType) {
|
|
|
28
28
|
case "sse":
|
|
29
29
|
return response.body;
|
|
30
30
|
case "streaming":
|
|
31
|
-
return
|
|
31
|
+
return response.body;
|
|
32
32
|
case "text":
|
|
33
33
|
return yield response.text();
|
|
34
34
|
}
|
|
@@ -36,7 +36,7 @@ function getResponseBody(response, responseType) {
|
|
|
36
36
|
const text = yield response.text();
|
|
37
37
|
if (text.length > 0) {
|
|
38
38
|
try {
|
|
39
|
-
let responseBody =
|
|
39
|
+
let responseBody = (0, json_js_1.fromJson)(text);
|
|
40
40
|
return responseBody;
|
|
41
41
|
}
|
|
42
42
|
catch (err) {
|
|
@@ -5,6 +5,9 @@ function join(base, ...segments) {
|
|
|
5
5
|
if (!base) {
|
|
6
6
|
return "";
|
|
7
7
|
}
|
|
8
|
+
if (segments.length === 0) {
|
|
9
|
+
return base;
|
|
10
|
+
}
|
|
8
11
|
if (base.includes("://")) {
|
|
9
12
|
let url;
|
|
10
13
|
try {
|
|
@@ -14,24 +17,37 @@ function join(base, ...segments) {
|
|
|
14
17
|
// Fallback to path joining if URL is malformed
|
|
15
18
|
return joinPath(base, ...segments);
|
|
16
19
|
}
|
|
20
|
+
const lastSegment = segments[segments.length - 1];
|
|
21
|
+
const shouldPreserveTrailingSlash = lastSegment && lastSegment.endsWith("/");
|
|
17
22
|
for (const segment of segments) {
|
|
18
23
|
const cleanSegment = trimSlashes(segment);
|
|
19
24
|
if (cleanSegment) {
|
|
20
25
|
url.pathname = joinPathSegments(url.pathname, cleanSegment);
|
|
21
26
|
}
|
|
22
27
|
}
|
|
28
|
+
if (shouldPreserveTrailingSlash && !url.pathname.endsWith("/")) {
|
|
29
|
+
url.pathname += "/";
|
|
30
|
+
}
|
|
23
31
|
return url.toString();
|
|
24
32
|
}
|
|
25
33
|
return joinPath(base, ...segments);
|
|
26
34
|
}
|
|
27
35
|
function joinPath(base, ...segments) {
|
|
36
|
+
if (segments.length === 0) {
|
|
37
|
+
return base;
|
|
38
|
+
}
|
|
28
39
|
let result = base;
|
|
40
|
+
const lastSegment = segments[segments.length - 1];
|
|
41
|
+
const shouldPreserveTrailingSlash = lastSegment && lastSegment.endsWith("/");
|
|
29
42
|
for (const segment of segments) {
|
|
30
43
|
const cleanSegment = trimSlashes(segment);
|
|
31
44
|
if (cleanSegment) {
|
|
32
45
|
result = joinPathSegments(result, cleanSegment);
|
|
33
46
|
}
|
|
34
47
|
}
|
|
48
|
+
if (shouldPreserveTrailingSlash && !result.endsWith("/")) {
|
|
49
|
+
result += "/";
|
|
50
|
+
}
|
|
35
51
|
return result;
|
|
36
52
|
}
|
|
37
53
|
function joinPathSegments(left, right) {
|
|
@@ -43,7 +59,11 @@ function joinPathSegments(left, right) {
|
|
|
43
59
|
function trimSlashes(str) {
|
|
44
60
|
if (!str)
|
|
45
61
|
return str;
|
|
46
|
-
let start =
|
|
47
|
-
let end = str.
|
|
48
|
-
|
|
62
|
+
let start = 0;
|
|
63
|
+
let end = str.length;
|
|
64
|
+
if (str.startsWith("/"))
|
|
65
|
+
start = 1;
|
|
66
|
+
if (str.endsWith("/"))
|
|
67
|
+
end = str.length - 1;
|
|
68
|
+
return start === 0 && end === str.length ? str : str.slice(start, end);
|
|
49
69
|
}
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "v0.3.
|
|
1
|
+
export declare const SDK_VERSION = "v0.3.47";
|
package/dist/cjs/version.js
CHANGED