@xyo-network/module-abstract 2.73.4 → 2.74.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/AbstractModule.d.mts +84 -0
- package/dist/AbstractModule.d.mts.map +1 -0
- package/dist/AbstractModule.d.ts +84 -0
- package/dist/AbstractModule.d.ts.map +1 -0
- package/dist/AbstractModuleInstance.d.mts +14 -0
- package/dist/AbstractModuleInstance.d.mts.map +1 -0
- package/dist/AbstractModuleInstance.d.ts +14 -0
- package/dist/AbstractModuleInstance.d.ts.map +1 -0
- package/dist/BaseEmitter.d.mts +17 -0
- package/dist/BaseEmitter.d.mts.map +1 -0
- package/dist/BaseEmitter.d.ts +17 -0
- package/dist/BaseEmitter.d.ts.map +1 -0
- package/dist/Error.d.mts +15 -0
- package/dist/Error.d.mts.map +1 -0
- package/dist/Error.d.ts +15 -0
- package/dist/Error.d.ts.map +1 -0
- package/dist/QueryValidator/ModuleConfigQueryValidator.d.mts +15 -0
- package/dist/QueryValidator/ModuleConfigQueryValidator.d.mts.map +1 -0
- package/dist/QueryValidator/ModuleConfigQueryValidator.d.ts +15 -0
- package/dist/QueryValidator/ModuleConfigQueryValidator.d.ts.map +1 -0
- package/dist/QueryValidator/QueryValidator.d.mts +8 -0
- package/dist/QueryValidator/QueryValidator.d.mts.map +1 -0
- package/dist/QueryValidator/QueryValidator.d.ts +8 -0
- package/dist/QueryValidator/QueryValidator.d.ts.map +1 -0
- package/dist/QueryValidator/SupportedQueryValidator.d.mts +22 -0
- package/dist/QueryValidator/SupportedQueryValidator.d.mts.map +1 -0
- package/dist/QueryValidator/SupportedQueryValidator.d.ts +22 -0
- package/dist/QueryValidator/SupportedQueryValidator.d.ts.map +1 -0
- package/dist/QueryValidator/index.d.mts +4 -0
- package/dist/QueryValidator/index.d.mts.map +1 -0
- package/dist/QueryValidator/index.d.ts +4 -0
- package/dist/QueryValidator/index.d.ts.map +1 -0
- package/dist/docs.json +12847 -11820
- package/dist/index.d.mts +6 -163
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +6 -163
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +25 -33
- package/src/AbstractModule.ts +13 -17
- package/src/AbstractModuleInstance.ts +2 -13
- package/types.d.ts +3 -0
- package/tsup.config.ts +0 -16
package/package.json
CHANGED
|
@@ -10,42 +10,34 @@
|
|
|
10
10
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xylabs/assert": "^2.
|
|
14
|
-
"@xylabs/exists": "^2.
|
|
15
|
-
"@xylabs/lodash": "^2.
|
|
16
|
-
"@xyo-network/account": "~2.
|
|
17
|
-
"@xyo-network/account-model": "~2.
|
|
18
|
-
"@xyo-network/address-payload-plugin": "~2.
|
|
19
|
-
"@xyo-network/archivist-model": "~2.
|
|
20
|
-
"@xyo-network/boundwitness-builder": "~2.
|
|
21
|
-
"@xyo-network/boundwitness-model": "~2.
|
|
22
|
-
"@xyo-network/config-payload-plugin": "~2.
|
|
23
|
-
"@xyo-network/core": "~2.
|
|
24
|
-
"@xyo-network/error": "~2.
|
|
25
|
-
"@xyo-network/manifest-model": "~2.
|
|
26
|
-
"@xyo-network/module-events": "~2.
|
|
27
|
-
"@xyo-network/module-model": "~2.
|
|
28
|
-
"@xyo-network/module-resolver": "~2.
|
|
29
|
-
"@xyo-network/payload-builder": "~2.
|
|
30
|
-
"@xyo-network/payload-model": "~2.
|
|
31
|
-
"@xyo-network/promise": "~2.
|
|
32
|
-
"@xyo-network/query-payload-plugin": "~2.
|
|
33
|
-
"@xyo-network/shared": "~2.
|
|
34
|
-
"@xyo-network/wallet-model": "~2.
|
|
13
|
+
"@xylabs/assert": "^2.11.6",
|
|
14
|
+
"@xylabs/exists": "^2.11.6",
|
|
15
|
+
"@xylabs/lodash": "^2.11.6",
|
|
16
|
+
"@xyo-network/account": "~2.74.1",
|
|
17
|
+
"@xyo-network/account-model": "~2.74.1",
|
|
18
|
+
"@xyo-network/address-payload-plugin": "~2.74.1",
|
|
19
|
+
"@xyo-network/archivist-model": "~2.74.1",
|
|
20
|
+
"@xyo-network/boundwitness-builder": "~2.74.1",
|
|
21
|
+
"@xyo-network/boundwitness-model": "~2.74.1",
|
|
22
|
+
"@xyo-network/config-payload-plugin": "~2.74.1",
|
|
23
|
+
"@xyo-network/core": "~2.74.1",
|
|
24
|
+
"@xyo-network/error": "~2.74.1",
|
|
25
|
+
"@xyo-network/manifest-model": "~2.74.1",
|
|
26
|
+
"@xyo-network/module-events": "~2.74.1",
|
|
27
|
+
"@xyo-network/module-model": "~2.74.1",
|
|
28
|
+
"@xyo-network/module-resolver": "~2.74.1",
|
|
29
|
+
"@xyo-network/payload-builder": "~2.74.1",
|
|
30
|
+
"@xyo-network/payload-model": "~2.74.1",
|
|
31
|
+
"@xyo-network/promise": "~2.74.1",
|
|
32
|
+
"@xyo-network/query-payload-plugin": "~2.74.1",
|
|
33
|
+
"@xyo-network/shared": "~2.74.1",
|
|
34
|
+
"@xyo-network/wallet-model": "~2.74.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@xylabs/ts-scripts-yarn3": "^
|
|
38
|
-
"@xylabs/tsconfig": "^
|
|
39
|
-
"jest": "^29.6.4",
|
|
40
|
-
"jest-mock-extended": "^3.0.5",
|
|
41
|
-
"publint": "^0.2.2",
|
|
42
|
-
"tsup": "^7.2.0",
|
|
37
|
+
"@xylabs/ts-scripts-yarn3": "^3.0.28",
|
|
38
|
+
"@xylabs/tsconfig": "^3.0.28",
|
|
43
39
|
"typescript": "^5.2.2"
|
|
44
40
|
},
|
|
45
|
-
"scripts": {
|
|
46
|
-
"package-compile": "tsup && publint",
|
|
47
|
-
"package-recompile": "tsup && publint"
|
|
48
|
-
},
|
|
49
41
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
50
42
|
"docs": "dist/docs.json",
|
|
51
43
|
"types": "dist/index.d.ts",
|
|
@@ -86,5 +78,5 @@
|
|
|
86
78
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
|
|
87
79
|
},
|
|
88
80
|
"sideEffects": false,
|
|
89
|
-
"version": "2.
|
|
81
|
+
"version": "2.74.1"
|
|
90
82
|
}
|
package/src/AbstractModule.ts
CHANGED
|
@@ -15,7 +15,6 @@ import { ModuleManifestPayload, ModuleManifestPayloadSchema } from '@xyo-network
|
|
|
15
15
|
import {
|
|
16
16
|
AddressPreviousHashPayload,
|
|
17
17
|
AddressPreviousHashSchema,
|
|
18
|
-
AnyConfigSchema,
|
|
19
18
|
CreatableModule,
|
|
20
19
|
CreatableModuleFactory,
|
|
21
20
|
duplicateModules,
|
|
@@ -56,10 +55,7 @@ import { BaseEmitter } from './BaseEmitter'
|
|
|
56
55
|
import { ModuleErrorBuilder } from './Error'
|
|
57
56
|
import { ModuleConfigQueryValidator, Queryable, SupportedQueryValidator } from './QueryValidator'
|
|
58
57
|
|
|
59
|
-
export abstract class AbstractModule<
|
|
60
|
-
TParams extends ModuleParams<AnyConfigSchema<ModuleConfig>> = ModuleParams<ModuleConfig>,
|
|
61
|
-
TEventData extends ModuleEventData = ModuleEventData,
|
|
62
|
-
>
|
|
58
|
+
export abstract class AbstractModule<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData>
|
|
63
59
|
extends BaseEmitter<TParams, TEventData>
|
|
64
60
|
implements Module<TParams, TEventData>
|
|
65
61
|
{
|
|
@@ -190,9 +186,9 @@ export abstract class AbstractModule<
|
|
|
190
186
|
allowedSchemas.filter((allowedSchema) => allowedSchema === schema).length > 0,
|
|
191
187
|
`Bad Config Schema [Received ${schema}] [Expected ${JSON.stringify(allowedSchemas)}]`,
|
|
192
188
|
)
|
|
193
|
-
const mutatedConfig: TModule['params']['config'] = { ...params?.config, schema }
|
|
189
|
+
const mutatedConfig: TModule['params']['config'] = { ...params?.config, schema } as TModule['params']['config']
|
|
194
190
|
params?.logger?.debug(`config: ${JSON.stringify(mutatedConfig, null, 2)}`)
|
|
195
|
-
const mutatedParams = { ...params, config: mutatedConfig } as TModule['params']
|
|
191
|
+
const mutatedParams: TModule['params'] = { ...params, config: mutatedConfig } as TModule['params']
|
|
196
192
|
|
|
197
193
|
const activeLogger = params?.logger ?? AbstractModule.defaultLogger
|
|
198
194
|
const generatedAccount = await AbstractModule.determineAccount({ account, accountDerivationPath, wallet })
|
|
@@ -514,6 +510,16 @@ export abstract class AbstractModule<
|
|
|
514
510
|
return compact([config, configSchema, address, ...queries])
|
|
515
511
|
}
|
|
516
512
|
|
|
513
|
+
protected async getArchivist(kind: keyof IndividualArchivistConfig): Promise<ArchivistInstance | undefined> {
|
|
514
|
+
if (!this.config.archivist) return undefined
|
|
515
|
+
const filter =
|
|
516
|
+
typeof this.config.archivist === 'string' || this.config.archivist instanceof String
|
|
517
|
+
? (this.config.archivist as string)
|
|
518
|
+
: (this.config?.archivist?.[kind] as string)
|
|
519
|
+
const resolved = await this.upResolver.resolve(filter)
|
|
520
|
+
return asArchivistInstance(resolved)
|
|
521
|
+
}
|
|
522
|
+
|
|
517
523
|
protected async initializeQueryAccounts() {
|
|
518
524
|
// Ensure distinct/unique wallet paths
|
|
519
525
|
const paths = Object.values(this.queryAccountPaths).filter(exists)
|
|
@@ -646,14 +652,4 @@ export abstract class AbstractModule<
|
|
|
646
652
|
}
|
|
647
653
|
|
|
648
654
|
protected writeArchivist = () => this.getArchivist('write')
|
|
649
|
-
|
|
650
|
-
private async getArchivist(kind: keyof IndividualArchivistConfig): Promise<ArchivistInstance | undefined> {
|
|
651
|
-
if (!this.config.archivist) return undefined
|
|
652
|
-
const filter =
|
|
653
|
-
typeof this.config.archivist === 'string' || this.config.archivist instanceof String
|
|
654
|
-
? (this.config.archivist as string)
|
|
655
|
-
: (this.config?.archivist?.[kind] as string)
|
|
656
|
-
const resolved = await this.upResolver.resolve(filter)
|
|
657
|
-
return asArchivistInstance(resolved)
|
|
658
|
-
}
|
|
659
655
|
}
|
|
@@ -1,23 +1,12 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
2
|
import { AccountInstance } from '@xyo-network/account-model'
|
|
3
3
|
import { ModuleManifestPayload } from '@xyo-network/manifest-model'
|
|
4
|
-
import {
|
|
5
|
-
AddressPreviousHashPayload,
|
|
6
|
-
AnyConfigSchema,
|
|
7
|
-
Module,
|
|
8
|
-
ModuleConfig,
|
|
9
|
-
ModuleDescriptionPayload,
|
|
10
|
-
ModuleEventData,
|
|
11
|
-
ModuleParams,
|
|
12
|
-
} from '@xyo-network/module-model'
|
|
4
|
+
import { AddressPreviousHashPayload, Module, ModuleDescriptionPayload, ModuleEventData, ModuleParams } from '@xyo-network/module-model'
|
|
13
5
|
import { Payload } from '@xyo-network/payload-model'
|
|
14
6
|
|
|
15
7
|
import { AbstractModule } from './AbstractModule'
|
|
16
8
|
|
|
17
|
-
export abstract class AbstractModuleInstance<
|
|
18
|
-
TParams extends ModuleParams<AnyConfigSchema<ModuleConfig>> = ModuleParams<ModuleConfig>,
|
|
19
|
-
TEventData extends ModuleEventData = ModuleEventData,
|
|
20
|
-
>
|
|
9
|
+
export abstract class AbstractModuleInstance<TParams extends ModuleParams = ModuleParams, TEventData extends ModuleEventData = ModuleEventData>
|
|
21
10
|
extends AbstractModule<TParams, TEventData>
|
|
22
11
|
implements Module<TParams, TEventData>
|
|
23
12
|
{
|
package/types.d.ts
ADDED
package/tsup.config.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'tsup'
|
|
2
|
-
|
|
3
|
-
// eslint-disable-next-line import/no-default-export
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
bundle: true,
|
|
6
|
-
cjsInterop: true,
|
|
7
|
-
clean: false,
|
|
8
|
-
dts: {
|
|
9
|
-
entry: ['src/index.ts'],
|
|
10
|
-
},
|
|
11
|
-
entry: ['src/index.ts'],
|
|
12
|
-
format: ['cjs', 'esm'],
|
|
13
|
-
sourcemap: true,
|
|
14
|
-
splitting: false,
|
|
15
|
-
tsconfig: 'tsconfig.json',
|
|
16
|
-
})
|