New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@deepgram/sdk

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deepgram/sdk - npm Package Compare versions

Comparing version 1.21.0 to 2.0.0

dist/types/error.d.ts

19

dist/billing.d.ts

@@ -1,2 +0,2 @@

import { BalanceList, Balance, RequestFunction } from "./types";
import { BalanceList, Balance, RequestFunction, ErrorResponse } from "./types";
export declare class Billing {

@@ -8,14 +8,19 @@ private _credentials;

constructor(_credentials: string, _apiUrl: string, _requireSSL: boolean, _request: RequestFunction);
private apiPath;
/**
* Retrieves list of balance info of the specified project.
* @param projectId Unique identifier of the project
* @param {string} projectId Unique identifier of the project
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<BalanceList | ErrorResponse>}
*/
listBalances(projectId: string): Promise<BalanceList>;
listBalances(projectId: string, endpoint?: string): Promise<BalanceList | ErrorResponse>;
/**
* Retrieves balance info of a specified balance_id in the specified project.
* @param projectId Unique identifier of the project
* @param balanceId Unique identifier of the balance
* @param {string} projectId Unique identifier of the project
* @param {string} balanceId Unique identifier of the balance
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<Balance>}
*/
getBalance(projectId: string, balanceId: string): Promise<Balance>;
getBalance(projectId: string, balanceId: string, endpoint?: string): Promise<Balance | ErrorResponse>;
}

@@ -1,2 +0,2 @@

import { Message, InvitationOptions, InvitationList, RequestFunction } from "./types";
import { Message, InvitationOptions, InvitationList, RequestFunction, ErrorResponse } from "./types";
export declare class Invitation {

@@ -8,25 +8,37 @@ private _credentials;

constructor(_credentials: string, _apiUrl: string, _requireSSL: boolean, _request: RequestFunction);
private apiPath;
/**
* Lists all the current invites of a specified project.
* @param projectId Unique identifier of the project
* @param {string} projectId Unique identifier of the project
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<InvitationList>}
*/
list(projectId: string): Promise<InvitationList>;
list(projectId: string, endpoint?: string): Promise<InvitationList | ErrorResponse>;
/**
* Sends an invitation to join the specified project.
* @param projectId Unique identifier of the project
* @param {string} projectId Unique identifier of the project
* @param {InvitationOptions} options Used to define the email and scope of the invitee
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<Message>}
*/
send(projectId: string, options: InvitationOptions): Promise<Message>;
send(projectId: string, options: InvitationOptions, endpoint?: string): Promise<Message | ErrorResponse>;
/**
* Removes the authenticated account from the specified project.
* @param projectId Unique identifier of the project
* @param {string} projectId Unique identifier of the project
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<Message>}
*/
leave(projectId: string): Promise<Message>;
leave(projectId: string, endpoint?: string): Promise<Message | ErrorResponse>;
/**
* Removes the specified email from the invitations on the specified project.
* @param projectId Unique identifier of the project
* @param email email address of the invitee
* NOTE: This will return successful even if the email does not have an invite on the project.
* @param {string} projectId Unique identifier of the project
* @param {string} email Email of the invite to delete
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<Message>}
*/
delete(projectId: string, email: string): Promise<Message>;
delete(projectId: string, email: string, endpoint?: string): Promise<Message | ErrorResponse>;
}

@@ -1,2 +0,2 @@

