mirror of
https://github.com/pezkuwichain/pezkuwi-api.git
synced 2026-11-02 06:41:06 +00:00
Move to @pezkuwi/dev 0.86 (eslint 10 toolchain)
- @pezkuwi/dev, dev-test, dev-ts ^0.86.3; disable directives renamed for the new rule names, or removed where the rule no longer reports - rethrown errors carry the original as `cause` (13 sites) - optional chains where a guard expression tested the same value - Init: the registry cache settles with the creator's own promise, dropping the entry in finally(), instead of re-wrapping it - Combinator: a typed call instead of `Function` - checkTypes.manual: synchronous checks run outside Promise.all - sortValues, createTypeUnsafe: initial values that were never read - typegen util: load docs.js for its side effect (it registers the `docs` Handlebars partial) now that its types are re-exported type-only - MockProvider keeps its Header assertion: the package's own build does not load api-augment, so createType returns a plain Codec there - Decorate keeps `delete queue[i]`: the hole marks a fired queue and later indexes must not shift
This commit is contained in:
1 parent
8c9af013b5
commit
60e0f73ffa
166 files changed
+2757
-3731
No files matched your search
@@ -29,7 +29,7 @@ interface StorageChangeSetJSON {
|
||||
type MemoizedRpcInterfaceMethod = Memoized<RpcInterfaceMethod> & {
|
||||
raw: Memoized<RpcInterfaceMethod>;
|
||||
meta: DefinitionRpc;
|
||||
}
|
||||
};
|
||||
|
||||
interface Options {
|
||||
isPedantic?: boolean;
|
||||
@@ -295,11 +295,11 @@ export class RpcCore {
|
||||
}
|
||||
};
|
||||
}).pipe(
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
||||
publishReplay(1), // create a Replay(1)
|
||||
isDelayed
|
||||
? refCountDelay() // Unsubscribe after delay
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
||||
: refCount()
|
||||
);
|
||||
};
|
||||
@@ -418,7 +418,7 @@ export class RpcCore {
|
||||
? this._formatStorageSet(registry, (result as StorageChangeSetJSON).block, keys, (result as StorageChangeSetJSON).changes)
|
||||
: registry.createType('StorageChangeSet', result);
|
||||
} else if (rpc.type === 'Vec<StorageChangeSet>') {
|
||||
const jsonSet = (result as StorageChangeSetJSON[]);
|
||||
const jsonSet = result as StorageChangeSetJSON[];
|
||||
const count = jsonSet.length;
|
||||
const mapped = new Array<[Hash, Codec[]]>(count);
|
||||
|
||||
@@ -529,7 +529,7 @@ export class RpcCore {
|
||||
: input
|
||||
], { blockHash, isFallback: isEmpty && !!meta.fallback, isOptional: meta.modifier.isOptional, isPedantic: this.#isPedantic && !meta.modifier.isOptional });
|
||||
} catch (error) {
|
||||
throw new Error(`Unable to decode storage ${key.section || 'unknown'}.${key.method || 'unknown'}:${entryNum}: ${(error as Error).message}`);
|
||||
throw new Error(`Unable to decode storage ${key.section || 'unknown'}.${key.method || 'unknown'}:${entryNum}: ${(error as Error).message}`, { cause: error });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,11 +43,10 @@ describe('methodSend', (): void => {
|
||||
|
||||
it('checks for mismatched parameters', async (): Promise<void> => {
|
||||
// private method
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const method = (rpc as any)._createMethodSend('test', 'bleh', methods.bleh);
|
||||
|
||||
await new Promise<boolean>((resolve) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
||||
method(1).subscribe(
|
||||
(): void => undefined,
|
||||
(error: Error): void => {
|
||||
@@ -59,14 +58,12 @@ describe('methodSend', (): void => {
|
||||
|
||||
it('calls the provider with the correct parameters', async (): Promise<void> => {
|
||||
// private method
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const method = (rpc as any)._createMethodSend('test', 'blah', methods.blah);
|
||||
|
||||
await new Promise<boolean>((resolve) => {
|
||||
// Args are length-prefixed, because it's a Bytes
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
||||
method(new Uint8Array([2 << 2, 0x12, 0x34])).subscribe((): void => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
expect(provider.send).toHaveBeenCalledWith('test_blah', ['0x1234'], false);
|
||||
resolve(true);
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// augmented, do an augmentation export
|
||||
export * from '@pezkuwi/rpc-core/types/jsonrpc';
|
||||
export type * from '@pezkuwi/rpc-core/types/jsonrpc';
|
||||
|
||||
// normal exports
|
||||
export * from './base.js';
|
||||
export type * from './base.js';
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2026 @pezkuwi/rpc-core authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
||||
export interface RpcInterface {
|
||||
// augmented
|
||||
}
|
||||
@@ -42,10 +42,10 @@ export function drr ({ delay, skipChange = false, skipTimeout = false }: Options
|
||||
skipChange
|
||||
? tap(NOOP)
|
||||
: distinctUntilChanged<T>(CMP),
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
||||
publishReplay(1),
|
||||
skipTimeout
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
||||
? refCount()
|
||||
: refCountDelay(delay)
|
||||
);
|
||||
|
||||
@@ -16,7 +16,7 @@ type ObsFn <T> = (...params: unknown[]) => Observable<T>;
|
||||
// 1. creates a memo of the inner fn -> Observable, removing when unsubscribed
|
||||
// 2. wraps the observable in a drr() (which includes an unsub delay)
|
||||
/** @internal */
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
export function memo <T> (instanceId: string, inner: Function): Memoized<ObsFn<T>> {
|
||||
const options = { getInstanceId: () => instanceId };
|
||||
const cached = memoize(
|
||||
|
||||
@@ -18,7 +18,7 @@ export function refCountDelay <T> (delay = 1750): MonoTypeOperatorFunction<T> {
|
||||
if (state === 1) {
|
||||
scheduler.unsubscribe();
|
||||
} else {
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
||||
connection = (source as ConnectableObservable<T>).connect();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user