@polkadot/rpc-core 9.14.2 → 10.1.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.
@@ -1,12 +1,5 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _packageInfo = require("@polkadot/rpc-provider/cjs/packageInfo");
8
- var _packageInfo2 = require("@polkadot/types/cjs/packageInfo");
9
- // Copyright 2017-2023 @polkadot/rpc-core authors & contributors
10
- // SPDX-License-Identifier: Apache-2.0
11
- var _default = [_packageInfo.packageInfo, _packageInfo2.packageInfo];
12
- exports.default = _default;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const packageInfo_1 = require("@polkadot/rpc-provider/cjs/packageInfo");
4
+ const packageInfo_2 = require("@polkadot/types/cjs/packageInfo");
5
+ exports.default = [packageInfo_1.packageInfo, packageInfo_2.packageInfo];
@@ -1,12 +1,7 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _util = require("@polkadot/util");
5
- var _detectOther = _interopRequireDefault(require("./detectOther"));
6
- var _packageInfo = require("./packageInfo");
7
- // Copyright 2017-2023 @polkadot/rpc-core authors & contributors
8
- // SPDX-License-Identifier: Apache-2.0
9
-
10
- // Do not edit, auto-generated by @polkadot/dev
11
-
12
- (0, _util.detectPackage)(_packageInfo.packageInfo, null, _detectOther.default);
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const util_1 = require("@polkadot/util");
5
+ const detectOther_js_1 = tslib_1.__importDefault(require("./detectOther.js"));
6
+ const packageInfo_js_1 = require("./packageInfo.js");
7
+ (0, util_1.detectPackage)(packageInfo_js_1.packageInfo, null, detectOther_js_1.default);
package/cjs/index.js CHANGED
@@ -1,17 +1,5 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- require("./detectPackage");
7
- var _bundle = require("./bundle");
8
- Object.keys(_bundle).forEach(function (key) {
9
- if (key === "default" || key === "__esModule") return;
10
- if (key in exports && exports[key] === _bundle[key]) return;
11
- Object.defineProperty(exports, key, {
12
- enumerable: true,
13
- get: function () {
14
- return _bundle[key];
15
- }
16
- });
17
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ require("./detectPackage.js");
5
+ tslib_1.__exportStar(require("./bundle.js"), exports);
@@ -1,18 +1,4 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.packageInfo = void 0;
7
- // Copyright 2017-2023 @polkadot/rpc-core authors & contributors
8
- // SPDX-License-Identifier: Apache-2.0
9
-
10
- // Do not edit, auto-generated by @polkadot/dev
11
-
12
- const packageInfo = {
13
- name: '@polkadot/rpc-core',
14
- path: typeof __dirname === 'string' ? __dirname : 'auto',
15
- type: 'cjs',
16
- version: '9.14.2'
17
- };
18
- exports.packageInfo = packageInfo;
4
+ exports.packageInfo = { name: '@polkadot/rpc-core', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '10.1.1' };
package/cjs/types/base.js CHANGED
@@ -1 +1,2 @@
1
- "use strict";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,27 +1,5 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _jsonrpc = require("@polkadot/rpc-core/types/jsonrpc");
7
- Object.keys(_jsonrpc).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _jsonrpc[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _jsonrpc[key];
14
- }
15
- });
16
- });
17
- var _base = require("./base");
18
- Object.keys(_base).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _base[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _base[key];
25
- }
26
- });
27
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("@polkadot/rpc-core/types/jsonrpc"), exports);
5
+ tslib_1.__exportStar(require("./base.js"), exports);
@@ -1 +1,2 @@
1
- "use strict";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/cjs/util/drr.js CHANGED
@@ -1,44 +1,32 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.drr = drr;
7
- var _rxjs = require("rxjs");
8
- var _util = require("@polkadot/util");
9
- var _refCountDelay = require("./refCountDelay");
10
- // Copyright 2017-2023 @polkadot/rpc-core authors & contributors
11
- // SPDX-License-Identifier: Apache-2.0
12
-
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.drr = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const util_1 = require("@polkadot/util");
6
+ const refCountDelay_js_1 = require("./refCountDelay.js");
13
7
  function CMP(a, b) {
14
- return (0, _util.stringify)({
15
- t: a
16
- }) === (0, _util.stringify)({
17
- t: b
18
- });
8
+ return (0, util_1.stringify)({ t: a }) === (0, util_1.stringify)({ t: b });
19
9
  }
