From 6e606ef3f8df4c10e2c048c5abebafb4352bc2ff Mon Sep 17 00:00:00 2001 From: Xcesius Date: Wed, 20 Aug 2025 13:17:31 +0200 Subject: [PATCH 01/10] feat(ui): add crosshair guides with settings\n\n- Draw crosshair row/column lines for the active cell\n- Highlight active headers; sync with frozen views\n- Settings dialog: toggle enable and set thickness\n- Persist in config (crosshair_enabled, crosshair_thickness)\n\nNo external deps; default enabled with 1px thickness. --- config_manager.py | 7 +- custom_widgets.py | 291 +++++++++++++++++++++++++++++++++++++- ui.py | 351 ++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 601 insertions(+), 48 deletions(-) diff --git a/config_manager.py b/config_manager.py index 24e10ce..e06e03e 100644 --- a/config_manager.py +++ b/config_manager.py @@ -22,6 +22,11 @@ def _load_config_unlocked(self): settings.setdefault("debug_mode_enabled", False) # Add the new setting for the frozen column's header settings.setdefault("show_row_numbers_on_frozen_column", False) + # Undo/Redo depth configuration + settings.setdefault("undo_stack_max_size", 10) + # Crosshair guides configuration + settings.setdefault("crosshair_enabled", True) + settings.setdefault("crosshair_thickness", 1) # Add the new setting for freezing the first row #settings.setdefault("freeze_first_row_enabled", False) config["settings"] = settings @@ -47,4 +52,4 @@ def set_setting(self, key, value): if "settings" not in self.config: self.config["settings"] = {} self.config["settings"][key] = value - self.save_config() \ No newline at end of file + self.save_config() diff --git a/custom_widgets.py b/custom_widgets.py index 496a1bf..a06e90e 100644 --- a/custom_widgets.py +++ b/custom_widgets.py @@ -1,8 +1,9 @@ -from PyQt6.QtWidgets import (QTableView, QStyledItemDelegate, QMenu, QApplication, - QHeaderView, QStyle, QAbstractItemView) -from PyQt6.QtCore import (Qt, pyqtSignal, QItemSelection, QItemSelectionModel, +from PyQt6.QtWidgets import (QTableView, QStyledItemDelegate, QMenu, QApplication, + QHeaderView, QStyle, QAbstractItemView, QInputDialog, QMessageBox) +from PyQt6.QtCore import (Qt, pyqtSignal, QItemSelection, QItemSelectionModel, QTimer) -from PyQt6.QtGui import QAction, QKeySequence, QStandardItemModel, QStandardItem +from PyQt6.QtGui import (QAction, QKeySequence, QStandardItemModel, QStandardItem, + QPainter, QPen, QColor) class CustomHeaderView(QHeaderView): rightClicked = pyqtSignal(int) @@ -13,6 +14,12 @@ def __init__(self, orientation, parent=None): self.customContextMenuRequested.connect(self.show_context_menu) self._is_selecting = False self._start_section = -1 + # Crosshair highlighting for active section + self._highlighted_section = -1 + self._show_crosshair_guides = True + self._crosshair_color = QColor(0, 120, 215, 60) # light accent fill + self._crosshair_border = QColor(0, 120, 215, 180) + self._crosshair_border_width = 1 def show_context_menu(self, position): logical_index = self.logicalIndexAt(position) @@ -62,6 +69,43 @@ def mouseReleaseEvent(self, event): return super().mouseReleaseEvent(event) + # --- Crosshair helpers --- + def setCrosshairGuidesEnabled(self, enabled: bool): + self._show_crosshair_guides = bool(enabled) + self.viewport().update() + + def setHighlightedSection(self, section_index: int): + self._highlighted_section = section_index if section_index is not None else -1 + self.viewport().update() + + def setCrosshairStyle(self, fill_color: QColor = None, border_color: QColor = None, border_width: int = None): + if fill_color is not None: + self._crosshair_color = fill_color + if border_color is not None: + self._crosshair_border = border_color + if border_width is not None: + self._crosshair_border_width = int(border_width) + self.viewport().update() + + def paintSection(self, painter, rect, logicalIndex): + super().paintSection(painter, rect, logicalIndex) + if not self._show_crosshair_guides: + return + if logicalIndex != self._highlighted_section or not rect.isValid(): + return + # Light fill to make the active column/row name pop + painter.save() + painter.setPen(Qt.PenStyle.NoPen) + painter.setBrush(self._crosshair_color) + painter.drawRect(rect) + # Subtle border to increase contrast + pen = QPen(self._crosshair_border) + pen.setWidth(self._crosshair_border_width) + painter.setPen(pen) + painter.setBrush(Qt.BrushStyle.NoBrush) + painter.drawRect(rect.adjusted(0, 0, -1, -1)) + painter.restore() + class NoHoverDelegate(QStyledItemDelegate): def paint(self, painter, option, index): opt = option @@ -82,11 +126,16 @@ class CleanTableView(QTableView): select_all_requested = pyqtSignal() insert_row_above_requested = pyqtSignal() insert_row_below_requested = pyqtSignal() + insert_rows_above_requested = pyqtSignal(int) + insert_rows_below_requested = pyqtSignal(int) delete_row_requested = pyqtSignal() insert_column_left_requested = pyqtSignal() insert_column_right_requested = pyqtSignal() + insert_columns_left_requested = pyqtSignal(int) + insert_columns_right_requested = pyqtSignal(int) delete_column_requested = pyqtSignal() math_action_requested = pyqtSignal(str) + conditional_math_requested = pyqtSignal(object) select_column_requested = pyqtSignal(int) select_row_requested = pyqtSignal(int) @@ -94,6 +143,15 @@ def __init__(self, parent=None): super().__init__(parent) self.config_manager = ConfigManager() self.setItemDelegate(NoHoverDelegate()) + # Improve edit UX: double-click or edit key starts edit, Enter commits + self.setEditTriggers(QAbstractItemView.EditTrigger.DoubleClicked | QAbstractItemView.EditTrigger.EditKeyPressed) + + # Crosshair guides settings + self._show_crosshair_guides = True + self._crosshair_color = QColor(0, 120, 215, 180) # Windows accent-like + self._crosshair_width = 1 + self._current_row = -1 + self._current_col = -1 # --- Frozen Column View Setup --- self.frozen_column_view = QTableView(self) @@ -144,11 +202,15 @@ def __init__(self, parent=None): self.setSelectionBehavior(QTableView.SelectionBehavior.SelectItems) self.setSelectionMode(QTableView.SelectionMode.ExtendedSelection) - + # Connect signals for column/row selection self.select_column_requested.connect(self.select_column) self.select_row_requested.connect(self.select_row) + # Track current cell for crosshair guides + # Will be fully connected when a model is set + self._selection_conn_made = False + def setModel(self, model): super().setModel(model) if model: @@ -156,6 +218,13 @@ def setModel(self, model): self.frozen_column_view.setSelectionModel(self.selectionModel()) self.frozen_row_view.setModel(model) self.frozen_row_view.setSelectionModel(self.selectionModel()) + # Hook current index changes for crosshair + if not self._selection_conn_made: + try: + self.selectionModel().currentChanged.connect(self._on_current_changed) + self._selection_conn_made = True + except Exception: + pass def set_first_column_frozen(self, frozen: bool): if self.model() is None or self.model().columnCount() == 0: @@ -191,6 +260,88 @@ def set_first_row_frozen(self, frozen: bool): for row in range(1, self.model().rowCount()): self.frozen_row_view.setRowHidden(row, True) self.frozen_row_view.setRowHidden(0, False) + + # --- Crosshair guides public API --- + def setCrosshairGuidesEnabled(self, enabled: bool): + self._show_crosshair_guides = bool(enabled) + # Propagate to headers + for hv in (self.horizontalHeader(), self.verticalHeader(), + getattr(self.frozen_column_view, 'horizontalHeader', lambda: None)() or None, + getattr(self.frozen_row_view, 'horizontalHeader', lambda: None)() or None): + if isinstance(hv, CustomHeaderView): + hv.setCrosshairGuidesEnabled(self._show_crosshair_guides) + self.viewport().update() + self.frozen_column_view.viewport().update() + self.frozen_row_view.viewport().update() + + def crosshairGuidesEnabled(self) -> bool: + return self._show_crosshair_guides + + def setCrosshairColor(self, color: QColor): + self._crosshair_color = color + self.viewport().update() + self.frozen_column_view.viewport().update() + self.frozen_row_view.viewport().update() + + def setCrosshairWidth(self, width: int): + self._crosshair_width = max(1, int(width)) + self.viewport().update() + self.frozen_column_view.viewport().update() + self.frozen_row_view.viewport().update() + + # --- Crosshair core logic --- + def _on_current_changed(self, current, previous): + if not current or not current.isValid(): + self._current_row = -1 + self._current_col = -1 + else: + self._current_row = current.row() + self._current_col = current.column() + # Update header highlights + try: + if isinstance(self.horizontalHeader(), CustomHeaderView): + self.horizontalHeader().setHighlightedSection(self._current_col) + if isinstance(self.verticalHeader(), CustomHeaderView): + self.verticalHeader().setHighlightedSection(self._current_row) + # Frozen mirrors + h_frozen = self.frozen_column_view.horizontalHeader() + if isinstance(h_frozen, CustomHeaderView): + h_frozen.setHighlightedSection(self._current_col) + h_frozen_row = self.frozen_row_view.horizontalHeader() + if isinstance(h_frozen_row, CustomHeaderView): + h_frozen_row.setHighlightedSection(self._current_col) + except Exception: + pass + # Repaint overlays + self.viewport().update() + self.frozen_column_view.viewport().update() + self.frozen_row_view.viewport().update() + + def paintEvent(self, event): + super().paintEvent(event) + if not self._show_crosshair_guides: + return + if self.model() is None or self._current_row < 0 or self._current_col < 0: + return + # Draw crosshair lines aligned to the active cell + try: + idx = self.model().index(self._current_row, self._current_col) + rect = self.visualRect(idx) + if not rect.isValid(): + return + painter = QPainter(self.viewport()) + pen = QPen(self._crosshair_color) + pen.setWidth(self._crosshair_width) + painter.setPen(pen) + # Vertical line across visible table area (not headers) + x = rect.left() + painter.drawLine(x, 0, x, self.viewport().height()) + # Horizontal line across visible table area (not headers) + y = rect.top() + painter.drawLine(0, y, self.viewport().width(), y) + painter.end() + except Exception: + pass # Initial sync of row height and all column widths self.frozen_row_view.setRowHeight(0, self.rowHeight(0)) for col in range(self.model().columnCount()): @@ -288,6 +439,15 @@ def select_row(self, row: int): self.selectionModel().select(selection, QItemSelectionModel.SelectionFlag.Select) def keyPressEvent(self, event): + if event.key() == Qt.Key.Key_Return or event.key() == Qt.Key.Key_Enter: + # Commit current editor if any + if self.state() == QAbstractItemView.State.EditingState: + self.closePersistentEditor(self.currentIndex()) + # Move down to mimic spreadsheet feel (optional) + current = self.currentIndex() + if current.isValid() and current.row() + 1 < (self.model().rowCount() if self.model() else 0): + self.setCurrentIndex(self.model().index(current.row() + 1, current.column())) + return if event.key() == Qt.Key.Key_R and (event.modifiers() & Qt.KeyboardModifier.ControlModifier): current_index = self.currentIndex() if current_index.isValid(): @@ -348,6 +508,10 @@ def show_context_menu(self, position): decrement_action = QAction("Decrement by 1", self) decrement_action.triggered.connect(lambda: self.math_action_requested.emit("decrement")) math_menu.addAction(decrement_action) + math_menu.addSeparator() + conditional_action = QAction("Conditional…", self) + conditional_action.triggered.connect(self._prompt_conditional_math) + math_menu.addAction(conditional_action) menu.addSeparator() insert_row_above_action = QAction("Insert Row &Above", self) insert_row_above_action.triggered.connect(self.insert_row_above_requested.emit) @@ -355,6 +519,12 @@ def show_context_menu(self, position): insert_row_below_action = QAction("Insert Row &Below", self) insert_row_below_action.triggered.connect(self.insert_row_below_requested.emit) menu.addAction(insert_row_below_action) + insert_rows_above_action = QAction("Insert &Rows Above…", self) + insert_rows_above_action.triggered.connect(lambda: self._prompt_insert_rows(True)) + menu.addAction(insert_rows_above_action) + insert_rows_below_action = QAction("Insert R&ows Below…", self) + insert_rows_below_action.triggered.connect(lambda: self._prompt_insert_rows(False)) + menu.addAction(insert_rows_below_action) delete_row_action = QAction("&Delete Row", self) delete_row_action.triggered.connect(self.delete_row_requested.emit) menu.addAction(delete_row_action) @@ -365,6 +535,12 @@ def show_context_menu(self, position): insert_column_right_action = QAction("Insert Column &Right", self) insert_column_right_action.triggered.connect(self.insert_column_right_requested.emit) menu.addAction(insert_column_right_action) + insert_columns_left_action = QAction("Insert C&olumns Left…", self) + insert_columns_left_action.triggered.connect(lambda: self._prompt_insert_columns(True)) + menu.addAction(insert_columns_left_action) + insert_columns_right_action = QAction("Insert Co&lumns Right…", self) + insert_columns_right_action.triggered.connect(lambda: self._prompt_insert_columns(False)) + menu.addAction(insert_columns_right_action) delete_column_action = QAction("Delete &Column", self) delete_column_action.triggered.connect(self.delete_column_requested.emit) menu.addAction(delete_column_action) @@ -386,14 +562,115 @@ def show_context_menu(self, position): except (ValueError, TypeError): can_do_math = False break - math_menu.setEnabled(can_do_math) + # Enable/disable only simple math actions based on numeric selection; keep Conditional always enabled + multiply_action.setEnabled(can_do_math) + divide_action.setEnabled(can_do_math) + add_action.setEnabled(can_do_math) + subtract_action.setEnabled(can_do_math) + increment_action.setEnabled(can_do_math) + decrement_action.setEnabled(can_do_math) has_valid_selection = index.isValid() select_row_action.setEnabled(has_valid_selection) select_column_action.setEnabled(has_valid_selection) insert_row_above_action.setEnabled(has_valid_selection) insert_row_below_action.setEnabled(has_valid_selection) + insert_rows_above_action.setEnabled(has_valid_selection) + insert_rows_below_action.setEnabled(has_valid_selection) delete_row_action.setEnabled(has_valid_selection) insert_column_left_action.setEnabled(has_valid_selection) insert_column_right_action.setEnabled(has_valid_selection) + insert_columns_left_action.setEnabled(has_valid_selection) + insert_columns_right_action.setEnabled(has_valid_selection) delete_column_action.setEnabled(has_valid_selection) - menu.exec(self.mapToGlobal(position)) \ No newline at end of file + menu.exec(self.mapToGlobal(position)) + + def _prompt_insert_rows(self, above: bool): + count, ok = QInputDialog.getInt(self, "Insert Rows", "Number of rows:", 5, 1, 10000, 1) + if not ok: + return + if above: + self.insert_rows_above_requested.emit(count) + else: + self.insert_rows_below_requested.emit(count) + + def _prompt_insert_columns(self, left: bool): + count, ok = QInputDialog.getInt(self, "Insert Columns", "Number of columns:", 2, 1, 500, 1) + if not ok: + return + if left: + self.insert_columns_left_requested.emit(count) + else: + self.insert_columns_right_requested.emit(count) + + def _prompt_conditional_math(self): + # 1) Condition input + text, ok = QInputDialog.getText(self, "Conditional Math", "Condition (e.g., primeevil == 1):") + if not ok or not text.strip(): + return + condition_str = text.strip() + + # 2) Operation choice + operations = ["multiply", "divide", "add", "subtract", "increment", "decrement"] + op, ok = QInputDialog.getItem(self, "Operation", "Choose operation:", operations, 0, False) + if not ok: + return + + operand = None + if op not in ("increment", "decrement"): + val, ok = QInputDialog.getDouble(self, op.capitalize(), f"Enter value to {op}:") + if not ok: + return + operand = val + + # 3) Target columns + selected_cols = sorted({idx.column() for idx in self.selectedIndexes()}) + use_sel = False + if selected_cols: + reply = QMessageBox.question(self, "Target Columns", "Apply to currently selected columns?", + QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No, + QMessageBox.StandardButton.Yes) + use_sel = reply == QMessageBox.StandardButton.Yes + + target_columns = [] + if use_sel: + target_columns = selected_cols + else: + # Build comma-separated prompt of columns + model = self.model() + # Prefer header items; fallback to headerData with DisplayRole + headers = [] + for c in range(model.columnCount()): + header_item = model.horizontalHeaderItem(c) + if header_item is not None and header_item.text() is not None: + headers.append(header_item.text()) + else: + try: + headers.append(str(model.headerData(c, Qt.Orientation.Horizontal, Qt.ItemDataRole.DisplayRole))) + except Exception: + headers.append(str(c)) + default_cols = ", ".join([h for h in headers if isinstance(h, str)][:2]) + cols_str, ok = QInputDialog.getText(self, "Target Columns", "Column names (comma separated):", text=default_cols) + if not ok or not cols_str.strip(): + return + requested = [c.strip() for c in cols_str.split(',') if c.strip()] + name_to_index = {str(headers[i]): i for i in range(len(headers))} + missing = [c for c in requested if c not in name_to_index] + if missing: + QMessageBox.warning(self, "Unknown Columns", f"Columns not found: {', '.join(missing)}") + return + target_columns = [name_to_index[c] for c in requested] + + payload = { + "condition": condition_str, + "operation": op, + "operand": operand, + "target_columns": target_columns, + } + # Minimal debug output to help trace selection -> payload mapping + try: + from config_manager import ConfigManager as _Cfg + if _Cfg().get_setting("debug_mode_enabled", False): + print("[DEBUG] Conditional prompt payload:", payload) + except Exception: + pass + self.conditional_math_requested.emit(payload) diff --git a/ui.py b/ui.py index e9bbe81..64ef273 100644 --- a/ui.py +++ b/ui.py @@ -11,6 +11,7 @@ import shutil from datetime import datetime import json +import re class ComboBoxDelegate(QStyledItemDelegate): def __init__(self, parent=None, items=None): @@ -409,6 +410,20 @@ def __init__(self, parent=None): self.debug_mode_checkbox.setChecked(self.config_manager.get_setting("debug_mode_enabled", False)) layout.addWidget(self.debug_mode_checkbox) + # Crosshair guides settings + self.crosshair_enabled_checkbox = QCheckBox("Enable crosshair guides (row/column lines)") + self.crosshair_enabled_checkbox.setChecked(self.config_manager.get_setting("crosshair_enabled", True)) + layout.addWidget(self.crosshair_enabled_checkbox) + + crosshair_row = QHBoxLayout() + crosshair_row.addWidget(QLabel("Crosshair thickness (px):")) + self.crosshair_thickness_input = QLineEdit(str(self.config_manager.get_setting("crosshair_thickness", 1))) + self.crosshair_thickness_input.setPlaceholderText("e.g. 1-6") + self.crosshair_thickness_input.setMaximumWidth(80) + crosshair_row.addWidget(self.crosshair_thickness_input) + crosshair_row.addStretch(1) + layout.addLayout(crosshair_row) + button_layout = QHBoxLayout() self.save_button = QPushButton("Save") self.save_button.clicked.connect(self.save_settings) @@ -429,6 +444,14 @@ def save_settings(self): # Save the new setting #self.config_manager.set_setting("freeze_first_row_enabled", self.freeze_first_row_checkbox.isChecked()) self.config_manager.set_setting("debug_mode_enabled", self.debug_mode_checkbox.isChecked()) + # Crosshair settings + self.config_manager.set_setting("crosshair_enabled", self.crosshair_enabled_checkbox.isChecked()) + try: + thickness = int(self.crosshair_thickness_input.text()) + except Exception: + thickness = 1 + thickness = max(1, min(6, thickness)) + self.config_manager.set_setting("crosshair_thickness", thickness) self.accept() class EditorWindow(QMainWindow, Ui_MainWindow): @@ -446,6 +469,20 @@ def __init__(self, parent=None): self.create_menus() self.apply_initial_settings() self.update_window_title() + # Honour configurable undo depth + try: + self.undo_stack.max_size = int(self.config_manager.get_setting("undo_stack_max_size", 10) or 10) + except Exception: + self.undo_stack.max_size = 10 + # Enable drag-and-drop opening of .txt files + self.setAcceptDrops(True) + + def debug_print(self, *args): + try: + if self.config_manager.get_setting("debug_mode_enabled", False): + print("[DEBUG]", *args) + except Exception: + pass def create_menus(self): # File Menu @@ -533,6 +570,25 @@ def apply_initial_settings(self): #self.freeze_row_action.setChecked(freeze_row) #self.tableView.set_first_row_frozen(freeze_row) + # Crosshair guides + crosshair_enabled = self.config_manager.get_setting("crosshair_enabled", True) + self.tableView.setCrosshairGuidesEnabled(bool(crosshair_enabled)) + try: + crosshair_width = int(self.config_manager.get_setting("crosshair_thickness", 1) or 1) + except Exception: + crosshair_width = 1 + self.tableView.setCrosshairWidth(max(1, min(6, crosshair_width))) + # Also sync header outline thickness on custom headers + try: + hh = self.tableView.horizontalHeader() + vh = self.tableView.verticalHeader() + if hasattr(hh, 'setCrosshairStyle'): + hh.setCrosshairStyle(border_width=max(1, min(6, crosshair_width))) + if hasattr(vh, 'setCrosshairStyle'): + vh.setCrosshairStyle(border_width=max(1, min(6, crosshair_width))) + except Exception: + pass + def toggle_freeze_first_column(self, frozen): """Handles the 'Freeze First Column' menu action.""" if self.data_frame is None or self.data_frame.shape[1] == 0: @@ -557,45 +613,66 @@ def toggle_freeze_first_row(self, frozen): def open_file(self): file_path, _ = QFileDialog.getOpenFileName(self, "Open .txt file", "", "Text Files (*.txt)") if file_path: - - # Auto-detect file type and encoding silently - file_type, confidence, binding_key = detect_file_type(file_path) - detected_encoding = auto_detect_encoding(file_path) - - # Try to find and apply binding if detected - binding_manager = get_binding_manager() - - # Force refresh if no bindings loaded (happens after directory reorganization) - if len(binding_manager.get_all_bindings()) == 0: - print(" No metadata loaded, forcing refresh...") - binding_manager.refresh_bindings() - - applied_binding = None - - if binding_key and confidence in ['high', 'medium']: - # Create dynamic binding for the detected file type and current file - applied_binding = binding_manager.create_dynamic_binding(binding_key, file_path) - - # Print detection results to console for debugging - print(f"Auto-detection results:") - print(f" File: {os.path.basename(file_path)}") - print(f" Type: {file_type} (confidence: {confidence})") - print(f" Encoding: {detected_encoding}") - if applied_binding: - print(f" Applied binding: {applied_binding.base_name}") - - # Load the file directly - self.current_file_path = file_path - self.current_binding = applied_binding - - data = open_txt_file(file_path) - if data is not None: - print(f"File loaded successfully! Type: {file_type}, Encoding: {detected_encoding}") - self.data_frame = data - self.display_data_in_table() - self.update_window_title() - else: - QMessageBox.warning(self, "Load Error", "Failed to load file!") + self._load_file_path(file_path) + + def _load_file_path(self, file_path: str): + """Load a specific .txt file path using standard detection and binding logic.""" + if not file_path: + return + # Auto-detect file type and encoding silently + file_type, confidence, binding_key = detect_file_type(file_path) + detected_encoding = auto_detect_encoding(file_path) + # Try to find and apply binding if detected + binding_manager = get_binding_manager() + # Force refresh if no bindings loaded (happens after directory reorganization) + if len(binding_manager.get_all_bindings()) == 0: + print(" No metadata loaded, forcing refresh...") + binding_manager.refresh_bindings() + applied_binding = None + if binding_key and confidence in ['high', 'medium']: + applied_binding = binding_manager.create_dynamic_binding(binding_key, file_path) + # Print detection results to console for debugging + print("Auto-detection results:") + print(f" File: {os.path.basename(file_path)}") + print(f" Type: {file_type} (confidence: {confidence})") + print(f" Encoding: {detected_encoding}") + if applied_binding: + print(f" Applied binding: {applied_binding.base_name}") + # Load the file directly + self.current_file_path = file_path + self.current_binding = applied_binding + data = open_txt_file(file_path) + if data is not None: + print(f"File loaded successfully! Type: {file_type}, Encoding: {detected_encoding}") + self.data_frame = data + self.display_data_in_table() + self.update_window_title() + else: + QMessageBox.warning(self, "Load Error", "Failed to load file!") + + # Drag-and-drop support + def dragEnterEvent(self, event): + if event.mimeData().hasUrls(): + # Accept if any of the URLs is a .txt file + for url in event.mimeData().urls(): + if url.isLocalFile() and url.toLocalFile().lower().endswith('.txt'): + event.acceptProposedAction() + return + event.ignore() + + def dropEvent(self, event): + handled = False + for url in event.mimeData().urls(): + local = url.toLocalFile() + if url.isLocalFile() and local.lower().endswith('.txt'): + self._load_file_path(local) + handled = True + # Load only first file for now + break + if handled: + event.acceptProposedAction() + else: + event.ignore() def show_binding_info(self, binding): print(f"Applied binding: {binding.base_name}") @@ -838,11 +915,16 @@ def connect_context_menu_signals(self): self.tableView.select_all_requested.connect(self.select_all) self.tableView.insert_row_above_requested.connect(self.insert_row_above) self.tableView.insert_row_below_requested.connect(self.insert_row_below) + self.tableView.insert_rows_above_requested.connect(self.insert_rows_above) + self.tableView.insert_rows_below_requested.connect(self.insert_rows_below) self.tableView.delete_row_requested.connect(self.delete_row) self.tableView.insert_column_left_requested.connect(self.insert_column_left) self.tableView.insert_column_right_requested.connect(self.insert_column_right) + self.tableView.insert_columns_left_requested.connect(self.insert_columns_left) + self.tableView.insert_columns_right_requested.connect(self.insert_columns_right) self.tableView.delete_column_requested.connect(self.delete_column) self.tableView.math_action_requested.connect(self.handle_math_action) + self.tableView.conditional_math_requested.connect(self.handle_conditional_math) self.tableView.select_column_requested.connect(self.select_column) def copy_selection(self): @@ -994,6 +1076,24 @@ def _insert_row_at_position(self, row_position): after = self.data_frame.iloc[row_position:] self.data_frame = pd.concat([before, new_df_row, after], ignore_index=True) print(f"Inserted new row at position {row_position}") + + def insert_rows_above(self, count: int): + current_index = self.tableView.currentIndex() + if not current_index.isValid(): + return + target_row = current_index.row() + for i in range(count): + self._insert_row_at_position(target_row) + print(f"Inserted {count} rows above {target_row}") + + def insert_rows_below(self, count: int): + current_index = self.tableView.currentIndex() + if not current_index.isValid(): + return + start = current_index.row() + 1 + for i in range(count): + self._insert_row_at_position(start + i) + print(f"Inserted {count} rows below {current_index.row()}") def delete_row(self): selection = self.tableView.selectionModel().selectedIndexes() @@ -1068,6 +1168,50 @@ def _insert_column_at_position(self, col_position): new_data[col_name] = self.data_frame[old_col_name] self.data_frame = pd.DataFrame(new_data) print(f"Inserted new column '{column_name}' at position {col_position}") + + def _insert_n_columns(self, col_position: int, count: int): + for i in range(count): + # Auto-name columns; user can rename later + from PyQt6.QtWidgets import QInputDialog + column_name = f"NewColumn{col_position + i}" + model = self.tableView.model() + if not model: + return + model.insertColumn(col_position + i) + model.setHorizontalHeaderItem(col_position + i, QStandardItem(column_name)) + for row in range(model.rowCount()): + model.setItem(row, col_position + i, QStandardItem("")) + if self.data_frame is not None: + import pandas as pd + columns = list(self.data_frame.columns) + columns.insert(col_position + i, column_name) + new_data = {} + for j, col_name in enumerate(columns): + if j < col_position + i: + old_col_name = list(self.data_frame.columns)[j] + new_data[col_name] = self.data_frame[old_col_name] + elif j == col_position + i: + new_data[col_name] = [None] * len(self.data_frame) + else: + old_col_name = list(self.data_frame.columns)[j - 1] + new_data[col_name] = self.data_frame[old_col_name] + self.data_frame = pd.DataFrame(new_data) + + def insert_columns_left(self, count: int): + current_index = self.tableView.currentIndex() + if not current_index.isValid(): + return + target_col = current_index.column() + self._insert_n_columns(target_col, count) + print(f"Inserted {count} columns left of {target_col}") + + def insert_columns_right(self, count: int): + current_index = self.tableView.currentIndex() + if not current_index.isValid(): + return + target_col = current_index.column() + 1 + self._insert_n_columns(target_col, count) + print(f"Inserted {count} columns right of {current_index.column()}") def delete_column(self): current_index = self.tableView.currentIndex() @@ -1135,4 +1279,131 @@ def handle_math_action(self, action): except (ValueError, TypeError): pass finally: - self._tracking_changes = True \ No newline at end of file + self._tracking_changes = True + + def handle_conditional_math(self, payload): + condition_str = payload.get("condition", "").strip() + operation = payload.get("operation") + operand = payload.get("operand") + target_columns = payload.get("target_columns", []) + + if self.data_frame is None or not condition_str or not operation: + return + + df = self.data_frame + self.debug_print("Conditional math invoked:", { + "condition": condition_str, + "operation": operation, + "operand": operand, + "target_columns_indices": target_columns, + "target_columns_names": [df.columns[i] for i in target_columns if i < len(df.columns)], + }) + # Build a boolean mask like "primeevil == 1" ensuring a proper boolean Series aligned to df + try: + maybe_mask = df.eval(condition_str) + if isinstance(maybe_mask, pd.Series) and maybe_mask.dtype == bool and maybe_mask.index.equals(df.index): + mask = maybe_mask + else: + # Try query; convert resulting index to aligned boolean Series + queried = df.query(condition_str) + mask = df.index.isin(queried.index) + except Exception: + QMessageBox.warning(self, "Invalid Condition", f"Could not evaluate condition: {condition_str}") + return + + if not isinstance(mask, (pd.Series, pd.Index)): + QMessageBox.warning(self, "Invalid Condition", "Condition did not produce a boolean mask.") + return + if isinstance(mask, pd.Index): + mask = df.index.isin(mask) + mask = pd.Series(mask, index=df.index).fillna(False) + self.debug_print("Mask computed:", { + "dtype": str(mask.dtype), + "true_count": int(mask.sum()), + "total_rows": int(len(mask)), + }) + + # If no rows matched, try numeric coercion of referenced columns as a fallback + if int(mask.sum()) == 0: + tokens = re.findall(r"[A-Za-z_][A-Za-z0-9_]*", condition_str) + referenced_cols = [t for t in tokens if t in df.columns] + local_coerced = {name: pd.to_numeric(df[name], errors='coerce') for name in referenced_cols} + try: + coerced_mask = pd.eval(condition_str, engine='python', local_dict=local_coerced) + if isinstance(coerced_mask, (pd.Series, list)): + coerced_mask = pd.Series(coerced_mask, index=df.index) + coerced_mask = coerced_mask.astype(bool).fillna(False) + self.debug_print("Coerced mask computed:", { + "referenced_cols": referenced_cols, + "true_count": int(coerced_mask.sum()), + }) + mask = coerced_mask + except Exception as e: + self.debug_print("Coerced evaluation failed:", str(e)) + + if not target_columns: + return + + # For each target column, coerce numeric and apply + self._tracking_changes = False + try: + for col_idx in target_columns: + if col_idx >= len(df.columns): + continue + col_name = df.columns[col_idx] + # Operate only on numeric values; non-numeric remain unchanged + numeric_series = pd.to_numeric(df[col_name], errors='coerce') + sel = mask.fillna(False) + current_values = numeric_series.where(sel) + self.debug_print(f"Applying '{operation}' to column", { + "column_index": int(col_idx), + "column_name": str(col_name), + "selected_non_na": int(current_values.notna().sum()), + }) + + if operation == "increment": + new_values = current_values + 1 + elif operation == "decrement": + new_values = current_values - 1 + elif operation == "add": + new_values = current_values + float(operand) + elif operation == "subtract": + new_values = current_values - float(operand) + elif operation == "multiply": + new_values = current_values * float(operand) + elif operation == "divide": + try: + val = float(operand) + except Exception: + QMessageBox.warning(self, "Invalid Operand", "Operand must be numeric.") + return + if val == 0: + QMessageBox.warning(self, "Invalid Operand", "Cannot divide by zero.") + return + new_values = current_values / val + else: + continue + + # Round to nearest integer like other math ops + new_values = new_values.round().astype('Int64') + df.loc[sel, col_name] = new_values.astype(object) + self.debug_print("Applied operation stats:", { + "updated_rows": int(sel.sum()), + "example_before_after": str(list(zip( + current_values.dropna().head(3).astype(int).tolist(), + new_values.dropna().head(3).astype(int).tolist() + ))) + }) + + # Reflect changes in the view model + model = self.tableView.model() + for row_idx in df.index[sel]: + model_item = model.item(int(row_idx), int(col_idx)) + if model_item is not None: + val = df.at[row_idx, col_name] + try: + model_item.setText(str(int(val))) + except Exception: + model_item.setText(str(val)) + finally: + self._tracking_changes = True From 23579eaaa93b2153bd374fca1326f79b3bf9d3b8 Mon Sep 17 00:00:00 2001 From: Xcesius Date: Wed, 20 Aug 2025 13:36:57 +0200 Subject: [PATCH 02/10] chore(gitignore): ignore root *.txt and AGENTS.md to reduce noise\n\n- Add /AGENTS.md and /*.txt rules\n- Preserve docs/*.md and tests fixtures by only ignoring root-level files --- .gitignore | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 10a1877..355b252 100644 --- a/.gitignore +++ b/.gitignore @@ -238,4 +238,9 @@ test_output/ test_results/ # Backup directory (already moved files there) -# backups/ \ No newline at end of file +# backups/ + +# Ignore top-level Markdown and text payloads not meant for version control +# Keep docs/*.md and tests fixtures tracked; only ignore root-level files +/AGENTS.md +/*.txt From 299253475f9b1a213be6bd550ee50eb665c79a0b Mon Sep 17 00:00:00 2001 From: Xcesius Date: Wed, 20 Aug 2025 13:38:53 +0200 Subject: [PATCH 03/10] chore(gitignore): ignore archives/backups/binaries and report folders\n\n- Ensure *.zip, *.bak, *.exe are ignored (already covered)\n- Ignore whole extracted_data/ and diff_reports/ directories\n- Keep docs and tests fixtures intact --- .gitignore | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 355b252..e1f2768 100644 --- a/.gitignore +++ b/.gitignore @@ -230,8 +230,11 @@ data/ .venv/ -# Extracted data files (can be regenerated) -extracted_data/*.json +# Extracted/derived data (can be regenerated) +extracted_data/ + +# Analysis/report outputs +diff_reports/ # Test output files test_output/ From 7ca2dcea537bb348b2c97e6355a9b441c2c9e95a Mon Sep 17 00:00:00 2001 From: Xcesius Date: Wed, 20 Aug 2025 13:40:56 +0200 Subject: [PATCH 04/10] fix(ui): extend crosshair lines across frozen panes\n\n- Draw horizontal line in frozen column view for active row\n- Draw vertical line in frozen row view for active column\n- Ensures crosshair spans to first field when frozen --- custom_widgets.py | 62 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 14 deletions(-) diff --git a/custom_widgets.py b/custom_widgets.py index a06e90e..532959e 100644 --- a/custom_widgets.py +++ b/custom_widgets.py @@ -325,21 +325,55 @@ def paintEvent(self, event): return # Draw crosshair lines aligned to the active cell try: - idx = self.model().index(self._current_row, self._current_col) + model = self.model() + # Main view overlay + idx = model.index(self._current_row, self._current_col) rect = self.visualRect(idx) - if not rect.isValid(): - return - painter = QPainter(self.viewport()) - pen = QPen(self._crosshair_color) - pen.setWidth(self._crosshair_width) - painter.setPen(pen) - # Vertical line across visible table area (not headers) - x = rect.left() - painter.drawLine(x, 0, x, self.viewport().height()) - # Horizontal line across visible table area (not headers) - y = rect.top() - painter.drawLine(0, y, self.viewport().width(), y) - painter.end() + if rect.isValid(): + p = QPainter(self.viewport()) + pen = QPen(self._crosshair_color) + pen.setWidth(self._crosshair_width) + p.setPen(pen) + # Vertical line across main viewport + x = rect.left() + p.drawLine(x, 0, x, self.viewport().height()) + # Horizontal line across main viewport + y = rect.top() + p.drawLine(0, y, self.viewport().width(), y) + p.end() + + # Also draw into frozen views so lines span full table including frozen panes + # 1) Horizontal line in frozen column view + if self.frozen_column_view.isVisible(): + try: + idx_left = model.index(self._current_row, 0) + rect_left = self.frozen_column_view.visualRect(idx_left) + if rect_left.isValid(): + p2 = QPainter(self.frozen_column_view.viewport()) + pen2 = QPen(self._crosshair_color) + pen2.setWidth(self._crosshair_width) + p2.setPen(pen2) + y_left = rect_left.top() + p2.drawLine(0, y_left, self.frozen_column_view.viewport().width(), y_left) + p2.end() + except Exception: + pass + + # 2) Vertical line in frozen row view + if self.frozen_row_view.isVisible(): + try: + idx_top = model.index(0, self._current_col) + rect_top = self.frozen_row_view.visualRect(idx_top) + if rect_top.isValid(): + p3 = QPainter(self.frozen_row_view.viewport()) + pen3 = QPen(self._crosshair_color) + pen3.setWidth(self._crosshair_width) + p3.setPen(pen3) + x_top = rect_top.left() + p3.drawLine(x_top, 0, x_top, self.frozen_row_view.viewport().height()) + p3.end() + except Exception: + pass except Exception: pass # Initial sync of row height and all column widths From 86feea85bb540e319ad633e1053927d724dec94f Mon Sep 17 00:00:00 2001 From: Xcesius Date: Wed, 20 Aug 2025 13:43:49 +0200 Subject: [PATCH 05/10] feat(ui): track crosshair on hover across all panes\n\n- Mouse tracking + event filter on main and frozen viewports\n- Use hover pos for crosshair lines and header highlights\n- Fall back to selection when not hovering --- custom_widgets.py | 97 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 88 insertions(+), 9 deletions(-) diff --git a/custom_widgets.py b/custom_widgets.py index 532959e..4779ceb 100644 --- a/custom_widgets.py +++ b/custom_widgets.py @@ -1,7 +1,7 @@ from PyQt6.QtWidgets import (QTableView, QStyledItemDelegate, QMenu, QApplication, QHeaderView, QStyle, QAbstractItemView, QInputDialog, QMessageBox) from PyQt6.QtCore import (Qt, pyqtSignal, QItemSelection, QItemSelectionModel, - QTimer) + QTimer, QEvent) from PyQt6.QtGui import (QAction, QKeySequence, QStandardItemModel, QStandardItem, QPainter, QPen, QColor) @@ -152,6 +152,8 @@ def __init__(self, parent=None): self._crosshair_width = 1 self._current_row = -1 self._current_col = -1 + self._hover_row = -1 + self._hover_col = -1 # --- Frozen Column View Setup --- self.frozen_column_view = QTableView(self) @@ -211,6 +213,13 @@ def __init__(self, parent=None): # Will be fully connected when a model is set self._selection_conn_made = False + # Enable hover tracking across all viewports + try: + self.viewport().setMouseTracking(True) + self.viewport().installEventFilter(self) + except Exception: + pass + def setModel(self, model): super().setModel(model) if model: @@ -225,6 +234,17 @@ def setModel(self, model): self._selection_conn_made = True except Exception: pass + # Ensure hover tracking is set for frozen views + try: + self.frozen_column_view.viewport().setMouseTracking(True) + self.frozen_column_view.viewport().installEventFilter(self) + except Exception: + pass + try: + self.frozen_row_view.viewport().setMouseTracking(True) + self.frozen_row_view.viewport().installEventFilter(self) + except Exception: + pass def set_first_column_frozen(self, frozen: bool): if self.model() is None or self.model().columnCount() == 0: @@ -299,17 +319,19 @@ def _on_current_changed(self, current, previous): self._current_col = current.column() # Update header highlights try: + eff_col = self._hover_col if self._hover_col >= 0 else self._current_col + eff_row = self._hover_row if self._hover_row >= 0 else self._current_row if isinstance(self.horizontalHeader(), CustomHeaderView): - self.horizontalHeader().setHighlightedSection(self._current_col) + self.horizontalHeader().setHighlightedSection(eff_col) if isinstance(self.verticalHeader(), CustomHeaderView): - self.verticalHeader().setHighlightedSection(self._current_row) + self.verticalHeader().setHighlightedSection(eff_row) # Frozen mirrors h_frozen = self.frozen_column_view.horizontalHeader() if isinstance(h_frozen, CustomHeaderView): - h_frozen.setHighlightedSection(self._current_col) + h_frozen.setHighlightedSection(eff_col) h_frozen_row = self.frozen_row_view.horizontalHeader() if isinstance(h_frozen_row, CustomHeaderView): - h_frozen_row.setHighlightedSection(self._current_col) + h_frozen_row.setHighlightedSection(eff_col) except Exception: pass # Repaint overlays @@ -317,17 +339,74 @@ def _on_current_changed(self, current, previous): self.frozen_column_view.viewport().update() self.frozen_row_view.viewport().update() + def eventFilter(self, obj, event): + if event.type() == QEvent.Type.MouseMove and self._show_crosshair_guides: + try: + if obj is self.viewport(): + idx = self.indexAt(event.pos()) + elif obj is self.frozen_column_view.viewport(): + idx = self.frozen_column_view.indexAt(event.pos()) + elif obj is self.frozen_row_view.viewport(): + idx = self.frozen_row_view.indexAt(event.pos()) + else: + return super().eventFilter(obj, event) + + if idx and idx.isValid(): + # Determine effective hover row/col per source viewport + if obj is self.viewport(): + row = idx.row() + col = idx.column() + elif obj is self.frozen_column_view.viewport(): + row = idx.row() + # Column is first frozen column (0) + col = 0 + else: # frozen_row_view + # Row is first frozen row (0); take actual column + row = 0 + col = idx.column() + self._hover_row = row + self._hover_col = col + # Update headers to reflect hover + try: + if isinstance(self.horizontalHeader(), CustomHeaderView): + self.horizontalHeader().setHighlightedSection(self._hover_col) + if isinstance(self.verticalHeader(), CustomHeaderView): + self.verticalHeader().setHighlightedSection(self._hover_row) + hf = self.frozen_column_view.horizontalHeader() + if isinstance(hf, CustomHeaderView): + hf.setHighlightedSection(self._hover_col) + hfr = self.frozen_row_view.horizontalHeader() + if isinstance(hfr, CustomHeaderView): + hfr.setHighlightedSection(self._hover_col) + except Exception: + pass + # Repaint + self.viewport().update() + self.frozen_column_view.viewport().update() + self.frozen_row_view.viewport().update() + except Exception: + pass + elif event.type() == QEvent.Type.Leave: + # Clear hover; fall back to current selection + self._hover_row = -1 + self._hover_col = -1 + self._on_current_changed(self.currentIndex(), None) + return super().eventFilter(obj, event) + def paintEvent(self, event): super().paintEvent(event) if not self._show_crosshair_guides: return - if self.model() is None or self._current_row < 0 or self._current_col < 0: + # Determine effective row/col from hover if available, else current selection + eff_row = self._hover_row if self._hover_row >= 0 else self._current_row + eff_col = self._hover_col if self._hover_col >= 0 else self._current_col + if self.model() is None or eff_row < 0 or eff_col < 0: return # Draw crosshair lines aligned to the active cell try: model = self.model() # Main view overlay - idx = model.index(self._current_row, self._current_col) + idx = model.index(eff_row, eff_col) rect = self.visualRect(idx) if rect.isValid(): p = QPainter(self.viewport()) @@ -346,7 +425,7 @@ def paintEvent(self, event): # 1) Horizontal line in frozen column view if self.frozen_column_view.isVisible(): try: - idx_left = model.index(self._current_row, 0) + idx_left = model.index(eff_row, 0) rect_left = self.frozen_column_view.visualRect(idx_left) if rect_left.isValid(): p2 = QPainter(self.frozen_column_view.viewport()) @@ -362,7 +441,7 @@ def paintEvent(self, event): # 2) Vertical line in frozen row view if self.frozen_row_view.isVisible(): try: - idx_top = model.index(0, self._current_col) + idx_top = model.index(0, eff_col) rect_top = self.frozen_row_view.visualRect(idx_top) if rect_top.isValid(): p3 = QPainter(self.frozen_row_view.viewport()) From ee1cb1f1c28d112ae9799c3110829b84421c1794 Mon Sep 17 00:00:00 2001 From: Xcesius Date: Wed, 20 Aug 2025 13:47:00 +0200 Subject: [PATCH 06/10] feat(ui): make hover-driven crosshair optional and extend lines into headers\n\n- New setting crosshair_hover_enabled with Settings dialog checkbox\n- Respect setting in event filter; fall back to selection-only\n- Draw crosshair lines into horizontal/vertical headers and frozen top header --- config_manager.py | 1 + custom_widgets.py | 53 ++++++++++++++++++++++++++++++++++++++++++++++- ui.py | 10 +++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) diff --git a/config_manager.py b/config_manager.py index e06e03e..21d98d2 100644 --- a/config_manager.py +++ b/config_manager.py @@ -27,6 +27,7 @@ def _load_config_unlocked(self): # Crosshair guides configuration settings.setdefault("crosshair_enabled", True) settings.setdefault("crosshair_thickness", 1) + settings.setdefault("crosshair_hover_enabled", True) # Add the new setting for freezing the first row #settings.setdefault("freeze_first_row_enabled", False) config["settings"] = settings diff --git a/custom_widgets.py b/custom_widgets.py index 4779ceb..2ff3898 100644 --- a/custom_widgets.py +++ b/custom_widgets.py @@ -154,6 +154,7 @@ def __init__(self, parent=None): self._current_col = -1 self._hover_row = -1 self._hover_col = -1 + self._hover_enabled = True # --- Frozen Column View Setup --- self.frozen_column_view = QTableView(self) @@ -309,6 +310,18 @@ def setCrosshairWidth(self, width: int): self.frozen_column_view.viewport().update() self.frozen_row_view.viewport().update() + def setCrosshairHoverEnabled(self, enabled: bool): + self._hover_enabled = bool(enabled) + if not self._hover_enabled: + self._hover_row = -1 + self._hover_col = -1 + self._on_current_changed(self.currentIndex(), None) + else: + # Trigger a repaint to pick up the current hover if any + self.viewport().update() + self.frozen_column_view.viewport().update() + self.frozen_row_view.viewport().update() + # --- Crosshair core logic --- def _on_current_changed(self, current, previous): if not current or not current.isValid(): @@ -340,7 +353,7 @@ def _on_current_changed(self, current, previous): self.frozen_row_view.viewport().update() def eventFilter(self, obj, event): - if event.type() == QEvent.Type.MouseMove and self._show_crosshair_guides: + if event.type() == QEvent.Type.MouseMove and self._show_crosshair_guides and self._hover_enabled: try: if obj is self.viewport(): idx = self.indexAt(event.pos()) @@ -453,6 +466,44 @@ def paintEvent(self, event): p3.end() except Exception: pass + + # 3) Extend crosshair into headers + try: + # Horizontal header (column names) - draw vertical line at column + hh = self.horizontalHeader() + if hh and hh.isVisible(): + xh = hh.sectionViewportPosition(eff_col) + if xh >= 0: + ph = QPainter(hh.viewport()) + penh = QPen(self._crosshair_color) + penh.setWidth(self._crosshair_width) + ph.setPen(penh) + ph.drawLine(xh, 0, xh, hh.viewport().height()) + ph.end() + # Vertical header (row numbers) - draw horizontal line at row + vh = self.verticalHeader() + if vh and vh.isVisible(): + yv = vh.sectionViewportPosition(eff_row) + if yv >= 0: + pv = QPainter(vh.viewport()) + penv = QPen(self._crosshair_color) + penv.setWidth(self._crosshair_width) + pv.setPen(penv) + pv.drawLine(0, yv, vh.viewport().width(), yv) + pv.end() + # Frozen row view header (top header for all columns) - vertical line + fr_hh = self.frozen_row_view.horizontalHeader() + if fr_hh and fr_hh.isVisible(): + xfh = fr_hh.sectionViewportPosition(eff_col) + if xfh >= 0: + pfh = QPainter(fr_hh.viewport()) + penfh = QPen(self._crosshair_color) + penfh.setWidth(self._crosshair_width) + pfh.setPen(penfh) + pfh.drawLine(xfh, 0, xfh, fr_hh.viewport().height()) + pfh.end() + except Exception: + pass except Exception: pass # Initial sync of row height and all column widths diff --git a/ui.py b/ui.py index 64ef273..9825426 100644 --- a/ui.py +++ b/ui.py @@ -415,6 +415,10 @@ def __init__(self, parent=None): self.crosshair_enabled_checkbox.setChecked(self.config_manager.get_setting("crosshair_enabled", True)) layout.addWidget(self.crosshair_enabled_checkbox) + self.crosshair_hover_checkbox = QCheckBox("Crosshair follows mouse hover") + self.crosshair_hover_checkbox.setChecked(self.config_manager.get_setting("crosshair_hover_enabled", True)) + layout.addWidget(self.crosshair_hover_checkbox) + crosshair_row = QHBoxLayout() crosshair_row.addWidget(QLabel("Crosshair thickness (px):")) self.crosshair_thickness_input = QLineEdit(str(self.config_manager.get_setting("crosshair_thickness", 1))) @@ -446,6 +450,7 @@ def save_settings(self): self.config_manager.set_setting("debug_mode_enabled", self.debug_mode_checkbox.isChecked()) # Crosshair settings self.config_manager.set_setting("crosshair_enabled", self.crosshair_enabled_checkbox.isChecked()) + self.config_manager.set_setting("crosshair_hover_enabled", self.crosshair_hover_checkbox.isChecked()) try: thickness = int(self.crosshair_thickness_input.text()) except Exception: @@ -573,6 +578,11 @@ def apply_initial_settings(self): # Crosshair guides crosshair_enabled = self.config_manager.get_setting("crosshair_enabled", True) self.tableView.setCrosshairGuidesEnabled(bool(crosshair_enabled)) + crosshair_hover = self.config_manager.get_setting("crosshair_hover_enabled", True) + try: + self.tableView.setCrosshairHoverEnabled(bool(crosshair_hover)) + except Exception: + pass try: crosshair_width = int(self.config_manager.get_setting("crosshair_thickness", 1) or 1) except Exception: From de9aff6bb7e1343945001167035ed9d75bac8530 Mon Sep 17 00:00:00 2001 From: Xcesius Date: Wed, 20 Aug 2025 13:49:57 +0200 Subject: [PATCH 07/10] fix(ui): ensure crosshair renders in frozen panes using overlay views\n\n- Introduce OverlayTableView for frozen panes to paint crosshair after normal paint\n- Remove ad-hoc painting from main view; use callbacks for reliability --- custom_widgets.py | 99 +++++++++++++++++++++++++++++++---------------- 1 file changed, 65 insertions(+), 34 deletions(-) diff --git a/custom_widgets.py b/custom_widgets.py index 2ff3898..c8475c6 100644 --- a/custom_widgets.py +++ b/custom_widgets.py @@ -117,6 +117,27 @@ class ConfigManager: def get_setting(self, key, default): return default +class OverlayTableView(QTableView): + """Lightweight QTableView that allows drawing an overlay after normal paint. + Used for frozen panes so crosshair lines render reliably on top. + """ + def __init__(self, parent=None): + super().__init__(parent) + self._overlay_callback = None + + def setOverlayCallback(self, callback): + self._overlay_callback = callback + + def paintEvent(self, event): + super().paintEvent(event) + if callable(self._overlay_callback): + try: + painter = QPainter(self.viewport()) + self._overlay_callback(painter) + painter.end() + except Exception: + pass + class CleanTableView(QTableView): # --- Signals remain unchanged --- copy_requested = pyqtSignal() @@ -157,7 +178,7 @@ def __init__(self, parent=None): self._hover_enabled = True # --- Frozen Column View Setup --- - self.frozen_column_view = QTableView(self) + self.frozen_column_view = OverlayTableView(self) self.frozen_column_view.setItemDelegate(NoHoverDelegate()) self.frozen_column_view.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.frozen_column_view.verticalHeader().hide() # Hide vertical header; main view's suffices @@ -168,7 +189,7 @@ def __init__(self, parent=None): self.frozen_column_view.setVisible(False) # --- Frozen Row View Setup --- - self.frozen_row_view = QTableView(self) + self.frozen_row_view = OverlayTableView(self) self.frozen_row_view.setItemDelegate(NoHoverDelegate()) self.frozen_row_view.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.frozen_row_view.verticalHeader().hide() @@ -246,6 +267,47 @@ def setModel(self, model): self.frozen_row_view.viewport().installEventFilter(self) except Exception: pass + # Overlay callbacks to draw crosshair lines reliably on frozen panes + def draw_frozen_col_overlay(p: QPainter): + if not self._show_crosshair_guides: + return + eff_row = self._hover_row if self._hover_row >= 0 else self._current_row + if self.model() is None or eff_row < 0: + return + try: + idx_left = self.model().index(eff_row, 0) + rect_left = self.frozen_column_view.visualRect(idx_left) + if not rect_left.isValid(): + return + pen2 = QPen(self._crosshair_color) + pen2.setWidth(self._crosshair_width) + p.setPen(pen2) + y_left = rect_left.top() + p.drawLine(0, y_left, self.frozen_column_view.viewport().width(), y_left) + except Exception: + pass + + def draw_frozen_row_overlay(p: QPainter): + if not self._show_crosshair_guides: + return + eff_col = self._hover_col if self._hover_col >= 0 else self._current_col + if self.model() is None or eff_col < 0: + return + try: + idx_top = self.model().index(0, eff_col) + rect_top = self.frozen_row_view.visualRect(idx_top) + if not rect_top.isValid(): + return + pen3 = QPen(self._crosshair_color) + pen3.setWidth(self._crosshair_width) + p.setPen(pen3) + x_top = rect_top.left() + p.drawLine(x_top, 0, x_top, self.frozen_row_view.viewport().height()) + except Exception: + pass + + self.frozen_column_view.setOverlayCallback(draw_frozen_col_overlay) + self.frozen_row_view.setOverlayCallback(draw_frozen_row_overlay) def set_first_column_frozen(self, frozen: bool): if self.model() is None or self.model().columnCount() == 0: @@ -434,38 +496,7 @@ def paintEvent(self, event): p.drawLine(0, y, self.viewport().width(), y) p.end() - # Also draw into frozen views so lines span full table including frozen panes - # 1) Horizontal line in frozen column view - if self.frozen_column_view.isVisible(): - try: - idx_left = model.index(eff_row, 0) - rect_left = self.frozen_column_view.visualRect(idx_left) - if rect_left.isValid(): - p2 = QPainter(self.frozen_column_view.viewport()) - pen2 = QPen(self._crosshair_color) - pen2.setWidth(self._crosshair_width) - p2.setPen(pen2) - y_left = rect_left.top() - p2.drawLine(0, y_left, self.frozen_column_view.viewport().width(), y_left) - p2.end() - except Exception: - pass - - # 2) Vertical line in frozen row view - if self.frozen_row_view.isVisible(): - try: - idx_top = model.index(0, eff_col) - rect_top = self.frozen_row_view.visualRect(idx_top) - if rect_top.isValid(): - p3 = QPainter(self.frozen_row_view.viewport()) - pen3 = QPen(self._crosshair_color) - pen3.setWidth(self._crosshair_width) - p3.setPen(pen3) - x_top = rect_top.left() - p3.drawLine(x_top, 0, x_top, self.frozen_row_view.viewport().height()) - p3.end() - except Exception: - pass + # Frozen overlays are handled by OverlayTableView callbacks # 3) Extend crosshair into headers try: From 8c0da79d9af99894a0766f6af00a1675186d03dc Mon Sep 17 00:00:00 2001 From: Xcesius Date: Wed, 20 Aug 2025 13:52:31 +0200 Subject: [PATCH 08/10] fix(settings): use real ConfigManager in widgets so UI reads saved settings\n\n- Remove stub ConfigManager in custom_widgets; import from config_manager\n- Ensures header/selection behaviors respect saved config values --- custom_widgets.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/custom_widgets.py b/custom_widgets.py index c8475c6..d0a0afd 100644 --- a/custom_widgets.py +++ b/custom_widgets.py @@ -4,6 +4,7 @@ QTimer, QEvent) from PyQt6.QtGui import (QAction, QKeySequence, QStandardItemModel, QStandardItem, QPainter, QPen, QColor) +from config_manager import ConfigManager as AppConfigManager class CustomHeaderView(QHeaderView): rightClicked = pyqtSignal(int) @@ -113,10 +114,6 @@ def paint(self, painter, option, index): opt.state &= ~QStyle.StateFlag.State_MouseOver super().paint(painter, opt, index) -class ConfigManager: - def get_setting(self, key, default): - return default - class OverlayTableView(QTableView): """Lightweight QTableView that allows drawing an overlay after normal paint. Used for frozen panes so crosshair lines render reliably on top. @@ -162,7 +159,7 @@ class CleanTableView(QTableView): def __init__(self, parent=None): super().__init__(parent) - self.config_manager = ConfigManager() + self.config_manager = AppConfigManager() self.setItemDelegate(NoHoverDelegate()) # Improve edit UX: double-click or edit key starts edit, Enter commits self.setEditTriggers(QAbstractItemView.EditTrigger.DoubleClicked | QAbstractItemView.EditTrigger.EditKeyPressed) From 549e477bd9fe0730c49dbf45e3994d350e7b61b6 Mon Sep 17 00:00:00 2001 From: Xcesius Date: Wed, 20 Aug 2025 14:51:33 +0200 Subject: [PATCH 09/10] Add crosshair guides feature --- node_modules/.package-lock.json | 1225 +++ .../@modelcontextprotocol/sdk/LICENSE | 21 + .../@modelcontextprotocol/sdk/README.md | 1323 +++ .../sdk/node_modules/eventsource/LICENSE | 22 + .../sdk/node_modules/eventsource/README.md | 167 + .../sdk/node_modules/eventsource/package.json | 130 + .../eventsource/src/EventSource.ts | 596 ++ .../node_modules/eventsource/src/errors.ts | 141 + .../sdk/node_modules/eventsource/src/index.ts | 3 + .../sdk/node_modules/eventsource/src/types.ts | 152 + .../@modelcontextprotocol/sdk/package.json | 103 + node_modules/accepts/HISTORY.md | 250 + node_modules/accepts/LICENSE | 23 + node_modules/accepts/README.md | 140 + node_modules/accepts/index.js | 238 + node_modules/accepts/package.json | 47 + node_modules/ajv/.tonic_example.js | 20 + node_modules/ajv/LICENSE | 22 + node_modules/ajv/README.md | 1497 +++ node_modules/ajv/package.json | 106 + node_modules/ajv/scripts/.eslintrc.yml | 3 + node_modules/ajv/scripts/bundle.js | 61 + node_modules/ajv/scripts/compile-dots.js | 73 + node_modules/ajv/scripts/info | 10 + node_modules/ajv/scripts/prepare-tests | 12 + .../ajv/scripts/publish-built-version | 32 + node_modules/ajv/scripts/travis-gh-pages | 23 + node_modules/ansi-regex/index.d.ts | 33 + node_modules/ansi-regex/index.js | 14 + node_modules/ansi-regex/license | 9 + node_modules/ansi-regex/package.json | 61 + node_modules/ansi-regex/readme.md | 66 + node_modules/ansi-styles/index.d.ts | 236 + node_modules/ansi-styles/index.js | 223 + node_modules/ansi-styles/license | 9 + node_modules/ansi-styles/package.json | 54 + node_modules/ansi-styles/readme.md | 173 + node_modules/body-parser/HISTORY.md | 731 ++ node_modules/body-parser/LICENSE | 23 + node_modules/body-parser/README.md | 491 + node_modules/body-parser/index.js | 80 + node_modules/body-parser/package.json | 49 + node_modules/bytes/History.md | 97 + node_modules/bytes/LICENSE | 23 + node_modules/bytes/Readme.md | 152 + node_modules/bytes/index.js | 170 + node_modules/bytes/package.json | 42 + .../call-bind-apply-helpers/.eslintrc | 17 + .../.github/FUNDING.yml | 12 + node_modules/call-bind-apply-helpers/.nycrc | 9 + .../call-bind-apply-helpers/CHANGELOG.md | 30 + node_modules/call-bind-apply-helpers/LICENSE | 21 + .../call-bind-apply-helpers/README.md | 62 + .../call-bind-apply-helpers/actualApply.d.ts | 1 + .../call-bind-apply-helpers/actualApply.js | 10 + .../call-bind-apply-helpers/applyBind.d.ts | 19 + .../call-bind-apply-helpers/applyBind.js | 10 + .../functionApply.d.ts | 1 + .../call-bind-apply-helpers/functionApply.js | 4 + .../call-bind-apply-helpers/functionCall.d.ts | 1 + .../call-bind-apply-helpers/functionCall.js | 4 + .../call-bind-apply-helpers/index.d.ts | 64 + node_modules/call-bind-apply-helpers/index.js | 15 + .../call-bind-apply-helpers/package.json | 85 + .../call-bind-apply-helpers/reflectApply.d.ts | 3 + .../call-bind-apply-helpers/reflectApply.js | 4 + .../call-bind-apply-helpers/test/index.js | 63 + .../call-bind-apply-helpers/tsconfig.json | 9 + node_modules/call-bound/.eslintrc | 13 + node_modules/call-bound/.github/FUNDING.yml | 12 + node_modules/call-bound/.nycrc | 9 + node_modules/call-bound/CHANGELOG.md | 42 + node_modules/call-bound/LICENSE | 21 + node_modules/call-bound/README.md | 53 + node_modules/call-bound/index.d.ts | 94 + node_modules/call-bound/index.js | 19 + node_modules/call-bound/package.json | 99 + node_modules/call-bound/test/index.js | 61 + node_modules/call-bound/tsconfig.json | 10 + node_modules/cliui/CHANGELOG.md | 157 + node_modules/cliui/LICENSE.txt | 14 + node_modules/cliui/README.md | 161 + node_modules/cliui/index.mjs | 15 + node_modules/cliui/package.json | 72 + node_modules/content-disposition/HISTORY.md | 66 + node_modules/content-disposition/LICENSE | 22 + node_modules/content-disposition/README.md | 142 + node_modules/content-disposition/index.js | 459 + node_modules/content-disposition/package.json | 44 + node_modules/content-type/HISTORY.md | 29 + node_modules/content-type/LICENSE | 22 + node_modules/content-type/README.md | 94 + node_modules/content-type/index.js | 225 + node_modules/content-type/package.json | 42 + node_modules/cookie-signature/History.md | 70 + node_modules/cookie-signature/LICENSE | 22 + node_modules/cookie-signature/Readme.md | 23 + node_modules/cookie-signature/index.js | 47 + node_modules/cookie-signature/package.json | 24 + node_modules/cookie/LICENSE | 24 + node_modules/cookie/README.md | 317 + node_modules/cookie/SECURITY.md | 25 + node_modules/cookie/index.js | 335 + node_modules/cookie/package.json | 44 + node_modules/cors/CONTRIBUTING.md | 33 + node_modules/cors/HISTORY.md | 58 + node_modules/cors/LICENSE | 22 + node_modules/cors/README.md | 243 + node_modules/cors/package.json | 41 + node_modules/cross-spawn/LICENSE | 21 + node_modules/cross-spawn/README.md | 89 + node_modules/cross-spawn/index.js | 39 + node_modules/cross-spawn/package.json | 73 + node_modules/debug/LICENSE | 20 + node_modules/debug/README.md | 481 + node_modules/debug/package.json | 64 + node_modules/debug/src/browser.js | 272 + node_modules/debug/src/common.js | 292 + node_modules/debug/src/index.js | 10 + node_modules/debug/src/node.js | 263 + node_modules/depd/History.md | 103 + node_modules/depd/LICENSE | 22 + node_modules/depd/Readme.md | 280 + node_modules/depd/index.js | 538 + node_modules/depd/package.json | 45 + node_modules/dunder-proto/.eslintrc | 5 + node_modules/dunder-proto/.github/FUNDING.yml | 12 + node_modules/dunder-proto/.nycrc | 13 + node_modules/dunder-proto/CHANGELOG.md | 24 + node_modules/dunder-proto/LICENSE | 21 + node_modules/dunder-proto/README.md | 54 + node_modules/dunder-proto/get.d.ts | 5 + node_modules/dunder-proto/get.js | 30 + node_modules/dunder-proto/package.json | 76 + node_modules/dunder-proto/set.d.ts | 5 + node_modules/dunder-proto/set.js | 35 + node_modules/dunder-proto/test/get.js | 34 + node_modules/dunder-proto/test/index.js | 4 + node_modules/dunder-proto/test/set.js | 50 + node_modules/dunder-proto/tsconfig.json | 9 + node_modules/ee-first/LICENSE | 22 + node_modules/ee-first/README.md | 80 + node_modules/ee-first/index.js | 95 + node_modules/ee-first/package.json | 29 + node_modules/emoji-regex/LICENSE-MIT.txt | 20 + node_modules/emoji-regex/README.md | 107 + node_modules/emoji-regex/index.d.ts | 3 + node_modules/emoji-regex/index.js | 4 + node_modules/emoji-regex/index.mjs | 4 + node_modules/emoji-regex/package.json | 45 + node_modules/encodeurl/LICENSE | 22 + node_modules/encodeurl/README.md | 109 + node_modules/encodeurl/index.js | 60 + node_modules/encodeurl/package.json | 40 + node_modules/es-define-property/.eslintrc | 13 + .../es-define-property/.github/FUNDING.yml | 12 + node_modules/es-define-property/.nycrc | 9 + node_modules/es-define-property/CHANGELOG.md | 29 + node_modules/es-define-property/LICENSE | 21 + node_modules/es-define-property/README.md | 49 + node_modules/es-define-property/index.d.ts | 3 + node_modules/es-define-property/index.js | 14 + node_modules/es-define-property/package.json | 81 + node_modules/es-define-property/test/index.js | 56 + node_modules/es-define-property/tsconfig.json | 10 + node_modules/es-errors/.eslintrc | 5 + node_modules/es-errors/.github/FUNDING.yml | 12 + node_modules/es-errors/CHANGELOG.md | 40 + node_modules/es-errors/LICENSE | 21 + node_modules/es-errors/README.md | 55 + node_modules/es-errors/eval.d.ts | 3 + node_modules/es-errors/eval.js | 4 + node_modules/es-errors/index.d.ts | 3 + node_modules/es-errors/index.js | 4 + node_modules/es-errors/package.json | 80 + node_modules/es-errors/range.d.ts | 3 + node_modules/es-errors/range.js | 4 + node_modules/es-errors/ref.d.ts | 3 + node_modules/es-errors/ref.js | 4 + node_modules/es-errors/syntax.d.ts | 3 + node_modules/es-errors/syntax.js | 4 + node_modules/es-errors/test/index.js | 19 + node_modules/es-errors/tsconfig.json | 49 + node_modules/es-errors/type.d.ts | 3 + node_modules/es-errors/type.js | 4 + node_modules/es-errors/uri.d.ts | 3 + node_modules/es-errors/uri.js | 4 + node_modules/es-object-atoms/.eslintrc | 16 + .../es-object-atoms/.github/FUNDING.yml | 12 + node_modules/es-object-atoms/CHANGELOG.md | 37 + node_modules/es-object-atoms/LICENSE | 21 + node_modules/es-object-atoms/README.md | 63 + .../RequireObjectCoercible.d.ts | 3 + .../es-object-atoms/RequireObjectCoercible.js | 11 + node_modules/es-object-atoms/ToObject.d.ts | 7 + node_modules/es-object-atoms/ToObject.js | 10 + node_modules/es-object-atoms/index.d.ts | 3 + node_modules/es-object-atoms/index.js | 4 + node_modules/es-object-atoms/isObject.d.ts | 3 + node_modules/es-object-atoms/isObject.js | 6 + node_modules/es-object-atoms/package.json | 80 + node_modules/es-object-atoms/test/index.js | 38 + node_modules/es-object-atoms/tsconfig.json | 6 + node_modules/escalade/index.d.mts | 11 + node_modules/escalade/index.d.ts | 15 + node_modules/escalade/license | 9 + node_modules/escalade/package.json | 74 + node_modules/escalade/readme.md | 211 + node_modules/escalade/sync/index.d.mts | 9 + node_modules/escalade/sync/index.d.ts | 13 + node_modules/escalade/sync/index.js | 18 + node_modules/escalade/sync/index.mjs | 18 + node_modules/escape-html/LICENSE | 24 + node_modules/escape-html/Readme.md | 43 + node_modules/escape-html/index.js | 78 + node_modules/escape-html/package.json | 24 + node_modules/etag/HISTORY.md | 83 + node_modules/etag/LICENSE | 22 + node_modules/etag/README.md | 159 + node_modules/etag/index.js | 131 + node_modules/etag/package.json | 47 + node_modules/eventsource-parser/LICENSE | 21 + node_modules/eventsource-parser/README.md | 126 + node_modules/eventsource-parser/package.json | 115 + node_modules/eventsource-parser/src/errors.ts | 44 + node_modules/eventsource-parser/src/index.ts | 3 + node_modules/eventsource-parser/src/parse.ts | 232 + node_modules/eventsource-parser/src/stream.ts | 88 + node_modules/eventsource-parser/src/types.ts | 97 + node_modules/eventsource-parser/stream.js | 2 + node_modules/eventsource/LICENSE | 22 + node_modules/eventsource/README.md | 167 + node_modules/eventsource/package.json | 130 + node_modules/eventsource/src/EventSource.ts | 596 ++ node_modules/eventsource/src/errors.ts | 141 + node_modules/eventsource/src/index.ts | 3 + node_modules/eventsource/src/types.ts | 145 + node_modules/express-rate-limit/license.md | 20 + node_modules/express-rate-limit/package.json | 133 + node_modules/express-rate-limit/readme.md | 147 + node_modules/express-rate-limit/tsconfig.json | 8 + node_modules/express/History.md | 3858 +++++++ node_modules/express/LICENSE | 24 + node_modules/express/Readme.md | 266 + node_modules/express/index.js | 11 + node_modules/express/package.json | 98 + node_modules/fast-deep-equal/LICENSE | 21 + node_modules/fast-deep-equal/README.md | 96 + node_modules/fast-deep-equal/es6/index.d.ts | 2 + node_modules/fast-deep-equal/es6/index.js | 72 + node_modules/fast-deep-equal/es6/react.d.ts | 2 + node_modules/fast-deep-equal/es6/react.js | 79 + node_modules/fast-deep-equal/index.d.ts | 4 + node_modules/fast-deep-equal/index.js | 46 + node_modules/fast-deep-equal/package.json | 61 + node_modules/fast-deep-equal/react.d.ts | 2 + node_modules/fast-deep-equal/react.js | 53 + .../fast-json-stable-stringify/.eslintrc.yml | 26 + .../.github/FUNDING.yml | 1 + .../fast-json-stable-stringify/.travis.yml | 8 + .../fast-json-stable-stringify/LICENSE | 21 + .../fast-json-stable-stringify/README.md | 131 + .../benchmark/index.js | 31 + .../benchmark/test.json | 137 + .../example/key_cmp.js | 7 + .../example/nested.js | 3 + .../fast-json-stable-stringify/example/str.js | 3 + .../example/value_cmp.js | 7 + .../fast-json-stable-stringify/index.d.ts | 4 + .../fast-json-stable-stringify/index.js | 59 + .../fast-json-stable-stringify/package.json | 52 + .../fast-json-stable-stringify/test/cmp.js | 13 + .../fast-json-stable-stringify/test/nested.js | 44 + .../fast-json-stable-stringify/test/str.js | 46 + .../test/to-json.js | 22 + node_modules/finalhandler/HISTORY.md | 233 + node_modules/finalhandler/LICENSE | 22 + node_modules/finalhandler/README.md | 147 + node_modules/finalhandler/index.js | 293 + node_modules/finalhandler/package.json | 43 + node_modules/forwarded/HISTORY.md | 21 + node_modules/forwarded/LICENSE | 22 + node_modules/forwarded/README.md | 57 + node_modules/forwarded/index.js | 90 + node_modules/forwarded/package.json | 45 + node_modules/fresh/HISTORY.md | 80 + node_modules/fresh/LICENSE | 23 + node_modules/fresh/README.md | 117 + node_modules/fresh/index.js | 136 + node_modules/fresh/package.json | 46 + node_modules/function-bind/.eslintrc | 21 + .../function-bind/.github/FUNDING.yml | 12 + .../function-bind/.github/SECURITY.md | 3 + node_modules/function-bind/.nycrc | 13 + node_modules/function-bind/CHANGELOG.md | 136 + node_modules/function-bind/LICENSE | 20 + node_modules/function-bind/README.md | 46 + node_modules/function-bind/implementation.js | 84 + node_modules/function-bind/index.js | 5 + node_modules/function-bind/package.json | 87 + node_modules/function-bind/test/.eslintrc | 9 + node_modules/function-bind/test/index.js | 252 + node_modules/get-caller-file/LICENSE.md | 6 + node_modules/get-caller-file/README.md | 41 + node_modules/get-caller-file/index.d.ts | 2 + node_modules/get-caller-file/index.js | 22 + node_modules/get-caller-file/index.js.map | 1 + node_modules/get-caller-file/package.json | 42 + node_modules/get-east-asian-width/index.d.ts | 60 + node_modules/get-east-asian-width/index.js | 31 + node_modules/get-east-asian-width/license | 9 + node_modules/get-east-asian-width/lookup.js | 403 + .../get-east-asian-width/package.json | 70 + node_modules/get-east-asian-width/readme.md | 65 + node_modules/get-intrinsic/.eslintrc | 42 + .../get-intrinsic/.github/FUNDING.yml | 12 + node_modules/get-intrinsic/.nycrc | 9 + node_modules/get-intrinsic/CHANGELOG.md | 186 + node_modules/get-intrinsic/LICENSE | 21 + node_modules/get-intrinsic/README.md | 71 + node_modules/get-intrinsic/index.js | 378 + node_modules/get-intrinsic/package.json | 97 + .../get-intrinsic/test/GetIntrinsic.js | 274 + node_modules/get-proto/.eslintrc | 10 + node_modules/get-proto/.github/FUNDING.yml | 12 + node_modules/get-proto/.nycrc | 9 + node_modules/get-proto/CHANGELOG.md | 21 + node_modules/get-proto/LICENSE | 21 + .../get-proto/Object.getPrototypeOf.d.ts | 5 + .../get-proto/Object.getPrototypeOf.js | 6 + node_modules/get-proto/README.md | 50 + .../get-proto/Reflect.getPrototypeOf.d.ts | 3 + .../get-proto/Reflect.getPrototypeOf.js | 4 + node_modules/get-proto/index.d.ts | 5 + node_modules/get-proto/index.js | 27 + node_modules/get-proto/package.json | 81 + node_modules/get-proto/test/index.js | 68 + node_modules/get-proto/tsconfig.json | 9 + node_modules/gopd/.eslintrc | 16 + node_modules/gopd/.github/FUNDING.yml | 12 + node_modules/gopd/CHANGELOG.md | 45 + node_modules/gopd/LICENSE | 21 + node_modules/gopd/README.md | 40 + node_modules/gopd/gOPD.d.ts | 1 + node_modules/gopd/gOPD.js | 4 + node_modules/gopd/index.d.ts | 5 + node_modules/gopd/index.js | 15 + node_modules/gopd/package.json | 77 + node_modules/gopd/test/index.js | 36 + node_modules/gopd/tsconfig.json | 9 + node_modules/has-symbols/.eslintrc | 11 + node_modules/has-symbols/.github/FUNDING.yml | 12 + node_modules/has-symbols/.nycrc | 9 + node_modules/has-symbols/CHANGELOG.md | 91 + node_modules/has-symbols/LICENSE | 21 + node_modules/has-symbols/README.md | 46 + node_modules/has-symbols/index.d.ts | 3 + node_modules/has-symbols/index.js | 14 + node_modules/has-symbols/package.json | 111 + node_modules/has-symbols/shams.d.ts | 3 + node_modules/has-symbols/shams.js | 45 + node_modules/has-symbols/test/index.js | 22 + .../has-symbols/test/shams/core-js.js | 29 + .../test/shams/get-own-property-symbols.js | 29 + node_modules/has-symbols/test/tests.js | 58 + node_modules/has-symbols/tsconfig.json | 10 + node_modules/hasown/.eslintrc | 5 + node_modules/hasown/.github/FUNDING.yml | 12 + node_modules/hasown/.nycrc | 13 + node_modules/hasown/CHANGELOG.md | 40 + node_modules/hasown/LICENSE | 21 + node_modules/hasown/README.md | 40 + node_modules/hasown/index.d.ts | 3 + node_modules/hasown/index.js | 8 + node_modules/hasown/package.json | 92 + node_modules/hasown/tsconfig.json | 6 + node_modules/http-errors/HISTORY.md | 180 + node_modules/http-errors/LICENSE | 23 + node_modules/http-errors/README.md | 169 + node_modules/http-errors/index.js | 289 + .../node_modules/statuses/HISTORY.md | 82 + .../http-errors/node_modules/statuses/LICENSE | 23 + .../node_modules/statuses/README.md | 136 + .../node_modules/statuses/codes.json | 65 + .../node_modules/statuses/index.js | 146 + .../node_modules/statuses/package.json | 49 + node_modules/http-errors/package.json | 50 + .../iconv-lite/.github/dependabot.yml | 11 + node_modules/iconv-lite/Changelog.md | 212 + node_modules/iconv-lite/LICENSE | 21 + node_modules/iconv-lite/README.md | 130 + .../iconv-lite/encodings/dbcs-codec.js | 597 ++ .../iconv-lite/encodings/dbcs-data.js | 188 + node_modules/iconv-lite/encodings/index.js | 23 + node_modules/iconv-lite/encodings/internal.js | 198 + .../iconv-lite/encodings/sbcs-codec.js | 72 + .../encodings/sbcs-data-generated.js | 451 + .../iconv-lite/encodings/sbcs-data.js | 179 + .../encodings/tables/big5-added.json | 122 + .../iconv-lite/encodings/tables/cp936.json | 264 + .../iconv-lite/encodings/tables/cp949.json | 273 + .../iconv-lite/encodings/tables/cp950.json | 177 + .../iconv-lite/encodings/tables/eucjp.json | 182 + .../encodings/tables/gb18030-ranges.json | 1 + .../encodings/tables/gbk-added.json | 56 + .../iconv-lite/encodings/tables/shiftjis.json | 125 + node_modules/iconv-lite/encodings/utf16.js | 197 + node_modules/iconv-lite/encodings/utf32.js | 319 + node_modules/iconv-lite/encodings/utf7.js | 290 + node_modules/iconv-lite/package.json | 44 + node_modules/inherits/LICENSE | 16 + node_modules/inherits/README.md | 42 + node_modules/inherits/inherits.js | 9 + node_modules/inherits/inherits_browser.js | 27 + node_modules/inherits/package.json | 29 + node_modules/ipaddr.js/LICENSE | 19 + node_modules/ipaddr.js/README.md | 233 + node_modules/ipaddr.js/ipaddr.min.js | 1 + node_modules/ipaddr.js/package.json | 35 + node_modules/is-promise/LICENSE | 19 + node_modules/is-promise/index.d.ts | 2 + node_modules/is-promise/index.js | 6 + node_modules/is-promise/index.mjs | 3 + node_modules/is-promise/package.json | 30 + node_modules/is-promise/readme.md | 33 + node_modules/isexe/.npmignore | 2 + node_modules/isexe/LICENSE | 15 + node_modules/isexe/README.md | 51 + node_modules/isexe/index.js | 57 + node_modules/isexe/mode.js | 41 + node_modules/isexe/package.json | 31 + node_modules/isexe/test/basic.js | 221 + node_modules/isexe/windows.js | 42 + .../json-schema-traverse/.eslintrc.yml | 27 + node_modules/json-schema-traverse/.travis.yml | 8 + node_modules/json-schema-traverse/LICENSE | 21 + node_modules/json-schema-traverse/README.md | 83 + node_modules/json-schema-traverse/index.js | 89 + .../json-schema-traverse/package.json | 43 + .../json-schema-traverse/spec/.eslintrc.yml | 6 + .../spec/fixtures/schema.js | 125 + .../json-schema-traverse/spec/index.spec.js | 171 + node_modules/math-intrinsics/.eslintrc | 16 + .../math-intrinsics/.github/FUNDING.yml | 12 + node_modules/math-intrinsics/CHANGELOG.md | 24 + node_modules/math-intrinsics/LICENSE | 21 + node_modules/math-intrinsics/README.md | 50 + node_modules/math-intrinsics/abs.d.ts | 1 + node_modules/math-intrinsics/abs.js | 4 + .../constants/maxArrayLength.d.ts | 3 + .../constants/maxArrayLength.js | 4 + .../constants/maxSafeInteger.d.ts | 3 + .../constants/maxSafeInteger.js | 5 + .../math-intrinsics/constants/maxValue.d.ts | 3 + .../math-intrinsics/constants/maxValue.js | 5 + node_modules/math-intrinsics/floor.d.ts | 1 + node_modules/math-intrinsics/floor.js | 4 + node_modules/math-intrinsics/isFinite.d.ts | 3 + node_modules/math-intrinsics/isFinite.js | 12 + node_modules/math-intrinsics/isInteger.d.ts | 3 + node_modules/math-intrinsics/isInteger.js | 16 + node_modules/math-intrinsics/isNaN.d.ts | 1 + node_modules/math-intrinsics/isNaN.js | 6 + .../math-intrinsics/isNegativeZero.d.ts | 3 + .../math-intrinsics/isNegativeZero.js | 6 + node_modules/math-intrinsics/max.d.ts | 1 + node_modules/math-intrinsics/max.js | 4 + node_modules/math-intrinsics/min.d.ts | 1 + node_modules/math-intrinsics/min.js | 4 + node_modules/math-intrinsics/mod.d.ts | 3 + node_modules/math-intrinsics/mod.js | 9 + node_modules/math-intrinsics/package.json | 86 + node_modules/math-intrinsics/pow.d.ts | 1 + node_modules/math-intrinsics/pow.js | 4 + node_modules/math-intrinsics/round.d.ts | 1 + node_modules/math-intrinsics/round.js | 4 + node_modules/math-intrinsics/sign.d.ts | 3 + node_modules/math-intrinsics/sign.js | 11 + node_modules/math-intrinsics/test/index.js | 192 + node_modules/math-intrinsics/tsconfig.json | 3 + .../mcp-proxy/.github/workflows/feature.yaml | 37 + .../mcp-proxy/.github/workflows/main.yaml | 48 + node_modules/mcp-proxy/LICENSE | 24 + node_modules/mcp-proxy/README.md | 175 + node_modules/mcp-proxy/eslint.config.ts | 20 + node_modules/mcp-proxy/jsr.json | 7 + node_modules/mcp-proxy/package.json | 80 + .../mcp-proxy/src/InMemoryEventStore.test.ts | 160 + .../mcp-proxy/src/InMemoryEventStore.ts | 96 + .../mcp-proxy/src/JSONFilterTransform.test.ts | 106 + .../mcp-proxy/src/JSONFilterTransform.ts | 59 + .../mcp-proxy/src/StdioClientTransport.ts | 260 + node_modules/mcp-proxy/src/bin/mcp-proxy.ts | 229 + .../src/fixtures/simple-stdio-proxy-server.ts | 3 + .../src/fixtures/simple-stdio-server.ts | 72 + node_modules/mcp-proxy/src/index.ts | 5 + node_modules/mcp-proxy/src/proxyServer.ts | 100 + .../mcp-proxy/src/startHTTPServer.test.ts | 329 + node_modules/mcp-proxy/src/startHTTPServer.ts | 593 ++ .../mcp-proxy/src/startStdioServer.test.ts | 229 + .../mcp-proxy/src/startStdioServer.ts | 82 + node_modules/mcp-proxy/src/tapTransport.ts | 90 + node_modules/mcp-proxy/tsconfig.json | 8 + node_modules/media-typer/HISTORY.md | 50 + node_modules/media-typer/LICENSE | 22 + node_modules/media-typer/README.md | 93 + node_modules/media-typer/index.js | 143 + node_modules/media-typer/package.json | 33 + node_modules/merge-descriptors/index.d.ts | 11 + node_modules/merge-descriptors/index.js | 26 + node_modules/merge-descriptors/license | 11 + node_modules/merge-descriptors/package.json | 50 + node_modules/merge-descriptors/readme.md | 55 + node_modules/mime-db/HISTORY.md | 541 + node_modules/mime-db/LICENSE | 23 + node_modules/mime-db/README.md | 109 + node_modules/mime-db/db.json | 9342 +++++++++++++++++ node_modules/mime-db/index.js | 12 + node_modules/mime-db/package.json | 56 + node_modules/mime-types/HISTORY.md | 421 + node_modules/mime-types/LICENSE | 23 + node_modules/mime-types/README.md | 126 + node_modules/mime-types/index.js | 211 + node_modules/mime-types/mimeScore.js | 52 + node_modules/mime-types/package.json | 45 + node_modules/ms/index.js | 162 + node_modules/ms/license.md | 21 + node_modules/ms/package.json | 38 + node_modules/ms/readme.md | 59 + node_modules/negotiator/HISTORY.md | 114 + node_modules/negotiator/LICENSE | 24 + node_modules/negotiator/README.md | 212 + node_modules/negotiator/index.js | 83 + node_modules/negotiator/package.json | 43 + node_modules/object-assign/index.js | 90 + node_modules/object-assign/license | 21 + node_modules/object-assign/package.json | 42 + node_modules/object-assign/readme.md | 61 + node_modules/object-inspect/.eslintrc | 53 + .../object-inspect/.github/FUNDING.yml | 12 + node_modules/object-inspect/.nycrc | 13 + node_modules/object-inspect/CHANGELOG.md | 424 + node_modules/object-inspect/LICENSE | 21 + node_modules/object-inspect/example/all.js | 23 + .../object-inspect/example/circular.js | 6 + node_modules/object-inspect/example/fn.js | 5 + .../object-inspect/example/inspect.js | 10 + node_modules/object-inspect/index.js | 544 + .../object-inspect/package-support.json | 20 + node_modules/object-inspect/package.json | 105 + node_modules/object-inspect/readme.markdown | 84 + node_modules/object-inspect/test-core-js.js | 26 + node_modules/object-inspect/test/bigint.js | 58 + .../object-inspect/test/browser/dom.js | 15 + node_modules/object-inspect/test/circular.js | 16 + node_modules/object-inspect/test/deep.js | 12 + node_modules/object-inspect/test/element.js | 53 + node_modules/object-inspect/test/err.js | 48 + node_modules/object-inspect/test/fakes.js | 29 + node_modules/object-inspect/test/fn.js | 76 + node_modules/object-inspect/test/global.js | 17 + node_modules/object-inspect/test/has.js | 15 + node_modules/object-inspect/test/holes.js | 15 + .../object-inspect/test/indent-option.js | 271 + node_modules/object-inspect/test/inspect.js | 139 + node_modules/object-inspect/test/lowbyte.js | 12 + node_modules/object-inspect/test/number.js | 58 + .../object-inspect/test/quoteStyle.js | 26 + .../object-inspect/test/toStringTag.js | 40 + node_modules/object-inspect/test/undef.js | 12 + node_modules/object-inspect/test/values.js | 261 + node_modules/object-inspect/util.inspect.js | 1 + node_modules/on-finished/HISTORY.md | 98 + node_modules/on-finished/LICENSE | 23 + node_modules/on-finished/README.md | 162 + node_modules/on-finished/index.js | 234 + node_modules/on-finished/package.json | 39 + node_modules/once/LICENSE | 15 + node_modules/once/README.md | 79 + node_modules/once/once.js | 42 + node_modules/once/package.json | 33 + node_modules/parseurl/HISTORY.md | 58 + node_modules/parseurl/LICENSE | 24 + node_modules/parseurl/README.md | 133 + node_modules/parseurl/index.js | 158 + node_modules/parseurl/package.json | 40 + node_modules/path-key/index.d.ts | 40 + node_modules/path-key/index.js | 16 + node_modules/path-key/license | 9 + node_modules/path-key/package.json | 39 + node_modules/path-key/readme.md | 61 + node_modules/path-to-regexp/LICENSE | 21 + node_modules/path-to-regexp/Readme.md | 216 + node_modules/path-to-regexp/package.json | 62 + node_modules/pkce-challenge/LICENSE | 21 + node_modules/pkce-challenge/README.md | 55 + node_modules/pkce-challenge/package.json | 58 + node_modules/proxy-addr/HISTORY.md | 161 + node_modules/proxy-addr/LICENSE | 22 + node_modules/proxy-addr/README.md | 139 + node_modules/proxy-addr/index.js | 327 + node_modules/proxy-addr/package.json | 47 + node_modules/punycode/LICENSE-MIT.txt | 20 + node_modules/punycode/README.md | 148 + node_modules/punycode/package.json | 58 + node_modules/punycode/punycode.es6.js | 444 + node_modules/punycode/punycode.js | 443 + node_modules/qs/.editorconfig | 46 + node_modules/qs/.eslintrc | 39 + node_modules/qs/.github/FUNDING.yml | 12 + node_modules/qs/.nycrc | 13 + node_modules/qs/CHANGELOG.md | 622 ++ node_modules/qs/LICENSE.md | 29 + node_modules/qs/README.md | 733 ++ node_modules/qs/package.json | 93 + node_modules/qs/test/empty-keys-cases.js | 267 + node_modules/qs/test/parse.js | 1276 +++ node_modules/qs/test/stringify.js | 1306 +++ node_modules/qs/test/utils.js | 262 + node_modules/range-parser/HISTORY.md | 56 + node_modules/range-parser/LICENSE | 23 + node_modules/range-parser/README.md | 84 + node_modules/range-parser/index.js | 162 + node_modules/range-parser/package.json | 44 + node_modules/raw-body/HISTORY.md | 325 + node_modules/raw-body/LICENSE | 22 + node_modules/raw-body/README.md | 223 + node_modules/raw-body/SECURITY.md | 24 + node_modules/raw-body/index.d.ts | 85 + node_modules/raw-body/index.js | 336 + node_modules/raw-body/package.json | 50 + node_modules/router/HISTORY.md | 228 + node_modules/router/LICENSE | 23 + node_modules/router/README.md | 416 + node_modules/router/index.js | 748 ++ node_modules/router/package.json | 44 + node_modules/safe-buffer/LICENSE | 21 + node_modules/safe-buffer/README.md | 584 ++ node_modules/safe-buffer/index.d.ts | 187 + node_modules/safe-buffer/index.js | 65 + node_modules/safe-buffer/package.json | 51 + node_modules/safer-buffer/LICENSE | 21 + node_modules/safer-buffer/Porting-Buffer.md | 268 + node_modules/safer-buffer/Readme.md | 156 + node_modules/safer-buffer/dangerous.js | 58 + node_modules/safer-buffer/package.json | 34 + node_modules/safer-buffer/safer.js | 77 + node_modules/safer-buffer/tests.js | 406 + node_modules/send/HISTORY.md | 580 + node_modules/send/LICENSE | 23 + node_modules/send/README.md | 317 + node_modules/send/index.js | 997 ++ node_modules/send/package.json | 60 + node_modules/serve-static/HISTORY.md | 516 + node_modules/serve-static/LICENSE | 25 + node_modules/serve-static/README.md | 253 + node_modules/serve-static/index.js | 208 + node_modules/serve-static/package.json | 41 + node_modules/setprototypeof/LICENSE | 13 + node_modules/setprototypeof/README.md | 31 + node_modules/setprototypeof/index.d.ts | 2 + node_modules/setprototypeof/index.js | 17 + node_modules/setprototypeof/package.json | 38 + node_modules/setprototypeof/test/index.js | 24 + node_modules/shebang-command/index.js | 19 + node_modules/shebang-command/license | 9 + node_modules/shebang-command/package.json | 34 + node_modules/shebang-command/readme.md | 34 + node_modules/shebang-regex/index.d.ts | 22 + node_modules/shebang-regex/index.js | 2 + node_modules/shebang-regex/license | 9 + node_modules/shebang-regex/package.json | 35 + node_modules/shebang-regex/readme.md | 33 + node_modules/side-channel-list/.editorconfig | 9 + node_modules/side-channel-list/.eslintrc | 11 + .../side-channel-list/.github/FUNDING.yml | 12 + node_modules/side-channel-list/.nycrc | 13 + node_modules/side-channel-list/CHANGELOG.md | 15 + node_modules/side-channel-list/LICENSE | 21 + node_modules/side-channel-list/README.md | 62 + node_modules/side-channel-list/index.d.ts | 13 + node_modules/side-channel-list/index.js | 113 + node_modules/side-channel-list/list.d.ts | 14 + node_modules/side-channel-list/package.json | 77 + node_modules/side-channel-list/test/index.js | 104 + node_modules/side-channel-list/tsconfig.json | 9 + node_modules/side-channel-map/.editorconfig | 9 + node_modules/side-channel-map/.eslintrc | 11 + .../side-channel-map/.github/FUNDING.yml | 12 + node_modules/side-channel-map/.nycrc | 13 + node_modules/side-channel-map/CHANGELOG.md | 22 + node_modules/side-channel-map/LICENSE | 21 + node_modules/side-channel-map/README.md | 62 + node_modules/side-channel-map/index.d.ts | 15 + node_modules/side-channel-map/index.js | 68 + node_modules/side-channel-map/package.json | 80 + node_modules/side-channel-map/test/index.js | 114 + node_modules/side-channel-map/tsconfig.json | 9 + .../side-channel-weakmap/.editorconfig | 9 + node_modules/side-channel-weakmap/.eslintrc | 12 + .../side-channel-weakmap/.github/FUNDING.yml | 12 + node_modules/side-channel-weakmap/.nycrc | 13 + .../side-channel-weakmap/CHANGELOG.md | 28 + node_modules/side-channel-weakmap/LICENSE | 21 + node_modules/side-channel-weakmap/README.md | 62 + node_modules/side-channel-weakmap/index.d.ts | 15 + node_modules/side-channel-weakmap/index.js | 84 + .../side-channel-weakmap/package.json | 87 + .../side-channel-weakmap/test/index.js | 114 + .../side-channel-weakmap/tsconfig.json | 9 + node_modules/side-channel/.editorconfig | 9 + node_modules/side-channel/.eslintrc | 12 + node_modules/side-channel/.github/FUNDING.yml | 12 + node_modules/side-channel/.nycrc | 13 + node_modules/side-channel/CHANGELOG.md | 110 + node_modules/side-channel/LICENSE | 21 + node_modules/side-channel/README.md | 61 + node_modules/side-channel/index.d.ts | 14 + node_modules/side-channel/index.js | 43 + node_modules/side-channel/package.json | 85 + node_modules/side-channel/test/index.js | 104 + node_modules/side-channel/tsconfig.json | 9 + node_modules/statuses/HISTORY.md | 87 + node_modules/statuses/LICENSE | 23 + node_modules/statuses/README.md | 139 + node_modules/statuses/codes.json | 65 + node_modules/statuses/index.js | 146 + node_modules/statuses/package.json | 49 + node_modules/string-width/index.d.ts | 39 + node_modules/string-width/index.js | 82 + node_modules/string-width/license | 9 + node_modules/string-width/package.json | 64 + node_modules/string-width/readme.md | 66 + node_modules/strip-ansi/index.d.ts | 15 + node_modules/strip-ansi/index.js | 14 + node_modules/strip-ansi/license | 9 + node_modules/strip-ansi/package.json | 57 + node_modules/strip-ansi/readme.md | 41 + node_modules/toidentifier/HISTORY.md | 9 + node_modules/toidentifier/LICENSE | 21 + node_modules/toidentifier/README.md | 61 + node_modules/toidentifier/index.js | 32 + node_modules/toidentifier/package.json | 38 + node_modules/type-is/HISTORY.md | 292 + node_modules/type-is/LICENSE | 23 + node_modules/type-is/README.md | 198 + node_modules/type-is/index.js | 250 + node_modules/type-is/package.json | 47 + node_modules/unpipe/HISTORY.md | 4 + node_modules/unpipe/LICENSE | 22 + node_modules/unpipe/README.md | 43 + node_modules/unpipe/index.js | 69 + node_modules/unpipe/package.json | 27 + node_modules/uri-js/LICENSE | 11 + node_modules/uri-js/README.md | 203 + node_modules/uri-js/package.json | 77 + node_modules/uri-js/yarn.lock | 2558 +++++ node_modules/vary/HISTORY.md | 39 + node_modules/vary/LICENSE | 22 + node_modules/vary/README.md | 101 + node_modules/vary/index.js | 149 + node_modules/vary/package.json | 43 + node_modules/which/CHANGELOG.md | 166 + node_modules/which/LICENSE | 15 + node_modules/which/README.md | 54 + node_modules/which/bin/node-which | 52 + node_modules/which/package.json | 43 + node_modules/which/which.js | 125 + node_modules/wrap-ansi/index.d.ts | 41 + node_modules/wrap-ansi/index.js | 222 + node_modules/wrap-ansi/license | 9 + node_modules/wrap-ansi/package.json | 69 + node_modules/wrap-ansi/readme.md | 75 + node_modules/wrappy/LICENSE | 15 + node_modules/wrappy/README.md | 36 + node_modules/wrappy/package.json | 29 + node_modules/wrappy/wrappy.js | 33 + node_modules/y18n/CHANGELOG.md | 100 + node_modules/y18n/LICENSE | 13 + node_modules/y18n/README.md | 127 + node_modules/y18n/index.mjs | 8 + node_modules/y18n/package.json | 70 + node_modules/yargs-parser/CHANGELOG.md | 319 + node_modules/yargs-parser/LICENSE.txt | 14 + node_modules/yargs-parser/README.md | 518 + node_modules/yargs-parser/browser.js | 29 + node_modules/yargs-parser/package.json | 78 + node_modules/yargs/LICENSE | 21 + node_modules/yargs/README.md | 182 + node_modules/yargs/browser.d.ts | 5 + node_modules/yargs/browser.mjs | 7 + node_modules/yargs/helpers/helpers.mjs | 10 + node_modules/yargs/helpers/package.json | 3 + node_modules/yargs/index.mjs | 10 + node_modules/yargs/locales/be.json | 46 + node_modules/yargs/locales/cs.json | 51 + node_modules/yargs/locales/de.json | 46 + node_modules/yargs/locales/en.json | 55 + node_modules/yargs/locales/es.json | 46 + node_modules/yargs/locales/fi.json | 49 + node_modules/yargs/locales/fr.json | 53 + node_modules/yargs/locales/he.json | 55 + node_modules/yargs/locales/hi.json | 49 + node_modules/yargs/locales/hu.json | 46 + node_modules/yargs/locales/id.json | 50 + node_modules/yargs/locales/it.json | 46 + node_modules/yargs/locales/ja.json | 51 + node_modules/yargs/locales/ko.json | 49 + node_modules/yargs/locales/nb.json | 44 + node_modules/yargs/locales/nl.json | 49 + node_modules/yargs/locales/nn.json | 44 + node_modules/yargs/locales/pirate.json | 13 + node_modules/yargs/locales/pl.json | 49 + node_modules/yargs/locales/pt.json | 45 + node_modules/yargs/locales/pt_BR.json | 48 + node_modules/yargs/locales/ru.json | 51 + node_modules/yargs/locales/th.json | 46 + node_modules/yargs/locales/tr.json | 48 + node_modules/yargs/locales/uk_UA.json | 51 + node_modules/yargs/locales/uz.json | 52 + node_modules/yargs/locales/zh_CN.json | 48 + node_modules/yargs/locales/zh_TW.json | 51 + node_modules/yargs/package.json | 103 + .../.github/CR_logotype-full-color.png | Bin 0 -> 11047 bytes .../zod-to-json-schema/.github/FUNDING.yml | 1 + .../zod-to-json-schema/.prettierrc.json | 1 + node_modules/zod-to-json-schema/LICENSE | 15 + node_modules/zod-to-json-schema/README.md | 399 + node_modules/zod-to-json-schema/SECURITY.md | 12 + node_modules/zod-to-json-schema/changelog.md | 80 + .../zod-to-json-schema/contributing.md | 9 + .../zod-to-json-schema/createIndex.ts | 32 + node_modules/zod-to-json-schema/package.json | 79 + node_modules/zod-to-json-schema/postcjs.ts | 3 + node_modules/zod-to-json-schema/postesm.ts | 3 + node_modules/zod/LICENSE | 21 + node_modules/zod/README.md | 208 + node_modules/zod/index.cjs | 33 + node_modules/zod/index.d.cts | 4 + node_modules/zod/index.d.ts | 4 + node_modules/zod/index.js | 4 + node_modules/zod/package.json | 118 + node_modules/zod/src/index.ts | 4 + node_modules/zod/src/v3/ZodError.ts | 330 + .../zod/src/v3/benchmarks/datetime.ts | 58 + .../src/v3/benchmarks/discriminatedUnion.ts | 80 + node_modules/zod/src/v3/benchmarks/index.ts | 59 + node_modules/zod/src/v3/benchmarks/ipv4.ts | 57 + node_modules/zod/src/v3/benchmarks/object.ts | 69 + .../zod/src/v3/benchmarks/primitives.ts | 162 + .../zod/src/v3/benchmarks/realworld.ts | 63 + node_modules/zod/src/v3/benchmarks/string.ts | 55 + node_modules/zod/src/v3/benchmarks/union.ts | 80 + node_modules/zod/src/v3/errors.ts | 13 + node_modules/zod/src/v3/external.ts | 6 + node_modules/zod/src/v3/helpers/enumUtil.ts | 17 + node_modules/zod/src/v3/helpers/errorUtil.ts | 8 + node_modules/zod/src/v3/helpers/parseUtil.ts | 176 + .../zod/src/v3/helpers/partialUtil.ts | 34 + .../zod/src/v3/helpers/typeAliases.ts | 2 + node_modules/zod/src/v3/helpers/util.ts | 224 + node_modules/zod/src/v3/index.ts | 4 + node_modules/zod/src/v3/locales/en.ts | 124 + node_modules/zod/src/v3/standard-schema.ts | 113 + node_modules/zod/src/v3/tests/Mocker.ts | 54 + .../zod/src/v3/tests/all-errors.test.ts | 157 + .../zod/src/v3/tests/anyunknown.test.ts | 28 + node_modules/zod/src/v3/tests/array.test.ts | 71 + .../zod/src/v3/tests/async-parsing.test.ts | 388 + .../src/v3/tests/async-refinements.test.ts | 46 + node_modules/zod/src/v3/tests/base.test.ts | 29 + node_modules/zod/src/v3/tests/bigint.test.ts | 55 + node_modules/zod/src/v3/tests/branded.test.ts | 53 + node_modules/zod/src/v3/tests/catch.test.ts | 220 + node_modules/zod/src/v3/tests/coerce.test.ts | 133 + node_modules/zod/src/v3/tests/complex.test.ts | 56 + node_modules/zod/src/v3/tests/custom.test.ts | 31 + node_modules/zod/src/v3/tests/date.test.ts | 32 + .../zod/src/v3/tests/deepmasking.test.ts | 186 + node_modules/zod/src/v3/tests/default.test.ts | 112 + .../zod/src/v3/tests/description.test.ts | 33 + .../src/v3/tests/discriminated-unions.test.ts | 315 + node_modules/zod/src/v3/tests/enum.test.ts | 80 + node_modules/zod/src/v3/tests/error.test.ts | 551 + .../zod/src/v3/tests/firstparty.test.ts | 87 + .../v3/tests/firstpartyschematypes.test.ts | 21 + .../zod/src/v3/tests/function.test.ts | 257 + .../zod/src/v3/tests/generics.test.ts | 48 + .../zod/src/v3/tests/instanceof.test.ts | 37 + .../zod/src/v3/tests/intersection.test.ts | 110 + .../src/v3/tests/language-server.source.ts | 76 + .../zod/src/v3/tests/language-server.test.ts | 207 + node_modules/zod/src/v3/tests/literal.test.ts | 36 + node_modules/zod/src/v3/tests/map.test.ts | 110 + node_modules/zod/src/v3/tests/masking.test.ts | 4 + node_modules/zod/src/v3/tests/mocker.test.ts | 19 + node_modules/zod/src/v3/tests/nan.test.ts | 21 + .../zod/src/v3/tests/nativeEnum.test.ts | 87 + .../zod/src/v3/tests/nullable.test.ts | 42 + node_modules/zod/src/v3/tests/number.test.ts | 176 + .../src/v3/tests/object-augmentation.test.ts | 29 + .../src/v3/tests/object-in-es5-env.test.ts | 29 + node_modules/zod/src/v3/tests/object.test.ts | 434 + .../zod/src/v3/tests/optional.test.ts | 42 + .../zod/src/v3/tests/parseUtil.test.ts | 23 + node_modules/zod/src/v3/tests/parser.test.ts | 41 + .../zod/src/v3/tests/partials.test.ts | 243 + .../zod/src/v3/tests/pickomit.test.ts | 111 + .../zod/src/v3/tests/pipeline.test.ts | 29 + .../zod/src/v3/tests/preprocess.test.ts | 186 + .../zod/src/v3/tests/primitive.test.ts | 440 + node_modules/zod/src/v3/tests/promise.test.ts | 90 + .../zod/src/v3/tests/readonly.test.ts | 194 + node_modules/zod/src/v3/tests/record.test.ts | 171 + .../zod/src/v3/tests/recursive.test.ts | 197 + node_modules/zod/src/v3/tests/refine.test.ts | 313 + .../zod/src/v3/tests/safeparse.test.ts | 27 + node_modules/zod/src/v3/tests/set.test.ts | 142 + .../zod/src/v3/tests/standard-schema.test.ts | 83 + node_modules/zod/src/v3/tests/string.test.ts | 916 ++ .../zod/src/v3/tests/transformer.test.ts | 233 + node_modules/zod/src/v3/tests/tuple.test.ts | 90 + node_modules/zod/src/v3/tests/unions.test.ts | 57 + .../zod/src/v3/tests/validations.test.ts | 133 + node_modules/zod/src/v3/tests/void.test.ts | 15 + node_modules/zod/src/v3/types.ts | 5136 +++++++++ node_modules/zod/src/v4-mini/index.ts | 1 + node_modules/zod/src/v4/classic/checks.ts | 30 + node_modules/zod/src/v4/classic/coerce.ts | 27 + node_modules/zod/src/v4/classic/compat.ts | 66 + node_modules/zod/src/v4/classic/errors.ts | 75 + node_modules/zod/src/v4/classic/external.ts | 50 + node_modules/zod/src/v4/classic/index.ts | 5 + node_modules/zod/src/v4/classic/iso.ts | 90 + node_modules/zod/src/v4/classic/parse.ts | 33 + node_modules/zod/src/v4/classic/schemas.ts | 2054 ++++ .../src/v4/classic/tests/anyunknown.test.ts | 26 + .../zod/src/v4/classic/tests/array.test.ts | 264 + .../v4/classic/tests/assignability.test.ts | 210 + .../v4/classic/tests/async-parsing.test.ts | 381 + .../classic/tests/async-refinements.test.ts | 68 + .../zod/src/v4/classic/tests/base.test.ts | 7 + .../zod/src/v4/classic/tests/bigint.test.ts | 54 + .../zod/src/v4/classic/tests/brand.test.ts | 63 + .../zod/src/v4/classic/tests/catch.test.ts | 252 + .../zod/src/v4/classic/tests/coalesce.test.ts | 20 + .../zod/src/v4/classic/tests/coerce.test.ts | 160 + .../v4/classic/tests/continuability.test.ts | 352 + .../zod/src/v4/classic/tests/custom.test.ts | 40 + .../zod/src/v4/classic/tests/date.test.ts | 31 + .../zod/src/v4/classic/tests/datetime.test.ts | 296 + .../zod/src/v4/classic/tests/default.test.ts | 313 + .../src/v4/classic/tests/description.test.ts | 32 + .../tests/discriminated-unions.test.ts | 619 ++ .../zod/src/v4/classic/tests/enum.test.ts | 285 + .../src/v4/classic/tests/error-utils.test.ts | 527 + .../zod/src/v4/classic/tests/error.test.ts | 711 ++ .../zod/src/v4/classic/tests/file.test.ts | 91 + .../src/v4/classic/tests/firstparty.test.ts | 175 + .../zod/src/v4/classic/tests/function.test.ts | 268 + .../zod/src/v4/classic/tests/generics.test.ts | 72 + .../zod/src/v4/classic/tests/index.test.ts | 829 ++ .../src/v4/classic/tests/instanceof.test.ts | 34 + .../src/v4/classic/tests/intersection.test.ts | 171 + .../zod/src/v4/classic/tests/json.test.ts | 108 + .../zod/src/v4/classic/tests/lazy.test.ts | 227 + .../zod/src/v4/classic/tests/literal.test.ts | 92 + .../zod/src/v4/classic/tests/map.test.ts | 196 + .../zod/src/v4/classic/tests/nan.test.ts | 21 + .../v4/classic/tests/nested-refine.test.ts | 168 + .../src/v4/classic/tests/nonoptional.test.ts | 86 + .../zod/src/v4/classic/tests/nullable.test.ts | 22 + .../zod/src/v4/classic/tests/number.test.ts | 247 + .../zod/src/v4/classic/tests/object.test.ts | 563 + .../zod/src/v4/classic/tests/optional.test.ts | 123 + .../zod/src/v4/classic/tests/partial.test.ts | 147 + .../zod/src/v4/classic/tests/pickomit.test.ts | 127 + .../zod/src/v4/classic/tests/pipe.test.ts | 81 + .../zod/src/v4/classic/tests/prefault.test.ts | 37 + .../src/v4/classic/tests/preprocess.test.ts | 298 + .../src/v4/classic/tests/primitive.test.ts | 175 + .../zod/src/v4/classic/tests/promise.test.ts | 81 + .../src/v4/classic/tests/prototypes.test.ts | 23 + .../zod/src/v4/classic/tests/readonly.test.ts | 252 + .../zod/src/v4/classic/tests/record.test.ts | 342 + .../v4/classic/tests/recursive-types.test.ts | 356 + .../zod/src/v4/classic/tests/refine.test.ts | 532 + .../src/v4/classic/tests/registries.test.ts | 204 + .../zod/src/v4/classic/tests/set.test.ts | 179 + .../v4/classic/tests/standard-schema.test.ts | 57 + .../v4/classic/tests/string-formats.test.ts | 109 + .../zod/src/v4/classic/tests/string.test.ts | 881 ++ .../src/v4/classic/tests/stringbool.test.ts | 66 + .../v4/classic/tests/template-literal.test.ts | 758 ++ .../v4/classic/tests/to-json-schema.test.ts | 2314 ++++ .../src/v4/classic/tests/transform.test.ts | 250 + .../zod/src/v4/classic/tests/tuple.test.ts | 163 + .../zod/src/v4/classic/tests/union.test.ts | 94 + .../src/v4/classic/tests/validations.test.ts | 283 + .../zod/src/v4/classic/tests/void.test.ts | 12 + node_modules/zod/src/v4/core/api.ts | 1594 +++ node_modules/zod/src/v4/core/checks.ts | 1283 +++ node_modules/zod/src/v4/core/config.ts | 15 + node_modules/zod/src/v4/core/core.ts | 134 + node_modules/zod/src/v4/core/doc.ts | 44 + node_modules/zod/src/v4/core/errors.ts | 424 + node_modules/zod/src/v4/core/function.ts | 176 + node_modules/zod/src/v4/core/index.ts | 15 + node_modules/zod/src/v4/core/json-schema.ts | 143 + node_modules/zod/src/v4/core/parse.ts | 94 + node_modules/zod/src/v4/core/regexes.ts | 135 + node_modules/zod/src/v4/core/registries.ts | 96 + node_modules/zod/src/v4/core/schemas.ts | 3842 +++++++ .../zod/src/v4/core/standard-schema.ts | 64 + .../zod/src/v4/core/tests/index.test.ts | 46 + .../zod/src/v4/core/tests/locales/be.test.ts | 124 + .../zod/src/v4/core/tests/locales/en.test.ts | 22 + .../zod/src/v4/core/tests/locales/ru.test.ts | 128 + .../zod/src/v4/core/tests/locales/tr.test.ts | 69 + .../zod/src/v4/core/to-json-schema.ts | 977 ++ node_modules/zod/src/v4/core/util.ts | 775 ++ node_modules/zod/src/v4/core/versions.ts | 5 + node_modules/zod/src/v4/core/zsf.ts | 323 + node_modules/zod/src/v4/index.ts | 4 + node_modules/zod/src/v4/locales/ar.ts | 125 + node_modules/zod/src/v4/locales/az.ts | 121 + node_modules/zod/src/v4/locales/be.ts | 184 + node_modules/zod/src/v4/locales/ca.ts | 127 + node_modules/zod/src/v4/locales/cs.ts | 142 + node_modules/zod/src/v4/locales/de.ts | 124 + node_modules/zod/src/v4/locales/en.ts | 127 + node_modules/zod/src/v4/locales/eo.ts | 125 + node_modules/zod/src/v4/locales/es.ts | 125 + node_modules/zod/src/v4/locales/fa.ts | 134 + node_modules/zod/src/v4/locales/fi.ts | 131 + node_modules/zod/src/v4/locales/fr-CA.ts | 126 + node_modules/zod/src/v4/locales/fr.ts | 124 + node_modules/zod/src/v4/locales/he.ts | 125 + node_modules/zod/src/v4/locales/hu.ts | 126 + node_modules/zod/src/v4/locales/id.ts | 125 + node_modules/zod/src/v4/locales/index.ts | 39 + node_modules/zod/src/v4/locales/it.ts | 125 + node_modules/zod/src/v4/locales/ja.ts | 122 + node_modules/zod/src/v4/locales/kh.ts | 126 + node_modules/zod/src/v4/locales/ko.ts | 131 + node_modules/zod/src/v4/locales/mk.ts | 127 + node_modules/zod/src/v4/locales/ms.ts | 124 + node_modules/zod/src/v4/locales/nl.ts | 126 + node_modules/zod/src/v4/locales/no.ts | 124 + node_modules/zod/src/v4/locales/ota.ts | 125 + node_modules/zod/src/v4/locales/pl.ts | 126 + node_modules/zod/src/v4/locales/ps.ts | 133 + node_modules/zod/src/v4/locales/pt.ts | 123 + node_modules/zod/src/v4/locales/ru.ts | 184 + node_modules/zod/src/v4/locales/sl.ts | 126 + node_modules/zod/src/v4/locales/sv.ts | 127 + node_modules/zod/src/v4/locales/ta.ts | 125 + node_modules/zod/src/v4/locales/th.ts | 126 + node_modules/zod/src/v4/locales/tr.ts | 121 + node_modules/zod/src/v4/locales/ua.ts | 126 + node_modules/zod/src/v4/locales/ur.ts | 126 + node_modules/zod/src/v4/locales/vi.ts | 125 + node_modules/zod/src/v4/locales/zh-CN.ts | 123 + node_modules/zod/src/v4/locales/zh-TW.ts | 125 + node_modules/zod/src/v4/mini/checks.ts | 32 + node_modules/zod/src/v4/mini/coerce.ts | 22 + node_modules/zod/src/v4/mini/external.ts | 40 + node_modules/zod/src/v4/mini/index.ts | 3 + node_modules/zod/src/v4/mini/iso.ts | 62 + node_modules/zod/src/v4/mini/parse.ts | 1 + node_modules/zod/src/v4/mini/schemas.ts | 1579 +++ .../src/v4/mini/tests/assignability.test.ts | 129 + .../zod/src/v4/mini/tests/brand.test.ts | 51 + .../zod/src/v4/mini/tests/checks.test.ts | 144 + .../zod/src/v4/mini/tests/computed.test.ts | 36 + .../zod/src/v4/mini/tests/error.test.ts | 22 + .../zod/src/v4/mini/tests/functions.test.ts | 43 + .../zod/src/v4/mini/tests/index.test.ts | 871 ++ .../zod/src/v4/mini/tests/number.test.ts | 95 + .../zod/src/v4/mini/tests/object.test.ts | 185 + .../zod/src/v4/mini/tests/prototypes.test.ts | 43 + .../src/v4/mini/tests/recursive-types.test.ts | 275 + .../zod/src/v4/mini/tests/string.test.ts | 299 + node_modules/zod/v3/ZodError.cjs | 138 + node_modules/zod/v3/ZodError.d.cts | 164 + node_modules/zod/v3/ZodError.d.ts | 164 + node_modules/zod/v3/ZodError.js | 133 + node_modules/zod/v3/errors.cjs | 17 + node_modules/zod/v3/errors.d.cts | 5 + node_modules/zod/v3/errors.d.ts | 5 + node_modules/zod/v3/errors.js | 9 + node_modules/zod/v3/external.cjs | 22 + node_modules/zod/v3/external.d.cts | 6 + node_modules/zod/v3/external.d.ts | 6 + node_modules/zod/v3/external.js | 6 + node_modules/zod/v3/helpers/enumUtil.cjs | 2 + node_modules/zod/v3/helpers/enumUtil.d.cts | 8 + node_modules/zod/v3/helpers/enumUtil.d.ts | 8 + node_modules/zod/v3/helpers/enumUtil.js | 1 + node_modules/zod/v3/helpers/errorUtil.cjs | 9 + node_modules/zod/v3/helpers/errorUtil.d.cts | 9 + node_modules/zod/v3/helpers/errorUtil.d.ts | 9 + node_modules/zod/v3/helpers/errorUtil.js | 6 + node_modules/zod/v3/helpers/parseUtil.cjs | 124 + node_modules/zod/v3/helpers/parseUtil.d.cts | 78 + node_modules/zod/v3/helpers/parseUtil.d.ts | 78 + node_modules/zod/v3/helpers/parseUtil.js | 109 + node_modules/zod/v3/helpers/partialUtil.cjs | 2 + node_modules/zod/v3/helpers/partialUtil.d.cts | 8 + node_modules/zod/v3/helpers/partialUtil.d.ts | 8 + node_modules/zod/v3/helpers/partialUtil.js | 1 + node_modules/zod/v3/helpers/typeAliases.cjs | 2 + node_modules/zod/v3/helpers/typeAliases.d.cts | 2 + node_modules/zod/v3/helpers/typeAliases.d.ts | 2 + node_modules/zod/v3/helpers/typeAliases.js | 1 + node_modules/zod/v3/helpers/util.cjs | 137 + node_modules/zod/v3/helpers/util.d.cts | 85 + node_modules/zod/v3/helpers/util.d.ts | 85 + node_modules/zod/v3/helpers/util.js | 133 + node_modules/zod/v3/index.cjs | 33 + node_modules/zod/v3/index.d.cts | 4 + node_modules/zod/v3/index.d.ts | 4 + node_modules/zod/v3/index.js | 4 + node_modules/zod/v3/locales/en.cjs | 111 + node_modules/zod/v3/locales/en.d.cts | 3 + node_modules/zod/v3/locales/en.d.ts | 3 + node_modules/zod/v3/locales/en.js | 109 + node_modules/zod/v3/standard-schema.cjs | 2 + node_modules/zod/v3/standard-schema.d.cts | 102 + node_modules/zod/v3/standard-schema.d.ts | 102 + node_modules/zod/v3/standard-schema.js | 1 + node_modules/zod/v3/types.cjs | 3775 +++++++ node_modules/zod/v3/types.d.cts | 1031 ++ node_modules/zod/v3/types.d.ts | 1031 ++ node_modules/zod/v3/types.js | 3693 +++++++ node_modules/zod/v4-mini/index.cjs | 17 + node_modules/zod/v4-mini/index.d.cts | 1 + node_modules/zod/v4-mini/index.d.ts | 1 + node_modules/zod/v4-mini/index.js | 1 + node_modules/zod/v4/classic/checks.cjs | 32 + node_modules/zod/v4/classic/checks.d.cts | 1 + node_modules/zod/v4/classic/checks.d.ts | 1 + node_modules/zod/v4/classic/checks.js | 1 + node_modules/zod/v4/classic/coerce.cjs | 47 + node_modules/zod/v4/classic/coerce.d.cts | 17 + node_modules/zod/v4/classic/coerce.d.ts | 17 + node_modules/zod/v4/classic/coerce.js | 17 + node_modules/zod/v4/classic/compat.cjs | 57 + node_modules/zod/v4/classic/compat.d.cts | 46 + node_modules/zod/v4/classic/compat.d.ts | 46 + node_modules/zod/v4/classic/compat.js | 27 + node_modules/zod/v4/classic/errors.cjs | 67 + node_modules/zod/v4/classic/errors.d.cts | 30 + node_modules/zod/v4/classic/errors.d.ts | 30 + node_modules/zod/v4/classic/errors.js | 41 + node_modules/zod/v4/classic/external.cjs | 70 + node_modules/zod/v4/classic/external.d.cts | 13 + node_modules/zod/v4/classic/external.d.ts | 13 + node_modules/zod/v4/classic/external.js | 18 + node_modules/zod/v4/classic/index.cjs | 33 + node_modules/zod/v4/classic/index.d.cts | 4 + node_modules/zod/v4/classic/index.d.ts | 4 + node_modules/zod/v4/classic/index.js | 4 + node_modules/zod/v4/classic/iso.cjs | 60 + node_modules/zod/v4/classic/iso.d.cts | 22 + node_modules/zod/v4/classic/iso.d.ts | 22 + node_modules/zod/v4/classic/iso.js | 30 + node_modules/zod/v4/classic/parse.cjs | 32 + node_modules/zod/v4/classic/parse.d.cts | 23 + node_modules/zod/v4/classic/parse.d.ts | 23 + node_modules/zod/v4/classic/parse.js | 6 + node_modules/zod/v4/classic/schemas.cjs | 1109 ++ node_modules/zod/v4/classic/schemas.d.cts | 630 ++ node_modules/zod/v4/classic/schemas.d.ts | 630 ++ node_modules/zod/v4/classic/schemas.js | 1006 ++ node_modules/zod/v4/core/api.cjs | 1039 ++ node_modules/zod/v4/core/api.d.cts | 284 + node_modules/zod/v4/core/api.d.ts | 284 + node_modules/zod/v4/core/api.js | 906 ++ node_modules/zod/v4/core/checks.cjs | 591 ++ node_modules/zod/v4/core/checks.d.cts | 278 + node_modules/zod/v4/core/checks.d.ts | 278 + node_modules/zod/v4/core/checks.js | 565 + node_modules/zod/v4/core/core.cjs | 67 + node_modules/zod/v4/core/core.d.cts | 49 + node_modules/zod/v4/core/core.d.ts | 49 + node_modules/zod/v4/core/core.js | 61 + node_modules/zod/v4/core/doc.cjs | 39 + node_modules/zod/v4/core/doc.d.cts | 14 + node_modules/zod/v4/core/doc.d.ts | 14 + node_modules/zod/v4/core/doc.js | 35 + node_modules/zod/v4/core/errors.cjs | 226 + node_modules/zod/v4/core/errors.d.cts | 208 + node_modules/zod/v4/core/errors.d.ts | 208 + node_modules/zod/v4/core/errors.js | 195 + node_modules/zod/v4/core/function.cjs | 102 + node_modules/zod/v4/core/function.d.cts | 52 + node_modules/zod/v4/core/function.d.ts | 52 + node_modules/zod/v4/core/function.js | 75 + node_modules/zod/v4/core/index.cjs | 44 + node_modules/zod/v4/core/index.d.cts | 15 + node_modules/zod/v4/core/index.d.ts | 15 + node_modules/zod/v4/core/index.js | 15 + node_modules/zod/v4/core/json-schema.cjs | 2 + node_modules/zod/v4/core/json-schema.d.cts | 87 + node_modules/zod/v4/core/json-schema.d.ts | 87 + node_modules/zod/v4/core/json-schema.js | 1 + node_modules/zod/v4/core/parse.cjs | 87 + node_modules/zod/v4/core/parse.d.cts | 25 + node_modules/zod/v4/core/parse.d.ts | 25 + node_modules/zod/v4/core/parse.js | 57 + node_modules/zod/v4/core/regexes.cjs | 103 + node_modules/zod/v4/core/regexes.d.cts | 62 + node_modules/zod/v4/core/regexes.d.ts | 62 + node_modules/zod/v4/core/regexes.js | 95 + node_modules/zod/v4/core/registries.cjs | 56 + node_modules/zod/v4/core/registries.d.cts | 35 + node_modules/zod/v4/core/registries.d.ts | 35 + node_modules/zod/v4/core/registries.js | 51 + node_modules/zod/v4/core/schemas.cjs | 1748 +++ node_modules/zod/v4/core/schemas.d.cts | 1041 ++ node_modules/zod/v4/core/schemas.d.ts | 1041 ++ node_modules/zod/v4/core/schemas.js | 1717 +++ node_modules/zod/v4/core/standard-schema.cjs | 2 + .../zod/v4/core/standard-schema.d.cts | 55 + node_modules/zod/v4/core/standard-schema.d.ts | 55 + node_modules/zod/v4/core/standard-schema.js | 1 + node_modules/zod/v4/core/to-json-schema.cjs | 854 ++ node_modules/zod/v4/core/to-json-schema.d.cts | 88 + node_modules/zod/v4/core/to-json-schema.d.ts | 88 + node_modules/zod/v4/core/to-json-schema.js | 849 ++ node_modules/zod/v4/core/util.cjs | 539 + node_modules/zod/v4/core/util.d.cts | 183 + node_modules/zod/v4/core/util.d.ts | 183 + node_modules/zod/v4/core/util.js | 493 + node_modules/zod/v4/core/versions.cjs | 8 + node_modules/zod/v4/core/versions.d.cts | 5 + node_modules/zod/v4/core/versions.d.ts | 5 + node_modules/zod/v4/core/versions.js | 5 + node_modules/zod/v4/index.cjs | 22 + node_modules/zod/v4/index.d.cts | 3 + node_modules/zod/v4/index.d.ts | 3 + node_modules/zod/v4/index.js | 3 + node_modules/zod/v4/locales/ar.cjs | 142 + node_modules/zod/v4/locales/ar.d.cts | 4 + node_modules/zod/v4/locales/ar.d.ts | 4 + node_modules/zod/v4/locales/ar.js | 116 + node_modules/zod/v4/locales/az.cjs | 141 + node_modules/zod/v4/locales/az.d.cts | 4 + node_modules/zod/v4/locales/az.d.ts | 4 + node_modules/zod/v4/locales/az.js | 115 + node_modules/zod/v4/locales/be.cjs | 190 + node_modules/zod/v4/locales/be.d.cts | 4 + node_modules/zod/v4/locales/be.d.ts | 4 + node_modules/zod/v4/locales/be.js | 164 + node_modules/zod/v4/locales/ca.cjs | 144 + node_modules/zod/v4/locales/ca.d.cts | 4 + node_modules/zod/v4/locales/ca.d.ts | 4 + node_modules/zod/v4/locales/ca.js | 118 + node_modules/zod/v4/locales/cs.cjs | 161 + node_modules/zod/v4/locales/cs.d.cts | 4 + node_modules/zod/v4/locales/cs.d.ts | 4 + node_modules/zod/v4/locales/cs.js | 135 + node_modules/zod/v4/locales/de.cjs | 142 + node_modules/zod/v4/locales/de.d.cts | 4 + node_modules/zod/v4/locales/de.d.ts | 4 + node_modules/zod/v4/locales/de.js | 116 + node_modules/zod/v4/locales/en.cjs | 145 + node_modules/zod/v4/locales/en.d.cts | 5 + node_modules/zod/v4/locales/en.d.ts | 5 + node_modules/zod/v4/locales/en.js | 117 + node_modules/zod/v4/locales/eo.cjs | 144 + node_modules/zod/v4/locales/eo.d.cts | 5 + node_modules/zod/v4/locales/eo.d.ts | 5 + node_modules/zod/v4/locales/eo.js | 116 + node_modules/zod/v4/locales/es.cjs | 143 + node_modules/zod/v4/locales/es.d.cts | 4 + node_modules/zod/v4/locales/es.d.ts | 4 + node_modules/zod/v4/locales/es.js | 117 + node_modules/zod/v4/locales/fa.cjs | 148 + node_modules/zod/v4/locales/fa.d.cts | 4 + node_modules/zod/v4/locales/fa.d.ts | 4 + node_modules/zod/v4/locales/fa.js | 122 + node_modules/zod/v4/locales/fi.cjs | 148 + node_modules/zod/v4/locales/fi.d.cts | 4 + node_modules/zod/v4/locales/fi.d.ts | 4 + node_modules/zod/v4/locales/fi.js | 122 + node_modules/zod/v4/locales/fr-CA.cjs | 143 + node_modules/zod/v4/locales/fr-CA.d.cts | 4 + node_modules/zod/v4/locales/fr-CA.d.ts | 4 + node_modules/zod/v4/locales/fr-CA.js | 117 + node_modules/zod/v4/locales/fr.cjs | 142 + node_modules/zod/v4/locales/fr.d.cts | 4 + node_modules/zod/v4/locales/fr.d.ts | 4 + node_modules/zod/v4/locales/fr.js | 116 + node_modules/zod/v4/locales/he.cjs | 143 + node_modules/zod/v4/locales/he.d.cts | 4 + node_modules/zod/v4/locales/he.d.ts | 4 + node_modules/zod/v4/locales/he.js | 117 + node_modules/zod/v4/locales/hu.cjs | 143 + node_modules/zod/v4/locales/hu.d.cts | 4 + node_modules/zod/v4/locales/hu.d.ts | 4 + node_modules/zod/v4/locales/hu.js | 117 + node_modules/zod/v4/locales/id.cjs | 142 + node_modules/zod/v4/locales/id.d.cts | 4 + node_modules/zod/v4/locales/id.d.ts | 4 + node_modules/zod/v4/locales/id.js | 116 + node_modules/zod/v4/locales/index.cjs | 84 + node_modules/zod/v4/locales/index.d.cts | 39 + node_modules/zod/v4/locales/index.d.ts | 39 + node_modules/zod/v4/locales/index.js | 39 + node_modules/zod/v4/locales/it.cjs | 143 + node_modules/zod/v4/locales/it.d.cts | 4 + node_modules/zod/v4/locales/it.d.ts | 4 + node_modules/zod/v4/locales/it.js | 117 + node_modules/zod/v4/locales/ja.cjs | 141 + node_modules/zod/v4/locales/ja.d.cts | 4 + node_modules/zod/v4/locales/ja.d.ts | 4 + node_modules/zod/v4/locales/ja.js | 115 + node_modules/zod/v4/locales/kh.cjs | 143 + node_modules/zod/v4/locales/kh.d.cts | 4 + node_modules/zod/v4/locales/kh.d.ts | 4 + node_modules/zod/v4/locales/kh.js | 117 + node_modules/zod/v4/locales/ko.cjs | 147 + node_modules/zod/v4/locales/ko.d.cts | 4 + node_modules/zod/v4/locales/ko.d.ts | 4 + node_modules/zod/v4/locales/ko.js | 121 + node_modules/zod/v4/locales/mk.cjs | 144 + node_modules/zod/v4/locales/mk.d.cts | 4 + node_modules/zod/v4/locales/mk.d.ts | 4 + node_modules/zod/v4/locales/mk.js | 118 + node_modules/zod/v4/locales/ms.cjs | 142 + node_modules/zod/v4/locales/ms.d.cts | 4 + node_modules/zod/v4/locales/ms.d.ts | 4 + node_modules/zod/v4/locales/ms.js | 116 + node_modules/zod/v4/locales/nl.cjs | 143 + node_modules/zod/v4/locales/nl.d.cts | 4 + node_modules/zod/v4/locales/nl.d.ts | 4 + node_modules/zod/v4/locales/nl.js | 117 + node_modules/zod/v4/locales/no.cjs | 142 + node_modules/zod/v4/locales/no.d.cts | 4 + node_modules/zod/v4/locales/no.d.ts | 4 + node_modules/zod/v4/locales/no.js | 116 + node_modules/zod/v4/locales/ota.cjs | 143 + node_modules/zod/v4/locales/ota.d.cts | 4 + node_modules/zod/v4/locales/ota.d.ts | 4 + node_modules/zod/v4/locales/ota.js | 117 + node_modules/zod/v4/locales/pl.cjs | 143 + node_modules/zod/v4/locales/pl.d.cts | 4 + node_modules/zod/v4/locales/pl.d.ts | 4 + node_modules/zod/v4/locales/pl.js | 117 + node_modules/zod/v4/locales/ps.cjs | 148 + node_modules/zod/v4/locales/ps.d.cts | 4 + node_modules/zod/v4/locales/ps.d.ts | 4 + node_modules/zod/v4/locales/ps.js | 122 + node_modules/zod/v4/locales/pt.cjs | 142 + node_modules/zod/v4/locales/pt.d.cts | 4 + node_modules/zod/v4/locales/pt.d.ts | 4 + node_modules/zod/v4/locales/pt.js | 116 + node_modules/zod/v4/locales/ru.cjs | 190 + node_modules/zod/v4/locales/ru.d.cts | 4 + node_modules/zod/v4/locales/ru.d.ts | 4 + node_modules/zod/v4/locales/ru.js | 164 + node_modules/zod/v4/locales/sl.cjs | 143 + node_modules/zod/v4/locales/sl.d.cts | 4 + node_modules/zod/v4/locales/sl.d.ts | 4 + node_modules/zod/v4/locales/sl.js | 117 + node_modules/zod/v4/locales/sv.cjs | 144 + node_modules/zod/v4/locales/sv.d.cts | 4 + node_modules/zod/v4/locales/sv.d.ts | 4 + node_modules/zod/v4/locales/sv.js | 118 + node_modules/zod/v4/locales/ta.cjs | 143 + node_modules/zod/v4/locales/ta.d.cts | 4 + node_modules/zod/v4/locales/ta.d.ts | 4 + node_modules/zod/v4/locales/ta.js | 117 + node_modules/zod/v4/locales/th.cjs | 143 + node_modules/zod/v4/locales/th.d.cts | 4 + node_modules/zod/v4/locales/th.d.ts | 4 + node_modules/zod/v4/locales/th.js | 117 + node_modules/zod/v4/locales/tr.cjs | 143 + node_modules/zod/v4/locales/tr.d.cts | 5 + node_modules/zod/v4/locales/tr.d.ts | 5 + node_modules/zod/v4/locales/tr.js | 115 + node_modules/zod/v4/locales/ua.cjs | 143 + node_modules/zod/v4/locales/ua.d.cts | 4 + node_modules/zod/v4/locales/ua.d.ts | 4 + node_modules/zod/v4/locales/ua.js | 117 + node_modules/zod/v4/locales/ur.cjs | 143 + node_modules/zod/v4/locales/ur.d.cts | 4 + node_modules/zod/v4/locales/ur.d.ts | 4 + node_modules/zod/v4/locales/ur.js | 117 + node_modules/zod/v4/locales/vi.cjs | 142 + node_modules/zod/v4/locales/vi.d.cts | 4 + node_modules/zod/v4/locales/vi.d.ts | 4 + node_modules/zod/v4/locales/vi.js | 116 + node_modules/zod/v4/locales/zh-CN.cjs | 142 + node_modules/zod/v4/locales/zh-CN.d.cts | 4 + node_modules/zod/v4/locales/zh-CN.d.ts | 4 + node_modules/zod/v4/locales/zh-CN.js | 116 + node_modules/zod/v4/locales/zh-TW.cjs | 143 + node_modules/zod/v4/locales/zh-TW.d.cts | 4 + node_modules/zod/v4/locales/zh-TW.d.ts | 4 + node_modules/zod/v4/locales/zh-TW.js | 117 + node_modules/zod/v4/mini/checks.cjs | 34 + node_modules/zod/v4/mini/checks.d.cts | 1 + node_modules/zod/v4/mini/checks.d.ts | 1 + node_modules/zod/v4/mini/checks.js | 1 + node_modules/zod/v4/mini/coerce.cjs | 47 + node_modules/zod/v4/mini/coerce.d.cts | 7 + node_modules/zod/v4/mini/coerce.d.ts | 7 + node_modules/zod/v4/mini/coerce.js | 17 + node_modules/zod/v4/mini/external.cjs | 62 + node_modules/zod/v4/mini/external.d.cts | 11 + node_modules/zod/v4/mini/external.d.ts | 11 + node_modules/zod/v4/mini/external.js | 13 + node_modules/zod/v4/mini/index.cjs | 32 + node_modules/zod/v4/mini/index.d.cts | 3 + node_modules/zod/v4/mini/index.d.ts | 3 + node_modules/zod/v4/mini/index.js | 3 + node_modules/zod/v4/mini/iso.cjs | 60 + node_modules/zod/v4/mini/iso.d.cts | 22 + node_modules/zod/v4/mini/iso.d.ts | 22 + node_modules/zod/v4/mini/iso.js | 30 + node_modules/zod/v4/mini/parse.cjs | 8 + node_modules/zod/v4/mini/parse.d.cts | 1 + node_modules/zod/v4/mini/parse.d.ts | 1 + node_modules/zod/v4/mini/parse.js | 1 + node_modules/zod/v4/mini/schemas.cjs | 839 ++ node_modules/zod/v4/mini/schemas.d.cts | 356 + node_modules/zod/v4/mini/schemas.d.ts | 356 + node_modules/zod/v4/mini/schemas.js | 732 ++ 1431 files changed, 183126 insertions(+) create mode 100644 node_modules/.package-lock.json create mode 100644 node_modules/@modelcontextprotocol/sdk/LICENSE create mode 100644 node_modules/@modelcontextprotocol/sdk/README.md create mode 100644 node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/LICENSE create mode 100644 node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/README.md create mode 100644 node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/package.json create mode 100644 node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/src/EventSource.ts create mode 100644 node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/src/errors.ts create mode 100644 node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/src/index.ts create mode 100644 node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/src/types.ts create mode 100644 node_modules/@modelcontextprotocol/sdk/package.json create mode 100644 node_modules/accepts/HISTORY.md create mode 100644 node_modules/accepts/LICENSE create mode 100644 node_modules/accepts/README.md create mode 100644 node_modules/accepts/index.js create mode 100644 node_modules/accepts/package.json create mode 100644 node_modules/ajv/.tonic_example.js create mode 100644 node_modules/ajv/LICENSE create mode 100644 node_modules/ajv/README.md create mode 100644 node_modules/ajv/package.json create mode 100644 node_modules/ajv/scripts/.eslintrc.yml create mode 100644 node_modules/ajv/scripts/bundle.js create mode 100644 node_modules/ajv/scripts/compile-dots.js create mode 100644 node_modules/ajv/scripts/info create mode 100644 node_modules/ajv/scripts/prepare-tests create mode 100644 node_modules/ajv/scripts/publish-built-version create mode 100644 node_modules/ajv/scripts/travis-gh-pages create mode 100644 node_modules/ansi-regex/index.d.ts create mode 100644 node_modules/ansi-regex/index.js create mode 100644 node_modules/ansi-regex/license create mode 100644 node_modules/ansi-regex/package.json create mode 100644 node_modules/ansi-regex/readme.md create mode 100644 node_modules/ansi-styles/index.d.ts create mode 100644 node_modules/ansi-styles/index.js create mode 100644 node_modules/ansi-styles/license create mode 100644 node_modules/ansi-styles/package.json create mode 100644 node_modules/ansi-styles/readme.md create mode 100644 node_modules/body-parser/HISTORY.md create mode 100644 node_modules/body-parser/LICENSE create mode 100644 node_modules/body-parser/README.md create mode 100644 node_modules/body-parser/index.js create mode 100644 node_modules/body-parser/package.json create mode 100644 node_modules/bytes/History.md create mode 100644 node_modules/bytes/LICENSE create mode 100644 node_modules/bytes/Readme.md create mode 100644 node_modules/bytes/index.js create mode 100644 node_modules/bytes/package.json create mode 100644 node_modules/call-bind-apply-helpers/.eslintrc create mode 100644 node_modules/call-bind-apply-helpers/.github/FUNDING.yml create mode 100644 node_modules/call-bind-apply-helpers/.nycrc create mode 100644 node_modules/call-bind-apply-helpers/CHANGELOG.md create mode 100644 node_modules/call-bind-apply-helpers/LICENSE create mode 100644 node_modules/call-bind-apply-helpers/README.md create mode 100644 node_modules/call-bind-apply-helpers/actualApply.d.ts create mode 100644 node_modules/call-bind-apply-helpers/actualApply.js create mode 100644 node_modules/call-bind-apply-helpers/applyBind.d.ts create mode 100644 node_modules/call-bind-apply-helpers/applyBind.js create mode 100644 node_modules/call-bind-apply-helpers/functionApply.d.ts create mode 100644 node_modules/call-bind-apply-helpers/functionApply.js create mode 100644 node_modules/call-bind-apply-helpers/functionCall.d.ts create mode 100644 node_modules/call-bind-apply-helpers/functionCall.js create mode 100644 node_modules/call-bind-apply-helpers/index.d.ts create mode 100644 node_modules/call-bind-apply-helpers/index.js create mode 100644 node_modules/call-bind-apply-helpers/package.json create mode 100644 node_modules/call-bind-apply-helpers/reflectApply.d.ts create mode 100644 node_modules/call-bind-apply-helpers/reflectApply.js create mode 100644 node_modules/call-bind-apply-helpers/test/index.js create mode 100644 node_modules/call-bind-apply-helpers/tsconfig.json create mode 100644 node_modules/call-bound/.eslintrc create mode 100644 node_modules/call-bound/.github/FUNDING.yml create mode 100644 node_modules/call-bound/.nycrc create mode 100644 node_modules/call-bound/CHANGELOG.md create mode 100644 node_modules/call-bound/LICENSE create mode 100644 node_modules/call-bound/README.md create mode 100644 node_modules/call-bound/index.d.ts create mode 100644 node_modules/call-bound/index.js create mode 100644 node_modules/call-bound/package.json create mode 100644 node_modules/call-bound/test/index.js create mode 100644 node_modules/call-bound/tsconfig.json create mode 100644 node_modules/cliui/CHANGELOG.md create mode 100644 node_modules/cliui/LICENSE.txt create mode 100644 node_modules/cliui/README.md create mode 100644 node_modules/cliui/index.mjs create mode 100644 node_modules/cliui/package.json create mode 100644 node_modules/content-disposition/HISTORY.md create mode 100644 node_modules/content-disposition/LICENSE create mode 100644 node_modules/content-disposition/README.md create mode 100644 node_modules/content-disposition/index.js create mode 100644 node_modules/content-disposition/package.json create mode 100644 node_modules/content-type/HISTORY.md create mode 100644 node_modules/content-type/LICENSE create mode 100644 node_modules/content-type/README.md create mode 100644 node_modules/content-type/index.js create mode 100644 node_modules/content-type/package.json create mode 100644 node_modules/cookie-signature/History.md create mode 100644 node_modules/cookie-signature/LICENSE create mode 100644 node_modules/cookie-signature/Readme.md create mode 100644 node_modules/cookie-signature/index.js create mode 100644 node_modules/cookie-signature/package.json create mode 100644 node_modules/cookie/LICENSE create mode 100644 node_modules/cookie/README.md create mode 100644 node_modules/cookie/SECURITY.md create mode 100644 node_modules/cookie/index.js create mode 100644 node_modules/cookie/package.json create mode 100644 node_modules/cors/CONTRIBUTING.md create mode 100644 node_modules/cors/HISTORY.md create mode 100644 node_modules/cors/LICENSE create mode 100644 node_modules/cors/README.md create mode 100644 node_modules/cors/package.json create mode 100644 node_modules/cross-spawn/LICENSE create mode 100644 node_modules/cross-spawn/README.md create mode 100644 node_modules/cross-spawn/index.js create mode 100644 node_modules/cross-spawn/package.json create mode 100644 node_modules/debug/LICENSE create mode 100644 node_modules/debug/README.md create mode 100644 node_modules/debug/package.json create mode 100644 node_modules/debug/src/browser.js create mode 100644 node_modules/debug/src/common.js create mode 100644 node_modules/debug/src/index.js create mode 100644 node_modules/debug/src/node.js create mode 100644 node_modules/depd/History.md create mode 100644 node_modules/depd/LICENSE create mode 100644 node_modules/depd/Readme.md create mode 100644 node_modules/depd/index.js create mode 100644 node_modules/depd/package.json create mode 100644 node_modules/dunder-proto/.eslintrc create mode 100644 node_modules/dunder-proto/.github/FUNDING.yml create mode 100644 node_modules/dunder-proto/.nycrc create mode 100644 node_modules/dunder-proto/CHANGELOG.md create mode 100644 node_modules/dunder-proto/LICENSE create mode 100644 node_modules/dunder-proto/README.md create mode 100644 node_modules/dunder-proto/get.d.ts create mode 100644 node_modules/dunder-proto/get.js create mode 100644 node_modules/dunder-proto/package.json create mode 100644 node_modules/dunder-proto/set.d.ts create mode 100644 node_modules/dunder-proto/set.js create mode 100644 node_modules/dunder-proto/test/get.js create mode 100644 node_modules/dunder-proto/test/index.js create mode 100644 node_modules/dunder-proto/test/set.js create mode 100644 node_modules/dunder-proto/tsconfig.json create mode 100644 node_modules/ee-first/LICENSE create mode 100644 node_modules/ee-first/README.md create mode 100644 node_modules/ee-first/index.js create mode 100644 node_modules/ee-first/package.json create mode 100644 node_modules/emoji-regex/LICENSE-MIT.txt create mode 100644 node_modules/emoji-regex/README.md create mode 100644 node_modules/emoji-regex/index.d.ts create mode 100644 node_modules/emoji-regex/index.js create mode 100644 node_modules/emoji-regex/index.mjs create mode 100644 node_modules/emoji-regex/package.json create mode 100644 node_modules/encodeurl/LICENSE create mode 100644 node_modules/encodeurl/README.md create mode 100644 node_modules/encodeurl/index.js create mode 100644 node_modules/encodeurl/package.json create mode 100644 node_modules/es-define-property/.eslintrc create mode 100644 node_modules/es-define-property/.github/FUNDING.yml create mode 100644 node_modules/es-define-property/.nycrc create mode 100644 node_modules/es-define-property/CHANGELOG.md create mode 100644 node_modules/es-define-property/LICENSE create mode 100644 node_modules/es-define-property/README.md create mode 100644 node_modules/es-define-property/index.d.ts create mode 100644 node_modules/es-define-property/index.js create mode 100644 node_modules/es-define-property/package.json create mode 100644 node_modules/es-define-property/test/index.js create mode 100644 node_modules/es-define-property/tsconfig.json create mode 100644 node_modules/es-errors/.eslintrc create mode 100644 node_modules/es-errors/.github/FUNDING.yml create mode 100644 node_modules/es-errors/CHANGELOG.md create mode 100644 node_modules/es-errors/LICENSE create mode 100644 node_modules/es-errors/README.md create mode 100644 node_modules/es-errors/eval.d.ts create mode 100644 node_modules/es-errors/eval.js create mode 100644 node_modules/es-errors/index.d.ts create mode 100644 node_modules/es-errors/index.js create mode 100644 node_modules/es-errors/package.json create mode 100644 node_modules/es-errors/range.d.ts create mode 100644 node_modules/es-errors/range.js create mode 100644 node_modules/es-errors/ref.d.ts create mode 100644 node_modules/es-errors/ref.js create mode 100644 node_modules/es-errors/syntax.d.ts create mode 100644 node_modules/es-errors/syntax.js create mode 100644 node_modules/es-errors/test/index.js create mode 100644 node_modules/es-errors/tsconfig.json create mode 100644 node_modules/es-errors/type.d.ts create mode 100644 node_modules/es-errors/type.js create mode 100644 node_modules/es-errors/uri.d.ts create mode 100644 node_modules/es-errors/uri.js create mode 100644 node_modules/es-object-atoms/.eslintrc create mode 100644 node_modules/es-object-atoms/.github/FUNDING.yml create mode 100644 node_modules/es-object-atoms/CHANGELOG.md create mode 100644 node_modules/es-object-atoms/LICENSE create mode 100644 node_modules/es-object-atoms/README.md create mode 100644 node_modules/es-object-atoms/RequireObjectCoercible.d.ts create mode 100644 node_modules/es-object-atoms/RequireObjectCoercible.js create mode 100644 node_modules/es-object-atoms/ToObject.d.ts create mode 100644 node_modules/es-object-atoms/ToObject.js create mode 100644 node_modules/es-object-atoms/index.d.ts create mode 100644 node_modules/es-object-atoms/index.js create mode 100644 node_modules/es-object-atoms/isObject.d.ts create mode 100644 node_modules/es-object-atoms/isObject.js create mode 100644 node_modules/es-object-atoms/package.json create mode 100644 node_modules/es-object-atoms/test/index.js create mode 100644 node_modules/es-object-atoms/tsconfig.json create mode 100644 node_modules/escalade/index.d.mts create mode 100644 node_modules/escalade/index.d.ts create mode 100644 node_modules/escalade/license create mode 100644 node_modules/escalade/package.json create mode 100644 node_modules/escalade/readme.md create mode 100644 node_modules/escalade/sync/index.d.mts create mode 100644 node_modules/escalade/sync/index.d.ts create mode 100644 node_modules/escalade/sync/index.js create mode 100644 node_modules/escalade/sync/index.mjs create mode 100644 node_modules/escape-html/LICENSE create mode 100644 node_modules/escape-html/Readme.md create mode 100644 node_modules/escape-html/index.js create mode 100644 node_modules/escape-html/package.json create mode 100644 node_modules/etag/HISTORY.md create mode 100644 node_modules/etag/LICENSE create mode 100644 node_modules/etag/README.md create mode 100644 node_modules/etag/index.js create mode 100644 node_modules/etag/package.json create mode 100644 node_modules/eventsource-parser/LICENSE create mode 100644 node_modules/eventsource-parser/README.md create mode 100644 node_modules/eventsource-parser/package.json create mode 100644 node_modules/eventsource-parser/src/errors.ts create mode 100644 node_modules/eventsource-parser/src/index.ts create mode 100644 node_modules/eventsource-parser/src/parse.ts create mode 100644 node_modules/eventsource-parser/src/stream.ts create mode 100644 node_modules/eventsource-parser/src/types.ts create mode 100644 node_modules/eventsource-parser/stream.js create mode 100644 node_modules/eventsource/LICENSE create mode 100644 node_modules/eventsource/README.md create mode 100644 node_modules/eventsource/package.json create mode 100644 node_modules/eventsource/src/EventSource.ts create mode 100644 node_modules/eventsource/src/errors.ts create mode 100644 node_modules/eventsource/src/index.ts create mode 100644 node_modules/eventsource/src/types.ts create mode 100644 node_modules/express-rate-limit/license.md create mode 100644 node_modules/express-rate-limit/package.json create mode 100644 node_modules/express-rate-limit/readme.md create mode 100644 node_modules/express-rate-limit/tsconfig.json create mode 100644 node_modules/express/History.md create mode 100644 node_modules/express/LICENSE create mode 100644 node_modules/express/Readme.md create mode 100644 node_modules/express/index.js create mode 100644 node_modules/express/package.json create mode 100644 node_modules/fast-deep-equal/LICENSE create mode 100644 node_modules/fast-deep-equal/README.md create mode 100644 node_modules/fast-deep-equal/es6/index.d.ts create mode 100644 node_modules/fast-deep-equal/es6/index.js create mode 100644 node_modules/fast-deep-equal/es6/react.d.ts create mode 100644 node_modules/fast-deep-equal/es6/react.js create mode 100644 node_modules/fast-deep-equal/index.d.ts create mode 100644 node_modules/fast-deep-equal/index.js create mode 100644 node_modules/fast-deep-equal/package.json create mode 100644 node_modules/fast-deep-equal/react.d.ts create mode 100644 node_modules/fast-deep-equal/react.js create mode 100644 node_modules/fast-json-stable-stringify/.eslintrc.yml create mode 100644 node_modules/fast-json-stable-stringify/.github/FUNDING.yml create mode 100644 node_modules/fast-json-stable-stringify/.travis.yml create mode 100644 node_modules/fast-json-stable-stringify/LICENSE create mode 100644 node_modules/fast-json-stable-stringify/README.md create mode 100644 node_modules/fast-json-stable-stringify/benchmark/index.js create mode 100644 node_modules/fast-json-stable-stringify/benchmark/test.json create mode 100644 node_modules/fast-json-stable-stringify/example/key_cmp.js create mode 100644 node_modules/fast-json-stable-stringify/example/nested.js create mode 100644 node_modules/fast-json-stable-stringify/example/str.js create mode 100644 node_modules/fast-json-stable-stringify/example/value_cmp.js create mode 100644 node_modules/fast-json-stable-stringify/index.d.ts create mode 100644 node_modules/fast-json-stable-stringify/index.js create mode 100644 node_modules/fast-json-stable-stringify/package.json create mode 100644 node_modules/fast-json-stable-stringify/test/cmp.js create mode 100644 node_modules/fast-json-stable-stringify/test/nested.js create mode 100644 node_modules/fast-json-stable-stringify/test/str.js create mode 100644 node_modules/fast-json-stable-stringify/test/to-json.js create mode 100644 node_modules/finalhandler/HISTORY.md create mode 100644 node_modules/finalhandler/LICENSE create mode 100644 node_modules/finalhandler/README.md create mode 100644 node_modules/finalhandler/index.js create mode 100644 node_modules/finalhandler/package.json create mode 100644 node_modules/forwarded/HISTORY.md create mode 100644 node_modules/forwarded/LICENSE create mode 100644 node_modules/forwarded/README.md create mode 100644 node_modules/forwarded/index.js create mode 100644 node_modules/forwarded/package.json create mode 100644 node_modules/fresh/HISTORY.md create mode 100644 node_modules/fresh/LICENSE create mode 100644 node_modules/fresh/README.md create mode 100644 node_modules/fresh/index.js create mode 100644 node_modules/fresh/package.json create mode 100644 node_modules/function-bind/.eslintrc create mode 100644 node_modules/function-bind/.github/FUNDING.yml create mode 100644 node_modules/function-bind/.github/SECURITY.md create mode 100644 node_modules/function-bind/.nycrc create mode 100644 node_modules/function-bind/CHANGELOG.md create mode 100644 node_modules/function-bind/LICENSE create mode 100644 node_modules/function-bind/README.md create mode 100644 node_modules/function-bind/implementation.js create mode 100644 node_modules/function-bind/index.js create mode 100644 node_modules/function-bind/package.json create mode 100644 node_modules/function-bind/test/.eslintrc create mode 100644 node_modules/function-bind/test/index.js create mode 100644 node_modules/get-caller-file/LICENSE.md create mode 100644 node_modules/get-caller-file/README.md create mode 100644 node_modules/get-caller-file/index.d.ts create mode 100644 node_modules/get-caller-file/index.js create mode 100644 node_modules/get-caller-file/index.js.map create mode 100644 node_modules/get-caller-file/package.json create mode 100644 node_modules/get-east-asian-width/index.d.ts create mode 100644 node_modules/get-east-asian-width/index.js create mode 100644 node_modules/get-east-asian-width/license create mode 100644 node_modules/get-east-asian-width/lookup.js create mode 100644 node_modules/get-east-asian-width/package.json create mode 100644 node_modules/get-east-asian-width/readme.md create mode 100644 node_modules/get-intrinsic/.eslintrc create mode 100644 node_modules/get-intrinsic/.github/FUNDING.yml create mode 100644 node_modules/get-intrinsic/.nycrc create mode 100644 node_modules/get-intrinsic/CHANGELOG.md create mode 100644 node_modules/get-intrinsic/LICENSE create mode 100644 node_modules/get-intrinsic/README.md create mode 100644 node_modules/get-intrinsic/index.js create mode 100644 node_modules/get-intrinsic/package.json create mode 100644 node_modules/get-intrinsic/test/GetIntrinsic.js create mode 100644 node_modules/get-proto/.eslintrc create mode 100644 node_modules/get-proto/.github/FUNDING.yml create mode 100644 node_modules/get-proto/.nycrc create mode 100644 node_modules/get-proto/CHANGELOG.md create mode 100644 node_modules/get-proto/LICENSE create mode 100644 node_modules/get-proto/Object.getPrototypeOf.d.ts create mode 100644 node_modules/get-proto/Object.getPrototypeOf.js create mode 100644 node_modules/get-proto/README.md create mode 100644 node_modules/get-proto/Reflect.getPrototypeOf.d.ts create mode 100644 node_modules/get-proto/Reflect.getPrototypeOf.js create mode 100644 node_modules/get-proto/index.d.ts create mode 100644 node_modules/get-proto/index.js create mode 100644 node_modules/get-proto/package.json create mode 100644 node_modules/get-proto/test/index.js create mode 100644 node_modules/get-proto/tsconfig.json create mode 100644 node_modules/gopd/.eslintrc create mode 100644 node_modules/gopd/.github/FUNDING.yml create mode 100644 node_modules/gopd/CHANGELOG.md create mode 100644 node_modules/gopd/LICENSE create mode 100644 node_modules/gopd/README.md create mode 100644 node_modules/gopd/gOPD.d.ts create mode 100644 node_modules/gopd/gOPD.js create mode 100644 node_modules/gopd/index.d.ts create mode 100644 node_modules/gopd/index.js create mode 100644 node_modules/gopd/package.json create mode 100644 node_modules/gopd/test/index.js create mode 100644 node_modules/gopd/tsconfig.json create mode 100644 node_modules/has-symbols/.eslintrc create mode 100644 node_modules/has-symbols/.github/FUNDING.yml create mode 100644 node_modules/has-symbols/.nycrc create mode 100644 node_modules/has-symbols/CHANGELOG.md create mode 100644 node_modules/has-symbols/LICENSE create mode 100644 node_modules/has-symbols/README.md create mode 100644 node_modules/has-symbols/index.d.ts create mode 100644 node_modules/has-symbols/index.js create mode 100644 node_modules/has-symbols/package.json create mode 100644 node_modules/has-symbols/shams.d.ts create mode 100644 node_modules/has-symbols/shams.js create mode 100644 node_modules/has-symbols/test/index.js create mode 100644 node_modules/has-symbols/test/shams/core-js.js create mode 100644 node_modules/has-symbols/test/shams/get-own-property-symbols.js create mode 100644 node_modules/has-symbols/test/tests.js create mode 100644 node_modules/has-symbols/tsconfig.json create mode 100644 node_modules/hasown/.eslintrc create mode 100644 node_modules/hasown/.github/FUNDING.yml create mode 100644 node_modules/hasown/.nycrc create mode 100644 node_modules/hasown/CHANGELOG.md create mode 100644 node_modules/hasown/LICENSE create mode 100644 node_modules/hasown/README.md create mode 100644 node_modules/hasown/index.d.ts create mode 100644 node_modules/hasown/index.js create mode 100644 node_modules/hasown/package.json create mode 100644 node_modules/hasown/tsconfig.json create mode 100644 node_modules/http-errors/HISTORY.md create mode 100644 node_modules/http-errors/LICENSE create mode 100644 node_modules/http-errors/README.md create mode 100644 node_modules/http-errors/index.js create mode 100644 node_modules/http-errors/node_modules/statuses/HISTORY.md create mode 100644 node_modules/http-errors/node_modules/statuses/LICENSE create mode 100644 node_modules/http-errors/node_modules/statuses/README.md create mode 100644 node_modules/http-errors/node_modules/statuses/codes.json create mode 100644 node_modules/http-errors/node_modules/statuses/index.js create mode 100644 node_modules/http-errors/node_modules/statuses/package.json create mode 100644 node_modules/http-errors/package.json create mode 100644 node_modules/iconv-lite/.github/dependabot.yml create mode 100644 node_modules/iconv-lite/Changelog.md create mode 100644 node_modules/iconv-lite/LICENSE create mode 100644 node_modules/iconv-lite/README.md create mode 100644 node_modules/iconv-lite/encodings/dbcs-codec.js create mode 100644 node_modules/iconv-lite/encodings/dbcs-data.js create mode 100644 node_modules/iconv-lite/encodings/index.js create mode 100644 node_modules/iconv-lite/encodings/internal.js create mode 100644 node_modules/iconv-lite/encodings/sbcs-codec.js create mode 100644 node_modules/iconv-lite/encodings/sbcs-data-generated.js create mode 100644 node_modules/iconv-lite/encodings/sbcs-data.js create mode 100644 node_modules/iconv-lite/encodings/tables/big5-added.json create mode 100644 node_modules/iconv-lite/encodings/tables/cp936.json create mode 100644 node_modules/iconv-lite/encodings/tables/cp949.json create mode 100644 node_modules/iconv-lite/encodings/tables/cp950.json create mode 100644 node_modules/iconv-lite/encodings/tables/eucjp.json create mode 100644 node_modules/iconv-lite/encodings/tables/gb18030-ranges.json create mode 100644 node_modules/iconv-lite/encodings/tables/gbk-added.json create mode 100644 node_modules/iconv-lite/encodings/tables/shiftjis.json create mode 100644 node_modules/iconv-lite/encodings/utf16.js create mode 100644 node_modules/iconv-lite/encodings/utf32.js create mode 100644 node_modules/iconv-lite/encodings/utf7.js create mode 100644 node_modules/iconv-lite/package.json create mode 100644 node_modules/inherits/LICENSE create mode 100644 node_modules/inherits/README.md create mode 100644 node_modules/inherits/inherits.js create mode 100644 node_modules/inherits/inherits_browser.js create mode 100644 node_modules/inherits/package.json create mode 100644 node_modules/ipaddr.js/LICENSE create mode 100644 node_modules/ipaddr.js/README.md create mode 100644 node_modules/ipaddr.js/ipaddr.min.js create mode 100644 node_modules/ipaddr.js/package.json create mode 100644 node_modules/is-promise/LICENSE create mode 100644 node_modules/is-promise/index.d.ts create mode 100644 node_modules/is-promise/index.js create mode 100644 node_modules/is-promise/index.mjs create mode 100644 node_modules/is-promise/package.json create mode 100644 node_modules/is-promise/readme.md create mode 100644 node_modules/isexe/.npmignore create mode 100644 node_modules/isexe/LICENSE create mode 100644 node_modules/isexe/README.md create mode 100644 node_modules/isexe/index.js create mode 100644 node_modules/isexe/mode.js create mode 100644 node_modules/isexe/package.json create mode 100644 node_modules/isexe/test/basic.js create mode 100644 node_modules/isexe/windows.js create mode 100644 node_modules/json-schema-traverse/.eslintrc.yml create mode 100644 node_modules/json-schema-traverse/.travis.yml create mode 100644 node_modules/json-schema-traverse/LICENSE create mode 100644 node_modules/json-schema-traverse/README.md create mode 100644 node_modules/json-schema-traverse/index.js create mode 100644 node_modules/json-schema-traverse/package.json create mode 100644 node_modules/json-schema-traverse/spec/.eslintrc.yml create mode 100644 node_modules/json-schema-traverse/spec/fixtures/schema.js create mode 100644 node_modules/json-schema-traverse/spec/index.spec.js create mode 100644 node_modules/math-intrinsics/.eslintrc create mode 100644 node_modules/math-intrinsics/.github/FUNDING.yml create mode 100644 node_modules/math-intrinsics/CHANGELOG.md create mode 100644 node_modules/math-intrinsics/LICENSE create mode 100644 node_modules/math-intrinsics/README.md create mode 100644 node_modules/math-intrinsics/abs.d.ts create mode 100644 node_modules/math-intrinsics/abs.js create mode 100644 node_modules/math-intrinsics/constants/maxArrayLength.d.ts create mode 100644 node_modules/math-intrinsics/constants/maxArrayLength.js create mode 100644 node_modules/math-intrinsics/constants/maxSafeInteger.d.ts create mode 100644 node_modules/math-intrinsics/constants/maxSafeInteger.js create mode 100644 node_modules/math-intrinsics/constants/maxValue.d.ts create mode 100644 node_modules/math-intrinsics/constants/maxValue.js create mode 100644 node_modules/math-intrinsics/floor.d.ts create mode 100644 node_modules/math-intrinsics/floor.js create mode 100644 node_modules/math-intrinsics/isFinite.d.ts create mode 100644 node_modules/math-intrinsics/isFinite.js create mode 100644 node_modules/math-intrinsics/isInteger.d.ts create mode 100644 node_modules/math-intrinsics/isInteger.js create mode 100644 node_modules/math-intrinsics/isNaN.d.ts create mode 100644 node_modules/math-intrinsics/isNaN.js create mode 100644 node_modules/math-intrinsics/isNegativeZero.d.ts create mode 100644 node_modules/math-intrinsics/isNegativeZero.js create mode 100644 node_modules/math-intrinsics/max.d.ts create mode 100644 node_modules/math-intrinsics/max.js create mode 100644 node_modules/math-intrinsics/min.d.ts create mode 100644 node_modules/math-intrinsics/min.js create mode 100644 node_modules/math-intrinsics/mod.d.ts create mode 100644 node_modules/math-intrinsics/mod.js create mode 100644 node_modules/math-intrinsics/package.json create mode 100644 node_modules/math-intrinsics/pow.d.ts create mode 100644 node_modules/math-intrinsics/pow.js create mode 100644 node_modules/math-intrinsics/round.d.ts create mode 100644 node_modules/math-intrinsics/round.js create mode 100644 node_modules/math-intrinsics/sign.d.ts create mode 100644 node_modules/math-intrinsics/sign.js create mode 100644 node_modules/math-intrinsics/test/index.js create mode 100644 node_modules/math-intrinsics/tsconfig.json create mode 100644 node_modules/mcp-proxy/.github/workflows/feature.yaml create mode 100644 node_modules/mcp-proxy/.github/workflows/main.yaml create mode 100644 node_modules/mcp-proxy/LICENSE create mode 100644 node_modules/mcp-proxy/README.md create mode 100644 node_modules/mcp-proxy/eslint.config.ts create mode 100644 node_modules/mcp-proxy/jsr.json create mode 100644 node_modules/mcp-proxy/package.json create mode 100644 node_modules/mcp-proxy/src/InMemoryEventStore.test.ts create mode 100644 node_modules/mcp-proxy/src/InMemoryEventStore.ts create mode 100644 node_modules/mcp-proxy/src/JSONFilterTransform.test.ts create mode 100644 node_modules/mcp-proxy/src/JSONFilterTransform.ts create mode 100644 node_modules/mcp-proxy/src/StdioClientTransport.ts create mode 100644 node_modules/mcp-proxy/src/bin/mcp-proxy.ts create mode 100644 node_modules/mcp-proxy/src/fixtures/simple-stdio-proxy-server.ts create mode 100644 node_modules/mcp-proxy/src/fixtures/simple-stdio-server.ts create mode 100644 node_modules/mcp-proxy/src/index.ts create mode 100644 node_modules/mcp-proxy/src/proxyServer.ts create mode 100644 node_modules/mcp-proxy/src/startHTTPServer.test.ts create mode 100644 node_modules/mcp-proxy/src/startHTTPServer.ts create mode 100644 node_modules/mcp-proxy/src/startStdioServer.test.ts create mode 100644 node_modules/mcp-proxy/src/startStdioServer.ts create mode 100644 node_modules/mcp-proxy/src/tapTransport.ts create mode 100644 node_modules/mcp-proxy/tsconfig.json create mode 100644 node_modules/media-typer/HISTORY.md create mode 100644 node_modules/media-typer/LICENSE create mode 100644 node_modules/media-typer/README.md create mode 100644 node_modules/media-typer/index.js create mode 100644 node_modules/media-typer/package.json create mode 100644 node_modules/merge-descriptors/index.d.ts create mode 100644 node_modules/merge-descriptors/index.js create mode 100644 node_modules/merge-descriptors/license create mode 100644 node_modules/merge-descriptors/package.json create mode 100644 node_modules/merge-descriptors/readme.md create mode 100644 node_modules/mime-db/HISTORY.md create mode 100644 node_modules/mime-db/LICENSE create mode 100644 node_modules/mime-db/README.md create mode 100644 node_modules/mime-db/db.json create mode 100644 node_modules/mime-db/index.js create mode 100644 node_modules/mime-db/package.json create mode 100644 node_modules/mime-types/HISTORY.md create mode 100644 node_modules/mime-types/LICENSE create mode 100644 node_modules/mime-types/README.md create mode 100644 node_modules/mime-types/index.js create mode 100644 node_modules/mime-types/mimeScore.js create mode 100644 node_modules/mime-types/package.json create mode 100644 node_modules/ms/index.js create mode 100644 node_modules/ms/license.md create mode 100644 node_modules/ms/package.json create mode 100644 node_modules/ms/readme.md create mode 100644 node_modules/negotiator/HISTORY.md create mode 100644 node_modules/negotiator/LICENSE create mode 100644 node_modules/negotiator/README.md create mode 100644 node_modules/negotiator/index.js create mode 100644 node_modules/negotiator/package.json create mode 100644 node_modules/object-assign/index.js create mode 100644 node_modules/object-assign/license create mode 100644 node_modules/object-assign/package.json create mode 100644 node_modules/object-assign/readme.md create mode 100644 node_modules/object-inspect/.eslintrc create mode 100644 node_modules/object-inspect/.github/FUNDING.yml create mode 100644 node_modules/object-inspect/.nycrc create mode 100644 node_modules/object-inspect/CHANGELOG.md create mode 100644 node_modules/object-inspect/LICENSE create mode 100644 node_modules/object-inspect/example/all.js create mode 100644 node_modules/object-inspect/example/circular.js create mode 100644 node_modules/object-inspect/example/fn.js create mode 100644 node_modules/object-inspect/example/inspect.js create mode 100644 node_modules/object-inspect/index.js create mode 100644 node_modules/object-inspect/package-support.json create mode 100644 node_modules/object-inspect/package.json create mode 100644 node_modules/object-inspect/readme.markdown create mode 100644 node_modules/object-inspect/test-core-js.js create mode 100644 node_modules/object-inspect/test/bigint.js create mode 100644 node_modules/object-inspect/test/browser/dom.js create mode 100644 node_modules/object-inspect/test/circular.js create mode 100644 node_modules/object-inspect/test/deep.js create mode 100644 node_modules/object-inspect/test/element.js create mode 100644 node_modules/object-inspect/test/err.js create mode 100644 node_modules/object-inspect/test/fakes.js create mode 100644 node_modules/object-inspect/test/fn.js create mode 100644 node_modules/object-inspect/test/global.js create mode 100644 node_modules/object-inspect/test/has.js create mode 100644 node_modules/object-inspect/test/holes.js create mode 100644 node_modules/object-inspect/test/indent-option.js create mode 100644 node_modules/object-inspect/test/inspect.js create mode 100644 node_modules/object-inspect/test/lowbyte.js create mode 100644 node_modules/object-inspect/test/number.js create mode 100644 node_modules/object-inspect/test/quoteStyle.js create mode 100644 node_modules/object-inspect/test/toStringTag.js create mode 100644 node_modules/object-inspect/test/undef.js create mode 100644 node_modules/object-inspect/test/values.js create mode 100644 node_modules/object-inspect/util.inspect.js create mode 100644 node_modules/on-finished/HISTORY.md create mode 100644 node_modules/on-finished/LICENSE create mode 100644 node_modules/on-finished/README.md create mode 100644 node_modules/on-finished/index.js create mode 100644 node_modules/on-finished/package.json create mode 100644 node_modules/once/LICENSE create mode 100644 node_modules/once/README.md create mode 100644 node_modules/once/once.js create mode 100644 node_modules/once/package.json create mode 100644 node_modules/parseurl/HISTORY.md create mode 100644 node_modules/parseurl/LICENSE create mode 100644 node_modules/parseurl/README.md create mode 100644 node_modules/parseurl/index.js create mode 100644 node_modules/parseurl/package.json create mode 100644 node_modules/path-key/index.d.ts create mode 100644 node_modules/path-key/index.js create mode 100644 node_modules/path-key/license create mode 100644 node_modules/path-key/package.json create mode 100644 node_modules/path-key/readme.md create mode 100644 node_modules/path-to-regexp/LICENSE create mode 100644 node_modules/path-to-regexp/Readme.md create mode 100644 node_modules/path-to-regexp/package.json create mode 100644 node_modules/pkce-challenge/LICENSE create mode 100644 node_modules/pkce-challenge/README.md create mode 100644 node_modules/pkce-challenge/package.json create mode 100644 node_modules/proxy-addr/HISTORY.md create mode 100644 node_modules/proxy-addr/LICENSE create mode 100644 node_modules/proxy-addr/README.md create mode 100644 node_modules/proxy-addr/index.js create mode 100644 node_modules/proxy-addr/package.json create mode 100644 node_modules/punycode/LICENSE-MIT.txt create mode 100644 node_modules/punycode/README.md create mode 100644 node_modules/punycode/package.json create mode 100644 node_modules/punycode/punycode.es6.js create mode 100644 node_modules/punycode/punycode.js create mode 100644 node_modules/qs/.editorconfig create mode 100644 node_modules/qs/.eslintrc create mode 100644 node_modules/qs/.github/FUNDING.yml create mode 100644 node_modules/qs/.nycrc create mode 100644 node_modules/qs/CHANGELOG.md create mode 100644 node_modules/qs/LICENSE.md create mode 100644 node_modules/qs/README.md create mode 100644 node_modules/qs/package.json create mode 100644 node_modules/qs/test/empty-keys-cases.js create mode 100644 node_modules/qs/test/parse.js create mode 100644 node_modules/qs/test/stringify.js create mode 100644 node_modules/qs/test/utils.js create mode 100644 node_modules/range-parser/HISTORY.md create mode 100644 node_modules/range-parser/LICENSE create mode 100644 node_modules/range-parser/README.md create mode 100644 node_modules/range-parser/index.js create mode 100644 node_modules/range-parser/package.json create mode 100644 node_modules/raw-body/HISTORY.md create mode 100644 node_modules/raw-body/LICENSE create mode 100644 node_modules/raw-body/README.md create mode 100644 node_modules/raw-body/SECURITY.md create mode 100644 node_modules/raw-body/index.d.ts create mode 100644 node_modules/raw-body/index.js create mode 100644 node_modules/raw-body/package.json create mode 100644 node_modules/router/HISTORY.md create mode 100644 node_modules/router/LICENSE create mode 100644 node_modules/router/README.md create mode 100644 node_modules/router/index.js create mode 100644 node_modules/router/package.json create mode 100644 node_modules/safe-buffer/LICENSE create mode 100644 node_modules/safe-buffer/README.md create mode 100644 node_modules/safe-buffer/index.d.ts create mode 100644 node_modules/safe-buffer/index.js create mode 100644 node_modules/safe-buffer/package.json create mode 100644 node_modules/safer-buffer/LICENSE create mode 100644 node_modules/safer-buffer/Porting-Buffer.md create mode 100644 node_modules/safer-buffer/Readme.md create mode 100644 node_modules/safer-buffer/dangerous.js create mode 100644 node_modules/safer-buffer/package.json create mode 100644 node_modules/safer-buffer/safer.js create mode 100644 node_modules/safer-buffer/tests.js create mode 100644 node_modules/send/HISTORY.md create mode 100644 node_modules/send/LICENSE create mode 100644 node_modules/send/README.md create mode 100644 node_modules/send/index.js create mode 100644 node_modules/send/package.json create mode 100644 node_modules/serve-static/HISTORY.md create mode 100644 node_modules/serve-static/LICENSE create mode 100644 node_modules/serve-static/README.md create mode 100644 node_modules/serve-static/index.js create mode 100644 node_modules/serve-static/package.json create mode 100644 node_modules/setprototypeof/LICENSE create mode 100644 node_modules/setprototypeof/README.md create mode 100644 node_modules/setprototypeof/index.d.ts create mode 100644 node_modules/setprototypeof/index.js create mode 100644 node_modules/setprototypeof/package.json create mode 100644 node_modules/setprototypeof/test/index.js create mode 100644 node_modules/shebang-command/index.js create mode 100644 node_modules/shebang-command/license create mode 100644 node_modules/shebang-command/package.json create mode 100644 node_modules/shebang-command/readme.md create mode 100644 node_modules/shebang-regex/index.d.ts create mode 100644 node_modules/shebang-regex/index.js create mode 100644 node_modules/shebang-regex/license create mode 100644 node_modules/shebang-regex/package.json create mode 100644 node_modules/shebang-regex/readme.md create mode 100644 node_modules/side-channel-list/.editorconfig create mode 100644 node_modules/side-channel-list/.eslintrc create mode 100644 node_modules/side-channel-list/.github/FUNDING.yml create mode 100644 node_modules/side-channel-list/.nycrc create mode 100644 node_modules/side-channel-list/CHANGELOG.md create mode 100644 node_modules/side-channel-list/LICENSE create mode 100644 node_modules/side-channel-list/README.md create mode 100644 node_modules/side-channel-list/index.d.ts create mode 100644 node_modules/side-channel-list/index.js create mode 100644 node_modules/side-channel-list/list.d.ts create mode 100644 node_modules/side-channel-list/package.json create mode 100644 node_modules/side-channel-list/test/index.js create mode 100644 node_modules/side-channel-list/tsconfig.json create mode 100644 node_modules/side-channel-map/.editorconfig create mode 100644 node_modules/side-channel-map/.eslintrc create mode 100644 node_modules/side-channel-map/.github/FUNDING.yml create mode 100644 node_modules/side-channel-map/.nycrc create mode 100644 node_modules/side-channel-map/CHANGELOG.md create mode 100644 node_modules/side-channel-map/LICENSE create mode 100644 node_modules/side-channel-map/README.md create mode 100644 node_modules/side-channel-map/index.d.ts create mode 100644 node_modules/side-channel-map/index.js create mode 100644 node_modules/side-channel-map/package.json create mode 100644 node_modules/side-channel-map/test/index.js create mode 100644 node_modules/side-channel-map/tsconfig.json create mode 100644 node_modules/side-channel-weakmap/.editorconfig create mode 100644 node_modules/side-channel-weakmap/.eslintrc create mode 100644 node_modules/side-channel-weakmap/.github/FUNDING.yml create mode 100644 node_modules/side-channel-weakmap/.nycrc create mode 100644 node_modules/side-channel-weakmap/CHANGELOG.md create mode 100644 node_modules/side-channel-weakmap/LICENSE create mode 100644 node_modules/side-channel-weakmap/README.md create mode 100644 node_modules/side-channel-weakmap/index.d.ts create mode 100644 node_modules/side-channel-weakmap/index.js create mode 100644 node_modules/side-channel-weakmap/package.json create mode 100644 node_modules/side-channel-weakmap/test/index.js create mode 100644 node_modules/side-channel-weakmap/tsconfig.json create mode 100644 node_modules/side-channel/.editorconfig create mode 100644 node_modules/side-channel/.eslintrc create mode 100644 node_modules/side-channel/.github/FUNDING.yml create mode 100644 node_modules/side-channel/.nycrc create mode 100644 node_modules/side-channel/CHANGELOG.md create mode 100644 node_modules/side-channel/LICENSE create mode 100644 node_modules/side-channel/README.md create mode 100644 node_modules/side-channel/index.d.ts create mode 100644 node_modules/side-channel/index.js create mode 100644 node_modules/side-channel/package.json create mode 100644 node_modules/side-channel/test/index.js create mode 100644 node_modules/side-channel/tsconfig.json create mode 100644 node_modules/statuses/HISTORY.md create mode 100644 node_modules/statuses/LICENSE create mode 100644 node_modules/statuses/README.md create mode 100644 node_modules/statuses/codes.json create mode 100644 node_modules/statuses/index.js create mode 100644 node_modules/statuses/package.json create mode 100644 node_modules/string-width/index.d.ts create mode 100644 node_modules/string-width/index.js create mode 100644 node_modules/string-width/license create mode 100644 node_modules/string-width/package.json create mode 100644 node_modules/string-width/readme.md create mode 100644 node_modules/strip-ansi/index.d.ts create mode 100644 node_modules/strip-ansi/index.js create mode 100644 node_modules/strip-ansi/license create mode 100644 node_modules/strip-ansi/package.json create mode 100644 node_modules/strip-ansi/readme.md create mode 100644 node_modules/toidentifier/HISTORY.md create mode 100644 node_modules/toidentifier/LICENSE create mode 100644 node_modules/toidentifier/README.md create mode 100644 node_modules/toidentifier/index.js create mode 100644 node_modules/toidentifier/package.json create mode 100644 node_modules/type-is/HISTORY.md create mode 100644 node_modules/type-is/LICENSE create mode 100644 node_modules/type-is/README.md create mode 100644 node_modules/type-is/index.js create mode 100644 node_modules/type-is/package.json create mode 100644 node_modules/unpipe/HISTORY.md create mode 100644 node_modules/unpipe/LICENSE create mode 100644 node_modules/unpipe/README.md create mode 100644 node_modules/unpipe/index.js create mode 100644 node_modules/unpipe/package.json create mode 100644 node_modules/uri-js/LICENSE create mode 100644 node_modules/uri-js/README.md create mode 100644 node_modules/uri-js/package.json create mode 100644 node_modules/uri-js/yarn.lock create mode 100644 node_modules/vary/HISTORY.md create mode 100644 node_modules/vary/LICENSE create mode 100644 node_modules/vary/README.md create mode 100644 node_modules/vary/index.js create mode 100644 node_modules/vary/package.json create mode 100644 node_modules/which/CHANGELOG.md create mode 100644 node_modules/which/LICENSE create mode 100644 node_modules/which/README.md create mode 100644 node_modules/which/bin/node-which create mode 100644 node_modules/which/package.json create mode 100644 node_modules/which/which.js create mode 100644 node_modules/wrap-ansi/index.d.ts create mode 100644 node_modules/wrap-ansi/index.js create mode 100644 node_modules/wrap-ansi/license create mode 100644 node_modules/wrap-ansi/package.json create mode 100644 node_modules/wrap-ansi/readme.md create mode 100644 node_modules/wrappy/LICENSE create mode 100644 node_modules/wrappy/README.md create mode 100644 node_modules/wrappy/package.json create mode 100644 node_modules/wrappy/wrappy.js create mode 100644 node_modules/y18n/CHANGELOG.md create mode 100644 node_modules/y18n/LICENSE create mode 100644 node_modules/y18n/README.md create mode 100644 node_modules/y18n/index.mjs create mode 100644 node_modules/y18n/package.json create mode 100644 node_modules/yargs-parser/CHANGELOG.md create mode 100644 node_modules/yargs-parser/LICENSE.txt create mode 100644 node_modules/yargs-parser/README.md create mode 100644 node_modules/yargs-parser/browser.js create mode 100644 node_modules/yargs-parser/package.json create mode 100644 node_modules/yargs/LICENSE create mode 100644 node_modules/yargs/README.md create mode 100644 node_modules/yargs/browser.d.ts create mode 100644 node_modules/yargs/browser.mjs create mode 100644 node_modules/yargs/helpers/helpers.mjs create mode 100644 node_modules/yargs/helpers/package.json create mode 100644 node_modules/yargs/index.mjs create mode 100644 node_modules/yargs/locales/be.json create mode 100644 node_modules/yargs/locales/cs.json create mode 100644 node_modules/yargs/locales/de.json create mode 100644 node_modules/yargs/locales/en.json create mode 100644 node_modules/yargs/locales/es.json create mode 100644 node_modules/yargs/locales/fi.json create mode 100644 node_modules/yargs/locales/fr.json create mode 100644 node_modules/yargs/locales/he.json create mode 100644 node_modules/yargs/locales/hi.json create mode 100644 node_modules/yargs/locales/hu.json create mode 100644 node_modules/yargs/locales/id.json create mode 100644 node_modules/yargs/locales/it.json create mode 100644 node_modules/yargs/locales/ja.json create mode 100644 node_modules/yargs/locales/ko.json create mode 100644 node_modules/yargs/locales/nb.json create mode 100644 node_modules/yargs/locales/nl.json create mode 100644 node_modules/yargs/locales/nn.json create mode 100644 node_modules/yargs/locales/pirate.json create mode 100644 node_modules/yargs/locales/pl.json create mode 100644 node_modules/yargs/locales/pt.json create mode 100644 node_modules/yargs/locales/pt_BR.json create mode 100644 node_modules/yargs/locales/ru.json create mode 100644 node_modules/yargs/locales/th.json create mode 100644 node_modules/yargs/locales/tr.json create mode 100644 node_modules/yargs/locales/uk_UA.json create mode 100644 node_modules/yargs/locales/uz.json create mode 100644 node_modules/yargs/locales/zh_CN.json create mode 100644 node_modules/yargs/locales/zh_TW.json create mode 100644 node_modules/yargs/package.json create mode 100644 node_modules/zod-to-json-schema/.github/CR_logotype-full-color.png create mode 100644 node_modules/zod-to-json-schema/.github/FUNDING.yml create mode 100644 node_modules/zod-to-json-schema/.prettierrc.json create mode 100644 node_modules/zod-to-json-schema/LICENSE create mode 100644 node_modules/zod-to-json-schema/README.md create mode 100644 node_modules/zod-to-json-schema/SECURITY.md create mode 100644 node_modules/zod-to-json-schema/changelog.md create mode 100644 node_modules/zod-to-json-schema/contributing.md create mode 100644 node_modules/zod-to-json-schema/createIndex.ts create mode 100644 node_modules/zod-to-json-schema/package.json create mode 100644 node_modules/zod-to-json-schema/postcjs.ts create mode 100644 node_modules/zod-to-json-schema/postesm.ts create mode 100644 node_modules/zod/LICENSE create mode 100644 node_modules/zod/README.md create mode 100644 node_modules/zod/index.cjs create mode 100644 node_modules/zod/index.d.cts create mode 100644 node_modules/zod/index.d.ts create mode 100644 node_modules/zod/index.js create mode 100644 node_modules/zod/package.json create mode 100644 node_modules/zod/src/index.ts create mode 100644 node_modules/zod/src/v3/ZodError.ts create mode 100644 node_modules/zod/src/v3/benchmarks/datetime.ts create mode 100644 node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts create mode 100644 node_modules/zod/src/v3/benchmarks/index.ts create mode 100644 node_modules/zod/src/v3/benchmarks/ipv4.ts create mode 100644 node_modules/zod/src/v3/benchmarks/object.ts create mode 100644 node_modules/zod/src/v3/benchmarks/primitives.ts create mode 100644 node_modules/zod/src/v3/benchmarks/realworld.ts create mode 100644 node_modules/zod/src/v3/benchmarks/string.ts create mode 100644 node_modules/zod/src/v3/benchmarks/union.ts create mode 100644 node_modules/zod/src/v3/errors.ts create mode 100644 node_modules/zod/src/v3/external.ts create mode 100644 node_modules/zod/src/v3/helpers/enumUtil.ts create mode 100644 node_modules/zod/src/v3/helpers/errorUtil.ts create mode 100644 node_modules/zod/src/v3/helpers/parseUtil.ts create mode 100644 node_modules/zod/src/v3/helpers/partialUtil.ts create mode 100644 node_modules/zod/src/v3/helpers/typeAliases.ts create mode 100644 node_modules/zod/src/v3/helpers/util.ts create mode 100644 node_modules/zod/src/v3/index.ts create mode 100644 node_modules/zod/src/v3/locales/en.ts create mode 100644 node_modules/zod/src/v3/standard-schema.ts create mode 100644 node_modules/zod/src/v3/tests/Mocker.ts create mode 100644 node_modules/zod/src/v3/tests/all-errors.test.ts create mode 100644 node_modules/zod/src/v3/tests/anyunknown.test.ts create mode 100644 node_modules/zod/src/v3/tests/array.test.ts create mode 100644 node_modules/zod/src/v3/tests/async-parsing.test.ts create mode 100644 node_modules/zod/src/v3/tests/async-refinements.test.ts create mode 100644 node_modules/zod/src/v3/tests/base.test.ts create mode 100644 node_modules/zod/src/v3/tests/bigint.test.ts create mode 100644 node_modules/zod/src/v3/tests/branded.test.ts create mode 100644 node_modules/zod/src/v3/tests/catch.test.ts create mode 100644 node_modules/zod/src/v3/tests/coerce.test.ts create mode 100644 node_modules/zod/src/v3/tests/complex.test.ts create mode 100644 node_modules/zod/src/v3/tests/custom.test.ts create mode 100644 node_modules/zod/src/v3/tests/date.test.ts create mode 100644 node_modules/zod/src/v3/tests/deepmasking.test.ts create mode 100644 node_modules/zod/src/v3/tests/default.test.ts create mode 100644 node_modules/zod/src/v3/tests/description.test.ts create mode 100644 node_modules/zod/src/v3/tests/discriminated-unions.test.ts create mode 100644 node_modules/zod/src/v3/tests/enum.test.ts create mode 100644 node_modules/zod/src/v3/tests/error.test.ts create mode 100644 node_modules/zod/src/v3/tests/firstparty.test.ts create mode 100644 node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts create mode 100644 node_modules/zod/src/v3/tests/function.test.ts create mode 100644 node_modules/zod/src/v3/tests/generics.test.ts create mode 100644 node_modules/zod/src/v3/tests/instanceof.test.ts create mode 100644 node_modules/zod/src/v3/tests/intersection.test.ts create mode 100644 node_modules/zod/src/v3/tests/language-server.source.ts create mode 100644 node_modules/zod/src/v3/tests/language-server.test.ts create mode 100644 node_modules/zod/src/v3/tests/literal.test.ts create mode 100644 node_modules/zod/src/v3/tests/map.test.ts create mode 100644 node_modules/zod/src/v3/tests/masking.test.ts create mode 100644 node_modules/zod/src/v3/tests/mocker.test.ts create mode 100644 node_modules/zod/src/v3/tests/nan.test.ts create mode 100644 node_modules/zod/src/v3/tests/nativeEnum.test.ts create mode 100644 node_modules/zod/src/v3/tests/nullable.test.ts create mode 100644 node_modules/zod/src/v3/tests/number.test.ts create mode 100644 node_modules/zod/src/v3/tests/object-augmentation.test.ts create mode 100644 node_modules/zod/src/v3/tests/object-in-es5-env.test.ts create mode 100644 node_modules/zod/src/v3/tests/object.test.ts create mode 100644 node_modules/zod/src/v3/tests/optional.test.ts create mode 100644 node_modules/zod/src/v3/tests/parseUtil.test.ts create mode 100644 node_modules/zod/src/v3/tests/parser.test.ts create mode 100644 node_modules/zod/src/v3/tests/partials.test.ts create mode 100644 node_modules/zod/src/v3/tests/pickomit.test.ts create mode 100644 node_modules/zod/src/v3/tests/pipeline.test.ts create mode 100644 node_modules/zod/src/v3/tests/preprocess.test.ts create mode 100644 node_modules/zod/src/v3/tests/primitive.test.ts create mode 100644 node_modules/zod/src/v3/tests/promise.test.ts create mode 100644 node_modules/zod/src/v3/tests/readonly.test.ts create mode 100644 node_modules/zod/src/v3/tests/record.test.ts create mode 100644 node_modules/zod/src/v3/tests/recursive.test.ts create mode 100644 node_modules/zod/src/v3/tests/refine.test.ts create mode 100644 node_modules/zod/src/v3/tests/safeparse.test.ts create mode 100644 node_modules/zod/src/v3/tests/set.test.ts create mode 100644 node_modules/zod/src/v3/tests/standard-schema.test.ts create mode 100644 node_modules/zod/src/v3/tests/string.test.ts create mode 100644 node_modules/zod/src/v3/tests/transformer.test.ts create mode 100644 node_modules/zod/src/v3/tests/tuple.test.ts create mode 100644 node_modules/zod/src/v3/tests/unions.test.ts create mode 100644 node_modules/zod/src/v3/tests/validations.test.ts create mode 100644 node_modules/zod/src/v3/tests/void.test.ts create mode 100644 node_modules/zod/src/v3/types.ts create mode 100644 node_modules/zod/src/v4-mini/index.ts create mode 100644 node_modules/zod/src/v4/classic/checks.ts create mode 100644 node_modules/zod/src/v4/classic/coerce.ts create mode 100644 node_modules/zod/src/v4/classic/compat.ts create mode 100644 node_modules/zod/src/v4/classic/errors.ts create mode 100644 node_modules/zod/src/v4/classic/external.ts create mode 100644 node_modules/zod/src/v4/classic/index.ts create mode 100644 node_modules/zod/src/v4/classic/iso.ts create mode 100644 node_modules/zod/src/v4/classic/parse.ts create mode 100644 node_modules/zod/src/v4/classic/schemas.ts create mode 100644 node_modules/zod/src/v4/classic/tests/anyunknown.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/array.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/assignability.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/async-parsing.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/async-refinements.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/base.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/bigint.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/brand.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/catch.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/coalesce.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/coerce.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/continuability.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/custom.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/date.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/datetime.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/default.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/description.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/enum.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/error-utils.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/error.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/file.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/firstparty.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/function.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/generics.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/index.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/instanceof.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/intersection.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/json.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/lazy.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/literal.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/map.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/nan.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/nested-refine.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/nonoptional.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/nullable.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/number.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/object.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/optional.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/partial.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/pickomit.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/pipe.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/prefault.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/preprocess.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/primitive.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/promise.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/prototypes.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/readonly.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/record.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/recursive-types.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/refine.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/registries.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/set.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/standard-schema.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/string-formats.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/string.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/stringbool.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/template-literal.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/transform.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/tuple.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/union.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/validations.test.ts create mode 100644 node_modules/zod/src/v4/classic/tests/void.test.ts create mode 100644 node_modules/zod/src/v4/core/api.ts create mode 100644 node_modules/zod/src/v4/core/checks.ts create mode 100644 node_modules/zod/src/v4/core/config.ts create mode 100644 node_modules/zod/src/v4/core/core.ts create mode 100644 node_modules/zod/src/v4/core/doc.ts create mode 100644 node_modules/zod/src/v4/core/errors.ts create mode 100644 node_modules/zod/src/v4/core/function.ts create mode 100644 node_modules/zod/src/v4/core/index.ts create mode 100644 node_modules/zod/src/v4/core/json-schema.ts create mode 100644 node_modules/zod/src/v4/core/parse.ts create mode 100644 node_modules/zod/src/v4/core/regexes.ts create mode 100644 node_modules/zod/src/v4/core/registries.ts create mode 100644 node_modules/zod/src/v4/core/schemas.ts create mode 100644 node_modules/zod/src/v4/core/standard-schema.ts create mode 100644 node_modules/zod/src/v4/core/tests/index.test.ts create mode 100644 node_modules/zod/src/v4/core/tests/locales/be.test.ts create mode 100644 node_modules/zod/src/v4/core/tests/locales/en.test.ts create mode 100644 node_modules/zod/src/v4/core/tests/locales/ru.test.ts create mode 100644 node_modules/zod/src/v4/core/tests/locales/tr.test.ts create mode 100644 node_modules/zod/src/v4/core/to-json-schema.ts create mode 100644 node_modules/zod/src/v4/core/util.ts create mode 100644 node_modules/zod/src/v4/core/versions.ts create mode 100644 node_modules/zod/src/v4/core/zsf.ts create mode 100644 node_modules/zod/src/v4/index.ts create mode 100644 node_modules/zod/src/v4/locales/ar.ts create mode 100644 node_modules/zod/src/v4/locales/az.ts create mode 100644 node_modules/zod/src/v4/locales/be.ts create mode 100644 node_modules/zod/src/v4/locales/ca.ts create mode 100644 node_modules/zod/src/v4/locales/cs.ts create mode 100644 node_modules/zod/src/v4/locales/de.ts create mode 100644 node_modules/zod/src/v4/locales/en.ts create mode 100644 node_modules/zod/src/v4/locales/eo.ts create mode 100644 node_modules/zod/src/v4/locales/es.ts create mode 100644 node_modules/zod/src/v4/locales/fa.ts create mode 100644 node_modules/zod/src/v4/locales/fi.ts create mode 100644 node_modules/zod/src/v4/locales/fr-CA.ts create mode 100644 node_modules/zod/src/v4/locales/fr.ts create mode 100644 node_modules/zod/src/v4/locales/he.ts create mode 100644 node_modules/zod/src/v4/locales/hu.ts create mode 100644 node_modules/zod/src/v4/locales/id.ts create mode 100644 node_modules/zod/src/v4/locales/index.ts create mode 100644 node_modules/zod/src/v4/locales/it.ts create mode 100644 node_modules/zod/src/v4/locales/ja.ts create mode 100644 node_modules/zod/src/v4/locales/kh.ts create mode 100644 node_modules/zod/src/v4/locales/ko.ts create mode 100644 node_modules/zod/src/v4/locales/mk.ts create mode 100644 node_modules/zod/src/v4/locales/ms.ts create mode 100644 node_modules/zod/src/v4/locales/nl.ts create mode 100644 node_modules/zod/src/v4/locales/no.ts create mode 100644 node_modules/zod/src/v4/locales/ota.ts create mode 100644 node_modules/zod/src/v4/locales/pl.ts create mode 100644 node_modules/zod/src/v4/locales/ps.ts create mode 100644 node_modules/zod/src/v4/locales/pt.ts create mode 100644 node_modules/zod/src/v4/locales/ru.ts create mode 100644 node_modules/zod/src/v4/locales/sl.ts create mode 100644 node_modules/zod/src/v4/locales/sv.ts create mode 100644 node_modules/zod/src/v4/locales/ta.ts create mode 100644 node_modules/zod/src/v4/locales/th.ts create mode 100644 node_modules/zod/src/v4/locales/tr.ts create mode 100644 node_modules/zod/src/v4/locales/ua.ts create mode 100644 node_modules/zod/src/v4/locales/ur.ts create mode 100644 node_modules/zod/src/v4/locales/vi.ts create mode 100644 node_modules/zod/src/v4/locales/zh-CN.ts create mode 100644 node_modules/zod/src/v4/locales/zh-TW.ts create mode 100644 node_modules/zod/src/v4/mini/checks.ts create mode 100644 node_modules/zod/src/v4/mini/coerce.ts create mode 100644 node_modules/zod/src/v4/mini/external.ts create mode 100644 node_modules/zod/src/v4/mini/index.ts create mode 100644 node_modules/zod/src/v4/mini/iso.ts create mode 100644 node_modules/zod/src/v4/mini/parse.ts create mode 100644 node_modules/zod/src/v4/mini/schemas.ts create mode 100644 node_modules/zod/src/v4/mini/tests/assignability.test.ts create mode 100644 node_modules/zod/src/v4/mini/tests/brand.test.ts create mode 100644 node_modules/zod/src/v4/mini/tests/checks.test.ts create mode 100644 node_modules/zod/src/v4/mini/tests/computed.test.ts create mode 100644 node_modules/zod/src/v4/mini/tests/error.test.ts create mode 100644 node_modules/zod/src/v4/mini/tests/functions.test.ts create mode 100644 node_modules/zod/src/v4/mini/tests/index.test.ts create mode 100644 node_modules/zod/src/v4/mini/tests/number.test.ts create mode 100644 node_modules/zod/src/v4/mini/tests/object.test.ts create mode 100644 node_modules/zod/src/v4/mini/tests/prototypes.test.ts create mode 100644 node_modules/zod/src/v4/mini/tests/recursive-types.test.ts create mode 100644 node_modules/zod/src/v4/mini/tests/string.test.ts create mode 100644 node_modules/zod/v3/ZodError.cjs create mode 100644 node_modules/zod/v3/ZodError.d.cts create mode 100644 node_modules/zod/v3/ZodError.d.ts create mode 100644 node_modules/zod/v3/ZodError.js create mode 100644 node_modules/zod/v3/errors.cjs create mode 100644 node_modules/zod/v3/errors.d.cts create mode 100644 node_modules/zod/v3/errors.d.ts create mode 100644 node_modules/zod/v3/errors.js create mode 100644 node_modules/zod/v3/external.cjs create mode 100644 node_modules/zod/v3/external.d.cts create mode 100644 node_modules/zod/v3/external.d.ts create mode 100644 node_modules/zod/v3/external.js create mode 100644 node_modules/zod/v3/helpers/enumUtil.cjs create mode 100644 node_modules/zod/v3/helpers/enumUtil.d.cts create mode 100644 node_modules/zod/v3/helpers/enumUtil.d.ts create mode 100644 node_modules/zod/v3/helpers/enumUtil.js create mode 100644 node_modules/zod/v3/helpers/errorUtil.cjs create mode 100644 node_modules/zod/v3/helpers/errorUtil.d.cts create mode 100644 node_modules/zod/v3/helpers/errorUtil.d.ts create mode 100644 node_modules/zod/v3/helpers/errorUtil.js create mode 100644 node_modules/zod/v3/helpers/parseUtil.cjs create mode 100644 node_modules/zod/v3/helpers/parseUtil.d.cts create mode 100644 node_modules/zod/v3/helpers/parseUtil.d.ts create mode 100644 node_modules/zod/v3/helpers/parseUtil.js create mode 100644 node_modules/zod/v3/helpers/partialUtil.cjs create mode 100644 node_modules/zod/v3/helpers/partialUtil.d.cts create mode 100644 node_modules/zod/v3/helpers/partialUtil.d.ts create mode 100644 node_modules/zod/v3/helpers/partialUtil.js create mode 100644 node_modules/zod/v3/helpers/typeAliases.cjs create mode 100644 node_modules/zod/v3/helpers/typeAliases.d.cts create mode 100644 node_modules/zod/v3/helpers/typeAliases.d.ts create mode 100644 node_modules/zod/v3/helpers/typeAliases.js create mode 100644 node_modules/zod/v3/helpers/util.cjs create mode 100644 node_modules/zod/v3/helpers/util.d.cts create mode 100644 node_modules/zod/v3/helpers/util.d.ts create mode 100644 node_modules/zod/v3/helpers/util.js create mode 100644 node_modules/zod/v3/index.cjs create mode 100644 node_modules/zod/v3/index.d.cts create mode 100644 node_modules/zod/v3/index.d.ts create mode 100644 node_modules/zod/v3/index.js create mode 100644 node_modules/zod/v3/locales/en.cjs create mode 100644 node_modules/zod/v3/locales/en.d.cts create mode 100644 node_modules/zod/v3/locales/en.d.ts create mode 100644 node_modules/zod/v3/locales/en.js create mode 100644 node_modules/zod/v3/standard-schema.cjs create mode 100644 node_modules/zod/v3/standard-schema.d.cts create mode 100644 node_modules/zod/v3/standard-schema.d.ts create mode 100644 node_modules/zod/v3/standard-schema.js create mode 100644 node_modules/zod/v3/types.cjs create mode 100644 node_modules/zod/v3/types.d.cts create mode 100644 node_modules/zod/v3/types.d.ts create mode 100644 node_modules/zod/v3/types.js create mode 100644 node_modules/zod/v4-mini/index.cjs create mode 100644 node_modules/zod/v4-mini/index.d.cts create mode 100644 node_modules/zod/v4-mini/index.d.ts create mode 100644 node_modules/zod/v4-mini/index.js create mode 100644 node_modules/zod/v4/classic/checks.cjs create mode 100644 node_modules/zod/v4/classic/checks.d.cts create mode 100644 node_modules/zod/v4/classic/checks.d.ts create mode 100644 node_modules/zod/v4/classic/checks.js create mode 100644 node_modules/zod/v4/classic/coerce.cjs create mode 100644 node_modules/zod/v4/classic/coerce.d.cts create mode 100644 node_modules/zod/v4/classic/coerce.d.ts create mode 100644 node_modules/zod/v4/classic/coerce.js create mode 100644 node_modules/zod/v4/classic/compat.cjs create mode 100644 node_modules/zod/v4/classic/compat.d.cts create mode 100644 node_modules/zod/v4/classic/compat.d.ts create mode 100644 node_modules/zod/v4/classic/compat.js create mode 100644 node_modules/zod/v4/classic/errors.cjs create mode 100644 node_modules/zod/v4/classic/errors.d.cts create mode 100644 node_modules/zod/v4/classic/errors.d.ts create mode 100644 node_modules/zod/v4/classic/errors.js create mode 100644 node_modules/zod/v4/classic/external.cjs create mode 100644 node_modules/zod/v4/classic/external.d.cts create mode 100644 node_modules/zod/v4/classic/external.d.ts create mode 100644 node_modules/zod/v4/classic/external.js create mode 100644 node_modules/zod/v4/classic/index.cjs create mode 100644 node_modules/zod/v4/classic/index.d.cts create mode 100644 node_modules/zod/v4/classic/index.d.ts create mode 100644 node_modules/zod/v4/classic/index.js create mode 100644 node_modules/zod/v4/classic/iso.cjs create mode 100644 node_modules/zod/v4/classic/iso.d.cts create mode 100644 node_modules/zod/v4/classic/iso.d.ts create mode 100644 node_modules/zod/v4/classic/iso.js create mode 100644 node_modules/zod/v4/classic/parse.cjs create mode 100644 node_modules/zod/v4/classic/parse.d.cts create mode 100644 node_modules/zod/v4/classic/parse.d.ts create mode 100644 node_modules/zod/v4/classic/parse.js create mode 100644 node_modules/zod/v4/classic/schemas.cjs create mode 100644 node_modules/zod/v4/classic/schemas.d.cts create mode 100644 node_modules/zod/v4/classic/schemas.d.ts create mode 100644 node_modules/zod/v4/classic/schemas.js create mode 100644 node_modules/zod/v4/core/api.cjs create mode 100644 node_modules/zod/v4/core/api.d.cts create mode 100644 node_modules/zod/v4/core/api.d.ts create mode 100644 node_modules/zod/v4/core/api.js create mode 100644 node_modules/zod/v4/core/checks.cjs create mode 100644 node_modules/zod/v4/core/checks.d.cts create mode 100644 node_modules/zod/v4/core/checks.d.ts create mode 100644 node_modules/zod/v4/core/checks.js create mode 100644 node_modules/zod/v4/core/core.cjs create mode 100644 node_modules/zod/v4/core/core.d.cts create mode 100644 node_modules/zod/v4/core/core.d.ts create mode 100644 node_modules/zod/v4/core/core.js create mode 100644 node_modules/zod/v4/core/doc.cjs create mode 100644 node_modules/zod/v4/core/doc.d.cts create mode 100644 node_modules/zod/v4/core/doc.d.ts create mode 100644 node_modules/zod/v4/core/doc.js create mode 100644 node_modules/zod/v4/core/errors.cjs create mode 100644 node_modules/zod/v4/core/errors.d.cts create mode 100644 node_modules/zod/v4/core/errors.d.ts create mode 100644 node_modules/zod/v4/core/errors.js create mode 100644 node_modules/zod/v4/core/function.cjs create mode 100644 node_modules/zod/v4/core/function.d.cts create mode 100644 node_modules/zod/v4/core/function.d.ts create mode 100644 node_modules/zod/v4/core/function.js create mode 100644 node_modules/zod/v4/core/index.cjs create mode 100644 node_modules/zod/v4/core/index.d.cts create mode 100644 node_modules/zod/v4/core/index.d.ts create mode 100644 node_modules/zod/v4/core/index.js create mode 100644 node_modules/zod/v4/core/json-schema.cjs create mode 100644 node_modules/zod/v4/core/json-schema.d.cts create mode 100644 node_modules/zod/v4/core/json-schema.d.ts create mode 100644 node_modules/zod/v4/core/json-schema.js create mode 100644 node_modules/zod/v4/core/parse.cjs create mode 100644 node_modules/zod/v4/core/parse.d.cts create mode 100644 node_modules/zod/v4/core/parse.d.ts create mode 100644 node_modules/zod/v4/core/parse.js create mode 100644 node_modules/zod/v4/core/regexes.cjs create mode 100644 node_modules/zod/v4/core/regexes.d.cts create mode 100644 node_modules/zod/v4/core/regexes.d.ts create mode 100644 node_modules/zod/v4/core/regexes.js create mode 100644 node_modules/zod/v4/core/registries.cjs create mode 100644 node_modules/zod/v4/core/registries.d.cts create mode 100644 node_modules/zod/v4/core/registries.d.ts create mode 100644 node_modules/zod/v4/core/registries.js create mode 100644 node_modules/zod/v4/core/schemas.cjs create mode 100644 node_modules/zod/v4/core/schemas.d.cts create mode 100644 node_modules/zod/v4/core/schemas.d.ts create mode 100644 node_modules/zod/v4/core/schemas.js create mode 100644 node_modules/zod/v4/core/standard-schema.cjs create mode 100644 node_modules/zod/v4/core/standard-schema.d.cts create mode 100644 node_modules/zod/v4/core/standard-schema.d.ts create mode 100644 node_modules/zod/v4/core/standard-schema.js create mode 100644 node_modules/zod/v4/core/to-json-schema.cjs create mode 100644 node_modules/zod/v4/core/to-json-schema.d.cts create mode 100644 node_modules/zod/v4/core/to-json-schema.d.ts create mode 100644 node_modules/zod/v4/core/to-json-schema.js create mode 100644 node_modules/zod/v4/core/util.cjs create mode 100644 node_modules/zod/v4/core/util.d.cts create mode 100644 node_modules/zod/v4/core/util.d.ts create mode 100644 node_modules/zod/v4/core/util.js create mode 100644 node_modules/zod/v4/core/versions.cjs create mode 100644 node_modules/zod/v4/core/versions.d.cts create mode 100644 node_modules/zod/v4/core/versions.d.ts create mode 100644 node_modules/zod/v4/core/versions.js create mode 100644 node_modules/zod/v4/index.cjs create mode 100644 node_modules/zod/v4/index.d.cts create mode 100644 node_modules/zod/v4/index.d.ts create mode 100644 node_modules/zod/v4/index.js create mode 100644 node_modules/zod/v4/locales/ar.cjs create mode 100644 node_modules/zod/v4/locales/ar.d.cts create mode 100644 node_modules/zod/v4/locales/ar.d.ts create mode 100644 node_modules/zod/v4/locales/ar.js create mode 100644 node_modules/zod/v4/locales/az.cjs create mode 100644 node_modules/zod/v4/locales/az.d.cts create mode 100644 node_modules/zod/v4/locales/az.d.ts create mode 100644 node_modules/zod/v4/locales/az.js create mode 100644 node_modules/zod/v4/locales/be.cjs create mode 100644 node_modules/zod/v4/locales/be.d.cts create mode 100644 node_modules/zod/v4/locales/be.d.ts create mode 100644 node_modules/zod/v4/locales/be.js create mode 100644 node_modules/zod/v4/locales/ca.cjs create mode 100644 node_modules/zod/v4/locales/ca.d.cts create mode 100644 node_modules/zod/v4/locales/ca.d.ts create mode 100644 node_modules/zod/v4/locales/ca.js create mode 100644 node_modules/zod/v4/locales/cs.cjs create mode 100644 node_modules/zod/v4/locales/cs.d.cts create mode 100644 node_modules/zod/v4/locales/cs.d.ts create mode 100644 node_modules/zod/v4/locales/cs.js create mode 100644 node_modules/zod/v4/locales/de.cjs create mode 100644 node_modules/zod/v4/locales/de.d.cts create mode 100644 node_modules/zod/v4/locales/de.d.ts create mode 100644 node_modules/zod/v4/locales/de.js create mode 100644 node_modules/zod/v4/locales/en.cjs create mode 100644 node_modules/zod/v4/locales/en.d.cts create mode 100644 node_modules/zod/v4/locales/en.d.ts create mode 100644 node_modules/zod/v4/locales/en.js create mode 100644 node_modules/zod/v4/locales/eo.cjs create mode 100644 node_modules/zod/v4/locales/eo.d.cts create mode 100644 node_modules/zod/v4/locales/eo.d.ts create mode 100644 node_modules/zod/v4/locales/eo.js create mode 100644 node_modules/zod/v4/locales/es.cjs create mode 100644 node_modules/zod/v4/locales/es.d.cts create mode 100644 node_modules/zod/v4/locales/es.d.ts create mode 100644 node_modules/zod/v4/locales/es.js create mode 100644 node_modules/zod/v4/locales/fa.cjs create mode 100644 node_modules/zod/v4/locales/fa.d.cts create mode 100644 node_modules/zod/v4/locales/fa.d.ts create mode 100644 node_modules/zod/v4/locales/fa.js create mode 100644 node_modules/zod/v4/locales/fi.cjs create mode 100644 node_modules/zod/v4/locales/fi.d.cts create mode 100644 node_modules/zod/v4/locales/fi.d.ts create mode 100644 node_modules/zod/v4/locales/fi.js create mode 100644 node_modules/zod/v4/locales/fr-CA.cjs create mode 100644 node_modules/zod/v4/locales/fr-CA.d.cts create mode 100644 node_modules/zod/v4/locales/fr-CA.d.ts create mode 100644 node_modules/zod/v4/locales/fr-CA.js create mode 100644 node_modules/zod/v4/locales/fr.cjs create mode 100644 node_modules/zod/v4/locales/fr.d.cts create mode 100644 node_modules/zod/v4/locales/fr.d.ts create mode 100644 node_modules/zod/v4/locales/fr.js create mode 100644 node_modules/zod/v4/locales/he.cjs create mode 100644 node_modules/zod/v4/locales/he.d.cts create mode 100644 node_modules/zod/v4/locales/he.d.ts create mode 100644 node_modules/zod/v4/locales/he.js create mode 100644 node_modules/zod/v4/locales/hu.cjs create mode 100644 node_modules/zod/v4/locales/hu.d.cts create mode 100644 node_modules/zod/v4/locales/hu.d.ts create mode 100644 node_modules/zod/v4/locales/hu.js create mode 100644 node_modules/zod/v4/locales/id.cjs create mode 100644 node_modules/zod/v4/locales/id.d.cts create mode 100644 node_modules/zod/v4/locales/id.d.ts create mode 100644 node_modules/zod/v4/locales/id.js create mode 100644 node_modules/zod/v4/locales/index.cjs create mode 100644 node_modules/zod/v4/locales/index.d.cts create mode 100644 node_modules/zod/v4/locales/index.d.ts create mode 100644 node_modules/zod/v4/locales/index.js create mode 100644 node_modules/zod/v4/locales/it.cjs create mode 100644 node_modules/zod/v4/locales/it.d.cts create mode 100644 node_modules/zod/v4/locales/it.d.ts create mode 100644 node_modules/zod/v4/locales/it.js create mode 100644 node_modules/zod/v4/locales/ja.cjs create mode 100644 node_modules/zod/v4/locales/ja.d.cts create mode 100644 node_modules/zod/v4/locales/ja.d.ts create mode 100644 node_modules/zod/v4/locales/ja.js create mode 100644 node_modules/zod/v4/locales/kh.cjs create mode 100644 node_modules/zod/v4/locales/kh.d.cts create mode 100644 node_modules/zod/v4/locales/kh.d.ts create mode 100644 node_modules/zod/v4/locales/kh.js create mode 100644 node_modules/zod/v4/locales/ko.cjs create mode 100644 node_modules/zod/v4/locales/ko.d.cts create mode 100644 node_modules/zod/v4/locales/ko.d.ts create mode 100644 node_modules/zod/v4/locales/ko.js create mode 100644 node_modules/zod/v4/locales/mk.cjs create mode 100644 node_modules/zod/v4/locales/mk.d.cts create mode 100644 node_modules/zod/v4/locales/mk.d.ts create mode 100644 node_modules/zod/v4/locales/mk.js create mode 100644 node_modules/zod/v4/locales/ms.cjs create mode 100644 node_modules/zod/v4/locales/ms.d.cts create mode 100644 node_modules/zod/v4/locales/ms.d.ts create mode 100644 node_modules/zod/v4/locales/ms.js create mode 100644 node_modules/zod/v4/locales/nl.cjs create mode 100644 node_modules/zod/v4/locales/nl.d.cts create mode 100644 node_modules/zod/v4/locales/nl.d.ts create mode 100644 node_modules/zod/v4/locales/nl.js create mode 100644 node_modules/zod/v4/locales/no.cjs create mode 100644 node_modules/zod/v4/locales/no.d.cts create mode 100644 node_modules/zod/v4/locales/no.d.ts create mode 100644 node_modules/zod/v4/locales/no.js create mode 100644 node_modules/zod/v4/locales/ota.cjs create mode 100644 node_modules/zod/v4/locales/ota.d.cts create mode 100644 node_modules/zod/v4/locales/ota.d.ts create mode 100644 node_modules/zod/v4/locales/ota.js create mode 100644 node_modules/zod/v4/locales/pl.cjs create mode 100644 node_modules/zod/v4/locales/pl.d.cts create mode 100644 node_modules/zod/v4/locales/pl.d.ts create mode 100644 node_modules/zod/v4/locales/pl.js create mode 100644 node_modules/zod/v4/locales/ps.cjs create mode 100644 node_modules/zod/v4/locales/ps.d.cts create mode 100644 node_modules/zod/v4/locales/ps.d.ts create mode 100644 node_modules/zod/v4/locales/ps.js create mode 100644 node_modules/zod/v4/locales/pt.cjs create mode 100644 node_modules/zod/v4/locales/pt.d.cts create mode 100644 node_modules/zod/v4/locales/pt.d.ts create mode 100644 node_modules/zod/v4/locales/pt.js create mode 100644 node_modules/zod/v4/locales/ru.cjs create mode 100644 node_modules/zod/v4/locales/ru.d.cts create mode 100644 node_modules/zod/v4/locales/ru.d.ts create mode 100644 node_modules/zod/v4/locales/ru.js create mode 100644 node_modules/zod/v4/locales/sl.cjs create mode 100644 node_modules/zod/v4/locales/sl.d.cts create mode 100644 node_modules/zod/v4/locales/sl.d.ts create mode 100644 node_modules/zod/v4/locales/sl.js create mode 100644 node_modules/zod/v4/locales/sv.cjs create mode 100644 node_modules/zod/v4/locales/sv.d.cts create mode 100644 node_modules/zod/v4/locales/sv.d.ts create mode 100644 node_modules/zod/v4/locales/sv.js create mode 100644 node_modules/zod/v4/locales/ta.cjs create mode 100644 node_modules/zod/v4/locales/ta.d.cts create mode 100644 node_modules/zod/v4/locales/ta.d.ts create mode 100644 node_modules/zod/v4/locales/ta.js create mode 100644 node_modules/zod/v4/locales/th.cjs create mode 100644 node_modules/zod/v4/locales/th.d.cts create mode 100644 node_modules/zod/v4/locales/th.d.ts create mode 100644 node_modules/zod/v4/locales/th.js create mode 100644 node_modules/zod/v4/locales/tr.cjs create mode 100644 node_modules/zod/v4/locales/tr.d.cts create mode 100644 node_modules/zod/v4/locales/tr.d.ts create mode 100644 node_modules/zod/v4/locales/tr.js create mode 100644 node_modules/zod/v4/locales/ua.cjs create mode 100644 node_modules/zod/v4/locales/ua.d.cts create mode 100644 node_modules/zod/v4/locales/ua.d.ts create mode 100644 node_modules/zod/v4/locales/ua.js create mode 100644 node_modules/zod/v4/locales/ur.cjs create mode 100644 node_modules/zod/v4/locales/ur.d.cts create mode 100644 node_modules/zod/v4/locales/ur.d.ts create mode 100644 node_modules/zod/v4/locales/ur.js create mode 100644 node_modules/zod/v4/locales/vi.cjs create mode 100644 node_modules/zod/v4/locales/vi.d.cts create mode 100644 node_modules/zod/v4/locales/vi.d.ts create mode 100644 node_modules/zod/v4/locales/vi.js create mode 100644 node_modules/zod/v4/locales/zh-CN.cjs create mode 100644 node_modules/zod/v4/locales/zh-CN.d.cts create mode 100644 node_modules/zod/v4/locales/zh-CN.d.ts create mode 100644 node_modules/zod/v4/locales/zh-CN.js create mode 100644 node_modules/zod/v4/locales/zh-TW.cjs create mode 100644 node_modules/zod/v4/locales/zh-TW.d.cts create mode 100644 node_modules/zod/v4/locales/zh-TW.d.ts create mode 100644 node_modules/zod/v4/locales/zh-TW.js create mode 100644 node_modules/zod/v4/mini/checks.cjs create mode 100644 node_modules/zod/v4/mini/checks.d.cts create mode 100644 node_modules/zod/v4/mini/checks.d.ts create mode 100644 node_modules/zod/v4/mini/checks.js create mode 100644 node_modules/zod/v4/mini/coerce.cjs create mode 100644 node_modules/zod/v4/mini/coerce.d.cts create mode 100644 node_modules/zod/v4/mini/coerce.d.ts create mode 100644 node_modules/zod/v4/mini/coerce.js create mode 100644 node_modules/zod/v4/mini/external.cjs create mode 100644 node_modules/zod/v4/mini/external.d.cts create mode 100644 node_modules/zod/v4/mini/external.d.ts create mode 100644 node_modules/zod/v4/mini/external.js create mode 100644 node_modules/zod/v4/mini/index.cjs create mode 100644 node_modules/zod/v4/mini/index.d.cts create mode 100644 node_modules/zod/v4/mini/index.d.ts create mode 100644 node_modules/zod/v4/mini/index.js create mode 100644 node_modules/zod/v4/mini/iso.cjs create mode 100644 node_modules/zod/v4/mini/iso.d.cts create mode 100644 node_modules/zod/v4/mini/iso.d.ts create mode 100644 node_modules/zod/v4/mini/iso.js create mode 100644 node_modules/zod/v4/mini/parse.cjs create mode 100644 node_modules/zod/v4/mini/parse.d.cts create mode 100644 node_modules/zod/v4/mini/parse.d.ts create mode 100644 node_modules/zod/v4/mini/parse.js create mode 100644 node_modules/zod/v4/mini/schemas.cjs create mode 100644 node_modules/zod/v4/mini/schemas.d.cts create mode 100644 node_modules/zod/v4/mini/schemas.d.ts create mode 100644 node_modules/zod/v4/mini/schemas.js diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 0000000..c7d6919 --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,1225 @@ +{ + "name": "Diablo2TextEditor", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@modelcontextprotocol/sdk": { + "version": "1.17.3", + "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.17.3.tgz", + "integrity": "sha512-JPwUKWSsbzx+DLFznf/QZ32Qa+ptfbUlHhRLrBQBAFu9iI1iYvizM4p+zhhRDceSsPutXp4z+R/HPVphlIiclg==", + "license": "MIT", + "dependencies": { + "ajv": "^6.12.6", + "content-type": "^1.0.5", + "cors": "^2.8.5", + "cross-spawn": "^7.0.5", + "eventsource": "^3.0.2", + "eventsource-parser": "^3.0.0", + "express": "^5.0.1", + "express-rate-limit": "^7.5.0", + "pkce-challenge": "^5.0.0", + "raw-body": "^3.0.0", + "zod": "^3.23.8", + "zod-to-json-schema": "^3.24.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/eventsource": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.7.tgz", + "integrity": "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==", + "license": "MIT", + "dependencies": { + "eventsource-parser": "^3.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.0.tgz", + "integrity": "sha512-TKY5pyBkHyADOPYlRT9Lx6F544mPl0vS5Ew7BJ45hA08Q+t3GjbueLliBWN3sMICk6+y7HdyxSzC4bWS8baBdg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/body-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.0.tgz", + "integrity": "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.0", + "http-errors": "^2.0.0", + "iconv-lite": "^0.6.3", + "on-finished": "^2.4.1", + "qs": "^6.14.0", + "raw-body": "^3.0.0", + "type-is": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/cliui": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-9.0.1.tgz", + "integrity": "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==", + "license": "ISC", + "dependencies": { + "string-width": "^7.2.0", + "strip-ansi": "^7.1.0", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/content-disposition": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.0.tgz", + "integrity": "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.4.0.tgz", + "integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eventsource": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-4.0.0.tgz", + "integrity": "sha512-fvIkb9qZzdMxgZrEQDyll+9oJsyaVvY92I2Re+qK0qEJ+w5s0X3dtz+M0VAPOjP1gtU3iqWyjQ0G3nvd5CLZ2g==", + "license": "MIT", + "dependencies": { + "eventsource-parser": "^3.0.1" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/eventsource-parser": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.0.5.tgz", + "integrity": "sha512-bSRG85ZrMdmWtm7qkF9He9TNRzc/Bm99gEJMaQoHJ9E6Kv9QBbsldh2oMj7iXmYNEAVvNgvv5vPorG6W+XtBhQ==", + "license": "MIT", + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/express": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz", + "integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.0", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express-rate-limit": { + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-7.5.1.tgz", + "integrity": "sha512-7iN8iPMDzOMHPUYllBEsQdWVB6fPDMPqwjBaFrgr4Jgr/+okjvzAy+UHlYYL/Vs0OsOrMkwS6PJDkFlJwoxUnw==", + "license": "MIT", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": ">= 4.11" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "license": "MIT" + }, + "node_modules/finalhandler": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.0.tgz", + "integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-east-asian-width": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.3.0.tgz", + "integrity": "sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "license": "MIT", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/http-errors/node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "license": "MIT" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/mcp-proxy": { + "version": "5.5.5", + "resolved": "https://registry.npmjs.org/mcp-proxy/-/mcp-proxy-5.5.5.tgz", + "integrity": "sha512-x6mFxhqjmNB/oXsqh3ITaqg8TZyJKmYxUGsC/Bt7x4Hz21B5WRw8YQagvPfPbyQlXSKUoxSoBlaf/LTYu8PJHw==", + "license": "MIT", + "dependencies": { + "@modelcontextprotocol/sdk": "^1.17.3", + "eventsource": "^4.0.0", + "yargs": "^18.0.0" + }, + "bin": { + "mcp-proxy": "dist/bin/mcp-proxy.js" + } + }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz", + "integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.2.0.tgz", + "integrity": "sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==", + "license": "MIT", + "engines": { + "node": ">=16" + } + }, + "node_modules/pkce-challenge": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.0.tgz", + "integrity": "sha512-ueGLflrrnvwB3xuo/uGob5pd5FN7l0MsLf0Z87o/UQmRtwjvfylfc9MurIxRAWywCYTgrvpXBcqjV4OfCYGCIQ==", + "license": "MIT", + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/qs": { + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", + "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.0.tgz", + "integrity": "sha512-RmkhL8CAyCRPXCE28MMH0z2PNWQBNk2Q09ZdxM9IOOXwxwZbN+qbWaatPkdkWIKL2ZVDImrN/pK5HTRz2PcS4g==", + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.6.3", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/send": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz", + "integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==", + "license": "MIT", + "dependencies": { + "debug": "^4.3.5", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "mime-types": "^3.0.1", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/serve-static": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz", + "integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.0.tgz", + "integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-18.0.0.tgz", + "integrity": "sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg==", + "license": "MIT", + "dependencies": { + "cliui": "^9.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "string-width": "^7.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^22.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=23" + } + }, + "node_modules/yargs-parser": { + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz", + "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==", + "license": "ISC", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=23" + } + }, + "node_modules/zod": { + "version": "3.25.76", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", + "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-to-json-schema": { + "version": "3.24.6", + "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.6.tgz", + "integrity": "sha512-h/z3PKvcTcTetyjl1fkj79MHNEjm+HpD6NXheWjzOekY7kV+lwDYnHw+ivHkijnCSMz1yJaWBD9vu/Fcmk+vEg==", + "license": "ISC", + "peerDependencies": { + "zod": "^3.24.1" + } + } + } +} diff --git a/node_modules/@modelcontextprotocol/sdk/LICENSE b/node_modules/@modelcontextprotocol/sdk/LICENSE new file mode 100644 index 0000000..3d48435 --- /dev/null +++ b/node_modules/@modelcontextprotocol/sdk/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Anthropic, PBC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@modelcontextprotocol/sdk/README.md b/node_modules/@modelcontextprotocol/sdk/README.md new file mode 100644 index 0000000..cee7eb8 --- /dev/null +++ b/node_modules/@modelcontextprotocol/sdk/README.md @@ -0,0 +1,1323 @@ +# MCP TypeScript SDK ![NPM Version](https://img.shields.io/npm/v/%40modelcontextprotocol%2Fsdk) ![MIT licensed](https://img.shields.io/npm/l/%40modelcontextprotocol%2Fsdk) + +## Table of Contents + +- [Overview](#overview) +- [Installation](#installation) +- [Quickstart](#quick-start) +- [What is MCP?](#what-is-mcp) +- [Core Concepts](#core-concepts) + - [Server](#server) + - [Resources](#resources) + - [Tools](#tools) + - [Prompts](#prompts) + - [Completions](#completions) + - [Sampling](#sampling) +- [Running Your Server](#running-your-server) + - [stdio](#stdio) + - [Streamable HTTP](#streamable-http) + - [Testing and Debugging](#testing-and-debugging) +- [Examples](#examples) + - [Echo Server](#echo-server) + - [SQLite Explorer](#sqlite-explorer) +- [Advanced Usage](#advanced-usage) + - [Dynamic Servers](#dynamic-servers) + - [Low-Level Server](#low-level-server) + - [Writing MCP Clients](#writing-mcp-clients) + - [Proxy Authorization Requests Upstream](#proxy-authorization-requests-upstream) + - [Backwards Compatibility](#backwards-compatibility) +- [Documentation](#documentation) +- [Contributing](#contributing) +- [License](#license) + +## Overview + +The Model Context Protocol allows applications to provide context for LLMs in a standardized way, separating the concerns of providing context from the actual LLM interaction. This TypeScript SDK implements the full MCP specification, making it easy to: + +- Build MCP clients that can connect to any MCP server +- Create MCP servers that expose resources, prompts and tools +- Use standard transports like stdio and Streamable HTTP +- Handle all MCP protocol messages and lifecycle events + +## Installation + +```bash +npm install @modelcontextprotocol/sdk +``` + +> ⚠️ MCP requires Node.js v18.x or higher to work fine. + +## Quick Start + +Let's create a simple MCP server that exposes a calculator tool and some data: + +```typescript +import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; +import { z } from "zod"; + +// Create an MCP server +const server = new McpServer({ + name: "demo-server", + version: "1.0.0" +}); + +// Add an addition tool +server.registerTool("add", + { + title: "Addition Tool", + description: "Add two numbers", + inputSchema: { a: z.number(), b: z.number() } + }, + async ({ a, b }) => ({ + content: [{ type: "text", text: String(a + b) }] + }) +); + +// Add a dynamic greeting resource +server.registerResource( + "greeting", + new ResourceTemplate("greeting://{name}", { list: undefined }), + { + title: "Greeting Resource", // Display name for UI + description: "Dynamic greeting generator" + }, + async (uri, { name }) => ({ + contents: [{ + uri: uri.href, + text: `Hello, ${name}!` + }] + }) +); + +// Start receiving messages on stdin and sending messages on stdout +const transport = new StdioServerTransport(); +await server.connect(transport); +``` + +## What is MCP? + +The [Model Context Protocol (MCP)](https://modelcontextprotocol.io) lets you build servers that expose data and functionality to LLM applications in a secure, standardized way. Think of it like a web API, but specifically designed for LLM interactions. MCP servers can: + +- Expose data through **Resources** (think of these sort of like GET endpoints; they are used to load information into the LLM's context) +- Provide functionality through **Tools** (sort of like POST endpoints; they are used to execute code or otherwise produce a side effect) +- Define interaction patterns through **Prompts** (reusable templates for LLM interactions) +- And more! + +## Core Concepts + +### Server + +The McpServer is your core interface to the MCP protocol. It handles connection management, protocol compliance, and message routing: + +```typescript +const server = new McpServer({ + name: "my-app", + version: "1.0.0" +}); +``` + +### Resources + +Resources are how you expose data to LLMs. They're similar to GET endpoints in a REST API - they provide data but shouldn't perform significant computation or have side effects: + +```typescript +// Static resource +server.registerResource( + "config", + "config://app", + { + title: "Application Config", + description: "Application configuration data", + mimeType: "text/plain" + }, + async (uri) => ({ + contents: [{ + uri: uri.href, + text: "App configuration here" + }] + }) +); + +// Dynamic resource with parameters +server.registerResource( + "user-profile", + new ResourceTemplate("users://{userId}/profile", { list: undefined }), + { + title: "User Profile", + description: "User profile information" + }, + async (uri, { userId }) => ({ + contents: [{ + uri: uri.href, + text: `Profile data for user ${userId}` + }] + }) +); + +// Resource with context-aware completion +server.registerResource( + "repository", + new ResourceTemplate("github://repos/{owner}/{repo}", { + list: undefined, + complete: { + // Provide intelligent completions based on previously resolved parameters + repo: (value, context) => { + if (context?.arguments?.["owner"] === "org1") { + return ["project1", "project2", "project3"].filter(r => r.startsWith(value)); + } + return ["default-repo"].filter(r => r.startsWith(value)); + } + } + }), + { + title: "GitHub Repository", + description: "Repository information" + }, + async (uri, { owner, repo }) => ({ + contents: [{ + uri: uri.href, + text: `Repository: ${owner}/${repo}` + }] + }) +); +``` + +### Tools + +Tools let LLMs take actions through your server. Unlike resources, tools are expected to perform computation and have side effects: + +```typescript +// Simple tool with parameters +server.registerTool( + "calculate-bmi", + { + title: "BMI Calculator", + description: "Calculate Body Mass Index", + inputSchema: { + weightKg: z.number(), + heightM: z.number() + } + }, + async ({ weightKg, heightM }) => ({ + content: [{ + type: "text", + text: String(weightKg / (heightM * heightM)) + }] + }) +); + +// Async tool with external API call +server.registerTool( + "fetch-weather", + { + title: "Weather Fetcher", + description: "Get weather data for a city", + inputSchema: { city: z.string() } + }, + async ({ city }) => { + const response = await fetch(`https://api.weather.com/${city}`); + const data = await response.text(); + return { + content: [{ type: "text", text: data }] + }; + } +); + +// Tool that returns ResourceLinks +server.registerTool( + "list-files", + { + title: "List Files", + description: "List project files", + inputSchema: { pattern: z.string() } + }, + async ({ pattern }) => ({ + content: [ + { type: "text", text: `Found files matching "${pattern}":` }, + // ResourceLinks let tools return references without file content + { + type: "resource_link", + uri: "file:///project/README.md", + name: "README.md", + mimeType: "text/markdown", + description: 'A README file' + }, + { + type: "resource_link", + uri: "file:///project/src/index.ts", + name: "index.ts", + mimeType: "text/typescript", + description: 'An index file' + } + ] + }) +); +``` + +#### ResourceLinks + +Tools can return `ResourceLink` objects to reference resources without embedding their full content. This is essential for performance when dealing with large files or many resources - clients can then selectively read only the resources they need using the provided URIs. + +### Prompts + +Prompts are reusable templates that help LLMs interact with your server effectively: + +```typescript +import { completable } from "@modelcontextprotocol/sdk/server/completable.js"; + +server.registerPrompt( + "review-code", + { + title: "Code Review", + description: "Review code for best practices and potential issues", + argsSchema: { code: z.string() } + }, + ({ code }) => ({ + messages: [{ + role: "user", + content: { + type: "text", + text: `Please review this code:\n\n${code}` + } + }] + }) +); + +// Prompt with context-aware completion +server.registerPrompt( + "team-greeting", + { + title: "Team Greeting", + description: "Generate a greeting for team members", + argsSchema: { + department: completable(z.string(), (value) => { + // Department suggestions + return ["engineering", "sales", "marketing", "support"].filter(d => d.startsWith(value)); + }), + name: completable(z.string(), (value, context) => { + // Name suggestions based on selected department + const department = context?.arguments?.["department"]; + if (department === "engineering") { + return ["Alice", "Bob", "Charlie"].filter(n => n.startsWith(value)); + } else if (department === "sales") { + return ["David", "Eve", "Frank"].filter(n => n.startsWith(value)); + } else if (department === "marketing") { + return ["Grace", "Henry", "Iris"].filter(n => n.startsWith(value)); + } + return ["Guest"].filter(n => n.startsWith(value)); + }) + } + }, + ({ department, name }) => ({ + messages: [{ + role: "assistant", + content: { + type: "text", + text: `Hello ${name}, welcome to the ${department} team!` + } + }] + }) +); +``` + +### Completions + +MCP supports argument completions to help users fill in prompt arguments and resource template parameters. See the examples above for [resource completions](#resources) and [prompt completions](#prompts). + +#### Client Usage + +```typescript +// Request completions for any argument +const result = await client.complete({ + ref: { + type: "ref/prompt", // or "ref/resource" + name: "example" // or uri: "template://..." + }, + argument: { + name: "argumentName", + value: "partial" // What the user has typed so far + }, + context: { // Optional: Include previously resolved arguments + arguments: { + previousArg: "value" + } + } +}); + +``` + +### Display Names and Metadata + +All resources, tools, and prompts support an optional `title` field for better UI presentation. The `title` is used as a display name, while `name` remains the unique identifier. + +**Note:** The `register*` methods (`registerTool`, `registerPrompt`, `registerResource`) are the recommended approach for new code. The older methods (`tool`, `prompt`, `resource`) remain available for backwards compatibility. + +#### Title Precedence for Tools + +For tools specifically, there are two ways to specify a title: +- `title` field in the tool configuration +- `annotations.title` field (when using the older `tool()` method with annotations) + +The precedence order is: `title` → `annotations.title` → `name` + +```typescript +// Using registerTool (recommended) +server.registerTool("my_tool", { + title: "My Tool", // This title takes precedence + annotations: { + title: "Annotation Title" // This is ignored if title is set + } +}, handler); + +// Using tool with annotations (older API) +server.tool("my_tool", "description", { + title: "Annotation Title" // This is used as title +}, handler); +``` + +When building clients, use the provided utility to get the appropriate display name: + +```typescript +import { getDisplayName } from "@modelcontextprotocol/sdk/shared/metadataUtils.js"; + +// Automatically handles the precedence: title → annotations.title → name +const displayName = getDisplayName(tool); +``` + +### Sampling + +MCP servers can request LLM completions from connected clients that support sampling. + +```typescript +import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; +import { z } from "zod"; + +const mcpServer = new McpServer({ + name: "tools-with-sample-server", + version: "1.0.0", +}); + +// Tool that uses LLM sampling to summarize any text +mcpServer.registerTool( + "summarize", + { + description: "Summarize any text using an LLM", + inputSchema: { + text: z.string().describe("Text to summarize"), + }, + }, + async ({ text }) => { + // Call the LLM through MCP sampling + const response = await mcpServer.server.createMessage({ + messages: [ + { + role: "user", + content: { + type: "text", + text: `Please summarize the following text concisely:\n\n${text}`, + }, + }, + ], + maxTokens: 500, + }); + + return { + content: [ + { + type: "text", + text: response.content.type === "text" ? response.content.text : "Unable to generate summary", + }, + ], + }; + } +); + +async function main() { + const transport = new StdioServerTransport(); + await mcpServer.connect(transport); + console.log("MCP server is running..."); +} + +main().catch((error) => { + console.error("Server error:", error); + process.exit(1); +}); +``` + + +## Running Your Server + +MCP servers in TypeScript need to be connected to a transport to communicate with clients. How you start the server depends on the choice of transport: + +### stdio + +For command-line tools and direct integrations: + +```typescript +import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; + +const server = new McpServer({ + name: "example-server", + version: "1.0.0" +}); + +// ... set up server resources, tools, and prompts ... + +const transport = new StdioServerTransport(); +await server.connect(transport); +``` + +### Streamable HTTP + +For remote servers, set up a Streamable HTTP transport that handles both client requests and server-to-client notifications. + +#### With Session Management + +In some cases, servers need to be stateful. This is achieved by [session management](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#session-management). + +```typescript +import express from "express"; +import { randomUUID } from "node:crypto"; +import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js"; +import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js" + + + +const app = express(); +app.use(express.json()); + +// Map to store transports by session ID +const transports: { [sessionId: string]: StreamableHTTPServerTransport } = {}; + +// Handle POST requests for client-to-server communication +app.post('/mcp', async (req, res) => { + // Check for existing session ID + const sessionId = req.headers['mcp-session-id'] as string | undefined; + let transport: StreamableHTTPServerTransport; + + if (sessionId && transports[sessionId]) { + // Reuse existing transport + transport = transports[sessionId]; + } else if (!sessionId && isInitializeRequest(req.body)) { + // New initialization request + transport = new StreamableHTTPServerTransport({ + sessionIdGenerator: () => randomUUID(), + onsessioninitialized: (sessionId) => { + // Store the transport by session ID + transports[sessionId] = transport; + }, + // DNS rebinding protection is disabled by default for backwards compatibility. If you are running this server + // locally, make sure to set: + // enableDnsRebindingProtection: true, + // allowedHosts: ['127.0.0.1'], + }); + + // Clean up transport when closed + transport.onclose = () => { + if (transport.sessionId) { + delete transports[transport.sessionId]; + } + }; + const server = new McpServer({ + name: "example-server", + version: "1.0.0" + }); + + // ... set up server resources, tools, and prompts ... + + // Connect to the MCP server + await server.connect(transport); + } else { + // Invalid request + res.status(400).json({ + jsonrpc: '2.0', + error: { + code: -32000, + message: 'Bad Request: No valid session ID provided', + }, + id: null, + }); + return; + } + + // Handle the request + await transport.handleRequest(req, res, req.body); +}); + +// Reusable handler for GET and DELETE requests +const handleSessionRequest = async (req: express.Request, res: express.Response) => { + const sessionId = req.headers['mcp-session-id'] as string | undefined; + if (!sessionId || !transports[sessionId]) { + res.status(400).send('Invalid or missing session ID'); + return; + } + + const transport = transports[sessionId]; + await transport.handleRequest(req, res); +}; + +// Handle GET requests for server-to-client notifications via SSE +app.get('/mcp', handleSessionRequest); + +// Handle DELETE requests for session termination +app.delete('/mcp', handleSessionRequest); + +app.listen(3000); +``` + +> [!TIP] +> When using this in a remote environment, make sure to allow the header parameter `mcp-session-id` in CORS. Otherwise, it may result in a `Bad Request: No valid session ID provided` error. Read the following section for examples. + + +#### CORS Configuration for Browser-Based Clients + +If you'd like your server to be accessible by browser-based MCP clients, you'll need to configure CORS headers. The `Mcp-Session-Id` header must be exposed for browser clients to access it: + +```typescript +import cors from 'cors'; + +// Add CORS middleware before your MCP routes +app.use(cors({ + origin: '*', // Configure appropriately for production, for example: + // origin: ['https://your-remote-domain.com', 'https://your-other-remote-domain.com'], + exposedHeaders: ['Mcp-Session-Id'], + allowedHeaders: ['Content-Type', 'mcp-session-id'], +})); +``` + +This configuration is necessary because: +- The MCP streamable HTTP transport uses the `Mcp-Session-Id` header for session management +- Browsers restrict access to response headers unless explicitly exposed via CORS +- Without this configuration, browser-based clients won't be able to read the session ID from initialization responses + +#### Without Session Management (Stateless) + +For simpler use cases where session management isn't needed: + +```typescript +const app = express(); +app.use(express.json()); + +app.post('/mcp', async (req: Request, res: Response) => { + // In stateless mode, create a new instance of transport and server for each request + // to ensure complete isolation. A single instance would cause request ID collisions + // when multiple clients connect concurrently. + + try { + const server = getServer(); + const transport: StreamableHTTPServerTransport = new StreamableHTTPServerTransport({ + sessionIdGenerator: undefined, + }); + res.on('close', () => { + console.log('Request closed'); + transport.close(); + server.close(); + }); + await server.connect(transport); + await transport.handleRequest(req, res, req.body); + } catch (error) { + console.error('Error handling MCP request:', error); + if (!res.headersSent) { + res.status(500).json({ + jsonrpc: '2.0', + error: { + code: -32603, + message: 'Internal server error', + }, + id: null, + }); + } + } +}); + +// SSE notifications not supported in stateless mode +app.get('/mcp', async (req: Request, res: Response) => { + console.log('Received GET MCP request'); + res.writeHead(405).end(JSON.stringify({ + jsonrpc: "2.0", + error: { + code: -32000, + message: "Method not allowed." + }, + id: null + })); +}); + +// Session termination not needed in stateless mode +app.delete('/mcp', async (req: Request, res: Response) => { + console.log('Received DELETE MCP request'); + res.writeHead(405).end(JSON.stringify({ + jsonrpc: "2.0", + error: { + code: -32000, + message: "Method not allowed." + }, + id: null + })); +}); + + +// Start the server +const PORT = 3000; +setupServer().then(() => { + app.listen(PORT, (error) => { + if (error) { + console.error('Failed to start server:', error); + process.exit(1); + } + console.log(`MCP Stateless Streamable HTTP Server listening on port ${PORT}`); + }); +}).catch(error => { + console.error('Failed to set up the server:', error); + process.exit(1); +}); + +``` + +This stateless approach is useful for: + +- Simple API wrappers +- RESTful scenarios where each request is independent +- Horizontally scaled deployments without shared session state + +#### DNS Rebinding Protection + +The Streamable HTTP transport includes DNS rebinding protection to prevent security vulnerabilities. By default, this protection is **disabled** for backwards compatibility. + +**Important**: If you are running this server locally, enable DNS rebinding protection: + +```typescript +const transport = new StreamableHTTPServerTransport({ + sessionIdGenerator: () => randomUUID(), + enableDnsRebindingProtection: true, + + allowedHosts: ['127.0.0.1', ...], + allowedOrigins: ['https://yourdomain.com', 'https://www.yourdomain.com'] +}); +``` + +### Testing and Debugging + +To test your server, you can use the [MCP Inspector](https://github.com/modelcontextprotocol/inspector). See its README for more information. + +## Examples + +### Echo Server + +A simple server demonstrating resources, tools, and prompts: + +```typescript +import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { z } from "zod"; + +const server = new McpServer({ + name: "echo-server", + version: "1.0.0" +}); + +server.registerResource( + "echo", + new ResourceTemplate("echo://{message}", { list: undefined }), + { + title: "Echo Resource", + description: "Echoes back messages as resources" + }, + async (uri, { message }) => ({ + contents: [{ + uri: uri.href, + text: `Resource echo: ${message}` + }] + }) +); + +server.registerTool( + "echo", + { + title: "Echo Tool", + description: "Echoes back the provided message", + inputSchema: { message: z.string() } + }, + async ({ message }) => ({ + content: [{ type: "text", text: `Tool echo: ${message}` }] + }) +); + +server.registerPrompt( + "echo", + { + title: "Echo Prompt", + description: "Creates a prompt to process a message", + argsSchema: { message: z.string() } + }, + ({ message }) => ({ + messages: [{ + role: "user", + content: { + type: "text", + text: `Please process this message: ${message}` + } + }] + }) +); +``` + +### SQLite Explorer + +A more complex example showing database integration: + +```typescript +import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import sqlite3 from "sqlite3"; +import { promisify } from "util"; +import { z } from "zod"; + +const server = new McpServer({ + name: "sqlite-explorer", + version: "1.0.0" +}); + +// Helper to create DB connection +const getDb = () => { + const db = new sqlite3.Database("database.db"); + return { + all: promisify(db.all.bind(db)), + close: promisify(db.close.bind(db)) + }; +}; + +server.registerResource( + "schema", + "schema://main", + { + title: "Database Schema", + description: "SQLite database schema", + mimeType: "text/plain" + }, + async (uri) => { + const db = getDb(); + try { + const tables = await db.all( + "SELECT sql FROM sqlite_master WHERE type='table'" + ); + return { + contents: [{ + uri: uri.href, + text: tables.map((t: {sql: string}) => t.sql).join("\n") + }] + }; + } finally { + await db.close(); + } + } +); + +server.registerTool( + "query", + { + title: "SQL Query", + description: "Execute SQL queries on the database", + inputSchema: { sql: z.string() } + }, + async ({ sql }) => { + const db = getDb(); + try { + const results = await db.all(sql); + return { + content: [{ + type: "text", + text: JSON.stringify(results, null, 2) + }] + }; + } catch (err: unknown) { + const error = err as Error; + return { + content: [{ + type: "text", + text: `Error: ${error.message}` + }], + isError: true + }; + } finally { + await db.close(); + } + } +); +``` + +## Advanced Usage + +### Dynamic Servers + +If you want to offer an initial set of tools/prompts/resources, but later add additional ones based on user action or external state change, you can add/update/remove them _after_ the Server is connected. This will automatically emit the corresponding `listChanged` notifications: + +```ts +import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { z } from "zod"; + +const server = new McpServer({ + name: "Dynamic Example", + version: "1.0.0" +}); + +const listMessageTool = server.tool( + "listMessages", + { channel: z.string() }, + async ({ channel }) => ({ + content: [{ type: "text", text: await listMessages(channel) }] + }) +); + +const putMessageTool = server.tool( + "putMessage", + { channel: z.string(), message: z.string() }, + async ({ channel, message }) => ({ + content: [{ type: "text", text: await putMessage(channel, message) }] + }) +); +// Until we upgrade auth, `putMessage` is disabled (won't show up in listTools) +putMessageTool.disable() + +const upgradeAuthTool = server.tool( + "upgradeAuth", + { permission: z.enum(["write", "admin"])}, + // Any mutations here will automatically emit `listChanged` notifications + async ({ permission }) => { + const { ok, err, previous } = await upgradeAuthAndStoreToken(permission) + if (!ok) return {content: [{ type: "text", text: `Error: ${err}` }]} + + // If we previously had read-only access, 'putMessage' is now available + if (previous === "read") { + putMessageTool.enable() + } + + if (permission === 'write') { + // If we've just upgraded to 'write' permissions, we can still call 'upgradeAuth' + // but can only upgrade to 'admin'. + upgradeAuthTool.update({ + paramsSchema: { permission: z.enum(["admin"]) }, // change validation rules + }) + } else { + // If we're now an admin, we no longer have anywhere to upgrade to, so fully remove that tool + upgradeAuthTool.remove() + } + } +) + +// Connect as normal +const transport = new StdioServerTransport(); +await server.connect(transport); +``` + +### Improving Network Efficiency with Notification Debouncing + +When performing bulk updates that trigger notifications (e.g., enabling or disabling multiple tools in a loop), the SDK can send a large number of messages in a short period. To improve performance and reduce network traffic, you can enable notification debouncing. + +This feature coalesces multiple, rapid calls for the same notification type into a single message. For example, if you disable five tools in a row, only one `notifications/tools/list_changed` message will be sent instead of five. + +> [!IMPORTANT] +> This feature is designed for "simple" notifications that do not carry unique data in their parameters. To prevent silent data loss, debouncing is **automatically bypassed** for any notification that contains a `params` object or a `relatedRequestId`. Such notifications will always be sent immediately. + +This is an opt-in feature configured during server initialization. + +```typescript +import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; + +const server = new McpServer( + { + name: "efficient-server", + version: "1.0.0" + }, + { + // Enable notification debouncing for specific methods + debouncedNotificationMethods: [ + 'notifications/tools/list_changed', + 'notifications/resources/list_changed', + 'notifications/prompts/list_changed' + ] + } +); + +// Now, any rapid changes to tools, resources, or prompts will result +// in a single, consolidated notification for each type. +server.registerTool("tool1", ...).disable(); +server.registerTool("tool2", ...).disable(); +server.registerTool("tool3", ...).disable(); +// Only one 'notifications/tools/list_changed' is sent. +``` + +### Low-Level Server + +For more control, you can use the low-level Server class directly: + +```typescript +import { Server } from "@modelcontextprotocol/sdk/server/index.js"; +import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; +import { + ListPromptsRequestSchema, + GetPromptRequestSchema +} from "@modelcontextprotocol/sdk/types.js"; + +const server = new Server( + { + name: "example-server", + version: "1.0.0" + }, + { + capabilities: { + prompts: {} + } + } +); + +server.setRequestHandler(ListPromptsRequestSchema, async () => { + return { + prompts: [{ + name: "example-prompt", + description: "An example prompt template", + arguments: [{ + name: "arg1", + description: "Example argument", + required: true + }] + }] + }; +}); + +server.setRequestHandler(GetPromptRequestSchema, async (request) => { + if (request.params.name !== "example-prompt") { + throw new Error("Unknown prompt"); + } + return { + description: "Example prompt", + messages: [{ + role: "user", + content: { + type: "text", + text: "Example prompt text" + } + }] + }; +}); + +const transport = new StdioServerTransport(); +await server.connect(transport); +``` + +### Eliciting User Input + +MCP servers can request additional information from users through the elicitation feature. This is useful for interactive workflows where the server needs user input or confirmation: + +```typescript +// Server-side: Restaurant booking tool that asks for alternatives +server.tool( + "book-restaurant", + { + restaurant: z.string(), + date: z.string(), + partySize: z.number() + }, + async ({ restaurant, date, partySize }) => { + // Check availability + const available = await checkAvailability(restaurant, date, partySize); + + if (!available) { + // Ask user if they want to try alternative dates + const result = await server.server.elicitInput({ + message: `No tables available at ${restaurant} on ${date}. Would you like to check alternative dates?`, + requestedSchema: { + type: "object", + properties: { + checkAlternatives: { + type: "boolean", + title: "Check alternative dates", + description: "Would you like me to check other dates?" + }, + flexibleDates: { + type: "string", + title: "Date flexibility", + description: "How flexible are your dates?", + enum: ["next_day", "same_week", "next_week"], + enumNames: ["Next day", "Same week", "Next week"] + } + }, + required: ["checkAlternatives"] + } + }); + + if (result.action === "accept" && result.content?.checkAlternatives) { + const alternatives = await findAlternatives( + restaurant, + date, + partySize, + result.content.flexibleDates as string + ); + return { + content: [{ + type: "text", + text: `Found these alternatives: ${alternatives.join(", ")}` + }] + }; + } + + return { + content: [{ + type: "text", + text: "No booking made. Original date not available." + }] + }; + } + + // Book the table + await makeBooking(restaurant, date, partySize); + return { + content: [{ + type: "text", + text: `Booked table for ${partySize} at ${restaurant} on ${date}` + }] + }; + } +); +``` + +Client-side: Handle elicitation requests + +```typescript +// This is a placeholder - implement based on your UI framework +async function getInputFromUser(message: string, schema: any): Promise<{ + action: "accept" | "decline" | "cancel"; + data?: Record; +}> { + // This should be implemented depending on the app + throw new Error("getInputFromUser must be implemented for your platform"); +} + +client.setRequestHandler(ElicitRequestSchema, async (request) => { + const userResponse = await getInputFromUser( + request.params.message, + request.params.requestedSchema + ); + + return { + action: userResponse.action, + content: userResponse.action === "accept" ? userResponse.data : undefined + }; +}); +``` + +**Note**: Elicitation requires client support. Clients must declare the `elicitation` capability during initialization. + +### Writing MCP Clients + +The SDK provides a high-level client interface: + +```typescript +import { Client } from "@modelcontextprotocol/sdk/client/index.js"; +import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"; + +const transport = new StdioClientTransport({ + command: "node", + args: ["server.js"] +}); + +const client = new Client( + { + name: "example-client", + version: "1.0.0" + } +); + +await client.connect(transport); + +// List prompts +const prompts = await client.listPrompts(); + +// Get a prompt +const prompt = await client.getPrompt({ + name: "example-prompt", + arguments: { + arg1: "value" + } +}); + +// List resources +const resources = await client.listResources(); + +// Read a resource +const resource = await client.readResource({ + uri: "file:///example.txt" +}); + +// Call a tool +const result = await client.callTool({ + name: "example-tool", + arguments: { + arg1: "value" + } +}); + +``` + +### Proxy Authorization Requests Upstream + +You can proxy OAuth requests to an external authorization provider: + +```typescript +import express from 'express'; +import { ProxyOAuthServerProvider } from '@modelcontextprotocol/sdk/server/auth/providers/proxyProvider.js'; +import { mcpAuthRouter } from '@modelcontextprotocol/sdk/server/auth/router.js'; + +const app = express(); + +const proxyProvider = new ProxyOAuthServerProvider({ + endpoints: { + authorizationUrl: "https://auth.external.com/oauth2/v1/authorize", + tokenUrl: "https://auth.external.com/oauth2/v1/token", + revocationUrl: "https://auth.external.com/oauth2/v1/revoke", + }, + verifyAccessToken: async (token) => { + return { + token, + clientId: "123", + scopes: ["openid", "email", "profile"], + } + }, + getClient: async (client_id) => { + return { + client_id, + redirect_uris: ["http://localhost:3000/callback"], + } + } +}) + +app.use(mcpAuthRouter({ + provider: proxyProvider, + issuerUrl: new URL("http://auth.external.com"), + baseUrl: new URL("http://mcp.example.com"), + serviceDocumentationUrl: new URL("https://docs.example.com/"), +})) +``` + +This setup allows you to: + +- Forward OAuth requests to an external provider +- Add custom token validation logic +- Manage client registrations +- Provide custom documentation URLs +- Maintain control over the OAuth flow while delegating to an external provider + +### Backwards Compatibility + +Clients and servers with StreamableHttp transport can maintain [backwards compatibility](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#backwards-compatibility) with the deprecated HTTP+SSE transport (from protocol version 2024-11-05) as follows + +#### Client-Side Compatibility + +For clients that need to work with both Streamable HTTP and older SSE servers: + +```typescript +import { Client } from "@modelcontextprotocol/sdk/client/index.js"; +import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"; +import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js"; +let client: Client|undefined = undefined +const baseUrl = new URL(url); +try { + client = new Client({ + name: 'streamable-http-client', + version: '1.0.0' + }); + const transport = new StreamableHTTPClientTransport( + new URL(baseUrl) + ); + await client.connect(transport); + console.log("Connected using Streamable HTTP transport"); +} catch (error) { + // If that fails with a 4xx error, try the older SSE transport + console.log("Streamable HTTP connection failed, falling back to SSE transport"); + client = new Client({ + name: 'sse-client', + version: '1.0.0' + }); + const sseTransport = new SSEClientTransport(baseUrl); + await client.connect(sseTransport); + console.log("Connected using SSE transport"); +} +``` + +#### Server-Side Compatibility + +For servers that need to support both Streamable HTTP and older clients: + +```typescript +import express from "express"; +import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js"; +import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js"; + +const server = new McpServer({ + name: "backwards-compatible-server", + version: "1.0.0" +}); + +// ... set up server resources, tools, and prompts ... + +const app = express(); +app.use(express.json()); + +// Store transports for each session type +const transports = { + streamable: {} as Record, + sse: {} as Record +}; + +// Modern Streamable HTTP endpoint +app.all('/mcp', async (req, res) => { + // Handle Streamable HTTP transport for modern clients + // Implementation as shown in the "With Session Management" example + // ... +}); + +// Legacy SSE endpoint for older clients +app.get('/sse', async (req, res) => { + // Create SSE transport for legacy clients + const transport = new SSEServerTransport('/messages', res); + transports.sse[transport.sessionId] = transport; + + res.on("close", () => { + delete transports.sse[transport.sessionId]; + }); + + await server.connect(transport); +}); + +// Legacy message endpoint for older clients +app.post('/messages', async (req, res) => { + const sessionId = req.query.sessionId as string; + const transport = transports.sse[sessionId]; + if (transport) { + await transport.handlePostMessage(req, res, req.body); + } else { + res.status(400).send('No transport found for sessionId'); + } +}); + +app.listen(3000); +``` + +**Note**: The SSE transport is now deprecated in favor of Streamable HTTP. New implementations should use Streamable HTTP, and existing SSE implementations should plan to migrate. + +## Documentation + +- [Model Context Protocol documentation](https://modelcontextprotocol.io) +- [MCP Specification](https://spec.modelcontextprotocol.io) +- [Example Servers](https://github.com/modelcontextprotocol/servers) + +## Contributing + +Issues and pull requests are welcome on GitHub at . + +## License + +This project is licensed under the MIT License—see the [LICENSE](LICENSE) file for details. diff --git a/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/LICENSE b/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/LICENSE new file mode 100644 index 0000000..505b0d9 --- /dev/null +++ b/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/LICENSE @@ -0,0 +1,22 @@ +The MIT License + +Copyright (c) EventSource GitHub organisation + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/README.md b/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/README.md new file mode 100644 index 0000000..500a96b --- /dev/null +++ b/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/README.md @@ -0,0 +1,167 @@ +# eventsource + +[![npm version](https://img.shields.io/npm/v/eventsource.svg?style=flat-square)](https://www.npmjs.com/package/eventsource)[![npm bundle size](https://img.shields.io/bundlephobia/minzip/eventsource?style=flat-square)](https://bundlephobia.com/result?p=eventsource)[![npm weekly downloads](https://img.shields.io/npm/dw/eventsource.svg?style=flat-square)](https://www.npmjs.com/package/eventsource) + +WhatWG/W3C-compatible [server-sent events/eventsource](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events) client. The module attempts to implement an absolute minimal amount of features/changes beyond the specification. + +If you're looking for a modern alternative with a less constrained API, check out the [`eventsource-client` package](https://www.npmjs.com/package/eventsource-client). + +## Installation + +```bash +npm install --save eventsource +``` + +## Supported engines + +- Node.js >= 18 +- Chrome >= 63 +- Safari >= 11.3 +- Firefox >= 65 +- Edge >= 79 +- Deno >= 1.30 +- Bun >= 1.1.23 + +Basically, any environment that supports: + +- [fetch](https://developer.mozilla.org/en-US/docs/Web/API/fetch) +- [ReadableStream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) +- [TextDecoderStream](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream) +- [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) +- [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event), [MessageEvent](https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent), [EventTarget](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget) + +If you need to support older runtimes, try the `2.x` branch/version range (note: 2.x branch is primarily targetted at Node.js, not browsers). + +## Usage + +```ts +import {EventSource} from 'eventsource' + +const es = new EventSource('https://my-server.com/sse') + +/* + * This will listen for events with the field `event: notice`. + */ +es.addEventListener('notice', (event) => { + console.log(event.data) +}) + +/* + * This will listen for events with the field `event: update`. + */ +es.addEventListener('update', (event) => { + console.log(event.data) +}) + +/* + * The event "message" is a special case, as it will capture events _without_ an + * event field, as well as events that have the specific type `event: message`. + * It will not trigger on any other event type. + */ +es.addEventListener('message', (event) => { + console.log(event.data) +}) + +/** + * To explicitly close the connection, call the `close` method. + * This will prevent any reconnection from happening. + */ +setTimeout(() => { + es.close() +}, 10_000) +``` + +### TypeScript + +Make sure you have configured your TSConfig so it matches the environment you are targetting. If you are targetting browsers, this would be `dom`: + +```jsonc +{ + "compilerOptions": { + "lib": ["dom"], + }, +} +``` + +If you're using Node.js, ensure you have `@types/node` installed (and it is version 18 or higher). Cloudflare workers have `@cloudflare/workers-types` etc. + +The following errors are caused by targetting an environment that does not have the necessary types available: + +``` +error TS2304: Cannot find name 'Event'. +error TS2304: Cannot find name 'EventTarget'. +error TS2304: Cannot find name 'MessageEvent'. +``` + +## Migrating from v1 / v2 + +See [MIGRATION.md](MIGRATION.md#v2-to-v3) for a detailed migration guide. + +## Extensions to the WhatWG/W3C API + +### Message and code properties on errors + +The `error` event has a `message` and `code` property that can be used to get more information about the error. In the specification, the Event + +```ts +es.addEventListener('error', (err) => { + if (err.code === 401 || err.code === 403) { + console.log('not authorized') + } +}) +``` + +### Specify `fetch` implementation + +The `EventSource` constructor accepts an optional `fetch` property in the second argument that can be used to specify the `fetch` implementation to use. + +This can be useful in environments where the global `fetch` function is not available - but it can also be used to alter the request/response behaviour. + +#### Setting HTTP request headers + +```ts +const es = new EventSource('https://my-server.com/sse', { + fetch: (input, init) => + fetch(input, { + ...init, + headers: { + ...init.headers, + Authorization: 'Bearer myToken', + }, + }), +}) +``` + +#### HTTP/HTTPS proxy + +Use a package like [`node-fetch-native`](https://github.com/unjs/node-fetch-native) to add proxy support, either through environment variables or explicit configuration. + +```ts +// npm install node-fetch-native --save +import {fetch} from 'node-fetch-native/proxy' + +const es = new EventSource('https://my-server.com/sse', { + fetch: (input, init) => fetch(input, init), +}) +``` + +#### Allow unauthorized HTTPS requests + +Use a package like [`undici`](https://github.com/nodejs/undici) for more control of fetch options through the use of an [`Agent`](https://undici.nodejs.org/#/docs/api/Agent.md). + +```ts +// npm install undici --save +import {fetch, Agent} from 'undici' + +await fetch('https://my-server.com/sse', { + dispatcher: new Agent({ + connect: { + rejectUnauthorized: false, + }, + }), +}) +``` + +## License + +MIT-licensed. See [LICENSE](LICENSE). diff --git a/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/package.json b/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/package.json new file mode 100644 index 0000000..351e4e1 --- /dev/null +++ b/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/package.json @@ -0,0 +1,130 @@ +{ + "name": "eventsource", + "version": "3.0.7", + "description": "WhatWG/W3C compliant EventSource client for Node.js and browsers", + "sideEffects": false, + "type": "module", + "main": "./dist/index.cjs", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "deno": "./dist/index.js", + "bun": "./dist/index.js", + "source": "./src/index.ts", + "import": "./dist/index.js", + "require": "./dist/index.cjs", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "scripts": { + "build": "pkg-utils build && pkg-utils --strict", + "build:watch": "pkg-utils watch", + "clean": "rimraf dist coverage", + "lint": "eslint . && tsc --noEmit", + "posttest": "npm run lint", + "prebuild": "npm run clean", + "prepare": "npm run build", + "test": "npm run test:node && npm run test:browser", + "test:browser": "tsx test/browser/client.browser.test.ts", + "test:bun": "bun run test/bun/client.bun.test.ts", + "test:deno": "deno run --allow-net --allow-read --allow-env --unstable-sloppy-imports test/deno/client.deno.test.ts", + "test:node": "tsx test/node/client.node.test.ts" + }, + "files": [ + "!dist/stats.html", + "dist", + "src" + ], + "repository": { + "type": "git", + "url": "git://git@github.com/EventSource/eventsource.git" + }, + "keywords": [ + "sse", + "eventsource", + "server-sent-events" + ], + "author": "Espen Hovlandsdal ", + "contributors": [ + "Aslak Hellesøy ", + "Einar Otto Stangvik " + ], + "license": "MIT", + "engines": { + "node": ">=18.0.0" + }, + "browserslist": [ + "node >= 18", + "chrome >= 71", + "safari >= 14.1", + "firefox >= 105", + "edge >= 79" + ], + "dependencies": { + "eventsource-parser": "^3.0.1" + }, + "devDependencies": { + "@sanity/pkg-utils": "^7.1.0", + "@sanity/semantic-release-preset": "^5.0.0", + "@tsconfig/strictest": "^2.0.5", + "@types/sinon": "^17.0.3", + "@typescript-eslint/eslint-plugin": "^6.11.0", + "@typescript-eslint/parser": "^6.11.0", + "esbuild": "^0.25.1", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", + "eslint-config-sanity": "^7.1.3", + "eventsource-encoder": "^1.0.0", + "playwright": "^1.48.2", + "prettier": "^3.5.3", + "rimraf": "^5.0.5", + "rollup-plugin-visualizer": "^5.12.0", + "semantic-release": "^24.2.0", + "sinon": "^17.0.1", + "tsx": "^4.19.2", + "typescript": "^5.8.2", + "undici": "^6.20.1" + }, + "overrides": { + "cross-spawn": "7.0.6" + }, + "bugs": { + "url": "https://github.com/EventSource/eventsource/issues" + }, + "homepage": "https://github.com/EventSource/eventsource#readme", + "prettier": { + "semi": false, + "printWidth": 100, + "bracketSpacing": false, + "singleQuote": true + }, + "eslintConfig": { + "parserOptions": { + "ecmaVersion": 9, + "sourceType": "module", + "ecmaFeatures": { + "modules": true + } + }, + "extends": [ + "sanity", + "sanity/typescript", + "prettier" + ], + "ignorePatterns": [ + "lib/**/" + ], + "globals": { + "globalThis": false + }, + "rules": { + "no-undef": "off", + "no-empty": "off" + } + }, + "publishConfig": { + "provenance": true + } +} diff --git a/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/src/EventSource.ts b/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/src/EventSource.ts new file mode 100644 index 0000000..468a13e --- /dev/null +++ b/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/src/EventSource.ts @@ -0,0 +1,596 @@ +import {createParser, type EventSourceMessage, type EventSourceParser} from 'eventsource-parser' + +import {ErrorEvent, flattenError, syntaxError} from './errors.js' +import type { + AddEventListenerOptions, + EventListenerOptions, + EventListenerOrEventListenerObject, + EventSourceEventMap, + EventSourceFetchInit, + EventSourceInit, + FetchLike, + FetchLikeResponse, +} from './types.js' + +/** + * An `EventSource` instance opens a persistent connection to an HTTP server, which sends events + * in `text/event-stream` format. The connection remains open until closed by calling `.close()`. + * + * @public + * @example + * ```js + * const eventSource = new EventSource('https://example.com/stream') + * eventSource.addEventListener('error', (error) => { + * console.error(error) + * }) + * eventSource.addEventListener('message', (event) => { + * console.log('Received message:', event.data) + * }) + * ``` + */ +export class EventSource extends EventTarget { + /** + * ReadyState representing an EventSource currently trying to connect + * + * @public + */ + static CONNECTING = 0 as const + + /** + * ReadyState representing an EventSource connection that is open (eg connected) + * + * @public + */ + static OPEN = 1 as const + + /** + * ReadyState representing an EventSource connection that is closed (eg disconnected) + * + * @public + */ + static CLOSED = 2 as const + + /** + * ReadyState representing an EventSource currently trying to connect + * + * @public + */ + readonly CONNECTING = 0 as const + + /** + * ReadyState representing an EventSource connection that is open (eg connected) + * + * @public + */ + readonly OPEN = 1 as const + + /** + * ReadyState representing an EventSource connection that is closed (eg disconnected) + * + * @public + */ + readonly CLOSED = 2 as const + + /** + * Returns the state of this EventSource object's connection. It can have the values described below. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState) + * + * Note: typed as `number` instead of `0 | 1 | 2` for compatibility with the `EventSource` interface, + * defined in the TypeScript `dom` library. + * + * @public + */ + public get readyState(): number { + return this.#readyState + } + + /** + * Returns the URL providing the event stream. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url) + * + * @public + */ + public get url(): string { + return this.#url.href + } + + /** + * Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials) + */ + public get withCredentials(): boolean { + return this.#withCredentials + } + + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */ + public get onerror(): ((ev: ErrorEvent) => unknown) | null { + return this.#onError + } + public set onerror(value: ((ev: ErrorEvent) => unknown) | null) { + this.#onError = value + } + + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */ + public get onmessage(): ((ev: MessageEvent) => unknown) | null { + return this.#onMessage + } + public set onmessage(value: ((ev: MessageEvent) => unknown) | null) { + this.#onMessage = value + } + + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */ + public get onopen(): ((ev: Event) => unknown) | null { + return this.#onOpen + } + public set onopen(value: ((ev: Event) => unknown) | null) { + this.#onOpen = value + } + + override addEventListener( + type: K, + listener: (this: EventSource, ev: EventSourceEventMap[K]) => unknown, + options?: boolean | AddEventListenerOptions, + ): void + override addEventListener( + type: string, + listener: (this: EventSource, event: MessageEvent) => unknown, + options?: boolean | AddEventListenerOptions, + ): void + override addEventListener( + type: string, + listener: EventListenerOrEventListenerObject, + options?: boolean | AddEventListenerOptions, + ): void + override addEventListener( + type: string, + listener: + | ((this: EventSource, event: MessageEvent) => unknown) + | EventListenerOrEventListenerObject, + options?: boolean | AddEventListenerOptions, + ): void { + const listen = listener as (this: EventSource, event: Event) => unknown + super.addEventListener(type, listen, options) + } + + override removeEventListener( + type: K, + listener: (this: EventSource, ev: EventSourceEventMap[K]) => unknown, + options?: boolean | EventListenerOptions, + ): void + override removeEventListener( + type: string, + listener: (this: EventSource, event: MessageEvent) => unknown, + options?: boolean | EventListenerOptions, + ): void + override removeEventListener( + type: string, + listener: EventListenerOrEventListenerObject, + options?: boolean | EventListenerOptions, + ): void + override removeEventListener( + type: string, + listener: + | ((this: EventSource, event: MessageEvent) => unknown) + | EventListenerOrEventListenerObject, + options?: boolean | EventListenerOptions, + ): void { + const listen = listener as (this: EventSource, event: Event) => unknown + super.removeEventListener(type, listen, options) + } + + constructor(url: string | URL, eventSourceInitDict?: EventSourceInit) { + super() + + try { + if (url instanceof URL) { + this.#url = url + } else if (typeof url === 'string') { + this.#url = new URL(url, getBaseURL()) + } else { + throw new Error('Invalid URL') + } + } catch (err) { + throw syntaxError('An invalid or illegal string was specified') + } + + this.#parser = createParser({ + onEvent: this.#onEvent, + onRetry: this.#onRetryChange, + }) + + this.#readyState = this.CONNECTING + this.#reconnectInterval = 3000 + this.#fetch = eventSourceInitDict?.fetch ?? globalThis.fetch + this.#withCredentials = eventSourceInitDict?.withCredentials ?? false + + this.#connect() + } + + /** + * Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close) + * + * @public + */ + close(): void { + if (this.#reconnectTimer) clearTimeout(this.#reconnectTimer) + if (this.#readyState === this.CLOSED) return + if (this.#controller) this.#controller.abort() + this.#readyState = this.CLOSED + this.#controller = undefined + } + + // PRIVATES FOLLOW + + /** + * Current connection state + * + * @internal + */ + #readyState: number + + /** + * Original URL used to connect. + * + * Note that this will stay the same even after a redirect. + * + * @internal + */ + #url: URL + + /** + * The destination URL after a redirect. Is reset on reconnection. + * + * @internal + */ + #redirectUrl: URL | undefined + + /** + * Whether to include credentials in the request + * + * @internal + */ + #withCredentials: boolean + + /** + * The fetch implementation to use + * + * @internal + */ + #fetch: FetchLike + + /** + * The reconnection time in milliseconds + * + * @internal + */ + #reconnectInterval: number + + /** + * Reference to an ongoing reconnect attempt, if any + * + * @internal + */ + #reconnectTimer: ReturnType | undefined + + /** + * The last event ID seen by the EventSource, which will be sent as `Last-Event-ID` in the + * request headers on a reconnection attempt. + * + * @internal + */ + #lastEventId: string | null = null + + /** + * The AbortController instance used to abort the fetch request + * + * @internal + */ + #controller: AbortController | undefined + + /** + * Instance of an EventSource parser (`eventsource-parser` npm module) + * + * @internal + */ + #parser: EventSourceParser + + /** + * Holds the current error handler, attached through `onerror` property directly. + * Note that `addEventListener('error', …)` will not be stored here. + * + * @internal + */ + #onError: ((ev: ErrorEvent) => unknown) | null = null + + /** + * Holds the current message handler, attached through `onmessage` property directly. + * Note that `addEventListener('message', …)` will not be stored here. + * + * @internal + */ + #onMessage: ((ev: MessageEvent) => unknown) | null = null + + /** + * Holds the current open handler, attached through `onopen` property directly. + * Note that `addEventListener('open', …)` will not be stored here. + * + * @internal + */ + #onOpen: ((ev: Event) => unknown) | null = null + + /** + * Connect to the given URL and start receiving events + * + * @internal + */ + #connect() { + this.#readyState = this.CONNECTING + this.#controller = new AbortController() + + // Browser tests are failing if we directly call `this.#fetch()`, thus the indirection. + const fetch = this.#fetch + fetch(this.#url, this.#getRequestOptions()) + .then(this.#onFetchResponse) + .catch(this.#onFetchError) + } + + /** + * Handles the fetch response + * + * @param response - The Fetch(ish) response + * @internal + */ + #onFetchResponse = async (response: FetchLikeResponse) => { + this.#parser.reset() + + const {body, redirected, status, headers} = response + + // [spec] a client can be told to stop reconnecting using the HTTP 204 No Content response code. + if (status === 204) { + // We still need to emit an error event - this mirrors the browser behavior, + // and without it there is no way to tell the user that the connection was closed. + this.#failConnection('Server sent HTTP 204, not reconnecting', 204) + this.close() + return + } + + // [spec] …Event stream requests can be redirected using HTTP 301 and 307 redirects as with + // [spec] normal HTTP requests. + // Spec does not say anything about other redirect codes (302, 308), but this seems an + // unintended omission, rather than a feature. Browsers will happily redirect on other 3xxs's. + if (redirected) { + this.#redirectUrl = new URL(response.url) + } else { + this.#redirectUrl = undefined + } + + // [spec] if res's status is not 200, …, then fail the connection. + if (status !== 200) { + this.#failConnection(`Non-200 status code (${status})`, status) + return + } + + // [spec] …or if res's `Content-Type` is not `text/event-stream`, then fail the connection. + const contentType = headers.get('content-type') || '' + if (!contentType.startsWith('text/event-stream')) { + this.#failConnection('Invalid content type, expected "text/event-stream"', status) + return + } + + // [spec] …if the readyState attribute is set to a value other than CLOSED… + if (this.#readyState === this.CLOSED) { + return + } + + // [spec] …sets the readyState attribute to OPEN and fires an event + // [spec] …named open at the EventSource object. + this.#readyState = this.OPEN + + const openEvent = new Event('open') + this.#onOpen?.(openEvent) + this.dispatchEvent(openEvent) + + // Ensure that the response stream is a web stream + if (typeof body !== 'object' || !body || !('getReader' in body)) { + this.#failConnection('Invalid response body, expected a web ReadableStream', status) + this.close() // This should only happen if `fetch` provided is "faulty" - don't reconnect + return + } + + const decoder = new TextDecoder() + + const reader = body.getReader() + let open = true + + do { + const {done, value} = await reader.read() + if (value) { + this.#parser.feed(decoder.decode(value, {stream: !done})) + } + + if (!done) { + continue + } + + open = false + this.#parser.reset() + + this.#scheduleReconnect() + } while (open) + } + + /** + * Handles rejected requests for the EventSource endpoint + * + * @param err - The error from `fetch()` + * @internal + */ + #onFetchError = (err: Error & {type?: string}) => { + this.#controller = undefined + + // We expect abort errors when the user manually calls `close()` - ignore those + if (err.name === 'AbortError' || err.type === 'aborted') { + return + } + + this.#scheduleReconnect(flattenError(err)) + } + + /** + * Get request options for the `fetch()` request + * + * @returns The request options + * @internal + */ + #getRequestOptions(): EventSourceFetchInit { + const lastEvent = this.#lastEventId ? {'Last-Event-ID': this.#lastEventId} : undefined + + const init: EventSourceFetchInit = { + // [spec] Let `corsAttributeState` be `Anonymous`… + // [spec] …will have their mode set to "cors"… + mode: 'cors', + redirect: 'follow', + headers: {Accept: 'text/event-stream', ...lastEvent}, + cache: 'no-store', + signal: this.#controller?.signal, + } + + // Some environments crash if attempting to set `credentials` where it is not supported, + // eg on Cloudflare Workers. To avoid this, we only set it in browser-like environments. + if ('window' in globalThis) { + // [spec] …and their credentials mode set to "same-origin" + // [spec] …if the `withCredentials` attribute is `true`, set the credentials mode to "include"… + init.credentials = this.withCredentials ? 'include' : 'same-origin' + } + + return init + } + + /** + * Called by EventSourceParser instance when an event has successfully been parsed + * and is ready to be processed. + * + * @param event - The parsed event + * @internal + */ + #onEvent = (event: EventSourceMessage) => { + if (typeof event.id === 'string') { + this.#lastEventId = event.id + } + + const messageEvent = new MessageEvent(event.event || 'message', { + data: event.data, + origin: this.#redirectUrl ? this.#redirectUrl.origin : this.#url.origin, + lastEventId: event.id || '', + }) + + // The `onmessage` property of the EventSource instance only triggers on messages without an + // `event` field, or ones that explicitly set `message`. + if (this.#onMessage && (!event.event || event.event === 'message')) { + this.#onMessage(messageEvent) + } + + this.dispatchEvent(messageEvent) + } + + /** + * Called by EventSourceParser instance when a new reconnection interval is received + * from the EventSource endpoint. + * + * @param value - The new reconnection interval in milliseconds + * @internal + */ + #onRetryChange = (value: number) => { + this.#reconnectInterval = value + } + + /** + * Handles the process referred to in the EventSource specification as "failing a connection". + * + * @param error - The error causing the connection to fail + * @param code - The HTTP status code, if available + * @internal + */ + #failConnection(message?: string, code?: number) { + // [spec] …if the readyState attribute is set to a value other than CLOSED, + // [spec] sets the readyState attribute to CLOSED… + if (this.#readyState !== this.CLOSED) { + this.#readyState = this.CLOSED + } + + // [spec] …and fires an event named `error` at the `EventSource` object. + // [spec] Once the user agent has failed the connection, it does not attempt to reconnect. + // [spec] > Implementations are especially encouraged to report detailed information + // [spec] > to their development consoles whenever an error event is fired, since little + // [spec] > to no information can be made available in the events themselves. + // Printing to console is not very programatically helpful, though, so we emit a custom event. + const errorEvent = new ErrorEvent('error', {code, message}) + + this.#onError?.(errorEvent) + this.dispatchEvent(errorEvent) + } + + /** + * Schedules a reconnection attempt against the EventSource endpoint. + * + * @param message - The error causing the connection to fail + * @param code - The HTTP status code, if available + * @internal + */ + #scheduleReconnect(message?: string, code?: number) { + // [spec] If the readyState attribute is set to CLOSED, abort the task. + if (this.#readyState === this.CLOSED) { + return + } + + // [spec] Set the readyState attribute to CONNECTING. + this.#readyState = this.CONNECTING + + // [spec] Fire an event named `error` at the EventSource object. + const errorEvent = new ErrorEvent('error', {code, message}) + this.#onError?.(errorEvent) + this.dispatchEvent(errorEvent) + + // [spec] Wait a delay equal to the reconnection time of the event source. + this.#reconnectTimer = setTimeout(this.#reconnect, this.#reconnectInterval) + } + + /** + * Reconnects to the EventSource endpoint after a disconnect/failure + * + * @internal + */ + #reconnect = () => { + this.#reconnectTimer = undefined + + // [spec] If the EventSource's readyState attribute is not set to CONNECTING, then return. + if (this.#readyState !== this.CONNECTING) { + return + } + + this.#connect() + } +} + +/** + * According to spec, when constructing a URL: + * > 1. Let baseURL be environment's base URL, if environment is a Document object + * > 2. Return the result of applying the URL parser to url, with baseURL. + * + * Thus we should use `document.baseURI` if available, since it can be set through a base tag. + * + * @returns The base URL, if available - otherwise `undefined` + * @internal + */ +function getBaseURL(): string | undefined { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const doc = 'document' in globalThis ? (globalThis as any).document : undefined + return doc && typeof doc === 'object' && 'baseURI' in doc && typeof doc.baseURI === 'string' + ? doc.baseURI + : undefined +} diff --git a/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/src/errors.ts b/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/src/errors.ts new file mode 100644 index 0000000..a39f75d --- /dev/null +++ b/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/src/errors.ts @@ -0,0 +1,141 @@ +/** + * An extended version of the `Event` emitted by the `EventSource` object when an error occurs. + * While the spec does not include any additional properties, we intentionally go beyond the spec + * and provide some (minimal) additional information to aid in debugging. + * + * @public + */ +export class ErrorEvent extends Event { + /** + * HTTP status code, if this was triggered by an HTTP error + * Note: this is not part of the spec, but is included for better error handling. + * + * @public + */ + public code?: number | undefined + + /** + * Optional message attached to the error. + * Note: this is not part of the spec, but is included for better error handling. + * + * @public + */ + public message?: string | undefined + + /** + * Constructs a new `ErrorEvent` instance. This is typically not called directly, + * but rather emitted by the `EventSource` object when an error occurs. + * + * @param type - The type of the event (should be "error") + * @param errorEventInitDict - Optional properties to include in the error event + */ + constructor( + type: string, + errorEventInitDict?: {message?: string | undefined; code?: number | undefined}, + ) { + super(type) + this.code = errorEventInitDict?.code ?? undefined + this.message = errorEventInitDict?.message ?? undefined + } + + /** + * Node.js "hides" the `message` and `code` properties of the `ErrorEvent` instance, + * when it is `console.log`'ed. This makes it harder to debug errors. To ease debugging, + * we explicitly include the properties in the `inspect` method. + * + * This is automatically called by Node.js when you `console.log` an instance of this class. + * + * @param _depth - The current depth + * @param options - The options passed to `util.inspect` + * @param inspect - The inspect function to use (prevents having to import it from `util`) + * @returns A string representation of the error + */ + [Symbol.for('nodejs.util.inspect.custom')]( + _depth: number, + options: {colors: boolean}, + inspect: (obj: unknown, inspectOptions: {colors: boolean}) => string, + ): string { + return inspect(inspectableError(this), options) + } + + /** + * Deno "hides" the `message` and `code` properties of the `ErrorEvent` instance, + * when it is `console.log`'ed. This makes it harder to debug errors. To ease debugging, + * we explicitly include the properties in the `inspect` method. + * + * This is automatically called by Deno when you `console.log` an instance of this class. + * + * @param inspect - The inspect function to use (prevents having to import it from `util`) + * @param options - The options passed to `Deno.inspect` + * @returns A string representation of the error + */ + [Symbol.for('Deno.customInspect')]( + inspect: (obj: unknown, inspectOptions: {colors: boolean}) => string, + options: {colors: boolean}, + ): string { + return inspect(inspectableError(this), options) + } +} + +/** + * For environments where DOMException may not exist, we will use a SyntaxError instead. + * While this isn't strictly according to spec, it is very close. + * + * @param message - The message to include in the error + * @returns A `DOMException` or `SyntaxError` instance + * @internal + */ +export function syntaxError(message: string): SyntaxError { + // If someone can figure out a way to make this work without depending on DOM/Node.js typings, + // and without casting to `any`, please send a PR 🙏 + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const DomException = (globalThis as any).DOMException + if (typeof DomException === 'function') { + return new DomException(message, 'SyntaxError') + } + + return new SyntaxError(message) +} + +/** + * Flatten an error into a single error message string. + * Unwraps nested errors and joins them with a comma. + * + * @param err - The error to flatten + * @returns A string representation of the error + * @internal + */ +export function flattenError(err: unknown): string { + if (!(err instanceof Error)) { + return `${err}` + } + + if ('errors' in err && Array.isArray(err.errors)) { + return err.errors.map(flattenError).join(', ') + } + + if ('cause' in err && err.cause instanceof Error) { + return `${err}: ${flattenError(err.cause)}` + } + + return err.message +} + +/** + * Convert an `ErrorEvent` instance into a plain object for inspection. + * + * @param err - The `ErrorEvent` instance to inspect + * @returns A plain object representation of the error + * @internal + */ +function inspectableError(err: ErrorEvent) { + return { + type: err.type, + message: err.message, + code: err.code, + defaultPrevented: err.defaultPrevented, + cancelable: err.cancelable, + timeStamp: err.timeStamp, + } +} diff --git a/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/src/index.ts b/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/src/index.ts new file mode 100644 index 0000000..c6b6216 --- /dev/null +++ b/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/src/index.ts @@ -0,0 +1,3 @@ +export {ErrorEvent} from './errors.js' +export {EventSource} from './EventSource.js' +export type * from './types.js' diff --git a/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/src/types.ts b/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/src/types.ts new file mode 100644 index 0000000..46d907a --- /dev/null +++ b/node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/src/types.ts @@ -0,0 +1,152 @@ +import type {ErrorEvent} from './errors.js' + +/** + * Stripped down version of `fetch()`, only defining the parts we care about. + * This ensures it should work with "most" fetch implementations. + * + * @public + */ +export type FetchLike = ( + url: string | URL, + init: EventSourceFetchInit, +) => Promise + +/** + * Subset of `RequestInit` used for `fetch()` calls made by the `EventSource` class. + * As we know that we will be passing certain values, we can be more specific and have + * users not have to do optional chaining and similar for things that will always be there. + * + * @public + */ +export interface EventSourceFetchInit { + /** An AbortSignal to set request's signal. Typed as `any` because of polyfill inconsistencies. */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + signal: {aborted: boolean} | any + + /** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */ + headers: { + [key: string]: string + Accept: 'text/event-stream' + } + + /** A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode. */ + mode: 'cors' | 'no-cors' | 'same-origin' + + /** A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials. */ + credentials?: 'include' | 'omit' | 'same-origin' + + /** Controls how the request is cached. */ + cache: 'no-store' + + /** A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */ + redirect: 'error' | 'follow' | 'manual' +} + +/** + * @public + * @deprecated Use `EventSourceFetchInit` instead. + * This type is only here for backwards compatibility and will be removed in a future version. + */ +export type FetchLikeInit = EventSourceFetchInit + +/** + * Stripped down version of `ReadableStreamDefaultReader`, only defining the parts we care about. + * + * @public + */ +export interface ReaderLike { + read(): Promise<{done: false; value: unknown} | {done: true; value?: undefined}> + cancel(): Promise +} + +/** + * Minimal version of the `Response` type returned by `fetch()`. + * + * @public + */ +export interface FetchLikeResponse { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + readonly body: {getReader(): ReaderLike} | Response['body'] | null + readonly url: string + readonly status: number + readonly redirected: boolean + readonly headers: {get(name: string): string | null} +} + +/** + * Mirrors the official DOM typings, with the exception of the extended ErrorEvent. + * + * @public + */ +export interface EventSourceEventMap { + error: ErrorEvent + message: MessageEvent + open: Event +} + +/** + * Mirrors the official DOM typings (for the most part) + * + * @public + */ +export interface EventSourceInit { + /** + * A boolean value, defaulting to `false`, indicating if CORS should be set to `include` credentials. + */ + withCredentials?: boolean + + /** + * Optional fetch implementation to use. Defaults to `globalThis.fetch`. + * Can also be used for advanced use cases like mocking, proxying, custom certs etc. + */ + fetch?: FetchLike +} + +/** + * Mirrors the official DOM typings (sorta). + * + * @public + */ +export interface EventListenerOptions { + /** Not directly used by Node.js. Added for API completeness. Default: `false`. */ + capture?: boolean +} + +/** + * Mirrors the official DOM typings (sorta). + * + * @public + */ +export interface AddEventListenerOptions extends EventListenerOptions { + /** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */ + once?: boolean + /** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */ + passive?: boolean + /** The listener will be removed when the given AbortSignal object's `abort()` method is called. */ + signal?: AbortSignal +} + +/** + * Mirrors the official DOM typings. + * + * @public + */ +export type EventListenerOrEventListenerObject = EventListener | EventListenerObject + +/** + * Mirrors the official DOM typings. + * + * @public + */ +export interface EventListener { + (evt: Event | MessageEvent): void +} + +/** + * Mirrors the official DOM typings. + * + * @public + */ +export interface EventListenerObject { + handleEvent(object: Event): void +} diff --git a/node_modules/@modelcontextprotocol/sdk/package.json b/node_modules/@modelcontextprotocol/sdk/package.json new file mode 100644 index 0000000..697b051 --- /dev/null +++ b/node_modules/@modelcontextprotocol/sdk/package.json @@ -0,0 +1,103 @@ +{ + "name": "@modelcontextprotocol/sdk", + "version": "1.17.3", + "description": "Model Context Protocol implementation for TypeScript", + "license": "MIT", + "author": "Anthropic, PBC (https://anthropic.com)", + "homepage": "https://modelcontextprotocol.io", + "bugs": "https://github.com/modelcontextprotocol/typescript-sdk/issues", + "type": "module", + "repository": { + "type": "git", + "url": "git+https://github.com/modelcontextprotocol/typescript-sdk.git" + }, + "engines": { + "node": ">=18" + }, + "keywords": [ + "modelcontextprotocol", + "mcp" + ], + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js" + }, + "./client": { + "import": "./dist/esm/client/index.js", + "require": "./dist/cjs/client/index.js" + }, + "./server": { + "import": "./dist/esm/server/index.js", + "require": "./dist/cjs/server/index.js" + }, + "./*": { + "import": "./dist/esm/*", + "require": "./dist/cjs/*" + } + }, + "typesVersions": { + "*": { + "*": [ + "./dist/esm/*" + ] + } + }, + "files": [ + "dist" + ], + "scripts": { + "fetch:spec-types": "curl -o spec.types.ts https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/refs/heads/main/schema/draft/schema.ts", + "build": "npm run build:esm && npm run build:cjs", + "build:esm": "mkdir -p dist/esm && echo '{\"type\": \"module\"}' > dist/esm/package.json && tsc -p tsconfig.prod.json", + "build:esm:w": "npm run build:esm -- -w", + "build:cjs": "mkdir -p dist/cjs && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json && tsc -p tsconfig.cjs.json", + "build:cjs:w": "npm run build:cjs -- -w", + "examples:simple-server:w": "tsx --watch src/examples/server/simpleStreamableHttp.ts --oauth", + "prepack": "npm run build:esm && npm run build:cjs", + "lint": "eslint src/", + "test": "npm run fetch:spec-types && jest", + "start": "npm run server", + "server": "tsx watch --clear-screen=false src/cli.ts server", + "client": "tsx src/cli.ts client" + }, + "dependencies": { + "ajv": "^6.12.6", + "content-type": "^1.0.5", + "cors": "^2.8.5", + "cross-spawn": "^7.0.5", + "eventsource": "^3.0.2", + "eventsource-parser": "^3.0.0", + "express": "^5.0.1", + "express-rate-limit": "^7.5.0", + "pkce-challenge": "^5.0.0", + "raw-body": "^3.0.0", + "zod": "^3.23.8", + "zod-to-json-schema": "^3.24.1" + }, + "devDependencies": { + "@eslint/js": "^9.8.0", + "@jest-mock/express": "^3.0.0", + "@types/content-type": "^1.1.8", + "@types/cors": "^2.8.17", + "@types/cross-spawn": "^6.0.6", + "@types/eslint__js": "^8.42.3", + "@types/eventsource": "^1.1.15", + "@types/express": "^5.0.0", + "@types/jest": "^29.5.12", + "@types/node": "^22.0.2", + "@types/supertest": "^6.0.2", + "@types/ws": "^8.5.12", + "eslint": "^9.8.0", + "jest": "^29.7.0", + "supertest": "^7.0.0", + "ts-jest": "^29.2.4", + "tsx": "^4.16.5", + "typescript": "^5.5.4", + "typescript-eslint": "^8.0.0", + "ws": "^8.18.0" + }, + "resolutions": { + "strip-ansi": "6.0.1" + } +} \ No newline at end of file diff --git a/node_modules/accepts/HISTORY.md b/node_modules/accepts/HISTORY.md new file mode 100644 index 0000000..627a81d --- /dev/null +++ b/node_modules/accepts/HISTORY.md @@ -0,0 +1,250 @@ +2.0.0 / 2024-08-31 +================== + + * Drop node <18 support + * deps: mime-types@^3.0.0 + * deps: negotiator@^1.0.0 + +1.3.8 / 2022-02-02 +================== + + * deps: mime-types@~2.1.34 + - deps: mime-db@~1.51.0 + * deps: negotiator@0.6.3 + +1.3.7 / 2019-04-29 +================== + + * deps: negotiator@0.6.2 + - Fix sorting charset, encoding, and language with extra parameters + +1.3.6 / 2019-04-28 +================== + + * deps: mime-types@~2.1.24 + - deps: mime-db@~1.40.0 + +1.3.5 / 2018-02-28 +================== + + * deps: mime-types@~2.1.18 + - deps: mime-db@~1.33.0 + +1.3.4 / 2017-08-22 +================== + + * deps: mime-types@~2.1.16 + - deps: mime-db@~1.29.0 + +1.3.3 / 2016-05-02 +================== + + * deps: mime-types@~2.1.11 + - deps: mime-db@~1.23.0 + * deps: negotiator@0.6.1 + - perf: improve `Accept` parsing speed + - perf: improve `Accept-Charset` parsing speed + - perf: improve `Accept-Encoding` parsing speed + - perf: improve `Accept-Language` parsing speed + +1.3.2 / 2016-03-08 +================== + + * deps: mime-types@~2.1.10 + - Fix extension of `application/dash+xml` + - Update primary extension for `audio/mp4` + - deps: mime-db@~1.22.0 + +1.3.1 / 2016-01-19 +================== + + * deps: mime-types@~2.1.9 + - deps: mime-db@~1.21.0 + +1.3.0 / 2015-09-29 +================== + + * deps: mime-types@~2.1.7 + - deps: mime-db@~1.19.0 + * deps: negotiator@0.6.0 + - Fix including type extensions in parameters in `Accept` parsing + - Fix parsing `Accept` parameters with quoted equals + - Fix parsing `Accept` parameters with quoted semicolons + - Lazy-load modules from main entry point + - perf: delay type concatenation until needed + - perf: enable strict mode + - perf: hoist regular expressions + - perf: remove closures getting spec properties + - perf: remove a closure from media type parsing + - perf: remove property delete from media type parsing + +1.2.13 / 2015-09-06 +=================== + + * deps: mime-types@~2.1.6 + - deps: mime-db@~1.18.0 + +1.2.12 / 2015-07-30 +=================== + + * deps: mime-types@~2.1.4 + - deps: mime-db@~1.16.0 + +1.2.11 / 2015-07-16 +=================== + + * deps: mime-types@~2.1.3 + - deps: mime-db@~1.15.0 + +1.2.10 / 2015-07-01 +=================== + + * deps: mime-types@~2.1.2 + - deps: mime-db@~1.14.0 + +1.2.9 / 2015-06-08 +================== + + * deps: mime-types@~2.1.1 + - perf: fix deopt during mapping + +1.2.8 / 2015-06-07 +================== + + * deps: mime-types@~2.1.0 + - deps: mime-db@~1.13.0 + * perf: avoid argument reassignment & argument slice + * perf: avoid negotiator recursive construction + * perf: enable strict mode + * perf: remove unnecessary bitwise operator + +1.2.7 / 2015-05-10 +================== + + * deps: negotiator@0.5.3 + - Fix media type parameter matching to be case-insensitive + +1.2.6 / 2015-05-07 +================== + + * deps: mime-types@~2.0.11 + - deps: mime-db@~1.9.1 + * deps: negotiator@0.5.2 + - Fix comparing media types with quoted values + - Fix splitting media types with quoted commas + +1.2.5 / 2015-03-13 +================== + + * deps: mime-types@~2.0.10 + - deps: mime-db@~1.8.0 + +1.2.4 / 2015-02-14 +================== + + * Support Node.js 0.6 + * deps: mime-types@~2.0.9 + - deps: mime-db@~1.7.0 + * deps: negotiator@0.5.1 + - Fix preference sorting to be stable for long acceptable lists + +1.2.3 / 2015-01-31 +================== + + * deps: mime-types@~2.0.8 + - deps: mime-db@~1.6.0 + +1.2.2 / 2014-12-30 +================== + + * deps: mime-types@~2.0.7 + - deps: mime-db@~1.5.0 + +1.2.1 / 2014-12-30 +================== + + * deps: mime-types@~2.0.5 + - deps: mime-db@~1.3.1 + +1.2.0 / 2014-12-19 +================== + + * deps: negotiator@0.5.0 + - Fix list return order when large accepted list + - Fix missing identity encoding when q=0 exists + - Remove dynamic building of Negotiator class + +1.1.4 / 2014-12-10 +================== + + * deps: mime-types@~2.0.4 + - deps: mime-db@~1.3.0 + +1.1.3 / 2014-11-09 +================== + + * deps: mime-types@~2.0.3 + - deps: mime-db@~1.2.0 + +1.1.2 / 2014-10-14 +================== + + * deps: negotiator@0.4.9 + - Fix error when media type has invalid parameter + +1.1.1 / 2014-09-28 +================== + + * deps: mime-types@~2.0.2 + - deps: mime-db@~1.1.0 + * deps: negotiator@0.4.8 + - Fix all negotiations to be case-insensitive + - Stable sort preferences of same quality according to client order + +1.1.0 / 2014-09-02 +================== + + * update `mime-types` + +1.0.7 / 2014-07-04 +================== + + * Fix wrong type returned from `type` when match after unknown extension + +1.0.6 / 2014-06-24 +================== + + * deps: negotiator@0.4.7 + +1.0.5 / 2014-06-20 +================== + + * fix crash when unknown extension given + +1.0.4 / 2014-06-19 +================== + + * use `mime-types` + +1.0.3 / 2014-06-11 +================== + + * deps: negotiator@0.4.6 + - Order by specificity when quality is the same + +1.0.2 / 2014-05-29 +================== + + * Fix interpretation when header not in request + * deps: pin negotiator@0.4.5 + +1.0.1 / 2014-01-18 +================== + + * Identity encoding isn't always acceptable + * deps: negotiator@~0.4.0 + +1.0.0 / 2013-12-27 +================== + + * Genesis diff --git a/node_modules/accepts/LICENSE b/node_modules/accepts/LICENSE new file mode 100644 index 0000000..0616607 --- /dev/null +++ b/node_modules/accepts/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/accepts/README.md b/node_modules/accepts/README.md new file mode 100644 index 0000000..f3f10c4 --- /dev/null +++ b/node_modules/accepts/README.md @@ -0,0 +1,140 @@ +# accepts + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][github-actions-ci-image]][github-actions-ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator). +Extracted from [koa](https://www.npmjs.com/package/koa) for general use. + +In addition to negotiator, it allows: + +- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])` + as well as `('text/html', 'application/json')`. +- Allows type shorthands such as `json`. +- Returns `false` when no types match +- Treats non-existent headers as `*` + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install accepts +``` + +## API + +```js +var accepts = require('accepts') +``` + +### accepts(req) + +Create a new `Accepts` object for the given `req`. + +#### .charset(charsets) + +Return the first accepted charset. If nothing in `charsets` is accepted, +then `false` is returned. + +#### .charsets() + +Return the charsets that the request accepts, in the order of the client's +preference (most preferred first). + +#### .encoding(encodings) + +Return the first accepted encoding. If nothing in `encodings` is accepted, +then `false` is returned. + +#### .encodings() + +Return the encodings that the request accepts, in the order of the client's +preference (most preferred first). + +#### .language(languages) + +Return the first accepted language. If nothing in `languages` is accepted, +then `false` is returned. + +#### .languages() + +Return the languages that the request accepts, in the order of the client's +preference (most preferred first). + +#### .type(types) + +Return the first accepted type (and it is returned as the same text as what +appears in the `types` array). If nothing in `types` is accepted, then `false` +is returned. + +The `types` array can contain full MIME types or file extensions. Any value +that is not a full MIME type is passed to `require('mime-types').lookup`. + +#### .types() + +Return the types that the request accepts, in the order of the client's +preference (most preferred first). + +## Examples + +### Simple type negotiation + +This simple example shows how to use `accepts` to return a different typed +respond body based on what the client wants to accept. The server lists it's +preferences in order and will get back the best match between the client and +server. + +```js +var accepts = require('accepts') +var http = require('http') + +function app (req, res) { + var accept = accepts(req) + + // the order of this list is significant; should be server preferred order + switch (accept.type(['json', 'html'])) { + case 'json': + res.setHeader('Content-Type', 'application/json') + res.write('{"hello":"world!"}') + break + case 'html': + res.setHeader('Content-Type', 'text/html') + res.write('hello, world!') + break + default: + // the fallback is text/plain, so no need to specify it above + res.setHeader('Content-Type', 'text/plain') + res.write('hello, world!') + break + } + + res.end() +} + +http.createServer(app).listen(3000) +``` + +You can test this out with the cURL program: +```sh +curl -I -H'Accept: text/html' http://localhost:3000/ +``` + +## License + +[MIT](LICENSE) + +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master +[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master +[github-actions-ci-image]: https://badgen.net/github/checks/jshttp/accepts/master?label=ci +[github-actions-ci-url]: https://github.com/jshttp/accepts/actions/workflows/ci.yml +[node-version-image]: https://badgen.net/npm/node/accepts +[node-version-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/accepts +[npm-url]: https://npmjs.org/package/accepts +[npm-version-image]: https://badgen.net/npm/v/accepts diff --git a/node_modules/accepts/index.js b/node_modules/accepts/index.js new file mode 100644 index 0000000..4f2840c --- /dev/null +++ b/node_modules/accepts/index.js @@ -0,0 +1,238 @@ +/*! + * accepts + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var Negotiator = require('negotiator') +var mime = require('mime-types') + +/** + * Module exports. + * @public + */ + +module.exports = Accepts + +/** + * Create a new Accepts object for the given req. + * + * @param {object} req + * @public + */ + +function Accepts (req) { + if (!(this instanceof Accepts)) { + return new Accepts(req) + } + + this.headers = req.headers + this.negotiator = new Negotiator(req) +} + +/** + * Check if the given `type(s)` is acceptable, returning + * the best match when true, otherwise `undefined`, in which + * case you should respond with 406 "Not Acceptable". + * + * The `type` value may be a single mime type string + * such as "application/json", the extension name + * such as "json" or an array `["json", "html", "text/plain"]`. When a list + * or array is given the _best_ match, if any is returned. + * + * Examples: + * + * // Accept: text/html + * this.types('html'); + * // => "html" + * + * // Accept: text/*, application/json + * this.types('html'); + * // => "html" + * this.types('text/html'); + * // => "text/html" + * this.types('json', 'text'); + * // => "json" + * this.types('application/json'); + * // => "application/json" + * + * // Accept: text/*, application/json + * this.types('image/png'); + * this.types('png'); + * // => undefined + * + * // Accept: text/*;q=.5, application/json + * this.types(['html', 'json']); + * this.types('html', 'json'); + * // => "json" + * + * @param {String|Array} types... + * @return {String|Array|Boolean} + * @public + */ + +Accepts.prototype.type = +Accepts.prototype.types = function (types_) { + var types = types_ + + // support flattened arguments + if (types && !Array.isArray(types)) { + types = new Array(arguments.length) + for (var i = 0; i < types.length; i++) { + types[i] = arguments[i] + } + } + + // no types, return all requested types + if (!types || types.length === 0) { + return this.negotiator.mediaTypes() + } + + // no accept header, return first given type + if (!this.headers.accept) { + return types[0] + } + + var mimes = types.map(extToMime) + var accepts = this.negotiator.mediaTypes(mimes.filter(validMime)) + var first = accepts[0] + + return first + ? types[mimes.indexOf(first)] + : false +} + +/** + * Return accepted encodings or best fit based on `encodings`. + * + * Given `Accept-Encoding: gzip, deflate` + * an array sorted by quality is returned: + * + * ['gzip', 'deflate'] + * + * @param {String|Array} encodings... + * @return {String|Array} + * @public + */ + +Accepts.prototype.encoding = +Accepts.prototype.encodings = function (encodings_) { + var encodings = encodings_ + + // support flattened arguments + if (encodings && !Array.isArray(encodings)) { + encodings = new Array(arguments.length) + for (var i = 0; i < encodings.length; i++) { + encodings[i] = arguments[i] + } + } + + // no encodings, return all requested encodings + if (!encodings || encodings.length === 0) { + return this.negotiator.encodings() + } + + return this.negotiator.encodings(encodings)[0] || false +} + +/** + * Return accepted charsets or best fit based on `charsets`. + * + * Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5` + * an array sorted by quality is returned: + * + * ['utf-8', 'utf-7', 'iso-8859-1'] + * + * @param {String|Array} charsets... + * @return {String|Array} + * @public + */ + +Accepts.prototype.charset = +Accepts.prototype.charsets = function (charsets_) { + var charsets = charsets_ + + // support flattened arguments + if (charsets && !Array.isArray(charsets)) { + charsets = new Array(arguments.length) + for (var i = 0; i < charsets.length; i++) { + charsets[i] = arguments[i] + } + } + + // no charsets, return all requested charsets + if (!charsets || charsets.length === 0) { + return this.negotiator.charsets() + } + + return this.negotiator.charsets(charsets)[0] || false +} + +/** + * Return accepted languages or best fit based on `langs`. + * + * Given `Accept-Language: en;q=0.8, es, pt` + * an array sorted by quality is returned: + * + * ['es', 'pt', 'en'] + * + * @param {String|Array} langs... + * @return {Array|String} + * @public + */ + +Accepts.prototype.lang = +Accepts.prototype.langs = +Accepts.prototype.language = +Accepts.prototype.languages = function (languages_) { + var languages = languages_ + + // support flattened arguments + if (languages && !Array.isArray(languages)) { + languages = new Array(arguments.length) + for (var i = 0; i < languages.length; i++) { + languages[i] = arguments[i] + } + } + + // no languages, return all requested languages + if (!languages || languages.length === 0) { + return this.negotiator.languages() + } + + return this.negotiator.languages(languages)[0] || false +} + +/** + * Convert extnames to mime. + * + * @param {String} type + * @return {String} + * @private + */ + +function extToMime (type) { + return type.indexOf('/') === -1 + ? mime.lookup(type) + : type +} + +/** + * Check if mime is valid. + * + * @param {String} type + * @return {Boolean} + * @private + */ + +function validMime (type) { + return typeof type === 'string' +} diff --git a/node_modules/accepts/package.json b/node_modules/accepts/package.json new file mode 100644 index 0000000..b35b262 --- /dev/null +++ b/node_modules/accepts/package.json @@ -0,0 +1,47 @@ +{ + "name": "accepts", + "description": "Higher-level content negotiation", + "version": "2.0.0", + "contributors": [ + "Douglas Christopher Wilson ", + "Jonathan Ong (http://jongleberry.com)" + ], + "license": "MIT", + "repository": "jshttp/accepts", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "devDependencies": { + "deep-equal": "1.0.1", + "eslint": "7.32.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.25.4", + "eslint-plugin-markdown": "2.2.1", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "4.3.1", + "eslint-plugin-standard": "4.1.0", + "mocha": "9.2.0", + "nyc": "15.1.0" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec --check-leaks --bail test/", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + }, + "keywords": [ + "content", + "negotiation", + "accept", + "accepts" + ] +} diff --git a/node_modules/ajv/.tonic_example.js b/node_modules/ajv/.tonic_example.js new file mode 100644 index 0000000..aa11812 --- /dev/null +++ b/node_modules/ajv/.tonic_example.js @@ -0,0 +1,20 @@ +var Ajv = require('ajv'); +var ajv = new Ajv({allErrors: true}); + +var schema = { + "properties": { + "foo": { "type": "string" }, + "bar": { "type": "number", "maximum": 3 } + } +}; + +var validate = ajv.compile(schema); + +test({"foo": "abc", "bar": 2}); +test({"foo": 2, "bar": 4}); + +function test(data) { + var valid = validate(data); + if (valid) console.log('Valid!'); + else console.log('Invalid: ' + ajv.errorsText(validate.errors)); +} \ No newline at end of file diff --git a/node_modules/ajv/LICENSE b/node_modules/ajv/LICENSE new file mode 100644 index 0000000..96ee719 --- /dev/null +++ b/node_modules/ajv/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015-2017 Evgeny Poberezkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/node_modules/ajv/README.md b/node_modules/ajv/README.md new file mode 100644 index 0000000..5aa2078 --- /dev/null +++ b/node_modules/ajv/README.md @@ -0,0 +1,1497 @@ +Ajv logo + +# Ajv: Another JSON Schema Validator + +The fastest JSON Schema validator for Node.js and browser. Supports draft-04/06/07. + +[![Build Status](https://travis-ci.org/ajv-validator/ajv.svg?branch=master)](https://travis-ci.org/ajv-validator/ajv) +[![npm](https://img.shields.io/npm/v/ajv.svg)](https://www.npmjs.com/package/ajv) +[![npm (beta)](https://img.shields.io/npm/v/ajv/beta)](https://www.npmjs.com/package/ajv/v/7.0.0-beta.0) +[![npm downloads](https://img.shields.io/npm/dm/ajv.svg)](https://www.npmjs.com/package/ajv) +[![Coverage Status](https://coveralls.io/repos/github/ajv-validator/ajv/badge.svg?branch=master)](https://coveralls.io/github/ajv-validator/ajv?branch=master) +[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv) +[![GitHub Sponsors](https://img.shields.io/badge/$-sponsors-brightgreen)](https://github.com/sponsors/epoberezkin) + + +## Ajv v7 beta is released + +[Ajv version 7.0.0-beta.0](https://github.com/ajv-validator/ajv/tree/v7-beta) is released with these changes: + +- to reduce the mistakes in JSON schemas and unexpected validation results, [strict mode](./docs/strict-mode.md) is added - it prohibits ignored or ambiguous JSON Schema elements. +- to make code injection from untrusted schemas impossible, [code generation](./docs/codegen.md) is fully re-written to be safe. +- to simplify Ajv extensions, the new keyword API that is used by pre-defined keywords is available to user-defined keywords - it is much easier to define any keywords now, especially with subschemas. +- schemas are compiled to ES6 code (ES5 code generation is supported with an option). +- to improve reliability and maintainability the code is migrated to TypeScript. + +**Please note**: + +- the support for JSON-Schema draft-04 is removed - if you have schemas using "id" attributes you have to replace them with "\$id" (or continue using version 6 that will be supported until 02/28/2021). +- all formats are separated to ajv-formats package - they have to be explicitely added if you use them. + +See [release notes](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0-beta.0) for the details. + +To install the new version: + +```bash +npm install ajv@beta +``` + +See [Getting started with v7](https://github.com/ajv-validator/ajv/tree/v7-beta#usage) for code example. + + +## Mozilla MOSS grant and OpenJS Foundation + +[](https://www.mozilla.org/en-US/moss/)     [](https://openjsf.org/blog/2020/08/14/ajv-joins-openjs-foundation-as-an-incubation-project/) + +Ajv has been awarded a grant from Mozilla’s [Open Source Support (MOSS) program](https://www.mozilla.org/en-US/moss/) in the “Foundational Technology” track! It will sponsor the development of Ajv support of [JSON Schema version 2019-09](https://tools.ietf.org/html/draft-handrews-json-schema-02) and of [JSON Type Definition](https://tools.ietf.org/html/draft-ucarion-json-type-definition-04). + +Ajv also joined [OpenJS Foundation](https://openjsf.org/) – having this support will help ensure the longevity and stability of Ajv for all its users. + +This [blog post](https://www.poberezkin.com/posts/2020-08-14-ajv-json-validator-mozilla-open-source-grant-openjs-foundation.html) has more details. + +I am looking for the long term maintainers of Ajv – working with [ReadySet](https://www.thereadyset.co/), also sponsored by Mozilla, to establish clear guidelines for the role of a "maintainer" and the contribution standards, and to encourage a wider, more inclusive, contribution from the community. + + +## Please [sponsor Ajv development](https://github.com/sponsors/epoberezkin) + +Since I asked to support Ajv development 40 people and 6 organizations contributed via GitHub and OpenCollective - this support helped receiving the MOSS grant! + +Your continuing support is very important - the funds will be used to develop and maintain Ajv once the next major version is released. + +Please sponsor Ajv via: +- [GitHub sponsors page](https://github.com/sponsors/epoberezkin) (GitHub will match it) +- [Ajv Open Collective️](https://opencollective.com/ajv) + +Thank you. + + +#### Open Collective sponsors + + + + + + + + + + + + + + + +## Using version 6 + +[JSON Schema draft-07](http://json-schema.org/latest/json-schema-validation.html) is published. + +[Ajv version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0) that supports draft-07 is released. It may require either migrating your schemas or updating your code (to continue using draft-04 and v5 schemas, draft-06 schemas will be supported without changes). + +__Please note__: To use Ajv with draft-06 schemas you need to explicitly add the meta-schema to the validator instance: + +```javascript +ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-06.json')); +``` + +To use Ajv with draft-04 schemas in addition to explicitly adding meta-schema you also need to use option schemaId: + +```javascript +var ajv = new Ajv({schemaId: 'id'}); +// If you want to use both draft-04 and draft-06/07 schemas: +// var ajv = new Ajv({schemaId: 'auto'}); +ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json')); +``` + + +## Contents + +- [Performance](#performance) +- [Features](#features) +- [Getting started](#getting-started) +- [Frequently Asked Questions](https://github.com/ajv-validator/ajv/blob/master/FAQ.md) +- [Using in browser](#using-in-browser) + - [Ajv and Content Security Policies (CSP)](#ajv-and-content-security-policies-csp) +- [Command line interface](#command-line-interface) +- Validation + - [Keywords](#validation-keywords) + - [Annotation keywords](#annotation-keywords) + - [Formats](#formats) + - [Combining schemas with $ref](#ref) + - [$data reference](#data-reference) + - NEW: [$merge and $patch keywords](#merge-and-patch-keywords) + - [Defining custom keywords](#defining-custom-keywords) + - [Asynchronous schema compilation](#asynchronous-schema-compilation) + - [Asynchronous validation](#asynchronous-validation) +- [Security considerations](#security-considerations) + - [Security contact](#security-contact) + - [Untrusted schemas](#untrusted-schemas) + - [Circular references in objects](#circular-references-in-javascript-objects) + - [Trusted schemas](#security-risks-of-trusted-schemas) + - [ReDoS attack](#redos-attack) +- Modifying data during validation + - [Filtering data](#filtering-data) + - [Assigning defaults](#assigning-defaults) + - [Coercing data types](#coercing-data-types) +- API + - [Methods](#api) + - [Options](#options) + - [Validation errors](#validation-errors) +- [Plugins](#plugins) +- [Related packages](#related-packages) +- [Some packages using Ajv](#some-packages-using-ajv) +- [Tests, Contributing, Changes history](#tests) +- [Support, Code of conduct, License](#open-source-software-support) + + +## Performance + +Ajv generates code using [doT templates](https://github.com/olado/doT) to turn JSON Schemas into super-fast validation functions that are efficient for v8 optimization. + +Currently Ajv is the fastest and the most standard compliant validator according to these benchmarks: + +- [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark) - 50% faster than the second place +- [jsck benchmark](https://github.com/pandastrike/jsck#benchmarks) - 20-190% faster +- [z-schema benchmark](https://rawgit.com/zaggino/z-schema/master/benchmark/results.html) +- [themis benchmark](https://cdn.rawgit.com/playlyfe/themis/master/benchmark/results.html) + + +Performance of different validators by [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark): + +[![performance](https://chart.googleapis.com/chart?chxt=x,y&cht=bhs&chco=76A4FB&chls=2.0&chbh=32,4,1&chs=600x416&chxl=-1:|djv|ajv|json-schema-validator-generator|jsen|is-my-json-valid|themis|z-schema|jsck|skeemas|json-schema-library|tv4&chd=t:100,98,72.1,66.8,50.1,15.1,6.1,3.8,1.2,0.7,0.2)](https://github.com/ebdrup/json-schema-benchmark/blob/master/README.md#performance) + + +## Features + +- Ajv implements full JSON Schema [draft-06/07](http://json-schema.org/) and draft-04 standards: + - all validation keywords (see [JSON Schema validation keywords](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md)) + - full support of remote refs (remote schemas have to be added with `addSchema` or compiled to be available) + - support of circular references between schemas + - correct string lengths for strings with unicode pairs (can be turned off) + - [formats](#formats) defined by JSON Schema draft-07 standard and custom formats (can be turned off) + - [validates schemas against meta-schema](#api-validateschema) +- supports [browsers](#using-in-browser) and Node.js 0.10-14.x +- [asynchronous loading](#asynchronous-schema-compilation) of referenced schemas during compilation +- "All errors" validation mode with [option allErrors](#options) +- [error messages with parameters](#validation-errors) describing error reasons to allow creating custom error messages +- i18n error messages support with [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) package +- [filtering data](#filtering-data) from additional properties +- [assigning defaults](#assigning-defaults) to missing properties and items +- [coercing data](#coercing-data-types) to the types specified in `type` keywords +- [custom keywords](#defining-custom-keywords) +- draft-06/07 keywords `const`, `contains`, `propertyNames` and `if/then/else` +- draft-06 boolean schemas (`true`/`false` as a schema to always pass/fail). +- keywords `switch`, `patternRequired`, `formatMaximum` / `formatMinimum` and `formatExclusiveMaximum` / `formatExclusiveMinimum` from [JSON Schema extension proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals) with [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package +- [$data reference](#data-reference) to use values from the validated data as values for the schema keywords +- [asynchronous validation](#asynchronous-validation) of custom formats and keywords + + +## Install + +``` +npm install ajv +``` + + +## Getting started + +Try it in the Node.js REPL: https://tonicdev.com/npm/ajv + + +The fastest validation call: + +```javascript +// Node.js require: +var Ajv = require('ajv'); +// or ESM/TypeScript import +import Ajv from 'ajv'; + +var ajv = new Ajv(); // options can be passed, e.g. {allErrors: true} +var validate = ajv.compile(schema); +var valid = validate(data); +if (!valid) console.log(validate.errors); +``` + +or with less code + +```javascript +// ... +var valid = ajv.validate(schema, data); +if (!valid) console.log(ajv.errors); +// ... +``` + +or + +```javascript +// ... +var valid = ajv.addSchema(schema, 'mySchema') + .validate('mySchema', data); +if (!valid) console.log(ajv.errorsText()); +// ... +``` + +See [API](#api) and [Options](#options) for more details. + +Ajv compiles schemas to functions and caches them in all cases (using schema serialized with [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) or a custom function as a key), so that the next time the same schema is used (not necessarily the same object instance) it won't be compiled again. + +The best performance is achieved when using compiled functions returned by `compile` or `getSchema` methods (there is no additional function call). + +__Please note__: every time a validation function or `ajv.validate` are called `errors` property is overwritten. You need to copy `errors` array reference to another variable if you want to use it later (e.g., in the callback). See [Validation errors](#validation-errors) + +__Note for TypeScript users__: `ajv` provides its own TypeScript declarations +out of the box, so you don't need to install the deprecated `@types/ajv` +module. + + +## Using in browser + +You can require Ajv directly from the code you browserify - in this case Ajv will be a part of your bundle. + +If you need to use Ajv in several bundles you can create a separate UMD bundle using `npm run bundle` script (thanks to [siddo420](https://github.com/siddo420)). + +Then you need to load Ajv in the browser: +```html + +``` + +This bundle can be used with different module systems; it creates global `Ajv` if no module system is found. + +The browser bundle is available on [cdnjs](https://cdnjs.com/libraries/ajv). + +Ajv is tested with these browsers: + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/epoberezkin.svg)](https://saucelabs.com/u/epoberezkin) + +__Please note__: some frameworks, e.g. Dojo, may redefine global require in such way that is not compatible with CommonJS module format. In such case Ajv bundle has to be loaded before the framework and then you can use global Ajv (see issue [#234](https://github.com/ajv-validator/ajv/issues/234)). + + +### Ajv and Content Security Policies (CSP) + +If you're using Ajv to compile a schema (the typical use) in a browser document that is loaded with a Content Security Policy (CSP), that policy will require a `script-src` directive that includes the value `'unsafe-eval'`. +:warning: NOTE, however, that `unsafe-eval` is NOT recommended in a secure CSP[[1]](https://developer.chrome.com/extensions/contentSecurityPolicy#relaxing-eval), as it has the potential to open the document to cross-site scripting (XSS) attacks. + +In order to make use of Ajv without easing your CSP, you can [pre-compile a schema using the CLI](https://github.com/ajv-validator/ajv-cli#compile-schemas). This will transpile the schema JSON into a JavaScript file that exports a `validate` function that works simlarly to a schema compiled at runtime. + +Note that pre-compilation of schemas is performed using [ajv-pack](https://github.com/ajv-validator/ajv-pack) and there are [some limitations to the schema features it can compile](https://github.com/ajv-validator/ajv-pack#limitations). A successfully pre-compiled schema is equivalent to the same schema compiled at runtime. + + +## Command line interface + +CLI is available as a separate npm package [ajv-cli](https://github.com/ajv-validator/ajv-cli). It supports: + +- compiling JSON Schemas to test their validity +- BETA: generating standalone module exporting a validation function to be used without Ajv (using [ajv-pack](https://github.com/ajv-validator/ajv-pack)) +- migrate schemas to draft-07 (using [json-schema-migrate](https://github.com/epoberezkin/json-schema-migrate)) +- validating data file(s) against JSON Schema +- testing expected validity of data against JSON Schema +- referenced schemas +- custom meta-schemas +- files in JSON, JSON5, YAML, and JavaScript format +- all Ajv options +- reporting changes in data after validation in [JSON-patch](https://tools.ietf.org/html/rfc6902) format + + +## Validation keywords + +Ajv supports all validation keywords from draft-07 of JSON Schema standard: + +- [type](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#type) +- [for numbers](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-numbers) - maximum, minimum, exclusiveMaximum, exclusiveMinimum, multipleOf +- [for strings](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-strings) - maxLength, minLength, pattern, format +- [for arrays](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-arrays) - maxItems, minItems, uniqueItems, items, additionalItems, [contains](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#contains) +- [for objects](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-objects) - maxProperties, minProperties, required, properties, patternProperties, additionalProperties, dependencies, [propertyNames](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#propertynames) +- [for all types](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#keywords-for-all-types) - enum, [const](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#const) +- [compound keywords](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#compound-keywords) - not, oneOf, anyOf, allOf, [if/then/else](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#ifthenelse) + +With [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package Ajv also supports validation keywords from [JSON Schema extension proposals](https://github.com/json-schema/json-schema/wiki/v5-Proposals) for JSON Schema standard: + +- [patternRequired](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#patternrequired-proposed) - like `required` but with patterns that some property should match. +- [formatMaximum, formatMinimum, formatExclusiveMaximum, formatExclusiveMinimum](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md#formatmaximum--formatminimum-and-exclusiveformatmaximum--exclusiveformatminimum-proposed) - setting limits for date, time, etc. + +See [JSON Schema validation keywords](https://github.com/ajv-validator/ajv/blob/master/KEYWORDS.md) for more details. + + +## Annotation keywords + +JSON Schema specification defines several annotation keywords that describe schema itself but do not perform any validation. + +- `title` and `description`: information about the data represented by that schema +- `$comment` (NEW in draft-07): information for developers. With option `$comment` Ajv logs or passes the comment string to the user-supplied function. See [Options](#options). +- `default`: a default value of the data instance, see [Assigning defaults](#assigning-defaults). +- `examples` (NEW in draft-06): an array of data instances. Ajv does not check the validity of these instances against the schema. +- `readOnly` and `writeOnly` (NEW in draft-07): marks data-instance as read-only or write-only in relation to the source of the data (database, api, etc.). +- `contentEncoding`: [RFC 2045](https://tools.ietf.org/html/rfc2045#section-6.1 ), e.g., "base64". +- `contentMediaType`: [RFC 2046](https://tools.ietf.org/html/rfc2046), e.g., "image/png". + +__Please note__: Ajv does not implement validation of the keywords `examples`, `contentEncoding` and `contentMediaType` but it reserves them. If you want to create a plugin that implements some of them, it should remove these keywords from the instance. + + +## Formats + +Ajv implements formats defined by JSON Schema specification and several other formats. It is recommended NOT to use "format" keyword implementations with untrusted data, as they use potentially unsafe regular expressions - see [ReDoS attack](#redos-attack). + +__Please note__: if you need to use "format" keyword to validate untrusted data, you MUST assess their suitability and safety for your validation scenarios. + +The following formats are implemented for string validation with "format" keyword: + +- _date_: full-date according to [RFC3339](http://tools.ietf.org/html/rfc3339#section-5.6). +- _time_: time with optional time-zone. +- _date-time_: date-time from the same source (time-zone is mandatory). `date`, `time` and `date-time` validate ranges in `full` mode and only regexp in `fast` mode (see [options](#options)). +- _uri_: full URI. +- _uri-reference_: URI reference, including full and relative URIs. +- _uri-template_: URI template according to [RFC6570](https://tools.ietf.org/html/rfc6570) +- _url_ (deprecated): [URL record](https://url.spec.whatwg.org/#concept-url). +- _email_: email address. +- _hostname_: host name according to [RFC1034](http://tools.ietf.org/html/rfc1034#section-3.5). +- _ipv4_: IP address v4. +- _ipv6_: IP address v6. +- _regex_: tests whether a string is a valid regular expression by passing it to RegExp constructor. +- _uuid_: Universally Unique IDentifier according to [RFC4122](http://tools.ietf.org/html/rfc4122). +- _json-pointer_: JSON-pointer according to [RFC6901](https://tools.ietf.org/html/rfc6901). +- _relative-json-pointer_: relative JSON-pointer according to [this draft](http://tools.ietf.org/html/draft-luff-relative-json-pointer-00). + +__Please note__: JSON Schema draft-07 also defines formats `iri`, `iri-reference`, `idn-hostname` and `idn-email` for URLs, hostnames and emails with international characters. Ajv does not implement these formats. If you create Ajv plugin that implements them please make a PR to mention this plugin here. + +There are two modes of format validation: `fast` and `full`. This mode affects formats `date`, `time`, `date-time`, `uri`, `uri-reference`, and `email`. See [Options](#options) for details. + +You can add additional formats and replace any of the formats above using [addFormat](#api-addformat) method. + +The option `unknownFormats` allows changing the default behaviour when an unknown format is encountered. In this case Ajv can either fail schema compilation (default) or ignore it (default in versions before 5.0.0). You also can allow specific format(s) that will be ignored. See [Options](#options) for details. + +You can find regular expressions used for format validation and the sources that were used in [formats.js](https://github.com/ajv-validator/ajv/blob/master/lib/compile/formats.js). + + +## Combining schemas with $ref + +You can structure your validation logic across multiple schema files and have schemas reference each other using `$ref` keyword. + +Example: + +```javascript +var schema = { + "$id": "http://example.com/schemas/schema.json", + "type": "object", + "properties": { + "foo": { "$ref": "defs.json#/definitions/int" }, + "bar": { "$ref": "defs.json#/definitions/str" } + } +}; + +var defsSchema = { + "$id": "http://example.com/schemas/defs.json", + "definitions": { + "int": { "type": "integer" }, + "str": { "type": "string" } + } +}; +``` + +Now to compile your schema you can either pass all schemas to Ajv instance: + +```javascript +var ajv = new Ajv({schemas: [schema, defsSchema]}); +var validate = ajv.getSchema('http://example.com/schemas/schema.json'); +``` + +or use `addSchema` method: + +```javascript +var ajv = new Ajv; +var validate = ajv.addSchema(defsSchema) + .compile(schema); +``` + +See [Options](#options) and [addSchema](#api) method. + +__Please note__: +- `$ref` is resolved as the uri-reference using schema $id as the base URI (see the example). +- References can be recursive (and mutually recursive) to implement the schemas for different data structures (such as linked lists, trees, graphs, etc.). +- You don't have to host your schema files at the URIs that you use as schema $id. These URIs are only used to identify the schemas, and according to JSON Schema specification validators should not expect to be able to download the schemas from these URIs. +- The actual location of the schema file in the file system is not used. +- You can pass the identifier of the schema as the second parameter of `addSchema` method or as a property name in `schemas` option. This identifier can be used instead of (or in addition to) schema $id. +- You cannot have the same $id (or the schema identifier) used for more than one schema - the exception will be thrown. +- You can implement dynamic resolution of the referenced schemas using `compileAsync` method. In this way you can store schemas in any system (files, web, database, etc.) and reference them without explicitly adding to Ajv instance. See [Asynchronous schema compilation](#asynchronous-schema-compilation). + + +## $data reference + +With `$data` option you can use values from the validated data as the values for the schema keywords. See [proposal](https://github.com/json-schema-org/json-schema-spec/issues/51) for more information about how it works. + +`$data` reference is supported in the keywords: const, enum, format, maximum/minimum, exclusiveMaximum / exclusiveMinimum, maxLength / minLength, maxItems / minItems, maxProperties / minProperties, formatMaximum / formatMinimum, formatExclusiveMaximum / formatExclusiveMinimum, multipleOf, pattern, required, uniqueItems. + +The value of "$data" should be a [JSON-pointer](https://tools.ietf.org/html/rfc6901) to the data (the root is always the top level data object, even if the $data reference is inside a referenced subschema) or a [relative JSON-pointer](http://tools.ietf.org/html/draft-luff-relative-json-pointer-00) (it is relative to the current point in data; if the $data reference is inside a referenced subschema it cannot point to the data outside of the root level for this subschema). + +Examples. + +This schema requires that the value in property `smaller` is less or equal than the value in the property larger: + +```javascript +var ajv = new Ajv({$data: true}); + +var schema = { + "properties": { + "smaller": { + "type": "number", + "maximum": { "$data": "1/larger" } + }, + "larger": { "type": "number" } + } +}; + +var validData = { + smaller: 5, + larger: 7 +}; + +ajv.validate(schema, validData); // true +``` + +This schema requires that the properties have the same format as their field names: + +```javascript +var schema = { + "additionalProperties": { + "type": "string", + "format": { "$data": "0#" } + } +}; + +var validData = { + 'date-time': '1963-06-19T08:30:06.283185Z', + email: 'joe.bloggs@example.com' +} +``` + +`$data` reference is resolved safely - it won't throw even if some property is undefined. If `$data` resolves to `undefined` the validation succeeds (with the exclusion of `const` keyword). If `$data` resolves to incorrect type (e.g. not "number" for maximum keyword) the validation fails. + + +## $merge and $patch keywords + +With the package [ajv-merge-patch](https://github.com/ajv-validator/ajv-merge-patch) you can use the keywords `$merge` and `$patch` that allow extending JSON Schemas with patches using formats [JSON Merge Patch (RFC 7396)](https://tools.ietf.org/html/rfc7396) and [JSON Patch (RFC 6902)](https://tools.ietf.org/html/rfc6902). + +To add keywords `$merge` and `$patch` to Ajv instance use this code: + +```javascript +require('ajv-merge-patch')(ajv); +``` + +Examples. + +Using `$merge`: + +```json +{ + "$merge": { + "source": { + "type": "object", + "properties": { "p": { "type": "string" } }, + "additionalProperties": false + }, + "with": { + "properties": { "q": { "type": "number" } } + } + } +} +``` + +Using `$patch`: + +```json +{ + "$patch": { + "source": { + "type": "object", + "properties": { "p": { "type": "string" } }, + "additionalProperties": false + }, + "with": [ + { "op": "add", "path": "/properties/q", "value": { "type": "number" } } + ] + } +} +``` + +The schemas above are equivalent to this schema: + +```json +{ + "type": "object", + "properties": { + "p": { "type": "string" }, + "q": { "type": "number" } + }, + "additionalProperties": false +} +``` + +The properties `source` and `with` in the keywords `$merge` and `$patch` can use absolute or relative `$ref` to point to other schemas previously added to the Ajv instance or to the fragments of the current schema. + +See the package [ajv-merge-patch](https://github.com/ajv-validator/ajv-merge-patch) for more information. + + +## Defining custom keywords + +The advantages of using custom keywords are: + +- allow creating validation scenarios that cannot be expressed using JSON Schema +- simplify your schemas +- help bringing a bigger part of the validation logic to your schemas +- make your schemas more expressive, less verbose and closer to your application domain +- implement custom data processors that modify your data (`modifying` option MUST be used in keyword definition) and/or create side effects while the data is being validated + +If a keyword is used only for side-effects and its validation result is pre-defined, use option `valid: true/false` in keyword definition to simplify both generated code (no error handling in case of `valid: true`) and your keyword functions (no need to return any validation result). + +The concerns you have to be aware of when extending JSON Schema standard with custom keywords are the portability and understanding of your schemas. You will have to support these custom keywords on other platforms and to properly document these keywords so that everybody can understand them in your schemas. + +You can define custom keywords with [addKeyword](#api-addkeyword) method. Keywords are defined on the `ajv` instance level - new instances will not have previously defined keywords. + +Ajv allows defining keywords with: +- validation function +- compilation function +- macro function +- inline compilation function that should return code (as string) that will be inlined in the currently compiled schema. + +Example. `range` and `exclusiveRange` keywords using compiled schema: + +```javascript +ajv.addKeyword('range', { + type: 'number', + compile: function (sch, parentSchema) { + var min = sch[0]; + var max = sch[1]; + + return parentSchema.exclusiveRange === true + ? function (data) { return data > min && data < max; } + : function (data) { return data >= min && data <= max; } + } +}); + +var schema = { "range": [2, 4], "exclusiveRange": true }; +var validate = ajv.compile(schema); +console.log(validate(2.01)); // true +console.log(validate(3.99)); // true +console.log(validate(2)); // false +console.log(validate(4)); // false +``` + +Several custom keywords (typeof, instanceof, range and propertyNames) are defined in [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package - they can be used for your schemas and as a starting point for your own custom keywords. + +See [Defining custom keywords](https://github.com/ajv-validator/ajv/blob/master/CUSTOM.md) for more details. + + +## Asynchronous schema compilation + +During asynchronous compilation remote references are loaded using supplied function. See `compileAsync` [method](#api-compileAsync) and `loadSchema` [option](#options). + +Example: + +```javascript +var ajv = new Ajv({ loadSchema: loadSchema }); + +ajv.compileAsync(schema).then(function (validate) { + var valid = validate(data); + // ... +}); + +function loadSchema(uri) { + return request.json(uri).then(function (res) { + if (res.statusCode >= 400) + throw new Error('Loading error: ' + res.statusCode); + return res.body; + }); +} +``` + +__Please note__: [Option](#options) `missingRefs` should NOT be set to `"ignore"` or `"fail"` for asynchronous compilation to work. + + +## Asynchronous validation + +Example in Node.js REPL: https://tonicdev.com/esp/ajv-asynchronous-validation + +You can define custom formats and keywords that perform validation asynchronously by accessing database or some other service. You should add `async: true` in the keyword or format definition (see [addFormat](#api-addformat), [addKeyword](#api-addkeyword) and [Defining custom keywords](#defining-custom-keywords)). + +If your schema uses asynchronous formats/keywords or refers to some schema that contains them it should have `"$async": true` keyword so that Ajv can compile it correctly. If asynchronous format/keyword or reference to asynchronous schema is used in the schema without `$async` keyword Ajv will throw an exception during schema compilation. + +__Please note__: all asynchronous subschemas that are referenced from the current or other schemas should have `"$async": true` keyword as well, otherwise the schema compilation will fail. + +Validation function for an asynchronous custom format/keyword should return a promise that resolves with `true` or `false` (or rejects with `new Ajv.ValidationError(errors)` if you want to return custom errors from the keyword function). + +Ajv compiles asynchronous schemas to [es7 async functions](http://tc39.github.io/ecmascript-asyncawait/) that can optionally be transpiled with [nodent](https://github.com/MatAtBread/nodent). Async functions are supported in Node.js 7+ and all modern browsers. You can also supply any other transpiler as a function via `processCode` option. See [Options](#options). + +The compiled validation function has `$async: true` property (if the schema is asynchronous), so you can differentiate these functions if you are using both synchronous and asynchronous schemas. + +Validation result will be a promise that resolves with validated data or rejects with an exception `Ajv.ValidationError` that contains the array of validation errors in `errors` property. + + +Example: + +```javascript +var ajv = new Ajv; +// require('ajv-async')(ajv); + +ajv.addKeyword('idExists', { + async: true, + type: 'number', + validate: checkIdExists +}); + + +function checkIdExists(schema, data) { + return knex(schema.table) + .select('id') + .where('id', data) + .then(function (rows) { + return !!rows.length; // true if record is found + }); +} + +var schema = { + "$async": true, + "properties": { + "userId": { + "type": "integer", + "idExists": { "table": "users" } + }, + "postId": { + "type": "integer", + "idExists": { "table": "posts" } + } + } +}; + +var validate = ajv.compile(schema); + +validate({ userId: 1, postId: 19 }) +.then(function (data) { + console.log('Data is valid', data); // { userId: 1, postId: 19 } +}) +.catch(function (err) { + if (!(err instanceof Ajv.ValidationError)) throw err; + // data is invalid + console.log('Validation errors:', err.errors); +}); +``` + +### Using transpilers with asynchronous validation functions. + +[ajv-async](https://github.com/ajv-validator/ajv-async) uses [nodent](https://github.com/MatAtBread/nodent) to transpile async functions. To use another transpiler you should separately install it (or load its bundle in the browser). + + +#### Using nodent + +```javascript +var ajv = new Ajv; +require('ajv-async')(ajv); +// in the browser if you want to load ajv-async bundle separately you can: +// window.ajvAsync(ajv); +var validate = ajv.compile(schema); // transpiled es7 async function +validate(data).then(successFunc).catch(errorFunc); +``` + + +#### Using other transpilers + +```javascript +var ajv = new Ajv({ processCode: transpileFunc }); +var validate = ajv.compile(schema); // transpiled es7 async function +validate(data).then(successFunc).catch(errorFunc); +``` + +See [Options](#options). + + +## Security considerations + +JSON Schema, if properly used, can replace data sanitisation. It doesn't replace other API security considerations. It also introduces additional security aspects to consider. + + +##### Security contact + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerabilities via GitHub issues. + + +##### Untrusted schemas + +Ajv treats JSON schemas as trusted as your application code. This security model is based on the most common use case, when the schemas are static and bundled together with the application. + +If your schemas are received from untrusted sources (or generated from untrusted data) there are several scenarios you need to prevent: +- compiling schemas can cause stack overflow (if they are too deep) +- compiling schemas can be slow (e.g. [#557](https://github.com/ajv-validator/ajv/issues/557)) +- validating certain data can be slow + +It is difficult to predict all the scenarios, but at the very least it may help to limit the size of untrusted schemas (e.g. limit JSON string length) and also the maximum schema object depth (that can be high for relatively small JSON strings). You also may want to mitigate slow regular expressions in `pattern` and `patternProperties` keywords. + +Regardless the measures you take, using untrusted schemas increases security risks. + + +##### Circular references in JavaScript objects + +Ajv does not support schemas and validated data that have circular references in objects. See [issue #802](https://github.com/ajv-validator/ajv/issues/802). + +An attempt to compile such schemas or validate such data would cause stack overflow (or will not complete in case of asynchronous validation). Depending on the parser you use, untrusted data can lead to circular references. + + +##### Security risks of trusted schemas + +Some keywords in JSON Schemas can lead to very slow validation for certain data. These keywords include (but may be not limited to): + +- `pattern` and `format` for large strings - in some cases using `maxLength` can help mitigate it, but certain regular expressions can lead to exponential validation time even with relatively short strings (see [ReDoS attack](#redos-attack)). +- `patternProperties` for large property names - use `propertyNames` to mitigate, but some regular expressions can have exponential evaluation time as well. +- `uniqueItems` for large non-scalar arrays - use `maxItems` to mitigate + +__Please note__: The suggestions above to prevent slow validation would only work if you do NOT use `allErrors: true` in production code (using it would continue validation after validation errors). + +You can validate your JSON schemas against [this meta-schema](https://github.com/ajv-validator/ajv/blob/master/lib/refs/json-schema-secure.json) to check that these recommendations are followed: + +```javascript +const isSchemaSecure = ajv.compile(require('ajv/lib/refs/json-schema-secure.json')); + +const schema1 = {format: 'email'}; +isSchemaSecure(schema1); // false + +const schema2 = {format: 'email', maxLength: MAX_LENGTH}; +isSchemaSecure(schema2); // true +``` + +__Please note__: following all these recommendation is not a guarantee that validation of untrusted data is safe - it can still lead to some undesirable results. + + +##### Content Security Policies (CSP) +See [Ajv and Content Security Policies (CSP)](#ajv-and-content-security-policies-csp) + + +## ReDoS attack + +Certain regular expressions can lead to the exponential evaluation time even with relatively short strings. + +Please assess the regular expressions you use in the schemas on their vulnerability to this attack - see [safe-regex](https://github.com/substack/safe-regex), for example. + +__Please note__: some formats that Ajv implements use [regular expressions](https://github.com/ajv-validator/ajv/blob/master/lib/compile/formats.js) that can be vulnerable to ReDoS attack, so if you use Ajv to validate data from untrusted sources __it is strongly recommended__ to consider the following: + +- making assessment of "format" implementations in Ajv. +- using `format: 'fast'` option that simplifies some of the regular expressions (although it does not guarantee that they are safe). +- replacing format implementations provided by Ajv with your own implementations of "format" keyword that either uses different regular expressions or another approach to format validation. Please see [addFormat](#api-addformat) method. +- disabling format validation by ignoring "format" keyword with option `format: false` + +Whatever mitigation you choose, please assume all formats provided by Ajv as potentially unsafe and make your own assessment of their suitability for your validation scenarios. + + +## Filtering data + +With [option `removeAdditional`](#options) (added by [andyscott](https://github.com/andyscott)) you can filter data during the validation. + +This option modifies original data. + +Example: + +```javascript +var ajv = new Ajv({ removeAdditional: true }); +var schema = { + "additionalProperties": false, + "properties": { + "foo": { "type": "number" }, + "bar": { + "additionalProperties": { "type": "number" }, + "properties": { + "baz": { "type": "string" } + } + } + } +} + +var data = { + "foo": 0, + "additional1": 1, // will be removed; `additionalProperties` == false + "bar": { + "baz": "abc", + "additional2": 2 // will NOT be removed; `additionalProperties` != false + }, +} + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // { "foo": 0, "bar": { "baz": "abc", "additional2": 2 } +``` + +If `removeAdditional` option in the example above were `"all"` then both `additional1` and `additional2` properties would have been removed. + +If the option were `"failing"` then property `additional1` would have been removed regardless of its value and property `additional2` would have been removed only if its value were failing the schema in the inner `additionalProperties` (so in the example above it would have stayed because it passes the schema, but any non-number would have been removed). + +__Please note__: If you use `removeAdditional` option with `additionalProperties` keyword inside `anyOf`/`oneOf` keywords your validation can fail with this schema, for example: + +```json +{ + "type": "object", + "oneOf": [ + { + "properties": { + "foo": { "type": "string" } + }, + "required": [ "foo" ], + "additionalProperties": false + }, + { + "properties": { + "bar": { "type": "integer" } + }, + "required": [ "bar" ], + "additionalProperties": false + } + ] +} +``` + +The intention of the schema above is to allow objects with either the string property "foo" or the integer property "bar", but not with both and not with any other properties. + +With the option `removeAdditional: true` the validation will pass for the object `{ "foo": "abc"}` but will fail for the object `{"bar": 1}`. It happens because while the first subschema in `oneOf` is validated, the property `bar` is removed because it is an additional property according to the standard (because it is not included in `properties` keyword in the same schema). + +While this behaviour is unexpected (issues [#129](https://github.com/ajv-validator/ajv/issues/129), [#134](https://github.com/ajv-validator/ajv/issues/134)), it is correct. To have the expected behaviour (both objects are allowed and additional properties are removed) the schema has to be refactored in this way: + +```json +{ + "type": "object", + "properties": { + "foo": { "type": "string" }, + "bar": { "type": "integer" } + }, + "additionalProperties": false, + "oneOf": [ + { "required": [ "foo" ] }, + { "required": [ "bar" ] } + ] +} +``` + +The schema above is also more efficient - it will compile into a faster function. + + +## Assigning defaults + +With [option `useDefaults`](#options) Ajv will assign values from `default` keyword in the schemas of `properties` and `items` (when it is the array of schemas) to the missing properties and items. + +With the option value `"empty"` properties and items equal to `null` or `""` (empty string) will be considered missing and assigned defaults. + +This option modifies original data. + +__Please note__: the default value is inserted in the generated validation code as a literal, so the value inserted in the data will be the deep clone of the default in the schema. + + +Example 1 (`default` in `properties`): + +```javascript +var ajv = new Ajv({ useDefaults: true }); +var schema = { + "type": "object", + "properties": { + "foo": { "type": "number" }, + "bar": { "type": "string", "default": "baz" } + }, + "required": [ "foo", "bar" ] +}; + +var data = { "foo": 1 }; + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // { "foo": 1, "bar": "baz" } +``` + +Example 2 (`default` in `items`): + +```javascript +var schema = { + "type": "array", + "items": [ + { "type": "number" }, + { "type": "string", "default": "foo" } + ] +} + +var data = [ 1 ]; + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // [ 1, "foo" ] +``` + +`default` keywords in other cases are ignored: + +- not in `properties` or `items` subschemas +- in schemas inside `anyOf`, `oneOf` and `not` (see [#42](https://github.com/ajv-validator/ajv/issues/42)) +- in `if` subschema of `switch` keyword +- in schemas generated by custom macro keywords + +The [`strictDefaults` option](#options) customizes Ajv's behavior for the defaults that Ajv ignores (`true` raises an error, and `"log"` outputs a warning). + + +## Coercing data types + +When you are validating user inputs all your data properties are usually strings. The option `coerceTypes` allows you to have your data types coerced to the types specified in your schema `type` keywords, both to pass the validation and to use the correctly typed data afterwards. + +This option modifies original data. + +__Please note__: if you pass a scalar value to the validating function its type will be coerced and it will pass the validation, but the value of the variable you pass won't be updated because scalars are passed by value. + + +Example 1: + +```javascript +var ajv = new Ajv({ coerceTypes: true }); +var schema = { + "type": "object", + "properties": { + "foo": { "type": "number" }, + "bar": { "type": "boolean" } + }, + "required": [ "foo", "bar" ] +}; + +var data = { "foo": "1", "bar": "false" }; + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // { "foo": 1, "bar": false } +``` + +Example 2 (array coercions): + +```javascript +var ajv = new Ajv({ coerceTypes: 'array' }); +var schema = { + "properties": { + "foo": { "type": "array", "items": { "type": "number" } }, + "bar": { "type": "boolean" } + } +}; + +var data = { "foo": "1", "bar": ["false"] }; + +var validate = ajv.compile(schema); + +console.log(validate(data)); // true +console.log(data); // { "foo": [1], "bar": false } +``` + +The coercion rules, as you can see from the example, are different from JavaScript both to validate user input as expected and to have the coercion reversible (to correctly validate cases where different types are defined in subschemas of "anyOf" and other compound keywords). + +See [Coercion rules](https://github.com/ajv-validator/ajv/blob/master/COERCION.md) for details. + + +## API + +##### new Ajv(Object options) -> Object + +Create Ajv instance. + + +##### .compile(Object schema) -> Function<Object data> + +Generate validating function and cache the compiled schema for future use. + +Validating function returns a boolean value. This function has properties `errors` and `schema`. Errors encountered during the last validation are assigned to `errors` property (it is assigned `null` if there was no errors). `schema` property contains the reference to the original schema. + +The schema passed to this method will be validated against meta-schema unless `validateSchema` option is false. If schema is invalid, an error will be thrown. See [options](#options). + + +##### .compileAsync(Object schema [, Boolean meta] [, Function callback]) -> Promise + +Asynchronous version of `compile` method that loads missing remote schemas using asynchronous function in `options.loadSchema`. This function returns a Promise that resolves to a validation function. An optional callback passed to `compileAsync` will be called with 2 parameters: error (or null) and validating function. The returned promise will reject (and the callback will be called with an error) when: + +- missing schema can't be loaded (`loadSchema` returns a Promise that rejects). +- a schema containing a missing reference is loaded, but the reference cannot be resolved. +- schema (or some loaded/referenced schema) is invalid. + +The function compiles schema and loads the first missing schema (or meta-schema) until all missing schemas are loaded. + +You can asynchronously compile meta-schema by passing `true` as the second parameter. + +See example in [Asynchronous compilation](#asynchronous-schema-compilation). + + +##### .validate(Object schema|String key|String ref, data) -> Boolean + +Validate data using passed schema (it will be compiled and cached). + +Instead of the schema you can use the key that was previously passed to `addSchema`, the schema id if it was present in the schema or any previously resolved reference. + +Validation errors will be available in the `errors` property of Ajv instance (`null` if there were no errors). + +__Please note__: every time this method is called the errors are overwritten so you need to copy them to another variable if you want to use them later. + +If the schema is asynchronous (has `$async` keyword on the top level) this method returns a Promise. See [Asynchronous validation](#asynchronous-validation). + + +##### .addSchema(Array<Object>|Object schema [, String key]) -> Ajv + +Add schema(s) to validator instance. This method does not compile schemas (but it still validates them). Because of that dependencies can be added in any order and circular dependencies are supported. It also prevents unnecessary compilation of schemas that are containers for other schemas but not used as a whole. + +Array of schemas can be passed (schemas should have ids), the second parameter will be ignored. + +Key can be passed that can be used to reference the schema and will be used as the schema id if there is no id inside the schema. If the key is not passed, the schema id will be used as the key. + + +Once the schema is added, it (and all the references inside it) can be referenced in other schemas and used to validate data. + +Although `addSchema` does not compile schemas, explicit compilation is not required - the schema will be compiled when it is used first time. + +By default the schema is validated against meta-schema before it is added, and if the schema does not pass validation the exception is thrown. This behaviour is controlled by `validateSchema` option. + +__Please note__: Ajv uses the [method chaining syntax](https://en.wikipedia.org/wiki/Method_chaining) for all methods with the prefix `add*` and `remove*`. +This allows you to do nice things like the following. + +```javascript +var validate = new Ajv().addSchema(schema).addFormat(name, regex).getSchema(uri); +``` + +##### .addMetaSchema(Array<Object>|Object schema [, String key]) -> Ajv + +Adds meta schema(s) that can be used to validate other schemas. That function should be used instead of `addSchema` because there may be instance options that would compile a meta schema incorrectly (at the moment it is `removeAdditional` option). + +There is no need to explicitly add draft-07 meta schema (http://json-schema.org/draft-07/schema) - it is added by default, unless option `meta` is set to `false`. You only need to use it if you have a changed meta-schema that you want to use to validate your schemas. See `validateSchema`. + + +##### .validateSchema(Object schema) -> Boolean + +Validates schema. This method should be used to validate schemas rather than `validate` due to the inconsistency of `uri` format in JSON Schema standard. + +By default this method is called automatically when the schema is added, so you rarely need to use it directly. + +If schema doesn't have `$schema` property, it is validated against draft 6 meta-schema (option `meta` should not be false). + +If schema has `$schema` property, then the schema with this id (that should be previously added) is used to validate passed schema. + +Errors will be available at `ajv.errors`. + + +##### .getSchema(String key) -> Function<Object data> + +Retrieve compiled schema previously added with `addSchema` by the key passed to `addSchema` or by its full reference (id). The returned validating function has `schema` property with the reference to the original schema. + + +##### .removeSchema([Object schema|String key|String ref|RegExp pattern]) -> Ajv + +Remove added/cached schema. Even if schema is referenced by other schemas it can be safely removed as dependent schemas have local references. + +Schema can be removed using: +- key passed to `addSchema` +- it's full reference (id) +- RegExp that should match schema id or key (meta-schemas won't be removed) +- actual schema object that will be stable-stringified to remove schema from cache + +If no parameter is passed all schemas but meta-schemas will be removed and the cache will be cleared. + + +##### .addFormat(String name, String|RegExp|Function|Object format) -> Ajv + +Add custom format to validate strings or numbers. It can also be used to replace pre-defined formats for Ajv instance. + +Strings are converted to RegExp. + +Function should return validation result as `true` or `false`. + +If object is passed it should have properties `validate`, `compare` and `async`: + +- _validate_: a string, RegExp or a function as described above. +- _compare_: an optional comparison function that accepts two strings and compares them according to the format meaning. This function is used with keywords `formatMaximum`/`formatMinimum` (defined in [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package). It should return `1` if the first value is bigger than the second value, `-1` if it is smaller and `0` if it is equal. +- _async_: an optional `true` value if `validate` is an asynchronous function; in this case it should return a promise that resolves with a value `true` or `false`. +- _type_: an optional type of data that the format applies to. It can be `"string"` (default) or `"number"` (see https://github.com/ajv-validator/ajv/issues/291#issuecomment-259923858). If the type of data is different, the validation will pass. + +Custom formats can be also added via `formats` option. + + +##### .addKeyword(String keyword, Object definition) -> Ajv + +Add custom validation keyword to Ajv instance. + +Keyword should be different from all standard JSON Schema keywords and different from previously defined keywords. There is no way to redefine keywords or to remove keyword definition from the instance. + +Keyword must start with a letter, `_` or `$`, and may continue with letters, numbers, `_`, `$`, or `-`. +It is recommended to use an application-specific prefix for keywords to avoid current and future name collisions. + +Example Keywords: +- `"xyz-example"`: valid, and uses prefix for the xyz project to avoid name collisions. +- `"example"`: valid, but not recommended as it could collide with future versions of JSON Schema etc. +- `"3-example"`: invalid as numbers are not allowed to be the first character in a keyword + +Keyword definition is an object with the following properties: + +- _type_: optional string or array of strings with data type(s) that the keyword applies to. If not present, the keyword will apply to all types. +- _validate_: validating function +- _compile_: compiling function +- _macro_: macro function +- _inline_: compiling function that returns code (as string) +- _schema_: an optional `false` value used with "validate" keyword to not pass schema +- _metaSchema_: an optional meta-schema for keyword schema +- _dependencies_: an optional list of properties that must be present in the parent schema - it will be checked during schema compilation +- _modifying_: `true` MUST be passed if keyword modifies data +- _statements_: `true` can be passed in case inline keyword generates statements (as opposed to expression) +- _valid_: pass `true`/`false` to pre-define validation result, the result returned from validation function will be ignored. This option cannot be used with macro keywords. +- _$data_: an optional `true` value to support [$data reference](#data-reference) as the value of custom keyword. The reference will be resolved at validation time. If the keyword has meta-schema it would be extended to allow $data and it will be used to validate the resolved value. Supporting $data reference requires that keyword has validating function (as the only option or in addition to compile, macro or inline function). +- _async_: an optional `true` value if the validation function is asynchronous (whether it is compiled or passed in _validate_ property); in this case it should return a promise that resolves with a value `true` or `false`. This option is ignored in case of "macro" and "inline" keywords. +- _errors_: an optional boolean or string `"full"` indicating whether keyword returns errors. If this property is not set Ajv will determine if the errors were set in case of failed validation. + +_compile_, _macro_ and _inline_ are mutually exclusive, only one should be used at a time. _validate_ can be used separately or in addition to them to support $data reference. + +__Please note__: If the keyword is validating data type that is different from the type(s) in its definition, the validation function will not be called (and expanded macro will not be used), so there is no need to check for data type inside validation function or inside schema returned by macro function (unless you want to enforce a specific type and for some reason do not want to use a separate `type` keyword for that). In the same way as standard keywords work, if the keyword does not apply to the data type being validated, the validation of this keyword will succeed. + +See [Defining custom keywords](#defining-custom-keywords) for more details. + + +##### .getKeyword(String keyword) -> Object|Boolean + +Returns custom keyword definition, `true` for pre-defined keywords and `false` if the keyword is unknown. + + +##### .removeKeyword(String keyword) -> Ajv + +Removes custom or pre-defined keyword so you can redefine them. + +While this method can be used to extend pre-defined keywords, it can also be used to completely change their meaning - it may lead to unexpected results. + +__Please note__: schemas compiled before the keyword is removed will continue to work without changes. To recompile schemas use `removeSchema` method and compile them again. + + +##### .errorsText([Array<Object> errors [, Object options]]) -> String + +Returns the text with all errors in a String. + +Options can have properties `separator` (string used to separate errors, ", " by default) and `dataVar` (the variable name that dataPaths are prefixed with, "data" by default). + + +## Options + +Defaults: + +```javascript +{ + // validation and reporting options: + $data: false, + allErrors: false, + verbose: false, + $comment: false, // NEW in Ajv version 6.0 + jsonPointers: false, + uniqueItems: true, + unicode: true, + nullable: false, + format: 'fast', + formats: {}, + unknownFormats: true, + schemas: {}, + logger: undefined, + // referenced schema options: + schemaId: '$id', + missingRefs: true, + extendRefs: 'ignore', // recommended 'fail' + loadSchema: undefined, // function(uri: string): Promise {} + // options to modify validated data: + removeAdditional: false, + useDefaults: false, + coerceTypes: false, + // strict mode options + strictDefaults: false, + strictKeywords: false, + strictNumbers: false, + // asynchronous validation options: + transpile: undefined, // requires ajv-async package + // advanced options: + meta: true, + validateSchema: true, + addUsedSchema: true, + inlineRefs: true, + passContext: false, + loopRequired: Infinity, + ownProperties: false, + multipleOfPrecision: false, + errorDataPath: 'object', // deprecated + messages: true, + sourceCode: false, + processCode: undefined, // function (str: string, schema: object): string {} + cache: new Cache, + serialize: undefined +} +``` + +##### Validation and reporting options + +- _$data_: support [$data references](#data-reference). Draft 6 meta-schema that is added by default will be extended to allow them. If you want to use another meta-schema you need to use $dataMetaSchema method to add support for $data reference. See [API](#api). +- _allErrors_: check all rules collecting all errors. Default is to return after the first error. +- _verbose_: include the reference to the part of the schema (`schema` and `parentSchema`) and validated data in errors (false by default). +- _$comment_ (NEW in Ajv version 6.0): log or pass the value of `$comment` keyword to a function. Option values: + - `false` (default): ignore $comment keyword. + - `true`: log the keyword value to console. + - function: pass the keyword value, its schema path and root schema to the specified function +- _jsonPointers_: set `dataPath` property of errors using [JSON Pointers](https://tools.ietf.org/html/rfc6901) instead of JavaScript property access notation. +- _uniqueItems_: validate `uniqueItems` keyword (true by default). +- _unicode_: calculate correct length of strings with unicode pairs (true by default). Pass `false` to use `.length` of strings that is faster, but gives "incorrect" lengths of strings with unicode pairs - each unicode pair is counted as two characters. +- _nullable_: support keyword "nullable" from [Open API 3 specification](https://swagger.io/docs/specification/data-models/data-types/). +- _format_: formats validation mode. Option values: + - `"fast"` (default) - simplified and fast validation (see [Formats](#formats) for details of which formats are available and affected by this option). + - `"full"` - more restrictive and slow validation. E.g., 25:00:00 and 2015/14/33 will be invalid time and date in 'full' mode but it will be valid in 'fast' mode. + - `false` - ignore all format keywords. +- _formats_: an object with custom formats. Keys and values will be passed to `addFormat` method. +- _keywords_: an object with custom keywords. Keys and values will be passed to `addKeyword` method. +- _unknownFormats_: handling of unknown formats. Option values: + - `true` (default) - if an unknown format is encountered the exception is thrown during schema compilation. If `format` keyword value is [$data reference](#data-reference) and it is unknown the validation will fail. + - `[String]` - an array of unknown format names that will be ignored. This option can be used to allow usage of third party schemas with format(s) for which you don't have definitions, but still fail if another unknown format is used. If `format` keyword value is [$data reference](#data-reference) and it is not in this array the validation will fail. + - `"ignore"` - to log warning during schema compilation and always pass validation (the default behaviour in versions before 5.0.0). This option is not recommended, as it allows to mistype format name and it won't be validated without any error message. This behaviour is required by JSON Schema specification. +- _schemas_: an array or object of schemas that will be added to the instance. In case you pass the array the schemas must have IDs in them. When the object is passed the method `addSchema(value, key)` will be called for each schema in this object. +- _logger_: sets the logging method. Default is the global `console` object that should have methods `log`, `warn` and `error`. See [Error logging](#error-logging). Option values: + - custom logger - it should have methods `log`, `warn` and `error`. If any of these methods is missing an exception will be thrown. + - `false` - logging is disabled. + + +##### Referenced schema options + +- _schemaId_: this option defines which keywords are used as schema URI. Option value: + - `"$id"` (default) - only use `$id` keyword as schema URI (as specified in JSON Schema draft-06/07), ignore `id` keyword (if it is present a warning will be logged). + - `"id"` - only use `id` keyword as schema URI (as specified in JSON Schema draft-04), ignore `$id` keyword (if it is present a warning will be logged). + - `"auto"` - use both `$id` and `id` keywords as schema URI. If both are present (in the same schema object) and different the exception will be thrown during schema compilation. +- _missingRefs_: handling of missing referenced schemas. Option values: + - `true` (default) - if the reference cannot be resolved during compilation the exception is thrown. The thrown error has properties `missingRef` (with hash fragment) and `missingSchema` (without it). Both properties are resolved relative to the current base id (usually schema id, unless it was substituted). + - `"ignore"` - to log error during compilation and always pass validation. + - `"fail"` - to log error and successfully compile schema but fail validation if this rule is checked. +- _extendRefs_: validation of other keywords when `$ref` is present in the schema. Option values: + - `"ignore"` (default) - when `$ref` is used other keywords are ignored (as per [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03#section-3) standard). A warning will be logged during the schema compilation. + - `"fail"` (recommended) - if other validation keywords are used together with `$ref` the exception will be thrown when the schema is compiled. This option is recommended to make sure schema has no keywords that are ignored, which can be confusing. + - `true` - validate all keywords in the schemas with `$ref` (the default behaviour in versions before 5.0.0). +- _loadSchema_: asynchronous function that will be used to load remote schemas when `compileAsync` [method](#api-compileAsync) is used and some reference is missing (option `missingRefs` should NOT be 'fail' or 'ignore'). This function should accept remote schema uri as a parameter and return a Promise that resolves to a schema. See example in [Asynchronous compilation](#asynchronous-schema-compilation). + + +##### Options to modify validated data + +- _removeAdditional_: remove additional properties - see example in [Filtering data](#filtering-data). This option is not used if schema is added with `addMetaSchema` method. Option values: + - `false` (default) - not to remove additional properties + - `"all"` - all additional properties are removed, regardless of `additionalProperties` keyword in schema (and no validation is made for them). + - `true` - only additional properties with `additionalProperties` keyword equal to `false` are removed. + - `"failing"` - additional properties that fail schema validation will be removed (where `additionalProperties` keyword is `false` or schema). +- _useDefaults_: replace missing or undefined properties and items with the values from corresponding `default` keywords. Default behaviour is to ignore `default` keywords. This option is not used if schema is added with `addMetaSchema` method. See examples in [Assigning defaults](#assigning-defaults). Option values: + - `false` (default) - do not use defaults + - `true` - insert defaults by value (object literal is used). + - `"empty"` - in addition to missing or undefined, use defaults for properties and items that are equal to `null` or `""` (an empty string). + - `"shared"` (deprecated) - insert defaults by reference. If the default is an object, it will be shared by all instances of validated data. If you modify the inserted default in the validated data, it will be modified in the schema as well. +- _coerceTypes_: change data type of data to match `type` keyword. See the example in [Coercing data types](#coercing-data-types) and [coercion rules](https://github.com/ajv-validator/ajv/blob/master/COERCION.md). Option values: + - `false` (default) - no type coercion. + - `true` - coerce scalar data types. + - `"array"` - in addition to coercions between scalar types, coerce scalar data to an array with one element and vice versa (as required by the schema). + + +##### Strict mode options + +- _strictDefaults_: report ignored `default` keywords in schemas. Option values: + - `false` (default) - ignored defaults are not reported + - `true` - if an ignored default is present, throw an error + - `"log"` - if an ignored default is present, log warning +- _strictKeywords_: report unknown keywords in schemas. Option values: + - `false` (default) - unknown keywords are not reported + - `true` - if an unknown keyword is present, throw an error + - `"log"` - if an unknown keyword is present, log warning +- _strictNumbers_: validate numbers strictly, failing validation for NaN and Infinity. Option values: + - `false` (default) - NaN or Infinity will pass validation for numeric types + - `true` - NaN or Infinity will not pass validation for numeric types + +##### Asynchronous validation options + +- _transpile_: Requires [ajv-async](https://github.com/ajv-validator/ajv-async) package. It determines whether Ajv transpiles compiled asynchronous validation function. Option values: + - `undefined` (default) - transpile with [nodent](https://github.com/MatAtBread/nodent) if async functions are not supported. + - `true` - always transpile with nodent. + - `false` - do not transpile; if async functions are not supported an exception will be thrown. + + +##### Advanced options + +- _meta_: add [meta-schema](http://json-schema.org/documentation.html) so it can be used by other schemas (true by default). If an object is passed, it will be used as the default meta-schema for schemas that have no `$schema` keyword. This default meta-schema MUST have `$schema` keyword. +- _validateSchema_: validate added/compiled schemas against meta-schema (true by default). `$schema` property in the schema can be http://json-schema.org/draft-07/schema or absent (draft-07 meta-schema will be used) or can be a reference to the schema previously added with `addMetaSchema` method. Option values: + - `true` (default) - if the validation fails, throw the exception. + - `"log"` - if the validation fails, log error. + - `false` - skip schema validation. +- _addUsedSchema_: by default methods `compile` and `validate` add schemas to the instance if they have `$id` (or `id`) property that doesn't start with "#". If `$id` is present and it is not unique the exception will be thrown. Set this option to `false` to skip adding schemas to the instance and the `$id` uniqueness check when these methods are used. This option does not affect `addSchema` method. +- _inlineRefs_: Affects compilation of referenced schemas. Option values: + - `true` (default) - the referenced schemas that don't have refs in them are inlined, regardless of their size - that substantially improves performance at the cost of the bigger size of compiled schema functions. + - `false` - to not inline referenced schemas (they will be compiled as separate functions). + - integer number - to limit the maximum number of keywords of the schema that will be inlined. +- _passContext_: pass validation context to custom keyword functions. If this option is `true` and you pass some context to the compiled validation function with `validate.call(context, data)`, the `context` will be available as `this` in your custom keywords. By default `this` is Ajv instance. +- _loopRequired_: by default `required` keyword is compiled into a single expression (or a sequence of statements in `allErrors` mode). In case of a very large number of properties in this keyword it may result in a very big validation function. Pass integer to set the number of properties above which `required` keyword will be validated in a loop - smaller validation function size but also worse performance. +- _ownProperties_: by default Ajv iterates over all enumerable object properties; when this option is `true` only own enumerable object properties (i.e. found directly on the object rather than on its prototype) are iterated. Contributed by @mbroadst. +- _multipleOfPrecision_: by default `multipleOf` keyword is validated by comparing the result of division with parseInt() of that result. It works for dividers that are bigger than 1. For small dividers such as 0.01 the result of the division is usually not integer (even when it should be integer, see issue [#84](https://github.com/ajv-validator/ajv/issues/84)). If you need to use fractional dividers set this option to some positive integer N to have `multipleOf` validated using this formula: `Math.abs(Math.round(division) - division) < 1e-N` (it is slower but allows for float arithmetics deviations). +- _errorDataPath_ (deprecated): set `dataPath` to point to 'object' (default) or to 'property' when validating keywords `required`, `additionalProperties` and `dependencies`. +- _messages_: Include human-readable messages in errors. `true` by default. `false` can be passed when custom messages are used (e.g. with [ajv-i18n](https://github.com/ajv-validator/ajv-i18n)). +- _sourceCode_: add `sourceCode` property to validating function (for debugging; this code can be different from the result of toString call). +- _processCode_: an optional function to process generated code before it is passed to Function constructor. It can be used to either beautify (the validating function is generated without line-breaks) or to transpile code. Starting from version 5.0.0 this option replaced options: + - `beautify` that formatted the generated function using [js-beautify](https://github.com/beautify-web/js-beautify). If you want to beautify the generated code pass a function calling `require('js-beautify').js_beautify` as `processCode: code => js_beautify(code)`. + - `transpile` that transpiled asynchronous validation function. You can still use `transpile` option with [ajv-async](https://github.com/ajv-validator/ajv-async) package. See [Asynchronous validation](#asynchronous-validation) for more information. +- _cache_: an optional instance of cache to store compiled schemas using stable-stringified schema as a key. For example, set-associative cache [sacjs](https://github.com/epoberezkin/sacjs) can be used. If not passed then a simple hash is used which is good enough for the common use case (a limited number of statically defined schemas). Cache should have methods `put(key, value)`, `get(key)`, `del(key)` and `clear()`. +- _serialize_: an optional function to serialize schema to cache key. Pass `false` to use schema itself as a key (e.g., if WeakMap used as a cache). By default [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used. + + +## Validation errors + +In case of validation failure, Ajv assigns the array of errors to `errors` property of validation function (or to `errors` property of Ajv instance when `validate` or `validateSchema` methods were called). In case of [asynchronous validation](#asynchronous-validation), the returned promise is rejected with exception `Ajv.ValidationError` that has `errors` property. + + +### Error objects + +Each error is an object with the following properties: + +- _keyword_: validation keyword. +- _dataPath_: the path to the part of the data that was validated. By default `dataPath` uses JavaScript property access notation (e.g., `".prop[1].subProp"`). When the option `jsonPointers` is true (see [Options](#options)) `dataPath` will be set using JSON pointer standard (e.g., `"/prop/1/subProp"`). +- _schemaPath_: the path (JSON-pointer as a URI fragment) to the schema of the keyword that failed validation. +- _params_: the object with the additional information about error that can be used to create custom error messages (e.g., using [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) package). See below for parameters set by all keywords. +- _message_: the standard error message (can be excluded with option `messages` set to false). +- _schema_: the schema of the keyword (added with `verbose` option). +- _parentSchema_: the schema containing the keyword (added with `verbose` option) +- _data_: the data validated by the keyword (added with `verbose` option). + +__Please note__: `propertyNames` keyword schema validation errors have an additional property `propertyName`, `dataPath` points to the object. After schema validation for each property name, if it is invalid an additional error is added with the property `keyword` equal to `"propertyNames"`. + + +### Error parameters + +Properties of `params` object in errors depend on the keyword that failed validation. + +- `maxItems`, `minItems`, `maxLength`, `minLength`, `maxProperties`, `minProperties` - property `limit` (number, the schema of the keyword). +- `additionalItems` - property `limit` (the maximum number of allowed items in case when `items` keyword is an array of schemas and `additionalItems` is false). +- `additionalProperties` - property `additionalProperty` (the property not used in `properties` and `patternProperties` keywords). +- `dependencies` - properties: + - `property` (dependent property), + - `missingProperty` (required missing dependency - only the first one is reported currently) + - `deps` (required dependencies, comma separated list as a string), + - `depsCount` (the number of required dependencies). +- `format` - property `format` (the schema of the keyword). +- `maximum`, `minimum` - properties: + - `limit` (number, the schema of the keyword), + - `exclusive` (boolean, the schema of `exclusiveMaximum` or `exclusiveMinimum`), + - `comparison` (string, comparison operation to compare the data to the limit, with the data on the left and the limit on the right; can be "<", "<=", ">", ">=") +- `multipleOf` - property `multipleOf` (the schema of the keyword) +- `pattern` - property `pattern` (the schema of the keyword) +- `required` - property `missingProperty` (required property that is missing). +- `propertyNames` - property `propertyName` (an invalid property name). +- `patternRequired` (in ajv-keywords) - property `missingPattern` (required pattern that did not match any property). +- `type` - property `type` (required type(s), a string, can be a comma-separated list) +- `uniqueItems` - properties `i` and `j` (indices of duplicate items). +- `const` - property `allowedValue` pointing to the value (the schema of the keyword). +- `enum` - property `allowedValues` pointing to the array of values (the schema of the keyword). +- `$ref` - property `ref` with the referenced schema URI. +- `oneOf` - property `passingSchemas` (array of indices of passing schemas, null if no schema passes). +- custom keywords (in case keyword definition doesn't create errors) - property `keyword` (the keyword name). + + +### Error logging + +Using the `logger` option when initiallizing Ajv will allow you to define custom logging. Here you can build upon the exisiting logging. The use of other logging packages is supported as long as the package or its associated wrapper exposes the required methods. If any of the required methods are missing an exception will be thrown. +- **Required Methods**: `log`, `warn`, `error` + +```javascript +var otherLogger = new OtherLogger(); +var ajv = new Ajv({ + logger: { + log: console.log.bind(console), + warn: function warn() { + otherLogger.logWarn.apply(otherLogger, arguments); + }, + error: function error() { + otherLogger.logError.apply(otherLogger, arguments); + console.error.apply(console, arguments); + } + } +}); +``` + + +## Plugins + +Ajv can be extended with plugins that add custom keywords, formats or functions to process generated code. When such plugin is published as npm package it is recommended that it follows these conventions: + +- it exports a function +- this function accepts ajv instance as the first parameter and returns the same instance to allow chaining +- this function can accept an optional configuration as the second parameter + +If you have published a useful plugin please submit a PR to add it to the next section. + + +## Related packages + +- [ajv-async](https://github.com/ajv-validator/ajv-async) - plugin to configure async validation mode +- [ajv-bsontype](https://github.com/BoLaMN/ajv-bsontype) - plugin to validate mongodb's bsonType formats +- [ajv-cli](https://github.com/jessedc/ajv-cli) - command line interface +- [ajv-errors](https://github.com/ajv-validator/ajv-errors) - plugin for custom error messages +- [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) - internationalised error messages +- [ajv-istanbul](https://github.com/ajv-validator/ajv-istanbul) - plugin to instrument generated validation code to measure test coverage of your schemas +- [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) - plugin with custom validation keywords (select, typeof, etc.) +- [ajv-merge-patch](https://github.com/ajv-validator/ajv-merge-patch) - plugin with keywords $merge and $patch +- [ajv-pack](https://github.com/ajv-validator/ajv-pack) - produces a compact module exporting validation functions +- [ajv-formats-draft2019](https://github.com/luzlab/ajv-formats-draft2019) - format validators for draft2019 that aren't already included in ajv (ie. `idn-hostname`, `idn-email`, `iri`, `iri-reference` and `duration`). + +## Some packages using Ajv + +- [webpack](https://github.com/webpack/webpack) - a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser +- [jsonscript-js](https://github.com/JSONScript/jsonscript-js) - the interpreter for [JSONScript](http://www.jsonscript.org) - scripted processing of existing endpoints and services +- [osprey-method-handler](https://github.com/mulesoft-labs/osprey-method-handler) - Express middleware for validating requests and responses based on a RAML method object, used in [osprey](https://github.com/mulesoft/osprey) - validating API proxy generated from a RAML definition +- [har-validator](https://github.com/ahmadnassri/har-validator) - HTTP Archive (HAR) validator +- [jsoneditor](https://github.com/josdejong/jsoneditor) - a web-based tool to view, edit, format, and validate JSON http://jsoneditoronline.org +- [JSON Schema Lint](https://github.com/nickcmaynard/jsonschemalint) - a web tool to validate JSON/YAML document against a single JSON Schema http://jsonschemalint.com +- [objection](https://github.com/vincit/objection.js) - SQL-friendly ORM for Node.js +- [table](https://github.com/gajus/table) - formats data into a string table +- [ripple-lib](https://github.com/ripple/ripple-lib) - a JavaScript API for interacting with [Ripple](https://ripple.com) in Node.js and the browser +- [restbase](https://github.com/wikimedia/restbase) - distributed storage with REST API & dispatcher for backend services built to provide a low-latency & high-throughput API for Wikipedia / Wikimedia content +- [hippie-swagger](https://github.com/CacheControl/hippie-swagger) - [Hippie](https://github.com/vesln/hippie) wrapper that provides end to end API testing with swagger validation +- [react-form-controlled](https://github.com/seeden/react-form-controlled) - React controlled form components with validation +- [rabbitmq-schema](https://github.com/tjmehta/rabbitmq-schema) - a schema definition module for RabbitMQ graphs and messages +- [@query/schema](https://www.npmjs.com/package/@query/schema) - stream filtering with a URI-safe query syntax parsing to JSON Schema +- [chai-ajv-json-schema](https://github.com/peon374/chai-ajv-json-schema) - chai plugin to us JSON Schema with expect in mocha tests +- [grunt-jsonschema-ajv](https://github.com/SignpostMarv/grunt-jsonschema-ajv) - Grunt plugin for validating files against JSON Schema +- [extract-text-webpack-plugin](https://github.com/webpack-contrib/extract-text-webpack-plugin) - extract text from bundle into a file +- [electron-builder](https://github.com/electron-userland/electron-builder) - a solution to package and build a ready for distribution Electron app +- [addons-linter](https://github.com/mozilla/addons-linter) - Mozilla Add-ons Linter +- [gh-pages-generator](https://github.com/epoberezkin/gh-pages-generator) - multi-page site generator converting markdown files to GitHub pages +- [ESLint](https://github.com/eslint/eslint) - the pluggable linting utility for JavaScript and JSX + + +## Tests + +``` +npm install +git submodule update --init +npm test +``` + +## Contributing + +All validation functions are generated using doT templates in [dot](https://github.com/ajv-validator/ajv/tree/master/lib/dot) folder. Templates are precompiled so doT is not a run-time dependency. + +`npm run build` - compiles templates to [dotjs](https://github.com/ajv-validator/ajv/tree/master/lib/dotjs) folder. + +`npm run watch` - automatically compiles templates when files in dot folder change + +Please see [Contributing guidelines](https://github.com/ajv-validator/ajv/blob/master/CONTRIBUTING.md) + + +## Changes history + +See https://github.com/ajv-validator/ajv/releases + +__Please note__: [Changes in version 7.0.0-beta](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0-beta.0) + +[Version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0). + +## Code of conduct + +Please review and follow the [Code of conduct](https://github.com/ajv-validator/ajv/blob/master/CODE_OF_CONDUCT.md). + +Please report any unacceptable behaviour to ajv.validator@gmail.com - it will be reviewed by the project team. + + +## Open-source software support + +Ajv is a part of [Tidelift subscription](https://tidelift.com/subscription/pkg/npm-ajv?utm_source=npm-ajv&utm_medium=referral&utm_campaign=readme) - it provides a centralised support to open-source software users, in addition to the support provided by software maintainers. + + +## License + +[MIT](https://github.com/ajv-validator/ajv/blob/master/LICENSE) diff --git a/node_modules/ajv/package.json b/node_modules/ajv/package.json new file mode 100644 index 0000000..559a933 --- /dev/null +++ b/node_modules/ajv/package.json @@ -0,0 +1,106 @@ +{ + "name": "ajv", + "version": "6.12.6", + "description": "Another JSON Schema Validator", + "main": "lib/ajv.js", + "typings": "lib/ajv.d.ts", + "files": [ + "lib/", + "dist/", + "scripts/", + "LICENSE", + ".tonic_example.js" + ], + "scripts": { + "eslint": "eslint lib/{compile/,}*.js spec/{**/,}*.js scripts --ignore-pattern spec/JSON-Schema-Test-Suite", + "jshint": "jshint lib/{compile/,}*.js", + "lint": "npm run jshint && npm run eslint", + "test-spec": "mocha spec/{**/,}*.spec.js -R spec", + "test-fast": "AJV_FAST_TEST=true npm run test-spec", + "test-debug": "npm run test-spec -- --inspect-brk", + "test-cov": "nyc npm run test-spec", + "test-ts": "tsc --target ES5 --noImplicitAny --noEmit spec/typescript/index.ts", + "bundle": "del-cli dist && node ./scripts/bundle.js . Ajv pure_getters", + "bundle-beautify": "node ./scripts/bundle.js js-beautify", + "build": "del-cli lib/dotjs/*.js \"!lib/dotjs/index.js\" && node scripts/compile-dots.js", + "test-karma": "karma start", + "test-browser": "del-cli .browser && npm run bundle && scripts/prepare-tests && npm run test-karma", + "test-all": "npm run test-cov && if-node-version 10 npm run test-browser", + "test": "npm run lint && npm run build && npm run test-all", + "prepublish": "npm run build && npm run bundle", + "watch": "watch \"npm run build\" ./lib/dot" + }, + "nyc": { + "exclude": [ + "**/spec/**", + "node_modules" + ], + "reporter": [ + "lcov", + "text-summary" + ] + }, + "repository": { + "type": "git", + "url": "https://github.com/ajv-validator/ajv.git" + }, + "keywords": [ + "JSON", + "schema", + "validator", + "validation", + "jsonschema", + "json-schema", + "json-schema-validator", + "json-schema-validation" + ], + "author": "Evgeny Poberezkin", + "license": "MIT", + "bugs": { + "url": "https://github.com/ajv-validator/ajv/issues" + }, + "homepage": "https://github.com/ajv-validator/ajv", + "tonicExampleFilename": ".tonic_example.js", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "devDependencies": { + "ajv-async": "^1.0.0", + "bluebird": "^3.5.3", + "brfs": "^2.0.0", + "browserify": "^16.2.0", + "chai": "^4.0.1", + "coveralls": "^3.0.1", + "del-cli": "^3.0.0", + "dot": "^1.0.3", + "eslint": "^7.3.1", + "gh-pages-generator": "^0.2.3", + "glob": "^7.0.0", + "if-node-version": "^1.0.0", + "js-beautify": "^1.7.3", + "jshint": "^2.10.2", + "json-schema-test": "^2.0.0", + "karma": "^5.0.0", + "karma-chrome-launcher": "^3.0.0", + "karma-mocha": "^2.0.0", + "karma-sauce-launcher": "^4.1.3", + "mocha": "^8.0.1", + "nyc": "^15.0.0", + "pre-commit": "^1.1.1", + "require-globify": "^1.3.0", + "typescript": "^3.9.5", + "uglify-js": "^3.6.9", + "watch": "^1.0.0" + }, + "collective": { + "type": "opencollective", + "url": "https://opencollective.com/ajv" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } +} diff --git a/node_modules/ajv/scripts/.eslintrc.yml b/node_modules/ajv/scripts/.eslintrc.yml new file mode 100644 index 0000000..493d7d3 --- /dev/null +++ b/node_modules/ajv/scripts/.eslintrc.yml @@ -0,0 +1,3 @@ +rules: + no-console: 0 + no-empty: [2, allowEmptyCatch: true] diff --git a/node_modules/ajv/scripts/bundle.js b/node_modules/ajv/scripts/bundle.js new file mode 100644 index 0000000..e381a76 --- /dev/null +++ b/node_modules/ajv/scripts/bundle.js @@ -0,0 +1,61 @@ +'use strict'; + +var fs = require('fs') + , path = require('path') + , browserify = require('browserify') + , uglify = require('uglify-js'); + +var pkg = process.argv[2] + , standalone = process.argv[3] + , compress = process.argv[4]; + +var packageDir = path.join(__dirname, '..'); +if (pkg != '.') packageDir = path.join(packageDir, 'node_modules', pkg); + +var json = require(path.join(packageDir, 'package.json')); + +var distDir = path.join(__dirname, '..', 'dist'); +if (!fs.existsSync(distDir)) fs.mkdirSync(distDir); + +var bOpts = {}; +if (standalone) bOpts.standalone = standalone; + +browserify(bOpts) +.require(path.join(packageDir, json.main), {expose: json.name}) +.bundle(function (err, buf) { + if (err) { + console.error('browserify error:', err); + process.exit(1); + } + + var outputFile = path.join(distDir, json.name); + var uglifyOpts = { + warnings: true, + compress: {}, + output: { + preamble: '/* ' + json.name + ' ' + json.version + ': ' + json.description + ' */' + } + }; + if (compress) { + var compressOpts = compress.split(','); + for (var i=0, il = compressOpts.length; i ../ajv-dist/bower.json + cd ../ajv-dist + + if [[ `git status --porcelain` ]]; then + echo "Changes detected. Updating master branch..." + git add -A + git commit -m "updated by travis build #$TRAVIS_BUILD_NUMBER" + git push --quiet origin master > /dev/null 2>&1 + fi + + echo "Publishing tag..." + + git tag $TRAVIS_TAG + git push --tags > /dev/null 2>&1 + + echo "Done" +fi diff --git a/node_modules/ajv/scripts/travis-gh-pages b/node_modules/ajv/scripts/travis-gh-pages new file mode 100644 index 0000000..b3d4f3d --- /dev/null +++ b/node_modules/ajv/scripts/travis-gh-pages @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -e + +if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" && $TRAVIS_JOB_NUMBER =~ ".3" ]]; then + git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qE '\.md$|^LICENSE$|travis-gh-pages$' && { + rm -rf ../gh-pages + git clone -b gh-pages --single-branch https://${GITHUB_TOKEN}@github.com/ajv-validator/ajv.git ../gh-pages + mkdir -p ../gh-pages/_source + cp *.md ../gh-pages/_source + cp LICENSE ../gh-pages/_source + currentDir=$(pwd) + cd ../gh-pages + $currentDir/node_modules/.bin/gh-pages-generator + # remove logo from README + sed -i -E "s/]+ajv_logo[^>]+>//" index.md + git config user.email "$GIT_USER_EMAIL" + git config user.name "$GIT_USER_NAME" + git add . + git commit -am "updated by travis build #$TRAVIS_BUILD_NUMBER" + git push --quiet origin gh-pages > /dev/null 2>&1 + } +fi diff --git a/node_modules/ansi-regex/index.d.ts b/node_modules/ansi-regex/index.d.ts new file mode 100644 index 0000000..7d562e9 --- /dev/null +++ b/node_modules/ansi-regex/index.d.ts @@ -0,0 +1,33 @@ +export type Options = { + /** + Match only the first ANSI escape. + + @default false + */ + readonly onlyFirst: boolean; +}; + +/** +Regular expression for matching ANSI escape codes. + +@example +``` +import ansiRegex from 'ansi-regex'; + +ansiRegex().test('\u001B[4mcake\u001B[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` +*/ +export default function ansiRegex(options?: Options): RegExp; diff --git a/node_modules/ansi-regex/index.js b/node_modules/ansi-regex/index.js new file mode 100644 index 0000000..2cc5ca2 --- /dev/null +++ b/node_modules/ansi-regex/index.js @@ -0,0 +1,14 @@ +export default function ansiRegex({onlyFirst = false} = {}) { + // Valid string terminator sequences are BEL, ESC\, and 0x9c + const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)'; + + // OSC sequences only: ESC ] ... ST (non-greedy until the first ST) + const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`; + + // CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte + const csi = '[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]'; + + const pattern = `${osc}|${csi}`; + + return new RegExp(pattern, onlyFirst ? undefined : 'g'); +} diff --git a/node_modules/ansi-regex/license b/node_modules/ansi-regex/license new file mode 100644 index 0000000..fa7ceba --- /dev/null +++ b/node_modules/ansi-regex/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/ansi-regex/package.json b/node_modules/ansi-regex/package.json new file mode 100644 index 0000000..a9cf5e2 --- /dev/null +++ b/node_modules/ansi-regex/package.json @@ -0,0 +1,61 @@ +{ + "name": "ansi-regex", + "version": "6.2.0", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": "chalk/ansi-regex", + "funding": "https://github.com/chalk/ansi-regex?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "types": "./index.d.ts", + "sideEffects": false, + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && ava && tsd", + "view-supported": "node fixtures/view-codes.js" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "devDependencies": { + "ansi-escapes": "^5.0.0", + "ava": "^3.15.0", + "tsd": "^0.21.0", + "xo": "^0.54.2" + } +} diff --git a/node_modules/ansi-regex/readme.md b/node_modules/ansi-regex/readme.md new file mode 100644 index 0000000..4d3c415 --- /dev/null +++ b/node_modules/ansi-regex/readme.md @@ -0,0 +1,66 @@ +# ansi-regex + +> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) + +## Install + +```sh +npm install ansi-regex +``` + +## Usage + +```js +import ansiRegex from 'ansi-regex'; + +ansiRegex().test('\u001B[4mcake\u001B[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` + +## API + +### ansiRegex(options?) + +Returns a regex for matching ANSI escape codes. + +#### options + +Type: `object` + +##### onlyFirst + +Type: `boolean`\ +Default: `false` *(Matches any ANSI escape codes in a string)* + +Match only the first ANSI escape. + +## Important + +If you run the regex against untrusted user input in a server context, you should [give it a timeout](https://github.com/sindresorhus/super-regex). + +**I do not consider [ReDoS](https://blog.yossarian.net/2022/12/28/ReDoS-vulnerabilities-and-misaligned-incentives) a valid vulnerability for this package.** + +## FAQ + +### Why do you test for codes not in the ECMA 48 standard? + +Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. + +On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) diff --git a/node_modules/ansi-styles/index.d.ts b/node_modules/ansi-styles/index.d.ts new file mode 100644 index 0000000..58f133a --- /dev/null +++ b/node_modules/ansi-styles/index.d.ts @@ -0,0 +1,236 @@ +export interface CSPair { // eslint-disable-line @typescript-eslint/naming-convention + /** + The ANSI terminal control sequence for starting this style. + */ + readonly open: string; + + /** + The ANSI terminal control sequence for ending this style. + */ + readonly close: string; +} + +export interface ColorBase { + /** + The ANSI terminal control sequence for ending this color. + */ + readonly close: string; + + ansi(code: number): string; + + ansi256(code: number): string; + + ansi16m(red: number, green: number, blue: number): string; +} + +export interface Modifier { + /** + Resets the current color chain. + */ + readonly reset: CSPair; + + /** + Make text bold. + */ + readonly bold: CSPair; + + /** + Emitting only a small amount of light. + */ + readonly dim: CSPair; + + /** + Make text italic. (Not widely supported) + */ + readonly italic: CSPair; + + /** + Make text underline. (Not widely supported) + */ + readonly underline: CSPair; + + /** + Make text overline. + + Supported on VTE-based terminals, the GNOME terminal, mintty, and Git Bash. + */ + readonly overline: CSPair; + + /** + Inverse background and foreground colors. + */ + readonly inverse: CSPair; + + /** + Prints the text, but makes it invisible. + */ + readonly hidden: CSPair; + + /** + Puts a horizontal line through the center of the text. (Not widely supported) + */ + readonly strikethrough: CSPair; +} + +export interface ForegroundColor { + readonly black: CSPair; + readonly red: CSPair; + readonly green: CSPair; + readonly yellow: CSPair; + readonly blue: CSPair; + readonly cyan: CSPair; + readonly magenta: CSPair; + readonly white: CSPair; + + /** + Alias for `blackBright`. + */ + readonly gray: CSPair; + + /** + Alias for `blackBright`. + */ + readonly grey: CSPair; + + readonly blackBright: CSPair; + readonly redBright: CSPair; + readonly greenBright: CSPair; + readonly yellowBright: CSPair; + readonly blueBright: CSPair; + readonly cyanBright: CSPair; + readonly magentaBright: CSPair; + readonly whiteBright: CSPair; +} + +export interface BackgroundColor { + readonly bgBlack: CSPair; + readonly bgRed: CSPair; + readonly bgGreen: CSPair; + readonly bgYellow: CSPair; + readonly bgBlue: CSPair; + readonly bgCyan: CSPair; + readonly bgMagenta: CSPair; + readonly bgWhite: CSPair; + + /** + Alias for `bgBlackBright`. + */ + readonly bgGray: CSPair; + + /** + Alias for `bgBlackBright`. + */ + readonly bgGrey: CSPair; + + readonly bgBlackBright: CSPair; + readonly bgRedBright: CSPair; + readonly bgGreenBright: CSPair; + readonly bgYellowBright: CSPair; + readonly bgBlueBright: CSPair; + readonly bgCyanBright: CSPair; + readonly bgMagentaBright: CSPair; + readonly bgWhiteBright: CSPair; +} + +export interface ConvertColor { + /** + Convert from the RGB color space to the ANSI 256 color space. + + @param red - (`0...255`) + @param green - (`0...255`) + @param blue - (`0...255`) + */ + rgbToAnsi256(red: number, green: number, blue: number): number; + + /** + Convert from the RGB HEX color space to the RGB color space. + + @param hex - A hexadecimal string containing RGB data. + */ + hexToRgb(hex: string): [red: number, green: number, blue: number]; + + /** + Convert from the RGB HEX color space to the ANSI 256 color space. + + @param hex - A hexadecimal string containing RGB data. + */ + hexToAnsi256(hex: string): number; + + /** + Convert from the ANSI 256 color space to the ANSI 16 color space. + + @param code - A number representing the ANSI 256 color. + */ + ansi256ToAnsi(code: number): number; + + /** + Convert from the RGB color space to the ANSI 16 color space. + + @param red - (`0...255`) + @param green - (`0...255`) + @param blue - (`0...255`) + */ + rgbToAnsi(red: number, green: number, blue: number): number; + + /** + Convert from the RGB HEX color space to the ANSI 16 color space. + + @param hex - A hexadecimal string containing RGB data. + */ + hexToAnsi(hex: string): number; +} + +/** +Basic modifier names. +*/ +export type ModifierName = keyof Modifier; + +/** +Basic foreground color names. + +[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) +*/ +export type ForegroundColorName = keyof ForegroundColor; + +/** +Basic background color names. + +[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) +*/ +export type BackgroundColorName = keyof BackgroundColor; + +/** +Basic color names. The combination of foreground and background color names. + +[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) +*/ +export type ColorName = ForegroundColorName | BackgroundColorName; + +/** +Basic modifier names. +*/ +export const modifierNames: readonly ModifierName[]; + +/** +Basic foreground color names. +*/ +export const foregroundColorNames: readonly ForegroundColorName[]; + +/** +Basic background color names. +*/ +export const backgroundColorNames: readonly BackgroundColorName[]; + +/* +Basic color names. The combination of foreground and background color names. +*/ +export const colorNames: readonly ColorName[]; + +declare const ansiStyles: { + readonly modifier: Modifier; + readonly color: ColorBase & ForegroundColor; + readonly bgColor: ColorBase & BackgroundColor; + readonly codes: ReadonlyMap; +} & ForegroundColor & BackgroundColor & Modifier & ConvertColor; + +export default ansiStyles; diff --git a/node_modules/ansi-styles/index.js b/node_modules/ansi-styles/index.js new file mode 100644 index 0000000..d7bede4 --- /dev/null +++ b/node_modules/ansi-styles/index.js @@ -0,0 +1,223 @@ +const ANSI_BACKGROUND_OFFSET = 10; + +const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`; + +const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`; + +const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`; + +const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + overline: [53, 55], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29], + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + + // Bright color + blackBright: [90, 39], + gray: [90, 39], // Alias of `blackBright` + grey: [90, 39], // Alias of `blackBright` + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39], + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgGray: [100, 49], // Alias of `bgBlackBright` + bgGrey: [100, 49], // Alias of `bgBlackBright` + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49], + }, +}; + +export const modifierNames = Object.keys(styles.modifier); +export const foregroundColorNames = Object.keys(styles.color); +export const backgroundColorNames = Object.keys(styles.bgColor); +export const colorNames = [...foregroundColorNames, ...backgroundColorNames]; + +function assembleStyles() { + const codes = new Map(); + + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m`, + }; + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false, + }); + } + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false, + }); + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + styles.color.ansi = wrapAnsi16(); + styles.color.ansi256 = wrapAnsi256(); + styles.color.ansi16m = wrapAnsi16m(); + styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET); + styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET); + styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET); + + // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js + Object.defineProperties(styles, { + rgbToAnsi256: { + value: (red, green, blue) => { + // We use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + if (red === green && green === blue) { + if (red < 8) { + return 16; + } + + if (red > 248) { + return 231; + } + + return Math.round(((red - 8) / 247) * 24) + 232; + } + + return 16 + + (36 * Math.round(red / 255 * 5)) + + (6 * Math.round(green / 255 * 5)) + + Math.round(blue / 255 * 5); + }, + enumerable: false, + }, + hexToRgb: { + value: hex => { + const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16)); + if (!matches) { + return [0, 0, 0]; + } + + let [colorString] = matches; + + if (colorString.length === 3) { + colorString = [...colorString].map(character => character + character).join(''); + } + + const integer = Number.parseInt(colorString, 16); + + return [ + /* eslint-disable no-bitwise */ + (integer >> 16) & 0xFF, + (integer >> 8) & 0xFF, + integer & 0xFF, + /* eslint-enable no-bitwise */ + ]; + }, + enumerable: false, + }, + hexToAnsi256: { + value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)), + enumerable: false, + }, + ansi256ToAnsi: { + value: code => { + if (code < 8) { + return 30 + code; + } + + if (code < 16) { + return 90 + (code - 8); + } + + let red; + let green; + let blue; + + if (code >= 232) { + red = (((code - 232) * 10) + 8) / 255; + green = red; + blue = red; + } else { + code -= 16; + + const remainder = code % 36; + + red = Math.floor(code / 36) / 5; + green = Math.floor(remainder / 6) / 5; + blue = (remainder % 6) / 5; + } + + const value = Math.max(red, green, blue) * 2; + + if (value === 0) { + return 30; + } + + // eslint-disable-next-line no-bitwise + let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red)); + + if (value === 2) { + result += 60; + } + + return result; + }, + enumerable: false, + }, + rgbToAnsi: { + value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)), + enumerable: false, + }, + hexToAnsi: { + value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)), + enumerable: false, + }, + }); + + return styles; +} + +const ansiStyles = assembleStyles(); + +export default ansiStyles; diff --git a/node_modules/ansi-styles/license b/node_modules/ansi-styles/license new file mode 100644 index 0000000..fa7ceba --- /dev/null +++ b/node_modules/ansi-styles/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/ansi-styles/package.json b/node_modules/ansi-styles/package.json new file mode 100644 index 0000000..6cd3ca5 --- /dev/null +++ b/node_modules/ansi-styles/package.json @@ -0,0 +1,54 @@ +{ + "name": "ansi-styles", + "version": "6.2.1", + "description": "ANSI escape codes for styling strings in the terminal", + "license": "MIT", + "repository": "chalk/ansi-styles", + "funding": "https://github.com/chalk/ansi-styles?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && ava && tsd", + "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "devDependencies": { + "ava": "^3.15.0", + "svg-term-cli": "^2.1.1", + "tsd": "^0.19.0", + "xo": "^0.47.0" + } +} diff --git a/node_modules/ansi-styles/readme.md b/node_modules/ansi-styles/readme.md new file mode 100644 index 0000000..6d04183 --- /dev/null +++ b/node_modules/ansi-styles/readme.md @@ -0,0 +1,173 @@ +# ansi-styles + +> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal + +You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. + +![](screenshot.png) + +## Install + +```sh +npm install ansi-styles +``` + +## Usage + +```js +import styles from 'ansi-styles'; + +console.log(`${styles.green.open}Hello world!${styles.green.close}`); + + +// Color conversion between 256/truecolor +// NOTE: When converting from truecolor to 256 colors, the original color +// may be degraded to fit the new color palette. This means terminals +// that do not support 16 million colors will best-match the +// original color. +console.log(`${styles.color.ansi(styles.rgbToAnsi(199, 20, 250))}Hello World${styles.color.close}`) +console.log(`${styles.color.ansi256(styles.rgbToAnsi256(199, 20, 250))}Hello World${styles.color.close}`) +console.log(`${styles.color.ansi16m(...styles.hexToRgb('#abcdef'))}Hello World${styles.color.close}`) +``` + +## API + +### `open` and `close` + +Each style has an `open` and `close` property. + +### `modifierNames`, `foregroundColorNames`, `backgroundColorNames`, and `colorNames` + +All supported style strings are exposed as an array of strings for convenience. `colorNames` is the combination of `foregroundColorNames` and `backgroundColorNames`. + +This can be useful if you need to validate input: + +```js +import {modifierNames, foregroundColorNames} from 'ansi-styles'; + +console.log(modifierNames.includes('bold')); +//=> true + +console.log(foregroundColorNames.includes('pink')); +//=> false +``` + +## Styles + +### Modifiers + +- `reset` +- `bold` +- `dim` +- `italic` *(Not widely supported)* +- `underline` +- `overline` *Supported on VTE-based terminals, the GNOME terminal, mintty, and Git Bash.* +- `inverse` +- `hidden` +- `strikethrough` *(Not widely supported)* + +### Colors + +- `black` +- `red` +- `green` +- `yellow` +- `blue` +- `magenta` +- `cyan` +- `white` +- `blackBright` (alias: `gray`, `grey`) +- `redBright` +- `greenBright` +- `yellowBright` +- `blueBright` +- `magentaBright` +- `cyanBright` +- `whiteBright` + +### Background colors + +- `bgBlack` +- `bgRed` +- `bgGreen` +- `bgYellow` +- `bgBlue` +- `bgMagenta` +- `bgCyan` +- `bgWhite` +- `bgBlackBright` (alias: `bgGray`, `bgGrey`) +- `bgRedBright` +- `bgGreenBright` +- `bgYellowBright` +- `bgBlueBright` +- `bgMagentaBright` +- `bgCyanBright` +- `bgWhiteBright` + +## Advanced usage + +By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. + +- `styles.modifier` +- `styles.color` +- `styles.bgColor` + +###### Example + +```js +import styles from 'ansi-styles'; + +console.log(styles.color.green.open); +``` + +Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `styles.codes`, which returns a `Map` with the open codes as keys and close codes as values. + +###### Example + +```js +import styles from 'ansi-styles'; + +console.log(styles.codes.get(36)); +//=> 39 +``` + +## 16 / 256 / 16 million (TrueColor) support + +`ansi-styles` allows converting between various color formats and ANSI escapes, with support for 16, 256 and [16 million colors](https://gist.github.com/XVilka/8346728). + +The following color spaces are supported: + +- `rgb` +- `hex` +- `ansi256` +- `ansi` + +To use these, call the associated conversion function with the intended output, for example: + +```js +import styles from 'ansi-styles'; + +styles.color.ansi(styles.rgbToAnsi(100, 200, 15)); // RGB to 16 color ansi foreground code +styles.bgColor.ansi(styles.hexToAnsi('#C0FFEE')); // HEX to 16 color ansi foreground code + +styles.color.ansi256(styles.rgbToAnsi256(100, 200, 15)); // RGB to 256 color ansi foreground code +styles.bgColor.ansi256(styles.hexToAnsi256('#C0FFEE')); // HEX to 256 color ansi foreground code + +styles.color.ansi16m(100, 200, 15); // RGB to 16 million color foreground code +styles.bgColor.ansi16m(...styles.hexToRgb('#C0FFEE')); // Hex (RGB) to 16 million color foreground code +``` + +## Related + +- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + +## For enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/node_modules/body-parser/HISTORY.md b/node_modules/body-parser/HISTORY.md new file mode 100644 index 0000000..17dd110 --- /dev/null +++ b/node_modules/body-parser/HISTORY.md @@ -0,0 +1,731 @@ +2.2.0 / 2025-03-27 +========================= + +* refactor: normalize common options for all parsers +* deps: + * iconv-lite@^0.6.3 + +2.1.0 / 2025-02-10 +========================= + +* deps: + * type-is@^2.0.0 + * debug@^4.4.0 + * Removed destroy +* refactor: prefix built-in node module imports +* use the node require cache instead of custom caching + +2.0.2 / 2024-10-31 +========================= + +* remove `unpipe` package and use native `unpipe()` method + +2.0.1 / 2024-09-10 +========================= + +* Restore expected behavior `extended` to `false` + +2.0.0 / 2024-09-10 +========================= +* Propagate changes from 1.20.3 +* add brotli support #406 +* Breaking Change: Node.js 18 is the minimum supported version + +2.0.0-beta.2 / 2023-02-23 +========================= + +This incorporates all changes after 1.19.1 up to 1.20.2. + + * Remove deprecated `bodyParser()` combination middleware + * deps: debug@3.1.0 + - Add `DEBUG_HIDE_DATE` environment variable + - Change timer to per-namespace instead of global + - Change non-TTY date format + - Remove `DEBUG_FD` environment variable support + - Support 256 namespace colors + * deps: iconv-lite@0.5.2 + - Add encoding cp720 + - Add encoding UTF-32 + * deps: raw-body@3.0.0-beta.1 + +2.0.0-beta.1 / 2021-12-17 +========================= + + * Drop support for Node.js 0.8 + * `req.body` is no longer always initialized to `{}` + - it is left `undefined` unless a body is parsed + * `urlencoded` parser now defaults `extended` to `false` + * Use `on-finished` to determine when body read + +1.20.3 / 2024-09-10 +=================== + + * deps: qs@6.13.0 + * add `depth` option to customize the depth level in the parser + * IMPORTANT: The default `depth` level for parsing URL-encoded data is now `32` (previously was `Infinity`) + +1.20.2 / 2023-02-21 +=================== + + * Fix strict json error message on Node.js 19+ + * deps: content-type@~1.0.5 + - perf: skip value escaping when unnecessary + * deps: raw-body@2.5.2 + +1.20.1 / 2022-10-06 +=================== + + * deps: qs@6.11.0 + * perf: remove unnecessary object clone + +1.20.0 / 2022-04-02 +=================== + + * Fix error message for json parse whitespace in `strict` + * Fix internal error when inflated body exceeds limit + * Prevent loss of async hooks context + * Prevent hanging when request already read + * deps: depd@2.0.0 + - Replace internal `eval` usage with `Function` constructor + - Use instance methods on `process` to check for listeners + * deps: http-errors@2.0.0 + - deps: depd@2.0.0 + - deps: statuses@2.0.1 + * deps: on-finished@2.4.1 + * deps: qs@6.10.3 + * deps: raw-body@2.5.1 + - deps: http-errors@2.0.0 + +1.19.2 / 2022-02-15 +=================== + + * deps: bytes@3.1.2 + * deps: qs@6.9.7 + * Fix handling of `__proto__` keys + * deps: raw-body@2.4.3 + - deps: bytes@3.1.2 + +1.19.1 / 2021-12-10 +=================== + + * deps: bytes@3.1.1 + * deps: http-errors@1.8.1 + - deps: inherits@2.0.4 + - deps: toidentifier@1.0.1 + - deps: setprototypeof@1.2.0 + * deps: qs@6.9.6 + * deps: raw-body@2.4.2 + - deps: bytes@3.1.1 + - deps: http-errors@1.8.1 + * deps: safe-buffer@5.2.1 + * deps: type-is@~1.6.18 + +1.19.0 / 2019-04-25 +=================== + + * deps: bytes@3.1.0 + - Add petabyte (`pb`) support + * deps: http-errors@1.7.2 + - Set constructor name when possible + - deps: setprototypeof@1.1.1 + - deps: statuses@'>= 1.5.0 < 2' + * deps: iconv-lite@0.4.24 + - Added encoding MIK + * deps: qs@6.7.0 + - Fix parsing array brackets after index + * deps: raw-body@2.4.0 + - deps: bytes@3.1.0 + - deps: http-errors@1.7.2 + - deps: iconv-lite@0.4.24 + * deps: type-is@~1.6.17 + - deps: mime-types@~2.1.24 + - perf: prevent internal `throw` on invalid type + +1.18.3 / 2018-05-14 +=================== + + * Fix stack trace for strict json parse error + * deps: depd@~1.1.2 + - perf: remove argument reassignment + * deps: http-errors@~1.6.3 + - deps: depd@~1.1.2 + - deps: setprototypeof@1.1.0 + - deps: statuses@'>= 1.3.1 < 2' + * deps: iconv-lite@0.4.23 + - Fix loading encoding with year appended + - Fix deprecation warnings on Node.js 10+ + * deps: qs@6.5.2 + * deps: raw-body@2.3.3 + - deps: http-errors@1.6.3 + - deps: iconv-lite@0.4.23 + * deps: type-is@~1.6.16 + - deps: mime-types@~2.1.18 + +1.18.2 / 2017-09-22 +=================== + + * deps: debug@2.6.9 + * perf: remove argument reassignment + +1.18.1 / 2017-09-12 +=================== + + * deps: content-type@~1.0.4 + - perf: remove argument reassignment + - perf: skip parameter parsing when no parameters + * deps: iconv-lite@0.4.19 + - Fix ISO-8859-1 regression + - Update Windows-1255 + * deps: qs@6.5.1 + - Fix parsing & compacting very deep objects + * deps: raw-body@2.3.2 + - deps: iconv-lite@0.4.19 + +1.18.0 / 2017-09-08 +=================== + + * Fix JSON strict violation error to match native parse error + * Include the `body` property on verify errors + * Include the `type` property on all generated errors + * Use `http-errors` to set status code on errors + * deps: bytes@3.0.0 + * deps: debug@2.6.8 + * deps: depd@~1.1.1 + - Remove unnecessary `Buffer` loading + * deps: http-errors@~1.6.2 + - deps: depd@1.1.1 + * deps: iconv-lite@0.4.18 + - Add support for React Native + - Add a warning if not loaded as utf-8 + - Fix CESU-8 decoding in Node.js 8 + - Improve speed of ISO-8859-1 encoding + * deps: qs@6.5.0 + * deps: raw-body@2.3.1 + - Use `http-errors` for standard emitted errors + - deps: bytes@3.0.0 + - deps: iconv-lite@0.4.18 + - perf: skip buffer decoding on overage chunk + * perf: prevent internal `throw` when missing charset + +1.17.2 / 2017-05-17 +=================== + + * deps: debug@2.6.7 + - Fix `DEBUG_MAX_ARRAY_LENGTH` + - deps: ms@2.0.0 + * deps: type-is@~1.6.15 + - deps: mime-types@~2.1.15 + +1.17.1 / 2017-03-06 +=================== + + * deps: qs@6.4.0 + - Fix regression parsing keys starting with `[` + +1.17.0 / 2017-03-01 +=================== + + * deps: http-errors@~1.6.1 + - Make `message` property enumerable for `HttpError`s + - deps: setprototypeof@1.0.3 + * deps: qs@6.3.1 + - Fix compacting nested arrays + +1.16.1 / 2017-02-10 +=================== + + * deps: debug@2.6.1 + - Fix deprecation messages in WebStorm and other editors + - Undeprecate `DEBUG_FD` set to `1` or `2` + +1.16.0 / 2017-01-17 +=================== + + * deps: debug@2.6.0 + - Allow colors in workers + - Deprecated `DEBUG_FD` environment variable + - Fix error when running under React Native + - Use same color for same namespace + - deps: ms@0.7.2 + * deps: http-errors@~1.5.1 + - deps: inherits@2.0.3 + - deps: setprototypeof@1.0.2 + - deps: statuses@'>= 1.3.1 < 2' + * deps: iconv-lite@0.4.15 + - Added encoding MS-31J + - Added encoding MS-932 + - Added encoding MS-936 + - Added encoding MS-949 + - Added encoding MS-950 + - Fix GBK/GB18030 handling of Euro character + * deps: qs@6.2.1 + - Fix array parsing from skipping empty values + * deps: raw-body@~2.2.0 + - deps: iconv-lite@0.4.15 + * deps: type-is@~1.6.14 + - deps: mime-types@~2.1.13 + +1.15.2 / 2016-06-19 +=================== + + * deps: bytes@2.4.0 + * deps: content-type@~1.0.2 + - perf: enable strict mode + * deps: http-errors@~1.5.0 + - Use `setprototypeof` module to replace `__proto__` setting + - deps: statuses@'>= 1.3.0 < 2' + - perf: enable strict mode + * deps: qs@6.2.0 + * deps: raw-body@~2.1.7 + - deps: bytes@2.4.0 + - perf: remove double-cleanup on happy path + * deps: type-is@~1.6.13 + - deps: mime-types@~2.1.11 + +1.15.1 / 2016-05-05 +=================== + + * deps: bytes@2.3.0 + - Drop partial bytes on all parsed units + - Fix parsing byte string that looks like hex + * deps: raw-body@~2.1.6 + - deps: bytes@2.3.0 + * deps: type-is@~1.6.12 + - deps: mime-types@~2.1.10 + +1.15.0 / 2016-02-10 +=================== + + * deps: http-errors@~1.4.0 + - Add `HttpError` export, for `err instanceof createError.HttpError` + - deps: inherits@2.0.1 + - deps: statuses@'>= 1.2.1 < 2' + * deps: qs@6.1.0 + * deps: type-is@~1.6.11 + - deps: mime-types@~2.1.9 + +1.14.2 / 2015-12-16 +=================== + + * deps: bytes@2.2.0 + * deps: iconv-lite@0.4.13 + * deps: qs@5.2.0 + * deps: raw-body@~2.1.5 + - deps: bytes@2.2.0 + - deps: iconv-lite@0.4.13 + * deps: type-is@~1.6.10 + - deps: mime-types@~2.1.8 + +1.14.1 / 2015-09-27 +=================== + + * Fix issue where invalid charset results in 400 when `verify` used + * deps: iconv-lite@0.4.12 + - Fix CESU-8 decoding in Node.js 4.x + * deps: raw-body@~2.1.4 + - Fix masking critical errors from `iconv-lite` + - deps: iconv-lite@0.4.12 + * deps: type-is@~1.6.9 + - deps: mime-types@~2.1.7 + +1.14.0 / 2015-09-16 +=================== + + * Fix JSON strict parse error to match syntax errors + * Provide static `require` analysis in `urlencoded` parser + * deps: depd@~1.1.0 + - Support web browser loading + * deps: qs@5.1.0 + * deps: raw-body@~2.1.3 + - Fix sync callback when attaching data listener causes sync read + * deps: type-is@~1.6.8 + - Fix type error when given invalid type to match against + - deps: mime-types@~2.1.6 + +1.13.3 / 2015-07-31 +=================== + + * deps: type-is@~1.6.6 + - deps: mime-types@~2.1.4 + +1.13.2 / 2015-07-05 +=================== + + * deps: iconv-lite@0.4.11 + * deps: qs@4.0.0 + - Fix dropping parameters like `hasOwnProperty` + - Fix user-visible incompatibilities from 3.1.0 + - Fix various parsing edge cases + * deps: raw-body@~2.1.2 + - Fix error stack traces to skip `makeError` + - deps: iconv-lite@0.4.11 + * deps: type-is@~1.6.4 + - deps: mime-types@~2.1.2 + - perf: enable strict mode + - perf: remove argument reassignment + +1.13.1 / 2015-06-16 +=================== + + * deps: qs@2.4.2 + - Downgraded from 3.1.0 because of user-visible incompatibilities + +1.13.0 / 2015-06-14 +=================== + + * Add `statusCode` property on `Error`s, in addition to `status` + * Change `type` default to `application/json` for JSON parser + * Change `type` default to `application/x-www-form-urlencoded` for urlencoded parser + * Provide static `require` analysis + * Use the `http-errors` module to generate errors + * deps: bytes@2.1.0 + - Slight optimizations + * deps: iconv-lite@0.4.10 + - The encoding UTF-16 without BOM now defaults to UTF-16LE when detection fails + - Leading BOM is now removed when decoding + * deps: on-finished@~2.3.0 + - Add defined behavior for HTTP `CONNECT` requests + - Add defined behavior for HTTP `Upgrade` requests + - deps: ee-first@1.1.1 + * deps: qs@3.1.0 + - Fix dropping parameters like `hasOwnProperty` + - Fix various parsing edge cases + - Parsed object now has `null` prototype + * deps: raw-body@~2.1.1 + - Use `unpipe` module for unpiping requests + - deps: iconv-lite@0.4.10 + * deps: type-is@~1.6.3 + - deps: mime-types@~2.1.1 + - perf: reduce try block size + - perf: remove bitwise operations + * perf: enable strict mode + * perf: remove argument reassignment + * perf: remove delete call + +1.12.4 / 2015-05-10 +=================== + + * deps: debug@~2.2.0 + * deps: qs@2.4.2 + - Fix allowing parameters like `constructor` + * deps: on-finished@~2.2.1 + * deps: raw-body@~2.0.1 + - Fix a false-positive when unpiping in Node.js 0.8 + - deps: bytes@2.0.1 + * deps: type-is@~1.6.2 + - deps: mime-types@~2.0.11 + +1.12.3 / 2015-04-15 +=================== + + * Slight efficiency improvement when not debugging + * deps: depd@~1.0.1 + * deps: iconv-lite@0.4.8 + - Add encoding alias UNICODE-1-1-UTF-7 + * deps: raw-body@1.3.4 + - Fix hanging callback if request aborts during read + - deps: iconv-lite@0.4.8 + +1.12.2 / 2015-03-16 +=================== + + * deps: qs@2.4.1 + - Fix error when parameter `hasOwnProperty` is present + +1.12.1 / 2015-03-15 +=================== + + * deps: debug@~2.1.3 + - Fix high intensity foreground color for bold + - deps: ms@0.7.0 + * deps: type-is@~1.6.1 + - deps: mime-types@~2.0.10 + +1.12.0 / 2015-02-13 +=================== + + * add `debug` messages + * accept a function for the `type` option + * use `content-type` to parse `Content-Type` headers + * deps: iconv-lite@0.4.7 + - Gracefully support enumerables on `Object.prototype` + * deps: raw-body@1.3.3 + - deps: iconv-lite@0.4.7 + * deps: type-is@~1.6.0 + - fix argument reassignment + - fix false-positives in `hasBody` `Transfer-Encoding` check + - support wildcard for both type and subtype (`*/*`) + - deps: mime-types@~2.0.9 + +1.11.0 / 2015-01-30 +=================== + + * make internal `extended: true` depth limit infinity + * deps: type-is@~1.5.6 + - deps: mime-types@~2.0.8 + +1.10.2 / 2015-01-20 +=================== + + * deps: iconv-lite@0.4.6 + - Fix rare aliases of single-byte encodings + * deps: raw-body@1.3.2 + - deps: iconv-lite@0.4.6 + +1.10.1 / 2015-01-01 +=================== + + * deps: on-finished@~2.2.0 + * deps: type-is@~1.5.5 + - deps: mime-types@~2.0.7 + +1.10.0 / 2014-12-02 +=================== + + * make internal `extended: true` array limit dynamic + +1.9.3 / 2014-11-21 +================== + + * deps: iconv-lite@0.4.5 + - Fix Windows-31J and X-SJIS encoding support + * deps: qs@2.3.3 + - Fix `arrayLimit` behavior + * deps: raw-body@1.3.1 + - deps: iconv-lite@0.4.5 + * deps: type-is@~1.5.3 + - deps: mime-types@~2.0.3 + +1.9.2 / 2014-10-27 +================== + + * deps: qs@2.3.2 + - Fix parsing of mixed objects and values + +1.9.1 / 2014-10-22 +================== + + * deps: on-finished@~2.1.1 + - Fix handling of pipelined requests + * deps: qs@2.3.0 + - Fix parsing of mixed implicit and explicit arrays + * deps: type-is@~1.5.2 + - deps: mime-types@~2.0.2 + +1.9.0 / 2014-09-24 +================== + + * include the charset in "unsupported charset" error message + * include the encoding in "unsupported content encoding" error message + * deps: depd@~1.0.0 + +1.8.4 / 2014-09-23 +================== + + * fix content encoding to be case-insensitive + +1.8.3 / 2014-09-19 +================== + + * deps: qs@2.2.4 + - Fix issue with object keys starting with numbers truncated + +1.8.2 / 2014-09-15 +================== + + * deps: depd@0.4.5 + +1.8.1 / 2014-09-07 +================== + + * deps: media-typer@0.3.0 + * deps: type-is@~1.5.1 + +1.8.0 / 2014-09-05 +================== + + * make empty-body-handling consistent between chunked requests + - empty `json` produces `{}` + - empty `raw` produces `new Buffer(0)` + - empty `text` produces `''` + - empty `urlencoded` produces `{}` + * deps: qs@2.2.3 + - Fix issue where first empty value in array is discarded + * deps: type-is@~1.5.0 + - fix `hasbody` to be true for `content-length: 0` + +1.7.0 / 2014-09-01 +================== + + * add `parameterLimit` option to `urlencoded` parser + * change `urlencoded` extended array limit to 100 + * respond with 413 when over `parameterLimit` in `urlencoded` + +1.6.7 / 2014-08-29 +================== + + * deps: qs@2.2.2 + - Remove unnecessary cloning + +1.6.6 / 2014-08-27 +================== + + * deps: qs@2.2.0 + - Array parsing fix + - Performance improvements + +1.6.5 / 2014-08-16 +================== + + * deps: on-finished@2.1.0 + +1.6.4 / 2014-08-14 +================== + + * deps: qs@1.2.2 + +1.6.3 / 2014-08-10 +================== + + * deps: qs@1.2.1 + +1.6.2 / 2014-08-07 +================== + + * deps: qs@1.2.0 + - Fix parsing array of objects + +1.6.1 / 2014-08-06 +================== + + * deps: qs@1.1.0 + - Accept urlencoded square brackets + - Accept empty values in implicit array notation + +1.6.0 / 2014-08-05 +================== + + * deps: qs@1.0.2 + - Complete rewrite + - Limits array length to 20 + - Limits object depth to 5 + - Limits parameters to 1,000 + +1.5.2 / 2014-07-27 +================== + + * deps: depd@0.4.4 + - Work-around v8 generating empty stack traces + +1.5.1 / 2014-07-26 +================== + + * deps: depd@0.4.3 + - Fix exception when global `Error.stackTraceLimit` is too low + +1.5.0 / 2014-07-20 +================== + + * deps: depd@0.4.2 + - Add `TRACE_DEPRECATION` environment variable + - Remove non-standard grey color from color output + - Support `--no-deprecation` argument + - Support `--trace-deprecation` argument + * deps: iconv-lite@0.4.4 + - Added encoding UTF-7 + * deps: raw-body@1.3.0 + - deps: iconv-lite@0.4.4 + - Added encoding UTF-7 + - Fix `Cannot switch to old mode now` error on Node.js 0.10+ + * deps: type-is@~1.3.2 + +1.4.3 / 2014-06-19 +================== + + * deps: type-is@1.3.1 + - fix global variable leak + +1.4.2 / 2014-06-19 +================== + + * deps: type-is@1.3.0 + - improve type parsing + +1.4.1 / 2014-06-19 +================== + + * fix urlencoded extended deprecation message + +1.4.0 / 2014-06-19 +================== + + * add `text` parser + * add `raw` parser + * check accepted charset in content-type (accepts utf-8) + * check accepted encoding in content-encoding (accepts identity) + * deprecate `bodyParser()` middleware; use `.json()` and `.urlencoded()` as needed + * deprecate `urlencoded()` without provided `extended` option + * lazy-load urlencoded parsers + * parsers split into files for reduced mem usage + * support gzip and deflate bodies + - set `inflate: false` to turn off + * deps: raw-body@1.2.2 + - Support all encodings from `iconv-lite` + +1.3.1 / 2014-06-11 +================== + + * deps: type-is@1.2.1 + - Switch dependency from mime to mime-types@1.0.0 + +1.3.0 / 2014-05-31 +================== + + * add `extended` option to urlencoded parser + +1.2.2 / 2014-05-27 +================== + + * deps: raw-body@1.1.6 + - assert stream encoding on node.js 0.8 + - assert stream encoding on node.js < 0.10.6 + - deps: bytes@1 + +1.2.1 / 2014-05-26 +================== + + * invoke `next(err)` after request fully read + - prevents hung responses and socket hang ups + +1.2.0 / 2014-05-11 +================== + + * add `verify` option + * deps: type-is@1.2.0 + - support suffix matching + +1.1.2 / 2014-05-11 +================== + + * improve json parser speed + +1.1.1 / 2014-05-11 +================== + + * fix repeated limit parsing with every request + +1.1.0 / 2014-05-10 +================== + + * add `type` option + * deps: pin for safety and consistency + +1.0.2 / 2014-04-14 +================== + + * use `type-is` module + +1.0.1 / 2014-03-20 +================== + + * lower default limits to 100kb diff --git a/node_modules/body-parser/LICENSE b/node_modules/body-parser/LICENSE new file mode 100644 index 0000000..386b7b6 --- /dev/null +++ b/node_modules/body-parser/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2014 Jonathan Ong +Copyright (c) 2014-2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/body-parser/README.md b/node_modules/body-parser/README.md new file mode 100644 index 0000000..9fcd4c6 --- /dev/null +++ b/node_modules/body-parser/README.md @@ -0,0 +1,491 @@ +# body-parser + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Build Status][ci-image]][ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] +[![OpenSSF Scorecard Badge][ossf-scorecard-badge]][ossf-scorecard-visualizer] + +Node.js body parsing middleware. + +Parse incoming request bodies in a middleware before your handlers, available +under the `req.body` property. + +**Note** As `req.body`'s shape is based on user-controlled input, all +properties and values in this object are untrusted and should be validated +before trusting. For example, `req.body.foo.toString()` may fail in multiple +ways, for example the `foo` property may not be there or may not be a string, +and `toString` may not be a function and instead a string or other user input. + +[Learn about the anatomy of an HTTP transaction in Node.js](https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/). + +_This does not handle multipart bodies_, due to their complex and typically +large nature. For multipart bodies, you may be interested in the following +modules: + + * [busboy](https://www.npmjs.org/package/busboy#readme) and + [connect-busboy](https://www.npmjs.org/package/connect-busboy#readme) + * [multiparty](https://www.npmjs.org/package/multiparty#readme) and + [connect-multiparty](https://www.npmjs.org/package/connect-multiparty#readme) + * [formidable](https://www.npmjs.org/package/formidable#readme) + * [multer](https://www.npmjs.org/package/multer#readme) + +This module provides the following parsers: + + * [JSON body parser](#bodyparserjsonoptions) + * [Raw body parser](#bodyparserrawoptions) + * [Text body parser](#bodyparsertextoptions) + * [URL-encoded form body parser](#bodyparserurlencodedoptions) + +Other body parsers you might be interested in: + +- [body](https://www.npmjs.org/package/body#readme) +- [co-body](https://www.npmjs.org/package/co-body#readme) + +## Installation + +```sh +$ npm install body-parser +``` + +## API + +```js +const bodyParser = require('body-parser') +``` + +The `bodyParser` object exposes various factories to create middlewares. All +middlewares will populate the `req.body` property with the parsed body when +the `Content-Type` request header matches the `type` option. + +The various errors returned by this module are described in the +[errors section](#errors). + +### bodyParser.json([options]) + +Returns middleware that only parses `json` and only looks at requests where +the `Content-Type` header matches the `type` option. This parser accepts any +Unicode encoding of the body and supports automatic inflation of `gzip`, +`br` (brotli) and `deflate` encodings. + +A new `body` object containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). + +#### Options + +The `json` function takes an optional `options` object that may contain any of +the following keys: + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### reviver + +The `reviver` option is passed directly to `JSON.parse` as the second +argument. You can find more information on this argument +[in the MDN documentation about JSON.parse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter). + +##### strict + +When set to `true`, will only accept arrays and objects; when `false` will +accept anything `JSON.parse` accepts. Defaults to `true`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a string, array of strings, or a function. If not a +function, `type` option is passed directly to the +[type-is](https://www.npmjs.org/package/type-is#readme) library and this can +be an extension name (like `json`), a mime type (like `application/json`), or +a mime type with a wildcard (like `*/*` or `*/json`). If a function, the `type` +option is called as `fn(req)` and the request is parsed if it returns a truthy +value. Defaults to `application/json`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +### bodyParser.raw([options]) + +Returns middleware that parses all bodies as a `Buffer` and only looks at +requests where the `Content-Type` header matches the `type` option. This +parser supports automatic inflation of `gzip`, `br` (brotli) and `deflate` +encodings. + +A new `body` object containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). This will be a `Buffer` object +of the body. + +#### Options + +The `raw` function takes an optional `options` object that may contain any of +the following keys: + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a string, array of strings, or a function. +If not a function, `type` option is passed directly to the +[type-is](https://www.npmjs.org/package/type-is#readme) library and this +can be an extension name (like `bin`), a mime type (like +`application/octet-stream`), or a mime type with a wildcard (like `*/*` or +`application/*`). If a function, the `type` option is called as `fn(req)` +and the request is parsed if it returns a truthy value. Defaults to +`application/octet-stream`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +### bodyParser.text([options]) + +Returns middleware that parses all bodies as a string and only looks at +requests where the `Content-Type` header matches the `type` option. This +parser supports automatic inflation of `gzip`, `br` (brotli) and `deflate` +encodings. + +A new `body` string containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). This will be a string of the +body. + +#### Options + +The `text` function takes an optional `options` object that may contain any of +the following keys: + +##### defaultCharset + +Specify the default character set for the text content if the charset is not +specified in the `Content-Type` header of the request. Defaults to `utf-8`. + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a string, array of strings, or a function. If not +a function, `type` option is passed directly to the +[type-is](https://www.npmjs.org/package/type-is#readme) library and this can +be an extension name (like `txt`), a mime type (like `text/plain`), or a mime +type with a wildcard (like `*/*` or `text/*`). If a function, the `type` +option is called as `fn(req)` and the request is parsed if it returns a +truthy value. Defaults to `text/plain`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +### bodyParser.urlencoded([options]) + +Returns middleware that only parses `urlencoded` bodies and only looks at +requests where the `Content-Type` header matches the `type` option. This +parser accepts only UTF-8 encoding of the body and supports automatic +inflation of `gzip`, `br` (brotli) and `deflate` encodings. + +A new `body` object containing the parsed data is populated on the `request` +object after the middleware (i.e. `req.body`). This object will contain +key-value pairs, where the value can be a string or array (when `extended` is +`false`), or any type (when `extended` is `true`). + +#### Options + +The `urlencoded` function takes an optional `options` object that may contain +any of the following keys: + +##### extended + +The "extended" syntax allows for rich objects and arrays to be encoded into the +URL-encoded format, allowing for a JSON-like experience with URL-encoded. For +more information, please [see the qs +library](https://www.npmjs.org/package/qs#readme). + +Defaults to `false`. + +##### inflate + +When set to `true`, then deflated (compressed) bodies will be inflated; when +`false`, deflated bodies are rejected. Defaults to `true`. + +##### limit + +Controls the maximum request body size. If this is a number, then the value +specifies the number of bytes; if it is a string, the value is passed to the +[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults +to `'100kb'`. + +##### parameterLimit + +The `parameterLimit` option controls the maximum number of parameters that +are allowed in the URL-encoded data. If a request contains more parameters +than this value, a 413 will be returned to the client. Defaults to `1000`. + +##### type + +The `type` option is used to determine what media type the middleware will +parse. This option can be a string, array of strings, or a function. If not +a function, `type` option is passed directly to the +[type-is](https://www.npmjs.org/package/type-is#readme) library and this can +be an extension name (like `urlencoded`), a mime type (like +`application/x-www-form-urlencoded`), or a mime type with a wildcard (like +`*/x-www-form-urlencoded`). If a function, the `type` option is called as +`fn(req)` and the request is parsed if it returns a truthy value. Defaults +to `application/x-www-form-urlencoded`. + +##### verify + +The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`, +where `buf` is a `Buffer` of the raw request body and `encoding` is the +encoding of the request. The parsing can be aborted by throwing an error. + +##### defaultCharset + +The default charset to parse as, if not specified in content-type. Must be +either `utf-8` or `iso-8859-1`. Defaults to `utf-8`. + +##### charsetSentinel + +Whether to let the value of the `utf8` parameter take precedence as the charset +selector. It requires the form to contain a parameter named `utf8` with a value +of `✓`. Defaults to `false`. + +##### interpretNumericEntities + +Whether to decode numeric entities such as `☺` when parsing an iso-8859-1 +form. Defaults to `false`. + + +#### depth + +The `depth` option is used to configure the maximum depth of the `qs` library when `extended` is `true`. This allows you to limit the amount of keys that are parsed and can be useful to prevent certain types of abuse. Defaults to `32`. It is recommended to keep this value as low as possible. + +## Errors + +The middlewares provided by this module create errors using the +[`http-errors` module](https://www.npmjs.com/package/http-errors). The errors +will typically have a `status`/`statusCode` property that contains the suggested +HTTP response code, an `expose` property to determine if the `message` property +should be displayed to the client, a `type` property to determine the type of +error without matching against the `message`, and a `body` property containing +the read body, if available. + +The following are the common errors created, though any error can come through +for various reasons. + +### content encoding unsupported + +This error will occur when the request had a `Content-Encoding` header that +contained an encoding but the "inflation" option was set to `false`. The +`status` property is set to `415`, the `type` property is set to +`'encoding.unsupported'`, and the `charset` property will be set to the +encoding that is unsupported. + +### entity parse failed + +This error will occur when the request contained an entity that could not be +parsed by the middleware. The `status` property is set to `400`, the `type` +property is set to `'entity.parse.failed'`, and the `body` property is set to +the entity value that failed parsing. + +### entity verify failed + +This error will occur when the request contained an entity that could not be +failed verification by the defined `verify` option. The `status` property is +set to `403`, the `type` property is set to `'entity.verify.failed'`, and the +`body` property is set to the entity value that failed verification. + +### request aborted + +This error will occur when the request is aborted by the client before reading +the body has finished. The `received` property will be set to the number of +bytes received before the request was aborted and the `expected` property is +set to the number of expected bytes. The `status` property is set to `400` +and `type` property is set to `'request.aborted'`. + +### request entity too large + +This error will occur when the request body's size is larger than the "limit" +option. The `limit` property will be set to the byte limit and the `length` +property will be set to the request body's length. The `status` property is +set to `413` and the `type` property is set to `'entity.too.large'`. + +### request size did not match content length + +This error will occur when the request's length did not match the length from +the `Content-Length` header. This typically occurs when the request is malformed, +typically when the `Content-Length` header was calculated based on characters +instead of bytes. The `status` property is set to `400` and the `type` property +is set to `'request.size.invalid'`. + +### stream encoding should not be set + +This error will occur when something called the `req.setEncoding` method prior +to this middleware. This module operates directly on bytes only and you cannot +call `req.setEncoding` when using this module. The `status` property is set to +`500` and the `type` property is set to `'stream.encoding.set'`. + +### stream is not readable + +This error will occur when the request is no longer readable when this middleware +attempts to read it. This typically means something other than a middleware from +this module read the request body already and the middleware was also configured to +read the same request. The `status` property is set to `500` and the `type` +property is set to `'stream.not.readable'`. + +### too many parameters + +This error will occur when the content of the request exceeds the configured +`parameterLimit` for the `urlencoded` parser. The `status` property is set to +`413` and the `type` property is set to `'parameters.too.many'`. + +### unsupported charset "BOGUS" + +This error will occur when the request had a charset parameter in the +`Content-Type` header, but the `iconv-lite` module does not support it OR the +parser does not support it. The charset is contained in the message as well +as in the `charset` property. The `status` property is set to `415`, the +`type` property is set to `'charset.unsupported'`, and the `charset` property +is set to the charset that is unsupported. + +### unsupported content encoding "bogus" + +This error will occur when the request had a `Content-Encoding` header that +contained an unsupported encoding. The encoding is contained in the message +as well as in the `encoding` property. The `status` property is set to `415`, +the `type` property is set to `'encoding.unsupported'`, and the `encoding` +property is set to the encoding that is unsupported. + +### The input exceeded the depth + +This error occurs when using `bodyParser.urlencoded` with the `extended` property set to `true` and the input exceeds the configured `depth` option. The `status` property is set to `400`. It is recommended to review the `depth` option and evaluate if it requires a higher value. When the `depth` option is set to `32` (default value), the error will not be thrown. + +## Examples + +### Express/Connect top-level generic + +This example demonstrates adding a generic JSON and URL-encoded parser as a +top-level middleware, which will parse the bodies of all incoming requests. +This is the simplest setup. + +```js +const express = require('express') +const bodyParser = require('body-parser') + +const app = express() + +// parse application/x-www-form-urlencoded +app.use(bodyParser.urlencoded()) + +// parse application/json +app.use(bodyParser.json()) + +app.use(function (req, res) { + res.setHeader('Content-Type', 'text/plain') + res.write('you posted:\n') + res.end(String(JSON.stringify(req.body, null, 2))) +}) +``` + +### Express route-specific + +This example demonstrates adding body parsers specifically to the routes that +need them. In general, this is the most recommended way to use body-parser with +Express. + +```js +const express = require('express') +const bodyParser = require('body-parser') + +const app = express() + +// create application/json parser +const jsonParser = bodyParser.json() + +// create application/x-www-form-urlencoded parser +const urlencodedParser = bodyParser.urlencoded() + +// POST /login gets urlencoded bodies +app.post('/login', urlencodedParser, function (req, res) { + if (!req.body || !req.body.username) res.sendStatus(400) + res.send('welcome, ' + req.body.username) +}) + +// POST /api/users gets JSON bodies +app.post('/api/users', jsonParser, function (req, res) { + if (!req.body) res.sendStatus(400) + // create user in req.body +}) +``` + +### Change accepted type for parsers + +All the parsers accept a `type` option which allows you to change the +`Content-Type` that the middleware will parse. + +```js +const express = require('express') +const bodyParser = require('body-parser') + +const app = express() + +// parse various different custom JSON types as JSON +app.use(bodyParser.json({ type: 'application/*+json' })) + +// parse some custom thing into a Buffer +app.use(bodyParser.raw({ type: 'application/vnd.custom-type' })) + +// parse an HTML body into a string +app.use(bodyParser.text({ type: 'text/html' })) +``` + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/expressjs/body-parser/master?label=ci +[ci-url]: https://github.com/expressjs/body-parser/actions/workflows/ci.yml +[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/body-parser/master +[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master +[node-version-image]: https://badgen.net/npm/node/body-parser +[node-version-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/body-parser +[npm-url]: https://npmjs.org/package/body-parser +[npm-version-image]: https://badgen.net/npm/v/body-parser +[ossf-scorecard-badge]: https://api.scorecard.dev/projects/github.com/expressjs/body-parser/badge +[ossf-scorecard-visualizer]: https://ossf.github.io/scorecard-visualizer/#/projects/github.com/expressjs/body-parser \ No newline at end of file diff --git a/node_modules/body-parser/index.js b/node_modules/body-parser/index.js new file mode 100644 index 0000000..d722d0b --- /dev/null +++ b/node_modules/body-parser/index.js @@ -0,0 +1,80 @@ +/*! + * body-parser + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * @typedef Parsers + * @type {function} + * @property {function} json + * @property {function} raw + * @property {function} text + * @property {function} urlencoded + */ + +/** + * Module exports. + * @type {Parsers} + */ + +exports = module.exports = bodyParser + +/** + * JSON parser. + * @public + */ + +Object.defineProperty(exports, 'json', { + configurable: true, + enumerable: true, + get: () => require('./lib/types/json') +}) + +/** + * Raw parser. + * @public + */ + +Object.defineProperty(exports, 'raw', { + configurable: true, + enumerable: true, + get: () => require('./lib/types/raw') +}) + +/** + * Text parser. + * @public + */ + +Object.defineProperty(exports, 'text', { + configurable: true, + enumerable: true, + get: () => require('./lib/types/text') +}) + +/** + * URL-encoded parser. + * @public + */ + +Object.defineProperty(exports, 'urlencoded', { + configurable: true, + enumerable: true, + get: () => require('./lib/types/urlencoded') +}) + +/** + * Create a middleware to parse json and urlencoded bodies. + * + * @param {object} [options] + * @return {function} + * @deprecated + * @public + */ + +function bodyParser () { + throw new Error('The bodyParser() generic has been split into individual middleware to use instead.') +} diff --git a/node_modules/body-parser/package.json b/node_modules/body-parser/package.json new file mode 100644 index 0000000..e7f763b --- /dev/null +++ b/node_modules/body-parser/package.json @@ -0,0 +1,49 @@ +{ + "name": "body-parser", + "description": "Node.js body parsing middleware", + "version": "2.2.0", + "contributors": [ + "Douglas Christopher Wilson ", + "Jonathan Ong (http://jongleberry.com)" + ], + "license": "MIT", + "repository": "expressjs/body-parser", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.0", + "http-errors": "^2.0.0", + "iconv-lite": "^0.6.3", + "on-finished": "^2.4.1", + "qs": "^6.14.0", + "raw-body": "^3.0.0", + "type-is": "^2.0.0" + }, + "devDependencies": { + "eslint": "8.34.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.27.5", + "eslint-plugin-markdown": "3.0.0", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "6.1.1", + "eslint-plugin-standard": "4.1.0", + "mocha": "^11.1.0", + "nyc": "^17.1.0", + "supertest": "^7.0.0" + }, + "files": [ + "lib/", + "LICENSE", + "HISTORY.md", + "index.js" + ], + "engines": { + "node": ">=18" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec --check-leaks test/", + "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + } +} diff --git a/node_modules/bytes/History.md b/node_modules/bytes/History.md new file mode 100644 index 0000000..d60ce0e --- /dev/null +++ b/node_modules/bytes/History.md @@ -0,0 +1,97 @@ +3.1.2 / 2022-01-27 +================== + + * Fix return value for un-parsable strings + +3.1.1 / 2021-11-15 +================== + + * Fix "thousandsSeparator" incorrecting formatting fractional part + +3.1.0 / 2019-01-22 +================== + + * Add petabyte (`pb`) support + +3.0.0 / 2017-08-31 +================== + + * Change "kB" to "KB" in format output + * Remove support for Node.js 0.6 + * Remove support for ComponentJS + +2.5.0 / 2017-03-24 +================== + + * Add option "unit" + +2.4.0 / 2016-06-01 +================== + + * Add option "unitSeparator" + +2.3.0 / 2016-02-15 +================== + + * Drop partial bytes on all parsed units + * Fix non-finite numbers to `.format` to return `null` + * Fix parsing byte string that looks like hex + * perf: hoist regular expressions + +2.2.0 / 2015-11-13 +================== + + * add option "decimalPlaces" + * add option "fixedDecimals" + +2.1.0 / 2015-05-21 +================== + + * add `.format` export + * add `.parse` export + +2.0.2 / 2015-05-20 +================== + + * remove map recreation + * remove unnecessary object construction + +2.0.1 / 2015-05-07 +================== + + * fix browserify require + * remove node.extend dependency + +2.0.0 / 2015-04-12 +================== + + * add option "case" + * add option "thousandsSeparator" + * return "null" on invalid parse input + * support proper round-trip: bytes(bytes(num)) === num + * units no longer case sensitive when parsing + +1.0.0 / 2014-05-05 +================== + + * add negative support. fixes #6 + +0.3.0 / 2014-03-19 +================== + + * added terabyte support + +0.2.1 / 2013-04-01 +================== + + * add .component + +0.2.0 / 2012-10-28 +================== + + * bytes(200).should.eql('200b') + +0.1.0 / 2012-07-04 +================== + + * add bytes to string conversion [yields] diff --git a/node_modules/bytes/LICENSE b/node_modules/bytes/LICENSE new file mode 100644 index 0000000..63e95a9 --- /dev/null +++ b/node_modules/bytes/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2012-2014 TJ Holowaychuk +Copyright (c) 2015 Jed Watson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/bytes/Readme.md b/node_modules/bytes/Readme.md new file mode 100644 index 0000000..5790e23 --- /dev/null +++ b/node_modules/bytes/Readme.md @@ -0,0 +1,152 @@ +# Bytes utility + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Build Status][ci-image]][ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Utility to parse a string bytes (ex: `1TB`) to bytes (`1099511627776`) and vice-versa. + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```bash +$ npm install bytes +``` + +## Usage + +```js +var bytes = require('bytes'); +``` + +#### bytes(number|string value, [options]): number|string|null + +Default export function. Delegates to either `bytes.format` or `bytes.parse` based on the type of `value`. + +**Arguments** + +| Name | Type | Description | +|---------|----------|--------------------| +| value | `number`|`string` | Number value to format or string value to parse | +| options | `Object` | Conversion options for `format` | + +**Returns** + +| Name | Type | Description | +|---------|------------------|-------------------------------------------------| +| results | `string`|`number`|`null` | Return null upon error. Numeric value in bytes, or string value otherwise. | + +**Example** + +```js +bytes(1024); +// output: '1KB' + +bytes('1KB'); +// output: 1024 +``` + +#### bytes.format(number value, [options]): string|null + +Format the given value in bytes into a string. If the value is negative, it is kept as such. If it is a float, it is + rounded. + +**Arguments** + +| Name | Type | Description | +|---------|----------|--------------------| +| value | `number` | Value in bytes | +| options | `Object` | Conversion options | + +**Options** + +| Property | Type | Description | +|-------------------|--------|-----------------------------------------------------------------------------------------| +| decimalPlaces | `number`|`null` | Maximum number of decimal places to include in output. Default value to `2`. | +| fixedDecimals | `boolean`|`null` | Whether to always display the maximum number of decimal places. Default value to `false` | +| thousandsSeparator | `string`|`null` | Example of values: `' '`, `','` and `'.'`... Default value to `''`. | +| unit | `string`|`null` | The unit in which the result will be returned (B/KB/MB/GB/TB). Default value to `''` (which means auto detect). | +| unitSeparator | `string`|`null` | Separator to use between number and unit. Default value to `''`. | + +**Returns** + +| Name | Type | Description | +|---------|------------------|-------------------------------------------------| +| results | `string`|`null` | Return null upon error. String value otherwise. | + +**Example** + +```js +bytes.format(1024); +// output: '1KB' + +bytes.format(1000); +// output: '1000B' + +bytes.format(1000, {thousandsSeparator: ' '}); +// output: '1 000B' + +bytes.format(1024 * 1.7, {decimalPlaces: 0}); +// output: '2KB' + +bytes.format(1024, {unitSeparator: ' '}); +// output: '1 KB' +``` + +#### bytes.parse(string|number value): number|null + +Parse the string value into an integer in bytes. If no unit is given, or `value` +is a number, it is assumed the value is in bytes. + +Supported units and abbreviations are as follows and are case-insensitive: + + * `b` for bytes + * `kb` for kilobytes + * `mb` for megabytes + * `gb` for gigabytes + * `tb` for terabytes + * `pb` for petabytes + +The units are in powers of two, not ten. This means 1kb = 1024b according to this parser. + +**Arguments** + +| Name | Type | Description | +|---------------|--------|--------------------| +| value | `string`|`number` | String to parse, or number in bytes. | + +**Returns** + +| Name | Type | Description | +|---------|-------------|-------------------------| +| results | `number`|`null` | Return null upon error. Value in bytes otherwise. | + +**Example** + +```js +bytes.parse('1KB'); +// output: 1024 + +bytes.parse('1024'); +// output: 1024 + +bytes.parse(1024); +// output: 1024 +``` + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/visionmedia/bytes.js/master?label=ci +[ci-url]: https://github.com/visionmedia/bytes.js/actions?query=workflow%3Aci +[coveralls-image]: https://badgen.net/coveralls/c/github/visionmedia/bytes.js/master +[coveralls-url]: https://coveralls.io/r/visionmedia/bytes.js?branch=master +[downloads-image]: https://badgen.net/npm/dm/bytes +[downloads-url]: https://npmjs.org/package/bytes +[npm-image]: https://badgen.net/npm/v/bytes +[npm-url]: https://npmjs.org/package/bytes diff --git a/node_modules/bytes/index.js b/node_modules/bytes/index.js new file mode 100644 index 0000000..6f2d0f8 --- /dev/null +++ b/node_modules/bytes/index.js @@ -0,0 +1,170 @@ +/*! + * bytes + * Copyright(c) 2012-2014 TJ Holowaychuk + * Copyright(c) 2015 Jed Watson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +module.exports = bytes; +module.exports.format = format; +module.exports.parse = parse; + +/** + * Module variables. + * @private + */ + +var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g; + +var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/; + +var map = { + b: 1, + kb: 1 << 10, + mb: 1 << 20, + gb: 1 << 30, + tb: Math.pow(1024, 4), + pb: Math.pow(1024, 5), +}; + +var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i; + +/** + * Convert the given value in bytes into a string or parse to string to an integer in bytes. + * + * @param {string|number} value + * @param {{ + * case: [string], + * decimalPlaces: [number] + * fixedDecimals: [boolean] + * thousandsSeparator: [string] + * unitSeparator: [string] + * }} [options] bytes options. + * + * @returns {string|number|null} + */ + +function bytes(value, options) { + if (typeof value === 'string') { + return parse(value); + } + + if (typeof value === 'number') { + return format(value, options); + } + + return null; +} + +/** + * Format the given value in bytes into a string. + * + * If the value is negative, it is kept as such. If it is a float, + * it is rounded. + * + * @param {number} value + * @param {object} [options] + * @param {number} [options.decimalPlaces=2] + * @param {number} [options.fixedDecimals=false] + * @param {string} [options.thousandsSeparator=] + * @param {string} [options.unit=] + * @param {string} [options.unitSeparator=] + * + * @returns {string|null} + * @public + */ + +function format(value, options) { + if (!Number.isFinite(value)) { + return null; + } + + var mag = Math.abs(value); + var thousandsSeparator = (options && options.thousandsSeparator) || ''; + var unitSeparator = (options && options.unitSeparator) || ''; + var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2; + var fixedDecimals = Boolean(options && options.fixedDecimals); + var unit = (options && options.unit) || ''; + + if (!unit || !map[unit.toLowerCase()]) { + if (mag >= map.pb) { + unit = 'PB'; + } else if (mag >= map.tb) { + unit = 'TB'; + } else if (mag >= map.gb) { + unit = 'GB'; + } else if (mag >= map.mb) { + unit = 'MB'; + } else if (mag >= map.kb) { + unit = 'KB'; + } else { + unit = 'B'; + } + } + + var val = value / map[unit.toLowerCase()]; + var str = val.toFixed(decimalPlaces); + + if (!fixedDecimals) { + str = str.replace(formatDecimalsRegExp, '$1'); + } + + if (thousandsSeparator) { + str = str.split('.').map(function (s, i) { + return i === 0 + ? s.replace(formatThousandsRegExp, thousandsSeparator) + : s + }).join('.'); + } + + return str + unitSeparator + unit; +} + +/** + * Parse the string value into an integer in bytes. + * + * If no unit is given, it is assumed the value is in bytes. + * + * @param {number|string} val + * + * @returns {number|null} + * @public + */ + +function parse(val) { + if (typeof val === 'number' && !isNaN(val)) { + return val; + } + + if (typeof val !== 'string') { + return null; + } + + // Test if the string passed is valid + var results = parseRegExp.exec(val); + var floatValue; + var unit = 'b'; + + if (!results) { + // Nothing could be extracted from the given string + floatValue = parseInt(val, 10); + unit = 'b' + } else { + // Retrieve the value and the unit + floatValue = parseFloat(results[1]); + unit = results[4].toLowerCase(); + } + + if (isNaN(floatValue)) { + return null; + } + + return Math.floor(map[unit] * floatValue); +} diff --git a/node_modules/bytes/package.json b/node_modules/bytes/package.json new file mode 100644 index 0000000..f2b6a8b --- /dev/null +++ b/node_modules/bytes/package.json @@ -0,0 +1,42 @@ +{ + "name": "bytes", + "description": "Utility to parse a string bytes to bytes and vice-versa", + "version": "3.1.2", + "author": "TJ Holowaychuk (http://tjholowaychuk.com)", + "contributors": [ + "Jed Watson ", + "Théo FIDRY " + ], + "license": "MIT", + "keywords": [ + "byte", + "bytes", + "utility", + "parse", + "parser", + "convert", + "converter" + ], + "repository": "visionmedia/bytes.js", + "devDependencies": { + "eslint": "7.32.0", + "eslint-plugin-markdown": "2.2.1", + "mocha": "9.2.0", + "nyc": "15.1.0" + }, + "files": [ + "History.md", + "LICENSE", + "Readme.md", + "index.js" + ], + "engines": { + "node": ">= 0.8" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --check-leaks --reporter spec", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + } +} diff --git a/node_modules/call-bind-apply-helpers/.eslintrc b/node_modules/call-bind-apply-helpers/.eslintrc new file mode 100644 index 0000000..201e859 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/.eslintrc @@ -0,0 +1,17 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-name-matching": 0, + "id-length": 0, + "new-cap": [2, { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + "no-extra-parens": 0, + "no-magic-numbers": 0, + }, +} diff --git a/node_modules/call-bind-apply-helpers/.github/FUNDING.yml b/node_modules/call-bind-apply-helpers/.github/FUNDING.yml new file mode 100644 index 0000000..0011e9d --- /dev/null +++ b/node_modules/call-bind-apply-helpers/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/call-bind-apply-helpers +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/call-bind-apply-helpers/.nycrc b/node_modules/call-bind-apply-helpers/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/node_modules/call-bind-apply-helpers/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/call-bind-apply-helpers/CHANGELOG.md b/node_modules/call-bind-apply-helpers/CHANGELOG.md new file mode 100644 index 0000000..2484942 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/CHANGELOG.md @@ -0,0 +1,30 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.2](https://github.com/ljharb/call-bind-apply-helpers/compare/v1.0.1...v1.0.2) - 2025-02-12 + +### Commits + +- [types] improve inferred types [`e6f9586`](https://github.com/ljharb/call-bind-apply-helpers/commit/e6f95860a3c72879cb861a858cdfb8138fbedec1) +- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape`, `es-value-fixtures`, `for-each`, `has-strict-mode`, `object-inspect` [`e43d540`](https://github.com/ljharb/call-bind-apply-helpers/commit/e43d5409f97543bfbb11f345d47d8ce4e066d8c1) + +## [v1.0.1](https://github.com/ljharb/call-bind-apply-helpers/compare/v1.0.0...v1.0.1) - 2024-12-08 + +### Commits + +- [types] `reflectApply`: fix types [`4efc396`](https://github.com/ljharb/call-bind-apply-helpers/commit/4efc3965351a4f02cc55e836fa391d3d11ef2ef8) +- [Fix] `reflectApply`: oops, Reflect is not a function [`83cc739`](https://github.com/ljharb/call-bind-apply-helpers/commit/83cc7395de6b79b7730bdf092f1436f0b1263c75) +- [Dev Deps] update `@arethetypeswrong/cli` [`80bd5d3`](https://github.com/ljharb/call-bind-apply-helpers/commit/80bd5d3ae58b4f6b6995ce439dd5a1bcb178a940) + +## v1.0.0 - 2024-12-05 + +### Commits + +- Initial implementation, tests, readme [`7879629`](https://github.com/ljharb/call-bind-apply-helpers/commit/78796290f9b7430c9934d6f33d94ae9bc89fce04) +- Initial commit [`3f1dc16`](https://github.com/ljharb/call-bind-apply-helpers/commit/3f1dc164afc43285631b114a5f9dd9137b2b952f) +- npm init [`081df04`](https://github.com/ljharb/call-bind-apply-helpers/commit/081df048c312fcee400922026f6e97281200a603) +- Only apps should have lockfiles [`5b9ca0f`](https://github.com/ljharb/call-bind-apply-helpers/commit/5b9ca0fe8101ebfaf309c549caac4e0a017ed930) diff --git a/node_modules/call-bind-apply-helpers/LICENSE b/node_modules/call-bind-apply-helpers/LICENSE new file mode 100644 index 0000000..f82f389 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/call-bind-apply-helpers/README.md b/node_modules/call-bind-apply-helpers/README.md new file mode 100644 index 0000000..8fc0dae --- /dev/null +++ b/node_modules/call-bind-apply-helpers/README.md @@ -0,0 +1,62 @@ +# call-bind-apply-helpers [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Helper functions around Function call/apply/bind, for use in `call-bind`. + +The only packages that should likely ever use this package directly are `call-bind` and `get-intrinsic`. +Please use `call-bind` unless you have a very good reason not to. + +## Getting started + +```sh +npm install --save call-bind-apply-helpers +``` + +## Usage/Examples + +```js +const assert = require('assert'); +const callBindBasic = require('call-bind-apply-helpers'); + +function f(a, b) { + assert.equal(this, 1); + assert.equal(a, 2); + assert.equal(b, 3); + assert.equal(arguments.length, 2); +} + +const fBound = callBindBasic([f, 1]); + +delete Function.prototype.call; +delete Function.prototype.bind; + +fBound(2, 3); +``` + +## Tests + +Clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/call-bind-apply-helpers +[npm-version-svg]: https://versionbadg.es/ljharb/call-bind-apply-helpers.svg +[deps-svg]: https://david-dm.org/ljharb/call-bind-apply-helpers.svg +[deps-url]: https://david-dm.org/ljharb/call-bind-apply-helpers +[dev-deps-svg]: https://david-dm.org/ljharb/call-bind-apply-helpers/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/call-bind-apply-helpers#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/call-bind-apply-helpers.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/call-bind-apply-helpers.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/call-bind-apply-helpers.svg +[downloads-url]: https://npm-stat.com/charts.html?package=call-bind-apply-helpers +[codecov-image]: https://codecov.io/gh/ljharb/call-bind-apply-helpers/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/call-bind-apply-helpers/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bind-apply-helpers +[actions-url]: https://github.com/ljharb/call-bind-apply-helpers/actions diff --git a/node_modules/call-bind-apply-helpers/actualApply.d.ts b/node_modules/call-bind-apply-helpers/actualApply.d.ts new file mode 100644 index 0000000..b87286a --- /dev/null +++ b/node_modules/call-bind-apply-helpers/actualApply.d.ts @@ -0,0 +1 @@ +export = Reflect.apply; \ No newline at end of file diff --git a/node_modules/call-bind-apply-helpers/actualApply.js b/node_modules/call-bind-apply-helpers/actualApply.js new file mode 100644 index 0000000..ffa5135 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/actualApply.js @@ -0,0 +1,10 @@ +'use strict'; + +var bind = require('function-bind'); + +var $apply = require('./functionApply'); +var $call = require('./functionCall'); +var $reflectApply = require('./reflectApply'); + +/** @type {import('./actualApply')} */ +module.exports = $reflectApply || bind.call($call, $apply); diff --git a/node_modules/call-bind-apply-helpers/applyBind.d.ts b/node_modules/call-bind-apply-helpers/applyBind.d.ts new file mode 100644 index 0000000..d176c1a --- /dev/null +++ b/node_modules/call-bind-apply-helpers/applyBind.d.ts @@ -0,0 +1,19 @@ +import actualApply from './actualApply'; + +type TupleSplitHead = T['length'] extends N + ? T + : T extends [...infer R, any] + ? TupleSplitHead + : never + +type TupleSplitTail = O['length'] extends N + ? T + : T extends [infer F, ...infer R] + ? TupleSplitTail<[...R], N, [...O, F]> + : never + +type TupleSplit = [TupleSplitHead, TupleSplitTail] + +declare function applyBind(...args: TupleSplit, 2>[1]): ReturnType; + +export = applyBind; \ No newline at end of file diff --git a/node_modules/call-bind-apply-helpers/applyBind.js b/node_modules/call-bind-apply-helpers/applyBind.js new file mode 100644 index 0000000..d2b7723 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/applyBind.js @@ -0,0 +1,10 @@ +'use strict'; + +var bind = require('function-bind'); +var $apply = require('./functionApply'); +var actualApply = require('./actualApply'); + +/** @type {import('./applyBind')} */ +module.exports = function applyBind() { + return actualApply(bind, $apply, arguments); +}; diff --git a/node_modules/call-bind-apply-helpers/functionApply.d.ts b/node_modules/call-bind-apply-helpers/functionApply.d.ts new file mode 100644 index 0000000..1f6e11b --- /dev/null +++ b/node_modules/call-bind-apply-helpers/functionApply.d.ts @@ -0,0 +1 @@ +export = Function.prototype.apply; \ No newline at end of file diff --git a/node_modules/call-bind-apply-helpers/functionApply.js b/node_modules/call-bind-apply-helpers/functionApply.js new file mode 100644 index 0000000..c71df9c --- /dev/null +++ b/node_modules/call-bind-apply-helpers/functionApply.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./functionApply')} */ +module.exports = Function.prototype.apply; diff --git a/node_modules/call-bind-apply-helpers/functionCall.d.ts b/node_modules/call-bind-apply-helpers/functionCall.d.ts new file mode 100644 index 0000000..15e93df --- /dev/null +++ b/node_modules/call-bind-apply-helpers/functionCall.d.ts @@ -0,0 +1 @@ +export = Function.prototype.call; \ No newline at end of file diff --git a/node_modules/call-bind-apply-helpers/functionCall.js b/node_modules/call-bind-apply-helpers/functionCall.js new file mode 100644 index 0000000..7a8d873 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/functionCall.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./functionCall')} */ +module.exports = Function.prototype.call; diff --git a/node_modules/call-bind-apply-helpers/index.d.ts b/node_modules/call-bind-apply-helpers/index.d.ts new file mode 100644 index 0000000..541516b --- /dev/null +++ b/node_modules/call-bind-apply-helpers/index.d.ts @@ -0,0 +1,64 @@ +type RemoveFromTuple< + Tuple extends readonly unknown[], + RemoveCount extends number, + Index extends 1[] = [] +> = Index["length"] extends RemoveCount + ? Tuple + : Tuple extends [infer First, ...infer Rest] + ? RemoveFromTuple + : Tuple; + +type ConcatTuples< + Prefix extends readonly unknown[], + Suffix extends readonly unknown[] +> = [...Prefix, ...Suffix]; + +type ExtractFunctionParams = T extends (this: infer TThis, ...args: infer P extends readonly unknown[]) => infer R + ? { thisArg: TThis; params: P; returnType: R } + : never; + +type BindFunction< + T extends (this: any, ...args: any[]) => any, + TThis, + TBoundArgs extends readonly unknown[], + ReceiverBound extends boolean +> = ExtractFunctionParams extends { + thisArg: infer OrigThis; + params: infer P extends readonly unknown[]; + returnType: infer R; +} + ? ReceiverBound extends true + ? (...args: RemoveFromTuple>) => R extends [OrigThis, ...infer Rest] + ? [TThis, ...Rest] // Replace `this` with `thisArg` + : R + : >>( + thisArg: U, + ...args: RemainingArgs + ) => R extends [OrigThis, ...infer Rest] + ? [U, ...ConcatTuples] // Preserve bound args in return type + : R + : never; + +declare function callBind< + const T extends (this: any, ...args: any[]) => any, + Extracted extends ExtractFunctionParams, + const TBoundArgs extends Partial & readonly unknown[], + const TThis extends Extracted["thisArg"] +>( + args: [fn: T, thisArg: TThis, ...boundArgs: TBoundArgs] +): BindFunction; + +declare function callBind< + const T extends (this: any, ...args: any[]) => any, + Extracted extends ExtractFunctionParams, + const TBoundArgs extends Partial & readonly unknown[] +>( + args: [fn: T, ...boundArgs: TBoundArgs] +): BindFunction; + +declare function callBind( + args: [fn: Exclude, ...rest: TArgs] +): never; + +// export as namespace callBind; +export = callBind; diff --git a/node_modules/call-bind-apply-helpers/index.js b/node_modules/call-bind-apply-helpers/index.js new file mode 100644 index 0000000..2f6dab4 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/index.js @@ -0,0 +1,15 @@ +'use strict'; + +var bind = require('function-bind'); +var $TypeError = require('es-errors/type'); + +var $call = require('./functionCall'); +var $actualApply = require('./actualApply'); + +/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */ +module.exports = function callBindBasic(args) { + if (args.length < 1 || typeof args[0] !== 'function') { + throw new $TypeError('a function is required'); + } + return $actualApply(bind, $call, args); +}; diff --git a/node_modules/call-bind-apply-helpers/package.json b/node_modules/call-bind-apply-helpers/package.json new file mode 100644 index 0000000..923b8be --- /dev/null +++ b/node_modules/call-bind-apply-helpers/package.json @@ -0,0 +1,85 @@ +{ + "name": "call-bind-apply-helpers", + "version": "1.0.2", + "description": "Helper functions around Function call/apply/bind, for use in `call-bind`", + "main": "index.js", + "exports": { + ".": "./index.js", + "./actualApply": "./actualApply.js", + "./applyBind": "./applyBind.js", + "./functionApply": "./functionApply.js", + "./functionCall": "./functionCall.js", + "./reflectApply": "./reflectApply.js", + "./package.json": "./package.json" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=auto", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "prelint": "evalmd README.md", + "lint": "eslint --ext=.js,.mjs .", + "postlint": "tsc -p . && attw -P", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>=10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/call-bind-apply-helpers.git" + }, + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/call-bind-apply-helpers/issues" + }, + "homepage": "https://github.com/ljharb/call-bind-apply-helpers#readme", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.3", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.2.3", + "@types/for-each": "^0.3.3", + "@types/function-bind": "^1.1.10", + "@types/object-inspect": "^1.13.0", + "@types/tape": "^5.8.1", + "auto-changelog": "^2.5.0", + "encoding": "^0.1.13", + "es-value-fixtures": "^1.7.1", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.5", + "has-strict-mode": "^1.1.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.4", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/call-bind-apply-helpers/reflectApply.d.ts b/node_modules/call-bind-apply-helpers/reflectApply.d.ts new file mode 100644 index 0000000..6b2ae76 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/reflectApply.d.ts @@ -0,0 +1,3 @@ +declare const reflectApply: false | typeof Reflect.apply; + +export = reflectApply; diff --git a/node_modules/call-bind-apply-helpers/reflectApply.js b/node_modules/call-bind-apply-helpers/reflectApply.js new file mode 100644 index 0000000..3d03caa --- /dev/null +++ b/node_modules/call-bind-apply-helpers/reflectApply.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./reflectApply')} */ +module.exports = typeof Reflect !== 'undefined' && Reflect && Reflect.apply; diff --git a/node_modules/call-bind-apply-helpers/test/index.js b/node_modules/call-bind-apply-helpers/test/index.js new file mode 100644 index 0000000..1cdc89e --- /dev/null +++ b/node_modules/call-bind-apply-helpers/test/index.js @@ -0,0 +1,63 @@ +'use strict'; + +var callBind = require('../'); +var hasStrictMode = require('has-strict-mode')(); +var forEach = require('for-each'); +var inspect = require('object-inspect'); +var v = require('es-value-fixtures'); + +var test = require('tape'); + +test('callBindBasic', function (t) { + forEach(v.nonFunctions, function (nonFunction) { + t['throws']( + // @ts-expect-error + function () { callBind([nonFunction]); }, + TypeError, + inspect(nonFunction) + ' is not a function' + ); + }); + + var sentinel = { sentinel: true }; + /** @type {(this: T, a: A, b: B) => [T | undefined, A, B]} */ + var func = function (a, b) { + // eslint-disable-next-line no-invalid-this + return [!hasStrictMode && this === global ? undefined : this, a, b]; + }; + t.equal(func.length, 2, 'original function length is 2'); + + /** type {(thisArg: unknown, a: number, b: number) => [unknown, number, number]} */ + var bound = callBind([func]); + /** type {((a: number, b: number) => [typeof sentinel, typeof a, typeof b])} */ + var boundR = callBind([func, sentinel]); + /** type {((b: number) => [typeof sentinel, number, typeof b])} */ + var boundArg = callBind([func, sentinel, /** @type {const} */ (1)]); + + // @ts-expect-error + t.deepEqual(bound(), [undefined, undefined, undefined], 'bound func with no args'); + + // @ts-expect-error + t.deepEqual(func(), [undefined, undefined, undefined], 'unbound func with too few args'); + // @ts-expect-error + t.deepEqual(bound(1, 2), [hasStrictMode ? 1 : Object(1), 2, undefined], 'bound func too few args'); + // @ts-expect-error + t.deepEqual(boundR(), [sentinel, undefined, undefined], 'bound func with receiver, with too few args'); + // @ts-expect-error + t.deepEqual(boundArg(), [sentinel, 1, undefined], 'bound func with receiver and arg, with too few args'); + + t.deepEqual(func(1, 2), [undefined, 1, 2], 'unbound func with right args'); + t.deepEqual(bound(1, 2, 3), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with right args'); + t.deepEqual(boundR(1, 2), [sentinel, 1, 2], 'bound func with receiver, with right args'); + t.deepEqual(boundArg(2), [sentinel, 1, 2], 'bound func with receiver and arg, with right arg'); + + // @ts-expect-error + t.deepEqual(func(1, 2, 3), [undefined, 1, 2], 'unbound func with too many args'); + // @ts-expect-error + t.deepEqual(bound(1, 2, 3, 4), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with too many args'); + // @ts-expect-error + t.deepEqual(boundR(1, 2, 3), [sentinel, 1, 2], 'bound func with receiver, with too many args'); + // @ts-expect-error + t.deepEqual(boundArg(2, 3), [sentinel, 1, 2], 'bound func with receiver and arg, with too many args'); + + t.end(); +}); diff --git a/node_modules/call-bind-apply-helpers/tsconfig.json b/node_modules/call-bind-apply-helpers/tsconfig.json new file mode 100644 index 0000000..aef9993 --- /dev/null +++ b/node_modules/call-bind-apply-helpers/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "es2021", + }, + "exclude": [ + "coverage", + ], +} \ No newline at end of file diff --git a/node_modules/call-bound/.eslintrc b/node_modules/call-bound/.eslintrc new file mode 100644 index 0000000..2612ed8 --- /dev/null +++ b/node_modules/call-bound/.eslintrc @@ -0,0 +1,13 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "new-cap": [2, { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + }, +} diff --git a/node_modules/call-bound/.github/FUNDING.yml b/node_modules/call-bound/.github/FUNDING.yml new file mode 100644 index 0000000..2a2a135 --- /dev/null +++ b/node_modules/call-bound/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/call-bound +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/call-bound/.nycrc b/node_modules/call-bound/.nycrc new file mode 100644 index 0000000..bdd626c --- /dev/null +++ b/node_modules/call-bound/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/call-bound/CHANGELOG.md b/node_modules/call-bound/CHANGELOG.md new file mode 100644 index 0000000..8bde4e9 --- /dev/null +++ b/node_modules/call-bound/CHANGELOG.md @@ -0,0 +1,42 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.4](https://github.com/ljharb/call-bound/compare/v1.0.3...v1.0.4) - 2025-03-03 + +### Commits + +- [types] improve types [`e648922`](https://github.com/ljharb/call-bound/commit/e6489222a9e54f350fbf952ceabe51fd8b6027ff) +- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape`, `es-value-fixtures`, `for-each`, `has-strict-mode`, `object-inspect` [`a42a5eb`](https://github.com/ljharb/call-bound/commit/a42a5ebe6c1b54fcdc7997c7dc64fdca9e936719) +- [Deps] update `call-bind-apply-helpers`, `get-intrinsic` [`f529eac`](https://github.com/ljharb/call-bound/commit/f529eac132404c17156bbc23ab2297a25d0f20b8) + +## [v1.0.3](https://github.com/ljharb/call-bound/compare/v1.0.2...v1.0.3) - 2024-12-15 + +### Commits + +- [Refactor] use `call-bind-apply-helpers` instead of `call-bind` [`5e0b134`](https://github.com/ljharb/call-bound/commit/5e0b13496df14fb7d05dae9412f088da8d3f75be) +- [Deps] update `get-intrinsic` [`41fc967`](https://github.com/ljharb/call-bound/commit/41fc96732a22c7b7e8f381f93ccc54bb6293be2e) +- [readme] fix example [`79a0137`](https://github.com/ljharb/call-bound/commit/79a0137723f7c6d09c9c05452bbf8d5efb5d6e49) +- [meta] add `sideEffects` flag [`08b07be`](https://github.com/ljharb/call-bound/commit/08b07be7f1c03f67dc6f3cdaf0906259771859f7) + +## [v1.0.2](https://github.com/ljharb/call-bound/compare/v1.0.1...v1.0.2) - 2024-12-10 + +### Commits + +- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `gopd` [`e6a5ffe`](https://github.com/ljharb/call-bound/commit/e6a5ffe849368fe4f74dfd6cdeca1b9baa39e8d5) +- [Deps] update `call-bind`, `get-intrinsic` [`2aeb5b5`](https://github.com/ljharb/call-bound/commit/2aeb5b521dc2b2683d1345c753ea1161de2d1c14) +- [types] improve return type [`1a0c9fe`](https://github.com/ljharb/call-bound/commit/1a0c9fe3114471e7ca1f57d104e2efe713bb4871) + +## v1.0.1 - 2024-12-05 + +### Commits + +- Initial implementation, tests, readme, types [`6d94121`](https://github.com/ljharb/call-bound/commit/6d94121a9243602e506334069f7a03189fe3363d) +- Initial commit [`0eae867`](https://github.com/ljharb/call-bound/commit/0eae867334ea025c33e6e91cdecfc9df96680cf9) +- npm init [`71b2479`](https://github.com/ljharb/call-bound/commit/71b2479c6723e0b7d91a6b663613067e98b7b275) +- Only apps should have lockfiles [`c3754a9`](https://github.com/ljharb/call-bound/commit/c3754a949b7f9132b47e2d18c1729889736741eb) +- [actions] skip `npm ls` in node < 10 [`74275a5`](https://github.com/ljharb/call-bound/commit/74275a5186b8caf6309b6b97472bdcb0df4683a8) +- [Dev Deps] add missing peer dep [`1354de8`](https://github.com/ljharb/call-bound/commit/1354de8679413e4ae9c523d85f76fa7a5e032d97) diff --git a/node_modules/call-bound/LICENSE b/node_modules/call-bound/LICENSE new file mode 100644 index 0000000..f82f389 --- /dev/null +++ b/node_modules/call-bound/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/call-bound/README.md b/node_modules/call-bound/README.md new file mode 100644 index 0000000..a44e43e --- /dev/null +++ b/node_modules/call-bound/README.md @@ -0,0 +1,53 @@ +# call-bound [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Robust call-bound JavaScript intrinsics, using `call-bind` and `get-intrinsic`. + +## Getting started + +```sh +npm install --save call-bound +``` + +## Usage/Examples + +```js +const assert = require('assert'); +const callBound = require('call-bound'); + +const slice = callBound('Array.prototype.slice'); + +delete Function.prototype.call; +delete Function.prototype.bind; +delete Array.prototype.slice; + +assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]); +``` + +## Tests + +Clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/call-bound +[npm-version-svg]: https://versionbadg.es/ljharb/call-bound.svg +[deps-svg]: https://david-dm.org/ljharb/call-bound.svg +[deps-url]: https://david-dm.org/ljharb/call-bound +[dev-deps-svg]: https://david-dm.org/ljharb/call-bound/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/call-bound#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/call-bound.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/call-bound.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/call-bound.svg +[downloads-url]: https://npm-stat.com/charts.html?package=call-bound +[codecov-image]: https://codecov.io/gh/ljharb/call-bound/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/call-bound/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bound +[actions-url]: https://github.com/ljharb/call-bound/actions diff --git a/node_modules/call-bound/index.d.ts b/node_modules/call-bound/index.d.ts new file mode 100644 index 0000000..5562f00 --- /dev/null +++ b/node_modules/call-bound/index.d.ts @@ -0,0 +1,94 @@ +type Intrinsic = typeof globalThis; + +type IntrinsicName = keyof Intrinsic | `%${keyof Intrinsic}%`; + +type IntrinsicPath = IntrinsicName | `${StripPercents}.${string}` | `%${StripPercents}.${string}%`; + +type AllowMissing = boolean; + +type StripPercents = T extends `%${infer U}%` ? U : T; + +type BindMethodPrecise = + F extends (this: infer This, ...args: infer Args) => infer R + ? (obj: This, ...args: Args) => R + : F extends { + (this: infer This1, ...args: infer Args1): infer R1; + (this: infer This2, ...args: infer Args2): infer R2 + } + ? { + (obj: This1, ...args: Args1): R1; + (obj: This2, ...args: Args2): R2 + } + : never + +// Extract method type from a prototype +type GetPrototypeMethod = + (typeof globalThis)[T] extends { prototype: any } + ? M extends keyof (typeof globalThis)[T]['prototype'] + ? (typeof globalThis)[T]['prototype'][M] + : never + : never + +// Get static property/method +type GetStaticMember = + P extends keyof (typeof globalThis)[T] ? (typeof globalThis)[T][P] : never + +// Type that maps string path to actual bound function or value with better precision +type BoundIntrinsic = + S extends `${infer Obj}.prototype.${infer Method}` + ? Obj extends keyof typeof globalThis + ? BindMethodPrecise> + : unknown + : S extends `${infer Obj}.${infer Prop}` + ? Obj extends keyof typeof globalThis + ? GetStaticMember + : unknown + : unknown + +declare function arraySlice(array: readonly T[], start?: number, end?: number): T[]; +declare function arraySlice(array: ArrayLike, start?: number, end?: number): T[]; +declare function arraySlice(array: IArguments, start?: number, end?: number): T[]; + +// Special cases for methods that need explicit typing +interface SpecialCases { + '%Object.prototype.isPrototypeOf%': (thisArg: {}, obj: unknown) => boolean; + '%String.prototype.replace%': { + (str: string, searchValue: string | RegExp, replaceValue: string): string; + (str: string, searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string + }; + '%Object.prototype.toString%': (obj: {}) => string; + '%Object.prototype.hasOwnProperty%': (obj: {}, v: PropertyKey) => boolean; + '%Array.prototype.slice%': typeof arraySlice; + '%Array.prototype.map%': (array: readonly T[], callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any) => U[]; + '%Array.prototype.filter%': (array: readonly T[], predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any) => T[]; + '%Array.prototype.indexOf%': (array: readonly T[], searchElement: T, fromIndex?: number) => number; + '%Function.prototype.apply%': (fn: (...args: A) => R, thisArg: any, args: A) => R; + '%Function.prototype.call%': (fn: (...args: A) => R, thisArg: any, ...args: A) => R; + '%Function.prototype.bind%': (fn: (...args: A) => R, thisArg: any, ...args: A) => (...remainingArgs: A) => R; + '%Promise.prototype.then%': { + (promise: Promise, onfulfilled: (value: T) => R | PromiseLike): Promise; + (promise: Promise, onfulfilled: ((value: T) => R | PromiseLike) | undefined | null, onrejected: (reason: any) => R | PromiseLike): Promise; + }; + '%RegExp.prototype.test%': (regexp: RegExp, str: string) => boolean; + '%RegExp.prototype.exec%': (regexp: RegExp, str: string) => RegExpExecArray | null; + '%Error.prototype.toString%': (error: Error) => string; + '%TypeError.prototype.toString%': (error: TypeError) => string; + '%String.prototype.split%': ( + obj: unknown, + splitter: string | RegExp | { + [Symbol.split](string: string, limit?: number): string[]; + }, + limit?: number | undefined + ) => string[]; +} + +/** + * Returns a bound function for a prototype method, or a value for a static property. + * + * @param name - The name of the intrinsic (e.g. 'Array.prototype.slice') + * @param {AllowMissing} [allowMissing] - Whether to allow missing intrinsics (default: false) + */ +declare function callBound, S extends IntrinsicPath>(name: K, allowMissing?: AllowMissing): SpecialCases[`%${StripPercents}%`]; +declare function callBound, S extends IntrinsicPath>(name: S, allowMissing?: AllowMissing): BoundIntrinsic; + +export = callBound; diff --git a/node_modules/call-bound/index.js b/node_modules/call-bound/index.js new file mode 100644 index 0000000..e9ade74 --- /dev/null +++ b/node_modules/call-bound/index.js @@ -0,0 +1,19 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var callBindBasic = require('call-bind-apply-helpers'); + +/** @type {(thisArg: string, searchString: string, position?: number) => number} */ +var $indexOf = callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]); + +/** @type {import('.')} */ +module.exports = function callBoundIntrinsic(name, allowMissing) { + /* eslint no-extra-parens: 0 */ + + var intrinsic = /** @type {(this: unknown, ...args: unknown[]) => unknown} */ (GetIntrinsic(name, !!allowMissing)); + if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { + return callBindBasic(/** @type {const} */ ([intrinsic])); + } + return intrinsic; +}; diff --git a/node_modules/call-bound/package.json b/node_modules/call-bound/package.json new file mode 100644 index 0000000..d542db4 --- /dev/null +++ b/node_modules/call-bound/package.json @@ -0,0 +1,99 @@ +{ + "name": "call-bound", + "version": "1.0.4", + "description": "Robust call-bound JavaScript intrinsics, using `call-bind` and `get-intrinsic`.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=auto", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "prelint": "evalmd README.md", + "lint": "eslint --ext=.js,.mjs .", + "postlint": "tsc -p . && attw -P", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "npx npm@'>=10.2' audit --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/call-bound.git" + }, + "keywords": [ + "javascript", + "ecmascript", + "es", + "js", + "callbind", + "callbound", + "call", + "bind", + "bound", + "call-bind", + "call-bound", + "function", + "es-abstract" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/call-bound/issues" + }, + "homepage": "https://github.com/ljharb/call-bound#readme", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.17.4", + "@ljharb/eslint-config": "^21.1.1", + "@ljharb/tsconfig": "^0.3.0", + "@types/call-bind": "^1.0.5", + "@types/get-intrinsic": "^1.2.3", + "@types/tape": "^5.8.1", + "auto-changelog": "^2.5.0", + "encoding": "^0.1.13", + "es-value-fixtures": "^1.7.1", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.5", + "gopd": "^1.2.0", + "has-strict-mode": "^1.1.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.4", + "safe-publish-latest": "^2.0.0", + "tape": "^5.9.0", + "typescript": "next" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/call-bound/test/index.js b/node_modules/call-bound/test/index.js new file mode 100644 index 0000000..a2fc9f0 --- /dev/null +++ b/node_modules/call-bound/test/index.js @@ -0,0 +1,61 @@ +'use strict'; + +var test = require('tape'); + +var callBound = require('../'); + +/** @template {true} T @template U @typedef {T extends U ? T : never} AssertType */ + +test('callBound', function (t) { + // static primitive + t.equal(callBound('Array.length'), Array.length, 'Array.length yields itself'); + t.equal(callBound('%Array.length%'), Array.length, '%Array.length% yields itself'); + + // static non-function object + t.equal(callBound('Array.prototype'), Array.prototype, 'Array.prototype yields itself'); + t.equal(callBound('%Array.prototype%'), Array.prototype, '%Array.prototype% yields itself'); + t.equal(callBound('Array.constructor'), Array.constructor, 'Array.constructor yields itself'); + t.equal(callBound('%Array.constructor%'), Array.constructor, '%Array.constructor% yields itself'); + + // static function + t.equal(callBound('Date.parse'), Date.parse, 'Date.parse yields itself'); + t.equal(callBound('%Date.parse%'), Date.parse, '%Date.parse% yields itself'); + + // prototype primitive + t.equal(callBound('Error.prototype.message'), Error.prototype.message, 'Error.prototype.message yields itself'); + t.equal(callBound('%Error.prototype.message%'), Error.prototype.message, '%Error.prototype.message% yields itself'); + + var x = callBound('Object.prototype.toString'); + var y = callBound('%Object.prototype.toString%'); + + // prototype function + t.notEqual(x, Object.prototype.toString, 'Object.prototype.toString does not yield itself'); + t.notEqual(y, Object.prototype.toString, '%Object.prototype.toString% does not yield itself'); + t.equal(x(true), Object.prototype.toString.call(true), 'call-bound Object.prototype.toString calls into the original'); + t.equal(y(true), Object.prototype.toString.call(true), 'call-bound %Object.prototype.toString% calls into the original'); + + t['throws']( + // @ts-expect-error + function () { callBound('does not exist'); }, + SyntaxError, + 'nonexistent intrinsic throws' + ); + t['throws']( + // @ts-expect-error + function () { callBound('does not exist', true); }, + SyntaxError, + 'allowMissing arg still throws for unknown intrinsic' + ); + + t.test('real but absent intrinsic', { skip: typeof WeakRef !== 'undefined' }, function (st) { + st['throws']( + function () { callBound('WeakRef'); }, + TypeError, + 'real but absent intrinsic throws' + ); + st.equal(callBound('WeakRef', true), undefined, 'allowMissing arg avoids exception'); + st.end(); + }); + + t.end(); +}); diff --git a/node_modules/call-bound/tsconfig.json b/node_modules/call-bound/tsconfig.json new file mode 100644 index 0000000..8976d98 --- /dev/null +++ b/node_modules/call-bound/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "ESNext", + "lib": ["es2024"], + }, + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/cliui/CHANGELOG.md b/node_modules/cliui/CHANGELOG.md new file mode 100644 index 0000000..df0eb18 --- /dev/null +++ b/node_modules/cliui/CHANGELOG.md @@ -0,0 +1,157 @@ +# Change Log + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [9.0.1](https://github.com/yargs/cliui/compare/v9.0.0...v9.0.1) (2025-03-17) + + +### Bug Fixes + +* make require("cliui") work as expected for CJS ([04ccc25](https://github.com/yargs/cliui/commit/04ccc250e30a059292c03fa1ef0a8661f8d93dfe)) + +## [9.0.0](https://github.com/yargs/cliui/compare/v8.0.1...v9.0.0) (2025-03-16) + + +### ⚠ BREAKING CHANGES + +* cliui is now ESM only ([#165](https://github.com/yargs/cliui/issues/165)) + +### Features + +* cliui is now ESM only ([#165](https://github.com/yargs/cliui/issues/165)) ([5a521de](https://github.com/yargs/cliui/commit/5a521de7ea88f262236394c8d96775bcf50ff0a4)) + +## [8.0.1](https://github.com/yargs/cliui/compare/v8.0.0...v8.0.1) (2022-10-01) + + +### Bug Fixes + +* **deps:** move rollup-plugin-ts to dev deps ([#124](https://github.com/yargs/cliui/issues/124)) ([7c8bd6b](https://github.com/yargs/cliui/commit/7c8bd6ba024d61e4eeae310c7959ab8ab6829081)) + +## [8.0.0](https://github.com/yargs/cliui/compare/v7.0.4...v8.0.0) (2022-09-30) + + +### ⚠ BREAKING CHANGES + +* **deps:** drop Node 10 to release CVE-2021-3807 patch (#122) + +### Bug Fixes + +* **deps:** drop Node 10 to release CVE-2021-3807 patch ([#122](https://github.com/yargs/cliui/issues/122)) ([f156571](https://github.com/yargs/cliui/commit/f156571ce4f2ebf313335e3a53ad905589da5a30)) + +### [7.0.4](https://www.github.com/yargs/cliui/compare/v7.0.3...v7.0.4) (2020-11-08) + + +### Bug Fixes + +* **deno:** import UIOptions from definitions ([#97](https://www.github.com/yargs/cliui/issues/97)) ([f04f343](https://www.github.com/yargs/cliui/commit/f04f3439bc78114c7e90f82ff56f5acf16268ea8)) + +### [7.0.3](https://www.github.com/yargs/cliui/compare/v7.0.2...v7.0.3) (2020-10-16) + + +### Bug Fixes + +* **exports:** node 13.0 and 13.1 require the dotted object form _with_ a string fallback ([#93](https://www.github.com/yargs/cliui/issues/93)) ([eca16fc](https://www.github.com/yargs/cliui/commit/eca16fc05d26255df3280906c36d7f0e5b05c6e9)) + +### [7.0.2](https://www.github.com/yargs/cliui/compare/v7.0.1...v7.0.2) (2020-10-14) + + +### Bug Fixes + +* **exports:** node 13.0-13.6 require a string fallback ([#91](https://www.github.com/yargs/cliui/issues/91)) ([b529d7e](https://www.github.com/yargs/cliui/commit/b529d7e432901af1af7848b23ed6cf634497d961)) + +### [7.0.1](https://www.github.com/yargs/cliui/compare/v7.0.0...v7.0.1) (2020-08-16) + + +### Bug Fixes + +* **build:** main should be build/index.cjs ([dc29a3c](https://www.github.com/yargs/cliui/commit/dc29a3cc617a410aa850e06337b5954b04f2cb4d)) + +## [7.0.0](https://www.github.com/yargs/cliui/compare/v6.0.0...v7.0.0) (2020-08-16) + + +### ⚠ BREAKING CHANGES + +* tsc/ESM/Deno support (#82) +* modernize deps and build (#80) + +### Build System + +* modernize deps and build ([#80](https://www.github.com/yargs/cliui/issues/80)) ([339d08d](https://www.github.com/yargs/cliui/commit/339d08dc71b15a3928aeab09042af94db2f43743)) + + +### Code Refactoring + +* tsc/ESM/Deno support ([#82](https://www.github.com/yargs/cliui/issues/82)) ([4b777a5](https://www.github.com/yargs/cliui/commit/4b777a5fe01c5d8958c6708695d6aab7dbe5706c)) + +## [6.0.0](https://www.github.com/yargs/cliui/compare/v5.0.0...v6.0.0) (2019-11-10) + + +### ⚠ BREAKING CHANGES + +* update deps, drop Node 6 + +### Code Refactoring + +* update deps, drop Node 6 ([62056df](https://www.github.com/yargs/cliui/commit/62056df)) + +## [5.0.0](https://github.com/yargs/cliui/compare/v4.1.0...v5.0.0) (2019-04-10) + + +### Bug Fixes + +* Update wrap-ansi to fix compatibility with latest versions of chalk. ([#60](https://github.com/yargs/cliui/issues/60)) ([7bf79ae](https://github.com/yargs/cliui/commit/7bf79ae)) + + +### BREAKING CHANGES + +* Drop support for node < 6. + + + + +## [4.1.0](https://github.com/yargs/cliui/compare/v4.0.0...v4.1.0) (2018-04-23) + + +### Features + +* add resetOutput method ([#57](https://github.com/yargs/cliui/issues/57)) ([7246902](https://github.com/yargs/cliui/commit/7246902)) + + + + +## [4.0.0](https://github.com/yargs/cliui/compare/v3.2.0...v4.0.0) (2017-12-18) + + +### Bug Fixes + +* downgrades strip-ansi to version 3.0.1 ([#54](https://github.com/yargs/cliui/issues/54)) ([5764c46](https://github.com/yargs/cliui/commit/5764c46)) +* set env variable FORCE_COLOR. ([#56](https://github.com/yargs/cliui/issues/56)) ([7350e36](https://github.com/yargs/cliui/commit/7350e36)) + + +### Chores + +* drop support for node < 4 ([#53](https://github.com/yargs/cliui/issues/53)) ([b105376](https://github.com/yargs/cliui/commit/b105376)) + + +### Features + +* add fallback for window width ([#45](https://github.com/yargs/cliui/issues/45)) ([d064922](https://github.com/yargs/cliui/commit/d064922)) + + +### BREAKING CHANGES + +* officially drop support for Node < 4 + + + + +## [3.2.0](https://github.com/yargs/cliui/compare/v3.1.2...v3.2.0) (2016-04-11) + + +### Bug Fixes + +* reduces tarball size ([acc6c33](https://github.com/yargs/cliui/commit/acc6c33)) + +### Features + +* adds standard-version for release management ([ff84e32](https://github.com/yargs/cliui/commit/ff84e32)) diff --git a/node_modules/cliui/LICENSE.txt b/node_modules/cliui/LICENSE.txt new file mode 100644 index 0000000..c7e2747 --- /dev/null +++ b/node_modules/cliui/LICENSE.txt @@ -0,0 +1,14 @@ +Copyright (c) 2015, Contributors + +Permission to use, copy, modify, and/or distribute this software +for any purpose with or without fee is hereby granted, provided +that the above copyright notice and this permission notice +appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE +LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES +OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/cliui/README.md b/node_modules/cliui/README.md new file mode 100644 index 0000000..3e02952 --- /dev/null +++ b/node_modules/cliui/README.md @@ -0,0 +1,161 @@ +# cliui + +![ci](https://github.com/yargs/cliui/workflows/ci/badge.svg) +[![NPM version](https://img.shields.io/npm/v/cliui.svg)](https://www.npmjs.com/package/cliui) +[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) +![nycrc config on GitHub](https://img.shields.io/nycrc/yargs/cliui) + +easily create complex multi-column command-line-interfaces. + +## Example + +```bash +npm i cliui@latest chalk@latest +``` + +```js +const ui = require('cliui')() +const {Chalk} = require('chalk'); +const chalk = new Chalk(); + +ui.div('Usage: $0 [command] [options]') + +ui.div({ + text: 'Options:', + padding: [2, 0, 1, 0] +}) + +ui.div( + { + text: "-f, --file", + width: 20, + padding: [0, 4, 0, 4] + }, + { + text: "the file to load." + + chalk.green("(if this description is long it wraps).") + , + width: 20 + }, + { + text: chalk.red("[required]"), + align: 'right' + } +) + +console.log(ui.toString()) +``` + +## Deno/ESM Support + +As of `v7` `cliui` supports [Deno](https://github.com/denoland/deno) and +[ESM](https://nodejs.org/api/esm.html#esm_ecmascript_modules): + +```typescript +import cliui from "cliui"; +import chalk from "chalk"; +// Deno: import cliui from "https://deno.land/x/cliui/deno.ts"; + +const ui = cliui({}) + +ui.div('Usage: $0 [command] [options]') + +ui.div({ + text: 'Options:', + padding: [2, 0, 1, 0] +}) + +ui.div( + { + text: "-f, --file", + width: 20, + padding: [0, 4, 0, 4] + }, + { + text: "the file to load." + + chalk.green("(if this description is long it wraps).") + , + width: 20 + }, + { + text: chalk.red("[required]"), + align: 'right' + } +) + +console.log(ui.toString()) +``` + + + +## Layout DSL + +cliui exposes a simple layout DSL: + +If you create a single `ui.div`, passing a string rather than an +object: + +* `\n`: characters will be interpreted as new rows. +* `\t`: characters will be interpreted as new columns. +* `\s`: characters will be interpreted as padding. + +**as an example...** + +```js +var ui = require('./')({ + width: 60 +}) + +ui.div( + 'Usage: node ./bin/foo.js\n' + + ' \t provide a regex\n' + + ' \t provide a glob\t [required]' +) + +console.log(ui.toString()) +``` + +**will output:** + +```shell +Usage: node ./bin/foo.js + provide a regex + provide a glob [required] +``` + +## Methods + +```js +cliui = require('cliui') +``` + +### cliui({width: integer}) + +Specify the maximum width of the UI being generated. +If no width is provided, cliui will try to get the current window's width and use it, and if that doesn't work, width will be set to `80`. + +### cliui({wrap: boolean}) + +Enable or disable the wrapping of text in a column. + +### cliui.div(column, column, column) + +Create a row with any number of columns, a column +can either be a string, or an object with the following +options: + +* **text:** some text to place in the column. +* **width:** the width of a column. +* **align:** alignment, `right` or `center`. +* **padding:** `[top, right, bottom, left]`. +* **border:** should a border be placed around the div? + +### cliui.span(column, column, column) + +Similar to `div`, except the next row will be appended without +a new line being created. + +### cliui.resetOutput() + +Resets the UI elements of the current cliui instance, maintaining the values +set for `width` and `wrap`. diff --git a/node_modules/cliui/index.mjs b/node_modules/cliui/index.mjs new file mode 100644 index 0000000..743ca50 --- /dev/null +++ b/node_modules/cliui/index.mjs @@ -0,0 +1,15 @@ +// Bootstrap cliui with CommonJS dependencies: +import { cliui } from './build/lib/index.js' +import stringWidth from 'string-width' +import stripAnsi from 'strip-ansi' +import wrapAnsi from 'wrap-ansi' + +export default function ui (opts) { + return cliui(opts, { + stringWidth, + stripAnsi, + wrap: wrapAnsi + }) +} + +export {ui as 'module.exports'}; diff --git a/node_modules/cliui/package.json b/node_modules/cliui/package.json new file mode 100644 index 0000000..91f628a --- /dev/null +++ b/node_modules/cliui/package.json @@ -0,0 +1,72 @@ +{ + "name": "cliui", + "version": "9.0.1", + "description": "easily create complex multi-column command-line-interfaces", + "main": "build/index.mjs", + "exports": { + ".": "./index.mjs" + }, + "type": "module", + "module": "./index.mjs", + "scripts": { + "check": "standardx '**/*.ts' && standardx '**/*.js'", + "fix": "standardx --fix '**/*.ts' && standardx --fix '**/*.js'", + "pretest": "rimraf build && tsc -p tsconfig.test.json", + "test": "c8 mocha ./test/*.mjs", + "postest": "check", + "coverage": "c8 report --check-coverage", + "precompile": "rimraf build", + "compile": "tsc", + "prepare": "npm run compile" + }, + "repository": "yargs/cliui", + "standard": { + "ignore": [ + "**/example/**" + ], + "globals": [ + "it" + ] + }, + "keywords": [ + "cli", + "command-line", + "layout", + "design", + "console", + "wrap", + "table" + ], + "author": "Ben Coe ", + "license": "ISC", + "dependencies": { + "string-width": "^7.2.0", + "strip-ansi": "^7.1.0", + "wrap-ansi": "^9.0.0" + }, + "devDependencies": { + "@types/node": "^22.13.10", + "@typescript-eslint/eslint-plugin": "^4.0.0", + "@typescript-eslint/parser": "^4.0.0", + "c8": "^10.1.3", + "chai": "^5.2.0", + "chalk": "^5.4.1", + "cross-env": "^7.0.2", + "eslint": "^7.6.0", + "eslint-plugin-import": "^2.22.0", + "eslint-plugin-n": "^14.0.0", + "gts": "^6.0.2", + "mocha": "^11.1.0", + "rimraf": "^6.0.1", + "standardx": "^7.0.0", + "typescript": "^5.8.2" + }, + "files": [ + "build", + "index.mjs", + "!*.d.ts" + ], + "engines": { + "node": ">=20" + } +} diff --git a/node_modules/content-disposition/HISTORY.md b/node_modules/content-disposition/HISTORY.md new file mode 100644 index 0000000..ff0b68b --- /dev/null +++ b/node_modules/content-disposition/HISTORY.md @@ -0,0 +1,66 @@ +1.0.0 / 2024-08-31 +================== + + * drop node <18 + * allow utf8 as alias for utf-8 + +0.5.4 / 2021-12-10 +================== + + * deps: safe-buffer@5.2.1 + +0.5.3 / 2018-12-17 +================== + + * Use `safe-buffer` for improved Buffer API + +0.5.2 / 2016-12-08 +================== + + * Fix `parse` to accept any linear whitespace character + +0.5.1 / 2016-01-17 +================== + + * perf: enable strict mode + +0.5.0 / 2014-10-11 +================== + + * Add `parse` function + +0.4.0 / 2014-09-21 +================== + + * Expand non-Unicode `filename` to the full ISO-8859-1 charset + +0.3.0 / 2014-09-20 +================== + + * Add `fallback` option + * Add `type` option + +0.2.0 / 2014-09-19 +================== + + * Reduce ambiguity of file names with hex escape in buggy browsers + +0.1.2 / 2014-09-19 +================== + + * Fix periodic invalid Unicode filename header + +0.1.1 / 2014-09-19 +================== + + * Fix invalid characters appearing in `filename*` parameter + +0.1.0 / 2014-09-18 +================== + + * Make the `filename` argument optional + +0.0.0 / 2014-09-18 +================== + + * Initial release diff --git a/node_modules/content-disposition/LICENSE b/node_modules/content-disposition/LICENSE new file mode 100644 index 0000000..84441fb --- /dev/null +++ b/node_modules/content-disposition/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014-2017 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/content-disposition/README.md b/node_modules/content-disposition/README.md new file mode 100644 index 0000000..3a0bb05 --- /dev/null +++ b/node_modules/content-disposition/README.md @@ -0,0 +1,142 @@ +# content-disposition + +[![NPM Version][npm-image]][npm-url] +[![NPM Downloads][downloads-image]][downloads-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][github-actions-ci-image]][github-actions-ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +Create and parse HTTP `Content-Disposition` header + +## Installation + +```sh +$ npm install content-disposition +``` + +## API + +```js +var contentDisposition = require('content-disposition') +``` + +### contentDisposition(filename, options) + +Create an attachment `Content-Disposition` header value using the given file name, +if supplied. The `filename` is optional and if no file name is desired, but you +want to specify `options`, set `filename` to `undefined`. + +```js +res.setHeader('Content-Disposition', contentDisposition('∫ maths.pdf')) +``` + +**note** HTTP headers are of the ISO-8859-1 character set. If you are writing this +header through a means different from `setHeader` in Node.js, you'll want to specify +the `'binary'` encoding in Node.js. + +#### Options + +`contentDisposition` accepts these properties in the options object. + +##### fallback + +If the `filename` option is outside ISO-8859-1, then the file name is actually +stored in a supplemental field for clients that support Unicode file names and +a ISO-8859-1 version of the file name is automatically generated. + +This specifies the ISO-8859-1 file name to override the automatic generation or +disables the generation all together, defaults to `true`. + + - A string will specify the ISO-8859-1 file name to use in place of automatic + generation. + - `false` will disable including a ISO-8859-1 file name and only include the + Unicode version (unless the file name is already ISO-8859-1). + - `true` will enable automatic generation if the file name is outside ISO-8859-1. + +If the `filename` option is ISO-8859-1 and this option is specified and has a +different value, then the `filename` option is encoded in the extended field +and this set as the fallback field, even though they are both ISO-8859-1. + +##### type + +Specifies the disposition type, defaults to `"attachment"`. This can also be +`"inline"`, or any other value (all values except inline are treated like +`attachment`, but can convey additional information if both parties agree to +it). The type is normalized to lower-case. + +### contentDisposition.parse(string) + +```js +var disposition = contentDisposition.parse('attachment; filename="EURO rates.txt"; filename*=UTF-8\'\'%e2%82%ac%20rates.txt') +``` + +Parse a `Content-Disposition` header string. This automatically handles extended +("Unicode") parameters by decoding them and providing them under the standard +parameter name. This will return an object with the following properties (examples +are shown for the string `'attachment; filename="EURO rates.txt"; filename*=UTF-8\'\'%e2%82%ac%20rates.txt'`): + + - `type`: The disposition type (always lower case). Example: `'attachment'` + + - `parameters`: An object of the parameters in the disposition (name of parameter + always lower case and extended versions replace non-extended versions). Example: + `{filename: "€ rates.txt"}` + +## Examples + +### Send a file for download + +```js +var contentDisposition = require('content-disposition') +var destroy = require('destroy') +var fs = require('fs') +var http = require('http') +var onFinished = require('on-finished') + +var filePath = '/path/to/public/plans.pdf' + +http.createServer(function onRequest (req, res) { + // set headers + res.setHeader('Content-Type', 'application/pdf') + res.setHeader('Content-Disposition', contentDisposition(filePath)) + + // send file + var stream = fs.createReadStream(filePath) + stream.pipe(res) + onFinished(res, function () { + destroy(stream) + }) +}) +``` + +## Testing + +```sh +$ npm test +``` + +## References + +- [RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1][rfc-2616] +- [RFC 5987: Character Set and Language Encoding for Hypertext Transfer Protocol (HTTP) Header Field Parameters][rfc-5987] +- [RFC 6266: Use of the Content-Disposition Header Field in the Hypertext Transfer Protocol (HTTP)][rfc-6266] +- [Test Cases for HTTP Content-Disposition header field (RFC 6266) and the Encodings defined in RFCs 2047, 2231 and 5987][tc-2231] + +[rfc-2616]: https://tools.ietf.org/html/rfc2616 +[rfc-5987]: https://tools.ietf.org/html/rfc5987 +[rfc-6266]: https://tools.ietf.org/html/rfc6266 +[tc-2231]: http://greenbytes.de/tech/tc2231/ + +## License + +[MIT](LICENSE) + +[npm-image]: https://img.shields.io/npm/v/content-disposition.svg +[npm-url]: https://npmjs.org/package/content-disposition +[node-version-image]: https://img.shields.io/node/v/content-disposition.svg +[node-version-url]: https://nodejs.org/en/download +[coveralls-image]: https://img.shields.io/coveralls/jshttp/content-disposition.svg +[coveralls-url]: https://coveralls.io/r/jshttp/content-disposition?branch=master +[downloads-image]: https://img.shields.io/npm/dm/content-disposition.svg +[downloads-url]: https://npmjs.org/package/content-disposition +[github-actions-ci-image]: https://img.shields.io/github/workflow/status/jshttp/content-disposition/ci/master?label=ci +[github-actions-ci-url]: https://github.com/jshttp/content-disposition?query=workflow%3Aci diff --git a/node_modules/content-disposition/index.js b/node_modules/content-disposition/index.js new file mode 100644 index 0000000..44f1d51 --- /dev/null +++ b/node_modules/content-disposition/index.js @@ -0,0 +1,459 @@ +/*! + * content-disposition + * Copyright(c) 2014-2017 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module exports. + * @public + */ + +module.exports = contentDisposition +module.exports.parse = parse + +/** + * Module dependencies. + * @private + */ + +var basename = require('path').basename +var Buffer = require('safe-buffer').Buffer + +/** + * RegExp to match non attr-char, *after* encodeURIComponent (i.e. not including "%") + * @private + */ + +var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g // eslint-disable-line no-control-regex + +/** + * RegExp to match percent encoding escape. + * @private + */ + +var HEX_ESCAPE_REGEXP = /%[0-9A-Fa-f]{2}/ +var HEX_ESCAPE_REPLACE_REGEXP = /%([0-9A-Fa-f]{2})/g + +/** + * RegExp to match non-latin1 characters. + * @private + */ + +var NON_LATIN1_REGEXP = /[^\x20-\x7e\xa0-\xff]/g + +/** + * RegExp to match quoted-pair in RFC 2616 + * + * quoted-pair = "\" CHAR + * CHAR = + * @private + */ + +var QESC_REGEXP = /\\([\u0000-\u007f])/g // eslint-disable-line no-control-regex + +/** + * RegExp to match chars that must be quoted-pair in RFC 2616 + * @private + */ + +var QUOTE_REGEXP = /([\\"])/g + +/** + * RegExp for various RFC 2616 grammar + * + * parameter = token "=" ( token | quoted-string ) + * token = 1* + * separators = "(" | ")" | "<" | ">" | "@" + * | "," | ";" | ":" | "\" | <"> + * | "/" | "[" | "]" | "?" | "=" + * | "{" | "}" | SP | HT + * quoted-string = ( <"> *(qdtext | quoted-pair ) <"> ) + * qdtext = > + * quoted-pair = "\" CHAR + * CHAR = + * TEXT = + * LWS = [CRLF] 1*( SP | HT ) + * CRLF = CR LF + * CR = + * LF = + * SP = + * HT = + * CTL = + * OCTET = + * @private + */ + +var PARAM_REGEXP = /;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g // eslint-disable-line no-control-regex +var TEXT_REGEXP = /^[\x20-\x7e\x80-\xff]+$/ +var TOKEN_REGEXP = /^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/ + +/** + * RegExp for various RFC 5987 grammar + * + * ext-value = charset "'" [ language ] "'" value-chars + * charset = "UTF-8" / "ISO-8859-1" / mime-charset + * mime-charset = 1*mime-charsetc + * mime-charsetc = ALPHA / DIGIT + * / "!" / "#" / "$" / "%" / "&" + * / "+" / "-" / "^" / "_" / "`" + * / "{" / "}" / "~" + * language = ( 2*3ALPHA [ extlang ] ) + * / 4ALPHA + * / 5*8ALPHA + * extlang = *3( "-" 3ALPHA ) + * value-chars = *( pct-encoded / attr-char ) + * pct-encoded = "%" HEXDIG HEXDIG + * attr-char = ALPHA / DIGIT + * / "!" / "#" / "$" / "&" / "+" / "-" / "." + * / "^" / "_" / "`" / "|" / "~" + * @private + */ + +var EXT_VALUE_REGEXP = /^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/ + +/** + * RegExp for various RFC 6266 grammar + * + * disposition-type = "inline" | "attachment" | disp-ext-type + * disp-ext-type = token + * disposition-parm = filename-parm | disp-ext-parm + * filename-parm = "filename" "=" value + * | "filename*" "=" ext-value + * disp-ext-parm = token "=" value + * | ext-token "=" ext-value + * ext-token = + * @private + */ + +var DISPOSITION_TYPE_REGEXP = /^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/ // eslint-disable-line no-control-regex + +/** + * Create an attachment Content-Disposition header. + * + * @param {string} [filename] + * @param {object} [options] + * @param {string} [options.type=attachment] + * @param {string|boolean} [options.fallback=true] + * @return {string} + * @public + */ + +function contentDisposition (filename, options) { + var opts = options || {} + + // get type + var type = opts.type || 'attachment' + + // get parameters + var params = createparams(filename, opts.fallback) + + // format into string + return format(new ContentDisposition(type, params)) +} + +/** + * Create parameters object from filename and fallback. + * + * @param {string} [filename] + * @param {string|boolean} [fallback=true] + * @return {object} + * @private + */ + +function createparams (filename, fallback) { + if (filename === undefined) { + return + } + + var params = {} + + if (typeof filename !== 'string') { + throw new TypeError('filename must be a string') + } + + // fallback defaults to true + if (fallback === undefined) { + fallback = true + } + + if (typeof fallback !== 'string' && typeof fallback !== 'boolean') { + throw new TypeError('fallback must be a string or boolean') + } + + if (typeof fallback === 'string' && NON_LATIN1_REGEXP.test(fallback)) { + throw new TypeError('fallback must be ISO-8859-1 string') + } + + // restrict to file base name + var name = basename(filename) + + // determine if name is suitable for quoted string + var isQuotedString = TEXT_REGEXP.test(name) + + // generate fallback name + var fallbackName = typeof fallback !== 'string' + ? fallback && getlatin1(name) + : basename(fallback) + var hasFallback = typeof fallbackName === 'string' && fallbackName !== name + + // set extended filename parameter + if (hasFallback || !isQuotedString || HEX_ESCAPE_REGEXP.test(name)) { + params['filename*'] = name + } + + // set filename parameter + if (isQuotedString || hasFallback) { + params.filename = hasFallback + ? fallbackName + : name + } + + return params +} + +/** + * Format object to Content-Disposition header. + * + * @param {object} obj + * @param {string} obj.type + * @param {object} [obj.parameters] + * @return {string} + * @private + */ + +function format (obj) { + var parameters = obj.parameters + var type = obj.type + + if (!type || typeof type !== 'string' || !TOKEN_REGEXP.test(type)) { + throw new TypeError('invalid type') + } + + // start with normalized type + var string = String(type).toLowerCase() + + // append parameters + if (parameters && typeof parameters === 'object') { + var param + var params = Object.keys(parameters).sort() + + for (var i = 0; i < params.length; i++) { + param = params[i] + + var val = param.slice(-1) === '*' + ? ustring(parameters[param]) + : qstring(parameters[param]) + + string += '; ' + param + '=' + val + } + } + + return string +} + +/** + * Decode a RFC 5987 field value (gracefully). + * + * @param {string} str + * @return {string} + * @private + */ + +function decodefield (str) { + var match = EXT_VALUE_REGEXP.exec(str) + + if (!match) { + throw new TypeError('invalid extended field value') + } + + var charset = match[1].toLowerCase() + var encoded = match[2] + var value + + // to binary string + var binary = encoded.replace(HEX_ESCAPE_REPLACE_REGEXP, pdecode) + + switch (charset) { + case 'iso-8859-1': + value = getlatin1(binary) + break + case 'utf-8': + case 'utf8': + value = Buffer.from(binary, 'binary').toString('utf8') + break + default: + throw new TypeError('unsupported charset in extended field') + } + + return value +} + +/** + * Get ISO-8859-1 version of string. + * + * @param {string} val + * @return {string} + * @private + */ + +function getlatin1 (val) { + // simple Unicode -> ISO-8859-1 transformation + return String(val).replace(NON_LATIN1_REGEXP, '?') +} + +/** + * Parse Content-Disposition header string. + * + * @param {string} string + * @return {object} + * @public + */ + +function parse (string) { + if (!string || typeof string !== 'string') { + throw new TypeError('argument string is required') + } + + var match = DISPOSITION_TYPE_REGEXP.exec(string) + + if (!match) { + throw new TypeError('invalid type format') + } + + // normalize type + var index = match[0].length + var type = match[1].toLowerCase() + + var key + var names = [] + var params = {} + var value + + // calculate index to start at + index = PARAM_REGEXP.lastIndex = match[0].slice(-1) === ';' + ? index - 1 + : index + + // match parameters + while ((match = PARAM_REGEXP.exec(string))) { + if (match.index !== index) { + throw new TypeError('invalid parameter format') + } + + index += match[0].length + key = match[1].toLowerCase() + value = match[2] + + if (names.indexOf(key) !== -1) { + throw new TypeError('invalid duplicate parameter') + } + + names.push(key) + + if (key.indexOf('*') + 1 === key.length) { + // decode extended value + key = key.slice(0, -1) + value = decodefield(value) + + // overwrite existing value + params[key] = value + continue + } + + if (typeof params[key] === 'string') { + continue + } + + if (value[0] === '"') { + // remove quotes and escapes + value = value + .slice(1, -1) + .replace(QESC_REGEXP, '$1') + } + + params[key] = value + } + + if (index !== -1 && index !== string.length) { + throw new TypeError('invalid parameter format') + } + + return new ContentDisposition(type, params) +} + +/** + * Percent decode a single character. + * + * @param {string} str + * @param {string} hex + * @return {string} + * @private + */ + +function pdecode (str, hex) { + return String.fromCharCode(parseInt(hex, 16)) +} + +/** + * Percent encode a single character. + * + * @param {string} char + * @return {string} + * @private + */ + +function pencode (char) { + return '%' + String(char) + .charCodeAt(0) + .toString(16) + .toUpperCase() +} + +/** + * Quote a string for HTTP. + * + * @param {string} val + * @return {string} + * @private + */ + +function qstring (val) { + var str = String(val) + + return '"' + str.replace(QUOTE_REGEXP, '\\$1') + '"' +} + +/** + * Encode a Unicode string for HTTP (RFC 5987). + * + * @param {string} val + * @return {string} + * @private + */ + +function ustring (val) { + var str = String(val) + + // percent encode as UTF-8 + var encoded = encodeURIComponent(str) + .replace(ENCODE_URL_ATTR_CHAR_REGEXP, pencode) + + return 'UTF-8\'\'' + encoded +} + +/** + * Class for parsed Content-Disposition header for v8 optimization + * + * @public + * @param {string} type + * @param {object} parameters + * @constructor + */ + +function ContentDisposition (type, parameters) { + this.type = type + this.parameters = parameters +} diff --git a/node_modules/content-disposition/package.json b/node_modules/content-disposition/package.json new file mode 100644 index 0000000..5cea50b --- /dev/null +++ b/node_modules/content-disposition/package.json @@ -0,0 +1,44 @@ +{ + "name": "content-disposition", + "description": "Create and parse Content-Disposition header", + "version": "1.0.0", + "author": "Douglas Christopher Wilson ", + "license": "MIT", + "keywords": [ + "content-disposition", + "http", + "rfc6266", + "res" + ], + "repository": "jshttp/content-disposition", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "devDependencies": { + "deep-equal": "1.0.1", + "eslint": "7.32.0", + "eslint-config-standard": "13.0.1", + "eslint-plugin-import": "2.25.3", + "eslint-plugin-markdown": "2.2.1", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "5.2.0", + "eslint-plugin-standard": "4.1.0", + "mocha": "^9.2.2", + "nyc": "15.1.0" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "README.md", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + } +} diff --git a/node_modules/content-type/HISTORY.md b/node_modules/content-type/HISTORY.md new file mode 100644 index 0000000..4583671 --- /dev/null +++ b/node_modules/content-type/HISTORY.md @@ -0,0 +1,29 @@ +1.0.5 / 2023-01-29 +================== + + * perf: skip value escaping when unnecessary + +1.0.4 / 2017-09-11 +================== + + * perf: skip parameter parsing when no parameters + +1.0.3 / 2017-09-10 +================== + + * perf: remove argument reassignment + +1.0.2 / 2016-05-09 +================== + + * perf: enable strict mode + +1.0.1 / 2015-02-13 +================== + + * Improve missing `Content-Type` header error message + +1.0.0 / 2015-02-01 +================== + + * Initial implementation, derived from `media-typer@0.3.0` diff --git a/node_modules/content-type/LICENSE b/node_modules/content-type/LICENSE new file mode 100644 index 0000000..34b1a2d --- /dev/null +++ b/node_modules/content-type/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/content-type/README.md b/node_modules/content-type/README.md new file mode 100644 index 0000000..c1a922a --- /dev/null +++ b/node_modules/content-type/README.md @@ -0,0 +1,94 @@ +# content-type + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][ci-image]][ci-url] +[![Coverage Status][coveralls-image]][coveralls-url] + +Create and parse HTTP Content-Type header according to RFC 7231 + +## Installation + +```sh +$ npm install content-type +``` + +## API + +```js +var contentType = require('content-type') +``` + +### contentType.parse(string) + +```js +var obj = contentType.parse('image/svg+xml; charset=utf-8') +``` + +Parse a `Content-Type` header. This will return an object with the following +properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`): + + - `type`: The media type (the type and subtype, always lower case). + Example: `'image/svg+xml'` + + - `parameters`: An object of the parameters in the media type (name of parameter + always lower case). Example: `{charset: 'utf-8'}` + +Throws a `TypeError` if the string is missing or invalid. + +### contentType.parse(req) + +```js +var obj = contentType.parse(req) +``` + +Parse the `Content-Type` header from the given `req`. Short-cut for +`contentType.parse(req.headers['content-type'])`. + +Throws a `TypeError` if the `Content-Type` header is missing or invalid. + +### contentType.parse(res) + +```js +var obj = contentType.parse(res) +``` + +Parse the `Content-Type` header set on the given `res`. Short-cut for +`contentType.parse(res.getHeader('content-type'))`. + +Throws a `TypeError` if the `Content-Type` header is missing or invalid. + +### contentType.format(obj) + +```js +var str = contentType.format({ + type: 'image/svg+xml', + parameters: { charset: 'utf-8' } +}) +``` + +Format an object into a `Content-Type` header. This will return a string of the +content type for the given object with the following properties (examples are +shown that produce the string `'image/svg+xml; charset=utf-8'`): + + - `type`: The media type (will be lower-cased). Example: `'image/svg+xml'` + + - `parameters`: An object of the parameters in the media type (name of the + parameter will be lower-cased). Example: `{charset: 'utf-8'}` + +Throws a `TypeError` if the object contains an invalid type or parameter names. + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/jshttp/content-type/master?label=ci +[ci-url]: https://github.com/jshttp/content-type/actions/workflows/ci.yml +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/content-type/master +[coveralls-url]: https://coveralls.io/r/jshttp/content-type?branch=master +[node-image]: https://badgen.net/npm/node/content-type +[node-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/content-type +[npm-url]: https://npmjs.org/package/content-type +[npm-version-image]: https://badgen.net/npm/v/content-type diff --git a/node_modules/content-type/index.js b/node_modules/content-type/index.js new file mode 100644 index 0000000..41840e7 --- /dev/null +++ b/node_modules/content-type/index.js @@ -0,0 +1,225 @@ +/*! + * content-type + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1 + * + * parameter = token "=" ( token / quoted-string ) + * token = 1*tchar + * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" + * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" + * / DIGIT / ALPHA + * ; any VCHAR, except delimiters + * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE + * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text + * obs-text = %x80-FF + * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) + */ +var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g // eslint-disable-line no-control-regex +var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/ // eslint-disable-line no-control-regex +var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/ + +/** + * RegExp to match quoted-pair in RFC 7230 sec 3.2.6 + * + * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) + * obs-text = %x80-FF + */ +var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g // eslint-disable-line no-control-regex + +/** + * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6 + */ +var QUOTE_REGEXP = /([\\"])/g + +/** + * RegExp to match type in RFC 7231 sec 3.1.1.1 + * + * media-type = type "/" subtype + * type = token + * subtype = token + */ +var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/ + +/** + * Module exports. + * @public + */ + +exports.format = format +exports.parse = parse + +/** + * Format object to media type. + * + * @param {object} obj + * @return {string} + * @public + */ + +function format (obj) { + if (!obj || typeof obj !== 'object') { + throw new TypeError('argument obj is required') + } + + var parameters = obj.parameters + var type = obj.type + + if (!type || !TYPE_REGEXP.test(type)) { + throw new TypeError('invalid type') + } + + var string = type + + // append parameters + if (parameters && typeof parameters === 'object') { + var param + var params = Object.keys(parameters).sort() + + for (var i = 0; i < params.length; i++) { + param = params[i] + + if (!TOKEN_REGEXP.test(param)) { + throw new TypeError('invalid parameter name') + } + + string += '; ' + param + '=' + qstring(parameters[param]) + } + } + + return string +} + +/** + * Parse media type to object. + * + * @param {string|object} string + * @return {Object} + * @public + */ + +function parse (string) { + if (!string) { + throw new TypeError('argument string is required') + } + + // support req/res-like objects as argument + var header = typeof string === 'object' + ? getcontenttype(string) + : string + + if (typeof header !== 'string') { + throw new TypeError('argument string is required to be a string') + } + + var index = header.indexOf(';') + var type = index !== -1 + ? header.slice(0, index).trim() + : header.trim() + + if (!TYPE_REGEXP.test(type)) { + throw new TypeError('invalid media type') + } + + var obj = new ContentType(type.toLowerCase()) + + // parse parameters + if (index !== -1) { + var key + var match + var value + + PARAM_REGEXP.lastIndex = index + + while ((match = PARAM_REGEXP.exec(header))) { + if (match.index !== index) { + throw new TypeError('invalid parameter format') + } + + index += match[0].length + key = match[1].toLowerCase() + value = match[2] + + if (value.charCodeAt(0) === 0x22 /* " */) { + // remove quotes + value = value.slice(1, -1) + + // remove escapes + if (value.indexOf('\\') !== -1) { + value = value.replace(QESC_REGEXP, '$1') + } + } + + obj.parameters[key] = value + } + + if (index !== header.length) { + throw new TypeError('invalid parameter format') + } + } + + return obj +} + +/** + * Get content-type from req/res objects. + * + * @param {object} + * @return {Object} + * @private + */ + +function getcontenttype (obj) { + var header + + if (typeof obj.getHeader === 'function') { + // res-like + header = obj.getHeader('content-type') + } else if (typeof obj.headers === 'object') { + // req-like + header = obj.headers && obj.headers['content-type'] + } + + if (typeof header !== 'string') { + throw new TypeError('content-type header is missing from object') + } + + return header +} + +/** + * Quote a string if necessary. + * + * @param {string} val + * @return {string} + * @private + */ + +function qstring (val) { + var str = String(val) + + // no need to quote tokens + if (TOKEN_REGEXP.test(str)) { + return str + } + + if (str.length > 0 && !TEXT_REGEXP.test(str)) { + throw new TypeError('invalid parameter value') + } + + return '"' + str.replace(QUOTE_REGEXP, '\\$1') + '"' +} + +/** + * Class to represent a content type. + * @private + */ +function ContentType (type) { + this.parameters = Object.create(null) + this.type = type +} diff --git a/node_modules/content-type/package.json b/node_modules/content-type/package.json new file mode 100644 index 0000000..9db19f6 --- /dev/null +++ b/node_modules/content-type/package.json @@ -0,0 +1,42 @@ +{ + "name": "content-type", + "description": "Create and parse HTTP Content-Type header", + "version": "1.0.5", + "author": "Douglas Christopher Wilson ", + "license": "MIT", + "keywords": [ + "content-type", + "http", + "req", + "res", + "rfc7231" + ], + "repository": "jshttp/content-type", + "devDependencies": { + "deep-equal": "1.0.1", + "eslint": "8.32.0", + "eslint-config-standard": "15.0.1", + "eslint-plugin-import": "2.27.5", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "6.1.1", + "eslint-plugin-standard": "4.1.0", + "mocha": "10.2.0", + "nyc": "15.1.0" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "README.md", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec --check-leaks --bail test/", + "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "version": "node scripts/version-history.js && git add HISTORY.md" + } +} diff --git a/node_modules/cookie-signature/History.md b/node_modules/cookie-signature/History.md new file mode 100644 index 0000000..479211a --- /dev/null +++ b/node_modules/cookie-signature/History.md @@ -0,0 +1,70 @@ +1.2.2 / 2024-10-29 +================== + +* various metadata/documentation tweaks (incl. #51) + + +1.2.1 / 2023-02-27 +================== + +* update annotations for allowed secret key types (#44, thanks @jyasskin!) + + +1.2.0 / 2022-02-17 +================== + +* allow buffer and other node-supported types as key (#33) +* be pickier about extra content after signed portion (#40) +* some internal code clarity/cleanup improvements (#26) + + +1.1.0 / 2018-01-18 +================== + +* switch to built-in `crypto.timingSafeEqual` for validation instead of previous double-hash method (thank you @jodevsa!) + + +1.0.7 / 2023-04-12 +================== + +Later release for older node.js versions. See the [v1.0.x branch notes](https://github.com/tj/node-cookie-signature/blob/v1.0.x/History.md#107--2023-04-12). + + +1.0.6 / 2015-02-03 +================== + +* use `npm test` instead of `make test` to run tests +* clearer assertion messages when checking input + + +1.0.5 / 2014-09-05 +================== + +* add license to package.json + +1.0.4 / 2014-06-25 +================== + + * corrected avoidance of timing attacks (thanks @tenbits!) + +1.0.3 / 2014-01-28 +================== + + * [incorrect] fix for timing attacks + +1.0.2 / 2014-01-28 +================== + + * fix missing repository warning + * fix typo in test + +1.0.1 / 2013-04-15 +================== + + * Revert "Changed underlying HMAC algo. to sha512." + * Revert "Fix for timing attacks on MAC verification." + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/cookie-signature/LICENSE b/node_modules/cookie-signature/LICENSE new file mode 100644 index 0000000..a2671bf --- /dev/null +++ b/node_modules/cookie-signature/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2012–2024 LearnBoost and other contributors; + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/cookie-signature/Readme.md b/node_modules/cookie-signature/Readme.md new file mode 100644 index 0000000..369af15 --- /dev/null +++ b/node_modules/cookie-signature/Readme.md @@ -0,0 +1,23 @@ + +# cookie-signature + + Sign and unsign cookies. + +## Example + +```js +var cookie = require('cookie-signature'); + +var val = cookie.sign('hello', 'tobiiscool'); +val.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI'); + +var val = cookie.sign('hello', 'tobiiscool'); +cookie.unsign(val, 'tobiiscool').should.equal('hello'); +cookie.unsign(val, 'luna').should.be.false; +``` + +## License + +MIT. + +See LICENSE file for details. diff --git a/node_modules/cookie-signature/index.js b/node_modules/cookie-signature/index.js new file mode 100644 index 0000000..3fbbddb --- /dev/null +++ b/node_modules/cookie-signature/index.js @@ -0,0 +1,47 @@ +/** + * Module dependencies. + */ + +var crypto = require('crypto'); + +/** + * Sign the given `val` with `secret`. + * + * @param {String} val + * @param {String|NodeJS.ArrayBufferView|crypto.KeyObject} secret + * @return {String} + * @api private + */ + +exports.sign = function(val, secret){ + if ('string' != typeof val) throw new TypeError("Cookie value must be provided as a string."); + if (null == secret) throw new TypeError("Secret key must be provided."); + return val + '.' + crypto + .createHmac('sha256', secret) + .update(val) + .digest('base64') + .replace(/\=+$/, ''); +}; + +/** + * Unsign and decode the given `input` with `secret`, + * returning `false` if the signature is invalid. + * + * @param {String} input + * @param {String|NodeJS.ArrayBufferView|crypto.KeyObject} secret + * @return {String|Boolean} + * @api private + */ + +exports.unsign = function(input, secret){ + if ('string' != typeof input) throw new TypeError("Signed cookie string must be provided."); + if (null == secret) throw new TypeError("Secret key must be provided."); + var tentativeValue = input.slice(0, input.lastIndexOf('.')), + expectedInput = exports.sign(tentativeValue, secret), + expectedBuffer = Buffer.from(expectedInput), + inputBuffer = Buffer.from(input); + return ( + expectedBuffer.length === inputBuffer.length && + crypto.timingSafeEqual(expectedBuffer, inputBuffer) + ) ? tentativeValue : false; +}; diff --git a/node_modules/cookie-signature/package.json b/node_modules/cookie-signature/package.json new file mode 100644 index 0000000..a160040 --- /dev/null +++ b/node_modules/cookie-signature/package.json @@ -0,0 +1,24 @@ +{ + "name": "cookie-signature", + "version": "1.2.2", + "main": "index.js", + "description": "Sign and unsign cookies", + "keywords": ["cookie", "sign", "unsign"], + "author": "TJ Holowaychuk ", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/visionmedia/node-cookie-signature.git" + }, + "dependencies": {}, + "engines": { + "node": ">=6.6.0" + }, + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "scripts": { + "test": "mocha --require should --reporter spec" + } +} diff --git a/node_modules/cookie/LICENSE b/node_modules/cookie/LICENSE new file mode 100644 index 0000000..058b6b4 --- /dev/null +++ b/node_modules/cookie/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2012-2014 Roman Shtylman +Copyright (c) 2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/cookie/README.md b/node_modules/cookie/README.md new file mode 100644 index 0000000..71fdac1 --- /dev/null +++ b/node_modules/cookie/README.md @@ -0,0 +1,317 @@ +# cookie + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][ci-image]][ci-url] +[![Coverage Status][coveralls-image]][coveralls-url] + +Basic HTTP cookie parser and serializer for HTTP servers. + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install cookie +``` + +## API + +```js +var cookie = require('cookie'); +``` + +### cookie.parse(str, options) + +Parse an HTTP `Cookie` header string and returning an object of all cookie name-value pairs. +The `str` argument is the string representing a `Cookie` header value and `options` is an +optional object containing additional parsing options. + +```js +var cookies = cookie.parse('foo=bar; equation=E%3Dmc%5E2'); +// { foo: 'bar', equation: 'E=mc^2' } +``` + +#### Options + +`cookie.parse` accepts these properties in the options object. + +##### decode + +Specifies a function that will be used to decode a cookie's value. Since the value of a cookie +has a limited character set (and must be a simple string), this function can be used to decode +a previously-encoded cookie value into a JavaScript string or other object. + +The default function is the global `decodeURIComponent`, which will decode any URL-encoded +sequences into their byte representations. + +**note** if an error is thrown from this function, the original, non-decoded cookie value will +be returned as the cookie's value. + +### cookie.serialize(name, value, options) + +Serialize a cookie name-value pair into a `Set-Cookie` header string. The `name` argument is the +name for the cookie, the `value` argument is the value to set the cookie to, and the `options` +argument is an optional object containing additional serialization options. + +```js +var setCookie = cookie.serialize('foo', 'bar'); +// foo=bar +``` + +#### Options + +`cookie.serialize` accepts these properties in the options object. + +##### domain + +Specifies the value for the [`Domain` `Set-Cookie` attribute][rfc-6265-5.2.3]. By default, no +domain is set, and most clients will consider the cookie to apply to only the current domain. + +##### encode + +Specifies a function that will be used to encode a cookie's value. Since value of a cookie +has a limited character set (and must be a simple string), this function can be used to encode +a value into a string suited for a cookie's value. + +The default function is the global `encodeURIComponent`, which will encode a JavaScript string +into UTF-8 byte sequences and then URL-encode any that fall outside of the cookie range. + +##### expires + +Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute][rfc-6265-5.2.1]. +By default, no expiration is set, and most clients will consider this a "non-persistent cookie" and +will delete it on a condition like exiting a web browser application. + +**note** the [cookie storage model specification][rfc-6265-5.3] states that if both `expires` and +`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, +so if both are set, they should point to the same date and time. + +##### httpOnly + +Specifies the `boolean` value for the [`HttpOnly` `Set-Cookie` attribute][rfc-6265-5.2.6]. When truthy, +the `HttpOnly` attribute is set, otherwise it is not. By default, the `HttpOnly` attribute is not set. + +**note** be careful when setting this to `true`, as compliant clients will not allow client-side +JavaScript to see the cookie in `document.cookie`. + +##### maxAge + +Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute][rfc-6265-5.2.2]. +The given number will be converted to an integer by rounding down. By default, no maximum age is set. + +**note** the [cookie storage model specification][rfc-6265-5.3] states that if both `expires` and +`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, +so if both are set, they should point to the same date and time. + +##### partitioned + +Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`](rfc-cutler-httpbis-partitioned-cookies) +attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not. By default, the +`Partitioned` attribute is not set. + +**note** This is an attribute that has not yet been fully standardized, and may change in the future. +This also means many clients may ignore this attribute until they understand it. + +More information about can be found in [the proposal](https://github.com/privacycg/CHIPS). + +##### path + +Specifies the value for the [`Path` `Set-Cookie` attribute][rfc-6265-5.2.4]. By default, the path +is considered the ["default path"][rfc-6265-5.1.4]. + +##### priority + +Specifies the `string` to be the value for the [`Priority` `Set-Cookie` attribute][rfc-west-cookie-priority-00-4.1]. + + - `'low'` will set the `Priority` attribute to `Low`. + - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set. + - `'high'` will set the `Priority` attribute to `High`. + +More information about the different priority levels can be found in +[the specification][rfc-west-cookie-priority-00-4.1]. + +**note** This is an attribute that has not yet been fully standardized, and may change in the future. +This also means many clients may ignore this attribute until they understand it. + +##### sameSite + +Specifies the `boolean` or `string` to be the value for the [`SameSite` `Set-Cookie` attribute][rfc-6265bis-09-5.4.7]. + + - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement. + - `false` will not set the `SameSite` attribute. + - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement. + - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie. + - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement. + +More information about the different enforcement levels can be found in +[the specification][rfc-6265bis-09-5.4.7]. + +**note** This is an attribute that has not yet been fully standardized, and may change in the future. +This also means many clients may ignore this attribute until they understand it. + +##### secure + +Specifies the `boolean` value for the [`Secure` `Set-Cookie` attribute][rfc-6265-5.2.5]. When truthy, +the `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set. + +**note** be careful when setting this to `true`, as compliant clients will not send the cookie back to +the server in the future if the browser does not have an HTTPS connection. + +## Example + +The following example uses this module in conjunction with the Node.js core HTTP server +to prompt a user for their name and display it back on future visits. + +```js +var cookie = require('cookie'); +var escapeHtml = require('escape-html'); +var http = require('http'); +var url = require('url'); + +function onRequest(req, res) { + // Parse the query string + var query = url.parse(req.url, true, true).query; + + if (query && query.name) { + // Set a new cookie with the name + res.setHeader('Set-Cookie', cookie.serialize('name', String(query.name), { + httpOnly: true, + maxAge: 60 * 60 * 24 * 7 // 1 week + })); + + // Redirect back after setting cookie + res.statusCode = 302; + res.setHeader('Location', req.headers.referer || '/'); + res.end(); + return; + } + + // Parse the cookies on the request + var cookies = cookie.parse(req.headers.cookie || ''); + + // Get the visitor name set in the cookie + var name = cookies.name; + + res.setHeader('Content-Type', 'text/html; charset=UTF-8'); + + if (name) { + res.write('

Welcome back, ' + escapeHtml(name) + '!

'); + } else { + res.write('

Hello, new visitor!

'); + } + + res.write('
'); + res.write(' '); + res.end('
'); +} + +http.createServer(onRequest).listen(3000); +``` + +## Testing + +```sh +$ npm test +``` + +## Benchmark + +``` +$ npm run bench + +> cookie@0.5.0 bench +> node benchmark/index.js + + node@18.18.2 + acorn@8.10.0 + ada@2.6.0 + ares@1.19.1 + brotli@1.0.9 + cldr@43.1 + icu@73.2 + llhttp@6.0.11 + modules@108 + napi@9 + nghttp2@1.57.0 + nghttp3@0.7.0 + ngtcp2@0.8.1 + openssl@3.0.10+quic + simdutf@3.2.14 + tz@2023c + undici@5.26.3 + unicode@15.0 + uv@1.44.2 + uvwasi@0.0.18 + v8@10.2.154.26-node.26 + zlib@1.2.13.1-motley + +> node benchmark/parse-top.js + + cookie.parse - top sites + + 14 tests completed. + + parse accounts.google.com x 2,588,913 ops/sec ±0.74% (186 runs sampled) + parse apple.com x 2,370,002 ops/sec ±0.69% (186 runs sampled) + parse cloudflare.com x 2,213,102 ops/sec ±0.88% (188 runs sampled) + parse docs.google.com x 2,194,157 ops/sec ±1.03% (184 runs sampled) + parse drive.google.com x 2,265,084 ops/sec ±0.79% (187 runs sampled) + parse en.wikipedia.org x 457,099 ops/sec ±0.81% (186 runs sampled) + parse linkedin.com x 504,407 ops/sec ±0.89% (186 runs sampled) + parse maps.google.com x 1,230,959 ops/sec ±0.98% (186 runs sampled) + parse microsoft.com x 926,294 ops/sec ±0.88% (184 runs sampled) + parse play.google.com x 2,311,338 ops/sec ±0.83% (185 runs sampled) + parse support.google.com x 1,508,850 ops/sec ±0.86% (186 runs sampled) + parse www.google.com x 1,022,582 ops/sec ±1.32% (182 runs sampled) + parse youtu.be x 332,136 ops/sec ±1.02% (185 runs sampled) + parse youtube.com x 323,833 ops/sec ±0.77% (183 runs sampled) + +> node benchmark/parse.js + + cookie.parse - generic + + 6 tests completed. + + simple x 3,214,032 ops/sec ±1.61% (183 runs sampled) + decode x 587,237 ops/sec ±1.16% (187 runs sampled) + unquote x 2,954,618 ops/sec ±1.35% (183 runs sampled) + duplicates x 857,008 ops/sec ±0.89% (187 runs sampled) + 10 cookies x 292,133 ops/sec ±0.89% (187 runs sampled) + 100 cookies x 22,610 ops/sec ±0.68% (187 runs sampled) +``` + +## References + +- [RFC 6265: HTTP State Management Mechanism][rfc-6265] +- [Same-site Cookies][rfc-6265bis-09-5.4.7] + +[rfc-cutler-httpbis-partitioned-cookies]: https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/ +[rfc-west-cookie-priority-00-4.1]: https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1 +[rfc-6265bis-09-5.4.7]: https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7 +[rfc-6265]: https://tools.ietf.org/html/rfc6265 +[rfc-6265-5.1.4]: https://tools.ietf.org/html/rfc6265#section-5.1.4 +[rfc-6265-5.2.1]: https://tools.ietf.org/html/rfc6265#section-5.2.1 +[rfc-6265-5.2.2]: https://tools.ietf.org/html/rfc6265#section-5.2.2 +[rfc-6265-5.2.3]: https://tools.ietf.org/html/rfc6265#section-5.2.3 +[rfc-6265-5.2.4]: https://tools.ietf.org/html/rfc6265#section-5.2.4 +[rfc-6265-5.2.5]: https://tools.ietf.org/html/rfc6265#section-5.2.5 +[rfc-6265-5.2.6]: https://tools.ietf.org/html/rfc6265#section-5.2.6 +[rfc-6265-5.3]: https://tools.ietf.org/html/rfc6265#section-5.3 + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/jshttp/cookie/master?label=ci +[ci-url]: https://github.com/jshttp/cookie/actions/workflows/ci.yml +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/cookie/master +[coveralls-url]: https://coveralls.io/r/jshttp/cookie?branch=master +[node-image]: https://badgen.net/npm/node/cookie +[node-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/cookie +[npm-url]: https://npmjs.org/package/cookie +[npm-version-image]: https://badgen.net/npm/v/cookie diff --git a/node_modules/cookie/SECURITY.md b/node_modules/cookie/SECURITY.md new file mode 100644 index 0000000..fd4a6c5 --- /dev/null +++ b/node_modules/cookie/SECURITY.md @@ -0,0 +1,25 @@ +# Security Policies and Procedures + +## Reporting a Bug + +The `cookie` team and community take all security bugs seriously. Thank +you for improving the security of the project. We appreciate your efforts and +responsible disclosure and will make every effort to acknowledge your +contributions. + +Report security bugs by emailing the current owner(s) of `cookie`. This +information can be found in the npm registry using the command +`npm owner ls cookie`. +If unsure or unable to get the information from the above, open an issue +in the [project issue tracker](https://github.com/jshttp/cookie/issues) +asking for the current contact information. + +To ensure the timely response to your report, please ensure that the entirety +of the report is contained within the email body and not solely behind a web +link or an attachment. + +At least one owner will acknowledge your email within 48 hours, and will send a +more detailed response within 48 hours indicating the next steps in handling +your report. After the initial reply to your report, the owners will +endeavor to keep you informed of the progress towards a fix and full +announcement, and may ask for additional information or guidance. diff --git a/node_modules/cookie/index.js b/node_modules/cookie/index.js new file mode 100644 index 0000000..acd5acd --- /dev/null +++ b/node_modules/cookie/index.js @@ -0,0 +1,335 @@ +/*! + * cookie + * Copyright(c) 2012-2014 Roman Shtylman + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +exports.parse = parse; +exports.serialize = serialize; + +/** + * Module variables. + * @private + */ + +var __toString = Object.prototype.toString +var __hasOwnProperty = Object.prototype.hasOwnProperty + +/** + * RegExp to match cookie-name in RFC 6265 sec 4.1.1 + * This refers out to the obsoleted definition of token in RFC 2616 sec 2.2 + * which has been replaced by the token definition in RFC 7230 appendix B. + * + * cookie-name = token + * token = 1*tchar + * tchar = "!" / "#" / "$" / "%" / "&" / "'" / + * "*" / "+" / "-" / "." / "^" / "_" / + * "`" / "|" / "~" / DIGIT / ALPHA + */ + +var cookieNameRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/; + +/** + * RegExp to match cookie-value in RFC 6265 sec 4.1.1 + * + * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE ) + * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E + * ; US-ASCII characters excluding CTLs, + * ; whitespace DQUOTE, comma, semicolon, + * ; and backslash + */ + +var cookieValueRegExp = /^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/; + +/** + * RegExp to match domain-value in RFC 6265 sec 4.1.1 + * + * domain-value = + * ; defined in [RFC1034], Section 3.5, as + * ; enhanced by [RFC1123], Section 2.1 + * =