@or-sdk/transcripts 1.0.1-beta.1196.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ ## Installation:
2
+ ```
3
+ $ npm i @or-sdk/transcripts
4
+ ```
5
+
6
+ ## Usage:
7
+ ```typescript
8
+ import { Transcripts } from '@or-sdk/transcripts'
9
+
10
+ // with direct api url
11
+ const transcripts = new Transcripts({
12
+ token: 'my-account-token-string',
13
+ transcriptsApiUrl: 'http://example.files/endpoint'
14
+ });
15
+
16
+ // with service discovery(slower)
17
+ const transcripts = new Transcripts({
18
+ token: 'my-account-token-string',
19
+ discoveryUrl: 'http://example.files/endpoint'
20
+ });
21
+ ```
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
+ 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;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.Transcripts = void 0;
55
+ var base_1 = require("@or-sdk/base");
56
+ var constants_1 = require("./constants");
57
+ var Transcripts = (function (_super) {
58
+ __extends(Transcripts, _super);
59
+ function Transcripts(params) {
60
+ var token = params.token, discoveryUrl = params.discoveryUrl, transcriptsApiUrl = params.transcriptsApiUrl, accountId = params.accountId;
61
+ return _super.call(this, {
62
+ token: token,
63
+ accountId: accountId,
64
+ serviceUrl: transcriptsApiUrl,
65
+ discoveryUrl: discoveryUrl,
66
+ serviceKey: constants_1.SERVICE_KEY,
67
+ }) || this;
68
+ }
69
+ Transcripts.prototype.createTranscript = function (_a) {
70
+ var sessionId = _a.sessionId, audioUrl = _a.audioUrl, transcriptionUrl = _a.transcriptionUrl, phone = _a.phone, createdAt = _a.createdAt, _b = _a.parseKeywords, parseKeywords = _b === void 0 ? false : _b, _c = _a.parseSentiments, parseSentiments = _c === void 0 ? false : _c, _d = _a.parseSummary, parseSummary = _d === void 0 ? false : _d;
71
+ return __awaiter(this, void 0, void 0, function () {
72
+ return __generator(this, function (_e) {
73
+ switch (_e.label) {
74
+ case 0: return [4, this.callApiV2({
75
+ method: 'post',
76
+ route: '',
77
+ data: {
78
+ sessionId: sessionId,
79
+ audioUrl: audioUrl,
80
+ transcriptionUrl: transcriptionUrl,
81
+ phone: phone,
82
+ createdAt: createdAt,
83
+ parseKeywords: parseKeywords,
84
+ parseSentiments: parseSentiments,
85
+ parseSummary: parseSummary,
86
+ },
87
+ })];
88
+ case 1: return [2, _e.sent()];
89
+ }
90
+ });
91
+ });
92
+ };
93
+ Transcripts.prototype.findOneTranscript = function (sessionId) {
94
+ return __awaiter(this, void 0, void 0, function () {
95
+ return __generator(this, function (_a) {
96
+ switch (_a.label) {
97
+ case 0: return [4, this.callApiV2({
98
+ method: 'get',
99
+ route: 'find-one/',
100
+ params: { sessionId: sessionId },
101
+ })];
102
+ case 1: return [2, _a.sent()];
103
+ }
104
+ });
105
+ });
106
+ };
107
+ Transcripts.prototype.findAllTranscripts = function (_a) {
108
+ var _b = _a.take, take = _b === void 0 ? 20 : _b, _c = _a.skip, skip = _c === void 0 ? 0 : _c, keywords = _a.keywords, summary = _a.summary, phone = _a.phone, createdAt = _a.createdAt;
109
+ return __awaiter(this, void 0, void 0, function () {
110
+ return __generator(this, function (_d) {
111
+ switch (_d.label) {
112
+ case 0: return [4, this.callApiV2({
113
+ method: 'get',
114
+ route: 'find-all/',
115
+ params: {
116
+ take: take,
117
+ skip: skip,
118
+ keywords: keywords,
119
+ summary: summary,
120
+ phone: phone,
121
+ createdAt: createdAt,
122
+ },
123
+ })];
124
+ case 1: return [2, _d.sent()];
125
+ }
126
+ });
127
+ });
128
+ };
129
+ return Transcripts;
130
+ }(base_1.Base));
131
+ exports.Transcripts = Transcripts;
132
+ //# sourceMappingURL=Transcripts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Transcripts.js","sourceRoot":"","sources":["../../src/Transcripts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAoC;AAEpC,yCAA0C;AAE1C;IAAiC,+BAAI;IACnC,qBAAY,MAAyB;QAC3B,IAAA,KAAK,GAAiD,MAAM,MAAvD,EAAE,YAAY,GAAmC,MAAM,aAAzC,EAAE,iBAAiB,GAAgB,MAAM,kBAAtB,EAAE,SAAS,GAAK,MAAM,UAAX,CAAY;eAErE,kBAAM;YACJ,KAAK,OAAA;YACL,SAAS,WAAA;YACT,UAAU,EAAE,iBAAiB;YAC7B,YAAY,cAAA;YACZ,UAAU,EAAE,uBAAW;SACxB,CAAC;IACJ,CAAC;IAeK,sCAAgB,GAAtB,UAAuB,EAAgJ;YAA9I,SAAS,eAAA,EAAE,QAAQ,cAAA,EAAE,gBAAgB,sBAAA,EAAE,KAAK,WAAA,EAAE,SAAS,eAAA,EAAE,qBAAqB,EAArB,aAAa,mBAAG,KAAK,KAAA,EAAE,uBAAuB,EAAvB,eAAe,mBAAG,KAAK,KAAA,EAAE,oBAAoB,EAApB,YAAY,mBAAG,KAAK,KAAA;;;;4BAC7I,WAAM,IAAI,CAAC,SAAS,CAAC;4BAC1B,MAAM,EAAE,MAAM;4BACd,KAAK,EAAE,EAAE;4BACT,IAAI,EAAE;gCACJ,SAAS,WAAA;gCACT,QAAQ,UAAA;gCACR,gBAAgB,kBAAA;gCAChB,KAAK,OAAA;gCACL,SAAS,WAAA;gCACT,aAAa,eAAA;gCACb,eAAe,iBAAA;gCACf,YAAY,cAAA;6BACb;yBACF,CAAC,EAAA;4BAbF,WAAO,SAaL,EAAC;;;;KACJ;IAOK,uCAAiB,GAAvB,UAAwB,SAAiB;;;;4BAChC,WAAM,IAAI,CAAC,SAAS,CAAC;4BAC1B,MAAM,EAAE,KAAK;4BACb,KAAK,EAAE,WAAW;4BAClB,MAAM,EAAE,EAAE,SAAS,WAAA,EAAE;yBACtB,CAAC,EAAA;4BAJF,WAAO,SAIL,EAAC;;;;KACJ;IAYK,wCAAkB,GAAxB,UAAyB,EAA4E;YAA1E,YAAS,EAAT,IAAI,mBAAG,EAAE,KAAA,EAAE,YAAQ,EAAR,IAAI,mBAAG,CAAC,KAAA,EAAE,QAAQ,cAAA,EAAE,OAAO,aAAA,EAAE,KAAK,WAAA,EAAE,SAAS,eAAA;;;;4BAC1E,WAAM,IAAI,CAAC,SAAS,CAAC;4BAC1B,MAAM,EAAE,KAAK;4BACb,KAAK,EAAE,WAAW;4BAClB,MAAM,EAAE;gCACN,IAAI,MAAA;gCACJ,IAAI,MAAA;gCACJ,QAAQ,UAAA;gCACR,OAAO,SAAA;gCACP,KAAK,OAAA;gCACL,SAAS,WAAA;6BACV;yBACF,CAAC,EAAA;4BAXF,WAAO,SAWL,EAAC;;;;KACJ;IACH,kBAAC;AAAD,CAAC,AAhFD,CAAiC,WAAI,GAgFpC;AAhFY,kCAAW"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TRANSCRIPTS_API_SERVICE_KEY = exports.SERVICE_KEY = void 0;
4
+ exports.SERVICE_KEY = 'transcripts-api';
5
+ exports.TRANSCRIPTS_API_SERVICE_KEY = exports.SERVICE_KEY;
6
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,iBAAiB,CAAC;AAChC,QAAA,2BAA2B,GAAG,mBAAW,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Transcripts = void 0;
18
+ var Transcripts_1 = require("./Transcripts");
19
+ Object.defineProperty(exports, "Transcripts", { enumerable: true, get: function () { return Transcripts_1.Transcripts; } });
20
+ __exportStar(require("./types"), exports);
21
+ __exportStar(require("./constants"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,0CAAwB;AACxB,8CAA4B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,67 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { Base } from '@or-sdk/base';
11
+ import { SERVICE_KEY } from './constants';
12
+ export class Transcripts extends Base {
13
+ constructor(params) {
14
+ const { token, discoveryUrl, transcriptsApiUrl, accountId } = params;
15
+ super({
16
+ token,
17
+ accountId,
18
+ serviceUrl: transcriptsApiUrl,
19
+ discoveryUrl,
20
+ serviceKey: SERVICE_KEY,
21
+ });
22
+ }
23
+ createTranscript({ sessionId, audioUrl, transcriptionUrl, phone, createdAt, parseKeywords = false, parseSentiments = false, parseSummary = false }) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ return yield this.callApiV2({
26
+ method: 'post',
27
+ route: '',
28
+ data: {
29
+ sessionId,
30
+ audioUrl,
31
+ transcriptionUrl,
32
+ phone,
33
+ createdAt,
34
+ parseKeywords,
35
+ parseSentiments,
36
+ parseSummary,
37
+ },
38
+ });
39
+ });
40
+ }
41
+ findOneTranscript(sessionId) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ return yield this.callApiV2({
44
+ method: 'get',
45
+ route: 'find-one/',
46
+ params: { sessionId },
47
+ });
48
+ });
49
+ }
50
+ findAllTranscripts({ take = 20, skip = 0, keywords, summary, phone, createdAt }) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ return yield this.callApiV2({
53
+ method: 'get',
54
+ route: 'find-all/',
55
+ params: {
56
+ take,
57
+ skip,
58
+ keywords,
59
+ summary,
60
+ phone,
61
+ createdAt,
62
+ },
63
+ });
64
+ });
65
+ }
66
+ }
67
+ //# sourceMappingURL=Transcripts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Transcripts.js","sourceRoot":"","sources":["../../src/Transcripts.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,WAAY,SAAQ,IAAI;IACnC,YAAY,MAAyB;QACnC,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAErE,KAAK,CAAC;YACJ,KAAK;YACL,SAAS;YACT,UAAU,EAAE,iBAAiB;YAC7B,YAAY;YACZ,UAAU,EAAE,WAAW;SACxB,CAAC,CAAC;IACL,CAAC;IAeK,gBAAgB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,GAAG,KAAK,EAAE,eAAe,GAAG,KAAK,EAAE,YAAY,GAAG,KAAK,EAAiB;;YACrK,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC;gBAC1B,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE,EAAE;gBACT,IAAI,EAAE;oBACJ,SAAS;oBACT,QAAQ;oBACR,gBAAgB;oBAChB,KAAK;oBACL,SAAS;oBACT,aAAa;oBACb,eAAe;oBACf,YAAY;iBACb;aACF,CAAC,CAAC;QACL,CAAC;KAAA;IAOK,iBAAiB,CAAC,SAAiB;;YACvC,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC;gBAC1B,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,WAAW;gBAClB,MAAM,EAAE,EAAE,SAAS,EAAE;aACtB,CAAC,CAAC;QACL,CAAC;KAAA;IAYK,kBAAkB,CAAC,EAAE,IAAI,GAAG,EAAE,EAAE,IAAI,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAkB;;YACnG,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC;gBAC1B,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,WAAW;gBAClB,MAAM,EAAE;oBACN,IAAI;oBACJ,IAAI;oBACJ,QAAQ;oBACR,OAAO;oBACP,KAAK;oBACL,SAAS;iBACV;aACF,CAAC,CAAC;QACL,CAAC;KAAA;CACF"}
@@ -0,0 +1,3 @@
1
+ export const SERVICE_KEY = 'transcripts-api';
2
+ export const TRANSCRIPTS_API_SERVICE_KEY = SERVICE_KEY;
3
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAC7C,MAAM,CAAC,MAAM,2BAA2B,GAAG,WAAW,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { Transcripts } from './Transcripts';
2
+ export * from './types';
3
+ export * from './constants';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { Base } from '@or-sdk/base';
2
+ import { CreateOptions, FindAllOptions, Transcription, TranscriptsConfig } from './types';
3
+ export declare class Transcripts extends Base {
4
+ constructor(params: TranscriptsConfig);
5
+ createTranscript({ sessionId, audioUrl, transcriptionUrl, phone, createdAt, parseKeywords, parseSentiments, parseSummary }: CreateOptions): Promise<Transcription>;
6
+ findOneTranscript(sessionId: string): Promise<Transcription>;
7
+ findAllTranscripts({ take, skip, keywords, summary, phone, createdAt }: FindAllOptions): Promise<Transcription[]>;
8
+ }
9
+ //# sourceMappingURL=Transcripts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Transcripts.d.ts","sourceRoot":"","sources":["../../src/Transcripts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG1F,qBAAa,WAAY,SAAQ,IAAI;gBACvB,MAAM,EAAE,iBAAiB;IAyB/B,gBAAgB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,EAAE,aAAqB,EAAE,eAAuB,EAAE,YAAoB,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAsB1L,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAkB5D,kBAAkB,CAAC,EAAE,IAAS,EAAE,IAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;CAcjI"}
@@ -0,0 +1,3 @@
1
+ export declare const SERVICE_KEY = "transcripts-api";
2
+ export declare const TRANSCRIPTS_API_SERVICE_KEY = "transcripts-api";
3
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAC7C,eAAO,MAAM,2BAA2B,oBAAc,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { Transcripts } from './Transcripts';
2
+ export * from './types';
3
+ export * from './constants';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { Token } from '@or-sdk/base';
2
+ export type TranscriptsConfig = {
3
+ token: Token;
4
+ transcriptsApiUrl?: string;
5
+ accountId?: string;
6
+ discoveryUrl?: string;
7
+ };
8
+ export type Transcription = {
9
+ sessionId: string;
10
+ accountId: string;
11
+ phone: string;
12
+ createdAt: Date;
13
+ sentiments: string | null;
14
+ summary: string | null;
15
+ keywords: string | null;
16
+ audioUrl: string;
17
+ transcriptionUrl: string;
18
+ };
19
+ export type CreateOptions = {
20
+ sessionId: string;
21
+ audioUrl: string;
22
+ transcriptionUrl: string;
23
+ phone: string;
24
+ createdAt: number;
25
+ parseKeywords?: boolean;
26
+ parseSentiments?: boolean;
27
+ parseSummary?: boolean;
28
+ };
29
+ export type FindAllOptions = {
30
+ take?: number;
31
+ skip?: number;
32
+ keywords?: string;
33
+ summary?: string;
34
+ phone?: string;
35
+ createdAt?: number;
36
+ };
37
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,MAAM,MAAM,iBAAiB,GAAG;IAI9B,KAAK,EAAE,KAAK,CAAC;IAIb,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAI3B,SAAS,CAAC,EAAE,MAAM,CAAC;IAInB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@or-sdk/transcripts",
3
+ "version": "1.0.1-beta.1196.0",
4
+ "main": "dist/cjs/index.js",
5
+ "module": "dist/esm/index.js",
6
+ "types": "dist/types/index.d.ts",
7
+ "scripts": {
8
+ "build": "pnpm clean && pnpm build:esm && pnpm build:cjs",
9
+ "build:cjs": "tsc --project tsconfig.json",
10
+ "build:esm": "tsc --project tsconfig.esm.json",
11
+ "build:types": "tsc --project tsconfig.types.json",
12
+ "build:watch": "concurrently -r --hide 1,2 \"pnpm build:watch:cjs\" \"pnpm build:watch:esm\" \"pnpm build:watch:types\"",
13
+ "build:watch:cjs": "tsc --project tsconfig.json -w",
14
+ "build:watch:esm": "tsc --project tsconfig.esm.json -w",
15
+ "build:watch:types": "tsc --project tsconfig.types.json -w",
16
+ "clean": "rm -rf ./dist",
17
+ "dev": "pnpm build:watch:esm"
18
+ },
19
+ "devDependencies": {
20
+ "concurrently": "^6.4.0",
21
+ "typescript": "^4.4.4"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "dependencies": {
27
+ "@or-sdk/base": "^0.28.1"
28
+ }
29
+ }
@@ -0,0 +1,85 @@
1
+ import { Base } from '@or-sdk/base';
2
+ import { CreateOptions, FindAllOptions, Transcription, TranscriptsConfig } from './types';
3
+ import { SERVICE_KEY } from './constants';
4
+
5
+ export class Transcripts extends Base {
6
+ constructor(params: TranscriptsConfig) {
7
+ const { token, discoveryUrl, transcriptsApiUrl, accountId } = params;
8
+
9
+ super({
10
+ token,
11
+ accountId,
12
+ serviceUrl: transcriptsApiUrl,
13
+ discoveryUrl,
14
+ serviceKey: SERVICE_KEY,
15
+ });
16
+ }
17
+
18
+
19
+ /**
20
+ * Create transcript item, only for SERVICE TOKEN with SUPER ADMIN
21
+ * @param sessionId - uuid of transcription session id
22
+ * @param audioUrl - url string to audio file
23
+ * @param transcriptionUrl - url string to transcription file
24
+ * @param phone - string which represents phone number '1234567890'
25
+ * @param createdAt - timestamp number when record was created
26
+ * @param parseKeywords - boolean, should chatGpt analyse keywords
27
+ * @param parseSentiments - boolean, should chatGpt analyse sentiments
28
+ * @param parseSummary - boolean, should chatGpt analyse summary
29
+ * @return Transcription item
30
+ */
31
+ async createTranscript({ sessionId, audioUrl, transcriptionUrl, phone, createdAt, parseKeywords = false, parseSentiments = false, parseSummary = false }: CreateOptions): Promise<Transcription> {
32
+ return await this.callApiV2({
33
+ method: 'post',
34
+ route: '',
35
+ data: {
36
+ sessionId,
37
+ audioUrl,
38
+ transcriptionUrl,
39
+ phone,
40
+ createdAt,
41
+ parseKeywords,
42
+ parseSentiments,
43
+ parseSummary,
44
+ },
45
+ });
46
+ }
47
+
48
+ /**
49
+ * Get one transcript
50
+ * @param sessionId - uuid of transcription session id
51
+ * @return Transcription item
52
+ */
53
+ async findOneTranscript(sessionId: string): Promise<Transcription> {
54
+ return await this.callApiV2({
55
+ method: 'get',
56
+ route: 'find-one/',
57
+ params: { sessionId },
58
+ });
59
+ }
60
+
61
+ /**
62
+ * Get all transcripts
63
+ * @param take - number of how many items should be return (default 20)
64
+ * @param skip - number of how many items should be skipped (default 0)
65
+ * @param keywords - string of keywords to search without comas, example: 'toyota May Apple Paris balance'
66
+ * @param summary - string of summary words to search without comas, example: 'call help received'
67
+ * @param phone - string of numbers of the tel. number
68
+ * @param createdAt - timestamp of the searching day
69
+ * @return Array of Transcription items
70
+ */
71
+ async findAllTranscripts({ take = 20, skip = 0, keywords, summary, phone, createdAt }: FindAllOptions): Promise<Transcription[]> {
72
+ return await this.callApiV2({
73
+ method: 'get',
74
+ route: 'find-all/',
75
+ params: {
76
+ take,
77
+ skip,
78
+ keywords,
79
+ summary,
80
+ phone,
81
+ createdAt,
82
+ },
83
+ });
84
+ }
85
+ }
@@ -0,0 +1,2 @@
1
+ export const SERVICE_KEY = 'transcripts-api';
2
+ export const TRANSCRIPTS_API_SERVICE_KEY = SERVICE_KEY;
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { Transcripts } from './Transcripts';
2
+ export * from './types';
3
+ export * from './constants';
package/src/types.ts ADDED
@@ -0,0 +1,52 @@
1
+ import { Token } from '@or-sdk/base';
2
+
3
+ export type TranscriptsConfig = {
4
+ /**
5
+ * token
6
+ */
7
+ token: Token;
8
+ /**
9
+ * Direct service url, can be used to avoid discovery api call
10
+ */
11
+ transcriptsApiUrl?: string;
12
+ /**
13
+ * Account ID for cross-account requests (super admin only)
14
+ */
15
+ accountId?: string;
16
+ /**
17
+ * function which return token
18
+ */
19
+ discoveryUrl?: string;
20
+ };
21
+
22
+ export type Transcription = {
23
+ sessionId: string;
24
+ accountId: string;
25
+ phone: string;
26
+ createdAt: Date;
27
+ sentiments: string | null;
28
+ summary: string | null;
29
+ keywords: string | null;
30
+ audioUrl: string;
31
+ transcriptionUrl: string;
32
+ };
33
+
34
+ export type CreateOptions = {
35
+ sessionId: string;
36
+ audioUrl: string;
37
+ transcriptionUrl: string;
38
+ phone: string;
39
+ createdAt: number;
40
+ parseKeywords?: boolean;
41
+ parseSentiments?: boolean;
42
+ parseSummary?: boolean;
43
+ };
44
+
45
+ export type FindAllOptions = {
46
+ take?: number;
47
+ skip?: number;
48
+ keywords?: string;
49
+ summary?: string;
50
+ phone?: string;
51
+ createdAt?: number;
52
+ };
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.esm.json",
3
+ "compilerOptions": {
4
+ "declarationDir": "./dist/types",
5
+ "rootDir": "./src",
6
+ "declaration": true
7
+ }
8
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist/esm",
5
+ "declarationDir": "./dist/types",
6
+ "module": "ES6",
7
+ "target": "es6",
8
+ "rootDir": "./src",
9
+ "declaration": true,
10
+ "declarationMap": true
11
+ }
12
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist/cjs/",
5
+ "rootDir": "./src"
6
+ }
7
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist/types/",
5
+ "rootDir": "./src",
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "emitDeclarationOnly": true
9
+ }
10
+ }