@deepgram/sdk 1.4.5 → 1.5.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.
Files changed (74) hide show
  1. package/dist/billing.d.ts +19 -0
  2. package/dist/browser/httpFetch.d.ts +1 -0
  3. package/dist/browser/index.d.ts +21 -0
  4. package/dist/browser/index.js +1 -1
  5. package/dist/constants/defaultOptions.d.ts +6 -0
  6. package/dist/constants/index.d.ts +1 -0
  7. package/dist/enums/alternatives.d.ts +4 -0
  8. package/dist/enums/connectionState.d.ts +6 -0
  9. package/dist/enums/diarization.d.ts +4 -0
  10. package/dist/enums/index.d.ts +7 -0
  11. package/dist/enums/liveTranscriptionEvents.d.ts +6 -0
  12. package/dist/enums/models.d.ts +5 -0
  13. package/dist/enums/punctuation.d.ts +4 -0
  14. package/dist/enums/searchKind.d.ts +4 -0
  15. package/dist/helpers/index.d.ts +2 -0
  16. package/dist/helpers/secondsToTimestamp.d.ts +1 -0
  17. package/dist/helpers/validateOptions.d.ts +1 -0
  18. package/dist/httpRequest.d.ts +3 -0
  19. package/dist/index.d.ts +20 -1341
  20. package/dist/index.js +1 -1
  21. package/dist/invitation.d.ts +30 -0
  22. package/dist/keys.d.ts +33 -0
  23. package/dist/members.d.ts +19 -0
  24. package/dist/projects.d.ts +22 -0
  25. package/dist/scopes.d.ts +21 -0
  26. package/dist/transcription/index.d.ts +18 -0
  27. package/dist/transcription/liveTranscription.d.ts +23 -0
  28. package/dist/transcription/preRecordedTranscription.d.ts +8 -0
  29. package/dist/types/balance.d.ts +6 -0
  30. package/dist/types/balanceList.d.ts +4 -0
  31. package/dist/types/channel.d.ts +25 -0
  32. package/dist/types/createKeyOptions.d.ts +13 -0
  33. package/dist/types/hit.d.ts +21 -0
  34. package/dist/types/index.d.ts +38 -0
  35. package/dist/types/invitationList.d.ts +4 -0
  36. package/dist/types/invitationOptions.d.ts +4 -0
  37. package/dist/types/key.d.ts +25 -0
  38. package/dist/types/keyResponse.d.ts +10 -0
  39. package/dist/types/keyResponseObj.d.ts +42 -0
  40. package/dist/types/keyword.d.ts +4 -0
  41. package/dist/types/liveTranscriptionOptions.d.ts +170 -0
  42. package/dist/types/liveTranscriptionResponse.d.ts +9 -0
  43. package/dist/types/member.d.ts +7 -0
  44. package/dist/types/memberList.d.ts +4 -0
  45. package/dist/types/message.d.ts +3 -0
  46. package/dist/types/metadata.d.ts +8 -0
  47. package/dist/types/prerecordedTranscriptionOptions.d.ts +148 -0
  48. package/dist/types/prerecordedTranscriptionResponse.d.ts +25 -0
  49. package/dist/types/project.d.ts +17 -0
  50. package/dist/types/projectPatchRequest.d.ts +4 -0
  51. package/dist/types/projectPatchResponse.d.ts +6 -0
  52. package/dist/types/projectResponse.d.ts +4 -0
  53. package/dist/types/requestFunction.d.ts +5 -0
  54. package/dist/types/scopeList.d.ts +3 -0
  55. package/dist/types/search.d.ts +14 -0
  56. package/dist/types/transcriptionSource.d.ts +14 -0
  57. package/dist/types/usageCallback.d.ts +4 -0
  58. package/dist/types/usageField.d.ts +7 -0
  59. package/dist/types/usageFieldOptions.d.ts +4 -0
  60. package/dist/types/usageOptions.d.ts +23 -0
  61. package/dist/types/usageRequest.d.ts +11 -0
  62. package/dist/types/usageRequestDetail.d.ts +30 -0
  63. package/dist/types/usageRequestList.d.ts +6 -0
  64. package/dist/types/usageRequestListOptions.d.ts +7 -0
  65. package/dist/types/usageRequestMessage.d.ts +3 -0
  66. package/dist/types/usageResponse.d.ts +10 -0
  67. package/dist/types/usageResponseDetail.d.ts +6 -0
  68. package/dist/types/utterance.d.ts +39 -0
  69. package/dist/types/wordBase.d.ts +9 -0
  70. package/dist/usage.d.ts +35 -0
  71. package/dist/userAgent.d.ts +1 -0
  72. package/package.json +4 -4
  73. package/webpack.config.js +1 -3
  74. package/CHANGELOG.md +0 -234
