@xyo-network/xl1-schema 1.7.17 → 1.7.18

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,7 @@
1
+ import { z } from 'zod';
2
+ declare const JsonValueSchema: z.ZodType<unknown>;
3
+ export declare const JsonObjectSchema: z.ZodRecord<z.ZodString, z.ZodType<unknown, z.ZodTypeDef, unknown>>;
4
+ export type JsonValue = z.infer<typeof JsonValueSchema>;
5
+ export type JsonObject = z.infer<typeof JsonObjectSchema>;
6
+ export {};
7
+ //# sourceMappingURL=JsonSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonSchema.d.ts","sourceRoot":"","sources":["../../src/JsonSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,QAAA,MAAM,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAQnC,CAAA;AAGL,eAAO,MAAM,gBAAgB,qEAA4B,CAAA;AAGzD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AACvD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json.schemastore.org/package.json",
3
3
  "name": "@xyo-network/xl1-schema",
4
- "version": "1.7.17",
4
+ "version": "1.7.18",
5
5
  "description": "XYO Layer One SDK Schema",
6
6
  "homepage": "https://xylabs.com",
7
7
  "bugs": {
@@ -36,23 +36,25 @@
36
36
  "src"
37
37
  ],
38
38
  "dependencies": {
39
- "@xyo-network/boundwitness-model": "^4.1.7",
40
- "@xyo-network/boundwitness-wrapper": "^4.1.7",
41
- "@xyo-network/payload-builder": "^4.1.7",
42
- "@xyo-network/payload-model": "^4.1.7",
43
- "@xyo-network/payload-wrapper": "^4.1.7",
44
- "@xyo-network/schema-payload-plugin": "^4.1.7",
45
- "@xyo-network/xl1-protocol": "^1.7.20",
46
- "ajv": "^8.17.1"
39
+ "@xyo-network/boundwitness-model": "~4.1.7",
40
+ "@xyo-network/boundwitness-wrapper": "~4.1.7",
41
+ "@xyo-network/payload-builder": "~4.1.7",
42
+ "@xyo-network/payload-model": "~4.1.7",
43
+ "@xyo-network/payload-wrapper": "~4.1.7",
44
+ "@xyo-network/schema-payload-plugin": "~4.1.7",
45
+ "@xyo-network/xl1-protocol": "~1.7.20",
46
+ "zod": "~3.25.76",
47
+ "zod-to-json-schema": "~3.24.6"
47
48
  },
48
49
  "devDependencies": {
49
- "@types/node": "^24.1.0",
50
- "@xylabs/ts-scripts-yarn3": "^7.0.1",
51
- "@xylabs/tsconfig": "^7.0.1",
52
- "@xyo-network/account": "^4.1.7",
53
- "knip": "^5.62.0",
54
- "typescript": "^5.8.3",
55
- "vitest": "^3.2.4"
50
+ "@types/node": "~24.1.0",
51
+ "@xylabs/ts-scripts-yarn3": "~7.0.1",
52
+ "@xylabs/tsconfig": "~7.0.1",
53
+ "@xyo-network/account": "~4.1.7",
54
+ "ajv": "~8.17.1",
55
+ "knip": "~5.62.0",
56
+ "typescript": "~5.8.3",
57
+ "vitest": "~3.2.4"
56
58
  },
57
59
  "engines": {
58
60
  "node": ">=22.3 <23"
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod'
2
+
3
+ // Define recursive JSON value schema
4
+ const JsonValueSchema: z.ZodType<unknown> = z.lazy(() =>
5
+ z.union([
6
+ z.string(),
7
+ z.number(),
8
+ z.boolean(),
9
+ z.null(),
10
+ z.array(JsonValueSchema),
11
+ z.record(JsonValueSchema), // object with string keys and JSON values
12
+ ]))
13
+
14
+ // JSON object schema — top-level must be an object
15
+ export const JsonObjectSchema = z.record(JsonValueSchema)
16
+
17
+ // TypeScript type for reference
18
+ export type JsonValue = z.infer<typeof JsonValueSchema>
19
+ export type JsonObject = z.infer<typeof JsonObjectSchema>