langgraph-ui-components 0.0.11-testing → 0.0.12

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.
Files changed (249) hide show
  1. package/dist/index.es.js +2 -3
  2. package/dist/index.es10.js +6 -25
  3. package/dist/index.es10.js.map +1 -1
  4. package/dist/index.es100.js +156 -127
  5. package/dist/index.es100.js.map +1 -1
  6. package/dist/index.es101.js +195 -62
  7. package/dist/index.es101.js.map +1 -1
  8. package/dist/index.es102.js +14 -37
  9. package/dist/index.es102.js.map +1 -1
  10. package/dist/index.es103.js +27 -34
  11. package/dist/index.es103.js.map +1 -1
  12. package/dist/index.es104.js +25 -157
  13. package/dist/index.es104.js.map +1 -1
  14. package/dist/index.es105.js +3130 -176
  15. package/dist/index.es105.js.map +1 -1
  16. package/dist/index.es106.js +36 -13
  17. package/dist/index.es106.js.map +1 -1
  18. package/dist/index.es107.js +5 -30
  19. package/dist/index.es107.js.map +1 -1
  20. package/dist/index.es108.js +69 -30
  21. package/dist/index.es108.js.map +1 -1
  22. package/dist/index.es109.js +28 -3148
  23. package/dist/index.es109.js.map +1 -1
  24. package/dist/index.es11.js +6 -1
  25. package/dist/index.es11.js.map +1 -1
  26. package/dist/index.es113.js +5 -16
  27. package/dist/index.es113.js.map +1 -1
  28. package/dist/index.es114.js +2 -7
  29. package/dist/index.es114.js.map +1 -1
  30. package/dist/index.es115.js +13 -2
  31. package/dist/index.es115.js.map +1 -1
  32. package/dist/index.es116.js +499 -9
  33. package/dist/index.es116.js.map +1 -1
  34. package/dist/index.es117.js +5 -501
  35. package/dist/index.es117.js.map +1 -1
  36. package/dist/index.es118.js +2 -7
  37. package/dist/index.es118.js.map +1 -1
  38. package/dist/index.es119.js +148 -2
  39. package/dist/index.es119.js.map +1 -1
  40. package/dist/index.es120.js +878 -118
  41. package/dist/index.es120.js.map +1 -1
  42. package/dist/index.es121.js +251 -877
  43. package/dist/index.es121.js.map +1 -1
  44. package/dist/index.es122.js +3 -281
  45. package/dist/index.es122.js.map +1 -1
  46. package/dist/index.es123.js +445 -3
  47. package/dist/index.es123.js.map +1 -1
  48. package/dist/index.es124.js +38 -436
  49. package/dist/index.es124.js.map +1 -1
  50. package/dist/index.es125.js +22 -46
  51. package/dist/index.es125.js.map +1 -1
  52. package/dist/index.es126.js +78 -21
  53. package/dist/index.es126.js.map +1 -1
  54. package/dist/index.es127.js +126 -76
  55. package/dist/index.es127.js.map +1 -1
  56. package/dist/index.es128.js +45 -125
  57. package/dist/index.es128.js.map +1 -1
  58. package/dist/index.es129.js +9 -48
  59. package/dist/index.es129.js.map +1 -1
  60. package/dist/index.es13.js +6 -6
  61. package/dist/index.es130.js +45 -10
  62. package/dist/index.es130.js.map +1 -1
  63. package/dist/index.es131.js +97 -43
  64. package/dist/index.es131.js.map +1 -1
  65. package/dist/index.es132.js +48 -94
  66. package/dist/index.es132.js.map +1 -1
  67. package/dist/index.es133.js +14 -51
  68. package/dist/index.es133.js.map +1 -1
  69. package/dist/index.es15.js +59 -31
  70. package/dist/index.es15.js.map +1 -1
  71. package/dist/index.es16.js +4 -4
  72. package/dist/index.es16.js.map +1 -1
  73. package/dist/index.es183.js +13 -162
  74. package/dist/index.es183.js.map +1 -1
  75. package/dist/index.es184.js +89 -2
  76. package/dist/index.es184.js.map +1 -1
  77. package/dist/index.es185.js +2 -15
  78. package/dist/index.es185.js.map +1 -1
  79. package/dist/index.es186.js +54 -87
  80. package/dist/index.es186.js.map +1 -1
  81. package/dist/index.es187.js +100 -2
  82. package/dist/index.es187.js.map +1 -1
  83. package/dist/index.es188.js +185 -50
  84. package/dist/index.es188.js.map +1 -1
  85. package/dist/index.es189.js +96 -86
  86. package/dist/index.es189.js.map +1 -1
  87. package/dist/index.es190.js +31 -187
  88. package/dist/index.es190.js.map +1 -1
  89. package/dist/index.es191.js +9 -109
  90. package/dist/index.es191.js.map +1 -1
  91. package/dist/index.es192.js +11 -35
  92. package/dist/index.es192.js.map +1 -1
  93. package/dist/index.es193.js +12 -10
  94. package/dist/index.es193.js.map +1 -1
  95. package/dist/index.es194.js +90 -10
  96. package/dist/index.es194.js.map +1 -1
  97. package/dist/index.es195.js +274 -11
  98. package/dist/index.es195.js.map +1 -1
  99. package/dist/index.es196.js +2 -91
  100. package/dist/index.es196.js.map +1 -1
  101. package/dist/index.es197.js +150 -261
  102. package/dist/index.es197.js.map +1 -1
  103. package/dist/index.es198.js +51 -2
  104. package/dist/index.es198.js.map +1 -1
  105. package/dist/index.es199.js +34 -158
  106. package/dist/index.es199.js.map +1 -1
  107. package/dist/index.es2.js +84 -46
  108. package/dist/index.es2.js.map +1 -1
  109. package/dist/index.es20.js +2 -2
  110. package/dist/index.es200.js +34 -50
  111. package/dist/index.es200.js.map +1 -1
  112. package/dist/index.es201.js +32 -32
  113. package/dist/index.es201.js.map +1 -1
  114. package/dist/index.es202.js +23 -34
  115. package/dist/index.es202.js.map +1 -1
  116. package/dist/index.es203.js +583 -32
  117. package/dist/index.es203.js.map +1 -1
  118. package/dist/index.es204.js +121 -20
  119. package/dist/index.es204.js.map +1 -1
  120. package/dist/index.es205.js +158 -585
  121. package/dist/index.es205.js.map +1 -1
  122. package/dist/index.es206.js +2 -125
  123. package/dist/index.es206.js.map +1 -1
  124. package/dist/index.es22.js +15 -119
  125. package/dist/index.es22.js.map +1 -1
  126. package/dist/index.es23.js +37 -17
  127. package/dist/index.es23.js.map +1 -1
  128. package/dist/index.es24.js +27 -34
  129. package/dist/index.es24.js.map +1 -1
  130. package/dist/index.es25.js +145 -28
  131. package/dist/index.es25.js.map +1 -1
  132. package/dist/index.es252.js +2 -2
  133. package/dist/index.es253.js +1 -1
  134. package/dist/index.es258.js +1 -1
  135. package/dist/index.es26.js +100 -144
  136. package/dist/index.es26.js.map +1 -1
  137. package/dist/index.es260.js +2 -2
  138. package/dist/index.es262.js +2 -2
  139. package/dist/index.es265.js +1 -1
  140. package/dist/index.es267.js +1 -1
  141. package/dist/index.es27.js +66 -101
  142. package/dist/index.es27.js.map +1 -1
  143. package/dist/index.es277.js +147 -2
  144. package/dist/index.es277.js.map +1 -1
  145. package/dist/index.es278.js +167 -126
  146. package/dist/index.es278.js.map +1 -1
  147. package/dist/index.es279.js +2 -188
  148. package/dist/index.es279.js.map +1 -1
  149. package/dist/index.es28.js +121 -68
  150. package/dist/index.es28.js.map +1 -1
  151. package/dist/index.es280.js +1 -1
  152. package/dist/index.es283.js +1 -1
  153. package/dist/index.es288.js +1 -1
  154. package/dist/index.es29.js +1 -1
  155. package/dist/index.es3.js +10 -42
  156. package/dist/index.es3.js.map +1 -1
  157. package/dist/index.es300.js +1 -1
  158. package/dist/index.es302.js +1 -1
  159. package/dist/index.es314.js +1 -1
  160. package/dist/index.es334.js +2 -2
  161. package/dist/index.es4.js +1 -2
  162. package/dist/index.es4.js.map +1 -1
  163. package/dist/index.es43.js +5 -5
  164. package/dist/index.es45.js +1 -1
  165. package/dist/index.es49.js +3 -3
  166. package/dist/index.es5.js.map +1 -1
  167. package/dist/index.es50.js +208 -5
  168. package/dist/index.es50.js.map +1 -1
  169. package/dist/index.es51.js +5 -208
  170. package/dist/index.es51.js.map +1 -1
  171. package/dist/index.es52.js +3 -3
  172. package/dist/index.es61.js +1 -1
  173. package/dist/index.es62.js +2 -2
  174. package/dist/index.es64.js +142 -5
  175. package/dist/index.es64.js.map +1 -1
  176. package/dist/index.es65.js +285 -148
  177. package/dist/index.es65.js.map +1 -1
  178. package/dist/index.es66.js +62 -668
  179. package/dist/index.es66.js.map +1 -1
  180. package/dist/index.es67.js +201 -131
  181. package/dist/index.es67.js.map +1 -1
  182. package/dist/index.es68.js +29 -295
  183. package/dist/index.es68.js.map +1 -1
  184. package/dist/index.es69.js +8 -65
  185. package/dist/index.es69.js.map +1 -1
  186. package/dist/index.es7.js +1 -2
  187. package/dist/index.es7.js.map +1 -1
  188. package/dist/index.es70.js +9 -210
  189. package/dist/index.es70.js.map +1 -1
  190. package/dist/index.es71.js +181 -28
  191. package/dist/index.es71.js.map +1 -1
  192. package/dist/index.es72.js +23 -8
  193. package/dist/index.es72.js.map +1 -1
  194. package/dist/index.es73.js +1397 -9
  195. package/dist/index.es73.js.map +1 -1
  196. package/dist/index.es74.js +9 -187
  197. package/dist/index.es74.js.map +1 -1
  198. package/dist/index.es75.js +8 -24
  199. package/dist/index.es75.js.map +1 -1
  200. package/dist/index.es76.js +5 -1399
  201. package/dist/index.es76.js.map +1 -1
  202. package/dist/index.es77.js +163 -9
  203. package/dist/index.es77.js.map +1 -1
  204. package/dist/index.es78.js +672 -8
  205. package/dist/index.es78.js.map +1 -1
  206. package/dist/index.es79.js +11 -36
  207. package/dist/index.es79.js.map +1 -1
  208. package/dist/index.es80.js +40 -5
  209. package/dist/index.es80.js.map +1 -1
  210. package/dist/index.es81.js +32 -71
  211. package/dist/index.es81.js.map +1 -1
  212. package/dist/index.es82.js +225 -30
  213. package/dist/index.es82.js.map +1 -1
  214. package/dist/index.es83.js +29 -11
  215. package/dist/index.es83.js.map +1 -1
  216. package/dist/index.es84.js +72 -37
  217. package/dist/index.es84.js.map +1 -1
  218. package/dist/index.es85.js +74 -32
  219. package/dist/index.es85.js.map +1 -1
  220. package/dist/index.es86.js +46 -226
  221. package/dist/index.es86.js.map +1 -1
  222. package/dist/index.es87.js +6 -6
  223. package/dist/index.es87.js.map +1 -1
  224. package/dist/index.es88.js +39 -71
  225. package/dist/index.es88.js.map +1 -1
  226. package/dist/index.es89.js +54 -73
  227. package/dist/index.es89.js.map +1 -1
  228. package/dist/index.es90.js +13 -52
  229. package/dist/index.es90.js.map +1 -1
  230. package/dist/index.es91.js +135 -28
  231. package/dist/index.es91.js.map +1 -1
  232. package/dist/index.es92.js +20 -42
  233. package/dist/index.es92.js.map +1 -1
  234. package/dist/index.es93.js +175 -50
  235. package/dist/index.es93.js.map +1 -1
  236. package/dist/index.es94.js +239 -11
  237. package/dist/index.es94.js.map +1 -1
  238. package/dist/index.es95.js +348 -130
  239. package/dist/index.es95.js.map +1 -1
  240. package/dist/index.es96.js +134 -18
  241. package/dist/index.es96.js.map +1 -1
  242. package/dist/index.es97.js +61 -173
  243. package/dist/index.es97.js.map +1 -1
  244. package/dist/index.es98.js +30 -234
  245. package/dist/index.es98.js.map +1 -1
  246. package/dist/index.es99.js +26 -344
  247. package/dist/index.es99.js.map +1 -1
  248. package/dist/styles.css +1 -1
  249. package/package.json +1 -1