@@ -0,0 +1,10 @@
1
+ import { UsageResponseDetail } from "./usageResponseDetail";
2
+ export declare type UsageResponse = {
3
+ start: string;
4
+ end: string;
5
+ resolution: {
6
+ units: string;
7
+ amount: number;
8
+ };
9
+ results: Array<UsageResponseDetail>;
10
+ };
@@ -0,0 +1,6 @@
1
+ export declare type UsageResponseDetail = {
2
+ start: string;
3
+ end: string;
4
+ hours: number;
5
+ requests: number;
6
+ };
@@ -0,0 +1,39 @@
1
+ import { WordBase } from "./wordBase";
2
+ export declare type Utterance = {
3
+ /**
4
+ * Start time (in seconds) from the beginning of the audio stream.
5
+ */
6
+ start: number;
7
+ /**
8
+ * End time (in seconds) from the beginning of the audio stream.
9
+ */
10
+ end: number;
11
+ /**
12
+ * Floating point value between 0 and 1 that indicates overall transcript
13
+ * reliability. Larger values indicate higher confidence.
14
+ */
15
+ confidence: number;
16
+ /**
17
+ * Audio channel to which the utterance belongs. When using multichannel audio,
18
+ * utterances are chronologically ordered by channel.
19
+ */
20
+ channel: number;
21
+ /**
22
+ * Transcript for the audio segment being processed.
23
+ */
24
+ transcript: string;
25
+ /**
26
+ * Object containing each word in the transcript, along with its start time
27
+ * and end time (in seconds) from the beginning of the audio stream, and a confidence value.
28
+ */
29
+ words: Array<WordBase>;
30
+ /**
31
+ * Integer indicating the predicted speaker of the majority of words
32
+ * in the utterance who is saying the words being processed.
33
+ */
34
+ speaker?: number;
35
+ /**
36
+ * Unique identifier of the utterance
37
+ */
38
+ id: string;
39
+ };
@@ -0,0 +1,9 @@
1
+ export declare type WordBase = {
2
+ word: string;
3
+ start: number;
4
+ end: number;
5
+ confidence: number;
6
+ punctuated_word?: string;
7
+ speaker?: number;
8
+ speaker_confidence?: number;
9
+ };
@@ -0,0 +1,35 @@
1
+ import { RequestFunction, UsageField, UsageFieldOptions, UsageOptions, UsageRequest, UsageRequestList, UsageRequestListOptions, UsageResponse } from "./types";
2
+ export declare class Usage {
3
+ private _credentials;
4
+ private _apiUrl;
5
+ private _request;
6
+ constructor(_credentials: string, _apiUrl: string, _request: RequestFunction);
7
+ private apiPath;
8
+ /**
9
+ * Retrieves all requests associated with the provided projectId based
10
+ * on the provided options
11
+ * @param projectId Unique identifier of the project
12
+ * @param options Additional filter options
13
+ */
14
+ listRequests(projectId: string, options?: UsageRequestListOptions): Promise<UsageRequestList>;
15
+ /**
16
+ * Retrieves a specific request associated with the provided projectId
17
+ * @param projectId Unique identifier of the project
18
+ * @param requestId Unique identifier for the request to retrieve
19
+ */
20
+ getRequest(projectId: string, requestId: string): Promise<UsageRequest>;
21
+ /**
22
+ * Retrieves usage associated with the provided projectId based
23
+ * on the provided options
24
+ * @param projectId Unique identifier of the project
25
+ * @param options Options to filter usage
26
+ */
27
+ getUsage(projectId: string, options?: UsageOptions): Promise<UsageResponse>;
28
+ /**
29
+ * Retrieves features used by the provided projectId based
30
+ * on the provided options
31
+ * @param projectId Unique identifier of the project
32
+ * @param options Options to filter usage
33
+ */
34
+ getFields(projectId: string, options?: UsageFieldOptions): Promise<UsageField>;
35
+ }
@@ -0,0 +1 @@
1
+ export declare function userAgent(): string;
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@deepgram/sdk",
3
- "version": "1.4.5",
3
+ "version": "1.5.0",
4
4
  "description": "An SDK for the Deepgram automated speech recognition platform",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
7
- "build": "npm run build:lib && webpack --config webpack.config.js && npm run bundle",
7
+ "build": "npm run build:lib && webpack --config webpack.config.js && npm run types",
8
8
  "build:lib": "tsc --project ./tsconfig.json && tsc --project ./tsconfig-es6.json",
9
9
  "coverage": "nyc npm run test",
10
10
  "lint": "eslint ./src --ext .ts && prettier --config .prettierrc src/*.ts src/**/*.ts --write",
11
11
  "test": "mocha -r ts-node/register tests/*test.ts tests/**/*test.ts --insect",
12
12
  "watch": "nodemon -e ts --watch src --exec \"npm run build\"",
