diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index 9ae4b7ba5..ad1f72cfc 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -34,7 +34,7 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: 1.17 + go-version: '1.20' - name: Clone ulixee/shared run: git clone https://github.com/ulixee/shared.git diff --git a/client/connections/ConnectionToHeroCore.ts b/client/connections/ConnectionToHeroCore.ts index 16574b9ab..440346e0d 100644 --- a/client/connections/ConnectionToHeroCore.ts +++ b/client/connections/ConnectionToHeroCore.ts @@ -4,6 +4,7 @@ import ICoreConfigureOptions from '@ulixee/hero-interfaces/ICoreConfigureOptions import { ConnectionToCore, WsTransportToCore } from '@ulixee/net'; import ICoreListenerPayload from '@ulixee/hero-interfaces/ICoreListenerPayload'; import ITransportToCore from '@ulixee/net/interfaces/ITransportToCore'; +import addGlobalInstance from '@ulixee/commons/lib/addGlobalInstance'; import ICoreCommandRequestPayload from '@ulixee/hero-interfaces/ICoreCommandRequestPayload'; import DisconnectedError from '@ulixee/net/errors/DisconnectedError'; import ICoreResponsePayload from '@ulixee/net/interfaces/ICoreResponsePayload'; @@ -147,3 +148,5 @@ export default class ConnectionToHeroCore extends ConnectionToCore { return host; } } + +addGlobalInstance(ConnectionToHeroCore); diff --git a/client/lib/CoreSession.ts b/client/lib/CoreSession.ts index a56013c87..c9cb3ea6a 100644 --- a/client/lib/CoreSession.ts +++ b/client/lib/CoreSession.ts @@ -3,6 +3,7 @@ import ISessionMeta from '@ulixee/hero-interfaces/ISessionMeta'; import { IJsPath } from '@ulixee/js-path'; import { loggerSessionIdNames } from '@ulixee/commons/lib/Logger'; import IHeroMeta from '@ulixee/hero-interfaces/IHeroMeta'; +import addGlobalInstance from '@ulixee/commons/lib/addGlobalInstance'; import * as readline from 'readline'; import { ReadLine } from 'readline'; import { CanceledPromiseError } from '@ulixee/commons/interfaces/IPendingWaitEvent'; @@ -154,10 +155,7 @@ export default class CoreSession return await this.commandQueue.run('Session.getDetachedElements', sessionId, name); } - public async getDetachedResources( - sessionId: string, - name: string, - ): Promise { + public async getDetachedResources(sessionId: string, name: string): Promise { return await this.commandQueue.run('Session.getDetachedResources', sessionId, name); } @@ -270,3 +268,5 @@ export default class CoreSession this.cliPrompt.prompt(true); } } + +addGlobalInstance(CoreSession); diff --git a/client/lib/Hero.ts b/client/lib/Hero.ts index ea8928a51..85740fff2 100644 --- a/client/lib/Hero.ts +++ b/client/lib/Hero.ts @@ -5,6 +5,7 @@ import SuperDocument from '@ulixee/awaited-dom/impl/super-klasses/SuperDocument' import IDomStorage from '@ulixee/unblocked-specification/agent/browser/IDomStorage'; import IUserProfile from '@ulixee/hero-interfaces/IUserProfile'; import { IRequestInit } from '@ulixee/awaited-dom/base/interfaces/official'; +import addGlobalInstance from '@ulixee/commons/lib/addGlobalInstance'; import Response from '@ulixee/awaited-dom/impl/official-klasses/Response'; import { ISuperElement, @@ -724,6 +725,8 @@ export default class Hero extends AwaitedEventTarget { } } +addGlobalInstance(Hero); + async function getCoreFrameForInteractions( interactions: IInteractions, ): Promise { diff --git a/client/lib/Tab.ts b/client/lib/Tab.ts index 3d18366b5..77d8a8b26 100644 --- a/client/lib/Tab.ts +++ b/client/lib/Tab.ts @@ -1,8 +1,13 @@ import StateMachine from '@ulixee/awaited-dom/base/StateMachine'; -import { ISuperElement, ISuperNode, ISuperNodeList } from '@ulixee/awaited-dom/base/interfaces/super'; +import { + ISuperElement, + ISuperNode, + ISuperNodeList, +} from '@ulixee/awaited-dom/base/interfaces/super'; import { IRequestInit } from '@ulixee/awaited-dom/base/interfaces/official'; import SuperDocument from '@ulixee/awaited-dom/impl/super-klasses/SuperDocument'; import Storage from '@ulixee/awaited-dom/impl/official-klasses/Storage'; +import addGlobalInstance from '@ulixee/commons/lib/addGlobalInstance'; import CSSStyleDeclaration from '@ulixee/awaited-dom/impl/official-klasses/CSSStyleDeclaration'; import Request from '@ulixee/awaited-dom/impl/official-klasses/Request'; import { @@ -394,6 +399,8 @@ export default class Tab extends AwaitedEventTarget { } } +addGlobalInstance(Tab); + export function getCoreTab(tab: Tab): Promise { return tab[InternalPropertiesSymbol].coreTabPromise.then(x => { if (x instanceof Error) throw x; diff --git a/core/lib/CommandRunner.ts b/core/lib/CommandRunner.ts index f5b7288d3..5e9c5d14a 100644 --- a/core/lib/CommandRunner.ts +++ b/core/lib/CommandRunner.ts @@ -13,7 +13,7 @@ export default class CommandRunner { return; } - throw new Error(`Target for command not available (${targetName})`); + throw new Error(`Target for command not available (${targetName}:${method})`); } if (!targets[targetName].isAllowedCommand(method)) { diff --git a/core/lib/InjectedScripts.ts b/core/lib/InjectedScripts.ts index fb8785c19..196355444 100644 --- a/core/lib/InjectedScripts.ts +++ b/core/lib/InjectedScripts.ts @@ -1,7 +1,6 @@ import * as fs from 'fs'; import { IPage } from '@ulixee/unblocked-specification/agent/browser/IPage'; import { stringifiedTypeSerializerClass } from '@ulixee/commons/lib/TypeSerializer'; -import { IFrame } from '@ulixee/unblocked-specification/agent/browser/IFrame'; import IDevtoolsSession from '@ulixee/unblocked-specification/agent/browser/IDevtoolsSession'; const pageScripts = { diff --git a/examples/example.org.ts b/examples/example.org.ts index f8171ee58..b20cb9ba9 100644 --- a/examples/example.org.ts +++ b/examples/example.org.ts @@ -1,5 +1,4 @@ -import Hero from '@ulixee/hero'; -import { LocationTrigger } from '@ulixee/unblocked-specification/agent/browser/Location'; +import Hero, { LocationTrigger } from '@ulixee/hero'; // NOTE: You need to start a Ulixee Miner to run this example async function run() {