20
10
  function ERR(error) {
21
- throw error;
11
+ throw error;
22
12
  }
23
13
  function NOOP() {
24
- // empty
14
+ // empty
25
15
  }
26
-
27
16
  /**
28
17
  * Shorthand for distinctUntilChanged(), publishReplay(1) and refCount().
29
18
  *
30
19
  * @ignore
31
20
  * @internal
32
21
  */
33
- function drr() {
34
- let {
35
- delay,
36
- skipChange = false,
37
- skipTimeout = false
38
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
39
- return source$ => source$.pipe((0, _rxjs.catchError)(ERR), skipChange ? (0, _rxjs.tap)(NOOP) : (0, _rxjs.distinctUntilChanged)(CMP),
40
- // eslint-disable-next-line deprecation/deprecation
41
- (0, _rxjs.publishReplay)(1), skipTimeout
42
- // eslint-disable-next-line deprecation/deprecation
43
- ? (0, _rxjs.refCount)() : (0, _refCountDelay.refCountDelay)(delay));
44
- }
22
+ function drr({ delay, skipChange = false, skipTimeout = false } = {}) {
23
+ return (source$) => source$.pipe((0, rxjs_1.catchError)(ERR), skipChange
24
+ ? (0, rxjs_1.tap)(NOOP)
25
+ : (0, rxjs_1.distinctUntilChanged)(CMP),
26
+ // eslint-disable-next-line deprecation/deprecation
27
+ (0, rxjs_1.publishReplay)(1), skipTimeout
28
+ // eslint-disable-next-line deprecation/deprecation
29
+ ? (0, rxjs_1.refCount)()
30
+ : (0, refCountDelay_js_1.refCountDelay)(delay));
31
+ }
32
+ exports.drr = drr;
package/cjs/util/index.js CHANGED
@@ -1,38 +1,6 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _drr = require("./drr");
7
- Object.keys(_drr).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _drr[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _drr[key];
14
- }
15
- });
16
- });
17
- var _memo = require("./memo");
18
- Object.keys(_memo).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _memo[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _memo[key];
25
- }
26
- });
27
- });
28
- var _refCountDelay = require("./refCountDelay");
29
- Object.keys(_refCountDelay).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _refCountDelay[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _refCountDelay[key];
36
- }
37
- });
38
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./drr.js"), exports);
5
+ tslib_1.__exportStar(require("./memo.js"), exports);
6
+ tslib_1.__exportStar(require("./refCountDelay.js"), exports);
package/cjs/util/memo.js CHANGED
@@ -1,35 +1,19 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.memo = memo;
7
- var _rxjs = require("rxjs");
8
- var _util = require("@polkadot/util");
9
- var _drr = require("./drr");
10
- // Copyright 2017-2023 @polkadot/api-derive authors & contributors
11
- // SPDX-License-Identifier: Apache-2.0
12
-
13
- // Wraps a derive, doing 2 things to optimize calls -
14
- // 1. creates a memo of the inner fn -> Observable, removing when unsubscribed
15
- // 2. wraps the observable in a drr() (which includes an unsub delay)
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.memo = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const util_1 = require("@polkadot/util");
6
+ const drr_js_1 = require("./drr.js");
16
7
  /** @internal */
