@xyo-network/os-runtime 7.2.1 → 7.3.1
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 +134 -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,21 +0,0 @@
|
|
|
1
|
-
import type { NodeInstance } from '@xyo-network/node-model'
|
|
2
|
-
import type { DappId } from '@xyo-network/os-model'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* A cache for running access node instances
|
|
6
|
-
*/
|
|
7
|
-
export class RunningDappAccessCache {
|
|
8
|
-
private static _cache: { [key: DappId]: NodeInstance } = {}
|
|
9
|
-
|
|
10
|
-
static get(key: DappId) {
|
|
11
|
-
return this._cache[key]
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
static has(key?: DappId) {
|
|
15
|
-
return key ? !!this._cache[key] : false
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
static set(key: DappId, value: NodeInstance) {
|
|
19
|
-
this._cache[key] = value
|
|
20
|
-
}
|
|
21
|
-
}
|
package/src/access/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './registered-names/index.ts'
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { assertEx } from '@xylabs/sdk-js'
|
|
2
|
-
import { asArchivistInstance } from '@xyo-network/archivist-model'
|
|
3
|
-
import type {
|
|
4
|
-
DappAccessRequest, RegisteredDappAccess, XyOsContext,
|
|
5
|
-
} from '@xyo-network/os-model'
|
|
6
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
7
|
-
|
|
8
|
-
import { RunningDappAccessCache } from '../../../RunningAccessDappCache.ts'
|
|
9
|
-
|
|
10
|
-
export class AccessNodeQueries {
|
|
11
|
-
protected xyOsContext: XyOsContext
|
|
12
|
-
private accessRequest: DappAccessRequest
|
|
13
|
-
private registeredDappAccess: RegisteredDappAccess
|
|
14
|
-
|
|
15
|
-
constructor(
|
|
16
|
-
xyOsContext: XyOsContext,
|
|
17
|
-
accessRequest: DappAccessRequest,
|
|
18
|
-
registeredDappAccess: RegisteredDappAccess,
|
|
19
|
-
) {
|
|
20
|
-
this.xyOsContext = xyOsContext
|
|
21
|
-
this.accessRequest = accessRequest
|
|
22
|
-
this.registeredDappAccess = registeredDappAccess
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
get nameServiceNamesAccessNode() {
|
|
26
|
-
return assertEx(RunningDappAccessCache.get(this.registeredDappAccess.registeringDappId), () => 'No access node found')
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Refresh the archivist in the dapp
|
|
30
|
-
async refresh() {
|
|
31
|
-
const archivist = await this.getArchivistFromDappNode()
|
|
32
|
-
await archivist.clear()
|
|
33
|
-
await this.run()
|
|
34
|
-
console.log('refreshed')
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Run the access node queries
|
|
38
|
-
async run() {
|
|
39
|
-
const payloads = await this.getPayloadsFromAccessNode()
|
|
40
|
-
await this.insertAccessNodePayloadsIntoDappNodeArchivist(payloads)
|
|
41
|
-
return payloads
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
private async getArchivistFromDappNode() {
|
|
45
|
-
const archivistPath = this.accessRequest?.destinationArchivist || 'DappArchivist'
|
|
46
|
-
const mod = assertEx(await this.xyOsContext.root.resolve(archivistPath), () => `Unable to find archivist at ${archivistPath}`)
|
|
47
|
-
return asArchivistInstance(mod, () => `Module at ${archivistPath} is not an archivist`, { required: true })
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
private async getPayloadsFromAccessNode() {
|
|
51
|
-
const archivistFromAccessNode = await this.resolveArchivistFromAccessNode()
|
|
52
|
-
return await archivistFromAccessNode.all()
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
private async insertAccessNodePayloadsIntoDappNodeArchivist(payloads: Payload[]) {
|
|
56
|
-
const archivist = await this.getArchivistFromDappNode()
|
|
57
|
-
await archivist.clear()
|
|
58
|
-
await archivist.insert(payloads)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
private async resolveArchivistFromAccessNode() {
|
|
62
|
-
const archivist = assertEx(
|
|
63
|
-
await this.nameServiceNamesAccessNode.resolve('PublicXnsArchivist'),
|
|
64
|
-
() => 'Unable to find archivist at PublicXnsArchivist',
|
|
65
|
-
)
|
|
66
|
-
return asArchivistInstance(archivist, () => 'PublicXnsArchivist is not an archivist', { required: true })
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { assertEx } from '@xylabs/sdk-js'
|
|
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 XnsArchivistPayloadDivinerModuleName = 'XnsArchivistPayloadDiviner'
|
|
7
|
-
export const XnsArchivistModuleName = 'XnsArchivist'
|
|
8
|
-
export const XnsRegistrationsArchivistModuleName = 'XnsRegistrationsArchivist'
|
|
9
|
-
|
|
10
|
-
export abstract class AbstractXnsCaller {
|
|
11
|
-
protected context: XyOsContext
|
|
12
|
-
constructor(context: XyOsContext) {
|
|
13
|
-
this.context = context
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Get the XnsArchivist
|
|
18
|
-
*/
|
|
19
|
-
async getXnsArchivist(pathPrefix?: string) {
|
|
20
|
-
const fullyQualifiedPath = pathPrefix ? `${pathPrefix}:${XnsArchivistModuleName}` : XnsArchivistModuleName
|
|
21
|
-
const mod = assertEx(await this.context.root.resolve(fullyQualifiedPath), () => `${fullyQualifiedPath} not found`)
|
|
22
|
-
return asArchivistInstance(mod, () => `${fullyQualifiedPath} is not an archivist`, { required: true })
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Get the XnsArchivistPayloadDiviner
|
|
27
|
-
*/
|
|
28
|
-
async getXnsArchivistPayloadDiviner(pathPrefix?: string) {
|
|
29
|
-
const fullyQualifiedPath = pathPrefix ? `${pathPrefix}:${XnsArchivistPayloadDivinerModuleName}` : XnsArchivistPayloadDivinerModuleName
|
|
30
|
-
const mod = assertEx(await this.context.root.resolve(fullyQualifiedPath), () => `${fullyQualifiedPath} not found`)
|
|
31
|
-
return asDivinerInstance(mod, () => `${fullyQualifiedPath} is not an diviner`, { required: true })
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Get the XnsRegistrationsArchivist
|
|
36
|
-
*/
|
|
37
|
-
async getXnsRegistrationsArchivist(pathPrefix?: string) {
|
|
38
|
-
const fullyQualifiedPath = pathPrefix ? `${pathPrefix}:${XnsRegistrationsArchivistModuleName}` : XnsRegistrationsArchivistModuleName
|
|
39
|
-
const mod = assertEx(await this.context.root.resolve(fullyQualifiedPath), () => `${fullyQualifiedPath} not found`)
|
|
40
|
-
return asArchivistInstance(mod, () => `${fullyQualifiedPath} is not an archivist`, { required: true })
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { assertEx } from '@xylabs/sdk-js'
|
|
2
|
-
import { isTemporalIndexingDivinerResultIndex } from '@xyo-network/diviner-temporal-indexing-model'
|
|
3
|
-
import type { TemporalIndexRegistrationResults, XyOsContext } from '@xyo-network/os-model'
|
|
4
|
-
import type { WithSources } from '@xyo-network/payload-model'
|
|
5
|
-
import type { Listener } from 'ethers'
|
|
6
|
-
|
|
7
|
-
import type { ResourceStore } from '../../../../../lib/index.ts'
|
|
8
|
-
import { PayloadStore } from '../../../../../lib/index.ts'
|
|
9
|
-
import { AbstractXnsCaller } from './AbstractXnsCaller.ts'
|
|
10
|
-
import { XnsRegistrationsResourceQueries } from './RegistrationsResourceQueries.ts'
|
|
11
|
-
|
|
12
|
-
export type XnsRegistrationsViews = 'allRegistrations'
|
|
13
|
-
|
|
14
|
-
export class XnsRegistrationsResource extends AbstractXnsCaller implements ResourceStore<XnsRegistrationsViews> {
|
|
15
|
-
protected _allRegistrations: PayloadStore<WithSources<TemporalIndexRegistrationResults>> | undefined
|
|
16
|
-
private pathPrefix?: string
|
|
17
|
-
|
|
18
|
-
constructor(
|
|
19
|
-
context: XyOsContext,
|
|
20
|
-
pathPrefix?: string,
|
|
21
|
-
) {
|
|
22
|
-
super(context)
|
|
23
|
-
this.pathPrefix = pathPrefix
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
get allRegistrations() {
|
|
27
|
-
return assertEx(this._allRegistrations)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
get subscriptions() {
|
|
31
|
-
return { allRegistrations: (cb: Listener) => this.allRegistrations.subscribe(cb) }
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
get views() {
|
|
35
|
-
return { allRegistrations: () => this.allRegistrations.getSnapshot() }
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
cleanupListeners() {
|
|
39
|
-
this.allRegistrations.cleanupListeners()
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async start() {
|
|
43
|
-
const xnsArchivistPayloadDiviner = await this.getXnsArchivistPayloadDiviner(this.pathPrefix)
|
|
44
|
-
const xnsArchivist = await this.getXnsArchivist(this.pathPrefix)
|
|
45
|
-
|
|
46
|
-
this._allRegistrations = await PayloadStore.create<WithSources<TemporalIndexRegistrationResults>>({
|
|
47
|
-
archivist: xnsArchivist,
|
|
48
|
-
getLatest: async () => await XnsRegistrationsResourceQueries.getAllRegistrations(xnsArchivistPayloadDiviner),
|
|
49
|
-
idFunction: isTemporalIndexingDivinerResultIndex,
|
|
50
|
-
})
|
|
51
|
-
}
|
|
52
|
-
}
|
package/src/access/interfaces/registered-names/helpers/resource/RegistrationsResourceQueries.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
2
|
-
import type { DivinerInstance } from '@xyo-network/diviner-model'
|
|
3
|
-
import { PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'
|
|
4
|
-
import { TemporalIndexingDivinerResultIndexSchema } from '@xyo-network/diviner-temporal-indexing-model'
|
|
5
|
-
import type { TemporalIndexRegistrationResults } from '@xyo-network/os-model'
|
|
6
|
-
import type { WithSources, WithStorageMeta } from '@xyo-network/payload-model'
|
|
7
|
-
|
|
8
|
-
export const XnsRegistrationsResourceQueries = {
|
|
9
|
-
getAllRegistrations: async (diviner: DivinerInstance) => {
|
|
10
|
-
const query = {
|
|
11
|
-
limit: 100,
|
|
12
|
-
order: 'desc',
|
|
13
|
-
schema: PayloadDivinerQuerySchema,
|
|
14
|
-
schemas: [TemporalIndexingDivinerResultIndexSchema],
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return (await diviner.divine([query])) as WithSources<TemporalIndexRegistrationResults>[]
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
getRecentRegistrations: async (archivist: ArchivistInstance) => {
|
|
21
|
-
return (await archivist.all()).toReversed() as WithStorageMeta<TemporalIndexRegistrationResults>[]
|
|
22
|
-
},
|
|
23
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './helpers/index.ts'
|
package/src/adapter/Base.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import type { BaseParams } from '@xylabs/sdk-js'
|
|
2
|
-
import {
|
|
3
|
-
assertEx, BaseEmitter, forget,
|
|
4
|
-
} from '@xylabs/sdk-js'
|
|
5
|
-
import type { ArchivistModuleEventData } from '@xyo-network/archivist'
|
|
6
|
-
import { asArchivistInstance } from '@xyo-network/archivist'
|
|
7
|
-
import type { KernelExternal } from '@xyo-network/kernel-model'
|
|
8
|
-
import { asAttachableNodeInstance } from '@xyo-network/node-model'
|
|
9
|
-
import type { NodeAdapter, NodeAdapterBaseEvents } from '@xyo-network/os-model'
|
|
10
|
-
import {
|
|
11
|
-
asSchema, type Payload, type Schema,
|
|
12
|
-
} from '@xyo-network/payload-model'
|
|
13
|
-
import { v4 as uuid } from 'uuid'
|
|
14
|
-
|
|
15
|
-
type ModuleEventPayload = {
|
|
16
|
-
event: string
|
|
17
|
-
name: string | undefined
|
|
18
|
-
schema: Schema<'network.xyo.kernel.module.event'>
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export class NodeAdapterBase extends BaseEmitter<BaseParams, NodeAdapterBaseEvents> implements NodeAdapter {
|
|
22
|
-
initialized = false
|
|
23
|
-
|
|
24
|
-
private _id: string = ''
|
|
25
|
-
private driverName: string
|
|
26
|
-
private kernel: KernelExternal
|
|
27
|
-
|
|
28
|
-
constructor(
|
|
29
|
-
kernel: KernelExternal,
|
|
30
|
-
driverName: string,
|
|
31
|
-
) {
|
|
32
|
-
super({})
|
|
33
|
-
this._id = uuid()
|
|
34
|
-
this.kernel = kernel
|
|
35
|
-
this.driverName = driverName
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
get id() {
|
|
39
|
-
return assertEx(this._id, () => 'NodeAdapterBase id not initialized')
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async start() {
|
|
43
|
-
try {
|
|
44
|
-
// listen to events inserted into the kernel events archivist
|
|
45
|
-
const moduleAttachedInsertListener = ({ payloads }: ArchivistModuleEventData['inserted']) => {
|
|
46
|
-
const moduleAttachedEvent = this.findModuleEventPayloads(payloads)
|
|
47
|
-
|
|
48
|
-
// loop through the event payloads
|
|
49
|
-
for (const payload of moduleAttachedEvent) {
|
|
50
|
-
// check if the event is for the driver
|
|
51
|
-
if (payload.name === this.driverName) {
|
|
52
|
-
this.validateAndReturnDriver()
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
// get the events archivist
|
|
57
|
-
const eventsArchivist = await this.getEventsArchivist()
|
|
58
|
-
|
|
59
|
-
// prepare the listener
|
|
60
|
-
const weakRefInsertListener = new WeakRef(moduleAttachedInsertListener)
|
|
61
|
-
const insertListenerRef = weakRefInsertListener.deref()
|
|
62
|
-
|
|
63
|
-
// attach the listener
|
|
64
|
-
if (insertListenerRef) eventsArchivist.on('inserted', insertListenerRef)
|
|
65
|
-
|
|
66
|
-
// check if the driver is already attached
|
|
67
|
-
const node = this.validateAndReturnDriver()
|
|
68
|
-
if (node) return node
|
|
69
|
-
|
|
70
|
-
// reset the initialized flag
|
|
71
|
-
this.initialized = false
|
|
72
|
-
} catch (error) {
|
|
73
|
-
// call the onError callbacks
|
|
74
|
-
await this.emit('driverError', { error: error as Error })
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
private findModuleEventPayloads(payloads: Payload[]) {
|
|
79
|
-
return payloads.filter((payload): payload is ModuleEventPayload => {
|
|
80
|
-
const payloadToTest = payload as ModuleEventPayload
|
|
81
|
-
return payloadToTest.event === 'driverReady' && payloadToTest.schema === asSchema('network.xyo.kernel.module.event', true)
|
|
82
|
-
})
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
private async getEventsArchivist() {
|
|
86
|
-
const mod = assertEx(await (await this.kernel.getNode()).resolve('KernelNode:ModuleEvents'), () => 'KernelNode:ModuleEvents not found')
|
|
87
|
-
return asArchivistInstance(mod, () => `${mod.id} is not an archivist`, { required: true })
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
private validateAndReturnDriver() {
|
|
91
|
-
const mod = this.kernel.initialized[this.driverName]
|
|
92
|
-
if (mod) {
|
|
93
|
-
// confirm expected shape
|
|
94
|
-
const node = asAttachableNodeInstance(mod, () => `${mod.id} is not a node`, { required: true })
|
|
95
|
-
|
|
96
|
-
// set the initialized flag
|
|
97
|
-
this.initialized = true
|
|
98
|
-
|
|
99
|
-
// call the next callbacks
|
|
100
|
-
const emit = async () => await this.emit('driverReady', { node })
|
|
101
|
-
forget(emit())
|
|
102
|
-
|
|
103
|
-
return node
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
package/src/adapter/Network.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { KernelExternal } from '@xyo-network/kernel-model'
|
|
2
|
-
import type { AttachableNodeInstance } from '@xyo-network/node-model'
|
|
3
|
-
import type { NetworkAdapterBase } from '@xyo-network/os-model'
|
|
4
|
-
|
|
5
|
-
import { NodeAdapterBase } from './Base.ts'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Adapts Network Driver to the Operating System
|
|
9
|
-
*/
|
|
10
|
-
export class NetworkAdapter extends NodeAdapterBase implements NetworkAdapterBase {
|
|
11
|
-
_connection: AttachableNodeInstance | undefined
|
|
12
|
-
|
|
13
|
-
constructor(kernel: KernelExternal, driverName: string) {
|
|
14
|
-
super(kernel, driverName)
|
|
15
|
-
this.on('driverReady', ({ node }) => {
|
|
16
|
-
this._connection = node
|
|
17
|
-
})
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
get connection() {
|
|
21
|
-
return this._connection
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
get hasConnection() {
|
|
25
|
-
return !!this.connection
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
removeConnection() {
|
|
29
|
-
this._connection = undefined
|
|
30
|
-
}
|
|
31
|
-
}
|
package/src/adapter/Settings.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { KernelExternal } from '@xyo-network/kernel-model'
|
|
2
|
-
import type { AttachableNodeInstance } from '@xyo-network/node-model'
|
|
3
|
-
|
|
4
|
-
import { NodeAdapterBase } from './Base.ts'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Adapts Settings Driver to the Operating System
|
|
8
|
-
*/
|
|
9
|
-
export class SettingsAdapter extends NodeAdapterBase {
|
|
10
|
-
private _settings: AttachableNodeInstance | undefined = undefined
|
|
11
|
-
|
|
12
|
-
constructor(kernel: KernelExternal, driverName: string) {
|
|
13
|
-
super(kernel, driverName)
|
|
14
|
-
this.on('driverReady', ({ node }) => {
|
|
15
|
-
this._settings = node
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
get hasSettings() {
|
|
20
|
-
return !!this.settings
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
get settings() {
|
|
24
|
-
return this._settings
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
removeSettings() {
|
|
28
|
-
this._settings = undefined
|
|
29
|
-
}
|
|
30
|
-
}
|
package/src/adapter/index.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { KernelExternal } from '@xyo-network/kernel-model'
|
|
2
|
-
import type { AdapterSetCreator } from '@xyo-network/os-model'
|
|
3
|
-
import { ExposedNodeOuterNodeName, PubSubBridgeNodeNodeName } from '@xyo-network/os-model'
|
|
4
|
-
|
|
5
|
-
import { NetworkAdapter } from '../adapter/index.ts'
|
|
6
|
-
|
|
7
|
-
export const OsPubSubBridgeNetworkAdapters: AdapterSetCreator = (kernel: KernelExternal) => [
|
|
8
|
-
new NetworkAdapter(kernel, PubSubBridgeNodeNodeName),
|
|
9
|
-
new NetworkAdapter(kernel, ExposedNodeOuterNodeName),
|
|
10
|
-
]
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { KernelExternal } from '@xyo-network/kernel-model'
|
|
2
|
-
import type { AdapterSetCreator } from '@xyo-network/os-model'
|
|
3
|
-
import { OsSettingsNodeName } from '@xyo-network/os-model'
|
|
4
|
-
|
|
5
|
-
import { SettingsAdapter } from '../adapter/index.ts'
|
|
6
|
-
|
|
7
|
-
export const OsSettingsAdapters: AdapterSetCreator = (kernel: KernelExternal) => [new SettingsAdapter(kernel, OsSettingsNodeName)]
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { KernelExternal } from '@xyo-network/kernel-model'
|
|
2
|
-
import type { AdapterSetCreator } from '@xyo-network/os-model'
|
|
3
|
-
import { XyoPublicNodeName } from '@xyo-network/os-model'
|
|
4
|
-
|
|
5
|
-
import { NetworkAdapter } from '../adapter/index.ts'
|
|
6
|
-
|
|
7
|
-
export const OsXyoPublicNetworkAdapters: AdapterSetCreator = (kernel: KernelExternal) => [
|
|
8
|
-
new NetworkAdapter(kernel, XyoPublicNodeName),
|
|
9
|
-
]
|
package/src/adapters/index.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { assertEx } from '@xylabs/sdk-js'
|
|
2
|
-
import type {
|
|
3
|
-
DappInjectableParams, NodeOsInfo, XyOsContext,
|
|
4
|
-
} from '@xyo-network/os-model'
|
|
5
|
-
import { isDappInjectableParams, isNodeOsInfo } from '@xyo-network/os-model'
|
|
6
|
-
|
|
7
|
-
import { DappCallerBase } from '../../DappCallerBase.ts'
|
|
8
|
-
import { DappDefaultsResourceQueries } from '../../DefaultsQueries.ts'
|
|
9
|
-
import type { Listener, ResourceStore } from '../../lib/index.ts'
|
|
10
|
-
import { PayloadStore } from '../../lib/index.ts'
|
|
11
|
-
|
|
12
|
-
export type DappDefaultsResourceViews = 'nodeOsInfo' | 'dappInjectableParamsFromRoute'
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* A resource for interacting with Dapp Defaults
|
|
16
|
-
*/
|
|
17
|
-
export class DappDefaultsResource extends DappCallerBase implements ResourceStore<DappDefaultsResourceViews> {
|
|
18
|
-
private _dappInjectableParamsFromRouteListener: PayloadStore<DappInjectableParams> | undefined
|
|
19
|
-
private _nodeOsInfoListener: PayloadStore<NodeOsInfo> | undefined
|
|
20
|
-
|
|
21
|
-
constructor(context: XyOsContext) {
|
|
22
|
-
super(context)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
get dappInjectableParamsFromRouteListener() {
|
|
26
|
-
return assertEx(this._dappInjectableParamsFromRouteListener, () => 'DappInjectableParams not found')
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
get nodeOsInfoListener() {
|
|
30
|
-
return assertEx(this._nodeOsInfoListener, () => 'NodeOsInfo not found')
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
get subscriptions() {
|
|
34
|
-
return {
|
|
35
|
-
dappInjectableParamsFromRoute: (cb: Listener) => this.dappInjectableParamsFromRouteListener.subscribe(cb),
|
|
36
|
-
nodeOsInfo: (cb: Listener) => this.nodeOsInfoListener.subscribe(cb),
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
get views() {
|
|
41
|
-
return {
|
|
42
|
-
dappInjectableParamsFromRoute: () => this.dappInjectableParamsFromRouteListener.getSnapshot(),
|
|
43
|
-
nodeOsInfo: () => this.nodeOsInfoListener.getSnapshot(),
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
cleanupListeners() {
|
|
48
|
-
this.nodeOsInfoListener.cleanupListeners()
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
async start() {
|
|
52
|
-
const archivist = await this.getDappArchivist()
|
|
53
|
-
const diviner = await this.getDappArchivistPayloadDiviner()
|
|
54
|
-
|
|
55
|
-
this._nodeOsInfoListener = await PayloadStore.create<NodeOsInfo>({
|
|
56
|
-
archivist,
|
|
57
|
-
getLatest: async () => await DappDefaultsResourceQueries.getNodeOsInfo(diviner),
|
|
58
|
-
idFunction: isNodeOsInfo,
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
this._dappInjectableParamsFromRouteListener = await PayloadStore.create<DappInjectableParams>({
|
|
62
|
-
archivist,
|
|
63
|
-
getLatest: async () => await DappDefaultsResourceQueries.getDappInjectableParamsFromRoute(diviner),
|
|
64
|
-
idFunction: isDappInjectableParams,
|
|
65
|
-
})
|
|
66
|
-
}
|
|
67
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './DefaultsResource.ts'
|
package/src/classes/index.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ModuleManifest } from '@xyo-network/manifest'
|
|
2
|
-
import type { ModuleFactoryLocatorInstance } from '@xyo-network/module-model'
|
|
3
|
-
import type {
|
|
4
|
-
DappName, DappPackageManifestPayload, XyOsContext,
|
|
5
|
-
} from '@xyo-network/os-model'
|
|
6
|
-
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
7
|
-
|
|
8
|
-
export type DappNodesCreatorParams = {
|
|
9
|
-
config: {
|
|
10
|
-
dappName: DappName
|
|
11
|
-
payload: DappPackageManifestPayload
|
|
12
|
-
privateChildren?: ModuleManifest[]
|
|
13
|
-
publicChildren?: ModuleManifest[]
|
|
14
|
-
}
|
|
15
|
-
context: XyOsContext
|
|
16
|
-
locator?: ModuleFactoryLocatorInstance
|
|
17
|
-
wallet: WalletInstance
|
|
18
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { DappName, XyOsContext } from '@xyo-network/os-model'
|
|
2
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
3
|
-
|
|
4
|
-
export interface InsertableConstructor { new (_xyOs: XyOsContext, dappName: DappName): DefaultPayloadsInsertable }
|
|
5
|
-
|
|
6
|
-
type InsertableConstructorParams = ConstructorParameters<InsertableConstructor>
|
|
7
|
-
|
|
8
|
-
export interface DefaultPayloadsInsertable { payloads(): Promise<Payload[]> }
|
|
9
|
-
|
|
10
|
-
export const createInsertable = (insertable: InsertableConstructor, ...params: InsertableConstructorParams) => new insertable(...params)
|
package/src/classes/lib/index.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'
|
|
2
|
-
import type {
|
|
3
|
-
DappInjectableParams,
|
|
4
|
-
DappNavItemSelection,
|
|
5
|
-
XyOsContext,
|
|
6
|
-
} from '@xyo-network/os-model'
|
|
7
|
-
import {
|
|
8
|
-
DappInjectableParamsSchema,
|
|
9
|
-
DappNavItemSelectionSchema,
|
|
10
|
-
} from '@xyo-network/os-model'
|
|
11
|
-
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
12
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
13
|
-
|
|
14
|
-
import { DappCaller } from '../../Caller.ts'
|
|
15
|
-
|
|
16
|
-
export class DappMenuCaller extends DappCaller {
|
|
17
|
-
constructor(context: XyOsContext) {
|
|
18
|
-
super(context)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Add new Payloads to the dappArchivist if they haven't already
|
|
23
|
-
* @param payloads
|
|
24
|
-
*/
|
|
25
|
-
async add(payloads: Payload[], force = false) {
|
|
26
|
-
const dappArchivist = await this.getDappArchivist()
|
|
27
|
-
|
|
28
|
-
for (const payload of payloads) {
|
|
29
|
-
const hash = await PayloadBuilder.dataHash(payload)
|
|
30
|
-
const [existing] = await dappArchivist.get([hash])
|
|
31
|
-
if (!existing || force) {
|
|
32
|
-
await dappArchivist.insert(payloads)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async currentNavSelection(): Promise<DappNavItemSelection[] | undefined> {
|
|
38
|
-
const diviner = await this.getDappArchivistPayloadDiviner()
|
|
39
|
-
const query = {
|
|
40
|
-
limit: 1,
|
|
41
|
-
order: 'desc',
|
|
42
|
-
schema: PayloadDivinerQuerySchema,
|
|
43
|
-
schemas: [DappNavItemSelectionSchema],
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return (await diviner.divine([query])) as DappNavItemSelection[]
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/*
|
|
50
|
-
* Indicate to the system that a nav item was selected
|
|
51
|
-
*
|
|
52
|
-
* @param {string} path
|
|
53
|
-
* @params {string} injectableParamsPath
|
|
54
|
-
* @returns Promise
|
|
55
|
-
*/
|
|
56
|
-
async makeNavItemSelection(path: string, injectableParamsPath?: string): Promise<void> {
|
|
57
|
-
const dappArchivist = await this.getDappArchivist()
|
|
58
|
-
const payload: DappNavItemSelection = {
|
|
59
|
-
path,
|
|
60
|
-
schema: DappNavItemSelectionSchema,
|
|
61
|
-
timestamp: Date.now(),
|
|
62
|
-
}
|
|
63
|
-
await dappArchivist.insert([payload])
|
|
64
|
-
|
|
65
|
-
if (injectableParamsPath) {
|
|
66
|
-
const injectableParams: DappInjectableParams = {
|
|
67
|
-
params: {},
|
|
68
|
-
path: injectableParamsPath,
|
|
69
|
-
schema: DappInjectableParamsSchema,
|
|
70
|
-
source: 'route',
|
|
71
|
-
timestamp: Date.now(),
|
|
72
|
-
}
|
|
73
|
-
await dappArchivist.insert([injectableParams])
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|