@myxtra/microservice 1.7.0 → 1.14.0-alpha.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/dist/index.mjs +158 -145
- package/package.json +8 -7
package/dist/index.mjs
CHANGED
@@ -47,8 +47,10 @@ var require_Options = __commonJS({
|
|
47
47
|
errorMessages: false,
|
48
48
|
markdownDescription: false,
|
49
49
|
patternStrategy: "escape",
|
50
|
+
applyRegexFlags: false,
|
50
51
|
emailStrategy: "format:email",
|
51
|
-
base64Strategy: "contentEncoding:base64"
|
52
|
+
base64Strategy: "contentEncoding:base64",
|
53
|
+
nameStrategy: "ref"
|
52
54
|
};
|
53
55
|
var getDefaultOptions = (options) => typeof options === "string" ? {
|
54
56
|
...exports.defaultOptions,
|
@@ -670,19 +672,14 @@ var require_types = __commonJS({
|
|
670
672
|
"../../node_modules/zod/lib/types.js"(exports) {
|
671
673
|
"use strict";
|
672
674
|
var __classPrivateFieldGet2 = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
673
|
-
if (kind === "a" && !f)
|
674
|
-
|
675
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
676
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
675
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
676
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
677
677
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
678
678
|
};
|
679
679
|
var __classPrivateFieldSet2 = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
680
|
-
if (kind === "m")
|
681
|
-
|
682
|
-
if (
|
683
|
-
throw new TypeError("Private accessor was defined without a setter");
|
684
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
685
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
680
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
681
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
682
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
686
683
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
687
684
|
};
|
688
685
|
var _ZodEnum_cache2;
|
@@ -4106,20 +4103,16 @@ var require_external = __commonJS({
|
|
4106
4103
|
"../../node_modules/zod/lib/external.js"(exports) {
|
4107
4104
|
"use strict";
|
4108
4105
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
4109
|
-
if (k2 === void 0)
|
4110
|
-
k2 = k;
|
4106
|
+
if (k2 === void 0) k2 = k;
|
4111
4107
|
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
4112
4108
|
return m[k];
|
4113
4109
|
} });
|
4114
4110
|
} : function(o, m, k, k2) {
|
4115
|
-
if (k2 === void 0)
|
4116
|
-
k2 = k;
|
4111
|
+
if (k2 === void 0) k2 = k;
|
4117
4112
|
o[k2] = m[k];
|
4118
4113
|
});
|
4119
4114
|
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
|
4120
|
-
for (var p in m)
|
4121
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
4122
|
-
__createBinding(exports2, m, p);
|
4115
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
|
4123
4116
|
};
|
4124
4117
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4125
4118
|
__exportStar(require_errors(), exports);
|
@@ -4136,14 +4129,12 @@ var require_lib = __commonJS({
|
|
4136
4129
|
"../../node_modules/zod/lib/index.js"(exports) {
|
4137
4130
|
"use strict";
|
4138
4131
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
4139
|
-
if (k2 === void 0)
|
4140
|
-
k2 = k;
|
4132
|
+
if (k2 === void 0) k2 = k;
|
4141
4133
|
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
4142
4134
|
return m[k];
|
4143
4135
|
} });
|
4144
4136
|
} : function(o, m, k, k2) {
|
4145
|
-
if (k2 === void 0)
|
4146
|
-
k2 = k;
|
4137
|
+
if (k2 === void 0) k2 = k;
|
4147
4138
|
o[k2] = m[k];
|
4148
4139
|
});
|
4149
4140
|
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
@@ -4152,21 +4143,16 @@ var require_lib = __commonJS({
|
|
4152
4143
|
o["default"] = v;
|
4153
4144
|
});
|
4154
4145
|
var __importStar = exports && exports.__importStar || function(mod) {
|
4155
|
-
if (mod && mod.__esModule)
|
4156
|
-
return mod;
|
4146
|
+
if (mod && mod.__esModule) return mod;
|
4157
4147
|
var result = {};
|
4158
4148
|
if (mod != null) {
|
4159
|
-
for (var k in mod)
|
4160
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
4161
|
-
__createBinding(result, mod, k);
|
4149
|
+
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
4162
4150
|
}
|
4163
4151
|
__setModuleDefault(result, mod);
|
4164
4152
|
return result;
|
4165
4153
|
};
|
4166
4154
|
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
|
4167
|
-
for (var p in m)
|
4168
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
4169
|
-
__createBinding(exports2, m, p);
|
4155
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
|
4170
4156
|
};
|
4171
4157
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4172
4158
|
exports.z = void 0;
|
@@ -4528,28 +4514,31 @@ var require_string = __commonJS({
|
|
4528
4514
|
/**
|
4529
4515
|
* `c` was changed to `[cC]` to replicate /i flag
|
4530
4516
|
*/
|
4531
|
-
cuid:
|
4532
|
-
cuid2:
|
4533
|
-
ulid:
|
4517
|
+
cuid: /^[cC][^\s-]{8,}$/,
|
4518
|
+
cuid2: /^[0-9a-z]+$/,
|
4519
|
+
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
4534
4520
|
/**
|
4535
4521
|
* `a-z` was added to replicate /i flag
|
4536
4522
|
*/
|
4537
|
-
email:
|
4538
|
-
|
4523
|
+
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
|
4524
|
+
/**
|
4525
|
+
* Constructed a valid Unicode RegExp
|
4526
|
+
*/
|
4527
|
+
emoji: RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u"),
|
4539
4528
|
/**
|
4540
4529
|
* Unused
|
4541
4530
|
*/
|
4542
|
-
uuid:
|
4531
|
+
uuid: /^[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}$/,
|
4543
4532
|
/**
|
4544
4533
|
* Unused
|
4545
4534
|
*/
|
4546
|
-
ipv4:
|
4535
|
+
ipv4: /^(?:(?: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])$/,
|
4547
4536
|
/**
|
4548
4537
|
* Unused
|
4549
4538
|
*/
|
4550
|
-
ipv6:
|
4551
|
-
base64:
|
4552
|
-
nanoid:
|
4539
|
+
ipv6: /^(([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})))$/,
|
4540
|
+
base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
|
4541
|
+
nanoid: /^[a-zA-Z0-9_-]{21}$/
|
4553
4542
|
};
|
4554
4543
|
function parseStringDef(def, refs) {
|
4555
4544
|
const res = {
|
@@ -4587,7 +4576,7 @@ var require_string = __commonJS({
|
|
4587
4576
|
addFormat(res, "uuid", check.message, refs);
|
4588
4577
|
break;
|
4589
4578
|
case "regex":
|
4590
|
-
addPattern(res, check.regex
|
4579
|
+
addPattern(res, check.regex, check.message, refs);
|
4591
4580
|
break;
|
4592
4581
|
case "cuid":
|
4593
4582
|
addPattern(res, exports.zodPatterns.cuid, check.message, refs);
|
@@ -4596,10 +4585,10 @@ var require_string = __commonJS({
|
|
4596
4585
|
addPattern(res, exports.zodPatterns.cuid2, check.message, refs);
|
4597
4586
|
break;
|
4598
4587
|
case "startsWith":
|
4599
|
-
addPattern(res,
|
4588
|
+
addPattern(res, RegExp(`^${processPattern(check.value)}`), check.message, refs);
|
4600
4589
|
break;
|
4601
4590
|
case "endsWith":
|
4602
|
-
addPattern(res, processPattern(check.value)
|
4591
|
+
addPattern(res, RegExp(`${processPattern(check.value)}$`), check.message, refs);
|
4603
4592
|
break;
|
4604
4593
|
case "datetime":
|
4605
4594
|
addFormat(res, "date-time", check.message, refs);
|
@@ -4618,7 +4607,7 @@ var require_string = __commonJS({
|
|
4618
4607
|
(0, errorMessages_js_1.setResponseValueAndErrors)(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
|
4619
4608
|
break;
|
4620
4609
|
case "includes": {
|
4621
|
-
addPattern(res, processPattern(check.value), check.message, refs);
|
4610
|
+
addPattern(res, RegExp(processPattern(check.value)), check.message, refs);
|
4622
4611
|
break;
|
4623
4612
|
}
|
4624
4613
|
case "ip": {
|
@@ -4699,7 +4688,7 @@ var require_string = __commonJS({
|
|
4699
4688
|
(0, errorMessages_js_1.setResponseValueAndErrors)(schema, "format", value, message, refs);
|
4700
4689
|
}
|
4701
4690
|
};
|
4702
|
-
var addPattern = (schema,
|
4691
|
+
var addPattern = (schema, regex, message, refs) => {
|
4703
4692
|
if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
|
4704
4693
|
if (!schema.allOf) {
|
4705
4694
|
schema.allOf = [];
|
@@ -4720,12 +4709,86 @@ var require_string = __commonJS({
|
|
4720
4709
|
}
|
4721
4710
|
}
|
4722
4711
|
schema.allOf.push({
|
4723
|
-
pattern:
|
4712
|
+
pattern: processRegExp(regex, refs),
|
4724
4713
|
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
4725
4714
|
});
|
4726
4715
|
} else {
|
4727
|
-
(0, errorMessages_js_1.setResponseValueAndErrors)(schema, "pattern",
|
4716
|
+
(0, errorMessages_js_1.setResponseValueAndErrors)(schema, "pattern", processRegExp(regex, refs), message, refs);
|
4717
|
+
}
|
4718
|
+
};
|
4719
|
+
var processRegExp = (regex, refs) => {
|
4720
|
+
if (!refs.applyRegexFlags || !regex.flags)
|
4721
|
+
return regex.source;
|
4722
|
+
const flags = {
|
4723
|
+
i: regex.flags.includes("i"),
|
4724
|
+
m: regex.flags.includes("m"),
|
4725
|
+
s: regex.flags.includes("s")
|
4726
|
+
// `.` matches newlines
|
4727
|
+
};
|
4728
|
+
const source = flags.i ? regex.source.toLowerCase() : regex.source;
|
4729
|
+
let pattern = "";
|
4730
|
+
let isEscaped = false;
|
4731
|
+
let inCharGroup = false;
|
4732
|
+
let inCharRange = false;
|
4733
|
+
for (let i = 0; i < source.length; i++) {
|
4734
|
+
if (isEscaped) {
|
4735
|
+
pattern += source[i];
|
4736
|
+
isEscaped = false;
|
4737
|
+
continue;
|
4738
|
+
}
|
4739
|
+
if (flags.i) {
|
4740
|
+
if (inCharGroup) {
|
4741
|
+
if (source[i].match(/[a-z]/)) {
|
4742
|
+
if (inCharRange) {
|
4743
|
+
pattern += source[i];
|
4744
|
+
pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
|
4745
|
+
inCharRange = false;
|
4746
|
+
} else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) {
|
4747
|
+
pattern += source[i];
|
4748
|
+
inCharRange = true;
|
4749
|
+
} else {
|
4750
|
+
pattern += `${source[i]}${source[i].toUpperCase()}`;
|
4751
|
+
}
|
4752
|
+
continue;
|
4753
|
+
}
|
4754
|
+
} else if (source[i].match(/[a-z]/)) {
|
4755
|
+
pattern += `[${source[i]}${source[i].toUpperCase()}]`;
|
4756
|
+
continue;
|
4757
|
+
}
|
4758
|
+
}
|
4759
|
+
if (flags.m) {
|
4760
|
+
if (source[i] === "^") {
|
4761
|
+
pattern += `(^|(?<=[\r
|
4762
|
+
]))`;
|
4763
|
+
continue;
|
4764
|
+
} else if (source[i] === "$") {
|
4765
|
+
pattern += `($|(?=[\r
|
4766
|
+
]))`;
|
4767
|
+
continue;
|
4768
|
+
}
|
4769
|
+
}
|
4770
|
+
if (flags.s && source[i] === ".") {
|
4771
|
+
pattern += inCharGroup ? `${source[i]}\r
|
4772
|
+
` : `[${source[i]}\r
|
4773
|
+
]`;
|
4774
|
+
continue;
|
4775
|
+
}
|
4776
|
+
pattern += source[i];
|
4777
|
+
if (source[i] === "\\") {
|
4778
|
+
isEscaped = true;
|
4779
|
+
} else if (inCharGroup && source[i] === "]") {
|
4780
|
+
inCharGroup = false;
|
4781
|
+
} else if (!inCharGroup && source[i] === "[") {
|
4782
|
+
inCharGroup = true;
|
4783
|
+
}
|
4784
|
+
}
|
4785
|
+
try {
|
4786
|
+
const regexTest = new RegExp(pattern);
|
4787
|
+
} catch {
|
4788
|
+
console.warn(`Could not convert regex pattern at ${refs.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`);
|
4789
|
+
return regex.source;
|
4728
4790
|
}
|
4791
|
+
return pattern;
|
4729
4792
|
};
|
4730
4793
|
}
|
4731
4794
|
});
|
@@ -5519,11 +5582,15 @@ var require_zodToJsonSchema = __commonJS({
|
|
5519
5582
|
currentPath: [...refs.basePath, refs.definitionPath, name2]
|
5520
5583
|
}, true) ?? {}
|
5521
5584
|
}), {}) : void 0;
|
5522
|
-
const name = typeof options === "string" ? options : options?.name;
|
5585
|
+
const name = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
5523
5586
|
const main = (0, parseDef_js_1.parseDef)(schema._def, name === void 0 ? refs : {
|
5524
5587
|
...refs,
|
5525
5588
|
currentPath: [...refs.basePath, refs.definitionPath, name]
|
5526
5589
|
}, false) ?? {};
|
5590
|
+
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
5591
|
+
if (title !== void 0) {
|
5592
|
+
main.title = title;
|
5593
|
+
}
|
5527
5594
|
const combined = name === void 0 ? definitions ? {
|
5528
5595
|
...main,
|
5529
5596
|
[refs.definitionPath]: definitions
|
@@ -5554,8 +5621,7 @@ var require_cjs = __commonJS({
|
|
5554
5621
|
"../../node_modules/zod-to-json-schema/dist/cjs/index.js"(exports) {
|
5555
5622
|
"use strict";
|
5556
5623
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
5557
|
-
if (k2 === void 0)
|
5558
|
-
k2 = k;
|
5624
|
+
if (k2 === void 0) k2 = k;
|
5559
5625
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5560
5626
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
5561
5627
|
desc = { enumerable: true, get: function() {
|
@@ -5564,14 +5630,11 @@ var require_cjs = __commonJS({
|
|
5564
5630
|
}
|
5565
5631
|
Object.defineProperty(o, k2, desc);
|
5566
5632
|
} : function(o, m, k, k2) {
|
5567
|
-
if (k2 === void 0)
|
5568
|
-
k2 = k;
|
5633
|
+
if (k2 === void 0) k2 = k;
|
5569
5634
|
o[k2] = m[k];
|
5570
5635
|
});
|
5571
5636
|
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
|
5572
|
-
for (var p in m)
|
5573
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
5574
|
-
__createBinding(exports2, m, p);
|
5637
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
|
5575
5638
|
};
|
5576
5639
|
Object.defineProperty(exports, "__esModule", { value: true });
|
5577
5640
|
__exportStar(require_Options(), exports);
|
@@ -5618,40 +5681,7 @@ var require_cjs = __commonJS({
|
|
5618
5681
|
var require_dist = __commonJS({
|
5619
5682
|
"../../node_modules/fastify-type-provider-zod/dist/index.js"(exports) {
|
5620
5683
|
"use strict";
|
5621
|
-
|
5622
|
-
var extendStatics = function(d, b) {
|
5623
|
-
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
5624
|
-
d2.__proto__ = b2;
|
5625
|
-
} || function(d2, b2) {
|
5626
|
-
for (var p in b2)
|
5627
|
-
if (Object.prototype.hasOwnProperty.call(b2, p))
|
5628
|
-
d2[p] = b2[p];
|
5629
|
-
};
|
5630
|
-
return extendStatics(d, b);
|
5631
|
-
};
|
5632
|
-
return function(d, b) {
|
5633
|
-
if (typeof b !== "function" && b !== null)
|
5634
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
5635
|
-
extendStatics(d, b);
|
5636
|
-
function __() {
|
5637
|
-
this.constructor = d;
|
5638
|
-
}
|
5639
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
5640
|
-
};
|
5641
|
-
}();
|
5642
|
-
var __rest = exports && exports.__rest || function(s, e) {
|
5643
|
-
var t = {};
|
5644
|
-
for (var p in s)
|
5645
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
5646
|
-
t[p] = s[p];
|
5647
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
5648
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
5649
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
5650
|
-
t[p[i]] = s[p[i]];
|
5651
|
-
}
|
5652
|
-
return t;
|
5653
|
-
};
|
5654
|
-
exports.__esModule = true;
|
5684
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
5655
5685
|
exports.serializerCompiler = exports.ResponseValidationError = exports.validatorCompiler = exports.jsonSchemaTransform = exports.createJsonSchemaTransform = void 0;
|
5656
5686
|
var zod_to_json_schema_1 = require_cjs();
|
5657
5687
|
var defaultSkipList = [
|
@@ -5667,43 +5697,41 @@ var require_dist = __commonJS({
|
|
5667
5697
|
target: "openApi3",
|
5668
5698
|
$refStrategy: "none"
|
5669
5699
|
};
|
5670
|
-
var createJsonSchemaTransform =
|
5671
|
-
|
5672
|
-
return function(_a2) {
|
5673
|
-
var schema = _a2.schema, url = _a2.url;
|
5700
|
+
var createJsonSchemaTransform = ({ skipList }) => {
|
5701
|
+
return ({ schema, url }) => {
|
5674
5702
|
if (!schema) {
|
5675
5703
|
return {
|
5676
5704
|
schema,
|
5677
5705
|
url
|
5678
5706
|
};
|
5679
5707
|
}
|
5680
|
-
|
5681
|
-
|
5708
|
+
const { response, headers, querystring, body, params, hide, ...rest } = schema;
|
5709
|
+
const transformed = {};
|
5682
5710
|
if (skipList.includes(url) || hide) {
|
5683
5711
|
transformed.hide = true;
|
5684
5712
|
return { schema: transformed, url };
|
5685
5713
|
}
|
5686
|
-
|
5687
|
-
for (
|
5688
|
-
|
5714
|
+
const zodSchemas = { headers, querystring, body, params };
|
5715
|
+
for (const prop in zodSchemas) {
|
5716
|
+
const zodSchema = zodSchemas[prop];
|
5689
5717
|
if (zodSchema) {
|
5690
5718
|
transformed[prop] = (0, zod_to_json_schema_1.zodToJsonSchema)(zodSchema, zodToJsonSchemaOptions);
|
5691
5719
|
}
|
5692
5720
|
}
|
5693
5721
|
if (response) {
|
5694
5722
|
transformed.response = {};
|
5695
|
-
for (
|
5696
|
-
|
5697
|
-
|
5723
|
+
for (const prop in response) {
|
5724
|
+
const schema2 = resolveSchema(response[prop]);
|
5725
|
+
const transformedResponse = (0, zod_to_json_schema_1.zodToJsonSchema)(
|
5698
5726
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5699
|
-
|
5727
|
+
schema2,
|
5700
5728
|
zodToJsonSchemaOptions
|
5701
5729
|
);
|
5702
5730
|
transformed.response[prop] = transformedResponse;
|
5703
5731
|
}
|
5704
5732
|
}
|
5705
|
-
for (
|
5706
|
-
|
5733
|
+
for (const prop in rest) {
|
5734
|
+
const meta = rest[prop];
|
5707
5735
|
if (meta) {
|
5708
5736
|
transformed[prop] = meta;
|
5709
5737
|
}
|
@@ -5715,16 +5743,16 @@ var require_dist = __commonJS({
|
|
5715
5743
|
exports.jsonSchemaTransform = (0, exports.createJsonSchemaTransform)({
|
5716
5744
|
skipList: defaultSkipList
|
5717
5745
|
});
|
5718
|
-
var validatorCompiler2 =
|
5719
|
-
|
5720
|
-
|
5746
|
+
var validatorCompiler2 = ({ schema }) => (
|
5747
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5748
|
+
(data) => {
|
5721
5749
|
try {
|
5722
5750
|
return { value: schema.parse(data) };
|
5723
5751
|
} catch (error) {
|
5724
5752
|
return { error };
|
5725
5753
|
}
|
5726
|
-
}
|
5727
|
-
|
5754
|
+
}
|
5755
|
+
);
|
5728
5756
|
exports.validatorCompiler = validatorCompiler2;
|
5729
5757
|
function hasOwnProperty(obj, prop) {
|
5730
5758
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
@@ -5736,32 +5764,23 @@ var require_dist = __commonJS({
|
|
5736
5764
|
if (hasOwnProperty(maybeSchema, "properties")) {
|
5737
5765
|
return maybeSchema.properties;
|
5738
5766
|
}
|
5739
|
-
throw new Error(
|
5767
|
+
throw new Error(`Invalid schema passed: ${JSON.stringify(maybeSchema)}`);
|
5740
5768
|
}
|
5741
|
-
var ResponseValidationError =
|
5742
|
-
|
5743
|
-
|
5744
|
-
|
5745
|
-
|
5746
|
-
|
5747
|
-
|
5748
|
-
_this.details = validationResult.error;
|
5749
|
-
return _this;
|
5750
|
-
}
|
5751
|
-
return ResponseValidationError2;
|
5752
|
-
}(Error)
|
5753
|
-
);
|
5769
|
+
var ResponseValidationError = class extends Error {
|
5770
|
+
constructor(validationResult) {
|
5771
|
+
super("Response doesn't match the schema");
|
5772
|
+
this.name = "ResponseValidationError";
|
5773
|
+
this.details = validationResult.error;
|
5774
|
+
}
|
5775
|
+
};
|
5754
5776
|
exports.ResponseValidationError = ResponseValidationError;
|
5755
|
-
var serializerCompiler2 =
|
5756
|
-
|
5757
|
-
|
5758
|
-
|
5759
|
-
|
5760
|
-
|
5761
|
-
|
5762
|
-
}
|
5763
|
-
throw new ResponseValidationError(result);
|
5764
|
-
};
|
5777
|
+
var serializerCompiler2 = ({ schema: maybeSchema }) => (data) => {
|
5778
|
+
const schema = resolveSchema(maybeSchema);
|
5779
|
+
const result = schema.safeParse(data);
|
5780
|
+
if (result.success) {
|
5781
|
+
return JSON.stringify(result.data);
|
5782
|
+
}
|
5783
|
+
throw new ResponseValidationError(result);
|
5765
5784
|
};
|
5766
5785
|
exports.serializerCompiler = serializerCompiler2;
|
5767
5786
|
}
|
@@ -6265,19 +6284,14 @@ var isDirty = (x) => x.status === "dirty";
|
|
6265
6284
|
var isValid = (x) => x.status === "valid";
|
6266
6285
|
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
6267
6286
|
function __classPrivateFieldGet(receiver, state, kind, f) {
|
6268
|
-
if (kind === "a" && !f)
|
6269
|
-
|
6270
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
6271
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
6287
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
6288
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
6272
6289
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
6273
6290
|
}
|
6274
6291
|
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
6275
|
-
if (kind === "m")
|
6276
|
-
|
6277
|
-
if (
|
6278
|
-
throw new TypeError("Private accessor was defined without a setter");
|
6279
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
6280
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
6292
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
6293
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
6294
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
6281
6295
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
6282
6296
|
}
|
6283
6297
|
var errorUtil;
|
@@ -7996,8 +8010,7 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
7996
8010
|
});
|
7997
8011
|
status.dirty();
|
7998
8012
|
}
|
7999
|
-
} else if (unknownKeys === "strip")
|
8000
|
-
;
|
8013
|
+
} else if (unknownKeys === "strip") ;
|
8001
8014
|
else {
|
8002
8015
|
throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
|
8003
8016
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@myxtra/microservice",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.14.0-alpha.0",
|
4
4
|
"main": "./dist/index.mjs",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"publishConfig": {
|
@@ -20,15 +20,16 @@
|
|
20
20
|
"typecheck": "tsc --noEmit"
|
21
21
|
},
|
22
22
|
"dependencies": {
|
23
|
-
"@myxtra/api": "1.
|
23
|
+
"@myxtra/api": "1.14.0-alpha.0"
|
24
24
|
},
|
25
25
|
"devDependencies": {
|
26
|
-
"@myxtra/eslint-config": "1.
|
27
|
-
"@tsconfig/node18": "^18.2.
|
26
|
+
"@myxtra/eslint-config": "1.17.0",
|
27
|
+
"@tsconfig/node18": "^18.2.4",
|
28
28
|
"eslint": "^8.54.0",
|
29
|
-
"fastify-type-provider-zod": "^1.
|
30
|
-
"
|
31
|
-
"
|
29
|
+
"fastify-type-provider-zod": "^1.2.0",
|
30
|
+
"prettier": "^3.3.3",
|
31
|
+
"tsup": "^8.2.4",
|
32
|
+
"typescript": "^5.5.4"
|
32
33
|
},
|
33
34
|
"peerDependencies": {
|
34
35
|
"@fastify/swagger": ">=8.0.0",
|