@xyo-network/schema-plugin 2.42.0

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.
@@ -0,0 +1,15 @@
1
+ import { XyoModuleParams } from '@xyo-network/module';
2
+ import { PayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin';
3
+ export declare const XyoSchemaPlugin: () => PayloadSetWitnessPlugin<XyoModuleParams<import("@xyo-network/payload").SchemaFields & import("@xyo-network/payload").PayloadFields & {
4
+ security?: {
5
+ allowed?: Record<string, string[][]> | undefined;
6
+ disallowed?: Record<string, string[]> | undefined;
7
+ } | undefined;
8
+ } & {
9
+ schema: "network.xyo.schema.witness.config";
10
+ } & {
11
+ targetSet?: (import("@xyo-network/payload").SchemaFields & import("@xyo-network/payload").PayloadFields & import("@xyo-network/payload").PayloadSet & {
12
+ schema: "network.xyo.payload.set";
13
+ }) | undefined;
14
+ }>>;
15
+ //# sourceMappingURL=Plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAA0B,uBAAuB,EAAE,MAAM,gCAAgC,CAAA;AAKhG,eAAO,MAAM,eAAe;;;;;;;;;;;GASzB,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { PayloadSetSchema } from '@xyo-network/payload';
2
+ import { createPayloadSetPlugin } from '@xyo-network/payloadset-plugin';
3
+ import { XyoSchemaSchema } from '@xyo-network/schema-payload-plugin';
4
+ import { XyoSchemaWitness } from './Witness';
5
+ export const XyoSchemaPlugin = () => createPayloadSetPlugin({ required: { [XyoSchemaSchema]: 1 }, schema: PayloadSetSchema }, {
6
+ witness: async (params) => {
7
+ const result = await XyoSchemaWitness.create(params);
8
+ return result;
9
+ },
10
+ });
11
+ //# sourceMappingURL=Plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Plugin.js","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,sBAAsB,EAA2B,MAAM,gCAAgC,CAAA;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AAEpE,OAAO,EAAE,gBAAgB,EAA0B,MAAM,WAAW,CAAA;AAEpE,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE,CAClC,sBAAsB,CACpB,EAAE,QAAQ,EAAE,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAChE;IACE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACxB,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QACpD,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CACF,CAAA"}
@@ -0,0 +1,14 @@
1
+ import { XyoModuleParams } from '@xyo-network/module';
2
+ import { XyoSchemaPayload } from '@xyo-network/schema-payload-plugin';
3
+ import { AbstractWitness, XyoWitnessConfig } from '@xyo-network/witness';
4
+ export type XyoSchemaWitnessConfigSchema = 'network.xyo.schema.witness.config';
5
+ export declare const XyoSchemaWitnessConfigSchema: XyoSchemaWitnessConfigSchema;
6
+ export type XyoSchemaWitnessConfig = XyoWitnessConfig<{
7
+ schema: XyoSchemaWitnessConfigSchema;
8
+ }>;
9
+ export declare class XyoSchemaWitness extends AbstractWitness<XyoSchemaWitnessConfig> {
10
+ static configSchema: "network.xyo.schema.witness.config";
11
+ static create(params?: XyoModuleParams<XyoSchemaWitnessConfig>): Promise<XyoSchemaWitness>;
12
+ observe(_payloads?: XyoSchemaPayload[]): Promise<XyoSchemaPayload[]>;
13
+ }
14
+ //# sourceMappingURL=Witness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Witness.d.ts","sourceRoot":"","sources":["../../src/Witness.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AACrE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAExE,MAAM,MAAM,4BAA4B,GAAG,mCAAmC,CAAA;AAC9E,eAAO,MAAM,4BAA4B,EAAE,4BAAkE,CAAA;AAE7G,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,CAAC;IAAE,MAAM,EAAE,4BAA4B,CAAA;CAAE,CAAC,CAAA;AAE/F,qBAAa,gBAAiB,SAAQ,eAAe,CAAC,sBAAsB,CAAC;IAC3E,OAAgB,YAAY,sCAA+B;WAErC,MAAM,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAI1F,OAAO,CAAC,SAAS,CAAC,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAIpF"}
@@ -0,0 +1,14 @@
1
+ import { delay } from '@xylabs/delay';
2
+ import { AbstractWitness } from '@xyo-network/witness';
3
+ export const XyoSchemaWitnessConfigSchema = 'network.xyo.schema.witness.config';
4
+ export class XyoSchemaWitness extends AbstractWitness {
5
+ static configSchema = XyoSchemaWitnessConfigSchema;
6
+ static async create(params) {
7
+ return (await super.create(params));
8
+ }
9
+ async observe(_payloads) {
10
+ await delay(0);
11
+ throw new Error('Method not implemented.');
12
+ }
13
+ }
14
+ //# sourceMappingURL=Witness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Witness.js","sourceRoot":"","sources":["../../src/Witness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAGrC,OAAO,EAAE,eAAe,EAAoB,MAAM,sBAAsB,CAAA;AAGxE,MAAM,CAAC,MAAM,4BAA4B,GAAiC,mCAAmC,CAAA;AAI7G,MAAM,OAAO,gBAAiB,SAAQ,eAAuC;IAC3E,MAAM,CAAU,YAAY,GAAG,4BAA4B,CAAA;IAE3D,MAAM,CAAU,KAAK,CAAC,MAAM,CAAC,MAAgD;QAC3E,OAAO,CAAC,MAAM,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAqB,CAAA;IACzD,CAAC;IAEQ,KAAK,CAAC,OAAO,CAAC,SAA8B;QACnD,MAAM,KAAK,CAAC,CAAC,CAAC,CAAA;QACd,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC5C,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { XyoSchemaPlugin } from './Plugin';
2
+ export * from './Witness';
3
+ export { XyoSchemaPlugin };
4
+ export default XyoSchemaPlugin;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE1C,cAAc,WAAW,CAAA;AAEzB,OAAO,EAAE,eAAe,EAAE,CAAA;AAG1B,eAAe,eAAe,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { XyoSchemaPlugin } from './Plugin';
2
+ export * from './Witness';
3
+ export { XyoSchemaPlugin };
4
+ // eslint-disable-next-line import/no-default-export
5
+ export default XyoSchemaPlugin;
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE1C,cAAc,WAAW,CAAA;AAEzB,OAAO,EAAE,eAAe,EAAE,CAAA;AAE1B,oDAAoD;AACpD,eAAe,eAAe,CAAA"}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@xyo-network/schema-plugin",
3
+ "author": {
4
+ "email": "support@xyo.network",
5
+ "name": "XYO Development Team",
6
+ "url": "https://xyo.network"
7
+ },
8
+ "bugs": {
9
+ "email": "support@xyo.network",
10
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
11
+ },
12
+ "dependencies": {
13
+ "@xylabs/delay": "^2.6.9",
14
+ "@xyo-network/module": "^2.42.0",
15
+ "@xyo-network/payload": "^2.42.0",
16
+ "@xyo-network/payloadset-plugin": "^2.42.0",
17
+ "@xyo-network/schema-payload-plugin": "^2.42.0",
18
+ "@xyo-network/witness": "^2.42.0",
19
+ "tslib": "^2.4.1"
20
+ },
21
+ "description": "Primary SDK for using XYO Protocol 2.0",
22
+ "browser": "dist/esm/index.js",
23
+ "docs": "dist/docs.json",
24
+ "exports": {
25
+ ".": {
26
+ "node": {
27
+ "import": "./dist/esm/index.js",
28
+ "require": "./dist/cjs/index.js"
29
+ },
30
+ "browser": {
31
+ "import": "./dist/esm/index.js",
32
+ "require": "./dist/cjs/index.js"
33
+ },
34
+ "default": "./dist/esm/index.js"
35
+ },
36
+ "./dist/docs.json": {
37
+ "default": "./dist/docs.json"
38
+ },
39
+ "./package.json": "./package.json"
40
+ },
41
+ "main": "dist/cjs/index.js",
42
+ "module": "dist/esm/index.js",
43
+ "homepage": "https://xyo.network",
44
+ "license": "LGPL-3.0-only",
45
+ "publishConfig": {
46
+ "access": "public"
47
+ },
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
51
+ },
52
+ "sideEffects": false,
53
+ "types": "dist/esm/index.d.ts",
54
+ "version": "2.42.0"
55
+ }
@@ -0,0 +1,13 @@
1
+ import { PayloadSetPluginResolver } from '@xyo-network/payloadset-plugin'
2
+ import { XyoSchemaSchema } from '@xyo-network/schema-payload-plugin'
3
+
4
+ import { XyoSchemaPlugin } from './Plugin'
5
+
6
+ describe('XyoSchemaPlugin', () => {
7
+ test('Add to Resolver', () => {
8
+ const plugin = XyoSchemaPlugin()
9
+ const resolver = new PayloadSetPluginResolver().register(plugin)
10
+ expect(resolver.resolve(plugin.set)).toBeObject()
11
+ expect(resolver.witness(XyoSchemaSchema)).toBeObject()
12
+ })
13
+ })
package/src/Plugin.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { XyoModuleParams } from '@xyo-network/module'
2
+ import { PayloadSetSchema } from '@xyo-network/payload'
3
+ import { createPayloadSetPlugin, PayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'
4
+ import { XyoSchemaSchema } from '@xyo-network/schema-payload-plugin'
5
+
6
+ import { XyoSchemaWitness, XyoSchemaWitnessConfig } from './Witness'
7
+
8
+ export const XyoSchemaPlugin = () =>
9
+ createPayloadSetPlugin<PayloadSetWitnessPlugin<XyoModuleParams<XyoSchemaWitnessConfig>>>(
10
+ { required: { [XyoSchemaSchema]: 1 }, schema: PayloadSetSchema },
11
+ {
12
+ witness: async (params) => {
13
+ const result = await XyoSchemaWitness.create(params)
14
+ return result
15
+ },
16
+ },
17
+ )
package/src/Witness.ts ADDED
@@ -0,0 +1,22 @@
1
+ import { delay } from '@xylabs/delay'
2
+ import { XyoModuleParams } from '@xyo-network/module'
3
+ import { XyoSchemaPayload } from '@xyo-network/schema-payload-plugin'
4
+ import { AbstractWitness, XyoWitnessConfig } from '@xyo-network/witness'
5
+
6
+ export type XyoSchemaWitnessConfigSchema = 'network.xyo.schema.witness.config'
7
+ export const XyoSchemaWitnessConfigSchema: XyoSchemaWitnessConfigSchema = 'network.xyo.schema.witness.config'
8
+
9
+ export type XyoSchemaWitnessConfig = XyoWitnessConfig<{ schema: XyoSchemaWitnessConfigSchema }>
10
+
11
+ export class XyoSchemaWitness extends AbstractWitness<XyoSchemaWitnessConfig> {
12
+ static override configSchema = XyoSchemaWitnessConfigSchema
13
+
14
+ static override async create(params?: XyoModuleParams<XyoSchemaWitnessConfig>): Promise<XyoSchemaWitness> {
15
+ return (await super.create(params)) as XyoSchemaWitness
16
+ }
17
+
18
+ override async observe(_payloads?: XyoSchemaPayload[]): Promise<XyoSchemaPayload[]> {
19
+ await delay(0)
20
+ throw new Error('Method not implemented.')
21
+ }
22
+ }
package/src/index.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { XyoSchemaPlugin } from './Plugin'
2
+
3
+ export * from './Witness'
4
+
5
+ export { XyoSchemaPlugin }
6
+
7
+ // eslint-disable-next-line import/no-default-export
8
+ export default XyoSchemaPlugin