@deepgram/sdk 1.2.0 → 1.2.4

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/CHANGELOG.md CHANGED
@@ -9,6 +9,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ---
11
11
 
12
+ ## [1.2.4]
13
+
14
+ ### Fixed
15
+
16
+ - 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.
17
+ - The `version` parameter was typed as required for both pre-recorded and live transcription. Changed this to be optional.
18
+
19
+ ## [1.2.2]
20
+
21
+ ### Updated
22
+
23
+ - Updated the `wordBase` type to include an optional `speaker` property.
24
+ - Updated the documentation for the speaker property of the `utterance` type.
25
+
26
+ ## [1.2.1]
27
+
28
+ ### Fixed
29
+
30
+ - Fixed a bug that caused real-time transcriptions to not close correctly. This
31
+ would result in the user not received the final transcription.
32
+
12
33
  ## [1.2.0]
13
34
 
14
35
  ### Updated
@@ -137,7 +158,11 @@ throw an error.
137
158
 
138
159
  ---
139
160
 
140
- [unreleased]: https://github.com/deepgram/node-sdk/compare/1.1.0...HEAD
161
+ [unreleased]: https://github.com/deepgram/node-sdk/compare/1.2.4...HEAD
162
+ [1.2.2]: https://github.com/deepgram/node-sdk/compare/1.2.2...1.2.4
163
+ [1.2.2]: https://github.com/deepgram/node-sdk/compare/1.2.1...1.2.2
164
+ [1.2.1]: https://github.com/deepgram/node-sdk/compare/1.2.0...1.2.1
165
+ [1.2.0]: https://github.com/deepgram/node-sdk/compare/1.1.0...1.2.0
141
166
  [1.1.0]: https://github.com/deepgram/node-sdk/compare/1.0.3...1.1.0
142
167
  [1.0.3]: https://github.com/deepgram/node-sdk/compare/1.0.2...1.0.3
143
168
  [1.0.2]: https://github.com/deepgram/node-sdk/compare/1.0.0...1.0.2
package/README.md CHANGED
@@ -84,7 +84,7 @@ navigator.mediaDevices.getUserMedia({ audio: true }).then((stream) => {
84
84
  mediaRecorder.start(1000)
85
85
  });
86
86
 
87
- deepgramSocket.addListener("transcriptReceived", (transcription) => {
87
+ deepgramSocket.addListener("transcriptReceived", (received) => {
88
88
  const transcript = received.channel.alternatives[0].transcript;
89
89
  if (transcript && received.is_final) {
90
90
  console.log(transcript);
@@ -147,5 +147,5 @@ project, let us know! You can either:
147
147
 
148
148
  Check out the Developer Documentation at [https://developers.deepgram.com/](https://developers.deepgram.com/)
149
149
 
150
- [signup]: https://console.deepgram.com?utm_source=node-sdk&utm_content=readme
150
+ [signup]: https://console.deepgram.com/signup?utm_medium=github&utm_source=DEVREL&utm_content=node-sdk
151
151
  [license]: LICENSE.txt
package/dist/keys.js CHANGED
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
14
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
15
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -50,8 +61,17 @@ var Keys = /** @class */ (function () {
50
61
  */
51
62
  Keys.prototype.list = function (projectId) {
52
63
  return __awaiter(this, void 0, void 0, function () {
64
+ var response, output;
53
65
  return __generator(this, function (_a) {
54
- return [2 /*return*/, (0, httpRequest_1._request)("GET", this._credentials, this._apiUrl, this.apiPath + "/" + projectId + "/keys")];
66
+ switch (_a.label) {
67
+ case 0: return [4 /*yield*/, (0, httpRequest_1._request)("GET", this._credentials, this._apiUrl, this.apiPath + "/" + projectId + "/keys")];
68
+ case 1:
69
+ response = _a.sent();
70
+ output = response.api_keys.map(function (apiKey) {
71
+ return __assign(__assign({}, apiKey), apiKey.api_key);
72
+ });
73
+ return [2 /*return*/, { api_keys: output }];
74
+ }
55
75
  });
56
76
  });
57
77
  };
package/dist/keys.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"keys.js","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAyC;AAGzC;IACE,cAAoB,YAAoB,EAAU,OAAe;QAA7C,iBAAY,GAAZ,YAAY,CAAQ;QAAU,YAAO,GAAP,OAAO,CAAQ;QAEzD,YAAO,GAAG,cAAc,CAAC;IAFmC,CAAC;IAIrE;;;OAGG;IACG,mBAAI,GAAV,UAAW,SAAiB;;;gBAC1B,sBAAO,IAAA,sBAAQ,EACb,KAAK,EACL,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,OAAO,EACT,IAAI,CAAC,OAAO,SAAI,SAAS,UAAO,CACpC,EAAC;;;KACH;IAED;;;;OAIG;IACG,kBAAG,GAAT,UAAU,SAAiB,EAAE,KAAa;;;gBACxC,sBAAO,IAAA,sBAAQ,EACb,KAAK,EACL,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,OAAO,EACT,IAAI,CAAC,OAAO,SAAI,SAAS,cAAS,KAAO,CAC7C,EAAC;;;KACH;IAED;;;;;;OAMG;IACG,qBAAM,GAAZ,UACE,SAAiB,EACjB,OAAe,EACf,MAAqB,EACrB,OAA0B;;;gBAE1B,6EAA6E;gBAC7E,IACE,OAAO;oBACP,OAAO,CAAC,cAAc,KAAK,SAAS;oBACpC,OAAO,CAAC,UAAU,KAAK,SAAS,EAChC;oBACA,MAAM,IAAI,KAAK,CACb,wFAAwF,CACzF,CAAC;iBACH;gBAED,sBAAO,IAAA,sBAAQ,EACb,MAAM,EACN,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,OAAO,EACT,IAAI,CAAC,OAAO,SAAI,SAAS,UAAO,EACnC,IAAI,CAAC,SAAS,CAAC;wBACb,OAAO,SAAA;wBAC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veTranscription = /** @class */ (function (_super) {
75
75
  * the websocket connection when transcription is finished
76
76
  */
77
77
  LiveTranscription.prototype.finish = function () {
78
- this._socket.close(1000);
78
+ this._socket.send(new Uint8Array(0));
79
79
  };
80
80
  return LiveTranscription;
81
81
  }(events_1.default));
@@ -1 +1 @@
1
- {"version":3,"file":"liveTranscription.js","sourceRoot":"","sources":["../../src/transcription/liveTranscription.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,kDAAkC;AAClC,4DAAsC;AACtC,0CAA2B;AAC3B,kCAAoE;AAEpE,0CAAyC;AAEzC;IAAuC,qCAAY;IAGjD,2BACE,WAAmB,EACnB,MAAc,EACd,OAAkC;QAHpC,YAKE,kBAAM,SAAS,CAAC,SAWjB;QAVC,KAAI,CAAC,OAAO,GAAG,IAAI,YAAS,CAC1B,WAAS,MAAM,mBAAc,qBAAW,CAAC,SAAS,CAAC,OAAO,CAAG,EAC7D;YACE,OAAO,EAAE;gBACP,aAAa,EAAE,WAAS,WAAa;gBACrC,YAAY,EAAE,IAAA,qBAAS,GAAE;aAC1B;SACF,CACF,CAAC;QACF,KAAI,CAAC,iBAAiB,EAAE,CAAC;;IAC3B,CAAC;IAEO,6CAAiB,GAAzB;QAAA,iBAgBC;QAfC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG;YACpB,KAAI,CAAC,IAAI,oBAA+B,KAAI,CAAC,CAAC;QAChD,CAAC,CAAC;QAEF,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,UAAC,KAA2B;YACjD,KAAI,CAAC,IAAI,sBAAgC,KAAK,CAAC,CAAC;QAClD,CAAC,CAAC;QAEF,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,UAAC,KAAK;YAC3B,KAAI,CAAC,IAAI,sBAAgC,KAAK,CAAC,CAAC;QAClD,CAAC,CAAC;QAEF,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,UAAC,CAAC;YACzB,KAAI,CAAC,IAAI,gDAA6C,CAAC,CAAC,IAAI,CAAC,CAAC;QAChE,CAAC,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,yCAAa,GAApB;QACE,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;IACjC,CAAC;IAED;;;OAGG;IACI,gCAAI,GAAX,UAAY,IAAuD;QACjE,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,KAAK,uBAAe,CAAC,IAAI,EAAE;YACpD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACzB;aAAM;YACL,IAAI,CAAC,IAAI,sBAEP,sCAAsC,CACvC,CAAC;SACH;IACH,CAAC;IAED;;;OAGG;IACI,kCAAM,GAAb;QACE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IACH,wBAAC;AAAD,CAAC,AApED,CAAuC,gBAAY,GAoElD;AApEY,8CAAiB"}
1
+ {"version":3,"file":"liveTranscription.js","sourceRoot":"","sources":["../../src/transcription/liveTranscription.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,kDAAkC;AAClC,4DAAsC;AACtC,0CAA2B;AAC3B,kCAAoE;AAEpE,0CAAyC;AAEzC;IAAuC,qCAAY;IAGjD,2BACE,WAAmB,EACnB,MAAc,EACd,OAAkC;QAHpC,YAKE,kBAAM,SAAS,CAAC,SAWjB;QAVC,KAAI,CAAC,OAAO,GAAG,IAAI,YAAS,CAC1B,WAAS,MAAM,mBAAc,qBAAW,CAAC,SAAS,CAAC,OAAO,CAAG,EAC7D;YACE,OAAO,EAAE;gBACP,aAAa,EAAE,WAAS,WAAa;gBACrC,YAAY,EAAE,IAAA,qBAAS,GAAE;aAC1B;SACF,CACF,CAAC;QACF,KAAI,CAAC,iBAAiB,EAAE,CAAC;;IAC3B,CAAC;IAEO,6CAAiB,GAAzB;QAAA,iBAgBC;QAfC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG;YACpB,KAAI,CAAC,IAAI,oBAA+B,KAAI,CAAC,CAAC;QAChD,CAAC,CAAC;QAEF,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,UAAC,KAA2B;YACjD,KAAI,CAAC,IAAI,sBAAgC,KAAK,CAAC,CAAC;QAClD,CAAC,CAAC;QAEF,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,UAAC,KAAK;YAC3B,KAAI,CAAC,IAAI,sBAAgC,KAAK,CAAC,CAAC;QAClD,CAAC,CAAC;QAEF,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,UAAC,CAAC;YACzB,KAAI,CAAC,IAAI,gDAA6C,CAAC,CAAC,IAAI,CAAC,CAAC;QAChE,CAAC,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,yCAAa,GAApB;QACE,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;IACjC,CAAC;IAED;;;OAGG;IACI,gCAAI,GAAX,UAAY,IAAuD;QACjE,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,KAAK,uBAAe,CAAC,IAAI,EAAE;YACpD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACzB;aAAM;YACL,IAAI,CAAC,IAAI,sBAEP,sCAAsC,CACvC,CAAC;SACH;IACH,CAAC;IAED;;;OAGG;IACI,kCAAM,GAAb;QACE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACH,wBAAC;AAAD,CAAC,AApED,CAAuC,gBAAY,GAoElD;AApEY,8CAAiB"}
@@ -1,4 +1,5 @@
1
1
  import { Key } from "./key";
2
+ import { Member } from "./member";
2
3
  /**
3
4
  * Response from the Deepgram API to list keys
4
5
  */
@@ -6,5 +7,44 @@ export declare type KeyResponse = {
6
7
  /**
7
8
  * Array of API keys associated with the project
8
9
  */
9
- api_keys: Array<Key>;
10
+ api_keys: Array<{
11
+ /**
12
+ * Optional member associated with the API key
13
+ */
14
+ member?: Member;
15
+ /**
16
+ * API key
17
+ */
18
+ api_key: Key;
19
+ /**
20
+ * Unique identifier of the key to use in API requests
21
+ * @deprecated This property has moved to api_key.api_key_id and will
22
+ * be removed in future versions.
23
+ */
24
+ api_key_id: string;
25
+ /**
26
+ * API key to send in API requests (Only displayed when first created)
27
+ * @deprecated This property has moved to api_key.key and will
28
+ * be removed in future versions.
29
+ */
30
+ key?: string;
31
+ /**
32
+ * Comment for user reference
33
+ * @deprecated This property has moved to api_key.comment and will
34
+ * be removed in future versions.
35
+ */
36
+ comment: string;
37
+ /**
38
+ * Timestamp of the date/time the key was created
39
+ * @deprecated This property has moved to api_key.created and will
40
+ * be removed in future versions.
41
+ */
42
+ created: string;
43
+ /**
44
+ * Array of scopes assigned to the key
45
+ * @deprecated This property has moved to api_key.scopes and will
46
+ * be removed in future versions.
47
+ */
48
+ scopes: Array<string>;
49
+ }>;
10
50
  };
@@ -16,7 +16,7 @@ export declare type LiveTranscriptionOptions = {
16
16
  * @remarks latest OR <version_id>
17
17
  * @see https://developers.deepgram.com/api-reference/speech-recognition-api#operation/transcribeAudio/properties/version
18
18
  */
19
- version: string;
19
+ version?: string;
20
20
  /**
21
21
  * BCP-47 language tag that hints at the primary spoken language.
22
22
  * @default en-US
@@ -1,6 +1,6 @@
1
1
  export declare type Member = {
2
- id: string;
3
- name: string;
4
- scopes: Array<string>;
2
+ member_id: string;
3
+ name?: string;
4
+ scopes?: Array<string>;
5
5
  email: string;
6
6
  };
@@ -16,7 +16,7 @@ export declare type PrerecordedTranscriptionOptions = {
16
16
  * @remarks latest OR <version_id>
17
17
  * @see https://developers.deepgram.com/api-reference/speech-recognition-api#operation/transcribeAudio/properties/version
18
18
  */
19
- version: string;
19
+ version?: string;
20
20
  /**
21
21
  * BCP-47 language tag that hints at the primary spoken language.
22
22
  * @default en-US
@@ -28,7 +28,8 @@ export declare type Utterance = {
28
28
  */
29
29
  words: Array<WordBase>;
30
30
  /**
31
- * Integer indicating the speaker who is saying the word being processed.
31
+ * Integer indicating the predicted speaker of the majority of words
32
+ * in the utterance who is saying the words being processed.
32
33
  */
33
34
  speaker?: number;
34
35
  /**
@@ -4,4 +4,5 @@ export declare type WordBase = {
4
4
  end: number;
5
5
  confidence: number;
6
6
  punctuated_word?: string;
7
+ speaker?: number;
7
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepgram/sdk",
3
- "version": "1.2.0",
3
+ "version": "1.2.4",
4
4
  "description": "An SDK for the Deepgram automated speech recognition platform",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "repository": {
15
15
  "type": "git",
16
- "url": "git+https://github.com/deepgram/node-sdk.git"
16
+ "url": "git+https://github.com/deepgram/deepgram-node-sdk.git"
17
17
  },
18
18
  "keywords": [
19
19
  "deepgram",
@@ -27,9 +27,9 @@
27
27
  },
28
28
  "license": "MIT",
29
29
  "bugs": {
30
- "url": "https://github.com/deepgram/node-sdk/issues"
30
+ "url": "https://github.com/deepgram/deepgram-node-sdk/issues"
31
31
  },
32
- "homepage": "https://github.com/deepgram/node-sdk#readme",
32
+ "homepage": "https://github.com/deepgram/deepgram-node-sdk#readme",
33
33
  "devDependencies": {
34
34
  "@types/chai": "^4.2.22",
35
35
  "@types/mocha": "^9.0.0",