@xyo-network/os-runtime 3.0.1 → 3.0.3

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.
Files changed (60) hide show
  1. package/dist/neutral/index.d.ts +1 -1
  2. package/dist/neutral/index.mjs +263 -97
  3. package/dist/neutral/index.mjs.map +1 -1
  4. package/package.json +6 -6
  5. package/src/Caller.ts +5 -2
  6. package/src/DefaultsQueries.ts +6 -2
  7. package/src/XyOs.ts +19 -9
  8. package/src/XyOsBase.ts +10 -3
  9. package/src/XyOsDapp.ts +9 -3
  10. package/src/access-interfaces/ValidDappAccessInterfaces.ts +4 -4
  11. package/src/access-interfaces/registered-names/helpers/AccessNodeQueries.ts +6 -2
  12. package/src/access-interfaces/registered-names/helpers/resource/RegistrationsResource.ts +8 -8
  13. package/src/adapter/Base.ts +11 -3
  14. package/src/adapters/OsPubSubBridgeNetwork.ts +3 -1
  15. package/src/classes/cache/RunningDappCache.ts +9 -3
  16. package/src/classes/dapp/DefaultsResource.ts +9 -3
  17. package/src/classes/dapp/access/Caller.ts +5 -4
  18. package/src/classes/dapp/access/Queries.ts +6 -2
  19. package/src/classes/dapp/access/Resource.ts +9 -3
  20. package/src/classes/lib/DappCreatorParams.ts +3 -1
  21. package/src/classes/lib/Insertable.ts +5 -7
  22. package/src/classes/menu/Caller.ts +5 -2
  23. package/src/classes/menu/Queries.ts +5 -2
  24. package/src/classes/menu/Resource.ts +12 -4
  25. package/src/classes/node/Creator.ts +19 -7
  26. package/src/classes/node/DefaultPayloads/DappAccessPayloads.ts +3 -1
  27. package/src/classes/node/DefaultPayloads/DefaultPayloads.ts +3 -1
  28. package/src/classes/node/DefaultPayloads/NodeInfoPayload.ts +3 -1
  29. package/src/classes/node/DefaultPayloads/SigningKeyPayloads.ts +9 -10
  30. package/src/classes/node/ExternalModulePermissions/ExternalModulePermissions.ts +6 -2
  31. package/src/classes/node/createDappContext.ts +9 -3
  32. package/src/classes/registration/DappRegistrationService.ts +25 -7
  33. package/src/classes/registration/DappRegistry.ts +16 -8
  34. package/src/classes/registration/ValidateDappAccessDiviner/Config.ts +10 -3
  35. package/src/classes/registration/ValidateDappAccessDiviner/Diviner.ts +13 -5
  36. package/src/classes/settings/Caller.ts +3 -1
  37. package/src/classes/settings/Resource.ts +9 -3
  38. package/src/classes/settings/SettingsQueries.ts +6 -2
  39. package/src/classes/settings/badge/Resource.ts +5 -7
  40. package/src/classes/system/ManageSystemDapps.ts +7 -2
  41. package/src/classes/system/Queries.ts +2 -1
  42. package/src/event/bus/Connection.ts +3 -1
  43. package/src/event/bus/EventBus.ts +13 -4
  44. package/src/helpers/monitor/XyOsMonitor.ts +9 -7
  45. package/src/helpers/monitor/types.ts +4 -1
  46. package/src/intent/Caller.ts +6 -2
  47. package/src/intent/Resource.ts +6 -2
  48. package/src/lib/ModuleAccountPaths.ts +6 -10
  49. package/src/lib/PayloadStore.ts +9 -3
  50. package/src/lib/isPayload.ts +3 -1
  51. package/src/manifest/ManifestReplaceableTokens.ts +4 -3
  52. package/src/profileModuleEvents.ts +6 -2
  53. package/src/stack/Base.ts +18 -6
  54. package/src/stack/Manager.ts +8 -8
  55. package/src/stack/Map.ts +3 -1
  56. package/src/stack/OsPubSubNetworkStack.ts +12 -4
  57. package/src/stack/OsSettingsStack.ts +6 -2
  58. package/src/stack/XyoPublicNetworkStack.ts +6 -2
  59. package/src/utils/buildWalletSeedPhrasePayload.ts +22 -6
  60. package/src/wallet/DappSeedPhraseRepository.ts +6 -2
package/package.json CHANGED
@@ -27,8 +27,8 @@
27
27
  "@xyo-network/diviner-payload-indexeddb": "^3.0.4",
28
28
  "@xyo-network/diviner-payload-model": "^3.0.4",
29
29
  "@xyo-network/diviner-temporal-indexing-model": "^3.0.4",
