Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
arietrouw committed Aug 3, 2024
1 parent 11ed34b commit 82e5386
Show file tree
Hide file tree
Showing 278 changed files with 1,337 additions and 1,138 deletions.
187 changes: 187 additions & 0 deletions .yarn/versions/e8b7d413.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
releases:
"@xyo-network/abstract-witness": minor
"@xyo-network/account": minor
"@xyo-network/account-model": minor
"@xyo-network/address-payload-plugin": minor
"@xyo-network/api": minor
"@xyo-network/api-models": minor
"@xyo-network/archivist": minor
"@xyo-network/archivist-abstract": minor
"@xyo-network/archivist-cookie": minor
"@xyo-network/archivist-indexeddb": minor
"@xyo-network/archivist-memory": minor
"@xyo-network/archivist-model": minor
"@xyo-network/archivist-storage": minor
"@xyo-network/archivist-view": minor
"@xyo-network/archivist-wrapper": minor
"@xyo-network/bip39": minor
"@xyo-network/boundwitness": minor
"@xyo-network/boundwitness-builder": minor
"@xyo-network/boundwitness-loader": minor
"@xyo-network/boundwitness-model": minor
"@xyo-network/boundwitness-validator": minor
"@xyo-network/boundwitness-wrapper": minor
"@xyo-network/bridge": minor
"@xyo-network/bridge-abstract": minor
"@xyo-network/bridge-http": minor
"@xyo-network/bridge-model": minor
"@xyo-network/bridge-module-resolver": minor
"@xyo-network/bridge-pub-sub": minor
"@xyo-network/bridge-websocket": minor
"@xyo-network/bridge-worker": minor
"@xyo-network/bridge-wrapper": minor
"@xyo-network/config-payload-plugin": minor
"@xyo-network/core": minor
"@xyo-network/core-payload-plugins": minor
"@xyo-network/data": minor
"@xyo-network/diviner": minor
"@xyo-network/diviner-abstract": minor
"@xyo-network/diviner-address-chain": minor
"@xyo-network/diviner-address-chain-abstract": minor
"@xyo-network/diviner-address-chain-memory": minor
"@xyo-network/diviner-address-chain-model": minor
"@xyo-network/diviner-address-history": minor
"@xyo-network/diviner-address-history-model": minor
"@xyo-network/diviner-address-space": minor
"@xyo-network/diviner-address-space-abstract": minor
"@xyo-network/diviner-address-space-memory": minor
"@xyo-network/diviner-address-space-model": minor
"@xyo-network/diviner-archivist": minor
"@xyo-network/diviner-boundwitness": minor
"@xyo-network/diviner-boundwitness-abstract": minor
"@xyo-network/diviner-boundwitness-indexeddb": minor
"@xyo-network/diviner-boundwitness-memory": minor
"@xyo-network/diviner-boundwitness-model": minor
"@xyo-network/diviner-boundwitness-stats": minor
"@xyo-network/diviner-boundwitness-stats-abstract": minor
"@xyo-network/diviner-boundwitness-stats-memory": minor
"@xyo-network/diviner-boundwitness-stats-model": minor
"@xyo-network/diviner-coin": minor
"@xyo-network/diviner-coin-user-locations": minor
"@xyo-network/diviner-coin-user-locations-abstract": minor
"@xyo-network/diviner-coin-user-locations-model": minor
"@xyo-network/diviner-distinct": minor
"@xyo-network/diviner-distinct-model": minor
"@xyo-network/diviner-forecasting": minor
"@xyo-network/diviner-forecasting-abstract": minor
"@xyo-network/diviner-forecasting-memory": minor
"@xyo-network/diviner-forecasting-method-arima": minor
"@xyo-network/diviner-forecasting-model": minor
"@xyo-network/diviner-hash-lease": minor
"@xyo-network/diviner-huri": minor
"@xyo-network/diviner-identity": minor
"@xyo-network/diviner-indexeddb": minor
"@xyo-network/diviner-indexing": minor
"@xyo-network/diviner-indexing-memory": minor
"@xyo-network/diviner-indexing-model": minor
"@xyo-network/diviner-jsonpatch": minor
"@xyo-network/diviner-jsonpatch-memory": minor
"@xyo-network/diviner-jsonpatch-model": minor
"@xyo-network/diviner-jsonpath": minor
"@xyo-network/diviner-jsonpath-aggregate": minor
"@xyo-network/diviner-jsonpath-aggregate-memory": minor
"@xyo-network/diviner-jsonpath-aggregate-model": minor
"@xyo-network/diviner-jsonpath-memory": minor
"@xyo-network/diviner-jsonpath-model": minor
"@xyo-network/diviner-model": minor
"@xyo-network/diviner-models": minor
"@xyo-network/diviner-payload": minor
"@xyo-network/diviner-payload-abstract": minor
"@xyo-network/diviner-payload-generic": minor
"@xyo-network/diviner-payload-indexeddb": minor
"@xyo-network/diviner-payload-memory": minor
"@xyo-network/diviner-payload-model": minor
"@xyo-network/diviner-payload-pointer": minor
"@xyo-network/diviner-payload-pointer-memory": minor
"@xyo-network/diviner-payload-pointer-model": minor
"@xyo-network/diviner-payload-stats": minor
"@xyo-network/diviner-payload-stats-abstract": minor
"@xyo-network/diviner-payload-stats-memory": minor
"@xyo-network/diviner-payload-stats-model": minor
"@xyo-network/diviner-range": minor
"@xyo-network/diviner-range-model": minor
"@xyo-network/diviner-schema-list": minor
"@xyo-network/diviner-schema-list-abstract": minor
"@xyo-network/diviner-schema-list-memory": minor
"@xyo-network/diviner-schema-list-model": minor
"@xyo-network/diviner-schema-stats": minor
"@xyo-network/diviner-schema-stats-abstract": minor
"@xyo-network/diviner-schema-stats-memory": minor
"@xyo-network/diviner-schema-stats-model": minor
"@xyo-network/diviner-stateful": minor
"@xyo-network/diviner-temporal-indexing": minor
"@xyo-network/diviner-temporal-indexing-memory": minor
"@xyo-network/diviner-temporal-indexing-model": minor
"@xyo-network/diviner-transform": minor
"@xyo-network/diviner-transform-abstract": minor
"@xyo-network/diviner-transform-memory": minor
"@xyo-network/diviner-transform-model": minor
"@xyo-network/diviner-wrapper": minor
"@xyo-network/dns": minor
"@xyo-network/domain-payload-plugin": minor
"@xyo-network/filesystem-archivist": minor
"@xyo-network/hash": minor
"@xyo-network/huri": minor
"@xyo-network/id-payload-plugin": minor
"@xyo-network/key-model": minor
"@xyo-network/manifest": minor
"@xyo-network/manifest-model": minor
"@xyo-network/manifest-wrapper": minor
"@xyo-network/metamask-connector": minor
"@xyo-network/module": minor
"@xyo-network/module-abstract": minor
"@xyo-network/module-events": minor
"@xyo-network/module-factory-locator": minor
"@xyo-network/module-model": minor
"@xyo-network/module-resolver": minor
"@xyo-network/module-wrapper": minor
"@xyo-network/modules": minor
"@xyo-network/network": minor
"@xyo-network/node": minor
"@xyo-network/node-abstract": minor
"@xyo-network/node-memory": minor
"@xyo-network/node-model": minor
"@xyo-network/node-view": minor
"@xyo-network/node-wrapper": minor
"@xyo-network/object": minor
"@xyo-network/payload": minor
"@xyo-network/payload-builder": minor
"@xyo-network/payload-model": minor
"@xyo-network/payload-plugin": minor
"@xyo-network/payload-utils": minor
"@xyo-network/payload-validator": minor
"@xyo-network/payload-wrapper": minor
"@xyo-network/payloadset-plugin": minor
"@xyo-network/previous-hash-store": minor
"@xyo-network/previous-hash-store-indexeddb": minor
"@xyo-network/previous-hash-store-model": minor
"@xyo-network/previous-hash-store-storage": minor
"@xyo-network/protocol": minor
"@xyo-network/quadkey": minor
"@xyo-network/query-payload-plugin": minor
"@xyo-network/schema-cache": minor
"@xyo-network/schema-name-validator": minor
"@xyo-network/schema-payload-plugin": minor
"@xyo-network/sdk-js": minor
"@xyo-network/sdk-utils": minor
"@xyo-network/sentinel": minor
"@xyo-network/sentinel-abstract": minor
"@xyo-network/sentinel-memory": minor
"@xyo-network/sentinel-model": minor
"@xyo-network/sentinel-wrapper": minor
"@xyo-network/shared": minor
"@xyo-network/typeof": minor
"@xyo-network/value-payload-plugin": minor
"@xyo-network/wallet-model": minor
"@xyo-network/wasm": minor
"@xyo-network/witness": minor
"@xyo-network/witness-adhoc": minor
"@xyo-network/witness-blockchain": minor
"@xyo-network/witness-blockchain-abstract": minor
"@xyo-network/witness-environment": minor
"@xyo-network/witness-evm": minor
"@xyo-network/witness-evm-abstract": minor
"@xyo-network/witness-model": minor
"@xyo-network/witness-timestamp": minor
"@xyo-network/witness-wrapper": minor
"@xyo-network/witnesses": minor
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"description": "Primary SDK for using XYO Protocol 2.0",
"devDependencies": {
"@babel/core": "^7.25.2",
"@stylistic/eslint-plugin": "^2.6.1",
"@types/jest": "^29.5.12",
"@types/supertest": "^6.0.2",
"@typescript-eslint/eslint-plugin": "^8.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/core-payload-plugins/packages/domain/src/Wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class DomainPayloadWrapper<T extends DomainPayload = DomainPayload> exten
}

