@deepgram/sdk 3.11.2 → 3.12.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 +145 -4
- package/dist/main/DeepgramClient.d.ts +8 -1
- package/dist/main/DeepgramClient.d.ts.map +1 -1
- package/dist/main/DeepgramClient.js +9 -0
- package/dist/main/DeepgramClient.js.map +1 -1
- package/dist/main/lib/constants.d.ts +0 -3
- package/dist/main/lib/constants.d.ts.map +1 -1
- package/dist/main/lib/constants.js +9 -17
- package/dist/main/lib/constants.js.map +1 -1
- package/dist/main/lib/helpers.d.ts +0 -3
- package/dist/main/lib/helpers.d.ts.map +1 -1
- package/dist/main/lib/helpers.js +1 -8
- package/dist/main/lib/helpers.js.map +1 -1
- package/dist/main/lib/runtime.d.ts +7 -0
- package/dist/main/lib/runtime.d.ts.map +1 -0
- package/dist/main/lib/runtime.js +19 -0
- package/dist/main/lib/runtime.js.map +1 -0
- package/dist/main/lib/types/GrantTokenResponse.d.ts +5 -0
- package/dist/main/lib/types/GrantTokenResponse.d.ts.map +1 -0
- package/dist/main/lib/types/GrantTokenResponse.js +3 -0
- package/dist/main/lib/types/GrantTokenResponse.js.map +1 -0
- package/dist/main/lib/types/index.d.ts +1 -0
- package/dist/main/lib/types/index.d.ts.map +1 -1
- package/dist/main/lib/types/index.js +1 -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/AbstractLiveClient.js +2 -2
- package/dist/main/packages/AbstractRestClient.js +2 -2
- package/dist/main/packages/AuthRestClient.d.ts +13 -0
- package/dist/main/packages/AuthRestClient.d.ts.map +1 -0
- package/dist/main/packages/AuthRestClient.js +42 -0
- package/dist/main/packages/AuthRestClient.js.map +1 -0
- package/dist/main/packages/ManageRestClient.d.ts +3 -31
- package/dist/main/packages/ManageRestClient.d.ts.map +1 -1
- package/dist/main/packages/ManageRestClient.js +3 -31
- package/dist/main/packages/ManageRestClient.js.map +1 -1
- package/dist/main/packages/index.d.ts +1 -0
- package/dist/main/packages/index.d.ts.map +1 -1
- package/dist/main/packages/index.js +1 -0
- package/dist/main/packages/index.js.map +1 -1
- package/dist/module/DeepgramClient.d.ts +8 -1
- package/dist/module/DeepgramClient.d.ts.map +1 -1
- package/dist/module/DeepgramClient.js +10 -1
- package/dist/module/DeepgramClient.js.map +1 -1
- package/dist/module/lib/constants.d.ts +0 -3
- package/dist/module/lib/constants.d.ts.map +1 -1
- package/dist/module/lib/constants.js +2 -10
- package/dist/module/lib/constants.js.map +1 -1
- package/dist/module/lib/helpers.d.ts +0 -3
- package/dist/module/lib/helpers.d.ts.map +1 -1
- package/dist/module/lib/helpers.js +0 -4
- package/dist/module/lib/helpers.js.map +1 -1
- package/dist/module/lib/runtime.d.ts +7 -0
- package/dist/module/lib/runtime.d.ts.map +1 -0
- package/dist/module/lib/runtime.js +13 -0
- package/dist/module/lib/runtime.js.map +1 -0
- package/dist/module/lib/types/GrantTokenResponse.d.ts +5 -0
- package/dist/module/lib/types/GrantTokenResponse.d.ts.map +1 -0
- package/dist/module/lib/types/GrantTokenResponse.js +2 -0
- package/dist/module/lib/types/GrantTokenResponse.js.map +1 -0
- package/dist/module/lib/types/index.d.ts +1 -0
- package/dist/module/lib/types/index.d.ts.map +1 -1
- package/dist/module/lib/types/index.js +1 -0
- 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/AbstractLiveClient.js +1 -1
- package/dist/module/packages/AbstractRestClient.js +1 -1
- package/dist/module/packages/AuthRestClient.d.ts +13 -0
- package/dist/module/packages/AuthRestClient.d.ts.map +1 -0
- package/dist/module/packages/AuthRestClient.js +38 -0
- package/dist/module/packages/AuthRestClient.js.map +1 -0
- package/dist/module/packages/ManageRestClient.d.ts +3 -31
- package/dist/module/packages/ManageRestClient.d.ts.map +1 -1
- package/dist/module/packages/ManageRestClient.js +3 -31
- package/dist/module/packages/ManageRestClient.js.map +1 -1
- package/dist/module/packages/index.d.ts +1 -0
- package/dist/module/packages/index.d.ts.map +1 -1
- package/dist/module/packages/index.js +1 -0
- package/dist/module/packages/index.js.map +1 -1
- package/dist/umd/deepgram.js +1 -1
- package/package.json +1 -1
- package/src/DeepgramClient.ts +10 -0
- package/src/lib/constants.ts +2 -16
- package/src/lib/helpers.ts +0 -7
- package/src/lib/runtime.ts +20 -0
- package/src/lib/types/GrantTokenResponse.ts +4 -0
- package/src/lib/types/index.ts +1 -0
- package/src/lib/version.ts +1 -1
- package/src/packages/AbstractLiveClient.ts +1 -1
- package/src/packages/AbstractRestClient.ts +1 -1
- package/src/packages/AuthRestClient.ts +32 -0
- package/src/packages/ManageRestClient.ts +3 -31
- package/src/packages/index.ts +1 -0
package/README.md
CHANGED
|
@@ -31,8 +31,11 @@ Official JavaScript SDK for [Deepgram](https://www.deepgram.com/). Power your ap
|
|
|
31
31
|
- [Transcription (Live / Streaming)](#transcription-live--streaming)
|
|
32
32
|
- [Live Audio](#live-audio)
|
|
33
33
|
- [Transcribing to captions](#transcribing-to-captions)
|
|
34
|
+
- [Voice Agent](#voice-agent)
|
|
34
35
|
- [Text to Speech](#text-to-speech)
|
|
35
36
|
- [Text Intelligence](#text-intelligence)
|
|
37
|
+
- [Authentication](#authentication)
|
|
38
|
+
- [Get Token Details](#get-token-details)
|
|
36
39
|
- [Projects](#projects)
|
|
37
40
|
- [Get Projects](#get-projects)
|
|
38
41
|
- [Get Project](#get-project)
|
|
@@ -62,6 +65,9 @@ Official JavaScript SDK for [Deepgram](https://www.deepgram.com/). Power your ap
|
|
|
62
65
|
- [Billing](#billing)
|
|
63
66
|
- [Get All Balances](#get-all-balances)
|
|
64
67
|
- [Get Balance](#get-balance)
|
|
68
|
+
- [Models](#models)
|
|
69
|
+
- [Get All Models](#get-all-models)
|
|
70
|
+
- [Get Model](#get-model)
|
|
65
71
|
- [On-Prem APIs](#on-prem-apis)
|
|
66
72
|
- [List On-Prem credentials](#list-on-prem-credentials)
|
|
67
73
|
- [Get On-Prem credentials](#get-on-prem-credentials)
|
|
@@ -148,7 +154,7 @@ const deepgram = createClient(DEEPGRAM_API_KEY);
|
|
|
148
154
|
|
|
149
155
|
## Scoped Configuration
|
|
150
156
|
|
|
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
|
|
157
|
+
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
158
|
|
|
153
159
|
### 1. Global Defaults
|
|
154
160
|
|
|
@@ -380,6 +386,101 @@ const vttOutput = webvtt(result);
|
|
|
380
386
|
|
|
381
387
|
[See our standalone captions library for more information](https://github.com/deepgram/deepgram-node-captions).
|
|
382
388
|
|
|
389
|
+
## Voice Agent
|
|
390
|
+
|
|
391
|
+
```js
|
|
392
|
+
import { createClient } from "@deepgram/sdk";
|
|
393
|
+
import { AgentEvents } from "@deepgram/sdk";
|
|
394
|
+
|
|
395
|
+
const deepgram = createClient(DEEPGRAM_API_KEY);
|
|
396
|
+
|
|
397
|
+
// Create an agent connection
|
|
398
|
+
const agent = deepgram.agent.live();
|
|
399
|
+
|
|
400
|
+
// Set up event handlers
|
|
401
|
+
agent.on(AgentEvents.Open, () => {
|
|
402
|
+
console.log("Connection opened");
|
|
403
|
+
|
|
404
|
+
// Configure the agent once connection is established
|
|
405
|
+
agent.configure({
|
|
406
|
+
audio: {
|
|
407
|
+
input: {
|
|
408
|
+
encoding: "linear16",
|
|
409
|
+
sampleRate: 16000,
|
|
410
|
+
},
|
|
411
|
+
output: {
|
|
412
|
+
encoding: "linear16",
|
|
413
|
+
container: "wav",
|
|
414
|
+
sampleRate: 24000,
|
|
415
|
+
},
|
|
416
|
+
},
|
|
417
|
+
agent: {
|
|
418
|
+
listen: {
|
|
419
|
+
model: "nova-3",
|
|
420
|
+
},
|
|
421
|
+
speak: {
|
|
422
|
+
model: "aura-asteria-en",
|
|
423
|
+
},
|
|
424
|
+
think: {
|
|
425
|
+
provider: {
|
|
426
|
+
type: "anthropic",
|
|
427
|
+
},
|
|
428
|
+
model: "claude-3-haiku-20240307",
|
|
429
|
+
instructions: "You are a helpful AI assistant. Keep responses brief and friendly.",
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
});
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
// Handle agent responses
|
|
436
|
+
agent.on(AgentEvents.AgentStartedSpeaking, (data) => {
|
|
437
|
+
console.log("Agent started speaking:", data["total_latency"]);
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
agent.on(AgentEvents.ConversationText, (message) => {
|
|
441
|
+
console.log(`${message.role} said: ${message.content}`);
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
agent.on(AgentEvents.Audio, (audio) => {
|
|
445
|
+
// Handle audio data from the agent
|
|
446
|
+
playAudio(audio); // Your audio playback implementation
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
agent.on(AgentEvents.Error, (error) => {
|
|
450
|
+
console.error("Error:", error);
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
agent.on(AgentEvents.Close, () => {
|
|
454
|
+
console.log("Connection closed");
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
// Send audio data
|
|
458
|
+
function sendAudioData(audioData) {
|
|
459
|
+
agent.send(audioData);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// Keep the connection alive
|
|
463
|
+
setInterval(() => {
|
|
464
|
+
agent.keepAlive();
|
|
465
|
+
}, 8000);
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
This example demonstrates:
|
|
469
|
+
|
|
470
|
+
- Setting up a WebSocket connection
|
|
471
|
+
- Configuring the agent with speech, language, and audio settings
|
|
472
|
+
- Handling various agent events (speech, transcripts, audio)
|
|
473
|
+
- Sending audio data and keeping the connection alive
|
|
474
|
+
|
|
475
|
+
For a complete implementation, you would need to:
|
|
476
|
+
|
|
477
|
+
1. Add your audio input source (e.g., microphone)
|
|
478
|
+
2. Implement audio playback for the agent's responses
|
|
479
|
+
3. Handle any function calls if your agent uses them
|
|
480
|
+
4. Add proper error handling and connection management
|
|
481
|
+
|
|
482
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/voice-agent-api/agent)
|
|
483
|
+
|
|
383
484
|
## Text to Speech
|
|
384
485
|
|
|
385
486
|
### Rest
|
|
@@ -434,6 +535,18 @@ const { result, error } = await deepgram.read.analyzeText(
|
|
|
434
535
|
|
|
435
536
|
[See our API reference for more info](https://developers.deepgram.com/reference/analyze-text).
|
|
436
537
|
|
|
538
|
+
## Authentication
|
|
539
|
+
|
|
540
|
+
### Get Token Details
|
|
541
|
+
|
|
542
|
+
Retrieves the details of the current authentication token.
|
|
543
|
+
|
|
544
|
+
```js
|
|
545
|
+
const { result, error } = await deepgram.manage.getTokenDetails();
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/authentication)
|
|
549
|
+
|
|
437
550
|
## Projects
|
|
438
551
|
|
|
439
552
|
### Get Projects
|
|
@@ -615,11 +728,9 @@ const { result, error } = await deepgram.manage.leaveProject(projectId);
|
|
|
615
728
|
Retrieves all requests associated with the provided project_id based on the provided options.
|
|
616
729
|
|
|
617
730
|
```js
|
|
618
|
-
const { result, error } = await deepgram.manage.
|
|
731
|
+
const { result, error } = await deepgram.manage.getProjectUsageRequests(projectId, options);
|
|
619
732
|
```
|
|
620
733
|
|
|
621
|
-
[See our API reference for more info](https://developers.deepgram.com/reference/get-all-requests).
|
|
622
|
-
|
|
623
734
|
### Get Request
|
|
624
735
|
|
|
625
736
|
Retrieves a specific request associated with the provided project_id.
|
|
@@ -672,6 +783,28 @@ const { result, error } = await deepgram.manage.getProjectBalance(projectId, bal
|
|
|
672
783
|
|
|
673
784
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-balance).
|
|
674
785
|
|
|
786
|
+
## Models
|
|
787
|
+
|
|
788
|
+
### Get All Models
|
|
789
|
+
|
|
790
|
+
Retrieves all models available for a given project.
|
|
791
|
+
|
|
792
|
+
```js
|
|
793
|
+
const { result, error } = await deepgram.manage.getAllModels(projectId, {});
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/management-api/models/list)
|
|
797
|
+
|
|
798
|
+
### Get Model
|
|
799
|
+
|
|
800
|
+
Retrieves details of a specific model.
|
|
801
|
+
|
|
802
|
+
```js
|
|
803
|
+
const { result, error } = await deepgram.manage.getModel(projectId, modelId);
|
|
804
|
+
```
|
|
805
|
+
|
|
806
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/management-api/models/get)
|
|
807
|
+
|
|
675
808
|
## On-Prem APIs
|
|
676
809
|
|
|
677
810
|
### List On-Prem credentials
|
|
@@ -680,24 +813,32 @@ const { result, error } = await deepgram.manage.getProjectBalance(projectId, bal
|
|
|
680
813
|
const { result, error } = await deepgram.onprem.listCredentials(projectId);
|
|
681
814
|
```
|
|
682
815
|
|
|
816
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/self-hosted-api/list-credentials)
|
|
817
|
+
|
|
683
818
|
### Get On-Prem credentials
|
|
684
819
|
|
|
685
820
|
```js
|
|
686
821
|
const { result, error } = await deepgram.onprem.getCredentials(projectId, credentialId);
|
|
687
822
|
```
|
|
688
823
|
|
|
824
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/self-hosted-api/get-credentials)
|
|
825
|
+
|
|
689
826
|
### Create On-Prem credentials
|
|
690
827
|
|
|
691
828
|
```js
|
|
692
829
|
const { result, error } = await deepgram.onprem.createCredentials(projectId, options);
|
|
693
830
|
```
|
|
694
831
|
|
|
832
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/self-hosted-api/create-credentials)
|
|
833
|
+
|
|
695
834
|
### Delete On-Prem credentials
|
|
696
835
|
|
|
697
836
|
```js
|
|
698
837
|
const { result, error } = await deepgram.onprem.deleteCredentials(projectId, credentialId);
|
|
699
838
|
```
|
|
700
839
|
|
|
840
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/self-hosted-api/delete-credentials)
|
|
841
|
+
|
|
701
842
|
## Backwards Compatibility
|
|
702
843
|
|
|
703
844
|
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.
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import { AbstractClient, AgentLiveClient, ListenClient, ManageClient, ReadClient, OnPremClient, SelfHostedRestClient, SpeakClient, ModelsRestClient } from "./packages";
|
|
1
|
+
import { AbstractClient, AgentLiveClient, AuthRestClient, ListenClient, ManageClient, ReadClient, OnPremClient, SelfHostedRestClient, SpeakClient, ModelsRestClient } from "./packages";
|
|
2
2
|
/**
|
|
3
3
|
* The DeepgramClient class provides access to various Deepgram API clients, including ListenClient, ManageClient, SelfHostedRestClient, ReadClient, and SpeakClient.
|
|
4
4
|
*
|
|
5
5
|
* @see https://github.com/deepgram/deepgram-js-sdk
|
|
6
6
|
*/
|
|
7
7
|
export default class DeepgramClient extends AbstractClient {
|
|
8
|
+
/**
|
|
9
|
+
* Returns a new instance of the AuthRestClient, which provides access to the Deepgram API's temporary token endpoints.
|
|
10
|
+
*
|
|
11
|
+
* @returns {AuthRestClient} A new instance of the AuthRestClient.
|
|
12
|
+
* @see https://developers.deepgram.com/reference/token-based-auth-api/grant-token
|
|
13
|
+
*/
|
|
14
|
+
get auth(): AuthRestClient;
|
|
8
15
|
/**
|
|
9
16
|
* Returns a new instance of the ListenClient, which provides access to the Deepgram API's listening functionality.
|
|
10
17
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeepgramClient.d.ts","sourceRoot":"","sources":["../../src/DeepgramClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,gBAAgB,EACjB,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;;;;OAIG;IACH,IAAI,MAAM,IAAI,gBAAgB,CAE7B;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;;;;;OAKG;IACI,KAAK,CAAC,QAAQ,GAAE,MAAiB,GAAG,eAAe;IAI1D;;;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
|
+
{"version":3,"file":"DeepgramClient.d.ts","sourceRoot":"","sources":["../../src/DeepgramClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,cAAc;IACxD;;;;;OAKG;IACH,IAAI,IAAI,IAAI,cAAc,CAEzB;IACD;;;;OAIG;IACH,IAAI,MAAM,IAAI,YAAY,CAEzB;IAED;;;;OAIG;IACH,IAAI,MAAM,IAAI,YAAY,CAEzB;IAED;;;;OAIG;IACH,IAAI,MAAM,IAAI,gBAAgB,CAE7B;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;;;;;OAKG;IACI,KAAK,CAAC,QAAQ,GAAE,MAAiB,GAAG,eAAe;IAI1D;;;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"}
|
|
@@ -8,6 +8,15 @@ const packages_1 = require("./packages");
|
|
|
8
8
|
* @see https://github.com/deepgram/deepgram-js-sdk
|
|
9
9
|
*/
|
|
10
10
|
class DeepgramClient extends packages_1.AbstractClient {
|
|
11
|
+
/**
|
|
12
|
+
* Returns a new instance of the AuthRestClient, which provides access to the Deepgram API's temporary token endpoints.
|
|
13
|
+
*
|
|
14
|
+
* @returns {AuthRestClient} A new instance of the AuthRestClient.
|
|
15
|
+
* @see https://developers.deepgram.com/reference/token-based-auth-api/grant-token
|
|
16
|
+
*/
|
|
17
|
+
get auth() {
|
|
18
|
+
return new packages_1.AuthRestClient(this.options);
|
|
19
|
+
}
|
|
11
20
|
/**
|
|
12
21
|
* Returns a new instance of the ListenClient, which provides access to the Deepgram API's listening functionality.
|
|
13
22
|
*
|
|
@@ -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,yCAWoB;AAEpB;;;;GAIG;AACH,MAAqB,cAAe,SAAQ,yBAAc;IACxD;;;;;OAKG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,yBAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IACD;;;;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;;;;OAIG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,2BAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5C,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;;;;;OAKG;IACI,KAAK,CAAC,WAAmB,QAAQ;QACtC,OAAO,IAAI,0BAAe,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACrD,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;AAnJD,iCAmJC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import type { DefaultNamespaceOptions, DefaultClientOptions } from "./types";
|
|
2
|
-
export declare const NODE_VERSION: string;
|
|
3
|
-
export declare const BUN_VERSION: string;
|
|
4
|
-
export declare const BROWSER_AGENT: string;
|
|
5
2
|
export declare const DEFAULT_HEADERS: {
|
|
6
3
|
"Content-Type": string;
|
|
7
4
|
"X-Client-Info": string;
|
|
@@ -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":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAc7E,eAAO,MAAM,eAAe;;;;CAI3B,CAAC;AAEF,eAAO,MAAM,WAAW,6BAA6B,CAAC;AACtD,eAAO,MAAM,iBAAiB,6BAA6B,CAAC;AAE5D,eAAO,MAAM,sBAAsB,EAAE,OAAO,CAAC,uBAAuB,CAKnE,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,OAAO,CAAC,uBAAuB,CAKlE,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,oBAG7B,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,26 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CONNECTION_STATE = exports.SOCKET_STATES = exports.DEFAULT_OPTIONS = exports.DEFAULT_AGENT_OPTIONS = exports.DEFAULT_GLOBAL_OPTIONS = exports.DEFAULT_AGENT_URL = exports.DEFAULT_URL = exports.DEFAULT_HEADERS =
|
|
3
|
+
exports.CONNECTION_STATE = exports.SOCKET_STATES = exports.DEFAULT_OPTIONS = exports.DEFAULT_AGENT_OPTIONS = exports.DEFAULT_GLOBAL_OPTIONS = exports.DEFAULT_AGENT_URL = exports.DEFAULT_URL = exports.DEFAULT_HEADERS = void 0;
|
|
4
4
|
const helpers_1 = require("./helpers");
|
|
5
|
+
const runtime_1 = require("./runtime");
|
|
5
6
|
const version_1 = require("./version");
|
|
6
|
-
exports.NODE_VERSION = typeof process !== "undefined" && process.versions && process.versions.node
|
|
7
|
-
? process.versions.node
|
|
8
|
-
: "unknown";
|
|
9
|
-
exports.BUN_VERSION = typeof process !== "undefined" && process.versions && process.versions.bun
|
|
10
|
-
? process.versions.bun
|
|
11
|
-
: "unknown";
|
|
12
|
-
exports.BROWSER_AGENT = typeof window !== "undefined" && window.navigator && window.navigator.userAgent
|
|
13
|
-
? window.navigator.userAgent
|
|
14
|
-
: "unknown";
|
|
15
7
|
const getAgent = () => {
|
|
16
|
-
if ((0,
|
|
17
|
-
return `node/${
|
|
8
|
+
if ((0, runtime_1.isNode)()) {
|
|
9
|
+
return `node/${runtime_1.NODE_VERSION}`;
|
|
18
10
|
}
|
|
19
|
-
else if ((0,
|
|
20
|
-
return `bun/${
|
|
11
|
+
else if ((0, runtime_1.isBun)()) {
|
|
12
|
+
return `bun/${runtime_1.BUN_VERSION}`;
|
|
21
13
|
}
|
|
22
|
-
else if ((0,
|
|
23
|
-
return `javascript ${
|
|
14
|
+
else if ((0, runtime_1.isBrowser)()) {
|
|
15
|
+
return `javascript ${runtime_1.BROWSER_AGENT}`;
|
|
24
16
|
}
|
|
25
17
|
else {
|
|
26
18
|
return `unknown`;
|
|
@@ -28,7 +20,7 @@ const getAgent = () => {
|
|
|
28
20
|
};
|
|
29
21
|
exports.DEFAULT_HEADERS = {
|
|
30
22
|
"Content-Type": `application/json`,
|
|
31
|
-
"X-Client-Info": `@deepgram/sdk; ${(0,
|
|
23
|
+
"X-Client-Info": `@deepgram/sdk; ${(0, runtime_1.isBrowser)() ? "browser" : "server"}; v${version_1.version}`,
|
|
32
24
|
"User-Agent": `@deepgram/sdk/${version_1.version} ${getAgent()}`,
|
|
33
25
|
};
|
|
34
26
|
exports.DEFAULT_URL = "https://api.deepgram.com";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../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W,QAAA,eAAe,GAAyB;IACnD,MAAM,EAAE,8BAAsB;IAC9B,KAAK,EAAE,6BAAqB;CAC7B,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"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { DeepgramClientOptions, FileSource, PrerecordedSource, UrlSource, TextSource, AnalyzeSource, LiveSchema, TranscriptionSchema } from "./types";
|
|
2
2
|
export declare function stripTrailingSlash(url: string): string;
|
|
3
|
-
export declare const isBrowser: () => boolean;
|
|
4
|
-
export declare const isNode: () => boolean;
|
|
5
|
-
export declare const isBun: () => boolean;
|
|
6
3
|
export declare function applyDefaults<O, S>(options?: Partial<O>, subordinate?: Partial<S>): S;
|
|
7
4
|
export declare function appendSearchParams(searchParams: URLSearchParams, options: Record<string, unknown>): void;
|
|
8
5
|
export declare const resolveHeadersConstructor: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,aAAa,EACb,UAAU,EACV,mBAAmB,EACpB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,aAAa,EACb,UAAU,EACV,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAKjB,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,GAAE,OAAO,CAAC,CAAC,CAAM,EAAE,WAAW,GAAE,OAAO,CAAC,CAAC,CAAM,GAAG,CAAC,CAE7F;AAED,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,eAAe,EAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,IAAI,CAWN;AAED,eAAO,MAAM,yBAAyB;;;CAMrC,CAAC;AAEF,eAAO,MAAM,WAAW,mBACN,iBAAiB,GAAG,aAAa,gCAKlD,CAAC;AAEF,eAAO,MAAM,YAAY,mBACP,iBAAiB,GAAG,aAAa,iCAKlD,CAAC;AAEF,eAAO,MAAM,YAAY,mBAAoB,iBAAiB,iCAI7D,CAAC;AAcF,qBAAa,WAAY,SAAQ,GAAG;IAC3B,WAAW,UAAQ;CAC3B;AAED,eAAO,MAAM,mBAAmB,QAAS,MAAM,WAI9C,CAAC;AAEF,eAAO,MAAM,eAAe,aAChB,MAAM,WACP,MAAM,GAAG,GAAG,wBACC,UAAU,GAAG,mBAAmB,KACrD,GAKF,CAAC;AAEF,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,UAAU,CAExD;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,qBAAqB,CAE9E;AAED,eAAO,MAAM,oBAAoB,eAAgB,qBAAqB,KAAG,qBA8DxE,CAAC"}
|
package/dist/main/lib/helpers.js
CHANGED
|
@@ -3,20 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.convertLegacyOptions = exports.isDeepgramClientOptions = exports.isLiveSchema = exports.buildRequestUrl = exports.convertProtocolToWs = exports.CallbackUrl = exports.isFileSource = exports.isTextSource = exports.isUrlSource = exports.resolveHeadersConstructor = exports.appendSearchParams = exports.applyDefaults = exports.
|
|
6
|
+
exports.convertLegacyOptions = exports.isDeepgramClientOptions = exports.isLiveSchema = exports.buildRequestUrl = exports.convertProtocolToWs = exports.CallbackUrl = exports.isFileSource = exports.isTextSource = exports.isUrlSource = exports.resolveHeadersConstructor = exports.appendSearchParams = exports.applyDefaults = exports.stripTrailingSlash = void 0;
|
|
7
7
|
const cross_fetch_1 = require("cross-fetch");
|
|
8
8
|
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
9
|
-
const constants_1 = require("./constants");
|
|
10
9
|
function stripTrailingSlash(url) {
|
|
11
10
|
return url.replace(/\/$/, "");
|
|
12
11
|
}
|
|
13
12
|
exports.stripTrailingSlash = stripTrailingSlash;
|
|
14
|
-
const isBrowser = () => constants_1.BROWSER_AGENT !== "unknown";
|
|
15
|
-
exports.isBrowser = isBrowser;
|
|
16
|
-
const isNode = () => constants_1.NODE_VERSION !== "unknown";
|
|
17
|
-
exports.isNode = isNode;
|
|
18
|
-
const isBun = () => constants_1.BUN_VERSION !== "unknown";
|
|
19
|
-
exports.isBun = isBun;
|
|
20
13
|
function applyDefaults(options = {}, subordinate = {}) {
|
|
21
14
|
return (0, deepmerge_1.default)(subordinate, options);
|
|
22
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":";;;;;;AAUA,6CAA2D;AAE3D,0DAA8B;
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/lib/helpers.ts"],"names":[],"mappings":";;;;;;AAUA,6CAA2D;AAE3D,0DAA8B;AAE9B,SAAgB,kBAAkB,CAAC,GA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U,CAAC,CAAC;IAE3C,IAAI,MAAA,UAAU,CAAC,MAAM,0CAAE,OAAO,EAAE;QAC9B,UAAU,CAAC,MAAM,GAAG;YAClB,KAAK,EAAE;gBACL,OAAO,EAAE;oBACP,OAAO,EAAE,MAAA,UAAU,CAAC,MAAM,0CAAE,OAAO;iBACpC;aACF;YACD,SAAS,EAAE;gBACT,OAAO,EAAE;oBACP,gBAAgB,EAAE,MAAA,UAAU,CAAC,MAAM,0CAAE,OAAO;iBAC7C;aACF;SACF,CAAC;KACH;IAED,UAAU,GAAG,IAAA,mBAAK,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAE3C,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AA9DW,QAAA,oBAAoB,wBA8D/B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const NODE_VERSION: string;
|
|
2
|
+
export declare const BUN_VERSION: string;
|
|
3
|
+
export declare const BROWSER_AGENT: string;
|
|
4
|
+
export declare const isBrowser: () => boolean;
|
|
5
|
+
export declare const isNode: () => boolean;
|
|
6
|
+
export declare const isBun: () => boolean;
|
|
7
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/lib/runtime.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,QAGV,CAAC;AAEhB,eAAO,MAAM,WAAW,QAGT,CAAC;AAEhB,eAAO,MAAM,aAAa,QAGX,CAAC;AAEhB,eAAO,MAAM,SAAS,eAAoC,CAAC;AAE3D,eAAO,MAAM,MAAM,eAAmC,CAAC;AAEvD,eAAO,MAAM,KAAK,eAAkC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isBun = exports.isNode = exports.isBrowser = exports.BROWSER_AGENT = exports.BUN_VERSION = exports.NODE_VERSION = void 0;
|
|
4
|
+
exports.NODE_VERSION = typeof process !== "undefined" && process.versions && process.versions.node
|
|
5
|
+
? process.versions.node
|
|
6
|
+
: "unknown";
|
|
7
|
+
exports.BUN_VERSION = typeof process !== "undefined" && process.versions && process.versions.bun
|
|
8
|
+
? process.versions.bun
|
|
9
|
+
: "unknown";
|
|
10
|
+
exports.BROWSER_AGENT = typeof window !== "undefined" && window.navigator && window.navigator.userAgent
|
|
11
|
+
? window.navigator.userAgent
|
|
12
|
+
: "unknown";
|
|
13
|
+
const isBrowser = () => exports.BROWSER_AGENT !== "unknown";
|
|
14
|
+
exports.isBrowser = isBrowser;
|
|
15
|
+
const isNode = () => exports.NODE_VERSION !== "unknown";
|
|
16
|
+
exports.isNode = isNode;
|
|
17
|
+
const isBun = () => exports.BUN_VERSION !== "unknown";
|
|
18
|
+
exports.isBun = isBun;
|
|
19
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/lib/runtime.ts"],"names":[],"mappings":";;;AAAa,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,WAAW,GACtB,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG;IACxE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG;IACtB,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;AAET,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,qBAAa,KAAK,SAAS,CAAC;AAA9C,QAAA,SAAS,aAAqC;AAEpD,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,oBAAY,KAAK,SAAS,CAAC;AAA1C,QAAA,MAAM,UAAoC;AAEhD,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,mBAAW,KAAK,SAAS,CAAC;AAAxC,QAAA,KAAK,SAAmC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GrantTokenResponse.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/GrantTokenResponse.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GrantTokenResponse.js","sourceRoot":"","sources":["../../../../src/lib/types/GrantTokenResponse.ts"],"names":[],"mappings":""}
|
|
@@ -26,6 +26,7 @@ export * from "./GetProjectUsageRequestsSchema";
|
|
|
26
26
|
export * from "./GetProjectUsageSummaryResponse";
|
|
27
27
|
export * from "./GetProjectUsageSummarySchema";
|
|
28
28
|
export * from "./GetTokenDetailsResponse";
|
|
29
|
+
export * from "./GrantTokenResponse";
|
|
29
30
|
export * from "./ListOnPremCredentialsResponse";
|
|
30
31
|
export * from "./LiveConfigOptions";
|
|
31
32
|
export * from "./LiveMetadataEvent";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC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cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC"}
|
|
@@ -42,6 +42,7 @@ __exportStar(require("./GetProjectUsageRequestsSchema"), exports);
|
|
|
42
42
|
__exportStar(require("./GetProjectUsageSummaryResponse"), exports);
|
|
43
43
|
__exportStar(require("./GetProjectUsageSummarySchema"), exports);
|
|
44
44
|
__exportStar(require("./GetTokenDetailsResponse"), exports);
|
|
45
|
+
__exportStar(require("./GrantTokenResponse"), exports);
|
|
45
46
|
__exportStar(require("./ListOnPremCredentialsResponse"), exports);
|
|
46
47
|
__exportStar(require("./LiveConfigOptions"), exports);
|
|
47
48
|
__exportStar(require("./LiveMetadataEvent"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,kDAAgC;AAChC,yDAAuC;AACvC,6DAA2C;AAC3C,kEAAgD;AAChD,6DAA2C;AAC3C,2DAAyC;AACzC,0DAAwC;AACxC,qDAAmC;AACnC,mDAAiC;AACjC,0CAAwB;AACxB,yDAAuC;AACvC,sDAAoC;AACpC,oDAAkC;AAClC,+DAA6C;AAC7C,8DAA4C;AAC5C,2DAAyC;AACzC,mEAAiD;AACjD,8DAA4C;AAC5C,uDAAqC;AACrC,wDAAsC;AACtC,kEAAgD;AAChD,gEAA8C;AAC9C,oEAAkD;AAClD,kEAAgD;AAChD,mEAAiD;AACjD,iEAA+C;AAC/C,4DAA0C;AAC1C,kEAAgD;AAChD,sDAAoC;AACpC,sDAAoC;AACpC,2DAAyC;AACzC,oDAAkC;AAClC,4DAA0C;AAC1C,gDAA8B;AAC9B,uDAAqC;AACrC,wDAAsC;AACtC,4DAA0C;AAC1C,wDAAsC;AACtC,mEAAiD;AACjD,wDAAsC;AACtC,sDAAoC;AACpC,iDAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,kDAAgC;AAChC,yDAAuC;AACvC,6DAA2C;AAC3C,kEAAgD;AAChD,6DAA2C;AAC3C,2DAAyC;AACzC,0DAAwC;AACxC,qDAAmC;AACnC,mDAAiC;AACjC,0CAAwB;AACxB,yDAAuC;AACvC,sDAAoC;AACpC,oDAAkC;AAClC,+DAA6C;AAC7C,8DAA4C;AAC5C,2DAAyC;AACzC,mEAAiD;AACjD,8DAA4C;AAC5C,uDAAqC;AACrC,wDAAsC;AACtC,kEAAgD;AAChD,gEAA8C;AAC9C,oEAAkD;AAClD,kEAAgD;AAChD,mEAAiD;AACjD,iEAA+C;AAC/C,4DAA0C;AAC1C,uDAAqC;AACrC,kEAAgD;AAChD,sDAAoC;AACpC,sDAAoC;AACpC,2DAAyC;AACzC,oDAAkC;AAClC,4DAA0C;AAC1C,gDAA8B;AAC9B,uDAAqC;AACrC,wDAAsC;AACtC,4DAA0C;AAC1C,wDAAsC;AACtC,mEAAiD;AACjD,wDAAsC;AACtC,sDAAoC;AACpC,iDAA+B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "3.
|
|
1
|
+
export declare const version = "3.12.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/main/lib/version.js
CHANGED
|
@@ -35,7 +35,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
35
35
|
exports.AbstractWsClient = exports.AbstractLiveClient = void 0;
|
|
36
36
|
const AbstractClient_1 = require("./AbstractClient");
|
|
37
37
|
const constants_1 = require("../lib/constants");
|
|
38
|
-
const
|
|
38
|
+
const runtime_1 = require("../lib/runtime");
|
|
39
39
|
/**
|
|
40
40
|
* Represents an error that occurred in a WebSocket-like connection.
|
|
41
41
|
* @property {any} error - The underlying error object.
|
|
@@ -120,7 +120,7 @@ class AbstractLiveClient extends AbstractClient_1.AbstractClient {
|
|
|
120
120
|
* @summary you can track the issue here
|
|
121
121
|
* @link https://github.com/oven-sh/bun/issues/4529
|
|
122
122
|
*/
|
|
123
|
-
if ((0,
|
|
123
|
+
if ((0, runtime_1.isBun)()) {
|
|
124
124
|
Promise.resolve().then(() => __importStar(require("ws"))).then(({ default: WS }) => {
|
|
125
125
|
this.conn = new WS(requestUrl, {
|
|
126
126
|
headers: this.headers,
|
|
@@ -16,7 +16,7 @@ exports.AbstractRestfulClient = exports.AbstractRestClient = void 0;
|
|
|
16
16
|
const errors_1 = require("../lib/errors");
|
|
17
17
|
const fetch_1 = require("../lib/fetch");
|
|
18
18
|
const AbstractClient_1 = require("./AbstractClient");
|
|
19
|
-
const
|
|
19
|
+
const runtime_1 = require("../lib/runtime");
|
|
20
20
|
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
21
21
|
/**
|
|
22
22
|
* An abstract class that extends `AbstractClient` and provides a base implementation for a REST-based API client.
|
|
@@ -31,7 +31,7 @@ class AbstractRestClient extends AbstractClient_1.AbstractClient {
|
|
|
31
31
|
*/
|
|
32
32
|
constructor(options) {
|
|
33
33
|
super(options);
|
|
34
|
-
if ((0,
|
|
34
|
+
if ((0, runtime_1.isBrowser)() && !this.proxy) {
|
|
35
35
|
throw new errors_1.DeepgramError("Due to CORS we are unable to support REST-based API calls to our API from the browser. Please consider using a proxy: https://dpgr.am/js-proxy for more information.");
|
|
36
36
|
}
|
|
37
37
|
this.fetch = (0, fetch_1.fetchWithAuth)(this.key, this.namespaceOptions.fetch.client);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DeepgramResponse } from "../lib/types/DeepgramResponse";
|
|
2
|
+
import type { GrantTokenResponse } from "../lib/types/GrantTokenResponse";
|
|
3
|
+
import { AbstractRestClient } from "./AbstractRestClient";
|
|
4
|
+
export declare class AuthRestClient extends AbstractRestClient {
|
|
5
|
+
namespace: string;
|
|
6
|
+
/**
|
|
7
|
+
* Generates a new temporary token for the Deepgram API.
|
|
8
|
+
* @param endpoint Optional custom endpoint to use for the request. Defaults to ":version/auth/grant".
|
|
9
|
+
* @returns Object containing the result of the request or an error if one occurred. Result will contain access_token and expires_in properties.
|
|
10
|
+
*/
|
|
11
|
+
grantToken(endpoint?: string): Promise<DeepgramResponse<GrantTokenResponse>>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=AuthRestClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthRestClient.d.ts","sourceRoot":"","sources":["../../../src/packages/AuthRestClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,qBAAa,cAAe,SAAQ,kBAAkB;IAC7C,SAAS,EAAE,MAAM,CAAU;IAElC;;;;OAIG;IACU,UAAU,CACrB,QAAQ,SAAwB,GAC/B,OAAO,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;CAgBjD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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.AuthRestClient = void 0;
|
|
13
|
+
const errors_1 = require("../lib/errors");
|
|
14
|
+
const AbstractRestClient_1 = require("./AbstractRestClient");
|
|
15
|
+
class AuthRestClient extends AbstractRestClient_1.AbstractRestClient {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.namespace = "auth";
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Generates a new temporary token for the Deepgram API.
|
|
22
|
+
* @param endpoint Optional custom endpoint to use for the request. Defaults to ":version/auth/grant".
|
|
23
|
+
* @returns Object containing the result of the request or an error if one occurred. Result will contain access_token and expires_in properties.
|
|
24
|
+
*/
|
|
25
|
+
grantToken(endpoint = ":version/auth/grant") {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
try {
|
|
28
|
+
const requestUrl = this.getRequestUrl(endpoint);
|
|
29
|
+
const result = yield this.post(requestUrl, "").then((result) => result.json());
|
|
30
|
+
return { result, error: null };
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
if ((0, errors_1.isDeepgramError)(error)) {
|
|
34
|
+
return { result: null, error };
|
|
35
|
+
}
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.AuthRestClient = AuthRestClient;
|
|
42
|
+
//# sourceMappingURL=AuthRestClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthRestClient.js","sourceRoot":"","sources":["../../../src/packages/AuthRestClient.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAgD;AAGhD,6DAA0D;AAE1D,MAAa,cAAe,SAAQ,uCAAkB;IAAtD;;QACS,cAAS,GAAW,MAAM,CAAC;IAyBpC,CAAC;IAvBC;;;;OAIG;IACU,UAAU,CACrB,QAAQ,GAAG,qBAAqB;;YAEhC,IAAI;gBACF,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;gBAChD,MAAM,MAAM,GAAuB,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CACjF,MAAM,CAAC,IAAI,EAAE,CACd,CAAC;gBAEF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;aAChC;YAAC,OAAO,KAAK,EAAE;gBACd,IAAI,IAAA,wBAAe,EAAC,KAAK,CAAC,EAAE;oBAC1B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;iBAChC;gBAED,MAAM,KAAK,CAAC;aACb;QACH,CAAC;KAAA;CACF;AA1BD,wCA0BC"}
|