30
- "@xyo-network/kernel": "^3.0.1",
31
- "@xyo-network/kernel-model": "^3.0.1",
30
+ "@xyo-network/kernel": "^3.0.3",
31
+ "@xyo-network/kernel-model": "^3.0.3",
32
32
  "@xyo-network/manifest": "^3.0.4",
33
33
  "@xyo-network/manifest-wrapper": "^3.0.4",
34
34
  "@xyo-network/module-abstract": "^3.0.4",
@@ -37,7 +37,7 @@
37
37
  "@xyo-network/module-model": "^3.0.4",
38
38
  "@xyo-network/module-resolver": "^3.0.4",
39
39
  "@xyo-network/node-model": "^3.0.4",
40
- "@xyo-network/os-model": "^3.0.1",
40
+ "@xyo-network/os-model": "^3.0.3",
41
41
  "@xyo-network/payload-builder": "^3.0.4",
42
42
  "@xyo-network/payload-model": "^3.0.4",
43
43
  "@xyo-network/wallet-model": "^3.0.4",
@@ -49,8 +49,8 @@
49
49
  "devDependencies": {
50
50
  "@types/semver": "^7.5.8",
51
51
  "@types/uuid": "^10.0.0",
52
- "@xylabs/ts-scripts-yarn3": "^4.0.0-rc.25",
53
- "@xylabs/tsconfig": "^4.0.0-rc.25",
52
+ "@xylabs/ts-scripts-yarn3": "^4.0.0-rc.28",
53
+ "@xylabs/tsconfig": "^4.0.0-rc.28",
54
54
  "typescript": "^5.5.4"
55
55
  },
56
56
  "description": "Primary SDK for using XYO Protocol 2.0",
@@ -73,6 +73,6 @@
73
73
  "url": "git+https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
74
74
  },
75
75
  "sideEffects": false,
76
- "version": "3.0.1",
76
+ "version": "3.0.3",
77
77
  "type": "module"
78
78
  }