17
- // eslint-disable-next-line @typescript-eslint/ban-types
18
8
  function memo(instanceId, inner) {
19
- const options = {
20
- getInstanceId: () => instanceId
21
- };
22
- const cached = (0, _util.memoize)(function () {
23
- for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
24
- params[_key] = arguments[_key];
25
- }
26
- return new _rxjs.Observable(observer => {
27
- const subscription = inner(...params).subscribe(observer);
28
- return () => {
29
- cached.unmemoize(...params);
30
- subscription.unsubscribe();
31
- };
32
- }).pipe((0, _drr.drr)());
33
- }, options);
34
- return cached;
35
- }
9
+ const options = { getInstanceId: () => instanceId };
10
+ const cached = (0, util_1.memoize)((...params) => new rxjs_1.Observable((observer) => {
11
+ const subscription = inner(...params).subscribe(observer);
12
+ return () => {
13
+ cached.unmemoize(...params);
14
+ subscription.unsubscribe();
15
+ };
16
+ }).pipe((0, drr_js_1.drr)()), options);
17
+ return cached;
18
+ }
19
+ exports.memo = memo;
@@ -1,45 +1,41 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.refCountDelay = refCountDelay;
7
- var _rxjs = require("rxjs");
8
- // Copyright 2017-2023 @polkadot/rpc-core authors & contributors
9
- // SPDX-License-Identifier: Apache-2.0
10
-
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.refCountDelay = void 0;
4
+ const rxjs_1 = require("rxjs");
11
5
  /** @internal */
12
- function refCountDelay() {
13
- let delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1750;
14
- return source => {
15
- // state: 0 = disconnected, 1 = disconnecting, 2 = connecting, 3 = connected
16
- let [state, refCount, connection, scheduler] = [0, 0, _rxjs.Subscription.EMPTY, _rxjs.Subscription.EMPTY];
17
- return new _rxjs.Observable(ob => {
18
- source.subscribe(ob);
19
- if (refCount++ === 0) {
20
- if (state === 1) {
21
- scheduler.unsubscribe();
22
- } else {
23
- // eslint-disable-next-line deprecation/deprecation
24
- connection = source.connect();
25
- }
26
- state = 3;
27
- }
28
- return () => {
29
- if (--refCount === 0) {
30
- if (state === 2) {
31
- state = 0;
32
- scheduler.unsubscribe();
33
- } else {
34
- // state === 3
35
- state = 1;
36
- scheduler = _rxjs.asapScheduler.schedule(() => {
37
- state = 0;
38
- connection.unsubscribe();
39
- }, delay);
40
- }
41
- }
42
- };
43
- });
44
- };
45
- }
6
+ function refCountDelay(delay = 1750) {
7
+ return (source) => {
8
+ // state: 0 = disconnected, 1 = disconnecting, 2 = connecting, 3 = connected
9
+ let [state, refCount, connection, scheduler] = [0, 0, rxjs_1.Subscription.EMPTY, rxjs_1.Subscription.EMPTY];
10
+ return new rxjs_1.Observable((ob) => {
11
+ source.subscribe(ob);
12
+ if (refCount++ === 0) {
13
+ if (state === 1) {
14
+ scheduler.unsubscribe();
15
+ }
16
+ else {
17
+ // eslint-disable-next-line deprecation/deprecation
18
+ connection = source.connect();
19
+ }
20
+ state = 3;
21
+ }
22
+ return () => {
23
+ if (--refCount === 0) {
24
+ if (state === 2) {
25
+ state = 0;
26
+ scheduler.unsubscribe();
27
+ }
28
+ else {
29
+ // state === 3
30
+ state = 1;
31
+ scheduler = rxjs_1.asapScheduler.schedule(() => {
32
+ state = 0;
33
+ connection.unsubscribe();
34
+ }, delay);
35
+ }
36
+ }
37
+ };
38
+ });
39
+ };
40
+ }
41
+ exports.refCountDelay = refCountDelay;
package/detectOther.js CHANGED
@@ -1,6 +1,3 @@
1
- // Copyright 2017-2023 @polkadot/rpc-core authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
1
  import { packageInfo as providerInfo } from '@polkadot/rpc-provider/packageInfo';
