@xyo-network/bridge-wrapper 2.99.2 → 2.99.4
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/neutral/BridgeWrapper.d.cts +26 -0
- package/dist/neutral/BridgeWrapper.d.cts.map +1 -0
- package/dist/neutral/BridgeWrapper.d.mts +26 -0
- package/dist/neutral/BridgeWrapper.d.mts.map +1 -0
- package/dist/neutral/BridgeWrapper.d.ts +26 -0
- package/dist/neutral/BridgeWrapper.d.ts.map +1 -0
- package/dist/neutral/index.cjs +65 -0
- package/dist/neutral/index.cjs.map +1 -0
- package/dist/neutral/index.d.cts +2 -0
- package/dist/neutral/index.d.cts.map +1 -0
- package/dist/neutral/index.d.mts +2 -0
- package/dist/neutral/index.d.mts.map +1 -0
- package/dist/neutral/index.d.ts +2 -0
- package/dist/neutral/index.d.ts.map +1 -0
- package/dist/neutral/index.js +44 -0
- package/dist/neutral/index.js.map +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BridgeExposeOptions, BridgeInstance, BridgeModule, BridgeUnexposeOptions } from '@xyo-network/bridge-model';
|
|
2
|
+
import { ModuleIdentifier, ModuleInstance } from '@xyo-network/module-model';
|
|
3
|
+
import { ModuleWrapper } from '@xyo-network/module-wrapper';
|
|
4
|
+
export declare class BridgeWrapper<TWrappedModule extends BridgeModule = BridgeModule> extends ModuleWrapper<TWrappedModule> implements BridgeInstance<TWrappedModule['params']> {
|
|
5
|
+
static instanceIdentityCheck: import("@xylabs/object").TypeCheck<BridgeInstance<import("@xyo-network/bridge-model").BridgeParams<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
|
|
6
|
+
client?: import("@xyo-network/bridge-model").BridgeClientConfig | undefined;
|
|
7
|
+
host?: import("@xyo-network/bridge-model").BridgeHostConfig | undefined;
|
|
8
|
+
schema: "network.xyo.bridge.config";
|
|
9
|
+
}, "schema"> & {
|
|
10
|
+
schema: "network.xyo.bridge.config";
|
|
11
|
+
}, "schema"> & {
|
|
12
|
+
schema: string;
|
|
13
|
+
}>, import("@xyo-network/bridge-model").BridgeModuleEventData>>;
|
|
14
|
+
static moduleIdentityCheck: import("@xyo-network/module-model").ModuleTypeCheck<BridgeModule<import("@xyo-network/bridge-model").BridgeParams<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
|
|
15
|
+
client?: import("@xyo-network/bridge-model").BridgeClientConfig | undefined;
|
|
16
|
+
host?: import("@xyo-network/bridge-model").BridgeHostConfig | undefined;
|
|
17
|
+
schema: "network.xyo.bridge.config";
|
|
18
|
+
}, "schema"> & {
|
|
19
|
+
schema: "network.xyo.bridge.config";
|
|
20
|
+
}, "schema"> & {
|
|
21
|
+
schema: string;
|
|
22
|
+
}>, import("@xyo-network/bridge-model").BridgeModuleEventData>>;
|
|
23
|
+
expose(id: ModuleIdentifier, options?: BridgeExposeOptions): Promise<ModuleInstance[]>;
|
|
24
|
+
unexpose(id: ModuleIdentifier, options?: BridgeUnexposeOptions): Promise<ModuleInstance[]>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=BridgeWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BridgeWrapper.d.ts","sourceRoot":"","sources":["../../src/BridgeWrapper.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EAGnB,cAAc,EACd,YAAY,EACZ,qBAAqB,EAOtB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC5E,OAAO,EAA8B,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAGvF,qBAAa,aAAa,CAAC,cAAc,SAAS,YAAY,GAAG,YAAY,CAC3E,SAAQ,aAAa,CAAC,cAAc,CACpC,YAAW,cAAc,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAEnD,OAAgB,qBAAqB;;;;;;;;oEAAmB;IACxD,OAAgB,mBAAmB;;;;;;;;oEAAiB;IAE9C,MAAM,CAAC,EAAE,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAQtF,QAAQ,CAAC,EAAE,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;CAOjG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BridgeExposeOptions, BridgeInstance, BridgeModule, BridgeUnexposeOptions } from '@xyo-network/bridge-model';
|
|
2
|
+
import { ModuleIdentifier, ModuleInstance } from '@xyo-network/module-model';
|
|
3
|
+
import { ModuleWrapper } from '@xyo-network/module-wrapper';
|
|
4
|
+
export declare class BridgeWrapper<TWrappedModule extends BridgeModule = BridgeModule> extends ModuleWrapper<TWrappedModule> implements BridgeInstance<TWrappedModule['params']> {
|
|
5
|
+
static instanceIdentityCheck: import("@xylabs/object").TypeCheck<BridgeInstance<import("@xyo-network/bridge-model").BridgeParams<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
|
|
6
|
+
client?: import("@xyo-network/bridge-model").BridgeClientConfig | undefined;
|
|
7
|
+
host?: import("@xyo-network/bridge-model").BridgeHostConfig | undefined;
|
|
8
|
+
schema: "network.xyo.bridge.config";
|
|
9
|
+
}, "schema"> & {
|
|
10
|
+
schema: "network.xyo.bridge.config";
|
|
11
|
+
}, "schema"> & {
|
|
12
|
+
schema: string;
|
|
13
|
+
}>, import("@xyo-network/bridge-model").BridgeModuleEventData>>;
|
|
14
|
+
static moduleIdentityCheck: import("@xyo-network/module-model").ModuleTypeCheck<BridgeModule<import("@xyo-network/bridge-model").BridgeParams<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
|
|
15
|
+
client?: import("@xyo-network/bridge-model").BridgeClientConfig | undefined;
|
|
16
|
+
host?: import("@xyo-network/bridge-model").BridgeHostConfig | undefined;
|
|
17
|
+
schema: "network.xyo.bridge.config";
|
|
18
|
+
}, "schema"> & {
|
|
19
|
+
schema: "network.xyo.bridge.config";
|
|
20
|
+
}, "schema"> & {
|
|
21
|
+
schema: string;
|
|
22
|
+
}>, import("@xyo-network/bridge-model").BridgeModuleEventData>>;
|
|
23
|
+
expose(id: ModuleIdentifier, options?: BridgeExposeOptions): Promise<ModuleInstance[]>;
|
|
24
|
+
unexpose(id: ModuleIdentifier, options?: BridgeUnexposeOptions): Promise<ModuleInstance[]>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=BridgeWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BridgeWrapper.d.ts","sourceRoot":"","sources":["../../src/BridgeWrapper.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EAGnB,cAAc,EACd,YAAY,EACZ,qBAAqB,EAOtB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC5E,OAAO,EAA8B,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAGvF,qBAAa,aAAa,CAAC,cAAc,SAAS,YAAY,GAAG,YAAY,CAC3E,SAAQ,aAAa,CAAC,cAAc,CACpC,YAAW,cAAc,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAEnD,OAAgB,qBAAqB;;;;;;;;oEAAmB;IACxD,OAAgB,mBAAmB;;;;;;;;oEAAiB;IAE9C,MAAM,CAAC,EAAE,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAQtF,QAAQ,CAAC,EAAE,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;CAOjG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BridgeExposeOptions, BridgeInstance, BridgeModule, BridgeUnexposeOptions } from '@xyo-network/bridge-model';
|
|
2
|
+
import { ModuleIdentifier, ModuleInstance } from '@xyo-network/module-model';
|
|
3
|
+
import { ModuleWrapper } from '@xyo-network/module-wrapper';
|
|
4
|
+
export declare class BridgeWrapper<TWrappedModule extends BridgeModule = BridgeModule> extends ModuleWrapper<TWrappedModule> implements BridgeInstance<TWrappedModule['params']> {
|
|
5
|
+
static instanceIdentityCheck: import("@xylabs/object").TypeCheck<BridgeInstance<import("@xyo-network/bridge-model").BridgeParams<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
|
|
6
|
+
client?: import("@xyo-network/bridge-model").BridgeClientConfig | undefined;
|
|
7
|
+
host?: import("@xyo-network/bridge-model").BridgeHostConfig | undefined;
|
|
8
|
+
schema: "network.xyo.bridge.config";
|
|
9
|
+
}, "schema"> & {
|
|
10
|
+
schema: "network.xyo.bridge.config";
|
|
11
|
+
}, "schema"> & {
|
|
12
|
+
schema: string;
|
|
13
|
+
}>, import("@xyo-network/bridge-model").BridgeModuleEventData>>;
|
|
14
|
+
static moduleIdentityCheck: import("@xyo-network/module-model").ModuleTypeCheck<BridgeModule<import("@xyo-network/bridge-model").BridgeParams<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
|
|
15
|
+
client?: import("@xyo-network/bridge-model").BridgeClientConfig | undefined;
|
|
16
|
+
host?: import("@xyo-network/bridge-model").BridgeHostConfig | undefined;
|
|
17
|
+
schema: "network.xyo.bridge.config";
|
|
18
|
+
}, "schema"> & {
|
|
19
|
+
schema: "network.xyo.bridge.config";
|
|
20
|
+
}, "schema"> & {
|
|
21
|
+
schema: string;
|
|
22
|
+
}>, import("@xyo-network/bridge-model").BridgeModuleEventData>>;
|
|
23
|
+
expose(id: ModuleIdentifier, options?: BridgeExposeOptions): Promise<ModuleInstance[]>;
|
|
24
|
+
unexpose(id: ModuleIdentifier, options?: BridgeUnexposeOptions): Promise<ModuleInstance[]>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=BridgeWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BridgeWrapper.d.ts","sourceRoot":"","sources":["../../src/BridgeWrapper.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EAGnB,cAAc,EACd,YAAY,EACZ,qBAAqB,EAOtB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC5E,OAAO,EAA8B,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAGvF,qBAAa,aAAa,CAAC,cAAc,SAAS,YAAY,GAAG,YAAY,CAC3E,SAAQ,aAAa,CAAC,cAAc,CACpC,YAAW,cAAc,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAEnD,OAAgB,qBAAqB;;;;;;;;oEAAmB;IACxD,OAAgB,mBAAmB;;;;;;;;oEAAiB;IAE9C,MAAM,CAAC,EAAE,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAQtF,QAAQ,CAAC,EAAE,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;CAOjG"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var src_exports = {};
|
|
23
|
+
__export(src_exports, {
|
|
24
|
+
BridgeWrapper: () => BridgeWrapper
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(src_exports);
|
|
27
|
+
|
|
28
|
+
// src/BridgeWrapper.ts
|
|
29
|
+
var import_bridge_model = require("@xyo-network/bridge-model");
|
|
30
|
+
var import_module_wrapper = require("@xyo-network/module-wrapper");
|
|
31
|
+
(0, import_module_wrapper.constructableModuleWrapper)();
|
|
32
|
+
var BridgeWrapper = class extends import_module_wrapper.ModuleWrapper {
|
|
33
|
+
static {
|
|
34
|
+
__name(this, "BridgeWrapper");
|
|
35
|
+
}
|
|
36
|
+
static instanceIdentityCheck = import_bridge_model.isBridgeInstance;
|
|
37
|
+
static moduleIdentityCheck = import_bridge_model.isBridgeModule;
|
|
38
|
+
async expose(id, options) {
|
|
39
|
+
const filterPayload = {
|
|
40
|
+
id,
|
|
41
|
+
schema: import_bridge_model.ModuleFilterPayloadSchema,
|
|
42
|
+
...options
|
|
43
|
+
};
|
|
44
|
+
const addresses = (await this.sendQuery({
|
|
45
|
+
schema: import_bridge_model.BridgeExposeQuerySchema
|
|
46
|
+
}, [
|
|
47
|
+
filterPayload
|
|
48
|
+
])).map(({ address }) => address);
|
|
49
|
+
return await Promise.all(addresses.map((address) => this.resolve(address)));
|
|
50
|
+
}
|
|
51
|
+
async unexpose(id, options) {
|
|
52
|
+
const filterPayload = {
|
|
53
|
+
id,
|
|
54
|
+
schema: import_bridge_model.ModuleFilterPayloadSchema,
|
|
55
|
+
...options
|
|
56
|
+
};
|
|
57
|
+
const addresses = (await this.sendQuery({
|
|
58
|
+
schema: import_bridge_model.BridgeUnexposeQuerySchema
|
|
59
|
+
}, [
|
|
60
|
+
filterPayload
|
|
61
|
+
])).map(({ address }) => address);
|
|
62
|
+
return addresses ? [] : [];
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/BridgeWrapper.ts"],"sourcesContent":["export * from './BridgeWrapper'\n","import { Address } from '@xylabs/hex'\nimport { AddressPayload } from '@xyo-network/address-payload-plugin'\nimport {\n BridgeExposeOptions,\n BridgeExposeQuery,\n BridgeExposeQuerySchema,\n BridgeInstance,\n BridgeModule,\n BridgeUnexposeOptions,\n BridgeUnexposeQuery,\n BridgeUnexposeQuerySchema,\n isBridgeInstance,\n isBridgeModule,\n ModuleFilterPayload,\n ModuleFilterPayloadSchema,\n} from '@xyo-network/bridge-model'\nimport { ModuleIdentifier, ModuleInstance } from '@xyo-network/module-model'\nimport { constructableModuleWrapper, ModuleWrapper } from '@xyo-network/module-wrapper'\n\nconstructableModuleWrapper()\nexport class BridgeWrapper<TWrappedModule extends BridgeModule = BridgeModule>\n extends ModuleWrapper<TWrappedModule>\n implements BridgeInstance<TWrappedModule['params']>\n{\n static override instanceIdentityCheck = isBridgeInstance\n static override moduleIdentityCheck = isBridgeModule\n\n async expose(id: ModuleIdentifier, options?: BridgeExposeOptions): Promise<ModuleInstance[]> {\n const filterPayload: ModuleFilterPayload = { id, schema: ModuleFilterPayloadSchema, ...options }\n const addresses = (\n await this.sendQuery<BridgeExposeQuery, ModuleFilterPayload, AddressPayload>({ schema: BridgeExposeQuerySchema }, [filterPayload])\n ).map(({ address }) => address)\n return await Promise.all((addresses as Address[]).map((address) => this.resolve(address)))\n }\n\n async unexpose(id: ModuleIdentifier, options?: BridgeUnexposeOptions): Promise<ModuleInstance[]> {\n const filterPayload: ModuleFilterPayload = { id, schema: ModuleFilterPayloadSchema, ...options }\n const addresses = (\n await this.sendQuery<BridgeUnexposeQuery, ModuleFilterPayload, AddressPayload>({ schema: BridgeUnexposeQuerySchema }, [filterPayload])\n ).map(({ address }) => address)\n return addresses ? [] : []\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACEA,0BAaO;AAEP,4BAA0D;IAE1DA,kDAAAA;AACO,IAAMC,gBAAN,cACGC,oCAAAA;EAnBV,OAmBUA;;;EAGR,OAAgBC,wBAAwBC;EACxC,OAAgBC,sBAAsBC;EAEtC,MAAMC,OAAOC,IAAsBC,SAA0D;AAC3F,UAAMC,gBAAqC;MAAEF;MAAIG,QAAQC;MAA2B,GAAGH;IAAQ;AAC/F,UAAMI,aACJ,MAAM,KAAKC,UAAkE;MAAEH,QAAQI;IAAwB,GAAG;MAACL;KAAc,GACjIM,IAAI,CAAC,EAAEC,QAAO,MAAOA,OAAAA;AACvB,WAAO,MAAMC,QAAQC,IAAKN,UAAwBG,IAAI,CAACC,YAAY,KAAKG,QAAQH,OAAAA,CAAAA,CAAAA;EAClF;EAEA,MAAMI,SAASb,IAAsBC,SAA4D;AAC/F,UAAMC,gBAAqC;MAAEF;MAAIG,QAAQC;MAA2B,GAAGH;IAAQ;AAC/F,UAAMI,aACJ,MAAM,KAAKC,UAAoE;MAAEH,QAAQW;IAA0B,GAAG;MAACZ;KAAc,GACrIM,IAAI,CAAC,EAAEC,QAAO,MAAOA,OAAAA;AACvB,WAAOJ,YAAY,CAAA,IAAK,CAAA;EAC1B;AACF;","names":["constructableModuleWrapper","BridgeWrapper","ModuleWrapper","instanceIdentityCheck","isBridgeInstance","moduleIdentityCheck","isBridgeModule","expose","id","options","filterPayload","schema","ModuleFilterPayloadSchema","addresses","sendQuery","BridgeExposeQuerySchema","map","address","Promise","all","resolve","unexpose","BridgeUnexposeQuerySchema"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/BridgeWrapper.ts
|
|
5
|
+
import { BridgeExposeQuerySchema, BridgeUnexposeQuerySchema, isBridgeInstance, isBridgeModule, ModuleFilterPayloadSchema } from "@xyo-network/bridge-model";
|
|
6
|
+
import { constructableModuleWrapper, ModuleWrapper } from "@xyo-network/module-wrapper";
|
|
7
|
+
constructableModuleWrapper();
|
|
8
|
+
var BridgeWrapper = class extends ModuleWrapper {
|
|
9
|
+
static {
|
|
10
|
+
__name(this, "BridgeWrapper");
|
|
11
|
+
}
|
|
12
|
+
static instanceIdentityCheck = isBridgeInstance;
|
|
13
|
+
static moduleIdentityCheck = isBridgeModule;
|
|
14
|
+
async expose(id, options) {
|
|
15
|
+
const filterPayload = {
|
|
16
|
+
id,
|
|
17
|
+
schema: ModuleFilterPayloadSchema,
|
|
18
|
+
...options
|
|
19
|
+
};
|
|
20
|
+
const addresses = (await this.sendQuery({
|
|
21
|
+
schema: BridgeExposeQuerySchema
|
|
22
|
+
}, [
|
|
23
|
+
filterPayload
|
|
24
|
+
])).map(({ address }) => address);
|
|
25
|
+
return await Promise.all(addresses.map((address) => this.resolve(address)));
|
|
26
|
+
}
|
|
27
|
+
async unexpose(id, options) {
|
|
28
|
+
const filterPayload = {
|
|
29
|
+
id,
|
|
30
|
+
schema: ModuleFilterPayloadSchema,
|
|
31
|
+
...options
|
|
32
|
+
};
|
|
33
|
+
const addresses = (await this.sendQuery({
|
|
34
|
+
schema: BridgeUnexposeQuerySchema
|
|
35
|
+
}, [
|
|
36
|
+
filterPayload
|
|
37
|
+
])).map(({ address }) => address);
|
|
38
|
+
return addresses ? [] : [];
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
BridgeWrapper
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/BridgeWrapper.ts"],"sourcesContent":["import { Address } from '@xylabs/hex'\nimport { AddressPayload } from '@xyo-network/address-payload-plugin'\nimport {\n BridgeExposeOptions,\n BridgeExposeQuery,\n BridgeExposeQuerySchema,\n BridgeInstance,\n BridgeModule,\n BridgeUnexposeOptions,\n BridgeUnexposeQuery,\n BridgeUnexposeQuerySchema,\n isBridgeInstance,\n isBridgeModule,\n ModuleFilterPayload,\n ModuleFilterPayloadSchema,\n} from '@xyo-network/bridge-model'\nimport { ModuleIdentifier, ModuleInstance } from '@xyo-network/module-model'\nimport { constructableModuleWrapper, ModuleWrapper } from '@xyo-network/module-wrapper'\n\nconstructableModuleWrapper()\nexport class BridgeWrapper<TWrappedModule extends BridgeModule = BridgeModule>\n extends ModuleWrapper<TWrappedModule>\n implements BridgeInstance<TWrappedModule['params']>\n{\n static override instanceIdentityCheck = isBridgeInstance\n static override moduleIdentityCheck = isBridgeModule\n\n async expose(id: ModuleIdentifier, options?: BridgeExposeOptions): Promise<ModuleInstance[]> {\n const filterPayload: ModuleFilterPayload = { id, schema: ModuleFilterPayloadSchema, ...options }\n const addresses = (\n await this.sendQuery<BridgeExposeQuery, ModuleFilterPayload, AddressPayload>({ schema: BridgeExposeQuerySchema }, [filterPayload])\n ).map(({ address }) => address)\n return await Promise.all((addresses as Address[]).map((address) => this.resolve(address)))\n }\n\n async unexpose(id: ModuleIdentifier, options?: BridgeUnexposeOptions): Promise<ModuleInstance[]> {\n const filterPayload: ModuleFilterPayload = { id, schema: ModuleFilterPayloadSchema, ...options }\n const addresses = (\n await this.sendQuery<BridgeUnexposeQuery, ModuleFilterPayload, AddressPayload>({ schema: BridgeUnexposeQuerySchema }, [filterPayload])\n ).map(({ address }) => address)\n return addresses ? [] : []\n }\n}\n"],"mappings":";;;;AAEA,SAGEA,yBAKAC,2BACAC,kBACAC,gBAEAC,iCACK;AAEP,SAASC,4BAA4BC,qBAAqB;AAE1DC,2BAAAA;AACO,IAAMC,gBAAN,cACGC,cAAAA;EAnBV,OAmBUA;;;EAGR,OAAgBC,wBAAwBC;EACxC,OAAgBC,sBAAsBC;EAEtC,MAAMC,OAAOC,IAAsBC,SAA0D;AAC3F,UAAMC,gBAAqC;MAAEF;MAAIG,QAAQC;MAA2B,GAAGH;IAAQ;AAC/F,UAAMI,aACJ,MAAM,KAAKC,UAAkE;MAAEH,QAAQI;IAAwB,GAAG;MAACL;KAAc,GACjIM,IAAI,CAAC,EAAEC,QAAO,MAAOA,OAAAA;AACvB,WAAO,MAAMC,QAAQC,IAAKN,UAAwBG,IAAI,CAACC,YAAY,KAAKG,QAAQH,OAAAA,CAAAA,CAAAA;EAClF;EAEA,MAAMI,SAASb,IAAsBC,SAA4D;AAC/F,UAAMC,gBAAqC;MAAEF;MAAIG,QAAQC;MAA2B,GAAGH;IAAQ;AAC/F,UAAMI,aACJ,MAAM,KAAKC,UAAoE;MAAEH,QAAQW;IAA0B,GAAG;MAACZ;KAAc,GACrIM,IAAI,CAAC,EAAEC,QAAO,MAAOA,OAAAA;AACvB,WAAOJ,YAAY,CAAA,IAAK,CAAA;EAC1B;AACF;","names":["BridgeExposeQuerySchema","BridgeUnexposeQuerySchema","isBridgeInstance","isBridgeModule","ModuleFilterPayloadSchema","constructableModuleWrapper","ModuleWrapper","constructableModuleWrapper","BridgeWrapper","ModuleWrapper","instanceIdentityCheck","isBridgeInstance","moduleIdentityCheck","isBridgeModule","expose","id","options","filterPayload","schema","ModuleFilterPayloadSchema","addresses","sendQuery","BridgeExposeQuerySchema","map","address","Promise","all","resolve","unexpose","BridgeUnexposeQuerySchema"]}
|
package/package.json
CHANGED
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xylabs/hex": "^3.
|
|
14
|
-
"@xyo-network/address-payload-plugin": "~2.99.
|
|
15
|
-
"@xyo-network/bridge-model": "~2.99.
|
|
16
|
-
"@xyo-network/module-model": "~2.99.
|
|
17
|
-
"@xyo-network/module-wrapper": "~2.99.
|
|
13
|
+
"@xylabs/hex": "^3.3.2",
|
|
14
|
+
"@xyo-network/address-payload-plugin": "~2.99.4",
|
|
15
|
+
"@xyo-network/bridge-model": "~2.99.4",
|
|
16
|
+
"@xyo-network/module-model": "~2.99.4",
|
|
17
|
+
"@xyo-network/module-wrapper": "~2.99.4"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@xylabs/ts-scripts-yarn3": "^3.
|
|
21
|
-
"@xylabs/tsconfig": "^3.
|
|
20
|
+
"@xylabs/ts-scripts-yarn3": "^3.10.0",
|
|
21
|
+
"@xylabs/tsconfig": "^3.10.0",
|
|
22
22
|
"typescript": "^5.4.5"
|
|
23
23
|
},
|
|
24
24
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
@@ -60,6 +60,6 @@
|
|
|
60
60
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
|
|
61
61
|
},
|
|
62
62
|
"sideEffects": false,
|
|
63
|
-
"version": "2.99.
|
|
63
|
+
"version": "2.99.4",
|
|
64
64
|
"type": "module"
|
|
65
65
|
}
|