@xyo-network/bridge-worker 3.9.18 → 3.9.20
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/browser/WorkerBridge.d.ts +55 -0
- package/dist/browser/WorkerBridge.d.ts.map +1 -0
- package/dist/browser/WorkerBridgeConfig.d.ts +6 -0
- package/dist/browser/WorkerBridgeConfig.d.ts.map +1 -0
- package/dist/browser/defaultNodeManifest.d.ts +3 -0
- package/dist/browser/defaultNodeManifest.d.ts.map +1 -0
- package/dist/browser/docsEntry.d.ts +4 -0
- package/dist/browser/docsEntry.d.ts.map +1 -0
- package/dist/browser/index.d.ts +5 -86
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/worker/Worker.d.ts +2 -0
- package/dist/browser/worker/Worker.d.ts.map +1 -0
- package/dist/browser/worker/WorkerNodeHost.d.ts +22 -0
- package/dist/browser/worker/WorkerNodeHost.d.ts.map +1 -0
- package/dist/browser/worker/index.d.ts +2 -0
- package/dist/browser/worker/index.d.ts.map +1 -0
- package/dist/neutral/WorkerBridge.d.ts +55 -0
- package/dist/neutral/WorkerBridge.d.ts.map +1 -0
- package/dist/neutral/WorkerBridgeConfig.d.ts +6 -0
- package/dist/neutral/WorkerBridgeConfig.d.ts.map +1 -0
- package/dist/neutral/defaultNodeManifest.d.ts +3 -0
- package/dist/neutral/defaultNodeManifest.d.ts.map +1 -0
- package/dist/neutral/docsEntry.d.ts +4 -0
- package/dist/neutral/docsEntry.d.ts.map +1 -0
- package/dist/neutral/index.d.ts +5 -86
- package/dist/neutral/index.d.ts.map +1 -0
- package/dist/neutral/worker/Worker.d.ts +2 -0
- package/dist/neutral/worker/Worker.d.ts.map +1 -0
- package/dist/neutral/worker/WorkerNodeHost.d.ts +22 -0
- package/dist/neutral/worker/WorkerNodeHost.d.ts.map +1 -0
- package/dist/neutral/worker/index.d.ts +2 -0
- package/dist/neutral/worker/index.d.ts.map +1 -0
- package/dist/node/WorkerBridge.d.ts +55 -0
- package/dist/node/WorkerBridge.d.ts.map +1 -0
- package/dist/node/WorkerBridgeConfig.d.ts +6 -0
- package/dist/node/WorkerBridgeConfig.d.ts.map +1 -0
- package/dist/node/defaultNodeManifest.d.ts +3 -0
- package/dist/node/defaultNodeManifest.d.ts.map +1 -0
- package/dist/node/docsEntry.d.ts +4 -0
- package/dist/node/docsEntry.d.ts.map +1 -0
- package/dist/node/index.d.ts +5 -86
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/worker/Worker.d.ts +2 -0
- package/dist/node/worker/Worker.d.ts.map +1 -0
- package/dist/node/worker/WorkerNodeHost.d.ts +22 -0
- package/dist/node/worker/WorkerNodeHost.d.ts.map +1 -0
- package/dist/node/worker/index.d.ts +2 -0
- package/dist/node/worker/index.d.ts.map +1 -0
- package/package.json +15 -15
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Address } from '@xylabs/hex';
|
|
2
|
+
import { Promisable } from '@xylabs/promise';
|
|
3
|
+
import { QueryBoundWitness } from '@xyo-network/boundwitness-model';
|
|
4
|
+
import { AbstractBridge } from '@xyo-network/bridge-abstract';
|
|
5
|
+
import { BridgeExposeOptions, BridgeModule, BridgeUnexposeOptions } from '@xyo-network/bridge-model';
|
|
6
|
+
import { PackageManifestPayload } from '@xyo-network/manifest-model';
|
|
7
|
+
import { AnyConfigSchema, ModuleInstance, ModuleParams, ModuleQueryResult } from '@xyo-network/module-model';
|
|
8
|
+
import { Payload, Schema } from '@xyo-network/payload-model';
|
|
9
|
+
import { LRUCache } from 'lru-cache';
|
|
10
|
+
import { WorkerBridgeConfig } from './WorkerBridgeConfig.ts';
|
|
11
|
+
export type WorkerBridgeParams<TConfig extends AnyConfigSchema<WorkerBridgeConfig> = AnyConfigSchema<WorkerBridgeConfig>> = ModuleParams<TConfig, {
|
|
12
|
+
worker?: Worker;
|
|
13
|
+
}>;
|
|
14
|
+
export interface Message<T extends string = string> {
|
|
15
|
+
type: T;
|
|
16
|
+
}
|
|
17
|
+
export interface QueryMessage extends Message<'xyoQuery'> {
|
|
18
|
+
address: Address;
|
|
19
|
+
msgId?: string;
|
|
20
|
+
payloads?: Payload[];
|
|
21
|
+
query: QueryBoundWitness;
|
|
22
|
+
}
|
|
23
|
+
export interface QueryResultMessage {
|
|
24
|
+
address: Address;
|
|
25
|
+
msgId?: string;
|
|
26
|
+
result: ModuleQueryResult;
|
|
27
|
+
}
|
|
28
|
+
export declare class WorkerBridge<TParams extends WorkerBridgeParams = WorkerBridgeParams> extends AbstractBridge<TParams> implements BridgeModule<TParams> {
|
|
29
|
+
static readonly configSchemas: Schema[];
|
|
30
|
+
static readonly defaultConfigSchema: Schema;
|
|
31
|
+
private _discoverCache?;
|
|
32
|
+
private _targetConfigs;
|
|
33
|
+
private _targetQueries;
|
|
34
|
+
get discoverCache(): LRUCache<string, Payload[], unknown>;
|
|
35
|
+
get discoverCacheConfig(): LRUCache.Options<string, Payload[], unknown>;
|
|
36
|
+
get worker(): Worker;
|
|
37
|
+
static createWorkerNode(manifest?: PackageManifestPayload): Promise<WorkerBridge<import("@xylabs/object").BaseParamsFields & {
|
|
38
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
39
|
+
addToResolvers?: boolean;
|
|
40
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
41
|
+
allowNameResolution?: boolean;
|
|
42
|
+
config: AnyConfigSchema<WorkerBridgeConfig>;
|
|
43
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
44
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
45
|
+
privateChildren?: ModuleInstance[];
|
|
46
|
+
publicChildren?: ModuleInstance[];
|
|
47
|
+
} & {
|
|
48
|
+
worker?: Worker;
|
|
49
|
+
}>>;
|
|
50
|
+
exposeHandler(_id: string, _options?: BridgeExposeOptions | undefined): Promisable<ModuleInstance[]>;
|
|
51
|
+
exposedHandler(): Promisable<Address[]>;
|
|
52
|
+
getRoots(_force?: boolean | undefined): Promise<ModuleInstance[]>;
|
|
53
|
+
unexposeHandler(_id: string, _options?: BridgeUnexposeOptions | undefined): Promisable<ModuleInstance[]>;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=WorkerBridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkerBridge.d.ts","sourceRoot":"","sources":["../../src/WorkerBridge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EACL,mBAAmB,EAAE,YAAY,EAAE,qBAAqB,EACzD,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EACL,eAAe,EAIf,cAAc,EACd,YAAY,EACZ,iBAAiB,EAClB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAGpC,OAAO,EAAE,kBAAkB,EAA4B,MAAM,yBAAyB,CAAA;AAEtF,MAAM,MAAM,kBAAkB,CAAC,OAAO,SAAS,eAAe,CAAC,kBAAkB,CAAC,GAAG,eAAe,CAAC,kBAAkB,CAAC,IAAI,YAAY,CACtI,OAAO,EACP;IACE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CACF,CAAA;AAED,MAAM,WAAW,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAChD,IAAI,EAAE,CAAC,CAAA;CACR;AAED,MAAM,WAAW,YAAa,SAAQ,OAAO,CAAC,UAAU,CAAC;IACvD,OAAO,EAAE,OAAO,CAAA;IAChB,KAA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abs/object';
|
|
2
|
+
import type { BridgeConfig } from '@xyo-network/bridge-model';
|
|
3
|
+
export declare const WorkerBridgeConfigSchema: "network.xyo.bridge.worker.config";
|
|
4
|
+
export type WorkerBridgeConfigSchema = typeof WorkerBridgeConfigSchema;
|
|
5
|
+
export type WorkerBridgeConfig<TConfig extends EmptyObject = EmptyObject> = BridgeConfig<TConfig, WorkerBridgeConfigSchema>;
|
|
6
|
+
//# sourceMappingURL=WorkerBridgeConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkerBridgeConfig.d.ts","sourceRoot":"","sources":["../../src/WorkerBridgeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D,eAAO,MAAM,wBAAwB,EAAG,kCAA2C,CAAA;AACnF,MAAM,MAAM,wBAAwB,GAAG,OAAO,wBAAwB,CAAA;AAEtE,MAAM,MAAM,kBAAkB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,IAAI,YAAY,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultNodeManifest.d.ts","sourceRoot":"","sources":["../../src/defaultNodeManifest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAKzE,eAAO,MAAM,sBAAsB,EAAE,sBAkCpC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docsEntry.d.ts","sourceRoot":"","sources":["../../src/docsEntry.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA"}
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,86 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import * as _xyo_network_module_model from '@xyo-network/module-model';
|
|
7
|
-
import { AnyConfigSchema, ModuleParams, ModuleQueryResult, ModuleInstance } from '@xyo-network/module-model';
|
|
8
|
-
import * as _xyo_network_account from '@xyo-network/account';
|
|
9
|
-
import * as _xylabs_object from '@xylabs/object';
|
|
10
|
-
import { EmptyObject } from '@xylabs/object';
|
|
11
|
-
import { Promisable } from '@xylabs/promise';
|
|
12
|
-
import { QueryBoundWitness } from '@xyo-network/boundwitness-model';
|
|
13
|
-
import { AbstractBridge } from '@xyo-network/bridge-abstract';
|
|
14
|
-
import { BridgeConfig, BridgeModule, BridgeExposeOptions, BridgeUnexposeOptions } from '@xyo-network/bridge-model';
|
|
15
|
-
import { Payload, Schema } from '@xyo-network/payload-model';
|
|
16
|
-
import { LRUCache } from 'lru-cache';
|
|
17
|
-
|
|
18
|
-
declare const defaultPackageManifest: PackageManifestPayload;
|
|
19
|
-
|
|
20
|
-
declare const WorkerBridgeConfigSchema: "network.xyo.bridge.worker.config";
|
|
21
|
-
type WorkerBridgeConfigSchema = typeof WorkerBridgeConfigSchema;
|
|
22
|
-
type WorkerBridgeConfig<TConfig extends EmptyObject = EmptyObject> = BridgeConfig<TConfig, WorkerBridgeConfigSchema>;
|
|
23
|
-
|
|
24
|
-
type WorkerBridgeParams<TConfig extends AnyConfigSchema<WorkerBridgeConfig> = AnyConfigSchema<WorkerBridgeConfig>> = ModuleParams<TConfig, {
|
|
25
|
-
worker?: Worker;
|
|
26
|
-
}>;
|
|
27
|
-
interface Message<T extends string = string> {
|
|
28
|
-
type: T;
|
|
29
|
-
}
|
|
30
|
-
interface QueryMessage extends Message<'xyoQuery'> {
|
|
31
|
-
address: Address;
|
|
32
|
-
msgId?: string;
|
|
33
|
-
payloads?: Payload[];
|
|
34
|
-
query: QueryBoundWitness;
|
|
35
|
-
}
|
|
36
|
-
interface QueryResultMessage {
|
|
37
|
-
address: Address;
|
|
38
|
-
msgId?: string;
|
|
39
|
-
result: ModuleQueryResult;
|
|
40
|
-
}
|
|
41
|
-
declare class WorkerBridge<TParams extends WorkerBridgeParams = WorkerBridgeParams> extends AbstractBridge<TParams> implements BridgeModule<TParams> {
|
|
42
|
-
static readonly configSchemas: Schema[];
|
|
43
|
-
static readonly defaultConfigSchema: Schema;
|
|
44
|
-
private _discoverCache?;
|
|
45
|
-
private _targetConfigs;
|
|
46
|
-
private _targetQueries;
|
|
47
|
-
get discoverCache(): LRUCache<string, Payload[], unknown>;
|
|
48
|
-
get discoverCacheConfig(): LRUCache.Options<string, Payload[], unknown>;
|
|
49
|
-
get worker(): Worker;
|
|
50
|
-
static createWorkerNode(manifest?: PackageManifestPayload): Promise<WorkerBridge<_xylabs_object.BaseParamsFields & {
|
|
51
|
-
account?: _xyo_network_account.AccountInstance | "random";
|
|
52
|
-
addToResolvers?: boolean;
|
|
53
|
-
additionalSigners?: _xyo_network_account.AccountInstance[];
|
|
54
|
-
allowNameResolution?: boolean;
|
|
55
|
-
config: AnyConfigSchema<WorkerBridgeConfig>;
|
|
56
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
57
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
58
|
-
privateChildren?: ModuleInstance[];
|
|
59
|
-
publicChildren?: ModuleInstance[];
|
|
60
|
-
} & {
|
|
61
|
-
worker?: Worker;
|
|
62
|
-
}>>;
|
|
63
|
-
exposeHandler(_id: string, _options?: BridgeExposeOptions | undefined): Promisable<ModuleInstance[]>;
|
|
64
|
-
exposedHandler(): Promisable<Address[]>;
|
|
65
|
-
getRoots(_force?: boolean | undefined): Promise<ModuleInstance[]>;
|
|
66
|
-
unexposeHandler(_id: string, _options?: BridgeUnexposeOptions | undefined): Promisable<ModuleInstance[]>;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
type QueryEvent = MessageEvent<QueryMessage>;
|
|
70
|
-
interface CreateNodeMessage extends Message<'createNode'> {
|
|
71
|
-
manifest: PackageManifestPayload$1;
|
|
72
|
-
}
|
|
73
|
-
type CreateNodeEvent = MessageEvent<CreateNodeMessage>;
|
|
74
|
-
interface NodeCreatedMessage extends Message<'nodeCreated'> {
|
|
75
|
-
address: Address;
|
|
76
|
-
}
|
|
77
|
-
declare class WorkerNodeHost {
|
|
78
|
-
protected node: NodeInstance;
|
|
79
|
-
protected logger?: Logger | undefined;
|
|
80
|
-
constructor(node: NodeInstance, logger?: Logger | undefined);
|
|
81
|
-
static create(config: PackageManifestPayload$1): Promise<WorkerNodeHost>;
|
|
82
|
-
static start(logger?: Logger): void;
|
|
83
|
-
private attachNode;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export { type CreateNodeEvent, type CreateNodeMessage, type Message, type NodeCreatedMessage, type QueryEvent, type QueryMessage, type QueryResultMessage, WorkerBridge, type WorkerBridgeConfig, WorkerBridgeConfigSchema, type WorkerBridgeParams, WorkerNodeHost, defaultPackageManifest };
|
|
1
|
+
export * from './defaultNodeManifest.ts';
|
|
2
|
+
export * from './worker/index.ts';
|
|
3
|
+
export * from './WorkerBridge.ts';
|
|
4
|
+
export * from './WorkerBridgeConfig.ts';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Worker.d.ts","sourceRoot":"","sources":["../../../src/worker/Worker.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Address } from '@xylabs/hex';
|
|
2
|
+
import type { Logger } from '@xylabs/logger';
|
|
3
|
+
import type { PackageManifestPayload } from '@xyo-network/manifest';
|
|
4
|
+
import type { NodeInstance } from '@xyo-network/node-model';
|
|
5
|
+
import type { Message, QueryMessage } from '../WorkerBridge.ts';
|
|
6
|
+
export type QueryEvent = MessageEvent<QueryMessage>;
|
|
7
|
+
export interface CreateNodeMessage extends Message<'createNode'> {
|
|
8
|
+
manifest: PackageManifestPayload;
|
|
9
|
+
}
|
|
10
|
+
export type CreateNodeEvent = MessageEvent<CreateNodeMessage>;
|
|
11
|
+
export interface NodeCreatedMessage extends Message<'nodeCreated'> {
|
|
12
|
+
address: Address;
|
|
13
|
+
}
|
|
14
|
+
export declare class WorkerNodeHost {
|
|
15
|
+
protected node: NodeInstance;
|
|
16
|
+
protected logger?: Logger | undefined;
|
|
17
|
+
constructor(node: NodeInstance, logger?: Logger | undefined);
|
|
18
|
+
static create(config: PackageManifestPayload): Promise<WorkerNodeHost>;
|
|
19
|
+
static start(logger?: Logger): void;
|
|
20
|
+
private attachNode;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=WorkerNodeHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkerNodeHost.d.ts","sourceRoot":"","sources":["../../../src/worker/WorkerNodeHost.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE3D,OAAO,KAAK,EACV,OAAO,EAAE,YAAY,EACtB,MAAM,oBAAoB,CAAA;AAE3B,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC,YAAY,CAAC,CAAA;AAEnD,MAAM,WAAW,iBAAkB,SAAQ,OAAO,CAAC,YAAY,CAAC;IAC9D,QAAQ,EAAE,sBAAsB,CAAA;CACjC;AAED,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,iBAAiB,CAAC,CAAA;AAE7D,MAAM,WAAW,kBAAmB,SAAQ,OAAO,CAAC,aAAa,CAAC;IAChE,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,qBAAa,cAAc;IAEvB,SAAS,CAAC,IAAI,EAAE,YAAY;IAC5B,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM;gBADf,IAAI,EAAE,YAAY,EAClB,MAAM,CAAC,EAAE,MAAM,YAAA;WAGd,MAAM,CAAC,MAAM,EAAE,sBAAsB;IASlD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM;IAwB5B,OAAO,CAAC,UAAU;CA8BnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/worker/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Address } from '@xylabs/hex';
|
|
2
|
+
import { Promisable } from '@xylabs/promise';
|
|
3
|
+
import { QueryBoundWitness } from '@xyo-network/boundwitness-model';
|
|
4
|
+
import { AbstractBridge } from '@xyo-network/bridge-abstract';
|
|
5
|
+
import { BridgeExposeOptions, BridgeModule, BridgeUnexposeOptions } from '@xyo-network/bridge-model';
|
|
6
|
+
import { PackageManifestPayload } from '@xyo-network/manifest-model';
|
|
7
|
+
import { AnyConfigSchema, ModuleInstance, ModuleParams, ModuleQueryResult } from '@xyo-network/module-model';
|
|
8
|
+
import { Payload, Schema } from '@xyo-network/payload-model';
|
|
9
|
+
import { LRUCache } from 'lru-cache';
|
|
10
|
+
import { WorkerBridgeConfig } from './WorkerBridgeConfig.ts';
|
|
11
|
+
export type WorkerBridgeParams<TConfig extends AnyConfigSchema<WorkerBridgeConfig> = AnyConfigSchema<WorkerBridgeConfig>> = ModuleParams<TConfig, {
|
|
12
|
+
worker?: Worker;
|
|
13
|
+
}>;
|
|
14
|
+
export interface Message<T extends string = string> {
|
|
15
|
+
type: T;
|
|
16
|
+
}
|
|
17
|
+
export interface QueryMessage extends Message<'xyoQuery'> {
|
|
18
|
+
address: Address;
|
|
19
|
+
msgId?: string;
|
|
20
|
+
payloads?: Payload[];
|
|
21
|
+
query: QueryBoundWitness;
|
|
22
|
+
}
|
|
23
|
+
export interface QueryResultMessage {
|
|
24
|
+
address: Address;
|
|
25
|
+
msgId?: string;
|
|
26
|
+
result: ModuleQueryResult;
|
|
27
|
+
}
|
|
28
|
+
export declare class WorkerBridge<TParams extends WorkerBridgeParams = WorkerBridgeParams> extends AbstractBridge<TParams> implements BridgeModule<TParams> {
|
|
29
|
+
static readonly configSchemas: Schema[];
|
|
30
|
+
static readonly defaultConfigSchema: Schema;
|
|
31
|
+
private _discoverCache?;
|
|
32
|
+
private _targetConfigs;
|
|
33
|
+
private _targetQueries;
|
|
34
|
+
get discoverCache(): LRUCache<string, Payload[], unknown>;
|
|
35
|
+
get discoverCacheConfig(): LRUCache.Options<string, Payload[], unknown>;
|
|
36
|
+
get worker(): Worker;
|
|
37
|
+
static createWorkerNode(manifest?: PackageManifestPayload): Promise<WorkerBridge<import("@xylabs/object").BaseParamsFields & {
|
|
38
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
39
|
+
addToResolvers?: boolean;
|
|
40
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
41
|
+
allowNameResolution?: boolean;
|
|
42
|
+
config: AnyConfigSchema<WorkerBridgeConfig>;
|
|
43
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
44
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
45
|
+
privateChildren?: ModuleInstance[];
|
|
46
|
+
publicChildren?: ModuleInstance[];
|
|
47
|
+
} & {
|
|
48
|
+
worker?: Worker;
|
|
49
|
+
}>>;
|
|
50
|
+
exposeHandler(_id: string, _options?: BridgeExposeOptions | undefined): Promisable<ModuleInstance[]>;
|
|
51
|
+
exposedHandler(): Promisable<Address[]>;
|
|
52
|
+
getRoots(_force?: boolean | undefined): Promise<ModuleInstance[]>;
|
|
53
|
+
unexposeHandler(_id: string, _options?: BridgeUnexposeOptions | undefined): Promisable<ModuleInstance[]>;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=WorkerBridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkerBridge.d.ts","sourceRoot":"","sources":["../../src/WorkerBridge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EACL,mBAAmB,EAAE,YAAY,EAAE,qBAAqB,EACzD,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EACL,eAAe,EAIf,cAAc,EACd,YAAY,EACZ,iBAAiB,EAClB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAGpC,OAAO,EAAE,kBAAkB,EAA4B,MAAM,yBAAyB,CAAA;AAEtF,MAAM,MAAM,kBAAkB,CAAC,OAAO,SAAS,eAAe,CAAC,kBAAkB,CAAC,GAAG,eAAe,CAAC,kBAAkB,CAAC,IAAI,YAAY,CACtI,OAAO,EACP;IACE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CACF,CAAA;AAED,MAAM,WAAW,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAChD,IAAI,EAAE,CAAC,CAAA;CACR;AAED,MAAM,WAAW,YAAa,SAAQ,OAA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"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { EmptyObject } from '@xylabs/object';
|
|
2
|
+
import type { BridgeConfig } from '@xyo-network/bridge-model';
|
|
3
|
+
export declare const WorkerBridgeConfigSchema: "network.xyo.bridge.worker.config";
|
|
4
|
+
export type WorkerBridgeConfigSchema = typeof WorkerBridgeConfigSchema;
|
|
5
|
+
export type WorkerBridgeConfig<TConfig extends EmptyObject = EmptyObject> = BridgeConfig<TConfig, WorkerBridgeConfigSchema>;
|
|
6
|
+
//# sourceMappingURL=WorkerBridgeConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkerBridgeConfig.d.ts","sourceRoot":"","sources":["../../src/WorkerBridgeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D,eAAO,MAAM,wBAAwB,EAAG,kCAA2C,CAAA;AACnF,MAAM,MAAM,wBAAwB,GAAG,OAAO,wBAAwB,CAAA;AAEtE,MAAM,MAAM,kBAAkB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,IAAI,YAAY,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultNodeManifest.d.ts","sourceRoot":"","sources":["../../src/defaultNodeManifest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAKzE,eAAO,MAAM,sBAAsB,EAAE,sBAkCpC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docsEntry.d.ts","sourceRoot":"","sources":["../../src/docsEntry.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA"}
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,86 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import * as _xyo_network_module_model from '@xyo-network/module-model';
|
|
7
|
-
import { AnyConfigSchema, ModuleParams, ModuleQueryResult, ModuleInstance } from '@xyo-network/module-model';
|
|
8
|
-
import * as _xyo_network_account from '@xyo-network/account';
|
|
9
|
-
import * as _xylabs_object from '@xylabs/object';
|
|
10
|
-
import { EmptyObject } from '@xylabs/object';
|
|
11
|
-
import { Promisable } from '@xylabs/promise';
|
|
12
|
-
import { QueryBoundWitness } from '@xyo-network/boundwitness-model';
|
|
13
|
-
import { AbstractBridge } from '@xyo-network/bridge-abstract';
|
|
14
|
-
import { BridgeConfig, BridgeModule, BridgeExposeOptions, BridgeUnexposeOptions } from '@xyo-network/bridge-model';
|
|
15
|
-
import { Payload, Schema } from '@xyo-network/payload-model';
|
|
16
|
-
import { LRUCache } from 'lru-cache';
|
|
17
|
-
|
|
18
|
-
declare const defaultPackageManifest: PackageManifestPayload;
|
|
19
|
-
|
|
20
|
-
declare const WorkerBridgeConfigSchema: "network.xyo.bridge.worker.config";
|
|
21
|
-
type WorkerBridgeConfigSchema = typeof WorkerBridgeConfigSchema;
|
|
22
|
-
type WorkerBridgeConfig<TConfig extends EmptyObject = EmptyObject> = BridgeConfig<TConfig, WorkerBridgeConfigSchema>;
|
|
23
|
-
|
|
24
|
-
type WorkerBridgeParams<TConfig extends AnyConfigSchema<WorkerBridgeConfig> = AnyConfigSchema<WorkerBridgeConfig>> = ModuleParams<TConfig, {
|
|
25
|
-
worker?: Worker;
|
|
26
|
-
}>;
|
|
27
|
-
interface Message<T extends string = string> {
|
|
28
|
-
type: T;
|
|
29
|
-
}
|
|
30
|
-
interface QueryMessage extends Message<'xyoQuery'> {
|
|
31
|
-
address: Address;
|
|
32
|
-
msgId?: string;
|
|
33
|
-
payloads?: Payload[];
|
|
34
|
-
query: QueryBoundWitness;
|
|
35
|
-
}
|
|
36
|
-
interface QueryResultMessage {
|
|
37
|
-
address: Address;
|
|
38
|
-
msgId?: string;
|
|
39
|
-
result: ModuleQueryResult;
|
|
40
|
-
}
|
|
41
|
-
declare class WorkerBridge<TParams extends WorkerBridgeParams = WorkerBridgeParams> extends AbstractBridge<TParams> implements BridgeModule<TParams> {
|
|
42
|
-
static readonly configSchemas: Schema[];
|
|
43
|
-
static readonly defaultConfigSchema: Schema;
|
|
44
|
-
private _discoverCache?;
|
|
45
|
-
private _targetConfigs;
|
|
46
|
-
private _targetQueries;
|
|
47
|
-
get discoverCache(): LRUCache<string, Payload[], unknown>;
|
|
48
|
-
get discoverCacheConfig(): LRUCache.Options<string, Payload[], unknown>;
|
|
49
|
-
get worker(): Worker;
|
|
50
|
-
static createWorkerNode(manifest?: PackageManifestPayload): Promise<WorkerBridge<_xylabs_object.BaseParamsFields & {
|
|
51
|
-
account?: _xyo_network_account.AccountInstance | "random";
|
|
52
|
-
addToResolvers?: boolean;
|
|
53
|
-
additionalSigners?: _xyo_network_account.AccountInstance[];
|
|
54
|
-
allowNameResolution?: boolean;
|
|
55
|
-
config: AnyConfigSchema<WorkerBridgeConfig>;
|
|
56
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
57
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
58
|
-
privateChildren?: ModuleInstance[];
|
|
59
|
-
publicChildren?: ModuleInstance[];
|
|
60
|
-
} & {
|
|
61
|
-
worker?: Worker;
|
|
62
|
-
}>>;
|
|
63
|
-
exposeHandler(_id: string, _options?: BridgeExposeOptions | undefined): Promisable<ModuleInstance[]>;
|
|
64
|
-
exposedHandler(): Promisable<Address[]>;
|
|
65
|
-
getRoots(_force?: boolean | undefined): Promise<ModuleInstance[]>;
|
|
66
|
-
unexposeHandler(_id: string, _options?: BridgeUnexposeOptions | undefined): Promisable<ModuleInstance[]>;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
type QueryEvent = MessageEvent<QueryMessage>;
|
|
70
|
-
interface CreateNodeMessage extends Message<'createNode'> {
|
|
71
|
-
manifest: PackageManifestPayload$1;
|
|
72
|
-
}
|
|
73
|
-
type CreateNodeEvent = MessageEvent<CreateNodeMessage>;
|
|
74
|
-
interface NodeCreatedMessage extends Message<'nodeCreated'> {
|
|
75
|
-
address: Address;
|
|
76
|
-
}
|
|
77
|
-
declare class WorkerNodeHost {
|
|
78
|
-
protected node: NodeInstance;
|
|
79
|
-
protected logger?: Logger | undefined;
|
|
80
|
-
constructor(node: NodeInstance, logger?: Logger | undefined);
|
|
81
|
-
static create(config: PackageManifestPayload$1): Promise<WorkerNodeHost>;
|
|
82
|
-
static start(logger?: Logger): void;
|
|
83
|
-
private attachNode;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export { type CreateNodeEvent, type CreateNodeMessage, type Message, type NodeCreatedMessage, type QueryEvent, type QueryMessage, type QueryResultMessage, WorkerBridge, type WorkerBridgeConfig, WorkerBridgeConfigSchema, type WorkerBridgeParams, WorkerNodeHost, defaultPackageManifest };
|
|
1
|
+
export * from './defaultNodeManifest.ts';
|
|
2
|
+
export * from './worker/index.ts';
|
|
3
|
+
export * from './WorkerBridge.ts';
|
|
4
|
+
export * from './WorkerBridgeConfig.ts';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Worker.d.ts","sourceRoot":"","sources":["../../../src/worker/Worker.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Address } from '@xylabs/hex';
|
|
2
|
+
import type { Logger } from '@xylabs/logger';
|
|
3
|
+
import type { PackageManifestPayload } from '@xyo-network/manifest';
|
|
4
|
+
import type { NodeInstance } from '@xyo-network/node-model';
|
|
5
|
+
import type { Message, QueryMessage } from '../WorkerBridge.ts';
|
|
6
|
+
export type QueryEvent = MessageEvent<QueryMessage>;
|
|
7
|
+
export interface CreateNodeMessage extends Message<'createNode'> {
|
|
8
|
+
manifest: PackageManifestPayload;
|
|
9
|
+
}
|
|
10
|
+
export type CreateNodeEvent = MessageEvent<CreateNodeMessage>;
|
|
11
|
+
export interface NodeCreatedMessage extends Message<'nodeCreated'> {
|
|
12
|
+
address: Address;
|
|
13
|
+
}
|
|
14
|
+
export declare class WorkerNodeHost {
|
|
15
|
+
protected node: NodeInstance;
|
|
16
|
+
protected logger?: Logger | undefined;
|
|
17
|
+
constructor(node: NodeInstance, logger?: Logger | undefined);
|
|
18
|
+
static create(config: PackageManifestPayload): Promise<WorkerNodeHost>;
|
|
19
|
+
static start(logger?: Logger): void;
|
|
20
|
+
private attachNode;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=WorkerNodeHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkerNodeHost.d.ts","sourceRoot":"","sources":["../../../src/worker/WorkerNodeHost.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE3D,OAAO,KAAK,EACV,OAAO,EAAE,YAAY,EACtB,MAAM,oBAAoB,CAAA;AAE3B,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC,YAAY,CAAC,CAAA;AAEnD,MAAM,WAAW,iBAAkB,SAAQ,OAAO,CAAC,YAAY,CAAC;IAC9D,QAAQ,EAAE,sBAAsB,CAAA;CACjC;AAED,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,iBAAiB,CAAC,CAAA;AAE7D,MAAM,WAAW,kBAAmB,SAAQ,OAAO,CAAC,aAAa,CAAC;IAChE,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,qBAAa,cAAc;IAEvB,SAAS,CAAC,IAAI,EAAE,YAAY;IAC5B,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM;gBADf,IAAI,EAAE,YAAY,EAClB,MAAM,CAAC,EAAE,MAAM,YAAA;WAGd,MAAM,CAAC,MAAM,EAAE,sBAAsB;IASlD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM;IAwB5B,OAAO,CAAC,UAAU;CA8BnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/worker/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Address } from '@xylabs/hex';
|
|
2
|
+
import { Promisable } from '@xylabs/promise';
|
|
3
|
+
import { QueryBoundWitness } from '@xyo-network/boundwitness-model';
|
|
4
|
+
import { AbstractBridge } from '@xyo-network/bridge-abstract';
|
|
5
|
+
import { BridgeExposeOptions, BridgeModule, BridgeUnexposeOptions } from '@xyo-network/bridge-model';
|
|
6
|
+
import { PackageManifestPayload } from '@xyo-network/manifest-model';
|
|
7
|
+
import { AnyConfigSchema, ModuleInstance, ModuleParams, ModuleQueryResult } from '@xyo-network/module-model';
|
|
8
|
+
import { Payload, Schema } from '@xyo-network/payload-model';
|
|
9
|
+
import { LRUCache } from 'lru-cache';
|
|
10
|
+
import { WorkerBridgeConfig } from './WorkerBridgeConfig.ts';
|
|
11
|
+
export type WorkerBridgeParams<TConfig extends AnyConfigSchema<WorkerBridgeConfig> = AnyConfigSchema<WorkerBridgeConfig>> = ModuleParams<TConfig, {
|
|
12
|
+
worker?: Worker;
|
|
13
|
+
}>;
|
|
14
|
+
export interface Message<T extends string = string> {
|
|
15
|
+
type: T;
|
|
16
|
+
}
|
|
17
|
+
export interface QueryMessage extends Message<'xyoQuery'> {
|
|
18
|
+
address: Address;
|
|
19
|
+
msgId?: string;
|
|
20
|
+
payloads?: Payload[];
|
|
21
|
+
query: QueryBoundWitness;
|
|
22
|
+
}
|
|
23
|
+
export interface QueryResultMessage {
|
|
24
|
+
address: Address;
|
|
25
|
+
msgId?: string;
|
|
26
|
+
result: ModuleQueryResult;
|
|
27
|
+
}
|
|
28
|
+
export declare class WorkerBridge<TParams extends WorkerBridgeParams = WorkerBridgeParams> extends AbstractBridge<TParams> implements BridgeModule<TParams> {
|
|
29
|
+
static readonly configSchemas: Schema[];
|
|
30
|
+
static readonly defaultConfigSchema: Schema;
|
|
31
|
+
private _discoverCache?;
|
|
32
|
+
private _targetConfigs;
|
|
33
|
+
private _targetQueries;
|
|
34
|
+
get discoverCache(): LRUCache<string, Payload[], unknown>;
|
|
35
|
+
get discoverCacheConfig(): LRUCache.Options<string, Payload[], unknown>;
|
|
36
|
+
get worker(): Worker;
|
|
37
|
+
static createWorkerNode(manifest?: PackageManifestPayload): Promise<WorkerBridge<import("@xylabs/object").BaseParamsFields & {
|
|
38
|
+
account?: import("@xyo-network/account-model").AccountInstance | "random";
|
|
39
|
+
addToResolvers?: boolean;
|
|
40
|
+
additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
|
|
41
|
+
allowNameResolution?: boolean;
|
|
42
|
+
config: AnyConfigSchema<WorkerBridgeConfig>;
|
|
43
|
+
ephemeralQueryAccountEnabled?: boolean;
|
|
44
|
+
moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
|
|
45
|
+
privateChildren?: ModuleInstance[];
|
|
46
|
+
publicChildren?: ModuleInstance[];
|
|
47
|
+
} & {
|
|
48
|
+
worker?: Worker;
|
|
49
|
+
}>>;
|
|
50
|
+
exposeHandler(_id: string, _options?: BridgeExposeOptions | undefined): Promisable<ModuleInstance[]>;
|
|
51
|
+
exposedHandler(): Promisable<Address[]>;
|
|
52
|
+
getRoots(_force?: boolean | undefined): Promise<ModuleInstance[]>;
|
|
53
|
+
unexposeHandler(_id: string, _options?: BridgeUnexposeOptions | undefined): Promisable<ModuleInstance[]>;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=WorkerBridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkerBridge.d.ts","sourceRoot":"","sources":["../../src/WorkerBridge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EACL,mBAAmB,EAAE,YAAY,EAAE,qBAAqB,EACzD,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EACL,eAAe,EAIf,cAAc,EACd,YAAY,EACZ,iBAAiB,EAClB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAGpC,OAAO,EAAE,kBAAkB,EAA4B,MAAM,yBAAyB,CAAA;AAEtF,MAAM,MAAM,kBAAkB,CAAC,OAAO,SAAS,eAAe,CAAC,kBAAkB,CAAC,GAAG,eAAe,CAAC,kBAAkB,CAAC,IAAI,YAAY,CACtI,OAAO,EACP;IACE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CACF,CAAA;AAED,MAAM,WAAW,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAChD,I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BAAqB,GAAG,SAAS,GAAG,UAAU,CAAC,cAAc,EAAE,CAAC;CAGlH"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { EmptyObject } from '@xylabs/object';
|
|
2
|
+
import type { BridgeConfig } from '@xyo-network/bridge-model';
|
|
3
|
+
export declare const WorkerBridgeConfigSchema: "network.xyo.bridge.worker.config";
|
|
4
|
+
export type WorkerBridgeConfigSchema = typeof WorkerBridgeConfigSchema;
|
|
5
|
+
export type WorkerBridgeConfig<TConfig extends EmptyObject = EmptyObject> = BridgeConfig<TConfig, WorkerBridgeConfigSchema>;
|
|
6
|
+
//# sourceMappingURL=WorkerBridgeConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkerBridgeConfig.d.ts","sourceRoot":"","sources":["../../src/WorkerBridgeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D,eAAO,MAAM,wBAAwB,EAAG,kCAA2C,CAAA;AACnF,MAAM,MAAM,wBAAwB,GAAG,OAAO,wBAAwB,CAAA;AAEtE,MAAM,MAAM,kBAAkB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,IAAI,YAAY,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultNodeManifest.d.ts","sourceRoot":"","sources":["../../src/defaultNodeManifest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAKzE,eAAO,MAAM,sBAAsB,EAAE,sBAkCpC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docsEntry.d.ts","sourceRoot":"","sources":["../../src/docsEntry.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA"}
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,86 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import * as _xyo_network_module_model from '@xyo-network/module-model';
|
|
7
|
-
import { AnyConfigSchema, ModuleParams, ModuleQueryResult, ModuleInstance } from '@xyo-network/module-model';
|
|
8
|
-
import * as _xyo_network_account from '@xyo-network/account';
|
|
9
|
-
import * as _xylabs_object from '@xylabs/object';
|
|
10
|
-
import { EmptyObject } from '@xylabs/object';
|
|
11
|
-
import { Promisable } from '@xylabs/promise';
|
|
12
|
-
import { QueryBoundWitness } from '@xyo-network/boundwitness-model';
|
|
13
|
-
import { AbstractBridge } from '@xyo-network/bridge-abstract';
|
|
14
|
-
import { BridgeConfig, BridgeModule, BridgeExposeOptions, BridgeUnexposeOptions } from '@xyo-network/bridge-model';
|
|
15
|
-
import { Payload, Schema } from '@xyo-network/payload-model';
|
|
16
|
-
import { LRUCache } from 'lru-cache';
|
|
17
|
-
|
|
18
|
-
declare const defaultPackageManifest: PackageManifestPayload;
|
|
19
|
-
|
|
20
|
-
declare const WorkerBridgeConfigSchema: "network.xyo.bridge.worker.config";
|
|
21
|
-
type WorkerBridgeConfigSchema = typeof WorkerBridgeConfigSchema;
|
|
22
|
-
type WorkerBridgeConfig<TConfig extends EmptyObject = EmptyObject> = BridgeConfig<TConfig, WorkerBridgeConfigSchema>;
|
|
23
|
-
|
|
24
|
-
type WorkerBridgeParams<TConfig extends AnyConfigSchema<WorkerBridgeConfig> = AnyConfigSchema<WorkerBridgeConfig>> = ModuleParams<TConfig, {
|
|
25
|
-
worker?: Worker;
|
|
26
|
-
}>;
|
|
27
|
-
interface Message<T extends string = string> {
|
|
28
|
-
type: T;
|
|
29
|
-
}
|
|
30
|
-
interface QueryMessage extends Message<'xyoQuery'> {
|
|
31
|
-
address: Address;
|
|
32
|
-
msgId?: string;
|
|
33
|
-
payloads?: Payload[];
|
|
34
|
-
query: QueryBoundWitness;
|
|
35
|
-
}
|
|
36
|
-
interface QueryResultMessage {
|
|
37
|
-
address: Address;
|
|
38
|
-
msgId?: string;
|
|
39
|
-
result: ModuleQueryResult;
|
|
40
|
-
}
|
|
41
|
-
declare class WorkerBridge<TParams extends WorkerBridgeParams = WorkerBridgeParams> extends AbstractBridge<TParams> implements BridgeModule<TParams> {
|
|
42
|
-
static readonly configSchemas: Schema[];
|
|
43
|
-
static readonly defaultConfigSchema: Schema;
|
|
44
|
-
private _discoverCache?;
|
|
45
|
-
private _targetConfigs;
|
|
46
|
-
private _targetQueries;
|
|
47
|
-
get discoverCache(): LRUCache<string, Payload[], unknown>;
|
|
48
|
-
get discoverCacheConfig(): LRUCache.Options<string, Payload[], unknown>;
|
|
49
|
-
get worker(): Worker;
|
|
50
|
-
static createWorkerNode(manifest?: PackageManifestPayload): Promise<WorkerBridge<_xylabs_object.BaseParamsFields & {
|
|
51
|
-
account?: _xyo_network_account.AccountInstance | "random";
|
|
52
|
-
addToResolvers?: boolean;
|
|
53
|
-
additionalSigners?: _xyo_network_account.AccountInstance[];
|
|
54
|
-
allowNameResolution?: boolean;
|
|
55
|
-
config: AnyConfigSchema<WorkerBridgeConfig>;
|
|
56
|
-
ephemeralQueryAccountEnabled?: boolean;
|
|
57
|
-
moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
|
|
58
|
-
privateChildren?: ModuleInstance[];
|
|
59
|
-
publicChildren?: ModuleInstance[];
|
|
60
|
-
} & {
|
|
61
|
-
worker?: Worker;
|
|
62
|
-
}>>;
|
|
63
|
-
exposeHandler(_id: string, _options?: BridgeExposeOptions | undefined): Promisable<ModuleInstance[]>;
|
|
64
|
-
exposedHandler(): Promisable<Address[]>;
|
|
65
|
-
getRoots(_force?: boolean | undefined): Promise<ModuleInstance[]>;
|
|
66
|
-
unexposeHandler(_id: string, _options?: BridgeUnexposeOptions | undefined): Promisable<ModuleInstance[]>;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
type QueryEvent = MessageEvent<QueryMessage>;
|
|
70
|
-
interface CreateNodeMessage extends Message<'createNode'> {
|
|
71
|
-
manifest: PackageManifestPayload$1;
|
|
72
|
-
}
|
|
73
|
-
type CreateNodeEvent = MessageEvent<CreateNodeMessage>;
|
|
74
|
-
interface NodeCreatedMessage extends Message<'nodeCreated'> {
|
|
75
|
-
address: Address;
|
|
76
|
-
}
|
|
77
|
-
declare class WorkerNodeHost {
|
|
78
|
-
protected node: NodeInstance;
|
|
79
|
-
protected logger?: Logger | undefined;
|
|
80
|
-
constructor(node: NodeInstance, logger?: Logger | undefined);
|
|
81
|
-
static create(config: PackageManifestPayload$1): Promise<WorkerNodeHost>;
|
|
82
|
-
static start(logger?: Logger): void;
|
|
83
|
-
private attachNode;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export { type CreateNodeEvent, type CreateNodeMessage, type Message, type NodeCreatedMessage, type QueryEvent, type QueryMessage, type QueryResultMessage, WorkerBridge, type WorkerBridgeConfig, WorkerBridgeConfigSchema, type WorkerBridgeParams, WorkerNodeHost, defaultPackageManifest };
|
|
1
|
+
export * from './defaultNodeManifest.ts';
|
|
2
|
+
export * from './worker/index.ts';
|
|
3
|
+
export * from './WorkerBridge.ts';
|
|
4
|
+
export * from './WorkerBridgeConfig.ts';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Worker.d.ts","sourceRoot":"","sources":["../../../src/worker/Worker.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Address } from '@xylabs/hex';
|
|
2
|
+
import type { Logger } from '@xylabs/logger';
|
|
3
|
+
import type { PackageManifestPayload } from '@xyo-network/manifest';
|
|
4
|
+
import type { NodeInstance } from '@xyo-network/node-model';
|
|
5
|
+
import type { Message, QueryMessage } from '../WorkerBridge.ts';
|
|
6
|
+
export type QueryEvent = MessageEvent<QueryMessage>;
|
|
7
|
+
export interface CreateNodeMessage extends Message<'createNode'> {
|
|
8
|
+
manifest: PackageManifestPayload;
|
|
9
|
+
}
|
|
10
|
+
export type CreateNodeEvent = MessageEvent<CreateNodeMessage>;
|
|
11
|
+
export interface NodeCreatedMessage extends Message<'nodeCreated'> {
|
|
12
|
+
address: Address;
|
|
13
|
+
}
|
|
14
|
+
export declare class WorkerNodeHost {
|
|
15
|
+
protected node: NodeInstance;
|
|
16
|
+
protected logger?: Logger | undefined;
|
|
17
|
+
constructor(node: NodeInstance, logger?: Logger | undefined);
|
|
18
|
+
static create(config: PackageManifestPayload): Promise<WorkerNodeHost>;
|
|
19
|
+
static start(logger?: Logger): void;
|
|
20
|
+
private attachNode;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=WorkerNodeHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkerNodeHost.d.ts","sourceRoot":"","sources":["../../../src/worker/WorkerNodeHost.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE3D,OAAO,KAAK,EACV,OAAO,EAAE,YAAY,EACtB,MAAM,oBAAoB,CAAA;AAE3B,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC,YAAY,CAAC,CAAA;AAEnD,MAAM,WAAW,iBAAkB,SAAQ,OAAO,CAAC,YAAY,CAAC;IAC9D,QAAQ,EAAE,sBAAsB,CAAA;CACjC;AAED,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,iBAAiB,CAAC,CAAA;AAE7D,MAAM,WAAW,kBAAmB,SAAQ,OAAO,CAAC,aAAa,CAAC;IAChE,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,qBAAa,cAAc;IAEvB,SAAS,CAAC,IAAI,EAAE,YAAY;IAC5B,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM;gBADf,IAAI,EAAE,YAAY,EAClB,MAAM,CAAC,EAAE,MAAM,YAAA;WAGd,MAAM,CAAC,MAAM,EAAE,sBAAsB;IASlD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM;IAwB5B,OAAO,CAAC,UAAU;CA8BnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/worker/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/bridge-worker",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.20",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -44,23 +44,23 @@
|
|
|
44
44
|
"@xylabs/logger": "^4.5.1",
|
|
45
45
|
"@xylabs/object": "^4.5.1",
|
|
46
46
|
"@xylabs/promise": "^4.5.1",
|
|
47
|
-
"@xyo-network/account": "^3.9.
|
|
48
|
-
"@xyo-network/archivist-model": "^3.9.
|
|
49
|
-
"@xyo-network/boundwitness-model": "^3.9.
|
|
50
|
-
"@xyo-network/bridge-abstract": "^3.9.
|
|
51
|
-
"@xyo-network/bridge-model": "^3.9.
|
|
52
|
-
"@xyo-network/manifest": "^3.9.
|
|
53
|
-
"@xyo-network/manifest-model": "^3.9.
|
|
54
|
-
"@xyo-network/module-model": "^3.9.
|
|
55
|
-
"@xyo-network/node-model": "^3.9.
|
|
56
|
-
"@xyo-network/payload-model": "^3.9.
|
|
57
|
-
"@xyo-network/sentinel-model": "^3.9.
|
|
47
|
+
"@xyo-network/account": "^3.9.20",
|
|
48
|
+
"@xyo-network/archivist-model": "^3.9.20",
|
|
49
|
+
"@xyo-network/boundwitness-model": "^3.9.20",
|
|
50
|
+
"@xyo-network/bridge-abstract": "^3.9.20",
|
|
51
|
+
"@xyo-network/bridge-model": "^3.9.20",
|
|
52
|
+
"@xyo-network/manifest": "^3.9.20",
|
|
53
|
+
"@xyo-network/manifest-model": "^3.9.20",
|
|
54
|
+
"@xyo-network/module-model": "^3.9.20",
|
|
55
|
+
"@xyo-network/node-model": "^3.9.20",
|
|
56
|
+
"@xyo-network/payload-model": "^3.9.20",
|
|
57
|
+
"@xyo-network/sentinel-model": "^3.9.20",
|
|
58
58
|
"lru-cache": "^11.0.2"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@xylabs/ts-scripts-yarn3": "^5.0.
|
|
62
|
-
"@xylabs/tsconfig": "^5.0.
|
|
63
|
-
"typescript": "^5.
|
|
61
|
+
"@xylabs/ts-scripts-yarn3": "^5.0.39",
|
|
62
|
+
"@xylabs/tsconfig": "^5.0.39",
|
|
63
|
+
"typescript": "^5.8.2"
|
|
64
64
|
},
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|