@polkadot/rpc-core 6.6.2-6 → 6.7.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/bundle.cjs CHANGED
@@ -17,8 +17,6 @@ Object.defineProperty(exports, "packageInfo", {
17
17
  }
18
18
  });
19
19
 
20
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
21
-
22
20
  var _classPrivateFieldLooseBase2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldLooseBase"));
23
21
 
24
22
  var _classPrivateFieldLooseKey2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldLooseKey"));
@@ -45,10 +43,8 @@ Object.keys(_index).forEach(function (key) {
45
43
 
46
44
  var _packageInfo = require("./packageInfo.cjs");
47
45
 
48
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
49
-
50
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
51
-
46
+ // Copyright 2017-2021 @polkadot/rpc-core authors & contributors
47
+ // SPDX-License-Identifier: Apache-2.0
52
48
  const l = (0, _util.logger)('rpc-core');
53
49
  const EMPTY_META = {
54
50
  fallback: undefined,
@@ -67,15 +63,19 @@ const EMPTY_META = {
67
63
 
68
64
  /** @internal */
69
65
 
70
- function logErrorMessage(method, {
71
- params,
72
- type
73
- }, error) {
74
- const inputs = params.map(({
75
- isOptional,
76
- name,
66
+ function logErrorMessage(method, _ref, error) {
67
+ let {
68
+ params,
77
69
  type
78
- }) => `${name}${isOptional ? '?' : ''}: ${type}`).join(', ');
70
+ } = _ref;
71
+ const inputs = params.map(_ref2 => {
72
+ let {
73
+ isOptional,
74
+ name,
75
+ type
76
+ } = _ref2;
77
+ return `${name}${isOptional ? '?' : ''}: ${type}`;
78
+ }).join(', ');
79
79
  l.error(`${method}(${inputs}): ${type}:: ${error.message}`);
80
80
  }
81
81
 
@@ -123,7 +123,8 @@ class RpcCore {
123
123
  * Default constructor for the Api Object
124
124
  * @param {ProviderInterface} provider An API provider using HTTP or WebSocket
125
125
  */
126
- constructor(instanceId, registry, provider, userRpc = {}) {
126
+ constructor(instanceId, registry, provider) {
127
+ let userRpc = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
127
128
  Object.defineProperty(this, _instanceId, {
128
129
  writable: true,
129
130
  value: void 0
@@ -191,37 +192,35 @@ class RpcCore {
191
192
 
192
193
  addUserInterfaces(userRpc) {
193
194
  // add any extra user-defined sections
194
- this.sections.push(...Object.keys(userRpc).filter(key => !this.sections.includes(key))); // decorate the sections with base and user methods
195
-
196
- this.sections.forEach(sectionName => {
197
- var _ref, _ref2;
198
-
199
- (_ref = this)[_ref2 = sectionName] || (_ref[_ref2] = {});
200
- const section = this[sectionName];
201
- Object.entries(_objectSpread(_objectSpread({}, this._createInterface(sectionName, _types.rpcDefinitions[sectionName] || {})), this._createInterface(sectionName, userRpc[sectionName] || {}))).forEach(([key, value]) => {
202
- section[key] || (section[key] = value);
203
- });
204
- });
205
- }
206
-
207
- _createInterface(section, methods) {
208
- return Object.entries(methods).filter(([method, {
209
- endpoint
210
- }]) => !this.mapping.has(endpoint || `${section}_${method}`)).reduce((exposed, [method, {
211
- endpoint
212
- }]) => {
213
- const def = methods[method];
214
- const isSubscription = !!def.pubsub;
215
- const jsonrpc = endpoint || `${section}_${method}`;
216
- this.mapping.set(jsonrpc, _objectSpread(_objectSpread({}, def), {}, {
217
- isSubscription,
218
- jsonrpc,
219
- method,
220
- section
221
- }));
222
- exposed[method] = isSubscription ? this._createMethodSubscribe(section, method, def) : this._createMethodSend(section, method, def);
223
- return exposed;
224
- }, {});
195
+ this.sections.push(...Object.keys(userRpc).filter(k => !this.sections.includes(k)));
196
+
197
+ for (let s = 0; s < this.sections.length; s++) {
198
+ const section = this.sections[s];
199
+ const defs = (0, _util.objectSpread)({}, _types.rpcDefinitions[section], userRpc[section]);
200
+ const methods = Object.keys(defs);
201
+
202
+ for (let m = 0; m < methods.length; m++) {
203
+ const method = methods[m];
204
+ const def = defs[method];
205
+ const jsonrpc = def.endpoint || `${section}_${method}`;
206
+
207
+ if (!this.mapping.has(jsonrpc)) {
208
+ const isSubscription = !!def.pubsub;
209
+
210
+ if (!this[section]) {
211
+ this[section] = {};
212
+ }
213
+
214
+ this.mapping.set(jsonrpc, (0, _util.objectSpread)({}, def, {
215
+ isSubscription,
216
+ jsonrpc,
217
+ method,
218
+ section
219
+ }));
220
+ (0, _util.lazyMethod)(this[section], method, () => isSubscription ? this._createMethodSubscribe(section, method, def) : this._createMethodSend(section, method, def));
221
+ }
222
+ }
223
+ }
225
224
  }
226
225
 
227
226
  _memomize(creator, def) {
@@ -240,9 +239,12 @@ class RpcCore {
240
239
 
241
240
  _createMethodSend(section, method, def) {
242
241
  const rpcName = def.endpoint || `${section}_${method}`;
243
- const hashIndex = def.params.findIndex(({
244
- isHistoric
245
- }) => isHistoric);
242
+ const hashIndex = def.params.findIndex(_ref3 => {
243
+ let {
244
+ isHistoric
245
+ } = _ref3;
246
+ return isHistoric;
247
+ });
246
248
  let memoized = null; // execute the RPC call, doing a registry swap for historic as applicable
247
249
 
248
250
  const callWithRegistry = async (isScale, values) => {
@@ -259,7 +261,11 @@ class RpcCore {
259
261
  return this._formatResult(isScale, registry, blockHash, method, def, params, result);
260
262
  };
261
263
 
262
- const creator = isScale => (...values) => {
264
+ const creator = isScale => function () {
265
+ for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
266
+ values[_key] = arguments[_key];
267
+ }
268
+
263
269
  const isDelayed = isScale && hashIndex !== -1 && !!values[hashIndex];
264
270
  return new _rxjs.Observable(observer => {
265
271
  callWithRegistry(isScale, values).then(value => {
@@ -286,12 +292,13 @@ class RpcCore {
286
292
  } // create a subscriptor, it subscribes once and resolves with the id as subscribe
287
293
 
288
294
 
289
- _createSubscriber({
290
- paramsJson,
291
- subName,
292
- subType,
293
- update
294
- }, errorHandler) {
295
+ _createSubscriber(_ref4, errorHandler) {
296
+ let {
297
+ paramsJson,
298
+ subName,
299
+ subType,
300
+ update
301
+ } = _ref4;
295
302
  return new Promise((resolve, reject) => {
296
303
  this.provider.subscribe(subType, subName, paramsJson, update).then(resolve).catch(error => {
297
304
  errorHandler(error);
@@ -301,18 +308,24 @@ class RpcCore {
301
308
  }
302
309
 
303
310
  _createMethodSubscribe(section, method, def) {
311
+ var _this = this;
312
+
304
313
  const [updateType, subMethod, unsubMethod] = def.pubsub;
305
314
  const subName = `${section}_${subMethod}`;
306
315
  const unsubName = `${section}_${unsubMethod}`;
307
316
  const subType = `${section}_${updateType}`;
308
317
  let memoized = null;
309
318
 
310
- const creator = isScale => (...values) => {
319
+ const creator = isScale => function () {
320
+ for (var _len2 = arguments.length, values = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
321
+ values[_key2] = arguments[_key2];
322
+ }
323
+
311
324
  return new _rxjs.Observable(observer => {
312
325
  // Have at least an empty promise, as used in the unsubscribe
313
326
  let subscriptionPromise = Promise.resolve(null);
314
327
 
315
- const registry = (0, _classPrivateFieldLooseBase2.default)(this, _registryDefault)[_registryDefault];
328
+ const registry = (0, _classPrivateFieldLooseBase2.default)(_this, _registryDefault)[_registryDefault];
316
329
 
317
330
  const errorHandler = error => {
318
331
  logErrorMessage(method, def, error);
@@ -320,7 +333,7 @@ class RpcCore {
320
333
  };
321
334
 
322
335
  try {
323
- const params = this._formatInputs(registry, null, def, values);
336
+ const params = _this._formatInputs(registry, null, def, values);
324
337
 
325
338
  const paramsJson = params.map(p => p.toJSON());
326
339
 
@@ -331,13 +344,13 @@ class RpcCore {
331
344
  }
332
345
 
333
346
  try {
334
- observer.next(this._formatResult(isScale, registry, null, method, def, params, result));
347
+ observer.next(_this._formatResult(isScale, registry, null, method, def, params, result));
335
348
  } catch (error) {
336
349
  observer.error(error);
337
350
  }
338
351
  };
339
352
 
340
- subscriptionPromise = this._createSubscriber({
353
+ subscriptionPromise = _this._createSubscriber({
341
354
  paramsJson,
342
355
  subName,
343
356
  subType,
@@ -354,7 +367,7 @@ class RpcCore {
354
367
  // Delete from cache, so old results don't hang around
355
368
  (_memoized2 = memoized) === null || _memoized2 === void 0 ? void 0 : _memoized2.unmemoize(...values); // Unsubscribe from provider
356
369
 
357
- subscriptionPromise.then(subscriptionId => (0, _util.isNull)(subscriptionId) ? Promise.resolve(false) : this.provider.unsubscribe(subType, unsubName, subscriptionId)).catch(error => logErrorMessage(method, def, error));
370
+ subscriptionPromise.then(subscriptionId => (0, _util.isNull)(subscriptionId) ? Promise.resolve(false) : _this.provider.unsubscribe(subType, unsubName, subscriptionId)).catch(error => logErrorMessage(method, def, error));
358
371
  };
359
372
  }).pipe((0, _index.drr)());
360
373
  };
@@ -364,9 +377,12 @@ class RpcCore {
364
377
  }
365
378
 
366
379
  _formatInputs(registry, blockHash, def, inputs) {
367
- const reqArgCount = def.params.filter(({
368
- isOptional
369
- }) => !isOptional).length;
380
+ const reqArgCount = def.params.filter(_ref5 => {
381
+ let {
382
+ isOptional
383
+ } = _ref5;
384
+ return !isOptional;
385
+ }).length;
370
386
  const optText = reqArgCount === def.params.length ? '' : ` (${def.params.length - reqArgCount} optional)`;
371
387
  (0, _util.assert)(inputs.length >= reqArgCount && inputs.length <= def.params.length, () => `Expected ${def.params.length} parameters${optText}, ${inputs.length} found instead`);
372
388
  return inputs.map((input, index) => registry.createTypeUnsafe(def.params[index].type, [input], {
@@ -382,10 +398,13 @@ class RpcCore {
382
398
  const keys = params[0];
383
399
  return keys ? this._formatStorageSet(registry, result.block, keys, result.changes) : registry.createType('StorageChangeSet', result);
384
400
  } else if (rpc.type === 'Vec<StorageChangeSet>') {
385
- const mapped = result.map(({
386
- block,
387
- changes
388
- }) => [registry.createType('Hash', block), this._formatStorageSet(registry, block, params[0], changes)]); // we only query at a specific block, not a range - flatten
401
+ const mapped = result.map(_ref6 => {
402
+ let {
403
+ block,
404
+ changes
405
+ } = _ref6;
406
+ return [registry.createType('Hash', block), this._formatStorageSet(registry, block, params[0], changes)];
407
+ }); // we only query at a specific block, not a range - flatten
389
408
 
390
409
  return method === 'queryStorageAt' ? mapped[0][1] : mapped;
391
410
  }
@@ -418,7 +437,10 @@ class RpcCore {
418
437
 
419
438
  _formatStorageSetEntry(registry, blockHash, key, changes, witCache, entryIndex) {
420
439
  const hexKey = key.toHex();
421
- const found = changes.find(([key]) => key === hexKey); // if we don't find the value, this is our fallback
440
+ const found = changes.find(_ref7 => {
441
+ let [key] = _ref7;
442
+ return key === hexKey;
443
+ }); // if we don't find the value, this is our fallback
422
444
  // - in the case of an array of values, fill the hole from the cache
423
445
  // - if a single result value, don't fill - it is not an update hole
424
446
  // - fallback to an empty option in all cases
@@ -434,7 +456,8 @@ class RpcCore {
434
456
  return this._newType(registry, blockHash, key, input, isEmpty, entryIndex);
435
457
  }
436
458
 
437
- _newType(registry, blockHash, key, input, isEmpty, entryIndex = -1) {
459
+ _newType(registry, blockHash, key, input, isEmpty) {
460
+ let entryIndex = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : -1;
438
461
  // single return value (via state.getStorage), decode the value based on the
439
462
  // outputType that we have specified. Fallback to Raw on nothing
440
463
  const type = key.outputType || 'Raw';
package/bundle.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import type { ProviderInterface } from '@polkadot/rpc-provider/types';
2
2
  import type { DefinitionRpc, DefinitionRpcExt, DefinitionRpcSub, Registry } from '@polkadot/types/types';
3
- import type { RpcInterface } from './types';
4
3
  export { packageInfo } from './packageInfo';
5
4
  export * from './util';
6
5
  /**
@@ -55,8 +54,7 @@ export declare class RpcCore {
55
54
  setRegistrySwap(registrySwap: (blockHash: Uint8Array) => Promise<{
56
55
  registry: Registry;
57
56
  }>): void;
58
- addUserInterfaces<Section extends keyof RpcInterface>(userRpc: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>): void;
59
- private _createInterface;
57
+ addUserInterfaces(userRpc: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>): void;
60
58
  private _memomize;
61
59
  private _formatResult;
62
60
  private _createMethodSend;
package/bundle.js CHANGED
@@ -1,16 +1,10 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
1
  import _classPrivateFieldLooseBase from "@babel/runtime/helpers/esm/classPrivateFieldLooseBase";
3
2
  import _classPrivateFieldLooseKey from "@babel/runtime/helpers/esm/classPrivateFieldLooseKey";
4
-
5
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
6
-
7
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
8
-
9
3
  // Copyright 2017-2021 @polkadot/rpc-core authors & contributors
10
4
  // SPDX-License-Identifier: Apache-2.0
11
5
  import { Observable, publishReplay, refCount } from 'rxjs';
12
6
  import { rpcDefinitions } from '@polkadot/types';
13
- import { assert, hexToU8a, isFunction, isNull, isUndefined, logger, memoize, u8aToU8a } from '@polkadot/util';
7
+ import { assert, hexToU8a, isFunction, isNull, isUndefined, lazyMethod, logger, memoize, objectSpread, u8aToU8a } from '@polkadot/util';
14
8
  import { drr, refCountDelay } from "./util/index.js";
15
9
  export { packageInfo } from "./packageInfo.js";
16
10
  export * from "./util/index.js";
@@ -156,37 +150,35 @@ export class RpcCore {
156
150
 
157
151
  addUserInterfaces(userRpc) {
158
152
  // add any extra user-defined sections
159
- this.sections.push(...Object.keys(userRpc).filter(key => !this.sections.includes(key))); // decorate the sections with base and user methods
160
-
161
- this.sections.forEach(sectionName => {
162
- var _ref, _ref2;
163
-
164
- (_ref = this)[_ref2 = sectionName] || (_ref[_ref2] = {});
165
- const section = this[sectionName];
166
- Object.entries(_objectSpread(_objectSpread({}, this._createInterface(sectionName, rpcDefinitions[sectionName] || {})), this._createInterface(sectionName, userRpc[sectionName] || {}))).forEach(([key, value]) => {
167
- section[key] || (section[key] = value);
168
- });
169
- });
170
- }
171
-
172
- _createInterface(section, methods) {
173
- return Object.entries(methods).filter(([method, {
174
- endpoint
175
- }]) => !this.mapping.has(endpoint || `${section}_${method}`)).reduce((exposed, [method, {
176
- endpoint
177
- }]) => {
178
- const def = methods[method];
179
- const isSubscription = !!def.pubsub;
180
- const jsonrpc = endpoint || `${section}_${method}`;
181
- this.mapping.set(jsonrpc, _objectSpread(_objectSpread({}, def), {}, {
182
- isSubscription,
183
- jsonrpc,
184
- method,
185
- section
186
- }));
187
- exposed[method] = isSubscription ? this._createMethodSubscribe(section, method, def) : this._createMethodSend(section, method, def);
188
- return exposed;
189
- }, {});
153
+ this.sections.push(...Object.keys(userRpc).filter(k => !this.sections.includes(k)));
154
+
155
+ for (let s = 0; s < this.sections.length; s++) {
156
+ const section = this.sections[s];
157
+ const defs = objectSpread({}, rpcDefinitions[section], userRpc[section]);
158
+ const methods = Object.keys(defs);
159
+
160
+ for (let m = 0; m < methods.length; m++) {
161
+ const method = methods[m];
162
+ const def = defs[method];
163
+ const jsonrpc = def.endpoint || `${section}_${method}`;
164
+
165
+ if (!this.mapping.has(jsonrpc)) {
166
+ const isSubscription = !!def.pubsub;
167
+
168
+ if (!this[section]) {
169
+ this[section] = {};
170
+ }
171
+
172
+ this.mapping.set(jsonrpc, objectSpread({}, def, {
173
+ isSubscription,
174
+ jsonrpc,
175
+ method,
176
+ section
177
+ }));
178
+ lazyMethod(this[section], method, () => isSubscription ? this._createMethodSubscribe(section, method, def) : this._createMethodSend(section, method, def));
179
+ }
180
+ }
181
+ }
190
182
  }
191
183
 
192
184
  _memomize(creator, def) {
package/package.json CHANGED
@@ -20,17 +20,17 @@
20
20
  "./detectPackage.cjs"
21
21
  ],
22
22
  "type": "module",
23
- "version": "6.6.2-6",
23
+ "version": "6.7.1",
24
24
  "main": "index.js",
25
25
  "dependencies": {
26
- "@babel/runtime": "^7.15.4",
27
- "@polkadot/rpc-provider": "6.6.2-6",
28
- "@polkadot/types": "6.6.2-6",
29
- "@polkadot/util": "^7.7.1",
26
+ "@babel/runtime": "^7.16.0",
27
+ "@polkadot/rpc-provider": "6.7.1",
28
+ "@polkadot/types": "6.7.1",
29
+ "@polkadot/util": "^7.8.2",
30
30
  "rxjs": "^7.4.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@polkadot/keyring": "^7.7.1"
33
+ "@polkadot/keyring": "^7.8.2"
34
34
  },
35
35
  "exports": {
36
36
  ".": {
package/packageInfo.cjs CHANGED
@@ -9,6 +9,6 @@ exports.packageInfo = void 0;
9
9
  // Auto-generated by @polkadot/dev, do not edit
10
10
  const packageInfo = {
11
11
  name: '@polkadot/rpc-core',
12
- version: '6.6.2-6'
12
+ version: '6.7.1'
13
13
  };
14
14
  exports.packageInfo = packageInfo;
package/packageInfo.js CHANGED
@@ -3,5 +3,5 @@
3
3
  // Auto-generated by @polkadot/dev, do not edit
4
4
  export const packageInfo = {
5
5
  name: '@polkadot/rpc-core',
6
- version: '6.6.2-6'
6
+ version: '6.7.1'
7
7
  };
@@ -1,7 +1,8 @@
1
1
  import type { Observable } from 'rxjs';
2
- import type { AnyFunction } from '@polkadot/types/types';
2
+ import type { AnyFunction, DefinitionRpc } from '@polkadot/types/types';
3
3
  export interface RpcInterface {
4
4
  }
5
5
  export declare type AugmentedRpc<F extends AnyFunction> = F & {
6
6
  raw: <T>(...params: Parameters<F>) => Observable<T>;
7
+ meta: DefinitionRpc;
7
8
  };
package/util/drr.cjs CHANGED
@@ -35,10 +35,13 @@ const NOOP = () => undefined;
35
35
  */
36
36
 
37
37
 
38
- const drr = ({
39
- delay,
40
- skipChange = false,
41
- skipTimeout = false
42
- } = {}) => source$ => source$.pipe((0, _rxjs.catchError)(ERR), skipChange ? (0, _rxjs.tap)(NOOP) : (0, _rxjs.distinctUntilChanged)(CMP), (0, _rxjs.publishReplay)(1), skipTimeout ? (0, _rxjs.refCount)() : (0, _refCountDelay.refCountDelay)(delay));
38
+ const drr = function () {
39
+ let {
40
+ delay,
41
+ skipChange = false,
42
+ skipTimeout = false
43
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
44
+ return source$ => source$.pipe((0, _rxjs.catchError)(ERR), skipChange ? (0, _rxjs.tap)(NOOP) : (0, _rxjs.distinctUntilChanged)(CMP), (0, _rxjs.publishReplay)(1), skipTimeout ? (0, _rxjs.refCount)() : (0, _refCountDelay.refCountDelay)(delay));
45
+ };
43
46
 
44
47
  exports.drr = drr;
package/util/memo.cjs CHANGED
@@ -23,12 +23,18 @@ function memo(instanceId, inner) {
23
23
  const options = {
24
24
  getInstanceId: () => instanceId
25
25
  };
26
- const cached = (0, _util.memoize)((...params) => 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)()), options);
26
+ const cached = (0, _util.memoize)(function () {
27
+ for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
28
+ params[_key] = arguments[_key];
29
+ }
30
+
31
+ return new _rxjs.Observable(observer => {
32
+ const subscription = inner(...params).subscribe(observer);
33
+ return () => {
34
+ cached.unmemoize(...params);
35
+ subscription.unsubscribe();
36
+ };
37
+ }).pipe((0, _drr.drr)());
38
+ }, options);
33
39
  return cached;
34
40
  }
@@ -11,7 +11,8 @@ var _rxjs = require("rxjs");
11
11
  // SPDX-License-Identifier: Apache-2.0
12
12
 
13
13
  /** @internal */
14
- function refCountDelay(delay = 1750) {
14
+ function refCountDelay() {
15
+ let delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1750;
15
16
  return source => {
16
17
  // state: 0 = disconnected, 1 = disconnecting, 2 = connecting, 3 = connected
17
18
  let [state, refCount, connection, scheduler] = [0, 0, _rxjs.Subscription.EMPTY, _rxjs.Subscription.EMPTY];