13
- "bundle": "dts-generator --project ./ --out dist/index.d.ts"
13
+ "types": "copyfiles -f bundle/*.d.ts dist && copyfiles -u 1 bundle/**/*.d.ts dist"
14
14
  },
15
15
  "exports": {
16
16
  ".": "./dist/index.js",
@@ -47,6 +47,7 @@
47
47
  "@typescript-eslint/parser": "^4.33.0",
48
48
  "browserify": "^17.0.0",
49
49
  "chai": "^4.3.4",
50
+ "copyfiles": "^2.4.1",
50
51
  "eslint": "^7.32.0",
51
52
  "eslint-config-airbnb-base": "^14.2.1",
52
53
  "eslint-plugin-import": "^2.25.2",
@@ -63,7 +64,6 @@
63
64
  },
64
65
  "dependencies": {
65
66
  "bufferutil": "^4.0.6",
66
- "dts-generator": "^3.0.0",
67
67
  "utf-8-validate": "^5.0.9",
68
68
  "ws": "^7.5.5"
69
69
  }
package/webpack.config.js CHANGED
@@ -2,7 +2,7 @@ const path = require("path");
2
2
 
3
3
  const clientConfig = {
4
4
  name: "client",
5
- target: "web", // <=== can be omitted as default is 'web'
5
+ target: "web",
6
6
  entry: "./bundle/browser/index.js",
7
7
  output: {
8
8
  path: path.resolve(__dirname, "dist/browser"),
@@ -14,7 +14,6 @@ const clientConfig = {
14
14
  experiments: {
15
15
  outputModule: true,
16
16
  },
17
- //…
18
17
  };
19
18
 
20
19
  const serverConfig = {
@@ -29,7 +28,6 @@ const serverConfig = {
29
28
  type: "umd",
30
29
  },
31
30
  },
32
- //…
33
31
  };
34
32
 
35
33
  module.exports = [serverConfig, clientConfig];
package/CHANGELOG.md DELETED
@@ -1,234 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [Unreleased]
9
-
10
- ---
11
-
12
- ## [1.4.5]
13
-
14
- ### Updated
15
-
16
- - Updated ReadStream to Readable
17
-
18
- ## [1.4.4]
19
-
20
- ### Added
21
-
22
- - Added `replace` to transcription option types
23
-
24
- ## [1.4.3]
25
-
26
- ### Added
27
-
28
- - Added `tier` to transcription option types
29
-
30
- ## [1.4.2]
31
-
32
- ### Added
33
-
34
- - Updated build step to build separate files for browser version
35
-
36
- ## [1.4.1]
37
-
38
- ### Added
39
-
40
- - Small fix for npm deployment
41
-
42
- ## [1.4.0]
43
-
44
- ### Added
45
-
46
- - Added Browser compatible versions of the live and preRecorded transcription methods
47
-
48
- ## [1.3.1]
49
-
50
- ### Updated
51
-
52
- - Updated user-agent header to be generated on build rather than on demand. This should remove warnings when using webpack
53
-
54
- ## [1.3.0]
55
-
56
- ### Added
57
-
58
- - Added Message Class for generic message responses
59
- - Added member endpoint functionality
60
- - This includes the `listMembers` and `removeMember` methods
61
- - Added Member and MemberList Class
62
- - Added scopes endpoint functionality
63
- - This includes the `get` and `update` methods
64
- - Added ScopeList Class
65
- - Added invites endpoint functionality
66
- - This includes the `list`, `send`, `leave` and `delete` methods
67
- - Added InvitationOptions and InvitationList Class
68
- - Added balances endpoint functionality
69
- - This includes the `listBalances` and `getBalance` methods
70
- - Added Balance and BalanceList Class
71
-
72
- ## [1.2.4]
73
-
74
- ### Fixed
75
-
76
- - Getting the list of API keys was returning the wrong type of object. The SDK now returns the correct object type, but also returns what was previously implemented with deprecation notices.
77
- - The `version` parameter was typed as required for both pre-recorded and live transcription. Changed this to be optional.
78
-
79
- ## [1.2.2]
80
-
81
- ### Updated
82
-
83
- - Updated the `wordBase` type to include an optional `speaker` property.
84
- - Updated the documentation for the speaker property of the `utterance` type.
85
-
86
- ## [1.2.1]
87
-
88
- ### Fixed
89
-
90
- - Fixed a bug that caused real-time transcriptions to not close correctly. This
91
- would result in the user not received the final transcription.
92
-
93
- ## [1.2.0]
94
-
95
- ### Updated
96
-
97
- - Updated the `keys.create` function to allow new `expirationDate` or `timeToLive`
98
- values. These are optional and one at most can be provided. Providing both will
99
- throw an error.
100
-
101
- ## [1.1.0]
102
-
103
- ### Added
104
-
105
- - Prerecorded transcription responses can now be used to generate WebVTT and
106
- SRT caption files. Example:
107
-
108
- ```js
109
- const response = await deepgram.transcription.preRecorded(
110
- { url: "URL_TO_FILE" },
111
- {
112
- punctuate: true,
113
- utterances: true,
114
- }
115
- );
116
- const webVTT = response.toWebVTT();
117
- const SRT = response.toSRT();
118
- ```
119
-
120
- The [utterances](https://developers.deepgram.com/documentation/features/utterances/)
121
- feature is required to use this functionality.
122
-
123
- ## [1.0.3]
124
-
125
- ### Added
126
-
127
- - In addition to a Url and Buffer, `trascricription.preRecorded` now accepts a
128
- ReadStream as a source of the file to transcribe.
129
-
130
- ### Updated
131
-
132
- - Removed a console log that occurred when an HTTP request ended
133
-
134
- ## [1.0.2]
135
-
136
- ### Added
137
-
138
- - `deepgram.projects.update` will now update a project
139
- - Prerecorded transcription responses now include utterances
140
-
141
- ### Updated
142
-
143
- - The project type has been modified to the following:
144
-
145
- ```ts
146
- {
147
- project_id: string;
148
- name?: string;
149
- company?: string;
150
- };
151
- ```
152
-
153
- - The key type has been modified to the following:
154
-
155
- ```ts
156
- {
157
- api_key_id: string;
158
- key?: string;
159
- comment: string;
160
- created: string;
161
- scopes: Array<string>;
162
- };
163
- ```
164
-
165
- - The usage request type has been modified to the following:
166
-
167
- ```ts
168
- {
169
- request_id: string;
170
- created: string;
171
- path: string;
172
- accessor: string;
173
- response?: UsageRequestDetail | UsageRequestMessage;
174
- callback?: UsageCallback;
175
- };
176
- ```
177
-
178
- ## [1.0.0]
179
-
180
- ### Added
181
-
182
- #### Live transcription
183
-
184
- - `deepgram.transcription.live` now manages a websocket connection to Deepgram's API
185
- for live transcription
186
-
187
- #### Projects
188
-
189
- - `deepgram.projects` allows listing projects or getting a specific project from
190
- your Deepgram account
191
-
192
- ### Updated
193
-
194
- #### Pre-recorded transcription
195
-
196
- - `deepgram.batch` has been moved to `deepgram.transcription.preRecorded`
197
- - Type of `source` parameter of pre-recorded transcriptions has changed. You can now
198
- send one of two types of objects: `{ url: YOUR_FILES_URL }` or
199
- `{ buffer: BUFFER_OF_YOUR_FILE, mimetype: FILES_MIME_TYPE }`
200
-
201
- #### API Key management
202
-
203
- - All `deepgram.keys` methods now require a `projectId`.
204
- - `deepgram.keys.create` now requires an additional parameter `scopes`. This is a
205
- string array specifying the scopes available to the newly created API key
206
-
207
- ## [0.6.5]
208
-
209
- - Added notice to README to denote the library is in a very unstable state.
210
-
211
- ## [0.6.4]
212
-
213
- ### Added
214
-
215
- - `transcribe` method will now return transcription results for both urls or buffers.
216
- - `keys` now provides `create`, `list`, and `delete` methods that allow managing of
217
- API keys.
218
-
219
- ---
220
-
221
- [unreleased]: https://github.com/deepgram/node-sdk/compare/1.4.0...HEAD
222
- [1.4.0]: https://github.com/deepgram/node-sdk/compare/1.3.1...1.4.0
223
- [1.3.1]: https://github.com/deepgram/node-sdk/compare/1.3.0...1.3.1
224
- [1.3.0]: https://github.com/deepgram/node-sdk/compare/1.2.4...1.3.0
225
- [1.2.4]: https://github.com/deepgram/node-sdk/compare/1.2.2...1.2.4
226
- [1.2.2]: https://github.com/deepgram/node-sdk/compare/1.2.1...1.2.2
227
- [1.2.1]: https://github.com/deepgram/node-sdk/compare/1.2.0...1.2.1
228
- [1.2.0]: https://github.com/deepgram/node-sdk/compare/1.1.0...1.2.0
229
- [1.1.0]: https://github.com/deepgram/node-sdk/compare/1.0.3...1.1.0
230
- [1.0.3]: https://github.com/deepgram/node-sdk/compare/1.0.2...1.0.3
231
- [1.0.2]: https://github.com/deepgram/node-sdk/compare/1.0.0...1.0.2
232
- [1.0.0]: https://github.com/deepgram/node-sdk/compare/0.6.5...1.0.0
233
- [0.6.5]: https://github.com/deepgram/node-sdk/compare/0.6.4...0.6.5
234
- [0.6.4]: https://github.com/deepgram/node-sdk/compare/edc07b4...0.6.4