@xyo-network/os-runtime 7.2.1 → 7.3.0
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/dist/neutral/Caller.d.ts.map +1 -1
- package/dist/neutral/DappCallerBase.d.ts +2 -2
- package/dist/neutral/OsCallerBase.d.ts +2 -2
- package/dist/neutral/RunningDappCache.d.ts.map +1 -1
- package/dist/neutral/XyOs.d.ts +4 -5
- package/dist/neutral/XyOs.d.ts.map +1 -1
- package/dist/neutral/XyOsBase.d.ts +122 -3
- package/dist/neutral/XyOsBase.d.ts.map +1 -1
- package/dist/neutral/XyOsDapp.d.ts +3 -3
- package/dist/neutral/XyOsDapp.d.ts.map +1 -1
- package/dist/neutral/access/Caller.d.ts +1 -1
- package/dist/neutral/access/Caller.d.ts.map +1 -1
- package/dist/neutral/access/RunningAccessDappCache.d.ts.map +1 -1
- package/dist/neutral/access/interfaces/registered-names/helpers/resource/AbstractXnsCaller.d.ts +1 -1
- package/dist/neutral/adapter/Base.d.ts.map +1 -1
- package/dist/neutral/classes/lib/DappCreatorParams.d.ts +3 -3
- package/dist/neutral/classes/lib/DappCreatorParams.d.ts.map +1 -1
- package/dist/neutral/classes/lib/Insertable.d.ts +1 -3
- package/dist/neutral/classes/lib/Insertable.d.ts.map +1 -1
- package/dist/neutral/classes/settings/CallerBase.d.ts +1 -1
- package/dist/neutral/classes/settings/SettingsQueries.d.ts.map +1 -1
- package/dist/neutral/dapp/context/creator/Creator.d.ts +1 -1
- package/dist/neutral/dapp/context/creator/Creator.d.ts.map +1 -1
- package/dist/neutral/dapp/context/creator/createDappContext.d.ts.map +1 -1
- package/dist/neutral/event/bus/EventBus.d.ts +1 -1
- package/dist/neutral/event/bus/EventBus.d.ts.map +1 -1
- package/dist/neutral/helpers/monitor/XyOsMonitor.d.ts +2 -2
- package/dist/neutral/helpers/monitor/XyOsMonitor.d.ts.map +1 -1
- package/dist/neutral/helpers/monitor/types.d.ts +2 -2
- package/dist/neutral/helpers/monitor/types.d.ts.map +1 -1
- package/dist/neutral/index.mjs +42 -36
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/lib/Listener.d.ts +1 -1
- package/dist/neutral/lib/Listener.d.ts.map +1 -1
- package/dist/neutral/loadOsNode.d.ts.map +1 -1
- package/dist/neutral/profileModuleEvents.d.ts +1 -3
- package/dist/neutral/profileModuleEvents.d.ts.map +1 -1
- package/dist/neutral/registration/DappRegistrationService.d.ts +3 -3
- package/dist/neutral/registration/DappRegistrationService.d.ts.map +1 -1
- package/dist/neutral/registration/DappRegistry.d.ts.map +1 -1
- package/dist/neutral/registration/ValidateDappAccessDiviner/Config.d.ts +1 -1
- package/dist/neutral/registration/ValidateDappAccessDiviner/Config.d.ts.map +1 -1
- package/dist/neutral/scripts/xyos/lib/headless.d.ts.map +1 -1
- package/dist/neutral/signer/Signers.d.ts.map +1 -1
- package/dist/neutral/stack/Manager.d.ts +2 -6
- package/dist/neutral/stack/Manager.d.ts.map +1 -1
- package/dist/neutral/system/ManageSystemDapps.d.ts +2 -2
- package/dist/neutral/system/ManageSystemDapps.d.ts.map +1 -1
- package/dist/node/Caller.d.ts.map +1 -1
- package/dist/node/DappCallerBase.d.ts +2 -2
- package/dist/node/OsCallerBase.d.ts +2 -2
- package/dist/node/RunningDappCache.d.ts.map +1 -1
- package/dist/node/XyOs.d.ts +4 -5
- package/dist/node/XyOs.d.ts.map +1 -1
- package/dist/node/XyOsBase.d.ts +122 -3
- package/dist/node/XyOsBase.d.ts.map +1 -1
- package/dist/node/XyOsDapp.d.ts +3 -3
- package/dist/node/XyOsDapp.d.ts.map +1 -1
- package/dist/node/access/Caller.d.ts +1 -1
- package/dist/node/access/Caller.d.ts.map +1 -1
- package/dist/node/access/RunningAccessDappCache.d.ts.map +1 -1
- package/dist/node/access/interfaces/registered-names/helpers/resource/AbstractXnsCaller.d.ts +1 -1
- package/dist/node/adapter/Base.d.ts.map +1 -1
- package/dist/node/classes/lib/DappCreatorParams.d.ts +3 -3
- package/dist/node/classes/lib/DappCreatorParams.d.ts.map +1 -1
- package/dist/node/classes/lib/Insertable.d.ts +1 -3
- package/dist/node/classes/lib/Insertable.d.ts.map +1 -1
- package/dist/node/classes/settings/CallerBase.d.ts +1 -1
- package/dist/node/classes/settings/SettingsQueries.d.ts.map +1 -1
- package/dist/node/dapp/context/creator/Creator.d.ts +1 -1
- package/dist/node/dapp/context/creator/Creator.d.ts.map +1 -1
- package/dist/node/dapp/context/creator/createDappContext.d.ts.map +1 -1
- package/dist/node/event/bus/EventBus.d.ts +1 -1
- package/dist/node/event/bus/EventBus.d.ts.map +1 -1
- package/dist/node/helpers/monitor/XyOsMonitor.d.ts +2 -2
- package/dist/node/helpers/monitor/XyOsMonitor.d.ts.map +1 -1
- package/dist/node/helpers/monitor/types.d.ts +2 -2
- package/dist/node/helpers/monitor/types.d.ts.map +1 -1
- package/dist/node/index.mjs +42 -36
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/lib/Listener.d.ts +1 -1
- package/dist/node/lib/Listener.d.ts.map +1 -1
- package/dist/node/loadOsNode.d.ts.map +1 -1
- package/dist/node/profileModuleEvents.d.ts +1 -3
- package/dist/node/profileModuleEvents.d.ts.map +1 -1
- package/dist/node/registration/DappRegistrationService.d.ts +3 -3
- package/dist/node/registration/DappRegistrationService.d.ts.map +1 -1
- package/dist/node/registration/DappRegistry.d.ts.map +1 -1
- package/dist/node/registration/ValidateDappAccessDiviner/Config.d.ts +1 -1
- package/dist/node/registration/ValidateDappAccessDiviner/Config.d.ts.map +1 -1
- package/dist/node/scripts/xyos/index.mjs +27 -24
- package/dist/node/scripts/xyos/index.mjs.map +1 -1
- package/dist/node/scripts/xyos/lib/headless.d.ts.map +1 -1
- package/dist/node/signer/Signers.d.ts.map +1 -1
- package/dist/node/stack/Manager.d.ts +2 -6
- package/dist/node/stack/Manager.d.ts.map +1 -1
- package/dist/node/system/ManageSystemDapps.d.ts +2 -2
- package/dist/node/system/ManageSystemDapps.d.ts.map +1 -1
- package/package.json +166 -49
- package/dist/neutral/signer/Signer.spec.d.ts +0 -2
- package/dist/neutral/signer/Signer.spec.d.ts.map +0 -1
- package/dist/neutral/spec/boot.spec.d.ts +0 -2
- package/dist/neutral/spec/boot.spec.d.ts.map +0 -1
- package/dist/node/signer/Signer.spec.d.ts +0 -2
- package/dist/node/signer/Signer.spec.d.ts.map +0 -1
- package/dist/node/spec/boot.spec.d.ts +0 -2
- package/dist/node/spec/boot.spec.d.ts.map +0 -1
- package/src/Caller.ts +0 -200
- package/src/DappCallerBase.ts +0 -55
- package/src/DefaultsQueries.ts +0 -27
- package/src/OsCallerBase.ts +0 -59
- package/src/PubSubBridgeCaller.ts +0 -33
- package/src/RunningDappCache.ts +0 -58
- package/src/XyOs.ts +0 -166
- package/src/XyOsBase.ts +0 -135
- package/src/XyOsDapp.ts +0 -106
- package/src/access/Caller.ts +0 -85
- package/src/access/Queries.ts +0 -38
- package/src/access/Resource.ts +0 -65
- package/src/access/RunningAccessDappCache.ts +0 -21
- package/src/access/index.ts +0 -4
- package/src/access/interfaces/index.ts +0 -1
- package/src/access/interfaces/registered-names/helpers/AccessNodeQueries.ts +0 -68
- package/src/access/interfaces/registered-names/helpers/index.ts +0 -2
- package/src/access/interfaces/registered-names/helpers/resource/AbstractXnsCaller.ts +0 -42
- package/src/access/interfaces/registered-names/helpers/resource/RegistrationsResource.ts +0 -52
- package/src/access/interfaces/registered-names/helpers/resource/RegistrationsResourceQueries.ts +0 -23
- package/src/access/interfaces/registered-names/helpers/resource/index.ts +0 -3
- package/src/access/interfaces/registered-names/index.ts +0 -1
- package/src/adapter/Base.ts +0 -106
- package/src/adapter/Network.ts +0 -31
- package/src/adapter/Settings.ts +0 -30
- package/src/adapter/index.ts +0 -2
- package/src/adapters/OsPubSubBridgeNetwork.ts +0 -10
- package/src/adapters/OsSettings.ts +0 -7
- package/src/adapters/OsXyoPublicNetwork.ts +0 -9
- package/src/adapters/index.ts +0 -3
- package/src/classes/dapp/DefaultsResource.ts +0 -67
- package/src/classes/dapp/index.ts +0 -1
- package/src/classes/index.ts +0 -4
- package/src/classes/lib/DappCreatorParams.ts +0 -18
- package/src/classes/lib/Insertable.ts +0 -10
- package/src/classes/lib/index.ts +0 -2
- package/src/classes/menu/Caller.ts +0 -76
- package/src/classes/menu/Queries.ts +0 -60
- package/src/classes/menu/Resource.ts +0 -105
- package/src/classes/menu/index.ts +0 -2
- package/src/classes/settings/Caller.ts +0 -78
- package/src/classes/settings/CallerBase.ts +0 -27
- package/src/classes/settings/Resource.ts +0 -81
- package/src/classes/settings/SettingsQueries.ts +0 -56
- package/src/classes/settings/badge/Caller.ts +0 -30
- package/src/classes/settings/badge/Queries.ts +0 -19
- package/src/classes/settings/badge/Resource.ts +0 -50
- package/src/classes/settings/badge/index.ts +0 -2
- package/src/classes/settings/index.ts +0 -5
- package/src/dapp/context/creator/Creator.ts +0 -122
- package/src/dapp/context/creator/DefaultPayloads/DappAccessPayloads.ts +0 -20
- package/src/dapp/context/creator/DefaultPayloads/DefaultPayloads.ts +0 -40
- package/src/dapp/context/creator/DefaultPayloads/NodeInfoPayload.ts +0 -33
- package/src/dapp/context/creator/DefaultPayloads/index.ts +0 -1
- package/src/dapp/context/creator/ExternalModulePermissions/ExternalModulePermissions.ts +0 -59
- package/src/dapp/context/creator/ExternalModulePermissions/index.ts +0 -1
- package/src/dapp/context/creator/createDappContext.ts +0 -61
- package/src/dapp/context/creator/index.ts +0 -3
- package/src/dapp/context/index.ts +0 -1
- package/src/dapp/index.ts +0 -1
- package/src/event/bus/Connection.ts +0 -31
- package/src/event/bus/EventBus.ts +0 -160
- package/src/event/bus/PubSubConnection.ts +0 -28
- package/src/event/bus/index.ts +0 -3
- package/src/event/connections/DappAccessRequest.ts +0 -11
- package/src/event/connections/DappsReady.ts +0 -9
- package/src/event/connections/ExposeDappRequest.ts +0 -11
- package/src/event/connections/OsPubSubNetworkReady.ts +0 -12
- package/src/event/connections/OsSettingsReady.ts +0 -12
- package/src/event/connections/OsXyoPublicReady.ts +0 -12
- package/src/event/connections/index.ts +0 -6
- package/src/event/index.ts +0 -2
- package/src/helpers/index.ts +0 -1
- package/src/helpers/monitor/XyOsMonitor.ts +0 -52
- package/src/helpers/monitor/index.ts +0 -2
- package/src/helpers/monitor/types.ts +0 -8
- package/src/index.ts +0 -29
- package/src/initializer/DappInitializer.ts +0 -57
- package/src/initializer/index.ts +0 -1
- package/src/intent/Caller.ts +0 -74
- package/src/intent/Resource.ts +0 -66
- package/src/intent/index.ts +0 -2
- package/src/lib/ExternalStore.ts +0 -7
- package/src/lib/Listener.ts +0 -1
- package/src/lib/ModuleAccountPaths.ts +0 -23
- package/src/lib/ModuleNames.ts +0 -3
- package/src/lib/NameTransforms.ts +0 -34
- package/src/lib/PayloadStore.ts +0 -105
- package/src/lib/ResourceStores.ts +0 -7
- package/src/lib/index.ts +0 -11
- package/src/lib/initializeXns.ts +0 -16
- package/src/lib/isEqual.ts +0 -42
- package/src/lib/isPayload.ts +0 -24
- package/src/lib/tokenPlacesSplit.ts +0 -17
- package/src/loadOsNode.ts +0 -44
- package/src/manifest/index.ts +0 -2
- package/src/manifest/manifestReplacementTokens.ts +0 -6
- package/src/manifest/os-node.manifest.json +0 -132
- package/src/manifests/dapp-window.manifest.json +0 -36
- package/src/manifests/index.ts +0 -1
- package/src/models/access/ValidDappAccessInterfaces.ts +0 -6
- package/src/models/access/index.ts +0 -1
- package/src/models/index.ts +0 -1
- package/src/profileModuleEvents.ts +0 -43
- package/src/registration/DappRegistrationService.ts +0 -180
- package/src/registration/DappRegistry.ts +0 -129
- package/src/registration/ValidateDappAccessDiviner/Config.ts +0 -24
- package/src/registration/ValidateDappAccessDiviner/Diviner.ts +0 -133
- package/src/registration/ValidateDappAccessDiviner/index.ts +0 -2
- package/src/registration/index.ts +0 -2
- package/src/scripts/xyos/command/config.ts +0 -19
- package/src/scripts/xyos/command/create.ts +0 -22
- package/src/scripts/xyos/command/index.ts +0 -7
- package/src/scripts/xyos/command/manifest.ts +0 -19
- package/src/scripts/xyos/command/start.ts +0 -35
- package/src/scripts/xyos/index.ts +0 -31
- package/src/scripts/xyos/lib/createFromTemplate.ts +0 -11
- package/src/scripts/xyos/lib/headless.ts +0 -68
- package/src/scripts/xyos/lib/index.ts +0 -2
- package/src/signer/Signer.spec.ts +0 -65
- package/src/signer/Signers.ts +0 -74
- package/src/signer/index.ts +0 -1
- package/src/spec/boot.spec.ts +0 -89
- package/src/stack/Base.ts +0 -165
- package/src/stack/Manager.ts +0 -51
- package/src/stack/Map.ts +0 -22
- package/src/stack/OsPubSubNetworkStack.ts +0 -70
- package/src/stack/OsSettingsStack.ts +0 -24
- package/src/stack/XyoPublicNetworkStack.ts +0 -32
- package/src/stack/index.ts +0 -6
- package/src/system/ManageSystemDapps.ts +0 -148
- package/src/system/Queries.ts +0 -69
- package/src/system/index.ts +0 -1
- package/src/types/global.d.ts +0 -9
- package/src/types/images.d.ts +0 -5
- package/src/utils/buildWalletSeedPhrasePayload.ts +0 -51
- package/src/utils/getApiDomain.ts +0 -14
- package/src/utils/index.ts +0 -3
- package/src/utils/renameObjKey.ts +0 -22
- package/src/wallet/DappSeedPhraseRepository.ts +0 -99
- package/src/wallet/SeedPhraseRepository.ts +0 -31
- package/src/wallet/index.ts +0 -2
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { assertEx } from '@xylabs/sdk-js'
|
|
2
|
-
import { asArchivistInstance } from '@xyo-network/archivist-model'
|
|
3
|
-
import { replaceManifestTokens } from '@xyo-network/kernel'
|
|
4
|
-
import { DappPackageManifestPayloadSchema } from '@xyo-network/manifest'
|
|
5
|
-
import type { ManifestWrapper } from '@xyo-network/manifest-wrapper'
|
|
6
|
-
import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
|
|
7
|
-
import type { ModuleFactoryLocatorInstance } from '@xyo-network/module-model'
|
|
8
|
-
import type { NodeInstance } from '@xyo-network/node-model'
|
|
9
|
-
import type {
|
|
10
|
-
DappId, DappPackageManifestPayload, ExternalModule, XyOsContext,
|
|
11
|
-
} from '@xyo-network/os-model'
|
|
12
|
-
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
13
|
-
|
|
14
|
-
import type { DappNodesCreatorParams } from '../../../classes/lib/index.ts'
|
|
15
|
-
import { DappCallerBase } from '../../../DappCallerBase.ts'
|
|
16
|
-
import { manifestReplacementTokens } from '../../../manifest/index.ts'
|
|
17
|
-
import { DefaultPayloads } from './DefaultPayloads/index.ts'
|
|
18
|
-
import { ExternalModulePermissions } from './ExternalModulePermissions/index.ts'
|
|
19
|
-
|
|
20
|
-
export type TargetDappManifestParams = ConstructorParameters<typeof ManifestWrapper<DappPackageManifestPayload>>
|
|
21
|
-
|
|
22
|
-
export class DappContextCreator {
|
|
23
|
-
// Designated offset path for the wallet used by windowed dapps. In the future, other offsets could be used for other dapp modes
|
|
24
|
-
private static DAPP_WINDOW_WALLET_PATH = '1'
|
|
25
|
-
|
|
26
|
-
private context: XyOsContext
|
|
27
|
-
private dappId: DappId
|
|
28
|
-
private externalPermissions?: ExternalModule[]
|
|
29
|
-
private rootWallet: WalletInstance
|
|
30
|
-
private sharedLocator?: ModuleFactoryLocatorInstance
|
|
31
|
-
private targetDappManifestParams: TargetDappManifestParams
|
|
32
|
-
|
|
33
|
-
constructor(
|
|
34
|
-
targetDappManifestParams: TargetDappManifestParams,
|
|
35
|
-
dappId: DappId,
|
|
36
|
-
context: XyOsContext,
|
|
37
|
-
rootWallet: WalletInstance,
|
|
38
|
-
externalPermissions?: ExternalModule[],
|
|
39
|
-
sharedLocator?: ModuleFactoryLocatorInstance,
|
|
40
|
-
) {
|
|
41
|
-
this.targetDappManifestParams = targetDappManifestParams
|
|
42
|
-
this.dappId = dappId
|
|
43
|
-
this.context = context
|
|
44
|
-
this.rootWallet = rootWallet
|
|
45
|
-
this.externalPermissions = externalPermissions
|
|
46
|
-
this.sharedLocator = sharedLocator
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
static async create(params: DappNodesCreatorParams, xnsNodeUrl: string | undefined, xnsNetwork: string | undefined) {
|
|
50
|
-
const {
|
|
51
|
-
config, locator, context, wallet,
|
|
52
|
-
} = params
|
|
53
|
-
const {
|
|
54
|
-
payload, dappName, publicChildren, privateChildren,
|
|
55
|
-
} = config
|
|
56
|
-
|
|
57
|
-
const { external, manifestPayload } = this.parseDappPackageManifestPayload(payload, xnsNodeUrl, xnsNetwork)
|
|
58
|
-
console.debug('[DEBUG] dApp manifest', manifestPayload)
|
|
59
|
-
|
|
60
|
-
// derive a wallet for the dapp to use from the root wallet
|
|
61
|
-
const dappWallet = await wallet.derivePath(DappContextCreator.DAPP_WINDOW_WALLET_PATH)
|
|
62
|
-
const targetDappManifestParams: TargetDappManifestParams = [manifestPayload,
|
|
63
|
-
dappWallet,
|
|
64
|
-
locator ?? new ModuleFactoryLocator(),
|
|
65
|
-
publicChildren,
|
|
66
|
-
privateChildren]
|
|
67
|
-
|
|
68
|
-
const instance = new this(targetDappManifestParams, dappName, context, wallet, external?.modules, locator)
|
|
69
|
-
return instance
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Add default payloads to the archivist shared between the os and the dapp
|
|
73
|
-
static async primeDappArchivist(dappContext: XyOsContext, osContext: XyOsContext, dappName: DappId) {
|
|
74
|
-
const dappCaller = new DappCallerBase(dappContext)
|
|
75
|
-
const dappArchivist = await dappCaller.getDappArchivist()
|
|
76
|
-
const defaultPayloads = new DefaultPayloads(dappArchivist, osContext, dappName)
|
|
77
|
-
|
|
78
|
-
await defaultPayloads.insert()
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Reset the dapp archivist to remove all payloads
|
|
82
|
-
static async resetDappArchivist(context: XyOsContext) {
|
|
83
|
-
const dappModule = await context.root.resolve('DappArchivist')
|
|
84
|
-
const dappArchivist = assertEx(asArchivistInstance(dappModule), () => 'resetDappArchivist: DappArchivist not found')
|
|
85
|
-
|
|
86
|
-
await dappArchivist.clear()
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
private static parseDappPackageManifestPayload(payload: DappPackageManifestPayload, xnsNodeUrl: string | undefined, xnsNetwork: string | undefined) {
|
|
90
|
-
// extract external permissions from package manifest payload
|
|
91
|
-
const { external, ...manifestWithoutExternals } = payload
|
|
92
|
-
const manifestPayloadRaw: DappPackageManifestPayload = {
|
|
93
|
-
...manifestWithoutExternals,
|
|
94
|
-
schema: DappPackageManifestPayloadSchema,
|
|
95
|
-
}
|
|
96
|
-
console.log('DappContextCreator:parseDappPackageManifestPayload', xnsNodeUrl, xnsNetwork)
|
|
97
|
-
const manifestPayload = replaceManifestTokens(manifestPayloadRaw, manifestReplacementTokens(xnsNodeUrl, xnsNetwork))
|
|
98
|
-
return { external, manifestPayload }
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
async loadDappContext(context: XyOsContext): Promise<XyOsContext> {
|
|
102
|
-
console.log('DappNodesCreator:loadDappContext', this.dappId)
|
|
103
|
-
// build nodes and attach to dappNodes to dappWindowNode
|
|
104
|
-
const dapp
|
|
105
|
-
= (await context.dappByName(this.dappId))
|
|
106
|
-
?? (await (async () => {
|
|
107
|
-
const dapp = await context.buildDapp(this.targetDappManifestParams[0], this.dappId)
|
|
108
|
-
await dapp.boot(this.rootWallet, this.sharedLocator)
|
|
109
|
-
return dapp
|
|
110
|
-
})())
|
|
111
|
-
await this.handleExternalModulePermissions(dapp.root)
|
|
112
|
-
await DappContextCreator.primeDappArchivist(dapp, this.context, this.dappId)
|
|
113
|
-
|
|
114
|
-
return dapp
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// try to satisfy the external permissions requested by a dapp
|
|
118
|
-
private async handleExternalModulePermissions(dappWindowNode: NodeInstance) {
|
|
119
|
-
const externalModulePermissions = new ExternalModulePermissions(this.context, dappWindowNode, this.dappId, this.externalPermissions)
|
|
120
|
-
await externalModulePermissions.permit()
|
|
121
|
-
}
|
|
122
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { DappName, XyOsContext } from '@xyo-network/os-model'
|
|
2
|
-
|
|
3
|
-
import type { DefaultPayloadsInsertable } from '../../../../classes/lib/index.ts'
|
|
4
|
-
import { OsCallerBase } from '../../../../OsCallerBase.ts'
|
|
5
|
-
|
|
6
|
-
export class DappAccessPayloads implements DefaultPayloadsInsertable {
|
|
7
|
-
private context: XyOsContext
|
|
8
|
-
constructor(
|
|
9
|
-
context: XyOsContext,
|
|
10
|
-
_dappName: DappName,
|
|
11
|
-
) {
|
|
12
|
-
this.context = context
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
async payloads() {
|
|
16
|
-
const osCaller = new OsCallerBase(this.context)
|
|
17
|
-
const archivist = await osCaller.getRegisteredDappInterfacesArchivist()
|
|
18
|
-
return await archivist.all()
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
2
|
-
import type { DappName, XyOsContext } from '@xyo-network/os-model'
|
|
3
|
-
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
4
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
5
|
-
|
|
6
|
-
import type { InsertableConstructor } from '../../../../classes/lib/index.ts'
|
|
7
|
-
import { createInsertable } from '../../../../classes/lib/index.ts'
|
|
8
|
-
import { DappAccessPayloads } from './DappAccessPayloads.ts'
|
|
9
|
-
import { NodeInfoPayload } from './NodeInfoPayload.ts'
|
|
10
|
-
|
|
11
|
-
export class DefaultPayloads {
|
|
12
|
-
private dappArchivist: ArchivistInstance
|
|
13
|
-
private dappName: DappName
|
|
14
|
-
private xyOs: XyOsContext
|
|
15
|
-
|
|
16
|
-
constructor(
|
|
17
|
-
dappArchivist: ArchivistInstance,
|
|
18
|
-
xyOs: XyOsContext,
|
|
19
|
-
dappName: DappName,
|
|
20
|
-
) {
|
|
21
|
-
this.dappArchivist = dappArchivist
|
|
22
|
-
this.xyOs = xyOs
|
|
23
|
-
this.dappName = dappName
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async insert() {
|
|
27
|
-
const insertables: InsertableConstructor[] = [NodeInfoPayload, DappAccessPayloads]
|
|
28
|
-
const insertPayloads: Payload[] = []
|
|
29
|
-
for (const insertable of insertables) {
|
|
30
|
-
const classInstance = createInsertable(insertable, this.xyOs, this.dappName)
|
|
31
|
-
const payloads = await classInstance.payloads()
|
|
32
|
-
insertPayloads.push(...payloads)
|
|
33
|
-
}
|
|
34
|
-
for (const payload of insertPayloads) {
|
|
35
|
-
const [existing] = await this.dappArchivist.get([await PayloadBuilder.dataHash(payload)])
|
|
36
|
-
if (existing) continue
|
|
37
|
-
await this.dappArchivist.insert([payload])
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Address } from '@xylabs/sdk-js'
|
|
2
|
-
import type {
|
|
3
|
-
DappName, NodeOsInfo, XyOsContext,
|
|
4
|
-
} from '@xyo-network/os-model'
|
|
5
|
-
import { NodeOsInfoSchema } from '@xyo-network/os-model'
|
|
6
|
-
|
|
7
|
-
import type { DefaultPayloadsInsertable } from '../../../../classes/lib/index.ts'
|
|
8
|
-
|
|
9
|
-
export class NodeInfoPayload implements DefaultPayloadsInsertable {
|
|
10
|
-
private _context: XyOsContext
|
|
11
|
-
constructor(
|
|
12
|
-
context: XyOsContext,
|
|
13
|
-
_dappName: DappName,
|
|
14
|
-
) {
|
|
15
|
-
this._context = context
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
async payloads() {
|
|
19
|
-
const exposedNode = this._context.exposedNode
|
|
20
|
-
if (exposedNode) {
|
|
21
|
-
console.debug('[DEBUG]', 'Found Exposed Node Address', exposedNode?.address)
|
|
22
|
-
} else {
|
|
23
|
-
console.error('exposedNode not found')
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
await Promise.resolve()
|
|
27
|
-
const nodeOsInfo: NodeOsInfo = {
|
|
28
|
-
publicAddress: exposedNode?.address ?? '' as Address,
|
|
29
|
-
schema: NodeOsInfoSchema,
|
|
30
|
-
}
|
|
31
|
-
return [nodeOsInfo]
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './DefaultPayloads.ts'
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { AttachableModuleInstance, ModuleIdentifier } from '@xyo-network/module-model'
|
|
2
|
-
import type { NodeInstance } from '@xyo-network/node-model'
|
|
3
|
-
import type {
|
|
4
|
-
DappName, ExternalModule, XyOsContext,
|
|
5
|
-
} from '@xyo-network/os-model'
|
|
6
|
-
|
|
7
|
-
// Dapps can only request specific modules from the parent node
|
|
8
|
-
const ALLOWED_MODULES_FROM_PARENT = ['IntentArchivist', 'OsSettingsNode', 'OsPubSubNetworkStackNode', 'OsXyoPublicNetworkStackNode'] as const
|
|
9
|
-
|
|
10
|
-
export class ExternalModulePermissions {
|
|
11
|
-
private context: XyOsContext
|
|
12
|
-
private dappName: DappName
|
|
13
|
-
private dappWindowNode: NodeInstance
|
|
14
|
-
private externalPermissions?: ExternalModule[]
|
|
15
|
-
|
|
16
|
-
constructor(
|
|
17
|
-
context: XyOsContext,
|
|
18
|
-
dappWindowNode: NodeInstance,
|
|
19
|
-
dappName: DappName,
|
|
20
|
-
externalPermissions?: ExternalModule[],
|
|
21
|
-
) {
|
|
22
|
-
this.context = context
|
|
23
|
-
this.dappWindowNode = dappWindowNode
|
|
24
|
-
this.dappName = dappName
|
|
25
|
-
this.externalPermissions = externalPermissions
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async permit() {
|
|
29
|
-
for (const permission of this.externalPermissions ?? []) {
|
|
30
|
-
await this.permitExternalModule(permission)
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
private getExternalModuleName(permission: ExternalModule) {
|
|
35
|
-
return permission.name as (typeof ALLOWED_MODULES_FROM_PARENT)[number]
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
private async permitExternalModule(externalPermission: ExternalModule) {
|
|
39
|
-
const externalModuleName = this.getExternalModuleName(externalPermission)
|
|
40
|
-
|
|
41
|
-
if (ALLOWED_MODULES_FROM_PARENT.includes(externalModuleName)) {
|
|
42
|
-
const mod = await this.resolveExternalModule(externalModuleName)
|
|
43
|
-
await this.registerAndAttachModule(mod)
|
|
44
|
-
} else {
|
|
45
|
-
console.warn(`${this.dappName} requested ${externalModuleName} but it was not fulfilled`)
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
private async registerAndAttachModule(mod?: AttachableModuleInstance) {
|
|
50
|
-
if (mod) {
|
|
51
|
-
await this.dappWindowNode.register?.(mod)
|
|
52
|
-
await this.dappWindowNode.attach(mod.address, true)
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
private async resolveExternalModule(id: ModuleIdentifier): Promise<AttachableModuleInstance | undefined> {
|
|
57
|
-
return await this.context.root.resolve(id)
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ExternalModulePermissions.ts'
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { GenericPayloadDiviner } from '@xyo-network/diviner-payload-generic'
|
|
2
|
-
import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
|
|
3
|
-
import type { ModuleFactoryLocatorInstance } from '@xyo-network/module-model'
|
|
4
|
-
import type {
|
|
5
|
-
RegisteredDapp, WindowDappNodeSet, XyOsContext,
|
|
6
|
-
} from '@xyo-network/os-model'
|
|
7
|
-
import { HDWallet } from '@xyo-network/wallet'
|
|
8
|
-
|
|
9
|
-
import type { DappNodesCreatorParams } from '../../../classes/lib/index.ts'
|
|
10
|
-
import { DappSeedPhraseRepository } from '../../../wallet/index.ts'
|
|
11
|
-
import { DappContextCreator } from './Creator.ts'
|
|
12
|
-
|
|
13
|
-
const GenericPayloadDivinerTags = { 'network.xyo.generic.payload.diviner': 'GenericPayloadDiviner' }
|
|
14
|
-
|
|
15
|
-
const resolveLocator = (existingLocator?: ModuleFactoryLocatorInstance): ModuleFactoryLocatorInstance => {
|
|
16
|
-
const locator = existingLocator ?? new ModuleFactoryLocator()
|
|
17
|
-
locator.register(GenericPayloadDiviner.factory(), GenericPayloadDivinerTags)
|
|
18
|
-
return locator
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const createDappContext = async (
|
|
22
|
-
dapp: RegisteredDapp,
|
|
23
|
-
context: XyOsContext,
|
|
24
|
-
allowedNames: string[],
|
|
25
|
-
xnsNodeUrl: string | undefined,
|
|
26
|
-
xnsNetwork: string | undefined,
|
|
27
|
-
): Promise<WindowDappNodeSet> => {
|
|
28
|
-
console.log('createNodes')
|
|
29
|
-
try {
|
|
30
|
-
const dappSeedPhraseRepository = new DappSeedPhraseRepository(context, allowedNames)
|
|
31
|
-
const seedPhrase = await dappSeedPhraseRepository.request(dapp.config.walletId)
|
|
32
|
-
if (!seedPhrase) {
|
|
33
|
-
throw new Error(`unable to find seed phrase for walletId: ${JSON.stringify(dapp.config, null, 2)}`)
|
|
34
|
-
}
|
|
35
|
-
const wallet = await HDWallet.fromPhrase(seedPhrase)
|
|
36
|
-
const dappName = dapp.config.name
|
|
37
|
-
const { config: dappConfig, params: dappParams } = dapp
|
|
38
|
-
|
|
39
|
-
const locator = resolveLocator((dappParams.locator ?? new ModuleFactoryLocator()).merge(context.platformLocator))
|
|
40
|
-
|
|
41
|
-
const params: DappNodesCreatorParams = {
|
|
42
|
-
config: { dappName, payload: dappConfig.manifest },
|
|
43
|
-
context,
|
|
44
|
-
locator,
|
|
45
|
-
wallet,
|
|
46
|
-
}
|
|
47
|
-
const dappContextCreator = await DappContextCreator.create(params, xnsNodeUrl, xnsNetwork)
|
|
48
|
-
|
|
49
|
-
const dappContext = await dappContextCreator.loadDappContext(context)
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
context: dappContext,
|
|
53
|
-
dappWallet: wallet,
|
|
54
|
-
}
|
|
55
|
-
} catch (e) {
|
|
56
|
-
const error = e as Error
|
|
57
|
-
console.error(`Error creating dappWindow node: ${error.message}`)
|
|
58
|
-
console.error(`Error creating dappWindow node: ${error.stack}`)
|
|
59
|
-
throw new Error(`Error creating dappWindow node: ${error.message}`)
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './creator/index.ts'
|
package/src/dapp/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './context/index.ts'
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { BaseParams, EventData } from '@xylabs/sdk-js'
|
|
2
|
-
import { assertEx, BaseEmitter } from '@xylabs/sdk-js'
|
|
3
|
-
import type {
|
|
4
|
-
EventBusConnectionInterface, EventBusConnectionRequest, EventBusConnectionType,
|
|
5
|
-
} from '@xyo-network/os-model'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* A Generic Connection to add to an EventBus
|
|
9
|
-
* @param request
|
|
10
|
-
*/
|
|
11
|
-
export class EventBusConnection<TEventData extends EventData = EventData>
|
|
12
|
-
extends BaseEmitter<BaseParams, TEventData>
|
|
13
|
-
implements EventBusConnectionInterface<TEventData> {
|
|
14
|
-
_id?: string
|
|
15
|
-
description?: string
|
|
16
|
-
type: EventBusConnectionType
|
|
17
|
-
|
|
18
|
-
constructor(request: EventBusConnectionRequest) {
|
|
19
|
-
super({})
|
|
20
|
-
this.description = request.description
|
|
21
|
-
this.type = request.type
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
get id() {
|
|
25
|
-
return assertEx(this._id, () => 'Connection ID not set. Did you forget to call buildConnection()?')
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
buildConnection(id: string) {
|
|
29
|
-
this._id = id
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
assertEx, findAs, forget,
|
|
3
|
-
} from '@xylabs/sdk-js'
|
|
4
|
-
import type { ArchivistModuleEventData } from '@xyo-network/archivist'
|
|
5
|
-
import { asArchivistInstance } from '@xyo-network/archivist'
|
|
6
|
-
import { MemoryArchivist, MemoryArchivistConfigSchema } from '@xyo-network/archivist-memory'
|
|
7
|
-
import type {
|
|
8
|
-
EventBusConnectionInterface,
|
|
9
|
-
EventBusEvent,
|
|
10
|
-
EventBusInterface,
|
|
11
|
-
EventBusPubSubConnectionInterface,
|
|
12
|
-
PublisherEventListener,
|
|
13
|
-
} from '@xyo-network/os-model'
|
|
14
|
-
import {
|
|
15
|
-
asOptionalEventBusEvent,
|
|
16
|
-
isPubSubConnections,
|
|
17
|
-
} from '@xyo-network/os-model'
|
|
18
|
-
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
19
|
-
import { asSchema } from '@xyo-network/payload-model'
|
|
20
|
-
import { Mutex } from 'async-mutex'
|
|
21
|
-
import { v4 as uuid } from 'uuid'
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Event Bus implementation inspired by the DBus protocol used in Linux desktop systems for inter-process communication.
|
|
25
|
-
*
|
|
26
|
-
* General flow:
|
|
27
|
-
* 1. Connection Added
|
|
28
|
-
* 2. Publisher and Subscriber Callbacks added
|
|
29
|
-
* 3. Events occurs and stored internally
|
|
30
|
-
* 4. Subscriber Callbacks called based off stored events
|
|
31
|
-
*/
|
|
32
|
-
export class EventBus implements EventBusInterface {
|
|
33
|
-
// Internal Archivist to store event data
|
|
34
|
-
private _archivist: MemoryArchivist | undefined
|
|
35
|
-
|
|
36
|
-
// Store all connections
|
|
37
|
-
private connections: Record<string, EventBusConnectionInterface> = {}
|
|
38
|
-
|
|
39
|
-
// Store all publisher callbacks for later removal
|
|
40
|
-
private publisherCallbacks: Record<string, PublisherEventListener> = {}
|
|
41
|
-
|
|
42
|
-
private startMutex = new Mutex()
|
|
43
|
-
|
|
44
|
-
get archivist() {
|
|
45
|
-
return asArchivistInstance(
|
|
46
|
-
assertEx(this._archivist, () => 'Archivist not found. Did you forget to call start()?'),
|
|
47
|
-
'not a valid archivist instance',
|
|
48
|
-
{ required: true },
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
addConnection(connection: EventBusConnectionInterface) {
|
|
53
|
-
// unique connection id
|
|
54
|
-
const id = uuid()
|
|
55
|
-
|
|
56
|
-
// store in local cache
|
|
57
|
-
this.connections[id] = connection
|
|
58
|
-
|
|
59
|
-
// update the connection id with the generated id
|
|
60
|
-
connection.buildConnection(id)
|
|
61
|
-
|
|
62
|
-
// let existing connections know about newly published events
|
|
63
|
-
if (isPubSubConnections(connection)) {
|
|
64
|
-
this.handlePublisherAdd(connection)
|
|
65
|
-
} else {
|
|
66
|
-
throw new Error('Unsupported connection type. Must be PubSub')
|
|
67
|
-
}
|
|
68
|
-
return connection
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
removeConnection(connectionId: string) {
|
|
72
|
-
// find the existing connection
|
|
73
|
-
const connection = this.connections[connectionId]
|
|
74
|
-
if (!connection) {
|
|
75
|
-
throw new Error('Connection not found ' + connectionId)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (connection && isPubSubConnections(connection)) {
|
|
79
|
-
this.handlePublisherRemove(connection)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
delete this.connections[connectionId]
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
async start(storeName = 'EventBusArchivist') {
|
|
86
|
-
return await this.startMutex.runExclusive(async () => {
|
|
87
|
-
if (this._archivist) {
|
|
88
|
-
console.warn('EventBus already started')
|
|
89
|
-
return this
|
|
90
|
-
}
|
|
91
|
-
// Later versions could include a node that has a payload diviner to query past events
|
|
92
|
-
this._archivist = await MemoryArchivist.create({ config: { name: storeName, schema: MemoryArchivistConfigSchema } })
|
|
93
|
-
|
|
94
|
-
// start listening to inserted events from publishers
|
|
95
|
-
// NOTE: This is a very basic implementation and could be optimized by indexing on connection, eventName, and callback
|
|
96
|
-
// for faster lookups by event name
|
|
97
|
-
this.archivist.on('inserted', ({ payloads }: ArchivistModuleEventData['inserted']) => {
|
|
98
|
-
// confirm an eventBusPayload was inserted
|
|
99
|
-
const eventBusEvent = findAs(payloads, asOptionalEventBusEvent)
|
|
100
|
-
// if not an eventBusPayload, return
|
|
101
|
-
if (!eventBusEvent) return
|
|
102
|
-
// Loop through all connections
|
|
103
|
-
for (const connectionId in this.connections) {
|
|
104
|
-
const connection = this.connections[connectionId]
|
|
105
|
-
// Target PubSub connections
|
|
106
|
-
if (isPubSubConnections(connection) && connection.subscribableEvents) {
|
|
107
|
-
// Loop through all subscribable events
|
|
108
|
-
for (const [eventName, callback] of connection.subscribableEvents.entries()) {
|
|
109
|
-
// check if the event name matches the payload name
|
|
110
|
-
if (eventName !== eventBusEvent.name) continue
|
|
111
|
-
// pass the event payloads to the callback
|
|
112
|
-
if (callback) {
|
|
113
|
-
const forgettable = async () => await callback({ payloads })
|
|
114
|
-
forget(forgettable())
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
})
|
|
120
|
-
return this
|
|
121
|
-
})
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
private handlePublisherAdd(connection: EventBusPubSubConnectionInterface) {
|
|
125
|
-
// Loop through all publishable events
|
|
126
|
-
for (const eventName of connection.publishableEvents ?? []) {
|
|
127
|
-
// Create publisher callback
|
|
128
|
-
const connectionPublisherCallback: PublisherEventListener = async ({ payloads }) => {
|
|
129
|
-
// build the event payload
|
|
130
|
-
const event: EventBusEvent = { name: eventName, schema: asSchema('network.xyo.event.bus.event', true) }
|
|
131
|
-
const eventPayloads = payloads ?? []
|
|
132
|
-
event.sources = await PayloadBuilder.dataHashes(eventPayloads)
|
|
133
|
-
// Sync events to archivist
|
|
134
|
-
try {
|
|
135
|
-
await this.archivist.insert([event, ...(payloads ?? [])])
|
|
136
|
-
} catch (e) {
|
|
137
|
-
console.error('Error inserting event into archivist', e)
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
// Subscribe the publisher callback to the connection
|
|
141
|
-
connection.on(eventName, connectionPublisherCallback)
|
|
142
|
-
|
|
143
|
-
// store the publisher callback for later removal
|
|
144
|
-
const callbackId = connection.id + eventName
|
|
145
|
-
this.publisherCallbacks[callbackId] = connectionPublisherCallback
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
private handlePublisherRemove(connection: EventBusPubSubConnectionInterface) {
|
|
150
|
-
// Loop through all publishable events
|
|
151
|
-
for (const [, event] of connection.publishableEvents?.entries() ?? []) {
|
|
152
|
-
// find the publisher callback
|
|
153
|
-
const id = connection.id + event
|
|
154
|
-
const callback = this.publisherCallbacks[id]
|
|
155
|
-
|
|
156
|
-
// unsubscribe the publisher callback from the connection
|
|
157
|
-
if (callback) connection.off(event, callback)
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
EventBusPubSubConnectionInterface,
|
|
3
|
-
EventBusPubSubConnectionRequest,
|
|
4
|
-
PublisherEventListenerEventData,
|
|
5
|
-
SubscribableEventListeners,
|
|
6
|
-
} from '@xyo-network/os-model'
|
|
7
|
-
|
|
8
|
-
import { EventBusConnection } from './Connection.ts'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* A PubSub Connection to add to an EventBus
|
|
12
|
-
* @param request
|
|
13
|
-
*/
|
|
14
|
-
export class EventBusPubSubConnection<TPublisherEventData extends PublisherEventListenerEventData = PublisherEventListenerEventData>
|
|
15
|
-
extends EventBusConnection<TPublisherEventData>
|
|
16
|
-
implements EventBusPubSubConnectionInterface {
|
|
17
|
-
publishableEvents?: string[]
|
|
18
|
-
subscribableEvents?: SubscribableEventListeners
|
|
19
|
-
|
|
20
|
-
constructor(request: EventBusPubSubConnectionRequest) {
|
|
21
|
-
super(request)
|
|
22
|
-
if (request.type !== 'PubSub') {
|
|
23
|
-
throw new Error('Invalid connection type. Must be PubSub')
|
|
24
|
-
}
|
|
25
|
-
this.publishableEvents = request.publishableEvents
|
|
26
|
-
this.subscribableEvents = request.subscribableEvents
|
|
27
|
-
}
|
|
28
|
-
}
|
package/src/event/bus/index.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { EventBusPubSubConnectionRequest } from '@xyo-network/os-model'
|
|
2
|
-
|
|
3
|
-
import { EventBusPubSubConnection } from '../bus/index.ts'
|
|
4
|
-
|
|
5
|
-
export const DappAccessRequestEvent = 'dappAccessRequest'
|
|
6
|
-
|
|
7
|
-
const dappAccessRequestConnectionRequest: EventBusPubSubConnectionRequest = {
|
|
8
|
-
publishableEvents: [DappAccessRequestEvent],
|
|
9
|
-
type: 'PubSub',
|
|
10
|
-
}
|
|
11
|
-
export const dappAccessRequestConnection = () => new EventBusPubSubConnection(dappAccessRequestConnectionRequest)
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { EventBusPubSubConnectionRequest } from '@xyo-network/os-model'
|
|
2
|
-
|
|
3
|
-
import { EventBusPubSubConnection } from '../bus/index.ts'
|
|
4
|
-
|
|
5
|
-
const dappsReadyConnectionRequest: EventBusPubSubConnectionRequest = {
|
|
6
|
-
publishableEvents: ['dappsReady'],
|
|
7
|
-
type: 'PubSub',
|
|
8
|
-
}
|
|
9
|
-
export const dappsReadyConnection = () => new EventBusPubSubConnection(dappsReadyConnectionRequest)
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { EventBusPubSubConnectionRequest } from '@xyo-network/os-model'
|
|
2
|
-
|
|
3
|
-
import { EventBusPubSubConnection } from '../bus/index.ts'
|
|
4
|
-
|
|
5
|
-
export const ExposeDappRequestEvent = 'exposeDappRequest'
|
|
6
|
-
|
|
7
|
-
const exposeDappConnectionRequest: EventBusPubSubConnectionRequest = {
|
|
8
|
-
publishableEvents: [ExposeDappRequestEvent],
|
|
9
|
-
type: 'PubSub',
|
|
10
|
-
}
|
|
11
|
-
export const exposeDappRequestConnection = () => new EventBusPubSubConnection(exposeDappConnectionRequest)
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { EventBusPubSubConnectionRequest } from '@xyo-network/os-model'
|
|
2
|
-
|
|
3
|
-
import { EventBusPubSubConnection } from '../bus/index.ts'
|
|
4
|
-
|
|
5
|
-
export const OsPubSubNetworkReadyEvent = 'osPubSubNetworkReady'
|
|
6
|
-
|
|
7
|
-
const osPubSubNetworkConnectionRequest: EventBusPubSubConnectionRequest = {
|
|
8
|
-
publishableEvents: [OsPubSubNetworkReadyEvent],
|
|
9
|
-
type: 'PubSub',
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const osPubSubNetworkReadyConnection = () => new EventBusPubSubConnection(osPubSubNetworkConnectionRequest)
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { EventBusPubSubConnectionRequest } from '@xyo-network/os-model'
|
|
2
|
-
|
|
3
|
-
import { EventBusPubSubConnection } from '../bus/index.ts'
|
|
4
|
-
|
|
5
|
-
export const OsSettingsReadyEvent = 'osSettingsReady'
|
|
6
|
-
|
|
7
|
-
const osSettingsConnectionRequest: EventBusPubSubConnectionRequest = {
|
|
8
|
-
publishableEvents: [OsSettingsReadyEvent],
|
|
9
|
-
type: 'PubSub',
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const osSettingsReadyConnection = () => new EventBusPubSubConnection(osSettingsConnectionRequest)
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { EventBusPubSubConnectionRequest } from '@xyo-network/os-model'
|
|
2
|
-
|
|
3
|
-
import { EventBusPubSubConnection } from '../bus/index.ts'
|
|
4
|
-
|
|
5
|
-
export const OsXyoPublicNetworkReadyEvent = 'osXyoPublicNetworkReady'
|
|
6
|
-
|
|
7
|
-
const osXyoPublicNetworkConnectionRequest: EventBusPubSubConnectionRequest = {
|
|
8
|
-
publishableEvents: [OsXyoPublicNetworkReadyEvent],
|
|
9
|
-
type: 'PubSub',
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const osXyoPublicNetworkReadyConnection = () => new EventBusPubSubConnection(osXyoPublicNetworkConnectionRequest)
|
package/src/event/index.ts
DELETED