5
2
  import { packageInfo as typesInfo } from '@polkadot/types/packageInfo';
6
3
  export default [providerInfo, typesInfo];
package/detectPackage.js CHANGED
@@ -1,9 +1,4 @@
1
- // Copyright 2017-2023 @polkadot/rpc-core authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- // Do not edit, auto-generated by @polkadot/dev
5
-
6
1
  import { detectPackage } from '@polkadot/util';
7
- import others from "./detectOther.js";
8
- import { packageInfo } from "./packageInfo.js";
2
+ import others from './detectOther.js';
3
+ import { packageInfo } from './packageInfo.js';
9
4
  detectPackage(packageInfo, null, others);
package/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import './detectPackage';
2
- export * from './bundle';
1
+ import './detectPackage.js';
2
+ export * from './bundle.js';
package/index.js CHANGED
@@ -1,5 +1,2 @@
1
- // Copyright 2017-2023 @polkadot/rpc-core authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import "./detectPackage.js";
5
- export * from "./bundle.js";
1
+ import './detectPackage.js';
2
+ export * from './bundle.js';
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "./cjs/detectPackage.js"
21
21
  ],
22
22
  "type": "module",
23
- "version": "9.14.2",
23
+ "version": "10.1.1",
24
24
  "main": "./cjs/index.js",
25
25
  "module": "./index.js",
26
26
  "types": "./index.d.ts",
@@ -47,7 +47,10 @@
47
47
  "require": "./cjs/detectPackage.js",
48
48
  "default": "./detectPackage.js"
49
49
  },
50
- "./package.json": "./package.json",
50
+ "./package.json": {
51
+ "require": "./cjs/package.json",
52
+ "default": "./package.json"
53
+ },
51
54
  "./packageInfo.js": {
52
55
  "types": "./packageInfo.d.ts",
53
56
  "require": "./cjs/packageInfo.js",
@@ -95,11 +98,11 @@
95
98
  }
96
99
  },
97
100
  "dependencies": {
98
- "@babel/runtime": "^7.20.13",
99
- "@polkadot/rpc-augment": "9.14.2",
100
- "@polkadot/rpc-provider": "9.14.2",
101
- "@polkadot/types": "9.14.2",
102
- "@polkadot/util": "^10.4.2",
103
- "rxjs": "^7.8.0"
101
+ "@polkadot/rpc-augment": "10.1.1",
102
+ "@polkadot/rpc-provider": "10.1.1",
103
+ "@polkadot/types": "10.1.1",
104
+ "@polkadot/util": "^11.0.2",
105
+ "rxjs": "^7.8.0",
106
+ "tslib": "^2.5.0"
104
107
  }
105
108
  }
package/packageInfo.js CHANGED
@@ -1,11 +1 @@
1
- // Copyright 2017-2023 @polkadot/rpc-core authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- // Do not edit, auto-generated by @polkadot/dev
5
-
6
- export const packageInfo = {
7
- name: '@polkadot/rpc-core',
8
- path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
9
- type: 'esm',
10
- version: '9.14.2'
11
- };
1
+ export const packageInfo = { name: '@polkadot/rpc-core', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '10.1.1' };
package/types/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export * from '@polkadot/rpc-core/types/jsonrpc';
2
- export * from './base';
2
+ export * from './base.js';
package/types/index.js CHANGED
@@ -1,8 +1,2 @@
1
- // Copyright 2017-2023 @polkadot/rpc-core authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- // augmented, do an augmentation export
5
1
  export * from '@polkadot/rpc-core/types/jsonrpc';
6
-
7
- // normal exports
8
- export * from "./base.js";
2
+ export * from './base.js';
package/util/drr.js CHANGED
@@ -1,37 +1,28 @@
1
- // Copyright 2017-2023 @polkadot/rpc-core authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
1
  import { catchError, distinctUntilChanged, publishReplay, refCount, tap } from 'rxjs';