package/src/Caller.ts CHANGED
@@ -12,7 +12,8 @@ import type {
12
12
  RegisteredDappAccess,
13
13
  SigningKey,
14
14
  SigningKeyFields,
15
- XyOsContext } from '@xyo-network/os-model'
15
+ XyOsContext,
16
+ } from '@xyo-network/os-model'
16
17
  import {
17
18
  DappAccessRequestSchema,
18
19
  DappInjectableParamsSchema,
@@ -22,7 +23,9 @@ import {
22
23
  SigningKeySchema,
23
24
  } from '@xyo-network/os-model'
24
25
  import { PayloadBuilder } from '@xyo-network/payload-builder'
25
- import type { Payload, WithMeta } from '@xyo-network/payload-model'
26
+ import type {
27
+ Payload, WithMeta,
28
+ } from '@xyo-network/payload-model'
26
29
 
27
30
  import { DappCallerBase } from './DappCallerBase.ts'
28
31
  import { DappDefaultsResourceQueries } from './DefaultsQueries.ts'
@@ -1,7 +1,11 @@
1
1
  import type { DivinerInstance } from '@xyo-network/diviner-model'
2
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'
3
+ import type {
4
+ DappInjectableParams, NodeOsInfo,
5
+ } from '@xyo-network/os-model'
6
+ import {
7
+ DappInjectableParamsSchema, NodeOsInfoSchema,
8
+ } from '@xyo-network/os-model'
5
9
  import type { WithMeta } from '@xyo-network/payload-model'
6
10
 
7
11
  export const DappDefaultsResourceQueries = {
package/src/XyOs.ts CHANGED
@@ -18,17 +18,19 @@ import type { WalletInstance } from '@xyo-network/wallet-model'
18
18
  import type { DappRegistrationServiceParams } from './classes/registration/index.ts'
19
19
  import { DappRegistrationService } from './classes/registration/index.ts'
20
20
  import { EventBus } from './event/index.ts'
21
- import type { MonitorEventConfig, XyOsMonitor } from './helpers/index.ts'
21
+ import type {
22
+ MonitorEventConfig, XyOsMonitor,
23
+ } from './helpers/index.ts'
22
24
  import { NameTransforms } from './lib/index.ts'
23
25
  import { loadOsNode } from './loadOsNode.ts'
24
26
  import type { OsPubSubNetworkStack } from './stack/index.ts'
25
- import { OsStackMap, StackManager } from './stack/index.ts'
27
+ import {
28
+ OsStackMap, StackManager,
29
+ } from './stack/index.ts'
26
30
  import type { XyOsContextParams } from './XyOsBase.ts'
27
31
  import { XyOsContextBase } from './XyOsBase.ts'
28
32
 
29
- export interface XyOsParams<TManifest extends PackageManifest = PackageManifest> extends XyOsContextParams<TManifest> {
30
- kernel: XyOsContext['kernel']
31
- }
33
+ export interface XyOsParams<TManifest extends PackageManifest = PackageManifest> extends XyOsContextParams<TManifest> { kernel: XyOsContext['kernel'] }
32
34
 
33
35
  export class XyOs extends XyOsContextBase<XyOsParams> implements XyOsContext {
34
36
  protected _exposedNode: NodeInstance | undefined
@@ -37,8 +39,12 @@ export class XyOs extends XyOsContextBase<XyOsParams> implements XyOsContext {
37
39
  protected dappRegistrationService: DappRegistrationService
38
40
  private stackManager: StackManager
39
41
 
40
- constructor({ eventBus = new EventBus(), ...params }: XyOsParams, dappsConfiguration?: DappRegistrationServiceParams, developmentMode?: boolean) {
41
- super({ eventBus, ...params })
42
+ constructor({
43
+ eventBus = new EventBus(), ...params
44
+ }: XyOsParams, dappsConfiguration?: DappRegistrationServiceParams, developmentMode?: boolean) {
45
+ super({
46
+ eventBus, ...params,
47
+ })
42
48
  this._locator = params.locator ?? new ModuleFactoryLocator()
43
49
  this.stackManager = new StackManager(OsStackMap)
44
50
  this.dappRegistrationService = new DappRegistrationService(this, dappsConfiguration, this.locator, developmentMode)
@@ -73,11 +79,15 @@ export class XyOs extends XyOsContextBase<XyOsParams> implements XyOsContext {
73
79
  }
74
80
 
75
81
  static async monitor<T>(fn: () => Promise<T>, eventConfig: MonitorEventConfig): Promise<T> {
76
- const { name, additionalProperties } = eventConfig
82
+ const {
83
+ name, additionalProperties,
84
+ } = eventConfig
77
85
  const monitor = this.monitoring
78
86
  monitor?.startTimer(name)
79
87
  const result = await fn()
80
- monitor?.stopTimer({ additionalProperties, name })
88
+ monitor?.stopTimer({
89
+ additionalProperties, name,
90
+ })
81
91
 
82
92
  return result
83
93
  }
package/src/XyOsBase.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { assertEx } from '@xylabs/assert'
2
- import type { BaseParams, JsonObject } from '@xylabs/object'
2
+ import type {
3
+ BaseParams, JsonObject,
4
+ } from '@xylabs/object'
3
5
  import type { Promisable } from '@xylabs/promise'
4
6
  import type { WalletInstance } from '@xyo-network/account'
5
7
  import type { KernelExternal } from '@xyo-network/kernel-model'
@@ -7,7 +9,9 @@ import type { PackageManifest } from '@xyo-network/manifest'
7
9
  import { BaseEmitter } from '@xyo-network/module-abstract'
8
10
  import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
9
11
  import type { NodeInstance } from '@xyo-network/node-model'
10
- import type { DappId, DappPackageManifestPayload, DappParams, EventBusInterface, StackInitializer, XyOsContext, XyOsDappContext } from '@xyo-network/os-model'
12
+ import type {
13
+ DappId, DappPackageManifestPayload, DappParams, EventBusInterface, StackInitializer, XyOsContext, XyOsDappContext,
14
+ } from '@xyo-network/os-model'
11
15
  import { Mutex } from 'async-mutex'
12
16
 
13
17
  export interface XyOsContextParams<TManifest extends PackageManifest = PackageManifest> extends BaseParams {
@@ -97,7 +101,10 @@ export class XyOsContextBase<TParams extends XyOsContextParams | void = void> ex
97
101
  throw new Error('Method not implemented. [installDapp]')
98
102
  }
99
103
 
100
- monitor<T>(_fn: () => Promise<T>, _eventConfig: { additionalProperties?: JsonObject; name: string }): Promise<T> {
104
+ monitor<T>(_fn: () => Promise<T>, _eventConfig: {
105
+ additionalProperties?: JsonObject
106
+ name: string
107
+ }): Promise<T> {
101
108
  throw new Error('Method not implemented. [monitor]')
102
109
  }
103
110
 
package/src/XyOsDapp.ts CHANGED
@@ -2,7 +2,9 @@ import { assertEx } from '@xylabs/assert'
2
2
  import type { WalletInstance } from '@xyo-network/account'
3
3
  import { ManifestWrapper } from '@xyo-network/manifest-wrapper'
4
4
  import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
5
- import type { DappPackageManifestPayload, XyOsContext, XyOsDappContext, XyOsDappDetails } from '@xyo-network/os-model'
5
+ import type {
6
+ DappPackageManifestPayload, XyOsContext, XyOsDappContext, XyOsDappDetails,
7
+ } from '@xyo-network/os-model'
6
8
  import { DappPackageManifestPayloadSchema } from '@xyo-network/os-model'
7
9
 
8
10
  import { DappWindowManifest } from './manifests/index.ts'
@@ -60,7 +62,9 @@ export class XyOsDapp extends XyOsContextBase<XyOsDappContextParams> implements
60
62
 
61
63
  console.log('XyOsDapp:boot:finalLocator', finalLocator)
62
64
 
63
- const dappNodesWrapper = new ManifestWrapper({ ...this.manifest, schema: DappPackageManifestPayloadSchema }, wallet, finalLocator)
65
+ const dappNodesWrapper = new ManifestWrapper({
66
+ ...this.manifest, schema: DappPackageManifestPayloadSchema,
67
+ }, wallet, finalLocator)
64
68
  const dappNodes = await dappNodesWrapper.loadNodes()
65
69
 
66
70
  // Derive a specific wallet for the dappManifestWrapper.
@@ -68,7 +72,9 @@ export class XyOsDapp extends XyOsContextBase<XyOsDappContextParams> implements
68
72
  const dappManifestWallet = await wallet.derivePath('99999')
69
73
  DappWindowManifest.nodes[0].config.name = this.dapp.name + 'Root'
70
74
  const wrapper = new ManifestWrapper<DappPackageManifestPayload>(
71
- { ...DappWindowManifest, schema: DappPackageManifestPayloadSchema },
75
+ {
76
+ ...DappWindowManifest, schema: DappPackageManifestPayloadSchema,
77
+ },
72
78
  dappManifestWallet,
73
79
  finalLocator,
74
80
  )
@@ -1,8 +1,8 @@
1
1
  import type { DappAccessInterface } from '@xyo-network/os-model'
2
- import { RegisteredNames, RegisteredNamesInterface } from '@xyo-network/os-model'
2
+ import {
3
+ RegisteredNames, RegisteredNamesInterface,
4
+ } from '@xyo-network/os-model'
3
5
 
4
6
  export type ValidDappAccessInterfaces = typeof RegisteredNames
5
7
 
6
- export const ValidDappAccessInterfaces: Record<string, DappAccessInterface> = {
7
- [RegisteredNames]: RegisteredNamesInterface,
8
- }
8
+ export const ValidDappAccessInterfaces: Record<string, DappAccessInterface> = { [RegisteredNames]: RegisteredNamesInterface }
@@ -1,7 +1,11 @@
1
1
  import { assertEx } from '@xylabs/assert'
2
2
  import { asArchivistInstance } from '@xyo-network/archivist-model'
3
- import type { DappAccessRequest, RegisteredDappAccess, TemporalIndexRegistrationResults, XyOsContext } from '@xyo-network/os-model'
4
- import type { WithMeta, WithSources } from '@xyo-network/payload-model'
3
+ import type {
4
+ DappAccessRequest, RegisteredDappAccess, TemporalIndexRegistrationResults, XyOsContext,
5
+ } from '@xyo-network/os-model'
6
+ import type {
7
+ WithMeta, WithSources,
8
+ } from '@xyo-network/payload-model'
5
9
 
6
10
  import { RunningDappAccessCache } from '../../../classes/cache/index.ts'
7
11
 
@@ -1,7 +1,11 @@
1
1
  import { assertEx } from '@xylabs/assert'
2
2
  import { isTemporalIndexingDivinerResultIndex } from '@xyo-network/diviner-temporal-indexing-model'
3
- import type { TemporalIndexRegistrationResults, XyOsContext } from '@xyo-network/os-model'
4
- import type { WithMeta, WithSources } from '@xyo-network/payload-model'
3
+ import type {
4
+ TemporalIndexRegistrationResults, XyOsContext,
5
+ } from '@xyo-network/os-model'
6
+ import type {
7
+ WithMeta, WithSources,
8
+ } from '@xyo-network/payload-model'
5
9
  import type { Listener } from 'ethers'
6
10
 
7
11
  import type { ResourceStore } from '../../../../lib/index.ts'
@@ -26,15 +30,11 @@ export class XnsRegistrationsResource extends AbstractXnsCaller implements Resou
26
30
  }
27
31
 
28
32
  get subscriptions() {
29
- return {
30
- allRegistrations: (cb: Listener) => this.allRegistrations.subscribe(cb),
31
- }
33
+ return { allRegistrations: (cb: Listener) => this.allRegistrations.subscribe(cb) }
32
34
  }
33
35
 
34
36
  get views() {
35
- return {
36
- allRegistrations: () => this.allRegistrations.getSnapshot(),
37
- }
37
+ return { allRegistrations: () => this.allRegistrations.getSnapshot() }
38
38
  }
39
39
 
40
40
  cleanupListeners() {
@@ -6,11 +6,19 @@ import { asArchivistInstance } from '@xyo-network/archivist'
6
6
  import type { KernelExternal } from '@xyo-network/kernel-model'
7
7
  import { BaseEmitter } from '@xyo-network/module-abstract'
8
8
  import { asAttachableNodeInstance } from '@xyo-network/node-model'
9
- import type { NodeAdapter, NodeAdapterBaseEvents } from '@xyo-network/os-model'
10
- import type { Payload, WithMeta } from '@xyo-network/payload-model'
9
+ import type {
10
+ NodeAdapter, NodeAdapterBaseEvents,
11
+ } from '@xyo-network/os-model'
12
+ import type {
13
+ Payload, WithMeta,
14
+ } from '@xyo-network/payload-model'
11
15
  import { v4 as uuid } from 'uuid'
12
16
 
13
- type ModuleEventPayload = { event: string; name: string | undefined; schema: 'network.xyo.kernel.module.event' }
17
+ type ModuleEventPayload = {
18
+ event: string
19
+ name: string | undefined
20
+ schema: 'network.xyo.kernel.module.event'
21
+ }
14
22
 
15
23
  export class NodeAdapterBase extends BaseEmitter<BaseParams, NodeAdapterBaseEvents> implements NodeAdapter {
16
24
  initialized = false
@@ -1,6 +1,8 @@
1
1
  import type { KernelExternal } from '@xyo-network/kernel-model'
2
2
  import type { AdapterSetCreator } from '@xyo-network/os-model'
3
- import { ExposedNodeOuterNodeName, PubSubBridgeNodeNodeName } from '@xyo-network/os-model'
3
+ import {
4
+ ExposedNodeOuterNodeName, PubSubBridgeNodeNodeName,
5
+ } from '@xyo-network/os-model'
4
6
 
5
7
  import { NetworkAdapter } from '../adapter/index.ts'
6
8
 
@@ -1,9 +1,13 @@
1
1
  import { assertEx } from '@xylabs/assert'
2
- import type { DappId, RegisteredDapp, WindowDappNodeSet, XyOsContext } from '@xyo-network/os-model'
2
+ import type {
3
+ DappId, RegisteredDapp, WindowDappNodeSet, XyOsContext,
4
+ } from '@xyo-network/os-model'
3
5
  import { Mutex } from 'async-mutex'
4
6
 
5
7
  import { XyOs } from '../../XyOs.ts'
6
- import { createDappContext, DappContextCreator } from '../node/index.ts'
8
+ import {
9
+ createDappContext, DappContextCreator,
10
+ } from '../node/index.ts'
7
11
 
8
12
  const findOrCreateMutex = new Mutex()
9
13
 
@@ -38,7 +42,9 @@ export class RunningDappCache {
38
42
 
39
43
  return windowDappSet
40
44
  }),
41
- { additionalProperties: { dappId }, name: 'Loading dApp' },
45
+ {
46
+ additionalProperties: { dappId }, name: 'Loading dApp',
47
+ },
42
48
  )
43
49
  }
44
50
 
@@ -1,10 +1,16 @@
1
1
  import { assertEx } from '@xylabs/assert'
2
- import type { DappInjectableParams, NodeOsInfo, XyOsContext } from '@xyo-network/os-model'
3
- import { isDappInjectableParams, isNodeOsInfo } from '@xyo-network/os-model'
2
+ import type {
3
+ DappInjectableParams, NodeOsInfo, XyOsContext,
4
+ } from '@xyo-network/os-model'
5
+ import {
6
+ isDappInjectableParams, isNodeOsInfo,
7
+ } from '@xyo-network/os-model'
4
8
 
5
9
  import { DappCallerBase } from '../../DappCallerBase.ts'
6
10
  import { DappDefaultsResourceQueries } from '../../DefaultsQueries.ts'
7
- import type { Listener, ResourceStore } from '../../lib/index.ts'
11
+ import type {
12
+ Listener, ResourceStore,
13
+ } from '../../lib/index.ts'
8
14
  import { PayloadStore } from '../../lib/index.ts'
9
15
 
10
16
  export type DappDefaultsResourceViews = 'nodeOsInfo' | 'dappInjectableParamsFromRoute'
@@ -6,14 +6,15 @@ import type {
6
6
  RegisteredDappAccess,
7
7
  RegisteredDappSet,
8
8
  RegisteredDappSetResult,
9
- XyOsContext } from '@xyo-network/os-model'
10
- import {
11
- isRegisteredDappAccessDappSet,
9
+ XyOsContext,
12
10
  } from '@xyo-network/os-model'
11
+ import { isRegisteredDappAccessDappSet } from '@xyo-network/os-model'
13
12
  import { PayloadBuilder } from '@xyo-network/payload-builder'
14
13
 
15
14
  import { OsCallerBase } from '../../../OsCallerBase.ts'
16
- import { RunningDappAccessCache, RunningDappCache } from '../../cache/index.ts'
15
+ import {
16
+ RunningDappAccessCache, RunningDappCache,
17
+ } from '../../cache/index.ts'
17
18
 
18
19
  /**
19
20
  * Caller for managing Dapp Access Nodes
@@ -1,7 +1,11 @@
1
1
  import type { DivinerInstance } from '@xyo-network/diviner-model'
2
2
  import { PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'
3
- import type { DappAccessRequest, RegisteredDappAccess } from '@xyo-network/os-model'
4
- import { DappAccessRequestSchema, RegisteredDappAccessSchema } from '@xyo-network/os-model'
3
+ import type {
4
+ DappAccessRequest, RegisteredDappAccess,
5
+ } from '@xyo-network/os-model'
6
+ import {
7
+ DappAccessRequestSchema, RegisteredDappAccessSchema,
8
+ } from '@xyo-network/os-model'
5
9
  import type { WithMeta } from '@xyo-network/payload-model'
6
10
 
7
11
  const noResults: unknown[] = []
@@ -1,9 +1,15 @@
1
1
  import { assertEx } from '@xylabs/assert'
2
- import type { DappAccessRequest, RegisteredDappAccess, XyOsContext } from '@xyo-network/os-model'
3
- import { isDappAccessRequestWithMeta, isRegisteredDappAccess } from '@xyo-network/os-model'
2
+ import type {
3
+ DappAccessRequest, RegisteredDappAccess, XyOsContext,
4
+ } from '@xyo-network/os-model'
5
+ import {
6
+ isDappAccessRequestWithMeta, isRegisteredDappAccess,
7
+ } from '@xyo-network/os-model'
4
8
 
5
9
  import { DappCallerBase } from '../../../DappCallerBase.ts'
6
- import type { Listener, ResourceStore } from '../../../lib/index.ts'
10
+ import type {
11
+ Listener, ResourceStore,
12
+ } from '../../../lib/index.ts'
7
13
  import { PayloadStore } from '../../../lib/index.ts'
8
14
  import { DappAccessRequestQueries } from './Queries.ts'
9
15
 
@@ -1,6 +1,8 @@
1
1
  import type { ModuleManifest } from '@xyo-network/manifest'
2
2
  import type { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
3
- import type { DappName, DappPackageManifestPayload, XyOsContext } from '@xyo-network/os-model'
3
+ import type {
4
+ DappName, DappPackageManifestPayload, XyOsContext,
5
+ } from '@xyo-network/os-model'
4
6
  import type { WalletInstance } from '@xyo-network/wallet-model'
5
7
 
6
8
  export type DappNodesCreatorParams = {
@@ -1,14 +1,12 @@
1
- import type { DappName, XyOsContext } from '@xyo-network/os-model'
1
+ import type {
2
+ DappName, XyOsContext,
3
+ } from '@xyo-network/os-model'
2
4
  import type { Payload } from '@xyo-network/payload-model'
3
5
 
4
- export interface InsertableConstructor {
5
- new (_xyOs: XyOsContext, dappName: DappName): DefaultPayloadsInsertable
6
- }
6
+ export interface InsertableConstructor { new (_xyOs: XyOsContext, dappName: DappName): DefaultPayloadsInsertable }
7
7
 
8
8
  type InsertableConstructorParams = ConstructorParameters<InsertableConstructor>
9
9
 
10
- export interface DefaultPayloadsInsertable {
11
- payloads(): Promise<Payload[]>
12
- }
10
+ export interface DefaultPayloadsInsertable { payloads(): Promise<Payload[]> }
13
11
 
14
12
  export const createInsertable = (insertable: InsertableConstructor, ...params: InsertableConstructorParams) => new insertable(...params)
@@ -2,13 +2,16 @@ import { PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'
2
2
  import type {
3
3
  DappInjectableParams,
4
4
  DappNavItemSelection,
5
- XyOsContext } from '@xyo-network/os-model'
5
+ XyOsContext,
6
+ } from '@xyo-network/os-model'
6
7
  import {
7
8
  DappInjectableParamsSchema,
8
9
  DappNavItemSelectionSchema,
9
10
  } from '@xyo-network/os-model'
10
11
  import { PayloadBuilder } from '@xyo-network/payload-builder'
11
- import type { Payload, WithMeta } from '@xyo-network/payload-model'
12
+ import type {
13
+ Payload, WithMeta,
14
+ } from '@xyo-network/payload-model'
12
15
 
13
16
  import { DappCaller } from '../../Caller.ts'
14
17
 
@@ -4,13 +4,16 @@ import { PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'
4
4
  import type {
5
5
  DappNavItem,
6
6
  DappNavItemSelection,
7
- DappNavMenuConfig } from '@xyo-network/os-model'
7
+ DappNavMenuConfig,
8
+ } from '@xyo-network/os-model'
8
9
  import {
9
10
  DappNavItemSchema,
10
11
  DappNavItemSelectionSchema,
11
12
  DappNavMenuConfigSchema,
12
13
  } from '@xyo-network/os-model'
13
- import type { WithMeta, WithSources } from '@xyo-network/payload-model'
14
+ import type {
15
+ WithMeta, WithSources,
16
+ } from '@xyo-network/payload-model'
14
17
 
15
18
  const NO_ITEMS: unknown[] = []
16
19
 
@@ -1,10 +1,18 @@
1
1
  import { assertEx } from '@xylabs/assert'
2
- import type { DappNavItem, DappNavItemSelection, DappNavMenuConfig, XyOsContext } from '@xyo-network/os-model'
3
- import { isDappNavItemSelection, isDappNavMenuConfig } from '@xyo-network/os-model'
4
- import type { Payload, WithMeta, WithSources } from '@xyo-network/payload-model'
2
+ import type {
3
+ DappNavItem, DappNavItemSelection, DappNavMenuConfig, XyOsContext,
4
+ } from '@xyo-network/os-model'
5
+ import {
6
+ isDappNavItemSelection, isDappNavMenuConfig,
7
+ } from '@xyo-network/os-model'
8
+ import type {
9
+ Payload, WithMeta, WithSources,
10
+ } from '@xyo-network/payload-model'
5
11
 
6
12
  import { DappCaller } from '../../Caller.ts'
7
- import type { Listener, ResourceStore } from '../../lib/index.ts'
13
+ import type {
14
+ Listener, ResourceStore,
15
+ } from '../../lib/index.ts'
8
16
  import { PayloadStore } from '../../lib/index.ts'
9
17
  import { DappMenuQueries } from './Queries.ts'
10
18
 
@@ -5,7 +5,9 @@ import { PackageManifestPayloadSchema } from '@xyo-network/manifest'
5
5
  import type { ManifestWrapper } from '@xyo-network/manifest-wrapper'
6
6
  import type { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
7
7
  import type { NodeInstance } from '@xyo-network/node-model'
8
- import type { DappId, DappPackageManifestPayload, ExternalModule, XyOsContext } from '@xyo-network/os-model'
8
+ import type {
9
+ DappId, DappPackageManifestPayload, ExternalModule, XyOsContext,
10
+ } from '@xyo-network/os-model'
9
11
  import type { WalletInstance } from '@xyo-network/wallet-model'
10
12
 
11
13
  import { DappCallerBase } from '../../DappCallerBase.ts'
@@ -30,10 +32,16 @@ export class DappContextCreator {
30
32
  ) {}
31
33
 
32
34
  static async create(params: DappNodesCreatorParams, xnsNodeUrl: string | undefined, xnsNetwork: string | undefined) {
33
- const { config, locator, context, wallet } = params
34
- const { payload, dappName, publicChildren, privateChildren } = config
35
-
36
- const { external, manifestPayload } = this.parseDappPackageManifestPayload(payload, xnsNodeUrl, xnsNetwork)
35
+ const {
36
+ config, locator, context, wallet,
37
+ } = params
38
+ const {
39
+ payload, dappName, publicChildren, privateChildren,
40
+ } = config
41
+
42
+ const {
43
+ external, manifestPayload,
44
+ } = this.parseDappPackageManifestPayload(payload, xnsNodeUrl, xnsNetwork)
37
45
  console.debug('[DEBUG] dApp manifest', manifestPayload)
38
46
 
39
47
  // derive a wallet for the dapp to use from the root wallet
@@ -63,13 +71,17 @@ export class DappContextCreator {
63
71
 
64
72
  private static parseDappPackageManifestPayload(payload: DappPackageManifestPayload, xnsNodeUrl: string | undefined, xnsNetwork: string | undefined) {
65
73
  // extract external permissions from package manifest payload
66
- const { external, ...manifestWithoutExternals } = payload
74
+ const {
75
+ external, ...manifestWithoutExternals
76
+ } = payload
67
77
  const manifestPayloadRaw: PackageManifestPayload = {
68
78
  ...manifestWithoutExternals,
69
79
  schema: PackageManifestPayloadSchema,
70
80
  }
71
81
  const manifestPayload = ReplaceManifestTokens(manifestPayloadRaw, xnsNodeUrl, xnsNetwork)
72
- return { external, manifestPayload }
82
+ return {
83
+ external, manifestPayload,
84
+ }
73
85
  }
74
86
 
75
87
  async loadDappContext(context: XyOsContext): Promise<XyOsContext> {
@@ -1,4 +1,6 @@
1
- import type { DappName, XyOsContext } from '@xyo-network/os-model'
1
+ import type {
2
+ DappName, XyOsContext,
3
+ } from '@xyo-network/os-model'
2
4
 
3
5
  import { OsCallerBase } from '../../../OsCallerBase.ts'
4
6
  import type { DefaultPayloadsInsertable } from '../../lib/index.ts'
@@ -1,5 +1,7 @@
1
1
  import type { ArchivistInstance } from '@xyo-network/archivist-model'
2
- import type { DappName, XyOsContext } from '@xyo-network/os-model'
2
+ import type {
3
+ DappName, XyOsContext,
4
+ } from '@xyo-network/os-model'
3
5
  import { PayloadBuilder } from '@xyo-network/payload-builder'
4
6
  import type { Payload } from '@xyo-network/payload-model'
5
7
 
@@ -1,4 +1,6 @@
1
- import type { DappName, NodeOsInfo, XyOsContext } from '@xyo-network/os-model'
1
+ import type {
2
+ DappName, NodeOsInfo, XyOsContext,
3
+ } from '@xyo-network/os-model'
2
4
  import { NodeOsInfoSchema } from '@xyo-network/os-model'
3
5
 
4
6
  import type { DefaultPayloadsInsertable } from '../../lib/index.ts'
@@ -1,8 +1,12 @@
1
1
  import { assertEx } from '@xylabs/assert'
2
2
  import { hexFrom } from '@xylabs/hex'
3
3
  import { HDWallet } from '@xyo-network/account'
4
- import type { DappName, XyOsContext } from '@xyo-network/os-model'
5
- import { mnemonicArrayToString, SigningKeySchema } from '@xyo-network/os-model'
4
+ import type {
5
+ DappName, XyOsContext,
6
+ } from '@xyo-network/os-model'
7
+ import {
8
+ mnemonicArrayToString, SigningKeySchema,
9
+ } from '@xyo-network/os-model'
6
10
  import type { Payload } from '@xyo-network/payload-model'
7
11
  import { isAnyPayload } from '@xyo-network/payload-model'
8
12
  import type { WalletInstance } from '@xyo-network/wallet-model'
@@ -14,17 +18,12 @@ const DappsWithAdditionalPayloads = new Set(['Profile'])
14
18
 
15
19
  const DefaultName: DappName = 'Name Service' as const
16
20
 
17
- const DEFAULT_DAPP_ACCOUNT_PATHS: Record<string, string> = {
18
- [DefaultName]: "1'/1",
19
- } as const
21
+ const DEFAULT_DAPP_ACCOUNT_PATHS: Record<string, string> = { [DefaultName]: "1'/1" } as const
20
22
 
21
23
  // WIP - for now, dApps listed here can gain access to the signing key for other dapps
22
24
  // In the future, this will be controlled by the user
23
- const ADDITIONAL_DAPP_ACCOUNT_PATHS: Record<string, Record<string, string>> = {
24
- ['Profile']: {
25
- [DefaultName]: DEFAULT_DAPP_ACCOUNT_PATHS[DefaultName],
26
- },
27
- } as const
25
+ const ADDITIONAL_DAPP_ACCOUNT_PATHS: Record<string, Record<string, string>>
26
+ = { ['Profile']: { [DefaultName]: DEFAULT_DAPP_ACCOUNT_PATHS[DefaultName] } } as const
28
27
 
29
28
  export class SigningKeyPayloads implements DefaultPayloadsInsertable {
30
29
  constructor(
@@ -1,6 +1,10 @@
1
- import type { AttachableModuleInstance, ModuleIdentifier } from '@xyo-network/module-model'
1
+ import type {
2
+ AttachableModuleInstance, ModuleIdentifier,
3
+ } from '@xyo-network/module-model'
2
4
  import type { NodeInstance } from '@xyo-network/node-model'
3
- import type { DappName, ExternalModule, XyOsContext } from '@xyo-network/os-model'
5
+ import type {
6
+ DappName, ExternalModule, XyOsContext,
7
+ } from '@xyo-network/os-model'
4
8
 
5
9
  // Dapps can only request specific modules from the parent node
6
10
  const ALLOWED_MODULES_FROM_PARENT = ['IntentArchivist', 'OsSettingsNode', 'OsPubSubNetworkStackNode', 'OsXyoPublicNetworkStackNode'] as const