@mastra/mcp 2.9.0-alpha.3 → 2.9.0-alpha.4
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/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +38 -38
- package/dist/docs/references/docs-connections-mcp.md +2 -0
- package/dist/index.cjs +302 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +302 -5
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
package/dist/docs/SKILL.md
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.9.0-alpha.
|
|
2
|
+
"version": "2.9.0-alpha.4",
|
|
3
3
|
"package": "@mastra/mcp",
|
|
4
4
|
"exports": {
|
|
5
5
|
"InMemoryMCPEventCursorStore": {
|
|
6
6
|
"types": "dist/integrations/events-cursor-store.d.ts",
|
|
7
7
|
"implementation": "dist/index.js",
|
|
8
|
-
"line":
|
|
8
|
+
"line": 25749
|
|
9
9
|
},
|
|
10
10
|
"InMemoryMCPTaskStore": {
|
|
11
11
|
"types": "dist/server/tasks/in-memory-store.d.ts",
|
|
12
12
|
"implementation": "dist/index.js",
|
|
13
|
-
"line":
|
|
13
|
+
"line": 22524
|
|
14
14
|
},
|
|
15
15
|
"InMemoryOAuthStorage": {
|
|
16
16
|
"types": "dist/client/oauth-provider.d.ts",
|
|
17
17
|
"implementation": "dist/index.js",
|
|
18
|
-
"line":
|
|
18
|
+
"line": 18097
|
|
19
19
|
},
|
|
20
20
|
"InMemoryWebhookSubscriptionStore": {
|
|
21
21
|
"types": "dist/server/events/webhook-store.d.ts",
|
|
22
22
|
"implementation": "dist/index.js",
|
|
23
|
-
"line":
|
|
23
|
+
"line": 20894
|
|
24
24
|
},
|
|
25
25
|
"InternalMastraMCPClient": {
|
|
26
26
|
"types": "dist/client/client.d.ts",
|
|
27
27
|
"implementation": "dist/index.js",
|
|
28
|
-
"line":
|
|
28
|
+
"line": 16367
|
|
29
29
|
},
|
|
30
30
|
"MCPClient": {
|
|
31
31
|
"types": "dist/client/configuration.d.ts",
|
|
32
32
|
"implementation": "dist/index.js",
|
|
33
|
-
"line":
|
|
33
|
+
"line": 18590
|
|
34
34
|
},
|
|
35
35
|
"MCPClientServerProxy": {
|
|
36
36
|
"types": "dist/client/server-proxy.d.ts",
|
|
37
37
|
"implementation": "dist/index.js",
|
|
38
|
-
"line":
|
|
38
|
+
"line": 18438
|
|
39
39
|
},
|
|
40
40
|
"MCPEventsSignalProvider": {
|
|
41
41
|
"types": "dist/integrations/events-signals.d.ts",
|
|
42
42
|
"implementation": "dist/index.js",
|
|
43
|
-
"line":
|
|
43
|
+
"line": 25934
|
|
44
44
|
},
|
|
45
45
|
"MCPOAuthClientProvider": {
|
|
46
46
|
"types": "dist/client/oauth-provider.d.ts",
|
|
47
47
|
"implementation": "dist/index.js",
|
|
48
|
-
"line":
|
|
48
|
+
"line": 18149
|
|
49
49
|
},
|
|
50
50
|
"MCPServer": {
|
|
51
51
|
"types": "dist/server/server.d.ts",
|
|
52
52
|
"implementation": "dist/index.js",
|
|
53
|
-
"line":
|
|
53
|
+
"line": 23539
|
|
54
54
|
},
|
|
55
55
|
"MCPTaskLimitError": {
|
|
56
56
|
"types": "dist/server/tasks/store.d.ts",
|
|
57
57
|
"implementation": "dist/index.js",
|
|
58
|
-
"line":
|
|
58
|
+
"line": 21706
|
|
59
59
|
},
|
|
60
60
|
"MCP_CALL_TOOL_CONTENT": {
|
|
61
61
|
"types": "dist/client/client.d.ts",
|
|
62
62
|
"implementation": "dist/index.js",
|
|
63
|
-
"line":
|
|
63
|
+
"line": 16211
|
|
64
64
|
},
|
|
65
65
|
"MCP_CALL_TOOL_META": {
|
|
66
66
|
"types": "dist/client/client.d.ts",
|
|
67
67
|
"implementation": "dist/index.js",
|
|
68
|
-
"line":
|
|
68
|
+
"line": 16213
|
|
69
69
|
},
|
|
70
70
|
"MCP_CLIENT_PROTOCOL_VERSION": {
|
|
71
71
|
"types": "dist/client/types.d.ts",
|
|
@@ -75,122 +75,122 @@
|
|
|
75
75
|
"MCP_DISCOVERY_TIMEOUT_CODE": {
|
|
76
76
|
"types": "dist/client/configuration.d.ts",
|
|
77
77
|
"implementation": "dist/index.js",
|
|
78
|
-
"line":
|
|
78
|
+
"line": 18559
|
|
79
79
|
},
|
|
80
80
|
"MCP_PROTOCOL_VERSION": {
|
|
81
81
|
"types": "dist/server/types.d.ts",
|
|
82
82
|
"implementation": "dist/index.js",
|
|
83
|
-
"line":
|
|
83
|
+
"line": 25476
|
|
84
84
|
},
|
|
85
85
|
"ServerEventActions": {
|
|
86
86
|
"types": "dist/server/events/actions.d.ts",
|
|
87
87
|
"implementation": "dist/index.js",
|
|
88
|
-
"line":
|
|
88
|
+
"line": 19995
|
|
89
89
|
},
|
|
90
90
|
"ServerPromptActions": {
|
|
91
91
|
"types": "dist/server/actions.d.ts",
|
|
92
92
|
"implementation": "dist/index.js",
|
|
93
|
-
"line":
|
|
93
|
+
"line": 19975
|
|
94
94
|
},
|
|
95
95
|
"ServerResourceActions": {
|
|
96
96
|
"types": "dist/server/actions.d.ts",
|
|
97
97
|
"implementation": "dist/index.js",
|
|
98
|
-
"line":
|
|
98
|
+
"line": 19961
|
|
99
99
|
},
|
|
100
100
|
"ServerToolActions": {
|
|
101
101
|
"types": "dist/server/actions.d.ts",
|
|
102
102
|
"implementation": "dist/index.js",
|
|
103
|
-
"line":
|
|
103
|
+
"line": 19943
|
|
104
104
|
},
|
|
105
105
|
"createIntrospectionValidator": {
|
|
106
106
|
"types": "dist/server/oauth-middleware.d.ts",
|
|
107
107
|
"implementation": "dist/index.js",
|
|
108
|
-
"line":
|
|
108
|
+
"line": 25668
|
|
109
109
|
},
|
|
110
110
|
"createOAuthCallbackServer": {
|
|
111
111
|
"types": "dist/client/oauth-callback-server.d.ts",
|
|
112
112
|
"implementation": "dist/index.js",
|
|
113
|
-
"line":
|
|
113
|
+
"line": 17979
|
|
114
114
|
},
|
|
115
115
|
"createOAuthMiddleware": {
|
|
116
116
|
"types": "dist/server/oauth-middleware.d.ts",
|
|
117
117
|
"implementation": "dist/index.js",
|
|
118
|
-
"line":
|
|
118
|
+
"line": 25521
|
|
119
119
|
},
|
|
120
120
|
"createSimpleTokenProvider": {
|
|
121
121
|
"types": "dist/client/oauth-provider.d.ts",
|
|
122
122
|
"implementation": "dist/index.js",
|
|
123
|
-
"line":
|
|
123
|
+
"line": 18412
|
|
124
124
|
},
|
|
125
125
|
"createStaticTokenValidator": {
|
|
126
126
|
"types": "dist/server/oauth-middleware.d.ts",
|
|
127
127
|
"implementation": "dist/index.js",
|
|
128
|
-
"line":
|
|
128
|
+
"line": 25637
|
|
129
129
|
},
|
|
130
130
|
"defineEvent": {
|
|
131
131
|
"types": "dist/server/events/define-event.d.ts",
|
|
132
132
|
"implementation": "dist/index.js",
|
|
133
|
-
"line":
|
|
133
|
+
"line": 25739
|
|
134
134
|
},
|
|
135
135
|
"extractBearerToken": {
|
|
136
136
|
"types": "dist/shared/oauth-types.d.ts",
|
|
137
137
|
"implementation": "dist/index.js",
|
|
138
|
-
"line":
|
|
138
|
+
"line": 13517
|
|
139
139
|
},
|
|
140
140
|
"generateProtectedResourceMetadata": {
|
|
141
141
|
"types": "dist/shared/oauth-types.d.ts",
|
|
142
142
|
"implementation": "dist/index.js",
|
|
143
|
-
"line":
|
|
143
|
+
"line": 13501
|
|
144
144
|
},
|
|
145
145
|
"generateWWWAuthenticateHeader": {
|
|
146
146
|
"types": "dist/shared/oauth-types.d.ts",
|
|
147
147
|
"implementation": "dist/index.js",
|
|
148
|
-
"line":
|
|
148
|
+
"line": 13486
|
|
149
149
|
},
|
|
150
150
|
"getCallbackUrlCandidates": {
|
|
151
151
|
"types": "dist/client/oauth-callback-server.d.ts",
|
|
152
152
|
"implementation": "dist/index.js",
|
|
153
|
-
"line":
|
|
153
|
+
"line": 17912
|
|
154
154
|
},
|
|
155
155
|
"getMcpCallToolContent": {
|
|
156
156
|
"types": "dist/client/client.d.ts",
|
|
157
157
|
"implementation": "dist/index.js",
|
|
158
|
-
"line":
|
|
158
|
+
"line": 16233
|
|
159
159
|
},
|
|
160
160
|
"getMcpCallToolMeta": {
|
|
161
161
|
"types": "dist/client/client.d.ts",
|
|
162
162
|
"implementation": "dist/index.js",
|
|
163
|
-
"line":
|
|
163
|
+
"line": 16242
|
|
164
164
|
},
|
|
165
165
|
"isMCPTaskStoreAdmin": {
|
|
166
166
|
"types": "dist/server/tasks/store.d.ts",
|
|
167
167
|
"implementation": "dist/index.js",
|
|
168
|
-
"line":
|
|
168
|
+
"line": 21757
|
|
169
169
|
},
|
|
170
170
|
"isWorkflowTaskContext": {
|
|
171
171
|
"types": "dist/server/tasks/workflow-runs.d.ts",
|
|
172
172
|
"implementation": "dist/index.js",
|
|
173
|
-
"line":
|
|
173
|
+
"line": 23297
|
|
174
174
|
},
|
|
175
175
|
"principalKeyOf": {
|
|
176
176
|
"types": "dist/server/tasks/store.d.ts",
|
|
177
177
|
"implementation": "dist/index.js",
|
|
178
|
-
"line":
|
|
178
|
+
"line": 21698
|
|
179
179
|
},
|
|
180
180
|
"taskKeyOf": {
|
|
181
181
|
"types": "dist/shared/tasks/task-id.d.ts",
|
|
182
182
|
"implementation": "dist/index.js",
|
|
183
|
-
"line":
|
|
183
|
+
"line": 13681
|
|
184
184
|
},
|
|
185
185
|
"traceContextFromMeta": {
|
|
186
186
|
"types": "dist/shared/trace-context.d.ts",
|
|
187
187
|
"implementation": "dist/index.js",
|
|
188
|
-
"line":
|
|
188
|
+
"line": 13703
|
|
189
189
|
},
|
|
190
190
|
"traceContextToMeta": {
|
|
191
191
|
"types": "dist/shared/trace-context.d.ts",
|
|
192
192
|
"implementation": "dist/index.js",
|
|
193
|
-
"line":
|
|
193
|
+
"line": 13715
|
|
194
194
|
}
|
|
195
195
|
},
|
|
196
196
|
"modules": {}
|
|
@@ -200,6 +200,8 @@ export async function handleRequest(prompt: string, apiKey: string) {
|
|
|
200
200
|
|
|
201
201
|
Visit [`listTools()`](https://mastra.ai/reference/tools/mcp-client) and [`listToolsets()`](https://mastra.ai/reference/tools/mcp-client) for their full APIs.
|
|
202
202
|
|
|
203
|
+
This example finishes within one request. When agent work must continue after the request ends or survive a process restart, use [durable agents](https://mastra.ai/docs/harness/durable-agents) or [background tasks](https://mastra.ai/docs/harness/background-tasks) instead of building your own task tracking. Call-time `toolsets` can't move to another process, so with a durable agent, load per-request MCP tools in the agent's `tools` function from [request context](https://mastra.ai/docs/server/request-context).
|
|
204
|
+
|
|
203
205
|
### Tool approval
|
|
204
206
|
|
|
205
207
|
Set `requireToolApproval` on a server to require approval for all its tools:
|
package/dist/index.cjs
CHANGED
|
@@ -1356,7 +1356,7 @@ var require_json_schema_traverse = /* @__PURE__ */ __commonJSMin$1(((exports, mo
|
|
|
1356
1356
|
return str.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
1357
1357
|
}
|
|
1358
1358
|
}));
|
|
1359
|
-
// ../schema-compat/dist/json-schema-
|
|
1359
|
+
// ../schema-compat/dist/json-schema-Ln9bxqtn.js
|
|
1360
1360
|
var require_code$1 = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
1361
1361
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1362
1362
|
exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
|
|
@@ -8196,8 +8196,303 @@ var require__2020 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
8196
8196
|
}
|
|
8197
8197
|
});
|
|
8198
8198
|
}));
|
|
8199
|
+
var require_formats = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
8200
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8201
|
+
exports.formatNames = exports.fastFormats = exports.fullFormats = void 0;
|
|
8202
|
+
function fmtDef(validate, compare) {
|
|
8203
|
+
return {
|
|
8204
|
+
validate,
|
|
8205
|
+
compare
|
|
8206
|
+
};
|
|
8207
|
+
}
|
|
8208
|
+
exports.fullFormats = {
|
|
8209
|
+
date: fmtDef(date, compareDate),
|
|
8210
|
+
time: fmtDef(getTime(true), compareTime),
|
|
8211
|
+
"date-time": fmtDef(getDateTime(true), compareDateTime),
|
|
8212
|
+
"iso-time": fmtDef(getTime(), compareIsoTime),
|
|
8213
|
+
"iso-date-time": fmtDef(getDateTime(), compareIsoDateTime),
|
|
8214
|
+
duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,
|
|
8215
|
+
uri,
|
|
8216
|
+
"uri-reference": /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[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]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,
|
|
8223
|
+
regex,
|
|
8224
|
+
uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,
|
|
8225
|
+
"json-pointer": /^(?:\/(?:[^~/]|~0|~1)*)*$/,
|
|
8226
|
+
"json-pointer-uri-fragment": /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,
|
|
8227
|
+
"relative-json-pointer": /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,
|
|
8228
|
+
byte,
|
|
8229
|
+
int32: {
|
|
8230
|
+
type: "number",
|
|
8231
|
+
validate: validateInt32
|
|
8232
|
+
},
|
|
8233
|
+
int64: {
|
|
8234
|
+
type: "number",
|
|
8235
|
+
validate: validateInt64
|
|
8236
|
+
},
|
|
8237
|
+
float: {
|
|
8238
|
+
type: "number",
|
|
8239
|
+
validate: validateNumber
|
|
8240
|
+
},
|
|
8241
|
+
double: {
|
|
8242
|
+
type: "number",
|
|
8243
|
+
validate: validateNumber
|
|
8244
|
+
},
|
|
8245
|
+
password: true,
|
|
8246
|
+
binary: true
|
|
8247
|
+
};
|
|
8248
|
+
exports.fastFormats = {
|
|
8249
|
+
...exports.fullFormats,
|
|
8250
|
+
date: fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/, compareDate),
|
|
8251
|
+
time: fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareTime),
|
|
8252
|
+
"date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareDateTime),
|
|
8253
|
+
"iso-time": fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareIsoTime),
|
|
8254
|
+
"iso-date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareIsoDateTime),
|
|
8255
|
+
uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
|
|
8256
|
+
"uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
|
|
8257
|
+
email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i
|
|
8258
|
+
};
|
|
8259
|
+
exports.formatNames = Object.keys(exports.fullFormats);
|
|
8260
|
+
function isLeapYear(year) {
|
|
8261
|
+
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
8262
|
+
}
|
|
8263
|
+
const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
8264
|
+
const DAYS = [
|
|
8265
|
+
0,
|
|
8266
|
+
31,
|
|
8267
|
+
28,
|
|
8268
|
+
31,
|
|
8269
|
+
30,
|
|
8270
|
+
31,
|
|
8271
|
+
30,
|
|
8272
|
+
31,
|
|
8273
|
+
31,
|
|
8274
|
+
30,
|
|
8275
|
+
31,
|
|
8276
|
+
30,
|
|
8277
|
+
31
|
|
8278
|
+
];
|
|
8279
|
+
function date(str) {
|
|
8280
|
+
const matches = DATE.exec(str);
|
|
8281
|
+
if (!matches) return false;
|
|
8282
|
+
const year = +matches[1];
|
|
8283
|
+
const month = +matches[2];
|
|
8284
|
+
const day = +matches[3];
|
|
8285
|
+
return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month]);
|
|
8286
|
+
}
|
|
8287
|
+
function compareDate(d1, d2) {
|
|
8288
|
+
if (!(d1 && d2)) return void 0;
|
|
8289
|
+
if (d1 > d2) return 1;
|
|
8290
|
+
if (d1 < d2) return -1;
|
|
8291
|
+
return 0;
|
|
8292
|
+
}
|
|
8293
|
+
const TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
|
|
8294
|
+
function getTime(strictTimeZone) {
|
|
8295
|
+
return function time(str) {
|
|
8296
|
+
const matches = TIME.exec(str);
|
|
8297
|
+
if (!matches) return false;
|
|
8298
|
+
const hr = +matches[1];
|
|
8299
|
+
const min = +matches[2];
|
|
8300
|
+
const sec = +matches[3];
|
|
8301
|
+
const tz = matches[4];
|
|
8302
|
+
const tzSign = matches[5] === "-" ? -1 : 1;
|
|
8303
|
+
const tzH = +(matches[6] || 0);
|
|
8304
|
+
const tzM = +(matches[7] || 0);
|
|
8305
|
+
if (tzH > 23 || tzM > 59 || strictTimeZone && !tz) return false;
|
|
8306
|
+
if (hr <= 23 && min <= 59 && sec < 60) return true;
|
|
8307
|
+
const utcMin = min - tzM * tzSign;
|
|
8308
|
+
const utcHr = hr - tzH * tzSign - (utcMin < 0 ? 1 : 0);
|
|
8309
|
+
return (utcHr === 23 || utcHr === -1) && (utcMin === 59 || utcMin === -1) && sec < 61;
|
|
8310
|
+
};
|
|
8311
|
+
}
|
|
8312
|
+
function compareTime(s1, s2) {
|
|
8313
|
+
if (!(s1 && s2)) return void 0;
|
|
8314
|
+
const t1 = (/* @__PURE__ */ new Date("2020-01-01T" + s1)).valueOf();
|
|
8315
|
+
const t2 = (/* @__PURE__ */ new Date("2020-01-01T" + s2)).valueOf();
|
|
8316
|
+
if (!(t1 && t2)) return void 0;
|
|
8317
|
+
return t1 - t2;
|
|
8318
|
+
}
|
|
8319
|
+
function compareIsoTime(t1, t2) {
|
|
8320
|
+
if (!(t1 && t2)) return void 0;
|
|
8321
|
+
const a1 = TIME.exec(t1);
|
|
8322
|
+
const a2 = TIME.exec(t2);
|
|
8323
|
+
if (!(a1 && a2)) return void 0;
|
|
8324
|
+
t1 = a1[1] + a1[2] + a1[3];
|
|
8325
|
+
t2 = a2[1] + a2[2] + a2[3];
|
|
8326
|
+
if (t1 > t2) return 1;
|
|
8327
|
+
if (t1 < t2) return -1;
|
|
8328
|
+
return 0;
|
|
8329
|
+
}
|
|
8330
|
+
const DATE_TIME_SEPARATOR = /t|\s/i;
|
|
8331
|
+
function getDateTime(strictTimeZone) {
|
|
8332
|
+
const time = getTime(strictTimeZone);
|
|
8333
|
+
return function date_time(str) {
|
|
8334
|
+
const dateTime = str.split(DATE_TIME_SEPARATOR);
|
|
8335
|
+
return dateTime.length === 2 && date(dateTime[0]) && time(dateTime[1]);
|
|
8336
|
+
};
|
|
8337
|
+
}
|
|
8338
|
+
function compareDateTime(dt1, dt2) {
|
|
8339
|
+
if (!(dt1 && dt2)) return void 0;
|
|
8340
|
+
const d1 = new Date(dt1).valueOf();
|
|
8341
|
+
const d2 = new Date(dt2).valueOf();
|
|
8342
|
+
if (!(d1 && d2)) return void 0;
|
|
8343
|
+
return d1 - d2;
|
|
8344
|
+
}
|
|
8345
|
+
function compareIsoDateTime(dt1, dt2) {
|
|
8346
|
+
if (!(dt1 && dt2)) return void 0;
|
|
8347
|
+
const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR);
|
|
8348
|
+
const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR);
|
|
8349
|
+
const res = compareDate(d1, d2);
|
|
8350
|
+
if (res === void 0) return void 0;
|
|
8351
|
+
return res || compareTime(t1, t2);
|
|
8352
|
+
}
|
|
8353
|
+
const NOT_URI_FRAGMENT = /\/|:/;
|
|
8354
|
+
const URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
8355
|
+
function uri(str) {
|
|
8356
|
+
return NOT_URI_FRAGMENT.test(str) && URI.test(str);
|
|
8357
|
+
}
|
|
8358
|
+
const BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;
|
|
8359
|
+
function byte(str) {
|
|
8360
|
+
BYTE.lastIndex = 0;
|
|
8361
|
+
return BYTE.test(str);
|
|
8362
|
+
}
|
|
8363
|
+
const MIN_INT32 = -(2 ** 31);
|
|
8364
|
+
const MAX_INT32 = 2 ** 31 - 1;
|
|
8365
|
+
function validateInt32(value) {
|
|
8366
|
+
return Number.isInteger(value) && value <= MAX_INT32 && value >= MIN_INT32;
|
|
8367
|
+
}
|
|
8368
|
+
function validateInt64(value) {
|
|
8369
|
+
return Number.isInteger(value);
|
|
8370
|
+
}
|
|
8371
|
+
function validateNumber() {
|
|
8372
|
+
return true;
|
|
8373
|
+
}
|
|
8374
|
+
const Z_ANCHOR = /[^\\]\\Z/;
|
|
8375
|
+
function regex(str) {
|
|
8376
|
+
if (Z_ANCHOR.test(str)) return false;
|
|
8377
|
+
try {
|
|
8378
|
+
new RegExp(str);
|
|
8379
|
+
return true;
|
|
8380
|
+
} catch (e) {
|
|
8381
|
+
return false;
|
|
8382
|
+
}
|
|
8383
|
+
}
|
|
8384
|
+
}));
|
|
8385
|
+
var require_limit = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
8386
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8387
|
+
exports.formatLimitDefinition = void 0;
|
|
8388
|
+
const ajv_1 = require_ajv();
|
|
8389
|
+
const codegen_1 = require_codegen();
|
|
8390
|
+
const ops = codegen_1.operators;
|
|
8391
|
+
const KWDs = {
|
|
8392
|
+
formatMaximum: {
|
|
8393
|
+
okStr: "<=",
|
|
8394
|
+
ok: ops.LTE,
|
|
8395
|
+
fail: ops.GT
|
|
8396
|
+
},
|
|
8397
|
+
formatMinimum: {
|
|
8398
|
+
okStr: ">=",
|
|
8399
|
+
ok: ops.GTE,
|
|
8400
|
+
fail: ops.LT
|
|
8401
|
+
},
|
|
8402
|
+
formatExclusiveMaximum: {
|
|
8403
|
+
okStr: "<",
|
|
8404
|
+
ok: ops.LT,
|
|
8405
|
+
fail: ops.GTE
|
|
8406
|
+
},
|
|
8407
|
+
formatExclusiveMinimum: {
|
|
8408
|
+
okStr: ">",
|
|
8409
|
+
ok: ops.GT,
|
|
8410
|
+
fail: ops.LTE
|
|
8411
|
+
}
|
|
8412
|
+
};
|
|
8413
|
+
exports.formatLimitDefinition = {
|
|
8414
|
+
keyword: Object.keys(KWDs),
|
|
8415
|
+
type: "string",
|
|
8416
|
+
schemaType: "string",
|
|
8417
|
+
$data: true,
|
|
8418
|
+
error: {
|
|
8419
|
+
message: ({ keyword, schemaCode }) => (0, codegen_1.str)`should be ${KWDs[keyword].okStr} ${schemaCode}`,
|
|
8420
|
+
params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`
|
|
8421
|
+
},
|
|
8422
|
+
code(cxt) {
|
|
8423
|
+
const { gen, data, schemaCode, keyword, it } = cxt;
|
|
8424
|
+
const { opts, self } = it;
|
|
8425
|
+
if (!opts.validateFormats) return;
|
|
8426
|
+
const fCxt = new ajv_1.KeywordCxt(it, self.RULES.all.format.definition, "format");
|
|
8427
|
+
if (fCxt.$data) validate$DataFormat();
|
|
8428
|
+
else validateFormat();
|
|
8429
|
+
function validate$DataFormat() {
|
|
8430
|
+
const fmts = gen.scopeValue("formats", {
|
|
8431
|
+
ref: self.formats,
|
|
8432
|
+
code: opts.code.formats
|
|
8433
|
+
});
|
|
8434
|
+
const fmt = gen.const("fmt", (0, codegen_1._)`${fmts}[${fCxt.schemaCode}]`);
|
|
8435
|
+
cxt.fail$data((0, codegen_1.or)((0, codegen_1._)`typeof ${fmt} != "object"`, (0, codegen_1._)`${fmt} instanceof RegExp`, (0, codegen_1._)`typeof ${fmt}.compare != "function"`, compareCode(fmt)));
|
|
8436
|
+
}
|
|
8437
|
+
function validateFormat() {
|
|
8438
|
+
const format = fCxt.schema;
|
|
8439
|
+
const fmtDef = self.formats[format];
|
|
8440
|
+
if (!fmtDef || fmtDef === true) return;
|
|
8441
|
+
if (typeof fmtDef != "object" || fmtDef instanceof RegExp || typeof fmtDef.compare != "function") throw new Error(`"${keyword}": format "${format}" does not define "compare" function`);
|
|
8442
|
+
const fmt = gen.scopeValue("formats", {
|
|
8443
|
+
key: format,
|
|
8444
|
+
ref: fmtDef,
|
|
8445
|
+
code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(format)}` : void 0
|
|
8446
|
+
});
|
|
8447
|
+
cxt.fail$data(compareCode(fmt));
|
|
8448
|
+
}
|
|
8449
|
+
function compareCode(fmt) {
|
|
8450
|
+
return (0, codegen_1._)`${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword].fail} 0`;
|
|
8451
|
+
}
|
|
8452
|
+
},
|
|
8453
|
+
dependencies: ["format"]
|
|
8454
|
+
};
|
|
8455
|
+
const formatLimitPlugin = (ajv) => {
|
|
8456
|
+
ajv.addKeyword(exports.formatLimitDefinition);
|
|
8457
|
+
return ajv;
|
|
8458
|
+
};
|
|
8459
|
+
exports.default = formatLimitPlugin;
|
|
8460
|
+
}));
|
|
8461
|
+
var require_dist = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
8462
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8463
|
+
const formats_1 = require_formats();
|
|
8464
|
+
const limit_1 = require_limit();
|
|
8465
|
+
const codegen_1 = require_codegen();
|
|
8466
|
+
const fullName = new codegen_1.Name("fullFormats");
|
|
8467
|
+
const fastName = new codegen_1.Name("fastFormats");
|
|
8468
|
+
const formatsPlugin = (ajv, opts = { keywords: true }) => {
|
|
8469
|
+
if (Array.isArray(opts)) {
|
|
8470
|
+
addFormats(ajv, opts, formats_1.fullFormats, fullName);
|
|
8471
|
+
return ajv;
|
|
8472
|
+
}
|
|
8473
|
+
const [formats, exportName] = opts.mode === "fast" ? [formats_1.fastFormats, fastName] : [formats_1.fullFormats, fullName];
|
|
8474
|
+
addFormats(ajv, opts.formats || formats_1.formatNames, formats, exportName);
|
|
8475
|
+
if (opts.keywords) (0, limit_1.default)(ajv);
|
|
8476
|
+
return ajv;
|
|
8477
|
+
};
|
|
8478
|
+
formatsPlugin.get = (name, mode = "full") => {
|
|
8479
|
+
const f = (mode === "fast" ? formats_1.fastFormats : formats_1.fullFormats)[name];
|
|
8480
|
+
if (!f) throw new Error(`Unknown format "${name}"`);
|
|
8481
|
+
return f;
|
|
8482
|
+
};
|
|
8483
|
+
function addFormats(ajv, list, fs, exportName) {
|
|
8484
|
+
var _a;
|
|
8485
|
+
var _b;
|
|
8486
|
+
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 || (_b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
|
|
8487
|
+
for (const f of list) ajv.addFormat(f, fs[f]);
|
|
8488
|
+
}
|
|
8489
|
+
module.exports = exports = formatsPlugin;
|
|
8490
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8491
|
+
exports.default = formatsPlugin;
|
|
8492
|
+
}));
|
|
8199
8493
|
var import_ajv = require_ajv();
|
|
8200
8494
|
var import__2020 = /* @__PURE__ */ __toESM$1(require__2020(), 1);
|
|
8495
|
+
var import_dist = /* @__PURE__ */ __toESM$1(require_dist(), 1);
|
|
8201
8496
|
var import_json_schema_traverse$2 = /* @__PURE__ */ __toESM$1(require_json_schema_traverse(), 1);
|
|
8202
8497
|
/**
|
|
8203
8498
|
* Vendor name for JSON Schema wrapped schemas.
|
|
@@ -8324,13 +8619,15 @@ var JsonSchemaWrapper = class {
|
|
|
8324
8619
|
*/
|
|
8325
8620
|
#getAjvValidator() {
|
|
8326
8621
|
if (!this.#ajvValidateCache) {
|
|
8327
|
-
const
|
|
8328
|
-
this.#ajvInstance = new AjvClass({
|
|
8622
|
+
const ajv = new (typeof this.#schema.$schema === "string" && this.#schema.$schema.includes("2020-12") ? import__2020.default : import_ajv.Ajv)({
|
|
8329
8623
|
allErrors: true,
|
|
8330
8624
|
strict: false,
|
|
8331
8625
|
...this.#options.ajvOptions
|
|
8332
8626
|
});
|
|
8333
|
-
|
|
8627
|
+
(0, import_dist.default)(ajv);
|
|
8628
|
+
for (const [name, format] of Object.entries(this.#options.ajvOptions?.formats ?? {})) if (format !== void 0) ajv.addFormat(name, format);
|
|
8629
|
+
this.#ajvInstance = ajv;
|
|
8630
|
+
this.#ajvValidateCache = ajv.compile(this.#schema);
|
|
8334
8631
|
}
|
|
8335
8632
|
return this.#ajvValidateCache;
|
|
8336
8633
|
}
|
|
@@ -8482,7 +8779,7 @@ function toStandardSchema$3(zodSchema) {
|
|
|
8482
8779
|
});
|
|
8483
8780
|
return wrapper;
|
|
8484
8781
|
}
|
|
8485
|
-
// ../schema-compat/dist/schema-
|
|
8782
|
+
// ../schema-compat/dist/schema-xsUy1mlm.js
|
|
8486
8783
|
/**
|
|
8487
8784
|
* Supported JSON Schema targets for z.toJSONSchema().
|
|
8488
8785
|
* Works with both real Zod v4 and Zod 3.25's v4 compat layer.
|