@power-plant/schema 0.0.36 → 0.0.37

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/codegen.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_helpers = require('./helpers-CQS3qnsv.cjs');
2
+ const require_helpers = require('./helpers-DbFdMcOB.cjs');
3
3
  let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
4
4
  let _stryke_type_checks = require("@stryke/type-checks");
5
5
  let _stryke_string_format_list = require("@stryke/string-format/list");
@@ -1,4 +1,4 @@
1
- import { W as JsonSchemaType, a as JsonSchema } from "./types-CEGqfUA4.cjs";
1
+ import { G as JsonSchemaType, a as JsonSchema } from "./types-BH-Q7QrB.cjs";
2
2
  //#region src/codegen.d.ts
3
3
  /**
4
4
  * Stringifies a value for generated TypeScript code.
@@ -1,4 +1,4 @@
1
- import { W as JsonSchemaType, a as JsonSchema } from "./types-OH3Npqz2.mjs";
1
+ import { G as JsonSchemaType, a as JsonSchema } from "./types-BrSNvUQg.mjs";
2
2
  //#region src/codegen.d.ts
3
3
  /**
4
4
  * Stringifies a value for generated TypeScript code.
package/dist/codegen.mjs CHANGED
@@ -1,20 +1,20 @@
1
- import { F as isJsonSchemaObject, O as isJsonSchemaLiteral, V as isJsonSchemaString, a as getPropertiesList, c as isSchemaNullable, d as merge, g as isJsonSchema, st as getPrimarySchemaType } from "./helpers-BxWdDZn4.mjs";
1
+ import { F as isJsonSchemaObject, O as isJsonSchemaLiteral, V as isJsonSchemaString, a as getPropertiesList, c as isSchemaNullable, d as merge, g as isJsonSchema, st as getPrimarySchemaType } from "./helpers-_8ADIMSN.mjs";
2
2
  import { isSetString } from "@stryke/type-checks/is-set-string";
3
3
  import { isInteger, isObject, isSetArray, isString } from "@stryke/type-checks";
4
4
  import { list } from "@stryke/string-format/list";
5
5
  import { toBool } from "@stryke/convert/to-bool";
6
6
  import { camelCase } from "@stryke/string-format/camel-case";
7
7
  import { isBoolean as isBoolean$1 } from "@stryke/type-checks/is-boolean";
8
- import { isNull } from "@stryke/type-checks/is-null";
9
- import { isNumber } from "@stryke/type-checks/is-number";
10
- import { isUndefined } from "@stryke/type-checks/is-undefined";
8
+ import { isNull as isNull$1 } from "@stryke/type-checks/is-null";
9
+ import { isNumber as isNumber$1 } from "@stryke/type-checks/is-number";
10
+ import { isUndefined as isUndefined$1 } from "@stryke/type-checks/is-undefined";
11
11
 
12
12
  //#region src/codegen.ts
13
13
  /**
14
14
  * Stringifies a value for generated TypeScript code.
15
15
  */
16
16
  function stringifyValue(value, type) {
17
- return isUndefined(value) ? "undefined" : isNull(value) ? "null" : type === "boolean" || isBoolean$1(value) ? String(toBool(value)) : type === "number" || isNumber(value) ? Number.parseFloat(String(value)).toLocaleString(void 0, { maximumFractionDigits: 20 }) : type === "integer" ? Number.parseInt(String(value)).toLocaleString() : type === "string" || type === "object" || type === "array" ? JSON.stringify(value) : String(value);
17
+ return isUndefined$1(value) ? "undefined" : isNull$1(value) ? "null" : type === "boolean" || isBoolean$1(value) ? String(toBool(value)) : type === "number" || isNumber$1(value) ? Number.parseFloat(String(value)).toLocaleString(void 0, { maximumFractionDigits: 20 }) : type === "integer" ? Number.parseInt(String(value)).toLocaleString() : type === "string" || type === "object" || type === "array" ? JSON.stringify(value) : String(value);
18
18
  }
19
19
  /**
20
20
  * Stringifies a JSON Schema fragment into a TypeScript-like type string.
@@ -25,7 +25,7 @@ function stringifyType(schema) {
25
25
  if (isJsonSchemaObject(schema) && isSetString(schema.name)) return schema.name;
26
26
  const objectSchema = schema;
27
27
  if (isSetString(objectSchema.$ref)) return /^#\/(?:definitions|\$defs)\/(.+)$/.exec(objectSchema.$ref)?.[1] ?? objectSchema.$ref;
28
- if (isJsonSchemaLiteral(schema) && !isUndefined(schema.const)) return JSON.stringify(isSetString(schema.const) ? schema.const.replaceAll(/^['"`]|['"`]$/g, "") : schema.const);
28
+ if (isJsonSchemaLiteral(schema) && !isUndefined$1(schema.const)) return JSON.stringify(isSetString(schema.const) ? schema.const.replaceAll(/^['"`]|['"`]$/g, "") : schema.const);
29
29
  const primaryType = getPrimarySchemaType(schema);
30
30
  if (primaryType) {
31
31
  if (primaryType === "integer" || primaryType === "number") return "number";
@@ -55,7 +55,7 @@ function stringifyType(schema) {
55
55
  * @returns A string representation of the value's type, which may be influenced by the provided JSON Schema primitive type hint. The function handles various JavaScript types and formats them accordingly, including special handling for `undefined`, `null`, booleans, numbers (with formatting), strings, objects, and arrays. If a specific type hint is provided, it will take precedence in determining the string representation of the value.
56
56
  */