import { CreateKeyOptions, KeyResponse, Key, RequestFunction } from "./types";
import { CreateKeyOptions, KeyResponse, Key, RequestFunction, ErrorResponse } from "./types";
export declare class Keys {

@@ -8,28 +8,39 @@ private _credentials;

constructor(_credentials: string, _apiUrl: string, _requireSSL: boolean, _request: RequestFunction);
private apiPath;
/**
* Retrieves all keys associated with the provided projectId
* @param projectId Unique identifier of the project containing API keys
* Retrieves all keys associated with the provided project_id.
* @param {string} projectId Unique identifier of the project
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<KeyResponse>}
*/
list(projectId: string): Promise<KeyResponse>;
list(projectId: string, endpoint?: string): Promise<KeyResponse | ErrorResponse>;
/**
* Retrieves a specific key associated with the provided projectId
* @param projectId Unique identifier of the project containing API keys
* @param keyId Unique identifier for the key to retrieve
* Retrieves a specific key associated with the provided project_id.
* @param {string} projectId Unique identifier of the project
* @param {string} keyId Unique identifier of the key
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<Key>}
*/
get(projectId: string, keyId: string): Promise<Key>;
get(projectId: string, keyId: string, endpoint?: string): Promise<Key | ErrorResponse>;
/**
* Creates an API key with the provided scopes
* @param projectId Unique identifier of the project to create an API key under
* @param comment Comment to describe the key
* @param scopes Permission scopes associated with the API key
* @param options Optional options used when creating API keys
* Creates an API key with the provided scopes.
* @param {string} projectId Unique identifier of the project
* @param {string} comment Comment to describe the key
* @param {Array<string>} scopes Permission scopes associated with the API key
* @param {CreateKeyOptions} options Options used when creating API keys
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<Key>}
*/
create(projectId: string, comment: string, scopes: Array<string>, options?: CreateKeyOptions): Promise<Key>;
create(projectId: string, comment: string, scopes: Array<string>, options?: CreateKeyOptions, endpoint?: string): Promise<Key | ErrorResponse>;
/**
* Deletes an API key
* @param projectId Unique identifier of the project to create an API key under
* @param keyId Unique identifier for the key to delete
* Deletes an API key.
* @param {string} projectId Unique identifier of the project
* @param {string} keyId Unique identifier of the key
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<void>}
*/
delete(projectId: string, keyId: string): Promise<void>;
delete(projectId: string, keyId: string, endpoint?: string): Promise<void | ErrorResponse>;
}

@@ -1,2 +0,2 @@

import { MemberList, Message, RequestFunction } from "./types";
import { MemberList, Message, RequestFunction, ErrorResponse } from "./types";
export declare class Members {

@@ -8,14 +8,19 @@ private _credentials;

constructor(_credentials: string, _apiUrl: string, _requireSSL: boolean, _request: RequestFunction);
private apiPath;
/**
* Retrieves account objects for all of the accounts in the specified project.
* @param projectId Unique identifier of the project
* @param {string} projectId Unique identifier of the project
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<MemberList | ErrorResponse>}
*/
listMembers(projectId: string): Promise<MemberList>;
listMembers(projectId: string, endpoint?: string): Promise<MemberList | ErrorResponse>;
/**
* Retrieves account objects for all of the accounts in the specified project.
* @param projectId Unique identifier of the project
* @param memberId Unique identifier of the member
* @param {string} projectId Unique identifier of the project
* @param {string} memberId Unique identifier of the member
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<Message | ErrorResponse>}
*/
removeMember(projectId: string, memberId: string): Promise<Message>;
removeMember(projectId: string, memberId: string, endpoint?: string): Promise<Message | ErrorResponse>;
}

@@ -1,2 +0,2 @@

import { Project, ProjectPatchResponse, ProjectResponse, ProjectPatchRequest, RequestFunction } from "./types";
import { Project, ProjectPatchResponse, ProjectResponse, ProjectPatchRequest, RequestFunction, ErrorResponse } from "./types";
export declare class Projects {

@@ -8,22 +8,34 @@ private _credentials;

constructor(_credentials: string, _apiUrl: string, _requireSSL: boolean, _request: RequestFunction);
private apiPath;
/**
* Returns all projects accessible by the API key
* Returns all projects accessible by the API key.
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<ProjectResponse | ErrorResponse>}
*/
list(): Promise<ProjectResponse>;
list(endpoint?: string): Promise<ProjectResponse | ErrorResponse>;
/**
* Retrieves a specific project based on the provided projectId
* @param projectId Unique identifier of the project to retrieve
* Retrieves a specific project based on the provided project_id.
* @param {string} projectId Unique identifier of the project
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<Project | ErrorResponse>}
*/
get(projectId: string): Promise<Project>;
get(projectId: string, endpoint?: string): Promise<Project | ErrorResponse>;
/**
* Update a specific project
* @param project project to update
* Update a project.
* @param {Project} project Project to update
* @param {ProjectPatchRequest} payload Details to change as an object
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<ProjectPatchResponse | ErrorResponse>}
*/
update(project: Project, payload: ProjectPatchRequest): Promise<ProjectPatchResponse>;
update(project: Project, payload: ProjectPatchRequest, endpoint?: string): Promise<ProjectPatchResponse | ErrorResponse>;
/**
* Delete a specific project
* @param project project to delete
* */
delete(projectId: string): Promise<void>;
* Delete a project.
* @param {string} projectId Unique identifier of the project
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<void | ErrorResponse>}
*/
delete(projectId: string, endpoint?: string): Promise<void | ErrorResponse>;
}

