@rc-ex/ws 1.3.2 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/exceptions/ClosedException.js +26 -0
- package/dist/cjs/exceptions/ClosedException.js.map +1 -0
- package/{lib → dist/cjs}/exceptions/ConnectionException.d.ts +1 -1
- package/dist/cjs/exceptions/ConnectionException.js +35 -0
- package/dist/cjs/exceptions/ConnectionException.js.map +1 -0
- package/dist/cjs/exceptions/TimeoutException.js +26 -0
- package/dist/cjs/exceptions/TimeoutException.js.map +1 -0
- package/{lib/esm → dist/cjs}/index.d.ts +6 -6
- package/dist/cjs/index.js +515 -0
- package/dist/cjs/index.js.map +1 -0
- package/{lib/esm → dist/cjs}/rest.d.ts +2 -2
- package/dist/cjs/rest.js +104 -0
- package/dist/cjs/rest.js.map +1 -0
- package/{lib → dist/cjs}/subscription.d.ts +3 -3
- package/dist/cjs/subscription.js +178 -0
- package/dist/cjs/subscription.js.map +1 -0
- package/{lib → dist/cjs}/types.d.ts +2 -2
- package/{lib/esm → dist/cjs}/utils.d.ts +1 -1
- package/dist/cjs/utils.js +116 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/esm/exceptions/ClosedException.js +24 -0
- package/dist/esm/exceptions/ClosedException.js.map +1 -0
- package/{lib → dist}/esm/exceptions/ConnectionException.d.ts +1 -1
- package/dist/esm/exceptions/ConnectionException.js +30 -0
- package/dist/esm/exceptions/ConnectionException.js.map +1 -0
- package/dist/esm/exceptions/TimeoutException.js +24 -0
- package/dist/esm/exceptions/TimeoutException.js.map +1 -0
- package/{lib → dist/esm}/index.d.ts +6 -6
- package/dist/esm/index.js +509 -0
- package/dist/esm/index.js.map +1 -0
- package/{lib → dist/esm}/rest.d.ts +2 -2
- package/dist/esm/rest.js +98 -0
- package/dist/esm/rest.js.map +1 -0
- package/{lib → dist}/esm/subscription.d.ts +3 -3
- package/dist/esm/subscription.js +173 -0
- package/dist/esm/subscription.js.map +1 -0
- package/{lib → dist}/esm/types.d.ts +2 -2
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/{lib → dist/esm}/utils.d.ts +1 -1
- package/dist/esm/utils.js +111 -0
- package/dist/esm/utils.js.map +1 -0
- package/package.json +23 -9
- package/src/exceptions/ConnectionException.ts +2 -2
- package/src/index.ts +10 -10
- package/src/rest.ts +4 -4
- package/src/subscription.ts +5 -9
- package/src/types.ts +2 -2
- package/src/utils.ts +3 -3
- package/tsconfig.cjs.json +28 -0
- package/tsconfig.esm.json +28 -0
- package/lib/esm/exceptions/ClosedException.js +0 -9
- package/lib/esm/exceptions/ClosedException.js.map +0 -1
- package/lib/esm/exceptions/ConnectionException.js +0 -18
- package/lib/esm/exceptions/ConnectionException.js.map +0 -1
- package/lib/esm/exceptions/TimeoutException.js +0 -9
- package/lib/esm/exceptions/TimeoutException.js.map +0 -1
- package/lib/esm/index.js +0 -334
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/rest.js +0 -54
- package/lib/esm/rest.js.map +0 -1
- package/lib/esm/subscription.js +0 -96
- package/lib/esm/subscription.js.map +0 -1
- package/lib/esm/utils.js +0 -72
- package/lib/esm/utils.js.map +0 -1
- package/lib/exceptions/ClosedException.js +0 -9
- package/lib/exceptions/ClosedException.js.map +0 -1
- package/lib/exceptions/ConnectionException.js +0 -18
- package/lib/exceptions/ConnectionException.js.map +0 -1
- package/lib/exceptions/TimeoutException.js +0 -9
- package/lib/exceptions/TimeoutException.js.map +0 -1
- package/lib/index.js +0 -334
- package/lib/index.js.map +0 -1
- package/lib/rest.js +0 -54
- package/lib/rest.js.map +0 -1
- package/lib/subscription.js +0 -96
- package/lib/subscription.js.map +0 -1
- package/lib/types.js +0 -3
- package/lib/types.js.map +0 -1
- package/lib/utils.js +0 -72
- package/lib/utils.js.map +0 -1
- package/tsconfig.json +0 -8
- /package/{lib/esm → dist/cjs}/exceptions/ClosedException.d.ts +0 -0
- /package/{lib/esm → dist/cjs}/exceptions/TimeoutException.d.ts +0 -0
- /package/{lib/esm → dist/cjs}/types.js +0 -0
- /package/{lib/esm → dist/cjs}/types.js.map +0 -0
- /package/{lib → dist/esm}/exceptions/ClosedException.d.ts +0 -0
- /package/{lib → dist/esm}/exceptions/TimeoutException.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,0EAAoD;AAEpD,gEAA+B;AAC/B,oDAA8B;AAC9B,iCAAsC;AACtC,kEAAqC;AACrC,4EAAsD;AAGtD,+BAAiC;AASjC,gEAA0C;AAC1C,yFAAmE;AACnE,kDAA4B;AAE5B,IAAM,UAAU,GAAG,CAAC,CAAC;AACrB,IAAM,IAAI,GAAG,CAAC,CAAC;AAEf,IAAM,IAAI,GAAG,IAAA,iBAAO,GAAE,CAAC;AAEvB,IAAY,MAOX;AAPD,WAAY,MAAM;IAChB,mDAAyC,CAAA;IACzC,iDAAuC,CAAA;IACvC,+CAAqC,CAAA;IACrC,mDAAyC,CAAA;IACzC,2BAAiB,CAAA;IACjB,6CAAmC,CAAA;AACrC,CAAC,EAPW,MAAM,sBAAN,MAAM,QAOjB;AAED;IAAiC,sCAAY;IAgC3C,4BAAmB,OAA8B;QAA9B,wBAAA,EAAA,YAA8B;;;QAC/C,YAAA,MAAK,WAAE,SAAC;QAhCH,kBAAY,GAAG,IAAI,qBAAY,EAAE,CAAC;QAQlC,sBAAgB,GAAG,CAAC,CAAC;QAqBrB,aAAO,GAAG,cAAO,CAAC,CAAC,mEAAmE;QAI3F,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,YAAA,KAAI,CAAC,OAAO,EAAC,iBAAiB,uCAAjB,iBAAiB,GAAK,KAAK,EAAC;QACzC,YAAA,KAAI,CAAC,OAAO,EAAC,SAAS,uCAAT,SAAS,GA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gB,EAAE,CAAC;4BAC1B,YAAY,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;wBACtC,CAAC;wBACD,MAAA,IAAI,CAAC,EAAE,0CAAE,KAAK,EAAE,CAAC;wBACjB,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC;wBACrB,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;wBACzB,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;wBAC1B,IAAI,CAAC,OAAO,EAAE,CAAC;;;;;KAChB;IAEY,sCAAS,GAAtB;4DACE,YAAsB,EACtB,QAA6B,EAC7B,KAAsD;;YAAtD,sBAAA,EAAA,iBAAsD;;;;wBAEhD,YAAY,GAAG,IAAI,sBAAY,CACnC,IAAmC,EACnC,YAAY,EACZ,QAAQ,CACT,CAAC;6BACE,CAAA,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAA,EAArC,wBAAqC;wBACvC,qBAAM,YAAY,CAAC,SAAS,EAAE,EAAA;;wBAA9B,SAA8B,CAAC;;;wBAE/B,YAAY,CAAC,gBAAgB,GAAG,KAAK,CAAC;wBACtC,qBAAM,YAAY,CAAC,OAAO,EAAE,EAAA;;wBAA5B,SAA4B,CAAC;;;wBAE/B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;wBACjC,sBAAO,YAAY,EAAC;;;;KACrB;IACH,yBAAC;AAAD,CAAC,AAxXD,CAAiC,sBAAY,GAwX5C;AAED,kBAAe,kBAAkB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { RestMethod, RestRequestConfig, RestResponse } from "@rc-ex/core/
|
|
2
|
-
import type { WebSocketExtensionInterface } from "./types
|
|
1
|
+
import type { RestMethod, RestRequestConfig, RestResponse } from "@rc-ex/core/types";
|
|
2
|
+
import type { WebSocketExtensionInterface } from "./types";
|
|
3
3
|
export declare function request<T>(this: WebSocketExtensionInterface, method: RestMethod, endpoint: string, content?: {}, queryParams?: {}, config?: RestRequestConfig): Promise<RestResponse<T>>;
|
package/dist/cjs/rest.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
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;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
exports.request = request;
|
|
54
|
+
var RestException_1 = __importDefault(require("@rc-ex/core/RestException"));
|
|
55
|
+
var hyperid_1 = __importDefault(require("hyperid"));
|
|
56
|
+
var http_status_codes_1 = require("http-status-codes");
|
|
57
|
+
var utils_1 = __importDefault(require("./utils"));
|
|
58
|
+
var version = "0.16";
|
|
59
|
+
var uuid = (0, hyperid_1.default)();
|
|
60
|
+
function request(method, endpoint, content, queryParams, config) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
+
var newConfig, messageId, requestBody, _a, meta, body, response;
|
|
63
|
+
var _b;
|
|
64
|
+
return __generator(this, function (_c) {
|
|
65
|
+
switch (_c.label) {
|
|
66
|
+
case 0:
|
|
67
|
+
newConfig = __assign({ method: method, baseURL: (_b = this.wsToken) === null || _b === void 0 ? void 0 : _b.uri, url: endpoint, data: content, params: queryParams }, config);
|
|
68
|
+
newConfig.headers = __assign(__assign({}, newConfig.headers), { "X-User-Agent": "".concat(this.rc.rest.appName, "/").concat(this.rc.rest.appVersion, " ringcentral-extensible/ws/").concat(version) });
|
|
69
|
+
messageId = uuid();
|
|
70
|
+
requestBody = [
|
|
71
|
+
{
|
|
72
|
+
type: "ClientRequest",
|
|
73
|
+
messageId: messageId,
|
|
74
|
+
method: newConfig.method,
|
|
75
|
+
path: newConfig.url,
|
|
76
|
+
headers: newConfig.headers,
|
|
77
|
+
query: newConfig.params,
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
if (newConfig.data) {
|
|
81
|
+
requestBody.push(newConfig.data);
|
|
82
|
+
}
|
|
83
|
+
return [4 /*yield*/, this.ws.send(JSON.stringify(requestBody))];
|
|
84
|
+
case 1:
|
|
85
|
+
_c.sent();
|
|
86
|
+
return [4 /*yield*/, utils_1.default.waitForWebSocketMessage(this.ws, function (_meta) { return _meta.messageId === messageId; })];
|
|
87
|
+
case 2:
|
|
88
|
+
_a = _c.sent(), meta = _a[0], body = _a[1];
|
|
89
|
+
response = {
|
|
90
|
+
data: body,
|
|
91
|
+
status: meta.status,
|
|
92
|
+
statusText: (0, http_status_codes_1.getReasonPhrase)(meta.status),
|
|
93
|
+
headers: meta.headers,
|
|
94
|
+
config: newConfig,
|
|
95
|
+
};
|
|
96
|
+
if (meta.type === "ClientRequest" && meta.status >= 200 && meta.status < 300) {
|
|
97
|
+
return [2 /*return*/, response];
|
|
98
|
+
}
|
|
99
|
+
throw new RestException_1.default(response);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=rest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rest.js","sourceRoot":"","sources":["../../src/rest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,0BAsDC;AAjED,4EAAsD;AACtD,oDAA8B;AAC9B,uDAAoD;AAEpD,kDAA4B;AAG5B,IAAM,OAAO,GAAG,MAAM,CAAC;AAEvB,IAAM,IAAI,GAAG,IAAA,iBAAO,GAAE,CAAC;AAEvB,SAAsB,OAAO,CAE3B,MAAkB,EAClB,QAAgB,EAChB,OAAY,EACZ,WAAgB,EAChB,MAA0B;;;;;;;oBAEpB,SAAS,cACb,MAAM,QAAA,EACN,OAAO,EAAE,MAAA,IAAI,CAAC,OAAO,0CAAE,GAAG,EAC1B,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,WAAW,IAChB,MAAM,CACV,CAAC;oBACF,SAAS,CAAC,OAAO,GAAG,sBACf,SAAS,CAAC,OAAO,KACpB,cAAc,EAAE,UAAG,IAAI,CAAC,EAAE,CAAC,IAAK,CAAC,OAAO,cACtC,IAAI,CAAC,EAAE,CAAC,IAAK,CAAC,UAAU,wCACI,OAAO,CAAE,GACjC,CAAC;oBACH,SAAS,GAAG,IAAI,EAAE,CAAC;oBACnB,WAAW,GAAG;wBAClB;4BACE,IAAI,EAAE,eAAe;4BACrB,SAAS,WAAA;4BACT,MAAM,EAAE,SAAS,CAAC,MAAM;4BACxB,IAAI,EAAE,SAAS,CAAC,GAAG;4BACnB,OAAO,EAAE,SAAS,CAAC,OAAO;4BAC1B,KAAK,EAAE,SAAS,CAAC,MAAM;yBACxB;qBACF,CAAC;oBACF,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC;wBACnB,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;oBACnC,CAAC;oBACD,qBAAM,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,EAAA;;oBAA/C,SAA+C,CAAC;oBAC3B,qBAAM,eAAK,CAAC,uBAAuB,CACtD,IAAI,CAAC,EAAE,EACP,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,SAAS,KAAK,SAAS,EAA7B,CAA6B,CACzC,EAAA;;oBAHK,KAAe,SAGpB,EAHM,IAAI,QAAA,EAAE,IAAI,QAAA;oBAIX,QAAQ,GAAiB;wBAC7B,IAAI,EAAE,IAAS;wBACf,MAAM,EAAE,IAAI,CAAC,MAAM;wBACnB,UAAU,EAAE,IAAA,mCAAe,EAAC,IAAI,CAAC,MAAM,CAAC;wBACxC,OAAO,EAAE,IAAI,CAAC,OAAO;wBACrB,MAAM,EAAE,SAAgB;qBACzB,CAAC;oBACF,IACE,IAAI,CAAC,IAAI,KAAK,eAAe,IAAI,IAAI,CAAC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,EACxE,CAAC;wBACD,sBAAO,QAAQ,EAAC;oBAClB,CAAC;oBACD,MAAM,IAAI,uBAAa,CAAC,QAAQ,CAAC,CAAC;;;;CACnC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type CreateSubscriptionRequest from "@rc-ex/core/
|
|
2
|
-
import type SubscriptionInfo from "@rc-ex/core/
|
|
1
|
+
import type CreateSubscriptionRequest from "@rc-ex/core/definitions/CreateSubscriptionRequest";
|
|
2
|
+
import type SubscriptionInfo from "@rc-ex/core/definitions/SubscriptionInfo";
|
|
3
3
|
import type { MessageEvent } from "ws";
|
|
4
|
-
import type { WebSocketExtensionInterface } from "./types
|
|
4
|
+
import type { WebSocketExtensionInterface } from "./types";
|
|
5
5
|
declare class Subscription {
|
|
6
6
|
subscriptionInfo?: SubscriptionInfo;
|
|
7
7
|
wse: WebSocketExtensionInterface;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
var utils_1 = __importDefault(require("./utils"));
|
|
43
|
+
var Subscription = /** @class */ (function () {
|
|
44
|
+
function Subscription(wse, eventFilters, callback) {
|
|
45
|
+
var _this = this;
|
|
46
|
+
this.enabled = true;
|
|
47
|
+
this.wse = wse;
|
|
48
|
+
this.eventFilters = eventFilters;
|
|
49
|
+
this.eventListener = function (mEvent) {
|
|
50
|
+
var event = mEvent;
|
|
51
|
+
var _a = utils_1.default
|
|
52
|
+
.splitWsgData(event.data), meta = _a[0], body = _a[1];
|
|
53
|
+
if (_this.enabled && meta.type === "ServerNotification" &&
|
|
54
|
+
body.subscriptionId === _this.subscriptionInfo.id) {
|
|
55
|
+
callback(body);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
this.setupWsEventListener();
|
|
59
|
+
}
|
|
60
|
+
Subscription.prototype.setupWsEventListener = function () {
|
|
61
|
+
this.wse.ws.addEventListener("message", this.eventListener);
|
|
62
|
+
};
|
|
63
|
+
Object.defineProperty(Subscription.prototype, "requestBody", {
|
|
64
|
+
get: function () {
|
|
65
|
+
return {
|
|
66
|
+
deliveryMode: { transportType: "WebSocket" }, // because WebSocket is not in spec
|
|
67
|
+
eventFilters: this.eventFilters,
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
enumerable: false,
|
|
71
|
+
configurable: true
|
|
72
|
+
});
|
|
73
|
+
Subscription.prototype.subscribe = function () {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
75
|
+
var _a;
|
|
76
|
+
return __generator(this, function (_b) {
|
|
77
|
+
switch (_b.label) {
|
|
78
|
+
case 0:
|
|
79
|
+
_a = this;
|
|
80
|
+
return [4 /*yield*/, this.wse.request("POST", "/restapi/v1.0/subscription", this.requestBody)];
|
|
81
|
+
case 1:
|
|
82
|
+
_a.subscriptionInfo = (_b.sent()).data;
|
|
83
|
+
return [2 /*return*/];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
Subscription.prototype.refresh = function () {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
90
|
+
var _a, e_1, re;
|
|
91
|
+
return __generator(this, function (_b) {
|
|
92
|
+
switch (_b.label) {
|
|
93
|
+
case 0:
|
|
94
|
+
if (!this.subscriptionInfo) {
|
|
95
|
+
return [2 /*return*/];
|
|
96
|
+
}
|
|
97
|
+
_b.label = 1;
|
|
98
|
+
case 1:
|
|
99
|
+
_b.trys.push([1, 3, , 6]);
|
|
100
|
+
_a = this;
|
|
101
|
+
return [4 /*yield*/, this.wse.request("PUT", "/restapi/v1.0/subscription/".concat(this.subscriptionInfo.id), this.requestBody)];
|
|
102
|
+
case 2:
|
|
103
|
+
_a.subscriptionInfo = (_b.sent()).data;
|
|
104
|
+
return [3 /*break*/, 6];
|
|
105
|
+
case 3:
|
|
106
|
+
e_1 = _b.sent();
|
|
107
|
+
re = e_1;
|
|
108
|
+
if (!(re.response && re.response.status === 404)) return [3 /*break*/, 5];
|
|
109
|
+
// subscription expired
|
|
110
|
+
return [4 /*yield*/, this.subscribe()];
|
|
111
|
+
case 4:
|
|
112
|
+
// subscription expired
|
|
113
|
+
_b.sent();
|
|
114
|
+
_b.label = 5;
|
|
115
|
+
case 5: return [3 /*break*/, 6];
|
|
116
|
+
case 6: return [2 /*return*/];
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
Subscription.prototype.revoke = function () {
|
|
122
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
123
|
+
var e_2, re;
|
|
124
|
+
return __generator(this, function (_a) {
|
|
125
|
+
switch (_a.label) {
|
|
126
|
+
case 0:
|
|
127
|
+
if (!this.subscriptionInfo) {
|
|
128
|
+
return [2 /*return*/];
|
|
129
|
+
}
|
|
130
|
+
_a.label = 1;
|
|
131
|
+
case 1:
|
|
132
|
+
_a.trys.push([1, 3, , 4]);
|
|
133
|
+
return [4 /*yield*/, this.wse.request("DELETE", "/restapi/v1.0/subscription/".concat(this.subscriptionInfo.id))];
|
|
134
|
+
case 2:
|
|
135
|
+
_a.sent();
|
|
136
|
+
return [3 /*break*/, 4];
|
|
137
|
+
case 3:
|
|
138
|
+
e_2 = _a.sent();
|
|
139
|
+
re = e_2;
|
|
140
|
+
if (re.response && re.response.status === 404) {
|
|
141
|
+
// ignore
|
|
142
|
+
if (this.wse.options.debugMode) {
|
|
143
|
+
console.debug("Subscription ".concat(this.subscriptionInfo.id, " doesn't exist on server side"));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
else if (re.response && re.response.status === 401) {
|
|
147
|
+
// ignore
|
|
148
|
+
if (this.wse.options.debugMode) {
|
|
149
|
+
console.debug("Token invalid when trying to revoke subscription");
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
throw e_2;
|
|
154
|
+
}
|
|
155
|
+
return [3 /*break*/, 4];
|
|
156
|
+
case 4:
|
|
157
|
+
this.remove();
|
|
158
|
+
return [2 /*return*/];
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
Subscription.prototype.remove = function () {
|
|
164
|
+
if (this.timeout) {
|
|
165
|
+
global.clearTimeout(this.timeout);
|
|
166
|
+
this.timeout = undefined;
|
|
167
|
+
}
|
|
168
|
+
this.enabled = false;
|
|
169
|
+
this.subscriptionInfo = undefined;
|
|
170
|
+
if (this.wse.ws) {
|
|
171
|
+
this.wse.ws.removeEventListener("message", this.eventListener);
|
|
172
|
+
}
|
|
173
|
+
this.wse.subscription = undefined;
|
|
174
|
+
};
|
|
175
|
+
return Subscription;
|
|
176
|
+
}());
|
|
177
|
+
exports.default = Subscription;
|
|
178
|
+
//# sourceMappingURL=subscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../src/subscription.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,kDAA4B;AAE5B;IAaE,sBACE,GAAgC,EAChC,YAAsB,EACtB,QAA6B;QAH/B,iBAmBC;QArBM,YAAO,GAAG,IAAI,CAAC;QAOpB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,aAAa,GAAG,UAAC,MAAoB;YACxC,IAAM,KAAK,GAAG,MAAkB,CAAC;YAC3B,IAAA,KAAsD,eAAK;iBAC9D,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,EADpB,IAAI,QAAA,EAAE,IAAI,QACU,CAAC;YAC5B,IACE,KAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,KAAK,oBAAoB;gBAClD,IAAI,CAAC,cAAc,KAAK,KAAI,CAAC,gBAAiB,CAAC,EAAE,EACjD,CAAC;gBACD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AAE,CAAC;YAChB,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,YAAY,GAAG,SAAS,CAAC;IACpC,CAAC;IACH,mBAAC;AAAD,CAAC,AAxHD,IAwHC;AAED,kBAAe,YAAY,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type RingCentral from "@rc-ex/core";
|
|
2
|
-
import type { RestMethod, RestRequestConfig, RestResponse } from "@rc-ex/core/
|
|
1
|
+
import type RingCentral from "@rc-ex/core/index";
|
|
2
|
+
import type { RestMethod, RestRequestConfig, RestResponse } from "@rc-ex/core/types";
|
|
3
3
|
import type WS from "isomorphic-ws";
|
|
4
4
|
export interface WsToken {
|
|
5
5
|
uri: string;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
var ClosedException_1 = __importDefault(require("./exceptions/ClosedException"));
|
|
43
|
+
var TimeoutException_1 = __importDefault(require("./exceptions/TimeoutException"));
|
|
44
|
+
var Utils = /** @class */ (function () {
|
|
45
|
+
function Utils() {
|
|
46
|
+
}
|
|
47
|
+
Utils.splitWsgData = function (wsgData) {
|
|
48
|
+
if (wsgData.includes(",--Boundary")) {
|
|
49
|
+
var index = wsgData.indexOf(",--Boundary");
|
|
50
|
+
return [
|
|
51
|
+
JSON.parse(wsgData.substring(1, index)),
|
|
52
|
+
wsgData.substring(index + 1, wsgData.length - 1),
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
return JSON.parse(wsgData);
|
|
56
|
+
};
|
|
57
|
+
Utils.debugWebSocket = function (_ws) {
|
|
58
|
+
var _this = this;
|
|
59
|
+
var ws = _ws;
|
|
60
|
+
var send = ws.send.bind(ws);
|
|
61
|
+
ws.send = function (str) { return __awaiter(_this, void 0, void 0, function () {
|
|
62
|
+
return __generator(this, function (_a) {
|
|
63
|
+
switch (_a.label) {
|
|
64
|
+
case 0: return [4 /*yield*/, send(str)];
|
|
65
|
+
case 1:
|
|
66
|
+
_a.sent();
|
|
67
|
+
console.debug("*** WebSocket outgoing message: ***\n".concat(JSON.stringify(JSON.parse(str), null, 2), "\n******"));
|
|
68
|
+
return [2 /*return*/];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}); };
|
|
72
|
+
ws.addEventListener("message", function (mEvent) {
|
|
73
|
+
var event = mEvent;
|
|
74
|
+
console.debug("*** WebSocket incoming message: ***\n".concat(JSON.stringify(JSON.parse(event.data), null, 2), "\n******"));
|
|
75
|
+
});
|
|
76
|
+
ws.addEventListener("open", function (event) {
|
|
77
|
+
console.debug("WebSocket open event:", event);
|
|
78
|
+
});
|
|
79
|
+
ws.addEventListener("error", function (event) {
|
|
80
|
+
console.debug("WebSocket error event:", event);
|
|
81
|
+
});
|
|
82
|
+
ws.addEventListener("close", function (event) {
|
|
83
|
+
console.debug("WebSocket close event:", event);
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
Utils.waitForWebSocketMessage = function (ws, matchCondition, timeout) {
|
|
87
|
+
if (timeout === void 0) { timeout = 60000; }
|
|
88
|
+
return new Promise(function (resolve, reject) {
|
|
89
|
+
var checkHandle = setInterval(function () {
|
|
90
|
+
if (ws.readyState === ws.CLOSED) {
|
|
91
|
+
clearInterval(checkHandle);
|
|
92
|
+
reject(new ClosedException_1.default());
|
|
93
|
+
}
|
|
94
|
+
}, 1000);
|
|
95
|
+
var timeoutHandle = setTimeout(function () {
|
|
96
|
+
ws.removeEventListener("message", handler);
|
|
97
|
+
clearInterval(checkHandle);
|
|
98
|
+
reject(new TimeoutException_1.default());
|
|
99
|
+
}, timeout);
|
|
100
|
+
var handler = function (mEvent) {
|
|
101
|
+
var event = mEvent;
|
|
102
|
+
var _a = Utils.splitWsgData(event.data), meta = _a[0], body = _a[1];
|
|
103
|
+
if (matchCondition(meta)) {
|
|
104
|
+
ws.removeEventListener("message", handler);
|
|
105
|
+
clearInterval(checkHandle);
|
|
106
|
+
clearTimeout(timeoutHandle);
|
|
107
|
+
resolve([meta, body, event]);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
ws.addEventListener("message", handler);
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
return Utils;
|
|
114
|
+
}());
|
|
115
|
+
exports.default = Utils;
|
|
116
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,iFAA2D;AAC3D,mFAA6D;AAE7D;IAAA;IAwEA,CAAC;IAvEe,kBAAY,GAA1B,UAA2B,OAAe;QACxC,IAAI,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;YACpC,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YA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AC,CAAC,CAAC;gBAC/B,CAAC;YACH,CAAC,CAAC;YACF,EAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC;IACH,YAAC;AAAD,CAAC,AAxED,IAwEC;AAED,kBAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var ClosedException = /** @class */ (function (_super) {
|
|
17
|
+
__extends(ClosedException, _super);
|
|
18
|
+
function ClosedException(message) {
|
|
19
|
+
return _super.call(this, message !== null && message !== void 0 ? message : "WebSocket has been closed") || this;
|
|
20
|
+
}
|
|
21
|
+
return ClosedException;
|
|
22
|
+
}(Error));
|
|
23
|
+
export default ClosedException;
|
|
24
|
+
//# sourceMappingURL=ClosedException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClosedException.js","sourceRoot":"","sources":["../../../src/exceptions/ClosedException.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;IAA8B,mCAAK;IACjC,yBAAmB,OAAgB;QACjC,OAAA,MAAK,YAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,2BAA2B,CAAC,SAAC;IAChD,CAAC;IACH,sBAAC;AAAD,CAAC,AAJD,CAA8B,KAAK,GAIlC;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
import Utils from "../utils";
|
|
17
|
+
var ConnectionException = /** @class */ (function (_super) {
|
|
18
|
+
__extends(ConnectionException, _super);
|
|
19
|
+
function ConnectionException(wsgEvent) {
|
|
20
|
+
var _this = this;
|
|
21
|
+
var _a = Utils.splitWsgData(wsgEvent.data), wsgError = _a[1];
|
|
22
|
+
_this = _super.call(this, JSON.stringify(wsgError, null, 2)) || this;
|
|
23
|
+
_this.wsgEvent = wsgEvent;
|
|
24
|
+
_this.wsgError = wsgError;
|
|
25
|
+
return _this;
|
|
26
|
+
}
|
|
27
|
+
return ConnectionException;
|
|
28
|
+
}(Error));
|
|
29
|
+
export default ConnectionException;
|
|
30
|
+
//# sourceMappingURL=ConnectionException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectionException.js","sourceRoot":"","sources":["../../../src/exceptions/ConnectionException.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,OAAO,KAAK,MAAM,UAAU,CAAC;AAE7B;IAAkC,uCAAK;IAKrC,6BAAmB,QAAkB;QAArC,iBAKC;QAJO,IAAA,KAAoC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAlE,QAAQ,QAA0D,CAAC;QAC5E,QAAA,MAAK,YAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAC;QACzC,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;;IAC3B,CAAC;IACH,0BAAC;AAAD,CAAC,AAXD,CAAkC,KAAK,GAWtC;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var TimeoutException = /** @class */ (function (_super) {
|
|
17
|
+
__extends(TimeoutException, _super);
|
|
18
|
+
function TimeoutException(message) {
|
|
19
|
+
return _super.call(this, message !== null && message !== void 0 ? message : "Failed to receive expected WebSocket message in time.") || this;
|
|
20
|
+
}
|
|
21
|
+
return TimeoutException;
|
|
22
|
+
}(Error));
|
|
23
|
+
export default TimeoutException;
|
|
24
|
+
//# sourceMappingURL=TimeoutException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeoutException.js","sourceRoot":"","sources":["../../../src/exceptions/TimeoutException.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;IAA+B,oCAAK;IAClC,0BAAmB,OAAgB;QACjC,OAAA,MAAK,YAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,uDAAuD,CAAC,SAAC;IAC5E,CAAC;IACH,uBAAC;AAAD,CAAC,AAJD,CAA+B,KAAK,GAInC;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type RingCentral from "@rc-ex/core";
|
|
2
|
-
import SdkExtension from "@rc-ex/core/
|
|
1
|
+
import type RingCentral from "@rc-ex/core/index";
|
|
2
|
+
import SdkExtension from "@rc-ex/core/SdkExtension";
|
|
3
3
|
import WS from "isomorphic-ws";
|
|
4
4
|
import { EventEmitter } from "events";
|
|
5
|
-
import type SubscriptionInfo from "@rc-ex/core/
|
|
6
|
-
import { request } from "./rest
|
|
7
|
-
import type { ConnectionDetails, WebSocketOptions, Wsc, WsToken } from "./types
|
|
8
|
-
import Subscription from "./subscription
|
|
5
|
+
import type SubscriptionInfo from "@rc-ex/core/definitions/SubscriptionInfo";
|
|
6
|
+
import { request } from "./rest";
|
|
7
|
+
import type { ConnectionDetails, WebSocketOptions, Wsc, WsToken } from "./types";
|
|
8
|
+
import Subscription from "./subscription";
|
|
9
9
|
export declare enum Events {
|
|
10
10
|
autoRecoverSuccess = "autoRecoverSuccess",
|
|
11
11
|
autoRecoverFailed = "autoRecoverFailed",
|