From 9c9e1af2ebb4b12f9c0e2fcdd064da18f33fa3ae Mon Sep 17 00:00:00 2001 From: Marc Fornos Date: Fri, 14 Jun 2024 13:10:17 +0200 Subject: [PATCH] remove mingo ops side effects --- packages/core/src/apis/substrate-apis.ts | 4 ++++ packages/core/src/index.ts | 3 +++ packages/core/src/subjects/query.spec.ts | 4 ++++ packages/core/src/subjects/query.ts | 3 --- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/core/src/apis/substrate-apis.ts b/packages/core/src/apis/substrate-apis.ts index 178170b..4ba261d 100644 --- a/packages/core/src/apis/substrate-apis.ts +++ b/packages/core/src/apis/substrate-apis.ts @@ -14,6 +14,7 @@ import { logger } from '@polkadot/util' import { Observable, map, shareReplay } from 'rxjs' import type { ApiNames, Configuration } from '../configuration/index.js' +import { installOperators } from '../subjects/mingo-ops.js' const l = logger('oc-substrate-apis') @@ -71,6 +72,9 @@ export class SubstrateApis { const { provider } = options diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index bb46013..28ac308 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -16,3 +16,6 @@ export { Smoldot } from './client/index.js' export * as config from './configuration/index.js' export * as converters from './converters/index.js' export * as types from './types/index.js' + +import { installOperators } from './subjects/mingo-ops.js' +export const mingo = { installOperators } diff --git a/packages/core/src/subjects/query.spec.ts b/packages/core/src/subjects/query.spec.ts index eb09859..696ced1 100644 --- a/packages/core/src/subjects/query.spec.ts +++ b/packages/core/src/subjects/query.spec.ts @@ -1,11 +1,15 @@ // Copyright 2023-2024 SO/DA zone // SPDX-License-Identifier: Apache-2.0 +import { installOperators } from './mingo-ops.js' import { ControlQuery } from './query.js' const testAddress = '1a1LcBX6hGPKg5aQ6DXZpAHCCzWjckhea4sz3P1PvL3oc4F' describe('control query', () => { + beforeAll(() => { + installOperators() + }) it('should filter out dispatch errors', () => { const q = ControlQuery.from({ dispatchError: { $eq: undefined }, diff --git a/packages/core/src/subjects/query.ts b/packages/core/src/subjects/query.ts index a4526e4..cd5d69b 100644 --- a/packages/core/src/subjects/query.ts +++ b/packages/core/src/subjects/query.ts @@ -7,9 +7,6 @@ import { Query } from 'mingo' import { RawObject } from 'mingo/types' import { installOperators } from './mingo-ops.js' -// Installs mingo operators if needed -installOperators() - export type Criteria = RawObject /**