@deepgram/sdk 3.3.5 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -9
- package/dist/main/DeepgramClient.d.ts +65 -12
- package/dist/main/DeepgramClient.d.ts.map +1 -1
- package/dist/main/DeepgramClient.js +73 -18
- package/dist/main/DeepgramClient.js.map +1 -1
- package/dist/main/index.d.ts +13 -4
- package/dist/main/index.d.ts.map +1 -1
- package/dist/main/index.js +18 -8
- package/dist/main/index.js.map +1 -1
- package/dist/main/lib/constants.d.ts +16 -7
- package/dist/main/lib/constants.d.ts.map +1 -1
- package/dist/main/lib/constants.js +26 -9
- package/dist/main/lib/constants.js.map +1 -1
- package/dist/main/lib/enums/LiveConnectionState.d.ts +5 -0
- package/dist/main/lib/enums/LiveConnectionState.d.ts.map +1 -1
- package/dist/main/lib/enums/LiveConnectionState.js +5 -0
- package/dist/main/lib/enums/LiveConnectionState.js.map +1 -1
- package/dist/main/lib/enums/LiveTranscriptionEvents.d.ts +24 -3
- package/dist/main/lib/enums/LiveTranscriptionEvents.d.ts.map +1 -1
- package/dist/main/lib/enums/LiveTranscriptionEvents.js +23 -2
- package/dist/main/lib/enums/LiveTranscriptionEvents.js.map +1 -1
- package/dist/main/lib/enums/index.d.ts +2 -2
- package/dist/main/lib/enums/index.d.ts.map +1 -1
- package/dist/main/lib/enums/index.js +16 -5
- package/dist/main/lib/enums/index.js.map +1 -1
- package/dist/main/lib/fetch.d.ts +19 -1
- package/dist/main/lib/fetch.d.ts.map +1 -1
- package/dist/main/lib/fetch.js +19 -1
- package/dist/main/lib/fetch.js.map +1 -1
- package/dist/main/lib/helpers.d.ts +9 -5
- package/dist/main/lib/helpers.d.ts.map +1 -1
- package/dist/main/lib/helpers.js +82 -7
- package/dist/main/lib/helpers.js.map +1 -1
- package/dist/main/lib/types/CreateProjectKeySchema.d.ts +0 -1
- package/dist/main/lib/types/CreateProjectKeySchema.d.ts.map +1 -1
- package/dist/main/lib/types/DeepgramClientOptions.d.ts +75 -8
- package/dist/main/lib/types/DeepgramClientOptions.d.ts.map +1 -1
- package/dist/main/lib/types/Fetch.d.ts +3 -13
- package/dist/main/lib/types/Fetch.d.ts.map +1 -1
- package/dist/main/lib/types/LiveConfigOptions.d.ts +6 -3
- package/dist/main/lib/types/LiveConfigOptions.d.ts.map +1 -1
- package/dist/main/lib/types/TranscriptionSchema.d.ts +0 -1
- package/dist/main/lib/types/TranscriptionSchema.d.ts.map +1 -1
- package/dist/main/lib/types/UpdateProjectMemberScopeSchema.d.ts +1 -1
- package/dist/main/lib/types/UpdateProjectMemberScopeSchema.d.ts.map +1 -1
- package/dist/main/lib/types/UpdateProjectSchema.d.ts +0 -1
- package/dist/main/lib/types/UpdateProjectSchema.d.ts.map +1 -1
- package/dist/main/lib/types/index.d.ts +39 -39
- package/dist/main/lib/types/index.d.ts.map +1 -1
- package/dist/main/lib/types/index.js +53 -0
- package/dist/main/lib/types/index.js.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/main/packages/AbstractClient.d.ts +63 -10
- package/dist/main/packages/AbstractClient.d.ts.map +1 -1
- package/dist/main/packages/AbstractClient.js +103 -50
- package/dist/main/packages/AbstractClient.js.map +1 -1
- package/dist/main/packages/AbstractLiveClient.d.ts +114 -0
- package/dist/main/packages/AbstractLiveClient.d.ts.map +1 -0
- package/dist/main/packages/AbstractLiveClient.js +238 -0
- package/dist/main/packages/AbstractLiveClient.js.map +1 -0
- package/dist/main/packages/AbstractRestClient.d.ts +105 -0
- package/dist/main/packages/AbstractRestClient.d.ts.map +1 -0
- package/dist/main/packages/AbstractRestClient.js +185 -0
- package/dist/main/packages/AbstractRestClient.js.map +1 -0
- package/dist/main/packages/ListenClient.d.ts +21 -4
- package/dist/main/packages/ListenClient.d.ts.map +1 -1
- package/dist/main/packages/ListenClient.js +25 -5
- package/dist/main/packages/ListenClient.js.map +1 -1
- package/dist/main/packages/ListenLiveClient.d.ts +58 -0
- package/dist/main/packages/ListenLiveClient.d.ts.map +1 -0
- package/dist/main/packages/ListenLiveClient.js +119 -0
- package/dist/main/packages/ListenLiveClient.js.map +1 -0
- package/dist/main/packages/ListenRestClient.d.ts +57 -0
- package/dist/main/packages/ListenRestClient.d.ts.map +1 -0
- package/dist/main/packages/ListenRestClient.js +167 -0
- package/dist/main/packages/ListenRestClient.js.map +1 -0
- package/dist/main/packages/ManageRestClient.d.ts +286 -0
- package/dist/main/packages/ManageRestClient.d.ts.map +1 -0
- package/dist/main/packages/ManageRestClient.js +628 -0
- package/dist/main/packages/ManageRestClient.js.map +1 -0
- package/dist/main/packages/ReadRestClient.d.ts +57 -0
- package/dist/main/packages/ReadRestClient.d.ts.map +1 -0
- package/dist/main/packages/ReadRestClient.js +165 -0
- package/dist/main/packages/ReadRestClient.js.map +1 -0
- package/dist/main/packages/SelfHostedRestClient.d.ts +47 -0
- package/dist/main/packages/SelfHostedRestClient.d.ts.map +1 -0
- package/dist/main/packages/SelfHostedRestClient.js +120 -0
- package/dist/main/packages/SelfHostedRestClient.js.map +1 -0
- package/dist/main/packages/SpeakRestClient.d.ts +36 -0
- package/dist/main/packages/SpeakRestClient.d.ts.map +1 -0
- package/dist/main/packages/SpeakRestClient.js +84 -0
- package/dist/main/packages/SpeakRestClient.js.map +1 -0
- package/dist/main/packages/index.d.ts +10 -8
- package/dist/main/packages/index.d.ts.map +1 -1
- package/dist/main/packages/index.js +24 -17
- package/dist/main/packages/index.js.map +1 -1
- package/dist/module/DeepgramClient.d.ts +65 -12
- package/dist/module/DeepgramClient.d.ts.map +1 -1
- package/dist/module/DeepgramClient.js +72 -17
- package/dist/module/DeepgramClient.js.map +1 -1
- package/dist/module/index.d.ts +13 -4
- package/dist/module/index.d.ts.map +1 -1
- package/dist/module/index.js +18 -8
- package/dist/module/index.js.map +1 -1
- package/dist/module/lib/constants.d.ts +16 -7
- package/dist/module/lib/constants.d.ts.map +1 -1
- package/dist/module/lib/constants.js +26 -9
- package/dist/module/lib/constants.js.map +1 -1
- package/dist/module/lib/enums/LiveConnectionState.d.ts +5 -0
- package/dist/module/lib/enums/LiveConnectionState.d.ts.map +1 -1
- package/dist/module/lib/enums/LiveConnectionState.js +5 -0
- package/dist/module/lib/enums/LiveConnectionState.js.map +1 -1
- package/dist/module/lib/enums/LiveTranscriptionEvents.d.ts +24 -3
- package/dist/module/lib/enums/LiveTranscriptionEvents.d.ts.map +1 -1
- package/dist/module/lib/enums/LiveTranscriptionEvents.js +23 -2
- package/dist/module/lib/enums/LiveTranscriptionEvents.js.map +1 -1
- package/dist/module/lib/enums/index.d.ts +2 -2
- package/dist/module/lib/enums/index.d.ts.map +1 -1
- package/dist/module/lib/enums/index.js +2 -2
- package/dist/module/lib/enums/index.js.map +1 -1
- package/dist/module/lib/fetch.d.ts +19 -1
- package/dist/module/lib/fetch.d.ts.map +1 -1
- package/dist/module/lib/fetch.js +19 -1
- package/dist/module/lib/fetch.js.map +1 -1
- package/dist/module/lib/helpers.d.ts +9 -5
- package/dist/module/lib/helpers.d.ts.map +1 -1
- package/dist/module/lib/helpers.js +75 -4
- package/dist/module/lib/helpers.js.map +1 -1
- package/dist/module/lib/types/CreateProjectKeySchema.d.ts +0 -1
- package/dist/module/lib/types/CreateProjectKeySchema.d.ts.map +1 -1
- package/dist/module/lib/types/DeepgramClientOptions.d.ts +75 -8
- package/dist/module/lib/types/DeepgramClientOptions.d.ts.map +1 -1
- package/dist/module/lib/types/Fetch.d.ts +3 -13
- package/dist/module/lib/types/Fetch.d.ts.map +1 -1
- package/dist/module/lib/types/LiveConfigOptions.d.ts +6 -3
- package/dist/module/lib/types/LiveConfigOptions.d.ts.map +1 -1
- package/dist/module/lib/types/TranscriptionSchema.d.ts +0 -1
- package/dist/module/lib/types/TranscriptionSchema.d.ts.map +1 -1
- package/dist/module/lib/types/UpdateProjectMemberScopeSchema.d.ts +1 -1
- package/dist/module/lib/types/UpdateProjectMemberScopeSchema.d.ts.map +1 -1
- package/dist/module/lib/types/UpdateProjectSchema.d.ts +0 -1
- package/dist/module/lib/types/UpdateProjectSchema.d.ts.map +1 -1
- package/dist/module/lib/types/index.d.ts +39 -39
- package/dist/module/lib/types/index.d.ts.map +1 -1
- package/dist/module/lib/types/index.js +39 -1
- package/dist/module/lib/types/index.js.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/module/packages/AbstractClient.d.ts +63 -10
- package/dist/module/packages/AbstractClient.d.ts.map +1 -1
- package/dist/module/packages/AbstractClient.js +99 -50
- package/dist/module/packages/AbstractClient.js.map +1 -1
- package/dist/module/packages/AbstractLiveClient.d.ts +114 -0
- package/dist/module/packages/AbstractLiveClient.d.ts.map +1 -0
- package/dist/module/packages/AbstractLiveClient.js +211 -0
- package/dist/module/packages/AbstractLiveClient.js.map +1 -0
- package/dist/module/packages/AbstractRestClient.d.ts +105 -0
- package/dist/module/packages/AbstractRestClient.d.ts.map +1 -0
- package/dist/module/packages/AbstractRestClient.js +178 -0
- package/dist/module/packages/AbstractRestClient.js.map +1 -0
- package/dist/module/packages/ListenClient.d.ts +21 -4
- package/dist/module/packages/ListenClient.d.ts.map +1 -1
- package/dist/module/packages/ListenClient.js +25 -5
- package/dist/module/packages/ListenClient.js.map +1 -1
- package/dist/module/packages/ListenLiveClient.d.ts +58 -0
- package/dist/module/packages/ListenLiveClient.d.ts.map +1 -0
- package/dist/module/packages/ListenLiveClient.js +115 -0
- package/dist/module/packages/ListenLiveClient.js.map +1 -0
- package/dist/module/packages/ListenRestClient.d.ts +57 -0
- package/dist/module/packages/ListenRestClient.d.ts.map +1 -0
- package/dist/module/packages/ListenRestClient.js +163 -0
- package/dist/module/packages/ListenRestClient.js.map +1 -0
- package/dist/module/packages/ManageRestClient.d.ts +286 -0
- package/dist/module/packages/ManageRestClient.d.ts.map +1 -0
- package/dist/module/packages/ManageRestClient.js +624 -0
- package/dist/module/packages/ManageRestClient.js.map +1 -0
- package/dist/module/packages/ReadRestClient.d.ts +57 -0
- package/dist/module/packages/ReadRestClient.d.ts.map +1 -0
- package/dist/module/packages/ReadRestClient.js +161 -0
- package/dist/module/packages/ReadRestClient.js.map +1 -0
- package/dist/module/packages/SelfHostedRestClient.d.ts +47 -0
- package/dist/module/packages/SelfHostedRestClient.d.ts.map +1 -0
- package/dist/module/packages/SelfHostedRestClient.js +116 -0
- package/dist/module/packages/SelfHostedRestClient.js.map +1 -0
- package/dist/module/packages/SpeakRestClient.d.ts +36 -0
- package/dist/module/packages/SpeakRestClient.d.ts.map +1 -0
- package/dist/module/packages/SpeakRestClient.js +80 -0
- package/dist/module/packages/SpeakRestClient.js.map +1 -0
- package/dist/module/packages/index.d.ts +10 -8
- package/dist/module/packages/index.d.ts.map +1 -1
- package/dist/module/packages/index.js +10 -8
- package/dist/module/packages/index.js.map +1 -1
- package/dist/umd/deepgram.js +1 -1
- package/package.json +8 -6
- package/src/DeepgramClient.ts +81 -17
- package/src/index.ts +32 -7
- package/src/lib/constants.ts +33 -13
- package/src/lib/enums/LiveConnectionState.ts +11 -4
- package/src/lib/enums/LiveTranscriptionEvents.ts +27 -4
- package/src/lib/enums/index.ts +2 -2
- package/src/lib/fetch.ts +22 -2
- package/src/lib/helpers.ts +98 -9
- package/src/lib/types/CreateProjectKeySchema.ts +0 -1
- package/src/lib/types/DeepgramClientOptions.ts +75 -11
- package/src/lib/types/Fetch.ts +2 -24
- package/src/lib/types/LiveConfigOptions.ts +7 -3
- package/src/lib/types/TranscriptionSchema.ts +0 -2
- package/src/lib/types/UpdateProjectMemberScopeSchema.ts +1 -1
- package/src/lib/types/UpdateProjectSchema.ts +0 -1
- package/src/lib/types/index.ts +39 -54
- package/src/lib/version.ts +1 -1
- package/src/packages/AbstractClient.ts +129 -61
- package/src/packages/AbstractLiveClient.ts +280 -0
- package/src/packages/AbstractRestClient.ts +221 -0
- package/src/packages/ListenClient.ts +26 -5
- package/src/packages/ListenLiveClient.ts +133 -0
- package/src/packages/ListenRestClient.ts +201 -0
- package/src/packages/ManageRestClient.ts +760 -0
- package/src/packages/ReadRestClient.ts +200 -0
- package/src/packages/SelfHostedRestClient.ts +134 -0
- package/src/packages/SpeakRestClient.ts +79 -0
- package/src/packages/index.ts +10 -8
- package/dist/main/packages/AbstractRestfulClient.d.ts +0 -26
- package/dist/main/packages/AbstractRestfulClient.d.ts.map +0 -1
- package/dist/main/packages/AbstractRestfulClient.js +0 -118
- package/dist/main/packages/AbstractRestfulClient.js.map +0 -1
- package/dist/main/packages/AbstractWsClient.d.ts +0 -10
- package/dist/main/packages/AbstractWsClient.d.ts.map +0 -1
- package/dist/main/packages/AbstractWsClient.js +0 -33
- package/dist/main/packages/AbstractWsClient.js.map +0 -1
- package/dist/main/packages/LiveClient.d.ts +0 -28
- package/dist/main/packages/LiveClient.d.ts.map +0 -1
- package/dist/main/packages/LiveClient.js +0 -110
- package/dist/main/packages/LiveClient.js.map +0 -1
- package/dist/main/packages/ManageClient.d.ts +0 -97
- package/dist/main/packages/ManageClient.d.ts.map +0 -1
- package/dist/main/packages/ManageClient.js +0 -463
- package/dist/main/packages/ManageClient.js.map +0 -1
- package/dist/main/packages/OnPremClient.d.ts +0 -21
- package/dist/main/packages/OnPremClient.d.ts.map +0 -1
- package/dist/main/packages/OnPremClient.js +0 -99
- package/dist/main/packages/OnPremClient.js.map +0 -1
- package/dist/main/packages/PrerecordedClient.d.ts +0 -10
- package/dist/main/packages/PrerecordedClient.d.ts.map +0 -1
- package/dist/main/packages/PrerecordedClient.js +0 -125
- package/dist/main/packages/PrerecordedClient.js.map +0 -1
- package/dist/main/packages/ReadClient.d.ts +0 -10
- package/dist/main/packages/ReadClient.d.ts.map +0 -1
- package/dist/main/packages/ReadClient.js +0 -123
- package/dist/main/packages/ReadClient.js.map +0 -1
- package/dist/main/packages/SpeakClient.d.ts +0 -12
- package/dist/main/packages/SpeakClient.d.ts.map +0 -1
- package/dist/main/packages/SpeakClient.js +0 -57
- package/dist/main/packages/SpeakClient.js.map +0 -1
- package/dist/module/packages/AbstractRestfulClient.d.ts +0 -26
- package/dist/module/packages/AbstractRestfulClient.d.ts.map +0 -1
- package/dist/module/packages/AbstractRestfulClient.js +0 -114
- package/dist/module/packages/AbstractRestfulClient.js.map +0 -1
- package/dist/module/packages/AbstractWsClient.d.ts +0 -10
- package/dist/module/packages/AbstractWsClient.d.ts.map +0 -1
- package/dist/module/packages/AbstractWsClient.js +0 -29
- package/dist/module/packages/AbstractWsClient.js.map +0 -1
- package/dist/module/packages/LiveClient.d.ts +0 -28
- package/dist/module/packages/LiveClient.d.ts.map +0 -1
- package/dist/module/packages/LiveClient.js +0 -106
- package/dist/module/packages/LiveClient.js.map +0 -1
- package/dist/module/packages/ManageClient.d.ts +0 -97
- package/dist/module/packages/ManageClient.d.ts.map +0 -1
- package/dist/module/packages/ManageClient.js +0 -459
- package/dist/module/packages/ManageClient.js.map +0 -1
- package/dist/module/packages/OnPremClient.d.ts +0 -21
- package/dist/module/packages/OnPremClient.d.ts.map +0 -1
- package/dist/module/packages/OnPremClient.js +0 -95
- package/dist/module/packages/OnPremClient.js.map +0 -1
- package/dist/module/packages/PrerecordedClient.d.ts +0 -10
- package/dist/module/packages/PrerecordedClient.d.ts.map +0 -1
- package/dist/module/packages/PrerecordedClient.js +0 -121
- package/dist/module/packages/PrerecordedClient.js.map +0 -1
- package/dist/module/packages/ReadClient.d.ts +0 -10
- package/dist/module/packages/ReadClient.d.ts.map +0 -1
- package/dist/module/packages/ReadClient.js +0 -119
- package/dist/module/packages/ReadClient.js.map +0 -1
- package/dist/module/packages/SpeakClient.d.ts +0 -12
- package/dist/module/packages/SpeakClient.d.ts.map +0 -1
- package/dist/module/packages/SpeakClient.js +0 -53
- package/dist/module/packages/SpeakClient.js.map +0 -1
- package/src/packages/AbstractRestfulClient.ts +0 -160
- package/src/packages/AbstractWsClient.ts +0 -42
- package/src/packages/LiveClient.ts +0 -140
- package/src/packages/ManageClient.ts +0 -584
- package/src/packages/OnPremClient.ts +0 -113
- package/src/packages/PrerecordedClient.ts +0 -162
- package/src/packages/ReadClient.ts +0 -161
- package/src/packages/SpeakClient.ts +0 -50
package/README.md
CHANGED
|
@@ -4,14 +4,24 @@
|
|
|
4
4
|
|
|
5
5
|
Official JavaScript SDK for [Deepgram](https://www.deepgram.com/). Power your apps with world-class speech and Language AI models.
|
|
6
6
|
|
|
7
|
-
- [Migrating from
|
|
7
|
+
- [Migrating from earlier versions](#migrating-from-earlier-versions)
|
|
8
|
+
- [V2 to V3](#v2-to-v3)
|
|
9
|
+
- [V3.\* to V3.4](#v3-to-v34)
|
|
8
10
|
- [Installation](#installation)
|
|
9
11
|
- [UMD](#umd)
|
|
10
12
|
- [ESM](#esm)
|
|
11
13
|
- [Initialization](#initialization)
|
|
12
14
|
- [Getting an API Key](#getting-an-api-key)
|
|
13
15
|
- [Scoped Configuration](#scoped-configuration)
|
|
14
|
-
- [
|
|
16
|
+
- [1. Global Defaults](#1-global-defaults)
|
|
17
|
+
- [2. Namespace-specific Configurations](#2-namespace-specific-configurations)
|
|
18
|
+
- [3. Transport Options](#3-transport-options)
|
|
19
|
+
- [4. Examples](#4-examples)
|
|
20
|
+
- [Change the API url used for all SDK methods](#change-the-api-url-used-for-all-sdk-methods)
|
|
21
|
+
- [Change the API url used for transcription only](#change-the-api-url-used-for-transcription-only)
|
|
22
|
+
- [Override fetch transmitter](#override-fetch-transmitter)
|
|
23
|
+
- [Proxy requests in the browser](#proxy-requests-in-the-browser)
|
|
24
|
+
- [Set custom headers for fetch](#set-custom-headers-for-fetch)
|
|
15
25
|
- [Transcription (Synchronous)](#transcription-synchronous)
|
|
16
26
|
- [Remote Files](#remote-files)
|
|
17
27
|
- [Local Files](#local-files)
|
|
@@ -21,6 +31,8 @@ Official JavaScript SDK for [Deepgram](https://www.deepgram.com/). Power your ap
|
|
|
21
31
|
- [Transcription (Live / Streaming)](#transcription-live--streaming)
|
|
22
32
|
- [Live Audio](#live-audio)
|
|
23
33
|
- [Transcribing to captions](#transcribing-to-captions)
|
|
34
|
+
- [Text to Speech](#text-to-speech)
|
|
35
|
+
- [Text Intelligence](#text-intelligence)
|
|
24
36
|
- [Projects](#projects)
|
|
25
37
|
- [Get Projects](#get-projects)
|
|
26
38
|
- [Get Project](#get-project)
|
|
@@ -55,15 +67,21 @@ Official JavaScript SDK for [Deepgram](https://www.deepgram.com/). Power your ap
|
|
|
55
67
|
- [Get On-Prem credentials](#get-on-prem-credentials)
|
|
56
68
|
- [Create On-Prem credentials](#create-on-prem-credentials)
|
|
57
69
|
- [Delete On-Prem credentials](#delete-on-prem-credentials)
|
|
58
|
-
-
|
|
70
|
+
- [Backwards Compatibility](#backwards-compatibility)
|
|
59
71
|
- [Development and Contributing](#development-and-contributing)
|
|
60
72
|
- [Debugging and making changes locally](#debugging-and-making-changes-locally)
|
|
61
73
|
- [Getting Help](#getting-help)
|
|
62
74
|
|
|
63
|
-
# Migrating from
|
|
75
|
+
# Migrating from earlier versions
|
|
76
|
+
|
|
77
|
+
## V2 to V3
|
|
64
78
|
|
|
65
79
|
We have published [a migration guide on our docs](https://developers.deepgram.com/docs/js-sdk-v2-to-v3-migration-guide), showing how to move from v2 to v3.
|
|
66
80
|
|
|
81
|
+
## V3.\* to V3.4
|
|
82
|
+
|
|
83
|
+
We recommend using only documented interfaces, as we strictly follow semantic versioning (semver) and breaking changes may occur for undocumented interfaces. To ensure compatibility, consider pinning your versions if you need to use undocumented interfaces.
|
|
84
|
+
|
|
67
85
|
# Installation
|
|
68
86
|
|
|
69
87
|
You can install this SDK directly from [npm](https://www.npmjs.com/package/@deepgram/sdk).
|
|
@@ -130,20 +148,76 @@ const deepgram = createClient(DEEPGRAM_API_KEY);
|
|
|
130
148
|
|
|
131
149
|
# Scoped Configuration
|
|
132
150
|
|
|
133
|
-
|
|
151
|
+
The SDK supports scoped configuration. You'll be able to configure various aspects of each namespace of the SDK from the initialization. Below outlines a flexible and customizable configuration system for the Deepgram SDK. Here’s how the namespace configuration works:
|
|
152
|
+
|
|
153
|
+
## 1. Global Defaults
|
|
154
|
+
|
|
155
|
+
- The `global` namespace serves as the foundational configuration applicable across all other namespaces unless overridden.
|
|
156
|
+
- Includes general settings like URL and headers applicable for all API calls.
|
|
157
|
+
- If no specific configurations are provided for other namespaces, the `global` defaults are used.
|
|
158
|
+
|
|
159
|
+
## 2. Namespace-specific Configurations
|
|
160
|
+
|
|
161
|
+
- Each namespace (`listen`, `manage`, `onprem`, `read`, `speak`) can have its specific configurations which override the `global` settings within their respective scopes.
|
|
162
|
+
- Allows for detailed control over different parts of the application interacting with various Deepgram API endpoints.
|
|
163
|
+
|
|
164
|
+
## 3. Transport Options
|
|
165
|
+
|
|
166
|
+
- Configurations for both `fetch` and `websocket` can be specified under each namespace, allowing different transport mechanisms for different operations.
|
|
167
|
+
- For example, the `fetch` configuration can have its own URL and proxy settings distinct from the `websocket`.
|
|
168
|
+
- The generic interfaces define a structure for transport options which include a client (like a `fetch` or `WebSocket` instance) and associated options (like headers, URL, proxy settings).
|
|
169
|
+
|
|
170
|
+
This configuration system enables robust customization where defaults provide a foundation, but every aspect of the client's interaction with the API can be finely controlled and tailored to specific needs through namespace-specific settings. This enhances the maintainability and scalability of the application by localizing configurations to their relevant contexts.
|
|
171
|
+
|
|
172
|
+
## 4. Examples
|
|
173
|
+
|
|
174
|
+
### Change the API url used for all SDK methods
|
|
175
|
+
|
|
176
|
+
Useful for using different API environments (for e.g. beta).
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
import { createClient } from "@deepgram/sdk";
|
|
180
|
+
// - or -
|
|
181
|
+
// const { createClient } = require("@deepgram/sdk");
|
|
182
|
+
|
|
183
|
+
const deepgram = createClient(DEEPGRAM_API_KEY, {
|
|
184
|
+
global: { fetch: { options: { url: "https://api.beta.deepgram.com" } } },
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Change the API url used for transcription only
|
|
189
|
+
|
|
190
|
+
Useful for on-prem installations. Only affects requests to `/listen` endpoints.
|
|
191
|
+
|
|
192
|
+
```js
|
|
193
|
+
import { createClient } from "@deepgram/sdk";
|
|
194
|
+
// - or -
|
|
195
|
+
// const { createClient } = require("@deepgram/sdk");
|
|
196
|
+
|
|
197
|
+
const deepgram = createClient(DEEPGRAM_API_KEY, {
|
|
198
|
+
listen: { fetch: { options: { url: "http://localhost:8080" } } },
|
|
199
|
+
});
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Override fetch transmitter
|
|
203
|
+
|
|
204
|
+
Useful for providing a custom http client.
|
|
134
205
|
|
|
135
206
|
```js
|
|
136
207
|
import { createClient } from "@deepgram/sdk";
|
|
137
208
|
// - or -
|
|
138
209
|
// const { createClient } = require("@deepgram/sdk");
|
|
139
210
|
|
|
211
|
+
const yourFetch = async () => {
|
|
212
|
+
return Response("...etc");
|
|
213
|
+
};
|
|
214
|
+
|
|
140
215
|
const deepgram = createClient(DEEPGRAM_API_KEY, {
|
|
141
|
-
global: {
|
|
142
|
-
// restProxy: { url: "http://localhost:8080" }
|
|
216
|
+
global: { fetch: { client: yourFetch } },
|
|
143
217
|
});
|
|
144
218
|
```
|
|
145
219
|
|
|
146
|
-
|
|
220
|
+
### Proxy requests in the browser
|
|
147
221
|
|
|
148
222
|
This SDK now works in the browser. If you'd like to make REST-based requests (pre-recorded transcription, on-premise, and management requests), then you'll need to use a proxy as we do not support custom CORS origins on our API. To set up your proxy, you configure the SDK like so:
|
|
149
223
|
|
|
@@ -151,7 +225,7 @@ This SDK now works in the browser. If you'd like to make REST-based requests (pr
|
|
|
151
225
|
import { createClient } from "@deepgram/sdk";
|
|
152
226
|
|
|
153
227
|
const deepgram = createClient("proxy", {
|
|
154
|
-
|
|
228
|
+
global: { fetch: { options: { proxy: { url: "http://localhost:8080" } } } },
|
|
155
229
|
});
|
|
156
230
|
```
|
|
157
231
|
|
|
@@ -161,6 +235,18 @@ Your proxy service should replace the Authorization header with `Authorization:
|
|
|
161
235
|
|
|
162
236
|
Check out our example Node-based proxy here: [Deepgram Node Proxy](https://github.com/deepgram-devs/deepgram-node-proxy).
|
|
163
237
|
|
|
238
|
+
### Set custom headers for fetch
|
|
239
|
+
|
|
240
|
+
Useful for many things.
|
|
241
|
+
|
|
242
|
+
```js
|
|
243
|
+
import { createClient } from "@deepgram/sdk";
|
|
244
|
+
|
|
245
|
+
const deepgram = createClient("proxy", {
|
|
246
|
+
global: { fetch: { options: { headers: { "x-custom-header": "foo" } } } },
|
|
247
|
+
});
|
|
248
|
+
```
|
|
249
|
+
|
|
164
250
|
# Transcription (Synchronous)
|
|
165
251
|
|
|
166
252
|
## Remote Files
|
|
@@ -294,6 +380,38 @@ const vttOutput = webvtt(result);
|
|
|
294
380
|
|
|
295
381
|
[See our standalone captions library for more information](https://github.com/deepgram/deepgram-node-captions).
|
|
296
382
|
|
|
383
|
+
# Text to Speech
|
|
384
|
+
|
|
385
|
+
```js
|
|
386
|
+
const { result } = await deepgram.speak.request({ text }, { model: "aura-asteria-en" });
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/text-to-speech-api).
|
|
390
|
+
|
|
391
|
+
# Text Intelligence
|
|
392
|
+
|
|
393
|
+
```js
|
|
394
|
+
const text = `The history of the phrase 'The quick brown fox jumps over the
|
|
395
|
+
lazy dog'. The earliest known appearance of the phrase was in The Boston
|
|
396
|
+
Journal. In an article titled "Current Notes" in the February 9, 1885, edition,
|
|
397
|
+
the phrase is mentioned as a good practice sentence for writing students: "A
|
|
398
|
+
favorite copy set by writing teachers for their pupils is the following,
|
|
399
|
+
because it contains every letter of the alphabet: 'A quick brown fox jumps over
|
|
400
|
+
the lazy dog.'" Dozens of other newspapers published the phrase over the
|
|
401
|
+
next few months, all using the version of the sentence starting with "A" rather
|
|
402
|
+
than "The". The earliest known use of the phrase starting with "The" is from
|
|
403
|
+
the 1888 book Illustrative Shorthand by Linda Bronson.[3] The modern form
|
|
404
|
+
(starting with "The") became more common even though it is slightly longer than
|
|
405
|
+
the original (starting with "A").`;
|
|
406
|
+
|
|
407
|
+
const { result, error } = await deepgram.read.analyzeText(
|
|
408
|
+
{ text },
|
|
409
|
+
{ language: "en", topics: true, sentiment: true }
|
|
410
|
+
);
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/analyze-text).
|
|
414
|
+
|
|
297
415
|
# Projects
|
|
298
416
|
|
|
299
417
|
## Get Projects
|
|
@@ -562,6 +680,8 @@ const { result, error } = await deepgram.onprem.deleteCredentials(projectId, cre
|
|
|
562
680
|
|
|
563
681
|
Older SDK versions will receive Priority 1 (P1) bug support only. Security issues, both in our code and dependencies, are promptly addressed. Significant bugs without clear workarounds are also given priority attention.
|
|
564
682
|
|
|
683
|
+
We strictly follow semver, and will not introduce breaking changes to the publicly documented interfaces of the SDK. **Use internal and undocumented interfaces without pinning your version, at your own risk.**
|
|
684
|
+
|
|
565
685
|
# Development and Contributing
|
|
566
686
|
|
|
567
687
|
Interested in contributing? We ❤️ pull requests!
|
|
@@ -1,33 +1,86 @@
|
|
|
1
|
-
import { AbstractClient } from "./packages
|
|
2
|
-
import { ListenClient } from "./packages/ListenClient";
|
|
3
|
-
import { ManageClient } from "./packages/ManageClient";
|
|
4
|
-
import { OnPremClient } from "./packages/OnPremClient";
|
|
5
|
-
import { ReadClient } from "./packages/ReadClient";
|
|
6
|
-
import { SpeakClient } from "./packages/SpeakClient";
|
|
1
|
+
import { AbstractClient, ListenClient, ManageClient, ReadClient, OnPremClient, SelfHostedRestClient, SpeakClient } from "./packages";
|
|
7
2
|
/**
|
|
8
|
-
* Deepgram
|
|
3
|
+
* The DeepgramClient class provides access to various Deepgram API clients, including ListenClient, ManageClient, SelfHostedRestClient, ReadClient, and SpeakClient.
|
|
9
4
|
*
|
|
10
|
-
*
|
|
11
|
-
* @see https://developers.deepgram.com/docs/js-sdk
|
|
5
|
+
* @see https://github.com/deepgram/deepgram-js-sdk
|
|
12
6
|
*/
|
|
13
7
|
export default class DeepgramClient extends AbstractClient {
|
|
8
|
+
/**
|
|
9
|
+
* Returns a new instance of the ListenClient, which provides access to the Deepgram API's listening functionality.
|
|
10
|
+
*
|
|
11
|
+
* @returns {ListenClient} A new instance of the ListenClient.
|
|
12
|
+
*/
|
|
14
13
|
get listen(): ListenClient;
|
|
14
|
+
/**
|
|
15
|
+
* Returns a new instance of the ManageClient, which provides access to the Deepgram API's management functionality.
|
|
16
|
+
*
|
|
17
|
+
* @returns {ManageClient} A new instance of the ManageClient.
|
|
18
|
+
*/
|
|
15
19
|
get manage(): ManageClient;
|
|
20
|
+
/**
|
|
21
|
+
* Returns a new instance of the SelfHostedRestClient, which provides access to the Deepgram API's self-hosted functionality.
|
|
22
|
+
*
|
|
23
|
+
* @returns {OnPremClient} A new instance of the SelfHostedRestClient named as OnPremClient.
|
|
24
|
+
* @deprecated use selfhosted() instead
|
|
25
|
+
*/
|
|
16
26
|
get onprem(): OnPremClient;
|
|
27
|
+
/**
|
|
28
|
+
* Returns a new instance of the SelfHostedRestClient, which provides access to the Deepgram API's self-hosted functionality.
|
|
29
|
+
*
|
|
30
|
+
* @returns {SelfHostedRestClient} A new instance of the SelfHostedRestClient.
|
|
31
|
+
*/
|
|
32
|
+
get selfhosted(): SelfHostedRestClient;
|
|
33
|
+
/**
|
|
34
|
+
* Returns a new instance of the ReadClient, which provides access to the Deepgram API's reading functionality.
|
|
35
|
+
*
|
|
36
|
+
* @returns {ReadClient} A new instance of the ReadClient.
|
|
37
|
+
*/
|
|
17
38
|
get read(): ReadClient;
|
|
18
|
-
get speak(): SpeakClient;
|
|
19
39
|
/**
|
|
20
|
-
*
|
|
40
|
+
* Returns a new instance of the SpeakClient, which provides access to the Deepgram API's speaking functionality.
|
|
21
41
|
*
|
|
22
|
-
* @
|
|
42
|
+
* @returns {SpeakClient} A new instance of the SpeakClient.
|
|
43
|
+
*/
|
|
44
|
+
get speak(): SpeakClient;
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated
|
|
47
|
+
* @see https://dpgr.am/js-v3
|
|
23
48
|
*/
|
|
24
49
|
get transcription(): any;
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated
|
|
52
|
+
* @see https://dpgr.am/js-v3
|
|
53
|
+
*/
|
|
25
54
|
get projects(): any;
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated
|
|
57
|
+
* @see https://dpgr.am/js-v3
|
|
58
|
+
*/
|
|
26
59
|
get keys(): any;
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated
|
|
62
|
+
* @see https://dpgr.am/js-v3
|
|
63
|
+
*/
|
|
27
64
|
get members(): any;
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated
|
|
67
|
+
* @see https://dpgr.am/js-v3
|
|
68
|
+
*/
|
|
28
69
|
get scopes(): any;
|
|
70
|
+
/**
|
|
71
|
+
* @deprecated
|
|
72
|
+
* @see https://dpgr.am/js-v3
|
|
73
|
+
*/
|
|
29
74
|
get invitation(): any;
|
|
75
|
+
/**
|
|
76
|
+
* @deprecated
|
|
77
|
+
* @see https://dpgr.am/js-v3
|
|
78
|
+
*/
|
|
30
79
|
get usage(): any;
|
|
80
|
+
/**
|
|
81
|
+
* @deprecated
|
|
82
|
+
* @see https://dpgr.am/js-v3
|
|
83
|
+
*/
|
|
31
84
|
get billing(): any;
|
|
32
85
|
}
|
|
33
86
|
//# sourceMappingURL=DeepgramClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeepgramClient.d.ts","sourceRoot":"","sources":["../../src/DeepgramClient.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"DeepgramClient.d.ts","sourceRoot":"","sources":["../../src/DeepgramClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,cAAc;IACxD;;;;OAIG;IACH,IAAI,MAAM,IAAI,YAAY,CAEzB;IAED;;;;OAIG;IACH,IAAI,MAAM,IAAI,YAAY,CAEzB;IAED;;;;;OAKG;IACH,IAAI,MAAM,IAAI,YAAY,CAEzB;IAED;;;;OAIG;IACH,IAAI,UAAU,IAAI,oBAAoB,CAErC;IAED;;;;OAIG;IACH,IAAI,IAAI,IAAI,UAAU,CAErB;IAED;;;;OAIG;IACH,IAAI,KAAK,IAAI,WAAW,CAEvB;IAED;;;OAGG;IACH,IAAI,aAAa,IAAI,GAAG,CAEvB;IAED;;;OAGG;IACH,IAAI,QAAQ,IAAI,GAAG,CAElB;IAED;;;OAGG;IACH,IAAI,IAAI,IAAI,GAAG,CAEd;IAED;;;OAGG;IACH,IAAI,OAAO,IAAI,GAAG,CAEjB;IAED;;;OAGG;IACH,IAAI,MAAM,IAAI,GAAG,CAEhB;IAED;;;OAGG;IACH,IAAI,UAAU,IAAI,GAAG,CAEpB;IAED;;;OAGG;IACH,IAAI,KAAK,IAAI,GAAG,CAEf;IAED;;;OAGG;IACH,IAAI,OAAO,IAAI,GAAG,CAEjB;CACF"}
|
|
@@ -1,60 +1,115 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const errors_1 = require("./lib/errors");
|
|
4
|
-
const
|
|
5
|
-
const ListenClient_1 = require("./packages/ListenClient");
|
|
6
|
-
const ManageClient_1 = require("./packages/ManageClient");
|
|
7
|
-
const OnPremClient_1 = require("./packages/OnPremClient");
|
|
8
|
-
const ReadClient_1 = require("./packages/ReadClient");
|
|
9
|
-
const SpeakClient_1 = require("./packages/SpeakClient");
|
|
4
|
+
const packages_1 = require("./packages");
|
|
10
5
|
/**
|
|
11
|
-
* Deepgram
|
|
6
|
+
* The DeepgramClient class provides access to various Deepgram API clients, including ListenClient, ManageClient, SelfHostedRestClient, ReadClient, and SpeakClient.
|
|
12
7
|
*
|
|
13
|
-
*
|
|
14
|
-
* @see https://developers.deepgram.com/docs/js-sdk
|
|
8
|
+
* @see https://github.com/deepgram/deepgram-js-sdk
|
|
15
9
|
*/
|
|
16
|
-
class DeepgramClient extends
|
|
10
|
+
class DeepgramClient extends packages_1.AbstractClient {
|
|
11
|
+
/**
|
|
12
|
+
* Returns a new instance of the ListenClient, which provides access to the Deepgram API's listening functionality.
|
|
13
|
+
*
|
|
14
|
+
* @returns {ListenClient} A new instance of the ListenClient.
|
|
15
|
+
*/
|
|
17
16
|
get listen() {
|
|
18
|
-
return new
|
|
17
|
+
return new packages_1.ListenClient(this.options);
|
|
19
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns a new instance of the ManageClient, which provides access to the Deepgram API's management functionality.
|
|
21
|
+
*
|
|
22
|
+
* @returns {ManageClient} A new instance of the ManageClient.
|
|
23
|
+
*/
|
|
20
24
|
get manage() {
|
|
21
|
-
return new
|
|
25
|
+
return new packages_1.ManageClient(this.options);
|
|
22
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns a new instance of the SelfHostedRestClient, which provides access to the Deepgram API's self-hosted functionality.
|
|
29
|
+
*
|
|
30
|
+
* @returns {OnPremClient} A new instance of the SelfHostedRestClient named as OnPremClient.
|
|
31
|
+
* @deprecated use selfhosted() instead
|
|
32
|
+
*/
|
|
23
33
|
get onprem() {
|
|
24
|
-
return
|
|
34
|
+
return this.selfhosted;
|
|
25
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Returns a new instance of the SelfHostedRestClient, which provides access to the Deepgram API's self-hosted functionality.
|
|
38
|
+
*
|
|
39
|
+
* @returns {SelfHostedRestClient} A new instance of the SelfHostedRestClient.
|
|
40
|
+
*/
|
|
41
|
+
get selfhosted() {
|
|
42
|
+
return new packages_1.SelfHostedRestClient(this.options);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Returns a new instance of the ReadClient, which provides access to the Deepgram API's reading functionality.
|
|
46
|
+
*
|
|
47
|
+
* @returns {ReadClient} A new instance of the ReadClient.
|
|
48
|
+
*/
|
|
26
49
|
get read() {
|
|
27
|
-
return new
|
|
50
|
+
return new packages_1.ReadClient(this.options);
|
|
28
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Returns a new instance of the SpeakClient, which provides access to the Deepgram API's speaking functionality.
|
|
54
|
+
*
|
|
55
|
+
* @returns {SpeakClient} A new instance of the SpeakClient.
|
|
56
|
+
*/
|
|
29
57
|
get speak() {
|
|
30
|
-
return new
|
|
58
|
+
return new packages_1.SpeakClient(this.options);
|
|
31
59
|
}
|
|
32
60
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* @see https://developers.deepgram.com/docs/js-sdk-v2-to-v3-migration-guide
|
|
61
|
+
* @deprecated
|
|
62
|
+
* @see https://dpgr.am/js-v3
|
|
36
63
|
*/
|
|
37
64
|
get transcription() {
|
|
38
65
|
throw new errors_1.DeepgramVersionError();
|
|
39
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* @deprecated
|
|
69
|
+
* @see https://dpgr.am/js-v3
|
|
70
|
+
*/
|
|
40
71
|
get projects() {
|
|
41
72
|
throw new errors_1.DeepgramVersionError();
|
|
42
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated
|
|
76
|
+
* @see https://dpgr.am/js-v3
|
|
77
|
+
*/
|
|
43
78
|
get keys() {
|
|
44
79
|
throw new errors_1.DeepgramVersionError();
|
|
45
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* @deprecated
|
|
83
|
+
* @see https://dpgr.am/js-v3
|
|
84
|
+
*/
|
|
46
85
|
get members() {
|
|
47
86
|
throw new errors_1.DeepgramVersionError();
|
|
48
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated
|
|
90
|
+
* @see https://dpgr.am/js-v3
|
|
91
|
+
*/
|
|
49
92
|
get scopes() {
|
|
50
93
|
throw new errors_1.DeepgramVersionError();
|
|
51
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* @deprecated
|
|
97
|
+
* @see https://dpgr.am/js-v3
|
|
98
|
+
*/
|
|
52
99
|
get invitation() {
|
|
53
100
|
throw new errors_1.DeepgramVersionError();
|
|
54
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* @deprecated
|
|
104
|
+
* @see https://dpgr.am/js-v3
|
|
105
|
+
*/
|
|
55
106
|
get usage() {
|
|
56
107
|
throw new errors_1.DeepgramVersionError();
|
|
57
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* @deprecated
|
|
111
|
+
* @see https://dpgr.am/js-v3
|
|
112
|
+
*/
|
|
58
113
|
get billing() {
|
|
59
114
|
throw new errors_1.DeepgramVersionError();
|
|
60
115
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeepgramClient.js","sourceRoot":"","sources":["../../src/DeepgramClient.ts"],"names":[],"mappings":";;AAAA,yCAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"DeepgramClient.js","sourceRoot":"","sources":["../../src/DeepgramClient.ts"],"names":[],"mappings":";;AAAA,yCAAoD;AACpD,yCAQoB;AAEpB;;;;GAIG;AACH,MAAqB,cAAe,SAAQ,yBAAc;IACxD;;;;OAIG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,uBAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,uBAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAED;;;;;OAKG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,IAAI,UAAU;QACZ,OAAO,IAAI,+BAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;IAED;;;;OAIG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,qBAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,sBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,IAAI,aAAa;QACf,MAAM,IAAI,6BAAoB,EAAE,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,IAAI,QAAQ;QACV,MAAM,IAAI,6BAAoB,EAAE,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,IAAI,IAAI;QACN,MAAM,IAAI,6BAAoB,EAAE,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,IAAI,OAAO;QACT,MAAM,IAAI,6BAAoB,EAAE,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,IAAI,MAAM;QACR,MAAM,IAAI,6BAAoB,EAAE,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,IAAI,UAAU;QACZ,MAAM,IAAI,6BAAoB,EAAE,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,IAAI,KAAK;QACP,MAAM,IAAI,6BAAoB,EAAE,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,IAAI,OAAO;QACT,MAAM,IAAI,6BAAoB,EAAE,CAAC;IACnC,CAAC;CACF;AAvHD,iCAuHC"}
|
package/dist/main/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { DeepgramClientOptions, IKeyFactory } from "./lib/types/DeepgramClientOptions";
|
|
1
2
|
import DeepgramClient from "./DeepgramClient";
|
|
2
|
-
import type { DeepgramClientOptions } from "./lib/types";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* This class is deprecated and should not be used. It throws a `DeepgramVersionError` when instantiated.
|
|
5
|
+
*
|
|
6
|
+
* @deprecated
|
|
7
|
+
* @see https://dpgr.am/js-v3
|
|
5
8
|
*/
|
|
6
9
|
declare class Deepgram {
|
|
7
10
|
protected apiKey: string;
|
|
@@ -10,9 +13,15 @@ declare class Deepgram {
|
|
|
10
13
|
constructor(apiKey: string, apiUrl?: string | undefined, requireSSL?: boolean | undefined);
|
|
11
14
|
}
|
|
12
15
|
/**
|
|
13
|
-
* Creates a new Deepgram
|
|
16
|
+
* Creates a new Deepgram client instance.
|
|
17
|
+
*
|
|
18
|
+
* @param {DeepgramClientArgs} args - Arguments to pass to the Deepgram client constructor.
|
|
19
|
+
* @returns A new Deepgram client instance.
|
|
14
20
|
*/
|
|
15
|
-
declare
|
|
21
|
+
declare function createClient(): DeepgramClient;
|
|
22
|
+
declare function createClient(key?: string | IKeyFactory): DeepgramClient;
|
|
23
|
+
declare function createClient(options?: DeepgramClientOptions): DeepgramClient;
|
|
24
|
+
declare function createClient(key?: string | IKeyFactory, options?: DeepgramClientOptions): DeepgramClient;
|
|
16
25
|
export { createClient, DeepgramClient, Deepgram };
|
|
17
26
|
/**
|
|
18
27
|
* Helpful exports.
|
package/dist/main/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEvF,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C;;;;;GAKG;AACH,cAAM,QAAQ;IACA,SAAS,CAAC,MAAM,EAAE,MAAM;IAAE,SAAS,CAAC,MAAM,CAAC;IAAU,SAAS,CAAC,UAAU,CAAC;gBAAhE,MAAM,EAAE,MAAM,EAAY,MAAM,CAAC,oBAAQ,EAAY,UAAU,CAAC,qBAAS;CAGhG;AAED;;;;;GAKG;AACH,iBAAS,YAAY,IAAI,cAAc,CAAC;AACxC,iBAAS,YAAY,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,cAAc,CAAC;AAClE,iBAAS,YAAY,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,cAAc,CAAC;AACvE,iBAAS,YAAY,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,WAAW,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,cAAc,CAAC;AAoBnG,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC;AAElD;;GAEG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAE9B;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/main/index.js
CHANGED
|
@@ -18,11 +18,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.srt = exports.webvtt = exports.Deepgram = exports.DeepgramClient = exports.createClient = void 0;
|
|
21
|
+
const errors_1 = require("./lib/errors");
|
|
21
22
|
const DeepgramClient_1 = __importDefault(require("./DeepgramClient"));
|
|
22
23
|
exports.DeepgramClient = DeepgramClient_1.default;
|
|
23
|
-
const errors_1 = require("./lib/errors");
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* This class is deprecated and should not be used. It throws a `DeepgramVersionError` when instantiated.
|
|
26
|
+
*
|
|
27
|
+
* @deprecated
|
|
28
|
+
* @see https://dpgr.am/js-v3
|
|
26
29
|
*/
|
|
27
30
|
class Deepgram {
|
|
28
31
|
constructor(apiKey, apiUrl, requireSSL) {
|
|
@@ -33,12 +36,19 @@ class Deepgram {
|
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
exports.Deepgram = Deepgram;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
39
|
+
function createClient(keyOrOptions, options) {
|
|
40
|
+
let resolvedOptions = {};
|
|
41
|
+
if (typeof keyOrOptions === "string" || typeof keyOrOptions === "function") {
|
|
42
|
+
if (typeof options === "object") {
|
|
43
|
+
resolvedOptions = options;
|
|
44
|
+
}
|
|
45
|
+
resolvedOptions.key = keyOrOptions;
|
|
46
|
+
}
|
|
47
|
+
else if (typeof keyOrOptions === "object") {
|
|
48
|
+
resolvedOptions = keyOrOptions;
|
|
49
|
+
}
|
|
50
|
+
return new DeepgramClient_1.default(resolvedOptions);
|
|
51
|
+
}
|
|
42
52
|
exports.createClient = createClient;
|
|
43
53
|
/**
|
|
44
54
|
* Helpful exports.
|
package/dist/main/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,yCAAoD;AACpD,sEAA8C;AA2CvB,yBA3ChB,wBAAc,CA2CgB;AAzCrC;;;;;GAKG;AACH,MAAM,QAAQ;IACZ,YAAsB,MAAc,EAAY,MAAe,EAAY,UAAoB;QAAzE,WAAM,GAAN,MAAM,CAAQ;QAAY,WAAM,GAAN,MAAM,CAAS;QAAY,eAAU,GAAV,UAAU,CAAU;QAC7F,MAAM,IAAI,6BAAoB,EAAE,CAAC;IACnC,CAAC;CACF;AA+BsC,4BAAQ;AAnB/C,SAAS,YAAY,CACnB,YAA2D,EAC3D,OAA+B;IAE/B,IAAI,eAAe,GAA0B,EAAE,CAAC;IAEhD,IAAI,OAAO,YAAY,KAAK,QAAQ,IAAI,OAAO,YAAY,KAAK,UAAU,EAAE;QAC1E,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;YAC/B,eAAe,GAAG,OAAO,CAAC;SAC3B;QAED,eAAe,CAAC,GAAG,GAAG,YAAY,CAAC;KACpC;SAAM,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE;QAC3C,eAAe,GAAG,YAAY,CAAC;KAChC;IAED,OAAO,IAAI,wBAAc,CAAC,eAAe,CAAC,CAAC;AAC7C,CAAC;AAEQ,oCAAY;AAErB;;GAEG;AACH,6CAA2B;AAC3B,8CAA4B;AAC5B,8CAA4B;AAC5B,kDAAgC;AAChC,+CAA6B;AAC7B,gDAA8B;AAE9B;;;;;;;;;GASG;AACH,+CAAiD;AAAxC,kGAAA,MAAM,OAAA;AAAE,+FAAA,GAAG,OAAA"}
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FetchOptions } from "./types/Fetch";
|
|
1
|
+
import type { DefaultNamespaceOptions, DefaultClientOptions } from "./types";
|
|
3
2
|
export declare const NODE_VERSION: string;
|
|
3
|
+
export declare const BROWSER_AGENT: string;
|
|
4
4
|
export declare const DEFAULT_HEADERS: {
|
|
5
5
|
"Content-Type": string;
|
|
6
6
|
"X-Client-Info": string;
|
|
7
7
|
"User-Agent": string;
|
|
8
8
|
};
|
|
9
9
|
export declare const DEFAULT_URL = "https://api.deepgram.com";
|
|
10
|
-
export declare const DEFAULT_GLOBAL_OPTIONS:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
export declare const DEFAULT_GLOBAL_OPTIONS: Partial<DefaultNamespaceOptions>;
|
|
11
|
+
export declare const DEFAULT_OPTIONS: DefaultClientOptions;
|
|
12
|
+
export declare enum SOCKET_STATES {
|
|
13
|
+
connecting = 0,
|
|
14
|
+
open = 1,
|
|
15
|
+
closing = 2,
|
|
16
|
+
closed = 3
|
|
17
|
+
}
|
|
18
|
+
export declare enum CONNECTION_STATE {
|
|
19
|
+
Connecting = "connecting",
|
|
20
|
+
Open = "open",
|
|
21
|
+
Closing = "closing",
|
|
22
|
+
Closed = "closed"
|
|
23
|
+
}
|
|
15
24
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE7E,eAAO,MAAM,YAAY,QAGV,CAAC;AAEhB,eAAO,MAAM,aAAa,QAGX,CAAC;AAEhB,eAAO,MAAM,eAAe;;;;CAM3B,CAAC;AAEF,eAAO,MAAM,WAAW,6BAA6B,CAAC;AAEtD,eAAO,MAAM,sBAAsB,EAAE,OAAO,CAAC,uBAAuB,CAKnE,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,oBAE7B,CAAC;AAEF,oBAAY,aAAa;IACvB,UAAU,IAAI;IACd,IAAI,IAAI;IACR,OAAO,IAAI;IACX,MAAM,IAAI;CACX;AAED,oBAAY,gBAAgB;IAC1B,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB"}
|
|
@@ -1,24 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
3
|
+
exports.CONNECTION_STATE = exports.SOCKET_STATES = exports.DEFAULT_OPTIONS = exports.DEFAULT_GLOBAL_OPTIONS = exports.DEFAULT_URL = exports.DEFAULT_HEADERS = exports.BROWSER_AGENT = exports.NODE_VERSION = void 0;
|
|
5
4
|
const helpers_1 = require("./helpers");
|
|
6
5
|
const version_1 = require("./version");
|
|
7
|
-
exports.NODE_VERSION = typeof process
|
|
6
|
+
exports.NODE_VERSION = typeof process !== "undefined" && process.versions && process.versions.node
|
|
7
|
+
? process.versions.node
|
|
8
|
+
: "unknown";
|
|
9
|
+
exports.BROWSER_AGENT = typeof window !== "undefined" && window.navigator && window.navigator.userAgent
|
|
10
|
+
? window.navigator.userAgent
|
|
11
|
+
: "unknown";
|
|
8
12
|
exports.DEFAULT_HEADERS = {
|
|
9
13
|
"Content-Type": `application/json`,
|
|
10
14
|
"X-Client-Info": `@deepgram/sdk; ${(0, helpers_1.isBrowser)() ? "browser" : "server"}; v${version_1.version}`,
|
|
11
|
-
"User-Agent": `@deepgram/sdk/${version_1.version} ${(0, helpers_1.isBrowser)() ?
|
|
15
|
+
"User-Agent": `@deepgram/sdk/${version_1.version} ${(0, helpers_1.isBrowser)() ? `javascript ${exports.BROWSER_AGENT}` : `node/${exports.NODE_VERSION}`}`,
|
|
12
16
|
};
|
|
13
17
|
exports.DEFAULT_URL = "https://api.deepgram.com";
|
|
14
18
|
exports.DEFAULT_GLOBAL_OPTIONS = {
|
|
15
|
-
url: exports.DEFAULT_URL,
|
|
16
|
-
|
|
17
|
-
exports.
|
|
18
|
-
|
|
19
|
+
fetch: { options: { url: exports.DEFAULT_URL, headers: exports.DEFAULT_HEADERS } },
|
|
20
|
+
websocket: {
|
|
21
|
+
options: { url: (0, helpers_1.convertProtocolToWs)(exports.DEFAULT_URL), _nodeOnlyHeaders: exports.DEFAULT_HEADERS },
|
|
22
|
+
},
|
|
19
23
|
};
|
|
20
24
|
exports.DEFAULT_OPTIONS = {
|
|
21
25
|
global: exports.DEFAULT_GLOBAL_OPTIONS,
|
|
22
|
-
fetch: exports.DEFAULT_FETCH_OPTIONS,
|
|
23
26
|
};
|
|
27
|
+
var SOCKET_STATES;
|
|
28
|
+
(function (SOCKET_STATES) {
|
|
29
|
+
SOCKET_STATES[SOCKET_STATES["connecting"] = 0] = "connecting";
|
|
30
|
+
SOCKET_STATES[SOCKET_STATES["open"] = 1] = "open";
|
|
31
|
+
SOCKET_STATES[SOCKET_STATES["closing"] = 2] = "closing";
|
|
32
|
+
SOCKET_STATES[SOCKET_STATES["closed"] = 3] = "closed";
|
|
33
|
+
})(SOCKET_STATES = exports.SOCKET_STATES || (exports.SOCKET_STATES = {}));
|
|
34
|
+
var CONNECTION_STATE;
|
|
35
|
+
(function (CONNECTION_STATE) {
|
|
36
|
+
CONNECTION_STATE["Connecting"] = "connecting";
|
|
37
|
+
CONNECTION_STATE["Open"] = "open";
|
|
38
|
+
CONNECTION_STATE["Closing"] = "closing";
|
|
39
|
+
CONNECTION_STATE["Closed"] = "closed";
|
|
40
|
+
})(CONNECTION_STATE = exports.CONNECTION_STATE || (exports.CONNECTION_STATE = {}));
|
|
24
41
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":";;;AAAA,uCAA2D;AAC3D,uCAAoC;AAGvB,QAAA,YAAY,GACvB,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI;IACzE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI;IACvB,CAAC,CAAC,SAAS,CAAC;AAEH,QAAA,aAAa,GACxB,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC,SAAS;IAC7E,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS;IAC5B,CAAC,CAAC,SAAS,CAAC;AAEH,QAAA,eAAe,GAAG;IAC7B,cAAc,EAAE,kBAAkB;IAClC,eAAe,EAAE,kBAAkB,IAAA,mBAAS,GAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,MAAM,iBAAO,EAAE;IACpF,YAAY,EAAE,iBAAiB,iBAAO,IACpC,IAAA,mBAAS,GAAE,CAAC,CAAC,CAAC,cAAc,qBAAa,EAAE,CAAC,CAAC,CAAC,QAAQ,oBAAY,EACpE,EAAE;CACH,CAAC;AAEW,QAAA,WAAW,GAAG,0BAA0B,CAAC;AAEzC,QAAA,sBAAsB,GAAqC;IACtE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,mBAAW,EAAE,OAAO,EAAE,uBAAe,EAAE,EAAE;IAClE,SAAS,EAAE;QACT,OAAO,EAAE,EAAE,GAAG,EAAE,IAAA,6BAAmB,EAAC,mBAAW,CAAC,EAAE,gBAAgB,EAAE,uBAAe,EAAE;KACtF;CACF,CAAC;AAEW,QAAA,eAAe,GAAyB;IACnD,MAAM,EAAE,8BAAsB;CAC/B,CAAC;AAEF,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,6DAAc,CAAA;IACd,iDAAQ,CAAA;IACR,uDAAW,CAAA;IACX,qDAAU,CAAA;AACZ,CAAC,EALW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAKxB;AAED,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,6CAAyB,CAAA;IACzB,iCAAa,CAAA;IACb,uCAAmB,CAAA;IACnB,qCAAiB,CAAA;AACnB,CAAC,EALW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAK3B"}
|