async fetchAliases(networkSlug?: Hash) {
//set it to null to signify fetch ran
// set it to null to signify fetch ran
this.aliases = null

const archivistUri = await this.findArchivistUri(networkSlug)
Expand All @@ -83,7 +83,7 @@ export class DomainPayloadWrapper<T extends DomainPayload = DomainPayload> exten
return this.fetchAlias(alias, { archivistUri })
}),
)
//cast to FetchedPayload[] after we filter out any null/undefined entries
// cast to FetchedPayload[] after we filter out any null/undefined entries
this.aliases = fetchedAliases.filter(Boolean) as FetchedAlias[]
}
}
Expand All @@ -95,7 +95,7 @@ export class DomainPayloadWrapper<T extends DomainPayload = DomainPayload> exten
}

private async findArchivistUri(hash?: Hash): Promise<string | undefined> {
return (await this.getNetwork(hash))?.nodes?.find((payload) => (payload.type === 'archivist' ? payload : undefined))?.uri
return (await this.getNetwork(hash))?.nodes?.find(payload => (payload.type === 'archivist' ? payload : undefined))?.uri
}

private async getNetwork(hash?: Hash): Promise<NetworkPayload | undefined> {
Expand Down
14 changes: 7 additions & 7 deletions packages/manifest/packages/wrapper/src/Wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export class ManifestWrapper<TManifest extends WithAnySchema<PackageManifestPayl
assertEx(!(await collision(node, manifest.config.name, external)), () => `Node name collision [${manifest.config.name}]`)

if (!(await collision(node, manifest.config.name, external))) {
//is it already registered?
if (node.registeredModules().some((mod) => mod.config.name && mod.config.name === manifest.config.name)) {
// is it already registered?
if (node.registeredModules().some(mod => mod.config.name && mod.config.name === manifest.config.name)) {
assertEx(await node.attach(manifest.config.name, external), () => `Failed to attach module [${manifest.config.name}]`)
} else {
if ((manifest as NodeManifest).modules) {
Expand All @@ -53,7 +53,7 @@ export class ManifestWrapper<TManifest extends WithAnySchema<PackageManifestPayl
}
}

//These are top level, so they can use this.wallet as their
// These are top level, so they can use this.wallet as their
async loadNodeFromIndex(index: number): Promise<MemoryNode> {
const manifest = assertEx(this.nodeManifest(index), () => 'Failed to find Node Manifest')
return await this.loadNodeFromManifest(this.wallet, manifest, manifest.config.accountPath ?? `${index}'`)
Expand All @@ -64,15 +64,15 @@ export class ManifestWrapper<TManifest extends WithAnySchema<PackageManifestPayl
const derivedWallet = path ? await wallet.derivePath(path) : await HDWallet.random()
const node = await MemoryNode.create({ account: derivedWallet, config: manifest.config })
// Load Private Modules
const privateModules =
manifest.modules?.private?.map(async (moduleManifest) => {
const privateModules
= manifest.modules?.private?.map(async (moduleManifest) => {
if (typeof moduleManifest === 'object') {
await this.loadModule(derivedWallet, node, moduleManifest, false)
}
}) ?? []
// Load Public Modules
const publicModules =
manifest.modules?.public?.map(async (moduleManifest) => {
const publicModules
= manifest.modules?.public?.map(async (moduleManifest) => {
if (typeof moduleManifest === 'object') {
await this.loadModule(derivedWallet, node, moduleManifest, true)
}
Expand Down
14 changes: 7 additions & 7 deletions packages/manifest/packages/wrapper/src/WrapperEx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export class ManifestWrapperEx<
assertEx(!(await collision(node, manifest.config.name, external)), () => `Node name collision [${manifest.config.name}]`)

if (!(await collision(node, manifest.config.name, external))) {
//is it already registered?
if (node.registeredModules().some((mod) => mod.config.name && mod.config.name === manifest.config.name)) {
// is it already registered?
if (node.registeredModules().some(mod => mod.config.name && mod.config.name === manifest.config.name)) {
assertEx(await node.attach(manifest.config.name, external), () => `Failed to attach module [${manifest.config.name}]`)
} else {
assertEx(
Expand All @@ -71,7 +71,7 @@ export class ManifestWrapperEx<
}
}

//These are top level, so they can use this.wallet as their
// These are top level, so they can use this.wallet as their
async loadNodeFromIndex(index: number): Promise<MemoryNode> {
const manifest = assertEx(this.nodeManifest(index), () => 'Failed to find Node Manifest')
return await this.loadNodeFromManifest(this.wallet, manifest, manifest.config.accountPath ?? `${index}'`)
Expand All @@ -81,15 +81,15 @@ export class ManifestWrapperEx<
const derivedWallet = path ? await wallet.derivePath(path) : await HDWallet.random()
const node = await MemoryNode.create({ account: derivedWallet, config: manifest.config })
// Load Private Modules
const privateModules =
manifest.modules?.private?.map(async (moduleManifest) => {
const privateModules
= manifest.modules?.private?.map(async (moduleManifest) => {
if (typeof moduleManifest === 'object') {
await this.loadModule(derivedWallet, node, moduleManifest, false)
}
}) ?? []
// Load Public Modules
const publicModules =
manifest.modules?.public?.map(async (moduleManifest) => {
const publicModules
= manifest.modules?.public?.map(async (moduleManifest) => {
if (typeof moduleManifest === 'object') {
await this.loadModule(derivedWallet, node, moduleManifest, true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ describe('Manifest', () => {
const [node] = await manifest.loadNodes()
expect(node).toBeDefined()
const discover = await node.state()
//console.log(`discover: ${toJsonString(discover)}`)
const discoveredAddresses = discover.filter((item) => item.schema === AddressSchema)
// console.log(`discover: ${toJsonString(discover)}`)
const discoveredAddresses = discover.filter(item => item.schema === AddressSchema)
expect(discoveredAddresses.length).toBe(4)
//expect((await node.resolve()).length).toBeGreaterThan(10)
// expect((await node.resolve()).length).toBeGreaterThan(10)
const roundTrip = (await node.manifest()) as NodeManifest
//console.log(`roundTrip: ${toJsonString(roundTrip)}`)
//expect(roundTrip.modules?.private).toBeArrayOfSize(1)
// console.log(`roundTrip: ${toJsonString(roundTrip)}`)
// expect(roundTrip.modules?.private).toBeArrayOfSize(1)
expect(roundTrip.modules?.public?.length).toBe(3)
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ describe('Manifest', () => {
const [node] = await manifest.loadNodes()
expect(node).toBeDefined()
const state = await node.state()
const discoveredAddresses = state.filter((item) => item.schema === AddressSchema)
const discoveredAddresses = state.filter(item => item.schema === AddressSchema)
expect(discoveredAddresses.length).toBeGreaterThan(7)
//expect((await node.resolve()).length).toBeGreaterThan(10)
// expect((await node.resolve()).length).toBeGreaterThan(10)
const roundTrip = (await node.manifest()) as NodeManifest
//expect(roundTrip.modules?.private).toBeArrayOfSize(1)
// expect(roundTrip.modules?.private).toBeArrayOfSize(1)
expect(roundTrip.modules?.public).toBeArrayOfSize(6)
})
})
Expand Down
6 changes: 3 additions & 3 deletions packages/manifest/packages/wrapper/src/spec/Manifest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ describe('Manifest', () => {
expect(node).toBeDefined()

const discover = await node.state()
const discoveredAddresses = discover.filter((item) => item.schema === AddressSchema)
const discoveredAddresses = discover.filter(item => item.schema === AddressSchema)
expect(discoveredAddresses.length).toBeGreaterThan(4)
//expect((await node.resolve()).length).toBeGreaterThan(4)
// expect((await node.resolve()).length).toBeGreaterThan(4)

const roundTrip = (await node.manifest()) as NodeManifest
console.log(`manifest: ${toJsonString(roundTrip, 20)}`)
//expect(roundTrip.modules?.private).toBeArrayOfSize(1)
// expect(roundTrip.modules?.private).toBeArrayOfSize(1)
expect(roundTrip.modules?.public).toBeArrayOfSize(3)
})
})
Expand Down
1 change: 1 addition & 0 deletions packages/manifest/src/spec/manifest-schemas.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/no-internal-modules */
import { Ajv, ValidateFunction } from 'ajv'

import dappPackageManifestSchemaCompiled from '../compilations/dapp-package-manifest-schema.json'
Expand Down
Loading

0 comments on commit 82e5386

Please sign in to comment.