@@ -1,2 +0,2 @@

import { ScopeList, Message, RequestFunction } from "./types";
import { ScopeList, Message, RequestFunction, ErrorResponse } from "./types";
export declare class Scopes {

@@ -8,16 +8,21 @@ private _credentials;

constructor(_credentials: string, _apiUrl: string, _requireSSL: boolean, _request: RequestFunction);
private apiPath;
/**
* Retrieves scopes of the specified member in the specified project.
* @param projectId Unique identifier of the project
* @param memberId Unique identifier of the member
* @param {string} projectId Unique identifier of the project
* @param {string} memberId Unique identifier of the member
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<ScopeList | ErrorResponse>}
*/
get(projectId: string, memberId: string): Promise<ScopeList>;
get(projectId: string, memberId: string, endpoint?: string): Promise<ScopeList | ErrorResponse>;
/**
* Updates the scope for the specified member in the specified project.
* @param projectId Unique identifier of the project
* @param memberId Unique identifier of the member being updated
* @param scope string of the scope to update to
* @param {string} projectId Unique identifier of the project
* @param {string} memberId Unique identifier of the member
* @param {string} scope Scope to update the member to
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<Message | ErrorResponse>}
*/
update(projectID: string, memberId: string, scope: string): Promise<Message>;
update(projectID: string, memberId: string, scope: string, endpoint?: string): Promise<Message | ErrorResponse>;
}

@@ -1,2 +0,2 @@

import { LiveTranscriptionOptions, PrerecordedTranscriptionOptions, PrerecordedTranscriptionResponse, TranscriptionSource } from "../types";
import { LiveTranscriptionOptions, PrerecordedTranscriptionOptions, PrerecordedTranscriptionResponse, TranscriptionSource, ErrorResponse } from "../types";
import { LiveTranscription } from "./liveTranscription";

@@ -9,12 +9,18 @@ export declare class Transcriber {

/**
* Transcribes prerecorded audio from a file or buffer
* @param source Url or Buffer of file to transcribe
* @param options Options to modify transcriptions
* Transcribes prerecorded audio from a file or buffer.
* @param {TranscriptionSource} source Source of audio to transcribe
* @param {PrerecordedTranscriptionOptions} options Options used to toggle transcription features
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<PrerecordedTranscriptionResponse | ErrorResponse>}
*/
preRecorded(source: TranscriptionSource, options?: PrerecordedTranscriptionOptions): Promise<PrerecordedTranscriptionResponse>;
preRecorded(source: TranscriptionSource, options?: PrerecordedTranscriptionOptions, endpoint?: string): Promise<PrerecordedTranscriptionResponse | ErrorResponse>;
/**
* Opens a websocket to Deepgram's API for live transcriptions
* @param options Options to modify transcriptions
* @param {LiveTranscriptionOptions} options Options used to toggle transcription features
* @param {string} endpoint Custom API endpoint
*
* @returns {LiveTranscription | ErrorResponse}
*/
live(options?: LiveTranscriptionOptions): LiveTranscription;
live(options?: LiveTranscriptionOptions, endpoint?: string): LiveTranscription | ErrorResponse;
}

