@deepgram/sdk 5.0.0-alpha.3 → 5.0.0-beta.1
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/LICENSE +1 -1
- package/dist/browser/index.global.js +496 -1104
- package/dist/cjs/BaseClient.d.ts +7 -7
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +1 -2
- package/dist/cjs/CustomClient.js +253 -249
- package/dist/cjs/api/resources/agent/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/agent/resources/v1/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/agent/resources/v1/client/Socket.d.ts +8 -8
- package/dist/cjs/api/resources/agent/resources/v1/client/Socket.js +9 -9
- package/dist/cjs/api/resources/agent/resources/v1/resources/settings/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/agent/resources/v1/resources/settings/resources/think/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/agent/resources/v1/resources/settings/resources/think/resources/models/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/auth/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/auth/resources/v1/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/auth/resources/v1/resources/tokens/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/listen/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/listen/resources/v1/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/listen/resources/v1/client/Client.js +29 -80
- package/dist/cjs/api/resources/listen/resources/v1/client/Socket.d.ts +4 -4
- package/dist/cjs/api/resources/listen/resources/v1/client/Socket.js +5 -5
- package/dist/cjs/api/resources/listen/resources/v1/resources/media/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/listen/resources/v1/resources/media/client/Client.js +76 -298
- package/dist/cjs/api/resources/listen/resources/v2/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/listen/resources/v2/client/Client.js +11 -26
- package/dist/cjs/api/resources/listen/resources/v2/client/Socket.d.ts +2 -2
- package/dist/cjs/api/resources/listen/resources/v2/client/Socket.js +3 -3
- package/dist/cjs/api/resources/manage/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/models/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/models/client/Client.js +3 -4
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/client/Client.js +4 -7
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/balances/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.js +9 -27
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/client/Client.js +4 -7
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/client/Client.js +3 -4
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/keys/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/keys/client/Client.js +3 -4
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/resources/invites/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/members/resources/scopes/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/models/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/models/client/Client.js +3 -4
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/requests/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/requests/client/Client.js +12 -31
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/client/Client.js +46 -133
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/client/Client.js +47 -136
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/client/Client.js +4 -7
- package/dist/cjs/api/resources/read/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/read/resources/v1/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/read/resources/v1/resources/text/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/read/resources/v1/resources/text/client/Client.js +14 -52
- package/dist/cjs/api/resources/selfHosted/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/selfHosted/resources/v1/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.js +4 -12
- package/dist/cjs/api/resources/speak/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/speak/resources/v1/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/speak/resources/v1/client/Client.js +6 -13
- package/dist/cjs/api/resources/speak/resources/v1/client/Socket.d.ts +4 -4
- package/dist/cjs/api/resources/speak/resources/v1/client/Socket.js +4 -4
- package/dist/cjs/api/resources/speak/resources/v1/resources/audio/client/Client.d.ts +1 -2
- package/dist/cjs/api/resources/speak/resources/v1/resources/audio/client/Client.js +11 -33
- package/dist/cjs/auth/HeaderAuthProvider.d.ts +14 -8
- package/dist/cjs/auth/HeaderAuthProvider.js +19 -9
- package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +2 -2
- package/dist/cjs/core/fetcher/Fetcher.d.ts +1 -2
- package/dist/cjs/core/headers.d.ts +2 -2
- package/dist/cjs/core/websocket/ws.d.ts +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +7 -7
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +1 -2
- package/dist/esm/CustomClient.mjs +254 -250
- package/dist/esm/api/resources/agent/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/agent/resources/v1/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/agent/resources/v1/client/Socket.d.mts +8 -8
- package/dist/esm/api/resources/agent/resources/v1/client/Socket.mjs +9 -9
- package/dist/esm/api/resources/agent/resources/v1/resources/settings/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/agent/resources/v1/resources/settings/resources/think/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/agent/resources/v1/resources/settings/resources/think/resources/models/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/auth/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/auth/resources/v1/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/auth/resources/v1/resources/tokens/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/listen/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/listen/resources/v1/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/listen/resources/v1/client/Client.mjs +29 -80
- package/dist/esm/api/resources/listen/resources/v1/client/Socket.d.mts +4 -4
- package/dist/esm/api/resources/listen/resources/v1/client/Socket.mjs +5 -5
- package/dist/esm/api/resources/listen/resources/v1/resources/media/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/listen/resources/v1/resources/media/client/Client.mjs +76 -298
- package/dist/esm/api/resources/listen/resources/v2/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/listen/resources/v2/client/Client.mjs +11 -26
- package/dist/esm/api/resources/listen/resources/v2/client/Socket.d.mts +2 -2
- package/dist/esm/api/resources/listen/resources/v2/client/Socket.mjs +3 -3
- package/dist/esm/api/resources/manage/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/models/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/models/client/Client.mjs +3 -4
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/client/Client.mjs +4 -7
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/balances/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/breakdown/client/Client.mjs +9 -27
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/fields/client/Client.mjs +4 -7
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/billing/resources/purchases/client/Client.mjs +3 -4
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/keys/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/keys/client/Client.mjs +3 -4
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/resources/invites/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/members/resources/scopes/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/models/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/models/client/Client.mjs +3 -4
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/requests/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/requests/client/Client.mjs +12 -31
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/client/Client.mjs +46 -133
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/breakdown/client/Client.mjs +47 -136
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/manage/resources/v1/resources/projects/resources/usage/resources/fields/client/Client.mjs +4 -7
- package/dist/esm/api/resources/read/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/read/resources/v1/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/read/resources/v1/resources/text/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/read/resources/v1/resources/text/client/Client.mjs +14 -52
- package/dist/esm/api/resources/selfHosted/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/selfHosted/resources/v1/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/selfHosted/resources/v1/resources/distributionCredentials/client/Client.mjs +4 -12
- package/dist/esm/api/resources/speak/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/speak/resources/v1/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/speak/resources/v1/client/Client.mjs +6 -13
- package/dist/esm/api/resources/speak/resources/v1/client/Socket.d.mts +4 -4
- package/dist/esm/api/resources/speak/resources/v1/client/Socket.mjs +4 -4
- package/dist/esm/api/resources/speak/resources/v1/resources/audio/client/Client.d.mts +1 -2
- package/dist/esm/api/resources/speak/resources/v1/resources/audio/client/Client.mjs +11 -33
- package/dist/esm/auth/HeaderAuthProvider.d.mts +14 -8
- package/dist/esm/auth/HeaderAuthProvider.mjs +19 -9
- package/dist/esm/core/fetcher/EndpointSupplier.d.mts +2 -2
- package/dist/esm/core/fetcher/Fetcher.d.mts +1 -2
- package/dist/esm/core/headers.d.mts +2 -2
- package/dist/esm/core/websocket/ws.d.mts +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +10 -7
|
@@ -2,8 +2,7 @@ import type { BaseClientOptions } from "../../../../../../BaseClient.mjs";
|
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
|
|
3
3
|
import { TextClient } from "../resources/text/client/Client.mjs";
|
|
4
4
|
export declare namespace V1Client {
|
|
5
|
-
|
|
6
|
-
}
|
|
5
|
+
type Options = BaseClientOptions;
|
|
7
6
|
}
|
|
8
7
|
export declare class V1Client {
|
|
9
8
|
protected readonly _options: NormalizedClientOptionsWithAuth<V1Client.Options>;
|
|
@@ -3,8 +3,7 @@ import { type NormalizedClientOptionsWithAuth } from "../../../../../../../../Ba
|
|
|
3
3
|
import * as core from "../../../../../../../../core/index.mjs";
|
|
4
4
|
import * as Deepgram from "../../../../../../../index.mjs";
|
|
5
5
|
export declare namespace TextClient {
|
|
6
|
-
|
|
7
|
-
}
|
|
6
|
+
type Options = BaseClientOptions;
|
|
8
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
9
8
|
}
|
|
10
9
|
}
|
|
@@ -53,58 +53,20 @@ export class TextClient {
|
|
|
53
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54
54
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
55
55
|
const { callback, callback_method: callbackMethod, sentiment, summarize, tag, topics, custom_topic: customTopic, custom_topic_mode: customTopicMode, intents, custom_intent: customIntent, custom_intent_mode: customIntentMode, language, body: _body, } = request;
|
|
56
|
-
const _queryParams = {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (Array.isArray(tag)) {
|
|
71
|
-
_queryParams.tag = tag.map((item) => item);
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
_queryParams.tag = tag;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
if (topics != null) {
|
|
78
|
-
_queryParams.topics = topics.toString();
|
|
79
|
-
}
|
|
80
|
-
if (customTopic != null) {
|
|
81
|
-
if (Array.isArray(customTopic)) {
|
|
82
|
-
_queryParams.custom_topic = customTopic.map((item) => item);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
_queryParams.custom_topic = customTopic;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
if (customTopicMode != null) {
|
|
89
|
-
_queryParams.custom_topic_mode = customTopicMode;
|
|
90
|
-
}
|
|
91
|
-
if (intents != null) {
|
|
92
|
-
_queryParams.intents = intents.toString();
|
|
93
|
-
}
|
|
94
|
-
if (customIntent != null) {
|
|
95
|
-
if (Array.isArray(customIntent)) {
|
|
96
|
-
_queryParams.custom_intent = customIntent.map((item) => item);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
_queryParams.custom_intent = customIntent;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (customIntentMode != null) {
|
|
103
|
-
_queryParams.custom_intent_mode = customIntentMode;
|
|
104
|
-
}
|
|
105
|
-
if (language != null) {
|
|
106
|
-
_queryParams.language = language;
|
|
107
|
-
}
|
|
56
|
+
const _queryParams = {
|
|
57
|
+
callback,
|
|
58
|
+
callback_method: callbackMethod != null ? callbackMethod : undefined,
|
|
59
|
+
sentiment,
|
|
60
|
+
summarize: summarize != null ? summarize : undefined,
|
|
61
|
+
tag,
|
|
62
|
+
topics,
|
|
63
|
+
custom_topic: customTopic,
|
|
64
|
+
custom_topic_mode: customTopicMode != null ? customTopicMode : undefined,
|
|
65
|
+
intents,
|
|
66
|
+
custom_intent: customIntent,
|
|
67
|
+
custom_intent_mode: customIntentMode != null ? customIntentMode : undefined,
|
|
68
|
+
language,
|
|
69
|
+
};
|
|
108
70
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
109
71
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
110
72
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
@@ -2,8 +2,7 @@ import type { BaseClientOptions } from "../../../../BaseClient.mjs";
|
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
3
3
|
import { V1Client } from "../resources/v1/client/Client.mjs";
|
|
4
4
|
export declare namespace SelfHostedClient {
|
|
5
|
-
|
|
6
|
-
}
|
|
5
|
+
type Options = BaseClientOptions;
|
|
7
6
|
}
|
|
8
7
|
export declare class SelfHostedClient {
|
|
9
8
|
protected readonly _options: NormalizedClientOptionsWithAuth<SelfHostedClient.Options>;
|
|
@@ -2,8 +2,7 @@ import type { BaseClientOptions } from "../../../../../../BaseClient.mjs";
|
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
|
|
3
3
|
import { DistributionCredentialsClient } from "../resources/distributionCredentials/client/Client.mjs";
|
|
4
4
|
export declare namespace V1Client {
|
|
5
|
-
|
|
6
|
-
}
|
|
5
|
+
type Options = BaseClientOptions;
|
|
7
6
|
}
|
|
8
7
|
export declare class V1Client {
|
|
9
8
|
protected readonly _options: NormalizedClientOptionsWithAuth<V1Client.Options>;
|
|
@@ -3,8 +3,7 @@ import { type NormalizedClientOptionsWithAuth } from "../../../../../../../../Ba
|
|
|
3
3
|
import * as core from "../../../../../../../../core/index.mjs";
|
|
4
4
|
import * as Deepgram from "../../../../../../../index.mjs";
|
|
5
5
|
export declare namespace DistributionCredentialsClient {
|
|
6
|
-
|
|
7
|
-
}
|
|
6
|
+
type Options = BaseClientOptions;
|
|
8
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
9
8
|
}
|
|
10
9
|
}
|
|
@@ -102,18 +102,10 @@ export class DistributionCredentialsClient {
|
|
|
102
102
|
return __awaiter(this, arguments, void 0, function* (project_id, request = {}, requestOptions) {
|
|
103
103
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
104
104
|
const { scopes, provider } = request, _body = __rest(request, ["scopes", "provider"]);
|
|
105
|
-
const _queryParams = {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
_queryParams.scopes = scopes;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
if (provider != null) {
|
|
115
|
-
_queryParams.provider = provider;
|
|
116
|
-
}
|
|
105
|
+
const _queryParams = {
|
|
106
|
+
scopes: Array.isArray(scopes) ? scopes.map((item) => item) : scopes != null ? scopes : undefined,
|
|
107
|
+
provider: provider != null ? provider : undefined,
|
|
108
|
+
};
|
|
117
109
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
118
110
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
119
111
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
@@ -2,8 +2,7 @@ import type { BaseClientOptions } from "../../../../BaseClient.mjs";
|
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
3
3
|
import { V1Client } from "../resources/v1/client/Client.mjs";
|
|
4
4
|
export declare namespace SpeakClient {
|
|
5
|
-
|
|
6
|
-
}
|
|
5
|
+
type Options = BaseClientOptions;
|
|
7
6
|
}
|
|
8
7
|
export declare class SpeakClient {
|
|
9
8
|
protected readonly _options: NormalizedClientOptionsWithAuth<SpeakClient.Options>;
|
|
@@ -3,8 +3,7 @@ import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClie
|
|
|
3
3
|
import { AudioClient } from "../resources/audio/client/Client.mjs";
|
|
4
4
|
import { V1Socket } from "./Socket.mjs";
|
|
5
5
|
export declare namespace V1Client {
|
|
6
|
-
|
|
7
|
-
}
|
|
6
|
+
type Options = BaseClientOptions;
|
|
8
7
|
interface ConnectArgs {
|
|
9
8
|
encoding?: string;
|
|
10
9
|
mip_opt_out?: string;
|
|
@@ -26,19 +26,12 @@ export class V1Client {
|
|
|
26
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
27
|
var _a, _b;
|
|
28
28
|
const { encoding, mip_opt_out: mipOptOut, model, sample_rate: sampleRate, headers, debug, reconnectAttempts, } = args;
|
|
29
|
-
const _queryParams = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
if (model != null) {
|
|
37
|
-
_queryParams.model = model;
|
|
38
|
-
}
|
|
39
|
-
if (sampleRate != null) {
|
|
40
|
-
_queryParams.sample_rate = sampleRate;
|
|
41
|
-
}
|
|
29
|
+
const _queryParams = {
|
|
30
|
+
encoding,
|
|
31
|
+
mip_opt_out: mipOptOut,
|
|
32
|
+
model,
|
|
33
|
+
sample_rate: sampleRate,
|
|
34
|
+
};
|
|
42
35
|
const _headers = mergeHeaders(mergeOnlyDefinedHeaders({ Authorization: args.Authorization }), headers);
|
|
43
36
|
const socket = new core.ReconnectingWebSocket({
|
|
44
37
|
url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.DeepgramEnvironment.Production).production, "/v1/speak"),
|
|
@@ -33,10 +33,10 @@ export declare class V1Socket {
|
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
35
|
on<T extends keyof V1Socket.EventHandlers>(event: T, callback: V1Socket.EventHandlers[T]): void;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
sendText(message: Deepgram.speak.SpeakV1Text): void;
|
|
37
|
+
sendFlush(message: Deepgram.speak.SpeakV1Flush): void;
|
|
38
|
+
sendClear(message: Deepgram.speak.SpeakV1Clear): void;
|
|
39
|
+
sendClose(message: Deepgram.speak.SpeakV1Close): void;
|
|
40
40
|
/** Connect to the websocket and register event handlers. */
|
|
41
41
|
connect(): V1Socket;
|
|
42
42
|
/** Close the websocket and unregister event handlers. */
|
|
@@ -54,19 +54,19 @@ export class V1Socket {
|
|
|
54
54
|
on(event, callback) {
|
|
55
55
|
this.eventHandlers[event] = callback;
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
sendText(message) {
|
|
58
58
|
this.assertSocketIsOpen();
|
|
59
59
|
this.sendJson(message);
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
sendFlush(message) {
|
|
62
62
|
this.assertSocketIsOpen();
|
|
63
63
|
this.sendJson(message);
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
sendClear(message) {
|
|
66
66
|
this.assertSocketIsOpen();
|
|
67
67
|
this.sendJson(message);
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
sendClose(message) {
|
|
70
70
|
this.assertSocketIsOpen();
|
|
71
71
|
this.sendJson(message);
|
|
72
72
|
}
|
|
@@ -3,8 +3,7 @@ import { type NormalizedClientOptionsWithAuth } from "../../../../../../../../Ba
|
|
|
3
3
|
import * as core from "../../../../../../../../core/index.mjs";
|
|
4
4
|
import * as Deepgram from "../../../../../../../index.mjs";
|
|
5
5
|
export declare namespace AudioClient {
|
|
6
|
-
|
|
7
|
-
}
|
|
6
|
+
type Options = BaseClientOptions;
|
|
8
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
9
8
|
}
|
|
10
9
|
}
|
|
@@ -41,39 +41,17 @@ export class AudioClient {
|
|
|
41
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
42
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
43
43
|
const { callback, callback_method: callbackMethod, mip_opt_out: mipOptOut, tag, bit_rate: bitRate, container, encoding, model, sample_rate: sampleRate } = request, _body = __rest(request, ["callback", "callback_method", "mip_opt_out", "tag", "bit_rate", "container", "encoding", "model", "sample_rate"]);
|
|
44
|
-
const _queryParams = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (Array.isArray(tag)) {
|
|
56
|
-
_queryParams.tag = tag.map((item) => item);
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
_queryParams.tag = tag;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (bitRate != null) {
|
|
63
|
-
_queryParams.bit_rate = bitRate.toString();
|
|
64
|
-
}
|
|
65
|
-
if (container != null) {
|
|
66
|
-
_queryParams.container = container;
|
|
67
|
-
}
|
|
68
|
-
if (encoding != null) {
|
|
69
|
-
_queryParams.encoding = encoding;
|
|
70
|
-
}
|
|
71
|
-
if (model != null) {
|
|
72
|
-
_queryParams.model = model;
|
|
73
|
-
}
|
|
74
|
-
if (sampleRate != null) {
|
|
75
|
-
_queryParams.sample_rate = sampleRate.toString();
|
|
76
|
-
}
|
|
44
|
+
const _queryParams = {
|
|
45
|
+
callback,
|
|
46
|
+
callback_method: callbackMethod != null ? callbackMethod : undefined,
|
|
47
|
+
mip_opt_out: mipOptOut,
|
|
48
|
+
tag,
|
|
49
|
+
bit_rate: bitRate,
|
|
50
|
+
container: container != null ? container : undefined,
|
|
51
|
+
encoding: encoding != null ? encoding : undefined,
|
|
52
|
+
model: model != null ? model : undefined,
|
|
53
|
+
sample_rate: sampleRate,
|
|
54
|
+
};
|
|
77
55
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
78
56
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
79
57
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import * as core from "../core/index.mjs";
|
|
2
|
-
|
|
3
|
-
interface Options {
|
|
4
|
-
apiKey?: core.Supplier<string | undefined>;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
2
|
+
declare const PARAM_KEY: "apiKey";
|
|
7
3
|
export declare class HeaderAuthProvider implements core.AuthProvider {
|
|
8
|
-
private readonly
|
|
4
|
+
private readonly options;
|
|
9
5
|
constructor(options: HeaderAuthProvider.Options);
|
|
10
|
-
static canCreate(options: HeaderAuthProvider.Options): boolean;
|
|
11
|
-
getAuthRequest(
|
|
6
|
+
static canCreate(options: Partial<HeaderAuthProvider.Options>): boolean;
|
|
7
|
+
getAuthRequest({ endpointMetadata, }?: {
|
|
12
8
|
endpointMetadata?: core.EndpointMetadata;
|
|
13
9
|
}): Promise<core.AuthRequest>;
|
|
14
10
|
}
|
|
11
|
+
export declare namespace HeaderAuthProvider {
|
|
12
|
+
const AUTH_SCHEME: "ApiKeyAuth";
|
|
13
|
+
const AUTH_CONFIG_ERROR_MESSAGE: string;
|
|
14
|
+
type Options = AuthOptions;
|
|
15
|
+
type AuthOptions = {
|
|
16
|
+
[PARAM_KEY]?: core.Supplier<string> | undefined;
|
|
17
|
+
};
|
|
18
|
+
function createInstance(options: Options): core.AuthProvider;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -10,27 +10,37 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
import * as core from "../core/index.mjs";
|
|
12
12
|
import * as errors from "../errors/index.mjs";
|
|
13
|
+
const PARAM_KEY = "apiKey";
|
|
14
|
+
const ENV_HEADER_KEY = "DEEPGRAM_API_KEY";
|
|
15
|
+
const HEADER_NAME = "Authorization";
|
|
13
16
|
export class HeaderAuthProvider {
|
|
14
17
|
constructor(options) {
|
|
15
|
-
this.
|
|
18
|
+
this.options = options;
|
|
16
19
|
}
|
|
17
20
|
static canCreate(options) {
|
|
18
21
|
var _a;
|
|
19
|
-
return options
|
|
22
|
+
return (options === null || options === void 0 ? void 0 : options[PARAM_KEY]) != null || ((_a = process.env) === null || _a === void 0 ? void 0 : _a[ENV_HEADER_KEY]) != null;
|
|
20
23
|
}
|
|
21
|
-
getAuthRequest(
|
|
22
|
-
return __awaiter(this,
|
|
24
|
+
getAuthRequest() {
|
|
25
|
+
return __awaiter(this, arguments, void 0, function* ({ endpointMetadata, } = {}) {
|
|
23
26
|
var _a, _b;
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
27
|
+
const headerValue = (_a = (yield core.Supplier.get(this.options[PARAM_KEY]))) !== null && _a !== void 0 ? _a : (_b = process.env) === null || _b === void 0 ? void 0 : _b[ENV_HEADER_KEY];
|
|
28
|
+
if (headerValue == null) {
|
|
26
29
|
throw new errors.DeepgramError({
|
|
27
|
-
message:
|
|
30
|
+
message: HeaderAuthProvider.AUTH_CONFIG_ERROR_MESSAGE,
|
|
28
31
|
});
|
|
29
32
|
}
|
|
30
|
-
const headerValue = `Token ${apiKey}`;
|
|
31
33
|
return {
|
|
32
|
-
headers: {
|
|
34
|
+
headers: { [HEADER_NAME]: headerValue },
|
|
33
35
|
};
|
|
34
36
|
});
|
|
35
37
|
}
|
|
36
38
|
}
|
|
39
|
+
(function (HeaderAuthProvider) {
|
|
40
|
+
HeaderAuthProvider.AUTH_SCHEME = "ApiKeyAuth";
|
|
41
|
+
HeaderAuthProvider.AUTH_CONFIG_ERROR_MESSAGE = `Please provide '${PARAM_KEY}' when initializing the client, or set the '${ENV_HEADER_KEY}' environment variable`;
|
|
42
|
+
function createInstance(options) {
|
|
43
|
+
return new HeaderAuthProvider(options);
|
|
44
|
+
}
|
|
45
|
+
HeaderAuthProvider.createInstance = createInstance;
|
|
46
|
+
})(HeaderAuthProvider || (HeaderAuthProvider = {}));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { EndpointMetadata } from "./EndpointMetadata.mjs";
|
|
2
2
|
import type { Supplier } from "./Supplier.mjs";
|
|
3
3
|
type EndpointSupplierFn<T> = (arg: {
|
|
4
|
-
endpointMetadata
|
|
4
|
+
endpointMetadata?: EndpointMetadata;
|
|
5
5
|
}) => T | Promise<T>;
|
|
6
6
|
export type EndpointSupplier<T> = Supplier<T> | EndpointSupplierFn<T>;
|
|
7
7
|
export declare const EndpointSupplier: {
|
|
8
8
|
get: <T>(supplier: EndpointSupplier<T>, arg: {
|
|
9
|
-
endpointMetadata
|
|
9
|
+
endpointMetadata?: EndpointMetadata;
|
|
10
10
|
}) => Promise<T>;
|
|
11
11
|
};
|
|
12
12
|
export {};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { type LogConfig, type Logger } from "../logging/logger.mjs";
|
|
2
2
|
import type { APIResponse } from "./APIResponse.mjs";
|
|
3
3
|
import type { EndpointMetadata } from "./EndpointMetadata.mjs";
|
|
4
|
-
import { EndpointSupplier } from "./EndpointSupplier.mjs";
|
|
5
4
|
export type FetchFunction = <R = unknown>(args: Fetcher.Args) => Promise<APIResponse<R, Fetcher.Error>>;
|
|
6
5
|
export declare namespace Fetcher {
|
|
7
6
|
interface Args {
|
|
8
7
|
url: string;
|
|
9
8
|
method: string;
|
|
10
9
|
contentType?: string;
|
|
11
|
-
headers?: Record<string,
|
|
10
|
+
headers?: Record<string, unknown>;
|
|
12
11
|
queryParameters?: Record<string, unknown>;
|
|
13
12
|
body?: unknown;
|
|
14
13
|
timeoutMs?: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function mergeHeaders
|
|
2
|
-
export declare function mergeOnlyDefinedHeaders
|
|
1
|
+
export declare function mergeHeaders(...headersArray: (Record<string, unknown> | null | undefined)[]): Record<string, unknown>;
|
|
2
|
+
export declare function mergeOnlyDefinedHeaders(...headersArray: (Record<string, unknown> | null | undefined)[]): Record<string, unknown>;
|
|
@@ -8,7 +8,7 @@ export declare namespace ReconnectingWebSocket {
|
|
|
8
8
|
protocols?: string | string[];
|
|
9
9
|
options?: ReconnectingWebSocket.Options;
|
|
10
10
|
headers?: Record<string, unknown>;
|
|
11
|
-
queryParameters?: Record<string,
|
|
11
|
+
queryParameters?: Record<string, unknown>;
|
|
12
12
|
}
|
|
13
13
|
type Options = {
|
|
14
14
|
WebSocket?: any;
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.
|
|
1
|
+
export declare const SDK_VERSION = "0.0.259";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.0.
|
|
1
|
+
export const SDK_VERSION = "0.0.259";
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepgram/sdk",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-beta.1",
|
|
4
4
|
"private": false,
|
|
5
|
-
"repository":
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/deepgram/deepgram-js-sdk.git"
|
|
8
|
+
},
|
|
6
9
|
"license": "MIT",
|
|
7
10
|
"type": "commonjs",
|
|
8
11
|
"main": "./dist/cjs/index.js",
|
|
@@ -33,14 +36,14 @@
|
|
|
33
36
|
"ws": "^8.16.0"
|
|
34
37
|
},
|
|
35
38
|
"devDependencies": {
|
|
36
|
-
"
|
|
37
|
-
"
|
|
39
|
+
"webpack": "^5.97.1",
|
|
40
|
+
"ts-loader": "^9.5.1",
|
|
38
41
|
"@types/ws": "^8.5.10",
|
|
42
|
+
"vitest": "^3.2.4",
|
|
39
43
|
"msw": "2.11.2",
|
|
40
|
-
"
|
|
44
|
+
"@types/node": "^18.19.70",
|
|
41
45
|
"typescript": "~5.7.2",
|
|
42
|
-
"
|
|
43
|
-
"webpack": "^5.97.1"
|
|
46
|
+
"@biomejs/biome": "2.3.1"
|
|
44
47
|
},
|
|
45
48
|
"browser": {
|
|
46
49
|
"fs": false,
|