@orpc/json-schema 2.0.0-beta.36 → 2.0.0-beta.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/index.d.mts CHANGED
@@ -54,7 +54,6 @@ declare enum JsonSchemaFormat {
54
54
  }
55
55
  declare enum JsonSchemaXNativeType {
56
56
  BigInt = "bigint",
57
- RegExp = "regexp",
58
57
  Date = "date",
59
58
  Url = "url",
60
59
  Set = "set",
package/dist/index.d.ts CHANGED
@@ -54,7 +54,6 @@ declare enum JsonSchemaFormat {
54
54
  }
55
55
  declare enum JsonSchemaXNativeType {
56
56
  BigInt = "bigint",
57
- RegExp = "regexp",
58
57
  Date = "date",
59
58
  Url = "url",
60
59
  Set = "set",
package/dist/index.mjs CHANGED
@@ -69,7 +69,8 @@ function visitJsonSchemaRefs(value, visit, schemaLevel = true, seen = /* @__PURE
69
69
  }
70
70
  return;
71
71
  }
72
- for (const [key, val] of Object.entries(value)) {
72
+ for (const key of Object.keys(value)) {
73
+ const val = value[key];
73
74
  if (key === "$ref" && typeof val === "string") {
74
75
  visit(val);
75
76
  } else if (!schemaLevel) {
@@ -87,7 +88,8 @@ function mapJsonSchemaRefs(value, map, schemaLevel = true, path = []) {
87
88
  return value.map((item, index) => mapJsonSchemaRefs(item, map, schemaLevel, [...path, index]));
88
89
  }
89
90
  const result = {};
90
- for (const [key, val] of Object.entries(value)) {
91
+ for (const key of Object.keys(value)) {
92
+ const val = value[key];
91
93
  if (key === "$ref" && typeof val === "string") {
92
94
  result[key] = map(val, [...path, key]);
93
95
  } else if (!schemaLevel) {
@@ -192,7 +194,6 @@ var JsonSchemaFormat = /* @__PURE__ */ ((JsonSchemaFormat2) => {
192
194
  })(JsonSchemaFormat || {});
193
195
  var JsonSchemaXNativeType = /* @__PURE__ */ ((JsonSchemaXNativeType2) => {
194
196
  JsonSchemaXNativeType2["BigInt"] = "bigint";
195
- JsonSchemaXNativeType2["RegExp"] = "regexp";
196
197
  JsonSchemaXNativeType2["Date"] = "date";
197
198
  JsonSchemaXNativeType2["Url"] = "url";
198
199
  JsonSchemaXNativeType2["Set"] = "set";
@@ -339,7 +340,8 @@ class JsonSchemaCoercer {
339
340
  return pattern ? [[pattern, value2]] : [];
340
341
  });
341
342
  const propertySchemas = schema.properties ?? {};
342
- for (const [key, value2] of Object.entries(coerced)) {
343
+ for (const key of Object.keys(coerced)) {
344
+ const value2 = coerced[key];
343
345
  const subSchema = getOwn(propertySchemas, key) ?? patternProperties.find(([pattern]) => pattern.test(key))?.[1] ?? schema.additionalProperties;
344
346
  if (value2 !== void 0 || schema.required?.includes(key)) {
345
347
  if (subSchema === void 0) {
@@ -392,15 +394,6 @@ class JsonSchemaCoercer {
392
394
  }
393
395
  break;
394
396
  }
395
- case JsonSchemaXNativeType.RegExp: {
396
- if (typeof coerced === "string") {
397
- coerced = stringToRegExp(coerced);
398
- }
399
- if (!(coerced instanceof RegExp)) {
400
- satisfied = UNSATISFIED;
401
- }
402
- break;
403
- }
404
397
  case JsonSchemaXNativeType.Url: {
405
398
  if (typeof coerced === "string") {
406
399
  coerced = stringToURL(coerced);
@@ -525,15 +518,6 @@ function stringToDate(value) {
525
518
  }
526
519
  return date;
527
520
  }
528
- const REGEXP_PATTERN = /^\/([\s\S]*)\/([a-z]*)$/;
529
- function stringToRegExp(value) {
530
- const match = value.match(REGEXP_PATTERN);
531
- if (match) {
532
- const [, pattern, flags] = match;
533
- return tryOrUndefined(() => new RegExp(pattern, flags)) ?? value;
534
- }
535
- return value;
536
- }
537
521
  function stringToURL(value) {
538
522
  return tryOrUndefined(() => new URL(value)) ?? value;
539
523
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/json-schema",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.36",
4
+ "version": "2.0.0-beta.37",
5
5
  "description": "JSON Schema conversion and smart request coercion for oRPC and OpenAPI",
6
6
  "license": "MIT",
7
7
  "funding": [
@@ -36,10 +36,10 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@openapi-spec/types": "~0.1.0",
39
- "@orpc/client": "2.0.0-beta.36",
40
- "@orpc/contract": "2.0.0-beta.36",
41
- "@orpc/server": "2.0.0-beta.36",
42
- "@orpc/shared": "2.0.0-beta.36",
39
+ "@orpc/client": "2.0.0-beta.37",
40
+ "@orpc/contract": "2.0.0-beta.37",
41
+ "@orpc/server": "2.0.0-beta.37",
42
+ "@orpc/shared": "2.0.0-beta.37",
43
43
  "@standard-schema/spec": "^1.1.0"
44
44
  },
45
45
  "devDependencies": {