@xyo-network/xml-plugin 3.1.2 → 3.2.0-rc.2

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.
@@ -14,19 +14,19 @@ export type Xml = Payload<XmlFields, XmlSchema>;
14
14
  /**
15
15
  * Identity function for determine if an object is an Xml Payload
16
16
  */
17
- export declare const isXml: (x?: unknown | null) => x is import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & XmlFields & {
18
- schema: "network.xyo.xml";
19
- };
20
- /**
21
- * Identity function for determine if an object is an Xml Payload with sources
22
- */
23
- export declare const isXmlWithSources: (x?: unknown | null) => x is import("@xyo-network/payload-model").WithSources<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & XmlFields & {
17
+ export declare const isXml: (x?: unknown | null) => x is import("@xylabs/object").DeepRestrictToStringKeys<{
24
18
  schema: "network.xyo.xml";
19
+ xml: {
20
+ [x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
21
+ };
25
22
  }>;
26
23
  /**
27
- * Identity function for determine if an object is an Xml Payload with meta
24
+ * Identity function for determine if an object is an Xml Payload with sources
28
25
  */
29
- export declare const isXmlWithMeta: (x?: unknown | null) => x is import("@xyo-network/payload-model").WithMeta<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & XmlFields & {
26
+ export declare const isXmlWithSources: (x?: unknown | null) => x is import("@xyo-network/payload-model").WithSources<import("@xylabs/object").DeepRestrictToStringKeys<{
30
27
  schema: "network.xyo.xml";
31
- }>;
28
+ xml: {
29
+ [x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
30
+ };
31
+ }>>;
32
32
  //# sourceMappingURL=Payload.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAKzD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,UAAU,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,KAAK;;CAAwC,CAAA;AAE1D;;GAEG;AACH,eAAO,MAAM,gBAAgB;;EAAmD,CAAA;AAEhF;;GAEG;AACH,eAAO,MAAM,aAAa;;EAAgD,CAAA"}
1
+ {"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAGzD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,UAAU,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,KAAK;;;;;EAAwC,CAAA;AAE1D;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;GAAmD,CAAA"}
@@ -60,19 +60,13 @@ XmlParsingDiviner = __decorateClass([
60
60
  ], XmlParsingDiviner);
61
61
 
62
62
  // src/Payload.ts
63
- import {
64
- isPayloadOfSchemaType,
65
- isPayloadOfSchemaTypeWithMeta,
66
- isPayloadOfSchemaTypeWithSources
67
- } from "@xyo-network/payload-model";
63
+ import { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources } from "@xyo-network/payload-model";
68
64
  var isXml = isPayloadOfSchemaType(XmlSchema);
69
65
  var isXmlWithSources = isPayloadOfSchemaTypeWithSources(XmlSchema);
70
- var isXmlWithMeta = isPayloadOfSchemaTypeWithMeta(XmlSchema);
71
66
  export {
72
67
  XmlParsingDiviner,
73
68
  XmlSchema,
74
69
  isXml,
75
- isXmlWithMeta,
76
70
  isXmlWithSources
77
71
  };
78
72
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Diviner/Diviner.ts","../../src/Schema.ts","../../src/Diviner/lib/StringDataField.ts","../../src/Diviner/lib/toXml.ts","../../src/Diviner/Schema.ts","../../src/Payload.ts"],"sourcesContent":["import { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerInstance, DivinerModuleEventData } from '@xyo-network/diviner-model'\nimport { creatableModule } from '@xyo-network/module-model'\nimport { Payload, Schema } from '@xyo-network/payload-model'\n\nimport { Xml } from '../Payload.ts'\nimport { XmlSchema } from '../Schema.ts'\nimport {\n hasStringDataField, StringDataField, toXml,\n} from './lib/index.ts'\nimport { XmlParsingDivinerParams } from './Params.ts'\nimport { XmlParsingDivinerConfigSchema } from './Schema.ts'\n\n@creatableModule()\nexport class XmlParsingDiviner<\n TParams extends XmlParsingDivinerParams = XmlParsingDivinerParams,\n TIn extends Payload<StringDataField> = Payload<StringDataField>,\n TOut extends Xml | Payload = Xml | Payload,\n TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n> extends AbstractDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, XmlParsingDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = XmlParsingDivinerConfigSchema\n static override targetSchema = XmlSchema\n\n protected override async divineHandler(payloads: TIn[] = []): Promise<TOut[]> {\n const results = await Promise.all(payloads.filter(hasStringDataField).map(toXml))\n return results as TOut[]\n }\n}\n","export const XmlSchema = 'network.xyo.xml'\nexport type XmlSchema = typeof XmlSchema\n","/**\n * Interface representing an object with a string data field\n */\nexport interface StringDataField {\n /**\n * The string data\n */\n data: string\n}\n\n/**\n * Identity for StringDataField\n * @param obj The input object\n * @returns True if the object is a StringDataField, false otherwise\n */\nexport const hasStringDataField = (obj?: unknown): obj is StringDataField => {\n return typeof obj === 'object' && obj !== null && 'data' in obj && typeof (obj as StringDataField)?.data === 'string'\n}\n","import { Parser } from 'xml2js'\n\nimport type { Xml } from '../../Payload.ts'\nimport { XmlSchema } from '../../Schema.ts'\nimport type { StringDataField } from './StringDataField.ts'\n\n/**\n * Takes a string data field containing xml and converts it to an XML object\n * @param obj The input object which contains the stringified xml data\n * @returns A promise that resolves to an XML payload\n */\nexport const toXml = (obj: StringDataField): Promise<Xml> => {\n const parser = new Parser()\n return new Promise<Xml>((resolve, reject) => {\n parser.parseString(obj.data, (err, result) => {\n if (err) {\n reject(err)\n } else {\n const xml = { schema: XmlSchema, xml: result } as const\n resolve(xml)\n }\n })\n })\n}\n","export const XmlParsingDivinerConfigSchema = 'network.xyo.diviner.xml.config' as const\nexport type XmlParsingDivinerConfigSchema = typeof XmlParsingDivinerConfigSchema\n","import type { JsonObject } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport {\n isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources,\n} from '@xyo-network/payload-model'\n\nimport { XmlSchema } from './Schema.ts'\n\n/**\n * The fields of an Xml Payload\n */\nexport interface XmlFields {\n xml: JsonObject\n}\n\n/**\n * An Xml Payload\n */\nexport type Xml = Payload<XmlFields, XmlSchema>\n\n/**\n * Identity function for determine if an object is an Xml Payload\n */\nexport const isXml = isPayloadOfSchemaType<Xml>(XmlSchema)\n\n/**\n * Identity function for determine if an object is an Xml Payload with sources\n */\nexport const isXmlWithSources = isPayloadOfSchemaTypeWithSources<Xml>(XmlSchema)\n\n/**\n * Identity function for determine if an object is an Xml Payload with meta\n */\nexport const isXmlWithMeta = isPayloadOfSchemaTypeWithMeta<Xml>(XmlSchema)\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,uBAAuB;AAEhC,SAAS,uBAAuB;;;ACFzB,IAAM,YAAY;;;ACelB,IAAM,qBAAqB,CAAC,QAA0C;AAC3E,SAAO,OAAO,QAAQ,YAAY,QAAQ,QAAQ,UAAU,OAAO,OAAQ,KAAyB,SAAS;AAC/G;;;ACjBA,SAAS,cAAc;AAWhB,IAAM,QAAQ,CAAC,QAAuC;AAC3D,QAAM,SAAS,IAAI,OAAO;AAC1B,SAAO,IAAI,QAAa,CAAC,SAAS,WAAW;AAC3C,WAAO,YAAY,IAAI,MAAM,CAAC,KAAK,WAAW;AAC5C,UAAI,KAAK;AACP,eAAO,GAAG;AAAA,MACZ,OAAO;AACL,cAAM,MAAM,EAAE,QAAQ,WAAW,KAAK,OAAO;AAC7C,gBAAQ,GAAG;AAAA,MACb;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;;;ACvBO,IAAM,gCAAgC;;;AJctC,IAAM,oBAAN,cASG,gBAAgD;AAAA,EAKxD,MAAyB,cAAc,WAAkB,CAAC,GAAoB;AAC5E,UAAM,UAAU,MAAM,QAAQ,IAAI,SAAS,OAAO,kBAAkB,EAAE,IAAI,KAAK,CAAC;AAChF,WAAO;AAAA,EACT;AACF;AARE,cAVW,mBAUc,iBAA0B,CAAC,GAAG,iDAAM,kBAAe,6BAA6B;AACzG,cAXW,mBAWc,uBAA8B;AACvD,cAZW,mBAYK,gBAAe;AAZpB,oBAAN;AAAA,EADN,gBAAgB;AAAA,GACJ;;;AKZb;AAAA,EACE;AAAA,EAAuB;AAAA,EAA+B;AAAA,OACjD;AAmBA,IAAM,QAAQ,sBAA2B,SAAS;AAKlD,IAAM,mBAAmB,iCAAsC,SAAS;AAKxE,IAAM,gBAAgB,8BAAmC,SAAS;","names":[]}
1
+ {"version":3,"sources":["../../src/Diviner/Diviner.ts","../../src/Schema.ts","../../src/Diviner/lib/StringDataField.ts","../../src/Diviner/lib/toXml.ts","../../src/Diviner/Schema.ts","../../src/Payload.ts"],"sourcesContent":["import { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport { DivinerInstance, DivinerModuleEventData } from '@xyo-network/diviner-model'\nimport { creatableModule } from '@xyo-network/module-model'\nimport { Payload, Schema } from '@xyo-network/payload-model'\n\nimport { Xml } from '../Payload.ts'\nimport { XmlSchema } from '../Schema.ts'\nimport {\n hasStringDataField, StringDataField, toXml,\n} from './lib/index.ts'\nimport { XmlParsingDivinerParams } from './Params.ts'\nimport { XmlParsingDivinerConfigSchema } from './Schema.ts'\n\n@creatableModule()\nexport class XmlParsingDiviner<\n TParams extends XmlParsingDivinerParams = XmlParsingDivinerParams,\n TIn extends Payload<StringDataField> = Payload<StringDataField>,\n TOut extends Xml | Payload = Xml | Payload,\n TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n> extends AbstractDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, XmlParsingDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = XmlParsingDivinerConfigSchema\n static override targetSchema = XmlSchema\n\n protected override async divineHandler(payloads: TIn[] = []): Promise<TOut[]> {\n const results = await Promise.all(payloads.filter(hasStringDataField).map(toXml))\n return results as TOut[]\n }\n}\n","export const XmlSchema = 'network.xyo.xml'\nexport type XmlSchema = typeof XmlSchema\n","/**\n * Interface representing an object with a string data field\n */\nexport interface StringDataField {\n /**\n * The string data\n */\n data: string\n}\n\n/**\n * Identity for StringDataField\n * @param obj The input object\n * @returns True if the object is a StringDataField, false otherwise\n */\nexport const hasStringDataField = (obj?: unknown): obj is StringDataField => {\n return typeof obj === 'object' && obj !== null && 'data' in obj && typeof (obj as StringDataField)?.data === 'string'\n}\n","import { Parser } from 'xml2js'\n\nimport type { Xml } from '../../Payload.ts'\nimport { XmlSchema } from '../../Schema.ts'\nimport type { StringDataField } from './StringDataField.ts'\n\n/**\n * Takes a string data field containing xml and converts it to an XML object\n * @param obj The input object which contains the stringified xml data\n * @returns A promise that resolves to an XML payload\n */\nexport const toXml = (obj: StringDataField): Promise<Xml> => {\n const parser = new Parser()\n return new Promise<Xml>((resolve, reject) => {\n parser.parseString(obj.data, (err, result) => {\n if (err) {\n reject(err)\n } else {\n const xml = { schema: XmlSchema, xml: result } as const\n resolve(xml)\n }\n })\n })\n}\n","export const XmlParsingDivinerConfigSchema = 'network.xyo.diviner.xml.config' as const\nexport type XmlParsingDivinerConfigSchema = typeof XmlParsingDivinerConfigSchema\n","import type { JsonObject } from '@xylabs/object'\nimport type { Payload } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources } from '@xyo-network/payload-model'\n\nimport { XmlSchema } from './Schema.ts'\n\n/**\n * The fields of an Xml Payload\n */\nexport interface XmlFields {\n xml: JsonObject\n}\n\n/**\n * An Xml Payload\n */\nexport type Xml = Payload<XmlFields, XmlSchema>\n\n/**\n * Identity function for determine if an object is an Xml Payload\n */\nexport const isXml = isPayloadOfSchemaType<Xml>(XmlSchema)\n\n/**\n * Identity function for determine if an object is an Xml Payload with sources\n */\nexport const isXmlWithSources = isPayloadOfSchemaTypeWithSources<Xml>(XmlSchema)\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,uBAAuB;AAEhC,SAAS,uBAAuB;;;ACFzB,IAAM,YAAY;;;ACelB,IAAM,qBAAqB,CAAC,QAA0C;AAC3E,SAAO,OAAO,QAAQ,YAAY,QAAQ,QAAQ,UAAU,OAAO,OAAQ,KAAyB,SAAS;AAC/G;;;ACjBA,SAAS,cAAc;AAWhB,IAAM,QAAQ,CAAC,QAAuC;AAC3D,QAAM,SAAS,IAAI,OAAO;AAC1B,SAAO,IAAI,QAAa,CAAC,SAAS,WAAW;AAC3C,WAAO,YAAY,IAAI,MAAM,CAAC,KAAK,WAAW;AAC5C,UAAI,KAAK;AACP,eAAO,GAAG;AAAA,MACZ,OAAO;AACL,cAAM,MAAM,EAAE,QAAQ,WAAW,KAAK,OAAO;AAC7C,gBAAQ,GAAG;AAAA,MACb;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;;;ACvBO,IAAM,gCAAgC;;;AJctC,IAAM,oBAAN,cASG,gBAAgD;AAAA,EAKxD,MAAyB,cAAc,WAAkB,CAAC,GAAoB;AAC5E,UAAM,UAAU,MAAM,QAAQ,IAAI,SAAS,OAAO,kBAAkB,EAAE,IAAI,KAAK,CAAC;AAChF,WAAO;AAAA,EACT;AACF;AARE,cAVW,mBAUc,iBAA0B,CAAC,GAAG,iDAAM,kBAAe,6BAA6B;AACzG,cAXW,mBAWc,uBAA8B;AACvD,cAZW,mBAYK,gBAAe;AAZpB,oBAAN;AAAA,EADN,gBAAgB;AAAA,GACJ;;;AKZb,SAAS,uBAAuB,wCAAwC;AAmBjE,IAAM,QAAQ,sBAA2B,SAAS;AAKlD,IAAM,mBAAmB,iCAAsC,SAAS;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/xml-plugin",
3
- "version": "3.1.2",
3
+ "version": "3.2.0-rc.2",
4
4
  "description": "Typescript/Javascript Plugins for XYO Platform",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -29,24 +29,25 @@
29
29
  "module": "dist/neutral/index.mjs",
30
30
  "types": "dist/neutral/index.d.ts",
31
31
  "dependencies": {
32
- "@xylabs/object": "^4.4.9",
33
- "@xyo-network/diviner-abstract": "^3.5.1",
34
- "@xyo-network/diviner-model": "^3.5.1",
35
- "@xyo-network/module-model": "^3.5.1",
36
- "@xyo-network/payload-model": "^3.5.1",
32
+ "@xylabs/object": "^4.4.24",
33
+ "@xyo-network/diviner-abstract": "^3.6.0-rc.11",
34
+ "@xyo-network/diviner-model": "^3.6.0-rc.11",
35
+ "@xyo-network/module-model": "^3.6.0-rc.11",
36
+ "@xyo-network/payload-model": "^3.6.0-rc.11",
37
37
  "xml2js": "^0.6.2"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/xml2js": "^0.4.14",
41
- "@xylabs/assert": "^4.4.9",
42
- "@xylabs/ts-scripts-yarn3": "^4.2.4",
43
- "@xylabs/tsconfig": "^4.2.4",
44
- "@xylabs/vitest-extended": "^4.4.9",
45
- "@xyo-network/api-call-witness": "^3.1.2",
41
+ "@xylabs/assert": "^4.4.24",
42
+ "@xylabs/ts-scripts-yarn3": "^4.2.6",
43
+ "@xylabs/tsconfig": "^4.2.6",
44
+ "@xylabs/vitest-extended": "^4.4.24",
45
+ "@xyo-network/api-call-witness": "^3.2.0-rc.2",
46
46
  "typescript": "^5.7.2",
47
- "vitest": "^2.1.6"
47
+ "vitest": "^2.1.8"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"
51
- }
51
+ },
52
+ "stableVersion": "3.1.2"
52
53
  }
package/src/Payload.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  import type { JsonObject } from '@xylabs/object'
2
2
  import type { Payload } from '@xyo-network/payload-model'
3
- import {
4
- isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources,
5
- } from '@xyo-network/payload-model'
3
+ import { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources } from '@xyo-network/payload-model'
6
4
 
7
5
  import { XmlSchema } from './Schema.ts'
8
6
 
@@ -27,8 +25,3 @@ export const isXml = isPayloadOfSchemaType<Xml>(XmlSchema)
27
25
  * Identity function for determine if an object is an Xml Payload with sources
28
26
  */
29
27
  export const isXmlWithSources = isPayloadOfSchemaTypeWithSources<Xml>(XmlSchema)
30
-
31
- /**
32
- * Identity function for determine if an object is an Xml Payload with meta
33
- */
34
- export const isXmlWithMeta = isPayloadOfSchemaTypeWithMeta<Xml>(XmlSchema)
package/xy.config.ts CHANGED
@@ -7,5 +7,4 @@ const config: XyTsupConfig = {
7
7
  },
8
8
  }
9
9
 
10
- // eslint-disable-next-line import-x/no-default-export
11
10
  export default config