@@ -7,3 +7,3 @@ /// <reference types="node" />

private _socket;
constructor(credentials: string, apiUrl: string, requireSSL: boolean, options?: LiveTranscriptionOptions);
constructor(credentials: string, apiUrl: string, requireSSL: boolean, options?: LiveTranscriptionOptions, endpoint?: string);
private _bindSocketEvents;

@@ -10,0 +10,0 @@ configure(config: ToggleConfigOptions): void;

import { PrerecordedTranscriptionOptions, PrerecordedTranscriptionResponse, TranscriptionSource } from "../types";
/**
* Transcribes audio from a file or buffer
* @param credentials Base64 encoded API key & secret
* @param source Url or Buffer of file to transcribe
* @param options Options to modify transcriptions
*
* @param apiKey string
* @param apiUrl string
* @param requireSSL boolean
* @param source TranscriptionSource
* @param options PrerecordedTranscriptionOptions
* @param options string
* @returns Promise<PrerecordedTranscriptionResponse>
*/
export declare const preRecordedTranscription: (apiKey: string, apiUrl: string, requireSSL: boolean, source: TranscriptionSource, options?: PrerecordedTranscriptionOptions | undefined) => Promise<PrerecordedTranscriptionResponse>;
export declare const preRecordedTranscription: (apiKey: string, apiUrl: string, requireSSL: boolean, source: TranscriptionSource, options?: PrerecordedTranscriptionOptions | undefined, endpoint?: string) => Promise<PrerecordedTranscriptionResponse>;

@@ -49,1 +49,2 @@ export * from "./alternatives";

export * from "./wordBase";
export * from "./error";

@@ -1,2 +0,2 @@

