@stryke/json 0.12.0 → 0.13.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  # Changelog for Stryke - JSON
4
4
 
5
+ ## [0.12.0](https://github.com/storm-software/stryke/releases/tag/json%400.12.0) (03/03/2026)
6
+
7
+ ### Features
8
+
9
+ - **json:** Added `isJsonSchema7BooleanType` type-check function ([9ad702e0](https://github.com/storm-software/stryke/commit/9ad702e0))
10
+ - **json:** Added additional fields to schema type checks ([4f49866a](https://github.com/storm-software/stryke/commit/4f49866a))
11
+ - **json:** Added the `canonicalJson` helper function ([8d21e027](https://github.com/storm-software/stryke/commit/8d21e027))
12
+
13
+ ### Updated Dependencies
14
+
15
+ - Updated **type-checks** to **v0.5.29**
16
+ - Updated **types** to **v0.10.43**
17
+
5
18
  ## [0.11.0](https://github.com/storm-software/stryke/releases/tag/json%400.11.0) (03/02/2026)
6
19
 
7
20
  ### Features
package/dist/index.cjs CHANGED
@@ -3,7 +3,7 @@ const require_canonical = require('./canonical-hMXtzPIV.cjs');
3
3
  const require_find_reference = require('./find-reference-Ct8UDBo2.cjs');
4
4
  const require_parse = require('./parse-BSmqrTy_.cjs');
5
5
  require('./pointer-Cvmor4sN.cjs');
6
- const require_schema = require('./schema-BM7g4xZ3.cjs');
6
+ const require_schema = require('./schema-CwyRhvHe.cjs');
7
7
  const require_strip_comments = require('./strip-comments-CPoO4Wj2.cjs');
8
8
  const require_parse$1 = require('./parse-CX9jPskm.cjs');
9
9
  const require_code_frames = require('./code-frames-ChE4PPdh.cjs');
@@ -31,6 +31,7 @@ exports.isJsonSchema7NumberType = require_schema.isJsonSchema7NumberType;
31
31
  exports.isJsonSchema7ObjectType = require_schema.isJsonSchema7ObjectType;
32
32
  exports.isJsonSchema7PrimitiveLiteralType = require_schema.isJsonSchema7PrimitiveLiteralType;
33
33
  exports.isJsonSchema7StringType = require_schema.isJsonSchema7StringType;
34
+ exports.isJsonSchema7TupleType = require_schema.isJsonSchema7TupleType;
34
35
  exports.isObjectReference = require_find_reference.isObjectReference;
35
36
  exports.isRoot = require_parse.isRoot;
36
37
  exports.isStandardJsonSchema = require_schema.isStandardJsonSchema;
package/dist/index.d.cts CHANGED
@@ -2,11 +2,11 @@ import { t as canonicalJson } from "./canonical-3PQxSh5G.cjs";
2
2
  import { a as isArrayEnd, i as find, n as ObjectReference, o as isArrayReference, r as Reference, s as isObjectReference, t as ArrayReference } from "./find-reference-BuuNqqOh.cjs";
3
3
  import { a as isValidIndex, c as unescapePointerSegment, i as isRoot, n as formatJsonPointer, o as parent, r as isInteger, s as parseJsonPointer, t as escapePointerSegment } from "./parse-DCHSu_0u.cjs";
4
4
  import { $ as TypeAnnotation, A as JsonSchema7PrimitiveLiteralType, B as JsonSchema7UndefinedType, C as JsonSchema7NativeEnumType, D as JsonSchema7NumberType, E as JsonSchema7NullableType, F as JsonSchema7SetType, G as Leaf, H as JsonSchema7UnknownType, I as JsonSchema7StringType, J as PrimitiveTypeAnnotation, K as LeafTypeAnnotation, L as JsonSchema7TupleType, M as JsonSchema7RecordPropertyNamesType, N as JsonSchema7RecordType, O as JsonSchema7ObjectType, P as JsonSchema7RefType, Q as Tree, R as JsonSchema7Type, S as JsonSchema7Meta, T as JsonSchema7NullType, U as JsonSerializeOptions, V as JsonSchema7UnionType, W as JsonValue, X as SimpleTypeAnnotation, Y as SerializableJsonValue, Z as SymbolTypeAnnotation, _ as JsonSchema7BooleanType, a as CustomTypeAnnotation, b as JsonSchema7LiteralType, c as JsonObject, d as JsonParserResult, et as TypedArrayAnnotation, f as JsonSchema7AllOfType, g as JsonSchema7BigintType, h as JsonSchema7ArrayType, i as CompositeTypeAnnotation, j as JsonSchema7PrimitiveUnionType, k as JsonSchema7Primitive, l as JsonParseOptions, m as JsonSchema7AnyType, n as ClassInstance, o as InnerNode, p as JsonSchema7AnyOfType, q as PrimitiveJsonValue, r as ClassTypeAnnotation, s as JsonArray, t as Class, u as JsonParserInterface, v as JsonSchema7DateType, w as JsonSchema7NeverType, x as JsonSchema7MapType, y as JsonSchema7EnumType, z as JsonSchema7TypeUnion } from "./types-BzNIRhpI.cjs";
5
- import { a as isJsonSchema7NumberType, c as isJsonSchema7StringType, i as isJsonSchema7LiteralType, l as isStandardJsonSchema, n as isJsonSchema7ArrayType, o as isJsonSchema7ObjectType, r as isJsonSchema7BooleanType, s as isJsonSchema7PrimitiveLiteralType, t as isJsonSchema7AllOfType } from "./schema-BgOm_N0w.cjs";
5
+ import { a as isJsonSchema7NumberType, c as isJsonSchema7StringType, i as isJsonSchema7LiteralType, l as isJsonSchema7TupleType, n as isJsonSchema7ArrayType, o as isJsonSchema7ObjectType, r as isJsonSchema7BooleanType, s as isJsonSchema7PrimitiveLiteralType, t as isJsonSchema7AllOfType, u as isStandardJsonSchema } from "./schema-CuBX00tF.cjs";
6
6
  import { t as StormJSON } from "./storm-json-DiBg5b6r.cjs";
7
7
  import { t as codeFrameColumns } from "./code-frames-ClyQ9O1l.cjs";
8
8
  import { n as parse, r as safeParse, t as Options } from "./parse-ygKFNauQ.cjs";
9
9
  import { t as formatParseError } from "./parse-error-CGKcBkMJ.cjs";
10
10
  import { n as stringify, t as invalidKeyChars } from "./stringify-mAxwby9q.cjs";
11
11
  import { t as stripComments } from "./strip-comments-AOXnoydB.cjs";
12
- export { ArrayReference, Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSchema7AllOfType, JsonSchema7AnyOfType, JsonSchema7AnyType, JsonSchema7ArrayType, JsonSchema7BigintType, JsonSchema7BooleanType, JsonSchema7DateType, JsonSchema7EnumType, JsonSchema7LiteralType, JsonSchema7MapType, JsonSchema7Meta, JsonSchema7NativeEnumType, JsonSchema7NeverType, JsonSchema7NullType, JsonSchema7NullableType, JsonSchema7NumberType, JsonSchema7ObjectType, JsonSchema7Primitive, JsonSchema7PrimitiveLiteralType, JsonSchema7PrimitiveUnionType, JsonSchema7RecordPropertyNamesType, JsonSchema7RecordType, JsonSchema7RefType, JsonSchema7SetType, JsonSchema7StringType, JsonSchema7TupleType, JsonSchema7Type, JsonSchema7TypeUnion, JsonSchema7UndefinedType, JsonSchema7UnionType, JsonSchema7UnknownType, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, ObjectReference, Options, PrimitiveJsonValue, PrimitiveTypeAnnotation, Reference, SerializableJsonValue, SimpleTypeAnnotation, StormJSON, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation, canonicalJson, codeFrameColumns, escapePointerSegment, find, formatJsonPointer, formatParseError, invalidKeyChars, isArrayEnd, isArrayReference, isInteger, isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7BooleanType, isJsonSchema7LiteralType, isJsonSchema7NumberType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isJsonSchema7StringType, isObjectReference, isRoot, isStandardJsonSchema, isValidIndex, parent, parse, parseJsonPointer, safeParse, stringify, stripComments, unescapePointerSegment };
12
+ export { ArrayReference, Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSchema7AllOfType, JsonSchema7AnyOfType, JsonSchema7AnyType, JsonSchema7ArrayType, JsonSchema7BigintType, JsonSchema7BooleanType, JsonSchema7DateType, JsonSchema7EnumType, JsonSchema7LiteralType, JsonSchema7MapType, JsonSchema7Meta, JsonSchema7NativeEnumType, JsonSchema7NeverType, JsonSchema7NullType, JsonSchema7NullableType, JsonSchema7NumberType, JsonSchema7ObjectType, JsonSchema7Primitive, JsonSchema7PrimitiveLiteralType, JsonSchema7PrimitiveUnionType, JsonSchema7RecordPropertyNamesType, JsonSchema7RecordType, JsonSchema7RefType, JsonSchema7SetType, JsonSchema7StringType, JsonSchema7TupleType, JsonSchema7Type, JsonSchema7TypeUnion, JsonSchema7UndefinedType, JsonSchema7UnionType, JsonSchema7UnknownType, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, ObjectReference, Options, PrimitiveJsonValue, PrimitiveTypeAnnotation, Reference, SerializableJsonValue, SimpleTypeAnnotation, StormJSON, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation, canonicalJson, codeFrameColumns, escapePointerSegment, find, formatJsonPointer, formatParseError, invalidKeyChars, isArrayEnd, isArrayReference, isInteger, isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7BooleanType, isJsonSchema7LiteralType, isJsonSchema7NumberType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isJsonSchema7StringType, isJsonSchema7TupleType, isObjectReference, isRoot, isStandardJsonSchema, isValidIndex, parent, parse, parseJsonPointer, safeParse, stringify, stripComments, unescapePointerSegment };
package/dist/index.d.mts CHANGED
@@ -2,7 +2,7 @@ import { t as canonicalJson } from "./canonical-DZDrZ9dv.mjs";
2
2
  import { a as isArrayEnd, i as find, n as ObjectReference, o as isArrayReference, r as Reference, s as isObjectReference, t as ArrayReference } from "./find-reference-MHRH7HJ_.mjs";
3
3
  import { a as isValidIndex, c as unescapePointerSegment, i as isRoot, n as formatJsonPointer, o as parent, r as isInteger, s as parseJsonPointer, t as escapePointerSegment } from "./parse-DaiwKCLz.mjs";
4
4
  import { $ as TypeAnnotation, A as JsonSchema7PrimitiveLiteralType, B as JsonSchema7UndefinedType, C as JsonSchema7NativeEnumType, D as JsonSchema7NumberType, E as JsonSchema7NullableType, F as JsonSchema7SetType, G as Leaf, H as JsonSchema7UnknownType, I as JsonSchema7StringType, J as PrimitiveTypeAnnotation, K as LeafTypeAnnotation, L as JsonSchema7TupleType, M as JsonSchema7RecordPropertyNamesType, N as JsonSchema7RecordType, O as JsonSchema7ObjectType, P as JsonSchema7RefType, Q as Tree, R as JsonSchema7Type, S as JsonSchema7Meta, T as JsonSchema7NullType, U as JsonSerializeOptions, V as JsonSchema7UnionType, W as JsonValue, X as SimpleTypeAnnotation, Y as SerializableJsonValue, Z as SymbolTypeAnnotation, _ as JsonSchema7BooleanType, a as CustomTypeAnnotation, b as JsonSchema7LiteralType, c as JsonObject, d as JsonParserResult, et as TypedArrayAnnotation, f as JsonSchema7AllOfType, g as JsonSchema7BigintType, h as JsonSchema7ArrayType, i as CompositeTypeAnnotation, j as JsonSchema7PrimitiveUnionType, k as JsonSchema7Primitive, l as JsonParseOptions, m as JsonSchema7AnyType, n as ClassInstance, o as InnerNode, p as JsonSchema7AnyOfType, q as PrimitiveJsonValue, r as ClassTypeAnnotation, s as JsonArray, t as Class, u as JsonParserInterface, v as JsonSchema7DateType, w as JsonSchema7NeverType, x as JsonSchema7MapType, y as JsonSchema7EnumType, z as JsonSchema7TypeUnion } from "./types-BAtAPir9.mjs";
5
- import { a as isJsonSchema7NumberType, c as isJsonSchema7StringType, i as isJsonSchema7LiteralType, l as isStandardJsonSchema, n as isJsonSchema7ArrayType, o as isJsonSchema7ObjectType, r as isJsonSchema7BooleanType, s as isJsonSchema7PrimitiveLiteralType, t as isJsonSchema7AllOfType } from "./schema-B7wpjw3I.mjs";
5
+ import { a as isJsonSchema7NumberType, c as isJsonSchema7StringType, i as isJsonSchema7LiteralType, l as isJsonSchema7TupleType, n as isJsonSchema7ArrayType, o as isJsonSchema7ObjectType, r as isJsonSchema7BooleanType, s as isJsonSchema7PrimitiveLiteralType, t as isJsonSchema7AllOfType, u as isStandardJsonSchema } from "./schema-D5wPTiM4.mjs";
6
6
  import { t as StormJSON } from "./storm-json-DJwb3Ou-.mjs";
7
7
  import { t as codeFrameColumns } from "./code-frames-BOS_tt9F.mjs";
8
8
  import { n as parse, r as safeParse, t as Options } from "./parse-XXQfTfNE.mjs";
@@ -10,4 +10,4 @@ import { t as formatParseError } from "./parse-error-CDt01Gvc.mjs";
10
10
  import { n as stringify, t as invalidKeyChars } from "./stringify-DtMcg2Wy.mjs";
11
11
  import { t as stripComments } from "./strip-comments-BNN6Uf4e.mjs";
12
12
  import "./index-e6k85DKM.mjs";
13
- export { ArrayReference, Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSchema7AllOfType, JsonSchema7AnyOfType, JsonSchema7AnyType, JsonSchema7ArrayType, JsonSchema7BigintType, JsonSchema7BooleanType, JsonSchema7DateType, JsonSchema7EnumType, JsonSchema7LiteralType, JsonSchema7MapType, JsonSchema7Meta, JsonSchema7NativeEnumType, JsonSchema7NeverType, JsonSchema7NullType, JsonSchema7NullableType, JsonSchema7NumberType, JsonSchema7ObjectType, JsonSchema7Primitive, JsonSchema7PrimitiveLiteralType, JsonSchema7PrimitiveUnionType, JsonSchema7RecordPropertyNamesType, JsonSchema7RecordType, JsonSchema7RefType, JsonSchema7SetType, JsonSchema7StringType, JsonSchema7TupleType, JsonSchema7Type, JsonSchema7TypeUnion, JsonSchema7UndefinedType, JsonSchema7UnionType, JsonSchema7UnknownType, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, ObjectReference, Options, PrimitiveJsonValue, PrimitiveTypeAnnotation, Reference, SerializableJsonValue, SimpleTypeAnnotation, StormJSON, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation, canonicalJson, codeFrameColumns, escapePointerSegment, find, formatJsonPointer, formatParseError, invalidKeyChars, isArrayEnd, isArrayReference, isInteger, isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7BooleanType, isJsonSchema7LiteralType, isJsonSchema7NumberType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isJsonSchema7StringType, isObjectReference, isRoot, isStandardJsonSchema, isValidIndex, parent, parse, parseJsonPointer, safeParse, stringify, stripComments, unescapePointerSegment };
13
+ export { ArrayReference, Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSchema7AllOfType, JsonSchema7AnyOfType, JsonSchema7AnyType, JsonSchema7ArrayType, JsonSchema7BigintType, JsonSchema7BooleanType, JsonSchema7DateType, JsonSchema7EnumType, JsonSchema7LiteralType, JsonSchema7MapType, JsonSchema7Meta, JsonSchema7NativeEnumType, JsonSchema7NeverType, JsonSchema7NullType, JsonSchema7NullableType, JsonSchema7NumberType, JsonSchema7ObjectType, JsonSchema7Primitive, JsonSchema7PrimitiveLiteralType, JsonSchema7PrimitiveUnionType, JsonSchema7RecordPropertyNamesType, JsonSchema7RecordType, JsonSchema7RefType, JsonSchema7SetType, JsonSchema7StringType, JsonSchema7TupleType, JsonSchema7Type, JsonSchema7TypeUnion, JsonSchema7UndefinedType, JsonSchema7UnionType, JsonSchema7UnknownType, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, ObjectReference, Options, PrimitiveJsonValue, PrimitiveTypeAnnotation, Reference, SerializableJsonValue, SimpleTypeAnnotation, StormJSON, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation, canonicalJson, codeFrameColumns, escapePointerSegment, find, formatJsonPointer, formatParseError, invalidKeyChars, isArrayEnd, isArrayReference, isInteger, isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7BooleanType, isJsonSchema7LiteralType, isJsonSchema7NumberType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isJsonSchema7StringType, isJsonSchema7TupleType, isObjectReference, isRoot, isStandardJsonSchema, isValidIndex, parent, parse, parseJsonPointer, safeParse, stringify, stripComments, unescapePointerSegment };
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import { t as canonicalJson } from "./canonical-CVbmCnGM.mjs";
2
2
  import { i as isObjectReference, n as isArrayEnd, r as isArrayReference, t as find } from "./find-reference-kPgdulJ1.mjs";
3
3
  import { a as isValidIndex, c as unescapePointerSegment, i as isRoot, n as formatJsonPointer, o as parent, r as isInteger, s as parseJsonPointer, t as escapePointerSegment } from "./parse-B3NfTO06.mjs";
4
4
  import "./pointer-DScQSL_a.mjs";
5
- import { a as isJsonSchema7NumberType, c as isJsonSchema7StringType, i as isJsonSchema7LiteralType, l as isStandardJsonSchema, n as isJsonSchema7ArrayType, o as isJsonSchema7ObjectType, r as isJsonSchema7BooleanType, s as isJsonSchema7PrimitiveLiteralType, t as isJsonSchema7AllOfType } from "./schema-SrJmxZsC.mjs";
5
+ import { a as isJsonSchema7NumberType, c as isJsonSchema7StringType, i as isJsonSchema7LiteralType, l as isJsonSchema7TupleType, n as isJsonSchema7ArrayType, o as isJsonSchema7ObjectType, r as isJsonSchema7BooleanType, s as isJsonSchema7PrimitiveLiteralType, t as isJsonSchema7AllOfType, u as isStandardJsonSchema } from "./schema-CMt54x11.mjs";
6
6
  import { t as stripComments } from "./strip-comments-DNTu6CWM.mjs";
7
7
  import { n as safeParse, t as parse } from "./parse-BrChHTWb.mjs";
8
8
  import { t as codeFrameColumns } from "./code-frames-C8DEdLmV.mjs";
@@ -12,4 +12,4 @@ import { t as StormJSON } from "./storm-json-BmO91crX.mjs";
12
12
  import "./types.mjs";
13
13
  import "./utils-mO6p60ai.mjs";
14
14
 
15
- export { StormJSON, canonicalJson, codeFrameColumns, escapePointerSegment, find, formatJsonPointer, formatParseError, invalidKeyChars, isArrayEnd, isArrayReference, isInteger, isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7BooleanType, isJsonSchema7LiteralType, isJsonSchema7NumberType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isJsonSchema7StringType, isObjectReference, isRoot, isStandardJsonSchema, isValidIndex, parent, parse, parseJsonPointer, safeParse, stringify, stripComments, unescapePointerSegment };
15
+ export { StormJSON, canonicalJson, codeFrameColumns, escapePointerSegment, find, formatJsonPointer, formatParseError, invalidKeyChars, isArrayEnd, isArrayReference, isInteger, isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7BooleanType, isJsonSchema7LiteralType, isJsonSchema7NumberType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isJsonSchema7StringType, isJsonSchema7TupleType, isObjectReference, isRoot, isStandardJsonSchema, isValidIndex, parent, parse, parseJsonPointer, safeParse, stringify, stripComments, unescapePointerSegment };
@@ -58,6 +58,15 @@ function isJsonSchema7ArrayType(schema) {
58
58
  return "type" in schema && schema.type === "array" && "items" in schema;
59
59
  }
60
60
  /**
61
+ * Type guard for {@link JsonSchema7TupleType}
62
+ *
63
+ * @param schema - The schema to check
64
+ * @returns True if the schema is a {@link JsonSchema7TupleType}, false otherwise
65
+ */
66
+ function isJsonSchema7TupleType(schema) {
67
+ return "type" in schema && schema.type === "array" && "items" in schema && Array.isArray(schema.items);
68
+ }
69
+ /**
61
70
  * Type guard for {@link JsonSchema7PrimitiveLiteralType}
62
71
  *
63
72
  * @param schema - The schema to check
@@ -95,5 +104,5 @@ function isStandardJsonSchema(value) {
95
104
  }
96
105
 
97
106
  //#endregion
98
- export { isJsonSchema7NumberType as a, isJsonSchema7StringType as c, isJsonSchema7LiteralType as i, isStandardJsonSchema as l, isJsonSchema7ArrayType as n, isJsonSchema7ObjectType as o, isJsonSchema7BooleanType as r, isJsonSchema7PrimitiveLiteralType as s, isJsonSchema7AllOfType as t };
99
- //# sourceMappingURL=schema-SrJmxZsC.mjs.map
107
+ export { isJsonSchema7NumberType as a, isJsonSchema7StringType as c, isJsonSchema7LiteralType as i, isJsonSchema7TupleType as l, isJsonSchema7ArrayType as n, isJsonSchema7ObjectType as o, isJsonSchema7BooleanType as r, isJsonSchema7PrimitiveLiteralType as s, isJsonSchema7AllOfType as t, isStandardJsonSchema as u };
108
+ //# sourceMappingURL=schema-CMt54x11.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-CMt54x11.mjs","names":[],"sources":["../src/schema.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { StandardJSONSchemaV1 } from \"@standard-schema/spec\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type {\n JsonSchema7AllOfType,\n JsonSchema7ArrayType,\n JsonSchema7BooleanType,\n JsonSchema7LiteralType,\n JsonSchema7NumberType,\n JsonSchema7ObjectType,\n JsonSchema7PrimitiveLiteralType,\n JsonSchema7StringType,\n JsonSchema7TupleType,\n JsonSchema7Type\n} from \"./types\";\n\n/**\n * Type guard for {@link JsonSchema7AllOfType}\n *\n * @param schema - The schema to check\n * @returns True if the schema is a {@link JsonSchema7AllOfType}, false otherwise\n */\nexport function isJsonSchema7AllOfType(\n schema: JsonSchema7Type\n): schema is JsonSchema7AllOfType {\n if (\"type\" in schema && schema.type === \"string\") {\n return false;\n }\n\n return \"allOf\" in schema;\n}\n\n/**\n * Type guard for {@link JsonSchema7ObjectType}\n *\n * @param schema - The schema to check\n * @returns True if the schema is a {@link JsonSchema7ObjectType}, false otherwise\n */\nexport function isJsonSchema7ObjectType(\n schema: JsonSchema7Type\n): schema is JsonSchema7ObjectType {\n if (\"type\" in schema && schema.type === \"object\") {\n return false;\n }\n\n return \"properties\" in schema;\n}\n\n/**\n * Type guard for {@link JsonSchema7StringType}\n *\n * @param schema - The schema to check\n * @returns True if the schema is a {@link JsonSchema7StringType}, false otherwise\n */\nexport function isJsonSchema7StringType(\n schema: JsonSchema7Type\n): schema is JsonSchema7StringType {\n return \"type\" in schema && schema.type === \"string\";\n}\n\n/**\n * Type guard for {@link JsonSchema7NumberType}\n *\n * @param schema - The schema to check\n * @returns True if the schema is a {@link JsonSchema7NumberType}, false otherwise\n */\nexport function isJsonSchema7NumberType(\n schema: JsonSchema7Type\n): schema is JsonSchema7NumberType {\n return (\n \"type\" in schema && (schema.type === \"number\" || schema.type === \"integer\")\n );\n}\n\n/**\n * Type guard for {@link JsonSchema7BooleanType}\n *\n * @param schema - The schema to check\n * @returns True if the schema is a {@link JsonSchema7BooleanType}, false otherwise\n */\nexport function isJsonSchema7BooleanType(\n schema: JsonSchema7Type\n): schema is JsonSchema7BooleanType {\n return \"type\" in schema && schema.type === \"boolean\";\n}\n\n/**\n * Type guard for {@link JsonSchema7ArrayType}\n *\n * @param schema - The schema to check\n * @returns True if the schema is a {@link JsonSchema7ArrayType}, false otherwise\n */\nexport function isJsonSchema7ArrayType(\n schema: JsonSchema7Type\n): schema is JsonSchema7ArrayType {\n return \"type\" in schema && schema.type === \"array\" && \"items\" in schema;\n}\n\n/**\n * Type guard for {@link JsonSchema7TupleType}\n *\n * @param schema - The schema to check\n * @returns True if the schema is a {@link JsonSchema7TupleType}, false otherwise\n */\nexport function isJsonSchema7TupleType(\n schema: JsonSchema7Type\n): schema is JsonSchema7TupleType {\n return (\n \"type\" in schema &&\n schema.type === \"array\" &&\n \"items\" in schema &&\n Array.isArray(schema.items)\n );\n}\n\n/**\n * Type guard for {@link JsonSchema7PrimitiveLiteralType}\n *\n * @param schema - The schema to check\n * @returns True if the schema is a {@link JsonSchema7PrimitiveLiteralType}, false otherwise\n */\nexport function isJsonSchema7PrimitiveLiteralType(\n schema: JsonSchema7Type\n): schema is JsonSchema7PrimitiveLiteralType {\n if (!(\"type\" in schema)) {\n return false;\n }\n\n const { type } = schema;\n\n return (\n (type === \"string\" ||\n type === \"number\" ||\n type === \"integer\" ||\n type === \"boolean\") &&\n \"const\" in schema\n );\n}\n\n/**\n * Type guard for {@link JsonSchema7LiteralType}\n *\n * @param schema - The schema to check\n * @returns True if the schema is a {@link JsonSchema7LiteralType}, false otherwise\n */\nexport function isJsonSchema7LiteralType(\n schema: JsonSchema7Type\n): schema is JsonSchema7LiteralType {\n if (isJsonSchema7PrimitiveLiteralType(schema)) {\n return true;\n }\n\n if (!(\"type\" in schema)) {\n return false;\n }\n\n return schema.type === \"object\" || schema.type === \"array\";\n}\n\n/**\n * Type guard to check if a value is a {@link StandardJSONSchemaV1 | Standard JSON Schema}.\n *\n * @remarks\n * This function checks if the value has the structure of a Standard JSON Schema, which includes a `~standard` property with a `jsonSchema` object that has `input` and `output` functions.\n *\n * @see https://standardschema.dev/json-schema\n *\n * @param value - The value to check.\n * @returns True if the value is a {@link StandardJSONSchemaV1 | Standard JSON Schema}, false otherwise.\n */\nexport function isStandardJsonSchema<Input = unknown, Output = Input>(\n value: any\n): value is StandardJSONSchemaV1<Input, Output> {\n return (\n isSetObject(value) &&\n \"~standard\" in value &&\n isSetObject(value[\"~standard\"]) &&\n \"jsonSchema\" in value[\"~standard\"] &&\n isSetObject(value[\"~standard\"].jsonSchema) &&\n \"input\" in value[\"~standard\"].jsonSchema &&\n isFunction(value[\"~standard\"].jsonSchema.input) &&\n \"output\" in value[\"~standard\"].jsonSchema &&\n isFunction(value[\"~standard\"].jsonSchema.output)\n );\n}\n"],"mappings":";;;;;;;;;AAwCA,SAAgB,uBACd,QACgC;AAChC,KAAI,UAAU,UAAU,OAAO,SAAS,SACtC,QAAO;AAGT,QAAO,WAAW;;;;;;;;AASpB,SAAgB,wBACd,QACiC;AACjC,KAAI,UAAU,UAAU,OAAO,SAAS,SACtC,QAAO;AAGT,QAAO,gBAAgB;;;;;;;;AASzB,SAAgB,wBACd,QACiC;AACjC,QAAO,UAAU,UAAU,OAAO,SAAS;;;;;;;;AAS7C,SAAgB,wBACd,QACiC;AACjC,QACE,UAAU,WAAW,OAAO,SAAS,YAAY,OAAO,SAAS;;;;;;;;AAUrE,SAAgB,yBACd,QACkC;AAClC,QAAO,UAAU,UAAU,OAAO,SAAS;;;;;;;;AAS7C,SAAgB,uBACd,QACgC;AAChC,QAAO,UAAU,UAAU,OAAO,SAAS,WAAW,WAAW;;;;;;;;AASnE,SAAgB,uBACd,QACgC;AAChC,QACE,UAAU,UACV,OAAO,SAAS,WAChB,WAAW,UACX,MAAM,QAAQ,OAAO,MAAM;;;;;;;;AAU/B,SAAgB,kCACd,QAC2C;AAC3C,KAAI,EAAE,UAAU,QACd,QAAO;CAGT,MAAM,EAAE,SAAS;AAEjB,SACG,SAAS,YACR,SAAS,YACT,SAAS,aACT,SAAS,cACX,WAAW;;;;;;;;AAUf,SAAgB,yBACd,QACkC;AAClC,KAAI,kCAAkC,OAAO,CAC3C,QAAO;AAGT,KAAI,EAAE,UAAU,QACd,QAAO;AAGT,QAAO,OAAO,SAAS,YAAY,OAAO,SAAS;;;;;;;;;;;;;AAcrD,SAAgB,qBACd,OAC8C;AAC9C,QACE,YAAY,MAAM,IAClB,eAAe,SACf,YAAY,MAAM,aAAa,IAC/B,gBAAgB,MAAM,gBACtB,YAAY,MAAM,aAAa,WAAW,IAC1C,WAAW,MAAM,aAAa,cAC9B,WAAW,MAAM,aAAa,WAAW,MAAM,IAC/C,YAAY,MAAM,aAAa,cAC/B,WAAW,MAAM,aAAa,WAAW,OAAO"}
@@ -1,4 +1,4 @@
1
- import { A as JsonSchema7PrimitiveLiteralType, D as JsonSchema7NumberType, I as JsonSchema7StringType, O as JsonSchema7ObjectType, R as JsonSchema7Type, _ as JsonSchema7BooleanType, b as JsonSchema7LiteralType, f as JsonSchema7AllOfType, h as JsonSchema7ArrayType } from "./types-BAtAPir9.mjs";
1
+ import { A as JsonSchema7PrimitiveLiteralType, D as JsonSchema7NumberType, I as JsonSchema7StringType, L as JsonSchema7TupleType, O as JsonSchema7ObjectType, R as JsonSchema7Type, _ as JsonSchema7BooleanType, b as JsonSchema7LiteralType, f as JsonSchema7AllOfType, h as JsonSchema7ArrayType } from "./types-BzNIRhpI.cjs";
2
2
  import { StandardJSONSchemaV1 } from "@standard-schema/spec";
3
3
 
4
4
  //#region src/schema.d.ts
@@ -45,6 +45,13 @@ declare function isJsonSchema7BooleanType(schema: JsonSchema7Type): schema is Js
45
45
  * @returns True if the schema is a {@link JsonSchema7ArrayType}, false otherwise
46
46
  */
47
47
  declare function isJsonSchema7ArrayType(schema: JsonSchema7Type): schema is JsonSchema7ArrayType;
48
+ /**
49
+ * Type guard for {@link JsonSchema7TupleType}
50
+ *
51
+ * @param schema - The schema to check
52
+ * @returns True if the schema is a {@link JsonSchema7TupleType}, false otherwise
53
+ */
54
+ declare function isJsonSchema7TupleType(schema: JsonSchema7Type): schema is JsonSchema7TupleType;
48
55
  /**
49
56
  * Type guard for {@link JsonSchema7PrimitiveLiteralType}
50
57
  *
@@ -72,5 +79,5 @@ declare function isJsonSchema7LiteralType(schema: JsonSchema7Type): schema is Js
72
79
  */
73
80
  declare function isStandardJsonSchema<Input = unknown, Output = Input>(value: any): value is StandardJSONSchemaV1<Input, Output>;
74
81
  //#endregion
75
- export { isJsonSchema7NumberType as a, isJsonSchema7StringType as c, isJsonSchema7LiteralType as i, isStandardJsonSchema as l, isJsonSchema7ArrayType as n, isJsonSchema7ObjectType as o, isJsonSchema7BooleanType as r, isJsonSchema7PrimitiveLiteralType as s, isJsonSchema7AllOfType as t };
76
- //# sourceMappingURL=schema-B7wpjw3I.d.mts.map
82
+ export { isJsonSchema7NumberType as a, isJsonSchema7StringType as c, isJsonSchema7LiteralType as i, isJsonSchema7TupleType as l, isJsonSchema7ArrayType as n, isJsonSchema7ObjectType as o, isJsonSchema7BooleanType as r, isJsonSchema7PrimitiveLiteralType as s, isJsonSchema7AllOfType as t, isStandardJsonSchema as u };
83
+ //# sourceMappingURL=schema-CuBX00tF.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-CuBX00tF.d.cts","names":[],"sources":["../src/schema.ts"],"sourcesContent":[],"mappings":";;;;;;;AAwCA;AAgBA;AAgBA;AAYA;AAcgB,iBA1DA,sBAAA,CA2DN,MAAA,EA1DA,eA2DG,CAAA,EAAA,MAAA,IA1DA,oBA0DsB;AAUnC;AAYA;AAiBA;AAwBA;AAyBA;;AAEiC,iBAtIjB,uBAAA,CAsIiB,MAAA,EArIvB,eAqIuB,CAAA,EAAA,MAAA,IApIpB,qBAoIoB;;;;;;;iBAtHjB,uBAAA,SACN,4BACG;;;;;;;iBAUG,uBAAA,SACN,4BACG;;;;;;;iBAYG,wBAAA,SACN,4BACG;;;;;;;iBAUG,sBAAA,SACN,4BACG;;;;;;;iBAUG,sBAAA,SACN,4BACG;;;;;;;iBAeG,iCAAA,SACN,4BACG;;;;;;;iBAsBG,wBAAA,SACN,4BACG;;;;;;;;;;;;iBAuBG,+CAA+C,6BAEnD,qBAAqB,OAAO"}
@@ -58,6 +58,15 @@ function isJsonSchema7ArrayType(schema) {
58
58
  return "type" in schema && schema.type === "array" && "items" in schema;
59
59
  }
60
60
  /**
61
+ * Type guard for {@link JsonSchema7TupleType}
62
+ *
63
+ * @param schema - The schema to check
64
+ * @returns True if the schema is a {@link JsonSchema7TupleType}, false otherwise
65
+ */
66
+ function isJsonSchema7TupleType(schema) {
67
+ return "type" in schema && schema.type === "array" && "items" in schema && Array.isArray(schema.items);
68
+ }
69
+ /**
61
70
  * Type guard for {@link JsonSchema7PrimitiveLiteralType}
62
71
  *
63
72
  * @param schema - The schema to check
@@ -143,6 +152,12 @@ Object.defineProperty(exports, 'isJsonSchema7StringType', {
143
152
  return isJsonSchema7StringType;
144
153
  }
145
154
  });
155
+ Object.defineProperty(exports, 'isJsonSchema7TupleType', {
156
+ enumerable: true,
157
+ get: function () {
158
+ return isJsonSchema7TupleType;
159
+ }
160
+ });
146
161
  Object.defineProperty(exports, 'isStandardJsonSchema', {
147
162
  enumerable: true,
148
163
  get: function () {
@@ -1,4 +1,4 @@
1
- import { A as JsonSchema7PrimitiveLiteralType, D as JsonSchema7NumberType, I as JsonSchema7StringType, O as JsonSchema7ObjectType, R as JsonSchema7Type, _ as JsonSchema7BooleanType, b as JsonSchema7LiteralType, f as JsonSchema7AllOfType, h as JsonSchema7ArrayType } from "./types-BzNIRhpI.cjs";
1
+ import { A as JsonSchema7PrimitiveLiteralType, D as JsonSchema7NumberType, I as JsonSchema7StringType, L as JsonSchema7TupleType, O as JsonSchema7ObjectType, R as JsonSchema7Type, _ as JsonSchema7BooleanType, b as JsonSchema7LiteralType, f as JsonSchema7AllOfType, h as JsonSchema7ArrayType } from "./types-BAtAPir9.mjs";
2
2
  import { StandardJSONSchemaV1 } from "@standard-schema/spec";
3
3
 
4
4
  //#region src/schema.d.ts
@@ -45,6 +45,13 @@ declare function isJsonSchema7BooleanType(schema: JsonSchema7Type): schema is Js
45
45
  * @returns True if the schema is a {@link JsonSchema7ArrayType}, false otherwise
46
46
  */
47
47
  declare function isJsonSchema7ArrayType(schema: JsonSchema7Type): schema is JsonSchema7ArrayType;
48
+ /**
49
+ * Type guard for {@link JsonSchema7TupleType}
50
+ *
51
+ * @param schema - The schema to check
52
+ * @returns True if the schema is a {@link JsonSchema7TupleType}, false otherwise
53
+ */
54
+ declare function isJsonSchema7TupleType(schema: JsonSchema7Type): schema is JsonSchema7TupleType;
48
55
  /**
49
56
  * Type guard for {@link JsonSchema7PrimitiveLiteralType}
50
57
  *
@@ -72,5 +79,5 @@ declare function isJsonSchema7LiteralType(schema: JsonSchema7Type): schema is Js
72
79
  */
73
80
  declare function isStandardJsonSchema<Input = unknown, Output = Input>(value: any): value is StandardJSONSchemaV1<Input, Output>;
74
81
  //#endregion
75
- export { isJsonSchema7NumberType as a, isJsonSchema7StringType as c, isJsonSchema7LiteralType as i, isStandardJsonSchema as l, isJsonSchema7ArrayType as n, isJsonSchema7ObjectType as o, isJsonSchema7BooleanType as r, isJsonSchema7PrimitiveLiteralType as s, isJsonSchema7AllOfType as t };
76
- //# sourceMappingURL=schema-BgOm_N0w.d.cts.map
82
+ export { isJsonSchema7NumberType as a, isJsonSchema7StringType as c, isJsonSchema7LiteralType as i, isJsonSchema7TupleType as l, isJsonSchema7ArrayType as n, isJsonSchema7ObjectType as o, isJsonSchema7BooleanType as r, isJsonSchema7PrimitiveLiteralType as s, isJsonSchema7AllOfType as t, isStandardJsonSchema as u };
83
+ //# sourceMappingURL=schema-D5wPTiM4.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-D5wPTiM4.d.mts","names":[],"sources":["../src/schema.ts"],"sourcesContent":[],"mappings":";;;;;;;AAwCA;AAgBA;AAgBA;AAYA;AAcgB,iBA1DA,sBAAA,CA2DN,MAAA,EA1DA,eA2DG,CAAA,EAAA,MAAA,IA1DA,oBA0DsB;AAUnC;AAYA;AAiBA;AAwBA;AAyBA;;AAEiC,iBAtIjB,uBAAA,CAsIiB,MAAA,EArIvB,eAqIuB,CAAA,EAAA,MAAA,IApIpB,qBAoIoB;;;;;;;iBAtHjB,uBAAA,SACN,4BACG;;;;;;;iBAUG,uBAAA,SACN,4BACG;;;;;;;iBAYG,wBAAA,SACN,4BACG;;;;;;;iBAUG,sBAAA,SACN,4BACG;;;;;;;iBAUG,sBAAA,SACN,4BACG;;;;;;;iBAeG,iCAAA,SACN,4BACG;;;;;;;iBAsBG,wBAAA,SACN,4BACG;;;;;;;;;;;;iBAuBG,+CAA+C,6BAEnD,qBAAqB,OAAO"}
package/dist/schema.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_schema = require('./schema-BM7g4xZ3.cjs');
1
+ const require_schema = require('./schema-CwyRhvHe.cjs');
2
2
 
3
3
  exports.isJsonSchema7AllOfType = require_schema.isJsonSchema7AllOfType;
4
4
  exports.isJsonSchema7ArrayType = require_schema.isJsonSchema7ArrayType;
@@ -8,4 +8,5 @@ exports.isJsonSchema7NumberType = require_schema.isJsonSchema7NumberType;
8
8
  exports.isJsonSchema7ObjectType = require_schema.isJsonSchema7ObjectType;
9
9
  exports.isJsonSchema7PrimitiveLiteralType = require_schema.isJsonSchema7PrimitiveLiteralType;
10
10
  exports.isJsonSchema7StringType = require_schema.isJsonSchema7StringType;
11
+ exports.isJsonSchema7TupleType = require_schema.isJsonSchema7TupleType;
11
12
  exports.isStandardJsonSchema = require_schema.isStandardJsonSchema;
package/dist/schema.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as isJsonSchema7NumberType, c as isJsonSchema7StringType, i as isJsonSchema7LiteralType, l as isStandardJsonSchema, n as isJsonSchema7ArrayType, o as isJsonSchema7ObjectType, r as isJsonSchema7BooleanType, s as isJsonSchema7PrimitiveLiteralType, t as isJsonSchema7AllOfType } from "./schema-BgOm_N0w.cjs";
2
- export { isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7BooleanType, isJsonSchema7LiteralType, isJsonSchema7NumberType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isJsonSchema7StringType, isStandardJsonSchema };
1
+ import { a as isJsonSchema7NumberType, c as isJsonSchema7StringType, i as isJsonSchema7LiteralType, l as isJsonSchema7TupleType, n as isJsonSchema7ArrayType, o as isJsonSchema7ObjectType, r as isJsonSchema7BooleanType, s as isJsonSchema7PrimitiveLiteralType, t as isJsonSchema7AllOfType, u as isStandardJsonSchema } from "./schema-CuBX00tF.cjs";
2
+ export { isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7BooleanType, isJsonSchema7LiteralType, isJsonSchema7NumberType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isJsonSchema7StringType, isJsonSchema7TupleType, isStandardJsonSchema };
package/dist/schema.d.mts CHANGED
@@ -1,3 +1,3 @@
1
1
  import "./types-BAtAPir9.mjs";
2
- import { a as isJsonSchema7NumberType, c as isJsonSchema7StringType, i as isJsonSchema7LiteralType, l as isStandardJsonSchema, n as isJsonSchema7ArrayType, o as isJsonSchema7ObjectType, r as isJsonSchema7BooleanType, s as isJsonSchema7PrimitiveLiteralType, t as isJsonSchema7AllOfType } from "./schema-B7wpjw3I.mjs";
3
- export { isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7BooleanType, isJsonSchema7LiteralType, isJsonSchema7NumberType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isJsonSchema7StringType, isStandardJsonSchema };
2
+ import { a as isJsonSchema7NumberType, c as isJsonSchema7StringType, i as isJsonSchema7LiteralType, l as isJsonSchema7TupleType, n as isJsonSchema7ArrayType, o as isJsonSchema7ObjectType, r as isJsonSchema7BooleanType, s as isJsonSchema7PrimitiveLiteralType, t as isJsonSchema7AllOfType, u as isStandardJsonSchema } from "./schema-D5wPTiM4.mjs";
3
+ export { isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7BooleanType, isJsonSchema7LiteralType, isJsonSchema7NumberType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isJsonSchema7StringType, isJsonSchema7TupleType, isStandardJsonSchema };
package/dist/schema.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { a as isJsonSchema7NumberType, c as isJsonSchema7StringType, i as isJsonSchema7LiteralType, l as isStandardJsonSchema, n as isJsonSchema7ArrayType, o as isJsonSchema7ObjectType, r as isJsonSchema7BooleanType, s as isJsonSchema7PrimitiveLiteralType, t as isJsonSchema7AllOfType } from "./schema-SrJmxZsC.mjs";
1
+ import { a as isJsonSchema7NumberType, c as isJsonSchema7StringType, i as isJsonSchema7LiteralType, l as isJsonSchema7TupleType, n as isJsonSchema7ArrayType, o as isJsonSchema7ObjectType, r as isJsonSchema7BooleanType, s as isJsonSchema7PrimitiveLiteralType, t as isJsonSchema7AllOfType, u as isStandardJsonSchema } from "./schema-CMt54x11.mjs";
2
2
 
3
- export { isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7BooleanType, isJsonSchema7LiteralType, isJsonSchema7NumberType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isJsonSchema7StringType, isStandardJsonSchema };
3
+ export { isJsonSchema7AllOfType, isJsonSchema7ArrayType, isJsonSchema7BooleanType, isJsonSchema7LiteralType, isJsonSchema7NumberType, isJsonSchema7ObjectType, isJsonSchema7PrimitiveLiteralType, isJsonSchema7StringType, isJsonSchema7TupleType, isStandardJsonSchema };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/json",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "type": "module",
5
5
  "description": "A package containing JSON parsing/stringify utilities used by Storm Software.",
6
6
  "repository": {
@@ -77,5 +77,5 @@
77
77
  "tsdown": "^0.17.2"
78
78
  },
79
79
  "publishConfig": { "access": "public" },
80
- "gitHead": "b8125bf046febc1991df62777827d0481c2c89c0"
80
+ "gitHead": "793c21dcc2c0734890ffe5e40bd69683455dc301"
81
81
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-B7wpjw3I.d.mts","names":[],"sources":["../src/schema.ts"],"sourcesContent":[],"mappings":";;;;;;;AAuCA;AAgBA;AAgBA;AAYA;AAcgB,iBA1DA,sBAAA,CA2DN,MAAA,EA1DA,eA2DG,CAAA,EAAA,MAAA,IA1DA,oBA0DsB;AAUnC;AAYA;AAwBA;AAyBA;;;AAEwC,iBArHxB,uBAAA,CAqHwB,MAAA,EApH9B,eAoH8B,CAAA,EAAA,MAAA,IAnH3B,qBAmH2B;;;;;;;iBArGxB,uBAAA,SACN,4BACG;;;;;;;iBAUG,uBAAA,SACN,4BACG;;;;;;;iBAYG,wBAAA,SACN,4BACG;;;;;;;iBAUG,sBAAA,SACN,4BACG;;;;;;;iBAUG,iCAAA,SACN,4BACG;;;;;;;iBAsBG,wBAAA,SACN,4BACG;;;;;;;;;;;;iBAuBG,+CAA+C,6BAEnD,qBAAqB,OAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-BgOm_N0w.d.cts","names":[],"sources":["../src/schema.ts"],"sourcesContent":[],"mappings":";;;;;;;AAuCA;AAgBA;AAgBA;AAYA;AAcgB,iBA1DA,sBAAA,CA2DN,MAAA,EA1DA,eA2DG,CAAA,EAAA,MAAA,IA1DA,oBA0DsB;AAUnC;AAYA;AAwBA;AAyBA;;;AAEwC,iBArHxB,uBAAA,CAqHwB,MAAA,EApH9B,eAoH8B,CAAA,EAAA,MAAA,IAnH3B,qBAmH2B;;;;;;;iBArGxB,uBAAA,SACN,4BACG;;;;;;;iBAUG,uBAAA,SACN,4BACG;;;;;;;iBAYG,wBAAA,SACN,4BACG;;;;;;;iBAUG,sBAAA,SACN,4BACG;;;;;;;iBAUG,iCAAA,SACN,4BACG;;;;;;;iBAsBG,wBAAA,SACN,4BACG;;;;;;;;;;;;iBAuBG,+CAA+C,6BAEnD,qBAAqB,OAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-SrJmxZsC.mjs","names":[],"sources":["../src/schema.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { StandardJSONSchemaV1 } from \"@standard-schema/spec\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type {\n JsonSchema7AllOfType,\n JsonSchema7ArrayType,\n JsonSchema7BooleanType,\n JsonSchema7LiteralType,\n JsonSchema7NumberType,\n JsonSchema7ObjectType,\n JsonSchema7PrimitiveLiteralType,\n JsonSchema7StringType,\n JsonSchema7Type\n} from \"./types\";\n\n/**\n * Type guard for {@link JsonSchema7AllOfType}\n *\n * @param schema - The schema to check\n * @returns True if the schema is a {@link JsonSchema7AllOfType}, false otherwise\n */\nexport function isJsonSchema7AllOfType(\n schema: JsonSchema7Type\n): schema is JsonSchema7AllOfType {\n if (\"type\" in schema && schema.type === \"string\") {\n return false;\n }\n\n return \"allOf\" in schema;\n}\n\n/**\n * Type guard for {@link JsonSchema7ObjectType}\n *\n * @param schema - The schema to check\n * @returns True if the schema is a {@link JsonSchema7ObjectType}, false otherwise\n */\nexport function isJsonSchema7ObjectType(\n schema: JsonSchema7Type\n): schema is JsonSchema7ObjectType {\n if (\"type\" in schema && schema.type === \"object\") {\n return false;\n }\n\n return \"properties\" in schema;\n}\n\n/**\n * Type guard for {@link JsonSchema7StringType}\n *\n * @param schema - The schema to check\n * @returns True if the schema is a {@link JsonSchema7StringType}, false otherwise\n */\nexport function isJsonSchema7StringType(\n schema: JsonSchema7Type\n): schema is JsonSchema7StringType {\n return \"type\" in schema && schema.type === \"string\";\n}\n\n/**\n * Type guard for {@link JsonSchema7NumberType}\n *\n * @param schema - The schema to check\n * @returns True if the schema is a {@link JsonSchema7NumberType}, false otherwise\n */\nexport function isJsonSchema7NumberType(\n schema: JsonSchema7Type\n): schema is JsonSchema7NumberType {\n return (\n \"type\" in schema && (schema.type === \"number\" || schema.type === \"integer\")\n );\n}\n\n/**\n * Type guard for {@link JsonSchema7BooleanType}\n *\n * @param schema - The schema to check\n * @returns True if the schema is a {@link JsonSchema7BooleanType}, false otherwise\n */\nexport function isJsonSchema7BooleanType(\n schema: JsonSchema7Type\n): schema is JsonSchema7BooleanType {\n return \"type\" in schema && schema.type === \"boolean\";\n}\n\n/**\n * Type guard for {@link JsonSchema7ArrayType}\n *\n * @param schema - The schema to check\n * @returns True if the schema is a {@link JsonSchema7ArrayType}, false otherwise\n */\nexport function isJsonSchema7ArrayType(\n schema: JsonSchema7Type\n): schema is JsonSchema7ArrayType {\n return \"type\" in schema && schema.type === \"array\" && \"items\" in schema;\n}\n\n/**\n * Type guard for {@link JsonSchema7PrimitiveLiteralType}\n *\n * @param schema - The schema to check\n * @returns True if the schema is a {@link JsonSchema7PrimitiveLiteralType}, false otherwise\n */\nexport function isJsonSchema7PrimitiveLiteralType(\n schema: JsonSchema7Type\n): schema is JsonSchema7PrimitiveLiteralType {\n if (!(\"type\" in schema)) {\n return false;\n }\n\n const { type } = schema;\n\n return (\n (type === \"string\" ||\n type === \"number\" ||\n type === \"integer\" ||\n type === \"boolean\") &&\n \"const\" in schema\n );\n}\n\n/**\n * Type guard for {@link JsonSchema7LiteralType}\n *\n * @param schema - The schema to check\n * @returns True if the schema is a {@link JsonSchema7LiteralType}, false otherwise\n */\nexport function isJsonSchema7LiteralType(\n schema: JsonSchema7Type\n): schema is JsonSchema7LiteralType {\n if (isJsonSchema7PrimitiveLiteralType(schema)) {\n return true;\n }\n\n if (!(\"type\" in schema)) {\n return false;\n }\n\n return schema.type === \"object\" || schema.type === \"array\";\n}\n\n/**\n * Type guard to check if a value is a {@link StandardJSONSchemaV1 | Standard JSON Schema}.\n *\n * @remarks\n * This function checks if the value has the structure of a Standard JSON Schema, which includes a `~standard` property with a `jsonSchema` object that has `input` and `output` functions.\n *\n * @see https://standardschema.dev/json-schema\n *\n * @param value - The value to check.\n * @returns True if the value is a {@link StandardJSONSchemaV1 | Standard JSON Schema}, false otherwise.\n */\nexport function isStandardJsonSchema<Input = unknown, Output = Input>(\n value: any\n): value is StandardJSONSchemaV1<Input, Output> {\n return (\n isSetObject(value) &&\n \"~standard\" in value &&\n isSetObject(value[\"~standard\"]) &&\n \"jsonSchema\" in value[\"~standard\"] &&\n isSetObject(value[\"~standard\"].jsonSchema) &&\n \"input\" in value[\"~standard\"].jsonSchema &&\n isFunction(value[\"~standard\"].jsonSchema.input) &&\n \"output\" in value[\"~standard\"].jsonSchema &&\n isFunction(value[\"~standard\"].jsonSchema.output)\n );\n}\n"],"mappings":";;;;;;;;;AAuCA,SAAgB,uBACd,QACgC;AAChC,KAAI,UAAU,UAAU,OAAO,SAAS,SACtC,QAAO;AAGT,QAAO,WAAW;;;;;;;;AASpB,SAAgB,wBACd,QACiC;AACjC,KAAI,UAAU,UAAU,OAAO,SAAS,SACtC,QAAO;AAGT,QAAO,gBAAgB;;;;;;;;AASzB,SAAgB,wBACd,QACiC;AACjC,QAAO,UAAU,UAAU,OAAO,SAAS;;;;;;;;AAS7C,SAAgB,wBACd,QACiC;AACjC,QACE,UAAU,WAAW,OAAO,SAAS,YAAY,OAAO,SAAS;;;;;;;;AAUrE,SAAgB,yBACd,QACkC;AAClC,QAAO,UAAU,UAAU,OAAO,SAAS;;;;;;;;AAS7C,SAAgB,uBACd,QACgC;AAChC,QAAO,UAAU,UAAU,OAAO,SAAS,WAAW,WAAW;;;;;;;;AASnE,SAAgB,kCACd,QAC2C;AAC3C,KAAI,EAAE,UAAU,QACd,QAAO;CAGT,MAAM,EAAE,SAAS;AAEjB,SACG,SAAS,YACR,SAAS,YACT,SAAS,aACT,SAAS,cACX,WAAW;;;;;;;;AAUf,SAAgB,yBACd,QACkC;AAClC,KAAI,kCAAkC,OAAO,CAC3C,QAAO;AAGT,KAAI,EAAE,UAAU,QACd,QAAO;AAGT,QAAO,OAAO,SAAS,YAAY,OAAO,SAAS;;;;;;;;;;;;;AAcrD,SAAgB,qBACd,OAC8C;AAC9C,QACE,YAAY,MAAM,IAClB,eAAe,SACf,YAAY,MAAM,aAAa,IAC/B,gBAAgB,MAAM,gBACtB,YAAY,MAAM,aAAa,WAAW,IAC1C,WAAW,MAAM,aAAa,cAC9B,WAAW,MAAM,aAAa,WAAW,MAAM,IAC/C,YAAY,MAAM,aAAa,cAC/B,WAAW,MAAM,aAAa,WAAW,OAAO"}