@deepgram/sdk 1.4.1 → 1.4.2
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/dist/browser/index.js +1 -1659
- package/dist/index.js +1 -1
- package/package.json +9 -6
- package/tsconfig-es6.json +16 -0
- package/webpack.config.js +21 -1
- package/bundle/billing.d.ts +0 -19
- package/bundle/billing.js +0 -73
- package/bundle/billing.js.map +0 -1
- package/bundle/browser/httpFetch.d.ts +0 -1
- package/bundle/browser/httpFetch.js +0 -75
- package/bundle/browser/httpFetch.js.map +0 -1
- package/bundle/browser/index.d.ts +0 -21
- package/bundle/browser/index.js +0 -35
- package/bundle/browser/index.js.map +0 -1
- package/bundle/browser/transcription/index.d.ts +0 -17
- package/bundle/browser/transcription/index.js +0 -75
- package/bundle/browser/transcription/index.js.map +0 -1
- package/bundle/browser/transcription/preRecordedTranscription.d.ts +0 -9
- package/bundle/browser/transcription/preRecordedTranscription.js +0 -87
- package/bundle/browser/transcription/preRecordedTranscription.js.map +0 -1
- package/bundle/constants/defaultOptions.d.ts +0 -6
- package/bundle/constants/defaultOptions.js +0 -10
- package/bundle/constants/defaultOptions.js.map +0 -1
- package/bundle/constants/index.d.ts +0 -1
- package/bundle/constants/index.js +0 -18
- package/bundle/constants/index.js.map +0 -1
- package/bundle/enums/alternatives.d.ts +0 -4
- package/bundle/enums/alternatives.js +0 -3
- package/bundle/enums/alternatives.js.map +0 -1
- package/bundle/enums/connectionState.d.ts +0 -6
- package/bundle/enums/connectionState.js +0 -11
- package/bundle/enums/connectionState.js.map +0 -1
- package/bundle/enums/diarization.d.ts +0 -4
- package/bundle/enums/diarization.js +0 -3
- package/bundle/enums/diarization.js.map +0 -1
- package/bundle/enums/index.d.ts +0 -7
- package/bundle/enums/index.js +0 -24
- package/bundle/enums/index.js.map +0 -1
- package/bundle/enums/liveTranscriptionEvents.d.ts +0 -6
- package/bundle/enums/liveTranscriptionEvents.js +0 -3
- package/bundle/enums/liveTranscriptionEvents.js.map +0 -1
- package/bundle/enums/models.d.ts +0 -5
- package/bundle/enums/models.js +0 -3
- package/bundle/enums/models.js.map +0 -1
- package/bundle/enums/punctuation.d.ts +0 -4
- package/bundle/enums/punctuation.js +0 -3
- package/bundle/enums/punctuation.js.map +0 -1
- package/bundle/enums/searchKind.d.ts +0 -4
- package/bundle/enums/searchKind.js +0 -3
- package/bundle/enums/searchKind.js.map +0 -1
- package/bundle/helpers/index.d.ts +0 -2
- package/bundle/helpers/index.js +0 -19
- package/bundle/helpers/index.js.map +0 -1
- package/bundle/helpers/secondsToTimestamp.d.ts +0 -1
- package/bundle/helpers/secondsToTimestamp.js +0 -8
- package/bundle/helpers/secondsToTimestamp.js.map +0 -1
- package/bundle/helpers/validateOptions.d.ts +0 -1
- package/bundle/helpers/validateOptions.js +0 -13
- package/bundle/helpers/validateOptions.js.map +0 -1
- package/bundle/httpRequest.d.ts +0 -3
- package/bundle/httpRequest.js +0 -91
- package/bundle/httpRequest.js.map +0 -1
- package/bundle/index.d.ts +0 -21
- package/bundle/index.js +0 -35
- package/bundle/index.js.map +0 -1
- package/bundle/invitation.d.ts +0 -30
- package/bundle/invitation.js +0 -99
- package/bundle/invitation.js.map +0 -1
- package/bundle/keys.d.ts +0 -33
- package/bundle/keys.js +0 -132
- package/bundle/keys.js.map +0 -1
- package/bundle/members.d.ts +0 -19
- package/bundle/members.js +0 -73
- package/bundle/members.js.map +0 -1
- package/bundle/projects.d.ts +0 -22
- package/bundle/projects.js +0 -82
- package/bundle/projects.js.map +0 -1
- package/bundle/scopes.d.ts +0 -21
- package/bundle/scopes.js +0 -77
- package/bundle/scopes.js.map +0 -1
- package/bundle/transcription/index.d.ts +0 -18
- package/bundle/transcription/index.js +0 -72
- package/bundle/transcription/index.js.map +0 -1
- package/bundle/transcription/liveTranscription.d.ts +0 -23
- package/bundle/transcription/liveTranscription.js +0 -83
- package/bundle/transcription/liveTranscription.js.map +0 -1
- package/bundle/transcription/preRecordedTranscription.d.ts +0 -8
- package/bundle/transcription/preRecordedTranscription.js +0 -114
- package/bundle/transcription/preRecordedTranscription.js.map +0 -1
- package/bundle/types/balance.d.ts +0 -6
- package/bundle/types/balance.js +0 -3
- package/bundle/types/balance.js.map +0 -1
- package/bundle/types/balanceList.d.ts +0 -4
- package/bundle/types/balanceList.js +0 -3
- package/bundle/types/balanceList.js.map +0 -1
- package/bundle/types/channel.d.ts +0 -25
- package/bundle/types/channel.js +0 -3
- package/bundle/types/channel.js.map +0 -1
- package/bundle/types/createKeyOptions.d.ts +0 -13
- package/bundle/types/createKeyOptions.js +0 -3
- package/bundle/types/createKeyOptions.js.map +0 -1
- package/bundle/types/hit.d.ts +0 -21
- package/bundle/types/hit.js +0 -3
- package/bundle/types/hit.js.map +0 -1
- package/bundle/types/index.d.ts +0 -38
- package/bundle/types/index.js +0 -55
- package/bundle/types/index.js.map +0 -1
- package/bundle/types/invitationList.d.ts +0 -4
- package/bundle/types/invitationList.js +0 -3
- package/bundle/types/invitationList.js.map +0 -1
- package/bundle/types/invitationOptions.d.ts +0 -4
- package/bundle/types/invitationOptions.js +0 -3
- package/bundle/types/invitationOptions.js.map +0 -1
- package/bundle/types/key.d.ts +0 -25
- package/bundle/types/key.js +0 -3
- package/bundle/types/key.js.map +0 -1
- package/bundle/types/keyResponse.d.ts +0 -10
- package/bundle/types/keyResponse.js +0 -3
- package/bundle/types/keyResponse.js.map +0 -1
- package/bundle/types/keyResponseObj.d.ts +0 -42
- package/bundle/types/keyResponseObj.js +0 -3
- package/bundle/types/keyResponseObj.js.map +0 -1
- package/bundle/types/keyword.d.ts +0 -4
- package/bundle/types/keyword.js +0 -3
- package/bundle/types/keyword.js.map +0 -1
- package/bundle/types/liveTranscriptionOptions.d.ts +0 -148
- package/bundle/types/liveTranscriptionOptions.js +0 -3
- package/bundle/types/liveTranscriptionOptions.js.map +0 -1
- package/bundle/types/liveTranscriptionResponse.d.ts +0 -9
- package/bundle/types/liveTranscriptionResponse.js +0 -3
- package/bundle/types/liveTranscriptionResponse.js.map +0 -1
- package/bundle/types/member.d.ts +0 -7
- package/bundle/types/member.js +0 -3
- package/bundle/types/member.js.map +0 -1
- package/bundle/types/memberList.d.ts +0 -4
- package/bundle/types/memberList.js +0 -3
- package/bundle/types/memberList.js.map +0 -1
- package/bundle/types/message.d.ts +0 -3
- package/bundle/types/message.js +0 -3
- package/bundle/types/message.js.map +0 -1
- package/bundle/types/metadata.d.ts +0 -8
- package/bundle/types/metadata.js +0 -3
- package/bundle/types/metadata.js.map +0 -1
- package/bundle/types/prerecordedTranscriptionOptions.d.ts +0 -126
- package/bundle/types/prerecordedTranscriptionOptions.js +0 -3
- package/bundle/types/prerecordedTranscriptionOptions.js.map +0 -1
- package/bundle/types/prerecordedTranscriptionResponse.d.ts +0 -25
- package/bundle/types/prerecordedTranscriptionResponse.js +0 -51
- package/bundle/types/prerecordedTranscriptionResponse.js.map +0 -1
- package/bundle/types/project.d.ts +0 -17
- package/bundle/types/project.js +0 -3
- package/bundle/types/project.js.map +0 -1
- package/bundle/types/projectPatchRequest.d.ts +0 -4
- package/bundle/types/projectPatchRequest.js +0 -3
- package/bundle/types/projectPatchRequest.js.map +0 -1
- package/bundle/types/projectPatchResponse.d.ts +0 -6
- package/bundle/types/projectPatchResponse.js +0 -3
- package/bundle/types/projectPatchResponse.js.map +0 -1
- package/bundle/types/projectResponse.d.ts +0 -4
- package/bundle/types/projectResponse.js +0 -3
- package/bundle/types/projectResponse.js.map +0 -1
- package/bundle/types/requestFunction.d.ts +0 -5
- package/bundle/types/requestFunction.js +0 -3
- package/bundle/types/requestFunction.js.map +0 -1
- package/bundle/types/scopeList.d.ts +0 -3
- package/bundle/types/scopeList.js +0 -3
- package/bundle/types/scopeList.js.map +0 -1
- package/bundle/types/search.d.ts +0 -14
- package/bundle/types/search.js +0 -3
- package/bundle/types/search.js.map +0 -1
- package/bundle/types/transcriptionSource.d.ts +0 -14
- package/bundle/types/transcriptionSource.js +0 -3
- package/bundle/types/transcriptionSource.js.map +0 -1
- package/bundle/types/usageCallback.d.ts +0 -4
- package/bundle/types/usageCallback.js +0 -3
- package/bundle/types/usageCallback.js.map +0 -1
- package/bundle/types/usageField.d.ts +0 -7
- package/bundle/types/usageField.js +0 -3
- package/bundle/types/usageField.js.map +0 -1
- package/bundle/types/usageFieldOptions.d.ts +0 -4
- package/bundle/types/usageFieldOptions.js +0 -3
- package/bundle/types/usageFieldOptions.js.map +0 -1
- package/bundle/types/usageOptions.d.ts +0 -23
- package/bundle/types/usageOptions.js +0 -3
- package/bundle/types/usageOptions.js.map +0 -1
- package/bundle/types/usageRequest.d.ts +0 -11
- package/bundle/types/usageRequest.js +0 -3
- package/bundle/types/usageRequest.js.map +0 -1
- package/bundle/types/usageRequestDetail.d.ts +0 -30
- package/bundle/types/usageRequestDetail.js +0 -3
- package/bundle/types/usageRequestDetail.js.map +0 -1
- package/bundle/types/usageRequestList.d.ts +0 -6
- package/bundle/types/usageRequestList.js +0 -3
- package/bundle/types/usageRequestList.js.map +0 -1
- package/bundle/types/usageRequestListOptions.d.ts +0 -7
- package/bundle/types/usageRequestListOptions.js +0 -3
- package/bundle/types/usageRequestListOptions.js.map +0 -1
- package/bundle/types/usageRequestMessage.d.ts +0 -3
- package/bundle/types/usageRequestMessage.js +0 -3
- package/bundle/types/usageRequestMessage.js.map +0 -1
- package/bundle/types/usageResponse.d.ts +0 -10
- package/bundle/types/usageResponse.js +0 -3
- package/bundle/types/usageResponse.js.map +0 -1
- package/bundle/types/usageResponseDetail.d.ts +0 -6
- package/bundle/types/usageResponseDetail.js +0 -3
- package/bundle/types/usageResponseDetail.js.map +0 -1
- package/bundle/types/utterance.d.ts +0 -39
- package/bundle/types/utterance.js +0 -3
- package/bundle/types/utterance.js.map +0 -1
- package/bundle/types/wordBase.d.ts +0 -8
- package/bundle/types/wordBase.js +0 -3
- package/bundle/types/wordBase.js.map +0 -1
- package/bundle/usage.d.ts +0 -35
- package/bundle/usage.js +0 -122
- package/bundle/usage.js.map +0 -1
- package/bundle/userAgent.d.ts +0 -1
- package/bundle/userAgent.js +0 -20
- package/bundle/userAgent.js.map +0 -1
package/dist/browser/index.js
CHANGED
|
@@ -1,1659 +1 @@
|
|
|
1
|
-
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
|
2
|
-
"use strict";
|
|
3
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
13
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
14
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
15
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
16
|
-
function step(op) {
|
|
17
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
18
|
-
while (_) try {
|
|
19
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
20
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
21
|
-
switch (op[0]) {
|
|
22
|
-
case 0: case 1: t = op; break;
|
|
23
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
24
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
25
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
26
|
-
default:
|
|
27
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
28
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
29
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
30
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
31
|
-
if (t[2]) _.ops.pop();
|
|
32
|
-
_.trys.pop(); continue;
|
|
33
|
-
}
|
|
34
|
-
op = body.call(thisArg, _);
|
|
35
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
36
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.Billing = void 0;
|
|
41
|
-
var Billing = /** @class */ (function () {
|
|
42
|
-
function Billing(_credentials, _apiUrl, _request) {
|
|
43
|
-
this._credentials = _credentials;
|
|
44
|
-
this._apiUrl = _apiUrl;
|
|
45
|
-
this._request = _request;
|
|
46
|
-
this.apiPath = "/v1/projects";
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Retrieves list of balance info of the specified project.
|
|
50
|
-
* @param projectId Unique identifier of the project
|
|
51
|
-
*/
|
|
52
|
-
Billing.prototype.listBalances = function (projectId) {
|
|
53
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
-
return __generator(this, function (_a) {
|
|
55
|
-
return [2 /*return*/, this._request("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/balances"))];
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Retrieves balance info of a specified balance_id in the specified project.
|
|
61
|
-
* @param projectId Unique identifier of the project
|
|
62
|
-
* @param balanceId Unique identifier of the balance
|
|
63
|
-
*/
|
|
64
|
-
Billing.prototype.getBalance = function (projectId, balanceId) {
|
|
65
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
66
|
-
return __generator(this, function (_a) {
|
|
67
|
-
return [2 /*return*/, this._request("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/balances/").concat(balanceId))];
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
return Billing;
|
|
72
|
-
}());
|
|
73
|
-
exports.Billing = Billing;
|
|
74
|
-
|
|
75
|
-
},{}],2:[function(require,module,exports){
|
|
76
|
-
"use strict";
|
|
77
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
78
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
79
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
80
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
81
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
82
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
83
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
87
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
88
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
89
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
90
|
-
function step(op) {
|
|
91
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
92
|
-
while (_) try {
|
|
93
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
94
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
95
|
-
switch (op[0]) {
|
|
96
|
-
case 0: case 1: t = op; break;
|
|
97
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
98
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
99
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
100
|
-
default:
|
|
101
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
102
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
103
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
104
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
105
|
-
if (t[2]) _.ops.pop();
|
|
106
|
-
_.trys.pop(); continue;
|
|
107
|
-
}
|
|
108
|
-
op = body.call(thisArg, _);
|
|
109
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
110
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
114
|
-
exports._request = void 0;
|
|
115
|
-
var userAgent_1 = require("../userAgent");
|
|
116
|
-
function _request(method, api_key, apiUrl, path, payload) {
|
|
117
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
118
|
-
var url, response, json, err_1;
|
|
119
|
-
return __generator(this, function (_a) {
|
|
120
|
-
switch (_a.label) {
|
|
121
|
-
case 0:
|
|
122
|
-
url = "https://".concat(apiUrl).concat(path);
|
|
123
|
-
_a.label = 1;
|
|
124
|
-
case 1:
|
|
125
|
-
_a.trys.push([1, 4, , 5]);
|
|
126
|
-
return [4 /*yield*/, fetch(url, {
|
|
127
|
-
method: method,
|
|
128
|
-
headers: {
|
|
129
|
-
Authorization: "token ".concat(api_key),
|
|
130
|
-
"Content-Type": "application/json",
|
|
131
|
-
"X-DG-Agent": (0, userAgent_1.userAgent)(),
|
|
132
|
-
},
|
|
133
|
-
body: payload,
|
|
134
|
-
})];
|
|
135
|
-
case 2:
|
|
136
|
-
response = _a.sent();
|
|
137
|
-
return [4 /*yield*/, response.json()];
|
|
138
|
-
case 3:
|
|
139
|
-
json = _a.sent();
|
|
140
|
-
return [2 /*return*/, json];
|
|
141
|
-
case 4:
|
|
142
|
-
err_1 = _a.sent();
|
|
143
|
-
throw new Error("DG: ".concat(err_1));
|
|
144
|
-
case 5: return [2 /*return*/];
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
exports._request = _request;
|
|
150
|
-
|
|
151
|
-
},{"../userAgent":56}],3:[function(require,module,exports){
|
|
152
|
-
"use strict";
|
|
153
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
154
|
-
exports.Deepgram = void 0;
|
|
155
|
-
var constants_1 = require("../constants");
|
|
156
|
-
var helpers_1 = require("../helpers");
|
|
157
|
-
var transcription_1 = require("./transcription");
|
|
158
|
-
var projects_1 = require("../projects");
|
|
159
|
-
var keys_1 = require("../keys");
|
|
160
|
-
var usage_1 = require("../usage");
|
|
161
|
-
var members_1 = require("../members");
|
|
162
|
-
var invitation_1 = require("../invitation");
|
|
163
|
-
var billing_1 = require("../billing");
|
|
164
|
-
var scopes_1 = require("../scopes");
|
|
165
|
-
var httpFetch_1 = require("./httpFetch");
|
|
166
|
-
var Deepgram = /** @class */ (function () {
|
|
167
|
-
function Deepgram(apiKey, apiUrl) {
|
|
168
|
-
this._apiKey = apiKey;
|
|
169
|
-
this._apiUrl = apiUrl || constants_1.DefaultOptions.apiUrl;
|
|
170
|
-
/**
|
|
171
|
-
* Ensures that the provided options were provided
|
|
172
|
-
*/
|
|
173
|
-
(0, helpers_1.validateOptions)(this._apiKey, this._apiUrl);
|
|
174
|
-
this.transcription = new transcription_1.Transcriber(this._apiKey, this._apiUrl);
|
|
175
|
-
this.projects = new projects_1.Projects(this._apiKey, this._apiUrl, httpFetch_1._request);
|
|
176
|
-
this.keys = new keys_1.Keys(this._apiKey, this._apiUrl, httpFetch_1._request);
|
|
177
|
-
this.usage = new usage_1.Usage(this._apiKey, this._apiUrl, httpFetch_1._request);
|
|
178
|
-
this.members = new members_1.Members(this._apiKey, this._apiUrl, httpFetch_1._request);
|
|
179
|
-
this.invitation = new invitation_1.Invitation(this._apiKey, this._apiUrl, httpFetch_1._request);
|
|
180
|
-
this.billing = new billing_1.Billing(this._apiKey, this._apiUrl, httpFetch_1._request);
|
|
181
|
-
this.scopes = new scopes_1.Scopes(this._apiKey, this._apiUrl, httpFetch_1._request);
|
|
182
|
-
}
|
|
183
|
-
return Deepgram;
|
|
184
|
-
}());
|
|
185
|
-
exports.Deepgram = Deepgram;
|
|
186
|
-
|
|
187
|
-
},{"../billing":1,"../constants":7,"../helpers":8,"../invitation":11,"../keys":12,"../members":13,"../projects":14,"../scopes":15,"../usage":55,"./httpFetch":2,"./transcription":4}],4:[function(require,module,exports){
|
|
188
|
-
"use strict";
|
|
189
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
190
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
191
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
192
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
193
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
194
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
195
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
196
|
-
});
|
|
197
|
-
};
|
|
198
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
199
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
200
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
201
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
202
|
-
function step(op) {
|
|
203
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
204
|
-
while (_) try {
|
|
205
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
206
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
207
|
-
switch (op[0]) {
|
|
208
|
-
case 0: case 1: t = op; break;
|
|
209
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
210
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
211
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
212
|
-
default:
|
|
213
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
214
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
215
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
216
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
217
|
-
if (t[2]) _.ops.pop();
|
|
218
|
-
_.trys.pop(); continue;
|
|
219
|
-
}
|
|
220
|
-
op = body.call(thisArg, _);
|
|
221
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
222
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
226
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
227
|
-
};
|
|
228
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
229
|
-
exports.Transcriber = void 0;
|
|
230
|
-
var querystring_1 = __importDefault(require("querystring"));
|
|
231
|
-
var preRecordedTranscription_1 = require("./preRecordedTranscription");
|
|
232
|
-
var Transcriber = /** @class */ (function () {
|
|
233
|
-
function Transcriber(_credentials, _apiUrl) {
|
|
234
|
-
this._credentials = _credentials;
|
|
235
|
-
this._apiUrl = _apiUrl;
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Transcribes prerecorded audio from a file or buffer
|
|
239
|
-
* @param source Url or Buffer of file to transcribe
|
|
240
|
-
* @param options Options to modify transcriptions
|
|
241
|
-
*/
|
|
242
|
-
Transcriber.prototype.preRecorded = function (source, options) {
|
|
243
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
244
|
-
return __generator(this, function (_a) {
|
|
245
|
-
switch (_a.label) {
|
|
246
|
-
case 0: return [4 /*yield*/, (0, preRecordedTranscription_1.preRecordedTranscription)(this._credentials, this._apiUrl || "", source, options)];
|
|
247
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
};
|
|
252
|
-
/**
|
|
253
|
-
* Opens a websocket to Deepgram's API for live transcriptions
|
|
254
|
-
* @param options Options to modify transcriptions
|
|
255
|
-
*/
|
|
256
|
-
Transcriber.prototype.live = function (options) {
|
|
257
|
-
return new WebSocket("wss://".concat(this._apiUrl, "/v1/listen?").concat(querystring_1.default.stringify(options)), ["token", this._credentials]);
|
|
258
|
-
};
|
|
259
|
-
return Transcriber;
|
|
260
|
-
}());
|
|
261
|
-
exports.Transcriber = Transcriber;
|
|
262
|
-
|
|
263
|
-
},{"./preRecordedTranscription":5,"querystring":60}],5:[function(require,module,exports){
|
|
264
|
-
"use strict";
|
|
265
|
-
var __assign = (this && this.__assign) || function () {
|
|
266
|
-
__assign = Object.assign || function(t) {
|
|
267
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
268
|
-
s = arguments[i];
|
|
269
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
270
|
-
t[p] = s[p];
|
|
271
|
-
}
|
|
272
|
-
return t;
|
|
273
|
-
};
|
|
274
|
-
return __assign.apply(this, arguments);
|
|
275
|
-
};
|
|
276
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
277
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
278
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
279
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
280
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
281
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
282
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
283
|
-
});
|
|
284
|
-
};
|
|
285
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
286
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
287
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
288
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
289
|
-
function step(op) {
|
|
290
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
291
|
-
while (_) try {
|
|
292
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
293
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
294
|
-
switch (op[0]) {
|
|
295
|
-
case 0: case 1: t = op; break;
|
|
296
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
297
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
298
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
299
|
-
default:
|
|
300
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
301
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
302
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
303
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
304
|
-
if (t[2]) _.ops.pop();
|
|
305
|
-
_.trys.pop(); continue;
|
|
306
|
-
}
|
|
307
|
-
op = body.call(thisArg, _);
|
|
308
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
309
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
310
|
-
}
|
|
311
|
-
};
|
|
312
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
313
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
314
|
-
};
|
|
315
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
316
|
-
exports.preRecordedTranscription = void 0;
|
|
317
|
-
var querystring_1 = __importDefault(require("querystring"));
|
|
318
|
-
var types_1 = require("../../types");
|
|
319
|
-
var httpFetch_1 = require("../httpFetch");
|
|
320
|
-
function isUrlSource(providedSource) {
|
|
321
|
-
if (providedSource.url)
|
|
322
|
-
return true;
|
|
323
|
-
return false;
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* Transcribes audio from a url
|
|
327
|
-
* @param credentials Base64 encoded API key & secret
|
|
328
|
-
* @param apiUrl url string of Deepgram's API
|
|
329
|
-
* @param source Url or Buffer of file to transcribe
|
|
330
|
-
* @param options Options to modify transcriptions
|
|
331
|
-
*/
|
|
332
|
-
var preRecordedTranscription = function (apiKey, apiUrl, source, options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
333
|
-
var transcriptionOptions, body, response;
|
|
334
|
-
return __generator(this, function (_a) {
|
|
335
|
-
switch (_a.label) {
|
|
336
|
-
case 0:
|
|
337
|
-
transcriptionOptions = __assign({}, options);
|
|
338
|
-
if (!isUrlSource(source)) {
|
|
339
|
-
throw new Error("DG: Source must be a URL string");
|
|
340
|
-
}
|
|
341
|
-
body = JSON.stringify(source);
|
|
342
|
-
return [4 /*yield*/, (0, httpFetch_1._request)("POST", apiKey, apiUrl, "/v1/listen?".concat(querystring_1.default.stringify(transcriptionOptions)), body)];
|
|
343
|
-
case 1:
|
|
344
|
-
response = _a.sent();
|
|
345
|
-
return [2 /*return*/, Object.assign(new types_1.PrerecordedTranscriptionResponse(), response)];
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
}); };
|
|
349
|
-
exports.preRecordedTranscription = preRecordedTranscription;
|
|
350
|
-
|
|
351
|
-
},{"../../types":21,"../httpFetch":2,"querystring":60}],6:[function(require,module,exports){
|
|
352
|
-
"use strict";
|
|
353
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
354
|
-
exports.DefaultOptions = void 0;
|
|
355
|
-
/**
|
|
356
|
-
* Default SDK options
|
|
357
|
-
*/
|
|
358
|
-
exports.DefaultOptions = {
|
|
359
|
-
apiUrl: "api.deepgram.com",
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
},{}],7:[function(require,module,exports){
|
|
363
|
-
"use strict";
|
|
364
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
365
|
-
if (k2 === undefined) k2 = k;
|
|
366
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
367
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
368
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
369
|
-
}
|
|
370
|
-
Object.defineProperty(o, k2, desc);
|
|
371
|
-
}) : (function(o, m, k, k2) {
|
|
372
|
-
if (k2 === undefined) k2 = k;
|
|
373
|
-
o[k2] = m[k];
|
|
374
|
-
}));
|
|
375
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
376
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
377
|
-
};
|
|
378
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
379
|
-
__exportStar(require("./defaultOptions"), exports);
|
|
380
|
-
|
|
381
|
-
},{"./defaultOptions":6}],8:[function(require,module,exports){
|
|
382
|
-
"use strict";
|
|
383
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
384
|
-
if (k2 === undefined) k2 = k;
|
|
385
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
386
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
387
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
388
|
-
}
|
|
389
|
-
Object.defineProperty(o, k2, desc);
|
|
390
|
-
}) : (function(o, m, k, k2) {
|
|
391
|
-
if (k2 === undefined) k2 = k;
|
|
392
|
-
o[k2] = m[k];
|
|
393
|
-
}));
|
|
394
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
395
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
396
|
-
};
|
|
397
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
398
|
-
__exportStar(require("./secondsToTimestamp"), exports);
|
|
399
|
-
__exportStar(require("./validateOptions"), exports);
|
|
400
|
-
|
|
401
|
-
},{"./secondsToTimestamp":9,"./validateOptions":10}],9:[function(require,module,exports){
|
|
402
|
-
"use strict";
|
|
403
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
404
|
-
exports.secondsToTimestamp = void 0;
|
|
405
|
-
function secondsToTimestamp(seconds) {
|
|
406
|
-
return new Date(seconds * 1000).toISOString().substr(11, 12);
|
|
407
|
-
}
|
|
408
|
-
exports.secondsToTimestamp = secondsToTimestamp;
|
|
409
|
-
|
|
410
|
-
},{}],10:[function(require,module,exports){
|
|
411
|
-
"use strict";
|
|
412
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
413
|
-
exports.validateOptions = void 0;
|
|
414
|
-
function validateOptions(apiKey, apiUrl) {
|
|
415
|
-
if (!apiKey || apiKey.trim().length === 0) {
|
|
416
|
-
throw new Error("DG: API key is required");
|
|
417
|
-
}
|
|
418
|
-
if (!apiUrl || apiUrl.trim().length === 0) {
|
|
419
|
-
throw new Error("DG: API url should be a valid url or not provided");
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
exports.validateOptions = validateOptions;
|
|
423
|
-
|
|
424
|
-
},{}],11:[function(require,module,exports){
|
|
425
|
-
"use strict";
|
|
426
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
427
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
428
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
429
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
430
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
431
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
432
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
433
|
-
});
|
|
434
|
-
};
|
|
435
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
436
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
437
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
438
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
439
|
-
function step(op) {
|
|
440
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
441
|
-
while (_) try {
|
|
442
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
443
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
444
|
-
switch (op[0]) {
|
|
445
|
-
case 0: case 1: t = op; break;
|
|
446
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
447
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
448
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
449
|
-
default:
|
|
450
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
451
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
452
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
453
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
454
|
-
if (t[2]) _.ops.pop();
|
|
455
|
-
_.trys.pop(); continue;
|
|
456
|
-
}
|
|
457
|
-
op = body.call(thisArg, _);
|
|
458
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
459
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
460
|
-
}
|
|
461
|
-
};
|
|
462
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
463
|
-
exports.Invitation = void 0;
|
|
464
|
-
var Invitation = /** @class */ (function () {
|
|
465
|
-
function Invitation(_credentials, _apiUrl, _request) {
|
|
466
|
-
this._credentials = _credentials;
|
|
467
|
-
this._apiUrl = _apiUrl;
|
|
468
|
-
this._request = _request;
|
|
469
|
-
this.apiPath = "/v1/projects";
|
|
470
|
-
}
|
|
471
|
-
/**
|
|
472
|
-
* Lists all the current invites of a specified project.
|
|
473
|
-
* @param projectId Unique identifier of the project
|
|
474
|
-
*/
|
|
475
|
-
Invitation.prototype.list = function (projectId) {
|
|
476
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
477
|
-
return __generator(this, function (_a) {
|
|
478
|
-
return [2 /*return*/, this._request("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/invites"))];
|
|
479
|
-
});
|
|
480
|
-
});
|
|
481
|
-
};
|
|
482
|
-
/**
|
|
483
|
-
* Sends an invitation to join the specified project.
|
|
484
|
-
* @param projectId Unique identifier of the project
|
|
485
|
-
*/
|
|
486
|
-
Invitation.prototype.send = function (projectId, options) {
|
|
487
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
488
|
-
return __generator(this, function (_a) {
|
|
489
|
-
return [2 /*return*/, this._request("POST", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/invites"), JSON.stringify({
|
|
490
|
-
email: options.email,
|
|
491
|
-
scope: options.scope,
|
|
492
|
-
}))];
|
|
493
|
-
});
|
|
494
|
-
});
|
|
495
|
-
};
|
|
496
|
-
/**
|
|
497
|
-
* Removes the authenticated account from the specified project.
|
|
498
|
-
* @param projectId Unique identifier of the project
|
|
499
|
-
*/
|
|
500
|
-
Invitation.prototype.leave = function (projectId) {
|
|
501
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
502
|
-
return __generator(this, function (_a) {
|
|
503
|
-
return [2 /*return*/, this._request("DELETE", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/leave"))];
|
|
504
|
-
});
|
|
505
|
-
});
|
|
506
|
-
};
|
|
507
|
-
/**
|
|
508
|
-
* Removes the specified email from the invitations on the specified project.
|
|
509
|
-
* @param projectId Unique identifier of the project
|
|
510
|
-
* @param email email address of the invitee
|
|
511
|
-
* NOTE: This will return successful even if the email does not have an invite on the project.
|
|
512
|
-
*/
|
|
513
|
-
Invitation.prototype.delete = function (projectId, email) {
|
|
514
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
515
|
-
return __generator(this, function (_a) {
|
|
516
|
-
return [2 /*return*/, this._request("DELETE", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/invites/").concat(email))];
|
|
517
|
-
});
|
|
518
|
-
});
|
|
519
|
-
};
|
|
520
|
-
return Invitation;
|
|
521
|
-
}());
|
|
522
|
-
exports.Invitation = Invitation;
|
|
523
|
-
|
|
524
|
-
},{}],12:[function(require,module,exports){
|
|
525
|
-
"use strict";
|
|
526
|
-
var __assign = (this && this.__assign) || function () {
|
|
527
|
-
__assign = Object.assign || function(t) {
|
|
528
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
529
|
-
s = arguments[i];
|
|
530
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
531
|
-
t[p] = s[p];
|
|
532
|
-
}
|
|
533
|
-
return t;
|
|
534
|
-
};
|
|
535
|
-
return __assign.apply(this, arguments);
|
|
536
|
-
};
|
|
537
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
538
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
539
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
540
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
541
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
542
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
543
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
544
|
-
});
|
|
545
|
-
};
|
|
546
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
547
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
548
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
549
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
550
|
-
function step(op) {
|
|
551
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
552
|
-
while (_) try {
|
|
553
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
554
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
555
|
-
switch (op[0]) {
|
|
556
|
-
case 0: case 1: t = op; break;
|
|
557
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
558
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
559
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
560
|
-
default:
|
|
561
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
562
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
563
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
564
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
565
|
-
if (t[2]) _.ops.pop();
|
|
566
|
-
_.trys.pop(); continue;
|
|
567
|
-
}
|
|
568
|
-
op = body.call(thisArg, _);
|
|
569
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
570
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
571
|
-
}
|
|
572
|
-
};
|
|
573
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
574
|
-
exports.Keys = void 0;
|
|
575
|
-
var Keys = /** @class */ (function () {
|
|
576
|
-
function Keys(_credentials, _apiUrl, _request) {
|
|
577
|
-
this._credentials = _credentials;
|
|
578
|
-
this._apiUrl = _apiUrl;
|
|
579
|
-
this._request = _request;
|
|
580
|
-
this.apiPath = "/v1/projects";
|
|
581
|
-
}
|
|
582
|
-
/**
|
|
583
|
-
* Retrieves all keys associated with the provided projectId
|
|
584
|
-
* @param projectId Unique identifier of the project containing API keys
|
|
585
|
-
*/
|
|
586
|
-
Keys.prototype.list = function (projectId) {
|
|
587
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
588
|
-
var response, output;
|
|
589
|
-
return __generator(this, function (_a) {
|
|
590
|
-
switch (_a.label) {
|
|
591
|
-
case 0: return [4 /*yield*/, this._request("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/keys"))];
|
|
592
|
-
case 1:
|
|
593
|
-
response = _a.sent();
|
|
594
|
-
output = response.api_keys.map(function (apiKey) {
|
|
595
|
-
return __assign(__assign({}, apiKey), apiKey.api_key);
|
|
596
|
-
});
|
|
597
|
-
return [2 /*return*/, { api_keys: output }];
|
|
598
|
-
}
|
|
599
|
-
});
|
|
600
|
-
});
|
|
601
|
-
};
|
|
602
|
-
/**
|
|
603
|
-
* Retrieves a specific key associated with the provided projectId
|
|
604
|
-
* @param projectId Unique identifier of the project containing API keys
|
|
605
|
-
* @param keyId Unique identifier for the key to retrieve
|
|
606
|
-
*/
|
|
607
|
-
Keys.prototype.get = function (projectId, keyId) {
|
|
608
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
609
|
-
return __generator(this, function (_a) {
|
|
610
|
-
return [2 /*return*/, this._request("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/keys/").concat(keyId))];
|
|
611
|
-
});
|
|
612
|
-
});
|
|
613
|
-
};
|
|
614
|
-
/**
|
|
615
|
-
* Creates an API key with the provided scopes
|
|
616
|
-
* @param projectId Unique identifier of the project to create an API key under
|
|
617
|
-
* @param comment Comment to describe the key
|
|
618
|
-
* @param scopes Permission scopes associated with the API key
|
|
619
|
-
* @param options Optional options used when creating API keys
|
|
620
|
-
*/
|
|
621
|
-
Keys.prototype.create = function (projectId, comment, scopes, options) {
|
|
622
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
623
|
-
return __generator(this, function (_a) {
|
|
624
|
-
/** Throw an error if the user provided both expirationDate and timeToLive */
|
|
625
|
-
if (options &&
|
|
626
|
-
options.expirationDate !== undefined &&
|
|
627
|
-
options.timeToLive !== undefined) {
|
|
628
|
-
throw new Error("Please provide expirationDate or timeToLive or neither. Providing both is not allowed.");
|
|
629
|
-
}
|
|
630
|
-
return [2 /*return*/, this._request("POST", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/keys"), JSON.stringify({
|
|
631
|
-
comment: comment,
|
|
632
|
-
scopes: scopes,
|
|
633
|
-
expiration_date: options && options.expirationDate
|
|
634
|
-
? options.expirationDate
|
|
635
|
-
: undefined,
|
|
636
|
-
time_to_live_in_seconds: options && options.timeToLive ? options.timeToLive : undefined,
|
|
637
|
-
}))];
|
|
638
|
-
});
|
|
639
|
-
});
|
|
640
|
-
};
|
|
641
|
-
/**
|
|
642
|
-
* Deletes an API key
|
|
643
|
-
* @param projectId Unique identifier of the project to create an API key under
|
|
644
|
-
* @param keyId Unique identifier for the key to delete
|
|
645
|
-
*/
|
|
646
|
-
Keys.prototype.delete = function (projectId, keyId) {
|
|
647
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
648
|
-
return __generator(this, function (_a) {
|
|
649
|
-
return [2 /*return*/, this._request("DELETE", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/keys/").concat(keyId))];
|
|
650
|
-
});
|
|
651
|
-
});
|
|
652
|
-
};
|
|
653
|
-
return Keys;
|
|
654
|
-
}());
|
|
655
|
-
exports.Keys = Keys;
|
|
656
|
-
|
|
657
|
-
},{}],13:[function(require,module,exports){
|
|
658
|
-
"use strict";
|
|
659
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
660
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
661
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
662
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
663
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
664
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
665
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
666
|
-
});
|
|
667
|
-
};
|
|
668
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
669
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
670
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
671
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
672
|
-
function step(op) {
|
|
673
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
674
|
-
while (_) try {
|
|
675
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
676
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
677
|
-
switch (op[0]) {
|
|
678
|
-
case 0: case 1: t = op; break;
|
|
679
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
680
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
681
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
682
|
-
default:
|
|
683
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
684
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
685
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
686
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
687
|
-
if (t[2]) _.ops.pop();
|
|
688
|
-
_.trys.pop(); continue;
|
|
689
|
-
}
|
|
690
|
-
op = body.call(thisArg, _);
|
|
691
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
692
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
693
|
-
}
|
|
694
|
-
};
|
|
695
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
696
|
-
exports.Members = void 0;
|
|
697
|
-
var Members = /** @class */ (function () {
|
|
698
|
-
function Members(_credentials, _apiUrl, _request) {
|
|
699
|
-
this._credentials = _credentials;
|
|
700
|
-
this._apiUrl = _apiUrl;
|
|
701
|
-
this._request = _request;
|
|
702
|
-
this.apiPath = "/v1/projects";
|
|
703
|
-
}
|
|
704
|
-
/**
|
|
705
|
-
* Retrieves account objects for all of the accounts in the specified project.
|
|
706
|
-
* @param projectId Unique identifier of the project
|
|
707
|
-
*/
|
|
708
|
-
Members.prototype.listMembers = function (projectId) {
|
|
709
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
710
|
-
return __generator(this, function (_a) {
|
|
711
|
-
return [2 /*return*/, this._request("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/members"))];
|
|
712
|
-
});
|
|
713
|
-
});
|
|
714
|
-
};
|
|
715
|
-
/**
|
|
716
|
-
* Retrieves account objects for all of the accounts in the specified project.
|
|
717
|
-
* @param projectId Unique identifier of the project
|
|
718
|
-
* @param memberId Unique identifier of the member
|
|
719
|
-
*/
|
|
720
|
-
Members.prototype.removeMember = function (projectId, memberId) {
|
|
721
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
722
|
-
return __generator(this, function (_a) {
|
|
723
|
-
return [2 /*return*/, this._request("DELETE", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/members/").concat(memberId))];
|
|
724
|
-
});
|
|
725
|
-
});
|
|
726
|
-
};
|
|
727
|
-
return Members;
|
|
728
|
-
}());
|
|
729
|
-
exports.Members = Members;
|
|
730
|
-
|
|
731
|
-
},{}],14:[function(require,module,exports){
|
|
732
|
-
"use strict";
|
|
733
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
734
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
735
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
736
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
737
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
738
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
739
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
740
|
-
});
|
|
741
|
-
};
|
|
742
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
743
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
744
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
745
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
746
|
-
function step(op) {
|
|
747
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
748
|
-
while (_) try {
|
|
749
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
750
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
751
|
-
switch (op[0]) {
|
|
752
|
-
case 0: case 1: t = op; break;
|
|
753
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
754
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
755
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
756
|
-
default:
|
|
757
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
758
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
759
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
760
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
761
|
-
if (t[2]) _.ops.pop();
|
|
762
|
-
_.trys.pop(); continue;
|
|
763
|
-
}
|
|
764
|
-
op = body.call(thisArg, _);
|
|
765
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
766
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
767
|
-
}
|
|
768
|
-
};
|
|
769
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
770
|
-
exports.Projects = void 0;
|
|
771
|
-
var Projects = /** @class */ (function () {
|
|
772
|
-
function Projects(_credentials, _apiUrl, _request) {
|
|
773
|
-
this._credentials = _credentials;
|
|
774
|
-
this._apiUrl = _apiUrl;
|
|
775
|
-
this._request = _request;
|
|
776
|
-
this.apiPath = "/v1/projects";
|
|
777
|
-
}
|
|
778
|
-
/**
|
|
779
|
-
* Returns all projects accessible by the API key
|
|
780
|
-
*/
|
|
781
|
-
Projects.prototype.list = function () {
|
|
782
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
783
|
-
return __generator(this, function (_a) {
|
|
784
|
-
return [2 /*return*/, this._request("GET", this._credentials, this._apiUrl, this.apiPath)];
|
|
785
|
-
});
|
|
786
|
-
});
|
|
787
|
-
};
|
|
788
|
-
/**
|
|
789
|
-
* Retrieves a specific project based on the provided projectId
|
|
790
|
-
* @param projectId Unique identifier of the project to retrieve
|
|
791
|
-
*/
|
|
792
|
-
Projects.prototype.get = function (projectId) {
|
|
793
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
794
|
-
return __generator(this, function (_a) {
|
|
795
|
-
return [2 /*return*/, this._request("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId))];
|
|
796
|
-
});
|
|
797
|
-
});
|
|
798
|
-
};
|
|
799
|
-
/**
|
|
800
|
-
* Update a specific project
|
|
801
|
-
* @param project project to update
|
|
802
|
-
*/
|
|
803
|
-
Projects.prototype.update = function (project, payload) {
|
|
804
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
805
|
-
return __generator(this, function (_a) {
|
|
806
|
-
return [2 /*return*/, this._request("PATCH", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(project.project_id), JSON.stringify(payload))];
|
|
807
|
-
});
|
|
808
|
-
});
|
|
809
|
-
};
|
|
810
|
-
return Projects;
|
|
811
|
-
}());
|
|
812
|
-
exports.Projects = Projects;
|
|
813
|
-
|
|
814
|
-
},{}],15:[function(require,module,exports){
|
|
815
|
-
"use strict";
|
|
816
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
817
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
818
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
819
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
820
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
821
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
822
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
823
|
-
});
|
|
824
|
-
};
|
|
825
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
826
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
827
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
828
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
829
|
-
function step(op) {
|
|
830
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
831
|
-
while (_) try {
|
|
832
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
833
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
834
|
-
switch (op[0]) {
|
|
835
|
-
case 0: case 1: t = op; break;
|
|
836
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
837
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
838
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
839
|
-
default:
|
|
840
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
841
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
842
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
843
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
844
|
-
if (t[2]) _.ops.pop();
|
|
845
|
-
_.trys.pop(); continue;
|
|
846
|
-
}
|
|
847
|
-
op = body.call(thisArg, _);
|
|
848
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
849
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
850
|
-
}
|
|
851
|
-
};
|
|
852
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
853
|
-
exports.Scopes = void 0;
|
|
854
|
-
var Scopes = /** @class */ (function () {
|
|
855
|
-
function Scopes(_credentials, _apiUrl, _request) {
|
|
856
|
-
this._credentials = _credentials;
|
|
857
|
-
this._apiUrl = _apiUrl;
|
|
858
|
-
this._request = _request;
|
|
859
|
-
this.apiPath = "/v1/projects";
|
|
860
|
-
}
|
|
861
|
-
/**
|
|
862
|
-
* Retrieves scopes of the specified member in the specified project.
|
|
863
|
-
* @param projectId Unique identifier of the project
|
|
864
|
-
* @param memberId Unique identifier of the member
|
|
865
|
-
*/
|
|
866
|
-
Scopes.prototype.get = function (projectId, memberId) {
|
|
867
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
868
|
-
return __generator(this, function (_a) {
|
|
869
|
-
return [2 /*return*/, this._request("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/members/").concat(memberId, "/scopes"))];
|
|
870
|
-
});
|
|
871
|
-
});
|
|
872
|
-
};
|
|
873
|
-
/**
|
|
874
|
-
* Updates the scope for the specified member in the specified project.
|
|
875
|
-
* @param projectId Unique identifier of the project
|
|
876
|
-
* @param memberId Unique identifier of the member being updated
|
|
877
|
-
* @param scope string of the scope to update to
|
|
878
|
-
*/
|
|
879
|
-
Scopes.prototype.update = function (projectID, memberId, scope) {
|
|
880
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
881
|
-
return __generator(this, function (_a) {
|
|
882
|
-
return [2 /*return*/, this._request("PUT", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectID, "/members/").concat(memberId, "/scopes"), JSON.stringify({
|
|
883
|
-
scope: scope,
|
|
884
|
-
}))];
|
|
885
|
-
});
|
|
886
|
-
});
|
|
887
|
-
};
|
|
888
|
-
return Scopes;
|
|
889
|
-
}());
|
|
890
|
-
exports.Scopes = Scopes;
|
|
891
|
-
|
|
892
|
-
},{}],16:[function(require,module,exports){
|
|
893
|
-
"use strict";
|
|
894
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
895
|
-
|
|
896
|
-
},{}],17:[function(require,module,exports){
|
|
897
|
-
"use strict";
|
|
898
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
899
|
-
|
|
900
|
-
},{}],18:[function(require,module,exports){
|
|
901
|
-
"use strict";
|
|
902
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
903
|
-
|
|
904
|
-
},{}],19:[function(require,module,exports){
|
|
905
|
-
"use strict";
|
|
906
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
907
|
-
|
|
908
|
-
},{}],20:[function(require,module,exports){
|
|
909
|
-
"use strict";
|
|
910
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
911
|
-
|
|
912
|
-
},{}],21:[function(require,module,exports){
|
|
913
|
-
"use strict";
|
|
914
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
915
|
-
if (k2 === undefined) k2 = k;
|
|
916
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
917
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
918
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
919
|
-
}
|
|
920
|
-
Object.defineProperty(o, k2, desc);
|
|
921
|
-
}) : (function(o, m, k, k2) {
|
|
922
|
-
if (k2 === undefined) k2 = k;
|
|
923
|
-
o[k2] = m[k];
|
|
924
|
-
}));
|
|
925
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
926
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
927
|
-
};
|
|
928
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
929
|
-
__exportStar(require("./balance"), exports);
|
|
930
|
-
__exportStar(require("./balanceList"), exports);
|
|
931
|
-
__exportStar(require("./channel"), exports);
|
|
932
|
-
__exportStar(require("./createKeyOptions"), exports);
|
|
933
|
-
__exportStar(require("./hit"), exports);
|
|
934
|
-
__exportStar(require("./invitationList"), exports);
|
|
935
|
-
__exportStar(require("./invitationOptions"), exports);
|
|
936
|
-
__exportStar(require("./key"), exports);
|
|
937
|
-
__exportStar(require("./keyResponse"), exports);
|
|
938
|
-
__exportStar(require("./liveTranscriptionOptions"), exports);
|
|
939
|
-
__exportStar(require("./liveTranscriptionResponse"), exports);
|
|
940
|
-
__exportStar(require("./member"), exports);
|
|
941
|
-
__exportStar(require("./memberList"), exports);
|
|
942
|
-
__exportStar(require("./message"), exports);
|
|
943
|
-
__exportStar(require("./metadata"), exports);
|
|
944
|
-
__exportStar(require("./prerecordedTranscriptionOptions"), exports);
|
|
945
|
-
__exportStar(require("./prerecordedTranscriptionResponse"), exports);
|
|
946
|
-
__exportStar(require("./project"), exports);
|
|
947
|
-
__exportStar(require("./projectPatchResponse"), exports);
|
|
948
|
-
__exportStar(require("./projectResponse"), exports);
|
|
949
|
-
__exportStar(require("./scopeList"), exports);
|
|
950
|
-
__exportStar(require("./search"), exports);
|
|
951
|
-
__exportStar(require("./transcriptionSource"), exports);
|
|
952
|
-
__exportStar(require("./usageCallback"), exports);
|
|
953
|
-
__exportStar(require("./usageField"), exports);
|
|
954
|
-
__exportStar(require("./usageFieldOptions"), exports);
|
|
955
|
-
__exportStar(require("./usageOptions"), exports);
|
|
956
|
-
__exportStar(require("./usageRequest"), exports);
|
|
957
|
-
__exportStar(require("./usageRequestDetail"), exports);
|
|
958
|
-
__exportStar(require("./usageRequestList"), exports);
|
|
959
|
-
__exportStar(require("./usageRequestListOptions"), exports);
|
|
960
|
-
__exportStar(require("./usageResponse"), exports);
|
|
961
|
-
__exportStar(require("./usageResponseDetail"), exports);
|
|
962
|
-
__exportStar(require("./utterance"), exports);
|
|
963
|
-
__exportStar(require("./wordBase"), exports);
|
|
964
|
-
__exportStar(require("./keyResponseObj"), exports);
|
|
965
|
-
__exportStar(require("./projectPatchRequest"), exports);
|
|
966
|
-
__exportStar(require("./requestFunction"), exports);
|
|
967
|
-
|
|
968
|
-
},{"./balance":16,"./balanceList":17,"./channel":18,"./createKeyOptions":19,"./hit":20,"./invitationList":22,"./invitationOptions":23,"./key":24,"./keyResponse":25,"./keyResponseObj":26,"./liveTranscriptionOptions":27,"./liveTranscriptionResponse":28,"./member":29,"./memberList":30,"./message":31,"./metadata":32,"./prerecordedTranscriptionOptions":33,"./prerecordedTranscriptionResponse":34,"./project":35,"./projectPatchRequest":36,"./projectPatchResponse":37,"./projectResponse":38,"./requestFunction":39,"./scopeList":40,"./search":41,"./transcriptionSource":42,"./usageCallback":43,"./usageField":44,"./usageFieldOptions":45,"./usageOptions":46,"./usageRequest":47,"./usageRequestDetail":48,"./usageRequestList":49,"./usageRequestListOptions":50,"./usageResponse":51,"./usageResponseDetail":52,"./utterance":53,"./wordBase":54}],22:[function(require,module,exports){
|
|
969
|
-
"use strict";
|
|
970
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
971
|
-
|
|
972
|
-
},{}],23:[function(require,module,exports){
|
|
973
|
-
"use strict";
|
|
974
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
975
|
-
|
|
976
|
-
},{}],24:[function(require,module,exports){
|
|
977
|
-
"use strict";
|
|
978
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
979
|
-
|
|
980
|
-
},{}],25:[function(require,module,exports){
|
|
981
|
-
"use strict";
|
|
982
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
983
|
-
|
|
984
|
-
},{}],26:[function(require,module,exports){
|
|
985
|
-
"use strict";
|
|
986
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
987
|
-
|
|
988
|
-
},{}],27:[function(require,module,exports){
|
|
989
|
-
"use strict";
|
|
990
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
991
|
-
|
|
992
|
-
},{}],28:[function(require,module,exports){
|
|
993
|
-
"use strict";
|
|
994
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
995
|
-
|
|
996
|
-
},{}],29:[function(require,module,exports){
|
|
997
|
-
"use strict";
|
|
998
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
999
|
-
|
|
1000
|
-
},{}],30:[function(require,module,exports){
|
|
1001
|
-
"use strict";
|
|
1002
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1003
|
-
|
|
1004
|
-
},{}],31:[function(require,module,exports){
|
|
1005
|
-
"use strict";
|
|
1006
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1007
|
-
|
|
1008
|
-
},{}],32:[function(require,module,exports){
|
|
1009
|
-
"use strict";
|
|
1010
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1011
|
-
|
|
1012
|
-
},{}],33:[function(require,module,exports){
|
|
1013
|
-
"use strict";
|
|
1014
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1015
|
-
|
|
1016
|
-
},{}],34:[function(require,module,exports){
|
|
1017
|
-
"use strict";
|
|
1018
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1019
|
-
exports.PrerecordedTranscriptionResponse = void 0;
|
|
1020
|
-
var helpers_1 = require("../helpers");
|
|
1021
|
-
var PrerecordedTranscriptionResponse = /** @class */ (function () {
|
|
1022
|
-
function PrerecordedTranscriptionResponse() {
|
|
1023
|
-
}
|
|
1024
|
-
/**
|
|
1025
|
-
* Converts the transcription to the WebVTT format
|
|
1026
|
-
* @remarks In order to translate the transcription to WebVTT, the utterances
|
|
1027
|
-
* feature must be used.
|
|
1028
|
-
* @returns A string with the transcription in the WebVTT format
|
|
1029
|
-
*/
|
|
1030
|
-
PrerecordedTranscriptionResponse.prototype.toWebVTT = function () {
|
|
1031
|
-
var _a, _b, _c, _d;
|
|
1032
|
-
if (!this.results || !this.results.utterances) {
|
|
1033
|
-
throw new Error("This function requires a transcript that was generated with the utterances feature.");
|
|
1034
|
-
}
|
|
1035
|
-
var webVTT = "WEBVTT\n\n";
|
|
1036
|
-
webVTT += "NOTE\nTranscription provided by Deepgram\nRequest Id: ".concat((_a = this.metadata) === null || _a === void 0 ? void 0 : _a.request_id, "\nCreated: ").concat((_b = this.metadata) === null || _b === void 0 ? void 0 : _b.created, "\nDuration: ").concat((_c = this.metadata) === null || _c === void 0 ? void 0 : _c.duration, "\nChannels: ").concat((_d = this.metadata) === null || _d === void 0 ? void 0 : _d.channels, "\n\n");
|
|
1037
|
-
for (var i = 0; i < this.results.utterances.length; i++) {
|
|
1038
|
-
var utterance = this.results.utterances[i];
|
|
1039
|
-
var start = (0, helpers_1.secondsToTimestamp)(utterance.start);
|
|
1040
|
-
var end = (0, helpers_1.secondsToTimestamp)(utterance.end);
|
|
1041
|
-
webVTT += "".concat(i + 1, "\n").concat(start, " --> ").concat(end, "\n- ").concat(utterance.transcript, "\n\n");
|
|
1042
|
-
}
|
|
1043
|
-
return webVTT;
|
|
1044
|
-
};
|
|
1045
|
-
/**
|
|
1046
|
-
* Converts the transcription to the SRT format
|
|
1047
|
-
* @remarks In order to translate the transcription to SRT, the utterances
|
|
1048
|
-
* feature must be used.
|
|
1049
|
-
* @returns A string with the transcription in the SRT format
|
|
1050
|
-
*/
|
|
1051
|
-
PrerecordedTranscriptionResponse.prototype.toSRT = function () {
|
|
1052
|
-
if (!this.results || !this.results.utterances) {
|
|
1053
|
-
throw new Error("This function requires a transcript that was generated with the utterances feature.");
|
|
1054
|
-
}
|
|
1055
|
-
var srt = "";
|
|
1056
|
-
for (var i = 0; i < this.results.utterances.length; i++) {
|
|
1057
|
-
var utterance = this.results.utterances[i];
|
|
1058
|
-
var start = (0, helpers_1.secondsToTimestamp)(utterance.start).replace(".", ",");
|
|
1059
|
-
var end = (0, helpers_1.secondsToTimestamp)(utterance.end).replace(".", ",");
|
|
1060
|
-
srt += "".concat(i + 1, "\n").concat(start, " --> ").concat(end, "\n").concat(utterance.transcript, "\n\n");
|
|
1061
|
-
}
|
|
1062
|
-
return srt;
|
|
1063
|
-
};
|
|
1064
|
-
return PrerecordedTranscriptionResponse;
|
|
1065
|
-
}());
|
|
1066
|
-
exports.PrerecordedTranscriptionResponse = PrerecordedTranscriptionResponse;
|
|
1067
|
-
|
|
1068
|
-
},{"../helpers":8}],35:[function(require,module,exports){
|
|
1069
|
-
"use strict";
|
|
1070
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1071
|
-
|
|
1072
|
-
},{}],36:[function(require,module,exports){
|
|
1073
|
-
"use strict";
|
|
1074
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1075
|
-
|
|
1076
|
-
},{}],37:[function(require,module,exports){
|
|
1077
|
-
"use strict";
|
|
1078
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1079
|
-
|
|
1080
|
-
},{}],38:[function(require,module,exports){
|
|
1081
|
-
"use strict";
|
|
1082
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1083
|
-
|
|
1084
|
-
},{}],39:[function(require,module,exports){
|
|
1085
|
-
"use strict";
|
|
1086
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1087
|
-
|
|
1088
|
-
},{}],40:[function(require,module,exports){
|
|
1089
|
-
"use strict";
|
|
1090
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1091
|
-
|
|
1092
|
-
},{}],41:[function(require,module,exports){
|
|
1093
|
-
"use strict";
|
|
1094
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1095
|
-
|
|
1096
|
-
},{}],42:[function(require,module,exports){
|
|
1097
|
-
"use strict";
|
|
1098
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1099
|
-
|
|
1100
|
-
},{}],43:[function(require,module,exports){
|
|
1101
|
-
"use strict";
|
|
1102
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1103
|
-
|
|
1104
|
-
},{}],44:[function(require,module,exports){
|
|
1105
|
-
"use strict";
|
|
1106
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1107
|
-
|
|
1108
|
-
},{}],45:[function(require,module,exports){
|
|
1109
|
-
"use strict";
|
|
1110
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1111
|
-
|
|
1112
|
-
},{}],46:[function(require,module,exports){
|
|
1113
|
-
"use strict";
|
|
1114
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1115
|
-
|
|
1116
|
-
},{}],47:[function(require,module,exports){
|
|
1117
|
-
"use strict";
|
|
1118
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1119
|
-
|
|
1120
|
-
},{}],48:[function(require,module,exports){
|
|
1121
|
-
"use strict";
|
|
1122
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1123
|
-
|
|
1124
|
-
},{}],49:[function(require,module,exports){
|
|
1125
|
-
"use strict";
|
|
1126
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1127
|
-
|
|
1128
|
-
},{}],50:[function(require,module,exports){
|
|
1129
|
-
"use strict";
|
|
1130
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1131
|
-
|
|
1132
|
-
},{}],51:[function(require,module,exports){
|
|
1133
|
-
"use strict";
|
|
1134
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1135
|
-
|
|
1136
|
-
},{}],52:[function(require,module,exports){
|
|
1137
|
-
"use strict";
|
|
1138
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1139
|
-
|
|
1140
|
-
},{}],53:[function(require,module,exports){
|
|
1141
|
-
"use strict";
|
|
1142
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1143
|
-
|
|
1144
|
-
},{}],54:[function(require,module,exports){
|
|
1145
|
-
"use strict";
|
|
1146
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1147
|
-
|
|
1148
|
-
},{}],55:[function(require,module,exports){
|
|
1149
|
-
"use strict";
|
|
1150
|
-
var __assign = (this && this.__assign) || function () {
|
|
1151
|
-
__assign = Object.assign || function(t) {
|
|
1152
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1153
|
-
s = arguments[i];
|
|
1154
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
1155
|
-
t[p] = s[p];
|
|
1156
|
-
}
|
|
1157
|
-
return t;
|
|
1158
|
-
};
|
|
1159
|
-
return __assign.apply(this, arguments);
|
|
1160
|
-
};
|
|
1161
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1162
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1163
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1164
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1165
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1166
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1167
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1168
|
-
});
|
|
1169
|
-
};
|
|
1170
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
1171
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
1172
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
1173
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
1174
|
-
function step(op) {
|
|
1175
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
1176
|
-
while (_) try {
|
|
1177
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
1178
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
1179
|
-
switch (op[0]) {
|
|
1180
|
-
case 0: case 1: t = op; break;
|
|
1181
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
1182
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
1183
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
1184
|
-
default:
|
|
1185
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
1186
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
1187
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
1188
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
1189
|
-
if (t[2]) _.ops.pop();
|
|
1190
|
-
_.trys.pop(); continue;
|
|
1191
|
-
}
|
|
1192
|
-
op = body.call(thisArg, _);
|
|
1193
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
1194
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
1195
|
-
}
|
|
1196
|
-
};
|
|
1197
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1198
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1199
|
-
};
|
|
1200
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1201
|
-
exports.Usage = void 0;
|
|
1202
|
-
var querystring_1 = __importDefault(require("querystring"));
|
|
1203
|
-
var Usage = /** @class */ (function () {
|
|
1204
|
-
function Usage(_credentials, _apiUrl, _request) {
|
|
1205
|
-
this._credentials = _credentials;
|
|
1206
|
-
this._apiUrl = _apiUrl;
|
|
1207
|
-
this._request = _request;
|
|
1208
|
-
this.apiPath = "/v1/projects";
|
|
1209
|
-
}
|
|
1210
|
-
/**
|
|
1211
|
-
* Retrieves all requests associated with the provided projectId based
|
|
1212
|
-
* on the provided options
|
|
1213
|
-
* @param projectId Unique identifier of the project
|
|
1214
|
-
* @param options Additional filter options
|
|
1215
|
-
*/
|
|
1216
|
-
Usage.prototype.listRequests = function (projectId, options) {
|
|
1217
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1218
|
-
var requestOptions;
|
|
1219
|
-
return __generator(this, function (_a) {
|
|
1220
|
-
requestOptions = __assign({}, options);
|
|
1221
|
-
return [2 /*return*/, this._request("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/requests?").concat(querystring_1.default.stringify(requestOptions)))];
|
|
1222
|
-
});
|
|
1223
|
-
});
|
|
1224
|
-
};
|
|
1225
|
-
/**
|
|
1226
|
-
* Retrieves a specific request associated with the provided projectId
|
|
1227
|
-
* @param projectId Unique identifier of the project
|
|
1228
|
-
* @param requestId Unique identifier for the request to retrieve
|
|
1229
|
-
*/
|
|
1230
|
-
Usage.prototype.getRequest = function (projectId, requestId) {
|
|
1231
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1232
|
-
return __generator(this, function (_a) {
|
|
1233
|
-
return [2 /*return*/, this._request("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/requests/").concat(requestId))];
|
|
1234
|
-
});
|
|
1235
|
-
});
|
|
1236
|
-
};
|
|
1237
|
-
/**
|
|
1238
|
-
* Retrieves usage associated with the provided projectId based
|
|
1239
|
-
* on the provided options
|
|
1240
|
-
* @param projectId Unique identifier of the project
|
|
1241
|
-
* @param options Options to filter usage
|
|
1242
|
-
*/
|
|
1243
|
-
Usage.prototype.getUsage = function (projectId, options) {
|
|
1244
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1245
|
-
var requestOptions;
|
|
1246
|
-
return __generator(this, function (_a) {
|
|
1247
|
-
requestOptions = __assign({}, options);
|
|
1248
|
-
return [2 /*return*/, this._request("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/usage?").concat(querystring_1.default.stringify(requestOptions)))];
|
|
1249
|
-
});
|
|
1250
|
-
});
|
|
1251
|
-
};
|
|
1252
|
-
/**
|
|
1253
|
-
* Retrieves features used by the provided projectId based
|
|
1254
|
-
* on the provided options
|
|
1255
|
-
* @param projectId Unique identifier of the project
|
|
1256
|
-
* @param options Options to filter usage
|
|
1257
|
-
*/
|
|
1258
|
-
Usage.prototype.getFields = function (projectId, options) {
|
|
1259
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1260
|
-
var requestOptions;
|
|
1261
|
-
return __generator(this, function (_a) {
|
|
1262
|
-
requestOptions = __assign({}, options);
|
|
1263
|
-
return [2 /*return*/, this._request("GET", this._credentials, this._apiUrl, "".concat(this.apiPath, "/").concat(projectId, "/usage/fields?").concat(querystring_1.default.stringify(requestOptions)))];
|
|
1264
|
-
});
|
|
1265
|
-
});
|
|
1266
|
-
};
|
|
1267
|
-
return Usage;
|
|
1268
|
-
}());
|
|
1269
|
-
exports.Usage = Usage;
|
|
1270
|
-
|
|
1271
|
-
},{"querystring":60}],56:[function(require,module,exports){
|
|
1272
|
-
(function (process){(function (){
|
|
1273
|
-
"use strict";
|
|
1274
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1275
|
-
exports.userAgent = void 0;
|
|
1276
|
-
/*
|
|
1277
|
-
* The following const is replaced during the CD
|
|
1278
|
-
* process to the version from package.json
|
|
1279
|
-
*/
|
|
1280
|
-
var sdkVersion = "1.4.1";
|
|
1281
|
-
function userAgent() {
|
|
1282
|
-
var agent = "@deepgram/sdk/UNKNOWN node/UNKNOWN";
|
|
1283
|
-
try {
|
|
1284
|
-
agent = "@deepgram/sdk/".concat(sdkVersion, " node/").concat(process.version.replace("v", ""));
|
|
1285
|
-
}
|
|
1286
|
-
catch (e) {
|
|
1287
|
-
console.warn("Could not load package details");
|
|
1288
|
-
}
|
|
1289
|
-
return agent;
|
|
1290
|
-
}
|
|
1291
|
-
exports.userAgent = userAgent;
|
|
1292
|
-
|
|
1293
|
-
}).call(this)}).call(this,require('_process'))
|
|
1294
|
-
},{"_process":57}],57:[function(require,module,exports){
|
|
1295
|
-
// shim for using process in browser
|
|
1296
|
-
var process = module.exports = {};
|
|
1297
|
-
|
|
1298
|
-
// cached from whatever global is present so that test runners that stub it
|
|
1299
|
-
// don't break things. But we need to wrap it in a try catch in case it is
|
|
1300
|
-
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
|
1301
|
-
// function because try/catches deoptimize in certain engines.
|
|
1302
|
-
|
|
1303
|
-
var cachedSetTimeout;
|
|
1304
|
-
var cachedClearTimeout;
|
|
1305
|
-
|
|
1306
|
-
function defaultSetTimout() {
|
|
1307
|
-
throw new Error('setTimeout has not been defined');
|
|
1308
|
-
}
|
|
1309
|
-
function defaultClearTimeout () {
|
|
1310
|
-
throw new Error('clearTimeout has not been defined');
|
|
1311
|
-
}
|
|
1312
|
-
(function () {
|
|
1313
|
-
try {
|
|
1314
|
-
if (typeof setTimeout === 'function') {
|
|
1315
|
-
cachedSetTimeout = setTimeout;
|
|
1316
|
-
} else {
|
|
1317
|
-
cachedSetTimeout = defaultSetTimout;
|
|
1318
|
-
}
|
|
1319
|
-
} catch (e) {
|
|
1320
|
-
cachedSetTimeout = defaultSetTimout;
|
|
1321
|
-
}
|
|
1322
|
-
try {
|
|
1323
|
-
if (typeof clearTimeout === 'function') {
|
|
1324
|
-
cachedClearTimeout = clearTimeout;
|
|
1325
|
-
} else {
|
|
1326
|
-
cachedClearTimeout = defaultClearTimeout;
|
|
1327
|
-
}
|
|
1328
|
-
} catch (e) {
|
|
1329
|
-
cachedClearTimeout = defaultClearTimeout;
|
|
1330
|
-
}
|
|
1331
|
-
} ())
|
|
1332
|
-
function runTimeout(fun) {
|
|
1333
|
-
if (cachedSetTimeout === setTimeout) {
|
|
1334
|
-
//normal enviroments in sane situations
|
|
1335
|
-
return setTimeout(fun, 0);
|
|
1336
|
-
}
|
|
1337
|
-
// if setTimeout wasn't available but was latter defined
|
|
1338
|
-
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
1339
|
-
cachedSetTimeout = setTimeout;
|
|
1340
|
-
return setTimeout(fun, 0);
|
|
1341
|
-
}
|
|
1342
|
-
try {
|
|
1343
|
-
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
1344
|
-
return cachedSetTimeout(fun, 0);
|
|
1345
|
-
} catch(e){
|
|
1346
|
-
try {
|
|
1347
|
-
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
1348
|
-
return cachedSetTimeout.call(null, fun, 0);
|
|
1349
|
-
} catch(e){
|
|
1350
|
-
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
|
1351
|
-
return cachedSetTimeout.call(this, fun, 0);
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
}
|
|
1357
|
-
function runClearTimeout(marker) {
|
|
1358
|
-
if (cachedClearTimeout === clearTimeout) {
|
|
1359
|
-
//normal enviroments in sane situations
|
|
1360
|
-
return clearTimeout(marker);
|
|
1361
|
-
}
|
|
1362
|
-
// if clearTimeout wasn't available but was latter defined
|
|
1363
|
-
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
1364
|
-
cachedClearTimeout = clearTimeout;
|
|
1365
|
-
return clearTimeout(marker);
|
|
1366
|
-
}
|
|
1367
|
-
try {
|
|
1368
|
-
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
1369
|
-
return cachedClearTimeout(marker);
|
|
1370
|
-
} catch (e){
|
|
1371
|
-
try {
|
|
1372
|
-
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
1373
|
-
return cachedClearTimeout.call(null, marker);
|
|
1374
|
-
} catch (e){
|
|
1375
|
-
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
|
1376
|
-
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
1377
|
-
return cachedClearTimeout.call(this, marker);
|
|
1378
|
-
}
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
}
|
|
1384
|
-
var queue = [];
|
|
1385
|
-
var draining = false;
|
|
1386
|
-
var currentQueue;
|
|
1387
|
-
var queueIndex = -1;
|
|
1388
|
-
|
|
1389
|
-
function cleanUpNextTick() {
|
|
1390
|
-
if (!draining || !currentQueue) {
|
|
1391
|
-
return;
|
|
1392
|
-
}
|
|
1393
|
-
draining = false;
|
|
1394
|
-
if (currentQueue.length) {
|
|
1395
|
-
queue = currentQueue.concat(queue);
|
|
1396
|
-
} else {
|
|
1397
|
-
queueIndex = -1;
|
|
1398
|
-
}
|
|
1399
|
-
if (queue.length) {
|
|
1400
|
-
drainQueue();
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
function drainQueue() {
|
|
1405
|
-
if (draining) {
|
|
1406
|
-
return;
|
|
1407
|
-
}
|
|
1408
|
-
var timeout = runTimeout(cleanUpNextTick);
|
|
1409
|
-
draining = true;
|
|
1410
|
-
|
|
1411
|
-
var len = queue.length;
|
|
1412
|
-
while(len) {
|
|
1413
|
-
currentQueue = queue;
|
|
1414
|
-
queue = [];
|
|
1415
|
-
while (++queueIndex < len) {
|
|
1416
|
-
if (currentQueue) {
|
|
1417
|
-
currentQueue[queueIndex].run();
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
queueIndex = -1;
|
|
1421
|
-
len = queue.length;
|
|
1422
|
-
}
|
|
1423
|
-
currentQueue = null;
|
|
1424
|
-
draining = false;
|
|
1425
|
-
runClearTimeout(timeout);
|
|
1426
|
-
}
|
|
1427
|
-
|
|
1428
|
-
process.nextTick = function (fun) {
|
|
1429
|
-
var args = new Array(arguments.length - 1);
|
|
1430
|
-
if (arguments.length > 1) {
|
|
1431
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1432
|
-
args[i - 1] = arguments[i];
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
queue.push(new Item(fun, args));
|
|
1436
|
-
if (queue.length === 1 && !draining) {
|
|
1437
|
-
runTimeout(drainQueue);
|
|
1438
|
-
}
|
|
1439
|
-
};
|
|
1440
|
-
|
|
1441
|
-
// v8 likes predictible objects
|
|
1442
|
-
function Item(fun, array) {
|
|
1443
|
-
this.fun = fun;
|
|
1444
|
-
this.array = array;
|
|
1445
|
-
}
|
|
1446
|
-
Item.prototype.run = function () {
|
|
1447
|
-
this.fun.apply(null, this.array);
|
|
1448
|
-
};
|
|
1449
|
-
process.title = 'browser';
|
|
1450
|
-
process.browser = true;
|
|
1451
|
-
process.env = {};
|
|
1452
|
-
process.argv = [];
|
|
1453
|
-
process.version = ''; // empty string to avoid regexp issues
|
|
1454
|
-
process.versions = {};
|
|
1455
|
-
|
|
1456
|
-
function noop() {}
|
|
1457
|
-
|
|
1458
|
-
process.on = noop;
|
|
1459
|
-
process.addListener = noop;
|
|
1460
|
-
process.once = noop;
|
|
1461
|
-
process.off = noop;
|
|
1462
|
-
process.removeListener = noop;
|
|
1463
|
-
process.removeAllListeners = noop;
|
|
1464
|
-
process.emit = noop;
|
|
1465
|
-
process.prependListener = noop;
|
|
1466
|
-
process.prependOnceListener = noop;
|
|
1467
|
-
|
|
1468
|
-
process.listeners = function (name) { return [] }
|
|
1469
|
-
|
|
1470
|
-
process.binding = function (name) {
|
|
1471
|
-
throw new Error('process.binding is not supported');
|
|
1472
|
-
};
|
|
1473
|
-
|
|
1474
|
-
process.cwd = function () { return '/' };
|
|
1475
|
-
process.chdir = function (dir) {
|
|
1476
|
-
throw new Error('process.chdir is not supported');
|
|
1477
|
-
};
|
|
1478
|
-
process.umask = function() { return 0; };
|
|
1479
|
-
|
|
1480
|
-
},{}],58:[function(require,module,exports){
|
|
1481
|
-
// Copyright Joyent, Inc. and other Node contributors.
|
|
1482
|
-
//
|
|
1483
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
1484
|
-
// copy of this software and associated documentation files (the
|
|
1485
|
-
// "Software"), to deal in the Software without restriction, including
|
|
1486
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
|
1487
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
1488
|
-
// persons to whom the Software is furnished to do so, subject to the
|
|
1489
|
-
// following conditions:
|
|
1490
|
-
//
|
|
1491
|
-
// The above copyright notice and this permission notice shall be included
|
|
1492
|
-
// in all copies or substantial portions of the Software.
|
|
1493
|
-
//
|
|
1494
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
1495
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
1496
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
1497
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
1498
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
1499
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
1500
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1501
|
-
|
|
1502
|
-
'use strict';
|
|
1503
|
-
|
|
1504
|
-
// If obj.hasOwnProperty has been overridden, then calling
|
|
1505
|
-
// obj.hasOwnProperty(prop) will break.
|
|
1506
|
-
// See: https://github.com/joyent/node/issues/1707
|
|
1507
|
-
function hasOwnProperty(obj, prop) {
|
|
1508
|
-
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1511
|
-
module.exports = function(qs, sep, eq, options) {
|
|
1512
|
-
sep = sep || '&';
|
|
1513
|
-
eq = eq || '=';
|
|
1514
|
-
var obj = {};
|
|
1515
|
-
|
|
1516
|
-
if (typeof qs !== 'string' || qs.length === 0) {
|
|
1517
|
-
return obj;
|
|
1518
|
-
}
|
|
1519
|
-
|
|
1520
|
-
var regexp = /\+/g;
|
|
1521
|
-
qs = qs.split(sep);
|
|
1522
|
-
|
|
1523
|
-
var maxKeys = 1000;
|
|
1524
|
-
if (options && typeof options.maxKeys === 'number') {
|
|
1525
|
-
maxKeys = options.maxKeys;
|
|
1526
|
-
}
|
|
1527
|
-
|
|
1528
|
-
var len = qs.length;
|
|
1529
|
-
// maxKeys <= 0 means that we should not limit keys count
|
|
1530
|
-
if (maxKeys > 0 && len > maxKeys) {
|
|
1531
|
-
len = maxKeys;
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
for (var i = 0; i < len; ++i) {
|
|
1535
|
-
var x = qs[i].replace(regexp, '%20'),
|
|
1536
|
-
idx = x.indexOf(eq),
|
|
1537
|
-
kstr, vstr, k, v;
|
|
1538
|
-
|
|
1539
|
-
if (idx >= 0) {
|
|
1540
|
-
kstr = x.substr(0, idx);
|
|
1541
|
-
vstr = x.substr(idx + 1);
|
|
1542
|
-
} else {
|
|
1543
|
-
kstr = x;
|
|
1544
|
-
vstr = '';
|
|
1545
|
-
}
|
|
1546
|
-
|
|
1547
|
-
k = decodeURIComponent(kstr);
|
|
1548
|
-
v = decodeURIComponent(vstr);
|
|
1549
|
-
|
|
1550
|
-
if (!hasOwnProperty(obj, k)) {
|
|
1551
|
-
obj[k] = v;
|
|
1552
|
-
} else if (isArray(obj[k])) {
|
|
1553
|
-
obj[k].push(v);
|
|
1554
|
-
} else {
|
|
1555
|
-
obj[k] = [obj[k], v];
|
|
1556
|
-
}
|
|
1557
|
-
}
|
|
1558
|
-
|
|
1559
|
-
return obj;
|
|
1560
|
-
};
|
|
1561
|
-
|
|
1562
|
-
var isArray = Array.isArray || function (xs) {
|
|
1563
|
-
return Object.prototype.toString.call(xs) === '[object Array]';
|
|
1564
|
-
};
|
|
1565
|
-
|
|
1566
|
-
},{}],59:[function(require,module,exports){
|
|
1567
|
-
// Copyright Joyent, Inc. and other Node contributors.
|
|
1568
|
-
//
|
|
1569
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
1570
|
-
// copy of this software and associated documentation files (the
|
|
1571
|
-
// "Software"), to deal in the Software without restriction, including
|
|
1572
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
|
1573
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
1574
|
-
// persons to whom the Software is furnished to do so, subject to the
|
|
1575
|
-
// following conditions:
|
|
1576
|
-
//
|
|
1577
|
-
// The above copyright notice and this permission notice shall be included
|
|
1578
|
-
// in all copies or substantial portions of the Software.
|
|
1579
|
-
//
|
|
1580
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
1581
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
1582
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
1583
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
1584
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
1585
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
1586
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1587
|
-
|
|
1588
|
-
'use strict';
|
|
1589
|
-
|
|
1590
|
-
var stringifyPrimitive = function(v) {
|
|
1591
|
-
switch (typeof v) {
|
|
1592
|
-
case 'string':
|
|
1593
|
-
return v;
|
|
1594
|
-
|
|
1595
|
-
case 'boolean':
|
|
1596
|
-
return v ? 'true' : 'false';
|
|
1597
|
-
|
|
1598
|
-
case 'number':
|
|
1599
|
-
return isFinite(v) ? v : '';
|
|
1600
|
-
|
|
1601
|
-
default:
|
|
1602
|
-
return '';
|
|
1603
|
-
}
|
|
1604
|
-
};
|
|
1605
|
-
|
|
1606
|
-
module.exports = function(obj, sep, eq, name) {
|
|
1607
|
-
sep = sep || '&';
|
|
1608
|
-
eq = eq || '=';
|
|
1609
|
-
if (obj === null) {
|
|
1610
|
-
obj = undefined;
|
|
1611
|
-
}
|
|
1612
|
-
|
|
1613
|
-
if (typeof obj === 'object') {
|
|
1614
|
-
return map(objectKeys(obj), function(k) {
|
|
1615
|
-
var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
|
|
1616
|
-
if (isArray(obj[k])) {
|
|
1617
|
-
return map(obj[k], function(v) {
|
|
1618
|
-
return ks + encodeURIComponent(stringifyPrimitive(v));
|
|
1619
|
-
}).join(sep);
|
|
1620
|
-
} else {
|
|
1621
|
-
return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
|
|
1622
|
-
}
|
|
1623
|
-
}).join(sep);
|
|
1624
|
-
|
|
1625
|
-
}
|
|
1626
|
-
|
|
1627
|
-
if (!name) return '';
|
|
1628
|
-
return encodeURIComponent(stringifyPrimitive(name)) + eq +
|
|
1629
|
-
encodeURIComponent(stringifyPrimitive(obj));
|
|
1630
|
-
};
|
|
1631
|
-
|
|
1632
|
-
var isArray = Array.isArray || function (xs) {
|
|
1633
|
-
return Object.prototype.toString.call(xs) === '[object Array]';
|
|
1634
|
-
};
|
|
1635
|
-
|
|
1636
|
-
function map (xs, f) {
|
|
1637
|
-
if (xs.map) return xs.map(f);
|
|
1638
|
-
var res = [];
|
|
1639
|
-
for (var i = 0; i < xs.length; i++) {
|
|
1640
|
-
res.push(f(xs[i], i));
|
|
1641
|
-
}
|
|
1642
|
-
return res;
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
|
-
var objectKeys = Object.keys || function (obj) {
|
|
1646
|
-
var res = [];
|
|
1647
|
-
for (var key in obj) {
|
|
1648
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
|
|
1649
|
-
}
|
|
1650
|
-
return res;
|
|
1651
|
-
};
|
|
1652
|
-
|
|
1653
|
-
},{}],60:[function(require,module,exports){
|
|
1654
|
-
'use strict';
|
|
1655
|
-
|
|
1656
|
-
exports.decode = exports.parse = require('./decode');
|
|
1657
|
-
exports.encode = exports.stringify = require('./encode');
|
|
1658
|
-
|
|
1659
|
-
},{"./decode":58,"./encode":59}]},{},[3]);
|
|
1
|
+
var t={587:t=>{function e(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,i,n,r){i=i||"&",n=n||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(i);var o=1e3;r&&"number"==typeof r.maxKeys&&(o=r.maxKeys);var c=t.length;o>0&&c>o&&(c=o);for(var h=0;h<c;++h){var u,l,p,d,v=t[h].replace(a,"%20"),f=v.indexOf(n);f>=0?(u=v.substr(0,f),l=v.substr(f+1)):(u=v,l=""),p=decodeURIComponent(u),d=decodeURIComponent(l),e(s,p)?Array.isArray(s[p])?s[p].push(d):s[p]=[s[p],d]:s[p]=d}return s}},361:t=>{var e=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,i,n,r){return i=i||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(r){var s=encodeURIComponent(e(r))+n;return Array.isArray(t[r])?t[r].map((function(t){return s+encodeURIComponent(e(t))})).join(i):s+encodeURIComponent(e(t[r]))})).join(i):r?encodeURIComponent(e(r))+n+encodeURIComponent(e(t)):""}},673:(t,e,i)=>{e.decode=e.parse=i(587),e.encode=e.stringify=i(361)}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var s=e[n]={exports:{}};return t[n](s,s.exports,i),s.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var n={};(()=>{i.d(n,{X:()=>g});var t=i(673);function e(t){return new Date(1e3*t).toISOString().substr(11,12)}class r{toWebVTT(){var t,i,n,r;if(!this.results||!this.results.utterances)throw new Error("This function requires a transcript that was generated with the utterances feature.");let s="WEBVTT\n\n";s+=`NOTE\nTranscription provided by Deepgram\nRequest Id: ${null===(t=this.metadata)||void 0===t?void 0:t.request_id}\nCreated: ${null===(i=this.metadata)||void 0===i?void 0:i.created}\nDuration: ${null===(n=this.metadata)||void 0===n?void 0:n.duration}\nChannels: ${null===(r=this.metadata)||void 0===r?void 0:r.channels}\n\n`;for(let t=0;t<this.results.utterances.length;t++){const i=this.results.utterances[t];s+=`${t+1}\n${e(i.start)} --\x3e ${e(i.end)}\n- ${i.transcript}\n\n`}return s}toSRT(){if(!this.results||!this.results.utterances)throw new Error("This function requires a transcript that was generated with the utterances feature.");let t="";for(let i=0;i<this.results.utterances.length;i++){const n=this.results.utterances[i];t+=`${i+1}\n${e(n.start).replace(".",",")} --\x3e ${e(n.end).replace(".",",")}\n${n.transcript}\n\n`}return t}}function s(){let t="@deepgram/sdk/UNKNOWN node/UNKNOWN";try{t=`@deepgram/sdk/1.4.2 node/${process.version.replace("v","")}`}catch(t){console.warn("Could not load package details")}return t}function a(t,e,i,n,r){return a=this,o=void 0,h=function*(){const a=`https://${i}${n}`;try{const i=yield fetch(a,{method:t,headers:{Authorization:`token ${e}`,"Content-Type":"application/json","X-DG-Agent":s()},body:r});return yield i.json()}catch(t){throw new Error(`DG: ${t}`)}},new((c=void 0)||(c=Promise))((function(t,e){function i(t){try{r(h.next(t))}catch(t){e(t)}}function n(t){try{r(h.throw(t))}catch(t){e(t)}}function r(e){var r;e.done?t(e.value):(r=e.value,r instanceof c?r:new c((function(t){t(r)}))).then(i,n)}r((h=h.apply(a,o||[])).next())}));var a,o,c,h}class o{constructor(t,e){this._credentials=t,this._apiUrl=e}preRecorded(e,i){return n=this,s=void 0,c=function*(){return yield((e,i,n,s)=>{return o=void 0,c=void 0,u=function*(){const o=Object.assign({},s);if(!n.url)throw new Error("DG: Source must be a URL string");const c=JSON.stringify(n),h=yield a("POST",e,i,`/v1/listen?${t.stringify(o)}`,c);return Object.assign(new r,h)},new((h=void 0)||(h=Promise))((function(t,e){function i(t){try{r(u.next(t))}catch(t){e(t)}}function n(t){try{r(u.throw(t))}catch(t){e(t)}}function r(e){var r;e.done?t(e.value):(r=e.value,r instanceof h?r:new h((function(t){t(r)}))).then(i,n)}r((u=u.apply(o,c||[])).next())}));var o,c,h,u})(this._credentials,this._apiUrl||"",e,i)},new((o=void 0)||(o=Promise))((function(t,e){function i(t){try{a(c.next(t))}catch(t){e(t)}}function r(t){try{a(c.throw(t))}catch(t){e(t)}}function a(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(i,r)}a((c=c.apply(n,s||[])).next())}));var n,s,o,c}live(e){return new WebSocket(`wss://${this._apiUrl}/v1/listen?${t.stringify(e)}`,["token",this._credentials])}}var c=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class h{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}list(){return c(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,this.apiPath)}))}get(t){return c(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}`)}))}update(t,e){return c(this,void 0,void 0,(function*(){return this._request("PATCH",this._credentials,this._apiUrl,`${this.apiPath}/${t.project_id}`,JSON.stringify(e))}))}}var u=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class l{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}list(t){return u(this,void 0,void 0,(function*(){return{api_keys:(yield this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys`)).api_keys.map((t=>Object.assign(Object.assign({},t),t.api_key)))}}))}get(t,e){return u(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys/${e}`)}))}create(t,e,i,n){return u(this,void 0,void 0,(function*(){if(n&&void 0!==n.expirationDate&&void 0!==n.timeToLive)throw new Error("Please provide expirationDate or timeToLive or neither. Providing both is not allowed.");return this._request("POST",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys`,JSON.stringify({comment:e,scopes:i,expiration_date:n&&n.expirationDate?n.expirationDate:void 0,time_to_live_in_seconds:n&&n.timeToLive?n.timeToLive:void 0}))}))}delete(t,e){return u(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/keys/${e}`)}))}}var p=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class d{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}listRequests(e,i){return p(this,void 0,void 0,(function*(){const n=Object.assign({},i);return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/requests?${t.stringify(n)}`)}))}getRequest(t,e){return p(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/requests/${e}`)}))}getUsage(e,i){return p(this,void 0,void 0,(function*(){const n=Object.assign({},i);return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/usage?${t.stringify(n)}`)}))}getFields(e,i){return p(this,void 0,void 0,(function*(){const n=Object.assign({},i);return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${e}/usage/fields?${t.stringify(n)}`)}))}}var v=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class f{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}listMembers(t){return v(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members`)}))}removeMember(t,e){return v(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members/${e}`)}))}}var _=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class y{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}list(t){return _(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/invites`)}))}send(t,e){return _(this,void 0,void 0,(function*(){return this._request("POST",this._credentials,this._apiUrl,`${this.apiPath}/${t}/invites`,JSON.stringify({email:e.email,scope:e.scope}))}))}leave(t){return _(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/leave`)}))}delete(t,e){return _(this,void 0,void 0,(function*(){return this._request("DELETE",this._credentials,this._apiUrl,`${this.apiPath}/${t}/invites/${e}`)}))}}var $=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class w{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}listBalances(t){return $(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/balances`)}))}getBalance(t,e){return $(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/balances/${e}`)}))}}var m=function(t,e,i,n){return new(i||(i=Promise))((function(r,s){function a(t){try{c(n.next(t))}catch(t){s(t)}}function o(t){try{c(n.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((n=n.apply(t,e||[])).next())}))};class U{constructor(t,e,i){this._credentials=t,this._apiUrl=e,this._request=i,this.apiPath="/v1/projects"}get(t,e){return m(this,void 0,void 0,(function*(){return this._request("GET",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members/${e}/scopes`)}))}update(t,e,i){return m(this,void 0,void 0,(function*(){return this._request("PUT",this._credentials,this._apiUrl,`${this.apiPath}/${t}/members/${e}/scopes`,JSON.stringify({scope:i}))}))}}class g{constructor(t,e){this._apiKey=t,this._apiUrl=e||"api.deepgram.com",function(t,e){if(!t||0===t.trim().length)throw new Error("DG: API key is required");if(!e||0===e.trim().length)throw new Error("DG: API url should be a valid url or not provided")}(this._apiKey,this._apiUrl),this.transcription=new o(this._apiKey,this._apiUrl),this.projects=new h(this._apiKey,this._apiUrl,a),this.keys=new l(this._apiKey,this._apiUrl,a),this.usage=new d(this._apiKey,this._apiUrl,a),this.members=new f(this._apiKey,this._apiUrl,a),this.invitation=new y(this._apiKey,this._apiUrl,a),this.billing=new w(this._apiKey,this._apiUrl,a),this.scopes=new U(this._apiKey,this._apiUrl,a)}}})();var r=n.X;export{r as Deepgram};
|