import { RequestFunction, UsageField, UsageFieldOptions, UsageOptions, UsageRequest, UsageRequestList, UsageRequestListOptions, UsageResponse } from "./types";
import { RequestFunction, UsageField, UsageFieldOptions, UsageOptions, UsageRequest, UsageRequestList, UsageRequestListOptions, UsageResponse, ErrorResponse } from "./types";
export declare class Usage {

@@ -8,30 +8,38 @@ private _credentials;

constructor(_credentials: string, _apiUrl: string, _requireSSL: boolean, _request: RequestFunction);
private apiPath;
/**
* Retrieves all requests associated with the provided projectId based
* on the provided options
* @param projectId Unique identifier of the project
* @param options Additional filter options
* Retrieves all requests associated with the provided project_id based on the provided options.
* @param {string} projectId Unique identifier of the project
* @param {UsageRequestListOptions} options Additional filter options
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<UsageRequestList | ErrorResponse>}
*/
listRequests(projectId: string, options?: UsageRequestListOptions): Promise<UsageRequestList>;
listRequests(projectId: string, options?: UsageRequestListOptions, endpoint?: string): Promise<UsageRequestList | ErrorResponse>;
/**
* Retrieves a specific request associated with the provided projectId
* @param projectId Unique identifier of the project
* @param requestId Unique identifier for the request to retrieve
* Retrieves a specific request associated with the provided project_id.
* @param {string} projectId Unique identifier of the project
* @param {string} requestId Unique identifier of the request
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<UsageRequest>}
*/
getRequest(projectId: string, requestId: string): Promise<UsageRequest>;
getRequest(projectId: string, requestId: string, endpoint?: string): Promise<UsageRequest>;
/**
* Retrieves usage associated with the provided projectId based
* on the provided options
* @param projectId Unique identifier of the project
* @param options Options to filter usage
* Retrieves usage associated with the provided project_id based on the provided options.
* @param {string} projectId Unique identifier of the project
* @param {UsageOptions} options Options to filter usage
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<UsageResponse | ErrorResponse>}
*/
getUsage(projectId: string, options?: UsageOptions): Promise<UsageResponse>;
getUsage(projectId: string, options?: UsageOptions, endpoint?: string): Promise<UsageResponse | ErrorResponse>;
/**
* Retrieves features used by the provided projectId based
* on the provided options
* @param projectId Unique identifier of the project
* @param options Options to filter usage
* Retrieves features used by the provided project_id based on the provided options.
* @param {string} projectId Unique identifier of the project
* @param {UsageFieldOptions} options Options to filter usage
* @param {string} endpoint Custom API endpoint
*
* @returns {Promise<UsageField | ErrorResponse>}
*/
getFields(projectId: string, options?: UsageFieldOptions): Promise<UsageField>;
getFields(projectId: string, options?: UsageFieldOptions, endpoint?: string): Promise<UsageField | ErrorResponse>;
}
{
"name": "@deepgram/sdk",
"version": "1.21.0",
"version": "2.0.0",
"description": "An SDK for the Deepgram automated speech recognition platform",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "npm run build:lib && webpack --config webpack.config.js && npm run types",
"build:lib": "tsc --project ./tsconfig.json && tsc --project ./tsconfig-es6.json",
"coverage": "nyc npm run test",
"build:lib": "tsc --project ./tsconfig.json",
"coverage": "nyc --reporter=lcovonly --reporter=text --reporter=text-summary npm run test",
"lint": "eslint ./src --ext .ts && prettier --config .prettierrc src/*.ts src/**/*.ts --write",

@@ -15,8 +16,2 @@ "test": "mocha -r ts-node/register tests/*test.ts tests/**/*test.ts --insect",

},
"exports": {
".": "./dist/index.js",
"./browser": {
"default": "./dist/browser/index.js"
}
},
"repository": {

@@ -33,5 +28,13 @@ "type": "git",

"author": {
"name": "Michael Jolley",
"email": "michael.jolley@deepgram.com"
"name": "Deepgram DevRel Team",
"email": "devrel@deepgram.com"
},
"contributors": [
"Brian Barrow",
"Brian Hillis",
"Luke Oliff",
"Michael Jolley",
"Sandra Rodgers",
"Shir Goldberg"
],
"license": "MIT",

@@ -50,3 +53,2 @@ "bugs": {

"@typescript-eslint/parser": "^4.33.0",
"browserify": "^17.0.0",
"chai": "^4.3.4",

@@ -58,3 +60,4 @@ "copyfiles": "^2.4.1",

"mocha": "^9.1.3",
"nock": "^13.1.4",
"mock-websocket": "^0.0.7",
"nock": "^13.3.1",
"nodemon": "^2.0.14",

@@ -61,0 +64,0 @@ "nyc": "^15.1.0",

@@ -71,28 +71,4 @@ # Deepgram Node.js SDK

```js
navigator.mediaDevices.getUserMedia({ audio: true }).then((stream) => {
const mediaRecorder = new MediaRecorder(stream, {
mimeType: 'audio/webm',
});
const deepgramSocket = deepgram.transcription.live({ punctuate: true });
See an example real time project at https://github.com/deepgram-devs/node-live-example, or visit this [Getting Started guide](https://developers.deepgram.com/documentation/getting-started/streaming/)
deepgramSocket.addEventListener('open', () => {
mediaRecorder.addEventListener('dataavailable', async (event) => {
if (event.data.size > 0 && deepgramSocket.readyState == 1) {
deepgramSocket.send(event.data)
}
})
mediaRecorder.start(1000)
});
deepgramSocket.addEventListener("message", (message) => {
const received = JSON.parse(message.data);
const transcript = received.channel.alternatives[0].transcript;
if (transcript && received.is_final) {
console.log(transcript);
}
});
});
```
## Samples

@@ -99,0 +75,0 @@

const path = require("path");
const clientConfig = {
name: "client",
target: "web",
entry: "./bundle/browser/index.js",
output: {
path: path.resolve(__dirname, "dist/browser"),
filename: "index.js",
library: {
type: "module",
},
},
experiments: {
outputModule: true,
},
};
const serverConfig = {
module.exports = {
name: "server",

@@ -33,2 +19,2 @@ target: "node",

module.exports = [serverConfig, clientConfig];

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc