@xyo-network/schema-payload-plugin 3.1.8 → 3.1.10

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.
@@ -1,5 +1,5 @@
1
- import type { Payload } from '@xyo-network/payload-model';
2
- import type { SchemaSchema } from './Schema.ts';
1
+ import { type Payload } from '@xyo-network/payload-model';
2
+ import { SchemaSchema } from './Schema.ts';
3
3
  export type SchemaPayload = Payload<{
4
4
  definition: {
5
5
  [key: string]: unknown;
@@ -9,4 +9,31 @@ export type SchemaPayload = Payload<{
9
9
  name?: string;
10
10
  schema: SchemaSchema;
11
11
  }>;
12
+ export declare const isSchemaPayload: (x?: unknown | null) => x is import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
13
+ definition: {
14
+ [key: string]: unknown;
15
+ $id?: string;
16
+ };
17
+ extends?: string;
18
+ name?: string;
19
+ schema: SchemaSchema;
20
+ };
21
+ export declare const isSchemaPayloadWithSources: (x?: unknown | null) => x is import("@xyo-network/payload-model").WithSources<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
22
+ definition: {
23
+ [key: string]: unknown;
24
+ $id?: string;
25
+ };
26
+ extends?: string;
27
+ name?: string;
28
+ schema: SchemaSchema;
29
+ }>;
30
+ export declare const isSchemaPayloadWithMeta: (x?: unknown | null) => x is import("@xyo-network/payload-model").WithMeta<import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
31
+ definition: {
32
+ [key: string]: unknown;
33
+ $id?: string;
34
+ };
35
+ extends?: string;
36
+ name?: string;
37
+ schema: SchemaSchema;
38
+ }>;
12
39
  //# 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,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,OAAO,KAAK,EAAE,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IS,MAAM;WAGT,MAAM;YAKL,YAAY;EAgB2E,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1C,eAAO,MAAM,mBAAmB;;;WAFI,CAAC;;;;;EAMjC,CAAA"}
1
+ {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1C,eAAO,MAAM,mBAAmB;;;WAG5B,CAAH;;;;;EACG,CAAA"}
@@ -1,9 +1,21 @@
1
- // src/Plugin.ts
2
- import { createPayloadPlugin } from "@xyo-network/payload-plugin";
1
+ // src/Payload.ts
2
+ import {
3
+ isPayloadOfSchemaType,
4
+ isPayloadOfSchemaTypeWithMeta,
5
+ isPayloadOfSchemaTypeWithSources
6
+ } from "@xyo-network/payload-model";
3
7
 
4
8
  // src/Schema.ts
5
9
  var SchemaSchema = "network.xyo.schema";
6
10
 
11
+ // src/Payload.ts
12
+ var isSchemaPayload = isPayloadOfSchemaType(SchemaSchema);
13
+ var isSchemaPayloadWithSources = isPayloadOfSchemaTypeWithSources(SchemaSchema);
14
+ var isSchemaPayloadWithMeta = isPayloadOfSchemaTypeWithMeta(SchemaSchema);
15
+
16
+ // src/Plugin.ts
17
+ import { createPayloadPlugin } from "@xyo-network/payload-plugin";
18
+
7
19
  // src/Template.ts
8
20
  var schemaPayloadTemplate = () => ({
9
21
  definition: {
@@ -22,6 +34,9 @@ export {
22
34
  SchemaPayloadPlugin,
23
35
  SchemaSchema,
24
36
  SchemaPayloadPlugin as default,
37
+ isSchemaPayload,
38
+ isSchemaPayloadWithMeta,
39
+ isSchemaPayloadWithSources,
25
40
  schemaPayloadTemplate
26
41
  };
27
42
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Plugin.ts","../../src/Schema.ts","../../src/Template.ts"],"sourcesContent":["import { createPayloadPlugin } from '@xyo-network/payload-plugin'\n\nimport type { SchemaPayload } from './Payload.ts'\nimport { SchemaSchema } from './Schema.ts'\nimport { schemaPayloadTemplate } from './Template.ts'\n\nexport const SchemaPayloadPlugin = () =>\n createPayloadPlugin<SchemaPayload>({\n schema: SchemaSchema,\n template: schemaPayloadTemplate,\n })\n","export type SchemaSchema = 'network.xyo.schema'\nexport const SchemaSchema: SchemaSchema = 'network.xyo.schema'\n","import type { SchemaPayload } from './Payload.ts'\nimport { SchemaSchema } from './Schema.ts'\nexport const schemaPayloadTemplate = (): SchemaPayload => ({\n definition: {\n $id: '',\n $schema: 'http://json-schema.org/draft-07/schema#',\n },\n schema: SchemaSchema,\n})\n"],"mappings":";AAAA,SAAS,2BAA2B;;;ACC7B,IAAM,eAA6B;;;ACCnC,IAAM,wBAAwB,OAAsB;AAAA,EACzD,YAAY;AAAA,IACV,KAAK;AAAA,IACL,SAAS;AAAA,EACX;AAAA,EACA,QAAQ;AACV;;;AFFO,IAAM,sBAAsB,MACjC,oBAAmC;AAAA,EACjC,QAAQ;AAAA,EACR,UAAU;AACZ,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../src/Payload.ts","../../src/Schema.ts","../../src/Plugin.ts","../../src/Template.ts"],"sourcesContent":["import {\n isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources, type Payload,\n} from '@xyo-network/payload-model'\n\nimport { SchemaSchema } from './Schema.ts'\n\nexport type SchemaPayload = Payload<{\n /**\n * The schema definition\n */\n definition: {\n [key: string]: unknown\n $id?: string\n }\n /**\n * The schema this schema extends (if any)\n */\n extends?: string\n\n /** @deprecated use definition.$id instead */\n name?: string\n\n /**\n * Identifies this payload as a Schema\n */\n schema: SchemaSchema\n}>\n\n/**\n * Identity function for determining if an object is an Schema\n */\nexport const isSchemaPayload = isPayloadOfSchemaType<SchemaPayload>(SchemaSchema)\n\n/**\n * Identity function for determining if an object is an Schema with sources\n */\nexport const isSchemaPayloadWithSources = isPayloadOfSchemaTypeWithSources<SchemaPayload>(SchemaSchema)\n\n/**\n * Identity function for determining if an object is an Schema with meta\n */\nexport const isSchemaPayloadWithMeta = isPayloadOfSchemaTypeWithMeta<SchemaPayload>(SchemaSchema)\n","export type SchemaSchema = 'network.xyo.schema'\nexport const SchemaSchema: SchemaSchema = 'network.xyo.schema'\n","import { createPayloadPlugin } from '@xyo-network/payload-plugin'\n\nimport type { SchemaPayload } from './Payload.ts'\nimport { SchemaSchema } from './Schema.ts'\nimport { schemaPayloadTemplate } from './Template.ts'\n\nexport const SchemaPayloadPlugin = () =>\n createPayloadPlugin<SchemaPayload>({\n schema: SchemaSchema,\n template: schemaPayloadTemplate,\n })\n","import type { SchemaPayload } from './Payload.ts'\nimport { SchemaSchema } from './Schema.ts'\nexport const schemaPayloadTemplate = (): SchemaPayload => ({\n definition: {\n $id: '',\n $schema: 'http://json-schema.org/draft-07/schema#',\n },\n schema: SchemaSchema,\n})\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EAAuB;AAAA,EAA+B;AAAA,OACjD;;;ACDA,IAAM,eAA6B;;;AD8BnC,IAAM,kBAAkB,sBAAqC,YAAY;AAKzE,IAAM,6BAA6B,iCAAgD,YAAY;AAK/F,IAAM,0BAA0B,8BAA6C,YAAY;;;AEzChG,SAAS,2BAA2B;;;ACE7B,IAAM,wBAAwB,OAAsB;AAAA,EACzD,YAAY;AAAA,IACV,KAAK;AAAA,IACL,SAAS;AAAA,EACX;AAAA,EACA,QAAQ;AACV;;;ADFO,IAAM,sBAAsB,MACjC,oBAAmC;AAAA,EACjC,QAAQ;AAAA,EACR,UAAU;AACZ,CAAC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/schema-payload-plugin",
3
- "version": "3.1.8",
3
+ "version": "3.1.10",
4
4
  "description": "Typescript/Javascript Plugins for XYO Platform",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -29,8 +29,8 @@
29
29
  "module": "dist/neutral/index.mjs",
30
30
  "types": "dist/neutral/index.d.ts",
31
31
  "dependencies": {
32
- "@xyo-network/payload-model": "^3.1.8",
33
- "@xyo-network/payload-plugin": "^3.1.8"
32
+ "@xyo-network/payload-model": "^3.1.10",
33
+ "@xyo-network/payload-plugin": "^3.1.10"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@xylabs/ts-scripts-yarn3": "^4.0.7",
package/src/Payload.ts CHANGED
@@ -1,15 +1,42 @@
1
- import type { Payload } from '@xyo-network/payload-model'
1
+ import {
2
+ isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources, type Payload,
3
+ } from '@xyo-network/payload-model'
2
4
 
3
- import type { SchemaSchema } from './Schema.ts'
5
+ import { SchemaSchema } from './Schema.ts'
4
6
 
5
7
  export type SchemaPayload = Payload<{
8
+ /**
9
+ * The schema definition
10
+ */
6
11
  definition: {
7
12
  [key: string]: unknown
8
13
  $id?: string
9
14
  }
15
+ /**
16
+ * The schema this schema extends (if any)
17
+ */
10
18
  extends?: string
19
+
11
20
  /** @deprecated use definition.$id instead */
12
21
  name?: string
13
22
 
23
+ /**
24
+ * Identifies this payload as a Schema
25
+ */
14
26
  schema: SchemaSchema
15
27
  }>
28
+
29
+ /**
30
+ * Identity function for determining if an object is an Schema
31
+ */
32
+ export const isSchemaPayload = isPayloadOfSchemaType<SchemaPayload>(SchemaSchema)
33
+
34
+ /**
35
+ * Identity function for determining if an object is an Schema with sources
36
+ */
37
+ export const isSchemaPayloadWithSources = isPayloadOfSchemaTypeWithSources<SchemaPayload>(SchemaSchema)
38
+
39
+ /**
40
+ * Identity function for determining if an object is an Schema with meta
41
+ */
42
+ export const isSchemaPayloadWithMeta = isPayloadOfSchemaTypeWithMeta<SchemaPayload>(SchemaSchema)