5
2
  import { stringify } from '@polkadot/util';
6
- import { refCountDelay } from "./refCountDelay.js";
3
+ import { refCountDelay } from './refCountDelay.js';
7
4
  function CMP(a, b) {
8
- return stringify({
9
- t: a
10
- }) === stringify({
11
- t: b
12
- });
5
+ return stringify({ t: a }) === stringify({ t: b });
13
6
  }
14
7
  function ERR(error) {
15
- throw error;
8
+ throw error;
16
9
  }
17
10
  function NOOP() {
18
- // empty
11
+ // empty
19
12
  }
20
-
21
13
  /**
22
14
  * Shorthand for distinctUntilChanged(), publishReplay(1) and refCount().
23
15
  *
24
16
  * @ignore
25
17
  * @internal
26
18
  */
27
- export function drr({
28
- delay,
29
- skipChange = false,
30
- skipTimeout = false
31
- } = {}) {
32
- return source$ => source$.pipe(catchError(ERR), skipChange ? tap(NOOP) : distinctUntilChanged(CMP),
33
- // eslint-disable-next-line deprecation/deprecation
34
- publishReplay(1), skipTimeout
35
- // eslint-disable-next-line deprecation/deprecation
36
- ? refCount() : refCountDelay(delay));
19
+ export function drr({ delay, skipChange = false, skipTimeout = false } = {}) {
20
+ return (source$) => source$.pipe(catchError(ERR), skipChange
21
+ ? tap(NOOP)
22
+ : distinctUntilChanged(CMP),
23
+ // eslint-disable-next-line deprecation/deprecation
24
+ publishReplay(1), skipTimeout
25
+ // eslint-disable-next-line deprecation/deprecation
26
+ ? refCount()
27
+ : refCountDelay(delay));
37
28
  }
package/util/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './drr';
2
- export * from './memo';
3
- export * from './refCountDelay';
1
+ export * from './drr.js';
2
+ export * from './memo.js';
3
+ export * from './refCountDelay.js';
package/util/index.js CHANGED
@@ -1,6 +1,3 @@
1
- // Copyright 2017-2023 @polkadot/rpc-core authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- export * from "./drr.js";
5
- export * from "./memo.js";
6
- export * from "./refCountDelay.js";
1
+ export * from './drr.js';
2
+ export * from './memo.js';
3
+ export * from './refCountDelay.js';
package/util/memo.js CHANGED
@@ -1,24 +1,15 @@
1
- // Copyright 2017-2023 @polkadot/api-derive authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
1
  import { Observable } from 'rxjs';
5
2
  import { memoize } from '@polkadot/util';
6
- import { drr } from "./drr.js";
7
- // Wraps a derive, doing 2 things to optimize calls -
8
- // 1. creates a memo of the inner fn -> Observable, removing when unsubscribed
9
- // 2. wraps the observable in a drr() (which includes an unsub delay)
3
+ import { drr } from './drr.js';
10
4
  /** @internal */
11
- // eslint-disable-next-line @typescript-eslint/ban-types
12
5
  export function memo(instanceId, inner) {
13
- const options = {
14
- getInstanceId: () => instanceId
15
- };
16
- const cached = memoize((...params) => new Observable(observer => {
17
- const subscription = inner(...params).subscribe(observer);
18
- return () => {
19
- cached.unmemoize(...params);
20
- subscription.unsubscribe();
21
- };
22
- }).pipe(drr()), options);
23
- return cached;
6
+ const options = { getInstanceId: () => instanceId };
7
+ const cached = memoize((...params) => new Observable((observer) => {
8
+ const subscription = inner(...params).subscribe(observer);
9
+ return () => {
10
+ cached.unmemoize(...params);
11
+ subscription.unsubscribe();
12
+ };
13
+ }).pipe(drr()), options);
14
+ return cached;
24
15
  }