@@ -1,594 +1,167 @@
1
- import { initializeContext, process, extractDefs, finalize } from "./index.es267.js";
2
- import { getEnumValues } from "./index.es127.js";
3
- const formatMap = {
4
- guid: "uuid",
5
- url: "uri",
6
- datetime: "date-time",
7
- json_string: "json-string",
8
- regex: ""
9
- // do not set
10
- };
11
- const stringProcessor = (schema, ctx, _json, _params) => {
12
- const json = _json;
13
- json.type = "string";
14
- const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
15
- if (typeof minimum === "number")
16
- json.minLength = minimum;
17
- if (typeof maximum === "number")
18
- json.maxLength = maximum;
19
- if (format) {
20
- json.format = formatMap[format] ?? format;
21
- if (json.format === "")
22
- delete json.format;
23
- if (format === "time") {
24
- delete json.format;
25
- }
26
- }
27
- if (contentEncoding)
28
- json.contentEncoding = contentEncoding;
29
- if (patterns && patterns.size > 0) {
30
- const regexes = [...patterns];
31
- if (regexes.length === 1)
32
- json.pattern = regexes[0].source;
33
- else if (regexes.length > 1) {
34
- json.allOf = [
35
- ...regexes.map((regex) => ({
36
- ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
37
- pattern: regex.source
38
- }))
39
- ];
40
- }
41
- }
42
- };
43
- const numberProcessor = (schema, ctx, _json, _params) => {
44
- const json = _json;
45
- const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
46
- if (typeof format === "string" && format.includes("int"))
47
- json.type = "integer";
48
- else
49
- json.type = "number";
50
- if (typeof exclusiveMinimum === "number") {
51
- if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
52
- json.minimum = exclusiveMinimum;
53
- json.exclusiveMinimum = true;
54
- } else {
55
- json.exclusiveMinimum = exclusiveMinimum;
56
- }
57
- }
58
- if (typeof minimum === "number") {
59
- json.minimum = minimum;
60
- if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
61
- if (exclusiveMinimum >= minimum)
62
- delete json.minimum;
63
- else
64
- delete json.exclusiveMinimum;
65
- }
66
- }
67
- if (typeof exclusiveMaximum === "number") {
68
- if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
69
- json.maximum = exclusiveMaximum;
70
- json.exclusiveMaximum = true;
71
- } else {
72
- json.exclusiveMaximum = exclusiveMaximum;
73
- }
74
- }
75
- if (typeof maximum === "number") {
76
- json.maximum = maximum;
77
- if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
78
- if (exclusiveMaximum <= maximum)
79
- delete json.maximum;
80
- else
81
- delete json.exclusiveMaximum;
82
- }
83
- }
84
- if (typeof multipleOf === "number")
85
- json.multipleOf = multipleOf;
86
- };
87
- const booleanProcessor = (_schema, _ctx, json, _params) => {
88
- json.type = "boolean";
89
- };
90
- const bigintProcessor = (_schema, ctx, _json, _params) => {
91
- if (ctx.unrepresentable === "throw") {
92
- throw new Error("BigInt cannot be represented in JSON Schema");
93
- }
94
- };
95
- const symbolProcessor = (_schema, ctx, _json, _params) => {
96
- if (ctx.unrepresentable === "throw") {
97
- throw new Error("Symbols cannot be represented in JSON Schema");
98
- }
99
- };
100
- const nullProcessor = (_schema, ctx, json, _params) => {
101
- if (ctx.target === "openapi-3.0") {
102
- json.type = "string";
103
- json.nullable = true;
104
- json.enum = [null];
105
- } else {
106
- json.type = "null";
107
- }
108
- };
109
- const undefinedProcessor = (_schema, ctx, _json, _params) => {
110
- if (ctx.unrepresentable === "throw") {
111
- throw new Error("Undefined cannot be represented in JSON Schema");
112
- }
113
- };
114
- const voidProcessor = (_schema, ctx, _json, _params) => {
115
- if (ctx.unrepresentable === "throw") {
116
- throw new Error("Void cannot be represented in JSON Schema");
117
- }
118
- };
119
- const neverProcessor = (_schema, _ctx, json, _params) => {
120
- json.not = {};
121
- };
122
- const anyProcessor = (_schema, _ctx, _json, _params) => {
123
- };
124
- const unknownProcessor = (_schema, _ctx, _json, _params) => {
125
- };
126
- const dateProcessor = (_schema, ctx, _json, _params) => {
127
- if (ctx.unrepresentable === "throw") {
128
- throw new Error("Date cannot be represented in JSON Schema");
129
- }
130
- };
131
- const enumProcessor = (schema, _ctx, json, _params) => {
132
- const def = schema._zod.def;
133
- const values = getEnumValues(def.entries);
134
- if (values.every((v) => typeof v === "number"))
135
- json.type = "number";
136
- if (values.every((v) => typeof v === "string"))
137
- json.type = "string";
138
- json.enum = values;
139
- };
140
- const literalProcessor = (schema, ctx, json, _params) => {
141
- const def = schema._zod.def;
142
- const vals = [];
143
- for (const val of def.values) {
144
- if (val === void 0) {
145
- if (ctx.unrepresentable === "throw") {
146
- throw new Error("Literal `undefined` cannot be represented in JSON Schema");
1
+ import { __module as eventemitter3 } from "./index.es206.js";
2
+ var hasRequiredEventemitter3;
3
+ function requireEventemitter3() {
4
+ if (hasRequiredEventemitter3) return eventemitter3.exports;
5
+ hasRequiredEventemitter3 = 1;
6
+ (function(module) {
7
+ var has = Object.prototype.hasOwnProperty, prefix = "~";
8
+ function Events() {
9
+ }
10
+ if (Object.create) {
11
+ Events.prototype = /* @__PURE__ */ Object.create(null);
12
+ if (!new Events().__proto__) prefix = false;
13
+ }
14
+ function EE(fn, context, once) {
15
+ this.fn = fn;
16
+ this.context = context;
17
+ this.once = once || false;
18
+ }
19
+ function addListener(emitter, event, fn, context, once) {
20
+ if (typeof fn !== "function") {
21
+ throw new TypeError("The listener must be a function");
22
+ }
23
+ var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
24
+ if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
25
+ else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
26
+ else emitter._events[evt] = [emitter._events[evt], listener];
27
+ return emitter;
28
+ }
29
+ function clearEvent(emitter, evt) {
30
+ if (--emitter._eventsCount === 0) emitter._events = new Events();
31
+ else delete emitter._events[evt];
32
+ }
33
+ function EventEmitter() {
34
+ this._events = new Events();
35
+ this._eventsCount = 0;
36
+ }
37
+ EventEmitter.prototype.eventNames = function eventNames() {
38
+ var names = [], events, name;
39
+ if (this._eventsCount === 0) return names;
40
+ for (name in events = this._events) {
41
+ if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
42
+ }
43
+ if (Object.getOwnPropertySymbols) {
44
+ return names.concat(Object.getOwnPropertySymbols(events));
45
+ }
46
+ return names;
47
+ };
48
+ EventEmitter.prototype.listeners = function listeners(event) {
49
+ var evt = prefix ? prefix + event : event, handlers = this._events[evt];
50
+ if (!handlers) return [];
51
+ if (handlers.fn) return [handlers.fn];
52
+ for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
53
+ ee[i] = handlers[i].fn;
147
54
  }
148
- } else if (typeof val === "bigint") {
149
- if (ctx.unrepresentable === "throw") {
150
- throw new Error("BigInt literals cannot be represented in JSON Schema");
55
+ return ee;
56
+ };
57
+ EventEmitter.prototype.listenerCount = function listenerCount(event) {
58
+ var evt = prefix ? prefix + event : event, listeners = this._events[evt];
59
+ if (!listeners) return 0;
60
+ if (listeners.fn) return 1;
61
+ return listeners.length;
62
+ };
63
+ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
64
+ var evt = prefix ? prefix + event : event;
65
+ if (!this._events[evt]) return false;
66
+ var listeners = this._events[evt], len = arguments.length, args, i;
67
+ if (listeners.fn) {
68
+ if (listeners.once) this.removeListener(event, listeners.fn, void 0, true);
69
+ switch (len) {
70
+ case 1:
71
+ return listeners.fn.call(listeners.context), true;
72
+ case 2:
73
+ return listeners.fn.call(listeners.context, a1), true;
74
+ case 3:
75
+ return listeners.fn.call(listeners.context, a1, a2), true;
76
+ case 4:
77
+ return listeners.fn.call(listeners.context, a1, a2, a3), true;
78
+ case 5:
79
+ return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
80
+ case 6:
81
+ return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
82
+ }
83
+ for (i = 1, args = new Array(len - 1); i < len; i++) {
84
+ args[i - 1] = arguments[i];
85
+ }
86
+ listeners.fn.apply(listeners.context, args);
151
87
  } else {
152
- vals.push(Number(val));
88
+ var length = listeners.length, j;
89
+ for (i = 0; i < length; i++) {
90
+ if (listeners[i].once) this.removeListener(event, listeners[i].fn, void 0, true);
91
+ switch (len) {
92
+ case 1:
93
+ listeners[i].fn.call(listeners[i].context);
94
+ break;
95
+ case 2:
96
+ listeners[i].fn.call(listeners[i].context, a1);
97
+ break;
98
+ case 3:
99
+ listeners[i].fn.call(listeners[i].context, a1, a2);
100
+ break;
101
+ case 4:
102
+ listeners[i].fn.call(listeners[i].context, a1, a2, a3);
103
+ break;
104
+ default:
105
+ if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) {
106
+ args[j - 1] = arguments[j];
107
+ }
108
+ listeners[i].fn.apply(listeners[i].context, args);
109
+ }
110
+ }
153
111
  }
154
- } else {
155
- vals.push(val);
156
- }
157
- }
158
- if (vals.length === 0) ;
159
- else if (vals.length === 1) {
160
- const val = vals[0];
161
- json.type = val === null ? "null" : typeof val;
162
- if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
163
- json.enum = [val];
164
- } else {
165
- json.const = val;
166
- }
167
- } else {
168
- if (vals.every((v) => typeof v === "number"))
169
- json.type = "number";
170
- if (vals.every((v) => typeof v === "string"))
171
- json.type = "string";
172
- if (vals.every((v) => typeof v === "boolean"))
173
- json.type = "boolean";
174
- if (vals.every((v) => v === null))
175
- json.type = "null";
176
- json.enum = vals;
177
- }
178
- };
179
- const nanProcessor = (_schema, ctx, _json, _params) => {
180
- if (ctx.unrepresentable === "throw") {
181
- throw new Error("NaN cannot be represented in JSON Schema");
182
- }
183
- };
184
- const templateLiteralProcessor = (schema, _ctx, json, _params) => {
185
- const _json = json;
186
- const pattern = schema._zod.pattern;
187
- if (!pattern)
188
- throw new Error("Pattern not found in template literal");
189
- _json.type = "string";
190
- _json.pattern = pattern.source;
191
- };
192
- const fileProcessor = (schema, _ctx, json, _params) => {
193
- const _json = json;
194
- const file = {
195
- type: "string",
196
- format: "binary",
197
- contentEncoding: "binary"
198
- };
199
- const { minimum, maximum, mime } = schema._zod.bag;
200
- if (minimum !== void 0)
201
- file.minLength = minimum;
202
- if (maximum !== void 0)
203
- file.maxLength = maximum;
204
- if (mime) {
205
- if (mime.length === 1) {
206
- file.contentMediaType = mime[0];
207
- Object.assign(_json, file);
208
- } else {
209
- Object.assign(_json, file);
210
- _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
211
- }
212
- } else {
213
- Object.assign(_json, file);
214
- }
215
- };
216
- const successProcessor = (_schema, _ctx, json, _params) => {
217
- json.type = "boolean";
218
- };
219
- const customProcessor = (_schema, ctx, _json, _params) => {
220
- if (ctx.unrepresentable === "throw") {
221
- throw new Error("Custom types cannot be represented in JSON Schema");
222
- }
223
- };
224
- const functionProcessor = (_schema, ctx, _json, _params) => {
225
- if (ctx.unrepresentable === "throw") {
226
- throw new Error("Function types cannot be represented in JSON Schema");
227
- }
228
- };
229
- const transformProcessor = (_schema, ctx, _json, _params) => {
230
- if (ctx.unrepresentable === "throw") {
231
- throw new Error("Transforms cannot be represented in JSON Schema");
232
- }
233
- };
234
- const mapProcessor = (_schema, ctx, _json, _params) => {
235
- if (ctx.unrepresentable === "throw") {
236
- throw new Error("Map cannot be represented in JSON Schema");
237
- }
238
- };
239
- const setProcessor = (_schema, ctx, _json, _params) => {
240
- if (ctx.unrepresentable === "throw") {
241
- throw new Error("Set cannot be represented in JSON Schema");
242
- }
243
- };
244
- const arrayProcessor = (schema, ctx, _json, params) => {
245
- const json = _json;
246
- const def = schema._zod.def;
247
- const { minimum, maximum } = schema._zod.bag;
248
- if (typeof minimum === "number")
249
- json.minItems = minimum;
250
- if (typeof maximum === "number")
251
- json.maxItems = maximum;
252
- json.type = "array";
253
- json.items = process(def.element, ctx, { ...params, path: [...params.path, "items"] });
254
- };
255
- const objectProcessor = (schema, ctx, _json, params) => {
256
- const json = _json;
257
- const def = schema._zod.def;
258
- json.type = "object";
259
- json.properties = {};
260
- const shape = def.shape;
261
- for (const key in shape) {
262
- json.properties[key] = process(shape[key], ctx, {
263
- ...params,
264
- path: [...params.path, "properties", key]
265
- });
266
- }
267
- const allKeys = new Set(Object.keys(shape));
268
- const requiredKeys = new Set([...allKeys].filter((key) => {
269
- const v = def.shape[key]._zod;
270
- if (ctx.io === "input") {
271
- return v.optin === void 0;
272
- } else {
273
- return v.optout === void 0;
274
- }
275
- }));
276
- if (requiredKeys.size > 0) {
277
- json.required = Array.from(requiredKeys);
278
- }
279
- if (def.catchall?._zod.def.type === "never") {
280
- json.additionalProperties = false;
281
- } else if (!def.catchall) {
282
- if (ctx.io === "output")
283
- json.additionalProperties = false;
284
- } else if (def.catchall) {
285
- json.additionalProperties = process(def.catchall, ctx, {
286
- ...params,
287
- path: [...params.path, "additionalProperties"]
288
- });
289
- }
290
- };
291
- const unionProcessor = (schema, ctx, json, params) => {
292
- const def = schema._zod.def;
293
- const isExclusive = def.inclusive === false;
294
- const options = def.options.map((x, i) => process(x, ctx, {
295
- ...params,
296
- path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
297
- }));
298
- if (isExclusive) {
299
- json.oneOf = options;
300
- } else {
301
- json.anyOf = options;
302
- }
303
- };
304
- const intersectionProcessor = (schema, ctx, json, params) => {
305
- const def = schema._zod.def;
306
- const a = process(def.left, ctx, {
307
- ...params,
308
- path: [...params.path, "allOf", 0]
309
- });
310
- const b = process(def.right, ctx, {
311
- ...params,
312
- path: [...params.path, "allOf", 1]
313
- });
314
- const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
315
- const allOf = [
316
- ...isSimpleIntersection(a) ? a.allOf : [a],
317
- ...isSimpleIntersection(b) ? b.allOf : [b]
318
- ];
319
- json.allOf = allOf;
320
- };
321
- const tupleProcessor = (schema, ctx, _json, params) => {
322
- const json = _json;
323
- const def = schema._zod.def;
324
- json.type = "array";
325
- const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
326
- const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
327
- const prefixItems = def.items.map((x, i) => process(x, ctx, {
328
- ...params,
329
- path: [...params.path, prefixPath, i]
330
- }));
331
- const rest = def.rest ? process(def.rest, ctx, {
332
- ...params,
333
- path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
334
- }) : null;
335
- if (ctx.target === "draft-2020-12") {
336
- json.prefixItems = prefixItems;
337
- if (rest) {
338
- json.items = rest;
339
- }
340
- } else if (ctx.target === "openapi-3.0") {
341
- json.items = {
342
- anyOf: prefixItems
112
+ return true;
343
113
  };
344
- if (rest) {
345
- json.items.anyOf.push(rest);
346
- }
347
- json.minItems = prefixItems.length;
348
- if (!rest) {
349
- json.maxItems = prefixItems.length;
350
- }
351
- } else {
352
- json.items = prefixItems;
353
- if (rest) {
354
- json.additionalItems = rest;
355
- }
356
- }
357
- const { minimum, maximum } = schema._zod.bag;
358
- if (typeof minimum === "number")
359
- json.minItems = minimum;
360
- if (typeof maximum === "number")
361
- json.maxItems = maximum;
362
- };
363
- const recordProcessor = (schema, ctx, _json, params) => {
364
- const json = _json;
365
- const def = schema._zod.def;
366
- json.type = "object";
367
- const keyType = def.keyType;
368
- const keyBag = keyType._zod.bag;
369
- const patterns = keyBag?.patterns;
370
- if (def.mode === "loose" && patterns && patterns.size > 0) {
371
- const valueSchema = process(def.valueType, ctx, {
372
- ...params,
373
- path: [...params.path, "patternProperties", "*"]
374
- });
375
- json.patternProperties = {};
376
- for (const pattern of patterns) {
377
- json.patternProperties[pattern.source] = valueSchema;
378
- }
379
- } else {
380
- if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
381
- json.propertyNames = process(def.keyType, ctx, {
382
- ...params,
383
- path: [...params.path, "propertyNames"]
384
- });
385
- }
386
- json.additionalProperties = process(def.valueType, ctx, {
387
- ...params,
388
- path: [...params.path, "additionalProperties"]
389
- });
390
- }
391
- const keyValues = keyType._zod.values;
392
- if (keyValues) {
393
- const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
394
- if (validKeyValues.length > 0) {
395
- json.required = validKeyValues;
396
- }
397
- }
398
- };
399
- const nullableProcessor = (schema, ctx, json, params) => {
400
- const def = schema._zod.def;
401
- const inner = process(def.innerType, ctx, params);
402
- const seen = ctx.seen.get(schema);
403
- if (ctx.target === "openapi-3.0") {
404
- seen.ref = def.innerType;
405
- json.nullable = true;
406
- } else {
407
- json.anyOf = [inner, { type: "null" }];
408
- }
409
- };
410
- const nonoptionalProcessor = (schema, ctx, _json, params) => {
411
- const def = schema._zod.def;
412
- process(def.innerType, ctx, params);
413
- const seen = ctx.seen.get(schema);
414
- seen.ref = def.innerType;
415
- };
416
- const defaultProcessor = (schema, ctx, json, params) => {
417
- const def = schema._zod.def;
418
- process(def.innerType, ctx, params);
419
- const seen = ctx.seen.get(schema);
420
- seen.ref = def.innerType;
421
- json.default = JSON.parse(JSON.stringify(def.defaultValue));
422
- };
423
- const prefaultProcessor = (schema, ctx, json, params) => {
424
- const def = schema._zod.def;
425
- process(def.innerType, ctx, params);
426
- const seen = ctx.seen.get(schema);
427
- seen.ref = def.innerType;
428
- if (ctx.io === "input")
429
- json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
430
- };
431
- const catchProcessor = (schema, ctx, json, params) => {
432
- const def = schema._zod.def;
433
- process(def.innerType, ctx, params);
434
- const seen = ctx.seen.get(schema);
435
- seen.ref = def.innerType;
436
- let catchValue;
437
- try {
438
- catchValue = def.catchValue(void 0);
439
- } catch {
440
- throw new Error("Dynamic catch values are not supported in JSON Schema");
441
- }
442
- json.default = catchValue;
443
- };
444
- const pipeProcessor = (schema, ctx, _json, params) => {
445
- const def = schema._zod.def;
446
- const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
447
- process(innerType, ctx, params);
448
- const seen = ctx.seen.get(schema);
449
- seen.ref = innerType;
450
- };
451
- const readonlyProcessor = (schema, ctx, json, params) => {
452
- const def = schema._zod.def;
453
- process(def.innerType, ctx, params);
454
- const seen = ctx.seen.get(schema);
455
- seen.ref = def.innerType;
456
- json.readOnly = true;
457
- };
458
- const promiseProcessor = (schema, ctx, _json, params) => {
459
- const def = schema._zod.def;
460
- process(def.innerType, ctx, params);
461
- const seen = ctx.seen.get(schema);
462
- seen.ref = def.innerType;
463
- };
464
- const optionalProcessor = (schema, ctx, _json, params) => {
465
- const def = schema._zod.def;
466
- process(def.innerType, ctx, params);
467
- const seen = ctx.seen.get(schema);
468
- seen.ref = def.innerType;
469
- };
470
- const lazyProcessor = (schema, ctx, _json, params) => {
471
- const innerType = schema._zod.innerType;
472
- process(innerType, ctx, params);
473
- const seen = ctx.seen.get(schema);
474
- seen.ref = innerType;
475
- };
476
- const allProcessors = {
477
- string: stringProcessor,
478
- number: numberProcessor,
479
- boolean: booleanProcessor,
480
- bigint: bigintProcessor,
481
- symbol: symbolProcessor,
482
- null: nullProcessor,
483
- undefined: undefinedProcessor,
484
- void: voidProcessor,
485
- never: neverProcessor,
486
- any: anyProcessor,
487
- unknown: unknownProcessor,
488
- date: dateProcessor,
489
- enum: enumProcessor,
490
- literal: literalProcessor,
491
- nan: nanProcessor,
492
- template_literal: templateLiteralProcessor,
493
- file: fileProcessor,
494
- success: successProcessor,
495
- custom: customProcessor,
496
- function: functionProcessor,
497
- transform: transformProcessor,
498
- map: mapProcessor,
499
- set: setProcessor,
500
- array: arrayProcessor,
501
- object: objectProcessor,
502
- union: unionProcessor,
503
- intersection: intersectionProcessor,
504
- tuple: tupleProcessor,
505
- record: recordProcessor,
506
- nullable: nullableProcessor,
507
- nonoptional: nonoptionalProcessor,
508
- default: defaultProcessor,
509
- prefault: prefaultProcessor,
510
- catch: catchProcessor,
511
- pipe: pipeProcessor,
512
- readonly: readonlyProcessor,
513
- promise: promiseProcessor,
514
- optional: optionalProcessor,
515
- lazy: lazyProcessor
516
- };
517
- function toJSONSchema(input, params) {
518
- if ("_idmap" in input) {
519
- const registry = input;
520
- const ctx2 = initializeContext({ ...params, processors: allProcessors });
521
- const defs = {};
522
- for (const entry of registry._idmap.entries()) {
523
- const [_, schema] = entry;
524
- process(schema, ctx2);
525
- }
526
- const schemas = {};
527
- const external = {
528
- registry,
529
- uri: params?.uri,
530
- defs
114
+ EventEmitter.prototype.on = function on(event, fn, context) {
115
+ return addListener(this, event, fn, context, false);
531
116
  };
532
- ctx2.external = external;
533
- for (const entry of registry._idmap.entries()) {
534
- const [key, schema] = entry;
535
- extractDefs(ctx2, schema);
536
- schemas[key] = finalize(ctx2, schema);
537
- }
538
- if (Object.keys(defs).length > 0) {
539
- const defsSegment = ctx2.target === "draft-2020-12" ? "$defs" : "definitions";
540
- schemas.__shared = {
541
- [defsSegment]: defs
542
- };
543
- }
544
- return { schemas };
545
- }
546
- const ctx = initializeContext({ ...params, processors: allProcessors });
547
- process(input, ctx);
548
- extractDefs(ctx, input);
549
- return finalize(ctx, input);
117
+ EventEmitter.prototype.once = function once(event, fn, context) {
118
+ return addListener(this, event, fn, context, true);
119
+ };
120
+ EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
121
+ var evt = prefix ? prefix + event : event;
122
+ if (!this._events[evt]) return this;
123
+ if (!fn) {
124
+ clearEvent(this, evt);
125
+ return this;
126
+ }
127
+ var listeners = this._events[evt];
128
+ if (listeners.fn) {
129
+ if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
130
+ clearEvent(this, evt);
131
+ }
132
+ } else {
133
+ for (var i = 0, events = [], length = listeners.length; i < length; i++) {
134
+ if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
135
+ events.push(listeners[i]);
136
+ }
137
+ }
138
+ if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
139
+ else clearEvent(this, evt);
140
+ }
141
+ return this;
142
+ };
143
+ EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
144
+ var evt;
145
+ if (event) {
146
+ evt = prefix ? prefix + event : event;
147
+ if (this._events[evt]) clearEvent(this, evt);
148
+ } else {
149
+ this._events = new Events();
150
+ this._eventsCount = 0;
151
+ }
152
+ return this;
153
+ };
154
+ EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
155
+ EventEmitter.prototype.addListener = EventEmitter.prototype.on;
156
+ EventEmitter.prefixed = prefix;
157
+ EventEmitter.EventEmitter = EventEmitter;
158
+ {
159
+ module.exports = EventEmitter;
160
+ }
161
+ })(eventemitter3);
162
+ return eventemitter3.exports;
550
163
  }
