@powerlines/schema 0.11.28 → 0.11.38
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/dist/bundle.cjs +34 -20
- package/dist/bundle.d.cts +3 -3
- package/dist/bundle.d.cts.map +1 -1
- package/dist/bundle.d.mts +3 -3
- package/dist/bundle.d.mts.map +1 -1
- package/dist/bundle.mjs +35 -21
- package/dist/bundle.mjs.map +1 -1
- package/dist/codegen.cjs +55 -8
- package/dist/codegen.d.cts +12 -6
- package/dist/codegen.d.cts.map +1 -1
- package/dist/codegen.d.mts +12 -6
- package/dist/codegen.d.mts.map +1 -1
- package/dist/codegen.mjs +52 -8
- package/dist/codegen.mjs.map +1 -1
- package/dist/constants.cjs +42 -0
- package/dist/constants.d.cts +15 -0
- package/dist/constants.d.cts.map +1 -0
- package/dist/constants.d.mts +15 -0
- package/dist/constants.d.mts.map +1 -0
- package/dist/constants.mjs +39 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/extract.cjs +144 -95
- package/dist/extract.d.cts +34 -69
- package/dist/extract.d.cts.map +1 -1
- package/dist/extract.d.mts +34 -69
- package/dist/extract.d.mts.map +1 -1
- package/dist/extract.mjs +144 -95
- package/dist/extract.mjs.map +1 -1
- package/dist/helpers.cjs +87 -0
- package/dist/helpers.d.cts +48 -0
- package/dist/helpers.d.cts.map +1 -0
- package/dist/helpers.d.mts +48 -0
- package/dist/helpers.d.mts.map +1 -0
- package/dist/helpers.mjs +84 -0
- package/dist/helpers.mjs.map +1 -0
- package/dist/index.cjs +29 -5
- package/dist/index.d.cts +8 -5
- package/dist/index.d.mts +8 -5
- package/dist/index.mjs +7 -4
- package/dist/metadata.cjs +80 -0
- package/dist/metadata.d.cts +52 -0
- package/dist/metadata.d.cts.map +1 -0
- package/dist/metadata.d.mts +52 -0
- package/dist/metadata.d.mts.map +1 -0
- package/dist/metadata.mjs +76 -0
- package/dist/metadata.mjs.map +1 -0
- package/dist/persistence.cjs +75 -0
- package/dist/persistence.d.cts +47 -0
- package/dist/persistence.d.cts.map +1 -0
- package/dist/persistence.d.mts +47 -0
- package/dist/persistence.d.mts.map +1 -0
- package/dist/persistence.mjs +71 -0
- package/dist/persistence.mjs.map +1 -0
- package/dist/reflection.cjs +292 -299
- package/dist/reflection.d.cts +3 -16
- package/dist/reflection.d.cts.map +1 -1
- package/dist/reflection.d.mts +3 -16
- package/dist/reflection.d.mts.map +1 -1
- package/dist/reflection.mjs +291 -299
- package/dist/reflection.mjs.map +1 -1
- package/dist/resolve.cjs +7 -7
- package/dist/resolve.mjs +7 -7
- package/dist/resolve.mjs.map +1 -1
- package/dist/type-checks.cjs +126 -25
- package/dist/type-checks.d.cts +45 -23
- package/dist/type-checks.d.cts.map +1 -1
- package/dist/type-checks.d.mts +45 -23
- package/dist/type-checks.d.mts.map +1 -1
- package/dist/type-checks.mjs +125 -25
- package/dist/type-checks.mjs.map +1 -1
- package/dist/types.d.cts +237 -95
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +237 -95
- package/dist/types.d.mts.map +1 -1
- package/package.json +24 -8
- package/dist/jtd.cjs +0 -385
- package/dist/jtd.d.cts +0 -15
- package/dist/jtd.d.cts.map +0 -1
- package/dist/jtd.d.mts +0 -15
- package/dist/jtd.d.mts.map +0 -1
- package/dist/jtd.mjs +0 -384
- package/dist/jtd.mjs.map +0 -1
package/dist/type-checks.d.mts
CHANGED
|
@@ -1,43 +1,65 @@
|
|
|
1
|
-
import { ExtractedSchema, Schema as Schema$1
|
|
1
|
+
import { ExtractedSchema, JsonSchema, JsonSchemaObject, Schema as Schema$1 } from "./types.mjs";
|
|
2
2
|
import { InputObject, Schema } from "untyped";
|
|
3
|
-
import { JTDSchemaType } from "ajv/dist/types/jtd-schema.js";
|
|
4
3
|
|
|
5
4
|
//#region src/type-checks.d.ts
|
|
6
5
|
/**
|
|
7
|
-
* Type guard
|
|
6
|
+
* Type guard for JSON Schema types.
|
|
8
7
|
*
|
|
9
|
-
* @
|
|
10
|
-
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* This function checks if the input is a JSON Schema type, which is defined as having a `type` property or a `$ref` property. This is used to determine if a given input conforms to the structure of a JSON Schema definition that includes type information.
|
|
10
|
+
*
|
|
11
|
+
* @param input - The value to check.
|
|
12
|
+
* @returns True if the input is a JSON Schema type, false otherwise.
|
|
11
13
|
*/
|
|
12
|
-
declare function
|
|
14
|
+
declare function isJsonSchema<T = unknown>(input: unknown): input is JsonSchema<T>;
|
|
13
15
|
/**
|
|
14
|
-
* Type guard
|
|
16
|
+
* Type guard for JSON Schema object forms.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* This function checks if the input is a JSON Schema object type, which is defined as having a `type` property equal to "object" or having a `properties` object. This is used to determine if a given input conforms to the structure of a JSON Schema object definition.
|
|
15
20
|
*
|
|
16
|
-
* @param input - The
|
|
17
|
-
* @returns
|
|
21
|
+
* @param input - The value to check.
|
|
22
|
+
* @returns True if the input is a JSON Schema object type, false otherwise.
|
|
18
23
|
*/
|
|
19
|
-
declare function
|
|
24
|
+
declare function isJsonSchemaObject<T extends Record<string, any> = Record<string, any>>(input: unknown): input is JsonSchemaObject<T>;
|
|
20
25
|
/**
|
|
21
|
-
* Type guard
|
|
26
|
+
* Type guard for JSON Schemas that only accept `null`.
|
|
22
27
|
*
|
|
23
|
-
* @
|
|
24
|
-
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* This function checks if the input is a JSON Schema that exclusively accepts the `null` type. It verifies that the input is a valid JSON Schema and that its `type` property is set to "null". This is useful for identifying schemas that are specifically designed to allow only `null` values.
|
|
30
|
+
*
|
|
31
|
+
* @param input - The value to check.
|
|
32
|
+
* @returns True if the input is a JSON Schema that only accepts `null`, false otherwise.
|
|
25
33
|
*/
|
|
26
|
-
declare function
|
|
34
|
+
declare function isNullOnlyJsonSchema(input: unknown): input is JsonSchema<null>;
|
|
35
|
+
/**
|
|
36
|
+
* Type guard for untyped schema objects.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* This function checks if the input is an untyped schema object, which is defined as having certain properties that are commonly found in untyped schema definitions. This includes properties such as `id`, `title`, `description`, `$schema`, `tsType`, `markdownType`, `type`, `required`, `tags`, `args`, `properties`, and `resolve`. The function verifies that these properties, if present, conform to the expected types (e.g., strings for certain properties, arrays for others). This type guard is used to determine if a given input can be treated as an untyped schema object within the context of the Powerlines schema system.
|
|
40
|
+
*
|
|
41
|
+
* @param input - The value to check.
|
|
42
|
+
* @returns True if the input is an untyped schema object, false otherwise.
|
|
43
|
+
*/
|
|
44
|
+
declare function isUntypedSchema(input: unknown): input is Schema;
|
|
27
45
|
/**
|
|
28
|
-
* Type guard
|
|
46
|
+
* Type guard for untyped input objects.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* This function checks if the input is an untyped input object, which is defined as having certain properties that are commonly found in untyped input definitions. This includes properties such as `$schema` and `$resolve`. The function verifies that these properties, if present, conform to the expected types (e.g., objects for `$schema`, functions for `$resolve`). This type guard is used to determine if a given input can be treated as an untyped input object within the context of the Powerlines schema system.
|
|
29
50
|
*
|
|
30
|
-
* @param input - The
|
|
31
|
-
* @returns
|
|
51
|
+
* @param input - The value to check.
|
|
52
|
+
* @returns True if the input is an untyped input object, false otherwise.
|
|
32
53
|
*/
|
|
33
|
-
declare function
|
|
54
|
+
declare function isUntypedInput(input: unknown): input is InputObject;
|
|
34
55
|
/**
|
|
35
|
-
* Type guard
|
|
56
|
+
* Type guard for Powerlines Schema objects.
|
|
36
57
|
*
|
|
37
|
-
* @param input - The
|
|
38
|
-
* @returns
|
|
58
|
+
* @param input - The value to check.
|
|
59
|
+
* @returns True if the input is a Powerlines Schema object, false otherwise.
|
|
39
60
|
*/
|
|
40
|
-
declare function
|
|
61
|
+
declare function isSchema<T = unknown>(input: unknown): input is Schema$1<T>;
|
|
62
|
+
declare function isExtractedSchema<T = unknown>(input: unknown): input is ExtractedSchema<T>;
|
|
41
63
|
//#endregion
|
|
42
|
-
export { isExtractedSchema,
|
|
64
|
+
export { isExtractedSchema, isJsonSchema, isJsonSchemaObject, isNullOnlyJsonSchema, isSchema, isUntypedInput, isUntypedSchema };
|
|
43
65
|
//# sourceMappingURL=type-checks.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-checks.d.mts","names":[],"sources":["../src/type-checks.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"type-checks.d.mts","names":[],"sources":["../src/type-checks.ts"],"mappings":";;;;;;AAyHA;;;;;;;iBAAgB,YAAA,aAAA,CACd,KAAA,YACC,KAAA,IAAS,UAAU,CAAC,CAAA;;;AAAC;AA4FxB;;;;;;iBAAgB,kBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,YAAiB,KAAA,IAAS,gBAAA,CAAiB,CAAA;;;;;;;;;;iBAgB7B,oBAAA,CACd,KAAA,YACC,KAAA,IAAS,UAAU;AAlBwB;AAgB9C;;;;;;;;AAhB8C,iBA+B9B,eAAA,CAAgB,KAAA,YAAiB,KAAA,IAAS,MAAa;AAAvE;;;;;;;;AAAuE;AAAvE,iBA2DgB,cAAA,CAAe,KAAA,YAAiB,KAAA,IAAS,WAAkB;;;;;;;iBAsB3D,QAAA,aAAA,CAAsB,KAAA,YAAiB,KAAA,IAAS,QAAM,CAAC,CAAA;AAAA,iBAYvD,iBAAA,aAAA,CACd,KAAA,YACC,KAAA,IAAS,eAAe,CAAC,CAAA"}
|
package/dist/type-checks.mjs
CHANGED
|
@@ -1,21 +1,124 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { JSON_SCHEMA_DATA_TYPES } from "./constants.mjs";
|
|
2
|
+
import { isFunction, isObject, isSetObject, isSetString } from "@stryke/type-checks";
|
|
3
|
+
import { isJsonSchemaObjectType } from "@stryke/json";
|
|
3
4
|
|
|
4
5
|
//#region src/type-checks.ts
|
|
6
|
+
const JSON_SCHEMA_DATA_TYPE_SET = new Set(JSON_SCHEMA_DATA_TYPES);
|
|
7
|
+
const isSetNumber = (value) => typeof value === "number" && Number.isFinite(value);
|
|
8
|
+
const isSetBoolean = (value) => typeof value === "boolean";
|
|
9
|
+
const isNonNegativeInteger = (value) => Number.isInteger(value) && value >= 0;
|
|
10
|
+
const isSchemaLikeValue = (value) => isSetObject(value) || isSetBoolean(value);
|
|
11
|
+
const isStringArray = (value) => Array.isArray(value) && value.every((item) => isSetString(item));
|
|
12
|
+
const isRecordOfStringArrays = (value) => isSetObject(value) && Object.values(value).every((item) => isStringArray(item));
|
|
13
|
+
const TYPE_KEYWORD_VALIDATORS = {
|
|
14
|
+
string: {
|
|
15
|
+
minLength: isNonNegativeInteger,
|
|
16
|
+
maxLength: isNonNegativeInteger,
|
|
17
|
+
pattern: isSetString,
|
|
18
|
+
format: isSetString,
|
|
19
|
+
contentEncoding: isSetString,
|
|
20
|
+
contentMediaType: isSetString
|
|
21
|
+
},
|
|
22
|
+
number: {
|
|
23
|
+
minimum: isSetNumber,
|
|
24
|
+
maximum: isSetNumber,
|
|
25
|
+
exclusiveMinimum: isSetNumber,
|
|
26
|
+
exclusiveMaximum: isSetNumber,
|
|
27
|
+
multipleOf: isSetNumber
|
|
28
|
+
},
|
|
29
|
+
integer: {
|
|
30
|
+
minimum: isSetNumber,
|
|
31
|
+
maximum: isSetNumber,
|
|
32
|
+
exclusiveMinimum: isSetNumber,
|
|
33
|
+
exclusiveMaximum: isSetNumber,
|
|
34
|
+
multipleOf: isSetNumber
|
|
35
|
+
},
|
|
36
|
+
boolean: {},
|
|
37
|
+
array: {
|
|
38
|
+
items: isSchemaLikeValue,
|
|
39
|
+
prefixItems: Array.isArray,
|
|
40
|
+
contains: isSchemaLikeValue,
|
|
41
|
+
minItems: isNonNegativeInteger,
|
|
42
|
+
maxItems: isNonNegativeInteger,
|
|
43
|
+
uniqueItems: isSetBoolean,
|
|
44
|
+
minContains: isNonNegativeInteger,
|
|
45
|
+
maxContains: isNonNegativeInteger
|
|
46
|
+
},
|
|
47
|
+
object: {
|
|
48
|
+
properties: isSetObject,
|
|
49
|
+
patternProperties: isSetObject,
|
|
50
|
+
additionalProperties: isSchemaLikeValue,
|
|
51
|
+
required: isStringArray,
|
|
52
|
+
minProperties: isNonNegativeInteger,
|
|
53
|
+
maxProperties: isNonNegativeInteger,
|
|
54
|
+
dependentRequired: isRecordOfStringArrays,
|
|
55
|
+
dependentSchemas: isSetObject,
|
|
56
|
+
propertyNames: isSchemaLikeValue,
|
|
57
|
+
unevaluatedProperties: isSchemaLikeValue
|
|
58
|
+
},
|
|
59
|
+
null: {}
|
|
60
|
+
};
|
|
5
61
|
/**
|
|
6
|
-
* Type guard
|
|
62
|
+
* Type guard for JSON Schema types.
|
|
7
63
|
*
|
|
8
|
-
* @
|
|
9
|
-
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* This function checks if the input is a JSON Schema type, which is defined as having a `type` property or a `$ref` property. This is used to determine if a given input conforms to the structure of a JSON Schema definition that includes type information.
|
|
66
|
+
*
|
|
67
|
+
* @param input - The value to check.
|
|
68
|
+
* @returns True if the input is a JSON Schema type, false otherwise.
|
|
69
|
+
*/
|
|
70
|
+
function isJsonSchema(input) {
|
|
71
|
+
if (!isSetObject(input)) return false;
|
|
72
|
+
const schema = input;
|
|
73
|
+
if ("$ref" in schema && isSetString(schema.$ref)) return true;
|
|
74
|
+
if (!("type" in schema)) return false;
|
|
75
|
+
const schemaTypes = [];
|
|
76
|
+
if (isSetString(schema.type)) {
|
|
77
|
+
if (!JSON_SCHEMA_DATA_TYPE_SET.has(schema.type)) return false;
|
|
78
|
+
schemaTypes.push(schema.type);
|
|
79
|
+
} else if (Array.isArray(schema.type) && schema.type.length > 0) {
|
|
80
|
+
if (!schema.type.every((schemaType) => isSetString(schemaType) && JSON_SCHEMA_DATA_TYPE_SET.has(schemaType)) || new Set(schema.type).size !== schema.type.length) return false;
|
|
81
|
+
schemaTypes.push(...schema.type);
|
|
82
|
+
} else return false;
|
|
83
|
+
const typeKeywordValidators = schemaTypes.flatMap((schemaType) => Object.entries(TYPE_KEYWORD_VALIDATORS[schemaType]));
|
|
84
|
+
for (const [keyword, validator] of typeKeywordValidators) if (keyword in schema && !validator(schema[keyword])) return false;
|
|
85
|
+
if ("minItems" in schema && "maxItems" in schema && isNonNegativeInteger(schema.minItems) && isNonNegativeInteger(schema.maxItems) && schema.minItems > schema.maxItems) return false;
|
|
86
|
+
if ("minLength" in schema && "maxLength" in schema && isNonNegativeInteger(schema.minLength) && isNonNegativeInteger(schema.maxLength) && schema.minLength > schema.maxLength) return false;
|
|
87
|
+
if ("minProperties" in schema && "maxProperties" in schema && isNonNegativeInteger(schema.minProperties) && isNonNegativeInteger(schema.maxProperties) && schema.minProperties > schema.maxProperties) return false;
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Type guard for JSON Schema object forms.
|
|
92
|
+
*
|
|
93
|
+
* @remarks
|
|
94
|
+
* This function checks if the input is a JSON Schema object type, which is defined as having a `type` property equal to "object" or having a `properties` object. This is used to determine if a given input conforms to the structure of a JSON Schema object definition.
|
|
95
|
+
*
|
|
96
|
+
* @param input - The value to check.
|
|
97
|
+
* @returns True if the input is a JSON Schema object type, false otherwise.
|
|
10
98
|
*/
|
|
11
|
-
function
|
|
12
|
-
return isJsonSchemaObjectType(input) && "
|
|
99
|
+
function isJsonSchemaObject(input) {
|
|
100
|
+
return isJsonSchemaObjectType(input) && (input.type === "object" || isObject(input.properties));
|
|
13
101
|
}
|
|
14
102
|
/**
|
|
15
|
-
* Type guard
|
|
103
|
+
* Type guard for JSON Schemas that only accept `null`.
|
|
104
|
+
*
|
|
105
|
+
* @remarks
|
|
106
|
+
* This function checks if the input is a JSON Schema that exclusively accepts the `null` type. It verifies that the input is a valid JSON Schema and that its `type` property is set to "null". This is useful for identifying schemas that are specifically designed to allow only `null` values.
|
|
16
107
|
*
|
|
17
|
-
* @param input - The
|
|
18
|
-
* @returns
|
|
108
|
+
* @param input - The value to check.
|
|
109
|
+
* @returns True if the input is a JSON Schema that only accepts `null`, false otherwise.
|
|
110
|
+
*/
|
|
111
|
+
function isNullOnlyJsonSchema(input) {
|
|
112
|
+
return isJsonSchema(input) && input.type === "null";
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Type guard for untyped schema objects.
|
|
116
|
+
*
|
|
117
|
+
* @remarks
|
|
118
|
+
* This function checks if the input is an untyped schema object, which is defined as having certain properties that are commonly found in untyped schema definitions. This includes properties such as `id`, `title`, `description`, `$schema`, `tsType`, `markdownType`, `type`, `required`, `tags`, `args`, `properties`, and `resolve`. The function verifies that these properties, if present, conform to the expected types (e.g., strings for certain properties, arrays for others). This type guard is used to determine if a given input can be treated as an untyped schema object within the context of the Powerlines schema system.
|
|
119
|
+
*
|
|
120
|
+
* @param input - The value to check.
|
|
121
|
+
* @returns True if the input is an untyped schema object, false otherwise.
|
|
19
122
|
*/
|
|
20
123
|
function isUntypedSchema(input) {
|
|
21
124
|
if (!isSetObject(input)) return false;
|
|
@@ -35,10 +138,13 @@ function isUntypedSchema(input) {
|
|
|
35
138
|
return true;
|
|
36
139
|
}
|
|
37
140
|
/**
|
|
38
|
-
* Type guard
|
|
141
|
+
* Type guard for untyped input objects.
|
|
39
142
|
*
|
|
40
|
-
* @
|
|
41
|
-
*
|
|
143
|
+
* @remarks
|
|
144
|
+
* This function checks if the input is an untyped input object, which is defined as having certain properties that are commonly found in untyped input definitions. This includes properties such as `$schema` and `$resolve`. The function verifies that these properties, if present, conform to the expected types (e.g., objects for `$schema`, functions for `$resolve`). This type guard is used to determine if a given input can be treated as an untyped input object within the context of the Powerlines schema system.
|
|
145
|
+
*
|
|
146
|
+
* @param input - The value to check.
|
|
147
|
+
* @returns True if the input is an untyped input object, false otherwise.
|
|
42
148
|
*/
|
|
43
149
|
function isUntypedInput(input) {
|
|
44
150
|
if (!isSetObject(input)) return false;
|
|
@@ -48,24 +154,18 @@ function isUntypedInput(input) {
|
|
|
48
154
|
return true;
|
|
49
155
|
}
|
|
50
156
|
/**
|
|
51
|
-
* Type guard
|
|
157
|
+
* Type guard for Powerlines Schema objects.
|
|
52
158
|
*
|
|
53
|
-
* @param input - The
|
|
54
|
-
* @returns
|
|
159
|
+
* @param input - The value to check.
|
|
160
|
+
* @returns True if the input is a Powerlines Schema object, false otherwise.
|
|
55
161
|
*/
|
|
56
162
|
function isSchema(input) {
|
|
57
|
-
return isSetObject(input) && "schema" in input &&
|
|
163
|
+
return isSetObject(input) && "schema" in input && isJsonSchema(input.schema) && "variant" in input && isSetString(input.variant) && "hash" in input && isSetString(input.hash);
|
|
58
164
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Type guard to check if a given input is a {@link ExtractedSchema} object. This function verifies that the input is a non-null object, contains a `schema` property that is a JSON Schema (draft-07) object, contains an `input` property that is a non-null object, and has a `variant` property that is one of the allowed schema variants ("json-schema", "standard-schema", "zod3", or "reflection"). If all these conditions are met, the function returns `true`, indicating that the input is a valid {@link ExtractedSchema}; otherwise, it returns `false`.
|
|
61
|
-
*
|
|
62
|
-
* @param input - The input to check for being a {@link ExtractedSchema}.
|
|
63
|
-
* @returns `true` if the input is a {@link ExtractedSchema}, otherwise `false`.
|
|
64
|
-
*/
|
|
65
165
|
function isExtractedSchema(input) {
|
|
66
|
-
return isSchema(input) && "source" in input && isSetObject(input.source) && "schema" in input.source &&
|
|
166
|
+
return isSchema(input) && "source" in input && isSetObject(input.source) && "schema" in input.source && "variant" in input.source && isSetString(input.source.variant);
|
|
67
167
|
}
|
|
68
168
|
|
|
69
169
|
//#endregion
|
|
70
|
-
export { isExtractedSchema,
|
|
170
|
+
export { isExtractedSchema, isJsonSchema, isJsonSchemaObject, isNullOnlyJsonSchema, isSchema, isUntypedInput, isUntypedSchema };
|
|
71
171
|
//# sourceMappingURL=type-checks.mjs.map
|
package/dist/type-checks.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-checks.mjs","names":[],"sources":["../src/type-checks.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\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/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isJsonSchemaObjectType } from \"@stryke/json/schema\";\nimport { isFunction, isSetObject, isSetString } from \"@stryke/type-checks\";\nimport { JTDSchemaType } from \"ajv/dist/types/jtd-schema\";\nimport {\n InputObject as UntypedInputObject,\n Schema as UntypedSchema\n} from \"untyped\";\nimport { ExtractedSchema, Schema, SchemaMetadata } from \"./types\";\n\n/**\n * Type guard to check if a given input is a [JSON Type Definition (JTD) schema object](https://tools.ietf.org/html/rfc8927). This function verifies that the input is a non-null object, contains a `jtd` property that is set to `true`, and has a `schema` property that is a JSON Schema (draft-07) object. If all these conditions are met, the function returns `true`, indicating that the input is a valid JTD schema; otherwise, it returns `false`.\n *\n * @param input - The input to check for being a [JTD schema](https://tools.ietf.org/html/rfc8927).\n * @returns `true` if the input is a [JTD schema](https://tools.ietf.org/html/rfc8927), otherwise `false`.\n */\nexport function isJTDSchema<TMetadata extends SchemaMetadata = SchemaMetadata>(\n input: unknown\n): input is JTDSchemaType<TMetadata> {\n return isJsonSchemaObjectType(input) && \"jtd\" in input && input.jtd === true;\n}\n\n/**\n * Type guard to check if a given input is an [untyped](https://github.com/unjs/untyped) {@link UntypedSchema | Schema} object. This function verifies that the input is a non-null object whose optional metadata properties (`id`, `title`, `description`, `$schema`, `tsType`, `markdownType`, `type`, `required`, `tags`, `args`, `properties`, and `resolve`) - when present - match the shapes declared by `untyped`'s [`Schema`](https://github.com/unjs/untyped/blob/main/src/types.ts) interface.\n *\n * @param input - The input to check for being an [untyped](https://github.com/unjs/untyped) schema.\n * @returns `true` if the input is an [untyped](https://github.com/unjs/untyped) schema, otherwise `false`.\n */\nexport function isUntypedSchema(input: unknown): input is UntypedSchema {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n if (\"id\" in schema && !isSetString(schema.id)) {\n return false;\n }\n if (\"title\" in schema && !isSetString(schema.title)) {\n return false;\n }\n if (\"description\" in schema && !isSetString(schema.description)) {\n return false;\n }\n if (\"$schema\" in schema && !isSetString(schema.$schema)) {\n return false;\n }\n if (\"tsType\" in schema && !isSetString(schema.tsType)) {\n return false;\n }\n if (\"markdownType\" in schema && !isSetString(schema.markdownType)) {\n return false;\n }\n if (\n \"type\" in schema &&\n !isSetString(schema.type) &&\n !Array.isArray(schema.type)\n ) {\n return false;\n }\n if (\"required\" in schema && !Array.isArray(schema.required)) {\n return false;\n }\n if (\"tags\" in schema && !Array.isArray(schema.tags)) {\n return false;\n }\n if (\"args\" in schema && !Array.isArray(schema.args)) {\n return false;\n }\n if (\"properties\" in schema && !isSetObject(schema.properties)) {\n return false;\n }\n if (\"resolve\" in schema && !isFunction(schema.resolve)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Type guard to check if a given input is an [untyped](https://github.com/unjs/untyped) {@link UntypedInputObject | InputObject}. This function verifies that the input is a non-null object and that any `untyped`-reserved `$`-prefixed properties have the expected shape: `$schema` (when present) must satisfy {@link isUntypedSchema} and `$resolve` (when present) must be a function. See `untyped`'s [`InputObject`](https://github.com/unjs/untyped/blob/main/src/types.ts) interface for the canonical definition.\n *\n * @param input - The input to check for being an [untyped](https://github.com/unjs/untyped) input object.\n * @returns `true` if the input is an [untyped](https://github.com/unjs/untyped) input object, otherwise `false`.\n */\nexport function isUntypedInput(input: unknown): input is UntypedInputObject {\n if (!isSetObject(input)) {\n return false;\n }\n\n const inputObject = input as Record<string, unknown>;\n if (\"$schema\" in inputObject && !isUntypedSchema(inputObject.$schema)) {\n return false;\n }\n if (\"$resolve\" in inputObject && !isFunction(inputObject.$resolve)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Type guard to check if a given input is a {@link Schema} object. This function verifies that the input is a non-null object, contains a `schema` property that is a JSON Schema (draft-07) object, contains an `input` property that is a non-null object, and has a `variant` property that is one of the allowed schema variants (\"json-schema\", \"standard-schema\", \"zod3\", or \"reflection\"). If all these conditions are met, the function returns `true`, indicating that the input is a valid {@link Schema}; otherwise, it returns `false`.\n *\n * @param input - The input to check for being a {@link Schema}.\n * @returns `true` if the input is a {@link Schema}, otherwise `false`.\n */\nexport function isSchema<TMetadata extends SchemaMetadata = SchemaMetadata>(\n input: unknown\n): input is Schema<TMetadata> {\n return (\n isSetObject(input) &&\n \"schema\" in input &&\n isJTDSchema(input.schema) &&\n \"input\" in input &&\n isSetObject(input.input) &&\n \"variant\" in input &&\n isSetString(input.variant)\n );\n}\n\n/**\n * Type guard to check if a given input is a {@link ExtractedSchema} object. This function verifies that the input is a non-null object, contains a `schema` property that is a JSON Schema (draft-07) object, contains an `input` property that is a non-null object, and has a `variant` property that is one of the allowed schema variants (\"json-schema\", \"standard-schema\", \"zod3\", or \"reflection\"). If all these conditions are met, the function returns `true`, indicating that the input is a valid {@link ExtractedSchema}; otherwise, it returns `false`.\n *\n * @param input - The input to check for being a {@link ExtractedSchema}.\n * @returns `true` if the input is a {@link ExtractedSchema}, otherwise `false`.\n */\nexport function isExtractedSchema<\n TMetadata extends SchemaMetadata = SchemaMetadata\n>(input: unknown): input is ExtractedSchema<TMetadata> {\n return (\n isSchema<TMetadata>(input) &&\n \"source\" in input &&\n isSetObject(input.source) &&\n \"schema\" in input.source &&\n isJTDSchema(input.source.schema) &&\n \"variant\" in input.source &&\n isSetString(input.source.variant)\n );\n}\n"],"mappings":";;;;;;;;;;AAiCA,SAAgB,YACd,OACmC;AACnC,QAAO,uBAAuB,MAAM,IAAI,SAAS,SAAS,MAAM,QAAQ;;;;;;;;AAS1E,SAAgB,gBAAgB,OAAwC;AACtE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M,QAAQ;;;;;;;;AAU9B,SAAgB,kBAEd,OAAqD;AACrD,QACE,SAAoB,MAAM,IAC1B,YAAY,SACZ,YAAY,MAAM,OAAO,IACzB,YAAY,MAAM,UAClB,YAAY,MAAM,OAAO,OAAO,IAChC,aAAa,MAAM,UACnB,YAAY,MAAM,OAAO,QAAQ"}
|
|
1
|
+
{"version":3,"file":"type-checks.mjs","names":[],"sources":["../src/type-checks.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\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/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isJsonSchemaObjectType } from \"@stryke/json\";\nimport {\n isFunction,\n isObject,\n isSetObject,\n isSetString\n} from \"@stryke/type-checks\";\nimport {\n InputObject as UntypedInputObject,\n Schema as UntypedSchema\n} from \"untyped\";\nimport { JSON_SCHEMA_DATA_TYPES } from \"./constants\";\nimport { ExtractedSchema, JsonSchema, JsonSchemaObject, Schema } from \"./types\";\n\ntype JsonSchemaDataType = (typeof JSON_SCHEMA_DATA_TYPES)[number];\n\nconst JSON_SCHEMA_DATA_TYPE_SET = new Set<JsonSchemaDataType>(\n JSON_SCHEMA_DATA_TYPES\n);\n\ntype SchemaKeywordValidator = (value: unknown) => boolean;\n\nconst isSetNumber = (value: unknown): value is number =>\n typeof value === \"number\" && Number.isFinite(value);\n\nconst isSetBoolean = (value: unknown): value is boolean =>\n typeof value === \"boolean\";\n\nconst isNonNegativeInteger = (value: unknown): value is number =>\n Number.isInteger(value) && (value as number) >= 0;\n\nconst isSchemaLikeValue = (value: unknown): boolean =>\n isSetObject(value) || isSetBoolean(value);\n\nconst isStringArray = (value: unknown): value is string[] =>\n Array.isArray(value) && value.every(item => isSetString(item));\n\nconst isRecordOfStringArrays = (\n value: unknown\n): value is Record<string, string[]> =>\n isSetObject(value) && Object.values(value).every(item => isStringArray(item));\n\nconst TYPE_KEYWORD_VALIDATORS: Record<\n JsonSchemaDataType,\n Record<string, SchemaKeywordValidator>\n> = {\n string: {\n minLength: isNonNegativeInteger,\n maxLength: isNonNegativeInteger,\n pattern: isSetString,\n format: isSetString,\n contentEncoding: isSetString,\n contentMediaType: isSetString\n },\n number: {\n minimum: isSetNumber,\n maximum: isSetNumber,\n exclusiveMinimum: isSetNumber,\n exclusiveMaximum: isSetNumber,\n multipleOf: isSetNumber\n },\n integer: {\n minimum: isSetNumber,\n maximum: isSetNumber,\n exclusiveMinimum: isSetNumber,\n exclusiveMaximum: isSetNumber,\n multipleOf: isSetNumber\n },\n boolean: {},\n array: {\n items: isSchemaLikeValue,\n prefixItems: Array.isArray,\n contains: isSchemaLikeValue,\n minItems: isNonNegativeInteger,\n maxItems: isNonNegativeInteger,\n uniqueItems: isSetBoolean,\n minContains: isNonNegativeInteger,\n maxContains: isNonNegativeInteger\n },\n object: {\n properties: isSetObject,\n patternProperties: isSetObject,\n additionalProperties: isSchemaLikeValue,\n required: isStringArray,\n minProperties: isNonNegativeInteger,\n maxProperties: isNonNegativeInteger,\n dependentRequired: isRecordOfStringArrays,\n dependentSchemas: isSetObject,\n propertyNames: isSchemaLikeValue,\n unevaluatedProperties: isSchemaLikeValue\n },\n null: {}\n};\n\n/**\n * Type guard for JSON Schema types.\n *\n * @remarks\n * This function checks if the input is a JSON Schema type, which is defined as having a `type` property or a `$ref` property. This is used to determine if a given input conforms to the structure of a JSON Schema definition that includes type information.\n *\n * @param input - The value to check.\n * @returns True if the input is a JSON Schema type, false otherwise.\n */\nexport function isJsonSchema<T = unknown>(\n input: unknown\n): input is JsonSchema<T> {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n\n if (\"$ref\" in schema && isSetString(schema.$ref)) {\n return true;\n }\n\n if (!(\"type\" in schema)) {\n return false;\n }\n\n const schemaTypes: JsonSchemaDataType[] = [];\n\n if (isSetString(schema.type)) {\n if (!JSON_SCHEMA_DATA_TYPE_SET.has(schema.type as JsonSchemaDataType)) {\n return false;\n }\n\n schemaTypes.push(schema.type as JsonSchemaDataType);\n } else if (Array.isArray(schema.type) && schema.type.length > 0) {\n if (\n !schema.type.every(\n schemaType =>\n isSetString(schemaType) &&\n JSON_SCHEMA_DATA_TYPE_SET.has(schemaType as JsonSchemaDataType)\n ) ||\n new Set(schema.type).size !== schema.type.length\n ) {\n return false;\n }\n\n schemaTypes.push(...(schema.type as JsonSchemaDataType[]));\n } else {\n return false;\n }\n\n const typeKeywordValidators = schemaTypes.flatMap(schemaType =>\n Object.entries(TYPE_KEYWORD_VALIDATORS[schemaType])\n );\n\n for (const [keyword, validator] of typeKeywordValidators) {\n if (keyword in schema && !validator(schema[keyword])) {\n return false;\n }\n }\n\n if (\n \"minItems\" in schema &&\n \"maxItems\" in schema &&\n isNonNegativeInteger(schema.minItems) &&\n isNonNegativeInteger(schema.maxItems) &&\n schema.minItems > schema.maxItems\n ) {\n return false;\n }\n\n if (\n \"minLength\" in schema &&\n \"maxLength\" in schema &&\n isNonNegativeInteger(schema.minLength) &&\n isNonNegativeInteger(schema.maxLength) &&\n schema.minLength > schema.maxLength\n ) {\n return false;\n }\n\n if (\n \"minProperties\" in schema &&\n \"maxProperties\" in schema &&\n isNonNegativeInteger(schema.minProperties) &&\n isNonNegativeInteger(schema.maxProperties) &&\n schema.minProperties > schema.maxProperties\n ) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Type guard for JSON Schema object forms.\n *\n * @remarks\n * This function checks if the input is a JSON Schema object type, which is defined as having a `type` property equal to \"object\" or having a `properties` object. This is used to determine if a given input conforms to the structure of a JSON Schema object definition.\n *\n * @param input - The value to check.\n * @returns True if the input is a JSON Schema object type, false otherwise.\n */\nexport function isJsonSchemaObject<\n T extends Record<string, any> = Record<string, any>\n>(input: unknown): input is JsonSchemaObject<T> {\n return (\n isJsonSchemaObjectType(input) &&\n (input.type === \"object\" || isObject(input.properties))\n );\n}\n\n/**\n * Type guard for JSON Schemas that only accept `null`.\n *\n * @remarks\n * This function checks if the input is a JSON Schema that exclusively accepts the `null` type. It verifies that the input is a valid JSON Schema and that its `type` property is set to \"null\". This is useful for identifying schemas that are specifically designed to allow only `null` values.\n *\n * @param input - The value to check.\n * @returns True if the input is a JSON Schema that only accepts `null`, false otherwise.\n */\nexport function isNullOnlyJsonSchema(\n input: unknown\n): input is JsonSchema<null> {\n return isJsonSchema(input) && input.type === \"null\";\n}\n\n/**\n * Type guard for untyped schema objects.\n *\n * @remarks\n * This function checks if the input is an untyped schema object, which is defined as having certain properties that are commonly found in untyped schema definitions. This includes properties such as `id`, `title`, `description`, `$schema`, `tsType`, `markdownType`, `type`, `required`, `tags`, `args`, `properties`, and `resolve`. The function verifies that these properties, if present, conform to the expected types (e.g., strings for certain properties, arrays for others). This type guard is used to determine if a given input can be treated as an untyped schema object within the context of the Powerlines schema system.\n *\n * @param input - The value to check.\n * @returns True if the input is an untyped schema object, false otherwise.\n */\nexport function isUntypedSchema(input: unknown): input is UntypedSchema {\n if (!isSetObject(input)) {\n return false;\n }\n\n const schema = input as Record<string, unknown>;\n if (\"id\" in schema && !isSetString(schema.id)) {\n return false;\n }\n if (\"title\" in schema && !isSetString(schema.title)) {\n return false;\n }\n if (\"description\" in schema && !isSetString(schema.description)) {\n return false;\n }\n if (\"$schema\" in schema && !isSetString(schema.$schema)) {\n return false;\n }\n if (\"tsType\" in schema && !isSetString(schema.tsType)) {\n return false;\n }\n if (\"markdownType\" in schema && !isSetString(schema.markdownType)) {\n return false;\n }\n if (\n \"type\" in schema &&\n !isSetString(schema.type) &&\n !Array.isArray(schema.type)\n ) {\n return false;\n }\n if (\"required\" in schema && !Array.isArray(schema.required)) {\n return false;\n }\n if (\"tags\" in schema && !Array.isArray(schema.tags)) {\n return false;\n }\n if (\"args\" in schema && !Array.isArray(schema.args)) {\n return false;\n }\n if (\"properties\" in schema && !isSetObject(schema.properties)) {\n return false;\n }\n if (\"resolve\" in schema && !isFunction(schema.resolve)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Type guard for untyped input objects.\n *\n * @remarks\n * This function checks if the input is an untyped input object, which is defined as having certain properties that are commonly found in untyped input definitions. This includes properties such as `$schema` and `$resolve`. The function verifies that these properties, if present, conform to the expected types (e.g., objects for `$schema`, functions for `$resolve`). This type guard is used to determine if a given input can be treated as an untyped input object within the context of the Powerlines schema system.\n *\n * @param input - The value to check.\n * @returns True if the input is an untyped input object, false otherwise.\n */\nexport function isUntypedInput(input: unknown): input is UntypedInputObject {\n if (!isSetObject(input)) {\n return false;\n }\n\n const inputObject = input as Record<string, unknown>;\n if (\"$schema\" in inputObject && !isUntypedSchema(inputObject.$schema)) {\n return false;\n }\n if (\"$resolve\" in inputObject && !isFunction(inputObject.$resolve)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Type guard for Powerlines Schema objects.\n *\n * @param input - The value to check.\n * @returns True if the input is a Powerlines Schema object, false otherwise.\n */\nexport function isSchema<T = unknown>(input: unknown): input is Schema<T> {\n return (\n isSetObject(input) &&\n \"schema\" in input &&\n isJsonSchema(input.schema) &&\n \"variant\" in input &&\n isSetString(input.variant) &&\n \"hash\" in input &&\n isSetString(input.hash)\n );\n}\n\nexport function isExtractedSchema<T = unknown>(\n input: unknown\n): input is ExtractedSchema<T> {\n return (\n isSchema<T>(input) &&\n \"source\" in input &&\n isSetObject(input.source) &&\n \"schema\" in input.source &&\n \"variant\" in input.source &&\n isSetString(input.source.variant)\n );\n}\n"],"mappings":";;;;;AAkCA,MAAM,4BAA4B,IAAI,IACpC,sBACF;AAIA,MAAM,eAAe,UACnB,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK;AAEpD,MAAM,gBAAgB,UACpB,OAAO,UAAU;AAEnB,MAAM,wBAAwB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