@xyo-network/os-runtime 3.0.7 → 3.0.9

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 (48) hide show
  1. package/dist/neutral/index.mjs +36 -146
  2. package/dist/neutral/index.mjs.map +1 -1
  3. package/package.json +59 -58
  4. package/src/Caller.ts +1 -3
  5. package/src/DefaultsQueries.ts +2 -6
  6. package/src/XyOs.ts +4 -12
  7. package/src/XyOsBase.ts +1 -3
  8. package/src/XyOsDapp.ts +2 -6
  9. package/src/access-interfaces/ValidDappAccessInterfaces.ts +1 -3
  10. package/src/access-interfaces/registered-names/helpers/AccessNodeQueries.ts +1 -3
  11. package/src/access-interfaces/registered-names/helpers/resource/RegistrationsResource.ts +2 -6
  12. package/src/adapter/Base.ts +2 -6
  13. package/src/adapters/OsPubSubBridgeNetwork.ts +1 -3
  14. package/src/classes/cache/RunningDappCache.ts +2 -6
  15. package/src/classes/dapp/DefaultsResource.ts +2 -6
  16. package/src/classes/dapp/access/Caller.ts +1 -3
  17. package/src/classes/dapp/access/Queries.ts +2 -6
  18. package/src/classes/dapp/access/Resource.ts +2 -6
  19. package/src/classes/lib/Insertable.ts +1 -3
  20. package/src/classes/menu/Caller.ts +1 -3
  21. package/src/classes/menu/Queries.ts +1 -3
  22. package/src/classes/menu/Resource.ts +2 -6
  23. package/src/classes/node/Creator.ts +3 -9
  24. package/src/classes/node/DefaultPayloads/DappAccessPayloads.ts +1 -3
  25. package/src/classes/node/DefaultPayloads/DefaultPayloads.ts +1 -3
  26. package/src/classes/node/DefaultPayloads/SigningKeyPayloads.ts +2 -6
  27. package/src/classes/node/ExternalModulePermissions/ExternalModulePermissions.ts +1 -3
  28. package/src/classes/node/createDappContext.ts +2 -6
  29. package/src/classes/registration/DappRegistrationService.ts +4 -12
  30. package/src/classes/registration/ValidateDappAccessDiviner/Config.ts +1 -3
  31. package/src/classes/registration/ValidateDappAccessDiviner/Diviner.ts +2 -6
  32. package/src/classes/settings/Resource.ts +2 -6
  33. package/src/classes/settings/SettingsQueries.ts +2 -6
  34. package/src/classes/settings/badge/Resource.ts +1 -3
  35. package/src/event/bus/EventBus.ts +2 -8
  36. package/src/helpers/monitor/XyOsMonitor.ts +1 -3
  37. package/src/intent/Caller.ts +1 -3
  38. package/src/intent/Resource.ts +2 -6
  39. package/src/lib/ModuleAccountPaths.ts +1 -3
  40. package/src/lib/PayloadStore.ts +1 -3
  41. package/src/lib/isPayload.ts +1 -3
  42. package/src/profileModuleEvents.ts +2 -6
  43. package/src/stack/Manager.ts +1 -3
  44. package/src/stack/OsPubSubNetworkStack.ts +4 -12
  45. package/src/stack/OsSettingsStack.ts +2 -6
  46. package/src/stack/XyoPublicNetworkStack.ts +2 -6
  47. package/src/utils/buildWalletSeedPhrasePayload.ts +2 -6
  48. package/src/wallet/DappSeedPhraseRepository.ts +1 -3
@@ -1,7 +1,5 @@
1
1
  import { assertEx } from '@xylabs/assert'
2
- import type {
3
- OsBadge, XyOsContext,
4
- } from '@xyo-network/os-model'
2
+ import type { OsBadge, XyOsContext } from '@xyo-network/os-model'
5
3
  import { isBadgeWithMeta } from '@xyo-network/os-model'
6
4
 
7
5
  import type { ResourceStore } from '../../../lib/index.ts'
@@ -87,11 +87,7 @@ export class EventBus implements EventBusInterface {
87
87
  return this
88
88
  }
89
89
  // Later versions could include a node that has a payload diviner to query past events
90
- this._archivist = await MemoryArchivist.create({
91
- config: {
92
- name: storeName, schema: MemoryArchivistConfigSchema,
93
- },
94
- })
90
+ this._archivist = await MemoryArchivist.create({ config: { name: storeName, schema: MemoryArchivistConfigSchema } })
95
91
 
96
92
  // start listening to inserted events from publishers
97
93
  // NOTE: This is a very basic implementation and could be optimized by indexing on connection, eventName, and callback
