@langchain/core 1.1.20 → 1.1.22

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.
@@ -0,0 +1,260 @@
1
+ import { __export } from "../_virtual/rolldown_runtime.js";
2
+
3
+ //#region src/utils/ssrf.ts
4
+ var ssrf_exports = {};
5
+ __export(ssrf_exports, {
6
+ isCloudMetadata: () => isCloudMetadata,
7
+ isLocalhost: () => isLocalhost,
8
+ isPrivateIp: () => isPrivateIp,
9
+ isSafeUrl: () => isSafeUrl,
10
+ isSameOrigin: () => isSameOrigin,
11
+ validateSafeUrl: () => validateSafeUrl
12
+ });
13
+ const PRIVATE_IP_RANGES = [
14
+ "10.0.0.0/8",
15
+ "172.16.0.0/12",
16
+ "192.168.0.0/16",
17
+ "127.0.0.0/8",
18
+ "169.254.0.0/16",
19
+ "0.0.0.0/8",
20
+ "::1/128",
21
+ "fc00::/7",
22
+ "fe80::/10",
23
+ "ff00::/8"
24
+ ];
25
+ const CLOUD_METADATA_IPS = [
26
+ "169.254.169.254",
27
+ "169.254.170.2",
28
+ "100.100.100.200"
29
+ ];
30
+ const CLOUD_METADATA_HOSTNAMES = [
31
+ "metadata.google.internal",
32
+ "metadata",
33
+ "instance-data"
34
+ ];
35
+ const LOCALHOST_NAMES = ["localhost", "localhost.localdomain"];
36
+ /**
37
+ * IPv4 regex: four octets 0-255
38
+ */
39
+ const IPV4_REGEX = /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;
40
+ /**
41
+ * Check if a string is a valid IPv4 address.
42
+ */
43
+ function isIPv4(ip) {
44
+ return IPV4_REGEX.test(ip);
45
+ }
46
+ /**
47
+ * Check if a string is a valid IPv6 address.
48
+ * Uses expandIpv6 for validation.
49
+ */
50
+ function isIPv6(ip) {
51
+ return expandIpv6(ip) !== null;
52
+ }
53
+ /**
54
+ * Check if a string is a valid IP address (IPv4 or IPv6).
55
+ */
56
+ function isIP(ip) {
57
+ return isIPv4(ip) || isIPv6(ip);
58
+ }
59
+ /**
60
+ * Parse an IP address string to an array of integers (for IPv4) or an array of 16-bit values (for IPv6)
61
+ * Returns null if the IP is invalid.
62
+ */
63
+ function parseIp(ip) {
64
+ if (isIPv4(ip)) return ip.split(".").map((octet) => parseInt(octet, 10));
65
+ else if (isIPv6(ip)) {
66
+ const expanded = expandIpv6(ip);
67
+ if (!expanded) return null;
68
+ const parts = expanded.split(":");
69
+ const result = [];
70
+ for (const part of parts) result.push(parseInt(part, 16));
71
+ return result;
72
+ }
73
+ return null;
74
+ }
75
+ /**
76
+ * Expand compressed IPv6 address to full form.
77
+ */
78
+ function expandIpv6(ip) {
79
+ if (!ip || typeof ip !== "string") return null;
80
+ if (!ip.includes(":")) return null;
81
+ if (!/^[0-9a-fA-F:]+$/.test(ip)) return null;
82
+ let normalized = ip;
83
+ if (normalized.includes("::")) {
84
+ const parts$1 = normalized.split("::");
85
+ if (parts$1.length > 2) return null;
86
+ const [left, right] = parts$1;
87
+ const leftParts = left ? left.split(":") : [];
88
+ const rightParts = right ? right.split(":") : [];
89
+ const missing = 8 - (leftParts.length + rightParts.length);
90
+ if (missing < 0) return null;
91
+ const zeros = Array(missing).fill("0");
92
+ normalized = [
93
+ ...leftParts,
94
+ ...zeros,
95
+ ...rightParts
96
+ ].filter((p) => p !== "").join(":");
97
+ }
98
+ const parts = normalized.split(":");
99
+ if (parts.length !== 8) return null;
100
+ for (const part of parts) {
101
+ if (part.length === 0 || part.length > 4) return null;
102
+ if (!/^[0-9a-fA-F]+$/.test(part)) return null;
103
+ }
104
+ return parts.map((p) => p.padStart(4, "0").toLowerCase()).join(":");
105
+ }
106
+ /**
107
+ * Parse CIDR notation (e.g., "192.168.0.0/24") into network address and prefix length.
108
+ */
109
+ function parseCidr(cidr) {
110
+ const [addrStr, prefixStr] = cidr.split("/");
111
+ if (!addrStr || !prefixStr) return null;
112
+ const addr = parseIp(addrStr);
113
+ if (!addr) return null;
114
+ const prefixLen = parseInt(prefixStr, 10);
115
+ if (isNaN(prefixLen)) return null;
116
+ const isIpv6 = isIPv6(addrStr);
117
+ if (isIpv6 && prefixLen > 128) return null;
118
+ if (!isIpv6 && prefixLen > 32) return null;
119
+ return {
120
+ addr,
121
+ prefixLen,
122
+ isIpv6
123
+ };
124
+ }
125
+ /**
126
+ * Check if an IP address is in a given CIDR range.
127
+ */
128
+ function isIpInCidr(ip, cidr) {
129
+ const ipParsed = parseIp(ip);
130
+ if (!ipParsed) return false;
131
+ const cidrParsed = parseCidr(cidr);
132
+ if (!cidrParsed) return false;
133
+ const isIpv6 = isIPv6(ip);
134
+ if (isIpv6 !== cidrParsed.isIpv6) return false;
135
+ const { addr: cidrAddr, prefixLen } = cidrParsed;
136
+ if (isIpv6) for (let i = 0; i < Math.ceil(prefixLen / 16); i++) {
137
+ const bitsToCheck = Math.min(16, prefixLen - i * 16);
138
+ const mask = 65535 << 16 - bitsToCheck & 65535;
139
+ if ((ipParsed[i] & mask) !== (cidrAddr[i] & mask)) return false;
140
+ }
141
+ else for (let i = 0; i < Math.ceil(prefixLen / 8); i++) {
142
+ const bitsToCheck = Math.min(8, prefixLen - i * 8);
143
+ const mask = 255 << 8 - bitsToCheck & 255;
144
+ if ((ipParsed[i] & mask) !== (cidrAddr[i] & mask)) return false;
145
+ }
146
+ return true;
147
+ }
148
+ /**
149
+ * Check if an IP address is private (RFC 1918, loopback, link-local, etc.)
150
+ */
151
+ function isPrivateIp(ip) {
152
+ if (!isIP(ip)) return false;
153
+ for (const range of PRIVATE_IP_RANGES) if (isIpInCidr(ip, range)) return true;
154
+ return false;
155
+ }
156
+ /**
157
+ * Check if a hostname or IP is a known cloud metadata endpoint.
158
+ */
159
+ function isCloudMetadata(hostname, ip) {
160
+ if (CLOUD_METADATA_IPS.includes(ip || "")) return true;
161
+ const lowerHostname = hostname.toLowerCase();
162
+ if (CLOUD_METADATA_HOSTNAMES.includes(lowerHostname)) return true;
163
+ return false;
164
+ }
165
+ /**
166
+ * Check if a hostname or IP is localhost.
167
+ */
168
+ function isLocalhost(hostname, ip) {
169
+ if (ip) {
170
+ if (ip === "127.0.0.1" || ip === "::1" || ip === "0.0.0.0") return true;
171
+ if (ip.startsWith("127.")) return true;
172
+ }
173
+ const lowerHostname = hostname.toLowerCase();
174
+ if (LOCALHOST_NAMES.includes(lowerHostname)) return true;
175
+ return false;
176
+ }
177
+ /**
178
+ * Validate that a URL is safe to connect to.
179
+ * Performs static validation checks against hostnames and direct IP addresses.
180
+ * Does not perform DNS resolution.
181
+ *
182
+ * @param url URL to validate
183
+ * @param options.allowPrivate Allow private IPs (default: false)
184
+ * @param options.allowHttp Allow http:// scheme (default: false)
185
+ * @returns The validated URL
186
+ * @throws Error if URL is not safe
187
+ */
188
+ function validateSafeUrl(url, options) {
189
+ const allowPrivate = options?.allowPrivate ?? false;
190
+ const allowHttp = options?.allowHttp ?? false;
191
+ try {
192
+ let parsedUrl;
193
+ try {
194
+ parsedUrl = new URL(url);
195
+ } catch {
196
+ throw new Error(`Invalid URL: ${url}`);
197
+ }
198
+ const hostname = parsedUrl.hostname;
199
+ if (!hostname) throw new Error("URL missing hostname.");
200
+ if (isCloudMetadata(hostname)) throw new Error(`URL points to cloud metadata endpoint: ${hostname}`);
201
+ if (isLocalhost(hostname)) {
202
+ if (!allowPrivate) throw new Error(`URL points to localhost: ${hostname}`);
203
+ return url;
204
+ }
205
+ const scheme = parsedUrl.protocol;
206
+ if (scheme !== "http:" && scheme !== "https:") throw new Error(`Invalid URL scheme: ${scheme}. Only http and https are allowed.`);
207
+ if (scheme === "http:" && !allowHttp) throw new Error("HTTP scheme not allowed. Use HTTPS or set allowHttp: true.");
208
+ if (isIP(hostname)) {
209
+ const ip = hostname;
210
+ if (isLocalhost(hostname, ip)) {
211
+ if (!allowPrivate) throw new Error(`URL points to localhost: ${hostname}`);
212
+ return url;
213
+ }
214
+ if (isCloudMetadata(hostname, ip)) throw new Error(`URL resolves to cloud metadata IP: ${ip} (${hostname})`);
215
+ if (isPrivateIp(ip)) {
216
+ if (!allowPrivate) throw new Error(`URL resolves to private IP: ${ip} (${hostname}). Set allowPrivate: true to allow.`);
217
+ }
218
+ return url;
219
+ }
220
+ return url;
221
+ } catch (error) {
222
+ if (error && typeof error === "object" && "message" in error) throw error;
223
+ throw new Error(`URL validation failed: ${error}`);
224
+ }
225
+ }
226
+ /**
227
+ * Check if a URL is safe to connect to (non-throwing version).
228
+ *
229
+ * @param url URL to check
230
+ * @param options.allowPrivate Allow private IPs (default: false)
231
+ * @param options.allowHttp Allow http:// scheme (default: false)
232
+ * @returns true if URL is safe, false otherwise
233
+ */
234
+ function isSafeUrl(url, options) {
235
+ try {
236
+ validateSafeUrl(url, options);
237
+ return true;
238
+ } catch {
239
+ return false;
240
+ }
241
+ }
242
+ /**
243
+ * Check if two URLs have the same origin (scheme, host, port).
244
+ * Uses semantic URL parsing to prevent SSRF bypasses via URL variations.
245
+ *
246
+ * @param url1 First URL
247
+ * @param url2 Second URL
248
+ * @returns true if both URLs have the same origin, false otherwise
249
+ */
250
+ function isSameOrigin(url1, url2) {
251
+ try {
252
+ return new URL(url1).origin === new URL(url2).origin;
253
+ } catch {
254
+ return false;
255
+ }
256
+ }
257
+
258
+ //#endregion
259
+ export { isCloudMetadata, isLocalhost, isPrivateIp, isSafeUrl, isSameOrigin, ssrf_exports, validateSafeUrl };
260
+ //# sourceMappingURL=ssrf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ssrf.js","names":["ip: string","result: number[]","parts","cidr: string","hostname: string","ip?: string","url: string","options?: { allowPrivate?: boolean; allowHttp?: boolean }","parsedUrl: URL","url1: string","url2: string"],"sources":["../../src/utils/ssrf.ts"],"sourcesContent":["// Private IP ranges (RFC 1918, loopback, link-local, etc.)\nconst PRIVATE_IP_RANGES = [\n \"10.0.0.0/8\",\n \"172.16.0.0/12\",\n \"192.168.0.0/16\",\n \"127.0.0.0/8\",\n \"169.254.0.0/16\",\n \"0.0.0.0/8\",\n \"::1/128\",\n \"fc00::/7\",\n \"fe80::/10\",\n \"ff00::/8\",\n];\n\n// Cloud metadata IPs\nconst CLOUD_METADATA_IPS = [\n \"169.254.169.254\",\n \"169.254.170.2\",\n \"100.100.100.200\",\n];\n\n// Cloud metadata hostnames (case-insensitive)\nconst CLOUD_METADATA_HOSTNAMES = [\n \"metadata.google.internal\",\n \"metadata\",\n \"instance-data\",\n];\n\n// Localhost variations\nconst LOCALHOST_NAMES = [\"localhost\", \"localhost.localdomain\"];\n\n/**\n * IPv4 regex: four octets 0-255\n */\nconst IPV4_REGEX =\n /^(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)$/;\n\n/**\n * Check if a string is a valid IPv4 address.\n */\nfunction isIPv4(ip: string): boolean {\n return IPV4_REGEX.test(ip);\n}\n\n/**\n * Check if a string is a valid IPv6 address.\n * Uses expandIpv6 for validation.\n */\nfunction isIPv6(ip: string): boolean {\n return expandIpv6(ip) !== null;\n}\n\n/**\n * Check if a string is a valid IP address (IPv4 or IPv6).\n */\nfunction isIP(ip: string): boolean {\n return isIPv4(ip) || isIPv6(ip);\n}\n\n/**\n * Parse an IP address string to an array of integers (for IPv4) or an array of 16-bit values (for IPv6)\n * Returns null if the IP is invalid.\n */\nfunction parseIp(ip: string): number[] | null {\n if (isIPv4(ip)) {\n return ip.split(\".\").map((octet) => parseInt(octet, 10));\n } else if (isIPv6(ip)) {\n // Normalize IPv6\n const expanded = expandIpv6(ip);\n if (!expanded) return null;\n const parts = expanded.split(\":\");\n const result: number[] = [];\n for (const part of parts) {\n result.push(parseInt(part, 16));\n }\n return result;\n }\n return null;\n}\n\n/**\n * Expand compressed IPv6 address to full form.\n */\nfunction expandIpv6(ip: string): string | null {\n // Basic structural validation\n if (!ip || typeof ip !== \"string\") return null;\n\n // Must contain at least one colon\n if (!ip.includes(\":\")) return null;\n\n // Check for invalid characters\n if (!/^[0-9a-fA-F:]+$/.test(ip)) return null;\n\n let normalized = ip;\n\n // Handle :: compression\n if (normalized.includes(\"::\")) {\n const parts = normalized.split(\"::\");\n if (parts.length > 2) return null; // Multiple :: is invalid\n\n const [left, right] = parts;\n const leftParts = left ? left.split(\":\") : [];\n const rightParts = right ? right.split(\":\") : [];\n const missing = 8 - (leftParts.length + rightParts.length);\n\n if (missing < 0) return null;\n\n const zeros = Array(missing).fill(\"0\");\n normalized = [...leftParts, ...zeros, ...rightParts]\n .filter((p) => p !== \"\")\n .join(\":\");\n }\n\n const parts = normalized.split(\":\");\n if (parts.length !== 8) return null;\n\n // Validate each part is a valid hex group (1-4 chars)\n for (const part of parts) {\n if (part.length === 0 || part.length > 4) return null;\n if (!/^[0-9a-fA-F]+$/.test(part)) return null;\n }\n\n return parts.map((p) => p.padStart(4, \"0\").toLowerCase()).join(\":\");\n}\n\n/**\n * Parse CIDR notation (e.g., \"192.168.0.0/24\") into network address and prefix length.\n */\nfunction parseCidr(\n cidr: string\n): { addr: number[]; prefixLen: number; isIpv6: boolean } | null {\n const [addrStr, prefixStr] = cidr.split(\"/\");\n if (!addrStr || !prefixStr) {\n return null;\n }\n\n const addr = parseIp(addrStr);\n if (!addr) {\n return null;\n }\n\n const prefixLen = parseInt(prefixStr, 10);\n if (isNaN(prefixLen)) {\n return null;\n }\n\n const isIpv6 = isIPv6(addrStr);\n\n if (isIpv6 && prefixLen > 128) {\n return null;\n }\n if (!isIpv6 && prefixLen > 32) {\n return null;\n }\n\n return { addr, prefixLen, isIpv6 };\n}\n\n/**\n * Check if an IP address is in a given CIDR range.\n */\nfunction isIpInCidr(ip: string, cidr: string): boolean {\n const ipParsed = parseIp(ip);\n if (!ipParsed) {\n return false;\n }\n\n const cidrParsed = parseCidr(cidr);\n if (!cidrParsed) {\n return false;\n }\n\n // Check IPv4 vs IPv6 mismatch\n const isIpv6 = isIPv6(ip);\n if (isIpv6 !== cidrParsed.isIpv6) {\n return false;\n }\n\n const { addr: cidrAddr, prefixLen } = cidrParsed;\n\n // Convert to bits and compare\n if (isIpv6) {\n // IPv6: each element is 16 bits\n for (let i = 0; i < Math.ceil(prefixLen / 16); i++) {\n const bitsToCheck = Math.min(16, prefixLen - i * 16);\n const mask = (0xffff << (16 - bitsToCheck)) & 0xffff;\n if ((ipParsed[i] & mask) !== (cidrAddr[i] & mask)) {\n return false;\n }\n }\n } else {\n // IPv4: each element is 8 bits\n for (let i = 0; i < Math.ceil(prefixLen / 8); i++) {\n const bitsToCheck = Math.min(8, prefixLen - i * 8);\n const mask = (0xff << (8 - bitsToCheck)) & 0xff;\n if ((ipParsed[i] & mask) !== (cidrAddr[i] & mask)) {\n return false;\n }\n }\n }\n\n return true;\n}\n\n/**\n * Check if an IP address is private (RFC 1918, loopback, link-local, etc.)\n */\nexport function isPrivateIp(ip: string): boolean {\n // Validate it's a proper IP\n if (!isIP(ip)) {\n return false;\n }\n\n for (const range of PRIVATE_IP_RANGES) {\n if (isIpInCidr(ip, range)) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Check if a hostname or IP is a known cloud metadata endpoint.\n */\nexport function isCloudMetadata(hostname: string, ip?: string): boolean {\n // Check if it's a known metadata IP\n if (CLOUD_METADATA_IPS.includes(ip || \"\")) {\n return true;\n }\n\n // Check if hostname matches (case-insensitive)\n const lowerHostname = hostname.toLowerCase();\n if (CLOUD_METADATA_HOSTNAMES.includes(lowerHostname)) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Check if a hostname or IP is localhost.\n */\nexport function isLocalhost(hostname: string, ip?: string): boolean {\n // Check if it's a localhost IP\n if (ip) {\n // Check for typical localhost IPs (loopback range)\n if (ip === \"127.0.0.1\" || ip === \"::1\" || ip === \"0.0.0.0\") {\n return true;\n }\n // Check if IP starts with 127. (entire loopback range)\n if (ip.startsWith(\"127.\")) {\n return true;\n }\n }\n\n // Check if hostname is localhost\n const lowerHostname = hostname.toLowerCase();\n if (LOCALHOST_NAMES.includes(lowerHostname)) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Validate that a URL is safe to connect to.\n * Performs static validation checks against hostnames and direct IP addresses.\n * Does not perform DNS resolution.\n *\n * @param url URL to validate\n * @param options.allowPrivate Allow private IPs (default: false)\n * @param options.allowHttp Allow http:// scheme (default: false)\n * @returns The validated URL\n * @throws Error if URL is not safe\n */\nexport function validateSafeUrl(\n url: string,\n options?: { allowPrivate?: boolean; allowHttp?: boolean }\n): string {\n const allowPrivate = options?.allowPrivate ?? false;\n const allowHttp = options?.allowHttp ?? false;\n\n try {\n let parsedUrl: URL;\n try {\n parsedUrl = new URL(url);\n } catch {\n throw new Error(`Invalid URL: ${url}`);\n }\n\n const hostname = parsedUrl.hostname;\n if (!hostname) {\n throw new Error(\"URL missing hostname.\");\n }\n\n // Check if it's a cloud metadata endpoint (always blocked)\n if (isCloudMetadata(hostname)) {\n throw new Error(`URL points to cloud metadata endpoint: ${hostname}`);\n }\n\n // Check if it's localhost (blocked unless allowPrivate is true)\n if (isLocalhost(hostname)) {\n if (!allowPrivate) {\n throw new Error(`URL points to localhost: ${hostname}`);\n }\n return url;\n }\n\n // Check scheme (after localhost checks to give better error messages)\n const scheme = parsedUrl.protocol;\n if (scheme !== \"http:\" && scheme !== \"https:\") {\n throw new Error(\n `Invalid URL scheme: ${scheme}. Only http and https are allowed.`\n );\n }\n\n if (scheme === \"http:\" && !allowHttp) {\n throw new Error(\n \"HTTP scheme not allowed. Use HTTPS or set allowHttp: true.\"\n );\n }\n\n // If hostname is already an IP, validate it directly\n if (isIP(hostname)) {\n const ip = hostname;\n\n // Check if it's localhost first (before private IP check)\n if (isLocalhost(hostname, ip)) {\n if (!allowPrivate) {\n throw new Error(`URL points to localhost: ${hostname}`);\n }\n return url;\n }\n\n // Cloud metadata is always blocked\n if (isCloudMetadata(hostname, ip)) {\n throw new Error(\n `URL resolves to cloud metadata IP: ${ip} (${hostname})`\n );\n }\n\n // Check private IPs\n if (isPrivateIp(ip)) {\n if (!allowPrivate) {\n throw new Error(\n `URL resolves to private IP: ${ip} (${hostname}). Set allowPrivate: true to allow.`\n );\n }\n }\n\n return url;\n }\n\n // For regular hostnames, we've already done all hostname-based checks above\n // (cloud metadata, localhost). If those passed, the URL is safe.\n // We don't perform DNS resolution in this environment-agnostic function.\n return url;\n } catch (error) {\n if (error && typeof error === \"object\" && \"message\" in error) {\n throw error;\n }\n throw new Error(`URL validation failed: ${error}`);\n }\n}\n\n/**\n * Check if a URL is safe to connect to (non-throwing version).\n *\n * @param url URL to check\n * @param options.allowPrivate Allow private IPs (default: false)\n * @param options.allowHttp Allow http:// scheme (default: false)\n * @returns true if URL is safe, false otherwise\n */\nexport function isSafeUrl(\n url: string,\n options?: { allowPrivate?: boolean; allowHttp?: boolean }\n): boolean {\n try {\n validateSafeUrl(url, options);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Check if two URLs have the same origin (scheme, host, port).\n * Uses semantic URL parsing to prevent SSRF bypasses via URL variations.\n *\n * @param url1 First URL\n * @param url2 Second URL\n * @returns true if both URLs have the same origin, false otherwise\n */\nexport function isSameOrigin(url1: string, url2: string): boolean {\n try {\n return new URL(url1).origin === new URL(url2).origin;\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,MAAM,oBAAoB;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;AAGD,MAAM,qBAAqB;CACzB;CACA;CACA;AACD;AAGD,MAAM,2BAA2B;CAC/B;CACA;CACA;AACD;AAGD,MAAM,kBAAkB,CAAC,aAAa,uBAAwB;;;;AAK9D,MAAM,aACJ;;;;AAKF,SAAS,OAAOA,IAAqB;AACnC,QAAO,WAAW,KAAK,GAAG;AAC3B;;;;;AAMD,SAAS,OAAOA,IAAqB;AACnC,QAAO,WAAW,GAAG,KAAK;AAC3B;;;;AAKD,SAAS,KAAKA,IAAqB;AACjC,QAAO,OAAO,GAAG,IAAI,OAAO,GAAG;AAChC;;;;;AAMD,SAAS,QAAQA,IAA6B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,IAAI,MACR,CAAC,oBAAoB,EAAE,OAAO,kCAAkC,CAAC;AAIrE,MAAI,WAAW,WAAW,CAAC,UACzB,OAAM,IAAI,MACR;AAKJ,MAAI,KAAK,SAAS,EAAE;GAClB,MAAM,KAAK;AAGX,OAAI,YAAY,UAAU,GAAG,EAAE;AAC7B,QAAI,CAAC,aACH,OAAM,IAAI,MAAM,CAAC,yBAAyB,EAAE,UAAU;AAExD,WAAO;GACR;AAGD,OAAI,gBAAgB,UAAU,GAAG,CAC/B,OAAM,IAAI,MACR,CAAC,mCAAmC,EAAE,GAAG,EAAE,EAAE,SAAS,CAAC,CAAC;AAK5D,OAAI,YAAY,GAAG,EACjB;QAAI,CAAC,aACH,OAAM,IAAI,MACR,CAAC,4BAA4B,EAAE,GAAG,EAAE,EAAE,SAAS,mCAAmC,CAAC;GAEtF;AAGH,UAAO;EACR;AAKD,SAAO;CACR,SAAQ,OAAO;AACd,MAAI,SAAS,OAAO,UAAU,YAAY,aAAa,MACrD,OAAM;AAER,QAAM,IAAI,MAAM,CAAC,uBAAuB,EAAE,OAAO;CAClD;AACF;;;;;;;;;AAUD,SAAgB,UACdF,KACAC,SACS;AACT,KAAI;EACF,gBAAgB,KAAK,QAAQ;AAC7B,SAAO;CACR,QAAO;AACN,SAAO;CACR;AACF;;;;;;;;;AAUD,SAAgB,aAAaE,MAAcC,MAAuB;AAChE,KAAI;AACF,SAAO,IAAI,IAAI,MAAM,WAAW,IAAI,IAAI,MAAM;CAC/C,QAAO;AACN,SAAO;CACR;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/core",
3
- "version": "1.1.20",
3
+ "version": "1.1.22",
4
4
  "description": "Core LangChain.js abstractions and schemas",
5
5
  "type": "module",
6
6
  "engines": {
@@ -688,6 +688,17 @@
688
688
  "default": "./dist/utils/math.js"
689
689
  }
690
690
  },
691
+ "./utils/ssrf": {
692
+ "input": "./src/utils/ssrf.ts",
693
+ "require": {
694
+ "types": "./dist/utils/ssrf.d.cts",
695
+ "default": "./dist/utils/ssrf.cjs"
696
+ },
697
+ "import": {
698
+ "types": "./dist/utils/ssrf.d.ts",
699
+ "default": "./dist/utils/ssrf.js"
700
+ }
701
+ },
691
702
  "./utils/stream": {
692
703
  "input": "./src/utils/stream.ts",
693
704
  "require": {
package/utils/ssrf.cjs ADDED
@@ -0,0 +1 @@
1
+ module.exports = require("../dist/utils/ssrf.cjs");
@@ -0,0 +1 @@
1
+ export * from "../dist/utils/ssrf.js";
@@ -0,0 +1 @@
1
+ export * from "../dist/utils/ssrf.js";
package/utils/ssrf.js ADDED
@@ -0,0 +1 @@
1
+ export * from "../dist/utils/ssrf.js";