@rc-ex/auto-refresh 0.2.0 → 0.2.1
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 +8 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +5 -3
package/README.md
CHANGED
|
@@ -21,8 +21,14 @@ autoRefreshExtension.start();
|
|
|
21
21
|
// autoRefreshExtension.stop();
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
For a working sample, please check this
|
|
24
|
+
For a working sample, please check this
|
|
25
|
+
[test case](../../../test/auto-refresh-extension.spec.ts).
|
|
25
26
|
|
|
26
27
|
## Disclaimer
|
|
27
28
|
|
|
28
|
-
[Token management](https://medium.com/ringcentral-developers/ringcentral-token-management-477578f00954)
|
|
29
|
+
[Token management](https://medium.com/ringcentral-developers/ringcentral-token-management-477578f00954)
|
|
30
|
+
is a complicated topic. There is no one-fit-all solution. This extension is an
|
|
31
|
+
quick-and-dirty out-of-box solution to refresh your token. It is by no means the
|
|
32
|
+
best practice. It simply starts a background timers to refresh your token
|
|
33
|
+
periodically. For serious production applications, you may need better token
|
|
34
|
+
management strategy.
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type RingCentral from
|
|
2
|
-
import SdkExtension from
|
|
1
|
+
import type RingCentral from "@rc-ex/core";
|
|
2
|
+
import SdkExtension from "@rc-ex/core/lib/SdkExtension";
|
|
3
3
|
export interface AutoRefreshOptions {
|
|
4
4
|
interval: number;
|
|
5
5
|
}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AACA,gFAAwD;AAMxD,MAAM,oBAAqB,SAAQ,sBAAY;IAK7C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AACA,gFAAwD;AAMxD,MAAM,oBAAqB,SAAQ,sBAAY;IAK7C,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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rc-ex/auto-refresh",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
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",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@rc-ex/core": "^1.5.
|
|
21
|
+
"@rc-ex/core": "^1.5.1"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "1a8a5becc832b92af73f1ad1f58b87f38fee3650"
|
|
24
24
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type RingCentral from
|
|
2
|
-
import SdkExtension from
|
|
1
|
+
import type RingCentral from "@rc-ex/core";
|
|
2
|
+
import SdkExtension from "@rc-ex/core/lib/SdkExtension";
|
|
3
3
|
|
|
4
4
|
export interface AutoRefreshOptions {
|
|
5
5
|
interval: number;
|
|
@@ -10,7 +10,9 @@ class AutoRefreshExtension extends SdkExtension {
|
|
|
10
10
|
public options: AutoRefreshOptions;
|
|
11
11
|
private timeout?: NodeJS.Timeout;
|
|
12
12
|
|
|
13
|
-
public constructor(
|
|
13
|
+
public constructor(
|
|
14
|
+
options: AutoRefreshOptions = { interval: 1000 * 60 * 30 },
|
|
15
|
+
) {
|
|
14
16
|
super();
|
|
15
17
|
this.options = options;
|
|
16
18
|
}
|