@@ -129,9 +125,7 @@ export class EventBus implements EventBusInterface {
129
125
  // Create publisher callback
130
126
  const connectionPublisherCallback: PublisherEventListener = async ({ payloads }) => {
131
127
  // build the event payload
132
- const event: EventBusEvent = {
133
- name: eventName, schema: 'network.xyo.event.bus.event',
134
- }
128
+ const event: EventBusEvent = { name: eventName, schema: 'network.xyo.event.bus.event' }
135
129
  const eventPayloads = payloads ?? []
136
130
  event.sources = await PayloadBuilder.dataHashes(eventPayloads)
137
131
  // Sync events to archivist
@@ -30,9 +30,7 @@ export abstract class XyOsMonitor {
30
30
  }
31
31
 
32
32
  stopTimer(eventConfig: MonitorEventConfig): void {
33
- const {
34
- additionalProperties, name,
35
- } = eventConfig
33
+ const { additionalProperties, name } = eventConfig
36
34
  const start = this.performanceTimers.get(name)
37
35
  if (start) {
38
36
  const end = performance.now()
@@ -2,9 +2,7 @@ import { PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'
2
2
  import type {
3
3
  DappId, DappIntent, DappIntentTypes, XyOsContext,
4
4
  } from '@xyo-network/os-model'
5
- import {
6
- DappIntentSchema, DappMode,
7
- } from '@xyo-network/os-model'
5
+ import { DappIntentSchema, DappMode } from '@xyo-network/os-model'
8
6
  import type { WithMeta } from '@xyo-network/payload-model'
9
7
 
10
8
  import { DappCallerBase } from '../DappCallerBase.ts'
@@ -1,14 +1,10 @@
1
1
  import { assertEx } from '@xylabs/assert'
2
- import type {
3
- DappIntent, XyOsContext,
4
- } from '@xyo-network/os-model'
2
+ import type { DappIntent, XyOsContext } from '@xyo-network/os-model'
5
3
  import { isDappIntent } from '@xyo-network/os-model'
6
4
  import type { WithMeta } from '@xyo-network/payload-model'
7
5
 
8
6
  import { DappCallerBase } from '../DappCallerBase.ts'
9
- import type {
10
- Listener, ResourceStore,
11
- } from '../lib/index.ts'
7
+ import type { Listener, ResourceStore } from '../lib/index.ts'
12
8
  import { PayloadStore } from '../lib/index.ts'
13
9
 
14
10
  export type DappIntentViews = 'latestDappIntent' | 'allDappIntents'
@@ -1,6 +1,4 @@
1
- import {
2
- DevelopArchivist, NodeSentinel,
3
- } from './ModuleNames.ts'
1
+ import { DevelopArchivist, NodeSentinel } from './ModuleNames.ts'
4
2
 
5
3
  export const RemoteNodeArchivistOffsetPaths: Record<string, Record<string, string>> = {
6
4
  Kerplunk: { [DevelopArchivist]: '118' },
@@ -1,6 +1,4 @@
1
- import type {
2
- ArchivistInstance, ArchivistModuleEventData,
3
- } from '@xyo-network/archivist'
1
+ import type { ArchivistInstance, ArchivistModuleEventData } from '@xyo-network/archivist'
4
2
  import type {
5
3
  Payload, WithMeta, WithSources,
6
4
  } from '@xyo-network/payload-model'
@@ -1,7 +1,5 @@
1
1
  import { AsObjectFactory } from '@xylabs/object'
2
- import type {
3
- Payload, Schema,
4
- } from '@xyo-network/payload-model'
2
+ import type { Payload, Schema } from '@xyo-network/payload-model'
5
3
 
6
4
  export const isObject = (x: unknown): x is Record<string | symbol | number, unknown> => {
7
5
  return typeof x === 'object' && !Array.isArray(x)
@@ -17,16 +17,12 @@ export const profileModuleEvents = (mod: ModuleInstance) => {
17
17
  mod.onAny(async (eventName, args) => {
18
18
  const mod = modRef.deref()
19
19
  if (mod) {
20
- const data = profileData[mod.address] ?? {
21
- allEventCount: 0, eventCounts: {},
22
- }
20
+ const data = profileData[mod.address] ?? { allEventCount: 0, eventCounts: {} }
23
21
  profileData[mod.address] = data
24
22
  data.allEventCount += 1
25
23
  data.eventCounts[eventName] = (data.eventCounts[eventName] ?? 0) + 1
26
24
  if (eventName === 'querySendStarted') {
27
- const {
28
- query, payloads = [],
29
- } = args as QuerySendStartedEventArgs
25
+ const { query, payloads = [] } = args as QuerySendStartedEventArgs
30
26
  const pairs = await PayloadBuilder.dataHashPairs(payloads)
31
27
  const foundPair = pairs.find(([, hash]) => hash === query.query)
32
28
  if (foundPair) {
@@ -31,9 +31,7 @@ export class StackManager {
31
31
 
32
32
  initialize(context: XyOsContext) {
33
33
  for (const [key, stackSet] of Object.entries(this.stackMap)) {
34
- const {
35
- stack: Stack, adapters: stackNodeModuleId,
36
- } = stackSet
34
+ const { stack: Stack, adapters: stackNodeModuleId } = stackSet
37
35
  const initializedStack = new Stack(context, stackNodeModuleId)
38
36
  initializedStack.initialize()
39
37
  this.stacks.set(key, initializedStack)
@@ -1,19 +1,11 @@
1
1
  import { assertEx } from '@xylabs/assert'
2
2
  import type { NodeInstance } from '@xyo-network/node-model'
3
- import {
4
- asAttachableNodeInstance, asNodeInstance,
5
- } from '@xyo-network/node-model'
6
- import type {
7
- AdapterSetCreator, XyOsContext,
8
- } from '@xyo-network/os-model'
9
- import {
10
- ExposedNodeOuterNodeName, PubSubBridgeNodeNodeName,
11
- } from '@xyo-network/os-model'
3
+ import { asAttachableNodeInstance, asNodeInstance } from '@xyo-network/node-model'
4
+ import type { AdapterSetCreator, XyOsContext } from '@xyo-network/os-model'
5
+ import { ExposedNodeOuterNodeName, PubSubBridgeNodeNodeName } from '@xyo-network/os-model'
12
6
 
13
7
  import type { EventBusPubSubConnection } from '../event/index.ts'
14
- import {
15
- osPubSubNetworkReadyConnection, OsPubSubNetworkReadyEvent,
16
- } from '../event/index.ts'
8
+ import { osPubSubNetworkReadyConnection, OsPubSubNetworkReadyEvent } from '../event/index.ts'
17
9
  import { initializeXns } from '../lib/index.ts'
18
10
  import { StackBase } from './Base.ts'
19
11
 
@@ -1,11 +1,7 @@
1
- import type {
2
- AdapterSetCreator, XyOsContext,
3
- } from '@xyo-network/os-model'
1
+ import type { AdapterSetCreator, XyOsContext } from '@xyo-network/os-model'
4
2
 
5
3
  import type { EventBusPubSubConnection } from '../event/index.ts'
6
- import {
7
- osSettingsReadyConnection, OsSettingsReadyEvent,
8
- } from '../event/index.ts'
4
+ import { osSettingsReadyConnection, OsSettingsReadyEvent } from '../event/index.ts'
9
5
  import { StackBase } from './Base.ts'
10
6
 
11
7
  export class OsSettingsStack extends StackBase {
@@ -1,12 +1,8 @@
1
- import type {
2
- AdapterSetCreator, XyOsContext,
3
- } from '@xyo-network/os-model'
1
+ import type { AdapterSetCreator, XyOsContext } from '@xyo-network/os-model'
4
2
  import { XyoPublicNodeName } from '@xyo-network/os-model'
5
3
 
6
4
  import type { EventBusPubSubConnection } from '../event/index.ts'
7
- import {
8
- osXyoPublicNetworkReadyConnection, OsXyoPublicNetworkReadyEvent,
9
- } from '../event/index.ts'
5
+ import { osXyoPublicNetworkReadyConnection, OsXyoPublicNetworkReadyEvent } from '../event/index.ts'
10
6
  import { StackBase } from './Base.ts'
11
7
 
12
8
  export class XyoPublicNetworkStack extends StackBase {
@@ -31,17 +31,13 @@ export const buildWalletSeedPhrasePayload = async (mnemonic: string, label: Wall
31
31
  language, mnemonic: mnemonic.split(' '), standard,
32
32
  },
33
33
  }
34
- const meta = {
35
- label, timestamp: Date.now(),
36
- }
34
+ const meta = { label, timestamp: Date.now() }
37
35
  const builder = new PayloadBuilder<WalletSeedPhrase>({
38
36
  fields, meta, schema: WalletSeedPhraseSchema,
39
37
  })
40
38
  const payload = await builder.build()
41
39
  const rootHash = await PayloadBuilder.hash(payload)
42
- return {
43
- payload, rootHash,
44
- }
40
+ return { payload, rootHash }
45
41
  }
46
42
 
47
43
  /**
@@ -8,9 +8,7 @@ import type { WithMeta } from '@xyo-network/payload-model'
8
8
  import { v4 as uuid } from 'uuid'
9
9
 
10
10
  import { OsCallerBase } from '../OsCallerBase.ts'
11
- import type {
12
- SeedPhraseId, SeedPhraseRepository,
13
- } from './SeedPhraseRepository.ts'
11
+ import type { SeedPhraseId, SeedPhraseRepository } from './SeedPhraseRepository.ts'
14
12
 
15
13
  export class DappSeedPhraseRepository extends OsCallerBase implements SeedPhraseRepository {
16
14
  // record of all dapps that have requested a seed phrase with the OS