@orpc/openapi 0.0.0-next.568a5ad → 0.0.0-next.6a7b82f
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/fetch.js +6 -6
- package/dist/index.js +45 -181
- package/package.json +7 -7
package/dist/fetch.js
CHANGED
|
@@ -187,13 +187,13 @@ function openAPIPathToRouterPath(path) {
|
|
|
187
187
|
return standardizeHTTPPath(path).replace(/\{([^}]+)\}/g, ":$1");
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
// ../../node_modules/.pnpm/hono@4.6.
|
|
190
|
+
// ../../node_modules/.pnpm/hono@4.6.12/node_modules/hono/dist/router.js
|
|
191
191
|
var METHOD_NAME_ALL = "ALL";
|
|
192
192
|
var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is already built.";
|
|
193
193
|
var UnsupportedPathError = class extends Error {
|
|
194
194
|
};
|
|
195
195
|
|
|
196
|
-
// ../../node_modules/.pnpm/hono@4.6.
|
|
196
|
+
// ../../node_modules/.pnpm/hono@4.6.12/node_modules/hono/dist/utils/url.js
|
|
197
197
|
var checkOptionalParameter = (path) => {
|
|
198
198
|
if (!path.match(/\:.+\?$/)) {
|
|
199
199
|
return null;
|
|
@@ -222,7 +222,7 @@ var checkOptionalParameter = (path) => {
|
|
|
222
222
|
return results.filter((v, i, a) => a.indexOf(v) === i);
|
|
223
223
|
};
|
|
224
224
|
|
|
225
|
-
// ../../node_modules/.pnpm/hono@4.6.
|
|
225
|
+
// ../../node_modules/.pnpm/hono@4.6.12/node_modules/hono/dist/router/reg-exp-router/node.js
|
|
226
226
|
var LABEL_REG_EXP_STR = "[^/]+";
|
|
227
227
|
var ONLY_WILDCARD_REG_EXP_STR = ".*";
|
|
228
228
|
var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
|
|
@@ -327,7 +327,7 @@ var Node = class {
|
|
|
327
327
|
}
|
|
328
328
|
};
|
|
329
329
|
|
|
330
|
-
// ../../node_modules/.pnpm/hono@4.6.
|
|
330
|
+
// ../../node_modules/.pnpm/hono@4.6.12/node_modules/hono/dist/router/reg-exp-router/trie.js
|
|
331
331
|
var Trie = class {
|
|
332
332
|
#context = { varIndex: 0 };
|
|
333
333
|
#root = new Node();
|
|
@@ -383,7 +383,7 @@ var Trie = class {
|
|
|
383
383
|
}
|
|
384
384
|
};
|
|
385
385
|
|
|
386
|
-
// ../../node_modules/.pnpm/hono@4.6.
|
|
386
|
+
// ../../node_modules/.pnpm/hono@4.6.12/node_modules/hono/dist/router/reg-exp-router/router.js
|
|
387
387
|
var emptyParam = [];
|
|
388
388
|
var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
|
|
389
389
|
var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
@@ -584,7 +584,7 @@ function createOpenAPIServerHandler() {
|
|
|
584
584
|
return createOpenAPIHandler(() => new RegExpRouter());
|
|
585
585
|
}
|
|
586
586
|
|
|
587
|
-
// ../../node_modules/.pnpm/hono@4.6.
|
|
587
|
+
// ../../node_modules/.pnpm/hono@4.6.12/node_modules/hono/dist/router/linear-router/router.js
|
|
588
588
|
var emptyParams = /* @__PURE__ */ Object.create(null);
|
|
589
589
|
var splitPathRe = /\/(:\w+(?:{(?:(?:{[\d,]+})|[^}])+})?)|\/[^\/\?]+|(\?)/g;
|
|
590
590
|
var splitByStarRe = /\*/;
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
Format
|
|
23
23
|
} from "json-schema-typed/draft-2020-12";
|
|
24
24
|
|
|
25
|
-
// ../../node_modules/.pnpm/zod@3.
|
|
25
|
+
// ../../node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.mjs
|
|
26
26
|
var util;
|
|
27
27
|
(function(util2) {
|
|
28
28
|
util2.assertEqual = (val) => val;
|
|
@@ -173,9 +173,6 @@ var ZodIssueCode = util.arrayToEnum([
|
|
|
173
173
|
"not_finite"
|
|
174
174
|
]);
|
|
175
175
|
var ZodError = class _ZodError extends Error {
|
|
176
|
-
get errors() {
|
|
177
|
-
return this.issues;
|
|
178
|
-
}
|
|
179
176
|
constructor(issues) {
|
|
180
177
|
super();
|
|
181
178
|
this.issues = [];
|
|
@@ -194,6 +191,9 @@ var ZodError = class _ZodError extends Error {
|
|
|
194
191
|
this.name = "ZodError";
|
|
195
192
|
this.issues = issues;
|
|
196
193
|
}
|
|
194
|
+
get errors() {
|
|
195
|
+
return this.issues;
|
|
196
|
+
}
|
|
197
197
|
format(_mapper) {
|
|
198
198
|
const mapper = _mapper || function(issue) {
|
|
199
199
|
return issue.message;
|
|
@@ -400,11 +400,8 @@ function addIssueToContext(ctx, issueData) {
|
|
|
400
400
|
path: ctx.path,
|
|
401
401
|
errorMaps: [
|
|
402
402
|
ctx.common.contextualErrorMap,
|
|
403
|
-
// contextual error map is first priority
|
|
404
403
|
ctx.schemaErrorMap,
|
|
405
|
-
// then schema-bound map if available
|
|
406
404
|
overrideMap,
|
|
407
|
-
// then global override map
|
|
408
405
|
overrideMap === errorMap ? void 0 : errorMap
|
|
409
406
|
// then global default map
|
|
410
407
|
].filter((x) => !!x)
|
|
@@ -555,6 +552,34 @@ function processCreateParams(params) {
|
|
|
555
552
|
return { errorMap: customMap, description };
|
|
556
553
|
}
|
|
557
554
|
var ZodType = class {
|
|
555
|
+
constructor(def) {
|
|
556
|
+
this.spa = this.safeParseAsync;
|
|
557
|
+
this._def = def;
|
|
558
|
+
this.parse = this.parse.bind(this);
|
|
559
|
+
this.safeParse = this.safeParse.bind(this);
|
|
560
|
+
this.parseAsync = this.parseAsync.bind(this);
|
|
561
|
+
this.safeParseAsync = this.safeParseAsync.bind(this);
|
|
562
|
+
this.spa = this.spa.bind(this);
|
|
563
|
+
this.refine = this.refine.bind(this);
|
|
564
|
+
this.refinement = this.refinement.bind(this);
|
|
565
|
+
this.superRefine = this.superRefine.bind(this);
|
|
566
|
+
this.optional = this.optional.bind(this);
|
|
567
|
+
this.nullable = this.nullable.bind(this);
|
|
568
|
+
this.nullish = this.nullish.bind(this);
|
|
569
|
+
this.array = this.array.bind(this);
|
|
570
|
+
this.promise = this.promise.bind(this);
|
|
571
|
+
this.or = this.or.bind(this);
|
|
572
|
+
this.and = this.and.bind(this);
|
|
573
|
+
this.transform = this.transform.bind(this);
|
|
574
|
+
this.brand = this.brand.bind(this);
|
|
575
|
+
this.default = this.default.bind(this);
|
|
576
|
+
this.catch = this.catch.bind(this);
|
|
577
|
+
this.describe = this.describe.bind(this);
|
|
578
|
+
this.pipe = this.pipe.bind(this);
|
|
579
|
+
this.readonly = this.readonly.bind(this);
|
|
580
|
+
this.isNullable = this.isNullable.bind(this);
|
|
581
|
+
this.isOptional = this.isOptional.bind(this);
|
|
582
|
+
}
|
|
558
583
|
get description() {
|
|
559
584
|
return this._def.description;
|
|
560
585
|
}
|
|
@@ -618,43 +643,6 @@ var ZodType = class {
|
|
|
618
643
|
const result = this._parseSync({ data, path: ctx.path, parent: ctx });
|
|
619
644
|
return handleResult(ctx, result);
|
|
620
645
|
}
|
|
621
|
-
"~validate"(data) {
|
|
622
|
-
var _a, _b;
|
|
623
|
-
const ctx = {
|
|
624
|
-
common: {
|
|
625
|
-
issues: [],
|
|
626
|
-
async: !!this["~standard"].async
|
|
627
|
-
},
|
|
628
|
-
path: [],
|
|
629
|
-
schemaErrorMap: this._def.errorMap,
|
|
630
|
-
parent: null,
|
|
631
|
-
data,
|
|
632
|
-
parsedType: getParsedType(data)
|
|
633
|
-
};
|
|
634
|
-
if (!this["~standard"].async) {
|
|
635
|
-
try {
|
|
636
|
-
const result = this._parseSync({ data, path: [], parent: ctx });
|
|
637
|
-
return isValid(result) ? {
|
|
638
|
-
value: result.value
|
|
639
|
-
} : {
|
|
640
|
-
issues: ctx.common.issues
|
|
641
|
-
};
|
|
642
|
-
} catch (err) {
|
|
643
|
-
if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes("encountered")) {
|
|
644
|
-
this["~standard"].async = true;
|
|
645
|
-
}
|
|
646
|
-
ctx.common = {
|
|
647
|
-
issues: [],
|
|
648
|
-
async: true
|
|
649
|
-
};
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
|
|
653
|
-
value: result.value
|
|
654
|
-
} : {
|
|
655
|
-
issues: ctx.common.issues
|
|
656
|
-
});
|
|
657
|
-
}
|
|
658
646
|
async parseAsync(data, params) {
|
|
659
647
|
const result = await this.safeParseAsync(data, params);
|
|
660
648
|
if (result.success)
|
|
@@ -732,39 +720,6 @@ var ZodType = class {
|
|
|
732
720
|
superRefine(refinement) {
|
|
733
721
|
return this._refinement(refinement);
|
|
734
722
|
}
|
|
735
|
-
constructor(def) {
|
|
736
|
-
this.spa = this.safeParseAsync;
|
|
737
|
-
this._def = def;
|
|
738
|
-
this.parse = this.parse.bind(this);
|
|
739
|
-
this.safeParse = this.safeParse.bind(this);
|
|
740
|
-
this.parseAsync = this.parseAsync.bind(this);
|
|
741
|
-
this.safeParseAsync = this.safeParseAsync.bind(this);
|
|
742
|
-
this.spa = this.spa.bind(this);
|
|
743
|
-
this.refine = this.refine.bind(this);
|
|
744
|
-
this.refinement = this.refinement.bind(this);
|
|
745
|
-
this.superRefine = this.superRefine.bind(this);
|
|
746
|
-
this.optional = this.optional.bind(this);
|
|
747
|
-
this.nullable = this.nullable.bind(this);
|
|
748
|
-
this.nullish = this.nullish.bind(this);
|
|
749
|
-
this.array = this.array.bind(this);
|
|
750
|
-
this.promise = this.promise.bind(this);
|
|
751
|
-
this.or = this.or.bind(this);
|
|
752
|
-
this.and = this.and.bind(this);
|
|
753
|
-
this.transform = this.transform.bind(this);
|
|
754
|
-
this.brand = this.brand.bind(this);
|
|
755
|
-
this.default = this.default.bind(this);
|
|
756
|
-
this.catch = this.catch.bind(this);
|
|
757
|
-
this.describe = this.describe.bind(this);
|
|
758
|
-
this.pipe = this.pipe.bind(this);
|
|
759
|
-
this.readonly = this.readonly.bind(this);
|
|
760
|
-
this.isNullable = this.isNullable.bind(this);
|
|
761
|
-
this.isOptional = this.isOptional.bind(this);
|
|
762
|
-
this["~standard"] = {
|
|
763
|
-
version: 1,
|
|
764
|
-
vendor: "zod",
|
|
765
|
-
validate: (data) => this["~validate"](data)
|
|
766
|
-
};
|
|
767
|
-
}
|
|
768
723
|
optional() {
|
|
769
724
|
return ZodOptional.create(this, this._def);
|
|
770
725
|
}
|
|
@@ -775,7 +730,7 @@ var ZodType = class {
|
|
|
775
730
|
return this.nullable().optional();
|
|
776
731
|
}
|
|
777
732
|
array() {
|
|
778
|
-
return ZodArray.create(this);
|
|
733
|
+
return ZodArray.create(this, this._def);
|
|
779
734
|
}
|
|
780
735
|
promise() {
|
|
781
736
|
return ZodPromise.create(this, this._def);
|
|
@@ -841,20 +796,16 @@ var ZodType = class {
|
|
|
841
796
|
};
|
|
842
797
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
|
843
798
|
var cuid2Regex = /^[0-9a-z]+$/;
|
|
844
|
-
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}
|
|
799
|
+
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
845
800
|
var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
|
|
846
801
|
var nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
|
847
|
-
var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
|
|
848
802
|
var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
|
|
849
803
|
var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
850
804
|
var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
851
805
|
var emojiRegex;
|
|
852
806
|
var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
853
|
-
var
|
|
854
|
-
var ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
|
|
855
|
-
var ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
807
|
+
var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
|
|
856
808
|
var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
857
|
-
var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
|
|
858
809
|
var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
|
|
859
810
|
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
860
811
|
function timeRegexSource(args) {
|
|
@@ -887,33 +838,6 @@ function isValidIP(ip, version) {
|
|
|
887
838
|
}
|
|
888
839
|
return false;
|
|
889
840
|
}
|
|
890
|
-
function isValidJWT(jwt, alg) {
|
|
891
|
-
if (!jwtRegex.test(jwt))
|
|
892
|
-
return false;
|
|
893
|
-
try {
|
|
894
|
-
const [header] = jwt.split(".");
|
|
895
|
-
const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
|
|
896
|
-
const decoded = JSON.parse(atob(base64));
|
|
897
|
-
if (typeof decoded !== "object" || decoded === null)
|
|
898
|
-
return false;
|
|
899
|
-
if (!decoded.typ || !decoded.alg)
|
|
900
|
-
return false;
|
|
901
|
-
if (alg && decoded.alg !== alg)
|
|
902
|
-
return false;
|
|
903
|
-
return true;
|
|
904
|
-
} catch (_a) {
|
|
905
|
-
return false;
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
function isValidCidr(ip, version) {
|
|
909
|
-
if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
|
|
910
|
-
return true;
|
|
911
|
-
}
|
|
912
|
-
if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
|
|
913
|
-
return true;
|
|
914
|
-
}
|
|
915
|
-
return false;
|
|
916
|
-
}
|
|
917
841
|
var ZodString = class _ZodString extends ZodType {
|
|
918
842
|
_parse(input) {
|
|
919
843
|
if (this._def.coerce) {
|
|
@@ -1170,26 +1094,6 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
1170
1094
|
});
|
|
1171
1095
|
status.dirty();
|
|
1172
1096
|
}
|
|
1173
|
-
} else if (check.kind === "jwt") {
|
|
1174
|
-
if (!isValidJWT(input.data, check.alg)) {
|
|
1175
|
-
ctx = this._getOrReturnCtx(input, ctx);
|
|
1176
|
-
addIssueToContext(ctx, {
|
|
1177
|
-
validation: "jwt",
|
|
1178
|
-
code: ZodIssueCode.invalid_string,
|
|
1179
|
-
message: check.message
|
|
1180
|
-
});
|
|
1181
|
-
status.dirty();
|
|
1182
|
-
}
|
|
1183
|
-
} else if (check.kind === "cidr") {
|
|
1184
|
-
if (!isValidCidr(input.data, check.version)) {
|
|
1185
|
-
ctx = this._getOrReturnCtx(input, ctx);
|
|
1186
|
-
addIssueToContext(ctx, {
|
|
1187
|
-
validation: "cidr",
|
|
1188
|
-
code: ZodIssueCode.invalid_string,
|
|
1189
|
-
message: check.message
|
|
1190
|
-
});
|
|
1191
|
-
status.dirty();
|
|
1192
|
-
}
|
|
1193
1097
|
} else if (check.kind === "base64") {
|
|
1194
1098
|
if (!base64Regex.test(input.data)) {
|
|
1195
1099
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -1200,16 +1104,6 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
1200
1104
|
});
|
|
1201
1105
|
status.dirty();
|
|
1202
1106
|
}
|
|
1203
|
-
} else if (check.kind === "base64url") {
|
|
1204
|
-
if (!base64urlRegex.test(input.data)) {
|
|
1205
|
-
ctx = this._getOrReturnCtx(input, ctx);
|
|
1206
|
-
addIssueToContext(ctx, {
|
|
1207
|
-
validation: "base64url",
|
|
1208
|
-
code: ZodIssueCode.invalid_string,
|
|
1209
|
-
message: check.message
|
|
1210
|
-
});
|
|
1211
|
-
status.dirty();
|
|
1212
|
-
}
|
|
1213
1107
|
} else {
|
|
1214
1108
|
util.assertNever(check);
|
|
1215
1109
|
}
|
|
@@ -1256,21 +1150,9 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
1256
1150
|
base64(message) {
|
|
1257
1151
|
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
|
1258
1152
|
}
|
|
1259
|
-
base64url(message) {
|
|
1260
|
-
return this._addCheck({
|
|
1261
|
-
kind: "base64url",
|
|
1262
|
-
...errorUtil.errToObj(message)
|
|
1263
|
-
});
|
|
1264
|
-
}
|
|
1265
|
-
jwt(options) {
|
|
1266
|
-
return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
|
|
1267
|
-
}
|
|
1268
1153
|
ip(options) {
|
|
1269
1154
|
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
|
1270
1155
|
}
|
|
1271
|
-
cidr(options) {
|
|
1272
|
-
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
|
1273
|
-
}
|
|
1274
1156
|
datetime(options) {
|
|
1275
1157
|
var _a, _b;
|
|
1276
1158
|
if (typeof options === "string") {
|
|
@@ -1361,7 +1243,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
1361
1243
|
});
|
|
1362
1244
|
}
|
|
1363
1245
|
/**
|
|
1364
|
-
*
|
|
1246
|
+
* @deprecated Use z.string().min(1) instead.
|
|
1247
|
+
* @see {@link ZodString.min}
|
|
1365
1248
|
*/
|
|
1366
1249
|
nonempty(message) {
|
|
1367
1250
|
return this.min(1, errorUtil.errToObj(message));
|
|
@@ -1423,15 +1306,9 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
1423
1306
|
get isIP() {
|
|
1424
1307
|
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
|
1425
1308
|
}
|
|
1426
|
-
get isCIDR() {
|
|
1427
|
-
return !!this._def.checks.find((ch) => ch.kind === "cidr");
|
|
1428
|
-
}
|
|
1429
1309
|
get isBase64() {
|
|
1430
1310
|
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
|
1431
1311
|
}
|
|
1432
|
-
get isBase64url() {
|
|
1433
|
-
return !!this._def.checks.find((ch) => ch.kind === "base64url");
|
|
1434
|
-
}
|
|
1435
1312
|
get minLength() {
|
|
1436
1313
|
let min = null;
|
|
1437
1314
|
for (const ch of this._def.checks) {
|
|
@@ -1709,15 +1586,17 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
1709
1586
|
}
|
|
1710
1587
|
_parse(input) {
|
|
1711
1588
|
if (this._def.coerce) {
|
|
1712
|
-
|
|
1713
|
-
input.data = BigInt(input.data);
|
|
1714
|
-
} catch (_a) {
|
|
1715
|
-
return this._getInvalidInput(input);
|
|
1716
|
-
}
|
|
1589
|
+
input.data = BigInt(input.data);
|
|
1717
1590
|
}
|
|
1718
1591
|
const parsedType = this._getType(input);
|
|
1719
1592
|
if (parsedType !== ZodParsedType.bigint) {
|
|
1720
|
-
|
|
1593
|
+
const ctx2 = this._getOrReturnCtx(input);
|
|
1594
|
+
addIssueToContext(ctx2, {
|
|
1595
|
+
code: ZodIssueCode.invalid_type,
|
|
1596
|
+
expected: ZodParsedType.bigint,
|
|
1597
|
+
received: ctx2.parsedType
|
|
1598
|
+
});
|
|
1599
|
+
return INVALID;
|
|
1721
1600
|
}
|
|
1722
1601
|
let ctx = void 0;
|
|
1723
1602
|
const status = new ParseStatus();
|
|
@@ -1764,15 +1643,6 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
1764
1643
|
}
|
|
1765
1644
|
return { status: status.value, value: input.data };
|
|
1766
1645
|
}
|
|
1767
|
-
_getInvalidInput(input) {
|
|
1768
|
-
const ctx = this._getOrReturnCtx(input);
|
|
1769
|
-
addIssueToContext(ctx, {
|
|
1770
|
-
code: ZodIssueCode.invalid_type,
|
|
1771
|
-
expected: ZodParsedType.bigint,
|
|
1772
|
-
received: ctx.parsedType
|
|
1773
|
-
});
|
|
1774
|
-
return INVALID;
|
|
1775
|
-
}
|
|
1776
1646
|
gte(value, message) {
|
|
1777
1647
|
return this.setLimit("min", value, true, errorUtil.toString(message));
|
|
1778
1648
|
}
|
|
@@ -4051,12 +3921,6 @@ function zodToJsonSchema(schema, options) {
|
|
|
4051
3921
|
case "ip":
|
|
4052
3922
|
json.format = Format.IPv4;
|
|
4053
3923
|
break;
|
|
4054
|
-
case "jwt":
|
|
4055
|
-
json.pattern = "^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$";
|
|
4056
|
-
break;
|
|
4057
|
-
case "base64url":
|
|
4058
|
-
json.pattern = "^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$";
|
|
4059
|
-
break;
|
|
4060
3924
|
default: {
|
|
4061
3925
|
const _expect = check.kind;
|
|
4062
3926
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/openapi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.6a7b82f",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
"escape-string-regexp": "^5.0.0",
|
|
38
38
|
"json-schema-typed": "^8.0.1",
|
|
39
39
|
"openapi3-ts": "^4.4.0",
|
|
40
|
-
"@orpc/
|
|
41
|
-
"@orpc/
|
|
42
|
-
"@orpc/
|
|
43
|
-
"@orpc/
|
|
44
|
-
"@orpc/
|
|
40
|
+
"@orpc/contract": "0.0.0-next.6a7b82f",
|
|
41
|
+
"@orpc/server": "0.0.0-next.6a7b82f",
|
|
42
|
+
"@orpc/zod": "0.0.0-next.6a7b82f",
|
|
43
|
+
"@orpc/transformer": "0.0.0-next.6a7b82f",
|
|
44
|
+
"@orpc/shared": "0.0.0-next.6a7b82f"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@readme/openapi-parser": "^2.6.0",
|
|
48
48
|
"hono": "^4.6.12",
|
|
49
|
-
"zod": "^3.
|
|
49
|
+
"zod": "^3.23.8"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsup --clean --sourcemap --entry.index=src/index.ts --entry.fetch=src/fetch/index.ts --format=esm --onSuccess='tsc -b --noCheck'",
|