@rc-ex/auto-refresh 0.3.1 → 0.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/{lib/esm → dist/cjs}/index.d.ts +2 -2
- package/{lib → dist/cjs}/index.js +2 -2
- package/dist/cjs/index.js.map +1 -0
- package/{lib → dist/esm}/index.d.ts +2 -2
- package/dist/esm/index.js +93 -0
- package/dist/esm/index.js.map +1 -0
- package/package.json +13 -9
- package/src/index.ts +2 -2
- package/tsconfig.cjs.json +16 -0
- package/tsconfig.esm.json +16 -0
- package/lib/esm/index.js +0 -35
- package/lib/esm/index.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/tsconfig.json +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
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
|
export interface AutoRefreshOptions {
|
|
4
4
|
interval: number;
|
|
5
5
|
}
|
|
@@ -54,7 +54,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
54
54
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
55
|
};
|
|
56
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
-
var
|
|
57
|
+
var SdkExtension_1 = __importDefault(require("@rc-ex/core/SdkExtension"));
|
|
58
58
|
var AutoRefreshExtension = /** @class */ (function (_super) {
|
|
59
59
|
__extends(AutoRefreshExtension, _super);
|
|
60
60
|
function AutoRefreshExtension(options) {
|
|
@@ -93,6 +93,6 @@ var AutoRefreshExtension = /** @class */ (function (_super) {
|
|
|
93
93
|
});
|
|
94
94
|
};
|
|
95
95
|
return AutoRefreshExtension;
|
|
96
|
-
}(
|
|
96
|
+
}(SdkExtension_1.default));
|
|
97
97
|
exports.default = AutoRefreshExtension;
|
|
98
98
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0EAAoD;AAMpD;IAAmC,wCAAY;IAK7C,8BACE,OAA0D;QAA1D,wBAAA,EAAA,YAAgC,QAAQ,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,EAAE;QAE1D,YAAA,MAAK,WAAE,SAAC;QACR,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;;IACzB,CAAC;IAEY,sCAAO,GAApB,UAAqB,EAAe;;;gBAClC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;;;;KACd;IAEM,oCAAK,GAAZ;QAAA,iBAKC;QAJC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,gBAAgB;QAC7B,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC;YACzB,KAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAEM,mCAAI,GAAX;QACE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC5B,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QAC3B,CAAC;IACH,CAAC;IAEY,qCAAM,GAAnB;;;gBACE,IAAI,CAAC,IAAI,EAAE,CAAC;;;;KACb;IACH,2BAAC;AAAD,CAAC,AAjCD,CAAmC,sBAAY,GAiC9C;AAED,kBAAe,oBAAoB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
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
|
export interface AutoRefreshOptions {
|
|
4
4
|
interval: number;
|
|
5
5
|
}
|
|
@@ -0,0 +1,93 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
+
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);
|
|
27
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
+
function step(op) {
|
|
30
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
32
|
+
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;
|
|
33
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
+
switch (op[0]) {
|
|
35
|
+
case 0: case 1: t = op; break;
|
|
36
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
+
default:
|
|
40
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
+
if (t[2]) _.ops.pop();
|
|
45
|
+
_.trys.pop(); continue;
|
|
46
|
+
}
|
|
47
|
+
op = body.call(thisArg, _);
|
|
48
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
import SdkExtension from "@rc-ex/core/SdkExtension";
|
|
53
|
+
var AutoRefreshExtension = /** @class */ (function (_super) {
|
|
54
|
+
__extends(AutoRefreshExtension, _super);
|
|
55
|
+
function AutoRefreshExtension(options) {
|
|
56
|
+
if (options === void 0) { options = { interval: 1000 * 60 * 30 }; }
|
|
57
|
+
var _this = _super.call(this) || this;
|
|
58
|
+
_this.options = options;
|
|
59
|
+
return _this;
|
|
60
|
+
}
|
|
61
|
+
AutoRefreshExtension.prototype.install = function (rc) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
+
return __generator(this, function (_a) {
|
|
64
|
+
this.rc = rc;
|
|
65
|
+
return [2 /*return*/];
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
AutoRefreshExtension.prototype.start = function () {
|
|
70
|
+
var _this = this;
|
|
71
|
+
this.stop(); // stop existing
|
|
72
|
+
this.timeout = setInterval(function () {
|
|
73
|
+
_this.rc.refresh();
|
|
74
|
+
}, this.options.interval);
|
|
75
|
+
};
|
|
76
|
+
AutoRefreshExtension.prototype.stop = function () {
|
|
77
|
+
if (this.timeout) {
|
|
78
|
+
clearInterval(this.timeout);
|
|
79
|
+
this.timeout = undefined;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
AutoRefreshExtension.prototype.revoke = function () {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
84
|
+
return __generator(this, function (_a) {
|
|
85
|
+
this.stop();
|
|
86
|
+
return [2 /*return*/];
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
return AutoRefreshExtension;
|
|
91
|
+
}(SdkExtension));
|
|
92
|
+
export default AutoRefreshExtension;
|
|
93
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,YAAY,MAAM,0BAA0B,CAAC;AAMpD;IAAmC,wCAAY;IAK7C,8BACE,OAA0D;QAA1D,wBAAA,EAAA,YAAgC,QAAQ,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,EAAE;QAE1D,YAAA,MAAK,WAAE,SAAC;QACR,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;;IACzB,CAAC;IAEY,sCAAO,GAApB,UAAqB,EAAe;;;gBAClC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;;;;KACd;IAEM,oCAAK,GAAZ;QAAA,iBAKC;QAJC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,gBAAgB;QAC7B,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC;YACzB,KAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAEM,mCAAI,GAAX;QACE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC5B,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QAC3B,CAAC;IACH,CAAC;IAEY,qCAAM,GAAnB;;;gBACE,IAAI,CAAC,IAAI,EAAE,CAAC;;;;KACb;IACH,2BAAC;AAAD,CAAC,AAjCD,CAAmC,YAAY,GAiC9C;AAED,eAAe,oBAAoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rc-ex/auto-refresh",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Auto Refresh extension for ringcentral-extensible project",
|
|
5
5
|
"author": "Tyler Liu <tyler.liu@ringcentral.com>",
|
|
6
6
|
"homepage": "https://github.com/ringcentral/ringcentral-extensible/tree/master/packages/extensions/auto-refresh",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"module": "
|
|
8
|
+
"main": "dist/cjs/index.js",
|
|
9
|
+
"types": "dist/cjs/index.d.ts",
|
|
10
|
+
"module": "dist/esm/index.js",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/esm/index.js",
|
|
14
|
+
"require": "./dist/cjs/index.js",
|
|
15
|
+
"types": "./dist/esm/index.d.ts"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
11
18
|
"repository": {
|
|
12
19
|
"type": "git",
|
|
13
20
|
"url": "git+https://github.com/ringcentral/ringcentral-extensible.git"
|
|
@@ -18,11 +25,8 @@
|
|
|
18
25
|
"publishConfig": {
|
|
19
26
|
"access": "public"
|
|
20
27
|
},
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"@rc-ex/core": "^1.6.1"
|
|
23
|
-
},
|
|
24
28
|
"scripts": {
|
|
25
|
-
"
|
|
29
|
+
"build": "tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json"
|
|
26
30
|
},
|
|
27
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "4a3dfa3b7c78e8460c531bcdd82802c7fcf3eee3"
|
|
28
32
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
|
|
|
4
4
|
export interface AutoRefreshOptions {
|
|
5
5
|
interval: number;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"esModuleInterop": true,
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"outDir": "./dist/cjs",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"paths": {
|
|
10
|
+
"@rc-ex/core/*": [
|
|
11
|
+
"../../core/dist/cjs/*"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"include": ["src/**/*.ts"]
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"esModuleInterop": true,
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"outDir": "./dist/esm",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"paths": {
|
|
10
|
+
"@rc-ex/core/*": [
|
|
11
|
+
"../../core/dist/esm/*"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"include": ["src/**/*.ts"]
|
|
16
|
+
}
|
package/lib/esm/index.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const SdkExtension_js_1 = __importDefault(require("@rc-ex/core/lib/esm/SdkExtension.js"));
|
|
7
|
-
class AutoRefreshExtension extends SdkExtension_js_1.default {
|
|
8
|
-
rc;
|
|
9
|
-
options;
|
|
10
|
-
timeout;
|
|
11
|
-
constructor(options = { interval: 1000 * 60 * 30 }) {
|
|
12
|
-
super();
|
|
13
|
-
this.options = options;
|
|
14
|
-
}
|
|
15
|
-
async install(rc) {
|
|
16
|
-
this.rc = rc;
|
|
17
|
-
}
|
|
18
|
-
start() {
|
|
19
|
-
this.stop(); // stop existing
|
|
20
|
-
this.timeout = setInterval(() => {
|
|
21
|
-
this.rc.refresh();
|
|
22
|
-
}, this.options.interval);
|
|
23
|
-
}
|
|
24
|
-
stop() {
|
|
25
|
-
if (this.timeout) {
|
|
26
|
-
clearInterval(this.timeout);
|
|
27
|
-
this.timeout = undefined;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
async revoke() {
|
|
31
|
-
this.stop();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.default = AutoRefreshExtension;
|
|
35
|
-
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;AACA,0FAA+D;AAM/D,MAAM,oBAAqB,SAAQ,yBAAY;IACtC,EAAE,CAAe;IACjB,OAAO,CAAqB;IAC3B,OAAO,CAAkB;IAEjC,YACE,UAA8B,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,EAAE;QAE1D,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,EAAe;QAClC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,gBAAgB;QAC7B,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE;YAC9B,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAEM,IAAI;QACT,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC5B,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QAC3B,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,MAAM;QACjB,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;CACF;AAED,kBAAe,oBAAoB,CAAC"}
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wFAA+D;AAM/D;IAAmC,wCAAY;IAK7C,8BACE,OAA0D;QAA1D,wBAAA,EAAA,YAAgC,QAAQ,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,EAAE;QAE1D,YAAA,MAAK,WAAE,SAAC;QACR,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;;IACzB,CAAC;IAEY,sCAAO,GAApB,UAAqB,EAAe;;;gBAClC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;;;;KACd;IAEM,oCAAK,GAAZ;QAAA,iBAKC;QAJC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,gBAAgB;QAC7B,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC;YACzB,KAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAEM,mCAAI,GAAX;QACE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC5B,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QAC3B,CAAC;IACH,CAAC;IAEY,qCAAM,GAAnB;;;gBACE,IAAI,CAAC,IAAI,EAAE,CAAC;;;;KACb;IACH,2BAAC;AAAD,CAAC,AAjCD,CAAmC,yBAAY,GAiC9C;AAED,kBAAe,oBAAoB,CAAC"}
|
package/tsconfig.json
DELETED