@xyo-network/os-runtime 7.2.0 → 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 +18 -20
- package/dist/neutral/Caller.d.ts.map +1 -1
- package/dist/neutral/DappCallerBase.d.ts +2 -2
- package/dist/neutral/DappCallerBase.d.ts.map +1 -1
- package/dist/neutral/OsCallerBase.d.ts +2 -2
- package/dist/neutral/PubSubBridgeCaller.d.ts +1 -1
- package/dist/neutral/PubSubBridgeCaller.d.ts.map +1 -1
- package/dist/neutral/RunningDappCache.d.ts.map +1 -1
- package/dist/neutral/XyOs.d.ts +5 -6
- package/dist/neutral/XyOs.d.ts.map +1 -1
- package/dist/neutral/XyOsBase.d.ts +124 -7
- 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 +2 -2
- 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 +2 -2
- 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/menu/Caller.d.ts +1 -2
- package/dist/neutral/classes/menu/Caller.d.ts.map +1 -1
- package/dist/neutral/classes/settings/Caller.d.ts +2 -2
- package/dist/neutral/classes/settings/CallerBase.d.ts +1 -1
- package/dist/neutral/classes/settings/SettingsQueries.d.ts.map +1 -1
- package/dist/neutral/classes/settings/badge/Caller.d.ts +2 -2
- package/dist/neutral/classes/settings/badge/Resource.d.ts +1 -1
- package/dist/neutral/classes/settings/badge/Resource.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/Connection.d.ts +3 -4
- package/dist/neutral/event/bus/Connection.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/event/bus/PubSubConnection.d.ts +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 +3 -3
- package/dist/neutral/helpers/monitor/types.d.ts.map +1 -1
- package/dist/neutral/index.mjs +1042 -694
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/intent/Caller.d.ts +5 -5
- package/dist/neutral/lib/Listener.d.ts +1 -1
- package/dist/neutral/lib/Listener.d.ts.map +1 -1
- package/dist/neutral/lib/PayloadStore.d.ts +1 -2
- package/dist/neutral/lib/PayloadStore.d.ts.map +1 -1
- package/dist/neutral/lib/isPayload.d.ts +1 -1
- package/dist/neutral/loadOsNode.d.ts.map +1 -1
- package/dist/neutral/profileModuleEvents.d.ts +2 -4
- 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 +4 -6
- package/dist/neutral/registration/DappRegistry.d.ts.map +1 -1
- package/dist/neutral/registration/ValidateDappAccessDiviner/Config.d.ts +7 -3
- package/dist/neutral/registration/ValidateDappAccessDiviner/Config.d.ts.map +1 -1
- package/dist/neutral/registration/ValidateDappAccessDiviner/Diviner.d.ts +3 -1
- package/dist/neutral/registration/ValidateDappAccessDiviner/Diviner.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/Base.d.ts +2 -2
- package/dist/neutral/stack/Base.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 +3 -3
- package/dist/neutral/system/ManageSystemDapps.d.ts.map +1 -1
- package/dist/neutral/utils/buildWalletSeedPhrasePayload.d.ts +1 -1
- package/dist/neutral/utils/buildWalletSeedPhrasePayload.d.ts.map +1 -1
- package/dist/neutral/wallet/SeedPhraseRepository.d.ts +3 -4
- package/dist/neutral/wallet/SeedPhraseRepository.d.ts.map +1 -1
- package/dist/node/Caller.d.ts +18 -20
- package/dist/node/Caller.d.ts.map +1 -1
- package/dist/node/DappCallerBase.d.ts +2 -2
- package/dist/node/DappCallerBase.d.ts.map +1 -1
- package/dist/node/OsCallerBase.d.ts +2 -2
- package/dist/node/PubSubBridgeCaller.d.ts +1 -1
- package/dist/node/PubSubBridgeCaller.d.ts.map +1 -1
- package/dist/node/RunningDappCache.d.ts.map +1 -1
- package/dist/node/XyOs.d.ts +5 -6
- package/dist/node/XyOs.d.ts.map +1 -1
- package/dist/node/XyOsBase.d.ts +124 -7
- 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 +2 -2
- 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 +2 -2
- 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/menu/Caller.d.ts +1 -2
- package/dist/node/classes/menu/Caller.d.ts.map +1 -1
- package/dist/node/classes/settings/Caller.d.ts +2 -2
- package/dist/node/classes/settings/CallerBase.d.ts +1 -1
- package/dist/node/classes/settings/SettingsQueries.d.ts.map +1 -1
- package/dist/node/classes/settings/badge/Caller.d.ts +2 -2
- package/dist/node/classes/settings/badge/Resource.d.ts +1 -1
- package/dist/node/classes/settings/badge/Resource.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/Connection.d.ts +3 -4
- package/dist/node/event/bus/Connection.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/event/bus/PubSubConnection.d.ts +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 +3 -3
- package/dist/node/helpers/monitor/types.d.ts.map +1 -1
- package/dist/node/index.mjs +1042 -694
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/intent/Caller.d.ts +5 -5
- package/dist/node/lib/Listener.d.ts +1 -1
- package/dist/node/lib/Listener.d.ts.map +1 -1
- package/dist/node/lib/PayloadStore.d.ts +1 -2
- package/dist/node/lib/PayloadStore.d.ts.map +1 -1
- package/dist/node/lib/isPayload.d.ts +1 -1
- package/dist/node/loadOsNode.d.ts.map +1 -1
- package/dist/node/profileModuleEvents.d.ts +2 -4
- 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 +4 -6
- package/dist/node/registration/DappRegistry.d.ts.map +1 -1
- package/dist/node/registration/ValidateDappAccessDiviner/Config.d.ts +7 -3
- package/dist/node/registration/ValidateDappAccessDiviner/Config.d.ts.map +1 -1
- package/dist/node/registration/ValidateDappAccessDiviner/Diviner.d.ts +3 -1
- package/dist/node/registration/ValidateDappAccessDiviner/Diviner.d.ts.map +1 -1
- package/dist/node/scripts/xyos/index.mjs +520 -384
- 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/Base.d.ts +2 -2
- package/dist/node/stack/Base.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 +3 -3
- package/dist/node/system/ManageSystemDapps.d.ts.map +1 -1
- package/dist/node/utils/buildWalletSeedPhrasePayload.d.ts +1 -1
- package/dist/node/utils/buildWalletSeedPhrasePayload.d.ts.map +1 -1
- package/dist/node/wallet/SeedPhraseRepository.d.ts +3 -4
- package/dist/node/wallet/SeedPhraseRepository.d.ts.map +1 -1
- package/package.json +165 -55
- 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 -202
- package/src/DappCallerBase.ts +0 -56
- 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 -136
- package/src/XyOsDapp.ts +0 -103
- 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 -104
- 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 -77
- 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 -33
- package/src/event/bus/EventBus.ts +0 -159
- 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 -106
- 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 -179
- package/src/registration/DappRegistry.ts +0 -131
- 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 -32
- 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 -166
- 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 -32
- package/src/wallet/index.ts +0 -2
package/src/DappCallerBase.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import { toSafeJsonString } from '@xylabs/object'
|
|
3
|
-
import { asArchivistInstance } from '@xyo-network/archivist-model'
|
|
4
|
-
import { asDivinerInstance } from '@xyo-network/diviner-model'
|
|
5
|
-
import type { XyOsContext } from '@xyo-network/os-model'
|
|
6
|
-
|
|
7
|
-
export const DappArchivistModuleName = 'DappArchivist'
|
|
8
|
-
export const IntentArchivistModuleName = 'IntentArchivist'
|
|
9
|
-
export const IntentArchivistPayloadDivinerModuleName = 'IntentArchivistPayloadDiviner'
|
|
10
|
-
export const DappArchivistPayloadDivinerModuleName = 'DappArchivistPayloadDiviner'
|
|
11
|
-
|
|
12
|
-
export class DappCallerBase {
|
|
13
|
-
protected context: XyOsContext
|
|
14
|
-
constructor(context: XyOsContext) {
|
|
15
|
-
this.context = context
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Get the DappArchivist
|
|
20
|
-
*/
|
|
21
|
-
async getDappArchivist() {
|
|
22
|
-
const mod = assertEx(
|
|
23
|
-
await this.context.root.resolve(DappArchivistModuleName),
|
|
24
|
-
() => `${DappArchivistModuleName} not found [${toSafeJsonString(this.context.root.publicChildren())}]`,
|
|
25
|
-
)
|
|
26
|
-
return asArchivistInstance(mod, () => `${DappArchivistModuleName} is not an archivist`, { required: true })
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Get the DappArchivistPayloadDiviner
|
|
31
|
-
*/
|
|
32
|
-
async getDappArchivistPayloadDiviner() {
|
|
33
|
-
const mod = assertEx(
|
|
34
|
-
await this.context.root.resolve(DappArchivistPayloadDivinerModuleName),
|
|
35
|
-
() => `${DappArchivistPayloadDivinerModuleName} not found`,
|
|
36
|
-
)
|
|
37
|
-
return asDivinerInstance(mod, () => `${DappArchivistPayloadDivinerModuleName} is not a diviner`, { required: true })
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Get the IntentArchivist
|
|
42
|
-
*/
|
|
43
|
-
async getDappIntentArchivist() {
|
|
44
|
-
const mod = assertEx(await this.context.root.resolve(IntentArchivistModuleName), () => `${IntentArchivistModuleName} not found`)
|
|
45
|
-
return asArchivistInstance(mod, () => `${IntentArchivistModuleName} is not an archivist`, { required: true })
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Get the IntentArchivistPayloadDiviner
|
|
49
|
-
async getDappIntentArchivistPayloadDiviner() {
|
|
50
|
-
const mod = assertEx(
|
|
51
|
-
await this.context.root.resolve(IntentArchivistPayloadDivinerModuleName),
|
|
52
|
-
() => `${IntentArchivistPayloadDivinerModuleName} not found`,
|
|
53
|
-
)
|
|
54
|
-
return asDivinerInstance(mod, () => `${IntentArchivistPayloadDivinerModuleName} is not a diviner`, { required: true })
|
|
55
|
-
}
|
|
56
|
-
}
|
package/src/DefaultsQueries.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { DivinerInstance } from '@xyo-network/diviner-model'
|
|
2
|
-
import { PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'
|
|
3
|
-
import type { DappInjectableParams, NodeOsInfo } from '@xyo-network/os-model'
|
|
4
|
-
import { DappInjectableParamsSchema, NodeOsInfoSchema } from '@xyo-network/os-model'
|
|
5
|
-
import type { WithSources } from '@xyo-network/payload-model'
|
|
6
|
-
|
|
7
|
-
export const DappDefaultsResourceQueries = {
|
|
8
|
-
async getDappInjectableParamsFromRoute(diviner: DivinerInstance) {
|
|
9
|
-
const query = {
|
|
10
|
-
limit: 1,
|
|
11
|
-
order: 'desc',
|
|
12
|
-
schema: PayloadDivinerQuerySchema,
|
|
13
|
-
schemas: [DappInjectableParamsSchema],
|
|
14
|
-
source: 'route',
|
|
15
|
-
}
|
|
16
|
-
return (await diviner.divine([query])) as WithSources<DappInjectableParams>[]
|
|
17
|
-
},
|
|
18
|
-
async getNodeOsInfo(diviner: DivinerInstance) {
|
|
19
|
-
const query = {
|
|
20
|
-
limit: 1,
|
|
21
|
-
order: 'desc',
|
|
22
|
-
schema: PayloadDivinerQuerySchema,
|
|
23
|
-
schemas: [NodeOsInfoSchema],
|
|
24
|
-
}
|
|
25
|
-
return (await diviner.divine([query])) as WithSources<NodeOsInfo>[]
|
|
26
|
-
},
|
|
27
|
-
}
|
package/src/OsCallerBase.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import { asArchivistInstance } from '@xyo-network/archivist-model'
|
|
3
|
-
import { asDivinerInstance } from '@xyo-network/diviner-model'
|
|
4
|
-
import type { XyOsContext } from '@xyo-network/os-model'
|
|
5
|
-
|
|
6
|
-
export const DappsArchivistModuleName = 'DappsArchivist'
|
|
7
|
-
export const DappsArchivistDevelopmentModuleName = `${DappsArchivistModuleName}Development`
|
|
8
|
-
export const DappsArchivistPayloadDivinerModuleName = 'DappsArchivistPayloadDiviner'
|
|
9
|
-
export const DappsArchivistPayloadDevelopmentDivinerModuleName = `${DappsArchivistPayloadDivinerModuleName}Development`
|
|
10
|
-
export const RegisteredDappInterfacesArchivistModuleName = 'RegisteredDappInterfacesArchivist'
|
|
11
|
-
|
|
12
|
-
export class OsCallerBase {
|
|
13
|
-
protected context: XyOsContext
|
|
14
|
-
constructor(context: XyOsContext) {
|
|
15
|
-
this.context = context
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Get the dapps archivist
|
|
19
|
-
async getDappsArchivist() {
|
|
20
|
-
const mod = assertEx(await this.context.root.resolve(DappsArchivistModuleName), () => `${DappsArchivistModuleName} not found`)
|
|
21
|
-
return asArchivistInstance(mod, () => `${DappsArchivistModuleName} is not an archivist`, { required: true })
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Get the dapps archivist development
|
|
25
|
-
async getDappsArchivistDevelopment() {
|
|
26
|
-
const mod = assertEx(
|
|
27
|
-
await this.context.root.resolve(DappsArchivistDevelopmentModuleName),
|
|
28
|
-
() => `${DappsArchivistDevelopmentModuleName} not found`,
|
|
29
|
-
)
|
|
30
|
-
return asArchivistInstance(mod, () => `${DappsArchivistDevelopmentModuleName} is not an archivist`, { required: true })
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Get the dapps archivist payload diviner
|
|
34
|
-
async getDappsArchivistPayloadDiviner() {
|
|
35
|
-
const mod = assertEx(
|
|
36
|
-
await this.context.root.resolve(DappsArchivistPayloadDivinerModuleName),
|
|
37
|
-
() => `${DappsArchivistPayloadDivinerModuleName} not found`,
|
|
38
|
-
)
|
|
39
|
-
return asDivinerInstance(mod, () => `${DappsArchivistPayloadDivinerModuleName} is not a diviner`, { required: true })
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Get the dapps archivist payload diviner development
|
|
43
|
-
async getDappsArchivistPayloadDivinerDevelopment() {
|
|
44
|
-
const mod = assertEx(
|
|
45
|
-
await this.context.root.resolve(DappsArchivistPayloadDevelopmentDivinerModuleName),
|
|
46
|
-
() => `${DappsArchivistPayloadDevelopmentDivinerModuleName} not found`,
|
|
47
|
-
)
|
|
48
|
-
return asDivinerInstance(mod, () => `${DappsArchivistPayloadDevelopmentDivinerModuleName} is not a diviner`, { required: true })
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Get the registered dapp interfaces archivist
|
|
52
|
-
async getRegisteredDappInterfacesArchivist() {
|
|
53
|
-
const mod = assertEx(
|
|
54
|
-
await this.context.root.resolve(RegisteredDappInterfacesArchivistModuleName),
|
|
55
|
-
() => `${RegisteredDappInterfacesArchivistModuleName} not found`,
|
|
56
|
-
)
|
|
57
|
-
return asArchivistInstance(mod, () => `${RegisteredDappInterfacesArchivistModuleName} is not an archivist`, { required: true })
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import type { Address } from '@xylabs/hex'
|
|
3
|
-
import type { BridgeExposeOptions } from '@xyo-network/bridge-model'
|
|
4
|
-
import { asBridgeInstance } from '@xyo-network/bridge-model'
|
|
5
|
-
import type { NodeInstance } from '@xyo-network/node-model'
|
|
6
|
-
import { BridgedPubSubModuleName } from '@xyo-network/os-model'
|
|
7
|
-
|
|
8
|
-
export class PubSubBridgeCaller {
|
|
9
|
-
private node: NodeInstance
|
|
10
|
-
constructor(node: NodeInstance) {
|
|
11
|
-
this.node = node
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
async exposeAddresses(addresses: Address[], options?: BridgeExposeOptions) {
|
|
15
|
-
const pubSubBridge = await this.getPubSubBridge()
|
|
16
|
-
for (const address of addresses) {
|
|
17
|
-
console.log(`Exposing: ${address}`)
|
|
18
|
-
await pubSubBridge.expose(address, options)
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async unExposeAddresses(addresses: Address[]) {
|
|
23
|
-
const pubSubBridge = await this.getPubSubBridge()
|
|
24
|
-
for (const address of addresses) {
|
|
25
|
-
await pubSubBridge.unexpose?.(address)
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
private async getPubSubBridge() {
|
|
30
|
-
const mod = assertEx(await this.node.resolve(BridgedPubSubModuleName), () => `${BridgedPubSubModuleName} not found`)
|
|
31
|
-
return asBridgeInstance(mod, () => `${BridgedPubSubModuleName} is not a bridge`, { required: true })
|
|
32
|
-
}
|
|
33
|
-
}
|
package/src/RunningDappCache.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import type {
|
|
3
|
-
DappId, RegisteredDapp, WindowDappNodeSet, XyOsContext,
|
|
4
|
-
} from '@xyo-network/os-model'
|
|
5
|
-
import { Mutex } from 'async-mutex'
|
|
6
|
-
|
|
7
|
-
import { createDappContext, DappContextCreator } from './dapp/index.ts'
|
|
8
|
-
import { XyOs } from './XyOs.ts'
|
|
9
|
-
|
|
10
|
-
const findOrCreateMutex = new Mutex()
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* A cache for running node instances
|
|
14
|
-
*/
|
|
15
|
-
export class RunningDappCache {
|
|
16
|
-
private static _cache: { [key: DappId]: WindowDappNodeSet } = {}
|
|
17
|
-
|
|
18
|
-
static async findOrCreate(
|
|
19
|
-
dapp: RegisteredDapp,
|
|
20
|
-
xyOs: XyOsContext,
|
|
21
|
-
allowedNames: string[],
|
|
22
|
-
xnsNodeUrl: string | undefined,
|
|
23
|
-
xnsNetwork: string | undefined,
|
|
24
|
-
): Promise<WindowDappNodeSet> {
|
|
25
|
-
const dappId = dapp.config.name
|
|
26
|
-
|
|
27
|
-
return await XyOs.monitor<WindowDappNodeSet>(
|
|
28
|
-
async () =>
|
|
29
|
-
await findOrCreateMutex.runExclusive(async () => {
|
|
30
|
-
const existingWindowDappSet = RunningDappCache.get(dappId)
|
|
31
|
-
if (existingWindowDappSet) {
|
|
32
|
-
console.debug('[DEBUG]', `RunningDappCache, using existing node for ${dappId}`)
|
|
33
|
-
const existingDappContext = assertEx(existingWindowDappSet.context, () => 'No context found in existing dapp node')
|
|
34
|
-
await DappContextCreator.primeDappArchivist(existingDappContext, xyOs, dappId)
|
|
35
|
-
return existingWindowDappSet
|
|
36
|
-
}
|
|
37
|
-
console.debug('[DEBUG]', 'RunningDappCache:creating', dappId)
|
|
38
|
-
const windowDappSet = await createDappContext(dapp, xyOs, allowedNames, xnsNodeUrl, xnsNetwork)
|
|
39
|
-
RunningDappCache.set(dappId, windowDappSet)
|
|
40
|
-
|
|
41
|
-
return windowDappSet
|
|
42
|
-
}),
|
|
43
|
-
{ additionalProperties: { dappId }, name: 'Loading dApp' },
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
static get(key: DappId): WindowDappNodeSet | undefined {
|
|
48
|
-
return this._cache[key]
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
static has(key?: DappId) {
|
|
52
|
-
return key ? !!this._cache[key] : false
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
static set(key: DappId, value: WindowDappNodeSet) {
|
|
56
|
-
this._cache[key] = value
|
|
57
|
-
}
|
|
58
|
-
}
|
package/src/XyOs.ts
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import type { Promisable } from '@xylabs/promise'
|
|
3
|
-
import { boot } from '@xyo-network/bios'
|
|
4
|
-
import { Kernel } from '@xyo-network/kernel'
|
|
5
|
-
import type { KernelExternal } from '@xyo-network/kernel-model'
|
|
6
|
-
import type { PackageManifest } from '@xyo-network/manifest'
|
|
7
|
-
import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
|
|
8
|
-
import type { ModuleFactoryLocatorInstance } from '@xyo-network/module-model'
|
|
9
|
-
import type { NodeInstance } from '@xyo-network/node-model'
|
|
10
|
-
import type {
|
|
11
|
-
DappId,
|
|
12
|
-
DappPackageManifestPayload,
|
|
13
|
-
DappParams,
|
|
14
|
-
SignersExternal,
|
|
15
|
-
StackInitializer,
|
|
16
|
-
XyOsContext,
|
|
17
|
-
XyOsDappContext,
|
|
18
|
-
XyOsGlobal,
|
|
19
|
-
} from '@xyo-network/os-model'
|
|
20
|
-
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
21
|
-
|
|
22
|
-
import { EventBus } from './event/index.ts'
|
|
23
|
-
import type { MonitorEventConfig, XyOsMonitor } from './helpers/index.ts'
|
|
24
|
-
import { NameTransforms } from './lib/index.ts'
|
|
25
|
-
import { loadOsNode } from './loadOsNode.ts'
|
|
26
|
-
import type { DappRegistrationServiceParams } from './registration/index.ts'
|
|
27
|
-
import { DappRegistrationService } from './registration/index.ts'
|
|
28
|
-
import { Signers } from './signer/index.ts'
|
|
29
|
-
import type { OsPubSubNetworkStack, UninitializedStackMap } from './stack/index.ts'
|
|
30
|
-
import { OsStackMap, StackManager } from './stack/index.ts'
|
|
31
|
-
import type { XyOsContextParams } from './XyOsBase.ts'
|
|
32
|
-
import { XyOsContextBase } from './XyOsBase.ts'
|
|
33
|
-
|
|
34
|
-
export interface XyOsParams<TManifest extends PackageManifest = PackageManifest> extends XyOsContextParams<TManifest> {
|
|
35
|
-
dappsConfiguration?: DappRegistrationServiceParams
|
|
36
|
-
developmentMode?: boolean
|
|
37
|
-
kernel?: XyOsContext['kernel']
|
|
38
|
-
stackMap?: UninitializedStackMap
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export class XyOs extends XyOsContextBase<XyOsParams> implements XyOsContext {
|
|
42
|
-
protected _exposedNode: NodeInstance | undefined
|
|
43
|
-
protected _exposedNodeOuter: NodeInstance | undefined
|
|
44
|
-
protected _kernel: KernelExternal
|
|
45
|
-
protected _locator: ModuleFactoryLocatorInstance
|
|
46
|
-
protected dappRegistrationService: DappRegistrationService
|
|
47
|
-
protected signers: SignersExternal | undefined
|
|
48
|
-
private stackManager: StackManager
|
|
49
|
-
|
|
50
|
-
constructor({
|
|
51
|
-
logger = console,
|
|
52
|
-
eventBus = new EventBus(),
|
|
53
|
-
kernel = new Kernel({ logger }),
|
|
54
|
-
locator = new ModuleFactoryLocator(),
|
|
55
|
-
dappsConfiguration,
|
|
56
|
-
developmentMode,
|
|
57
|
-
stackMap = OsStackMap,
|
|
58
|
-
...params
|
|
59
|
-
}: XyOsParams = {}) {
|
|
60
|
-
super({
|
|
61
|
-
eventBus, kernel, locator, ...params,
|
|
62
|
-
})
|
|
63
|
-
this._locator = locator
|
|
64
|
-
this._kernel = kernel
|
|
65
|
-
this.stackManager = new StackManager(stackMap)
|
|
66
|
-
this.dappRegistrationService = new DappRegistrationService(this, dappsConfiguration, this.locator, developmentMode)
|
|
67
|
-
if (this.signerPaths && this.kernel?.bios?.seedPhraseStore) this.signers = new Signers(this.signerPaths, this.kernel?.bios?.seedPhraseStore)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
static get monitoring(): XyOsMonitor | undefined {
|
|
71
|
-
return
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
static get xyOsGlobal(): XyOsGlobal {
|
|
75
|
-
return getXyOsGlobal()
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
override get bios(): KernelExternal['bios'] | undefined {
|
|
79
|
-
return assertEx(this.params.kernel?.bios, () => 'Missing bios')
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
override get exposedNode() {
|
|
83
|
-
return this.stackManager.getStack<OsPubSubNetworkStack>('osPubSubNetworkStack')?.exposedNode
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
override get exposedNodeOuter() {
|
|
87
|
-
return this.stackManager.getStack<OsPubSubNetworkStack>('osPubSubNetworkStack')?.exposedNodeOuter
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
override get kernel(): XyOsContext['kernel'] | undefined {
|
|
91
|
-
return assertEx(this.params.kernel, () => 'Missing kernel')
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
get locator() {
|
|
95
|
-
return this._locator
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
get stacks() {
|
|
99
|
-
return this.stackManager.stacks
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
override get user() {
|
|
103
|
-
return { signers: this.signers?.getWalletKindSigner('user') }
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
static async monitor<T>(fn: () => Promise<T>, eventConfig: MonitorEventConfig): Promise<T> {
|
|
107
|
-
const { name, additionalProperties } = eventConfig
|
|
108
|
-
const monitor = this.monitoring
|
|
109
|
-
monitor?.startTimer(name)
|
|
110
|
-
const result = await fn()
|
|
111
|
-
monitor?.stopTimer({ additionalProperties, name })
|
|
112
|
-
|
|
113
|
-
return result
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
override async boot(wallet: WalletInstance, locator: ModuleFactoryLocatorInstance = new ModuleFactoryLocator()) {
|
|
117
|
-
console.warn('XyOs:boot', wallet.address)
|
|
118
|
-
const fullLocator = this._locator.merge(locator)
|
|
119
|
-
return await this._bootMutex.runExclusive(async () => {
|
|
120
|
-
await this.eventBus.start()
|
|
121
|
-
if (this.kernel?.status === 'created') {
|
|
122
|
-
await this.kernel.boot(await boot(), { locator: fullLocator, kernelDrivers: [] })
|
|
123
|
-
}
|
|
124
|
-
if (this.kernel?.status !== 'booted') {
|
|
125
|
-
throw new Error('Kernel not booted')
|
|
126
|
-
}
|
|
127
|
-
assertEx(this._root === undefined, () => 'XyOs already booted')
|
|
128
|
-
const [root] = await XyOs.monitor(async () => await loadOsNode(wallet, fullLocator), { name: 'Load XyOs' })
|
|
129
|
-
this._root = root
|
|
130
|
-
|
|
131
|
-
this.stackManager.initialize(this)
|
|
132
|
-
if (this.signers) await this.signers.initialize()
|
|
133
|
-
return this
|
|
134
|
-
})
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
override buildDapp(
|
|
138
|
-
manifest: DappPackageManifestPayload,
|
|
139
|
-
dappId = NameTransforms.slug(manifest.nodes[0]?.config.name),
|
|
140
|
-
name = NameTransforms.moduleName(manifest.nodes[0]?.config.name),
|
|
141
|
-
): Promisable<XyOsDappContext> {
|
|
142
|
-
return this.dappRegistrationService.buildDapp(manifest, dappId, name)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
override dappByName(dappId: DappId): Promisable<XyOsDappContext | undefined> {
|
|
146
|
-
return this.dappRegistrationService.builtDapps[dappId]
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
override getDappParams(dappId: DappId): DappParams {
|
|
150
|
-
return this.dappRegistrationService.getParamsForRegisteredDapp(dappId)
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
override getStack(stackName: string): StackInitializer {
|
|
154
|
-
return assertEx(this.stackManager.getStack(stackName), () => `Stack not found: ${stackName}`)
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
override async monitor<T>(fn: () => Promise<T>, eventConfig: MonitorEventConfig): Promise<T> {
|
|
158
|
-
return await XyOs.monitor<T>(fn, eventConfig)
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
override shutdown() {
|
|
162
|
-
assertEx(this._root !== undefined, () => 'XyOs not booted')
|
|
163
|
-
this._root = undefined
|
|
164
|
-
this.stackManager.stop()
|
|
165
|
-
}
|
|
166
|
-
}
|
package/src/XyOsBase.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import type { BaseParams } from '@xylabs/base'
|
|
3
|
-
import { BaseEmitter } from '@xylabs/events'
|
|
4
|
-
import type { JsonObject } from '@xylabs/object'
|
|
5
|
-
import type { Promisable } from '@xylabs/promise'
|
|
6
|
-
import type { KernelExternal } from '@xyo-network/kernel-model'
|
|
7
|
-
import type { PackageManifest } from '@xyo-network/manifest'
|
|
8
|
-
import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
|
|
9
|
-
import type { ModuleFactoryLocatorInstance } from '@xyo-network/module-model'
|
|
10
|
-
import type { NodeInstance } from '@xyo-network/node-model'
|
|
11
|
-
import type {
|
|
12
|
-
DappId, DappPackageManifestPayload, DappParams, EventBusInterface, OsUser,
|
|
13
|
-
StackInitializer, WalletKindSignerPaths, XyOsContext, XyOsDappContext,
|
|
14
|
-
} from '@xyo-network/os-model'
|
|
15
|
-
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
16
|
-
import { Mutex } from 'async-mutex'
|
|
17
|
-
|
|
18
|
-
export interface XyOsContextParams<TManifest extends PackageManifest = PackageManifest> extends BaseParams {
|
|
19
|
-
eventBus?: EventBusInterface
|
|
20
|
-
locator?: ModuleFactoryLocatorInstance
|
|
21
|
-
manifest?: TManifest
|
|
22
|
-
platformLocator?: ModuleFactoryLocator
|
|
23
|
-
signerPaths?: WalletKindSignerPaths
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export class XyOsContextBase<TParams extends XyOsContextParams | void = void> extends BaseEmitter<
|
|
27
|
-
TParams extends XyOsContextParams ? TParams : XyOsContextParams
|
|
28
|
-
> {
|
|
29
|
-
protected _bootMutex = new Mutex()
|
|
30
|
-
protected _platformLocator: ModuleFactoryLocator | undefined
|
|
31
|
-
protected _root: NodeInstance | undefined
|
|
32
|
-
|
|
33
|
-
get bios(): KernelExternal['bios'] | undefined {
|
|
34
|
-
return this.kernel?.bios
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
get eventBus(): XyOsContext['eventBus'] {
|
|
38
|
-
return assertEx(this.params.eventBus, () => 'Missing event bus')
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
get exposedNode(): NodeInstance | undefined {
|
|
42
|
-
throw new Error('Method not implemented. [exposedNode]')
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
get exposedNodeOuter(): NodeInstance | undefined {
|
|
46
|
-
throw new Error('Method not implemented. [exposedNodeOuter]')
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
get installedDapps(): DappId[] {
|
|
50
|
-
return []
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
get kernel(): XyOsContext['kernel'] | undefined {
|
|
54
|
-
return undefined
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
get manifest() {
|
|
58
|
-
return assertEx(this.params.manifest, () => 'Missing manifest')
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
get platformLocator(): ModuleFactoryLocator {
|
|
62
|
-
this._platformLocator = this._platformLocator ?? this.params.platformLocator ?? new ModuleFactoryLocator()
|
|
63
|
-
return this._platformLocator
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
get possibleRoot(): NodeInstance | undefined {
|
|
67
|
-
return this._root
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
get root(): NodeInstance {
|
|
71
|
-
return assertEx(this._root, () => 'XyOs root not set (probably not yet booted)')
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
get runningDapps(): DappId[] {
|
|
75
|
-
return []
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
get signerPaths() {
|
|
79
|
-
return this.params.signerPaths
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
get state() {
|
|
83
|
-
return this._root ? 'running' : 'stopped'
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
get user(): OsUser {
|
|
87
|
-
throw new Error('Method not implemented. [user]')
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
boot(_wallet: WalletInstance, _locator: ModuleFactoryLocator): Promisable<XyOsContext> {
|
|
91
|
-
throw new Error('Method not implemented. [boot]')
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
buildDapp(_manifest: DappPackageManifestPayload, _dappId?: DappId): Promisable<XyOsDappContext> {
|
|
95
|
-
throw new Error('Method not implemented. [buildDapp]')
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
dappByName(_dappId: DappId): Promisable<XyOsDappContext | undefined> {
|
|
99
|
-
throw new Error('Method not implemented. [runningDapp]')
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
getDappParams(_dappId: DappId): DappParams | undefined {
|
|
103
|
-
throw new Error('Method not implemented. [getDappParams]')
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
getStack(_stackName: string): StackInitializer {
|
|
107
|
-
throw new Error('Method not implemented. [getStack]')
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
installDapp(_dappId: DappId) {
|
|
111
|
-
throw new Error('Method not implemented. [installDapp]')
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
monitor<T>(_fn: () => Promise<T>, _eventConfig: {
|
|
115
|
-
additionalProperties?: JsonObject
|
|
116
|
-
name: string
|
|
117
|
-
}): Promise<T> {
|
|
118
|
-
throw new Error('Method not implemented. [monitor]')
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
shutdown() {
|
|
122
|
-
throw new Error('Method not implemented. [shutdown]')
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
startDapp(_dappId: DappId): Promisable<XyOsDappContext> {
|
|
126
|
-
throw new Error('Method not implemented. [startDapp]')
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
stopDapp(_dappId: DappId) {
|
|
130
|
-
throw new Error('Method not implemented. [stopDapp]')
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
uninstallDapp(_dappId: DappId) {
|
|
134
|
-
throw new Error('Method not implemented. [uninstallDapp]')
|
|
135
|
-
}
|
|
136
|
-
}
|
package/src/XyOsDapp.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import { ManifestWrapper } from '@xyo-network/manifest-wrapper'
|
|
3
|
-
import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
|
|
4
|
-
import type { ModuleFactoryLocatorInstance } from '@xyo-network/module-model'
|
|
5
|
-
import type {
|
|
6
|
-
DappPackageManifestPayload, OsUser, XyOsContext, XyOsDappContext, XyOsDappDetails,
|
|
7
|
-
} from '@xyo-network/os-model'
|
|
8
|
-
import { DappPackageManifestPayloadSchema } from '@xyo-network/os-model'
|
|
9
|
-
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
10
|
-
|
|
11
|
-
import { DappWindowManifest } from './manifests/index.ts'
|
|
12
|
-
import type { XyOsContextParams } from './XyOsBase.ts'
|
|
13
|
-
import { XyOsContextBase } from './XyOsBase.ts'
|
|
14
|
-
|
|
15
|
-
export interface XyOsDappContextParams extends XyOsContextParams<DappPackageManifestPayload> {
|
|
16
|
-
dapp: XyOsDappDetails
|
|
17
|
-
locator: ModuleFactoryLocatorInstance
|
|
18
|
-
parent: XyOsContext
|
|
19
|
-
user: OsUser
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export class XyOsDapp extends XyOsContextBase<XyOsDappContextParams> implements XyOsDappContext {
|
|
23
|
-
dapp: XyOsDappDetails
|
|
24
|
-
|
|
25
|
-
constructor(params: XyOsDappContextParams) {
|
|
26
|
-
super(params)
|
|
27
|
-
this.dapp = { ...params.dapp }
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
override get eventBus() {
|
|
31
|
-
return this.parent.eventBus
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
override get exposedNode() {
|
|
35
|
-
return this.parent.exposedNode
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
override get exposedNodeOuter() {
|
|
39
|
-
return this.parent.exposedNodeOuter
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @deprecated Dapps should not have access to the bios. This is done for the
|
|
44
|
-
* settings dapp, but should be refactored out. Bios could possibly be an
|
|
45
|
-
* optional property of the parent context passed in for dapps that require
|
|
46
|
-
* elevated permissions.
|
|
47
|
-
* ^^^ I believe we may want this here in that is a dApp requests access to the bios it will optionally be there
|
|
48
|
-
*/
|
|
49
|
-
override get kernel(): XyOsContextBase['kernel'] {
|
|
50
|
-
return assertEx(this.parent.kernel, () => 'Missing kernel')
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
get parent() {
|
|
54
|
-
return this.params.parent
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
get stacks() {
|
|
58
|
-
return []
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
override get user() {
|
|
62
|
-
return this.params.user
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
override async boot(wallet: WalletInstance, locator?: ModuleFactoryLocator): Promise<XyOsDappContext> {
|
|
66
|
-
return await this._bootMutex.runExclusive(async () => {
|
|
67
|
-
console.log('XyOsDapp:boot:start', wallet.address, this.dapp.id)
|
|
68
|
-
assertEx(this._root === undefined, () => 'Dapp already booted')
|
|
69
|
-
|
|
70
|
-
const finalLocator
|
|
71
|
-
= locator ? (this.params.locator ?? new ModuleFactoryLocator()).merge(locator) : (this.params.locator ?? new ModuleFactoryLocator())
|
|
72
|
-
|
|
73
|
-
console.log('XyOsDapp:boot:finalLocator', finalLocator)
|
|
74
|
-
|
|
75
|
-
const dappNodesWrapper = new ManifestWrapper({ ...this.manifest, schema: DappPackageManifestPayloadSchema }, wallet, finalLocator)
|
|
76
|
-
const dappNodes = await dappNodesWrapper.loadNodes()
|
|
77
|
-
|
|
78
|
-
// Derive a specific wallet for the dappManifestWrapper.
|
|
79
|
-
// If the dappNodes and dappManifest wrappers get the same wallet, there will be collisions.
|
|
80
|
-
const dappManifestWallet = await wallet.derivePath('99999')
|
|
81
|
-
DappWindowManifest.nodes[0].config.name = this.dapp.name + 'Root'
|
|
82
|
-
const wrapper = new ManifestWrapper<DappPackageManifestPayload>(
|
|
83
|
-
{ ...DappWindowManifest, schema: DappPackageManifestPayloadSchema },
|
|
84
|
-
dappManifestWallet,
|
|
85
|
-
finalLocator,
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
const node = await wrapper.loadNodeFromIndex(0)
|
|
89
|
-
for (const dappNode of dappNodes) {
|
|
90
|
-
await node.register(dappNode)
|
|
91
|
-
await node.attach(dappNode.address, true)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
this._root = node
|
|
95
|
-
console.log('XyOsDapp:boot:finish', wallet.address, this.dapp.id)
|
|
96
|
-
return this
|
|
97
|
-
})
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
override getStack(stackName: string) {
|
|
101
|
-
return this.parent.getStack(stackName)
|
|
102
|
-
}
|
|
103
|
-
}
|