langchain-stripe-loader 0.0.0 → 0.2.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.js ADDED
@@ -0,0 +1,457 @@
1
+ // src/StripeDocsLoader.ts
2
+ import { SitemapProcessor, fetchWithRetry, RequestPacer } from "stripe-loaders-core";
3
+ import { BaseDocumentLoader } from "@langchain/core/document_loaders/base";
4
+ import { Document } from "@langchain/core/documents";
5
+ import { NodeHtmlMarkdown } from "node-html-markdown";
6
+
7
+ // src/utils.ts
8
+ import { ConsoleLogger } from "stripe-loaders-core";
9
+ var defaultLogger = new ConsoleLogger(false);
10
+ function extractBodyFromHTML(htmlString, logger = defaultLogger) {
11
+ try {
12
+ if (!htmlString) {
13
+ logger.log("Input HTML is null or undefined");
14
+ return [];
15
+ }
16
+ const bodyRegex = /<body[^>]*>([\s\S]*?)<\/body>/gi;
17
+ const matches = [];
18
+ let match;
19
+ while ((match = bodyRegex.exec(htmlString)) !== null) {
20
+ if (match[1]) {
21
+ matches.push(match[1].trim());
22
+ }
23
+ }
24
+ if (matches.length === 0) {
25
+ logger.log("No body tags found");
26
+ return [];
27
+ }
28
+ return matches;
29
+ } catch (error) {
30
+ logger.error(`An error occurred: ${error}`);
31
+ return [];
32
+ }
33
+ }
34
+ function extractArticleFromHTML(htmlString, logger = defaultLogger) {
35
+ try {
36
+ if (!htmlString) {
37
+ logger.log("Input HTML is null or undefined");
38
+ return [];
39
+ }
40
+ const articles = [];
41
+ const processArticleTags = () => {
42
+ const articleRegex = /<article(?:\s+[^>]*)?>(.*?)<\/article>/gis;
43
+ let articleMatch;
44
+ let foundArticles = false;
45
+ while ((articleMatch = articleRegex.exec(htmlString)) !== null) {
46
+ if (articleMatch[1]) {
47
+ articles.push(articleMatch[1].trim());
48
+ foundArticles = true;
49
+ }
50
+ }
51
+ return foundArticles;
52
+ };
53
+ const processMainContent = () => {
54
+ const mainContentRegex = /<(div|section|main|article)(?:\s+[^>]*?)id=["']main-content["'](?:[^>]*?)>(.*?)<\/\1>/is;
55
+ const mainContentMatch = mainContentRegex.exec(htmlString);
56
+ if (mainContentMatch && mainContentMatch[2]) {
57
+ logger.log("Found element with main-content ID");
58
+ const contentArticleRegex = /<div(?:\s+[^>]*?)class=["'][^"']*Content-article[^"']*["'](?:[^>]*?)>(.*?)<\/div>/is;
59
+ const contentArticleMatch = contentArticleRegex.exec(mainContentMatch[2]);
60
+ if (contentArticleMatch && contentArticleMatch[1]) {
61
+ logger.log("Found content with Content-article class");
62
+ articles.push(contentArticleMatch[1].trim());
63
+ return true;
64
+ }
65
+ const documentRegex = /<div(?:\s+[^>]*?)class=["'][^"']*Document[^"']*["'](?:[^>]*?)>(.*?)<\/div>/is;
66
+ const documentMatch = documentRegex.exec(mainContentMatch[2]);
67
+ if (documentMatch && documentMatch[1]) {
68
+ logger.log("Found content with Document class");
69
+ articles.push(documentMatch[1].trim());
70
+ return true;
71
+ }
72
+ logger.log("Using all content within main-content");
73
+ articles.push(mainContentMatch[2].trim());
74
+ return true;
75
+ }
76
+ return false;
77
+ };
78
+ const processBody = () => {
79
+ const bodyRegex = /<body(?:\s+[^>]*?)>(.*?)<\/body>/is;
80
+ const bodyMatch = bodyRegex.exec(htmlString);
81
+ if (bodyMatch && bodyMatch[1]) {
82
+ const contentArticleRegex = /<div(?:\s+[^>]*?)class=["'][^"']*Content-article[^"']*["'](?:[^>]*?)>(.*?)<\/div>/is;
83
+ const contentArticleMatch = contentArticleRegex.exec(bodyMatch[1]);
84
+ if (contentArticleMatch && contentArticleMatch[1]) {
85
+ logger.log("Found content with Content-article class in body");
86
+ articles.push(contentArticleMatch[1].trim());
87
+ return true;
88
+ }
89
+ const documentRegex = /<div(?:\s+[^>]*?)class=["'][^"']*Document[^"']*["'](?:[^>]*?)>(.*?)<\/div>/is;
90
+ const documentMatch = documentRegex.exec(bodyMatch[1]);
91
+ if (documentMatch && documentMatch[1]) {
92
+ logger.log("Found content with Document class in body");
93
+ articles.push(documentMatch[1].trim());
94
+ return true;
95
+ }
96
+ }
97
+ logger.log("No specific content container found");
98
+ return false;
99
+ };
100
+ if (!processArticleTags()) {
101
+ logger.log("No article tags found, trying to find main-content");
102
+ if (!processMainContent()) {
103
+ logger.log("No main-content found, trying to find body content");
104
+ processBody();
105
+ }
106
+ }
107
+ return articles;
108
+ } catch (error) {
109
+ logger.error(`Error extracting article from HTML: ${error}`);
110
+ return [];
111
+ }
112
+ }
113
+ function toMarkdownUrl(pageUrl, locale) {
114
+ const url = new URL(pageUrl);
115
+ const path = url.pathname.replace(/\/+$/, "");
116
+ url.pathname = path.endsWith(".md") ? path : `${path || ""}.md`;
117
+ url.hash = "";
118
+ url.searchParams.set("locale", locale);
119
+ return url.toString();
120
+ }
121
+ function parseMarkdownDocument(markdown) {
122
+ const lines = (markdown ?? "").replace(/\r\n?/g, "\n").split("\n");
123
+ let title = "Unknown";
124
+ let description = "No description";
125
+ let index = lines.findIndex((line) => /^#\s+\S/.test(line));
126
+ if (index === -1) {
127
+ return { title, description };
128
+ }
129
+ title = lines[index].replace(/^#\s+/, "").trim();
130
+ const paragraph = [];
131
+ for (index += 1; index < lines.length; index++) {
132
+ const line = lines[index].trim();
133
+ if (line === "") {
134
+ if (paragraph.length > 0) break;
135
+ continue;
136
+ }
137
+ if (/^(#|```|[-*+]\s|\d+\.\s|>|\||<)/.test(line)) {
138
+ if (paragraph.length > 0) break;
139
+ continue;
140
+ }
141
+ paragraph.push(line);
142
+ }
143
+ if (paragraph.length > 0) {
144
+ description = paragraph.join(" ");
145
+ }
146
+ return { title, description };
147
+ }
148
+
149
+ // src/utils/url-filter.ts
150
+ function matchesResource(url, resource) {
151
+ const urlPath = new URL(url).pathname;
152
+ const pathSegments = urlPath.split("/").filter(Boolean);
153
+ if (resource.includes("/")) {
154
+ const resourceSegments = resource.split("/").filter(Boolean);
155
+ return resourceSegments.every((segment, index) => pathSegments[index] === segment);
156
+ } else {
157
+ return pathSegments[0] === resource;
158
+ }
159
+ }
160
+ function matchesExcludeResources(url, excludeResources) {
161
+ if (!excludeResources || excludeResources.length === 0) {
162
+ return false;
163
+ }
164
+ const urlPath = new URL(url).pathname;
165
+ const pathSegments = urlPath.split("/").filter(Boolean);
166
+ for (const excludeResource of excludeResources) {
167
+ if (excludeResource.includes("/")) {
168
+ const excludeSegments = excludeResource.split("/").filter(Boolean);
169
+ const matchesExclude = excludeSegments.every(
170
+ (segment, index) => pathSegments[index] === segment
171
+ );
172
+ if (matchesExclude) {
173
+ return true;
174
+ }
175
+ } else {
176
+ if (pathSegments[0] === excludeResource) {
177
+ return true;
178
+ }
179
+ }
180
+ }
181
+ return false;
182
+ }
183
+ function filterUrls(urls, resource, excludeResources) {
184
+ if (!resource && (!excludeResources || excludeResources.length === 0)) {
185
+ return urls;
186
+ }
187
+ return urls.filter((url) => {
188
+ if (resource && !matchesResource(url, resource)) {
189
+ return false;
190
+ }
191
+ if (excludeResources && matchesExcludeResources(url, excludeResources)) {
192
+ return false;
193
+ }
194
+ return true;
195
+ });
196
+ }
197
+
198
+ // src/options.ts
199
+ import {
200
+ ConsoleLogger as ConsoleLogger2,
201
+ resolveRateLimit
202
+ } from "stripe-loaders-core";
203
+ function resolveLoaderOptions(options) {
204
+ const opts = typeof options === "boolean" ? { debug: options } : options ?? {};
205
+ const debug = opts.debug ?? false;
206
+ return {
207
+ debug,
208
+ logger: opts.logger ?? new ConsoleLogger2(debug),
209
+ rateLimit: resolveRateLimit(opts.rateLimit),
210
+ fetch: opts.fetch,
211
+ sleep: opts.sleep
212
+ };
213
+ }
214
+
215
+ // src/StripeDocsLoader.ts
216
+ var StripeDocsDocumentLoader = class extends BaseDocumentLoader {
217
+ /**
218
+ * @param options Loader options, or a boolean to enable debug logging (legacy signature)
219
+ */
220
+ constructor(options) {
221
+ super();
222
+ this.options = resolveLoaderOptions(options);
223
+ this.format = typeof options === "object" && options.format || "html";
224
+ }
225
+ /**
226
+ * Fetches URLs from the Stripe Docs sitemap
227
+ * @returns {Promise<string[]>} Array of URLs from the sitemap
228
+ */
229
+ async fetchURLsFromSitemap() {
230
+ const documentUrls = await new SitemapProcessor({
231
+ debug: this.options.debug,
232
+ logger: this.options.logger,
233
+ rateLimit: this.options.rateLimit,
234
+ fetch: this.options.fetch,
235
+ sleep: this.options.sleep
236
+ }).fetchAndProcessSitemap("https://docs.stripe.com/sitemap.xml");
237
+ return documentUrls;
238
+ }
239
+ /**
240
+ * Fetches articles from the sitemap
241
+ */
242
+ async fetchArticlesFromSitemap({
243
+ locale,
244
+ resource,
245
+ excludeResources,
246
+ format
247
+ }) {
248
+ const documentUrls = await this.fetchURLsFromSitemap();
249
+ const filteredDocumentUrls = filterUrls(documentUrls, resource, excludeResources);
250
+ return this.fetchArticlesFromURLs(filteredDocumentUrls, locale, format);
251
+ }
252
+ async fetchArticlesFromURLs(documentUrls, locale, format = this.format) {
253
+ const { logger } = this.options;
254
+ const pacer = new RequestPacer(this.options.rateLimit, this.options.sleep);
255
+ const articles = [];
256
+ for (const docsUrl of documentUrls) {
257
+ const requestUrl = format === "markdown" ? toMarkdownUrl(docsUrl, locale) : `${docsUrl}?locale=${locale}`;
258
+ try {
259
+ await pacer.wait();
260
+ logger.log(`Fetching ${requestUrl}`);
261
+ const response = await fetchWithRetry(requestUrl, void 0, {
262
+ rateLimit: this.options.rateLimit,
263
+ fetch: this.options.fetch,
264
+ sleep: this.options.sleep,
265
+ onRetry: ({ attempt, waitMs, reason }) => logger.warn(`Retrying ${requestUrl} (attempt ${attempt}, ${reason}) in ${waitMs}ms`)
266
+ });
267
+ if (response.status >= 400) {
268
+ logger.warn(`Skipping ${docsUrl} - HTTP status: ${response.status}`);
269
+ continue;
270
+ }
271
+ const body = await response.text();
272
+ if (format === "markdown") {
273
+ const { title: title2, description: description2 } = parseMarkdownDocument(body);
274
+ articles.push({ url: docsUrl, content: body.trim(), title: title2, description: description2, format });
275
+ continue;
276
+ }
277
+ const extracted = extractArticleFromHTML(body, logger);
278
+ const titleMatch = body.match(/<title[^>]*>([^<]+)<\/title>/);
279
+ const descMatch = body.match(/<meta[^>]*name="description"[^>]*content="([^"]+)"[^>]*>/);
280
+ const title = titleMatch ? titleMatch[1].trim() : "Unknown";
281
+ const description = descMatch ? descMatch[1].trim() : "No description";
282
+ articles.push(
283
+ ...extracted.map((content) => ({ url: docsUrl, content, title, description, format }))
284
+ );
285
+ } catch (error) {
286
+ logger.error(`Error fetching ${docsUrl}: ${error}`);
287
+ continue;
288
+ }
289
+ }
290
+ return articles;
291
+ }
292
+ /**
293
+ * @deprecated Use `this.load()` and `splitter.splitDocuments()` individually.
294
+ * Loads the documents and splits them using the given document transformer.
295
+ * Kept for compatibility with LangChain's `index()` API, which only treats a
296
+ * source as a document loader when it has both `load()` and `loadAndSplit()`.
297
+ * `@langchain/core` 1.x no longer provides this method on BaseDocumentLoader.
298
+ * @param splitter The document transformer (e.g. a text splitter) to apply
299
+ * @returns {Promise<Document[]>} The loaded and split documents
300
+ */
301
+ async loadAndSplit(splitter) {
302
+ if (splitter === void 0) {
303
+ throw new Error("You must pass a text splitter to use this method.");
304
+ }
305
+ const docs = await this.load();
306
+ return splitter.invoke(docs);
307
+ }
308
+ /**
309
+ * Loads documents from Stripe Docs
310
+ * @returns {Promise<Document[]>} Array of LangChain documents
311
+ */
312
+ async load(options) {
313
+ const { urls, resource, excludeResources } = options ?? {};
314
+ const locale = options?.locale ?? "en-US";
315
+ const format = options?.format ?? this.format;
316
+ const articles = urls ? await this.fetchArticlesFromURLs(urls, locale, format) : await this.fetchArticlesFromSitemap({ locale, resource, excludeResources, format });
317
+ const nhm = new NodeHtmlMarkdown();
318
+ return articles.map(
319
+ (article) => new Document({
320
+ pageContent: article.format === "markdown" ? article.content : nhm.translate(article.content),
321
+ metadata: {
322
+ source: article.url,
323
+ title: article.title,
324
+ description: article.description
325
+ }
326
+ })
327
+ );
328
+ }
329
+ };
330
+
331
+ // src/StripeComLoader.ts
332
+ import { SitemapProcessor as SitemapProcessor2, fetchWithRetry as fetchWithRetry2, RequestPacer as RequestPacer2 } from "stripe-loaders-core";
333
+ import { BaseDocumentLoader as BaseDocumentLoader2 } from "@langchain/core/document_loaders/base";
334
+ import { Document as Document2 } from "@langchain/core/documents";
335
+ import { NodeHtmlMarkdown as NodeHtmlMarkdown2 } from "node-html-markdown";
336
+ var StripeComDocumentLoader = class extends BaseDocumentLoader2 {
337
+ /**
338
+ * @param options Loader options, or a boolean to enable debug logging (legacy signature)
339
+ */
340
+ constructor(options) {
341
+ super();
342
+ this.options = resolveLoaderOptions(options);
343
+ }
344
+ /**
345
+ * Fetches URLs from the Stripe.com sitemap
346
+ * @param {string} resource Optional resource path to filter URLs
347
+ * @returns {Promise<string[]>} Array of URLs from the sitemap
348
+ */
349
+ async fetchURLsFromSitemap(resource) {
350
+ return new SitemapProcessor2({
351
+ debug: this.options.debug,
352
+ logger: this.options.logger,
353
+ rateLimit: this.options.rateLimit,
354
+ fetch: this.options.fetch,
355
+ sleep: this.options.sleep
356
+ }).fetchAndProcessSitemapIndex(
357
+ "https://stripe.com/sitemap/sitemap.xml",
358
+ ["https://stripe.com/", resource].filter(Boolean).join("")
359
+ );
360
+ }
361
+ /**
362
+ * Fetches article content from a list of URLs
363
+ * @param {string[]} urls Array of URLs to fetch content from
364
+ * @param {string} locale Locale for the content
365
+ * @returns {Promise<StripeDocsArticle[]>} Array of article objects
366
+ */
367
+ async fetchArticlesFromURLs(urls, locale) {
368
+ const { logger } = this.options;
369
+ const pacer = new RequestPacer2(this.options.rateLimit, this.options.sleep);
370
+ const articles = [];
371
+ for (const pageUrl of urls) {
372
+ const requestUrl = `${pageUrl}?locale=${locale}`;
373
+ try {
374
+ await pacer.wait();
375
+ logger.log(`Fetching ${requestUrl}`);
376
+ const response = await fetchWithRetry2(requestUrl, void 0, {
377
+ rateLimit: this.options.rateLimit,
378
+ fetch: this.options.fetch,
379
+ sleep: this.options.sleep,
380
+ onRetry: ({ attempt, waitMs, reason }) => logger.warn(`Retrying ${requestUrl} (attempt ${attempt}, ${reason}) in ${waitMs}ms`)
381
+ });
382
+ if (response.status >= 400) {
383
+ logger.warn(`Skipping ${pageUrl} - HTTP status: ${response.status}`);
384
+ continue;
385
+ }
386
+ const html = await response.text();
387
+ const rawArticles = extractBodyFromHTML(html, logger);
388
+ const titleMatch = html.match(/<title[^>]*>([^<]+)<\/title>/);
389
+ const descMatch = html.match(/<meta[^>]*name="description"[^>]*content="([^"]+)"[^>]*>/);
390
+ const title = titleMatch ? titleMatch[1].trim() : "Unknown";
391
+ const description = descMatch ? descMatch[1].trim() : "No description";
392
+ articles.push(
393
+ ...rawArticles.map((content) => ({ url: pageUrl, content, title, description }))
394
+ );
395
+ } catch (error) {
396
+ logger.error(`Error fetching ${pageUrl}: ${error}`);
397
+ continue;
398
+ }
399
+ }
400
+ return articles;
401
+ }
402
+ /**
403
+ * Fetches articles from the sitemap
404
+ * @param {string} resource Optional resource path to filter URLs
405
+ * @param {string} locale Locale for the content
406
+ * @returns {Promise<StripeDocsArticle[]>} Array of article objects
407
+ */
408
+ async fetchArticlesFromSitemap(resource, locale) {
409
+ const documentUrls = await this.fetchURLsFromSitemap(resource);
410
+ return this.fetchArticlesFromURLs(documentUrls, locale);
411
+ }
412
+ /**
413
+ * @deprecated Use `this.load()` and `splitter.splitDocuments()` individually.
414
+ * Loads the documents and splits them using the given document transformer.
415
+ * Kept for compatibility with LangChain's `index()` API, which only treats a
416
+ * source as a document loader when it has both `load()` and `loadAndSplit()`.
417
+ * `@langchain/core` 1.x no longer provides this method on BaseDocumentLoader.
418
+ * @param splitter The document transformer (e.g. a text splitter) to apply
419
+ * @returns {Promise<Document[]>} The loaded and split documents
420
+ */
421
+ async loadAndSplit(splitter) {
422
+ if (splitter === void 0) {
423
+ throw new Error("You must pass a text splitter to use this method.");
424
+ }
425
+ const docs = await this.load();
426
+ return splitter.invoke(docs);
427
+ }
428
+ /**
429
+ * Loads documents from Stripe.com
430
+ * @param {Object} options Loading options
431
+ * @param {string} options.resource Optional resource path to filter URLs
432
+ * @param {string} options.locale Optional locale for the content (defaults to 'en-US')
433
+ * @param {string[]} options.urls Optional list of specific URLs to load
434
+ * @returns {Promise<Document[]>} Array of LangChain documents
435
+ */
436
+ async load(options) {
437
+ const { resource, urls } = options ?? {};
438
+ const locale = options?.locale ?? "en-US";
439
+ const articles = urls ? await this.fetchArticlesFromURLs(urls, locale) : await this.fetchArticlesFromSitemap(resource, locale);
440
+ const nhm = new NodeHtmlMarkdown2();
441
+ return articles.map(
442
+ (article) => new Document2({
443
+ pageContent: nhm.translate(article.content),
444
+ metadata: {
445
+ source: article.url,
446
+ title: article.title,
447
+ description: article.description
448
+ }
449
+ })
450
+ );
451
+ }
452
+ };
453
+ export {
454
+ StripeComDocumentLoader,
455
+ StripeDocsDocumentLoader
456
+ };
457
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/StripeDocsLoader.ts","../src/utils.ts","../src/utils/url-filter.ts","../src/options.ts","../src/StripeComLoader.ts"],"sourcesContent":["import { SitemapProcessor, fetchWithRetry, RequestPacer } from 'stripe-loaders-core';\nimport { BaseDocumentLoader } from '@langchain/core/document_loaders/base';\nimport { BaseDocumentTransformer, Document } from '@langchain/core/documents';\nimport { NodeHtmlMarkdown } from 'node-html-markdown';\nimport { extractArticleFromHTML, parseMarkdownDocument, toMarkdownUrl } from './utils';\nimport { filterUrls } from './utils/url-filter';\nimport {\n resolveLoaderOptions,\n type ResolvedLoaderOptions,\n type StripeLoaderOptions,\n} from './options';\n\n/**\n * How page content is fetched from docs.stripe.com.\n * - `html`: fetch the HTML page and convert the extracted article to Markdown (default).\n * - `markdown`: fetch the Markdown version that docs.stripe.com serves at `<page>.md`.\n */\nexport type StripeDocsContentFormat = 'html' | 'markdown';\n\nexport interface StripeDocsLoaderOptions extends StripeLoaderOptions {\n /** Default content format for `load()`. Defaults to `html`. */\n format?: StripeDocsContentFormat;\n}\n\nexport interface StripeDocsLoadOptions {\n /** Locale for the content. Defaults to `en-US`. */\n locale?: string;\n /** Load only these URLs instead of the sitemap. */\n urls?: string[];\n /** Resource path to include (e.g. `connect`). */\n resource?: string;\n /** Resource paths to exclude. */\n excludeResources?: string[];\n /** Content format. Overrides the constructor option. */\n format?: StripeDocsContentFormat;\n}\n\n/**\n * Interface representing a Stripe documentation article\n */\ntype StripeDocsArticle = {\n url: string;\n content: string;\n title: string;\n description: string;\n format: StripeDocsContentFormat;\n};\n\n/**\n * Document loader for Stripe Docs website content\n * Extracts content from docs.stripe.com pages and converts it to LangChain documents\n */\nexport class StripeDocsDocumentLoader extends BaseDocumentLoader {\n private readonly options: ResolvedLoaderOptions;\n private readonly format: StripeDocsContentFormat;\n\n /**\n * @param options Loader options, or a boolean to enable debug logging (legacy signature)\n */\n constructor(options?: boolean | StripeDocsLoaderOptions) {\n super();\n this.options = resolveLoaderOptions(options);\n this.format = (typeof options === 'object' && options.format) || 'html';\n }\n\n /**\n * Fetches URLs from the Stripe Docs sitemap\n * @returns {Promise<string[]>} Array of URLs from the sitemap\n */\n protected async fetchURLsFromSitemap() {\n const documentUrls = await new SitemapProcessor({\n debug: this.options.debug,\n logger: this.options.logger,\n rateLimit: this.options.rateLimit,\n fetch: this.options.fetch,\n sleep: this.options.sleep,\n }).fetchAndProcessSitemap('https://docs.stripe.com/sitemap.xml');\n return documentUrls;\n }\n\n /**\n * Fetches articles from the sitemap\n */\n private async fetchArticlesFromSitemap({\n locale,\n resource,\n excludeResources,\n format,\n }: {\n locale: string;\n resource?: string;\n excludeResources?: string[];\n format: StripeDocsContentFormat;\n }): Promise<StripeDocsArticle[]> {\n const documentUrls = await this.fetchURLsFromSitemap();\n const filteredDocumentUrls = filterUrls(documentUrls, resource, excludeResources);\n return this.fetchArticlesFromURLs(filteredDocumentUrls, locale, format);\n }\n\n private async fetchArticlesFromURLs(\n documentUrls: string[],\n locale: string,\n format: StripeDocsContentFormat = this.format\n ): Promise<StripeDocsArticle[]> {\n const { logger } = this.options;\n const pacer = new RequestPacer(this.options.rateLimit, this.options.sleep);\n const articles: StripeDocsArticle[] = [];\n\n for (const docsUrl of documentUrls) {\n const requestUrl =\n format === 'markdown' ? toMarkdownUrl(docsUrl, locale) : `${docsUrl}?locale=${locale}`;\n try {\n await pacer.wait();\n logger.log(`Fetching ${requestUrl}`);\n const response = await fetchWithRetry(requestUrl, undefined, {\n rateLimit: this.options.rateLimit,\n fetch: this.options.fetch,\n sleep: this.options.sleep,\n onRetry: ({ attempt, waitMs, reason }) =>\n logger.warn(`Retrying ${requestUrl} (attempt ${attempt}, ${reason}) in ${waitMs}ms`),\n });\n\n // Skip if HTTP status code is 400 or higher\n if (response.status >= 400) {\n logger.warn(`Skipping ${docsUrl} - HTTP status: ${response.status}`);\n continue;\n }\n\n const body = await response.text();\n\n if (format === 'markdown') {\n const { title, description } = parseMarkdownDocument(body);\n articles.push({ url: docsUrl, content: body.trim(), title, description, format });\n continue;\n }\n\n const extracted = extractArticleFromHTML(body, logger);\n const titleMatch = body.match(/<title[^>]*>([^<]+)<\\/title>/);\n const descMatch = body.match(/<meta[^>]*name=\"description\"[^>]*content=\"([^\"]+)\"[^>]*>/);\n\n const title = titleMatch ? titleMatch[1].trim() : 'Unknown';\n const description = descMatch ? descMatch[1].trim() : 'No description';\n articles.push(\n ...extracted.map(content => ({ url: docsUrl, content, title, description, format }))\n );\n } catch (error) {\n logger.error(`Error fetching ${docsUrl}: ${error}`);\n // Skip to the next URL if an error occurs\n continue;\n }\n }\n return articles;\n }\n\n /**\n * @deprecated Use `this.load()` and `splitter.splitDocuments()` individually.\n * Loads the documents and splits them using the given document transformer.\n * Kept for compatibility with LangChain's `index()` API, which only treats a\n * source as a document loader when it has both `load()` and `loadAndSplit()`.\n * `@langchain/core` 1.x no longer provides this method on BaseDocumentLoader.\n * @param splitter The document transformer (e.g. a text splitter) to apply\n * @returns {Promise<Document[]>} The loaded and split documents\n */\n async loadAndSplit(splitter?: BaseDocumentTransformer): Promise<Document[]> {\n if (splitter === undefined) {\n throw new Error('You must pass a text splitter to use this method.');\n }\n const docs = await this.load();\n return splitter.invoke(docs);\n }\n\n /**\n * Loads documents from Stripe Docs\n * @returns {Promise<Document[]>} Array of LangChain documents\n */\n async load(options?: StripeDocsLoadOptions): Promise<Document[]> {\n const { urls, resource, excludeResources } = options ?? {};\n const locale = options?.locale ?? 'en-US';\n const format = options?.format ?? this.format;\n const articles = urls\n ? await this.fetchArticlesFromURLs(urls, locale, format)\n : await this.fetchArticlesFromSitemap({ locale, resource, excludeResources, format });\n\n // HTML content is converted to Markdown; Markdown content is used as-is\n const nhm = new NodeHtmlMarkdown();\n\n return articles.map(\n article =>\n new Document({\n pageContent:\n article.format === 'markdown' ? article.content : nhm.translate(article.content),\n metadata: {\n source: article.url,\n title: article.title,\n description: article.description,\n },\n })\n );\n }\n}\n","import { ConsoleLogger, type Logger } from 'stripe-loaders-core';\n\nconst defaultLogger: Logger = new ConsoleLogger(false);\n\n/**\n * Extracts the body tag and its contents from an HTML string\n * @param {string} htmlString - The HTML string to extract from\n * @param {Logger} logger - Logger for diagnostic messages\n * @returns {string[]} Array of extracted body contents\n */\nexport function extractBodyFromHTML(htmlString: string, logger: Logger = defaultLogger) {\n try {\n if (!htmlString) {\n logger.log('Input HTML is null or undefined');\n return [];\n }\n\n // Use safe regular expression to extract body tags\n // Use non-greedy matching and consider nested tags\n const bodyRegex = /<body[^>]*>([\\s\\S]*?)<\\/body>/gi;\n const matches = [];\n let match;\n\n while ((match = bodyRegex.exec(htmlString)) !== null) {\n if (match[1]) {\n matches.push(match[1].trim());\n }\n }\n\n if (matches.length === 0) {\n logger.log('No body tags found');\n return [];\n }\n\n return matches;\n } catch (error) {\n logger.error(`An error occurred: ${error}`);\n return [];\n }\n}\n\n/**\n * Extracts article tags and their contents from an HTML string\n * @param {string} htmlString - The HTML string to extract from\n * @param {Logger} logger - Logger for diagnostic messages\n * @returns {string[]} Array of extracted article contents\n */\nexport function extractArticleFromHTML(htmlString: string, logger: Logger = defaultLogger) {\n try {\n // Return empty array if input is null or undefined\n if (!htmlString) {\n logger.log('Input HTML is null or undefined');\n return [];\n }\n\n const articles: string[] = [];\n\n // 1. First, look for article tags - changed to more specific regex\n // Create a function to process one article tag\n const processArticleTags = () => {\n // Modified to match only article tags\n const articleRegex = /<article(?:\\s+[^>]*)?>(.*?)<\\/article>/gis;\n let articleMatch;\n let foundArticles = false;\n\n while ((articleMatch = articleRegex.exec(htmlString)) !== null) {\n if (articleMatch[1]) {\n articles.push(articleMatch[1].trim());\n foundArticles = true;\n }\n }\n\n return foundArticles;\n };\n\n // 2. Function to find elements with main-content\n const processMainContent = () => {\n // Limited to specific tags and more specific pattern\n const mainContentRegex =\n /<(div|section|main|article)(?:\\s+[^>]*?)id=[\"']main-content[\"'](?:[^>]*?)>(.*?)<\\/\\1>/is;\n const mainContentMatch = mainContentRegex.exec(htmlString);\n\n if (mainContentMatch && mainContentMatch[2]) {\n logger.log('Found element with main-content ID');\n\n // Look for div tags with Content-article class\n const contentArticleRegex =\n /<div(?:\\s+[^>]*?)class=[\"'][^\"']*Content-article[^\"']*[\"'](?:[^>]*?)>(.*?)<\\/div>/is;\n const contentArticleMatch = contentArticleRegex.exec(mainContentMatch[2]);\n\n if (contentArticleMatch && contentArticleMatch[1]) {\n logger.log('Found content with Content-article class');\n articles.push(contentArticleMatch[1].trim());\n return true;\n }\n\n // Look for div tags with Document class\n const documentRegex =\n /<div(?:\\s+[^>]*?)class=[\"'][^\"']*Document[^\"']*[\"'](?:[^>]*?)>(.*?)<\\/div>/is;\n const documentMatch = documentRegex.exec(mainContentMatch[2]);\n\n if (documentMatch && documentMatch[1]) {\n logger.log('Found content with Document class');\n articles.push(documentMatch[1].trim());\n return true;\n }\n\n // Use all content within main-content\n logger.log('Using all content within main-content');\n articles.push(mainContentMatch[2].trim());\n return true;\n }\n\n return false;\n };\n\n // 3. Function to find content in body tag\n const processBody = () => {\n // Look for body tag - specific pattern\n const bodyRegex = /<body(?:\\s+[^>]*?)>(.*?)<\\/body>/is;\n const bodyMatch = bodyRegex.exec(htmlString);\n\n if (bodyMatch && bodyMatch[1]) {\n // Look for div tags with Content-article class\n const contentArticleRegex =\n /<div(?:\\s+[^>]*?)class=[\"'][^\"']*Content-article[^\"']*[\"'](?:[^>]*?)>(.*?)<\\/div>/is;\n const contentArticleMatch = contentArticleRegex.exec(bodyMatch[1]);\n\n if (contentArticleMatch && contentArticleMatch[1]) {\n logger.log('Found content with Content-article class in body');\n articles.push(contentArticleMatch[1].trim());\n return true;\n }\n\n // Look for div tags with Document class\n const documentRegex =\n /<div(?:\\s+[^>]*?)class=[\"'][^\"']*Document[^\"']*[\"'](?:[^>]*?)>(.*?)<\\/div>/is;\n const documentMatch = documentRegex.exec(bodyMatch[1]);\n\n if (documentMatch && documentMatch[1]) {\n logger.log('Found content with Document class in body');\n articles.push(documentMatch[1].trim());\n return true;\n }\n }\n\n logger.log('No specific content container found');\n return false;\n };\n\n // Try processing in sequence\n if (!processArticleTags()) {\n logger.log('No article tags found, trying to find main-content');\n if (!processMainContent()) {\n logger.log('No main-content found, trying to find body content');\n processBody();\n }\n }\n\n return articles;\n } catch (error) {\n logger.error(`Error extracting article from HTML: ${error}`);\n return [];\n }\n}\n\n/**\n * Builds the URL of the Markdown version of a docs.stripe.com page\n * (e.g. `https://docs.stripe.com/payments/checkout` -> `https://docs.stripe.com/payments/checkout.md?locale=ja-JP`).\n * @param {string} pageUrl - The page URL from the sitemap\n * @param {string} locale - Locale for the content\n * @returns {string} The Markdown URL\n */\nexport function toMarkdownUrl(pageUrl: string, locale: string): string {\n const url = new URL(pageUrl);\n const path = url.pathname.replace(/\\/+$/, '');\n url.pathname = path.endsWith('.md') ? path : `${path || ''}.md`;\n url.hash = '';\n url.searchParams.set('locale', locale);\n return url.toString();\n}\n\n/**\n * Extracts the title (first level-1 heading) and description (first paragraph after it)\n * from a Markdown document.\n * @param {string} markdown - The Markdown content\n * @returns {{ title: string; description: string }} Title and description\n */\nexport function parseMarkdownDocument(markdown: string): { title: string; description: string } {\n const lines = (markdown ?? '').replace(/\\r\\n?/g, '\\n').split('\\n');\n let title = 'Unknown';\n let description = 'No description';\n let index = lines.findIndex(line => /^#\\s+\\S/.test(line));\n\n if (index === -1) {\n return { title, description };\n }\n title = lines[index].replace(/^#\\s+/, '').trim();\n\n const paragraph: string[] = [];\n for (index += 1; index < lines.length; index++) {\n const line = lines[index].trim();\n if (line === '') {\n if (paragraph.length > 0) break;\n continue;\n }\n if (/^(#|```|[-*+]\\s|\\d+\\.\\s|>|\\||<)/.test(line)) {\n if (paragraph.length > 0) break;\n continue;\n }\n paragraph.push(line);\n }\n if (paragraph.length > 0) {\n description = paragraph.join(' ');\n }\n return { title, description };\n}\n","/**\n * Utility functions for URL filtering\n */\n\n/**\n * Checks if a URL matches the specified resource path\n * @param url URL to check\n * @param resource Resource path (single or multiple path segments)\n * @returns true if matches, false otherwise\n */\nexport function matchesResource(url: string, resource: string): boolean {\n // Remove hostname from URL and get only the path\n const urlPath = new URL(url).pathname;\n // Remove leading slash and get the first path segment\n const pathSegments = urlPath.split('/').filter(Boolean);\n\n if (resource.includes('/')) {\n // If resource contains multiple path segments (e.g., 'get-started/account')\n const resourceSegments = resource.split('/').filter(Boolean);\n // Check if the specified resource path starts from the beginning of the URL\n return resourceSegments.every((segment, index) => pathSegments[index] === segment);\n } else {\n // If resource is a single path segment (e.g., 'connect')\n return pathSegments[0] === resource;\n }\n}\n\n/**\n * Checks if a URL matches any of the excluded resources\n * @param url URL to check\n * @param excludeResources Array of excluded resource paths\n * @returns true if excluded, false otherwise\n */\nexport function matchesExcludeResources(url: string, excludeResources: string[]): boolean {\n if (!excludeResources || excludeResources.length === 0) {\n return false;\n }\n\n // Remove hostname from URL and get only the path\n const urlPath = new URL(url).pathname;\n // Remove leading slash and get path segments\n const pathSegments = urlPath.split('/').filter(Boolean);\n\n for (const excludeResource of excludeResources) {\n if (excludeResource.includes('/')) {\n // If excludeResource contains multiple path segments (e.g., 'get-started/account')\n const excludeSegments = excludeResource.split('/').filter(Boolean);\n // Check if the specified exclude path starts from the beginning of the URL\n const matchesExclude = excludeSegments.every(\n (segment, index) => pathSegments[index] === segment\n );\n if (matchesExclude) {\n return true;\n }\n } else {\n // If excludeResource is a single path segment (e.g., 'connect')\n if (pathSegments[0] === excludeResource) {\n return true;\n }\n }\n }\n\n return false;\n}\n\n/**\n * Function to filter URLs\n * @param urls Array of URLs to filter\n * @param resource Resource path to include (optional)\n * @param excludeResources Array of resource paths to exclude (optional)\n * @returns Filtered array of URLs\n */\nexport function filterUrls(\n urls: string[],\n resource?: string,\n excludeResources?: string[]\n): string[] {\n if (!resource && (!excludeResources || excludeResources.length === 0)) {\n return urls;\n }\n\n return urls.filter(url => {\n // If resource is specified and URL doesn't match that resource\n if (resource && !matchesResource(url, resource)) {\n return false;\n }\n\n // If exclude resources are specified and URL matches any of the excluded resources\n if (excludeResources && matchesExcludeResources(url, excludeResources)) {\n return false;\n }\n\n return true;\n });\n}\n","import {\n ConsoleLogger,\n resolveRateLimit,\n type FetchLike,\n type Logger,\n type RateLimitOptions,\n type SleepFn,\n} from 'stripe-loaders-core';\n\n/**\n * Options shared by the Stripe document loaders.\n */\nexport interface StripeLoaderOptions {\n /** Enables debug logging on the default logger. */\n debug?: boolean;\n /** Custom logger. Defaults to a console logger (`log` / `warn` only when `debug` is true). */\n logger?: Logger;\n /**\n * Rate limiting and retry settings. Requests are always sent one at a time;\n * defaults to a 1s (±250ms) delay between requests and 3 retries on 429 / 5xx.\n */\n rateLimit?: Partial<RateLimitOptions>;\n /** Custom fetch implementation (defaults to the global fetch). */\n fetch?: FetchLike;\n /** Custom sleep implementation, mainly for tests. */\n sleep?: SleepFn;\n}\n\nexport interface ResolvedLoaderOptions {\n debug: boolean;\n logger: Logger;\n rateLimit: RateLimitOptions;\n fetch?: FetchLike;\n sleep?: SleepFn;\n}\n\n/**\n * Accepts the legacy `debug` boolean or an options object.\n */\nexport function resolveLoaderOptions(\n options?: boolean | StripeLoaderOptions\n): ResolvedLoaderOptions {\n const opts: StripeLoaderOptions =\n typeof options === 'boolean' ? { debug: options } : (options ?? {});\n const debug = opts.debug ?? false;\n return {\n debug,\n logger: opts.logger ?? new ConsoleLogger(debug),\n rateLimit: resolveRateLimit(opts.rateLimit),\n fetch: opts.fetch,\n sleep: opts.sleep,\n };\n}\n","import { SitemapProcessor, fetchWithRetry, RequestPacer } from 'stripe-loaders-core';\nimport { BaseDocumentLoader } from '@langchain/core/document_loaders/base';\nimport { BaseDocumentTransformer, Document } from '@langchain/core/documents';\nimport { NodeHtmlMarkdown } from 'node-html-markdown';\nimport { extractBodyFromHTML } from './utils';\nimport {\n resolveLoaderOptions,\n type ResolvedLoaderOptions,\n type StripeLoaderOptions,\n} from './options';\n\n/**\n * Interface representing a Stripe documentation article\n */\ntype StripeDocsArticle = {\n url: string;\n content: string;\n title: string;\n description: string;\n};\n\n/**\n * Document loader for Stripe.com website content\n * Extracts content from Stripe.com pages and converts it to LangChain documents\n */\nexport class StripeComDocumentLoader extends BaseDocumentLoader {\n private readonly options: ResolvedLoaderOptions;\n\n /**\n * @param options Loader options, or a boolean to enable debug logging (legacy signature)\n */\n constructor(options?: boolean | StripeLoaderOptions) {\n super();\n this.options = resolveLoaderOptions(options);\n }\n\n /**\n * Fetches URLs from the Stripe.com sitemap\n * @param {string} resource Optional resource path to filter URLs\n * @returns {Promise<string[]>} Array of URLs from the sitemap\n */\n protected async fetchURLsFromSitemap(resource?: string) {\n return new SitemapProcessor({\n debug: this.options.debug,\n logger: this.options.logger,\n rateLimit: this.options.rateLimit,\n fetch: this.options.fetch,\n sleep: this.options.sleep,\n }).fetchAndProcessSitemapIndex(\n 'https://stripe.com/sitemap/sitemap.xml',\n ['https://stripe.com/', resource].filter(Boolean).join('')\n );\n }\n\n /**\n * Fetches article content from a list of URLs\n * @param {string[]} urls Array of URLs to fetch content from\n * @param {string} locale Locale for the content\n * @returns {Promise<StripeDocsArticle[]>} Array of article objects\n */\n private async fetchArticlesFromURLs(\n urls: string[],\n locale: string\n ): Promise<StripeDocsArticle[]> {\n const { logger } = this.options;\n const pacer = new RequestPacer(this.options.rateLimit, this.options.sleep);\n const articles: StripeDocsArticle[] = [];\n\n for (const pageUrl of urls) {\n const requestUrl = `${pageUrl}?locale=${locale}`;\n try {\n await pacer.wait();\n logger.log(`Fetching ${requestUrl}`);\n const response = await fetchWithRetry(requestUrl, undefined, {\n rateLimit: this.options.rateLimit,\n fetch: this.options.fetch,\n sleep: this.options.sleep,\n onRetry: ({ attempt, waitMs, reason }) =>\n logger.warn(`Retrying ${requestUrl} (attempt ${attempt}, ${reason}) in ${waitMs}ms`),\n });\n\n // Skip if HTTP status code is 400 or higher\n if (response.status >= 400) {\n logger.warn(`Skipping ${pageUrl} - HTTP status: ${response.status}`);\n continue;\n }\n\n const html = await response.text();\n const rawArticles = extractBodyFromHTML(html, logger);\n const titleMatch = html.match(/<title[^>]*>([^<]+)<\\/title>/);\n const descMatch = html.match(/<meta[^>]*name=\"description\"[^>]*content=\"([^\"]+)\"[^>]*>/);\n\n const title = titleMatch ? titleMatch[1].trim() : 'Unknown';\n const description = descMatch ? descMatch[1].trim() : 'No description';\n articles.push(\n ...rawArticles.map(content => ({ url: pageUrl, content, title, description }))\n );\n } catch (error) {\n logger.error(`Error fetching ${pageUrl}: ${error}`);\n continue;\n }\n }\n return articles;\n }\n\n /**\n * Fetches articles from the sitemap\n * @param {string} resource Optional resource path to filter URLs\n * @param {string} locale Locale for the content\n * @returns {Promise<StripeDocsArticle[]>} Array of article objects\n */\n private async fetchArticlesFromSitemap(\n resource: string | undefined,\n locale: string\n ): Promise<StripeDocsArticle[]> {\n const documentUrls = await this.fetchURLsFromSitemap(resource);\n return this.fetchArticlesFromURLs(documentUrls, locale);\n }\n\n /**\n * @deprecated Use `this.load()` and `splitter.splitDocuments()` individually.\n * Loads the documents and splits them using the given document transformer.\n * Kept for compatibility with LangChain's `index()` API, which only treats a\n * source as a document loader when it has both `load()` and `loadAndSplit()`.\n * `@langchain/core` 1.x no longer provides this method on BaseDocumentLoader.\n * @param splitter The document transformer (e.g. a text splitter) to apply\n * @returns {Promise<Document[]>} The loaded and split documents\n */\n async loadAndSplit(splitter?: BaseDocumentTransformer): Promise<Document[]> {\n if (splitter === undefined) {\n throw new Error('You must pass a text splitter to use this method.');\n }\n const docs = await this.load();\n return splitter.invoke(docs);\n }\n\n /**\n * Loads documents from Stripe.com\n * @param {Object} options Loading options\n * @param {string} options.resource Optional resource path to filter URLs\n * @param {string} options.locale Optional locale for the content (defaults to 'en-US')\n * @param {string[]} options.urls Optional list of specific URLs to load\n * @returns {Promise<Document[]>} Array of LangChain documents\n */\n async load(options?: {\n resource?: string;\n locale?: string;\n urls?: string[];\n }): Promise<Document[]> {\n const { resource, urls } = options ?? {};\n const locale = options?.locale ?? 'en-US';\n const articles = urls\n ? await this.fetchArticlesFromURLs(urls, locale)\n : await this.fetchArticlesFromSitemap(resource, locale);\n\n // Use NodeHtmlMarkdown to convert HTML to Markdown\n const nhm = new NodeHtmlMarkdown();\n\n return articles.map(\n article =>\n new Document({\n pageContent: nhm.translate(article.content),\n metadata: {\n source: article.url,\n title: article.title,\n description: article.description,\n },\n })\n );\n }\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,gBAAgB,oBAAoB;AAC/D,SAAS,0BAA0B;AACnC,SAAkC,gBAAgB;AAClD,SAAS,wBAAwB;;;ACHjC,SAAS,qBAAkC;AAE3C,IAAM,gBAAwB,IAAI,cAAc,KAAK;AAQ9C,SAAS,oBAAoB,YAAoB,SAAiB,eAAe;AACtF,MAAI;AACF,QAAI,CAAC,YAAY;AACf,aAAO,IAAI,iCAAiC;AAC5C,aAAO,CAAC;AAAA,IACV;AAIA,UAAM,YAAY;AAClB,UAAM,UAAU,CAAC;AACjB,QAAI;AAEJ,YAAQ,QAAQ,UAAU,KAAK,UAAU,OAAO,MAAM;AACpD,UAAI,MAAM,CAAC,GAAG;AACZ,gBAAQ,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC;AAAA,MAC9B;AAAA,IACF;AAEA,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A,QAC8B;AAC9B,UAAM,eAAe,MAAM,KAAK,qBAAqB,QAAQ;AAC7D,WAAO,KAAK,sBAAsB,cAAc,MAAM;AAAA,EACxD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAM,aAAa,UAAyD;AAC1E,QAAI,aAAa,QAAW;AAC1B,YAAM,IAAI,MAAM,mDAAmD;AAAA,IACrE;AACA,UAAM,OAAO,MAAM,KAAK,KAAK;AAC7B,WAAO,SAAS,OAAO,IAAI;AAAA,EAC7B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,KAAK,SAIa;AACtB,UAAM,EAAE,UAAU,KAAK,IAAI,WAAW,CAAC;AACvC,UAAM,SAAS,SAAS,UAAU;AAClC,UAAM,WAAW,OACb,MAAM,KAAK,sBAAsB,MAAM,MAAM,IAC7C,MAAM,KAAK,yBAAyB,UAAU,MAAM;AAGxD,UAAM,MAAM,IAAIC,kBAAiB;AAEjC,WAAO,SAAS;AAAA,MACd,aACE,IAAIC,UAAS;AAAA,QACX,aAAa,IAAI,UAAU,QAAQ,OAAO;AAAA,QAC1C,UAAU;AAAA,UACR,QAAQ,QAAQ;AAAA,UAChB,OAAO,QAAQ;AAAA,UACf,aAAa,QAAQ;AAAA,QACvB;AAAA,MACF,CAAC;AAAA,IACL;AAAA,EACF;AACF;","names":["ConsoleLogger","title","description","SitemapProcessor","fetchWithRetry","RequestPacer","BaseDocumentLoader","Document","NodeHtmlMarkdown","BaseDocumentLoader","SitemapProcessor","RequestPacer","fetchWithRetry","NodeHtmlMarkdown","Document"]}
package/package.json CHANGED
@@ -1,30 +1,33 @@
1
1
  {
2
2
  "name": "langchain-stripe-loader",
3
- "version": "0.0.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
- "main": "./dist/langchain-stripe-loader.cjs",
6
- "module": "./dist/langchain-stripe-loader.js",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/langchain-stripe-loader.js",
12
- "require": "./dist/langchain-stripe-loader.cjs"
13
- }
10
+ "import": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.cts",
16
+ "default": "./dist/index.cjs"
17
+ }
18
+ },
19
+ "./package.json": "./package.json"
14
20
  },
15
21
  "files": [
16
22
  "dist"
17
23
  ],
18
- "scripts": {
19
- "dev": "vite build --watch",
20
- "build": "vite build && tsc --emitDeclarationOnly",
21
- "test": "vitest run",
22
- "prepublishOnly": "npm run build"
23
- },
24
24
  "dependencies": {
25
- "@langchain/core": "^0.3.42",
26
- "stripe-loaders-core": "^0.0.0",
27
- "turndown": "^7.2.0"
25
+ "@langchain/core": "^1.4.0",
26
+ "node-html-markdown": "^1.3.0",
27
+ "stripe-loaders-core": "^0.2.0"
28
+ },
29
+ "engines": {
30
+ "node": ">=20"
28
31
  },
29
32
  "keywords": [
30
33
  "stripe",
@@ -40,17 +43,20 @@
40
43
  "description": "LangChain loader for Stripe data",
41
44
  "repository": {
42
45
  "type": "git",
43
- "url": "https://github.com/wpkyoto/stripe-docs-loader",
46
+ "url": "https://github.com/hideokamoto/stripe-docs-loader",
44
47
  "directory": "packages/langchain-stripe-loader"
45
48
  },
46
49
  "bugs": {
47
- "url": "https://github.com/wpkyoto/stripe-docs-loader/issues"
50
+ "url": "https://github.com/hideokamoto/stripe-docs-loader/issues"
48
51
  },
49
- "homepage": "https://github.com/wpkyoto/stripe-docs-loader/tree/main/packages/langchain-stripe-loader#readme",
52
+ "homepage": "https://github.com/hideokamoto/stripe-docs-loader/tree/main/packages/langchain-stripe-loader#readme",
50
53
  "publishConfig": {
51
54
  "access": "public"
52
55
  },
53
- "devDependencies": {
54
- "@types/turndown": "^5.0.5"
56
+ "sideEffects": false,
57
+ "scripts": {
58
+ "dev": "tsup --watch",
59
+ "build": "tsup",
60
+ "test": "vitest run"
55
61
  }
56
- }
62
+ }
@@ -1,44 +0,0 @@
1
- import { BaseDocumentLoader } from '@langchain/core/document_loaders/base';
2
- import { Document } from '@langchain/core/documents';
3
- /**
4
- * Document loader for Stripe.com website content
5
- * Extracts content from Stripe.com pages and converts it to LangChain documents
6
- */
7
- export declare class StripeComDocumentLoader extends BaseDocumentLoader {
8
- private readonly debug;
9
- constructor(debug?: boolean);
10
- /**
11
- * Fetches URLs from the Stripe.com sitemap
12
- * @param {string} resource Optional resource path to filter URLs
13
- * @returns {Promise<string[]>} Array of URLs from the sitemap
14
- */
15
- protected fetchURLsFromSitemap(resource?: string): Promise<string[]>;
16
- /**
17
- * Fetches article content from a list of URLs
18
- * @param {string[]} urls Array of URLs to fetch content from
19
- * @param {string} locale Optional locale for the content
20
- * @returns {Promise<StripeDocsArticle[]>} Array of article objects
21
- */
22
- private fetchArticlesFromURLs;
23
- /**
24
- * Fetches articles from the sitemap
25
- * @param {string} resource Optional resource path to filter URLs
26
- * @param {string} locale Optional locale for the content
27
- * @returns {Promise<StripeDocsArticle[]>} Array of article objects
28
- */
29
- private fetchArticlesFromSitemap;
30
- /**
31
- * Loads documents from Stripe.com
32
- * @param {Object} options Loading options
33
- * @param {string} options.resource Optional resource path to filter URLs
34
- * @param {string} options.locale Optional locale for the content (defaults to 'en-US')
35
- * @param {string[]} options.urls Optional list of specific URLs to load
36
- * @returns {Promise<Document[]>} Array of LangChain documents
37
- */
38
- load(options?: {
39
- resource?: string;
40
- locale?: string;
41
- urls?: string[];
42
- }): Promise<Document[]>;
43
- }
44
- //# sourceMappingURL=StripeComLoader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StripeComLoader.d.ts","sourceRoot":"","sources":["../src/StripeComLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAcrD;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,kBAAkB;IACjD,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,GAAE,OAAe;IAGnD;;;;OAIG;cACa,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM;IAUtD;;;;;OAKG;YACW,qBAAqB;IAmBnC;;;;;OAKG;YACW,wBAAwB;IAStC;;;;;;;OAOG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;KACjB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;CAoBxB"}