551
164
  export {
552
- allProcessors,
553
- anyProcessor,
554
- arrayProcessor,
555
- bigintProcessor,
556
- booleanProcessor,
557
- catchProcessor,
558
- customProcessor,
559
- dateProcessor,
560
- defaultProcessor,
561
- enumProcessor,
562
- fileProcessor,
563
- functionProcessor,
564
- intersectionProcessor,
565
- lazyProcessor,
566
- literalProcessor,
567
- mapProcessor,
568
- nanProcessor,
569
- neverProcessor,
570
- nonoptionalProcessor,
571
- nullProcessor,
572
- nullableProcessor,
573
- numberProcessor,
574
- objectProcessor,
575
- optionalProcessor,
576
- pipeProcessor,
577
- prefaultProcessor,
578
- promiseProcessor,
579
- readonlyProcessor,
580
- recordProcessor,
581
- setProcessor,
582
- stringProcessor,
583
- successProcessor,
584
- symbolProcessor,
585
- templateLiteralProcessor,
586
- toJSONSchema,
587
- transformProcessor,
588
- tupleProcessor,
589
- undefinedProcessor,
590
- unionProcessor,
591
- unknownProcessor,
592
- voidProcessor
165
+ requireEventemitter3 as __require
593
166
  };
594
167
  //# sourceMappingURL=index.es205.js.map