57
57
  function getJsonSchemaType(value) {
58
- return isNull(value) ? "null" : isBoolean$1(value) ? "boolean" : isInteger(value) ? "integer" : isNumber(value) ? "number" : isString(value) ? "string" : isObject(value) ? "object" : Array.isArray(value) ? "array" : void 0;
58
+ return isNull$1(value) ? "null" : isBoolean$1(value) ? "boolean" : isInteger(value) ? "integer" : isNumber$1(value) ? "number" : isString(value) ? "string" : isObject(value) ? "object" : Array.isArray(value) ? "array" : void 0;
59
59
  }
60
60
  /**
61
61
  * Resolves a local JSON Schema `$ref` (e.g. `#/$defs/Name`) to the referenced definition name.
@@ -5,9 +5,9 @@ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-stri
5
5
  let _stryke_type_checks = require("@stryke/type-checks");
6
6
  let _stryke_path_find = require("@stryke/path/find");
7
7
  let _stryke_resolve_constants = require("@stryke/resolve/constants");
8
- let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
9
8
  let defu = require("defu");
10
9
  defu = require_rolldown_runtime.__toESM(defu, 1);
10
+ let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
11
11
 
12
12
  //#region src/metadata.ts
13
13
  /**
@@ -4,8 +4,8 @@ import { isSetString } from "@stryke/type-checks/is-set-string";
4
4
  import { isBoolean, isFunction, isSetObject as isSetObject$1, isSetString as isSetString$1, isString } from "@stryke/type-checks";
5
5
  import { findFileExtensionSafe } from "@stryke/path/find";
6
6
  import { VALID_OBJECT_SOURCE_EXTENSIONS } from "@stryke/resolve/constants";
7
- import { getUnique } from "@stryke/helpers/get-unique";
8
7
  import defu from "defu";
8
+ import { getUnique } from "@stryke/helpers/get-unique";
9
9
 
10
10
  //#region src/metadata.ts
11
11
  /**
@@ -939,4 +939,4 @@ function traverseSchema(schema, callback) {
939
939
 
940
940
  //#endregion
941
941
  export { isUntypedConfig as $, isJsonSchemaNativeEnum as A, isJsonSchemaSet as B, isJsonSchemaDate as C, isJsonSchemaKeywords as D, isJsonSchemaInteger as E, isJsonSchemaObject as F, isJsonSchemaUnion as G, isJsonSchemaTuple as H, isJsonSchemaPrimitiveType as I, isSchema as J, isJsonSchemaUnknown as K, isJsonSchemaPrimitiveUnion as L, isJsonSchemaNull as M, isJsonSchemaNullable as N, isJsonSchemaLiteral as O, isJsonSchemaNumber as P, isStandardSchema as Q, isJsonSchemaRecord as R, isJsonSchemaBoolean as S, isJsonSchemaEnum as T, isJsonSchemaType as U, isJsonSchemaString as V, isJsonSchemaUndefined as W, isSchemaOf as X, isSchemaObject as Y, isSchemaWithSource as Z, isJsonSchemaAllOf as _, getPropertiesList as a, isValibotSchema as at, isJsonSchemaArray as b, isSchemaNullable as c, readSchemaTypes as ct, merge as d, isUntypedConfigStrict as et, mergeMetadata as f, isJsonSchema as g, isFileReference as h, getProperties as i, isUntypedSchemaStrict as it, isJsonSchemaNever as j, isJsonSchemaMap as k, isValidSchemaConfigFile as l, hasJsonSchemaConstructorFlag as m, getJsonSchema as n, isUntypedInputStrict as nt, getProperty as o, applyJsonSchemaMetadata as ot, traverseSchema as p, isNullOnlyJsonSchema as q, getJsonSchemaObject as r, isUntypedSchema as rt, isPropertyOptional as s, getPrimarySchemaType as st, addProperty as t, isUntypedInput as tt, isValidSchemaInputFile as u, isJsonSchemaAny as v, isJsonSchemaDecimal as w, isJsonSchemaBigint as x, isJsonSchemaAnyOf as y, isJsonSchemaRef as z };
942
- //# sourceMappingURL=helpers-BxWdDZn4.mjs.map
942
+ //# sourceMappingURL=helpers-_8ADIMSN.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers-_8ADIMSN.mjs","names":[],"sources":[],"mappings":""}